quickvo-player 0.0.2

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 ADDED
@@ -0,0 +1,2358 @@
1
+ var U = Object.defineProperty;
2
+ var P = (f) => {
3
+ throw TypeError(f);
4
+ };
5
+ var W = (f, o, a) => o in f ? U(f, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : f[o] = a;
6
+ var v = (f, o, a) => W(f, typeof o != "symbol" ? o + "" : o, a), B = (f, o, a) => o.has(f) || P("Cannot " + a);
7
+ var x = (f, o, a) => (B(f, o, "read from private field"), a ? a.call(f) : o.get(f)), D = (f, o, a) => o.has(f) ? P("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(f) : o.set(f, a), C = (f, o, a, u) => (B(f, o, "write to private field"), u ? u.call(f, a) : o.set(f, a), a);
8
+ const L = '(function(){"use strict";const U=new TextDecoder("utf-8"),H=(e,s)=>{const a=e.getUint8(s),t=a>>7&1,n=a>>5&3,r=a&31;return{forbidden_zero_bit:t,nal_ref_idc:n,nal_unit_type:r}},b=(e,s)=>e.getUint8(s),P=(e,s,a)=>{const t=new Uint8Array(e.buffer.slice(s,s+a));return U?.decode(t)||""},T=(e,s,a)=>{let t=s,n,r=0;switch(a){case 0:n=e.getFloat64(t,!1),r=8;break;case 1:n=!!e.getUint8(t),r=1;break;case 2:{n="";const o=e.getUint16(t,!1);t=t+2;const c=new Int8Array(e.buffer,t,o).filter(d=>d!==0);n=(U?.decode(c)||"").trim(),r=2+o}break;case 3:for(n={};t<e.byteLength;){const o=e.getUint16(t,!1);if(o===0)break;t=t+2;const c=P(e,t,o);t=t+o;const g=b(e,t);if(g===6)break;t=t+1;const d=T(e,t,g);t=t+d.length,n[c]=d.value,r=2+o+1+d.length}break;case 8:{n={};const o=e.getUint32(t,!1);t=t+4;for(let c=0;c<o;c++){const g=e.getUint16(t,!1);t=t+2;const d=P(e,t,g);t=t+g;const h=b(e,t);t=t+1;const l=T(e,t,h);t=t+l.length,n[d]=l.value,r=2+g+1+l.length}}break;case 10:{n=[];const o=e.getUint32(t,!1);t=t+4;for(let c=0;c<o;c++){const g=b(e,t);t=t+1;const d=T(e,t,g);t=t+d.length,n.push(d.value),r=1+d.length}}break}return{amfType:a,length:r,value:n}},m=(e,s)=>e.getUint8(s)<<16|e.getUint8(s+1)<<8|e.getUint8(s+2);var u={header:{getSignature:e=>{const s=new Int8Array(e.buffer.slice(0,3));return U?.decode(s)||""},getVersion:e=>e.getUint8(3),getFlags:e=>{const a=e.getUint8(0).toString(2).padStart(5,"0").split(""),[,,t,,n]=a;return{audio:n==="1",video:t==="1"}},getDataOffset:e=>e.getUint32(5)},getPreviousTagSize:(e,s)=>e.getUint32(s),isSurplusTag:(e,s)=>{let a=!0;const t=e.byteLength;if(s+4>t)a=!1;else if(s+4+11>t)a=!1;else{const n=m(e,s+4+1);s+4+11+n>t&&(a=!1)}return a},tag:{tagHeader:{getTagType:(e,s)=>{const a=e.getUint8(s);let t;switch(a){case 18:t="script";break;case 8:t="audio";break;case 9:t="video";break}return t},getDataSize:(e,s)=>m(e,s+1),getTimestamp:(e,s)=>m(e,s+4),getTimestampExtended:(e,s)=>e.getUint8(s+7),getStreamID:(e,s)=>m(e,s+8)},tagBody:{parseAudio:(e,s,a)=>{let t=s;const n=e.getUint8(t),r=n>>4&15,i=n>>2&3,o=n>>1&1,c=n&1;t=t+1;const g=e.getUint8(t);t=t+1;const d=a-2,h=new Uint8Array(e.buffer.slice(t,t+d));if(r===10&&g===0){const l=e.getUint8(t),p=e.getUint8(t+1),f=(l&248)>>3,y=(l&7)<<1|p>>7,S=(p&120)>>3,A=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],D=`mp4a.40.${f}`,z=A[y];return{soundFormat:r,soundRate:i,soundSize:o,soundType:c,accPacketType:g,data:h,audioObjectType:f,samplingFrequencyIndex:y,channelConfiguration:S,codec:D,sampleRate:z}}return{soundFormat:r,soundRate:i,soundSize:o,soundType:c,accPacketType:g,data:h}},parseVideo:(e,s,a)=>{let t=s;const n=e.getUint8(t),r=n>>4&15,i=n&15;t=t+1;const o=e.getUint8(t);t=t+1;const c=m(e,t);t=t+3;const g=a-5,d=new Uint8Array(e.buffer.slice(t,t+g));switch(i){case 7:if(o===0){const h=e.getUint8(t);if(t=t+1,h!==1)throw new Error("Invalid AVC version");const l=e.getUint8(t)&255;t=t+1;const p=e.getUint8(t)&255;t=t+1;const f=e.getUint8(t)&255;t=t+1;const A=`avc1.${Array.from([l,p,f],E=>E.toString(16).padStart(2,"0")).join("")}`,D=(e.getUint8(t)&3)-1;t=t+1;const z=e.getUint8(t)&31;t=t+1;const _=e.getUint16(t,!1);t=t+2;const O=new Uint8Array(e.buffer.slice(t,t+_));t=t+_;const I=e.getUint8(t)&31;t=t+1;const x=e.getUint16(t,!1);t=t+2;const M=new Uint8Array(e.buffer.slice(t,t+x));return t=t+x,{frameType:r,codecID:i,avcPacketType:o,cts:c,data:d,version:h,codec:A,profile:l,compatibility:p,level:f,lengthSizeMinusOne:D,numOfSequenceParameterSets:z,sequenceParameterSetLength:_,sps:O,numOfPictureParameterSets:I,pictureParameterSetLength:x,pps:M}}else if(o===1){const h=[],l=t+a-5;for(;t+4<l;){const p=e.getUint32(t,!1);t=t+4;const f=H(e,t);t=t+1;const y=p-1,S=new Uint8Array(e.buffer.slice(t,t+y));t=t+y,h.push({size:p,header:f,payload:S})}return{frameType:r,codecID:i,avcPacketType:o,cts:c,data:d,nalus:h}}break;default:throw new Error("Unsupported codecID")}return{frameType:r,codecID:i,avcPacketType:o,cts:c,data:d}},parseMetaData:(e,s)=>{let a=s;{if(e.getUint8(a)!==2)throw new Error("Invalid AMF type for onMetaData (expected 0x02)");a=a+1}const t=e.getUint16(a,!1);a=a+2;{const i=new Int8Array(e.buffer.slice(a,a+t));if((U?.decode(i)||"")!=="onMetaData")throw new Error("Expected \'onMetaData\' string");a=a+t}const n=b(e,a);return a=a+1,T(e,a,n).value}}}};class L{parseSpeed=8;pendingPayloads=[];payload=new Uint8Array(0);offset=0;is_parsing=!1;header;tag;on={};constructor(){}init=()=>{this.destroy()};push=s=>{this.pendingPayloads.push(s),this.is_parsing||this.parse()};destroy=()=>{this.pendingPayloads=[],this.payload=new Uint8Array(0),this.offset=0,this.is_parsing=!1,this.header=void 0,this.tag=void 0};parse=async()=>{for(this.is_parsing=!0;;){const s=this.pendingPayloads.shift();if(!s)break;const a=new Uint8Array(this.payload.byteLength+s.byteLength);a.set(this.payload,0),a.set(s,this.payload.byteLength),this.payload=a;const t=new DataView(this.payload.buffer);this.header||this.parseHeader(t),await this.parseTag(t)}this.is_parsing=!1};parseHeader=s=>(this.header={signature:u.header.getSignature(s),version:u.header.getVersion(s),flags:u.header.getFlags(s),dataOffset:u.header.getDataOffset(s)},this.offset=this.header?.dataOffset,this.on.header&&this.on.header(this.header),this.header);parseTag=async s=>{const a=(n,r)=>({tagType:u.tag.tagHeader.getTagType(n,r),dataSize:u.tag.tagHeader.getDataSize(n,r),timestamp:u.tag.tagHeader.getTimestamp(n,r),timestampExtended:u.tag.tagHeader.getTimestampExtended(n,r),streamID:u.tag.tagHeader.getStreamID(n,r)}),t=(n,r,i,o)=>{let c;switch(n){case"script":c=u.tag.tagBody.parseMetaData(r,i);break;case"audio":c=u.tag.tagBody.parseAudio(r,i,o);break;case"video":c=u.tag.tagBody.parseVideo(r,i,o);break}return c};for(;this.offset<s.byteLength;){if(u.isSurplusTag(s,this.offset)===!1){this.payload=this.payload.slice(this.offset),this.offset=0;break}const r=a(s,this.offset+4),{tagType:i,dataSize:o}=r;if(!i)break;const c=t(i,s,this.offset+4+11,o);this.tag={header:r,body:c},this.on.tag&&this.on.tag(this.tag),this.offset=this.offset+4+11+o,await new Promise(g=>setTimeout(()=>g(!0),this.parseSpeed))}}}const k=new L;k.on.header=e=>postMessage({action:"onHeader",data:e}),k.on.tag=e=>postMessage({action:"onTag",data:e}),onmessage=e=>{const{action:s,data:a}=e.data,t=k[s];t&&t(a)}})();\n', A = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", L], { type: "text/javascript;charset=utf-8" });
9
+ function E(f) {
10
+ let o;
11
+ try {
12
+ if (o = A && (self.URL || self.webkitURL).createObjectURL(A), !o) throw "";
13
+ const a = new Worker(o, {
14
+ name: f == null ? void 0 : f.name
15
+ });
16
+ return a.addEventListener("error", () => {
17
+ (self.URL || self.webkitURL).revokeObjectURL(o);
18
+ }), a;
19
+ } catch {
20
+ return new Worker(
21
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(L),
22
+ {
23
+ name: f == null ? void 0 : f.name
24
+ }
25
+ );
26
+ }
27
+ }
28
+ class _ {
29
+ constructor() {
30
+ v(this, "worker", new E());
31
+ v(this, "on", {});
32
+ v(this, "init", () => this.worker.postMessage({ action: "init" }));
33
+ v(this, "push", (o) => this.worker.postMessage({ action: "push", data: o }));
34
+ v(this, "destroy", () => {
35
+ this.worker.postMessage({ action: "destroy", data: {} }), this.worker.terminate();
36
+ });
37
+ this.worker.onmessage = (o) => {
38
+ const { action: a, data: u } = o.data;
39
+ a === "onHeader" && this.on.header && this.on.header(u), a === "onTag" && this.on.tag && this.on.tag(u);
40
+ };
41
+ }
42
+ }
43
+ const N = `(function(){"use strict";class r{audioDecoderConfig;audioDecoder;videoDecoderConfig;videoDecoder;hasKeyFrame=!1;on={audio:{},video:{}};constructor(){}audio={init:i=>{this.audio.destroy(),this.audioDecoderConfig={...i},this.audioDecoder=new AudioDecoder({output:e=>{this.on.audio.decode&&this.on.audio.decode(e)},error:e=>{this.on.audio.error&&this.on.audio.error(e)}}),this.audioDecoder.configure(this.audioDecoderConfig)},decode:i=>{if(!this.audioDecoder)return;const e=new EncodedAudioChunk(i);this.audioDecoder.decode(e)},flush:()=>{this.audioDecoder?.flush()},destroy:()=>{this.audioDecoderConfig=void 0,this.audioDecoder?.close(),this.audioDecoder=void 0}};video={init:i=>{this.video.destroy(),this.videoDecoderConfig={...i},this.videoDecoder=new VideoDecoder({output:async e=>{const d=await createImageBitmap(e),s=e.timestamp;e.close(),d.width>0&&d.height>0?this.on.video.decode&&this.on.video.decode({timestamp:s,bitmap:d}):d.close()},error:e=>{this.on.video.error&&this.on.video.error(e)}}),this.videoDecoder.configure(this.videoDecoderConfig)},decode:i=>{if(this.videoDecoder&&(i.type==="key"&&(this.hasKeyFrame=!0),this.hasKeyFrame&&this.videoDecoder.decodeQueueSize<2)){const e=new EncodedVideoChunk(i);this.videoDecoder.decode(e)}},flush:()=>{this.videoDecoder?.flush()},destroy:()=>{this.videoDecoderConfig=void 0,this.videoDecoder?.close(),this.videoDecoder=void 0,this.hasKeyFrame=!1}}}const t=new r;t.on.audio.decode=o=>postMessage({type:"audio",action:"onDecode",data:o}),t.on.audio.error=o=>postMessage({type:"audio",action:"onError",data:o}),t.on.video.decode=o=>postMessage({type:"video",action:"onDecode",data:o}),t.on.video.error=o=>postMessage({type:"video",action:"onError",data:o}),onmessage=o=>{const{type:i,action:e,data:d}=o.data,s=t[i][e];s&&s(d)}})();
44
+ `, R = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", N], { type: "text/javascript;charset=utf-8" });
45
+ function V(f) {
46
+ let o;
47
+ try {
48
+ if (o = R && (self.URL || self.webkitURL).createObjectURL(R), !o) throw "";
49
+ const a = new Worker(o, {
50
+ name: f == null ? void 0 : f.name
51
+ });
52
+ return a.addEventListener("error", () => {
53
+ (self.URL || self.webkitURL).revokeObjectURL(o);
54
+ }), a;
55
+ } catch {
56
+ return new Worker(
57
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(N),
58
+ {
59
+ name: f == null ? void 0 : f.name
60
+ }
61
+ );
62
+ }
63
+ }
64
+ class j {
65
+ constructor() {
66
+ v(this, "worker", new V());
67
+ v(this, "on", { audio: {}, video: {} });
68
+ v(this, "audio", {
69
+ init: (o) => this.worker.postMessage({ type: "audio", action: "init", data: o }),
70
+ decode: (o) => this.worker.postMessage({ type: "audio", action: "decode", data: o }),
71
+ flush: () => this.worker.postMessage({ type: "audio", action: "flush" }),
72
+ destroy: () => {
73
+ this.worker.postMessage({ type: "audio", action: "destroy" });
74
+ }
75
+ });
76
+ v(this, "video", {
77
+ init: (o) => this.worker.postMessage({ type: "video", action: "init", data: o }),
78
+ decode: (o) => this.worker.postMessage({ type: "video", action: "decode", data: o }),
79
+ flush: () => this.worker.postMessage({ type: "video", action: "flush" }),
80
+ destroy: () => {
81
+ this.worker.postMessage({ type: "video", action: "destroy", data: {} });
82
+ }
83
+ });
84
+ v(this, "destroy", () => {
85
+ this.worker.postMessage({ type: "audio", action: "destroy" }), this.worker.postMessage({ type: "video", action: "destroy", data: {} }), this.worker.terminate();
86
+ });
87
+ this.worker.onmessage = (o) => {
88
+ const { type: a, action: u, data: r } = o.data;
89
+ switch (a) {
90
+ case "audio":
91
+ u === "onDecode" && this.on.audio.decode && this.on.audio.decode(r), u === "onError" && this.on.audio.error && this.on.audio.error(r);
92
+ break;
93
+ case "video":
94
+ u === "onDecode" && this.on.video.decode && this.on.video.decode(r), u === "onError" && this.on.video.error && this.on.video.error(r);
95
+ break;
96
+ }
97
+ };
98
+ }
99
+ }
100
+ const F = `(function(){"use strict";class r{isRendering=!1;pendingFrames=[];offscreenCanvas;writable;writer;ctx;cutOption;baseTime=0;pause=!1;shader=["stream"];constructor(){}init=({offscreenCanvas:e,baseTime:t=performance.timeOrigin,writable:i})=>{this.destroy(),this.offscreenCanvas=e,this.writable=i,this.writer=this.writable.getWriter(),this.ctx=this.offscreenCanvas.getContext("2d"),this.baseTime=t};setShader=e=>{this.shader=e};setSize=({width:e,height:t})=>{this.offscreenCanvas&&(this.offscreenCanvas.width=e,this.offscreenCanvas.height=t)};destroy=()=>{this.isRendering=!1,this.pendingFrames=[],this.offscreenCanvas=void 0,this.ctx=void 0,this.baseTime=0};push=e=>{this.pendingFrames.push(e),this.isRendering===!1&&setTimeout(this.renderFrame,0)};setCut=e=>{this.cutOption=e};setPause=e=>{this.pause=e,this.isRendering===!1&&setTimeout(this.renderFrame,0)};calculateTimeUntilNextFrame=e=>{const t=performance.timeOrigin+performance.now(),s=this.baseTime+e/1e3-t;return Math.max(0,s)};renderFrame=async()=>{for(this.isRendering=!0;;){const e=this.pendingFrames.shift();if(!e)break;let{timestamp:t,bitmap:i}=e;if(this.cutOption){const{sx:a=0,sy:c=0,sw:m=i.width,sh:o=i.height}=this.cutOption;i=await createImageBitmap(i,a,c,m,o)}const s=this.calculateTimeUntilNextFrame(t);await new Promise(a=>setTimeout(()=>a(!0),s)),this.drawImage({timestamp:t,bitmap:i}),this.cutOption&&i.close()}this.isRendering=!1};drawImage=e=>{if(this.pause!==!0){if(this.shader.includes("stream")){const t=new VideoFrame(e.bitmap,{timestamp:e.timestamp});this.writer.write(t),t.close()}this.shader.includes("canvas")&&this.ctx&&this.offscreenCanvas&&this.ctx.drawImage(e.bitmap,0,0,this.offscreenCanvas.width,this.offscreenCanvas.height)}}}const h=new r;onmessage=n=>{const{action:e,data:t}=n.data,i=h[e];i&&i(t)}})();
101
+ `, M = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", F], { type: "text/javascript;charset=utf-8" });
102
+ function H(f) {
103
+ let o;
104
+ try {
105
+ if (o = M && (self.URL || self.webkitURL).createObjectURL(M), !o) throw "";
106
+ const a = new Worker(o, {
107
+ name: f == null ? void 0 : f.name
108
+ });
109
+ return a.addEventListener("error", () => {
110
+ (self.URL || self.webkitURL).revokeObjectURL(o);
111
+ }), a;
112
+ } catch {
113
+ return new Worker(
114
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(F),
115
+ {
116
+ name: f == null ? void 0 : f.name
117
+ }
118
+ );
119
+ }
120
+ }
121
+ class $ {
122
+ constructor() {
123
+ v(this, "worker", new H());
124
+ v(this, "init", ({ offscreenCanvas: o, baseTime: a = 0, writable: u }) => this.worker.postMessage({ action: "init", data: { offscreenCanvas: o, baseTime: a, writable: u } }, [o, u]));
125
+ v(this, "setShader", (o) => this.worker.postMessage({ action: "setShader", data: o }));
126
+ v(this, "setSize", ({ width: o, height: a }) => this.worker.postMessage({ action: "setSize", data: { width: o, height: a } }));
127
+ v(this, "push", (o) => this.worker.postMessage({ action: "push", data: o }));
128
+ v(this, "setCut", async (o) => this.worker.postMessage({ action: "setCut", data: o }));
129
+ v(this, "setPause", (o) => this.worker.postMessage({ action: "setPause", data: o }));
130
+ v(this, "destroy", () => {
131
+ this.worker.postMessage({ action: "destroy", data: {} }), this.worker.terminate();
132
+ });
133
+ }
134
+ }
135
+ var q = Object.defineProperty, K = (f, o, a) => o in f ? q(f, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : f[o] = a, h = (f, o, a) => K(f, typeof o != "symbol" ? o + "" : o, a);
136
+ class Q {
137
+ constructor(o, a) {
138
+ h(this, "inputStream", new MediaStream()), h(this, "outputStream", new MediaStream()), h(this, "inputGain", 1), h(this, "enhanceGain", 1), h(this, "bgsGain", 1), h(this, "bgmGain", 1), h(this, "outputGain", 1), h(this, "mixAudioMap", /* @__PURE__ */ new Map()), h(this, "audioContext", new AudioContext()), h(this, "sourceNode"), h(this, "inputGainNode"), h(this, "enhanceGainNode"), h(this, "bgsGainNode"), h(this, "bgmGainNode"), h(this, "analyserNode"), h(this, "analyserArrayData"), h(this, "outputGainNode"), h(this, "destinationNode"), h(this, "filterStream", (u) => u), h(this, "stop", () => {
139
+ {
140
+ const u = this.inputStream.getTracks();
141
+ for (const r of u)
142
+ r.stop(), this.inputStream.removeTrack(r);
143
+ }
144
+ }), h(this, "getStream", () => this.filterStream(this.outputStream)), h(this, "setMute", (u = !0) => {
145
+ u ? this.analyserNode.disconnect(this.outputGainNode) : this.analyserNode.connect(this.outputGainNode);
146
+ }), h(this, "setInputGain", (u) => {
147
+ this.inputGain = u, this.inputGainNode.gain.setValueAtTime(u, this.audioContext.currentTime);
148
+ }), h(this, "setEnhanceGain", async (u) => {
149
+ this.enhanceGain = u + 1, this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain, this.audioContext.currentTime);
150
+ }), h(this, "setBgsGain", (u) => {
151
+ this.bgsGain = u, this.bgsGainNode.gain.setValueAtTime(u, this.audioContext.currentTime);
152
+ }), h(this, "setBgmGain", (u) => {
153
+ this.bgmGain = u, this.bgmGainNode.gain.setValueAtTime(u, this.audioContext.currentTime);
154
+ }), h(this, "setOutputGain", (u) => {
155
+ this.outputGain = u, this.outputGainNode.gain.setValueAtTime(this.outputGain, this.audioContext.currentTime);
156
+ }), h(this, "getVolume", () => {
157
+ const { analyserNode: u, analyserArrayData: r } = this;
158
+ u.getByteFrequencyData(r);
159
+ let n = 0;
160
+ for (let i = 0; i < r.length; i++)
161
+ n += r[i];
162
+ return Math.ceil(n / r.length);
163
+ }), h(this, "mixAudio", (u, r = "bgm") => new Promise(async (n, i) => {
164
+ try {
165
+ {
166
+ const s = this.mixAudioMap.get(r);
167
+ s && s.stop();
168
+ }
169
+ const e = r === "bgs" ? this.bgsGainNode : this.bgmGainNode, t = this.audioContext.createBufferSource();
170
+ this.mixAudioMap.set(r, t), t.buffer = u, t.connect(e), t.onended = () => {
171
+ t.disconnect(e), this.mixAudioMap.delete(r), n(!0);
172
+ }, t.start(0);
173
+ } catch (e) {
174
+ i(e);
175
+ }
176
+ })), h(this, "mixAudioStop", (u) => {
177
+ const r = this.mixAudioMap.get(u);
178
+ r == null || r.stop();
179
+ }), h(this, "changeMix", (u, r) => {
180
+ const n = u === "bgs" ? this.bgsGainNode : this.bgmGainNode;
181
+ r ? n.connect(this.destinationNode) : n.disconnect(this.destinationNode);
182
+ }), a && (this.audioContext = a), this.inputStream = o, 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;
183
+ {
184
+ const { sourceNode: u, inputGainNode: r, enhanceGainNode: n, bgsGainNode: i, bgmGainNode: e, analyserNode: t, outputGainNode: s, destinationNode: l } = this;
185
+ u.connect(r), r.connect(n), n.connect(t), i.connect(t), e.connect(t), n.connect(l), i.connect(l), e.connect(l), t.connect(s), s.connect(this.audioContext.destination);
186
+ }
187
+ this.setMute(!0), this.audioContext.resume();
188
+ }
189
+ }
190
+ const J = async (f, o) => {
191
+ try {
192
+ const { format: a, numberOfChannels: u, numberOfFrames: r, sampleRate: n } = o, i = f.createBuffer(u, r, n);
193
+ for (let e = 0; e < u; e++) {
194
+ const t = o.allocationSize({ planeIndex: e }), s = new Uint8Array(t);
195
+ o.copyTo(s, { planeIndex: e });
196
+ const l = new DataView(s.buffer), c = i.getChannelData(e);
197
+ for (let d = 0; d < r; d++) {
198
+ let y;
199
+ switch (a) {
200
+ case "s16":
201
+ // 16-bit signed PCM (范围: -32768 ~ 32767)
202
+ case "s16-planar":
203
+ y = l.getInt16(d * 2, !0) / 32768;
204
+ break;
205
+ case "f32":
206
+ // 32-bit float (范围: -1.0 ~ 1.0)
207
+ case "f32-planar":
208
+ y = l.getFloat32(d * 4, !0);
209
+ break;
210
+ case "u8":
211
+ // 8-bit unsigned (范围: 0 ~ 255)
212
+ case "u8-planar":
213
+ y = (l.getUint8(d) - 128) / 128;
214
+ break;
215
+ default:
216
+ throw new Error(`Unsupported audio format: ${a}`);
217
+ }
218
+ c[d] = Math.max(-1, Math.min(1, y));
219
+ }
220
+ }
221
+ return i;
222
+ } catch (a) {
223
+ throw console.error("Failed to convert AudioData to AudioBuffer:", a), a;
224
+ }
225
+ };
226
+ class X {
227
+ constructor() {
228
+ v(this, "prAudioStream");
229
+ v(this, "audioContext");
230
+ v(this, "destination");
231
+ v(this, "stream", new MediaStream());
232
+ v(this, "nextStartTime", 0);
233
+ v(this, "pendingSources", []);
234
+ v(this, "init", (o) => {
235
+ o || (o = new (window.AudioContext || window.webkitAudioContext)()), this.audioContext = o, this.destination = this.audioContext.createMediaStreamDestination(), this.stream = new MediaStream(), this.stream.addTrack(this.destination.stream.getAudioTracks()[0]), this.prAudioStream = new Q(this.stream, this.audioContext), this.nextStartTime = 0, this.pendingSources = [];
236
+ });
237
+ v(this, "getStream", () => {
238
+ var o;
239
+ return (o = this.prAudioStream) == null ? void 0 : o.getStream();
240
+ });
241
+ }
242
+ async push(o) {
243
+ try {
244
+ if (!this.audioContext || !this.destination) return;
245
+ const a = await J(this.audioContext, o);
246
+ if (!a) return;
247
+ const u = this.audioContext.createBufferSource();
248
+ u.buffer = a, u.connect(this.destination);
249
+ const r = Math.max(this.nextStartTime, this.audioContext.currentTime);
250
+ this.nextStartTime = r + a.duration, u.start(r), this.pendingSources.push(u), u.onended = () => {
251
+ this.pendingSources = this.pendingSources.filter((n) => n !== u);
252
+ }, this.audioContext.state === "suspended" && await this.audioContext.resume();
253
+ } finally {
254
+ o.close();
255
+ }
256
+ }
257
+ destroy() {
258
+ var o, a;
259
+ (o = this.audioContext) == null || o.close(), this.audioContext = void 0, this.destination = void 0, this.nextStartTime = 0, (a = this.prAudioStream) == null || a.stop(), this.pendingSources.forEach((u) => u.stop()), this.pendingSources = [];
260
+ }
261
+ }
262
+ var S, T;
263
+ class Y {
264
+ constructor(o = {}) {
265
+ D(this, S, {
266
+ timeout: 5 * 1e3
267
+ });
268
+ D(this, T);
269
+ /**
270
+ *
271
+ * @param input string | URL | Request
272
+ * @param init RequestInit
273
+ */
274
+ v(this, "check", (o, a) => new Promise(async (u, r) => {
275
+ var i;
276
+ this.stop(), C(this, T, new AbortController());
277
+ const n = window.setTimeout(() => {
278
+ var e;
279
+ (e = x(this, T)) == null || e.abort("Timeout."), r({ status: "timeout", reason: "" });
280
+ }, x(this, S).timeout);
281
+ try {
282
+ const e = await fetch(o, { ...a, method: "HEAD", signal: (i = x(this, T)) == null ? void 0 : i.signal });
283
+ e.status === 200 ? u({ status: "successed", reason: "" }) : r({ status: "failed", reason: `${e.status}` });
284
+ } catch (e) {
285
+ r({ status: "error", reason: e.message });
286
+ }
287
+ clearTimeout(n);
288
+ }));
289
+ /**
290
+ *
291
+ * @param input string | URL | Request
292
+ * @param init RequestInit
293
+ */
294
+ v(this, "request", async (o, a) => new Promise(async (u, r) => {
295
+ var n;
296
+ try {
297
+ await this.check(o, a), C(this, T, new AbortController());
298
+ const i = await fetch(o, { ...a, signal: (n = x(this, T)) == null ? void 0 : n.signal });
299
+ u(i);
300
+ } catch (i) {
301
+ this.stop(), r(i);
302
+ }
303
+ }));
304
+ /**
305
+ * stop
306
+ */
307
+ v(this, "stop", () => {
308
+ var o;
309
+ ((o = x(this, T)) == null ? void 0 : o.signal.aborted) === !1 && x(this, T).abort("Actively stop.");
310
+ });
311
+ C(this, S, { ...x(this, S), ...o });
312
+ }
313
+ }
314
+ S = new WeakMap(), T = new WeakMap();
315
+ const O = (f) => {
316
+ const o = (f == null ? void 0 : f.getTracks()) || [];
317
+ for (const a of o)
318
+ a.stop();
319
+ }, G = (f) => {
320
+ const o = new $(), a = document.createElement("canvas"), u = a.transferControlToOffscreen(), r = new MediaStreamTrackGenerator({ kind: "video" }), n = new MediaStream([r]), i = () => {
321
+ o.destroy(), O(n);
322
+ };
323
+ return o.init({ offscreenCanvas: u, baseTime: f, writable: r.writable }), { worker: o, canvas: a, stream: n, destroy: i };
324
+ };
325
+ class be {
326
+ constructor() {
327
+ v(this, "prFetch", new Y());
328
+ v(this, "demuxerWorker");
329
+ v(this, "decoderWorker");
330
+ v(this, "audioPlayer");
331
+ v(this, "renderWorker");
332
+ v(this, "renderBaseTime", 0);
333
+ v(this, "stream");
334
+ v(this, "canvas");
335
+ v(this, "on", { demuxer: {}, decoder: {} });
336
+ v(this, "cutRenders", /* @__PURE__ */ new Map());
337
+ // @ts-ignore
338
+ v(this, "trackGenerator");
339
+ /**
340
+ * 初始化
341
+ */
342
+ v(this, "init", () => {
343
+ this.initDemuxer(), this.initDecoder(), this.audioPlayer = new X(), this.audioPlayer.init(), this.initRender();
344
+ });
345
+ /**
346
+ * 开始播放
347
+ * @param url : string
348
+ */
349
+ v(this, "start", async (o) => {
350
+ var a, u;
351
+ try {
352
+ this.stop(), this.renderBaseTime = (/* @__PURE__ */ new Date()).getTime(), this.init();
353
+ const r = (a = (await this.prFetch.request(o)).body) == null ? void 0 : a.getReader();
354
+ if (!r) throw new Error("Reader is error.");
355
+ for (; ; ) {
356
+ const { done: n, value: i } = await r.read();
357
+ if (i && ((u = this.demuxerWorker) == null || u.push(i)), n)
358
+ break;
359
+ }
360
+ } catch {
361
+ }
362
+ });
363
+ /**
364
+ * 停止
365
+ */
366
+ v(this, "stop", () => {
367
+ var a, u, r, n;
368
+ this.prFetch.stop(), (a = this.demuxerWorker) == null || a.destroy(), (u = this.decoderWorker) == null || u.destroy(), (r = this.renderWorker) == null || r.destroy(), O(this.stream);
369
+ const o = [...this.cutRenders.keys()];
370
+ for (const i of o)
371
+ this.cut.remove(i);
372
+ (n = this.audioPlayer) == null || n.destroy(), this.renderBaseTime = 0, this.canvas = void 0;
373
+ });
374
+ /**
375
+ * 监听媒体 tag
376
+ */
377
+ v(this, "onTag", (o) => {
378
+ var i;
379
+ if (!this.decoderWorker) return;
380
+ const { header: a, body: u } = o, { tagType: r, timestamp: n } = a;
381
+ switch (r) {
382
+ case "script":
383
+ {
384
+ const { width: e, height: t } = u;
385
+ (i = this.renderWorker) == null || i.setSize({ width: e, height: t }), this.on.demuxer.script && this.on.demuxer.script(o);
386
+ }
387
+ break;
388
+ case "audio":
389
+ {
390
+ const { accPacketType: e, data: t } = u;
391
+ if (e === 0) {
392
+ const { codec: s, sampleRate: l, channelConfiguration: c } = u, d = { codec: s, sampleRate: l, numberOfChannels: c, description: new Uint8Array([]) };
393
+ this.decoderWorker.audio.init(d);
394
+ } else e === 1 && this.decoderWorker.audio.decode({ type: "key", timestamp: n * 1, data: t });
395
+ this.on.demuxer.audio && this.on.demuxer.audio(o);
396
+ }
397
+ break;
398
+ case "video":
399
+ {
400
+ const { avcPacketType: e, frameType: t, data: s, nalus: l = [] } = u;
401
+ if (e === 0) {
402
+ const { codec: c, data: d } = u;
403
+ this.decoderWorker.video.init({ codec: c, description: d });
404
+ } else if (e === 1) {
405
+ const c = t === 1 ? "key" : "delta";
406
+ this.decoderWorker.video.decode({ type: c, timestamp: n * 1e3, data: s });
407
+ for (const d of l) {
408
+ const { header: y, payload: p } = d, { nal_unit_type: w } = y;
409
+ w === 6 && this.on.demuxer.sei && this.on.demuxer.sei(p);
410
+ }
411
+ }
412
+ this.on.demuxer.video && this.on.demuxer.video(o);
413
+ }
414
+ break;
415
+ }
416
+ });
417
+ /**
418
+ * 初始化分离器
419
+ */
420
+ v(this, "initDemuxer", () => {
421
+ this.demuxerWorker = new _(), this.demuxerWorker.init(), this.demuxerWorker.on.tag = this.onTag;
422
+ });
423
+ /**
424
+ * 初始化解码器
425
+ */
426
+ v(this, "initDecoder", () => {
427
+ this.decoderWorker = new j(), this.decoderWorker.on.audio.decode = (o) => {
428
+ var a;
429
+ (a = this.audioPlayer) == null || a.push(o), this.on.decoder.audio && this.on.decoder.audio(o);
430
+ }, this.decoderWorker.on.audio.error = (o) => {
431
+ this.stop(), this.on.error && this.on.error(o);
432
+ }, this.decoderWorker.on.video.decode = async (o) => {
433
+ var u, r;
434
+ (u = this.renderWorker) == null || u.push(o);
435
+ const a = [...this.cutRenders.keys()];
436
+ for (const n of a)
437
+ (r = this.cutRenders.get(n)) == null || r.worker.push(o);
438
+ this.on.decoder.video && this.on.decoder.video(o), o.bitmap.close();
439
+ }, this.decoderWorker.on.video.error = (o) => {
440
+ this.stop(), this.on.error && this.on.error(o);
441
+ };
442
+ });
443
+ /**
444
+ * 初始化渲染器
445
+ */
446
+ v(this, "initRender", () => {
447
+ const { worker: o, canvas: a, stream: u } = G(this.renderBaseTime);
448
+ this.renderWorker = o, this.canvas = a, this.stream = u, this.renderWorker.setPause(!1);
449
+ });
450
+ v(this, "getCanvas", () => this.canvas);
451
+ v(this, "getStream", () => this.stream);
452
+ v(this, "getCutCanvas", (o) => {
453
+ var a;
454
+ return (a = this.cutRenders.get(o)) == null ? void 0 : a.canvas;
455
+ });
456
+ v(this, "getCutStream", (o) => {
457
+ var a;
458
+ return (a = this.cutRenders.get(o)) == null ? void 0 : a.stream;
459
+ });
460
+ v(this, "setPause", (o) => {
461
+ var a;
462
+ (a = this.renderWorker) == null || a.setPause(o);
463
+ });
464
+ /**
465
+ * 设置渲染模式
466
+ */
467
+ v(this, "setShader", (o) => {
468
+ var a;
469
+ (a = this.renderWorker) == null || a.setShader(o);
470
+ });
471
+ /**
472
+ * 是否静音 默认为true
473
+ * @param state?: boolean
474
+ */
475
+ v(this, "setMute", (o) => {
476
+ var a, u;
477
+ return (u = (a = this.audioPlayer) == null ? void 0 : a.prAudioStream) == null ? void 0 : u.setMute(o);
478
+ });
479
+ v(this, "cut", {
480
+ /**
481
+ * 创建剪切
482
+ */
483
+ create: (o, a) => {
484
+ let u = this.cutRenders.get(o);
485
+ return u ? (u.worker.setCut(a), u.worker.setPause(!1), u) : (u = G(this.renderBaseTime), u.worker.setCut(a), this.cutRenders.set(o, u), u);
486
+ },
487
+ setPause: (o, a) => {
488
+ var u;
489
+ (u = this.cutRenders.get(o)) == null || u.worker.setPause(a);
490
+ },
491
+ /**
492
+ * 设置渲染模式
493
+ */
494
+ setShader: (o, a) => {
495
+ var u;
496
+ (u = this.cutRenders.get(o)) == null || u.worker.setShader(a);
497
+ },
498
+ /**
499
+ * 移除剪切
500
+ */
501
+ remove: (o) => {
502
+ var a;
503
+ (a = this.cutRenders.get(o)) == null || a.destroy(), this.cutRenders.delete(o);
504
+ }
505
+ });
506
+ }
507
+ }
508
+ new TextDecoder("utf-8");
509
+ var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, indexMinimal = {}, minimal$1 = {}, aspromise, hasRequiredAspromise;
510
+ function requireAspromise() {
511
+ if (hasRequiredAspromise) return aspromise;
512
+ hasRequiredAspromise = 1, aspromise = f;
513
+ function f(o, a) {
514
+ for (var u = new Array(arguments.length - 1), r = 0, n = 2, i = !0; n < arguments.length; )
515
+ u[r++] = arguments[n++];
516
+ return new Promise(function(t, s) {
517
+ u[r] = function(c) {
518
+ if (i)
519
+ if (i = !1, c)
520
+ s(c);
521
+ else {
522
+ for (var d = new Array(arguments.length - 1), y = 0; y < d.length; )
523
+ d[y++] = arguments[y];
524
+ t.apply(null, d);
525
+ }
526
+ };
527
+ try {
528
+ o.apply(a || null, u);
529
+ } catch (l) {
530
+ i && (i = !1, s(l));
531
+ }
532
+ });
533
+ }
534
+ return aspromise;
535
+ }
536
+ var base64 = {}, hasRequiredBase64;
537
+ function requireBase64() {
538
+ return hasRequiredBase64 || (hasRequiredBase64 = 1, function(f) {
539
+ var o = f;
540
+ o.length = function(e) {
541
+ var t = e.length;
542
+ if (!t)
543
+ return 0;
544
+ for (var s = 0; --t % 4 > 1 && e.charAt(t) === "="; )
545
+ ++s;
546
+ return Math.ceil(e.length * 3) / 4 - s;
547
+ };
548
+ for (var a = new Array(64), u = new Array(123), r = 0; r < 64; )
549
+ u[a[r] = r < 26 ? r + 65 : r < 52 ? r + 71 : r < 62 ? r - 4 : r - 59 | 43] = r++;
550
+ o.encode = function(e, t, s) {
551
+ for (var l = null, c = [], d = 0, y = 0, p; t < s; ) {
552
+ var w = e[t++];
553
+ switch (y) {
554
+ case 0:
555
+ c[d++] = a[w >> 2], p = (w & 3) << 4, y = 1;
556
+ break;
557
+ case 1:
558
+ c[d++] = a[p | w >> 4], p = (w & 15) << 2, y = 2;
559
+ break;
560
+ case 2:
561
+ c[d++] = a[p | w >> 6], c[d++] = a[w & 63], y = 0;
562
+ break;
563
+ }
564
+ d > 8191 && ((l || (l = [])).push(String.fromCharCode.apply(String, c)), d = 0);
565
+ }
566
+ return y && (c[d++] = a[p], c[d++] = 61, y === 1 && (c[d++] = 61)), l ? (d && l.push(String.fromCharCode.apply(String, c.slice(0, d))), l.join("")) : String.fromCharCode.apply(String, c.slice(0, d));
567
+ };
568
+ var n = "invalid encoding";
569
+ o.decode = function(e, t, s) {
570
+ for (var l = s, c = 0, d, y = 0; y < e.length; ) {
571
+ var p = e.charCodeAt(y++);
572
+ if (p === 61 && c > 1)
573
+ break;
574
+ if ((p = u[p]) === void 0)
575
+ throw Error(n);
576
+ switch (c) {
577
+ case 0:
578
+ d = p, c = 1;
579
+ break;
580
+ case 1:
581
+ t[s++] = d << 2 | (p & 48) >> 4, d = p, c = 2;
582
+ break;
583
+ case 2:
584
+ t[s++] = (d & 15) << 4 | (p & 60) >> 2, d = p, c = 3;
585
+ break;
586
+ case 3:
587
+ t[s++] = (d & 3) << 6 | p, c = 0;
588
+ break;
589
+ }
590
+ }
591
+ if (c === 1)
592
+ throw Error(n);
593
+ return s - l;
594
+ }, o.test = function(e) {
595
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e);
596
+ };
597
+ }(base64)), base64;
598
+ }
599
+ var eventemitter, hasRequiredEventemitter;
600
+ function requireEventemitter() {
601
+ if (hasRequiredEventemitter) return eventemitter;
602
+ hasRequiredEventemitter = 1, eventemitter = f;
603
+ function f() {
604
+ this._listeners = {};
605
+ }
606
+ return f.prototype.on = function(a, u, r) {
607
+ return (this._listeners[a] || (this._listeners[a] = [])).push({
608
+ fn: u,
609
+ ctx: r || this
610
+ }), this;
611
+ }, f.prototype.off = function(a, u) {
612
+ if (a === void 0)
613
+ this._listeners = {};
614
+ else if (u === void 0)
615
+ this._listeners[a] = [];
616
+ else
617
+ for (var r = this._listeners[a], n = 0; n < r.length; )
618
+ r[n].fn === u ? r.splice(n, 1) : ++n;
619
+ return this;
620
+ }, f.prototype.emit = function(a) {
621
+ var u = this._listeners[a];
622
+ if (u) {
623
+ for (var r = [], n = 1; n < arguments.length; )
624
+ r.push(arguments[n++]);
625
+ for (n = 0; n < u.length; )
626
+ u[n].fn.apply(u[n++].ctx, r);
627
+ }
628
+ return this;
629
+ }, eventemitter;
630
+ }
631
+ var float, hasRequiredFloat;
632
+ function requireFloat() {
633
+ if (hasRequiredFloat) return float;
634
+ hasRequiredFloat = 1, float = f(f);
635
+ function f(n) {
636
+ return typeof Float32Array < "u" ? function() {
637
+ var i = new Float32Array([-0]), e = new Uint8Array(i.buffer), t = e[3] === 128;
638
+ function s(y, p, w) {
639
+ i[0] = y, p[w] = e[0], p[w + 1] = e[1], p[w + 2] = e[2], p[w + 3] = e[3];
640
+ }
641
+ function l(y, p, w) {
642
+ i[0] = y, p[w] = e[3], p[w + 1] = e[2], p[w + 2] = e[1], p[w + 3] = e[0];
643
+ }
644
+ n.writeFloatLE = t ? s : l, n.writeFloatBE = t ? l : s;
645
+ function c(y, p) {
646
+ return e[0] = y[p], e[1] = y[p + 1], e[2] = y[p + 2], e[3] = y[p + 3], i[0];
647
+ }
648
+ function d(y, p) {
649
+ return e[3] = y[p], e[2] = y[p + 1], e[1] = y[p + 2], e[0] = y[p + 3], i[0];
650
+ }
651
+ n.readFloatLE = t ? c : d, n.readFloatBE = t ? d : c;
652
+ }() : function() {
653
+ function i(t, s, l, c) {
654
+ var d = s < 0 ? 1 : 0;
655
+ if (d && (s = -s), s === 0)
656
+ t(1 / s > 0 ? (
657
+ /* positive */
658
+ 0
659
+ ) : (
660
+ /* negative 0 */
661
+ 2147483648
662
+ ), l, c);
663
+ else if (isNaN(s))
664
+ t(2143289344, l, c);
665
+ else if (s > 34028234663852886e22)
666
+ t((d << 31 | 2139095040) >>> 0, l, c);
667
+ else if (s < 11754943508222875e-54)
668
+ t((d << 31 | Math.round(s / 1401298464324817e-60)) >>> 0, l, c);
669
+ else {
670
+ var y = Math.floor(Math.log(s) / Math.LN2), p = Math.round(s * Math.pow(2, -y) * 8388608) & 8388607;
671
+ t((d << 31 | y + 127 << 23 | p) >>> 0, l, c);
672
+ }
673
+ }
674
+ n.writeFloatLE = i.bind(null, o), n.writeFloatBE = i.bind(null, a);
675
+ function e(t, s, l) {
676
+ var c = t(s, l), d = (c >> 31) * 2 + 1, y = c >>> 23 & 255, p = c & 8388607;
677
+ return y === 255 ? p ? NaN : d * (1 / 0) : y === 0 ? d * 1401298464324817e-60 * p : d * Math.pow(2, y - 150) * (p + 8388608);
678
+ }
679
+ n.readFloatLE = e.bind(null, u), n.readFloatBE = e.bind(null, r);
680
+ }(), typeof Float64Array < "u" ? function() {
681
+ var i = new Float64Array([-0]), e = new Uint8Array(i.buffer), t = e[7] === 128;
682
+ function s(y, p, w) {
683
+ i[0] = y, p[w] = e[0], p[w + 1] = e[1], p[w + 2] = e[2], p[w + 3] = e[3], p[w + 4] = e[4], p[w + 5] = e[5], p[w + 6] = e[6], p[w + 7] = e[7];
684
+ }
685
+ function l(y, p, w) {
686
+ i[0] = y, p[w] = e[7], p[w + 1] = e[6], p[w + 2] = e[5], p[w + 3] = e[4], p[w + 4] = e[3], p[w + 5] = e[2], p[w + 6] = e[1], p[w + 7] = e[0];
687
+ }
688
+ n.writeDoubleLE = t ? s : l, n.writeDoubleBE = t ? l : s;
689
+ function c(y, p) {
690
+ return e[0] = y[p], e[1] = y[p + 1], e[2] = y[p + 2], e[3] = y[p + 3], e[4] = y[p + 4], e[5] = y[p + 5], e[6] = y[p + 6], e[7] = y[p + 7], i[0];
691
+ }
692
+ function d(y, p) {
693
+ return e[7] = y[p], e[6] = y[p + 1], e[5] = y[p + 2], e[4] = y[p + 3], e[3] = y[p + 4], e[2] = y[p + 5], e[1] = y[p + 6], e[0] = y[p + 7], i[0];
694
+ }
695
+ n.readDoubleLE = t ? c : d, n.readDoubleBE = t ? d : c;
696
+ }() : function() {
697
+ function i(t, s, l, c, d, y) {
698
+ var p = c < 0 ? 1 : 0;
699
+ if (p && (c = -c), c === 0)
700
+ t(0, d, y + s), t(1 / c > 0 ? (
701
+ /* positive */
702
+ 0
703
+ ) : (
704
+ /* negative 0 */
705
+ 2147483648
706
+ ), d, y + l);
707
+ else if (isNaN(c))
708
+ t(0, d, y + s), t(2146959360, d, y + l);
709
+ else if (c > 17976931348623157e292)
710
+ t(0, d, y + s), t((p << 31 | 2146435072) >>> 0, d, y + l);
711
+ else {
712
+ var w;
713
+ if (c < 22250738585072014e-324)
714
+ w = c / 5e-324, t(w >>> 0, d, y + s), t((p << 31 | w / 4294967296) >>> 0, d, y + l);
715
+ else {
716
+ var b = Math.floor(Math.log(c) / Math.LN2);
717
+ b === 1024 && (b = 1023), w = c * Math.pow(2, -b), t(w * 4503599627370496 >>> 0, d, y + s), t((p << 31 | b + 1023 << 20 | w * 1048576 & 1048575) >>> 0, d, y + l);
718
+ }
719
+ }
720
+ }
721
+ n.writeDoubleLE = i.bind(null, o, 0, 4), n.writeDoubleBE = i.bind(null, a, 4, 0);
722
+ function e(t, s, l, c, d) {
723
+ var y = t(c, d + s), p = t(c, d + l), w = (p >> 31) * 2 + 1, b = p >>> 20 & 2047, m = 4294967296 * (p & 1048575) + y;
724
+ return b === 2047 ? m ? NaN : w * (1 / 0) : b === 0 ? w * 5e-324 * m : w * Math.pow(2, b - 1075) * (m + 4503599627370496);
725
+ }
726
+ n.readDoubleLE = e.bind(null, u, 0, 4), n.readDoubleBE = e.bind(null, r, 4, 0);
727
+ }(), n;
728
+ }
729
+ function o(n, i, e) {
730
+ i[e] = n & 255, i[e + 1] = n >>> 8 & 255, i[e + 2] = n >>> 16 & 255, i[e + 3] = n >>> 24;
731
+ }
732
+ function a(n, i, e) {
733
+ i[e] = n >>> 24, i[e + 1] = n >>> 16 & 255, i[e + 2] = n >>> 8 & 255, i[e + 3] = n & 255;
734
+ }
735
+ function u(n, i) {
736
+ return (n[i] | n[i + 1] << 8 | n[i + 2] << 16 | n[i + 3] << 24) >>> 0;
737
+ }
738
+ function r(n, i) {
739
+ return (n[i] << 24 | n[i + 1] << 16 | n[i + 2] << 8 | n[i + 3]) >>> 0;
740
+ }
741
+ return float;
742
+ }
743
+ var inquire_1, hasRequiredInquire;
744
+ function requireInquire() {
745
+ if (hasRequiredInquire) return inquire_1;
746
+ hasRequiredInquire = 1, inquire_1 = inquire;
747
+ function inquire(moduleName) {
748
+ try {
749
+ var mod = eval("quire".replace(/^/, "re"))(moduleName);
750
+ if (mod && (mod.length || Object.keys(mod).length))
751
+ return mod;
752
+ } catch (f) {
753
+ }
754
+ return null;
755
+ }
756
+ return inquire_1;
757
+ }
758
+ var utf8 = {}, hasRequiredUtf8;
759
+ function requireUtf8() {
760
+ return hasRequiredUtf8 || (hasRequiredUtf8 = 1, function(f) {
761
+ var o = f;
762
+ o.length = function(u) {
763
+ for (var r = 0, n = 0, i = 0; i < u.length; ++i)
764
+ n = u.charCodeAt(i), n < 128 ? r += 1 : n < 2048 ? r += 2 : (n & 64512) === 55296 && (u.charCodeAt(i + 1) & 64512) === 56320 ? (++i, r += 4) : r += 3;
765
+ return r;
766
+ }, o.read = function(u, r, n) {
767
+ var i = n - r;
768
+ if (i < 1)
769
+ return "";
770
+ for (var e = null, t = [], s = 0, l; r < n; )
771
+ l = u[r++], l < 128 ? t[s++] = l : l > 191 && l < 224 ? t[s++] = (l & 31) << 6 | u[r++] & 63 : l > 239 && l < 365 ? (l = ((l & 7) << 18 | (u[r++] & 63) << 12 | (u[r++] & 63) << 6 | u[r++] & 63) - 65536, t[s++] = 55296 + (l >> 10), t[s++] = 56320 + (l & 1023)) : t[s++] = (l & 15) << 12 | (u[r++] & 63) << 6 | u[r++] & 63, s > 8191 && ((e || (e = [])).push(String.fromCharCode.apply(String, t)), s = 0);
772
+ return e ? (s && e.push(String.fromCharCode.apply(String, t.slice(0, s))), e.join("")) : String.fromCharCode.apply(String, t.slice(0, s));
773
+ }, o.write = function(u, r, n) {
774
+ for (var i = n, e, t, s = 0; s < u.length; ++s)
775
+ e = u.charCodeAt(s), e < 128 ? r[n++] = e : e < 2048 ? (r[n++] = e >> 6 | 192, r[n++] = e & 63 | 128) : (e & 64512) === 55296 && ((t = u.charCodeAt(s + 1)) & 64512) === 56320 ? (e = 65536 + ((e & 1023) << 10) + (t & 1023), ++s, r[n++] = e >> 18 | 240, r[n++] = e >> 12 & 63 | 128, r[n++] = e >> 6 & 63 | 128, r[n++] = e & 63 | 128) : (r[n++] = e >> 12 | 224, r[n++] = e >> 6 & 63 | 128, r[n++] = e & 63 | 128);
776
+ return n - i;
777
+ };
778
+ }(utf8)), utf8;
779
+ }
780
+ var pool_1, hasRequiredPool;
781
+ function requirePool() {
782
+ if (hasRequiredPool) return pool_1;
783
+ hasRequiredPool = 1, pool_1 = f;
784
+ function f(o, a, u) {
785
+ var r = u || 8192, n = r >>> 1, i = null, e = r;
786
+ return function(s) {
787
+ if (s < 1 || s > n)
788
+ return o(s);
789
+ e + s > r && (i = o(r), e = 0);
790
+ var l = a.call(i, e, e += s);
791
+ return e & 7 && (e = (e | 7) + 1), l;
792
+ };
793
+ }
794
+ return pool_1;
795
+ }
796
+ var longbits, hasRequiredLongbits;
797
+ function requireLongbits() {
798
+ if (hasRequiredLongbits) return longbits;
799
+ hasRequiredLongbits = 1, longbits = o;
800
+ var f = requireMinimal$1();
801
+ function o(n, i) {
802
+ this.lo = n >>> 0, this.hi = i >>> 0;
803
+ }
804
+ var a = o.zero = new o(0, 0);
805
+ a.toNumber = function() {
806
+ return 0;
807
+ }, a.zzEncode = a.zzDecode = function() {
808
+ return this;
809
+ }, a.length = function() {
810
+ return 1;
811
+ };
812
+ var u = o.zeroHash = "\0\0\0\0\0\0\0\0";
813
+ o.fromNumber = function(i) {
814
+ if (i === 0)
815
+ return a;
816
+ var e = i < 0;
817
+ e && (i = -i);
818
+ var t = i >>> 0, s = (i - t) / 4294967296 >>> 0;
819
+ return e && (s = ~s >>> 0, t = ~t >>> 0, ++t > 4294967295 && (t = 0, ++s > 4294967295 && (s = 0))), new o(t, s);
820
+ }, o.from = function(i) {
821
+ if (typeof i == "number")
822
+ return o.fromNumber(i);
823
+ if (f.isString(i))
824
+ if (f.Long)
825
+ i = f.Long.fromString(i);
826
+ else
827
+ return o.fromNumber(parseInt(i, 10));
828
+ return i.low || i.high ? new o(i.low >>> 0, i.high >>> 0) : a;
829
+ }, o.prototype.toNumber = function(i) {
830
+ if (!i && this.hi >>> 31) {
831
+ var e = ~this.lo + 1 >>> 0, t = ~this.hi >>> 0;
832
+ return e || (t = t + 1 >>> 0), -(e + t * 4294967296);
833
+ }
834
+ return this.lo + this.hi * 4294967296;
835
+ }, o.prototype.toLong = function(i) {
836
+ return f.Long ? new f.Long(this.lo | 0, this.hi | 0, !!i) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!i };
837
+ };
838
+ var r = String.prototype.charCodeAt;
839
+ return o.fromHash = function(i) {
840
+ return i === u ? a : new o(
841
+ (r.call(i, 0) | r.call(i, 1) << 8 | r.call(i, 2) << 16 | r.call(i, 3) << 24) >>> 0,
842
+ (r.call(i, 4) | r.call(i, 5) << 8 | r.call(i, 6) << 16 | r.call(i, 7) << 24) >>> 0
843
+ );
844
+ }, o.prototype.toHash = function() {
845
+ return String.fromCharCode(
846
+ this.lo & 255,
847
+ this.lo >>> 8 & 255,
848
+ this.lo >>> 16 & 255,
849
+ this.lo >>> 24,
850
+ this.hi & 255,
851
+ this.hi >>> 8 & 255,
852
+ this.hi >>> 16 & 255,
853
+ this.hi >>> 24
854
+ );
855
+ }, o.prototype.zzEncode = function() {
856
+ var i = this.hi >> 31;
857
+ return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ i) >>> 0, this.lo = (this.lo << 1 ^ i) >>> 0, this;
858
+ }, o.prototype.zzDecode = function() {
859
+ var i = -(this.lo & 1);
860
+ return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ i) >>> 0, this.hi = (this.hi >>> 1 ^ i) >>> 0, this;
861
+ }, o.prototype.length = function() {
862
+ var i = this.lo, e = (this.lo >>> 28 | this.hi << 4) >>> 0, t = this.hi >>> 24;
863
+ return t === 0 ? e === 0 ? i < 16384 ? i < 128 ? 1 : 2 : i < 2097152 ? 3 : 4 : e < 16384 ? e < 128 ? 5 : 6 : e < 2097152 ? 7 : 8 : t < 128 ? 9 : 10;
864
+ }, longbits;
865
+ }
866
+ var hasRequiredMinimal$1;
867
+ function requireMinimal$1() {
868
+ return hasRequiredMinimal$1 || (hasRequiredMinimal$1 = 1, function(f) {
869
+ var o = f;
870
+ o.asPromise = requireAspromise(), o.base64 = requireBase64(), o.EventEmitter = requireEventemitter(), o.float = requireFloat(), o.inquire = requireInquire(), o.utf8 = requireUtf8(), o.pool = requirePool(), o.LongBits = requireLongbits(), o.isNode = !!(typeof commonjsGlobal < "u" && commonjsGlobal && commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node), o.global = o.isNode && commonjsGlobal || typeof window < "u" && window || typeof self < "u" && self || minimal$1, o.emptyArray = Object.freeze ? Object.freeze([]) : (
871
+ /* istanbul ignore next */
872
+ []
873
+ ), o.emptyObject = Object.freeze ? Object.freeze({}) : (
874
+ /* istanbul ignore next */
875
+ {}
876
+ ), o.isInteger = Number.isInteger || /* istanbul ignore next */
877
+ function(n) {
878
+ return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
879
+ }, o.isString = function(n) {
880
+ return typeof n == "string" || n instanceof String;
881
+ }, o.isObject = function(n) {
882
+ return n && typeof n == "object";
883
+ }, o.isset = /**
884
+ * Checks if a property on a message is considered to be present.
885
+ * @param {Object} obj Plain object or message instance
886
+ * @param {string} prop Property name
887
+ * @returns {boolean} `true` if considered to be present, otherwise `false`
888
+ */
889
+ o.isSet = function(n, i) {
890
+ var e = n[i];
891
+ return e != null && n.hasOwnProperty(i) ? typeof e != "object" || (Array.isArray(e) ? e.length : Object.keys(e).length) > 0 : !1;
892
+ }, o.Buffer = function() {
893
+ try {
894
+ var r = o.inquire("buffer").Buffer;
895
+ return r.prototype.utf8Write ? r : (
896
+ /* istanbul ignore next */
897
+ null
898
+ );
899
+ } catch {
900
+ return null;
901
+ }
902
+ }(), o._Buffer_from = null, o._Buffer_allocUnsafe = null, o.newBuffer = function(n) {
903
+ return typeof n == "number" ? o.Buffer ? o._Buffer_allocUnsafe(n) : new o.Array(n) : o.Buffer ? o._Buffer_from(n) : typeof Uint8Array > "u" ? n : new Uint8Array(n);
904
+ }, o.Array = typeof Uint8Array < "u" ? Uint8Array : Array, o.Long = /* istanbul ignore next */
905
+ o.global.dcodeIO && /* istanbul ignore next */
906
+ o.global.dcodeIO.Long || /* istanbul ignore next */
907
+ o.global.Long || o.inquire("long"), o.key2Re = /^true|false|0|1$/, o.key32Re = /^-?(?:0|[1-9][0-9]*)$/, o.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, o.longToHash = function(n) {
908
+ return n ? o.LongBits.from(n).toHash() : o.LongBits.zeroHash;
909
+ }, o.longFromHash = function(n, i) {
910
+ var e = o.LongBits.fromHash(n);
911
+ return o.Long ? o.Long.fromBits(e.lo, e.hi, i) : e.toNumber(!!i);
912
+ };
913
+ function a(r, n, i) {
914
+ for (var e = Object.keys(n), t = 0; t < e.length; ++t)
915
+ (r[e[t]] === void 0 || !i) && (r[e[t]] = n[e[t]]);
916
+ return r;
917
+ }
918
+ o.merge = a, o.lcFirst = function(n) {
919
+ return n.charAt(0).toLowerCase() + n.substring(1);
920
+ };
921
+ function u(r) {
922
+ function n(i, e) {
923
+ if (!(this instanceof n))
924
+ return new n(i, e);
925
+ Object.defineProperty(this, "message", { get: function() {
926
+ return i;
927
+ } }), Error.captureStackTrace ? Error.captureStackTrace(this, n) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), e && a(this, e);
928
+ }
929
+ return n.prototype = Object.create(Error.prototype, {
930
+ constructor: {
931
+ value: n,
932
+ writable: !0,
933
+ enumerable: !1,
934
+ configurable: !0
935
+ },
936
+ name: {
937
+ get: function() {
938
+ return r;
939
+ },
940
+ set: void 0,
941
+ enumerable: !1,
942
+ // configurable: false would accurately preserve the behavior of
943
+ // the original, but I'm guessing that was not intentional.
944
+ // For an actual error subclass, this property would
945
+ // be configurable.
946
+ configurable: !0
947
+ },
948
+ toString: {
949
+ value: function() {
950
+ return this.name + ": " + this.message;
951
+ },
952
+ writable: !0,
953
+ enumerable: !1,
954
+ configurable: !0
955
+ }
956
+ }), n;
957
+ }
958
+ o.newError = u, o.ProtocolError = u("ProtocolError"), o.oneOfGetter = function(n) {
959
+ for (var i = {}, e = 0; e < n.length; ++e)
960
+ i[n[e]] = 1;
961
+ return function() {
962
+ for (var t = Object.keys(this), s = t.length - 1; s > -1; --s)
963
+ if (i[t[s]] === 1 && this[t[s]] !== void 0 && this[t[s]] !== null)
964
+ return t[s];
965
+ };
966
+ }, o.oneOfSetter = function(n) {
967
+ return function(i) {
968
+ for (var e = 0; e < n.length; ++e)
969
+ n[e] !== i && delete this[n[e]];
970
+ };
971
+ }, o.toJSONOptions = {
972
+ longs: String,
973
+ enums: String,
974
+ bytes: String,
975
+ json: !0
976
+ }, o._configure = function() {
977
+ var r = o.Buffer;
978
+ if (!r) {
979
+ o._Buffer_from = o._Buffer_allocUnsafe = null;
980
+ return;
981
+ }
982
+ o._Buffer_from = r.from !== Uint8Array.from && r.from || /* istanbul ignore next */
983
+ function(i, e) {
984
+ return new r(i, e);
985
+ }, o._Buffer_allocUnsafe = r.allocUnsafe || /* istanbul ignore next */
986
+ function(i) {
987
+ return new r(i);
988
+ };
989
+ };
990
+ }(minimal$1)), minimal$1;
991
+ }
992
+ var writer, hasRequiredWriter;
993
+ function requireWriter() {
994
+ if (hasRequiredWriter) return writer;
995
+ hasRequiredWriter = 1, writer = t;
996
+ var f = requireMinimal$1(), o, a = f.LongBits, u = f.base64, r = f.utf8;
997
+ function n(b, m, g) {
998
+ this.fn = b, this.len = m, this.next = void 0, this.val = g;
999
+ }
1000
+ function i() {
1001
+ }
1002
+ function e(b) {
1003
+ this.head = b.head, this.tail = b.tail, this.len = b.len, this.next = b.states;
1004
+ }
1005
+ function t() {
1006
+ this.len = 0, this.head = new n(i, 0, 0), this.tail = this.head, this.states = null;
1007
+ }
1008
+ var s = function() {
1009
+ return f.Buffer ? function() {
1010
+ return (t.create = function() {
1011
+ return new o();
1012
+ })();
1013
+ } : function() {
1014
+ return new t();
1015
+ };
1016
+ };
1017
+ t.create = s(), t.alloc = function(m) {
1018
+ return new f.Array(m);
1019
+ }, f.Array !== Array && (t.alloc = f.pool(t.alloc, f.Array.prototype.subarray)), t.prototype._push = function(m, g, k) {
1020
+ return this.tail = this.tail.next = new n(m, g, k), this.len += g, this;
1021
+ };
1022
+ function l(b, m, g) {
1023
+ m[g] = b & 255;
1024
+ }
1025
+ function c(b, m, g) {
1026
+ for (; b > 127; )
1027
+ m[g++] = b & 127 | 128, b >>>= 7;
1028
+ m[g] = b;
1029
+ }
1030
+ function d(b, m) {
1031
+ this.len = b, this.next = void 0, this.val = m;
1032
+ }
1033
+ d.prototype = Object.create(n.prototype), d.prototype.fn = c, t.prototype.uint32 = function(m) {
1034
+ return this.len += (this.tail = this.tail.next = new d(
1035
+ (m = m >>> 0) < 128 ? 1 : m < 16384 ? 2 : m < 2097152 ? 3 : m < 268435456 ? 4 : 5,
1036
+ m
1037
+ )).len, this;
1038
+ }, t.prototype.int32 = function(m) {
1039
+ return m < 0 ? this._push(y, 10, a.fromNumber(m)) : this.uint32(m);
1040
+ }, t.prototype.sint32 = function(m) {
1041
+ return this.uint32((m << 1 ^ m >> 31) >>> 0);
1042
+ };
1043
+ function y(b, m, g) {
1044
+ for (; b.hi; )
1045
+ m[g++] = b.lo & 127 | 128, b.lo = (b.lo >>> 7 | b.hi << 25) >>> 0, b.hi >>>= 7;
1046
+ for (; b.lo > 127; )
1047
+ m[g++] = b.lo & 127 | 128, b.lo = b.lo >>> 7;
1048
+ m[g++] = b.lo;
1049
+ }
1050
+ t.prototype.uint64 = function(m) {
1051
+ var g = a.from(m);
1052
+ return this._push(y, g.length(), g);
1053
+ }, t.prototype.int64 = t.prototype.uint64, t.prototype.sint64 = function(m) {
1054
+ var g = a.from(m).zzEncode();
1055
+ return this._push(y, g.length(), g);
1056
+ }, t.prototype.bool = function(m) {
1057
+ return this._push(l, 1, m ? 1 : 0);
1058
+ };
1059
+ function p(b, m, g) {
1060
+ m[g] = b & 255, m[g + 1] = b >>> 8 & 255, m[g + 2] = b >>> 16 & 255, m[g + 3] = b >>> 24;
1061
+ }
1062
+ t.prototype.fixed32 = function(m) {
1063
+ return this._push(p, 4, m >>> 0);
1064
+ }, t.prototype.sfixed32 = t.prototype.fixed32, t.prototype.fixed64 = function(m) {
1065
+ var g = a.from(m);
1066
+ return this._push(p, 4, g.lo)._push(p, 4, g.hi);
1067
+ }, t.prototype.sfixed64 = t.prototype.fixed64, t.prototype.float = function(m) {
1068
+ return this._push(f.float.writeFloatLE, 4, m);
1069
+ }, t.prototype.double = function(m) {
1070
+ return this._push(f.float.writeDoubleLE, 8, m);
1071
+ };
1072
+ var w = f.Array.prototype.set ? function(m, g, k) {
1073
+ g.set(m, k);
1074
+ } : function(m, g, k) {
1075
+ for (var I = 0; I < m.length; ++I)
1076
+ g[k + I] = m[I];
1077
+ };
1078
+ return t.prototype.bytes = function(m) {
1079
+ var g = m.length >>> 0;
1080
+ if (!g)
1081
+ return this._push(l, 1, 0);
1082
+ if (f.isString(m)) {
1083
+ var k = t.alloc(g = u.length(m));
1084
+ u.decode(m, k, 0), m = k;
1085
+ }
1086
+ return this.uint32(g)._push(w, g, m);
1087
+ }, t.prototype.string = function(m) {
1088
+ var g = r.length(m);
1089
+ return g ? this.uint32(g)._push(r.write, g, m) : this._push(l, 1, 0);
1090
+ }, t.prototype.fork = function() {
1091
+ return this.states = new e(this), this.head = this.tail = new n(i, 0, 0), this.len = 0, this;
1092
+ }, t.prototype.reset = function() {
1093
+ return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new n(i, 0, 0), this.len = 0), this;
1094
+ }, t.prototype.ldelim = function() {
1095
+ var m = this.head, g = this.tail, k = this.len;
1096
+ return this.reset().uint32(k), k && (this.tail.next = m.next, this.tail = g, this.len += k), this;
1097
+ }, t.prototype.finish = function() {
1098
+ for (var m = this.head.next, g = this.constructor.alloc(this.len), k = 0; m; )
1099
+ m.fn(m.val, g, k), k += m.len, m = m.next;
1100
+ return g;
1101
+ }, t._configure = function(b) {
1102
+ o = b, t.create = s(), o._configure();
1103
+ }, writer;
1104
+ }
1105
+ var writer_buffer, hasRequiredWriter_buffer;
1106
+ function requireWriter_buffer() {
1107
+ if (hasRequiredWriter_buffer) return writer_buffer;
1108
+ hasRequiredWriter_buffer = 1, writer_buffer = a;
1109
+ var f = requireWriter();
1110
+ (a.prototype = Object.create(f.prototype)).constructor = a;
1111
+ var o = requireMinimal$1();
1112
+ function a() {
1113
+ f.call(this);
1114
+ }
1115
+ a._configure = function() {
1116
+ a.alloc = o._Buffer_allocUnsafe, a.writeBytesBuffer = o.Buffer && o.Buffer.prototype instanceof Uint8Array && o.Buffer.prototype.set.name === "set" ? function(n, i, e) {
1117
+ i.set(n, e);
1118
+ } : function(n, i, e) {
1119
+ if (n.copy)
1120
+ n.copy(i, e, 0, n.length);
1121
+ else for (var t = 0; t < n.length; )
1122
+ i[e++] = n[t++];
1123
+ };
1124
+ }, a.prototype.bytes = function(n) {
1125
+ o.isString(n) && (n = o._Buffer_from(n, "base64"));
1126
+ var i = n.length >>> 0;
1127
+ return this.uint32(i), i && this._push(a.writeBytesBuffer, i, n), this;
1128
+ };
1129
+ function u(r, n, i) {
1130
+ r.length < 40 ? o.utf8.write(r, n, i) : n.utf8Write ? n.utf8Write(r, i) : n.write(r, i);
1131
+ }
1132
+ return a.prototype.string = function(n) {
1133
+ var i = o.Buffer.byteLength(n);
1134
+ return this.uint32(i), i && this._push(u, i, n), this;
1135
+ }, a._configure(), writer_buffer;
1136
+ }
1137
+ var reader, hasRequiredReader;
1138
+ function requireReader() {
1139
+ if (hasRequiredReader) return reader;
1140
+ hasRequiredReader = 1, reader = n;
1141
+ var f = requireMinimal$1(), o, a = f.LongBits, u = f.utf8;
1142
+ function r(c, d) {
1143
+ return RangeError("index out of range: " + c.pos + " + " + (d || 1) + " > " + c.len);
1144
+ }
1145
+ function n(c) {
1146
+ this.buf = c, this.pos = 0, this.len = c.length;
1147
+ }
1148
+ var i = typeof Uint8Array < "u" ? function(d) {
1149
+ if (d instanceof Uint8Array || Array.isArray(d))
1150
+ return new n(d);
1151
+ throw Error("illegal buffer");
1152
+ } : function(d) {
1153
+ if (Array.isArray(d))
1154
+ return new n(d);
1155
+ throw Error("illegal buffer");
1156
+ }, e = function() {
1157
+ return f.Buffer ? function(y) {
1158
+ return (n.create = function(w) {
1159
+ return f.Buffer.isBuffer(w) ? new o(w) : i(w);
1160
+ })(y);
1161
+ } : i;
1162
+ };
1163
+ n.create = e(), n.prototype._slice = f.Array.prototype.subarray || /* istanbul ignore next */
1164
+ f.Array.prototype.slice, n.prototype.uint32 = /* @__PURE__ */ function() {
1165
+ var d = 4294967295;
1166
+ return function() {
1167
+ if (d = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (d = (d | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (d = (d | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (d = (d | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (d = (d | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128)) return d;
1168
+ if ((this.pos += 5) > this.len)
1169
+ throw this.pos = this.len, r(this, 10);
1170
+ return d;
1171
+ };
1172
+ }(), n.prototype.int32 = function() {
1173
+ return this.uint32() | 0;
1174
+ }, n.prototype.sint32 = function() {
1175
+ var d = this.uint32();
1176
+ return d >>> 1 ^ -(d & 1) | 0;
1177
+ };
1178
+ function t() {
1179
+ var c = new a(0, 0), d = 0;
1180
+ if (this.len - this.pos > 4) {
1181
+ for (; d < 4; ++d)
1182
+ if (c.lo = (c.lo | (this.buf[this.pos] & 127) << d * 7) >>> 0, this.buf[this.pos++] < 128)
1183
+ return c;
1184
+ if (c.lo = (c.lo | (this.buf[this.pos] & 127) << 28) >>> 0, c.hi = (c.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128)
1185
+ return c;
1186
+ d = 0;
1187
+ } else {
1188
+ for (; d < 3; ++d) {
1189
+ if (this.pos >= this.len)
1190
+ throw r(this);
1191
+ if (c.lo = (c.lo | (this.buf[this.pos] & 127) << d * 7) >>> 0, this.buf[this.pos++] < 128)
1192
+ return c;
1193
+ }
1194
+ return c.lo = (c.lo | (this.buf[this.pos++] & 127) << d * 7) >>> 0, c;
1195
+ }
1196
+ if (this.len - this.pos > 4) {
1197
+ for (; d < 5; ++d)
1198
+ if (c.hi = (c.hi | (this.buf[this.pos] & 127) << d * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
1199
+ return c;
1200
+ } else
1201
+ for (; d < 5; ++d) {
1202
+ if (this.pos >= this.len)
1203
+ throw r(this);
1204
+ if (c.hi = (c.hi | (this.buf[this.pos] & 127) << d * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
1205
+ return c;
1206
+ }
1207
+ throw Error("invalid varint encoding");
1208
+ }
1209
+ n.prototype.bool = function() {
1210
+ return this.uint32() !== 0;
1211
+ };
1212
+ function s(c, d) {
1213
+ return (c[d - 4] | c[d - 3] << 8 | c[d - 2] << 16 | c[d - 1] << 24) >>> 0;
1214
+ }
1215
+ n.prototype.fixed32 = function() {
1216
+ if (this.pos + 4 > this.len)
1217
+ throw r(this, 4);
1218
+ return s(this.buf, this.pos += 4);
1219
+ }, n.prototype.sfixed32 = function() {
1220
+ if (this.pos + 4 > this.len)
1221
+ throw r(this, 4);
1222
+ return s(this.buf, this.pos += 4) | 0;
1223
+ };
1224
+ function l() {
1225
+ if (this.pos + 8 > this.len)
1226
+ throw r(this, 8);
1227
+ return new a(s(this.buf, this.pos += 4), s(this.buf, this.pos += 4));
1228
+ }
1229
+ return n.prototype.float = function() {
1230
+ if (this.pos + 4 > this.len)
1231
+ throw r(this, 4);
1232
+ var d = f.float.readFloatLE(this.buf, this.pos);
1233
+ return this.pos += 4, d;
1234
+ }, n.prototype.double = function() {
1235
+ if (this.pos + 8 > this.len)
1236
+ throw r(this, 4);
1237
+ var d = f.float.readDoubleLE(this.buf, this.pos);
1238
+ return this.pos += 8, d;
1239
+ }, n.prototype.bytes = function() {
1240
+ var d = this.uint32(), y = this.pos, p = this.pos + d;
1241
+ if (p > this.len)
1242
+ throw r(this, d);
1243
+ if (this.pos += d, Array.isArray(this.buf))
1244
+ return this.buf.slice(y, p);
1245
+ if (y === p) {
1246
+ var w = f.Buffer;
1247
+ return w ? w.alloc(0) : new this.buf.constructor(0);
1248
+ }
1249
+ return this._slice.call(this.buf, y, p);
1250
+ }, n.prototype.string = function() {
1251
+ var d = this.bytes();
1252
+ return u.read(d, 0, d.length);
1253
+ }, n.prototype.skip = function(d) {
1254
+ if (typeof d == "number") {
1255
+ if (this.pos + d > this.len)
1256
+ throw r(this, d);
1257
+ this.pos += d;
1258
+ } else
1259
+ do
1260
+ if (this.pos >= this.len)
1261
+ throw r(this);
1262
+ while (this.buf[this.pos++] & 128);
1263
+ return this;
1264
+ }, n.prototype.skipType = function(c) {
1265
+ switch (c) {
1266
+ case 0:
1267
+ this.skip();
1268
+ break;
1269
+ case 1:
1270
+ this.skip(8);
1271
+ break;
1272
+ case 2:
1273
+ this.skip(this.uint32());
1274
+ break;
1275
+ case 3:
1276
+ for (; (c = this.uint32() & 7) !== 4; )
1277
+ this.skipType(c);
1278
+ break;
1279
+ case 5:
1280
+ this.skip(4);
1281
+ break;
1282
+ /* istanbul ignore next */
1283
+ default:
1284
+ throw Error("invalid wire type " + c + " at offset " + this.pos);
1285
+ }
1286
+ return this;
1287
+ }, n._configure = function(c) {
1288
+ o = c, n.create = e(), o._configure();
1289
+ var d = f.Long ? "toLong" : (
1290
+ /* istanbul ignore next */
1291
+ "toNumber"
1292
+ );
1293
+ f.merge(n.prototype, {
1294
+ int64: function() {
1295
+ return t.call(this)[d](!1);
1296
+ },
1297
+ uint64: function() {
1298
+ return t.call(this)[d](!0);
1299
+ },
1300
+ sint64: function() {
1301
+ return t.call(this).zzDecode()[d](!1);
1302
+ },
1303
+ fixed64: function() {
1304
+ return l.call(this)[d](!0);
1305
+ },
1306
+ sfixed64: function() {
1307
+ return l.call(this)[d](!1);
1308
+ }
1309
+ });
1310
+ }, reader;
1311
+ }
1312
+ var reader_buffer, hasRequiredReader_buffer;
1313
+ function requireReader_buffer() {
1314
+ if (hasRequiredReader_buffer) return reader_buffer;
1315
+ hasRequiredReader_buffer = 1, reader_buffer = a;
1316
+ var f = requireReader();
1317
+ (a.prototype = Object.create(f.prototype)).constructor = a;
1318
+ var o = requireMinimal$1();
1319
+ function a(u) {
1320
+ f.call(this, u);
1321
+ }
1322
+ return a._configure = function() {
1323
+ o.Buffer && (a.prototype._slice = o.Buffer.prototype.slice);
1324
+ }, a.prototype.string = function() {
1325
+ var r = this.uint32();
1326
+ return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + r, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + r, this.len));
1327
+ }, a._configure(), reader_buffer;
1328
+ }
1329
+ var rpc = {}, service, hasRequiredService;
1330
+ function requireService() {
1331
+ if (hasRequiredService) return service;
1332
+ hasRequiredService = 1, service = o;
1333
+ var f = requireMinimal$1();
1334
+ (o.prototype = Object.create(f.EventEmitter.prototype)).constructor = o;
1335
+ function o(a, u, r) {
1336
+ if (typeof a != "function")
1337
+ throw TypeError("rpcImpl must be a function");
1338
+ f.EventEmitter.call(this), this.rpcImpl = a, this.requestDelimited = !!u, this.responseDelimited = !!r;
1339
+ }
1340
+ return o.prototype.rpcCall = function a(u, r, n, i, e) {
1341
+ if (!i)
1342
+ throw TypeError("request must be specified");
1343
+ var t = this;
1344
+ if (!e)
1345
+ return f.asPromise(a, t, u, r, n, i);
1346
+ if (!t.rpcImpl) {
1347
+ setTimeout(function() {
1348
+ e(Error("already ended"));
1349
+ }, 0);
1350
+ return;
1351
+ }
1352
+ try {
1353
+ return t.rpcImpl(
1354
+ u,
1355
+ r[t.requestDelimited ? "encodeDelimited" : "encode"](i).finish(),
1356
+ function(l, c) {
1357
+ if (l)
1358
+ return t.emit("error", l, u), e(l);
1359
+ if (c === null) {
1360
+ t.end(
1361
+ /* endedByRPC */
1362
+ !0
1363
+ );
1364
+ return;
1365
+ }
1366
+ if (!(c instanceof n))
1367
+ try {
1368
+ c = n[t.responseDelimited ? "decodeDelimited" : "decode"](c);
1369
+ } catch (d) {
1370
+ return t.emit("error", d, u), e(d);
1371
+ }
1372
+ return t.emit("data", c, u), e(null, c);
1373
+ }
1374
+ );
1375
+ } catch (s) {
1376
+ t.emit("error", s, u), setTimeout(function() {
1377
+ e(s);
1378
+ }, 0);
1379
+ return;
1380
+ }
1381
+ }, o.prototype.end = function(u) {
1382
+ return this.rpcImpl && (u || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
1383
+ }, service;
1384
+ }
1385
+ var hasRequiredRpc;
1386
+ function requireRpc() {
1387
+ return hasRequiredRpc || (hasRequiredRpc = 1, function(f) {
1388
+ var o = f;
1389
+ o.Service = requireService();
1390
+ }(rpc)), rpc;
1391
+ }
1392
+ var roots, hasRequiredRoots;
1393
+ function requireRoots() {
1394
+ return hasRequiredRoots || (hasRequiredRoots = 1, roots = {}), roots;
1395
+ }
1396
+ var hasRequiredIndexMinimal;
1397
+ function requireIndexMinimal() {
1398
+ return hasRequiredIndexMinimal || (hasRequiredIndexMinimal = 1, function(f) {
1399
+ var o = f;
1400
+ o.build = "minimal", o.Writer = requireWriter(), o.BufferWriter = requireWriter_buffer(), o.Reader = requireReader(), o.BufferReader = requireReader_buffer(), o.util = requireMinimal$1(), o.rpc = requireRpc(), o.roots = requireRoots(), o.configure = a;
1401
+ function a() {
1402
+ o.util._configure(), o.Writer._configure(o.BufferWriter), o.Reader._configure(o.BufferReader);
1403
+ }
1404
+ a();
1405
+ }(indexMinimal)), indexMinimal;
1406
+ }
1407
+ var minimal, hasRequiredMinimal;
1408
+ function requireMinimal() {
1409
+ return hasRequiredMinimal || (hasRequiredMinimal = 1, minimal = requireIndexMinimal()), minimal;
1410
+ }
1411
+ var minimalExports = requireMinimal();
1412
+ const $Reader = minimalExports.Reader, $Writer = minimalExports.Writer, $util = minimalExports.util, $root = minimalExports.roots.default || (minimalExports.roots.default = {}), com = $root.com = (() => {
1413
+ const f = {};
1414
+ return f.quick = function() {
1415
+ const o = {};
1416
+ return o.voice = function() {
1417
+ const a = {};
1418
+ return a.proto = function() {
1419
+ const u = {};
1420
+ return u.SeiData = function() {
1421
+ function r(n) {
1422
+ if (n) for (let i = Object.keys(n), e = 0; e < i.length; ++e) n[i[e]] != null && (this[i[e]] = n[i[e]]);
1423
+ }
1424
+ return r.prototype.event = 0, r.prototype.data = $util.newBuffer([]), r.prototype.compress = !1, r.prototype.version = 0, r.create = function(i) {
1425
+ return new r(i);
1426
+ }, r.encode = function(i, e) {
1427
+ return e || (e = $Writer.create()), i.event != null && Object.hasOwnProperty.call(i, "event") && e.uint32(
1428
+ /* id 1, wireType 0 =*/
1429
+ 8
1430
+ ).int32(i.event), i.data != null && Object.hasOwnProperty.call(i, "data") && e.uint32(
1431
+ /* id 2, wireType 2 =*/
1432
+ 18
1433
+ ).bytes(i.data), i.compress != null && Object.hasOwnProperty.call(i, "compress") && e.uint32(
1434
+ /* id 3, wireType 0 =*/
1435
+ 24
1436
+ ).bool(i.compress), i.version != null && Object.hasOwnProperty.call(i, "version") && e.uint32(
1437
+ /* id 4, wireType 0 =*/
1438
+ 32
1439
+ ).int32(i.version), e;
1440
+ }, r.encodeDelimited = function(i, e) {
1441
+ return this.encode(i, e).ldelim();
1442
+ }, r.decode = function(i, e, t) {
1443
+ i instanceof $Reader || (i = $Reader.create(i));
1444
+ let s = e === void 0 ? i.len : i.pos + e, l = new $root.com.quick.voice.proto.SeiData();
1445
+ for (; i.pos < s; ) {
1446
+ let c = i.uint32();
1447
+ if (c === t) break;
1448
+ switch (c >>> 3) {
1449
+ case 1: {
1450
+ l.event = i.int32();
1451
+ break;
1452
+ }
1453
+ case 2: {
1454
+ l.data = i.bytes();
1455
+ break;
1456
+ }
1457
+ case 3: {
1458
+ l.compress = i.bool();
1459
+ break;
1460
+ }
1461
+ case 4: {
1462
+ l.version = i.int32();
1463
+ break;
1464
+ }
1465
+ default:
1466
+ i.skipType(c & 7);
1467
+ break;
1468
+ }
1469
+ }
1470
+ return l;
1471
+ }, r.decodeDelimited = function(i) {
1472
+ return i instanceof $Reader || (i = new $Reader(i)), this.decode(i, i.uint32());
1473
+ }, r.verify = function(i) {
1474
+ if (typeof i != "object" || i === null) return "object expected";
1475
+ if (i.event != null && i.hasOwnProperty("event"))
1476
+ switch (i.event) {
1477
+ default:
1478
+ return "event: enum value expected";
1479
+ case 0:
1480
+ case 1:
1481
+ break;
1482
+ }
1483
+ return i.data != null && i.hasOwnProperty("data") && !(i.data && typeof i.data.length == "number" || $util.isString(i.data)) ? "data: buffer expected" : i.compress != null && i.hasOwnProperty("compress") && typeof i.compress != "boolean" ? "compress: boolean expected" : i.version != null && i.hasOwnProperty("version") && !$util.isInteger(i.version) ? "version: integer expected" : null;
1484
+ }, r.fromObject = function(i) {
1485
+ if (i instanceof $root.com.quick.voice.proto.SeiData) return i;
1486
+ let e = new $root.com.quick.voice.proto.SeiData();
1487
+ switch (i.event) {
1488
+ default:
1489
+ if (typeof i.event == "number") {
1490
+ e.event = i.event;
1491
+ break;
1492
+ }
1493
+ break;
1494
+ case "Layout":
1495
+ case 0:
1496
+ e.event = 0;
1497
+ break;
1498
+ case "Custom":
1499
+ case 1:
1500
+ e.event = 1;
1501
+ break;
1502
+ }
1503
+ return i.data != null && (typeof i.data == "string" ? $util.base64.decode(i.data, e.data = $util.newBuffer($util.base64.length(i.data)), 0) : i.data.length >= 0 && (e.data = i.data)), i.compress != null && (e.compress = !!i.compress), i.version != null && (e.version = i.version | 0), e;
1504
+ }, r.toObject = function(i, e) {
1505
+ e || (e = {});
1506
+ let t = {};
1507
+ return e.defaults && (t.event = e.enums === String ? "Layout" : 0, e.bytes === String ? t.data = "" : (t.data = [], e.bytes !== Array && (t.data = $util.newBuffer(t.data))), t.compress = !1, t.version = 0), i.event != null && i.hasOwnProperty("event") && (t.event = e.enums === String ? $root.com.quick.voice.proto.EventType[i.event] === void 0 ? i.event : $root.com.quick.voice.proto.EventType[i.event] : i.event), i.data != null && i.hasOwnProperty("data") && (t.data = e.bytes === String ? $util.base64.encode(i.data, 0, i.data.length) : e.bytes === Array ? Array.prototype.slice.call(i.data) : i.data), i.compress != null && i.hasOwnProperty("compress") && (t.compress = i.compress), i.version != null && i.hasOwnProperty("version") && (t.version = i.version), t;
1508
+ }, r.prototype.toJSON = function() {
1509
+ return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
1510
+ }, r.getTypeUrl = function(i) {
1511
+ return i === void 0 && (i = "type.googleapis.com"), i + "/com.quick.voice.proto.SeiData";
1512
+ }, r;
1513
+ }(), u.EventType = function() {
1514
+ const r = {}, n = Object.create(r);
1515
+ return n[r[0] = "Layout"] = 0, n[r[1] = "Custom"] = 1, n;
1516
+ }(), u.LayoutData = function() {
1517
+ function r(i) {
1518
+ if (this.userMap = {}, i) for (let e = Object.keys(i), t = 0; t < e.length; ++t) i[e[t]] != null && (this[e[t]] = i[e[t]]);
1519
+ }
1520
+ r.prototype.roomId = "", r.prototype.type = 0, r.prototype.userMap = $util.emptyObject, r.prototype.globalCustom = null;
1521
+ let n;
1522
+ return Object.defineProperty(r.prototype, "_globalCustom", {
1523
+ get: $util.oneOfGetter(n = ["globalCustom"]),
1524
+ set: $util.oneOfSetter(n)
1525
+ }), r.create = function(e) {
1526
+ return new r(e);
1527
+ }, r.encode = function(e, t) {
1528
+ if (t || (t = $Writer.create()), e.roomId != null && Object.hasOwnProperty.call(e, "roomId") && t.uint32(
1529
+ /* id 1, wireType 2 =*/
1530
+ 10
1531
+ ).string(e.roomId), e.type != null && Object.hasOwnProperty.call(e, "type") && t.uint32(
1532
+ /* id 2, wireType 0 =*/
1533
+ 16
1534
+ ).int32(e.type), e.userMap != null && Object.hasOwnProperty.call(e, "userMap"))
1535
+ for (let s = Object.keys(e.userMap), l = 0; l < s.length; ++l)
1536
+ t.uint32(
1537
+ /* id 3, wireType 2 =*/
1538
+ 26
1539
+ ).fork().uint32(
1540
+ /* id 1, wireType 2 =*/
1541
+ 10
1542
+ ).string(s[l]), $root.com.quick.voice.proto.UserInfo.encode(e.userMap[s[l]], t.uint32(
1543
+ /* id 2, wireType 2 =*/
1544
+ 18
1545
+ ).fork()).ldelim().ldelim();
1546
+ return e.globalCustom != null && Object.hasOwnProperty.call(e, "globalCustom") && $root.com.quick.voice.proto.CustomInfo.encode(e.globalCustom, t.uint32(
1547
+ /* id 4, wireType 2 =*/
1548
+ 34
1549
+ ).fork()).ldelim(), t;
1550
+ }, r.encodeDelimited = function(e, t) {
1551
+ return this.encode(e, t).ldelim();
1552
+ }, r.decode = function(e, t, s) {
1553
+ e instanceof $Reader || (e = $Reader.create(e));
1554
+ let l = t === void 0 ? e.len : e.pos + t, c = new $root.com.quick.voice.proto.LayoutData(), d, y;
1555
+ for (; e.pos < l; ) {
1556
+ let p = e.uint32();
1557
+ if (p === s) break;
1558
+ switch (p >>> 3) {
1559
+ case 1: {
1560
+ c.roomId = e.string();
1561
+ break;
1562
+ }
1563
+ case 2: {
1564
+ c.type = e.int32();
1565
+ break;
1566
+ }
1567
+ case 3: {
1568
+ c.userMap === $util.emptyObject && (c.userMap = {});
1569
+ let w = e.uint32() + e.pos;
1570
+ for (d = "", y = null; e.pos < w; ) {
1571
+ let b = e.uint32();
1572
+ switch (b >>> 3) {
1573
+ case 1:
1574
+ d = e.string();
1575
+ break;
1576
+ case 2:
1577
+ y = $root.com.quick.voice.proto.UserInfo.decode(e, e.uint32());
1578
+ break;
1579
+ default:
1580
+ e.skipType(b & 7);
1581
+ break;
1582
+ }
1583
+ }
1584
+ c.userMap[d] = y;
1585
+ break;
1586
+ }
1587
+ case 4: {
1588
+ c.globalCustom = $root.com.quick.voice.proto.CustomInfo.decode(e, e.uint32());
1589
+ break;
1590
+ }
1591
+ default:
1592
+ e.skipType(p & 7);
1593
+ break;
1594
+ }
1595
+ }
1596
+ return c;
1597
+ }, r.decodeDelimited = function(e) {
1598
+ return e instanceof $Reader || (e = new $Reader(e)), this.decode(e, e.uint32());
1599
+ }, r.verify = function(e) {
1600
+ if (typeof e != "object" || e === null) return "object expected";
1601
+ if (e.roomId != null && e.hasOwnProperty("roomId") && !$util.isString(e.roomId)) return "roomId: string expected";
1602
+ if (e.type != null && e.hasOwnProperty("type"))
1603
+ switch (e.type) {
1604
+ default:
1605
+ return "type: enum value expected";
1606
+ case 0:
1607
+ case 1:
1608
+ case 2:
1609
+ break;
1610
+ }
1611
+ if (e.userMap != null && e.hasOwnProperty("userMap")) {
1612
+ if (!$util.isObject(e.userMap)) return "userMap: object expected";
1613
+ let t = Object.keys(e.userMap);
1614
+ for (let s = 0; s < t.length; ++s) {
1615
+ let l = $root.com.quick.voice.proto.UserInfo.verify(e.userMap[t[s]]);
1616
+ if (l) return "userMap." + l;
1617
+ }
1618
+ }
1619
+ if (e.globalCustom != null && e.hasOwnProperty("globalCustom")) {
1620
+ let t = $root.com.quick.voice.proto.CustomInfo.verify(e.globalCustom);
1621
+ if (t) return "globalCustom." + t;
1622
+ }
1623
+ return null;
1624
+ }, r.fromObject = function(e) {
1625
+ if (e instanceof $root.com.quick.voice.proto.LayoutData) return e;
1626
+ let t = new $root.com.quick.voice.proto.LayoutData();
1627
+ switch (e.roomId != null && (t.roomId = String(e.roomId)), e.type) {
1628
+ default:
1629
+ if (typeof e.type == "number") {
1630
+ t.type = e.type;
1631
+ break;
1632
+ }
1633
+ break;
1634
+ case "AudioAndVideo":
1635
+ case 0:
1636
+ t.type = 0;
1637
+ break;
1638
+ case "OnlyAudio":
1639
+ case 1:
1640
+ t.type = 1;
1641
+ break;
1642
+ case "OnlyVideo":
1643
+ case 2:
1644
+ t.type = 2;
1645
+ break;
1646
+ }
1647
+ if (e.userMap) {
1648
+ if (typeof e.userMap != "object") throw TypeError(".com.quick.voice.proto.LayoutData.userMap: object expected");
1649
+ t.userMap = {};
1650
+ for (let s = Object.keys(e.userMap), l = 0; l < s.length; ++l) {
1651
+ if (typeof e.userMap[s[l]] != "object") throw TypeError(".com.quick.voice.proto.LayoutData.userMap: object expected");
1652
+ t.userMap[s[l]] = $root.com.quick.voice.proto.UserInfo.fromObject(e.userMap[s[l]]);
1653
+ }
1654
+ }
1655
+ if (e.globalCustom != null) {
1656
+ if (typeof e.globalCustom != "object") throw TypeError(".com.quick.voice.proto.LayoutData.globalCustom: object expected");
1657
+ t.globalCustom = $root.com.quick.voice.proto.CustomInfo.fromObject(e.globalCustom);
1658
+ }
1659
+ return t;
1660
+ }, r.toObject = function(e, t) {
1661
+ t || (t = {});
1662
+ let s = {};
1663
+ (t.objects || t.defaults) && (s.userMap = {}), t.defaults && (s.roomId = "", s.type = t.enums === String ? "AudioAndVideo" : 0), e.roomId != null && e.hasOwnProperty("roomId") && (s.roomId = e.roomId), e.type != null && e.hasOwnProperty("type") && (s.type = t.enums === String ? $root.com.quick.voice.proto.LayoutType[e.type] === void 0 ? e.type : $root.com.quick.voice.proto.LayoutType[e.type] : e.type);
1664
+ let l;
1665
+ if (e.userMap && (l = Object.keys(e.userMap)).length) {
1666
+ s.userMap = {};
1667
+ for (let c = 0; c < l.length; ++c) s.userMap[l[c]] = $root.com.quick.voice.proto.UserInfo.toObject(e.userMap[l[c]], t);
1668
+ }
1669
+ return e.globalCustom != null && e.hasOwnProperty("globalCustom") && (s.globalCustom = $root.com.quick.voice.proto.CustomInfo.toObject(e.globalCustom, t), t.oneofs && (s._globalCustom = "globalCustom")), s;
1670
+ }, r.prototype.toJSON = function() {
1671
+ return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
1672
+ }, r.getTypeUrl = function(e) {
1673
+ return e === void 0 && (e = "type.googleapis.com"), e + "/com.quick.voice.proto.LayoutData";
1674
+ }, r;
1675
+ }(), u.UserInfo = function() {
1676
+ function r(i) {
1677
+ if (this.audios = [], this.videos = [], i) for (let e = Object.keys(i), t = 0; t < e.length; ++t) i[e[t]] != null && (this[e[t]] = i[e[t]]);
1678
+ }
1679
+ r.prototype.id = "", r.prototype.audios = $util.emptyArray, r.prototype.videos = $util.emptyArray, r.prototype.custom = null;
1680
+ let n;
1681
+ return Object.defineProperty(r.prototype, "_custom", {
1682
+ get: $util.oneOfGetter(n = ["custom"]),
1683
+ set: $util.oneOfSetter(n)
1684
+ }), r.create = function(e) {
1685
+ return new r(e);
1686
+ }, r.encode = function(e, t) {
1687
+ if (t || (t = $Writer.create()), e.id != null && Object.hasOwnProperty.call(e, "id") && t.uint32(
1688
+ /* id 1, wireType 2 =*/
1689
+ 10
1690
+ ).string(e.id), e.audios != null && e.audios.length) for (let s = 0; s < e.audios.length; ++s) $root.com.quick.voice.proto.AudioInfo.encode(e.audios[s], t.uint32(
1691
+ /* id 2, wireType 2 =*/
1692
+ 18
1693
+ ).fork()).ldelim();
1694
+ if (e.videos != null && e.videos.length) for (let s = 0; s < e.videos.length; ++s) $root.com.quick.voice.proto.VideoInfo.encode(e.videos[s], t.uint32(
1695
+ /* id 3, wireType 2 =*/
1696
+ 26
1697
+ ).fork()).ldelim();
1698
+ return e.custom != null && Object.hasOwnProperty.call(e, "custom") && $root.com.quick.voice.proto.CustomInfo.encode(e.custom, t.uint32(
1699
+ /* id 4, wireType 2 =*/
1700
+ 34
1701
+ ).fork()).ldelim(), t;
1702
+ }, r.encodeDelimited = function(e, t) {
1703
+ return this.encode(e, t).ldelim();
1704
+ }, r.decode = function(e, t, s) {
1705
+ e instanceof $Reader || (e = $Reader.create(e));
1706
+ let l = t === void 0 ? e.len : e.pos + t, c = new $root.com.quick.voice.proto.UserInfo();
1707
+ for (; e.pos < l; ) {
1708
+ let d = e.uint32();
1709
+ if (d === s) break;
1710
+ switch (d >>> 3) {
1711
+ case 1: {
1712
+ c.id = e.string();
1713
+ break;
1714
+ }
1715
+ case 2: {
1716
+ c.audios && c.audios.length || (c.audios = []), c.audios.push($root.com.quick.voice.proto.AudioInfo.decode(e, e.uint32()));
1717
+ break;
1718
+ }
1719
+ case 3: {
1720
+ c.videos && c.videos.length || (c.videos = []), c.videos.push($root.com.quick.voice.proto.VideoInfo.decode(e, e.uint32()));
1721
+ break;
1722
+ }
1723
+ case 4: {
1724
+ c.custom = $root.com.quick.voice.proto.CustomInfo.decode(e, e.uint32());
1725
+ break;
1726
+ }
1727
+ default:
1728
+ e.skipType(d & 7);
1729
+ break;
1730
+ }
1731
+ }
1732
+ return c;
1733
+ }, r.decodeDelimited = function(e) {
1734
+ return e instanceof $Reader || (e = new $Reader(e)), this.decode(e, e.uint32());
1735
+ }, r.verify = function(e) {
1736
+ if (typeof e != "object" || e === null) return "object expected";
1737
+ if (e.id != null && e.hasOwnProperty("id") && !$util.isString(e.id)) return "id: string expected";
1738
+ if (e.audios != null && e.hasOwnProperty("audios")) {
1739
+ if (!Array.isArray(e.audios)) return "audios: array expected";
1740
+ for (let t = 0; t < e.audios.length; ++t) {
1741
+ let s = $root.com.quick.voice.proto.AudioInfo.verify(e.audios[t]);
1742
+ if (s) return "audios." + s;
1743
+ }
1744
+ }
1745
+ if (e.videos != null && e.hasOwnProperty("videos")) {
1746
+ if (!Array.isArray(e.videos)) return "videos: array expected";
1747
+ for (let t = 0; t < e.videos.length; ++t) {
1748
+ let s = $root.com.quick.voice.proto.VideoInfo.verify(e.videos[t]);
1749
+ if (s) return "videos." + s;
1750
+ }
1751
+ }
1752
+ if (e.custom != null && e.hasOwnProperty("custom")) {
1753
+ let t = $root.com.quick.voice.proto.CustomInfo.verify(e.custom);
1754
+ if (t) return "custom." + t;
1755
+ }
1756
+ return null;
1757
+ }, r.fromObject = function(e) {
1758
+ if (e instanceof $root.com.quick.voice.proto.UserInfo) return e;
1759
+ let t = new $root.com.quick.voice.proto.UserInfo();
1760
+ if (e.id != null && (t.id = String(e.id)), e.audios) {
1761
+ if (!Array.isArray(e.audios)) throw TypeError(".com.quick.voice.proto.UserInfo.audios: array expected");
1762
+ t.audios = [];
1763
+ for (let s = 0; s < e.audios.length; ++s) {
1764
+ if (typeof e.audios[s] != "object") throw TypeError(".com.quick.voice.proto.UserInfo.audios: object expected");
1765
+ t.audios[s] = $root.com.quick.voice.proto.AudioInfo.fromObject(e.audios[s]);
1766
+ }
1767
+ }
1768
+ if (e.videos) {
1769
+ if (!Array.isArray(e.videos)) throw TypeError(".com.quick.voice.proto.UserInfo.videos: array expected");
1770
+ t.videos = [];
1771
+ for (let s = 0; s < e.videos.length; ++s) {
1772
+ if (typeof e.videos[s] != "object") throw TypeError(".com.quick.voice.proto.UserInfo.videos: object expected");
1773
+ t.videos[s] = $root.com.quick.voice.proto.VideoInfo.fromObject(e.videos[s]);
1774
+ }
1775
+ }
1776
+ if (e.custom != null) {
1777
+ if (typeof e.custom != "object") throw TypeError(".com.quick.voice.proto.UserInfo.custom: object expected");
1778
+ t.custom = $root.com.quick.voice.proto.CustomInfo.fromObject(e.custom);
1779
+ }
1780
+ return t;
1781
+ }, r.toObject = function(e, t) {
1782
+ t || (t = {});
1783
+ let s = {};
1784
+ if ((t.arrays || t.defaults) && (s.audios = [], s.videos = []), t.defaults && (s.id = ""), e.id != null && e.hasOwnProperty("id") && (s.id = e.id), e.audios && e.audios.length) {
1785
+ s.audios = [];
1786
+ for (let l = 0; l < e.audios.length; ++l) s.audios[l] = $root.com.quick.voice.proto.AudioInfo.toObject(e.audios[l], t);
1787
+ }
1788
+ if (e.videos && e.videos.length) {
1789
+ s.videos = [];
1790
+ for (let l = 0; l < e.videos.length; ++l) s.videos[l] = $root.com.quick.voice.proto.VideoInfo.toObject(e.videos[l], t);
1791
+ }
1792
+ return e.custom != null && e.hasOwnProperty("custom") && (s.custom = $root.com.quick.voice.proto.CustomInfo.toObject(e.custom, t), t.oneofs && (s._custom = "custom")), s;
1793
+ }, r.prototype.toJSON = function() {
1794
+ return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
1795
+ }, r.getTypeUrl = function(e) {
1796
+ return e === void 0 && (e = "type.googleapis.com"), e + "/com.quick.voice.proto.UserInfo";
1797
+ }, r;
1798
+ }(), u.AudioInfo = function() {
1799
+ function r(i) {
1800
+ if (i) for (let e = Object.keys(i), t = 0; t < e.length; ++t) i[e[t]] != null && (this[e[t]] = i[e[t]]);
1801
+ }
1802
+ r.prototype.type = 0, r.prototype.isEnable = !1, r.prototype.isMute = !1, r.prototype.volume = 0, r.prototype.updateTime = null;
1803
+ let n;
1804
+ return Object.defineProperty(r.prototype, "_updateTime", {
1805
+ get: $util.oneOfGetter(n = ["updateTime"]),
1806
+ set: $util.oneOfSetter(n)
1807
+ }), r.create = function(e) {
1808
+ return new r(e);
1809
+ }, r.encode = function(e, t) {
1810
+ return t || (t = $Writer.create()), e.type != null && Object.hasOwnProperty.call(e, "type") && t.uint32(
1811
+ /* id 1, wireType 0 =*/
1812
+ 8
1813
+ ).int32(e.type), e.isEnable != null && Object.hasOwnProperty.call(e, "isEnable") && t.uint32(
1814
+ /* id 2, wireType 0 =*/
1815
+ 16
1816
+ ).bool(e.isEnable), e.isMute != null && Object.hasOwnProperty.call(e, "isMute") && t.uint32(
1817
+ /* id 3, wireType 0 =*/
1818
+ 24
1819
+ ).bool(e.isMute), e.volume != null && Object.hasOwnProperty.call(e, "volume") && t.uint32(
1820
+ /* id 4, wireType 1 =*/
1821
+ 33
1822
+ ).double(e.volume), e.updateTime != null && Object.hasOwnProperty.call(e, "updateTime") && t.uint32(
1823
+ /* id 5, wireType 0 =*/
1824
+ 40
1825
+ ).int64(e.updateTime), t;
1826
+ }, r.encodeDelimited = function(e, t) {
1827
+ return this.encode(e, t).ldelim();
1828
+ }, r.decode = function(e, t, s) {
1829
+ e instanceof $Reader || (e = $Reader.create(e));
1830
+ let l = t === void 0 ? e.len : e.pos + t, c = new $root.com.quick.voice.proto.AudioInfo();
1831
+ for (; e.pos < l; ) {
1832
+ let d = e.uint32();
1833
+ if (d === s) break;
1834
+ switch (d >>> 3) {
1835
+ case 1: {
1836
+ c.type = e.int32();
1837
+ break;
1838
+ }
1839
+ case 2: {
1840
+ c.isEnable = e.bool();
1841
+ break;
1842
+ }
1843
+ case 3: {
1844
+ c.isMute = e.bool();
1845
+ break;
1846
+ }
1847
+ case 4: {
1848
+ c.volume = e.double();
1849
+ break;
1850
+ }
1851
+ case 5: {
1852
+ c.updateTime = e.int64();
1853
+ break;
1854
+ }
1855
+ default:
1856
+ e.skipType(d & 7);
1857
+ break;
1858
+ }
1859
+ }
1860
+ return c;
1861
+ }, r.decodeDelimited = function(e) {
1862
+ return e instanceof $Reader || (e = new $Reader(e)), this.decode(e, e.uint32());
1863
+ }, r.verify = function(e) {
1864
+ if (typeof e != "object" || e === null) return "object expected";
1865
+ if (e.type != null && e.hasOwnProperty("type"))
1866
+ switch (e.type) {
1867
+ default:
1868
+ return "type: enum value expected";
1869
+ case 0:
1870
+ case 1:
1871
+ break;
1872
+ }
1873
+ return e.isEnable != null && e.hasOwnProperty("isEnable") && typeof e.isEnable != "boolean" ? "isEnable: boolean expected" : e.isMute != null && e.hasOwnProperty("isMute") && typeof e.isMute != "boolean" ? "isMute: boolean expected" : e.volume != null && e.hasOwnProperty("volume") && typeof e.volume != "number" ? "volume: number expected" : e.updateTime != null && e.hasOwnProperty("updateTime") && !$util.isInteger(e.updateTime) && !(e.updateTime && $util.isInteger(e.updateTime.low) && $util.isInteger(e.updateTime.high)) ? "updateTime: integer|Long expected" : null;
1874
+ }, r.fromObject = function(e) {
1875
+ if (e instanceof $root.com.quick.voice.proto.AudioInfo) return e;
1876
+ let t = new $root.com.quick.voice.proto.AudioInfo();
1877
+ switch (e.type) {
1878
+ default:
1879
+ if (typeof e.type == "number") {
1880
+ t.type = e.type;
1881
+ break;
1882
+ }
1883
+ break;
1884
+ case "Microphone":
1885
+ case 0:
1886
+ t.type = 0;
1887
+ break;
1888
+ case "SystemVoice":
1889
+ case 1:
1890
+ t.type = 1;
1891
+ break;
1892
+ }
1893
+ return e.isEnable != null && (t.isEnable = !!e.isEnable), e.isMute != null && (t.isMute = !!e.isMute), e.volume != null && (t.volume = Number(e.volume)), e.updateTime != null && ($util.Long ? (t.updateTime = $util.Long.fromValue(e.updateTime)).unsigned = !1 : typeof e.updateTime == "string" ? t.updateTime = parseInt(e.updateTime, 10) : typeof e.updateTime == "number" ? t.updateTime = e.updateTime : typeof e.updateTime == "object" && (t.updateTime = new $util.LongBits(e.updateTime.low >>> 0, e.updateTime.high >>> 0).toNumber())), t;
1894
+ }, r.toObject = function(e, t) {
1895
+ t || (t = {});
1896
+ let s = {};
1897
+ return t.defaults && (s.type = t.enums === String ? "Microphone" : 0, s.isEnable = !1, s.isMute = !1, s.volume = 0), e.type != null && e.hasOwnProperty("type") && (s.type = t.enums === String ? $root.com.quick.voice.proto.AudioType[e.type] === void 0 ? e.type : $root.com.quick.voice.proto.AudioType[e.type] : e.type), e.isEnable != null && e.hasOwnProperty("isEnable") && (s.isEnable = e.isEnable), e.isMute != null && e.hasOwnProperty("isMute") && (s.isMute = e.isMute), e.volume != null && e.hasOwnProperty("volume") && (s.volume = t.json && !isFinite(e.volume) ? String(e.volume) : e.volume), e.updateTime != null && e.hasOwnProperty("updateTime") && (typeof e.updateTime == "number" ? s.updateTime = t.longs === String ? String(e.updateTime) : e.updateTime : s.updateTime = t.longs === String ? $util.Long.prototype.toString.call(e.updateTime) : t.longs === Number ? new $util.LongBits(e.updateTime.low >>> 0, e.updateTime.high >>> 0).toNumber() : e.updateTime, t.oneofs && (s._updateTime = "updateTime")), s;
1898
+ }, r.prototype.toJSON = function() {
1899
+ return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
1900
+ }, r.getTypeUrl = function(e) {
1901
+ return e === void 0 && (e = "type.googleapis.com"), e + "/com.quick.voice.proto.AudioInfo";
1902
+ }, r;
1903
+ }(), u.VideoInfo = function() {
1904
+ function r(i) {
1905
+ if (i) for (let e = Object.keys(i), t = 0; t < e.length; ++t) i[e[t]] != null && (this[e[t]] = i[e[t]]);
1906
+ }
1907
+ r.prototype.type = 0, r.prototype.isEnable = !1, r.prototype.isMute = !1, r.prototype.width = 0, r.prototype.height = 0, r.prototype.x = 0, r.prototype.y = 0, r.prototype.updateTime = null;
1908
+ let n;
1909
+ return Object.defineProperty(r.prototype, "_updateTime", {
1910
+ get: $util.oneOfGetter(n = ["updateTime"]),
1911
+ set: $util.oneOfSetter(n)
1912
+ }), r.create = function(e) {
1913
+ return new r(e);
1914
+ }, r.encode = function(e, t) {
1915
+ return t || (t = $Writer.create()), e.type != null && Object.hasOwnProperty.call(e, "type") && t.uint32(
1916
+ /* id 1, wireType 0 =*/
1917
+ 8
1918
+ ).int32(e.type), e.isEnable != null && Object.hasOwnProperty.call(e, "isEnable") && t.uint32(
1919
+ /* id 2, wireType 0 =*/
1920
+ 16
1921
+ ).bool(e.isEnable), e.isMute != null && Object.hasOwnProperty.call(e, "isMute") && t.uint32(
1922
+ /* id 3, wireType 0 =*/
1923
+ 24
1924
+ ).bool(e.isMute), e.width != null && Object.hasOwnProperty.call(e, "width") && t.uint32(
1925
+ /* id 4, wireType 0 =*/
1926
+ 32
1927
+ ).int32(e.width), e.height != null && Object.hasOwnProperty.call(e, "height") && t.uint32(
1928
+ /* id 5, wireType 0 =*/
1929
+ 40
1930
+ ).int32(e.height), e.x != null && Object.hasOwnProperty.call(e, "x") && t.uint32(
1931
+ /* id 6, wireType 0 =*/
1932
+ 48
1933
+ ).int32(e.x), e.y != null && Object.hasOwnProperty.call(e, "y") && t.uint32(
1934
+ /* id 7, wireType 0 =*/
1935
+ 56
1936
+ ).int32(e.y), e.updateTime != null && Object.hasOwnProperty.call(e, "updateTime") && t.uint32(
1937
+ /* id 8, wireType 0 =*/
1938
+ 64
1939
+ ).int64(e.updateTime), t;
1940
+ }, r.encodeDelimited = function(e, t) {
1941
+ return this.encode(e, t).ldelim();
1942
+ }, r.decode = function(e, t, s) {
1943
+ e instanceof $Reader || (e = $Reader.create(e));
1944
+ let l = t === void 0 ? e.len : e.pos + t, c = new $root.com.quick.voice.proto.VideoInfo();
1945
+ for (; e.pos < l; ) {
1946
+ let d = e.uint32();
1947
+ if (d === s) break;
1948
+ switch (d >>> 3) {
1949
+ case 1: {
1950
+ c.type = e.int32();
1951
+ break;
1952
+ }
1953
+ case 2: {
1954
+ c.isEnable = e.bool();
1955
+ break;
1956
+ }
1957
+ case 3: {
1958
+ c.isMute = e.bool();
1959
+ break;
1960
+ }
1961
+ case 4: {
1962
+ c.width = e.int32();
1963
+ break;
1964
+ }
1965
+ case 5: {
1966
+ c.height = e.int32();
1967
+ break;
1968
+ }
1969
+ case 6: {
1970
+ c.x = e.int32();
1971
+ break;
1972
+ }
1973
+ case 7: {
1974
+ c.y = e.int32();
1975
+ break;
1976
+ }
1977
+ case 8: {
1978
+ c.updateTime = e.int64();
1979
+ break;
1980
+ }
1981
+ default:
1982
+ e.skipType(d & 7);
1983
+ break;
1984
+ }
1985
+ }
1986
+ return c;
1987
+ }, r.decodeDelimited = function(e) {
1988
+ return e instanceof $Reader || (e = new $Reader(e)), this.decode(e, e.uint32());
1989
+ }, r.verify = function(e) {
1990
+ if (typeof e != "object" || e === null) return "object expected";
1991
+ if (e.type != null && e.hasOwnProperty("type"))
1992
+ switch (e.type) {
1993
+ default:
1994
+ return "type: enum value expected";
1995
+ case 0:
1996
+ case 1:
1997
+ break;
1998
+ }
1999
+ return e.isEnable != null && e.hasOwnProperty("isEnable") && typeof e.isEnable != "boolean" ? "isEnable: boolean expected" : e.isMute != null && e.hasOwnProperty("isMute") && typeof e.isMute != "boolean" ? "isMute: boolean expected" : e.width != null && e.hasOwnProperty("width") && !$util.isInteger(e.width) ? "width: integer expected" : e.height != null && e.hasOwnProperty("height") && !$util.isInteger(e.height) ? "height: integer expected" : e.x != null && e.hasOwnProperty("x") && !$util.isInteger(e.x) ? "x: integer expected" : e.y != null && e.hasOwnProperty("y") && !$util.isInteger(e.y) ? "y: integer expected" : e.updateTime != null && e.hasOwnProperty("updateTime") && !$util.isInteger(e.updateTime) && !(e.updateTime && $util.isInteger(e.updateTime.low) && $util.isInteger(e.updateTime.high)) ? "updateTime: integer|Long expected" : null;
2000
+ }, r.fromObject = function(e) {
2001
+ if (e instanceof $root.com.quick.voice.proto.VideoInfo) return e;
2002
+ let t = new $root.com.quick.voice.proto.VideoInfo();
2003
+ switch (e.type) {
2004
+ default:
2005
+ if (typeof e.type == "number") {
2006
+ t.type = e.type;
2007
+ break;
2008
+ }
2009
+ break;
2010
+ case "Camera":
2011
+ case 0:
2012
+ t.type = 0;
2013
+ break;
2014
+ case "Screen":
2015
+ case 1:
2016
+ t.type = 1;
2017
+ break;
2018
+ }
2019
+ return e.isEnable != null && (t.isEnable = !!e.isEnable), e.isMute != null && (t.isMute = !!e.isMute), e.width != null && (t.width = e.width | 0), e.height != null && (t.height = e.height | 0), e.x != null && (t.x = e.x | 0), e.y != null && (t.y = e.y | 0), e.updateTime != null && ($util.Long ? (t.updateTime = $util.Long.fromValue(e.updateTime)).unsigned = !1 : typeof e.updateTime == "string" ? t.updateTime = parseInt(e.updateTime, 10) : typeof e.updateTime == "number" ? t.updateTime = e.updateTime : typeof e.updateTime == "object" && (t.updateTime = new $util.LongBits(e.updateTime.low >>> 0, e.updateTime.high >>> 0).toNumber())), t;
2020
+ }, r.toObject = function(e, t) {
2021
+ t || (t = {});
2022
+ let s = {};
2023
+ return t.defaults && (s.type = t.enums === String ? "Camera" : 0, s.isEnable = !1, s.isMute = !1, s.width = 0, s.height = 0, s.x = 0, s.y = 0), e.type != null && e.hasOwnProperty("type") && (s.type = t.enums === String ? $root.com.quick.voice.proto.VideoType[e.type] === void 0 ? e.type : $root.com.quick.voice.proto.VideoType[e.type] : e.type), e.isEnable != null && e.hasOwnProperty("isEnable") && (s.isEnable = e.isEnable), e.isMute != null && e.hasOwnProperty("isMute") && (s.isMute = e.isMute), e.width != null && e.hasOwnProperty("width") && (s.width = e.width), e.height != null && e.hasOwnProperty("height") && (s.height = e.height), e.x != null && e.hasOwnProperty("x") && (s.x = e.x), e.y != null && e.hasOwnProperty("y") && (s.y = e.y), e.updateTime != null && e.hasOwnProperty("updateTime") && (typeof e.updateTime == "number" ? s.updateTime = t.longs === String ? String(e.updateTime) : e.updateTime : s.updateTime = t.longs === String ? $util.Long.prototype.toString.call(e.updateTime) : t.longs === Number ? new $util.LongBits(e.updateTime.low >>> 0, e.updateTime.high >>> 0).toNumber() : e.updateTime, t.oneofs && (s._updateTime = "updateTime")), s;
2024
+ }, r.prototype.toJSON = function() {
2025
+ return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
2026
+ }, r.getTypeUrl = function(e) {
2027
+ return e === void 0 && (e = "type.googleapis.com"), e + "/com.quick.voice.proto.VideoInfo";
2028
+ }, r;
2029
+ }(), u.CustomInfo = function() {
2030
+ function r(i) {
2031
+ if (this.customKeyMap = {}, i) for (let e = Object.keys(i), t = 0; t < e.length; ++t) i[e[t]] != null && (this[e[t]] = i[e[t]]);
2032
+ }
2033
+ r.prototype.roomId = "", r.prototype.customKeyMap = $util.emptyObject, r.prototype.updateTime = null;
2034
+ let n;
2035
+ return Object.defineProperty(r.prototype, "_updateTime", {
2036
+ get: $util.oneOfGetter(n = ["updateTime"]),
2037
+ set: $util.oneOfSetter(n)
2038
+ }), r.create = function(e) {
2039
+ return new r(e);
2040
+ }, r.encode = function(e, t) {
2041
+ if (t || (t = $Writer.create()), e.roomId != null && Object.hasOwnProperty.call(e, "roomId") && t.uint32(
2042
+ /* id 1, wireType 2 =*/
2043
+ 10
2044
+ ).string(e.roomId), e.customKeyMap != null && Object.hasOwnProperty.call(e, "customKeyMap")) for (let s = Object.keys(e.customKeyMap), l = 0; l < s.length; ++l) t.uint32(
2045
+ /* id 2, wireType 2 =*/
2046
+ 18
2047
+ ).fork().uint32(
2048
+ /* id 1, wireType 2 =*/
2049
+ 10
2050
+ ).string(s[l]).uint32(
2051
+ /* id 2, wireType 2 =*/
2052
+ 18
2053
+ ).string(e.customKeyMap[s[l]]).ldelim();
2054
+ return e.updateTime != null && Object.hasOwnProperty.call(e, "updateTime") && t.uint32(
2055
+ /* id 3, wireType 0 =*/
2056
+ 24
2057
+ ).int64(e.updateTime), t;
2058
+ }, r.encodeDelimited = function(e, t) {
2059
+ return this.encode(e, t).ldelim();
2060
+ }, r.decode = function(e, t, s) {
2061
+ e instanceof $Reader || (e = $Reader.create(e));
2062
+ let l = t === void 0 ? e.len : e.pos + t, c = new $root.com.quick.voice.proto.CustomInfo(), d, y;
2063
+ for (; e.pos < l; ) {
2064
+ let p = e.uint32();
2065
+ if (p === s) break;
2066
+ switch (p >>> 3) {
2067
+ case 1: {
2068
+ c.roomId = e.string();
2069
+ break;
2070
+ }
2071
+ case 2: {
2072
+ c.customKeyMap === $util.emptyObject && (c.customKeyMap = {});
2073
+ let w = e.uint32() + e.pos;
2074
+ for (d = "", y = ""; e.pos < w; ) {
2075
+ let b = e.uint32();
2076
+ switch (b >>> 3) {
2077
+ case 1:
2078
+ d = e.string();
2079
+ break;
2080
+ case 2:
2081
+ y = e.string();
2082
+ break;
2083
+ default:
2084
+ e.skipType(b & 7);
2085
+ break;
2086
+ }
2087
+ }
2088
+ c.customKeyMap[d] = y;
2089
+ break;
2090
+ }
2091
+ case 3: {
2092
+ c.updateTime = e.int64();
2093
+ break;
2094
+ }
2095
+ default:
2096
+ e.skipType(p & 7);
2097
+ break;
2098
+ }
2099
+ }
2100
+ return c;
2101
+ }, r.decodeDelimited = function(e) {
2102
+ return e instanceof $Reader || (e = new $Reader(e)), this.decode(e, e.uint32());
2103
+ }, r.verify = function(e) {
2104
+ if (typeof e != "object" || e === null) return "object expected";
2105
+ if (e.roomId != null && e.hasOwnProperty("roomId") && !$util.isString(e.roomId)) return "roomId: string expected";
2106
+ if (e.customKeyMap != null && e.hasOwnProperty("customKeyMap")) {
2107
+ if (!$util.isObject(e.customKeyMap)) return "customKeyMap: object expected";
2108
+ let t = Object.keys(e.customKeyMap);
2109
+ for (let s = 0; s < t.length; ++s) if (!$util.isString(e.customKeyMap[t[s]])) return "customKeyMap: string{k:string} expected";
2110
+ }
2111
+ return e.updateTime != null && e.hasOwnProperty("updateTime") && !$util.isInteger(e.updateTime) && !(e.updateTime && $util.isInteger(e.updateTime.low) && $util.isInteger(e.updateTime.high)) ? "updateTime: integer|Long expected" : null;
2112
+ }, r.fromObject = function(e) {
2113
+ if (e instanceof $root.com.quick.voice.proto.CustomInfo) return e;
2114
+ let t = new $root.com.quick.voice.proto.CustomInfo();
2115
+ if (e.roomId != null && (t.roomId = String(e.roomId)), e.customKeyMap) {
2116
+ if (typeof e.customKeyMap != "object") throw TypeError(".com.quick.voice.proto.CustomInfo.customKeyMap: object expected");
2117
+ t.customKeyMap = {};
2118
+ for (let s = Object.keys(e.customKeyMap), l = 0; l < s.length; ++l) t.customKeyMap[s[l]] = String(e.customKeyMap[s[l]]);
2119
+ }
2120
+ return e.updateTime != null && ($util.Long ? (t.updateTime = $util.Long.fromValue(e.updateTime)).unsigned = !1 : typeof e.updateTime == "string" ? t.updateTime = parseInt(e.updateTime, 10) : typeof e.updateTime == "number" ? t.updateTime = e.updateTime : typeof e.updateTime == "object" && (t.updateTime = new $util.LongBits(e.updateTime.low >>> 0, e.updateTime.high >>> 0).toNumber())), t;
2121
+ }, r.toObject = function(e, t) {
2122
+ t || (t = {});
2123
+ let s = {};
2124
+ (t.objects || t.defaults) && (s.customKeyMap = {}), t.defaults && (s.roomId = ""), e.roomId != null && e.hasOwnProperty("roomId") && (s.roomId = e.roomId);
2125
+ let l;
2126
+ if (e.customKeyMap && (l = Object.keys(e.customKeyMap)).length) {
2127
+ s.customKeyMap = {};
2128
+ for (let c = 0; c < l.length; ++c) s.customKeyMap[l[c]] = e.customKeyMap[l[c]];
2129
+ }
2130
+ return e.updateTime != null && e.hasOwnProperty("updateTime") && (typeof e.updateTime == "number" ? s.updateTime = t.longs === String ? String(e.updateTime) : e.updateTime : s.updateTime = t.longs === String ? $util.Long.prototype.toString.call(e.updateTime) : t.longs === Number ? new $util.LongBits(e.updateTime.low >>> 0, e.updateTime.high >>> 0).toNumber() : e.updateTime, t.oneofs && (s._updateTime = "updateTime")), s;
2131
+ }, r.prototype.toJSON = function() {
2132
+ return this.constructor.toObject(this, minimalExports.util.toJSONOptions);
2133
+ }, r.getTypeUrl = function(e) {
2134
+ return e === void 0 && (e = "type.googleapis.com"), e + "/com.quick.voice.proto.CustomInfo";
2135
+ }, r;
2136
+ }(), u.LayoutType = function() {
2137
+ const r = {}, n = Object.create(r);
2138
+ return n[r[0] = "AudioAndVideo"] = 0, n[r[1] = "OnlyAudio"] = 1, n[r[2] = "OnlyVideo"] = 2, n;
2139
+ }(), u.AudioType = function() {
2140
+ const r = {}, n = Object.create(r);
2141
+ return n[r[0] = "Microphone"] = 0, n[r[1] = "SystemVoice"] = 1, n;
2142
+ }(), u.VideoType = function() {
2143
+ const r = {}, n = Object.create(r);
2144
+ return n[r[0] = "Camera"] = 0, n[r[1] = "Screen"] = 1, n;
2145
+ }(), u;
2146
+ }(), a;
2147
+ }(), o;
2148
+ }(), f;
2149
+ })(), createAudioInfo = () => ({
2150
+ remove: !1,
2151
+ isEnable: !1,
2152
+ updateTime: 0,
2153
+ isMute: !1,
2154
+ volume: 0
2155
+ }), createVideoInfo = () => ({
2156
+ remove: !1,
2157
+ isEnable: !1,
2158
+ updateTime: 0,
2159
+ isMute: !1,
2160
+ sx: 0,
2161
+ sy: 0,
2162
+ sw: 0,
2163
+ sh: 0
2164
+ });
2165
+ class RoomUser {
2166
+ constructor() {
2167
+ v(this, "userId", "");
2168
+ v(this, "mc_audio");
2169
+ // 麦克风
2170
+ v(this, "mc_video");
2171
+ // 摄像头
2172
+ v(this, "ss_audio");
2173
+ // 屏幕共享视频
2174
+ v(this, "ss_video");
2175
+ // 屏幕共享音频
2176
+ v(this, "updateTime", 0);
2177
+ v(this, "getUpdateTimeKey", () => {
2178
+ const o = [];
2179
+ return this.mc_audio && o.push(this.mc_audio.updateTime), this.mc_video && o.push(this.mc_video.updateTime), this.ss_audio && o.push(this.ss_audio.updateTime), this.ss_video && o.push(this.ss_video.updateTime), o.join("_");
2180
+ });
2181
+ v(this, "init", (o) => {
2182
+ var e, t, s, l;
2183
+ const { id: a, audios: u = [], videos: r = [] } = o;
2184
+ this.userId = a;
2185
+ const n = this.getUpdateTimeKey();
2186
+ 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);
2187
+ for (const c of u) {
2188
+ const { type: d = 0, isEnable: y = !1, isMute: p = !1, updateTime: w, volume: b = 0 } = c;
2189
+ switch (d) {
2190
+ case 0:
2191
+ {
2192
+ if (this.mc_audio || (this.mc_audio = createAudioInfo()), this.mc_audio.remove = !1, this.mc_audio.updateTime === w) break;
2193
+ this.mc_audio.isEnable = !!y, this.mc_audio.isMute = !!p, this.mc_audio.updateTime = Number(w), this.mc_audio.volume = Number(b);
2194
+ }
2195
+ break;
2196
+ case 1:
2197
+ {
2198
+ if (this.ss_audio || (this.ss_audio = createAudioInfo()), this.ss_audio.remove = !1, this.ss_audio.updateTime === w) break;
2199
+ this.ss_audio.isEnable = !!y, this.ss_audio.isMute = !!p, this.ss_audio.updateTime = Number(w), this.ss_audio.volume = Number(b);
2200
+ }
2201
+ break;
2202
+ }
2203
+ }
2204
+ for (const c of r) {
2205
+ const { type: d = 0, isEnable: y, isMute: p, updateTime: w, width: b, height: m, x: g, y: k } = c;
2206
+ switch (d) {
2207
+ case 0:
2208
+ {
2209
+ if (this.mc_video || (this.mc_video = createVideoInfo()), this.mc_video.remove = !1, this.mc_video.updateTime === w) break;
2210
+ this.mc_video.isEnable = !!y, this.mc_video.isMute = !!p, this.mc_video.updateTime = Number(w) || 0, this.mc_video.sx = g || 0, this.mc_video.sy = k || 0, this.mc_video.sw = b || 0, this.mc_video.sh = m || 0;
2211
+ }
2212
+ break;
2213
+ case 1:
2214
+ {
2215
+ if (this.ss_video || (this.ss_video = createVideoInfo()), this.ss_video.remove = !1, this.ss_video.updateTime === w) break;
2216
+ this.ss_video.isEnable = !!y, this.ss_video.isMute = !!p, this.ss_video.updateTime = Number(w) || 0, this.ss_video.sx = g || 0, this.ss_video.sy = k || 0, this.ss_video.sw = b || 0, this.ss_video.sh = m || 0;
2217
+ }
2218
+ break;
2219
+ }
2220
+ }
2221
+ (e = this.mc_audio) != null && e.remove && (this.mc_audio = void 0), (t = this.mc_video) != null && t.remove && (this.mc_video = void 0), (s = this.ss_audio) != null && s.remove && (this.ss_audio = void 0), (l = this.ss_video) != null && l.remove && (this.ss_video = void 0);
2222
+ const i = this.getUpdateTimeKey();
2223
+ n !== i && (this.updateTime = (/* @__PURE__ */ new Date()).getTime());
2224
+ });
2225
+ v(this, "destroy", () => {
2226
+ var o, a;
2227
+ (o = this.mc_video) != null && o.destroy && this.mc_video.destroy(), (a = this.ss_video) != null && a.destroy && this.ss_video.destroy(), this.mc_audio = void 0, this.mc_video = void 0, this.ss_audio = void 0, this.ss_video = void 0;
2228
+ });
2229
+ }
2230
+ }
2231
+ const parseSEI = (f) => {
2232
+ let o = 0, a = 0;
2233
+ for (; ; ) {
2234
+ const r = f[o];
2235
+ if (a = a + r, o = o + 1, r !== 255) break;
2236
+ }
2237
+ let u = 0;
2238
+ for (; ; ) {
2239
+ const r = f[o];
2240
+ if (u = u + r, o = o + 1, r !== 255) break;
2241
+ }
2242
+ if (a === 5) {
2243
+ const r = f.slice(o, o + 16), i = Array.from(r, (p) => p.toString(16).padStart(2, "0")).join("");
2244
+ o = o + 16;
2245
+ const e = u - 16, t = f.slice(o, o + e), s = com.quick.voice.proto.SeiData.decode(t), { event: l = 0 } = s, c = s.data;
2246
+ let d;
2247
+ switch (l) {
2248
+ case 0:
2249
+ d = com.quick.voice.proto.LayoutData.decode(s.data);
2250
+ break;
2251
+ case 1:
2252
+ d = com.quick.voice.proto.CustomInfo.decode(s.data);
2253
+ break;
2254
+ }
2255
+ return { uuid: i, ...s, event: l, data_remote: c, data: d };
2256
+ }
2257
+ };
2258
+ class QuickVoPlayer {
2259
+ constructor() {
2260
+ v(this, "displayMode", "original");
2261
+ v(this, "prPlayer", new be());
2262
+ v(this, "dom");
2263
+ v(this, "room", {
2264
+ roomId: "",
2265
+ updateTime: "",
2266
+ author: "",
2267
+ version: ""
2268
+ });
2269
+ v(this, "usersMap", /* @__PURE__ */ new Map());
2270
+ v(this, "on", {
2271
+ users: (o) => {
2272
+ }
2273
+ });
2274
+ v(this, "init", () => {
2275
+ this.prPlayer.init();
2276
+ });
2277
+ v(this, "start", (o) => {
2278
+ this.prPlayer.start(o);
2279
+ });
2280
+ v(this, "stop", () => {
2281
+ this.prPlayer.stop();
2282
+ });
2283
+ v(this, "setMute", (o) => {
2284
+ this.prPlayer.setMute(o);
2285
+ });
2286
+ v(this, "getStream", () => this.prPlayer.getStream());
2287
+ v(this, "getAllUseUpdateKey", () => {
2288
+ const o = [...this.usersMap.values()];
2289
+ return Array.from(o, (u) => u.updateTime).join("_");
2290
+ });
2291
+ v(this, "checkAndCreateUser", (o, a) => {
2292
+ if (!this.usersMap.has(o)) {
2293
+ const r = new RoomUser();
2294
+ this.usersMap.set(o, r);
2295
+ }
2296
+ const u = this.usersMap.get(o);
2297
+ if (u) {
2298
+ if (u.init(a), u.mc_video) {
2299
+ const { sx: r, sy: n, sw: i, sh: e } = u.mc_video, t = `${u.userId}_mc_video`, { stream: s, destroy: l } = this.prPlayer.cut.create(t, { sx: r, sy: n, sw: i, sh: e });
2300
+ u.mc_video.stream = s, u.mc_video.destroy = () => {
2301
+ l(), this.prPlayer.cut.remove(t), this.usersMap.delete(u.userId);
2302
+ };
2303
+ }
2304
+ if (u.ss_video) {
2305
+ const { sx: r, sy: n, sw: i, sh: e } = u.ss_video, t = `${u.userId}_ss_video`, { stream: s, destroy: l } = this.prPlayer.cut.create(t, { sx: r, sy: n, sw: i, sh: e });
2306
+ u.ss_video.stream = s, u.ss_video.destroy = () => {
2307
+ l(), this.prPlayer.cut.remove(t), this.usersMap.delete(u.userId);
2308
+ };
2309
+ }
2310
+ }
2311
+ });
2312
+ /**
2313
+ * 监听SEI信息
2314
+ */
2315
+ v(this, "onSEI", (o) => {
2316
+ try {
2317
+ const a = parseSEI(o);
2318
+ if (!a) return;
2319
+ const { event: u, data: r } = a;
2320
+ switch (u) {
2321
+ case 0:
2322
+ {
2323
+ const { roomId: n, userMap: i } = r;
2324
+ if (n !== this.room.roomId) return;
2325
+ const e = this.getAllUseUpdateKey(), t = Object.keys(i);
2326
+ {
2327
+ const l = [...this.usersMap.values()];
2328
+ for (const c of l)
2329
+ t.includes(c.userId) || c == null || c.destroy();
2330
+ }
2331
+ for (const l of t) {
2332
+ const c = i[l];
2333
+ this.checkAndCreateUser(l, c);
2334
+ }
2335
+ const s = this.getAllUseUpdateKey();
2336
+ if (e !== s && this.on.users) {
2337
+ const l = [...this.usersMap.values()], c = Array.from(l, ({ userId: d, mc_audio: y, mc_video: p, ss_audio: w, ss_video: b, updateTime: m }) => ({ userId: d, mc_audio: y, mc_video: p, ss_audio: w, ss_video: b, updateTime: m }));
2338
+ this.on.users(c);
2339
+ }
2340
+ }
2341
+ break;
2342
+ case 1:
2343
+ {
2344
+ const { roomId: n, updateTime: i } = r, { author: e, version: t } = r.customKeyMap;
2345
+ this.room.roomId = n, this.room.updateTime = i, this.room.author = e, this.room.version = t;
2346
+ }
2347
+ break;
2348
+ }
2349
+ } catch (a) {
2350
+ console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->onSEI: error", a);
2351
+ }
2352
+ });
2353
+ this.prPlayer.on.demuxer.sei = this.onSEI;
2354
+ }
2355
+ }
2356
+ export {
2357
+ QuickVoPlayer
2358
+ };