quickvo-player 0.3.6 → 0.3.9
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/dist/index.js +165 -143
- package/dist/index.umd.cjs +3 -5
- package/package.json +6 -5
package/dist/index.umd.cjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`quickvo-player`]={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t){return typeof e==`object`&&e&&`$typeName`in e&&typeof e.$typeName==`string`?t===void 0?!0:t.typeName===e.$typeName:!1}var n;(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`})(n||={});function r(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(n&15)<<28,t=(n&112)>>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}throw Error(`invalid varint`)}var i=4294967296;function a(e){let t=e[0]===`-`;t&&(e=e.slice(1));let n=1e6,r=0,a=0;function o(t,o){let s=Number(e.slice(t,o));a*=n,r=r*n+s,r>=i&&(a+=r/i|0,r%=i)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),t?u(r,a):l(r,a)}function o(e,t){let n=l(e,t),r=n.hi&2147483648;r&&(n=u(n.lo,n.hi));let i=s(n.lo,n.hi);return r?`-`+i:i}function s(e,t){if({lo:e,hi:t}=c(e,t),t<=2097151)return String(i*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,a=t>>16&65535,o=n+r*6777216+a*6710656,s=r+a*8147497,l=a*2,u=1e7;return o>=u&&(s+=Math.floor(o/u),o%=u),s>=u&&(l+=Math.floor(s/u),s%=u),l.toString()+ee(s)+ee(o)}function c(e,t){return{lo:e>>>0,hi:t>>>0}}function l(e,t){return{lo:e|0,hi:t|0}}function u(e,t){return t=~t,e?e=~e+1:t+=1,l(e,t)}var ee=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function te(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}function ne(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}var d=re();function re(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(globalThis.Deno||typeof process!=`object`||typeof process.env!=`object`||process.env.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||r<t)throw Error(`invalid int64: ${e}`);return r},uParse(e){let t=typeof e==`bigint`?e:BigInt(e);if(t>i||t<r)throw Error(`invalid uint64: ${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,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)},uDec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0)}}}return{zero:`0`,supported:!1,parse(e){return typeof e!=`string`&&(e=e.toString()),ie(e),e},uParse(e){return typeof e!=`string`&&(e=e.toString()),ae(e),e},enc(e){return typeof e!=`string`&&(e=e.toString()),ie(e),a(e)},uEnc(e){return typeof e!=`string`&&(e=e.toString()),ae(e),a(e)},dec(e,t){return o(e,t)},uDec(e,t){return s(e,t)}}}function ie(e){if(!/^-?[0-9]+$/.test(e))throw Error(`invalid int64: `+e)}function ae(e){if(!/^[0-9]+$/.test(e))throw Error(`invalid uint64: `+e)}function f(e,t){switch(e){case n.STRING:return``;case n.BOOL:return!1;case n.DOUBLE:case n.FLOAT:return 0;case n.INT64:case n.UINT64:case n.SFIXED64:case n.FIXED64:case n.SINT64:return t?`0`:d.zero;case n.BYTES:return new Uint8Array;default:return 0}}function oe(e,t){switch(e){case n.BOOL:return t===!1;case n.STRING:return t===``;case n.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}var se=2,p=Symbol.for(`reflect unsafe local`);function ce(e,t){let n=e[t.localName].case;return n===void 0?n:t.fields.find(e=>e.localName===n)}function le(e,t){let n=t.localName;if(t.oneof)return e[t.oneof.localName].case===n;if(t.presence!=se)return e[n]!==void 0&&Object.prototype.hasOwnProperty.call(e,n);switch(t.fieldKind){case`list`:return e[n].length>0;case`map`:return Object.keys(e[n]).length>0;case`scalar`:return!oe(t.scalar,e[n]);case`enum`:return e[n]!==t.enum.values[0].number}throw Error(`message field with implicit presence`)}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0}function ue(e,t){if(t.oneof){let n=e[t.oneof.localName];return n.case===t.localName?n.value:void 0}return e[t.localName]}function de(e,t,n){t.oneof?e[t.oneof.localName]={case:t.localName,value:n}:e[t.localName]=n}function fe(e,t){let n=t.localName;if(t.oneof){let r=t.oneof.localName;e[r].case===n&&(e[r]={case:void 0})}else if(t.presence!=se)delete e[n];else switch(t.fieldKind){case`map`:e[n]={};break;case`list`:e[n]=[];break;case`enum`:e[n]=t.enum.values[0].number;break;case`scalar`:e[n]=f(t.scalar,t.longAsString);break}}function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g(e,t){if(h(e)&&p in e&&`add`in e&&`field`in e&&typeof e.field==`function`){if(t!==void 0){let n=t,r=e.field();return n.listKind==r.listKind&&n.scalar===r.scalar&&n.message?.typeName===r.message?.typeName&&n.enum?.typeName===r.enum?.typeName}return!0}return!1}function pe(e,t){if(h(e)&&p in e&&`has`in e&&`field`in e&&typeof e.field==`function`){if(t!==void 0){let n=t,r=e.field();return n.mapKey===r.mapKey&&n.mapKind==r.mapKind&&n.scalar===r.scalar&&n.message?.typeName===r.message?.typeName&&n.enum?.typeName===r.enum?.typeName}return!0}return!1}function _(e,t){return h(e)&&p in e&&`desc`in e&&h(e.desc)&&e.desc.kind===`message`&&(t===void 0||e.desc.typeName==t.typeName)}function me(e){return ge(e.$typeName)}function he(e){let t=e.fields[0];return ge(e.typeName)&&t!==void 0&&t.fieldKind==`scalar`&&t.name==`value`&&t.number==1}function ge(e){return e.startsWith(`google.protobuf.`)&&[`DoubleValue`,`FloatValue`,`Int64Value`,`UInt64Value`,`Int32Value`,`UInt32Value`,`BoolValue`,`StringValue`,`BytesValue`].includes(e.substring(16))}var _e=999,ve=998,v=2;function ye(e,n){if(t(n,e))return n;let r=De(e);return n!==void 0&&be(e,r,n),r}function be(e,t,n){for(let r of e.members){let e=n[r.localName];if(e==null)continue;let i;if(r.kind==`oneof`){let t=ce(n,r);if(!t)continue;i=t,e=ue(n,t)}else i=r;switch(i.fieldKind){case`message`:e=y(i,e);break;case`scalar`:e=xe(i,e);break;case`list`:e=Ce(i,e);break;case`map`:e=Se(i,e);break}de(t,i,e)}return t}function xe(e,t){return e.scalar==n.BYTES?b(t):t}function Se(e,t){if(h(t)){if(e.scalar==n.BYTES)return we(t,b);if(e.mapKind==`message`)return we(t,t=>y(e,t))}return t}function Ce(e,t){if(Array.isArray(t)){if(e.scalar==n.BYTES)return t.map(b);if(e.listKind==`message`)return t.map(t=>y(e,t))}return t}function y(e,n){if(e.fieldKind==`message`&&!e.oneof&&he(e.message))return xe(e.message.fields[0],n);if(h(n)){if(e.message.typeName==`google.protobuf.Struct`&&e.parent.typeName!==`google.protobuf.Value`)return n;if(!t(n,e.message))return ye(e.message,n)}return n}function b(e){return Array.isArray(e)?new Uint8Array(e):e}function we(e,t){let n={};for(let r of Object.entries(e))n[r[0]]=t(r[1]);return n}var Te=Symbol(),Ee=new WeakMap;function De(e){let t;if(Oe(e)){let n=Ee.get(e),r,i;if(n)({prototype:r,members:i}=n);else{r={},i=new Set;for(let t of e.members)t.kind!=`oneof`&&(t.fieldKind!=`scalar`&&t.fieldKind!=`enum`||t.presence!=v&&(i.add(t),r[t.localName]=x(t)));Ee.set(e,{prototype:r,members:i})}t=Object.create(r),t.$typeName=e.typeName;for(let n of e.members)i.has(n)||n.kind==`field`&&(n.fieldKind==`message`||(n.fieldKind==`scalar`||n.fieldKind==`enum`)&&n.presence!=v)||(t[n.localName]=x(n))}else{t={$typeName:e.typeName};for(let n of e.members)(n.kind==`oneof`||n.presence==v)&&(t[n.localName]=x(n))}return t}function Oe(e){switch(e.file.edition){case _e:return!1;case ve:return!0;default:return e.fields.some(e=>e.presence!=v&&e.fieldKind!=`message`&&!e.oneof)}}function x(e){if(e.kind==`oneof`)return{case:void 0};if(e.fieldKind==`list`)return[];if(e.fieldKind==`map`)return{};if(e.fieldKind==`message`)return Te;let t=e.getDefaultValue();return t===void 0?e.fieldKind==`scalar`?f(e.scalar,e.longAsString):e.enum.values[0].number:e.fieldKind==`scalar`&&e.longAsString?t.toString():t}var S=class extends Error{constructor(e,t,n=`FieldValueInvalidError`){super(t),this.name=n,this.field=()=>e}},ke=Symbol.for(`@bufbuild/protobuf/text-encoding`);function Ae(){if(globalThis[ke]==null){let e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[ke]={encodeUtf8(t){return e.encode(t)},decodeUtf8(e){return t.decode(e)},checkUtf8(e){try{return!0}catch{return!1}}}}return globalThis[ke]}var C;(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`})(C||={});var je=class{constructor(e,t=Ae().decodeUtf8){this.decodeUtf8=t,this.varint64=r,this.uint32=ne,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case C.Varint:for(;this.buf[this.pos++]&128;);break;case C.Bit64:this.pos+=4;case C.Bit32:this.pos+=4;break;case C.LengthDelimited:let n=this.uint32();this.pos+=n;break;case C.StartGroup:for(;;){let[e,n]=this.tag();if(n===C.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(n,e)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return d.dec(...this.varint64())}uint64(){return d.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,d.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return d.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return d.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.decodeUtf8(this.bytes())}};function Me(e,t){let n=e.fieldKind==`list`?g(t,e):e.fieldKind==`map`?pe(t,e):Fe(e,t);if(n===!0)return;let r;switch(e.fieldKind){case`list`:r=`expected ${Re(e)}, got ${T(t)}`;break;case`map`:r=`expected ${ze(e)}, got ${T(t)}`;break;default:r=w(e,t,n)}return new S(e,r)}function Ne(e,t,n){let r=Fe(e,n);if(r!==!0)return new S(e,`list item #${t+1}: ${w(e,n,r)}`)}function Pe(e,t,n){let r=Ie(t,e.mapKey);if(r!==!0)return new S(e,`invalid map key: ${w({scalar:e.mapKey},t,r)}`);let i=Fe(e,n);if(i!==!0)return new S(e,`map entry ${T(t)}: ${w(e,n,i)}`)}function Fe(e,t){return e.scalar===void 0?e.enum===void 0?_(t,e.message):e.enum.open?Number.isInteger(t):e.enum.values.some(e=>e.number===t):Ie(t,e.scalar)}function Ie(e,t){switch(t){case n.DOUBLE:return typeof e==`number`;case n.FLOAT:return typeof e==`number`?Number.isNaN(e)||!Number.isFinite(e)?!0:e>34028234663852886e22||e<-34028234663852886e22?`${e.toFixed()} out of range`:!0:!1;case n.INT32:case n.SFIXED32:case n.SINT32:return typeof e!=`number`||!Number.isInteger(e)?!1:e>2147483647||e<-2147483648?`${e.toFixed()} out of range`:!0;case n.FIXED32:case n.UINT32:return typeof e!=`number`||!Number.isInteger(e)?!1:e>4294967295||e<0?`${e.toFixed()} out of range`:!0;case n.BOOL:return typeof e==`boolean`;case n.STRING:return typeof e==`string`?Ae().checkUtf8(e)||`invalid UTF8`:!1;case n.BYTES:return e instanceof Uint8Array;case n.INT64:case n.SFIXED64:case n.SINT64:if(typeof e==`bigint`||typeof e==`number`||typeof e==`string`&&e.length>0)try{return d.parse(e),!0}catch{return`${e} out of range`}return!1;case n.FIXED64:case n.UINT64:if(typeof e==`bigint`||typeof e==`number`||typeof e==`string`&&e.length>0)try{return d.uParse(e),!0}catch{return`${e} out of range`}return!1}}function w(e,t,n){return n=typeof n==`string`?`: ${n}`:`, got ${T(t)}`,e.scalar===void 0?e.enum===void 0?`expected ${Le(e.message)}`+n:`expected ${e.enum.toString()}`+n:`expected ${Be(e.scalar)}`+n}function T(e){switch(typeof e){case`object`:return e===null?`null`:e instanceof Uint8Array?`Uint8Array(${e.length})`:Array.isArray(e)?`Array(${e.length})`:g(e)?Re(e.field()):pe(e)?ze(e.field()):_(e)?Le(e.desc):t(e)?`message ${e.$typeName}`:`object`;case`string`:return e.length>30?`string`:`"${e.split(`"`).join(`\\"`)}"`;case`boolean`:return String(e);case`number`:return String(e);case`bigint`:return String(e)+`n`;default:return typeof e}}function Le(e){return`ReflectMessage (${e.typeName})`}function Re(e){switch(e.listKind){case`message`:return`ReflectList (${e.message.toString()})`;case`enum`:return`ReflectList (${e.enum.toString()})`;case`scalar`:return`ReflectList (${n[e.scalar]})`}}function ze(e){switch(e.mapKind){case`message`:return`ReflectMap (${n[e.mapKey]}, ${e.message.toString()})`;case`enum`:return`ReflectMap (${n[e.mapKey]}, ${e.enum.toString()})`;case`scalar`:return`ReflectMap (${n[e.mapKey]}, ${n[e.scalar]})`}}function Be(e){switch(e){case n.STRING:return`string`;case n.BOOL:return`boolean`;case n.INT64:case n.SINT64:case n.SFIXED64:return`bigint (int64)`;case n.UINT64:case n.FIXED64:return`bigint (uint64)`;case n.BYTES:return`Uint8Array`;case n.DOUBLE:return`number (float64)`;case n.FLOAT:return`number (float32)`;case n.FIXED32:case n.UINT32:return`number (uint32)`;case n.INT32:case n.SFIXED32:case n.SINT32:return`number (int32)`}}function E(e,t,n=!0){return new He(e,t,n)}var Ve=new WeakMap,He=class{get sortedFields(){let e=Ve.get(this.desc);if(e)return e;let t=this.desc.fields.concat().sort((e,t)=>e.number-t.number);return Ve.set(this.desc,t),t}constructor(e,t,n=!0){this.lists=new Map,this.maps=new Map,this.check=n,this.desc=e,this.message=this[p]=t??ye(e),this.fields=e.fields,this.oneofs=e.oneofs,this.members=e.members}findNumber(e){return this._fieldsByNumber||=new Map(this.desc.fields.map(e=>[e.number,e])),this._fieldsByNumber.get(e)}oneofCase(e){return D(this.message,e),ce(this.message,e)}isSet(e){return D(this.message,e),le(this.message,e)}clear(e){D(this.message,e),fe(this.message,e)}get(e){D(this.message,e);let t=ue(this.message,e);switch(e.fieldKind){case`list`:let n=this.lists.get(e);return(!n||n[p]!==t)&&this.lists.set(e,n=new Ue(e,t,this.check)),n;case`map`:let r=this.maps.get(e);return(!r||r[p]!==t)&&this.maps.set(e,r=new We(e,t,this.check)),r;case`message`:return k(e,t,this.check);case`scalar`:return t===void 0?f(e.scalar,!1):N(e,t);case`enum`:return t??e.enum.values[0].number}}set(e,t){if(D(this.message,e),this.check){let n=Me(e,t);if(n)throw n}let n;n=e.fieldKind==`message`?O(e,t):pe(t)||g(t)?t[p]:P(e,t),de(this.message,e,n)}getUnknown(){return this.message.$unknown}setUnknown(e){this.message.$unknown=e}};function D(e,t){if(t.parent.typeName!==e.$typeName)throw new S(t,`cannot use ${t.toString()} with message ${e.$typeName}`,`ForeignFieldError`)}var Ue=class{field(){return this._field}get size(){return this._arr.length}constructor(e,t,n){this._field=e,this._arr=this[p]=t,this.check=n}get(e){let t=this._arr[e];return t===void 0?void 0:A(this._field,t,this.check)}set(e,t){if(e<0||e>=this._arr.length)throw new S(this._field,`list item #${e+1}: out of range`);if(this.check){let n=Ne(this._field,e,t);if(n)throw n}this._arr[e]=Ge(this._field,t)}add(e){if(this.check){let t=Ne(this._field,this._arr.length,e);if(t)throw t}this._arr.push(Ge(this._field,e))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let e of this._arr)yield A(this._field,e,this.check)}*entries(){for(let e=0;e<this._arr.length;e++)yield[e,A(this._field,this._arr[e],this.check)]}},We=class{constructor(e,t,n=!0){this.obj=this[p]=t??{},this.check=n,this._field=e}field(){return this._field}set(e,t){if(this.check){let n=Pe(this._field,e,t);if(n)throw n}return this.obj[M(e)]=Ke(this._field,t),this}delete(e){let t=M(e),n=Object.prototype.hasOwnProperty.call(this.obj,t);return n&&delete this.obj[t],n}clear(){for(let e of Object.keys(this.obj))delete this.obj[e]}get(e){let t=this.obj[M(e)];return t!==void 0&&(t=j(this._field,t,this.check)),t}has(e){return Object.prototype.hasOwnProperty.call(this.obj,M(e))}*keys(){for(let e of Object.keys(this.obj))yield qe(e,this._field.mapKey)}*entries(){for(let e of Object.entries(this.obj))yield[qe(e[0],this._field.mapKey),j(this._field,e[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let e of Object.values(this.obj))yield j(this._field,e,this.check)}forEach(e,t){for(let n of this.entries())e.call(t,n[1],n[0],this)}};function O(e,t){return _(t)?me(t.message)&&!e.oneof&&e.fieldKind==`message`?t.message.value:t.desc.typeName==`google.protobuf.Struct`&&e.parent.typeName!=`google.protobuf.Value`?Ye(t.message):t.message:t}function k(e,t,n){return t!==void 0&&(he(e.message)&&!e.oneof&&e.fieldKind==`message`?t={$typeName:e.message.typeName,value:N(e.message.fields[0],t)}:e.message.typeName==`google.protobuf.Struct`&&e.parent.typeName!=`google.protobuf.Value`&&h(t)&&(t=Je(t))),new He(e.message,t,n)}function Ge(e,t){return e.listKind==`message`?O(e,t):P(e,t)}function A(e,t,n){return e.listKind==`message`?k(e,t,n):N(e,t)}function Ke(e,t){return e.mapKind==`message`?O(e,t):P(e,t)}function j(e,t,n){return e.mapKind==`message`?k(e,t,n):t}function M(e){return typeof e==`string`||typeof e==`number`?e:String(e)}function qe(e,t){switch(t){case n.STRING:return e;case n.INT32:case n.FIXED32:case n.UINT32:case n.SFIXED32:case n.SINT32:{let t=Number.parseInt(e);if(Number.isFinite(t))return t;break}case n.BOOL:switch(e){case`true`:return!0;case`false`:return!1}break;case n.UINT64:case n.FIXED64:try{return d.uParse(e)}catch{}break;default:try{return d.parse(e)}catch{}break}return e}function N(e,t){switch(e.scalar){case n.INT64:case n.SFIXED64:case n.SINT64:`longAsString`in e&&e.longAsString&&typeof t==`string`&&(t=d.parse(t));break;case n.FIXED64:case n.UINT64:`longAsString`in e&&e.longAsString&&typeof t==`string`&&(t=d.uParse(t));break}return t}function P(e,t){switch(e.scalar){case n.INT64:case n.SFIXED64:case n.SINT64:`longAsString`in e&&e.longAsString?t=String(t):(typeof t==`string`||typeof t==`number`)&&(t=d.parse(t));break;case n.FIXED64:case n.UINT64:`longAsString`in e&&e.longAsString?t=String(t):(typeof t==`string`||typeof t==`number`)&&(t=d.uParse(t));break}return t}function Je(e){let t={$typeName:`google.protobuf.Struct`,fields:{}};if(h(e))for(let[n,r]of Object.entries(e))t.fields[n]=Ze(r);return t}function Ye(e){let t={};for(let[n,r]of Object.entries(e.fields))t[n]=Xe(r);return t}function Xe(e){switch(e.kind.case){case`structValue`:return Ye(e.kind.value);case`listValue`:return e.kind.value.values.map(Xe);case`nullValue`:case void 0:return null;default:return e.kind.value}}function Ze(e){let t={$typeName:`google.protobuf.Value`,kind:{case:void 0}};switch(typeof e){case`number`:t.kind={case:`numberValue`,value:e};break;case`string`:t.kind={case:`stringValue`,value:e};break;case`boolean`:t.kind={case:`boolValue`,value:e};break;case`object`:if(e===null)t.kind={case:`nullValue`,value:0};else if(Array.isArray(e)){let n={$typeName:`google.protobuf.ListValue`,values:[]};if(Array.isArray(e))for(let t of e)n.values.push(Ze(t));t.kind={case:`listValue`,value:n}}else t.kind={case:`structValue`,value:Je(e)};break}return t}function Qe(e){let t=tt(),n=e.length*3/4;e[e.length-2]==`=`?n-=2:e[e.length-1]==`=`&&--n;let r=new Uint8Array(n),i=0,a=0,o,s=0;for(let n=0;n<e.length;n++){if(o=t[e.charCodeAt(n)],o===void 0)switch(e[n]){case`=`:a=0;case`
|
|
2
|
-
`:case`\r`:case` `:case` `:continue;default:throw Error(`invalid base64 string`)}switch(a){case 0:s=o,a=1;break;case 1:r[i++]=s<<2|(o&48)>>4,s=o,a=2;break;case 2:r[i++]=(s&15)<<4|(o&60)>>2,s=o,a=3;break;case 3:r[i++]=(s&3)<<6|o,a=0;break}}if(a==1)throw Error(`invalid base64 string`);return r.subarray(0,i)}var F,$e,I;function et(e){return F||(F=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),$e=F.slice(0,-2).concat(`-`,`_`)),e==`url`?$e:F}function tt(){if(!I){I=[];let e=et(`std`);for(let t=0;t<e.length;t++)I[e[t].charCodeAt(0)]=t;I[45]=e.indexOf(`+`),I[95]=e.indexOf(`/`)}return I}function L(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=e.charAt(r);switch(i){case`_`:t=!0;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n.push(i),t=!1;break;default:t&&(t=!1,i=i.toUpperCase()),n.push(i);break}}return n.join(``)}var nt=new Set([`constructor`,`toString`,`toJSON`,`valueOf`]);function R(e){return nt.has(e)?e+`$`:e}function z(e){for(let t of e.field)m(t,`jsonName`)||(t.jsonName=L(t.name));e.nestedType.forEach(z)}function rt(e,t){let n=e.values.find(e=>e.name===t);if(!n)throw Error(`cannot parse ${e} default value: ${t}`);return n.number}function it(e,t){switch(e){case n.STRING:return t;case n.BYTES:{let r=at(t);if(r===!1)throw Error(`cannot parse ${n[e]} default value: ${t}`);return r}case n.INT64:case n.SFIXED64:case n.SINT64:return d.parse(t);case n.UINT64:case n.FIXED64:return d.uParse(t);case n.DOUBLE:case n.FLOAT:switch(t){case`inf`:return 1/0;case`-inf`:return-1/0;case`nan`:return NaN;default:return parseFloat(t)}case n.BOOL:return t===`true`;case n.INT32:case n.UINT32:case n.SINT32:case n.FIXED32:case n.SFIXED32:return parseInt(t,10)}}function at(e){let t=[],n={tail:e,c:``,next(){return this.tail.length==0?!1:(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(e){if(this.tail.length>=e){let t=this.tail.substring(0,e);return this.tail=this.tail.substring(e),t}return!1}};for(;n.next();)switch(n.c){case`\\`:if(n.next())switch(n.c){case`\\`:t.push(n.c.charCodeAt(0));break;case`b`:t.push(8);break;case`f`:t.push(12);break;case`n`:t.push(10);break;case`r`:t.push(13);break;case`t`:t.push(9);break;case`v`:t.push(11);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:{let e=n.c,r=n.take(2);if(r===!1)return!1;let i=parseInt(e+r,8);if(Number.isNaN(i))return!1;t.push(i);break}case`x`:{let e=n.c,r=n.take(2);if(r===!1)return!1;let i=parseInt(e+r,16);if(Number.isNaN(i))return!1;t.push(i);break}case`u`:{let e=n.c,r=n.take(4);if(r===!1)return!1;let i=parseInt(e+r,16);if(Number.isNaN(i))return!1;let a=new Uint8Array(4);new DataView(a.buffer).setInt32(0,i,!0),t.push(a[0],a[1],a[2],a[3]);break}case`U`:{let e=n.c,r=n.take(8);if(r===!1)return!1;let i=d.uEnc(e+r),a=new Uint8Array(8),o=new DataView(a.buffer);o.setInt32(0,i.lo,!0),o.setInt32(4,i.hi,!0),t.push(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);break}}break;default:t.push(n.c.charCodeAt(0))}return new Uint8Array(t)}function*B(e){switch(e.kind){case`file`:for(let t of e.messages)yield t,yield*B(t);yield*e.enums,yield*e.services,yield*e.extensions;break;case`message`:for(let t of e.nestedMessages)yield t,yield*B(t);yield*e.nestedEnums,yield*e.nestedExtensions;break}}function ot(...e){let t=st();if(!e.length)return t;if(`$typeName`in e[0]&&e[0].$typeName==`google.protobuf.FileDescriptorSet`){for(let n of e[0].file)Ct(n,t);return t}if(`$typeName`in e[0]){let n=e[0],r=e[1],i=new Set;function a(e){let n=[];for(let a of e.dependency){if(t.getFile(a)!=null||i.has(a))continue;let o=r(a);if(!o)throw Error(`Unable to resolve ${a}, imported by ${e.name}`);`kind`in o?t.addFile(o,!1,!0):(i.add(o.name),n.push(o))}return n.concat(...n.map(a))}for(let e of[n,...a(n)].reverse())Ct(e,t)}else for(let n of e)for(let e of n.files)t.addFile(e);return t}function st(){let e=new Map,t=new Map,n=new Map;return{kind:`registry`,types:e,extendees:t,[Symbol.iterator](){return e.values()},get files(){return n.values()},addFile(e,t,r){if(n.set(e.proto.name,e),!t)for(let t of B(e))this.add(t);if(r)for(let n of e.dependencies)this.addFile(n,t,r)},add(n){if(n.kind==`extension`){let e=t.get(n.extendee.typeName);e||t.set(n.extendee.typeName,e=new Map),e.set(n.number,n)}e.set(n.typeName,n)},get(t){return e.get(t)},getFile(e){return n.get(e)},getMessage(t){let n=e.get(t);return n?.kind==`message`?n:void 0},getEnum(t){let n=e.get(t);return n?.kind==`enum`?n:void 0},getExtension(t){let n=e.get(t);return n?.kind==`extension`?n:void 0},getExtensionFor(e,n){return t.get(e.typeName)?.get(n)},getService(t){let n=e.get(t);return n?.kind==`service`?n:void 0}}}var ct=998,lt=999,ut=9,V=10,H=11,dt=12,ft=14,U=3,pt=2,mt=1,ht=0,gt=1,_t=2,vt=3,yt=1,bt=2,xt=1,St={998:{fieldPresence:1,enumType:2,repeatedFieldEncoding:2,utf8Validation:3,messageEncoding:1,jsonFormat:2,enforceNamingStyle:2,defaultSymbolVisibility:1},999:{fieldPresence:2,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1e3:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1001:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:1,defaultSymbolVisibility:2}};function Ct(e,t){let n={kind:`file`,proto:e,deprecated:e.options?.deprecated??!1,edition:kt(e),name:e.name.replace(/\.proto$/,``),dependencies:At(e,t),enums:[],messages:[],extensions:[],services:[],toString(){return`file ${e.name}`}},r=new Map,i={get(e){return r.get(e)},add(e){X(e.proto.options?.mapEntry===!0),r.set(e.typeName,e)}};for(let r of e.enumType)wt(r,n,void 0,t);for(let r of e.messageType)Tt(r,n,void 0,t,i);for(let r of e.service)Et(r,n,t);W(n,t);for(let e of r.values())G(e,t,i);for(let e of n.messages)G(e,t,i),W(e,t);t.addFile(n,!0)}function W(e,t){switch(e.kind){case`file`:for(let n of e.proto.extension){let r=K(n,e,t);e.extensions.push(r),t.add(r)}break;case`message`:for(let n of e.proto.extension){let r=K(n,e,t);e.nestedExtensions.push(r),t.add(r)}for(let n of e.nestedMessages)W(n,t);break}}function G(e,t,n){let r=e.proto.oneofDecl.map(t=>Ot(t,e)),i=new Set;for(let a of e.proto.field){let o=Nt(a,r),s=K(a,e,t,o,n);e.fields.push(s),e.field[s.localName]=s,o===void 0?e.members.push(s):(o.fields.push(s),i.has(o)||(i.add(o),e.members.push(o)))}for(let t of r.filter(e=>i.has(e)))e.oneofs.push(t);for(let r of e.nestedMessages)G(r,t,n)}function wt(e,t,n,r){let i=jt(e.name,e.value),a={kind:`enum`,proto:e,deprecated:e.options?.deprecated??!1,file:t,parent:n,open:!0,name:e.name,typeName:q(e,n,t),value:{},values:[],sharedPrefix:i,toString(){return`enum ${this.typeName}`}};a.open=Lt(a),r.add(a);for(let t of e.value){let e=t.name;a.values.push(a.value[t.number]={kind:`enum_value`,proto:t,deprecated:t.options?.deprecated??!1,parent:a,name:e,localName:R(i==null?e:e.substring(i.length)),number:t.number,toString(){return`enum value ${a.typeName}.${e}`}})}(n?.nestedEnums??t.enums).push(a)}function Tt(e,t,n,r,i){let a={kind:`message`,proto:e,deprecated:e.options?.deprecated??!1,file:t,parent:n,name:e.name,typeName:q(e,n,t),fields:[],field:{},oneofs:[],members:[],nestedEnums:[],nestedMessages:[],nestedExtensions:[],toString(){return`message ${this.typeName}`}};e.options?.mapEntry===!0?i.add(a):((n?.nestedMessages??t.messages).push(a),r.add(a));for(let n of e.enumType)wt(n,t,a,r);for(let n of e.nestedType)Tt(n,t,a,r,i)}function Et(e,t,n){let r={kind:`service`,proto:e,deprecated:e.options?.deprecated??!1,file:t,name:e.name,typeName:q(e,void 0,t),methods:[],method:{},toString(){return`service ${this.typeName}`}};t.services.push(r),n.add(r);for(let t of e.method){let e=Dt(t,r,n);r.methods.push(e),r.method[e.localName]=e}}function Dt(e,t,n){let r;r=e.clientStreaming&&e.serverStreaming?`bidi_streaming`:e.clientStreaming?`client_streaming`:e.serverStreaming?`server_streaming`:`unary`;let i=n.getMessage(J(e.inputType)),a=n.getMessage(J(e.outputType));X(i,`invalid MethodDescriptorProto: input_type ${e.inputType} not found`),X(a,`invalid MethodDescriptorProto: output_type ${e.inputType} not found`);let o=e.name;return{kind:`rpc`,proto:e,deprecated:e.options?.deprecated??!1,parent:t,name:o,localName:R(o.length?R(o[0].toLowerCase()+o.substring(1)):o),methodKind:r,input:i,output:a,idempotency:e.options?.idempotencyLevel??ht,toString(){return`rpc ${t.typeName}.${o}`}}}function Ot(e,t){return{kind:`oneof`,proto:e,deprecated:!1,parent:t,fields:[],name:e.name,localName:R(L(e.name)),toString(){return`oneof ${t.typeName}.${this.name}`}}}function K(e,t,n,r,i){let a=i===void 0,o={kind:`field`,proto:e,deprecated:e.options?.deprecated??!1,name:e.name,number:e.number,scalar:void 0,message:void 0,enum:void 0,presence:Pt(e,r,a,t),listKind:void 0,mapKind:void 0,mapKey:void 0,delimitedEncoding:void 0,packed:void 0,longAsString:!1,getDefaultValue:void 0};if(a){let r=t.kind==`file`?t:t.file,i=t.kind==`file`?void 0:t,a=q(e,i,r);o.kind=`extension`,o.file=r,o.parent=i,o.oneof=void 0,o.typeName=a,o.jsonName=`[${a}]`,o.toString=()=>`extension ${a}`;let s=n.getMessage(J(e.extendee));X(s,`invalid FieldDescriptorProto: extendee ${e.extendee} not found`),o.extendee=s}else{let n=t;X(n.kind==`message`),o.parent=n,o.oneof=r,o.localName=r?L(e.name):R(L(e.name)),o.jsonName=e.jsonName,o.toString=()=>`field ${n.typeName}.${e.name}`}let s=e.label,c=e.type,l=e.options?.jstype;if(s===U){let r=c==H?i?.get(J(e.typeName)):void 0;if(r){o.fieldKind=`map`;let{key:e,value:t}=It(r);return o.mapKey=e.scalar,o.mapKind=t.fieldKind,o.message=t.message,o.delimitedEncoding=!1,o.enum=t.enum,o.scalar=t.scalar,o}switch(o.fieldKind=`list`,c){case H:case V:o.listKind=`message`,o.message=n.getMessage(J(e.typeName)),X(o.message),o.delimitedEncoding=Rt(e,t);break;case ft:o.listKind=`enum`,o.enum=n.getEnum(J(e.typeName)),X(o.enum);break;default:o.listKind=`scalar`,o.scalar=c,o.longAsString=l==mt;break}return o.packed=Ft(e,t),o}switch(c){case H:case V:o.fieldKind=`message`,o.message=n.getMessage(J(e.typeName)),X(o.message,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),o.delimitedEncoding=Rt(e,t),o.getDefaultValue=()=>void 0;break;case ft:{let t=n.getEnum(J(e.typeName));X(t!==void 0,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),o.fieldKind=`enum`,o.enum=n.getEnum(J(e.typeName)),o.getDefaultValue=()=>m(e,`defaultValue`)?rt(t,e.defaultValue):void 0;break}default:o.fieldKind=`scalar`,o.scalar=c,o.longAsString=l==mt,o.getDefaultValue=()=>m(e,`defaultValue`)?it(c,e.defaultValue):void 0;break}return o}function kt(e){switch(e.syntax){case``:case`proto2`:return ct;case`proto3`:return lt;case`editions`:if(e.edition in St)return e.edition;throw Error(`${e.name}: unsupported edition`);default:throw Error(`${e.name}: unsupported syntax "${e.syntax}"`)}}function At(e,t){return e.dependency.map(n=>{let r=t.getFile(n);if(!r)throw Error(`Cannot find ${n}, imported by ${e.name}`);return r})}function jt(e,t){let n=Mt(e)+`_`;for(let e of t){if(!e.name.toLowerCase().startsWith(n))return;let t=e.name.substring(n.length);if(t.length==0||/^\d/.test(t))return}return n}function Mt(e){return(e.substring(0,1)+e.substring(1).replace(/[A-Z]/g,e=>`_`+e)).toLowerCase()}function q(e,t,n){let r;return r=t?`${t.typeName}.${e.name}`:n.proto.package.length>0?`${n.proto.package}.${e.name}`:`${e.name}`,r}function J(e){return e.startsWith(`.`)?e.substring(1):e}function Nt(e,t){if(!m(e,`oneofIndex`)||e.proto3Optional)return;let n=t[e.oneofIndex];return X(n,`invalid FieldDescriptorProto: oneof #${e.oneofIndex} for field #${e.number} not found`),n}function Pt(e,t,n,r){if(e.label==pt)return vt;if(e.label==U)return _t;if(t||e.proto3Optional||n)return gt;let i=Y(`fieldPresence`,{proto:e,parent:r});return i==_t&&(e.type==H||e.type==V)?gt:i}function Ft(e,t){if(e.label!=U)return!1;switch(e.type){case ut:case dt:case V:case H:return!1}let n=e.options;return n&&m(n,`packed`)?n.packed:yt==Y(`repeatedFieldEncoding`,{proto:e,parent:t})}function It(e){let t=e.fields.find(e=>e.number===1),r=e.fields.find(e=>e.number===2);return X(t&&t.fieldKind==`scalar`&&t.scalar!=n.BYTES&&t.scalar!=n.FLOAT&&t.scalar!=n.DOUBLE&&r&&r.fieldKind!=`list`&&r.fieldKind!=`map`),{key:t,value:r}}function Lt(e){return xt==Y(`enumType`,{proto:e.proto,parent:e.parent??e.file})}function Rt(e,t){return e.type==V?!0:bt==Y(`messageEncoding`,{proto:e,parent:t})}function Y(e,t){let n=t.proto.options?.features;if(n){let t=n[e];if(t!=0)return t}if(`kind`in t){if(t.kind==`message`)return Y(e,t.parent??t.file);let n=St[t.edition];if(!n)throw Error(`feature default for edition ${t.edition} not found`);return n[e]}return Y(e,t.parent)}function X(e,t){if(!e)throw Error(t)}function zt(e){let t=Bt(e);return t.messageType.forEach(z),ot(t,()=>void 0).getFile(t.name)}function Bt(e){return Object.assign(Object.create({syntax:``,edition:0}),Object.assign(Object.assign({$typeName:`google.protobuf.FileDescriptorProto`,dependency:[],publicDependency:[],weakDependency:[],optionDependency:[],service:[],extension:[]},e),{messageType:e.messageType.map(Vt),enumType:e.enumType.map(Wt)}))}function Vt(e){return Object.assign(Object.create({visibility:0}),{$typeName:`google.protobuf.DescriptorProto`,name:e.name,field:e.field?.map(Ht)??[],extension:[],nestedType:e.nestedType?.map(Vt)??[],enumType:e.enumType?.map(Wt)??[],extensionRange:e.extensionRange?.map(e=>Object.assign({$typeName:`google.protobuf.DescriptorProto.ExtensionRange`},e))??[],oneofDecl:[],reservedRange:[],reservedName:[]})}function Ht(e){return Object.assign(Object.create({label:1,typeName:``,extendee:``,defaultValue:``,oneofIndex:0,jsonName:``,proto3Optional:!1}),Object.assign(Object.assign({$typeName:`google.protobuf.FieldDescriptorProto`},e),{options:e.options?Ut(e.options):void 0}))}function Ut(e){return Object.assign(Object.create({ctype:0,packed:!1,jstype:0,lazy:!1,unverifiedLazy:!1,deprecated:!1,weak:!1,debugRedact:!1,retention:0}),Object.assign(Object.assign({$typeName:`google.protobuf.FieldOptions`},e),{targets:e.targets??[],editionDefaults:e.editionDefaults?.map(e=>Object.assign({$typeName:`google.protobuf.FieldOptions.EditionDefault`},e))??[],uninterpretedOption:[]}))}function Wt(e){return Object.assign(Object.create({visibility:0}),{$typeName:`google.protobuf.EnumDescriptorProto`,name:e.name,reservedName:[],reservedRange:[],value:e.value.map(e=>Object.assign({$typeName:`google.protobuf.EnumValueDescriptorProto`},e))})}function Z(e,t,...n){return n.reduce((e,t)=>e.nestedMessages[t],e.messages[t])}var Gt=Z(zt({name:`google/protobuf/descriptor.proto`,package:`google.protobuf`,messageType:[{name:`FileDescriptorSet`,field:[{name:`file`,number:1,type:11,label:3,typeName:`.google.protobuf.FileDescriptorProto`}],extensionRange:[{start:536e6,end:536000001}]},{name:`FileDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`package`,number:2,type:9,label:1},{name:`dependency`,number:3,type:9,label:3},{name:`public_dependency`,number:10,type:5,label:3},{name:`weak_dependency`,number:11,type:5,label:3},{name:`option_dependency`,number:15,type:9,label:3},{name:`message_type`,number:4,type:11,label:3,typeName:`.google.protobuf.DescriptorProto`},{name:`enum_type`,number:5,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto`},{name:`service`,number:6,type:11,label:3,typeName:`.google.protobuf.ServiceDescriptorProto`},{name:`extension`,number:7,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`options`,number:8,type:11,label:1,typeName:`.google.protobuf.FileOptions`},{name:`source_code_info`,number:9,type:11,label:1,typeName:`.google.protobuf.SourceCodeInfo`},{name:`syntax`,number:12,type:9,label:1},{name:`edition`,number:14,type:14,label:1,typeName:`.google.protobuf.Edition`}]},{name:`DescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`field`,number:2,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`extension`,number:6,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`nested_type`,number:3,type:11,label:3,typeName:`.google.protobuf.DescriptorProto`},{name:`enum_type`,number:4,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto`},{name:`extension_range`,number:5,type:11,label:3,typeName:`.google.protobuf.DescriptorProto.ExtensionRange`},{name:`oneof_decl`,number:8,type:11,label:3,typeName:`.google.protobuf.OneofDescriptorProto`},{name:`options`,number:7,type:11,label:1,typeName:`.google.protobuf.MessageOptions`},{name:`reserved_range`,number:9,type:11,label:3,typeName:`.google.protobuf.DescriptorProto.ReservedRange`},{name:`reserved_name`,number:10,type:9,label:3},{name:`visibility`,number:11,type:14,label:1,typeName:`.google.protobuf.SymbolVisibility`}],nestedType:[{name:`ExtensionRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.ExtensionRangeOptions`}]},{name:`ReservedRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1}]}]},{name:`ExtensionRangeOptions`,field:[{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`},{name:`declaration`,number:2,type:11,label:3,typeName:`.google.protobuf.ExtensionRangeOptions.Declaration`,options:{retention:2}},{name:`features`,number:50,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`verification`,number:3,type:14,label:1,typeName:`.google.protobuf.ExtensionRangeOptions.VerificationState`,defaultValue:`UNVERIFIED`,options:{retention:2}}],nestedType:[{name:`Declaration`,field:[{name:`number`,number:1,type:5,label:1},{name:`full_name`,number:2,type:9,label:1},{name:`type`,number:3,type:9,label:1},{name:`reserved`,number:5,type:8,label:1},{name:`repeated`,number:6,type:8,label:1}]}],enumType:[{name:`VerificationState`,value:[{name:`DECLARATION`,number:0},{name:`UNVERIFIED`,number:1}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`FieldDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`number`,number:3,type:5,label:1},{name:`label`,number:4,type:14,label:1,typeName:`.google.protobuf.FieldDescriptorProto.Label`},{name:`type`,number:5,type:14,label:1,typeName:`.google.protobuf.FieldDescriptorProto.Type`},{name:`type_name`,number:6,type:9,label:1},{name:`extendee`,number:2,type:9,label:1},{name:`default_value`,number:7,type:9,label:1},{name:`oneof_index`,number:9,type:5,label:1},{name:`json_name`,number:10,type:9,label:1},{name:`options`,number:8,type:11,label:1,typeName:`.google.protobuf.FieldOptions`},{name:`proto3_optional`,number:17,type:8,label:1}],enumType:[{name:`Type`,value:[{name:`TYPE_DOUBLE`,number:1},{name:`TYPE_FLOAT`,number:2},{name:`TYPE_INT64`,number:3},{name:`TYPE_UINT64`,number:4},{name:`TYPE_INT32`,number:5},{name:`TYPE_FIXED64`,number:6},{name:`TYPE_FIXED32`,number:7},{name:`TYPE_BOOL`,number:8},{name:`TYPE_STRING`,number:9},{name:`TYPE_GROUP`,number:10},{name:`TYPE_MESSAGE`,number:11},{name:`TYPE_BYTES`,number:12},{name:`TYPE_UINT32`,number:13},{name:`TYPE_ENUM`,number:14},{name:`TYPE_SFIXED32`,number:15},{name:`TYPE_SFIXED64`,number:16},{name:`TYPE_SINT32`,number:17},{name:`TYPE_SINT64`,number:18}]},{name:`Label`,value:[{name:`LABEL_OPTIONAL`,number:1},{name:`LABEL_REPEATED`,number:3},{name:`LABEL_REQUIRED`,number:2}]}]},{name:`OneofDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`options`,number:2,type:11,label:1,typeName:`.google.protobuf.OneofOptions`}]},{name:`EnumDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`value`,number:2,type:11,label:3,typeName:`.google.protobuf.EnumValueDescriptorProto`},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.EnumOptions`},{name:`reserved_range`,number:4,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto.EnumReservedRange`},{name:`reserved_name`,number:5,type:9,label:3},{name:`visibility`,number:6,type:14,label:1,typeName:`.google.protobuf.SymbolVisibility`}],nestedType:[{name:`EnumReservedRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1}]}]},{name:`EnumValueDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`number`,number:2,type:5,label:1},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.EnumValueOptions`}]},{name:`ServiceDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`method`,number:2,type:11,label:3,typeName:`.google.protobuf.MethodDescriptorProto`},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.ServiceOptions`}]},{name:`MethodDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`input_type`,number:2,type:9,label:1},{name:`output_type`,number:3,type:9,label:1},{name:`options`,number:4,type:11,label:1,typeName:`.google.protobuf.MethodOptions`},{name:`client_streaming`,number:5,type:8,label:1,defaultValue:`false`},{name:`server_streaming`,number:6,type:8,label:1,defaultValue:`false`}]},{name:`FileOptions`,field:[{name:`java_package`,number:1,type:9,label:1},{name:`java_outer_classname`,number:8,type:9,label:1},{name:`java_multiple_files`,number:10,type:8,label:1,defaultValue:`false`},{name:`java_generate_equals_and_hash`,number:20,type:8,label:1,options:{deprecated:!0}},{name:`java_string_check_utf8`,number:27,type:8,label:1,defaultValue:`false`},{name:`optimize_for`,number:9,type:14,label:1,typeName:`.google.protobuf.FileOptions.OptimizeMode`,defaultValue:`SPEED`},{name:`go_package`,number:11,type:9,label:1},{name:`cc_generic_services`,number:16,type:8,label:1,defaultValue:`false`},{name:`java_generic_services`,number:17,type:8,label:1,defaultValue:`false`},{name:`py_generic_services`,number:18,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:23,type:8,label:1,defaultValue:`false`},{name:`cc_enable_arenas`,number:31,type:8,label:1,defaultValue:`true`},{name:`objc_class_prefix`,number:36,type:9,label:1},{name:`csharp_namespace`,number:37,type:9,label:1},{name:`swift_prefix`,number:39,type:9,label:1},{name:`php_class_prefix`,number:40,type:9,label:1},{name:`php_namespace`,number:41,type:9,label:1},{name:`php_metadata_namespace`,number:44,type:9,label:1},{name:`ruby_package`,number:45,type:9,label:1},{name:`features`,number:50,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],enumType:[{name:`OptimizeMode`,value:[{name:`SPEED`,number:1},{name:`CODE_SIZE`,number:2},{name:`LITE_RUNTIME`,number:3}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`MessageOptions`,field:[{name:`message_set_wire_format`,number:1,type:8,label:1,defaultValue:`false`},{name:`no_standard_descriptor_accessor`,number:2,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`map_entry`,number:7,type:8,label:1},{name:`deprecated_legacy_json_field_conflicts`,number:11,type:8,label:1,options:{deprecated:!0}},{name:`features`,number:12,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`FieldOptions`,field:[{name:`ctype`,number:1,type:14,label:1,typeName:`.google.protobuf.FieldOptions.CType`,defaultValue:`STRING`},{name:`packed`,number:2,type:8,label:1},{name:`jstype`,number:6,type:14,label:1,typeName:`.google.protobuf.FieldOptions.JSType`,defaultValue:`JS_NORMAL`},{name:`lazy`,number:5,type:8,label:1,defaultValue:`false`},{name:`unverified_lazy`,number:15,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`weak`,number:10,type:8,label:1,defaultValue:`false`,options:{deprecated:!0}},{name:`debug_redact`,number:16,type:8,label:1,defaultValue:`false`},{name:`retention`,number:17,type:14,label:1,typeName:`.google.protobuf.FieldOptions.OptionRetention`},{name:`targets`,number:19,type:14,label:3,typeName:`.google.protobuf.FieldOptions.OptionTargetType`},{name:`edition_defaults`,number:20,type:11,label:3,typeName:`.google.protobuf.FieldOptions.EditionDefault`},{name:`features`,number:21,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`feature_support`,number:22,type:11,label:1,typeName:`.google.protobuf.FieldOptions.FeatureSupport`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],nestedType:[{name:`EditionDefault`,field:[{name:`edition`,number:3,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`value`,number:2,type:9,label:1}]},{name:`FeatureSupport`,field:[{name:`edition_introduced`,number:1,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`edition_deprecated`,number:2,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`deprecation_warning`,number:3,type:9,label:1},{name:`edition_removed`,number:4,type:14,label:1,typeName:`.google.protobuf.Edition`}]}],enumType:[{name:`CType`,value:[{name:`STRING`,number:0},{name:`CORD`,number:1},{name:`STRING_PIECE`,number:2}]},{name:`JSType`,value:[{name:`JS_NORMAL`,number:0},{name:`JS_STRING`,number:1},{name:`JS_NUMBER`,number:2}]},{name:`OptionRetention`,value:[{name:`RETENTION_UNKNOWN`,number:0},{name:`RETENTION_RUNTIME`,number:1},{name:`RETENTION_SOURCE`,number:2}]},{name:`OptionTargetType`,value:[{name:`TARGET_TYPE_UNKNOWN`,number:0},{name:`TARGET_TYPE_FILE`,number:1},{name:`TARGET_TYPE_EXTENSION_RANGE`,number:2},{name:`TARGET_TYPE_MESSAGE`,number:3},{name:`TARGET_TYPE_FIELD`,number:4},{name:`TARGET_TYPE_ONEOF`,number:5},{name:`TARGET_TYPE_ENUM`,number:6},{name:`TARGET_TYPE_ENUM_ENTRY`,number:7},{name:`TARGET_TYPE_SERVICE`,number:8},{name:`TARGET_TYPE_METHOD`,number:9}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`OneofOptions`,field:[{name:`features`,number:1,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`EnumOptions`,field:[{name:`allow_alias`,number:2,type:8,label:1},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`deprecated_legacy_json_field_conflicts`,number:6,type:8,label:1,options:{deprecated:!0}},{name:`features`,number:7,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`EnumValueOptions`,field:[{name:`deprecated`,number:1,type:8,label:1,defaultValue:`false`},{name:`features`,number:2,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`debug_redact`,number:3,type:8,label:1,defaultValue:`false`},{name:`feature_support`,number:4,type:11,label:1,typeName:`.google.protobuf.FieldOptions.FeatureSupport`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`ServiceOptions`,field:[{name:`features`,number:34,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`deprecated`,number:33,type:8,label:1,defaultValue:`false`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`MethodOptions`,field:[{name:`deprecated`,number:33,type:8,label:1,defaultValue:`false`},{name:`idempotency_level`,number:34,type:14,label:1,typeName:`.google.protobuf.MethodOptions.IdempotencyLevel`,defaultValue:`IDEMPOTENCY_UNKNOWN`},{name:`features`,number:35,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],enumType:[{name:`IdempotencyLevel`,value:[{name:`IDEMPOTENCY_UNKNOWN`,number:0},{name:`NO_SIDE_EFFECTS`,number:1},{name:`IDEMPOTENT`,number:2}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`UninterpretedOption`,field:[{name:`name`,number:2,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption.NamePart`},{name:`identifier_value`,number:3,type:9,label:1},{name:`positive_int_value`,number:4,type:4,label:1},{name:`negative_int_value`,number:5,type:3,label:1},{name:`double_value`,number:6,type:1,label:1},{name:`string_value`,number:7,type:12,label:1},{name:`aggregate_value`,number:8,type:9,label:1}],nestedType:[{name:`NamePart`,field:[{name:`name_part`,number:1,type:9,label:2},{name:`is_extension`,number:2,type:8,label:2}]}]},{name:`FeatureSet`,field:[{name:`field_presence`,number:1,type:14,label:1,typeName:`.google.protobuf.FeatureSet.FieldPresence`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`EXPLICIT`,edition:900},{value:`IMPLICIT`,edition:999},{value:`EXPLICIT`,edition:1e3}]}},{name:`enum_type`,number:2,type:14,label:1,typeName:`.google.protobuf.FeatureSet.EnumType`,options:{retention:1,targets:[6,1],editionDefaults:[{value:`CLOSED`,edition:900},{value:`OPEN`,edition:999}]}},{name:`repeated_field_encoding`,number:3,type:14,label:1,typeName:`.google.protobuf.FeatureSet.RepeatedFieldEncoding`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`EXPANDED`,edition:900},{value:`PACKED`,edition:999}]}},{name:`utf8_validation`,number:4,type:14,label:1,typeName:`.google.protobuf.FeatureSet.Utf8Validation`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`NONE`,edition:900},{value:`VERIFY`,edition:999}]}},{name:`message_encoding`,number:5,type:14,label:1,typeName:`.google.protobuf.FeatureSet.MessageEncoding`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`LENGTH_PREFIXED`,edition:900}]}},{name:`json_format`,number:6,type:14,label:1,typeName:`.google.protobuf.FeatureSet.JsonFormat`,options:{retention:1,targets:[3,6,1],editionDefaults:[{value:`LEGACY_BEST_EFFORT`,edition:900},{value:`ALLOW`,edition:999}]}},{name:`enforce_naming_style`,number:7,type:14,label:1,typeName:`.google.protobuf.FeatureSet.EnforceNamingStyle`,options:{retention:2,targets:[1,2,3,4,5,6,7,8,9],editionDefaults:[{value:`STYLE_LEGACY`,edition:900},{value:`STYLE2024`,edition:1001}]}},{name:`default_symbol_visibility`,number:8,type:14,label:1,typeName:`.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility`,options:{retention:2,targets:[1],editionDefaults:[{value:`EXPORT_ALL`,edition:900},{value:`EXPORT_TOP_LEVEL`,edition:1001}]}}],nestedType:[{name:`VisibilityFeature`,enumType:[{name:`DefaultSymbolVisibility`,value:[{name:`DEFAULT_SYMBOL_VISIBILITY_UNKNOWN`,number:0},{name:`EXPORT_ALL`,number:1},{name:`EXPORT_TOP_LEVEL`,number:2},{name:`LOCAL_ALL`,number:3},{name:`STRICT`,number:4}]}]}],enumType:[{name:`FieldPresence`,value:[{name:`FIELD_PRESENCE_UNKNOWN`,number:0},{name:`EXPLICIT`,number:1},{name:`IMPLICIT`,number:2},{name:`LEGACY_REQUIRED`,number:3}]},{name:`EnumType`,value:[{name:`ENUM_TYPE_UNKNOWN`,number:0},{name:`OPEN`,number:1},{name:`CLOSED`,number:2}]},{name:`RepeatedFieldEncoding`,value:[{name:`REPEATED_FIELD_ENCODING_UNKNOWN`,number:0},{name:`PACKED`,number:1},{name:`EXPANDED`,number:2}]},{name:`Utf8Validation`,value:[{name:`UTF8_VALIDATION_UNKNOWN`,number:0},{name:`VERIFY`,number:2},{name:`NONE`,number:3}]},{name:`MessageEncoding`,value:[{name:`MESSAGE_ENCODING_UNKNOWN`,number:0},{name:`LENGTH_PREFIXED`,number:1},{name:`DELIMITED`,number:2}]},{name:`JsonFormat`,value:[{name:`JSON_FORMAT_UNKNOWN`,number:0},{name:`ALLOW`,number:1},{name:`LEGACY_BEST_EFFORT`,number:2}]},{name:`EnforceNamingStyle`,value:[{name:`ENFORCE_NAMING_STYLE_UNKNOWN`,number:0},{name:`STYLE2024`,number:1},{name:`STYLE_LEGACY`,number:2}]}],extensionRange:[{start:1e3,end:9995},{start:9995,end:1e4},{start:1e4,end:10001}]},{name:`FeatureSetDefaults`,field:[{name:`defaults`,number:1,type:11,label:3,typeName:`.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault`},{name:`minimum_edition`,number:4,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`maximum_edition`,number:5,type:14,label:1,typeName:`.google.protobuf.Edition`}],nestedType:[{name:`FeatureSetEditionDefault`,field:[{name:`edition`,number:3,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`overridable_features`,number:4,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`fixed_features`,number:5,type:11,label:1,typeName:`.google.protobuf.FeatureSet`}]}]},{name:`SourceCodeInfo`,field:[{name:`location`,number:1,type:11,label:3,typeName:`.google.protobuf.SourceCodeInfo.Location`}],nestedType:[{name:`Location`,field:[{name:`path`,number:1,type:5,label:3,options:{packed:!0}},{name:`span`,number:2,type:5,label:3,options:{packed:!0}},{name:`leading_comments`,number:3,type:9,label:1},{name:`trailing_comments`,number:4,type:9,label:1},{name:`leading_detached_comments`,number:6,type:9,label:3}]}],extensionRange:[{start:536e6,end:536000001}]},{name:`GeneratedCodeInfo`,field:[{name:`annotation`,number:1,type:11,label:3,typeName:`.google.protobuf.GeneratedCodeInfo.Annotation`}],nestedType:[{name:`Annotation`,field:[{name:`path`,number:1,type:5,label:3,options:{packed:!0}},{name:`source_file`,number:2,type:9,label:1},{name:`begin`,number:3,type:5,label:1},{name:`end`,number:4,type:5,label:1},{name:`semantic`,number:5,type:14,label:1,typeName:`.google.protobuf.GeneratedCodeInfo.Annotation.Semantic`}],enumType:[{name:`Semantic`,value:[{name:`NONE`,number:0},{name:`SET`,number:1},{name:`ALIAS`,number:2}]}]}]}],enumType:[{name:`Edition`,value:[{name:`EDITION_UNKNOWN`,number:0},{name:`EDITION_LEGACY`,number:900},{name:`EDITION_PROTO2`,number:998},{name:`EDITION_PROTO3`,number:999},{name:`EDITION_2023`,number:1e3},{name:`EDITION_2024`,number:1001},{name:`EDITION_UNSTABLE`,number:9999},{name:`EDITION_1_TEST_ONLY`,number:1},{name:`EDITION_2_TEST_ONLY`,number:2},{name:`EDITION_99997_TEST_ONLY`,number:99997},{name:`EDITION_99998_TEST_ONLY`,number:99998},{name:`EDITION_99999_TEST_ONLY`,number:99999},{name:`EDITION_MAX`,number:2147483647}]},{name:`SymbolVisibility`,value:[{name:`VISIBILITY_UNSET`,number:0},{name:`VISIBILITY_LOCAL`,number:1},{name:`VISIBILITY_EXPORT`,number:2}]}]}),1),Kt;(function(e){e[e.DECLARATION=0]=`DECLARATION`,e[e.UNVERIFIED=1]=`UNVERIFIED`})(Kt||={});var qt;(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.GROUP=10]=`GROUP`,e[e.MESSAGE=11]=`MESSAGE`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.ENUM=14]=`ENUM`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(qt||={});var Jt;(function(e){e[e.OPTIONAL=1]=`OPTIONAL`,e[e.REPEATED=3]=`REPEATED`,e[e.REQUIRED=2]=`REQUIRED`})(Jt||={});var Yt;(function(e){e[e.SPEED=1]=`SPEED`,e[e.CODE_SIZE=2]=`CODE_SIZE`,e[e.LITE_RUNTIME=3]=`LITE_RUNTIME`})(Yt||={});var Xt;(function(e){e[e.STRING=0]=`STRING`,e[e.CORD=1]=`CORD`,e[e.STRING_PIECE=2]=`STRING_PIECE`})(Xt||={});var Zt;(function(e){e[e.JS_NORMAL=0]=`JS_NORMAL`,e[e.JS_STRING=1]=`JS_STRING`,e[e.JS_NUMBER=2]=`JS_NUMBER`})(Zt||={});var Qt;(function(e){e[e.RETENTION_UNKNOWN=0]=`RETENTION_UNKNOWN`,e[e.RETENTION_RUNTIME=1]=`RETENTION_RUNTIME`,e[e.RETENTION_SOURCE=2]=`RETENTION_SOURCE`})(Qt||={});var $t;(function(e){e[e.TARGET_TYPE_UNKNOWN=0]=`TARGET_TYPE_UNKNOWN`,e[e.TARGET_TYPE_FILE=1]=`TARGET_TYPE_FILE`,e[e.TARGET_TYPE_EXTENSION_RANGE=2]=`TARGET_TYPE_EXTENSION_RANGE`,e[e.TARGET_TYPE_MESSAGE=3]=`TARGET_TYPE_MESSAGE`,e[e.TARGET_TYPE_FIELD=4]=`TARGET_TYPE_FIELD`,e[e.TARGET_TYPE_ONEOF=5]=`TARGET_TYPE_ONEOF`,e[e.TARGET_TYPE_ENUM=6]=`TARGET_TYPE_ENUM`,e[e.TARGET_TYPE_ENUM_ENTRY=7]=`TARGET_TYPE_ENUM_ENTRY`,e[e.TARGET_TYPE_SERVICE=8]=`TARGET_TYPE_SERVICE`,e[e.TARGET_TYPE_METHOD=9]=`TARGET_TYPE_METHOD`})($t||={});var en;(function(e){e[e.IDEMPOTENCY_UNKNOWN=0]=`IDEMPOTENCY_UNKNOWN`,e[e.NO_SIDE_EFFECTS=1]=`NO_SIDE_EFFECTS`,e[e.IDEMPOTENT=2]=`IDEMPOTENT`})(en||={});var tn;(function(e){e[e.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0]=`DEFAULT_SYMBOL_VISIBILITY_UNKNOWN`,e[e.EXPORT_ALL=1]=`EXPORT_ALL`,e[e.EXPORT_TOP_LEVEL=2]=`EXPORT_TOP_LEVEL`,e[e.LOCAL_ALL=3]=`LOCAL_ALL`,e[e.STRICT=4]=`STRICT`})(tn||={});var nn;(function(e){e[e.FIELD_PRESENCE_UNKNOWN=0]=`FIELD_PRESENCE_UNKNOWN`,e[e.EXPLICIT=1]=`EXPLICIT`,e[e.IMPLICIT=2]=`IMPLICIT`,e[e.LEGACY_REQUIRED=3]=`LEGACY_REQUIRED`})(nn||={});var rn;(function(e){e[e.ENUM_TYPE_UNKNOWN=0]=`ENUM_TYPE_UNKNOWN`,e[e.OPEN=1]=`OPEN`,e[e.CLOSED=2]=`CLOSED`})(rn||={});var an;(function(e){e[e.REPEATED_FIELD_ENCODING_UNKNOWN=0]=`REPEATED_FIELD_ENCODING_UNKNOWN`,e[e.PACKED=1]=`PACKED`,e[e.EXPANDED=2]=`EXPANDED`})(an||={});var on;(function(e){e[e.UTF8_VALIDATION_UNKNOWN=0]=`UTF8_VALIDATION_UNKNOWN`,e[e.VERIFY=2]=`VERIFY`,e[e.NONE=3]=`NONE`})(on||={});var sn;(function(e){e[e.MESSAGE_ENCODING_UNKNOWN=0]=`MESSAGE_ENCODING_UNKNOWN`,e[e.LENGTH_PREFIXED=1]=`LENGTH_PREFIXED`,e[e.DELIMITED=2]=`DELIMITED`})(sn||={});var cn;(function(e){e[e.JSON_FORMAT_UNKNOWN=0]=`JSON_FORMAT_UNKNOWN`,e[e.ALLOW=1]=`ALLOW`,e[e.LEGACY_BEST_EFFORT=2]=`LEGACY_BEST_EFFORT`})(cn||={});var ln;(function(e){e[e.ENFORCE_NAMING_STYLE_UNKNOWN=0]=`ENFORCE_NAMING_STYLE_UNKNOWN`,e[e.STYLE2024=1]=`STYLE2024`,e[e.STYLE_LEGACY=2]=`STYLE_LEGACY`})(ln||={});var un;(function(e){e[e.NONE=0]=`NONE`,e[e.SET=1]=`SET`,e[e.ALIAS=2]=`ALIAS`})(un||={});var dn;(function(e){e[e.EDITION_UNKNOWN=0]=`EDITION_UNKNOWN`,e[e.EDITION_LEGACY=900]=`EDITION_LEGACY`,e[e.EDITION_PROTO2=998]=`EDITION_PROTO2`,e[e.EDITION_PROTO3=999]=`EDITION_PROTO3`,e[e.EDITION_2023=1e3]=`EDITION_2023`,e[e.EDITION_2024=1001]=`EDITION_2024`,e[e.EDITION_UNSTABLE=9999]=`EDITION_UNSTABLE`,e[e.EDITION_1_TEST_ONLY=1]=`EDITION_1_TEST_ONLY`,e[e.EDITION_2_TEST_ONLY=2]=`EDITION_2_TEST_ONLY`,e[e.EDITION_99997_TEST_ONLY=99997]=`EDITION_99997_TEST_ONLY`,e[e.EDITION_99998_TEST_ONLY=99998]=`EDITION_99998_TEST_ONLY`,e[e.EDITION_99999_TEST_ONLY=99999]=`EDITION_99999_TEST_ONLY`,e[e.EDITION_MAX=2147483647]=`EDITION_MAX`})(dn||={});var fn;(function(e){e[e.VISIBILITY_UNSET=0]=`VISIBILITY_UNSET`,e[e.VISIBILITY_LOCAL=1]=`VISIBILITY_LOCAL`,e[e.VISIBILITY_EXPORT=2]=`VISIBILITY_EXPORT`})(fn||={});var pn={readUnknownFields:!0};function mn(e){return e?Object.assign(Object.assign({},pn),e):pn}function Q(e,t,n){let r=E(e,void 0,!1);return hn(r,new je(t),mn(n),!1,t.byteLength),r.message}function hn(e,t,n,r,i){let a=r?t.len:t.pos+i,o,s,c=e.getUnknown()??[];for(;t.pos<a&&([o,s]=t.tag(),!(r&&s==C.EndGroup));){let r=e.findNumber(o);if(!r){let e=t.skip(s,o);n.readUnknownFields&&c.push({no:o,wireType:s,data:e});continue}gn(e,t,r,s,n)}if(r&&(s!=C.EndGroup||o!==i))throw Error(`invalid end group tag`);c.length>0&&e.setUnknown(c)}function gn(e,t,r,i,a){switch(r.fieldKind){case`scalar`:e.set(r,$(t,r.scalar));break;case`enum`:let o=$(t,n.INT32);if(r.enum.open)e.set(r,o);else if(r.enum.values.some(e=>e.number===o))e.set(r,o);else if(a.readUnknownFields){let t=[];te(o,t);let n=e.getUnknown()??[];n.push({no:r.number,wireType:i,data:new Uint8Array(t)}),e.setUnknown(n)}break;case`message`:e.set(r,yn(t,a,r,e.get(r)));break;case`list`:vn(t,i,e.get(r),a);break;case`map`:_n(t,e.get(r),a);break}}function _n(e,t,n){let r=t.field(),i,a,o=e.uint32(),s=e.pos+o;for(;e.pos<s;){let[t]=e.tag();switch(t){case 1:i=$(e,r.mapKey);break;case 2:switch(r.mapKind){case`scalar`:a=$(e,r.scalar);break;case`enum`:a=e.int32();break;case`message`:a=yn(e,n,r);break}break}}if(i===void 0&&(i=f(r.mapKey,!1)),a===void 0)switch(r.mapKind){case`scalar`:a=f(r.scalar,!1);break;case`enum`:a=r.enum.values[0].number;break;case`message`:a=E(r.message,void 0,!1);break}t.set(i,a)}function vn(e,t,r,i){let a=r.field();if(a.listKind===`message`){r.add(yn(e,i,a));return}let o=a.scalar??n.INT32;if(!(t==C.LengthDelimited&&o!=n.STRING&&o!=n.BYTES)){r.add($(e,o));return}let s=e.uint32()+e.pos;for(;e.pos<s;)r.add($(e,o))}function yn(e,t,n,r){let i=n.delimitedEncoding,a=r??E(n.message,void 0,!1);return hn(a,e,t,i,i?n.number:e.uint32()),a}function $(e,t){switch(t){case n.STRING:return e.string();case n.BOOL:return e.bool();case n.DOUBLE:return e.double();case n.FLOAT:return e.float();case n.INT32:return e.int32();case n.INT64:return e.int64();case n.UINT64:return e.uint64();case n.FIXED64:return e.fixed64();case n.BYTES:return e.bytes();case n.FIXED32:return e.fixed32();case n.SFIXED32:return e.sfixed32();case n.SFIXED64:return e.sfixed64();case n.SINT64:return e.sint64();case n.UINT32:return e.uint32();case n.SINT32:return e.sint32()}}function bn(e,t){let n=Q(Gt,Qe(e));return n.messageType.forEach(z),n.dependency=t?.map(e=>e.proto.name)??[],ot(n,e=>t?.find(t=>t.proto.name===e)).getFile(n.name)}var xn='(function(){"use strict";class P{pendingPayloads=[];payload=new Uint8Array(0);chunks=[];push=t=>{this.pendingPayloads.push(t)};next=(t=0)=>{this.payload=this.payload.slice(t);const s=this.pendingPayloads.shift();if(!s)return!1;const e=new Uint8Array(this.payload.byteLength+s.byteLength);return e.set(this.payload,0),e.set(s,this.payload.byteLength),this.payload=e,new DataView(this.payload.buffer)};pushChunk=t=>{this.chunks.push(t),this.chunks.length>100&&this.chunks.shift()};destroy=()=>{this.pendingPayloads=[],this.payload=new Uint8Array(0),this.chunks=[]}}const I=(y,t)=>{const s=new Uint8Array(y),e=new Uint8Array(t),n=new Uint8Array(11+s.length+e.length);let a=0;return n[a++]=1,n[a++]=s[1],n[a++]=s[2],n[a++]=s[3],n[a++]=255,n[a++]=225,n[a++]=s.length>>8&255,n[a++]=s.length&255,n.set(s,a),a+=s.length,n[a++]=1,n[a++]=e.length>>8&255,n[a++]=e.length&255,n.set(e,a),n},T=y=>{let t=0;const s=new DataView(y.buffer),e=s.getUint8(t);if(t=t+1,e!==1)throw new Error("Invalid AVC version");const n=s.getUint8(t)&255;t=t+1;const a=s.getUint8(t)&255;t=t+1;const o=s.getUint8(t)&255;t=t+1;const c=`avc1.${Array.from([n,a,o],U=>U.toString(16).padStart(2,"0")).join("")}`,r=(s.getUint8(t)&3)-1;t=t+1;const g=s.getUint8(t)&31;t=t+1;const p=s.getUint16(t,!1);t=t+2;const h=new Uint8Array(s.buffer.slice(t,t+p));t=t+p;const d=s.getUint8(t)&31;t=t+1;const u=s.getUint16(t,!1);t=t+2;const f=new Uint8Array(s.buffer.slice(t,t+u));return t=t+u,{version:e,codec:c,profile:n,compatibility:a,level:o,lengthSizeMinusOne:r,numOfSequenceParameterSets:g,sequenceParameterSetLength:p,sps:h,numOfPictureParameterSets:d,pictureParameterSetLength:u,pps:f}},M=y=>{const t=new Uint8Array(4+y.length);return new DataView(t.buffer).setUint32(0,y.length,!1),t.set(y,4),t},C=y=>{let t=0;for(const n of y)t+=n.length;const s=new Uint8Array(t);let e=0;for(const n of y){const a=n;s.set(a,e),e+=a.length}return s},D=y=>{let t="unknown";switch(y){case 1:case 2:case 27:case 36:t="video";break;case 3:case 4:case 15:t="audio";break;case 6:t="subtitle";break;case 134:t="ad";break}return t};class x{pat;pmt;audioConfig;videoConfig;payloadMap=new Map;on={};constructor(){}parse=async t=>{let s=0;for(;!(s+188>t.byteLength);){if(t.getInt8(s)!=71){s++;continue}await this.parsePacket(t,s),s+=188}return s};parsePacket=async(t,s)=>{if(s+188>t.byteLength)throw new Error("Invalid TS packet");if(t.getUint8(s)!==71)throw new Error("Invalid TS packet");let e=s;const n=this.parseHeader(t,e);e+=4;const{transport_error_indicator:a,pid:o,payload_unit_start_indicator:l,adaptation_field_control:i}=n;if(a===1||o===void 0)return;let c=184;if(i===2||i===3){const r=t.getUint8(e);e+=1,this.parseAdaptationField(t,e),e+=r,c-=r}if(i===3&&(c-=1),i===1||i===3){const r=new Uint8Array(t.buffer.slice(e,e+c));if(o===0)return this.parsePAT(t,e);{const{programs:h=[]}=this.pat||{};if(h.find(u=>u.pmt_pid===o))return this.parsePMT(t,e)}const{streams:g=[]}=this.pmt||{},p=g.find(h=>h.elementary_pid===o);if(p){if(l===1){const h=this.payloadMap.get(o);if(h){switch(p.kind){case"audio":{const d=await this.parseAudio(h);this.on.chunk&&this.on.chunk(d)}break;case"video":{const d=await this.parseVideo(h);this.on.chunk&&this.on.chunk(d),await new Promise(u=>setTimeout(()=>u(!0),0))}break}this.payloadMap.delete(o)}}{this.payloadMap.has(o)||this.payloadMap.set(o,new Uint8Array);const h=this.payloadMap.get(o),d=new Uint8Array(h.byteLength+r.byteLength);d.set(h,0),d.set(r,h.byteLength),this.payloadMap.set(o,d)}}}};parseHeader=(t,s)=>{let e=s;const n=t.getUint8(e),a=t.getUint8(e+1),o=t.getUint8(e+2),l=t.getUint8(e+3),i=(a&128)>>7;if(i===1)return{sync_byte:n,transport_error_indicator:i};const c=(a&64)>>6,r=(a&32)>>5,g=(a&31)<<8|o,p=(l&192)>>6,h=l>>4&3,d=l&15;return{sync_byte:n,transport_error_indicator:i,payload_unit_start_indicator:c,transport_priority:r,pid:g,transport_scrambling_control:p,adaptation_field_control:h,continuity_counter:d}};parsePAT=(t,s)=>{let e=s,n;{const l=t.getUint8(e);e+=1;const i=t.getUint8(e);if(e+=1,i!==0)throw new Error("Invalid PAT table_id");const c=t.getUint16(e)&4095;e+=2;const r=t.getUint16(e);e+=2;const g=(t.getUint8(e)&62)>>1,p=t.getUint8(e)&1;e+=1;const h=t.getUint8(e);e+=1;const d=t.getUint8(e);e+=1,n={pointer_field:l,table_id:i,section_length:c,transport_stream_id:r,version_number:g,current_next_indicator:p,section_number:h,last_section_number:d}}const a=[];{const l=n.section_length-5-4,i=e+l;for(;e<i;){const c=t.getUint16(e),r=t.getUint16(e+2)&8191;e+=4,c!==0&&r>=32&&r<=8190&&a.push({program_number:c,pmt_pid:r})}}const o=t.getUint32(e);this.pat={header:n,programs:a,crc32:o},this.on.debug&&this.on.debug({pat:this.pat})};parsePMT=(t,s)=>{let e=s,n;{const l=t.getUint8(e);e+=1;const i=t.getUint8(e);if(e+=1,i!==2)throw new Error("Invalid PMT table_id");const c=t.getUint16(e)&4095;e+=2;const r=t.getUint16(e);e+=2;const g=(t.getUint8(e)&62)>>1,p=t.getUint8(e)&1;e+=1;const h=t.getUint8(e);e+=1;const d=t.getUint8(e);e+=1;const u=t.getUint16(e)&8191;e+=2;const f=t.getUint16(e)&4095;e+=2,n={pointer_field:l,table_id:i,section_length:c,transport_stream_id:r,version_number:g,current_next_indicator:p,section_number:h,last_section_number:d,pcr_pid:u,program_info_length:f}}const a=[];{const l=n.section_length-9-4,i=e+l;for(;e<i;){const c=t.getUint8(e),r=D(c),g=t.getUint16(e+1)&8191,p=t.getUint16(e+3)&4095;if(e+=5,g<32||g>8190){console.warn(`Invalid elementary_pid: 0x${g.toString(16)}`);continue}a.push({kind:r,stream_type:c,elementary_pid:g,es_info_length:p})}}const o=t.getUint32(e);this.pmt={header:n,streams:a,crc32:o},this.on.debug&&this.on.debug({pmt:this.pmt})};parseAdaptationField=(t,s)=>{let e=s,n,a,o,l;const i=t.getUint8(e),c=!!(i&128),r=!!(i&64),g=!!(i&32),p=!!(i&16),h=!!(i&8),d=!!(i&4),u=!!(i&2),f=!!(i&1);e+=1;const U=(_,b)=>{let m=BigInt(0);m|=BigInt(_.getUint16(b))<<25n,m|=BigInt(_.getUint16(b+1))<<17n,m|=BigInt(_.getUint16(b+2))<<9n,m|=BigInt(_.getUint16(b+3))<<1n,m|=BigInt(_.getUint16(b+4)>>7);const S=(_.getUint16(b+4)&1)<<8|_.getUint16(b+5);return m=m*300n+BigInt(S),m};if(p&&(n=U(t,e),e+=6),h&&(a=U(t,e),e+=6),d&&(o=t.getInt8(e),e+=1),u){const _=t.getUint8(e);e+=1,l=new Uint8Array(t.buffer,e,_),e+=_}return{discontinuity_indicator:c,random_access_indicator:r,elementary_stream_priority_indicator:g,pcr_flag:p,opcr_flag:h,splicing_point_flag:d,transport_private_data_flag:u,adaptation_field_extension_flag:f,pcr:n,opcr:a,splice_countdown:o,transport_private_data:l}};parseAudio=async t=>{const s=new DataView(t.buffer);let e=0,n,a;{const o=s.getUint8(e)===0&&s.getUint8(e+1)===0&&s.getUint8(e+2)===1;if(e+=3,!o)throw new Error("invalid ts audio payload.");const l=s.getUint8(e);e+=1;const i=s.getUint8(e)<<8|s.getUint8(e+1);e+=2;let c,r,g,p,h;{const f=s.getUint8(e);e+=1,c=f>>4&3,r=(f>>3&1)===1,g=(f>>2&1)===1,p=(f>>1&1)===1,h=(f&1)===1}let d,u;{const f=s.getUint8(e);e+=1;const U=f>>6,_=s.getUint8(e);e+=1,(U&2)===2&&(d=this.parsePtsDts(s,e)),(U&1)===1?u=this.parsePtsDts(s,e+5):u=d,e+=_}n={stream_id:l,pes_packet_length:i,scrambling_control:c,priority:r,data_alignment:g,copyright:p,original_copy:h,pts:d,dts:u}}a=t.slice(e);{if(!this.audioConfig&&s.getUint8(e)===255){const g=s.getUint8(e+2),p=s.getUint8(e+3);let h,d;d=g>>2&15,h=(g&1)<<2|p>>6;const u=`mp4a.40.${h}`,U=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][d];this.audioConfig={kind:"audio",codec:u,sampleRate:U,numberOfChannels:h},this.on.config&&this.on.config(this.audioConfig)}const{dts:o=0,pts:l=0}=n,i=l-o,c=a.slice(7);return{kind:"audio",type:"key",dts:o,pts:l,cts:i,data:c}}};parseVideo=async t=>{const s=new DataView(t.buffer);let e=0,n,a;{const o=s.getUint8(e)===0&&s.getUint8(e+1)===0&&s.getUint8(e+2)===1;if(e+=3,!o)throw new Error("invalid ts video payload.");const l=s.getUint8(e);e+=1;const i=s.getUint8(e)<<8|s.getUint8(e+1);e+=2;let c,r,g,p,h;{const f=s.getUint8(e);e+=1,c=f>>4&3,r=(f>>3&1)===1,g=(f>>2&1)===1,p=(f>>1&1)===1,h=(f&1)===1}let d,u;{const f=s.getUint8(e);e+=1;const U=f>>6,_=s.getUint8(e);e+=1,(U&2)===2&&(d=this.parsePtsDts(s,e)),(U&1)===1?u=this.parsePtsDts(s,e+5):u=d,e+=_}n={stream_id:l,pes_packet_length:i,scrambling_control:c,priority:r,data_alignment:g,copyright:p,original_copy:h,pts:d,dts:u}}a=t.slice(e);{const o=this.getNalus(a);if(!this.videoConfig){let h,d;if(h=o.find(f=>f.type===7)?.nalu.slice(4),d=o.find(f=>f.type===8)?.nalu.slice(4),h&&d){const u=I(h,d),{codec:f}=T(u);this.videoConfig={kind:"video",codec:f,description:u,sps:h,pps:d},this.on.config&&this.on.config(this.videoConfig)}}const l=[];let i="delta";for(const h of o){const{type:d,nalu:u}=h;switch(d){case 6:case 9:l.push(u);break;case 1:i="delta",l.push(u);break;case 5:i="key",l.push(u);break}}const c=C(l),{dts:r=0,pts:g=0}=n,p=g-r;return{kind:"video",type:i,dts:r,pts:g,cts:p,data:c,nalus:l}}};parsePtsDts(t,s){const e=t.getUint8(s),n=t.getUint8(s+1),a=t.getUint8(s+2),o=t.getUint8(s+3),l=t.getUint8(s+4),i=(BigInt(e)&0b00001110n)<<29n|(BigInt(n)&0b11111111n)<<22n|(BigInt(a)&0b11111110n)<<14n|(BigInt(o)&0b11111111n)<<7n|(BigInt(l)&0b11111110n)>>1n;return Number(i)/90}getNalus=t=>{const s=[];let e=0;for(;!(e+4>t.byteLength);){if(t[e]!==0||t[e+1]!==0||t[e+2]!==1){e+=1;continue}e+=3;let n=e;const a=t[e]&31;for(e+=1;!(e+1>t.byteLength);){if(t[e]!==0||t[e+1]!==0||t[e+2]!==1){e+=1;continue}break}let o=e-n;if(t[e-1]===0&&(o-=1),o!==0){const l=t.slice(n,n+o),i=M(l);s.push({type:a,nalu:i})}}return s}}const k=(y,t)=>y.getUint8(t)<<16|y.getUint8(t+1)<<8|y.getUint8(t+2);class L{audioConfig;videoConfig;header;textDecoder=new TextDecoder("utf-8");on={};constructor(){}parse=async t=>{let s=0;for(this.header||(this.parseHeader(t,s),s+=9);this.isSurplusTag(t,s)!==!1;){const n=this.parseTagHeader(t,s+4),{tagType:a,dataSize:o,timestamp:l}=n;if(a){const i=this.parseTagBody(a,t,s+4+11,o);switch(a){case"script":this.on.info&&this.on.info(i);break;case"audio":{const{accPacketType:c}=i;if(c===0){const{codec:r,sampleRate:g,channelConfiguration:p}=i;this.audioConfig={kind:"audio",codec:r,sampleRate:g,numberOfChannels:p},this.on.config&&this.on.config(this.audioConfig)}else{const{cts:r,data:g}=i,p="key",h=r===void 0?void 0:r+l;this.on.chunk&&this.on.chunk({kind:"audio",type:p,dts:l,pts:h,cts:r,data:g})}}break;case"video":{const{avcPacketType:c}=i;if(c===0){const{codec:r,sps:g,pps:p,data:h}=i;this.videoConfig={kind:"video",codec:r,description:h,sps:g,pps:p},this.on.config&&this.on.config(this.videoConfig)}else{const{frameType:r,cts:g,data:p,nalus:h}=i,d=r===1?"key":"delta",u=g===void 0?void 0:g+l;this.on.chunk&&this.on.chunk({kind:"video",type:d,dts:l,pts:u,cts:g,data:p,nalus:h})}}break}s=s+4+11+o}await new Promise(i=>setTimeout(()=>i(!0),8))}return s};parseHeader=(t,s)=>{let e,n,a,o;e=t.getUint8(s)<<16|t.getUint8(s+1)<<8|t.getUint8(s+2),n=t.getUint8(3);{const i=t.getUint8(0).toString(2).padStart(5,"0").split(""),[,,c,,r]=i;a={audio:r==="1",video:c==="1"}}o=t.getUint32(5),this.header={signature:e,version:n,flags:a,dataOffset:o}};isSurplusTag=(t,s)=>{let e=!0;const n=t.byteLength;if(s+4>n)e=!1;else if(s+4+11>n)e=!1;else{const a=k(t,s+4+1);s+4+11+a>n&&(e=!1)}return e};parseTagHeader=(t,s)=>{let e,n,a,o,l;{const i=t.getUint8(s);let c;switch(i){case 18:c="script";break;case 8:c="audio";break;case 9:c="video";break}e=c}return n=k(t,s+1),a=k(t,s+4),o=t.getUint8(s+7),l=k(t,s+8),{tagType:e,dataSize:n,timestamp:a,timestampExtended:o,streamID:l}};parseTagBody=(t,s,e,n)=>{let a;switch(t){case"script":a=this.parseMetaData(s,e);break;case"audio":a=this.parseAudio(s,e,n);break;case"video":a=this.parseVideo(s,e,n);break}return a};parseMetaData=(t,s)=>{let e=s;{if(t.getUint8(e)!==2)throw new Error("Invalid AMF type for onMetaData (expected 0x02)");e=e+1}const n=t.getUint16(e,!1);e=e+2;{const l=new Int8Array(t.buffer.slice(e,e+n));if((this.textDecoder?.decode(l)||"")!=="onMetaData")throw new Error("Expected \'onMetaData\' string");e=e+n}const a=this.getAmfType(t,e);return e=e+1,this.getAMFValue(t,e,a).value};parseAudio=(t,s,e)=>{let n=s;const a=t.getUint8(n),o=a>>4&15,l=a>>2&3,i=a>>1&1,c=a&1;n=n+1;const r=t.getUint8(n);n=n+1;const g=e,p=new Uint8Array(t.buffer.slice(n,n+g));if(o===10&&r===0){const h=t.getUint8(n),d=t.getUint8(n+1),u=h>>3&31,f=(h&7)<<1|d>>7,U=d>>3&15,_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],b=`mp4a.40.${u}`,m=_[f];return{soundFormat:o,soundRate:l,soundSize:i,soundType:c,accPacketType:r,data:p,samplingFrequencyIndex:f,channelConfiguration:U,codec:b,sampleRate:m}}return{soundFormat:o,soundRate:l,soundSize:i,soundType:c,accPacketType:r,data:p}};parseVideo=(t,s,e)=>{let n=s;const a=t.getUint8(n),o=a>>4&15,l=a&15;n=n+1;const i=t.getUint8(n);n=n+1;const c=k(t,n);n=n+3;const r=e-5,g=new Uint8Array(t.buffer.slice(n,n+r));switch(l){case 7:if(i===0){const p=T(g);return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g,...p}}else if(i===1){const p=[],h=n+e-5;for(;!(n+4>h);){const d=t.getUint32(n,!1),u=new Uint8Array(t.buffer.slice(n,n+4+d));n+=4+d,p.push(u)}return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g,nalus:p}}break;default:throw new Error("Unsupported codecID")}return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g}};getAmfType=(t,s)=>t.getUint8(s);getAMFName=(t,s,e)=>{const n=new Uint8Array(t.buffer.slice(s,s+e));return this.textDecoder?.decode(n)||""};getAMFValue=(t,s,e)=>{let n=s,a,o=0;switch(e){case 0:a=t.getFloat64(n,!1),o=8;break;case 1:a=!!t.getUint8(n),o=1;break;case 2:{a="";const i=t.getUint16(n,!1);n=n+2;const c=new Int8Array(t.buffer,n,i).filter(g=>g!==0);a=(this.textDecoder?.decode(c)||"").trim(),o=2+i}break;case 3:for(a={};n<t.byteLength;){const i=t.getUint16(n,!1);if(i===0)break;n=n+2;const c=this.getAMFName(t,n,i);n=n+i;const r=this.getAmfType(t,n);if(r===6)break;n=n+1;const g=this.getAMFValue(t,n,r);n=n+g.length,a[c]=g.value,o=2+i+1+g.length}break;case 8:{a={};const i=t.getUint32(n,!1);n=n+4;for(let c=0;c<i;c++){const r=t.getUint16(n,!1);n=n+2;const g=this.getAMFName(t,n,r);n=n+r;const p=this.getAmfType(t,n);n=n+1;const h=this.getAMFValue(t,n,p);n=n+h.length,a[g]=h.value,o=2+r+1+h.length}}break;case 10:{a=[];const i=t.getUint32(n,!1);n=n+4;for(let c=0;c<i;c++){const r=this.getAmfType(t,n);n=n+1;const g=this.getAMFValue(t,n,r);n=n+g.length,a.push(g.value),o=1+g.length}}break}return{amfType:e,length:o,value:a}}}class O{pattern;cacher=new P;isParseing=!1;offset=0;parser;on={};constructor(){}init=t=>{switch(this.destroy(),this.pattern=t,this.pattern){case"flv":this.parser=new L;break;case"hls":this.parser=new x;break;default:throw new Error("is error pattern.")}this.parser.on.debug=s=>this.on.debug&&this.on.debug(s),this.parser.on.info=s=>this.on.info&&this.on.info(s),this.parser.on.config=s=>this.on.config&&this.on.config(s),this.parser.on.chunk=s=>{this.cacher.pushChunk(s),this.on.chunk&&this.on.chunk(s)}};push=t=>{this.cacher.push(t),this.isParseing===!1&&this.parse()};destroy=()=>{this.cacher.destroy(),this.isParseing=!1,this.offset=0};parse=async()=>{try{if(this.isParseing=!0,!this.pattern)throw new Error("You need to set the pattern.");if(!this.parser)throw new Error("You need to init parser.");for(;;){const t=this.cacher.next(this.offset);if(this.offset=0,!t)break;this.offset=await this.parser.parse(t)}this.isParseing=!1}catch{this.destroy()}}}const A=new O;A.on.info=y=>postMessage({action:"on.info",data:y}),A.on.config=y=>postMessage({action:"on.config",data:y}),A.on.chunk=y=>postMessage({action:"on.chunk",data:y}),A.on.debug=y=>postMessage({action:"on.debug",data:y}),onmessage=y=>{const{action:t,data:s}=y.data,e=A[t];e&&e(s)}})();\n',Sn=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,xn],{type:`text/javascript;charset=utf-8`});function Cn(e){let t;try{if(t=Sn&&(self.URL||self.webkitURL).createObjectURL(Sn),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(xn),{name:e?.name})}}var wn=class{worker=new Cn;on={};constructor(){this.worker.onmessage=e=>{let{action:t,data:n}=e.data;switch(t){case`on.info`:this.on.info&&this.on.info(n);break;case`on.config`:this.on.config&&this.on.config(n);break;case`on.chunk`:this.on.chunk&&this.on.chunk(n);break;case`on.debug`:this.on.debug&&this.on.debug(n);break}}}init=e=>this.worker.postMessage({action:`init`,data:e});push=e=>this.worker.postMessage({action:`push`,data:e});destroy=()=>{this.worker.postMessage({action:`destroy`,data:{}}),this.worker.terminate()}},Tn=`(function(){"use strict";class a{pattern="flv";audioDecoderConfig;audioDecoder;videoDecoderConfig;videoDecoder;hasKeyFrame=!1;baseTime=0;pendingChunks=[];currentChunk;isProcessing=!1;decodeTimer=0;frameTrack=!1;isFrameTrack=!1;fameTrackOption={flv:[30,50],hls:[200,300],dash:[50,100],rtmp:[50,100]};decodingSpeedRatio=1;maxDecodingSpeedRatio=2;decodingSpeed=16;fps=0;firstVideoChunkTimestamp;secondVideoChunkTimestamp;frameStartTime;lastRenderTime;nextRenderTime;on={audio:{},video:{}};constructor(){}init=e=>{this.destroy(),this.pattern=e,this.baseTime=new Date().getTime()-performance.now(),this.initDecodeInterval()};initAudio=e=>{this.audio.destroy(),this.audioDecoderConfig={...e},this.audioDecoder=new AudioDecoder({output:i=>{const o=this.decodingSpeedRatio;this.on.audio.decode&&this.on.audio.decode({audioData:i,playbackRate:o})},error:i=>{this.on.audio.error&&this.on.audio.error(i)}}),this.audioDecoder.configure(this.audioDecoderConfig)};initVideo=e=>{this.video.destroy(),this.videoDecoderConfig={...e},this.videoDecoder=new VideoDecoder({output:async i=>{this.frameStartTime||(this.frameStartTime=i.timestamp);try{const o=i.timestamp-this.frameStartTime+this.baseTime*1e3,s=await createImageBitmap(i);if(i.close(),!s.width||!s.height)return s.close();this.on.video.decode&&this.on.video.decode({timestamp:o,bitmap:s}),this.currentChunk&&this.currentChunk.kind==="video"&&this.currentChunk.nalus&&this.on.nalus&&this.on.nalus(this.currentChunk.nalus)}catch{i.close()}},error:i=>{this.on.video.error&&this.on.video.error(i)}}),this.videoDecoder.configure(this.videoDecoderConfig)};setFrameTrack=e=>{this.frameTrack=e,this.frameTrack===!1&&(this.decodingSpeedRatio=1)};push=e=>{this.pendingChunks.push(e)};destroy=()=>{this.audio.destroy(),this.video.destroy(),this.pendingChunks=[],this.firstVideoChunkTimestamp=void 0,this.secondVideoChunkTimestamp=void 0,this.frameStartTime=void 0,this.lastRenderTime=void 0,this.nextRenderTime=void 0,clearInterval(this.decodeTimer)};initDecodeInterval=()=>{let e=this.decodingSpeed/this.decodingSpeedRatio;const i=this.baseTime+performance.now();if(this.lastRenderTime||(this.lastRenderTime=i),this.fps=Math.round(1e3/(i-this.lastRenderTime)),this.lastRenderTime=i,this.nextRenderTime){const o=this.lastRenderTime-this.nextRenderTime;e-=o}this.nextRenderTime=this.lastRenderTime+e,this.decodeTimer=setTimeout(()=>{this.decode(),this.initDecodeInterval()},e)};decode=()=>{if(this.isProcessing!==!0){for(this.isProcessing=!0;this.currentChunk=this.pendingChunks.shift(),!!this.currentChunk;){const e=this.pendingChunks.length;if(this.frameTrack){const[s,n]=this.fameTrackOption[this.pattern];if(e<=s&&(this.isFrameTrack=!1),e>=n&&(this.isFrameTrack=!0),this.isFrameTrack){const r=Math.min(1+(e-s)/100,this.maxDecodingSpeedRatio);this.decodingSpeedRatio=Number(r.toFixed(1))}else this.decodingSpeedRatio=1}if(this.on.analysis){const{decodingSpeed:s,decodingSpeedRatio:n,fps:r}=this;this.on.analysis({decodingSpeed:s,decodingSpeedRatio:n,fps:r,cacheLength:e})}const{kind:i,init:o}=this.currentChunk;switch(i){case"audio":this.decodeAudio(o);break;case"video":this.decodeVideo(o);break}if(i==="video")break}this.isProcessing=!1}};decodeAudio=e=>{if(!this.audioDecoder)return;const i=new EncodedAudioChunk(e);this.audioDecoder.decode(i)};decodeVideo=e=>{if(this.videoDecoder&&(e.type==="key"&&(this.hasKeyFrame=!0),this.firstVideoChunkTimestamp?this.secondVideoChunkTimestamp||(this.secondVideoChunkTimestamp=e.timestamp,this.decodingSpeed=(this.secondVideoChunkTimestamp-this.firstVideoChunkTimestamp)/1e3):this.firstVideoChunkTimestamp=e.timestamp,this.hasKeyFrame)){const i=new EncodedVideoChunk(e);this.videoDecoder.decode(i)}};audio={flush:()=>{this.audioDecoder?.flush()},destroy:()=>{this.audioDecoderConfig=void 0,this.audioDecoder?.close(),this.audioDecoder=void 0}};video={flush:()=>{this.videoDecoder?.flush()},destroy:()=>{this.videoDecoderConfig=void 0,this.videoDecoder?.close(),this.videoDecoder=void 0,this.hasKeyFrame=!1}}}const d=new a;d.on.audio.decode=t=>postMessage({action:"on.audio.decode",data:t},[t.audioData]),d.on.audio.error=t=>postMessage({action:"on.audio.error",data:t}),d.on.video.decode=t=>postMessage({action:"on.video.decode",data:t},[t.bitmap]),d.on.video.error=t=>postMessage({action:"on.video.error",data:t}),d.on.nalus=t=>postMessage({action:"on.nalus",data:t}),d.on.analysis=t=>postMessage({action:"on.analysis",data:t}),onmessage=t=>{const{action:e,data:i}=t.data,o=d[e];o&&o(i)}})();
|
|
3
|
-
|
|
4
|
-
`,An=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,kn],{type:`text/javascript;charset=utf-8`});function jn(e){let t;try{if(t=An&&(self.URL||self.webkitURL).createObjectURL(An),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(kn),{name:e?.name})}}var Mn=class{worker=new jn;constructor(){}push=e=>this.worker.postMessage({action:`push`,data:e},[e.bitmap]);addCut=e=>{let t=[];e.writable&&t.push(e.writable),e.offscreen&&t.push(e.offscreen),this.worker.postMessage({action:`addCut`,data:e},t)};delCut=e=>this.worker.postMessage({action:`delCut`,data:e});setCut=e=>this.worker.postMessage({action:`setCut`,data:e});setPause=e=>this.worker.postMessage({action:`setPause`,data:e});destroy=()=>{this.worker.postMessage({action:`destroy`,data:{}}),this.worker.terminate()}},Nn=class{inputStream=new MediaStream;outputStream=new MediaStream;inputGain=1;enhanceGain=1;bgsGain=1;bgmGain=1;outputGain=1;mixAudioMap=new Map;audioContext=new AudioContext;sourceNode;inputGainNode;enhanceGainNode;bgsGainNode;bgmGainNode;rnnoiseNode;analyserNode;analyserArrayData;outputGainNode;destinationNode;denoise=!1;mute=!0;rnnoiseWorklet;rnnoiseWorkletNode;filterStream=e=>e;constructor(e,t){this.inputStream=e,t&&(this.audioContext=t),this.sourceNode=this.audioContext.createMediaStreamSource(this.inputStream),this.inputGainNode=this.audioContext.createGain(),this.inputGainNode.gain.setValueAtTime(this.inputGain,this.audioContext.currentTime),this.enhanceGainNode=this.audioContext.createGain(),this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain,this.audioContext.currentTime),this.bgsGainNode=this.audioContext.createGain(),this.bgsGainNode.gain.setValueAtTime(this.bgsGain,this.audioContext.currentTime),this.bgmGainNode=this.audioContext.createGain(),this.bgmGainNode.gain.setValueAtTime(this.bgmGain,this.audioContext.currentTime),this.analyserNode=this.audioContext.createAnalyser(),this.analyserNode.fftSize=512,this.analyserArrayData=new Uint8Array(this.analyserNode.frequencyBinCount),this.outputGainNode=this.audioContext.createGain(),this.outputGainNode.gain.setValueAtTime(this.outputGain,this.audioContext.currentTime),this.destinationNode=this.audioContext.createMediaStreamDestination(),this.outputStream=this.destinationNode.stream;{let{sourceNode:e,inputGainNode:t,enhanceGainNode:n,bgsGainNode:r,bgmGainNode:i,analyserNode:a,outputGainNode:o,destinationNode:s}=this;e.connect(t),t.connect(n),n.connect(a),r.connect(a),i.connect(a),n.connect(s),r.connect(s),i.connect(s),o.connect(this.audioContext.destination)}this.audioContext.resume()}use=({rnnoise:e})=>{this.rnnoiseWorklet=new e.RnnoiseWorklet};_changeSource=()=>{this.sourceNode.disconnect(),this.sourceNode=this.audioContext.createMediaStreamSource(this.inputStream),this.sourceNode.connect(this.inputGainNode)};replaceTrack=e=>{let t=this.inputStream.getTracks();for(let e of t)this.inputStream.removeTrack(e);this.inputStream.addTrack(e),this._changeSource()};stop=()=>{{let e=this.inputStream.getTracks();for(let t of e)t.stop(),this.inputStream.removeTrack(t)}};pause=async e=>{let t=this.inputStream.getTracks();for(let n of t)n.enabled=!e};getStream=()=>this.filterStream(this.outputStream);setMute=(e=!0)=>{this.mute=e,this.analyserNode.disconnect(),e===!1&&this.analyserNode.connect(this.outputGainNode)};setDenoise=async(e=!0)=>{this.rnnoiseWorklet&&(this.inputGainNode.disconnect(),this.rnnoiseWorklet.destroy(),e?(this.rnnoiseWorkletNode=await this.rnnoiseWorklet.createRnnoiseWorkletNode(this.audioContext),this.inputGainNode.connect(this.rnnoiseWorkletNode),this.rnnoiseWorkletNode.connect(this.enhanceGainNode)):this.inputGainNode.connect(this.enhanceGainNode),this.denoise=e)};setInputGain=e=>{this.inputGain=e,this.inputGainNode.gain.setValueAtTime(e,this.audioContext.currentTime)};setEnhanceGain=async e=>{this.enhanceGain=e+1,this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain,this.audioContext.currentTime)};setBgsGain=e=>{this.bgsGain=e,this.bgsGainNode.gain.setValueAtTime(e,this.audioContext.currentTime)};setBgmGain=e=>{this.bgmGain=e,this.bgmGainNode.gain.setValueAtTime(e,this.audioContext.currentTime)};setOutputGain=e=>{this.outputGain=e,this.outputGainNode.gain.setValueAtTime(this.outputGain,this.audioContext.currentTime)};getVolume=()=>{let{analyserNode:e,analyserArrayData:t}=this;e.getByteFrequencyData(t);let n=0;for(let e=0;e<t.length;e++)n+=t[e];return Math.ceil(n/t.length)};mixAudio=(e,t=`bgm`)=>new Promise(async(n,r)=>{try{{let e=this.mixAudioMap.get(t);e&&e.stop()}let r=t===`bgs`?this.bgsGainNode:this.bgmGainNode,i=this.audioContext.createBufferSource();this.mixAudioMap.set(t,i),i.buffer=e,i.connect(r),i.onended=()=>{i.disconnect(r),this.mixAudioMap.delete(t),n(!0)},i.start(0)}catch(e){r(e)}});mixAudioStop=e=>{this.mixAudioMap.get(e)?.stop()};changeMix=(e,t)=>{let n=e===`bgs`?this.bgsGainNode:this.bgmGainNode;t?n.connect(this.destinationNode):n.disconnect(this.destinationNode)}},Pn=async(e,t)=>{try{let{format:n,numberOfChannels:r,numberOfFrames:i,sampleRate:a}=t,o=e.createBuffer(r,i,a);for(let e=0;e<r;e++){let r=t.allocationSize({planeIndex:e}),a=new Uint8Array(r);t.copyTo(a,{planeIndex:e});let s=new DataView(a.buffer),c=o.getChannelData(e);for(let e=0;e<i;e++){let t;switch(n){case`s16`:case`s16-planar`:t=s.getInt16(e*2,!0)/32768;break;case`f32`:case`f32-planar`:t=s.getFloat32(e*4,!0);break;case`u8`:case`u8-planar`:t=(s.getUint8(e)-128)/128;break;default:throw Error(`Unsupported audio format: ${n}`)}c[e]=Math.max(-1,Math.min(1,t))}}return o}catch(e){throw console.error(`Failed to convert AudioData to AudioBuffer:`,e),e}},Fn=class{prAudioStream;audioContext;destination;stream=new MediaStream;nextStartTime=0;pendingSources=[];constructor(){}init=e=>{e||=new(window.AudioContext||window.webkitAudioContext),this.audioContext=e,this.destination=this.audioContext.createMediaStreamDestination(),this.stream=new MediaStream,this.stream.addTrack(this.destination.stream.getAudioTracks()[0]),this.prAudioStream=new Nn(this.stream,this.audioContext),this.nextStartTime=0,this.pendingSources=[]};async push(e){let{audioData:t,playbackRate:n=1}=e;if(!this.audioContext||!this.destination)return;let r=await Pn(this.audioContext,t);if(t.close(),!r)return;let i=this.audioContext.createBufferSource();i.buffer=r,i.playbackRate.value=n;let a=-1200*Math.log2(n);i.detune.value=a,i.connect(this.destination);let o=Math.max(this.nextStartTime,this.audioContext.currentTime);this.nextStartTime=o+r.duration/n,i.start(o),this.pendingSources.push(i),i.onended=()=>{this.pendingSources=this.pendingSources.filter(e=>e!==i)},this.audioContext.state===`suspended`&&await this.audioContext.resume()}getStream=()=>this.prAudioStream?.getStream();destroy(){this.audioContext?.close(),this.audioContext=void 0,this.destination=void 0,this.nextStartTime=0,this.prAudioStream?.stop(),this.pendingSources.forEach(e=>e.stop()),this.pendingSources=[]}},In=e=>{let t=e.toLowerCase();return t.includes(`.m3u8`)||t.includes(`hls`)||t.includes(`master.m3u8`)||t.match(/index\d*\.m3u8/)?`hls`:t.includes(`.mpd`)||t.includes(`dash`)?`dash`:t.startsWith(`rtmp://`)||t.startsWith(`rtmps://`)?`rtmp`:t.includes(`.flv`)||t.includes(`flv`)&&!t.includes(`flash`)?`flv`:`unknown`},Ln=e=>{let t=e?.getTracks()||[];for(let e of t)e.stop()},Rn=class{resolvesMap=new Map;index=0;constructor(){}add=(e,t=()=>!1,n=0)=>new Promise(r=>{if(t())return r(!0);this.resolvesMap.has(e)||this.resolvesMap.set(e,new Map),this.index++;let i=`${this.index}`;if(n=Math.max(0,n),n===0){this.resolvesMap.get(e)?.set(i,{resolve:r,timer:0});return}let a=window.setTimeout(()=>{this.emit(e)},n);this.resolvesMap.get(e)?.set(i,{resolve:r,timer:a})});emit=async e=>{let t=this.resolvesMap.get(e);if(!t)return;let n=[...t.keys()];for(let e of n){let n=t.get(e);n&&(clearTimeout(n.timer),n.resolve(),t.delete(e))}}},zn=e=>{let t=new DataView(e.buffer),n=0,r,i,a;r=t.getUint32(n,!1),n+=4;{let e=t.getUint8(n);i={forbidden_zero_bit:e>>7&1,nal_ref_idc:e>>5&3,nal_unit_type:e&31},n+=1}{let e=r-1;a=new Uint8Array(t.buffer.slice(n,n+e))}return{size:r,header:i,data:a}},Bn=class{#e={timeout:5*1e3,check:!1};#t=null;constructor(e={}){this.#e={...this.#e,...e}}#n=(e,t)=>new Promise(async n=>{this.#t=new AbortController;let{signal:r}=this.#t,i=this.#e.timeout,a=setTimeout(()=>{this.#t?.abort(`Timeout (${i}ms)`)},i);await fetch(e,{cache:`no-store`,...t,method:`HEAD`,signal:r}).then(e=>{clearTimeout(a),n({status:e.status===200?`successed`:`failed`,reason:e.status===200?``:`HTTP ${e.status}`})}).catch(e=>{if(clearTimeout(a),e.name===`AbortError`){let e=r.reason||`Actively stopped`;n({status:e.includes(`Timeout`)?`timeout`:`stopped`,reason:e})}else n({status:`error`,reason:e.message})})});request=(e,t)=>new Promise(async(n,r)=>{try{this.stop(),this.#e.check&&await this.#n(e),this.#t=new AbortController;let{signal:r}=this.#t;n(await fetch(e,{cache:`no-store`,...t,signal:r}))}catch(e){r(e)}});stop=()=>{if(this.#t?.signal.aborted===!1){let e=Error(`Actively stopped.`);e.name=`AbortError`,this.#t.abort(e)}}},Vn=class{option={debug:!1,frameTrack:!1};converter=`MediaStreamTrackGenerator`in window?`generator`:`canvas`;prFetch=new Bn;getSegmentsFetch=new Bn;prResolves=new Rn;url=``;start_resolve;demuxerWorker;decoderWorker;audioPlayer;renderWorker;stream;on={demuxer:{},decoder:{}};cutRenders=new Map;trackGenerator;constructor(e={}){let{debug:t=!1}=e;this.option.debug=t}start=async e=>{await this.stop(),this.url=e;let t=In(e);if(t===`unknown`)throw Error(`This address cannot be parsed.`);switch(this.init(t),t){case`flv`:this.flv.start();break;case`hls`:this.hls.start();break}};stop=async()=>{try{this.url=``,clearInterval(this.hls.getSegmentsTimer),this.prFetch.stop(),this.getSegmentsFetch.stop(),this.demuxerWorker?.destroy(),this.decoderWorker?.destroy(),this.renderWorker?.destroy(),this.cutRenders=new Map,Ln(this.stream),this.audioPlayer?.destroy()}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-player: error`,e)}};getStream=()=>this.stream;setPause=e=>{this.renderWorker?.setPause({pause:e})};setMute=e=>this.audioPlayer?.prAudioStream?.setMute(e);setOutputGain=e=>{this.audioPlayer?.prAudioStream?.setOutputGain(e)};setFrameTrack=e=>{this.option.frameTrack=e,this.decoderWorker?.setFrameTrack(e)};isReady=()=>this.prResolves.add(`isReady`,()=>this.stream?.active===!0);cut={create:(e,t)=>{if(this.converter===`generator`){let n=new MediaStreamTrackGenerator({kind:`video`}),r=new MediaStream([n]);return this.renderWorker?.addCut({key:e,writable:n.writable,option:t}),this.cutRenders.set(e,{stream:r}),r}let n=document.createElement(`canvas`),r=n.captureStream(),i=n.transferControlToOffscreen();return this.renderWorker?.addCut({key:e,offscreen:i,option:t}),this.cutRenders.set(e,{stream:r}),r},setCut:(e,t)=>{this.renderWorker?.setCut({key:e,cutOption:t})},getStream:e=>this.cutRenders.get(e)?.stream,remove:e=>{this.renderWorker?.delCut(e),this.cutRenders.delete(e)},setPause:(e,t)=>{this.renderWorker?.setPause({key:e,pause:t})}};init=e=>{this.initRender(),this.initDecoder(e),this.initDemuxer(e),this.audioPlayer=new Fn,this.audioPlayer.init()};initDemuxer=e=>{this.demuxerWorker=new wn,this.demuxerWorker.init(e),this.demuxerWorker.on.debug=e=>{this.option.debug&&this.on.debug&&this.on.debug(e)},this.demuxerWorker.on.info=e=>{this.option.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-player: info`,e),this.on.demuxer.info&&this.on.demuxer.info(e)},this.demuxerWorker.on.config=e=>{this.option.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-player: config`,e),this.on.demuxer.config&&this.on.demuxer.config(e);let{kind:t}=e;switch(t){case`audio`:{let{codec:t,sampleRate:n,numberOfChannels:r}=e;this.decoderWorker?.initAudio({codec:t,sampleRate:n,numberOfChannels:r})}break;case`video`:{let{codec:t,description:n}=e;this.decoderWorker?.initVideo({codec:t,description:n})}break}},this.demuxerWorker.on.chunk=e=>{if(this.on.demuxer.chunk&&this.on.demuxer.chunk(e),!this.decoderWorker)return;let{kind:t}=e;switch(t){case`audio`:{let{type:n,dts:r,data:i}=e,a=r*1e3;this.decoderWorker.push({kind:t,init:{type:n,timestamp:a,data:i}})}break;case`video`:{let{type:n,dts:r,data:i,nalus:a=[]}=e,o=r*1e3;this.decoderWorker.push({kind:t,init:{type:n,timestamp:o,data:i},nalus:a})}break}}};initDecoder=e=>{this.decoderWorker=new On,this.decoderWorker.init(e);let{frameTrack:t=!1}=this.option;this.decoderWorker.setFrameTrack(t),this.decoderWorker.on.audio.decode=e=>{this.audioPlayer?.push(e),this.on.decoder.audio&&this.on.decoder.audio(e)},this.decoderWorker.on.audio.error=e=>{this.option.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-player: audio.error `,e),this.on.error&&this.on.error(e)},this.decoderWorker.on.video.decode=async e=>{this.start_resolve&&=(this.start_resolve(!0),void 0),this.renderWorker?.push(e),this.on.decoder.video&&this.on.decoder.video(e)},this.decoderWorker.on.video.error=e=>{this.on.error&&this.on.error(e)},this.decoderWorker.on.nalus=async e=>{for(let t of e){if(t.byteLength<=4)continue;let{header:e,data:n}=zn(t),{nal_unit_type:r}=e;r===6&&this.on.decoder.sei&&this.on.decoder.sei(n)}},this.decoderWorker.on.analysis=e=>{this.on.decoder.analysis&&this.on.decoder.analysis(e)}};initRender=()=>{if(this.renderWorker=new Mn,this.converter===`generator`){let e=new MediaStreamTrackGenerator({kind:`video`}),t=new MediaStream([e]);this.renderWorker?.addCut({writable:e.writable}),this.stream=t}else{let e=document.createElement(`canvas`),t=e.captureStream(),n=e.transferControlToOffscreen();this.renderWorker?.addCut({offscreen:n}),this.stream=t}this.renderWorker?.setPause({pause:!1})};flv={start:()=>new Promise(async(e,t)=>{try{this.start_resolve=e;let n,r=0;for(;;){r+=1;try{n=await this.prFetch.request(this.url)}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->Breathe: error`,e)}if(n?.status===200||r===3)break;await new Promise(e=>setTimeout(()=>e(!0),500))}if(!n||n.status!==200)return t(`request is error.`);let i=n.body?.getReader();if(!i)return t(`reader is error.`);for(;;){let{done:e,value:t}=await i.read();if(t&&this.demuxerWorker?.push(t),e||this.url===``)break}}catch(e){e.name!==`AbortError`&&t(e)}})};hls={isLive:!1,urls:[],url:``,getSegmentsTimer:0,parse:async e=>{let t=new TextDecoder(`utf-8`).decode(e).split(`
|
|
5
|
-
`).map(e=>e.replace(`\r`,``)),n=this.url.substring(0,this.url.lastIndexOf(`/`)+1),r=4,i=0,a=!1,o=[];for(let e of t)e.startsWith(`#EXTINF:`)?r=parseFloat(e.split(`:`)[1].split(`,`)[0]):e.startsWith(`#EXT-X-TARGETDURATION:`)?i=parseInt(e.split(`:`)[1]):e.startsWith(`#EXT-X-ENDLIST`)?a=!1:e.startsWith(`#EXT-X-MEDIA-SEQUENCE:`)?a=!0:e.includes(`.ts`)&&!e.startsWith(`#`)&&o.push({url:e.startsWith(`http`)?e:n+e,duration:r,isLive:a});return{baseUrl:n,targetDuration:i,isLive:a,segments:o}},getSegments:async()=>{try{let e,t=0;for(;;){t+=1;try{e=await this.getSegmentsFetch.request(this.url)}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->Breathe: error`,e)}if(e?.status===200||t===3)break;await new Promise(e=>setTimeout(()=>e(!0),500))}if(!e||e.status!==200)throw Error(`request is error.`);let n=e.body?.getReader();if(!n)throw Error(`reader is error.`);for(;;){let{done:e,value:t}=await n.read();if(t){let{segments:e=[],isLive:n=!1}=await this.hls.parse(t);this.hls.isLive=n,n===!1&&(this.option.frameTrack=!1);let r=Array.from(e,e=>e.url),i=r.findIndex(e=>e===this.hls.url);i!==-1&&(r=r.slice(i+1)),this.hls.urls=r}if(e||this.url===``)break}}catch(e){e.name!==`AbortError`&&this.on.error&&this.on.error(e)}},start:()=>new Promise(async(e,t)=>{try{for(this.start_resolve=e,this.hls.url=``,this.hls.urls=[],await this.hls.getSegments(),this.hls.getSegmentsTimer=window.setInterval(this.hls.getSegments,500),this.hls.isLive===!1&&(clearInterval(this.hls.getSegmentsTimer),this.decoderWorker?.setFrameTrack(!1));;){let e=this.hls.urls.shift();if(e){this.hls.url=e;let t=(await this.prFetch.request(e)).body?.getReader();if(!t)throw Error(`segment reader is error.`);for(;;){let{done:e,value:n}=await t.read();if(n&&this.demuxerWorker?.push(n),e||this.url===``)break}}else await new Promise(e=>setTimeout(()=>e(!0),300))}}catch(e){e.name!==`AbortError`&&t(e)}})}},Hn=bn(`Cg1DZG5EYXRhLnByb3RvEhVjb20ucXVpY2sudm9pY2UucHJvdG8iawoHU2VpRGF0YRIvCgVldmVudBgBIAEoDjIgLmNvbS5xdWljay52b2ljZS5wcm90by5FdmVudFR5cGUSDAoEZGF0YRgCIAEoDBIQCghjb21wcmVzcxgDIAEoCBIPCgd2ZXJzaW9uGAQgASgFIq4CCgpMYXlvdXREYXRhEg4KBnJvb21JZBgBIAEoCRIvCgR0eXBlGAIgASgOMiEuY29tLnF1aWNrLnZvaWNlLnByb3RvLkxheW91dFR5cGUSPwoHdXNlck1hcBgDIAMoCzIuLmNvbS5xdWljay52b2ljZS5wcm90by5MYXlvdXREYXRhLlVzZXJNYXBFbnRyeRI8CgxnbG9iYWxDdXN0b20YBCABKAsyIS5jb20ucXVpY2sudm9pY2UucHJvdG8uQ3VzdG9tSW5mb0gAiAEBGk8KDFVzZXJNYXBFbnRyeRILCgNrZXkYASABKAkSLgoFdmFsdWUYAiABKAsyHy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlckluZm86AjgBQg8KDV9nbG9iYWxDdXN0b20ivQEKCFVzZXJJbmZvEgoKAmlkGAEgASgJEjAKBmF1ZGlvcxgCIAMoCzIgLmNvbS5xdWljay52b2ljZS5wcm90by5BdWRpb0luZm8SMAoGdmlkZW9zGAMgAygLMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlZpZGVvSW5mbxI2CgZjdXN0b20YBCABKAsyIS5jb20ucXVpY2sudm9pY2UucHJvdG8uQ3VzdG9tSW5mb0gAiAEBQgkKB19jdXN0b20ilQEKCUF1ZGlvSW5mbxIuCgR0eXBlGAEgASgOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLkF1ZGlvVHlwZRIQCghpc0VuYWJsZRgCIAEoCBIOCgZpc011dGUYAyABKAgSDgoGdm9sdW1lGAQgASgBEhcKCnVwZGF0ZVRpbWUYBSABKANIAIgBAUINCgtfdXBkYXRlVGltZSK6AQoJVmlkZW9JbmZvEi4KBHR5cGUYASABKA4yIC5jb20ucXVpY2sudm9pY2UucHJvdG8uVmlkZW9UeXBlEhAKCGlzRW5hYmxlGAIgASgIEg4KBmlzTXV0ZRgDIAEoCBINCgV3aWR0aBgEIAEoBRIOCgZoZWlnaHQYBSABKAUSCQoBeBgGIAEoBRIJCgF5GAcgASgFEhcKCnVwZGF0ZVRpbWUYCCABKANIAIgBAUINCgtfdXBkYXRlVGltZSLEAQoKQ3VzdG9tSW5mbxIOCgZyb29tSWQYASABKAkSSQoMY3VzdG9tS2V5TWFwGAIgAygLMjMuY29tLnF1aWNrLnZvaWNlLnByb3RvLkN1c3RvbUluZm8uQ3VzdG9tS2V5TWFwRW50cnkSFwoKdXBkYXRlVGltZRgDIAEoA0gAiAEBGjMKEUN1c3RvbUtleU1hcEVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAFCDQoLX3VwZGF0ZVRpbWUqIwoJRXZlbnRUeXBlEgoKBkxheW91dBAAEgoKBkN1c3RvbRABKj0KCkxheW91dFR5cGUSEQoNQXVkaW9BbmRWaWRlbxAAEg0KCU9ubHlBdWRpbxABEg0KCU9ubHlWaWRlbxACKiwKCUF1ZGlvVHlwZRIOCgpNaWNyb3Bob25lEAASDwoLU3lzdGVtVm9pY2UQASojCglWaWRlb1R5cGUSCgoGQ2FtZXJhEAASCgoGU2NyZWVuEAFCPwoWY29tLnF1aWNrLnBsYXllci5wcm90b0IHQ2RuRGF0YVoWY29tLnF1aWNrLnBsYXllci5wcm90b7oCA0NkbmIGcHJvdG8z`),Un=Z(Hn,0),Wn=Z(Hn,1),Gn=Z(Hn,5),Kn=()=>({remove:!1,isEnable:!1,updateTime:0,isMute:!1,volume:0}),qn=()=>({remove:!1,isEnable:!1,updateTime:0,isMute:!1,sx:0,sy:0,sw:0,sh:0}),Jn=class{userId=``;mc_audio;mc_video;ss_audio;ss_video;updateTime=0;constructor(){}getUpdateTimeKey=()=>{let e=[];return this.mc_audio&&e.push(this.mc_audio.updateTime),this.mc_video&&e.push(this.mc_video.updateTime),this.ss_audio&&e.push(this.ss_audio.updateTime),this.ss_video&&e.push(this.ss_video.updateTime),e.join(`_`)};init=e=>{let{id:t,audios:n=[],videos:r=[]}=e;this.userId=t;let i=this.getUpdateTimeKey();this.mc_audio&&(this.mc_audio.remove=!0),this.mc_video&&(this.mc_video.remove=!0),this.ss_audio&&(this.ss_audio.remove=!0),this.ss_video&&(this.ss_video.remove=!0);for(let e of n){let{type:t=0,isEnable:n=!1,isMute:r=!1,updateTime:i,volume:a=0}=e;switch(t){case 0:if(this.mc_audio||=Kn(),this.mc_audio.remove=!1,this.mc_audio.updateTime===Number(i))break;this.mc_audio.isEnable=!!n,this.mc_audio.isMute=!!r,this.mc_audio.updateTime=Number(i),this.mc_audio.volume=Number(a);break;case 1:if(this.ss_audio||=Kn(),this.ss_audio.remove=!1,this.ss_audio.updateTime===Number(i))break;this.ss_audio.isEnable=!!n,this.ss_audio.isMute=!!r,this.ss_audio.updateTime=Number(i),this.ss_audio.volume=Number(a);break}}for(let e of r){let{type:t=0,isEnable:n,isMute:r,updateTime:i,width:a,height:o,x:s,y:c}=e;switch(t){case 0:if(this.mc_video||=qn(),this.mc_video.remove=!1,this.mc_video.updateTime===Number(i))break;this.mc_video.isEnable=!!n,this.mc_video.isMute=!!r,this.mc_video.updateTime=Number(i)||0,this.mc_video.sx=s||0,this.mc_video.sy=c||0,this.mc_video.sw=a||0,this.mc_video.sh=o||0;break;case 1:if(this.ss_video||=qn(),this.ss_video.remove=!1,this.ss_video.updateTime===Number(i))break;this.ss_video.isEnable=!!n,this.ss_video.isMute=!!r,this.ss_video.updateTime=Number(i)||0,this.ss_video.sx=s||0,this.ss_video.sy=c||0,this.ss_video.sw=a||0,this.ss_video.sh=o||0;break}}this.mc_audio?.remove&&(this.mc_audio=void 0),this.mc_video?.remove&&(this.mc_video=void 0),this.ss_audio?.remove&&(this.ss_audio=void 0),this.ss_video?.remove&&(this.ss_video=void 0),i!==this.getUpdateTimeKey()&&(this.updateTime=new Date().getTime())};destroy=()=>{this.mc_audio=void 0,this.mc_video=void 0,this.ss_audio=void 0,this.ss_video=void 0}},Yn=e=>{let t=0,n=0;for(;;){let r=e[t];if(n+=r,t+=1,r!==255)break}let r=0;for(;;){let n=e[t];if(r+=n,t+=1,n!==255)break}if(n===5){let n=e.slice(t,t+16),i=Array.from(n,e=>e.toString(16).padStart(2,`0`)).join(``);t+=16;let a=r-16,o=Q(Un,e.slice(t,t+a)),{event:s=0}=o,c=o.data,l;switch(s){case 0:l=Q(Wn,o.data);break;case 1:l=Q(Gn,o.data);break}return{uuid:i,...o,event:s,data_remote:c,data:l}}};e.QuickVoPlayer=class{option={debug:!1,ws:`wss://livep2p.devplay.cc/websocket`};displayMode=`original`;prPlayer;dom;room={roomId:``,updateTime:``,author:``,version:``};usersMap=new Map;on={users:e=>{},analysis:e=>{}};constructor(e={}){let{debug:t=!1}=e;this.option.debug=t,this.prPlayer=new Vn({debug:t}),this.prPlayer.on.demuxer.chunk=e=>{},this.prPlayer.on.decoder.sei=this.onSEI,this.prPlayer.on.decoder.analysis=this.onAnalysis}start=async e=>(this.stop(),this.prPlayer.start(e));stop=()=>{this.prPlayer.stop(),this.usersMap=new Map,this.room.roomId=``,this.room.author=``,this.room.updateTime=``,this.room.version=``};setMute=e=>{this.prPlayer.setMute(e)};setOutputGain=e=>{this.prPlayer.audioPlayer?.prAudioStream?.setOutputGain(e)};getStream=()=>this.prPlayer.getStream();getAllUseUpdateKey=()=>{let e=[...this.usersMap.values()];return Array.from(e,e=>e.updateTime).join(`_`)};checkAndCreateUser=(e,t)=>{!this.usersMap.has(e)&&this.usersMap.set(e,new Jn);let n=this.usersMap.get(e);if(n){if(n.init(t),n.mc_video&&n.mc_video.stream===void 0){let{sx:e,sy:t,sw:r,sh:i}=n.mc_video,a=`${n.userId}_mc_video`,o=this.prPlayer.cut.create(a,{sx:e,sy:t,sw:r,sh:i});this.displayMode===`original`&&this.prPlayer.cut.setPause(a,!0),n.mc_video.stream=o}if(n.ss_video&&n.ss_video.stream===void 0){let{sx:e,sy:t,sw:r,sh:i}=n.ss_video,a=`${n.userId}_ss_video`,o=this.prPlayer.cut.create(a,{sx:e,sy:t,sw:r,sh:i});this.displayMode===`original`&&this.prPlayer.cut.setPause(a,!0),n.ss_video.stream=o}if(n?.mc_video){let e=`${n.userId}_mc_video`,{sx:t,sy:r,sw:i,sh:a}=n.mc_video;this.prPlayer.cut.setCut(e,{sx:t,sy:r,sw:i,sh:a})}if(n?.ss_video){let e=`${n.userId}_ss_video`,{sx:t,sy:r,sw:i,sh:a}=n.ss_video;this.prPlayer.cut.setCut(e,{sx:t,sy:r,sw:i,sh:a})}}};setDisplayMode=e=>{switch(this.displayMode=e,e){case`original`:{this.prPlayer.setPause(!1);let e=[...this.usersMap.keys()];for(let t of e)this.prPlayer.cut.setPause(`${t}_mc_video`,!0),this.prPlayer.cut.setPause(`${t}_ss_video`,!0)}break;case`cut`:{this.prPlayer.setPause(!0);let e=[...this.usersMap.keys()];for(let t of e)this.prPlayer.cut.setPause(`${t}_mc_video`,!1),this.prPlayer.cut.setPause(`${t}_ss_video`,!1)}break}};onSEI=e=>{try{let t=Yn(e);if(!t)return;let{event:n,data:r}=t;switch(n){case 0:{let{roomId:e,userMap:t}=r;if(e!==this.room.roomId)return;let n=this.getAllUseUpdateKey(),i=Object.keys(t);{let e=[...this.usersMap.keys()];for(let t of e)i.includes(t)||(this.prPlayer.cut.remove(`${t}_mc_video`),this.prPlayer.cut.remove(`${t}_ss_video`),this.usersMap.delete(t))}for(let e of i){let n=t[e];this.checkAndCreateUser(e,n)}if(n!==this.getAllUseUpdateKey()&&this.on.users){let e=[...this.usersMap.values()],t=Array.from(e,({userId:e,mc_audio:t,mc_video:n,ss_audio:r,ss_video:i,updateTime:a})=>({userId:e,mc_audio:t,mc_video:n,ss_audio:r,ss_video:i,updateTime:a}));this.on.users(t)}}break;case 1:{let{roomId:e,updateTime:t}=r,{author:n,version:i}=r.customKeyMap;this.room.roomId=e,this.room.updateTime=t,this.room.author=n,this.room.version=i}break}}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->onSEI: error`,e)}};onAnalysis=e=>{this.on.analysis&&this.on.analysis(e)}}});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`quickvo-player`]={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t){return typeof e==`object`&&e&&`$typeName`in e&&typeof e.$typeName==`string`?t===void 0?!0:t.typeName===e.$typeName:!1}var n;(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`})(n||={});function r(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(n&15)<<28,t=(n&112)>>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}throw Error(`invalid varint`)}var i=4294967296;function a(e){let t=e[0]===`-`;t&&(e=e.slice(1));let n=1e6,r=0,a=0;function o(t,o){let s=Number(e.slice(t,o));a*=n,r=r*n+s,r>=i&&(a+=r/i|0,r%=i)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),t?u(r,a):l(r,a)}function o(e,t){let n=l(e,t),r=n.hi&2147483648;r&&(n=u(n.lo,n.hi));let i=s(n.lo,n.hi);return r?`-`+i:i}function s(e,t){if({lo:e,hi:t}=c(e,t),t<=2097151)return String(i*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,a=t>>16&65535,o=n+r*6777216+a*6710656,s=r+a*8147497,l=a*2,u=1e7;return o>=u&&(s+=Math.floor(o/u),o%=u),s>=u&&(l+=Math.floor(s/u),s%=u),l.toString()+ee(s)+ee(o)}function c(e,t){return{lo:e>>>0,hi:t>>>0}}function l(e,t){return{lo:e|0,hi:t|0}}function u(e,t){return t=~t,e?e=~e+1:t+=1,l(e,t)}var ee=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function te(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}function ne(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}var d=re();function re(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(globalThis.Deno||typeof process!=`object`||typeof process.env!=`object`||process.env.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||r<t)throw Error(`invalid int64: ${e}`);return r},uParse(e){let t=typeof e==`bigint`?e:BigInt(e);if(t>i||t<r)throw Error(`invalid uint64: ${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,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)},uDec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0)}}}return{zero:`0`,supported:!1,parse(e){return typeof e!=`string`&&(e=e.toString()),ie(e),e},uParse(e){return typeof e!=`string`&&(e=e.toString()),ae(e),e},enc(e){return typeof e!=`string`&&(e=e.toString()),ie(e),a(e)},uEnc(e){return typeof e!=`string`&&(e=e.toString()),ae(e),a(e)},dec(e,t){return o(e,t)},uDec(e,t){return s(e,t)}}}function ie(e){if(!/^-?[0-9]+$/.test(e))throw Error(`invalid int64: `+e)}function ae(e){if(!/^[0-9]+$/.test(e))throw Error(`invalid uint64: `+e)}function f(e,t){switch(e){case n.STRING:return``;case n.BOOL:return!1;case n.DOUBLE:case n.FLOAT:return 0;case n.INT64:case n.UINT64:case n.SFIXED64:case n.FIXED64:case n.SINT64:return t?`0`:d.zero;case n.BYTES:return new Uint8Array;default:return 0}}function oe(e,t){switch(e){case n.BOOL:return t===!1;case n.STRING:return t===``;case n.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}var se=2,p=Symbol.for(`reflect unsafe local`);function ce(e,t){let n=e[t.localName].case;return n===void 0?n:t.fields.find(e=>e.localName===n)}function le(e,t){let n=t.localName;if(t.oneof)return e[t.oneof.localName].case===n;if(t.presence!=se)return e[n]!==void 0&&Object.prototype.hasOwnProperty.call(e,n);switch(t.fieldKind){case`list`:return e[n].length>0;case`map`:return Object.keys(e[n]).length>0;case`scalar`:return!oe(t.scalar,e[n]);case`enum`:return e[n]!==t.enum.values[0].number}throw Error(`message field with implicit presence`)}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0}function ue(e,t){if(t.oneof){let n=e[t.oneof.localName];return n.case===t.localName?n.value:void 0}return e[t.localName]}function de(e,t,n){t.oneof?e[t.oneof.localName]={case:t.localName,value:n}:e[t.localName]=n}function fe(e,t){let n=t.localName;if(t.oneof){let r=t.oneof.localName;e[r].case===n&&(e[r]={case:void 0})}else if(t.presence!=se)delete e[n];else switch(t.fieldKind){case`map`:e[n]={};break;case`list`:e[n]=[];break;case`enum`:e[n]=t.enum.values[0].number;break;case`scalar`:e[n]=f(t.scalar,t.longAsString);break}}function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g(e,t){if(h(e)&&p in e&&`add`in e&&`field`in e&&typeof e.field==`function`){if(t!==void 0){let n=t,r=e.field();return n.listKind==r.listKind&&n.scalar===r.scalar&&n.message?.typeName===r.message?.typeName&&n.enum?.typeName===r.enum?.typeName}return!0}return!1}function _(e,t){if(h(e)&&p in e&&`has`in e&&`field`in e&&typeof e.field==`function`){if(t!==void 0){let n=t,r=e.field();return n.mapKey===r.mapKey&&n.mapKind==r.mapKind&&n.scalar===r.scalar&&n.message?.typeName===r.message?.typeName&&n.enum?.typeName===r.enum?.typeName}return!0}return!1}function v(e,t){return h(e)&&p in e&&`desc`in e&&h(e.desc)&&e.desc.kind===`message`&&(t===void 0||e.desc.typeName==t.typeName)}function pe(e){return he(e.$typeName)}function me(e){let t=e.fields[0];return he(e.typeName)&&t!==void 0&&t.fieldKind==`scalar`&&t.name==`value`&&t.number==1}function he(e){return e.startsWith(`google.protobuf.`)&&[`DoubleValue`,`FloatValue`,`Int64Value`,`UInt64Value`,`Int32Value`,`UInt32Value`,`BoolValue`,`StringValue`,`BytesValue`].includes(e.substring(16))}var ge=999,_e=998,y=2;function ve(e,n){if(t(n,e))return n;let r=Ee(e);return n!==void 0&&ye(e,r,n),r}function ye(e,t,n){for(let r of e.members){let e=n[r.localName];if(e==null)continue;let i;if(r.kind==`oneof`){let t=ce(n,r);if(!t)continue;i=t,e=ue(n,t)}else i=r;switch(i.fieldKind){case`message`:e=b(i,e);break;case`scalar`:e=be(i,e);break;case`list`:e=Se(i,e);break;case`map`:e=xe(i,e);break}de(t,i,e)}return t}function be(e,t){return e.scalar==n.BYTES?x(t):t}function xe(e,t){if(h(t)){if(e.scalar==n.BYTES)return Ce(t,x);if(e.mapKind==`message`)return Ce(t,t=>b(e,t))}return t}function Se(e,t){if(Array.isArray(t)){if(e.scalar==n.BYTES)return t.map(x);if(e.listKind==`message`)return t.map(t=>b(e,t))}return t}function b(e,n){if(e.fieldKind==`message`&&!e.oneof&&me(e.message))return be(e.message.fields[0],n);if(h(n)){if(e.message.typeName==`google.protobuf.Struct`&&e.parent.typeName!==`google.protobuf.Value`)return n;if(!t(n,e.message))return ve(e.message,n)}return n}function x(e){return Array.isArray(e)?new Uint8Array(e):e}function Ce(e,t){let n={};for(let r of Object.entries(e))n[r[0]]=t(r[1]);return n}var we=Symbol(),Te=new WeakMap;function Ee(e){let t;if(De(e)){let n=Te.get(e),r,i;if(n)({prototype:r,members:i}=n);else{r={},i=new Set;for(let t of e.members)t.kind!=`oneof`&&(t.fieldKind!=`scalar`&&t.fieldKind!=`enum`||t.presence!=y&&(i.add(t),r[t.localName]=Oe(t)));Te.set(e,{prototype:r,members:i})}t=Object.create(r),t.$typeName=e.typeName;for(let n of e.members)i.has(n)||n.kind==`field`&&(n.fieldKind==`message`||(n.fieldKind==`scalar`||n.fieldKind==`enum`)&&n.presence!=y)||(t[n.localName]=Oe(n))}else{t={$typeName:e.typeName};for(let n of e.members)(n.kind==`oneof`||n.presence==y)&&(t[n.localName]=Oe(n))}return t}function De(e){switch(e.file.edition){case ge:return!1;case _e:return!0;default:return e.fields.some(e=>e.presence!=y&&e.fieldKind!=`message`&&!e.oneof)}}function Oe(e){if(e.kind==`oneof`)return{case:void 0};if(e.fieldKind==`list`)return[];if(e.fieldKind==`map`)return{};if(e.fieldKind==`message`)return we;let t=e.getDefaultValue();return t===void 0?e.fieldKind==`scalar`?f(e.scalar,e.longAsString):e.enum.values[0].number:e.fieldKind==`scalar`&&e.longAsString?t.toString():t}var S=class extends Error{constructor(e,t,n=`FieldValueInvalidError`){super(t),this.name=n,this.field=()=>e}},C=Symbol.for(`@bufbuild/protobuf/text-encoding`);function ke(){if(globalThis[C]==null){let e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[C]={encodeUtf8(t){return e.encode(t)},decodeUtf8(e){return t.decode(e)},checkUtf8(e){try{return!0}catch{return!1}}}}return globalThis[C]}var w;(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`})(w||={});var Ae=class{constructor(e,t=ke().decodeUtf8){this.decodeUtf8=t,this.varint64=r,this.uint32=ne,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case w.Varint:for(;this.buf[this.pos++]&128;);break;case w.Bit64:this.pos+=4;case w.Bit32:this.pos+=4;break;case w.LengthDelimited:let n=this.uint32();this.pos+=n;break;case w.StartGroup:for(;;){let[e,n]=this.tag();if(n===w.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(n,e)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return d.dec(...this.varint64())}uint64(){return d.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,d.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return d.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return d.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.decodeUtf8(this.bytes())}};function je(e,t){let n=e.fieldKind==`list`?g(t,e):e.fieldKind==`map`?_(t,e):T(e,t);if(n===!0)return;let r;switch(e.fieldKind){case`list`:r=`expected ${Ie(e)}, got ${D(t)}`;break;case`map`:r=`expected ${Le(e)}, got ${D(t)}`;break;default:r=E(e,t,n)}return new S(e,r)}function Me(e,t,n){let r=T(e,n);if(r!==!0)return new S(e,`list item #${t+1}: ${E(e,n,r)}`)}function Ne(e,t,n){let r=Pe(t,e.mapKey);if(r!==!0)return new S(e,`invalid map key: ${E({scalar:e.mapKey},t,r)}`);let i=T(e,n);if(i!==!0)return new S(e,`map entry ${D(t)}: ${E(e,n,i)}`)}function T(e,t){return e.scalar===void 0?e.enum===void 0?v(t,e.message):e.enum.open?Number.isInteger(t):e.enum.values.some(e=>e.number===t):Pe(t,e.scalar)}function Pe(e,t){switch(t){case n.DOUBLE:return typeof e==`number`;case n.FLOAT:return typeof e==`number`?Number.isNaN(e)||!Number.isFinite(e)?!0:e>34028234663852886e22||e<-34028234663852886e22?`${e.toFixed()} out of range`:!0:!1;case n.INT32:case n.SFIXED32:case n.SINT32:return typeof e!=`number`||!Number.isInteger(e)?!1:e>2147483647||e<-2147483648?`${e.toFixed()} out of range`:!0;case n.FIXED32:case n.UINT32:return typeof e!=`number`||!Number.isInteger(e)?!1:e>4294967295||e<0?`${e.toFixed()} out of range`:!0;case n.BOOL:return typeof e==`boolean`;case n.STRING:return typeof e==`string`?ke().checkUtf8(e)||`invalid UTF8`:!1;case n.BYTES:return e instanceof Uint8Array;case n.INT64:case n.SFIXED64:case n.SINT64:if(typeof e==`bigint`||typeof e==`number`||typeof e==`string`&&e.length>0)try{return d.parse(e),!0}catch{return`${e} out of range`}return!1;case n.FIXED64:case n.UINT64:if(typeof e==`bigint`||typeof e==`number`||typeof e==`string`&&e.length>0)try{return d.uParse(e),!0}catch{return`${e} out of range`}return!1}}function E(e,t,n){return n=typeof n==`string`?`: ${n}`:`, got ${D(t)}`,e.scalar===void 0?e.enum===void 0?`expected ${Fe(e.message)}`+n:`expected ${e.enum.toString()}`+n:`expected ${Re(e.scalar)}`+n}function D(e){switch(typeof e){case`object`:return e===null?`null`:e instanceof Uint8Array?`Uint8Array(${e.length})`:Array.isArray(e)?`Array(${e.length})`:g(e)?Ie(e.field()):_(e)?Le(e.field()):v(e)?Fe(e.desc):t(e)?`message ${e.$typeName}`:`object`;case`string`:return e.length>30?`string`:`"${e.split(`"`).join(`\\"`)}"`;case`boolean`:return String(e);case`number`:return String(e);case`bigint`:return String(e)+`n`;default:return typeof e}}function Fe(e){return`ReflectMessage (${e.typeName})`}function Ie(e){switch(e.listKind){case`message`:return`ReflectList (${e.message.toString()})`;case`enum`:return`ReflectList (${e.enum.toString()})`;case`scalar`:return`ReflectList (${n[e.scalar]})`}}function Le(e){switch(e.mapKind){case`message`:return`ReflectMap (${n[e.mapKey]}, ${e.message.toString()})`;case`enum`:return`ReflectMap (${n[e.mapKey]}, ${e.enum.toString()})`;case`scalar`:return`ReflectMap (${n[e.mapKey]}, ${n[e.scalar]})`}}function Re(e){switch(e){case n.STRING:return`string`;case n.BOOL:return`boolean`;case n.INT64:case n.SINT64:case n.SFIXED64:return`bigint (int64)`;case n.UINT64:case n.FIXED64:return`bigint (uint64)`;case n.BYTES:return`Uint8Array`;case n.DOUBLE:return`number (float64)`;case n.FLOAT:return`number (float32)`;case n.FIXED32:case n.UINT32:return`number (uint32)`;case n.INT32:case n.SFIXED32:case n.SINT32:return`number (int32)`}}function O(e,t,n=!0){return new Be(e,t,n)}var ze=new WeakMap,Be=class{get sortedFields(){let e=ze.get(this.desc);if(e)return e;let t=this.desc.fields.concat().sort((e,t)=>e.number-t.number);return ze.set(this.desc,t),t}constructor(e,t,n=!0){this.lists=new Map,this.maps=new Map,this.check=n,this.desc=e,this.message=this[p]=t??ve(e),this.fields=e.fields,this.oneofs=e.oneofs,this.members=e.members}findNumber(e){return this._fieldsByNumber||=new Map(this.desc.fields.map(e=>[e.number,e])),this._fieldsByNumber.get(e)}oneofCase(e){return k(this.message,e),ce(this.message,e)}isSet(e){return k(this.message,e),le(this.message,e)}clear(e){k(this.message,e),fe(this.message,e)}get(e){k(this.message,e);let t=ue(this.message,e);switch(e.fieldKind){case`list`:let n=this.lists.get(e);return(!n||n[p]!==t)&&this.lists.set(e,n=new Ve(e,t,this.check)),n;case`map`:let r=this.maps.get(e);return(!r||r[p]!==t)&&this.maps.set(e,r=new He(e,t,this.check)),r;case`message`:return j(e,t,this.check);case`scalar`:return t===void 0?f(e.scalar,!1):Ke(e,t);case`enum`:return t??e.enum.values[0].number}}set(e,t){if(k(this.message,e),this.check){let n=je(e,t);if(n)throw n}let n;n=e.fieldKind==`message`?A(e,t):_(t)||g(t)?t[p]:qe(e,t),de(this.message,e,n)}getUnknown(){return this.message.$unknown}setUnknown(e){this.message.$unknown=e}};function k(e,t){if(t.parent.typeName!==e.$typeName)throw new S(t,`cannot use ${t.toString()} with message ${e.$typeName}`,`ForeignFieldError`)}var Ve=class{field(){return this._field}get size(){return this._arr.length}constructor(e,t,n){this._field=e,this._arr=this[p]=t,this.check=n}get(e){let t=this._arr[e];return t===void 0?void 0:M(this._field,t,this.check)}set(e,t){if(e<0||e>=this._arr.length)throw new S(this._field,`list item #${e+1}: out of range`);if(this.check){let n=Me(this._field,e,t);if(n)throw n}this._arr[e]=Ue(this._field,t)}add(e){if(this.check){let t=Me(this._field,this._arr.length,e);if(t)throw t}this._arr.push(Ue(this._field,e))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let e of this._arr)yield M(this._field,e,this.check)}*entries(){for(let e=0;e<this._arr.length;e++)yield[e,M(this._field,this._arr[e],this.check)]}},He=class{constructor(e,t,n=!0){this.obj=this[p]=t??{},this.check=n,this._field=e}field(){return this._field}set(e,t){if(this.check){let n=Ne(this._field,e,t);if(n)throw n}return this.obj[P(e)]=We(this._field,t),this}delete(e){let t=P(e),n=Object.prototype.hasOwnProperty.call(this.obj,t);return n&&delete this.obj[t],n}clear(){for(let e of Object.keys(this.obj))delete this.obj[e]}get(e){let t=this.obj[P(e)];return t!==void 0&&(t=N(this._field,t,this.check)),t}has(e){return Object.prototype.hasOwnProperty.call(this.obj,P(e))}*keys(){for(let e of Object.keys(this.obj))yield Ge(e,this._field.mapKey)}*entries(){for(let e of Object.entries(this.obj))yield[Ge(e[0],this._field.mapKey),N(this._field,e[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let e of Object.values(this.obj))yield N(this._field,e,this.check)}forEach(e,t){for(let n of this.entries())e.call(t,n[1],n[0],this)}};function A(e,t){return v(t)?pe(t.message)&&!e.oneof&&e.fieldKind==`message`?t.message.value:t.desc.typeName==`google.protobuf.Struct`&&e.parent.typeName!=`google.protobuf.Value`?Ye(t.message):t.message:t}function j(e,t,n){return t!==void 0&&(me(e.message)&&!e.oneof&&e.fieldKind==`message`?t={$typeName:e.message.typeName,value:Ke(e.message.fields[0],t)}:e.message.typeName==`google.protobuf.Struct`&&e.parent.typeName!=`google.protobuf.Value`&&h(t)&&(t=Je(t))),new Be(e.message,t,n)}function Ue(e,t){return e.listKind==`message`?A(e,t):qe(e,t)}function M(e,t,n){return e.listKind==`message`?j(e,t,n):Ke(e,t)}function We(e,t){return e.mapKind==`message`?A(e,t):qe(e,t)}function N(e,t,n){return e.mapKind==`message`?j(e,t,n):t}function P(e){return typeof e==`string`||typeof e==`number`?e:String(e)}function Ge(e,t){switch(t){case n.STRING:return e;case n.INT32:case n.FIXED32:case n.UINT32:case n.SFIXED32:case n.SINT32:{let t=Number.parseInt(e);if(Number.isFinite(t))return t;break}case n.BOOL:switch(e){case`true`:return!0;case`false`:return!1}break;case n.UINT64:case n.FIXED64:try{return d.uParse(e)}catch{}break;default:try{return d.parse(e)}catch{}break}return e}function Ke(e,t){switch(e.scalar){case n.INT64:case n.SFIXED64:case n.SINT64:`longAsString`in e&&e.longAsString&&typeof t==`string`&&(t=d.parse(t));break;case n.FIXED64:case n.UINT64:`longAsString`in e&&e.longAsString&&typeof t==`string`&&(t=d.uParse(t));break}return t}function qe(e,t){switch(e.scalar){case n.INT64:case n.SFIXED64:case n.SINT64:`longAsString`in e&&e.longAsString?t=String(t):(typeof t==`string`||typeof t==`number`)&&(t=d.parse(t));break;case n.FIXED64:case n.UINT64:`longAsString`in e&&e.longAsString?t=String(t):(typeof t==`string`||typeof t==`number`)&&(t=d.uParse(t));break}return t}function Je(e){let t={$typeName:`google.protobuf.Struct`,fields:{}};if(h(e))for(let[n,r]of Object.entries(e))t.fields[n]=Ze(r);return t}function Ye(e){let t={};for(let[n,r]of Object.entries(e.fields))t[n]=Xe(r);return t}function Xe(e){switch(e.kind.case){case`structValue`:return Ye(e.kind.value);case`listValue`:return e.kind.value.values.map(Xe);case`nullValue`:case void 0:return null;default:return e.kind.value}}function Ze(e){let t={$typeName:`google.protobuf.Value`,kind:{case:void 0}};switch(typeof e){case`number`:t.kind={case:`numberValue`,value:e};break;case`string`:t.kind={case:`stringValue`,value:e};break;case`boolean`:t.kind={case:`boolValue`,value:e};break;case`object`:if(e===null)t.kind={case:`nullValue`,value:0};else if(Array.isArray(e)){let n={$typeName:`google.protobuf.ListValue`,values:[]};if(Array.isArray(e))for(let t of e)n.values.push(Ze(t));t.kind={case:`listValue`,value:n}}else t.kind={case:`structValue`,value:Je(e)};break}return t}function Qe(e){let t=tt(),n=e.length*3/4;e[e.length-2]==`=`?n-=2:e[e.length-1]==`=`&&--n;let r=new Uint8Array(n),i=0,a=0,o,s=0;for(let n=0;n<e.length;n++){if(o=t[e.charCodeAt(n)],o===void 0)switch(e[n]){case`=`:a=0;case`
|
|
2
|
+
`:case`\r`:case` `:case` `:continue;default:throw Error(`invalid base64 string`)}switch(a){case 0:s=o,a=1;break;case 1:r[i++]=s<<2|(o&48)>>4,s=o,a=2;break;case 2:r[i++]=(s&15)<<4|(o&60)>>2,s=o,a=3;break;case 3:r[i++]=(s&3)<<6|o,a=0;break}}if(a==1)throw Error(`invalid base64 string`);return r.subarray(0,i)}var F,$e,I;function et(e){return F||(F=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),$e=F.slice(0,-2).concat(`-`,`_`)),e==`url`?$e:F}function tt(){if(!I){I=[];let e=et(`std`);for(let t=0;t<e.length;t++)I[e[t].charCodeAt(0)]=t;I[45]=e.indexOf(`+`),I[95]=e.indexOf(`/`)}return I}function L(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=e.charAt(r);switch(i){case`_`:t=!0;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n.push(i),t=!1;break;default:t&&(t=!1,i=i.toUpperCase()),n.push(i);break}}return n.join(``)}var nt=new Set([`constructor`,`toString`,`toJSON`,`valueOf`]);function R(e){return nt.has(e)?e+`$`:e}function z(e){for(let t of e.field)m(t,`jsonName`)||(t.jsonName=L(t.name));e.nestedType.forEach(z)}function rt(e,t){let n=e.values.find(e=>e.name===t);if(!n)throw Error(`cannot parse ${e} default value: ${t}`);return n.number}function it(e,t){switch(e){case n.STRING:return t;case n.BYTES:{let r=at(t);if(r===!1)throw Error(`cannot parse ${n[e]} default value: ${t}`);return r}case n.INT64:case n.SFIXED64:case n.SINT64:return d.parse(t);case n.UINT64:case n.FIXED64:return d.uParse(t);case n.DOUBLE:case n.FLOAT:switch(t){case`inf`:return 1/0;case`-inf`:return-1/0;case`nan`:return NaN;default:return parseFloat(t)}case n.BOOL:return t===`true`;case n.INT32:case n.UINT32:case n.SINT32:case n.FIXED32:case n.SFIXED32:return parseInt(t,10)}}function at(e){let t=[],n={tail:e,c:``,next(){return this.tail.length==0?!1:(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(e){if(this.tail.length>=e){let t=this.tail.substring(0,e);return this.tail=this.tail.substring(e),t}return!1}};for(;n.next();)switch(n.c){case`\\`:if(n.next())switch(n.c){case`\\`:t.push(n.c.charCodeAt(0));break;case`b`:t.push(8);break;case`f`:t.push(12);break;case`n`:t.push(10);break;case`r`:t.push(13);break;case`t`:t.push(9);break;case`v`:t.push(11);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:{let e=n.c,r=n.take(2);if(r===!1)return!1;let i=parseInt(e+r,8);if(Number.isNaN(i))return!1;t.push(i);break}case`x`:{let e=n.c,r=n.take(2);if(r===!1)return!1;let i=parseInt(e+r,16);if(Number.isNaN(i))return!1;t.push(i);break}case`u`:{let e=n.c,r=n.take(4);if(r===!1)return!1;let i=parseInt(e+r,16);if(Number.isNaN(i))return!1;let a=new Uint8Array(4);new DataView(a.buffer).setInt32(0,i,!0),t.push(a[0],a[1],a[2],a[3]);break}case`U`:{let e=n.c,r=n.take(8);if(r===!1)return!1;let i=d.uEnc(e+r),a=new Uint8Array(8),o=new DataView(a.buffer);o.setInt32(0,i.lo,!0),o.setInt32(4,i.hi,!0),t.push(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);break}}break;default:t.push(n.c.charCodeAt(0))}return new Uint8Array(t)}function*B(e){switch(e.kind){case`file`:for(let t of e.messages)yield t,yield*B(t);yield*e.enums,yield*e.services,yield*e.extensions;break;case`message`:for(let t of e.nestedMessages)yield t,yield*B(t);yield*e.nestedEnums,yield*e.nestedExtensions;break}}function ot(...e){let t=st();if(!e.length)return t;if(`$typeName`in e[0]&&e[0].$typeName==`google.protobuf.FileDescriptorSet`){for(let n of e[0].file)Ct(n,t);return t}if(`$typeName`in e[0]){let r=e[0],i=e[1],a=new Set;function n(e){let r=[];for(let n of e.dependency){if(t.getFile(n)!=null||a.has(n))continue;let o=i(n);if(!o)throw Error(`Unable to resolve ${n}, imported by ${e.name}`);`kind`in o?t.addFile(o,!1,!0):(a.add(o.name),r.push(o))}return r.concat(...r.map(n))}for(let e of[r,...n(r)].reverse())Ct(e,t)}else for(let n of e)for(let e of n.files)t.addFile(e);return t}function st(){let e=new Map,t=new Map,n=new Map;return{kind:`registry`,types:e,extendees:t,[Symbol.iterator](){return e.values()},get files(){return n.values()},addFile(e,t,r){if(n.set(e.proto.name,e),!t)for(let t of B(e))this.add(t);if(r)for(let n of e.dependencies)this.addFile(n,t,r)},add(n){if(n.kind==`extension`){let e=t.get(n.extendee.typeName);e||t.set(n.extendee.typeName,e=new Map),e.set(n.number,n)}e.set(n.typeName,n)},get(t){return e.get(t)},getFile(e){return n.get(e)},getMessage(t){let n=e.get(t);return n?.kind==`message`?n:void 0},getEnum(t){let n=e.get(t);return n?.kind==`enum`?n:void 0},getExtension(t){let n=e.get(t);return n?.kind==`extension`?n:void 0},getExtensionFor(e,n){return t.get(e.typeName)?.get(n)},getService(t){let n=e.get(t);return n?.kind==`service`?n:void 0}}}var ct=998,lt=999,ut=9,V=10,H=11,dt=12,ft=14,U=3,pt=2,mt=1,ht=0,gt=1,_t=2,vt=3,yt=1,bt=2,xt=1,St={998:{fieldPresence:1,enumType:2,repeatedFieldEncoding:2,utf8Validation:3,messageEncoding:1,jsonFormat:2,enforceNamingStyle:2,defaultSymbolVisibility:1},999:{fieldPresence:2,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1e3:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1001:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:1,defaultSymbolVisibility:2}};function Ct(e,t){let n={kind:`file`,proto:e,deprecated:e.options?.deprecated??!1,edition:kt(e),name:e.name.replace(/\.proto$/,``),dependencies:At(e,t),enums:[],messages:[],extensions:[],services:[],toString(){return`file ${e.name}`}},r=new Map,i={get(e){return r.get(e)},add(e){X(e.proto.options?.mapEntry===!0),r.set(e.typeName,e)}};for(let r of e.enumType)wt(r,n,void 0,t);for(let r of e.messageType)Tt(r,n,void 0,t,i);for(let r of e.service)Et(r,n,t);W(n,t);for(let e of r.values())G(e,t,i);for(let e of n.messages)G(e,t,i),W(e,t);t.addFile(n,!0)}function W(e,t){switch(e.kind){case`file`:for(let n of e.proto.extension){let r=K(n,e,t);e.extensions.push(r),t.add(r)}break;case`message`:for(let n of e.proto.extension){let r=K(n,e,t);e.nestedExtensions.push(r),t.add(r)}for(let n of e.nestedMessages)W(n,t);break}}function G(e,t,n){let r=e.proto.oneofDecl.map(t=>Ot(t,e)),i=new Set;for(let a of e.proto.field){let o=Nt(a,r),s=K(a,e,t,o,n);e.fields.push(s),e.field[s.localName]=s,o===void 0?e.members.push(s):(o.fields.push(s),i.has(o)||(i.add(o),e.members.push(o)))}for(let t of r.filter(e=>i.has(e)))e.oneofs.push(t);for(let r of e.nestedMessages)G(r,t,n)}function wt(e,t,n,r){let i=jt(e.name,e.value),a={kind:`enum`,proto:e,deprecated:e.options?.deprecated??!1,file:t,parent:n,open:!0,name:e.name,typeName:q(e,n,t),value:{},values:[],sharedPrefix:i,toString(){return`enum ${this.typeName}`}};a.open=Lt(a),r.add(a);for(let t of e.value){let e=t.name;a.values.push(a.value[t.number]={kind:`enum_value`,proto:t,deprecated:t.options?.deprecated??!1,parent:a,name:e,localName:R(i==null?e:e.substring(i.length)),number:t.number,toString(){return`enum value ${a.typeName}.${e}`}})}(n?.nestedEnums??t.enums).push(a)}function Tt(e,t,n,r,i){let a={kind:`message`,proto:e,deprecated:e.options?.deprecated??!1,file:t,parent:n,name:e.name,typeName:q(e,n,t),fields:[],field:{},oneofs:[],members:[],nestedEnums:[],nestedMessages:[],nestedExtensions:[],toString(){return`message ${this.typeName}`}};e.options?.mapEntry===!0?i.add(a):((n?.nestedMessages??t.messages).push(a),r.add(a));for(let n of e.enumType)wt(n,t,a,r);for(let n of e.nestedType)Tt(n,t,a,r,i)}function Et(e,t,n){let r={kind:`service`,proto:e,deprecated:e.options?.deprecated??!1,file:t,name:e.name,typeName:q(e,void 0,t),methods:[],method:{},toString(){return`service ${this.typeName}`}};t.services.push(r),n.add(r);for(let t of e.method){let e=Dt(t,r,n);r.methods.push(e),r.method[e.localName]=e}}function Dt(e,t,n){let r;r=e.clientStreaming&&e.serverStreaming?`bidi_streaming`:e.clientStreaming?`client_streaming`:e.serverStreaming?`server_streaming`:`unary`;let i=n.getMessage(J(e.inputType)),a=n.getMessage(J(e.outputType));X(i,`invalid MethodDescriptorProto: input_type ${e.inputType} not found`),X(a,`invalid MethodDescriptorProto: output_type ${e.inputType} not found`);let o=e.name;return{kind:`rpc`,proto:e,deprecated:e.options?.deprecated??!1,parent:t,name:o,localName:R(o.length?R(o[0].toLowerCase()+o.substring(1)):o),methodKind:r,input:i,output:a,idempotency:e.options?.idempotencyLevel??ht,toString(){return`rpc ${t.typeName}.${o}`}}}function Ot(e,t){return{kind:`oneof`,proto:e,deprecated:!1,parent:t,fields:[],name:e.name,localName:R(L(e.name)),toString(){return`oneof ${t.typeName}.${this.name}`}}}function K(e,t,n,r,i){let a=i===void 0,o={kind:`field`,proto:e,deprecated:e.options?.deprecated??!1,name:e.name,number:e.number,scalar:void 0,message:void 0,enum:void 0,presence:Pt(e,r,a,t),listKind:void 0,mapKind:void 0,mapKey:void 0,delimitedEncoding:void 0,packed:void 0,longAsString:!1,getDefaultValue:void 0};if(a){let r=t.kind==`file`?t:t.file,i=t.kind==`file`?void 0:t,a=q(e,i,r);o.kind=`extension`,o.file=r,o.parent=i,o.oneof=void 0,o.typeName=a,o.jsonName=`[${a}]`,o.toString=()=>`extension ${a}`;let s=n.getMessage(J(e.extendee));X(s,`invalid FieldDescriptorProto: extendee ${e.extendee} not found`),o.extendee=s}else{let n=t;X(n.kind==`message`),o.parent=n,o.oneof=r,o.localName=r?L(e.name):R(L(e.name)),o.jsonName=e.jsonName,o.toString=()=>`field ${n.typeName}.${e.name}`}let s=e.label,c=e.type,l=e.options?.jstype;if(s===U){let r=c==H?i?.get(J(e.typeName)):void 0;if(r){o.fieldKind=`map`;let{key:e,value:t}=It(r);return o.mapKey=e.scalar,o.mapKind=t.fieldKind,o.message=t.message,o.delimitedEncoding=!1,o.enum=t.enum,o.scalar=t.scalar,o}switch(o.fieldKind=`list`,c){case H:case V:o.listKind=`message`,o.message=n.getMessage(J(e.typeName)),X(o.message),o.delimitedEncoding=Rt(e,t);break;case ft:o.listKind=`enum`,o.enum=n.getEnum(J(e.typeName)),X(o.enum);break;default:o.listKind=`scalar`,o.scalar=c,o.longAsString=l==mt;break}return o.packed=Ft(e,t),o}switch(c){case H:case V:o.fieldKind=`message`,o.message=n.getMessage(J(e.typeName)),X(o.message,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),o.delimitedEncoding=Rt(e,t),o.getDefaultValue=()=>void 0;break;case ft:{let t=n.getEnum(J(e.typeName));X(t!==void 0,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),o.fieldKind=`enum`,o.enum=n.getEnum(J(e.typeName)),o.getDefaultValue=()=>m(e,`defaultValue`)?rt(t,e.defaultValue):void 0;break}default:o.fieldKind=`scalar`,o.scalar=c,o.longAsString=l==mt,o.getDefaultValue=()=>m(e,`defaultValue`)?it(c,e.defaultValue):void 0;break}return o}function kt(e){switch(e.syntax){case``:case`proto2`:return ct;case`proto3`:return lt;case`editions`:if(e.edition in St)return e.edition;throw Error(`${e.name}: unsupported edition`);default:throw Error(`${e.name}: unsupported syntax "${e.syntax}"`)}}function At(e,t){return e.dependency.map(n=>{let r=t.getFile(n);if(!r)throw Error(`Cannot find ${n}, imported by ${e.name}`);return r})}function jt(e,t){let n=Mt(e)+`_`;for(let e of t){if(!e.name.toLowerCase().startsWith(n))return;let t=e.name.substring(n.length);if(t.length==0||/^\d/.test(t))return}return n}function Mt(e){return(e.substring(0,1)+e.substring(1).replace(/[A-Z]/g,e=>`_`+e)).toLowerCase()}function q(e,t,n){let r;return r=t?`${t.typeName}.${e.name}`:n.proto.package.length>0?`${n.proto.package}.${e.name}`:`${e.name}`,r}function J(e){return e.startsWith(`.`)?e.substring(1):e}function Nt(e,t){if(!m(e,`oneofIndex`)||e.proto3Optional)return;let n=t[e.oneofIndex];return X(n,`invalid FieldDescriptorProto: oneof #${e.oneofIndex} for field #${e.number} not found`),n}function Pt(e,t,n,r){if(e.label==pt)return vt;if(e.label==U)return _t;if(t||e.proto3Optional||n)return gt;let i=Y(`fieldPresence`,{proto:e,parent:r});return i==_t&&(e.type==H||e.type==V)?gt:i}function Ft(e,t){if(e.label!=U)return!1;switch(e.type){case ut:case dt:case V:case H:return!1}let n=e.options;return n&&m(n,`packed`)?n.packed:yt==Y(`repeatedFieldEncoding`,{proto:e,parent:t})}function It(e){let t=e.fields.find(e=>e.number===1),r=e.fields.find(e=>e.number===2);return X(t&&t.fieldKind==`scalar`&&t.scalar!=n.BYTES&&t.scalar!=n.FLOAT&&t.scalar!=n.DOUBLE&&r&&r.fieldKind!=`list`&&r.fieldKind!=`map`),{key:t,value:r}}function Lt(e){return xt==Y(`enumType`,{proto:e.proto,parent:e.parent??e.file})}function Rt(e,t){return e.type==V?!0:bt==Y(`messageEncoding`,{proto:e,parent:t})}function Y(e,t){let n=t.proto.options?.features;if(n){let t=n[e];if(t!=0)return t}if(`kind`in t){if(t.kind==`message`)return Y(e,t.parent??t.file);let n=St[t.edition];if(!n)throw Error(`feature default for edition ${t.edition} not found`);return n[e]}return Y(e,t.parent)}function X(e,t){if(!e)throw Error(t)}function zt(e){let t=Bt(e);return t.messageType.forEach(z),ot(t,()=>void 0).getFile(t.name)}function Bt(e){return Object.assign(Object.create({syntax:``,edition:0}),Object.assign(Object.assign({$typeName:`google.protobuf.FileDescriptorProto`,dependency:[],publicDependency:[],weakDependency:[],optionDependency:[],service:[],extension:[]},e),{messageType:e.messageType.map(Vt),enumType:e.enumType.map(Wt)}))}function Vt(e){return Object.assign(Object.create({visibility:0}),{$typeName:`google.protobuf.DescriptorProto`,name:e.name,field:e.field?.map(Ht)??[],extension:[],nestedType:e.nestedType?.map(Vt)??[],enumType:e.enumType?.map(Wt)??[],extensionRange:e.extensionRange?.map(e=>Object.assign({$typeName:`google.protobuf.DescriptorProto.ExtensionRange`},e))??[],oneofDecl:[],reservedRange:[],reservedName:[]})}function Ht(e){return Object.assign(Object.create({label:1,typeName:``,extendee:``,defaultValue:``,oneofIndex:0,jsonName:``,proto3Optional:!1}),Object.assign(Object.assign({$typeName:`google.protobuf.FieldDescriptorProto`},e),{options:e.options?Ut(e.options):void 0}))}function Ut(e){return Object.assign(Object.create({ctype:0,packed:!1,jstype:0,lazy:!1,unverifiedLazy:!1,deprecated:!1,weak:!1,debugRedact:!1,retention:0}),Object.assign(Object.assign({$typeName:`google.protobuf.FieldOptions`},e),{targets:e.targets??[],editionDefaults:e.editionDefaults?.map(e=>Object.assign({$typeName:`google.protobuf.FieldOptions.EditionDefault`},e))??[],uninterpretedOption:[]}))}function Wt(e){return Object.assign(Object.create({visibility:0}),{$typeName:`google.protobuf.EnumDescriptorProto`,name:e.name,reservedName:[],reservedRange:[],value:e.value.map(e=>Object.assign({$typeName:`google.protobuf.EnumValueDescriptorProto`},e))})}function Z(e,t,...n){return n.reduce((e,t)=>e.nestedMessages[t],e.messages[t])}var Gt=Z(zt({name:`google/protobuf/descriptor.proto`,package:`google.protobuf`,messageType:[{name:`FileDescriptorSet`,field:[{name:`file`,number:1,type:11,label:3,typeName:`.google.protobuf.FileDescriptorProto`}],extensionRange:[{start:536e6,end:536000001}]},{name:`FileDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`package`,number:2,type:9,label:1},{name:`dependency`,number:3,type:9,label:3},{name:`public_dependency`,number:10,type:5,label:3},{name:`weak_dependency`,number:11,type:5,label:3},{name:`option_dependency`,number:15,type:9,label:3},{name:`message_type`,number:4,type:11,label:3,typeName:`.google.protobuf.DescriptorProto`},{name:`enum_type`,number:5,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto`},{name:`service`,number:6,type:11,label:3,typeName:`.google.protobuf.ServiceDescriptorProto`},{name:`extension`,number:7,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`options`,number:8,type:11,label:1,typeName:`.google.protobuf.FileOptions`},{name:`source_code_info`,number:9,type:11,label:1,typeName:`.google.protobuf.SourceCodeInfo`},{name:`syntax`,number:12,type:9,label:1},{name:`edition`,number:14,type:14,label:1,typeName:`.google.protobuf.Edition`}]},{name:`DescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`field`,number:2,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`extension`,number:6,type:11,label:3,typeName:`.google.protobuf.FieldDescriptorProto`},{name:`nested_type`,number:3,type:11,label:3,typeName:`.google.protobuf.DescriptorProto`},{name:`enum_type`,number:4,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto`},{name:`extension_range`,number:5,type:11,label:3,typeName:`.google.protobuf.DescriptorProto.ExtensionRange`},{name:`oneof_decl`,number:8,type:11,label:3,typeName:`.google.protobuf.OneofDescriptorProto`},{name:`options`,number:7,type:11,label:1,typeName:`.google.protobuf.MessageOptions`},{name:`reserved_range`,number:9,type:11,label:3,typeName:`.google.protobuf.DescriptorProto.ReservedRange`},{name:`reserved_name`,number:10,type:9,label:3},{name:`visibility`,number:11,type:14,label:1,typeName:`.google.protobuf.SymbolVisibility`}],nestedType:[{name:`ExtensionRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.ExtensionRangeOptions`}]},{name:`ReservedRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1}]}]},{name:`ExtensionRangeOptions`,field:[{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`},{name:`declaration`,number:2,type:11,label:3,typeName:`.google.protobuf.ExtensionRangeOptions.Declaration`,options:{retention:2}},{name:`features`,number:50,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`verification`,number:3,type:14,label:1,typeName:`.google.protobuf.ExtensionRangeOptions.VerificationState`,defaultValue:`UNVERIFIED`,options:{retention:2}}],nestedType:[{name:`Declaration`,field:[{name:`number`,number:1,type:5,label:1},{name:`full_name`,number:2,type:9,label:1},{name:`type`,number:3,type:9,label:1},{name:`reserved`,number:5,type:8,label:1},{name:`repeated`,number:6,type:8,label:1}]}],enumType:[{name:`VerificationState`,value:[{name:`DECLARATION`,number:0},{name:`UNVERIFIED`,number:1}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`FieldDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`number`,number:3,type:5,label:1},{name:`label`,number:4,type:14,label:1,typeName:`.google.protobuf.FieldDescriptorProto.Label`},{name:`type`,number:5,type:14,label:1,typeName:`.google.protobuf.FieldDescriptorProto.Type`},{name:`type_name`,number:6,type:9,label:1},{name:`extendee`,number:2,type:9,label:1},{name:`default_value`,number:7,type:9,label:1},{name:`oneof_index`,number:9,type:5,label:1},{name:`json_name`,number:10,type:9,label:1},{name:`options`,number:8,type:11,label:1,typeName:`.google.protobuf.FieldOptions`},{name:`proto3_optional`,number:17,type:8,label:1}],enumType:[{name:`Type`,value:[{name:`TYPE_DOUBLE`,number:1},{name:`TYPE_FLOAT`,number:2},{name:`TYPE_INT64`,number:3},{name:`TYPE_UINT64`,number:4},{name:`TYPE_INT32`,number:5},{name:`TYPE_FIXED64`,number:6},{name:`TYPE_FIXED32`,number:7},{name:`TYPE_BOOL`,number:8},{name:`TYPE_STRING`,number:9},{name:`TYPE_GROUP`,number:10},{name:`TYPE_MESSAGE`,number:11},{name:`TYPE_BYTES`,number:12},{name:`TYPE_UINT32`,number:13},{name:`TYPE_ENUM`,number:14},{name:`TYPE_SFIXED32`,number:15},{name:`TYPE_SFIXED64`,number:16},{name:`TYPE_SINT32`,number:17},{name:`TYPE_SINT64`,number:18}]},{name:`Label`,value:[{name:`LABEL_OPTIONAL`,number:1},{name:`LABEL_REPEATED`,number:3},{name:`LABEL_REQUIRED`,number:2}]}]},{name:`OneofDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`options`,number:2,type:11,label:1,typeName:`.google.protobuf.OneofOptions`}]},{name:`EnumDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`value`,number:2,type:11,label:3,typeName:`.google.protobuf.EnumValueDescriptorProto`},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.EnumOptions`},{name:`reserved_range`,number:4,type:11,label:3,typeName:`.google.protobuf.EnumDescriptorProto.EnumReservedRange`},{name:`reserved_name`,number:5,type:9,label:3},{name:`visibility`,number:6,type:14,label:1,typeName:`.google.protobuf.SymbolVisibility`}],nestedType:[{name:`EnumReservedRange`,field:[{name:`start`,number:1,type:5,label:1},{name:`end`,number:2,type:5,label:1}]}]},{name:`EnumValueDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`number`,number:2,type:5,label:1},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.EnumValueOptions`}]},{name:`ServiceDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`method`,number:2,type:11,label:3,typeName:`.google.protobuf.MethodDescriptorProto`},{name:`options`,number:3,type:11,label:1,typeName:`.google.protobuf.ServiceOptions`}]},{name:`MethodDescriptorProto`,field:[{name:`name`,number:1,type:9,label:1},{name:`input_type`,number:2,type:9,label:1},{name:`output_type`,number:3,type:9,label:1},{name:`options`,number:4,type:11,label:1,typeName:`.google.protobuf.MethodOptions`},{name:`client_streaming`,number:5,type:8,label:1,defaultValue:`false`},{name:`server_streaming`,number:6,type:8,label:1,defaultValue:`false`}]},{name:`FileOptions`,field:[{name:`java_package`,number:1,type:9,label:1},{name:`java_outer_classname`,number:8,type:9,label:1},{name:`java_multiple_files`,number:10,type:8,label:1,defaultValue:`false`},{name:`java_generate_equals_and_hash`,number:20,type:8,label:1,options:{deprecated:!0}},{name:`java_string_check_utf8`,number:27,type:8,label:1,defaultValue:`false`},{name:`optimize_for`,number:9,type:14,label:1,typeName:`.google.protobuf.FileOptions.OptimizeMode`,defaultValue:`SPEED`},{name:`go_package`,number:11,type:9,label:1},{name:`cc_generic_services`,number:16,type:8,label:1,defaultValue:`false`},{name:`java_generic_services`,number:17,type:8,label:1,defaultValue:`false`},{name:`py_generic_services`,number:18,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:23,type:8,label:1,defaultValue:`false`},{name:`cc_enable_arenas`,number:31,type:8,label:1,defaultValue:`true`},{name:`objc_class_prefix`,number:36,type:9,label:1},{name:`csharp_namespace`,number:37,type:9,label:1},{name:`swift_prefix`,number:39,type:9,label:1},{name:`php_class_prefix`,number:40,type:9,label:1},{name:`php_namespace`,number:41,type:9,label:1},{name:`php_metadata_namespace`,number:44,type:9,label:1},{name:`ruby_package`,number:45,type:9,label:1},{name:`features`,number:50,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],enumType:[{name:`OptimizeMode`,value:[{name:`SPEED`,number:1},{name:`CODE_SIZE`,number:2},{name:`LITE_RUNTIME`,number:3}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`MessageOptions`,field:[{name:`message_set_wire_format`,number:1,type:8,label:1,defaultValue:`false`},{name:`no_standard_descriptor_accessor`,number:2,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`map_entry`,number:7,type:8,label:1},{name:`deprecated_legacy_json_field_conflicts`,number:11,type:8,label:1,options:{deprecated:!0}},{name:`features`,number:12,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`FieldOptions`,field:[{name:`ctype`,number:1,type:14,label:1,typeName:`.google.protobuf.FieldOptions.CType`,defaultValue:`STRING`},{name:`packed`,number:2,type:8,label:1},{name:`jstype`,number:6,type:14,label:1,typeName:`.google.protobuf.FieldOptions.JSType`,defaultValue:`JS_NORMAL`},{name:`lazy`,number:5,type:8,label:1,defaultValue:`false`},{name:`unverified_lazy`,number:15,type:8,label:1,defaultValue:`false`},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`weak`,number:10,type:8,label:1,defaultValue:`false`,options:{deprecated:!0}},{name:`debug_redact`,number:16,type:8,label:1,defaultValue:`false`},{name:`retention`,number:17,type:14,label:1,typeName:`.google.protobuf.FieldOptions.OptionRetention`},{name:`targets`,number:19,type:14,label:3,typeName:`.google.protobuf.FieldOptions.OptionTargetType`},{name:`edition_defaults`,number:20,type:11,label:3,typeName:`.google.protobuf.FieldOptions.EditionDefault`},{name:`features`,number:21,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`feature_support`,number:22,type:11,label:1,typeName:`.google.protobuf.FieldOptions.FeatureSupport`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],nestedType:[{name:`EditionDefault`,field:[{name:`edition`,number:3,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`value`,number:2,type:9,label:1}]},{name:`FeatureSupport`,field:[{name:`edition_introduced`,number:1,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`edition_deprecated`,number:2,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`deprecation_warning`,number:3,type:9,label:1},{name:`edition_removed`,number:4,type:14,label:1,typeName:`.google.protobuf.Edition`}]}],enumType:[{name:`CType`,value:[{name:`STRING`,number:0},{name:`CORD`,number:1},{name:`STRING_PIECE`,number:2}]},{name:`JSType`,value:[{name:`JS_NORMAL`,number:0},{name:`JS_STRING`,number:1},{name:`JS_NUMBER`,number:2}]},{name:`OptionRetention`,value:[{name:`RETENTION_UNKNOWN`,number:0},{name:`RETENTION_RUNTIME`,number:1},{name:`RETENTION_SOURCE`,number:2}]},{name:`OptionTargetType`,value:[{name:`TARGET_TYPE_UNKNOWN`,number:0},{name:`TARGET_TYPE_FILE`,number:1},{name:`TARGET_TYPE_EXTENSION_RANGE`,number:2},{name:`TARGET_TYPE_MESSAGE`,number:3},{name:`TARGET_TYPE_FIELD`,number:4},{name:`TARGET_TYPE_ONEOF`,number:5},{name:`TARGET_TYPE_ENUM`,number:6},{name:`TARGET_TYPE_ENUM_ENTRY`,number:7},{name:`TARGET_TYPE_SERVICE`,number:8},{name:`TARGET_TYPE_METHOD`,number:9}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`OneofOptions`,field:[{name:`features`,number:1,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`EnumOptions`,field:[{name:`allow_alias`,number:2,type:8,label:1},{name:`deprecated`,number:3,type:8,label:1,defaultValue:`false`},{name:`deprecated_legacy_json_field_conflicts`,number:6,type:8,label:1,options:{deprecated:!0}},{name:`features`,number:7,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`EnumValueOptions`,field:[{name:`deprecated`,number:1,type:8,label:1,defaultValue:`false`},{name:`features`,number:2,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`debug_redact`,number:3,type:8,label:1,defaultValue:`false`},{name:`feature_support`,number:4,type:11,label:1,typeName:`.google.protobuf.FieldOptions.FeatureSupport`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`ServiceOptions`,field:[{name:`features`,number:34,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`deprecated`,number:33,type:8,label:1,defaultValue:`false`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],extensionRange:[{start:1e3,end:536870912}]},{name:`MethodOptions`,field:[{name:`deprecated`,number:33,type:8,label:1,defaultValue:`false`},{name:`idempotency_level`,number:34,type:14,label:1,typeName:`.google.protobuf.MethodOptions.IdempotencyLevel`,defaultValue:`IDEMPOTENCY_UNKNOWN`},{name:`features`,number:35,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`uninterpreted_option`,number:999,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption`}],enumType:[{name:`IdempotencyLevel`,value:[{name:`IDEMPOTENCY_UNKNOWN`,number:0},{name:`NO_SIDE_EFFECTS`,number:1},{name:`IDEMPOTENT`,number:2}]}],extensionRange:[{start:1e3,end:536870912}]},{name:`UninterpretedOption`,field:[{name:`name`,number:2,type:11,label:3,typeName:`.google.protobuf.UninterpretedOption.NamePart`},{name:`identifier_value`,number:3,type:9,label:1},{name:`positive_int_value`,number:4,type:4,label:1},{name:`negative_int_value`,number:5,type:3,label:1},{name:`double_value`,number:6,type:1,label:1},{name:`string_value`,number:7,type:12,label:1},{name:`aggregate_value`,number:8,type:9,label:1}],nestedType:[{name:`NamePart`,field:[{name:`name_part`,number:1,type:9,label:2},{name:`is_extension`,number:2,type:8,label:2}]}]},{name:`FeatureSet`,field:[{name:`field_presence`,number:1,type:14,label:1,typeName:`.google.protobuf.FeatureSet.FieldPresence`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`EXPLICIT`,edition:900},{value:`IMPLICIT`,edition:999},{value:`EXPLICIT`,edition:1e3}]}},{name:`enum_type`,number:2,type:14,label:1,typeName:`.google.protobuf.FeatureSet.EnumType`,options:{retention:1,targets:[6,1],editionDefaults:[{value:`CLOSED`,edition:900},{value:`OPEN`,edition:999}]}},{name:`repeated_field_encoding`,number:3,type:14,label:1,typeName:`.google.protobuf.FeatureSet.RepeatedFieldEncoding`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`EXPANDED`,edition:900},{value:`PACKED`,edition:999}]}},{name:`utf8_validation`,number:4,type:14,label:1,typeName:`.google.protobuf.FeatureSet.Utf8Validation`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`NONE`,edition:900},{value:`VERIFY`,edition:999}]}},{name:`message_encoding`,number:5,type:14,label:1,typeName:`.google.protobuf.FeatureSet.MessageEncoding`,options:{retention:1,targets:[4,1],editionDefaults:[{value:`LENGTH_PREFIXED`,edition:900}]}},{name:`json_format`,number:6,type:14,label:1,typeName:`.google.protobuf.FeatureSet.JsonFormat`,options:{retention:1,targets:[3,6,1],editionDefaults:[{value:`LEGACY_BEST_EFFORT`,edition:900},{value:`ALLOW`,edition:999}]}},{name:`enforce_naming_style`,number:7,type:14,label:1,typeName:`.google.protobuf.FeatureSet.EnforceNamingStyle`,options:{retention:2,targets:[1,2,3,4,5,6,7,8,9],editionDefaults:[{value:`STYLE_LEGACY`,edition:900},{value:`STYLE2024`,edition:1001}]}},{name:`default_symbol_visibility`,number:8,type:14,label:1,typeName:`.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility`,options:{retention:2,targets:[1],editionDefaults:[{value:`EXPORT_ALL`,edition:900},{value:`EXPORT_TOP_LEVEL`,edition:1001}]}}],nestedType:[{name:`VisibilityFeature`,enumType:[{name:`DefaultSymbolVisibility`,value:[{name:`DEFAULT_SYMBOL_VISIBILITY_UNKNOWN`,number:0},{name:`EXPORT_ALL`,number:1},{name:`EXPORT_TOP_LEVEL`,number:2},{name:`LOCAL_ALL`,number:3},{name:`STRICT`,number:4}]}]}],enumType:[{name:`FieldPresence`,value:[{name:`FIELD_PRESENCE_UNKNOWN`,number:0},{name:`EXPLICIT`,number:1},{name:`IMPLICIT`,number:2},{name:`LEGACY_REQUIRED`,number:3}]},{name:`EnumType`,value:[{name:`ENUM_TYPE_UNKNOWN`,number:0},{name:`OPEN`,number:1},{name:`CLOSED`,number:2}]},{name:`RepeatedFieldEncoding`,value:[{name:`REPEATED_FIELD_ENCODING_UNKNOWN`,number:0},{name:`PACKED`,number:1},{name:`EXPANDED`,number:2}]},{name:`Utf8Validation`,value:[{name:`UTF8_VALIDATION_UNKNOWN`,number:0},{name:`VERIFY`,number:2},{name:`NONE`,number:3}]},{name:`MessageEncoding`,value:[{name:`MESSAGE_ENCODING_UNKNOWN`,number:0},{name:`LENGTH_PREFIXED`,number:1},{name:`DELIMITED`,number:2}]},{name:`JsonFormat`,value:[{name:`JSON_FORMAT_UNKNOWN`,number:0},{name:`ALLOW`,number:1},{name:`LEGACY_BEST_EFFORT`,number:2}]},{name:`EnforceNamingStyle`,value:[{name:`ENFORCE_NAMING_STYLE_UNKNOWN`,number:0},{name:`STYLE2024`,number:1},{name:`STYLE_LEGACY`,number:2}]}],extensionRange:[{start:1e3,end:9995},{start:9995,end:1e4},{start:1e4,end:10001}]},{name:`FeatureSetDefaults`,field:[{name:`defaults`,number:1,type:11,label:3,typeName:`.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault`},{name:`minimum_edition`,number:4,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`maximum_edition`,number:5,type:14,label:1,typeName:`.google.protobuf.Edition`}],nestedType:[{name:`FeatureSetEditionDefault`,field:[{name:`edition`,number:3,type:14,label:1,typeName:`.google.protobuf.Edition`},{name:`overridable_features`,number:4,type:11,label:1,typeName:`.google.protobuf.FeatureSet`},{name:`fixed_features`,number:5,type:11,label:1,typeName:`.google.protobuf.FeatureSet`}]}]},{name:`SourceCodeInfo`,field:[{name:`location`,number:1,type:11,label:3,typeName:`.google.protobuf.SourceCodeInfo.Location`}],nestedType:[{name:`Location`,field:[{name:`path`,number:1,type:5,label:3,options:{packed:!0}},{name:`span`,number:2,type:5,label:3,options:{packed:!0}},{name:`leading_comments`,number:3,type:9,label:1},{name:`trailing_comments`,number:4,type:9,label:1},{name:`leading_detached_comments`,number:6,type:9,label:3}]}],extensionRange:[{start:536e6,end:536000001}]},{name:`GeneratedCodeInfo`,field:[{name:`annotation`,number:1,type:11,label:3,typeName:`.google.protobuf.GeneratedCodeInfo.Annotation`}],nestedType:[{name:`Annotation`,field:[{name:`path`,number:1,type:5,label:3,options:{packed:!0}},{name:`source_file`,number:2,type:9,label:1},{name:`begin`,number:3,type:5,label:1},{name:`end`,number:4,type:5,label:1},{name:`semantic`,number:5,type:14,label:1,typeName:`.google.protobuf.GeneratedCodeInfo.Annotation.Semantic`}],enumType:[{name:`Semantic`,value:[{name:`NONE`,number:0},{name:`SET`,number:1},{name:`ALIAS`,number:2}]}]}]}],enumType:[{name:`Edition`,value:[{name:`EDITION_UNKNOWN`,number:0},{name:`EDITION_LEGACY`,number:900},{name:`EDITION_PROTO2`,number:998},{name:`EDITION_PROTO3`,number:999},{name:`EDITION_2023`,number:1e3},{name:`EDITION_2024`,number:1001},{name:`EDITION_UNSTABLE`,number:9999},{name:`EDITION_1_TEST_ONLY`,number:1},{name:`EDITION_2_TEST_ONLY`,number:2},{name:`EDITION_99997_TEST_ONLY`,number:99997},{name:`EDITION_99998_TEST_ONLY`,number:99998},{name:`EDITION_99999_TEST_ONLY`,number:99999},{name:`EDITION_MAX`,number:2147483647}]},{name:`SymbolVisibility`,value:[{name:`VISIBILITY_UNSET`,number:0},{name:`VISIBILITY_LOCAL`,number:1},{name:`VISIBILITY_EXPORT`,number:2}]}]}),1),Kt;(function(e){e[e.DECLARATION=0]=`DECLARATION`,e[e.UNVERIFIED=1]=`UNVERIFIED`})(Kt||={});var qt;(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.GROUP=10]=`GROUP`,e[e.MESSAGE=11]=`MESSAGE`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.ENUM=14]=`ENUM`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(qt||={});var Jt;(function(e){e[e.OPTIONAL=1]=`OPTIONAL`,e[e.REPEATED=3]=`REPEATED`,e[e.REQUIRED=2]=`REQUIRED`})(Jt||={});var Yt;(function(e){e[e.SPEED=1]=`SPEED`,e[e.CODE_SIZE=2]=`CODE_SIZE`,e[e.LITE_RUNTIME=3]=`LITE_RUNTIME`})(Yt||={});var Xt;(function(e){e[e.STRING=0]=`STRING`,e[e.CORD=1]=`CORD`,e[e.STRING_PIECE=2]=`STRING_PIECE`})(Xt||={});var Zt;(function(e){e[e.JS_NORMAL=0]=`JS_NORMAL`,e[e.JS_STRING=1]=`JS_STRING`,e[e.JS_NUMBER=2]=`JS_NUMBER`})(Zt||={});var Qt;(function(e){e[e.RETENTION_UNKNOWN=0]=`RETENTION_UNKNOWN`,e[e.RETENTION_RUNTIME=1]=`RETENTION_RUNTIME`,e[e.RETENTION_SOURCE=2]=`RETENTION_SOURCE`})(Qt||={});var $t;(function(e){e[e.TARGET_TYPE_UNKNOWN=0]=`TARGET_TYPE_UNKNOWN`,e[e.TARGET_TYPE_FILE=1]=`TARGET_TYPE_FILE`,e[e.TARGET_TYPE_EXTENSION_RANGE=2]=`TARGET_TYPE_EXTENSION_RANGE`,e[e.TARGET_TYPE_MESSAGE=3]=`TARGET_TYPE_MESSAGE`,e[e.TARGET_TYPE_FIELD=4]=`TARGET_TYPE_FIELD`,e[e.TARGET_TYPE_ONEOF=5]=`TARGET_TYPE_ONEOF`,e[e.TARGET_TYPE_ENUM=6]=`TARGET_TYPE_ENUM`,e[e.TARGET_TYPE_ENUM_ENTRY=7]=`TARGET_TYPE_ENUM_ENTRY`,e[e.TARGET_TYPE_SERVICE=8]=`TARGET_TYPE_SERVICE`,e[e.TARGET_TYPE_METHOD=9]=`TARGET_TYPE_METHOD`})($t||={});var en;(function(e){e[e.IDEMPOTENCY_UNKNOWN=0]=`IDEMPOTENCY_UNKNOWN`,e[e.NO_SIDE_EFFECTS=1]=`NO_SIDE_EFFECTS`,e[e.IDEMPOTENT=2]=`IDEMPOTENT`})(en||={});var tn;(function(e){e[e.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0]=`DEFAULT_SYMBOL_VISIBILITY_UNKNOWN`,e[e.EXPORT_ALL=1]=`EXPORT_ALL`,e[e.EXPORT_TOP_LEVEL=2]=`EXPORT_TOP_LEVEL`,e[e.LOCAL_ALL=3]=`LOCAL_ALL`,e[e.STRICT=4]=`STRICT`})(tn||={});var nn;(function(e){e[e.FIELD_PRESENCE_UNKNOWN=0]=`FIELD_PRESENCE_UNKNOWN`,e[e.EXPLICIT=1]=`EXPLICIT`,e[e.IMPLICIT=2]=`IMPLICIT`,e[e.LEGACY_REQUIRED=3]=`LEGACY_REQUIRED`})(nn||={});var rn;(function(e){e[e.ENUM_TYPE_UNKNOWN=0]=`ENUM_TYPE_UNKNOWN`,e[e.OPEN=1]=`OPEN`,e[e.CLOSED=2]=`CLOSED`})(rn||={});var an;(function(e){e[e.REPEATED_FIELD_ENCODING_UNKNOWN=0]=`REPEATED_FIELD_ENCODING_UNKNOWN`,e[e.PACKED=1]=`PACKED`,e[e.EXPANDED=2]=`EXPANDED`})(an||={});var on;(function(e){e[e.UTF8_VALIDATION_UNKNOWN=0]=`UTF8_VALIDATION_UNKNOWN`,e[e.VERIFY=2]=`VERIFY`,e[e.NONE=3]=`NONE`})(on||={});var sn;(function(e){e[e.MESSAGE_ENCODING_UNKNOWN=0]=`MESSAGE_ENCODING_UNKNOWN`,e[e.LENGTH_PREFIXED=1]=`LENGTH_PREFIXED`,e[e.DELIMITED=2]=`DELIMITED`})(sn||={});var cn;(function(e){e[e.JSON_FORMAT_UNKNOWN=0]=`JSON_FORMAT_UNKNOWN`,e[e.ALLOW=1]=`ALLOW`,e[e.LEGACY_BEST_EFFORT=2]=`LEGACY_BEST_EFFORT`})(cn||={});var ln;(function(e){e[e.ENFORCE_NAMING_STYLE_UNKNOWN=0]=`ENFORCE_NAMING_STYLE_UNKNOWN`,e[e.STYLE2024=1]=`STYLE2024`,e[e.STYLE_LEGACY=2]=`STYLE_LEGACY`})(ln||={});var un;(function(e){e[e.NONE=0]=`NONE`,e[e.SET=1]=`SET`,e[e.ALIAS=2]=`ALIAS`})(un||={});var dn;(function(e){e[e.EDITION_UNKNOWN=0]=`EDITION_UNKNOWN`,e[e.EDITION_LEGACY=900]=`EDITION_LEGACY`,e[e.EDITION_PROTO2=998]=`EDITION_PROTO2`,e[e.EDITION_PROTO3=999]=`EDITION_PROTO3`,e[e.EDITION_2023=1e3]=`EDITION_2023`,e[e.EDITION_2024=1001]=`EDITION_2024`,e[e.EDITION_UNSTABLE=9999]=`EDITION_UNSTABLE`,e[e.EDITION_1_TEST_ONLY=1]=`EDITION_1_TEST_ONLY`,e[e.EDITION_2_TEST_ONLY=2]=`EDITION_2_TEST_ONLY`,e[e.EDITION_99997_TEST_ONLY=99997]=`EDITION_99997_TEST_ONLY`,e[e.EDITION_99998_TEST_ONLY=99998]=`EDITION_99998_TEST_ONLY`,e[e.EDITION_99999_TEST_ONLY=99999]=`EDITION_99999_TEST_ONLY`,e[e.EDITION_MAX=2147483647]=`EDITION_MAX`})(dn||={});var fn;(function(e){e[e.VISIBILITY_UNSET=0]=`VISIBILITY_UNSET`,e[e.VISIBILITY_LOCAL=1]=`VISIBILITY_LOCAL`,e[e.VISIBILITY_EXPORT=2]=`VISIBILITY_EXPORT`})(fn||={});var pn={readUnknownFields:!0};function mn(e){return e?Object.assign(Object.assign({},pn),e):pn}function Q(e,t,n){let r=O(e,void 0,!1);return hn(r,new Ae(t),mn(n),!1,t.byteLength),r.message}function hn(e,t,n,r,i){let a=r?t.len:t.pos+i,o,s,c=e.getUnknown()??[];for(;t.pos<a&&([o,s]=t.tag(),!(r&&s==w.EndGroup));){let r=e.findNumber(o);if(!r){let e=t.skip(s,o);n.readUnknownFields&&c.push({no:o,wireType:s,data:e});continue}gn(e,t,r,s,n)}if(r&&(s!=w.EndGroup||o!==i))throw Error(`invalid end group tag`);c.length>0&&e.setUnknown(c)}function gn(e,t,r,i,a){switch(r.fieldKind){case`scalar`:e.set(r,$(t,r.scalar));break;case`enum`:let o=$(t,n.INT32);if(r.enum.open)e.set(r,o);else if(r.enum.values.some(e=>e.number===o))e.set(r,o);else if(a.readUnknownFields){let t=[];te(o,t);let n=e.getUnknown()??[];n.push({no:r.number,wireType:i,data:new Uint8Array(t)}),e.setUnknown(n)}break;case`message`:e.set(r,yn(t,a,r,e.get(r)));break;case`list`:vn(t,i,e.get(r),a);break;case`map`:_n(t,e.get(r),a);break}}function _n(e,t,n){let r=t.field(),i,a,o=e.uint32(),s=e.pos+o;for(;e.pos<s;){let[t]=e.tag();switch(t){case 1:i=$(e,r.mapKey);break;case 2:switch(r.mapKind){case`scalar`:a=$(e,r.scalar);break;case`enum`:a=e.int32();break;case`message`:a=yn(e,n,r);break}break}}if(i===void 0&&(i=f(r.mapKey,!1)),a===void 0)switch(r.mapKind){case`scalar`:a=f(r.scalar,!1);break;case`enum`:a=r.enum.values[0].number;break;case`message`:a=O(r.message,void 0,!1);break}t.set(i,a)}function vn(e,t,r,i){let a=r.field();if(a.listKind===`message`){r.add(yn(e,i,a));return}let o=a.scalar??n.INT32;if(!(t==w.LengthDelimited&&o!=n.STRING&&o!=n.BYTES)){r.add($(e,o));return}let s=e.uint32()+e.pos;for(;e.pos<s;)r.add($(e,o))}function yn(e,t,n,r){let i=n.delimitedEncoding,a=r??O(n.message,void 0,!1);return hn(a,e,t,i,i?n.number:e.uint32()),a}function $(e,t){switch(t){case n.STRING:return e.string();case n.BOOL:return e.bool();case n.DOUBLE:return e.double();case n.FLOAT:return e.float();case n.INT32:return e.int32();case n.INT64:return e.int64();case n.UINT64:return e.uint64();case n.FIXED64:return e.fixed64();case n.BYTES:return e.bytes();case n.FIXED32:return e.fixed32();case n.SFIXED32:return e.sfixed32();case n.SFIXED64:return e.sfixed64();case n.SINT64:return e.sint64();case n.UINT32:return e.uint32();case n.SINT32:return e.sint32()}}function bn(e,t){let n=Q(Gt,Qe(e));return n.messageType.forEach(z),n.dependency=t?.map(e=>e.proto.name)??[],ot(n,e=>t?.find(t=>t.proto.name===e)).getFile(n.name)}var xn="(function(){var e=class{pendingPayloads=[];payload=new Uint8Array;chunks=[];push=e=>{this.pendingPayloads.push(e)};next=(e=0)=>{this.payload=this.payload.slice(e);let t=this.pendingPayloads.shift();if(!t)return!1;let n=new Uint8Array(this.payload.byteLength+t.byteLength);return n.set(this.payload,0),n.set(t,this.payload.byteLength),this.payload=n,new DataView(this.payload.buffer)};pushChunk=e=>{this.chunks.push(e),this.chunks.length>100&&this.chunks.shift()};destroy=()=>{this.pendingPayloads=[],this.payload=new Uint8Array,this.chunks=[]}};let t=(e,t)=>{let n=new Uint8Array(e),r=new Uint8Array(t),i=new Uint8Array(11+n.length+r.length),a=0;return i[a++]=1,i[a++]=n[1],i[a++]=n[2],i[a++]=n[3],i[a++]=255,i[a++]=225,i[a++]=n.length>>8&255,i[a++]=n.length&255,i.set(n,a),a+=n.length,i[a++]=1,i[a++]=r.length>>8&255,i[a++]=r.length&255,i.set(r,a),i},n=e=>{let t=0,n=new DataView(e.buffer),r=n.getUint8(t);if(t+=1,r!==1)throw Error(`Invalid AVC version`);let i=n.getUint8(t)&255;t+=1;let a=n.getUint8(t)&255;t+=1;let o=n.getUint8(t)&255;t+=1;let s=`avc1.${Array.from([i,a,o],e=>e.toString(16).padStart(2,`0`)).join(``)}`,c=(n.getUint8(t)&3)-1;t+=1;let l=n.getUint8(t)&31;t+=1;let u=n.getUint16(t,!1);t+=2;let d=new Uint8Array(n.buffer.slice(t,t+u));t+=u;let f=n.getUint8(t)&31;t+=1;let p=n.getUint16(t,!1);t+=2;let m=new Uint8Array(n.buffer.slice(t,t+p));return t+=p,{version:r,codec:s,profile:i,compatibility:a,level:o,lengthSizeMinusOne:c,numOfSequenceParameterSets:l,sequenceParameterSetLength:u,sps:d,numOfPictureParameterSets:f,pictureParameterSetLength:p,pps:m}},r=e=>{let t=new Uint8Array(4+e.length);return new DataView(t.buffer).setUint32(0,e.length,!1),t.set(e,4),t},i=e=>{let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e){let e=t;n.set(e,r),r+=e.length}return n},a=e=>{let t=`unknown`;switch(e){case 1:case 2:case 27:case 36:t=`video`;break;case 3:case 4:case 15:t=`audio`;break;case 6:t=`subtitle`;break;case 134:t=`ad`;break}return t};var o=class{pat;pmt;audioConfig;videoConfig;payloadMap=new Map;on={};constructor(){}parse=async e=>{let t=0;for(;!(t+188>e.byteLength);){if(e.getInt8(t)!=71){t++;continue}await this.parsePacket(e,t),t+=188}return t};parsePacket=async(e,t)=>{if(t+188>e.byteLength||e.getUint8(t)!==71)throw Error(`Invalid TS packet`);let n=t,r=this.parseHeader(e,n);n+=4;let{transport_error_indicator:i,pid:a,payload_unit_start_indicator:o,adaptation_field_control:s}=r;if(i===1||a===void 0)return;let c=184;if(s===2||s===3){let t=e.getUint8(n);n+=1,this.parseAdaptationField(e,n),n+=t,c-=t}if(s===3&&--c,s===1||s===3){let t=new Uint8Array(e.buffer.slice(n,n+c));if(a===0)return this.parsePAT(e,n);{let{programs:t=[]}=this.pat||{};if(t.find(e=>e.pmt_pid===a))return this.parsePMT(e,n)}let{streams:r=[]}=this.pmt||{},i=r.find(e=>e.elementary_pid===a);if(i){if(o===1){let e=this.payloadMap.get(a);if(e){switch(i.kind){case`audio`:{let t=await this.parseAudio(e);this.on.chunk&&this.on.chunk(t)}break;case`video`:{let t=await this.parseVideo(e);this.on.chunk&&this.on.chunk(t),await new Promise(e=>setTimeout(()=>e(!0),0))}break}this.payloadMap.delete(a)}}{this.payloadMap.has(a)||this.payloadMap.set(a,new Uint8Array);let e=this.payloadMap.get(a),n=new Uint8Array(e.byteLength+t.byteLength);n.set(e,0),n.set(t,e.byteLength),this.payloadMap.set(a,n)}}}};parseHeader=(e,t)=>{let n=t,r=e.getUint8(n),i=e.getUint8(n+1),a=e.getUint8(n+2),o=e.getUint8(n+3),s=(i&128)>>7;return s===1?{sync_byte:r,transport_error_indicator:s}:{sync_byte:r,transport_error_indicator:s,payload_unit_start_indicator:(i&64)>>6,transport_priority:(i&32)>>5,pid:(i&31)<<8|a,transport_scrambling_control:(o&192)>>6,adaptation_field_control:o>>4&3,continuity_counter:o&15}};parsePAT=(e,t)=>{let n=t,r;{let t=e.getUint8(n);n+=1;let i=e.getUint8(n);if(n+=1,i!==0)throw Error(`Invalid PAT table_id`);let a=e.getUint16(n)&4095;n+=2;let o=e.getUint16(n);n+=2;let s=(e.getUint8(n)&62)>>1,c=e.getUint8(n)&1;n+=1;let l=e.getUint8(n);n+=1;let u=e.getUint8(n);n+=1,r={pointer_field:t,table_id:i,section_length:a,transport_stream_id:o,version_number:s,current_next_indicator:c,section_number:l,last_section_number:u}}let i=[];{let t=r.section_length-5-4,a=n+t;for(;n<a;){let t=e.getUint16(n),r=e.getUint16(n+2)&8191;n+=4,t!==0&&r>=32&&r<=8190&&i.push({program_number:t,pmt_pid:r})}}let a=e.getUint32(n);this.pat={header:r,programs:i,crc32:a},this.on.debug&&this.on.debug({pat:this.pat})};parsePMT=(e,t)=>{let n=t,r;{let t=e.getUint8(n);n+=1;let i=e.getUint8(n);if(n+=1,i!==2)throw Error(`Invalid PMT table_id`);let a=e.getUint16(n)&4095;n+=2;let o=e.getUint16(n);n+=2;let s=(e.getUint8(n)&62)>>1,c=e.getUint8(n)&1;n+=1;let l=e.getUint8(n);n+=1;let u=e.getUint8(n);n+=1;let d=e.getUint16(n)&8191;n+=2;let f=e.getUint16(n)&4095;n+=2,r={pointer_field:t,table_id:i,section_length:a,transport_stream_id:o,version_number:s,current_next_indicator:c,section_number:l,last_section_number:u,pcr_pid:d,program_info_length:f}}let i=[];{let t=r.section_length-9-4,o=n+t;for(;n<o;){let t=e.getUint8(n),r=a(t),o=e.getUint16(n+1)&8191,s=e.getUint16(n+3)&4095;if(n+=5,o<32||o>8190){console.warn(`Invalid elementary_pid: 0x${o.toString(16)}`);continue}i.push({kind:r,stream_type:t,elementary_pid:o,es_info_length:s})}}let o=e.getUint32(n);this.pmt={header:r,streams:i,crc32:o},this.on.debug&&this.on.debug({pmt:this.pmt})};parseAdaptationField=(e,t)=>{let n=t,r,i,a,o,s=e.getUint8(n),c=!!(s&128),l=!!(s&64),u=!!(s&32),d=!!(s&16),f=!!(s&8),p=!!(s&4),m=!!(s&2),h=!!(s&1);n+=1;let g=(e,t)=>{let n=BigInt(0);n|=BigInt(e.getUint16(t))<<25n,n|=BigInt(e.getUint16(t+1))<<17n,n|=BigInt(e.getUint16(t+2))<<9n,n|=BigInt(e.getUint16(t+3))<<1n,n|=BigInt(e.getUint16(t+4)>>7);let r=(e.getUint16(t+4)&1)<<8|e.getUint16(t+5);return n=n*300n+BigInt(r),n};if(d&&(r=g(e,n),n+=6),f&&(i=g(e,n),n+=6),p&&(a=e.getInt8(n),n+=1),m){let t=e.getUint8(n);n+=1,o=new Uint8Array(e.buffer,n,t),n+=t}return{discontinuity_indicator:c,random_access_indicator:l,elementary_stream_priority_indicator:u,pcr_flag:d,opcr_flag:f,splicing_point_flag:p,transport_private_data_flag:m,adaptation_field_extension_flag:h,pcr:r,opcr:i,splice_countdown:a,transport_private_data:o}};parseAudio=async e=>{let t=new DataView(e.buffer),n=0,r,i;{let e=t.getUint8(n)===0&&t.getUint8(n+1)===0&&t.getUint8(n+2)===1;if(n+=3,!e)throw Error(`invalid ts audio payload.`);let i=t.getUint8(n);n+=1;let a=t.getUint8(n)<<8|t.getUint8(n+1);n+=2;let o,s,c,l,u;{let e=t.getUint8(n);n+=1,o=e>>4&3,s=(e>>3&1)==1,c=(e>>2&1)==1,l=(e>>1&1)==1,u=(e&1)==1}let d,f;{let e=t.getUint8(n);n+=1;let r=e>>6,i=t.getUint8(n);n+=1,(r&2)==2&&(d=this.parsePtsDts(t,n)),f=(r&1)==1?this.parsePtsDts(t,n+5):d,n+=i}r={stream_id:i,pes_packet_length:a,scrambling_control:o,priority:s,data_alignment:c,copyright:l,original_copy:u,pts:d,dts:f}}i=e.slice(n);{if(!this.audioConfig&&t.getUint8(n)===255){let e=t.getUint8(n+2),r=t.getUint8(n+3),i,a;a=e>>2&15,i=(e&1)<<2|r>>6,this.audioConfig={kind:`audio`,codec:`mp4a.40.${i}`,sampleRate:[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][a],numberOfChannels:i},this.on.config&&this.on.config(this.audioConfig)}let{dts:e=0,pts:a=0}=r;return{kind:`audio`,type:`key`,dts:e,pts:a,cts:a-e,data:i.slice(7)}}};parseVideo=async e=>{let r=new DataView(e.buffer),a=0,o,s;{let e=r.getUint8(a)===0&&r.getUint8(a+1)===0&&r.getUint8(a+2)===1;if(a+=3,!e)throw Error(`invalid ts video payload.`);let t=r.getUint8(a);a+=1;let n=r.getUint8(a)<<8|r.getUint8(a+1);a+=2;let i,s,c,l,u;{let e=r.getUint8(a);a+=1,i=e>>4&3,s=(e>>3&1)==1,c=(e>>2&1)==1,l=(e>>1&1)==1,u=(e&1)==1}let d,f;{let e=r.getUint8(a);a+=1;let t=e>>6,n=r.getUint8(a);a+=1,(t&2)==2&&(d=this.parsePtsDts(r,a)),f=(t&1)==1?this.parsePtsDts(r,a+5):d,a+=n}o={stream_id:t,pes_packet_length:n,scrambling_control:i,priority:s,data_alignment:c,copyright:l,original_copy:u,pts:d,dts:f}}s=e.slice(a);{let e=this.getNalus(s);if(!this.videoConfig){let r,i;if(r=e.find(e=>e.type===7)?.nalu.slice(4),i=e.find(e=>e.type===8)?.nalu.slice(4),r&&i){let e=t(r,i),{codec:a}=n(e);this.videoConfig={kind:`video`,codec:a,description:e,sps:r,pps:i},this.on.config&&this.on.config(this.videoConfig)}}let r=[],a=`delta`;for(let t of e){let{type:e,nalu:n}=t;switch(e){case 6:case 9:r.push(n);break;case 1:a=`delta`,r.push(n);break;case 5:a=`key`,r.push(n);break}}let c=i(r),{dts:l=0,pts:u=0}=o,d=u-l;return{kind:`video`,type:a,dts:l,pts:u,cts:d,data:c,nalus:r}}};parsePtsDts(e,t){let n=e.getUint8(t),r=e.getUint8(t+1),i=e.getUint8(t+2),a=e.getUint8(t+3),o=e.getUint8(t+4),s=(BigInt(n)&14n)<<29n|(BigInt(r)&255n)<<22n|(BigInt(i)&254n)<<14n|(BigInt(a)&255n)<<7n|(BigInt(o)&254n)>>1n;return Number(s)/90}getNalus=e=>{let t=[],n=0;for(;!(n+4>e.byteLength);){if(e[n]!==0||e[n+1]!==0||e[n+2]!==1){n+=1;continue}n+=3;let i=n,a=e[n]&31;for(n+=1;!(n+1>e.byteLength);){if(e[n]!==0||e[n+1]!==0||e[n+2]!==1){n+=1;continue}break}let o=n-i;if(e[n-1]===0&&--o,o!==0){let n=r(e.slice(i,i+o));t.push({type:a,nalu:n})}}return t}};let s=(e,t)=>e.getUint8(t)<<16|e.getUint8(t+1)<<8|e.getUint8(t+2);var c=class{audioConfig;videoConfig;header;textDecoder=new TextDecoder(`utf-8`);on={};constructor(){}parse=async e=>{let t=0;for(this.header||(this.parseHeader(e,t),t+=9);this.isSurplusTag(e,t)!==!1;){let{tagType:n,dataSize:r,timestamp:i}=this.parseTagHeader(e,t+4);if(n){let a=this.parseTagBody(n,e,t+4+11,r);switch(n){case`script`:this.on.info&&this.on.info(a);break;case`audio`:{let{accPacketType:e}=a;if(e===0){let{codec:e,sampleRate:t,channelConfiguration:n}=a;this.audioConfig={kind:`audio`,codec:e,sampleRate:t,numberOfChannels:n},this.on.config&&this.on.config(this.audioConfig)}else{let{cts:e,data:t}=a,n=e===void 0?void 0:e+i;this.on.chunk&&this.on.chunk({kind:`audio`,type:`key`,dts:i,pts:n,cts:e,data:t})}}break;case`video`:{let{avcPacketType:e}=a;if(e===0){let{codec:e,sps:t,pps:n,data:r}=a;this.videoConfig={kind:`video`,codec:e,description:r,sps:t,pps:n},this.on.config&&this.on.config(this.videoConfig)}else{let{frameType:e,cts:t,data:n,nalus:r}=a,o=e===1?`key`:`delta`,s=t===void 0?void 0:t+i;this.on.chunk&&this.on.chunk({kind:`video`,type:o,dts:i,pts:s,cts:t,data:n,nalus:r})}}break}t=t+4+11+r}await new Promise(e=>setTimeout(()=>e(!0),8))}return t};parseHeader=(e,t)=>{let n,r,i,a;n=e.getUint8(t)<<16|e.getUint8(t+1)<<8|e.getUint8(t+2),r=e.getUint8(3);{let[,,t,,n]=e.getUint8(0).toString(2).padStart(5,`0`).split(``);i={audio:n===`1`,video:t===`1`}}a=e.getUint32(5),this.header={signature:n,version:r,flags:i,dataOffset:a}};isSurplusTag=(e,t)=>{let n=!0,r=e.byteLength;if(t+4>r)n=!1;else if(t+4+11>r)n=!1;else{let i=s(e,t+4+1);t+4+11+i>r&&(n=!1)}return n};parseTagHeader=(e,t)=>{let n,r,i,a,o;{let r=e.getUint8(t),i;switch(r){case 18:i=`script`;break;case 8:i=`audio`;break;case 9:i=`video`;break}n=i}return r=s(e,t+1),i=s(e,t+4),a=e.getUint8(t+7),o=s(e,t+8),{tagType:n,dataSize:r,timestamp:i,timestampExtended:a,streamID:o}};parseTagBody=(e,t,n,r)=>{let i;switch(e){case`script`:i=this.parseMetaData(t,n);break;case`audio`:i=this.parseAudio(t,n,r);break;case`video`:i=this.parseVideo(t,n,r);break}return i};parseMetaData=(e,t)=>{let n=t;if(e.getUint8(n)!==2)throw Error(`Invalid AMF type for onMetaData (expected 0x02)`);n+=1;let r=e.getUint16(n,!1);n+=2;{let t=new Int8Array(e.buffer.slice(n,n+r));if((this.textDecoder?.decode(t)||``)!==`onMetaData`)throw Error(`Expected 'onMetaData' string`);n+=r}let i=this.getAmfType(e,n);return n+=1,this.getAMFValue(e,n,i).value};parseAudio=(e,t,n)=>{let r=t,i=e.getUint8(r),a=i>>4&15,o=i>>2&3,s=i>>1&1,c=i&1;r+=1;let l=e.getUint8(r);r+=1;let u=n,d=new Uint8Array(e.buffer.slice(r,r+u));if(a===10&&l===0){let t=e.getUint8(r),n=e.getUint8(r+1),i=t>>3&31,u=(t&7)<<1|n>>7;return{soundFormat:a,soundRate:o,soundSize:s,soundType:c,accPacketType:l,data:d,samplingFrequencyIndex:u,channelConfiguration:n>>3&15,codec:`mp4a.40.${i}`,sampleRate:[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][u]}}return{soundFormat:a,soundRate:o,soundSize:s,soundType:c,accPacketType:l,data:d}};parseVideo=(e,t,r)=>{let i=t,a=e.getUint8(i),o=a>>4&15,c=a&15;i+=1;let l=e.getUint8(i);i+=1;let u=s(e,i);i+=3;let d=r-5,f=new Uint8Array(e.buffer.slice(i,i+d));switch(c){case 7:if(l===0)return{frameType:o,codecID:c,avcPacketType:l,cts:u,data:f,...n(f)};if(l===1){let t=[],n=i+r-5;for(;!(i+4>n);){let n=e.getUint32(i,!1),r=new Uint8Array(e.buffer.slice(i,i+4+n));i+=4+n,t.push(r)}return{frameType:o,codecID:c,avcPacketType:l,cts:u,data:f,nalus:t}}break;default:throw Error(`Unsupported codecID`)}return{frameType:o,codecID:c,avcPacketType:l,cts:u,data:f}};getAmfType=(e,t)=>e.getUint8(t);getAMFName=(e,t,n)=>{let r=new Uint8Array(e.buffer.slice(t,t+n));return this.textDecoder?.decode(r)||``};getAMFValue=(e,t,n)=>{let r=t,i,a=0;switch(n){case 0:i=e.getFloat64(r,!1),a=8;break;case 1:i=!!e.getUint8(r),a=1;break;case 2:{i=``;let t=e.getUint16(r,!1);r+=2;let n=new Int8Array(e.buffer,r,t).filter(e=>e!==0);i=(this.textDecoder?.decode(n)||``).trim(),a=2+t}break;case 3:for(i={};r<e.byteLength;){let t=e.getUint16(r,!1);if(t===0)break;r+=2;let n=this.getAMFName(e,r,t);r+=t;let o=this.getAmfType(e,r);if(o===6)break;r+=1;let s=this.getAMFValue(e,r,o);r+=s.length,i[n]=s.value,a=2+t+1+s.length}break;case 8:{i={};let t=e.getUint32(r,!1);r+=4;for(let n=0;n<t;n++){let t=e.getUint16(r,!1);r+=2;let n=this.getAMFName(e,r,t);r+=t;let o=this.getAmfType(e,r);r+=1;let s=this.getAMFValue(e,r,o);r+=s.length,i[n]=s.value,a=2+t+1+s.length}}break;case 10:{i=[];let t=e.getUint32(r,!1);r+=4;for(let n=0;n<t;n++){let t=this.getAmfType(e,r);r+=1;let n=this.getAMFValue(e,r,t);r+=n.length,i.push(n.value),a=1+n.length}}break}return{amfType:n,length:a,value:i}}};let l=new class{pattern;cacher=new e;isParseing=!1;offset=0;parser;on={};constructor(){}init=e=>{switch(this.destroy(),this.pattern=e,this.pattern){case`flv`:this.parser=new c;break;case`hls`:this.parser=new o;break;default:throw Error(`is error pattern.`)}this.parser.on.debug=e=>this.on.debug&&this.on.debug(e),this.parser.on.info=e=>this.on.info&&this.on.info(e),this.parser.on.config=e=>this.on.config&&this.on.config(e),this.parser.on.chunk=e=>{this.cacher.pushChunk(e),this.on.chunk&&this.on.chunk(e)}};push=e=>{this.cacher.push(e),this.isParseing===!1&&this.parse()};destroy=()=>{this.cacher.destroy(),this.isParseing=!1,this.offset=0};parse=async()=>{try{if(this.isParseing=!0,!this.pattern)throw Error(`You need to set the pattern.`);if(!this.parser)throw Error(`You need to init parser.`);for(;;){let e=this.cacher.next(this.offset);if(this.offset=0,!e)break;this.offset=await this.parser.parse(e)}this.isParseing=!1}catch{this.destroy()}}};l.on.info=e=>postMessage({action:`on.info`,data:e}),l.on.config=e=>postMessage({action:`on.config`,data:e}),l.on.chunk=e=>postMessage({action:`on.chunk`,data:e}),l.on.debug=e=>postMessage({action:`on.debug`,data:e}),onmessage=e=>{let{action:t,data:n}=e.data,r=l[t];r&&r(n)}})();",Sn=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,xn],{type:`text/javascript;charset=utf-8`});function Cn(e){let t;try{if(t=Sn&&(self.URL||self.webkitURL).createObjectURL(Sn),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(xn),{name:e?.name})}}var wn=`pr-player-demuxer`,Tn=class{worker=new Cn({name:wn});on={};constructor(){this.worker.onmessage=e=>{let{action:t,data:n}=e.data;switch(t){case`on.info`:this.on.info&&this.on.info(n);break;case`on.config`:this.on.config&&this.on.config(n);break;case`on.chunk`:this.on.chunk&&this.on.chunk(n);break;case`on.debug`:this.on.debug&&this.on.debug(n);break}}}init=e=>this.worker.postMessage({action:`init`,data:e});push=e=>this.worker.postMessage({action:`push`,data:e});destroy=()=>{this.worker.postMessage({action:`destroy`,data:{}}),this.worker.terminate()}},En="(function(){let e=new class{pattern=`flv`;audioDecoderConfig;audioDecoder;videoDecoderConfig;videoDecoder;hasKeyFrame=!1;baseTime=0;pendingChunks=[];currentChunk;isProcessing=!1;decodeTimer=0;frameTrack=!1;isFrameTrack=!1;fameTrackOption={flv:[30,50],hls:[200,300],dash:[50,100],rtmp:[50,100]};decodingSpeedRatio=1;maxDecodingSpeedRatio=2;decodingSpeed=16;fps=0;firstVideoChunkTimestamp;secondVideoChunkTimestamp;frameStartTime;lastRenderTime;nextRenderTime;on={audio:{},video:{}};constructor(){}init=e=>{this.destroy(),this.pattern=e,this.baseTime=new Date().getTime()-performance.now(),this.initDecodeInterval()};initAudio=e=>{this.audio.destroy(),this.audioDecoderConfig={...e},this.audioDecoder=new AudioDecoder({output:e=>{let t=this.decodingSpeedRatio;this.on.audio.decode&&this.on.audio.decode({audioData:e,playbackRate:t})},error:e=>{this.on.audio.error&&this.on.audio.error(e)}}),this.audioDecoder.configure(this.audioDecoderConfig)};initVideo=e=>{this.video.destroy(),this.videoDecoderConfig={...e},this.videoDecoder=new VideoDecoder({output:async e=>{this.frameStartTime||=e.timestamp;try{let t=e.timestamp-this.frameStartTime+this.baseTime*1e3,n=await createImageBitmap(e);if(e.close(),!n.width||!n.height)return n.close();this.on.video.decode&&this.on.video.decode({timestamp:t,bitmap:n}),this.currentChunk&&this.currentChunk.kind===`video`&&this.currentChunk.nalus&&this.on.nalus&&this.on.nalus(this.currentChunk.nalus)}catch{e.close()}},error:e=>{this.on.video.error&&this.on.video.error(e)}}),this.videoDecoder.configure(this.videoDecoderConfig)};setFrameTrack=e=>{this.frameTrack=e,this.frameTrack===!1&&(this.decodingSpeedRatio=1)};push=e=>{this.pendingChunks.push(e)};destroy=()=>{this.audio.destroy(),this.video.destroy(),this.pendingChunks=[],this.firstVideoChunkTimestamp=void 0,this.secondVideoChunkTimestamp=void 0,this.frameStartTime=void 0,this.lastRenderTime=void 0,this.nextRenderTime=void 0,clearInterval(this.decodeTimer)};initDecodeInterval=()=>{let e=this.decodingSpeed/this.decodingSpeedRatio,t=this.baseTime+performance.now();if(this.lastRenderTime||=t,this.fps=Math.round(1e3/(t-this.lastRenderTime)),this.lastRenderTime=t,this.nextRenderTime){let t=this.lastRenderTime-this.nextRenderTime;e-=t}this.nextRenderTime=this.lastRenderTime+e,this.decodeTimer=setTimeout(()=>{this.decode(),this.initDecodeInterval()},e)};decode=()=>{if(this.isProcessing!==!0){for(this.isProcessing=!0;this.currentChunk=this.pendingChunks.shift(),this.currentChunk;){let e=this.pendingChunks.length;if(this.frameTrack){let[t,n]=this.fameTrackOption[this.pattern];if(e<=t&&(this.isFrameTrack=!1),e>=n&&(this.isFrameTrack=!0),this.isFrameTrack){let n=Math.min(1+(e-t)/100,this.maxDecodingSpeedRatio);this.decodingSpeedRatio=Number(n.toFixed(1))}else this.decodingSpeedRatio=1}if(this.on.analysis){let{decodingSpeed:t,decodingSpeedRatio:n,fps:r}=this;this.on.analysis({decodingSpeed:t,decodingSpeedRatio:n,fps:r,cacheLength:e})}let{kind:t,init:n}=this.currentChunk;switch(t){case`audio`:this.decodeAudio(n);break;case`video`:this.decodeVideo(n);break}if(t===`video`)break}this.isProcessing=!1}};decodeAudio=e=>{if(!this.audioDecoder)return;let t=new EncodedAudioChunk(e);this.audioDecoder.decode(t)};decodeVideo=e=>{if(this.videoDecoder&&(e.type===`key`&&(this.hasKeyFrame=!0),this.firstVideoChunkTimestamp?this.secondVideoChunkTimestamp||(this.secondVideoChunkTimestamp=e.timestamp,this.decodingSpeed=(this.secondVideoChunkTimestamp-this.firstVideoChunkTimestamp)/1e3):this.firstVideoChunkTimestamp=e.timestamp,this.hasKeyFrame)){let t=new EncodedVideoChunk(e);this.videoDecoder.decode(t)}};audio={flush:()=>{this.audioDecoder?.flush()},destroy:()=>{this.audioDecoderConfig=void 0,this.audioDecoder?.close(),this.audioDecoder=void 0}};video={flush:()=>{this.videoDecoder?.flush()},destroy:()=>{this.videoDecoderConfig=void 0,this.videoDecoder?.close(),this.videoDecoder=void 0,this.hasKeyFrame=!1}}};e.on.audio.decode=e=>postMessage({action:`on.audio.decode`,data:e},[e.audioData]),e.on.audio.error=e=>postMessage({action:`on.audio.error`,data:e}),e.on.video.decode=e=>postMessage({action:`on.video.decode`,data:e},[e.bitmap]),e.on.video.error=e=>postMessage({action:`on.video.error`,data:e}),e.on.nalus=e=>postMessage({action:`on.nalus`,data:e}),e.on.analysis=e=>postMessage({action:`on.analysis`,data:e}),onmessage=t=>{let{action:n,data:r}=t.data,i=e[n];i&&i(r)}})();",Dn=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,En],{type:`text/javascript;charset=utf-8`});function On(e){let t;try{if(t=Dn&&(self.URL||self.webkitURL).createObjectURL(Dn),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(En),{name:e?.name})}}var kn=`pr-player-decoder`,An=class{worker=new On({name:kn});on={audio:{},video:{}};constructor(){this.worker.onmessage=e=>{let{action:t,data:n}=e.data;switch(t){case`on.audio.decode`:this.on.audio.decode&&this.on.audio.decode(n);break;case`on.audio.error`:this.on.audio.error&&this.on.audio.error(n);break;case`on.video.decode`:this.on.video.decode&&this.on.video.decode(n);break;case`on.video.error`:this.on.video.error&&this.on.video.error(n);break;case`on.nalus`:this.on.nalus&&this.on.nalus(n);break;case`on.analysis`:this.on.analysis&&this.on.analysis(n);break}}}init=e=>this.worker.postMessage({action:`init`,data:e});initAudio=e=>this.worker.postMessage({action:`initAudio`,data:e});initVideo=e=>this.worker.postMessage({action:`initVideo`,data:e});push=e=>this.worker.postMessage({action:`push`,data:e});setFrameTrack=e=>this.worker.postMessage({action:`setFrameTrack`,data:e});destroy=()=>{this.worker.postMessage({action:`destroy`}),this.worker.terminate()}},jn="(function(){let e=new class{renderMap=new Map;constructor(){}push=async e=>{let{timestamp:t}=e,{bitmap:n}=e;try{let e=[...this.renderMap.keys()];for(let r of e){let e=this.renderMap.get(r);if(!e)continue;let{pause:i=!1,writer:a,offscreen:o,option:s}=e;if(i===!0)continue;let c=async e=>{if(a){let n=new VideoFrame(e,{timestamp:t});try{await a.write(n)}catch{}n.close()}else o&&(o.width=e.width,o.height=e.height,o?.getContext(`2d`)?.drawImage(e,0,0))};if(r===`default`)await c(n);else if(s){let{sx:e=0,sy:t=0,sw:r=n.width,sh:i=n.height}=s;await c(await createImageBitmap(n,e,t,r,i))}}}catch{}n.close()};addCut=e=>{let{key:t,writable:n,offscreen:r,option:i}={key:`default`,...e};if(n){let e=n.getWriter();this.renderMap.set(t,{writer:e,option:i,pause:!1})}else this.renderMap.set(t,{offscreen:r,option:i,pause:!1})};delCut=e=>{this.renderMap.delete(e)};setCut=e=>{let{key:t,cutOption:n}={key:`default`,...e},r=this.renderMap.get(t);r&&this.renderMap.set(t,{...r,option:n})};setPause=e=>{let{key:t,pause:n}={key:`default`,...e},r=this.renderMap.get(t);r&&this.renderMap.set(t,{...r,pause:n})};destroy=()=>{this.renderMap=new Map}};onmessage=t=>{let{action:n,data:r}=t.data,i=e[n];i&&i(r)}})();",Mn=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,jn],{type:`text/javascript;charset=utf-8`});function Nn(e){let t;try{if(t=Mn&&(self.URL||self.webkitURL).createObjectURL(Mn),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(jn),{name:e?.name})}}var Pn=`pr-player-render`,Fn=class{worker=new Nn({name:Pn});constructor(){}push=e=>this.worker.postMessage({action:`push`,data:e},[e.bitmap]);addCut=e=>{let t=[];e.writable&&t.push(e.writable),e.offscreen&&t.push(e.offscreen),this.worker.postMessage({action:`addCut`,data:e},t)};delCut=e=>this.worker.postMessage({action:`delCut`,data:e});setCut=e=>this.worker.postMessage({action:`setCut`,data:e});setPause=e=>this.worker.postMessage({action:`setPause`,data:e});destroy=()=>{this.worker.postMessage({action:`destroy`,data:{}}),this.worker.terminate()}},In=`data:text/javascript;base64,LyoqDQogKiDpnZnpn7Pml7bvvJrlnKjpopHln5/ku4Xkv53nlZkgYmluIDDvvZ4077yI6ZqP5py677yJ77yM5YW25L2Z5Li6IDDvvIzlho3lkIjmiJDml7bln5/lhpnlhaXovpPlh7og4oCUIOWNs+S/ruaUueecn+WuniBQQ03vvIznu48gQW5hbHlzZXIoZmZ0U2l6ZT01MTIpIOaXtuWJjSA1IOS4qiBiaW4g5pyJ6IO96YeP44CB5YW25L2Z5o6l6L+RIDDjgIINCiAqIFBFUklPRCDpobvkuI4gUHJBdWRpb1N0cmVhbSDkuK0gYW5hbHlzZXJOb2RlLmZmdFNpemUg5LiA6Ie044CCDQogKi8NCmNsYXNzIE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3NvciBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3NvciB7DQogIGlzRGVzdHJveSA9IGZhbHNlDQogIGRlYnVnID0gZmFsc2UNCg0KICBzdGF0aWMgU0lMRU5DRV9FUFMgPSAxZS0xNQ0KDQogIC8qKiDkuI4gc3JjL1ByQXVkaW9TdHJlYW0udHMg6YeMIGFuYWx5c2VyTm9kZS5mZnRTaXplIOS/neaMgeS4gOiHtCAqLw0KICBzdGF0aWMgUEVSSU9EID0gNTEyDQoNCiAgLyoqIGJpbiAw772eNCDpmo/mnLrlpI3mlbDvvIjlrp7pg6gv6Jma6YOo77yJ55qE5aSn6Ie05bmF5bqm5bC65bqm77yM5Y+v5oyJ5ZCs5oSfL+e8lueggeWGjeiwgyAqLw0KICBzdGF0aWMgQklOX1NDQUxFID0gMC4wMg0KDQogIGNvbnN0cnVjdG9yKCkgew0KICAgIHN1cGVyKCkNCiAgICB0aGlzLl9zaWxlbnRQY20gPSBuZXcgRmxvYXQzMkFycmF5KE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3Nvci5QRVJJT0QpDQogICAgdGhpcy5fc2lsZW50T2ZmID0gTm90RW1wdHlGaWx0ZXJXb3JrbGV0UHJvY2Vzc29yLlBFUklPRA0KICB9DQoNCiAgc3RhdGljIGFsbElucHV0c1NpbGVudChpbnB1dHMpIHsNCiAgICBjb25zdCBlcHMgPSBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuU0lMRU5DRV9FUFMNCiAgICBmb3IgKGxldCBuaSA9IDA7IG5pIDwgaW5wdXRzLmxlbmd0aDsgbmkrKykgew0KICAgICAgY29uc3QgaW5wdXQgPSBpbnB1dHNbbmldDQogICAgICBpZiAoIWlucHV0KSBjb250aW51ZQ0KICAgICAgZm9yIChsZXQgY2ggPSAwOyBjaCA8IGlucHV0Lmxlbmd0aDsgY2grKykgew0KICAgICAgICBjb25zdCBjaGFubmVsID0gaW5wdXRbY2hdDQogICAgICAgIGlmICghY2hhbm5lbCkgY29udGludWUNCiAgICAgICAgY29uc3QgbiA9IGNoYW5uZWwubGVuZ3RoDQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbjsgaSsrKSB7DQogICAgICAgICAgaWYgKE1hdGguYWJzKGNoYW5uZWxbaV0pID49IGVwcykgcmV0dXJuIGZhbHNlDQogICAgICAgIH0NCiAgICAgIH0NCiAgICB9DQogICAgcmV0dXJuIHRydWUNCiAgfQ0KDQogIC8qKg0KICAgKiDku4UgYmluIDAuLjQg6Z2e6Zu277yI6ZqP5py677yJ77yM5ruh6Laz5a6e5L+h5Y+3IElERlTvvIzlhpnlhaUgdGhpcy5fc2lsZW50UGNtDQogICAqLw0KICByZWZpbGxTaWxlbnRQY21Gcm9tRml2ZUJpbnMoKSB7DQogICAgY29uc3QgTiA9IE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3Nvci5QRVJJT0QNCiAgICBjb25zdCBzY2FsZSA9IE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3Nvci5CSU5fU0NBTEUNCiAgICBjb25zdCByZSA9IG5ldyBGbG9hdDY0QXJyYXkoNSkNCiAgICBjb25zdCBpbSA9IG5ldyBGbG9hdDY0QXJyYXkoNSkNCiAgICByZVswXSA9IChNYXRoLnJhbmRvbSgpICogMiAtIDEpICogc2NhbGUNCiAgICBpbVswXSA9IDANCiAgICBmb3IgKGxldCBrID0gMTsgayA8PSA0OyBrKyspIHsNCiAgICAgIHJlW2tdID0gKE1hdGgucmFuZG9tKCkgKiAyIC0gMSkgKiBzY2FsZQ0KICAgICAgaW1ba10gPSAoTWF0aC5yYW5kb20oKSAqIDIgLSAxKSAqIHNjYWxlDQogICAgfQ0KICAgIGNvbnN0IGludk4gPSAxIC8gTg0KICAgIGNvbnN0IHR3b1BpT3Zlck4gPSAoMiAqIE1hdGguUEkpIC8gTg0KICAgIGZvciAobGV0IG4gPSAwOyBuIDwgTjsgbisrKSB7DQogICAgICBsZXQgcyA9IHJlWzBdDQogICAgICBmb3IgKGxldCBrID0gMTsgayA8PSA0OyBrKyspIHsNCiAgICAgICAgY29uc3QgYW5nID0gdHdvUGlPdmVyTiAqIGsgKiBuDQogICAgICAgIHMgKz0gMiAqIChyZVtrXSAqIE1hdGguY29zKGFuZykgLSBpbVtrXSAqIE1hdGguc2luKGFuZykpDQogICAgICB9DQogICAgICB0aGlzLl9zaWxlbnRQY21bbl0gPSBzICogaW52Tg0KICAgIH0NCiAgICB0aGlzLl9zaWxlbnRPZmYgPSAwDQogIH0NCg0KICBmaWxsT3V0cHV0c1NwYXJzZUZpdmVCaW5zKG91dHB1dHMpIHsNCiAgICBjb25zdCBmaXJzdCA9IG91dHB1dHNbMF0NCiAgICBpZiAoIWZpcnN0IHx8ICFmaXJzdFswXSkgcmV0dXJuDQogICAgY29uc3QgZnJhbWVMZW4gPSBmaXJzdFswXS5sZW5ndGgNCg0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZnJhbWVMZW47IGkrKykgew0KICAgICAgaWYgKHRoaXMuX3NpbGVudE9mZiA+PSBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuUEVSSU9EKSB7DQogICAgICAgIHRoaXMucmVmaWxsU2lsZW50UGNtRnJvbUZpdmVCaW5zKCkNCiAgICAgIH0NCiAgICAgIGNvbnN0IHYgPSB0aGlzLl9zaWxlbnRQY21bdGhpcy5fc2lsZW50T2ZmKytdDQogICAgICBmb3IgKGxldCBubyA9IDA7IG5vIDwgb3V0cHV0cy5sZW5ndGg7IG5vKyspIHsNCiAgICAgICAgY29uc3Qgb3V0UG9ydHMgPSBvdXRwdXRzW25vXQ0KICAgICAgICBpZiAoIW91dFBvcnRzKSBjb250aW51ZQ0KICAgICAgICBmb3IgKGxldCBjaCA9IDA7IGNoIDwgb3V0UG9ydHMubGVuZ3RoOyBjaCsrKSB7DQogICAgICAgICAgY29uc3QgY2hhbm5lbCA9IG91dFBvcnRzW2NoXQ0KICAgICAgICAgIGlmIChjaGFubmVsKSBjaGFubmVsW2ldID0gdg0KICAgICAgICB9DQogICAgICB9DQogICAgfQ0KICB9DQoNCiAgc3RhdGljIGNvcHlJbnB1dHNUb091dHB1dHMoaW5wdXRzLCBvdXRwdXRzKSB7DQogICAgZm9yIChsZXQgbm8gPSAwOyBubyA8IG91dHB1dHMubGVuZ3RoOyBubysrKSB7DQogICAgICBjb25zdCBvdXRQb3J0cyA9IG91dHB1dHNbbm9dDQogICAgICBjb25zdCBpblBvcnRzID0gaW5wdXRzW25vXQ0KICAgICAgaWYgKCFvdXRQb3J0cykgY29udGludWUNCiAgICAgIGZvciAobGV0IGNoID0gMDsgY2ggPCBvdXRQb3J0cy5sZW5ndGg7IGNoKyspIHsNCiAgICAgICAgY29uc3Qgb3V0Q2ggPSBvdXRQb3J0c1tjaF0NCiAgICAgICAgaWYgKCFvdXRDaCkgY29udGludWUNCiAgICAgICAgY29uc3QgaW5DaCA9IGluUG9ydHMgJiYgaW5Qb3J0c1tjaF0NCiAgICAgICAgaWYgKGluQ2ggJiYgaW5DaC5sZW5ndGggPT09IG91dENoLmxlbmd0aCkgew0KICAgICAgICAgIG91dENoLnNldChpbkNoKQ0KICAgICAgICB9IGVsc2UgaWYgKGluQ2gpIHsNCiAgICAgICAgICBjb25zdCBuID0gTWF0aC5taW4oaW5DaC5sZW5ndGgsIG91dENoLmxlbmd0aCkNCiAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG47IGkrKykgb3V0Q2hbaV0gPSBpbkNoW2ldDQogICAgICAgICAgZm9yIChsZXQgaSA9IG47IGkgPCBvdXRDaC5sZW5ndGg7IGkrKykgb3V0Q2hbaV0gPSAwDQogICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgb3V0Q2guZmlsbCgwKQ0KICAgICAgICB9DQogICAgICB9DQogICAgfQ0KICB9DQoNCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMpIHsNCiAgICBpZiAodGhpcy5pc0Rlc3Ryb3kpIHJldHVybiBmYWxzZQ0KDQogICAgaWYgKHRoaXMuZGVidWcpIHsNCiAgICAgIGNvbnNvbGUubG9nKCdceDFiWzM4OzI7MDsxNTE7MjU1bSVjJXNceDFiWzBtJywgJ2NvbG9yOiMwMDk3ZmY7JywgJy0tLS0tLS0+QnJlYXRoZTogaW5wdXRzJywgaW5wdXRzKQ0KICAgIH0NCg0KICAgIGlmIChOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuYWxsSW5wdXRzU2lsZW50KGlucHV0cykpIHsNCiAgICAgIHRoaXMuZmlsbE91dHB1dHNTcGFyc2VGaXZlQmlucyhvdXRwdXRzKQ0KICAgIH0gZWxzZSB7DQogICAgICB0aGlzLl9zaWxlbnRPZmYgPSBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuUEVSSU9EDQogICAgICBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuY29weUlucHV0c1RvT3V0cHV0cyhpbnB1dHMsIG91dHB1dHMpDQogICAgfQ0KDQogICAgcmV0dXJuIHRydWUNCiAgfQ0KDQogIGRlc3Ryb3koKSB7DQogICAgdGhpcy5pc0Rlc3Ryb3kgPSB0cnVlDQogIH0NCn0NCg0KcmVnaXN0ZXJQcm9jZXNzb3IoJ25vdC1lbXB0eS1maWx0ZXItcHJvY2Vzc29yJywgTm90RW1wdHlGaWx0ZXJXb3JrbGV0UHJvY2Vzc29yKQ0K`,Ln=class{audioContext=new AudioContext;notEmptyFilterWorkletNode;constructor(){}createNotEmptyFilterWorkletNode=async e=>(this.destroy(),this.audioContext=e,await this.audioContext.audioWorklet.addModule(In),this.notEmptyFilterWorkletNode=new AudioWorkletNode(this.audioContext,`not-empty-filter-processor`),this.notEmptyFilterWorkletNode);destroy=()=>{this.notEmptyFilterWorkletNode?.disconnect(),this.notEmptyFilterWorkletNode?.port.postMessage({type:`destroy`}),this.notEmptyFilterWorkletNode=void 0}},Rn=class{inputStream=new MediaStream;outputStream=new MediaStream;inputGain=1;enhanceGain=1;bgsGain=1;bgmGain=1;outputGain=1;mixAudioMap=new Map;audioContext=new AudioContext;isExternalAudioContext=!1;sourceNode;inputGainNode;enhanceGainNode;bgsGainNode;bgmGainNode;rnnoiseNode;analyserNode;analyserArrayData;outputGainNode;destinationNode;denoise=!1;mute=!0;notEmpty=!1;rnnoiseWorklet;rnnoiseWorkletNode;notEmptyFilterWorklet=new Ln;notEmptyFilterWorkletNode;filterStream=e=>e;constructor(e,t){this.inputStream=e,t&&(this.audioContext=t,this.isExternalAudioContext=!0),this.sourceNode=this.audioContext.createMediaStreamSource(this.inputStream),this.inputGainNode=this.audioContext.createGain(),this.inputGainNode.gain.setValueAtTime(this.inputGain,this.audioContext.currentTime),this.enhanceGainNode=this.audioContext.createGain(),this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain,this.audioContext.currentTime),this.bgsGainNode=this.audioContext.createGain(),this.bgsGainNode.gain.setValueAtTime(this.bgsGain,this.audioContext.currentTime),this.bgmGainNode=this.audioContext.createGain(),this.bgmGainNode.gain.setValueAtTime(this.bgmGain,this.audioContext.currentTime),this.analyserNode=this.audioContext.createAnalyser(),this.analyserNode.fftSize=512,this.analyserArrayData=new Uint8Array(this.analyserNode.frequencyBinCount),this.outputGainNode=this.audioContext.createGain(),this.outputGainNode.gain.setValueAtTime(this.outputGain,this.audioContext.currentTime),this.destinationNode=this.audioContext.createMediaStreamDestination(),this.outputStream=this.destinationNode.stream;{let{sourceNode:e,inputGainNode:t,enhanceGainNode:n,bgsGainNode:r,bgmGainNode:i,analyserNode:a,outputGainNode:o,destinationNode:s}=this;e.connect(t),t.connect(n),n.connect(a),r.connect(a),i.connect(a),n.connect(s),r.connect(s),i.connect(s),o.connect(this.audioContext.destination)}this.audioContext.resume()}use=({rnnoise:e})=>{this.rnnoiseWorklet=new e.RnnoiseWorklet};_changeSource=()=>{this.sourceNode.disconnect(),this.sourceNode=this.audioContext.createMediaStreamSource(this.inputStream),this.sourceNode.connect(this.inputGainNode)};replaceTrack=e=>{let t=this.inputStream.getTracks();for(let e of t)this.inputStream.removeTrack(e);this.inputStream.addTrack(e),this._changeSource()};stop=()=>{{let e=this.inputStream.getTracks();for(let t of e)t.stop(),this.inputStream.removeTrack(t)}};pause=async e=>{let t=this.inputStream.getTracks();for(let n of t)n.enabled=!e};getStream=()=>this.filterStream(this.outputStream);setMute=(e=!0)=>{this.mute=e,this.analyserNode.disconnect(),e===!1&&this.analyserNode.connect(this.outputGainNode)};setDenoise=async(e=!0)=>{this.rnnoiseWorklet&&(this.inputGainNode.disconnect(),e?(this.rnnoiseWorkletNode=await this.rnnoiseWorklet.createRnnoiseWorkletNode(this.audioContext),this.inputGainNode.connect(this.rnnoiseWorkletNode),this.rnnoiseWorkletNode.connect(this.enhanceGainNode)):(this.inputGainNode.connect(this.enhanceGainNode),this.rnnoiseWorklet.destroy()),this.denoise=e)};setNotEmpty=async(e=!0)=>{this.notEmptyFilterWorklet&&(e?(this.notEmptyFilterWorkletNode=await this.notEmptyFilterWorklet.createNotEmptyFilterWorkletNode(this.audioContext),this.notEmptyFilterWorkletNode.connect(this.analyserNode),this.notEmptyFilterWorkletNode.connect(this.destinationNode)):(this.notEmptyFilterWorkletNode?.disconnect(),this.notEmptyFilterWorklet.destroy()),this.notEmpty=e)};setInputGain=e=>{this.inputGain=e,this.inputGainNode.gain.setValueAtTime(e,this.audioContext.currentTime)};setEnhanceGain=async e=>{this.enhanceGain=e+1,this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain,this.audioContext.currentTime)};setBgsGain=e=>{this.bgsGain=e,this.bgsGainNode.gain.setValueAtTime(e,this.audioContext.currentTime)};setBgmGain=e=>{this.bgmGain=e,this.bgmGainNode.gain.setValueAtTime(e,this.audioContext.currentTime)};setOutputGain=e=>{this.outputGain=e,this.outputGainNode.gain.setValueAtTime(this.outputGain,this.audioContext.currentTime)};getVolume=()=>{let{analyserNode:e,analyserArrayData:t}=this;e.getByteFrequencyData(t);let n=0;for(let e=0;e<t.length;e++)n+=t[e];return Math.ceil(n/t.length)};mixAudio=(e,t=`bgm`)=>new Promise(async(n,r)=>{try{{let e=this.mixAudioMap.get(t);e&&e.stop()}let r=t===`bgs`?this.bgsGainNode:this.bgmGainNode,i=this.audioContext.createBufferSource();this.mixAudioMap.set(t,i),i.buffer=e,i.connect(r),i.onended=()=>{i.disconnect(r),this.mixAudioMap.delete(t),n(!0)},i.start(0)}catch(e){r(e)}});mixAudioStop=e=>{this.mixAudioMap.get(e)?.stop()};changeMix=(e,t)=>{let n=e===`bgs`?this.bgsGainNode:this.bgmGainNode;t?n.connect(this.destinationNode):n.disconnect(this.destinationNode)};destroy=async()=>{for(let e of this.mixAudioMap.values())e.stop(),e.disconnect();this.mixAudioMap.clear(),this.notEmptyFilterWorklet.destroy(),this.rnnoiseWorklet?.destroy(),this.notEmptyFilterWorkletNode=void 0,this.rnnoiseWorkletNode=void 0,this.sourceNode.disconnect(),this.inputGainNode.disconnect(),this.enhanceGainNode.disconnect(),this.bgsGainNode.disconnect(),this.bgmGainNode.disconnect(),this.analyserNode.disconnect(),this.outputGainNode.disconnect();for(let e of this.inputStream.getTracks())e.stop(),this.inputStream.removeTrack(e);for(let e of this.outputStream.getTracks())e.stop(),this.outputStream.removeTrack(e);this.notEmpty=!1,this.denoise=!1,this.mute=!0,!this.isExternalAudioContext&&this.audioContext.state!==`closed`&&await this.audioContext.close()}},zn=async(e,t)=>{try{let{format:n,numberOfChannels:r,numberOfFrames:i,sampleRate:a}=t,o=e.createBuffer(r,i,a);for(let e=0;e<r;e++){let r=t.allocationSize({planeIndex:e}),a=new Uint8Array(r);t.copyTo(a,{planeIndex:e});let s=new DataView(a.buffer),c=o.getChannelData(e);for(let e=0;e<i;e++){let t;switch(n){case`s16`:case`s16-planar`:t=s.getInt16(e*2,!0)/32768;break;case`f32`:case`f32-planar`:t=s.getFloat32(e*4,!0);break;case`u8`:case`u8-planar`:t=(s.getUint8(e)-128)/128;break;default:throw Error(`Unsupported audio format: ${n}`)}c[e]=Math.max(-1,Math.min(1,t))}}return o}catch(e){throw console.error(`Failed to convert AudioData to AudioBuffer:`,e),e}},Bn=class{prAudioStream;audioContext;destination;stream=new MediaStream;nextStartTime=0;pendingSources=[];constructor(){}init=e=>{e||=new(window.AudioContext||window.webkitAudioContext),this.audioContext=e,this.destination=this.audioContext.createMediaStreamDestination(),this.stream=new MediaStream,this.stream.addTrack(this.destination.stream.getAudioTracks()[0]),this.prAudioStream=new Rn(this.stream,this.audioContext),this.nextStartTime=0,this.pendingSources=[]};async push(e){let{audioData:t,playbackRate:n=1}=e;if(!this.audioContext||!this.destination)return;let r=await zn(this.audioContext,t);if(t.close(),!r)return;let i=this.audioContext.createBufferSource();i.buffer=r,i.playbackRate.value=n;let a=-1200*Math.log2(n);i.detune.value=a,i.connect(this.destination);let o=Math.max(this.nextStartTime,this.audioContext.currentTime);this.nextStartTime=o+r.duration/n,i.start(o),this.pendingSources.push(i),i.onended=()=>{this.pendingSources=this.pendingSources.filter(e=>e!==i)},this.audioContext.state===`suspended`&&await this.audioContext.resume()}getStream=()=>this.prAudioStream?.getStream();destroy(){this.audioContext?.close(),this.audioContext=void 0,this.destination=void 0,this.nextStartTime=0,this.prAudioStream?.stop(),this.prAudioStream?.destroy(),this.pendingSources.forEach(e=>e.stop()),this.pendingSources=[]}},Vn=e=>{let t=e.toLowerCase();return t.includes(`.m3u8`)||t.includes(`hls`)||t.includes(`master.m3u8`)||t.match(/index\d*\.m3u8/)?`hls`:t.includes(`.mpd`)||t.includes(`dash`)?`dash`:t.startsWith(`rtmp://`)||t.startsWith(`rtmps://`)?`rtmp`:t.includes(`.flv`)||t.includes(`flv`)&&!t.includes(`flash`)?`flv`:`unknown`},Hn=e=>{let t=e?.getTracks()||[];for(let e of t)e.stop()},Un=class{resolvesMap=new Map;index=0;constructor(){}add=(e,t=()=>!1,n=0)=>new Promise(r=>{if(t())return r(!0);this.resolvesMap.has(e)||this.resolvesMap.set(e,new Map),this.index++;let i=`${this.index}`;if(n=Math.max(0,n),n===0){this.resolvesMap.get(e)?.set(i,{resolve:r,timer:0});return}let a=window.setTimeout(()=>{this.emit(e)},n);this.resolvesMap.get(e)?.set(i,{resolve:r,timer:a})});emit=async e=>{let t=this.resolvesMap.get(e);if(!t)return;let n=[...t.keys()];for(let e of n){let n=t.get(e);n&&(clearTimeout(n.timer),n.resolve(),t.delete(e))}}},Wn=e=>{let t=new DataView(e.buffer),n=0,r,i,a;r=t.getUint32(n,!1),n+=4;{let e=t.getUint8(n);i={forbidden_zero_bit:e>>7&1,nal_ref_idc:e>>5&3,nal_unit_type:e&31},n+=1}{let e=r-1;a=new Uint8Array(t.buffer.slice(n,n+e))}return{size:r,header:i,data:a}},Gn=class{#e={timeout:5*1e3,check:!1};#t=null;constructor(e={}){this.#e={...this.#e,...e}}#n=(e,t)=>new Promise(async n=>{this.#t=new AbortController;let{signal:r}=this.#t,i=this.#e.timeout,a=setTimeout(()=>{this.#t?.abort(`Timeout (${i}ms)`)},i);await fetch(e,{cache:`no-store`,...t,method:`HEAD`,signal:r}).then(e=>{clearTimeout(a),n({status:e.status===200?`successed`:`failed`,reason:e.status===200?``:`HTTP ${e.status}`})}).catch(e=>{if(clearTimeout(a),e.name===`AbortError`){let e=r.reason||`Actively stopped`;n({status:e.includes(`Timeout`)?`timeout`:`stopped`,reason:e})}else n({status:`error`,reason:e.message})})});request=(e,t)=>new Promise(async(n,r)=>{try{this.stop(),this.#e.check&&await this.#n(e),this.#t=new AbortController;let{signal:r}=this.#t;n(await fetch(e,{cache:`no-store`,...t,signal:r}))}catch(e){r(e)}});stop=()=>{if(this.#t?.signal.aborted===!1){let e=Error(`Actively stopped.`);e.name=`AbortError`,this.#t.abort(e)}}},Kn=class{option={debug:!1,frameTrack:!1};converter=`MediaStreamTrackGenerator`in window?`generator`:`canvas`;prFetch=new Gn;getSegmentsFetch=new Gn;prResolves=new Un;url=``;start_resolve;demuxerWorker;decoderWorker;audioPlayer;renderWorker;stream;on={demuxer:{},decoder:{}};cutRenders=new Map;trackGenerator;constructor(e={}){let{debug:t=!1}=e;this.option.debug=t}start=async e=>{await this.stop(),this.url=e;let t=Vn(e);if(t===`unknown`)throw Error(`This address cannot be parsed.`);switch(this.init(t),t){case`flv`:this.flv.start();break;case`hls`:this.hls.start();break}};stop=async()=>{try{this.url=``,clearInterval(this.hls.getSegmentsTimer),this.prFetch.stop(),this.getSegmentsFetch.stop(),this.demuxerWorker?.destroy(),this.decoderWorker?.destroy(),this.renderWorker?.destroy(),this.cutRenders=new Map,Hn(this.stream),this.audioPlayer?.destroy()}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-player: error`,e)}};getStream=()=>this.stream;setPause=e=>{this.renderWorker?.setPause({pause:e})};setMute=e=>this.audioPlayer?.prAudioStream?.setMute(e);setOutputGain=e=>{this.audioPlayer?.prAudioStream?.setOutputGain(e)};setFrameTrack=e=>{this.option.frameTrack=e,this.decoderWorker?.setFrameTrack(e)};isReady=()=>this.prResolves.add(`isReady`,()=>this.stream?.active===!0);cut={create:(e,t)=>{if(this.converter===`generator`){let n=new MediaStreamTrackGenerator({kind:`video`}),r=new MediaStream([n]);return this.renderWorker?.addCut({key:e,writable:n.writable,option:t}),this.cutRenders.set(e,{stream:r}),r}let n=document.createElement(`canvas`),r=n.captureStream(),i=n.transferControlToOffscreen();return this.renderWorker?.addCut({key:e,offscreen:i,option:t}),this.cutRenders.set(e,{stream:r}),r},setCut:(e,t)=>{this.renderWorker?.setCut({key:e,cutOption:t})},getStream:e=>this.cutRenders.get(e)?.stream,remove:e=>{this.renderWorker?.delCut(e),this.cutRenders.delete(e)},setPause:(e,t)=>{this.renderWorker?.setPause({key:e,pause:t})}};init=e=>{this.initRender(),this.initDecoder(e),this.initDemuxer(e),this.audioPlayer=new Bn,this.audioPlayer.init()};initDemuxer=e=>{this.demuxerWorker=new Tn,this.demuxerWorker.init(e),this.demuxerWorker.on.debug=e=>{this.option.debug&&this.on.debug&&this.on.debug(e)},this.demuxerWorker.on.info=e=>{this.option.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-player: info`,e),this.on.demuxer.info&&this.on.demuxer.info(e)},this.demuxerWorker.on.config=e=>{this.option.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-player: config`,e),this.on.demuxer.config&&this.on.demuxer.config(e);let{kind:t}=e;switch(t){case`audio`:{let{codec:t,sampleRate:n,numberOfChannels:r}=e;this.decoderWorker?.initAudio({codec:t,sampleRate:n,numberOfChannels:r})}break;case`video`:{let{codec:t,description:n}=e;this.decoderWorker?.initVideo({codec:t,description:n})}break}},this.demuxerWorker.on.chunk=e=>{if(this.on.demuxer.chunk&&this.on.demuxer.chunk(e),!this.decoderWorker)return;let{kind:t}=e;switch(t){case`audio`:{let{type:n,dts:r,data:i}=e,a=r*1e3;this.decoderWorker.push({kind:t,init:{type:n,timestamp:a,data:i}})}break;case`video`:{let{type:n,dts:r,data:i,nalus:a=[]}=e,o=r*1e3;this.decoderWorker.push({kind:t,init:{type:n,timestamp:o,data:i},nalus:a})}break}}};initDecoder=e=>{this.decoderWorker=new An,this.decoderWorker.init(e);let{frameTrack:t=!1}=this.option;this.decoderWorker.setFrameTrack(t),this.decoderWorker.on.audio.decode=e=>{this.audioPlayer?.push(e),this.on.decoder.audio&&this.on.decoder.audio(e)},this.decoderWorker.on.audio.error=e=>{this.option.debug&&console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->pr-player: audio.error `,e),this.on.error&&this.on.error(e)},this.decoderWorker.on.video.decode=async e=>{this.start_resolve&&=(this.start_resolve(!0),void 0),this.renderWorker?.push(e),this.on.decoder.video&&this.on.decoder.video(e)},this.decoderWorker.on.video.error=e=>{this.on.error&&this.on.error(e)},this.decoderWorker.on.nalus=async e=>{for(let t of e){if(t.byteLength<=4)continue;let{header:e,data:n}=Wn(t),{nal_unit_type:r}=e;r===6&&this.on.decoder.sei&&this.on.decoder.sei(n)}},this.decoderWorker.on.analysis=e=>{this.on.decoder.analysis&&this.on.decoder.analysis(e)}};initRender=()=>{if(this.renderWorker=new Fn,this.converter===`generator`){let e=new MediaStreamTrackGenerator({kind:`video`}),t=new MediaStream([e]);this.renderWorker?.addCut({writable:e.writable}),this.stream=t}else{let e=document.createElement(`canvas`),t=e.captureStream(),n=e.transferControlToOffscreen();this.renderWorker?.addCut({offscreen:n}),this.stream=t}this.renderWorker?.setPause({pause:!1})};flv={start:()=>new Promise(async(e,t)=>{try{this.start_resolve=e;let n,r=0;for(;;){r+=1;try{n=await this.prFetch.request(this.url)}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->Breathe: error`,e)}if(n?.status===200||r===3)break;await new Promise(e=>setTimeout(()=>e(!0),500))}if(!n||n.status!==200)return t(`request is error.`);let i=n.body?.getReader();if(!i)return t(`reader is error.`);for(;;){let{done:e,value:t}=await i.read();if(t&&this.demuxerWorker?.push(t),e||this.url===``)break}}catch(e){e.name!==`AbortError`&&t(e)}})};hls={isLive:!1,urls:[],url:``,getSegmentsTimer:0,parse:async e=>{let t=new TextDecoder(`utf-8`).decode(e).split(`
|
|
3
|
+
`).map(e=>e.replace(`\r`,``)),n=this.url.substring(0,this.url.lastIndexOf(`/`)+1),r=4,i=0,a=!1,o=[];for(let e of t)e.startsWith(`#EXTINF:`)?r=parseFloat(e.split(`:`)[1].split(`,`)[0]):e.startsWith(`#EXT-X-TARGETDURATION:`)?i=parseInt(e.split(`:`)[1]):e.startsWith(`#EXT-X-ENDLIST`)?a=!1:e.startsWith(`#EXT-X-MEDIA-SEQUENCE:`)?a=!0:e.includes(`.ts`)&&!e.startsWith(`#`)&&o.push({url:e.startsWith(`http`)?e:n+e,duration:r,isLive:a});return{baseUrl:n,targetDuration:i,isLive:a,segments:o}},getSegments:async()=>{try{let e,t=0;for(;;){t+=1;try{e=await this.getSegmentsFetch.request(this.url)}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->Breathe: error`,e)}if(e?.status===200||t===3)break;await new Promise(e=>setTimeout(()=>e(!0),500))}if(!e||e.status!==200)throw Error(`request is error.`);let n=e.body?.getReader();if(!n)throw Error(`reader is error.`);for(;;){let{done:e,value:t}=await n.read();if(t){let{segments:e=[],isLive:n=!1}=await this.hls.parse(t);this.hls.isLive=n,n===!1&&(this.option.frameTrack=!1);let r=Array.from(e,e=>e.url),i=r.findIndex(e=>e===this.hls.url);i!==-1&&(r=r.slice(i+1)),this.hls.urls=r}if(e||this.url===``)break}}catch(e){e.name!==`AbortError`&&this.on.error&&this.on.error(e)}},start:()=>new Promise(async(e,t)=>{try{for(this.start_resolve=e,this.hls.url=``,this.hls.urls=[],await this.hls.getSegments(),this.hls.getSegmentsTimer=window.setInterval(this.hls.getSegments,500),this.hls.isLive===!1&&(clearInterval(this.hls.getSegmentsTimer),this.decoderWorker?.setFrameTrack(!1));;){let e=this.hls.urls.shift();if(e){this.hls.url=e;let t=(await this.prFetch.request(e)).body?.getReader();if(!t)throw Error(`segment reader is error.`);for(;;){let{done:e,value:n}=await t.read();if(n&&this.demuxerWorker?.push(n),e||this.url===``)break}}else await new Promise(e=>setTimeout(()=>e(!0),300))}}catch(e){e.name!==`AbortError`&&t(e)}})}},qn=bn(`Cg1DZG5EYXRhLnByb3RvEhVjb20ucXVpY2sudm9pY2UucHJvdG8iawoHU2VpRGF0YRIvCgVldmVudBgBIAEoDjIgLmNvbS5xdWljay52b2ljZS5wcm90by5FdmVudFR5cGUSDAoEZGF0YRgCIAEoDBIQCghjb21wcmVzcxgDIAEoCBIPCgd2ZXJzaW9uGAQgASgFIq4CCgpMYXlvdXREYXRhEg4KBnJvb21JZBgBIAEoCRIvCgR0eXBlGAIgASgOMiEuY29tLnF1aWNrLnZvaWNlLnByb3RvLkxheW91dFR5cGUSPwoHdXNlck1hcBgDIAMoCzIuLmNvbS5xdWljay52b2ljZS5wcm90by5MYXlvdXREYXRhLlVzZXJNYXBFbnRyeRI8CgxnbG9iYWxDdXN0b20YBCABKAsyIS5jb20ucXVpY2sudm9pY2UucHJvdG8uQ3VzdG9tSW5mb0gAiAEBGk8KDFVzZXJNYXBFbnRyeRILCgNrZXkYASABKAkSLgoFdmFsdWUYAiABKAsyHy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlckluZm86AjgBQg8KDV9nbG9iYWxDdXN0b20ivQEKCFVzZXJJbmZvEgoKAmlkGAEgASgJEjAKBmF1ZGlvcxgCIAMoCzIgLmNvbS5xdWljay52b2ljZS5wcm90by5BdWRpb0luZm8SMAoGdmlkZW9zGAMgAygLMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlZpZGVvSW5mbxI2CgZjdXN0b20YBCABKAsyIS5jb20ucXVpY2sudm9pY2UucHJvdG8uQ3VzdG9tSW5mb0gAiAEBQgkKB19jdXN0b20ilQEKCUF1ZGlvSW5mbxIuCgR0eXBlGAEgASgOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLkF1ZGlvVHlwZRIQCghpc0VuYWJsZRgCIAEoCBIOCgZpc011dGUYAyABKAgSDgoGdm9sdW1lGAQgASgBEhcKCnVwZGF0ZVRpbWUYBSABKANIAIgBAUINCgtfdXBkYXRlVGltZSK6AQoJVmlkZW9JbmZvEi4KBHR5cGUYASABKA4yIC5jb20ucXVpY2sudm9pY2UucHJvdG8uVmlkZW9UeXBlEhAKCGlzRW5hYmxlGAIgASgIEg4KBmlzTXV0ZRgDIAEoCBINCgV3aWR0aBgEIAEoBRIOCgZoZWlnaHQYBSABKAUSCQoBeBgGIAEoBRIJCgF5GAcgASgFEhcKCnVwZGF0ZVRpbWUYCCABKANIAIgBAUINCgtfdXBkYXRlVGltZSLEAQoKQ3VzdG9tSW5mbxIOCgZyb29tSWQYASABKAkSSQoMY3VzdG9tS2V5TWFwGAIgAygLMjMuY29tLnF1aWNrLnZvaWNlLnByb3RvLkN1c3RvbUluZm8uQ3VzdG9tS2V5TWFwRW50cnkSFwoKdXBkYXRlVGltZRgDIAEoA0gAiAEBGjMKEUN1c3RvbUtleU1hcEVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAFCDQoLX3VwZGF0ZVRpbWUqIwoJRXZlbnRUeXBlEgoKBkxheW91dBAAEgoKBkN1c3RvbRABKj0KCkxheW91dFR5cGUSEQoNQXVkaW9BbmRWaWRlbxAAEg0KCU9ubHlBdWRpbxABEg0KCU9ubHlWaWRlbxACKiwKCUF1ZGlvVHlwZRIOCgpNaWNyb3Bob25lEAASDwoLU3lzdGVtVm9pY2UQASojCglWaWRlb1R5cGUSCgoGQ2FtZXJhEAASCgoGU2NyZWVuEAFCPwoWY29tLnF1aWNrLnBsYXllci5wcm90b0IHQ2RuRGF0YVoWY29tLnF1aWNrLnBsYXllci5wcm90b7oCA0NkbmIGcHJvdG8z`),Jn=Z(qn,0),Yn=Z(qn,1),Xn=Z(qn,5),Zn=()=>({remove:!1,isEnable:!1,updateTime:0,isMute:!1,volume:0}),Qn=()=>({remove:!1,isEnable:!1,updateTime:0,isMute:!1,sx:0,sy:0,sw:0,sh:0}),$n=class{userId=``;mc_audio;mc_video;ss_audio;ss_video;updateTime=0;constructor(){}getUpdateTimeKey=()=>{let e=[];return this.mc_audio&&e.push(this.mc_audio.updateTime),this.mc_video&&e.push(this.mc_video.updateTime),this.ss_audio&&e.push(this.ss_audio.updateTime),this.ss_video&&e.push(this.ss_video.updateTime),e.join(`_`)};init=e=>{let{id:t,audios:n=[],videos:r=[]}=e;this.userId=t;let i=this.getUpdateTimeKey();this.mc_audio&&(this.mc_audio.remove=!0),this.mc_video&&(this.mc_video.remove=!0),this.ss_audio&&(this.ss_audio.remove=!0),this.ss_video&&(this.ss_video.remove=!0);for(let e of n){let{type:t=0,isEnable:n=!1,isMute:r=!1,updateTime:i,volume:a=0}=e;switch(t){case 0:if(this.mc_audio||=Zn(),this.mc_audio.remove=!1,this.mc_audio.updateTime===Number(i))break;this.mc_audio.isEnable=!!n,this.mc_audio.isMute=!!r,this.mc_audio.updateTime=Number(i),this.mc_audio.volume=Number(a);break;case 1:if(this.ss_audio||=Zn(),this.ss_audio.remove=!1,this.ss_audio.updateTime===Number(i))break;this.ss_audio.isEnable=!!n,this.ss_audio.isMute=!!r,this.ss_audio.updateTime=Number(i),this.ss_audio.volume=Number(a);break}}for(let e of r){let{type:t=0,isEnable:n,isMute:r,updateTime:i,width:a,height:o,x:s,y:c}=e;switch(t){case 0:if(this.mc_video||=Qn(),this.mc_video.remove=!1,this.mc_video.updateTime===Number(i))break;this.mc_video.isEnable=!!n,this.mc_video.isMute=!!r,this.mc_video.updateTime=Number(i)||0,this.mc_video.sx=s||0,this.mc_video.sy=c||0,this.mc_video.sw=a||0,this.mc_video.sh=o||0;break;case 1:if(this.ss_video||=Qn(),this.ss_video.remove=!1,this.ss_video.updateTime===Number(i))break;this.ss_video.isEnable=!!n,this.ss_video.isMute=!!r,this.ss_video.updateTime=Number(i)||0,this.ss_video.sx=s||0,this.ss_video.sy=c||0,this.ss_video.sw=a||0,this.ss_video.sh=o||0;break}}this.mc_audio?.remove&&(this.mc_audio=void 0),this.mc_video?.remove&&(this.mc_video=void 0),this.ss_audio?.remove&&(this.ss_audio=void 0),this.ss_video?.remove&&(this.ss_video=void 0),i!==this.getUpdateTimeKey()&&(this.updateTime=new Date().getTime())};destroy=()=>{this.mc_audio=void 0,this.mc_video=void 0,this.ss_audio=void 0,this.ss_video=void 0}},er=e=>{let t=0,n=0;for(;;){let r=e[t];if(n+=r,t+=1,r!==255)break}let r=0;for(;;){let n=e[t];if(r+=n,t+=1,n!==255)break}if(n===5){let n=e.slice(t,t+16),i=Array.from(n,e=>e.toString(16).padStart(2,`0`)).join(``);t+=16;let a=r-16,o=Q(Jn,e.slice(t,t+a)),{event:s=0}=o,c=o.data,l;switch(s){case 0:l=Q(Yn,o.data);break;case 1:l=Q(Xn,o.data);break}return{uuid:i,...o,event:s,data_remote:c,data:l}}};e.QuickVoPlayer=class{option={debug:!1,ws:`wss://livep2p.devplay.cc/websocket`};displayMode=`original`;prPlayer;dom;room={roomId:``,updateTime:``,author:``,version:``};usersMap=new Map;on={users:e=>{},analysis:e=>{}};constructor(e={}){let{debug:t=!1}=e;this.option.debug=t,this.prPlayer=new Kn({debug:t}),this.prPlayer.on.demuxer.chunk=e=>{},this.prPlayer.on.decoder.sei=this.onSEI,this.prPlayer.on.decoder.analysis=this.onAnalysis}start=async e=>(this.stop(),this.prPlayer.start(e));stop=()=>{this.prPlayer.stop(),this.usersMap=new Map,this.room.roomId=``,this.room.author=``,this.room.updateTime=``,this.room.version=``};setMute=e=>{this.prPlayer.setMute(e)};setOutputGain=e=>{this.prPlayer.audioPlayer?.prAudioStream?.setOutputGain(e)};getStream=()=>this.prPlayer.getStream();getAllUseUpdateKey=()=>{let e=[...this.usersMap.values()];return Array.from(e,e=>e.updateTime).join(`_`)};checkAndCreateUser=(e,t)=>{!this.usersMap.has(e)&&this.usersMap.set(e,new $n);let n=this.usersMap.get(e);if(n){if(n.init(t),n.mc_video&&n.mc_video.stream===void 0){let{sx:e,sy:t,sw:r,sh:i}=n.mc_video,a=`${n.userId}_mc_video`,o=this.prPlayer.cut.create(a,{sx:e,sy:t,sw:r,sh:i});this.displayMode===`original`&&this.prPlayer.cut.setPause(a,!0),n.mc_video.stream=o}if(n.ss_video&&n.ss_video.stream===void 0){let{sx:e,sy:t,sw:r,sh:i}=n.ss_video,a=`${n.userId}_ss_video`,o=this.prPlayer.cut.create(a,{sx:e,sy:t,sw:r,sh:i});this.displayMode===`original`&&this.prPlayer.cut.setPause(a,!0),n.ss_video.stream=o}if(n?.mc_video){let e=`${n.userId}_mc_video`,{sx:t,sy:r,sw:i,sh:a}=n.mc_video;this.prPlayer.cut.setCut(e,{sx:t,sy:r,sw:i,sh:a})}if(n?.ss_video){let e=`${n.userId}_ss_video`,{sx:t,sy:r,sw:i,sh:a}=n.ss_video;this.prPlayer.cut.setCut(e,{sx:t,sy:r,sw:i,sh:a})}}};setDisplayMode=e=>{switch(this.displayMode=e,e){case`original`:{this.prPlayer.setPause(!1);let e=[...this.usersMap.keys()];for(let t of e)this.prPlayer.cut.setPause(`${t}_mc_video`,!0),this.prPlayer.cut.setPause(`${t}_ss_video`,!0)}break;case`cut`:{this.prPlayer.setPause(!0);let e=[...this.usersMap.keys()];for(let t of e)this.prPlayer.cut.setPause(`${t}_mc_video`,!1),this.prPlayer.cut.setPause(`${t}_ss_video`,!1)}break}};onSEI=e=>{try{let t=er(e);if(!t)return;let{event:n,data:r}=t;switch(n){case 0:{let{roomId:e,userMap:t}=r;if(e!==this.room.roomId)return;let n=this.getAllUseUpdateKey(),i=Object.keys(t);{let e=[...this.usersMap.keys()];for(let t of e)i.includes(t)||(this.prPlayer.cut.remove(`${t}_mc_video`),this.prPlayer.cut.remove(`${t}_ss_video`),this.usersMap.delete(t))}for(let e of i){let n=t[e];this.checkAndCreateUser(e,n)}if(n!==this.getAllUseUpdateKey()&&this.on.users){let e=[...this.usersMap.values()],t=Array.from(e,({userId:e,mc_audio:t,mc_video:n,ss_audio:r,ss_video:i,updateTime:a})=>({userId:e,mc_audio:t,mc_video:n,ss_audio:r,ss_video:i,updateTime:a}));this.on.users(t)}}break;case 1:{let{roomId:e,updateTime:t}=r,{author:n,version:i}=r.customKeyMap;this.room.roomId=e,this.room.updateTime=t,this.room.author=n,this.room.version=i}break}}catch(e){console.log(`\x1B[38;2;0;151;255m%c%s\x1B[0m`,`color:#0097ff;`,`------->onSEI: error`,e)}};onAnalysis=e=>{this.on.analysis&&this.on.analysis(e)}}});
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quickvo-player",
|
|
3
3
|
"description": "基于web-codecs解码flv视频流并输出帧数据。",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.9",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"main": "./dist/index.umd.cjs",
|
|
10
10
|
"module": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
11
|
+
"types": "./dist/src/index.d.ts",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
14
|
"import": "./dist/index.js",
|
|
15
|
-
"require": "./dist/index.umd.cjs"
|
|
15
|
+
"require": "./dist/index.umd.cjs",
|
|
16
|
+
"types": "./dist/src/index.d.ts"
|
|
16
17
|
}
|
|
17
18
|
},
|
|
18
19
|
"scripts": {
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@bufbuild/protobuf": "^2.11.0",
|
|
24
|
-
"pr-player": "0.
|
|
25
|
+
"pr-player": "^0.4.2",
|
|
25
26
|
"pr-ws": "^0.3.3"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"@bufbuild/protoc-gen-es": "^2.11.0",
|
|
30
31
|
"@types/node": "^22.13.0",
|
|
31
32
|
"typescript": "~5.9.0",
|
|
32
|
-
"vite": "^8.0.
|
|
33
|
+
"vite": "^8.0.7",
|
|
33
34
|
"vite-plugin-dts": "^4.5.4"
|
|
34
35
|
},
|
|
35
36
|
"private": false,
|