@cloudflare/realtimekit-recording-sdk 0.0.1 → 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/LICENSE +201 -0
- package/README.md +49 -57
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +721 -714
- package/dist/index.iife.js +3 -3
- package/package.json +81 -1
- package/types/controllers/RealtimeKitController.d.ts +1 -1
- package/types/controllers/RecordingController.d.ts +3 -3
- package/types/controllers/WebsocketController.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/types/sdk.d.ts +1 -1
- package/types/utils/logger.d.ts +2 -2
- package/types/utils/mock.d.ts +1 -1
- package/types/controllers/DyteController.d.ts +0 -26
package/dist/index.es.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Ht = Object.defineProperty;
|
|
2
|
+
var en = (n, e, t) => e in n ? Ht(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var it = (n, e, t) => (en(n, typeof e != "symbol" ? e + "" : e, t), t), We = (n, e, t) => {
|
|
4
4
|
if (!e.has(n))
|
|
5
5
|
throw TypeError("Cannot " + t);
|
|
6
6
|
};
|
|
7
|
-
var l = (n, e, t) => (
|
|
7
|
+
var l = (n, e, t) => (We(n, e, "read from private field"), t ? t.call(n) : e.get(n)), D = (n, e, t) => {
|
|
8
8
|
if (e.has(n))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
e instanceof WeakSet ? e.add(n) : e.set(n, t);
|
|
11
|
-
}, C = (n, e, t, i) => (
|
|
12
|
-
var
|
|
13
|
-
var
|
|
11
|
+
}, C = (n, e, t, i) => (We(n, e, "write to private field"), i ? i.call(n, t) : e.set(n, t), t);
|
|
12
|
+
var rt = (n, e, t) => (We(n, e, "access private method"), t);
|
|
13
|
+
var et = { exports: {} }, re = typeof Reflect == "object" ? Reflect : null, st = re && typeof re.apply == "function" ? re.apply : function(e, t, i) {
|
|
14
14
|
return Function.prototype.apply.call(e, t, i);
|
|
15
|
-
},
|
|
16
|
-
|
|
15
|
+
}, Ie;
|
|
16
|
+
re && typeof re.ownKeys == "function" ? Ie = re.ownKeys : Object.getOwnPropertySymbols ? Ie = function(e) {
|
|
17
17
|
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
|
18
|
-
} :
|
|
18
|
+
} : Ie = function(e) {
|
|
19
19
|
return Object.getOwnPropertyNames(e);
|
|
20
20
|
};
|
|
21
|
-
function
|
|
21
|
+
function tn(n) {
|
|
22
22
|
console && console.warn && console.warn(n);
|
|
23
23
|
}
|
|
24
|
-
var
|
|
24
|
+
var vt = Number.isNaN || function(e) {
|
|
25
25
|
return e !== e;
|
|
26
26
|
};
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
function
|
|
27
|
+
function v() {
|
|
28
|
+
v.init.call(this);
|
|
29
|
+
}
|
|
30
|
+
et.exports = v;
|
|
31
|
+
et.exports.once = on;
|
|
32
|
+
v.EventEmitter = v;
|
|
33
|
+
v.prototype._events = void 0;
|
|
34
|
+
v.prototype._eventsCount = 0;
|
|
35
|
+
v.prototype._maxListeners = void 0;
|
|
36
|
+
var ot = 10;
|
|
37
|
+
function Ve(n) {
|
|
38
38
|
if (typeof n != "function")
|
|
39
39
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof n);
|
|
40
40
|
}
|
|
41
|
-
Object.defineProperty(
|
|
41
|
+
Object.defineProperty(v, "defaultMaxListeners", {
|
|
42
42
|
enumerable: !0,
|
|
43
43
|
get: function() {
|
|
44
|
-
return
|
|
44
|
+
return ot;
|
|
45
45
|
},
|
|
46
46
|
set: function(n) {
|
|
47
|
-
if (typeof n != "number" || n < 0 ||
|
|
47
|
+
if (typeof n != "number" || n < 0 || vt(n))
|
|
48
48
|
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + n + ".");
|
|
49
|
-
|
|
49
|
+
ot = n;
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
|
|
52
|
+
v.init = function() {
|
|
53
53
|
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
54
54
|
};
|
|
55
|
-
|
|
56
|
-
if (typeof e != "number" || e < 0 ||
|
|
55
|
+
v.prototype.setMaxListeners = function(e) {
|
|
56
|
+
if (typeof e != "number" || e < 0 || vt(e))
|
|
57
57
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
58
58
|
return this._maxListeners = e, this;
|
|
59
59
|
};
|
|
60
|
-
function
|
|
61
|
-
return n._maxListeners === void 0 ?
|
|
60
|
+
function kt(n) {
|
|
61
|
+
return n._maxListeners === void 0 ? v.defaultMaxListeners : n._maxListeners;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
return
|
|
63
|
+
v.prototype.getMaxListeners = function() {
|
|
64
|
+
return kt(this);
|
|
65
65
|
};
|
|
66
|
-
|
|
66
|
+
v.prototype.emit = function(e) {
|
|
67
67
|
for (var t = [], i = 1; i < arguments.length; i++)
|
|
68
68
|
t.push(arguments[i]);
|
|
69
69
|
var r = e === "error", s = this._events;
|
|
@@ -82,51 +82,51 @@ w.prototype.emit = function(e) {
|
|
|
82
82
|
if (f === void 0)
|
|
83
83
|
return !1;
|
|
84
84
|
if (typeof f == "function")
|
|
85
|
-
|
|
85
|
+
st(f, this, t);
|
|
86
86
|
else
|
|
87
|
-
for (var h = f.length, d =
|
|
88
|
-
|
|
87
|
+
for (var h = f.length, d = Rt(f, h), i = 0; i < h; ++i)
|
|
88
|
+
st(d[i], this, t);
|
|
89
89
|
return !0;
|
|
90
90
|
};
|
|
91
|
-
function
|
|
91
|
+
function It(n, e, t, i) {
|
|
92
92
|
var r, s, o;
|
|
93
|
-
if (
|
|
93
|
+
if (Ve(t), s = n._events, s === void 0 ? (s = n._events = /* @__PURE__ */ Object.create(null), n._eventsCount = 0) : (s.newListener !== void 0 && (n.emit(
|
|
94
94
|
"newListener",
|
|
95
95
|
e,
|
|
96
96
|
t.listener ? t.listener : t
|
|
97
97
|
), s = n._events), o = s[e]), o === void 0)
|
|
98
98
|
o = s[e] = t, ++n._eventsCount;
|
|
99
|
-
else if (typeof o == "function" ? o = s[e] = i ? [t, o] : [o, t] : i ? o.unshift(t) : o.push(t), r =
|
|
99
|
+
else if (typeof o == "function" ? o = s[e] = i ? [t, o] : [o, t] : i ? o.unshift(t) : o.push(t), r = kt(n), r > 0 && o.length > r && !o.warned) {
|
|
100
100
|
o.warned = !0;
|
|
101
101
|
var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
102
|
-
a.name = "MaxListenersExceededWarning", a.emitter = n, a.type = e, a.count = o.length,
|
|
102
|
+
a.name = "MaxListenersExceededWarning", a.emitter = n, a.type = e, a.count = o.length, tn(a);
|
|
103
103
|
}
|
|
104
104
|
return n;
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
return
|
|
106
|
+
v.prototype.addListener = function(e, t) {
|
|
107
|
+
return It(this, e, t, !1);
|
|
108
108
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return
|
|
109
|
+
v.prototype.on = v.prototype.addListener;
|
|
110
|
+
v.prototype.prependListener = function(e, t) {
|
|
111
|
+
return It(this, e, t, !0);
|
|
112
112
|
};
|
|
113
|
-
function
|
|
113
|
+
function nn() {
|
|
114
114
|
if (!this.fired)
|
|
115
115
|
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
var i = { fired: !1, wrapFn: void 0, target: n, type: e, listener: t }, r =
|
|
117
|
+
function Nt(n, e, t) {
|
|
118
|
+
var i = { fired: !1, wrapFn: void 0, target: n, type: e, listener: t }, r = nn.bind(i);
|
|
119
119
|
return r.listener = t, i.wrapFn = r, r;
|
|
120
120
|
}
|
|
121
|
-
|
|
122
|
-
return
|
|
121
|
+
v.prototype.once = function(e, t) {
|
|
122
|
+
return Ve(t), this.on(e, Nt(this, e, t)), this;
|
|
123
123
|
};
|
|
124
|
-
|
|
125
|
-
return
|
|
124
|
+
v.prototype.prependOnceListener = function(e, t) {
|
|
125
|
+
return Ve(t), this.prependListener(e, Nt(this, e, t)), this;
|
|
126
126
|
};
|
|
127
|
-
|
|
127
|
+
v.prototype.removeListener = function(e, t) {
|
|
128
128
|
var i, r, s, o, a;
|
|
129
|
-
if (
|
|
129
|
+
if (Ve(t), r = this._events, r === void 0)
|
|
130
130
|
return this;
|
|
131
131
|
if (i = r[e], i === void 0)
|
|
132
132
|
return this;
|
|
@@ -140,12 +140,12 @@ w.prototype.removeListener = function(e, t) {
|
|
|
140
140
|
}
|
|
141
141
|
if (s < 0)
|
|
142
142
|
return this;
|
|
143
|
-
s === 0 ? i.shift() :
|
|
143
|
+
s === 0 ? i.shift() : rn(i, s), i.length === 1 && (r[e] = i[0]), r.removeListener !== void 0 && this.emit("removeListener", e, a || t);
|
|
144
144
|
}
|
|
145
145
|
return this;
|
|
146
146
|
};
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
v.prototype.off = v.prototype.removeListener;
|
|
148
|
+
v.prototype.removeAllListeners = function(e) {
|
|
149
149
|
var t, i, r;
|
|
150
150
|
if (i = this._events, i === void 0)
|
|
151
151
|
return this;
|
|
@@ -164,24 +164,24 @@ w.prototype.removeAllListeners = function(e) {
|
|
|
164
164
|
this.removeListener(e, t[r]);
|
|
165
165
|
return this;
|
|
166
166
|
};
|
|
167
|
-
function
|
|
167
|
+
function Et(n, e, t) {
|
|
168
168
|
var i = n._events;
|
|
169
169
|
if (i === void 0)
|
|
170
170
|
return [];
|
|
171
171
|
var r = i[e];
|
|
172
|
-
return r === void 0 ? [] : typeof r == "function" ? t ? [r.listener || r] : [r] : t ?
|
|
172
|
+
return r === void 0 ? [] : typeof r == "function" ? t ? [r.listener || r] : [r] : t ? sn(r) : Rt(r, r.length);
|
|
173
173
|
}
|
|
174
|
-
|
|
175
|
-
return
|
|
174
|
+
v.prototype.listeners = function(e) {
|
|
175
|
+
return Et(this, e, !0);
|
|
176
176
|
};
|
|
177
|
-
|
|
178
|
-
return
|
|
177
|
+
v.prototype.rawListeners = function(e) {
|
|
178
|
+
return Et(this, e, !1);
|
|
179
179
|
};
|
|
180
|
-
|
|
181
|
-
return typeof n.listenerCount == "function" ? n.listenerCount(e) :
|
|
180
|
+
v.listenerCount = function(n, e) {
|
|
181
|
+
return typeof n.listenerCount == "function" ? n.listenerCount(e) : Tt.call(n, e);
|
|
182
182
|
};
|
|
183
|
-
|
|
184
|
-
function
|
|
183
|
+
v.prototype.listenerCount = Tt;
|
|
184
|
+
function Tt(n) {
|
|
185
185
|
var e = this._events;
|
|
186
186
|
if (e !== void 0) {
|
|
187
187
|
var t = e[n];
|
|
@@ -192,25 +192,25 @@ function yt(n) {
|
|
|
192
192
|
}
|
|
193
193
|
return 0;
|
|
194
194
|
}
|
|
195
|
-
|
|
196
|
-
return this._eventsCount > 0 ?
|
|
195
|
+
v.prototype.eventNames = function() {
|
|
196
|
+
return this._eventsCount > 0 ? Ie(this._events) : [];
|
|
197
197
|
};
|
|
198
|
-
function
|
|
198
|
+
function Rt(n, e) {
|
|
199
199
|
for (var t = new Array(e), i = 0; i < e; ++i)
|
|
200
200
|
t[i] = n[i];
|
|
201
201
|
return t;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function rn(n, e) {
|
|
204
204
|
for (; e + 1 < n.length; e++)
|
|
205
205
|
n[e] = n[e + 1];
|
|
206
206
|
n.pop();
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function sn(n) {
|
|
209
209
|
for (var e = new Array(n.length), t = 0; t < e.length; ++t)
|
|
210
210
|
e[t] = n[t].listener || n[t];
|
|
211
211
|
return e;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function on(n, e) {
|
|
214
214
|
return new Promise(function(t, i) {
|
|
215
215
|
function r(o) {
|
|
216
216
|
n.removeListener(e, s), i(o);
|
|
@@ -218,13 +218,13 @@ function Qt(n, e) {
|
|
|
218
218
|
function s() {
|
|
219
219
|
typeof n.removeListener == "function" && n.removeListener("error", r), t([].slice.call(arguments));
|
|
220
220
|
}
|
|
221
|
-
|
|
221
|
+
Ot(n, e, s, { once: !0 }), e !== "error" && an(n, r, { once: !0 });
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
typeof n.on == "function" &&
|
|
224
|
+
function an(n, e, t) {
|
|
225
|
+
typeof n.on == "function" && Ot(n, "error", e, t);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function Ot(n, e, t, i) {
|
|
228
228
|
if (typeof n.on == "function")
|
|
229
229
|
i.once ? n.once(e, t) : n.on(e, t);
|
|
230
230
|
else if (typeof n.addEventListener == "function")
|
|
@@ -234,10 +234,10 @@ function kt(n, e, t, i) {
|
|
|
234
234
|
else
|
|
235
235
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof n);
|
|
236
236
|
}
|
|
237
|
-
var
|
|
238
|
-
class
|
|
237
|
+
var cn = et.exports;
|
|
238
|
+
class un {
|
|
239
239
|
constructor() {
|
|
240
|
-
|
|
240
|
+
it(this, "client");
|
|
241
241
|
}
|
|
242
242
|
logToConsole() {
|
|
243
243
|
return window.devMode === !0 && !this.isInitialized();
|
|
@@ -272,20 +272,20 @@ class tn {
|
|
|
272
272
|
this.isInitialized() && ((r = this.client) == null || r.__internals__.logger.warn(this.generateMessage(e), t, i)), this.logToConsole() && console.warn(e);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
const
|
|
276
|
-
var H, G,
|
|
277
|
-
class
|
|
275
|
+
const N = new un(), Lt = 1e3, fn = 60 * Lt, hn = 1 * Lt;
|
|
276
|
+
var H, G, we, ce, _e, St;
|
|
277
|
+
class ln extends cn.EventEmitter {
|
|
278
278
|
constructor(t, i) {
|
|
279
279
|
super();
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
this.meeting = t, this.options = i,
|
|
280
|
+
D(this, _e);
|
|
281
|
+
D(this, H, null);
|
|
282
|
+
D(this, G, !1);
|
|
283
|
+
D(this, we, !1);
|
|
284
|
+
D(this, ce, null);
|
|
285
|
+
this.meeting = t, this.options = i, rt(this, _e, St).call(this);
|
|
286
286
|
}
|
|
287
287
|
cleanup() {
|
|
288
|
-
|
|
288
|
+
N.info("Cleaning up recording controller"), delete window.dyteRecording, delete window.realtimeKitRecording, this.meeting.removeAllListeners(), this.removeAllListeners(), l(this, ce) !== null && clearInterval(l(this, ce));
|
|
289
289
|
}
|
|
290
290
|
getParticipantCount() {
|
|
291
291
|
return this.meeting.getParticipantCount();
|
|
@@ -305,7 +305,7 @@ class sn extends en.EventEmitter {
|
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
307
|
if ((/* @__PURE__ */ new Date()).getTime() - l(this, H).getTime() > this.options.waitTimeMs) {
|
|
308
|
-
|
|
308
|
+
N.info("Setting triggerDyteRecording & triggerRealtimeKitRecording to false"), C(this, G, !0), window.triggerDyteRecording = !1, window.triggerRealtimeKitRecording = !1;
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
311
|
C(this, G, !1), window.triggerDyteRecording = !0, window.triggerRealtimeKitRecording = !0;
|
|
@@ -313,13 +313,13 @@ class sn extends en.EventEmitter {
|
|
|
313
313
|
stopRecording() {
|
|
314
314
|
if (this.options.autoStop)
|
|
315
315
|
throw new Error("Cannot stop recording when autoStop is true");
|
|
316
|
-
|
|
316
|
+
N.info("Stopping recording"), window.triggerDyteRecording && (window.triggerDyteRecording = !1), window.triggerRealtimeKitRecording && (window.triggerRealtimeKitRecording = !1);
|
|
317
317
|
}
|
|
318
318
|
get meetingJoined() {
|
|
319
|
-
return l(this,
|
|
319
|
+
return l(this, we);
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
H = new WeakMap(), G = new WeakMap(),
|
|
322
|
+
H = new WeakMap(), G = new WeakMap(), we = new WeakMap(), ce = new WeakMap(), _e = new WeakSet(), St = function() {
|
|
323
323
|
window.dyteRecording !== void 0 && (window.dyteRecording = void 0, window.realtimeKitRecording = void 0, window.triggerDyteRecording = !1, window.triggerRealtimeKitRecording = !1), window.realtimeKitRecording !== void 0 && (window.dyteRecording = void 0, window.realtimeKitRecording = void 0, window.triggerDyteRecording = !1, window.triggerRealtimeKitRecording = !1), window.triggerDyteRecording = !0, window.triggerRealtimeKitRecording = !0, window.dyteRecording = {
|
|
324
324
|
// Kept for backward compatibility with Dyte golang workers
|
|
325
325
|
getParticipantCount: () => this.getParticipantCount(),
|
|
@@ -332,18 +332,18 @@ H = new WeakMap(), G = new WeakMap(), ge = new WeakMap(), oe = new WeakMap(), Ae
|
|
|
332
332
|
isMeetingJoined: () => this.meetingJoined,
|
|
333
333
|
getMeeting: () => this.meeting.getMeeting()
|
|
334
334
|
}, this.meeting.handleParticipantJoin(() => {
|
|
335
|
-
|
|
335
|
+
N.info(`Participant joined. Total participants: ${this.getParticipantCount()}. Scanning meeting state`), this.scanMeetingState(), this.emit("participantCount", this.getParticipantCount());
|
|
336
336
|
}), this.meeting.handleParticipantLeave(() => {
|
|
337
|
-
|
|
337
|
+
N.info(`Participant left. Remaining participants: ${this.getParticipantCount()}. Scanning meeting state`), this.scanMeetingState(), this.emit("participantCount", this.getParticipantCount());
|
|
338
338
|
}), this.meeting.handleMeetingJoined(() => {
|
|
339
|
-
|
|
339
|
+
N.info("Meeting joined"), C(this, we, !0), this.emit("participantCount", this.getParticipantCount());
|
|
340
340
|
}), this.meeting.handleMeetingLeft(({ state: t }) => {
|
|
341
|
-
t !== "ended" && t !== "kicked" || (
|
|
342
|
-
}), this.options.autoStop && C(this,
|
|
341
|
+
t !== "ended" && t !== "kicked" || (N.info("Meeting ended"), this.emit("meetingEnded"), this.cleanup(), window.triggerDyteRecording = !1, window.triggerRealtimeKitRecording = !1);
|
|
342
|
+
}), this.options.autoStop && C(this, ce, setInterval(() => {
|
|
343
343
|
this.scanMeetingState();
|
|
344
344
|
}, this.options.scanInterval));
|
|
345
345
|
};
|
|
346
|
-
class
|
|
346
|
+
class dn {
|
|
347
347
|
constructor(e) {
|
|
348
348
|
this.meeting = e;
|
|
349
349
|
}
|
|
@@ -372,7 +372,7 @@ class on {
|
|
|
372
372
|
this.meeting.self.removeAllListeners();
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function Ft(n) {
|
|
376
376
|
let e = typeof n;
|
|
377
377
|
if (e == "object") {
|
|
378
378
|
if (Array.isArray(n))
|
|
@@ -382,20 +382,20 @@ function Et(n) {
|
|
|
382
382
|
}
|
|
383
383
|
return e;
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function gn(n) {
|
|
386
386
|
return n !== null && typeof n == "object" && !Array.isArray(n);
|
|
387
387
|
}
|
|
388
|
-
let W = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),
|
|
388
|
+
let W = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), Ke = [];
|
|
389
389
|
for (let n = 0; n < W.length; n++)
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
function
|
|
390
|
+
Ke[W[n].charCodeAt(0)] = n;
|
|
391
|
+
Ke["-".charCodeAt(0)] = W.indexOf("+");
|
|
392
|
+
Ke["_".charCodeAt(0)] = W.indexOf("/");
|
|
393
|
+
function mn(n) {
|
|
394
394
|
let e = n.length * 3 / 4;
|
|
395
395
|
n[n.length - 2] == "=" ? e -= 2 : n[n.length - 1] == "=" && (e -= 1);
|
|
396
396
|
let t = new Uint8Array(e), i = 0, r = 0, s, o = 0;
|
|
397
397
|
for (let a = 0; a < n.length; a++) {
|
|
398
|
-
if (s =
|
|
398
|
+
if (s = Ke[n.charCodeAt(a)], s === void 0)
|
|
399
399
|
switch (n[a]) {
|
|
400
400
|
case "=":
|
|
401
401
|
r = 0;
|
|
@@ -427,7 +427,7 @@ function cn(n) {
|
|
|
427
427
|
throw Error("invalid base64 string.");
|
|
428
428
|
return t.subarray(0, i);
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function pn(n) {
|
|
431
431
|
let e = "", t = 0, i, r = 0;
|
|
432
432
|
for (let s = 0; s < n.length; s++)
|
|
433
433
|
switch (i = n[s], t) {
|
|
@@ -443,7 +443,7 @@ function un(n) {
|
|
|
443
443
|
}
|
|
444
444
|
return t && (e += W[r], e += "=", t == 1 && (e += "=")), e;
|
|
445
445
|
}
|
|
446
|
-
var
|
|
446
|
+
var Se;
|
|
447
447
|
(function(n) {
|
|
448
448
|
n.symbol = Symbol.for("protobuf-ts/unknown"), n.onRead = (t, i, r, s, o) => {
|
|
449
449
|
(e(i) ? i[n.symbol] : i[n.symbol] = []).push({ no: r, wireType: s, data: o });
|
|
@@ -458,12 +458,12 @@ var Ee;
|
|
|
458
458
|
return [];
|
|
459
459
|
}, n.last = (t, i) => n.list(t, i).slice(-1)[0];
|
|
460
460
|
const e = (t) => t && Array.isArray(t[n.symbol]);
|
|
461
|
-
})(
|
|
462
|
-
var
|
|
461
|
+
})(Se || (Se = {}));
|
|
462
|
+
var L;
|
|
463
463
|
(function(n) {
|
|
464
464
|
n[n.Varint = 0] = "Varint", n[n.Bit64 = 1] = "Bit64", n[n.LengthDelimited = 2] = "LengthDelimited", n[n.StartGroup = 3] = "StartGroup", n[n.EndGroup = 4] = "EndGroup", n[n.Bit32 = 5] = "Bit32";
|
|
465
|
-
})(
|
|
466
|
-
function
|
|
465
|
+
})(L || (L = {}));
|
|
466
|
+
function wn() {
|
|
467
467
|
let n = 0, e = 0;
|
|
468
468
|
for (let i = 0; i < 28; i += 7) {
|
|
469
469
|
let r = this.buf[this.pos++];
|
|
@@ -480,7 +480,7 @@ function fn() {
|
|
|
480
480
|
}
|
|
481
481
|
throw new Error("invalid varint");
|
|
482
482
|
}
|
|
483
|
-
function
|
|
483
|
+
function $e(n, e, t) {
|
|
484
484
|
for (let s = 0; s < 28; s = s + 7) {
|
|
485
485
|
const o = n >>> s, a = !(!(o >>> 7) && e == 0), f = (a ? o | 128 : o) & 255;
|
|
486
486
|
if (t.push(f), !a)
|
|
@@ -496,26 +496,26 @@ function Ve(n, e, t) {
|
|
|
496
496
|
t.push(e >>> 31 & 1);
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
const
|
|
500
|
-
function
|
|
499
|
+
const Ne = 65536 * 65536;
|
|
500
|
+
function Ct(n) {
|
|
501
501
|
let e = n[0] == "-";
|
|
502
502
|
e && (n = n.slice(1));
|
|
503
503
|
const t = 1e6;
|
|
504
504
|
let i = 0, r = 0;
|
|
505
505
|
function s(o, a) {
|
|
506
506
|
const f = Number(n.slice(o, a));
|
|
507
|
-
r *= t, i = i * t + f, i >=
|
|
507
|
+
r *= t, i = i * t + f, i >= Ne && (r = r + (i / Ne | 0), i = i % Ne);
|
|
508
508
|
}
|
|
509
509
|
return s(-24, -18), s(-18, -12), s(-12, -6), s(-6), [e, i, r];
|
|
510
510
|
}
|
|
511
|
-
function
|
|
511
|
+
function Xe(n, e) {
|
|
512
512
|
if (e >>> 0 <= 2097151)
|
|
513
|
-
return "" + (
|
|
513
|
+
return "" + (Ne * e + (n >>> 0));
|
|
514
514
|
let t = n & 16777215, i = (n >>> 24 | e << 8) >>> 0 & 16777215, r = e >> 16 & 65535, s = t + i * 6777216 + r * 6710656, o = i + r * 8147497, a = r * 2, f = 1e7;
|
|
515
515
|
s >= f && (o += Math.floor(s / f), s %= f), o >= f && (a += Math.floor(o / f), o %= f);
|
|
516
|
-
function h(d,
|
|
517
|
-
let
|
|
518
|
-
return
|
|
516
|
+
function h(d, E) {
|
|
517
|
+
let g = d ? String(d) : "";
|
|
518
|
+
return E ? "0000000".slice(g.length) + g : g;
|
|
519
519
|
}
|
|
520
520
|
return h(
|
|
521
521
|
a,
|
|
@@ -533,7 +533,7 @@ function Pe(n, e) {
|
|
|
533
533
|
1
|
|
534
534
|
);
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function at(n, e) {
|
|
537
537
|
if (n >= 0) {
|
|
538
538
|
for (; n > 127; )
|
|
539
539
|
e.push(n & 127 | 128), n = n >>> 7;
|
|
@@ -544,7 +544,7 @@ function nt(n, e) {
|
|
|
544
544
|
e.push(1);
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function bn() {
|
|
548
548
|
let n = this.buf[this.pos++], e = n & 127;
|
|
549
549
|
if (!(n & 128))
|
|
550
550
|
return this.assertBounds(), e;
|
|
@@ -561,10 +561,10 @@ function hn() {
|
|
|
561
561
|
throw new Error("invalid varint");
|
|
562
562
|
return this.assertBounds(), e >>> 0;
|
|
563
563
|
}
|
|
564
|
-
let
|
|
565
|
-
function
|
|
564
|
+
let I;
|
|
565
|
+
function yn() {
|
|
566
566
|
const n = new DataView(new ArrayBuffer(8));
|
|
567
|
-
|
|
567
|
+
I = globalThis.BigInt !== void 0 && typeof n.getBigInt64 == "function" && typeof n.getBigUint64 == "function" && typeof n.setBigInt64 == "function" && typeof n.setBigUint64 == "function" ? {
|
|
568
568
|
MIN: BigInt("-9223372036854775808"),
|
|
569
569
|
MAX: BigInt("9223372036854775807"),
|
|
570
570
|
UMIN: BigInt("0"),
|
|
@@ -573,13 +573,13 @@ function ln() {
|
|
|
573
573
|
V: n
|
|
574
574
|
} : void 0;
|
|
575
575
|
}
|
|
576
|
-
|
|
577
|
-
function
|
|
576
|
+
yn();
|
|
577
|
+
function Mt(n) {
|
|
578
578
|
if (!n)
|
|
579
579
|
throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support");
|
|
580
580
|
}
|
|
581
|
-
const
|
|
582
|
-
class
|
|
581
|
+
const At = /^-?[0-9]+$/, Fe = 4294967296, ve = 2147483648;
|
|
582
|
+
class Dt {
|
|
583
583
|
/**
|
|
584
584
|
* Create a new instance with the given bits.
|
|
585
585
|
*/
|
|
@@ -596,46 +596,46 @@ class Lt {
|
|
|
596
596
|
* Convert to a native number.
|
|
597
597
|
*/
|
|
598
598
|
toNumber() {
|
|
599
|
-
let e = this.hi *
|
|
599
|
+
let e = this.hi * Fe + (this.lo >>> 0);
|
|
600
600
|
if (!Number.isSafeInteger(e))
|
|
601
601
|
throw new Error("cannot convert to safe number");
|
|
602
602
|
return e;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
class M extends
|
|
605
|
+
class M extends Dt {
|
|
606
606
|
/**
|
|
607
607
|
* Create instance from a `string`, `number` or `bigint`.
|
|
608
608
|
*/
|
|
609
609
|
static from(e) {
|
|
610
|
-
if (
|
|
610
|
+
if (I)
|
|
611
611
|
switch (typeof e) {
|
|
612
612
|
case "string":
|
|
613
613
|
if (e == "0")
|
|
614
614
|
return this.ZERO;
|
|
615
615
|
if (e == "")
|
|
616
616
|
throw new Error("string is no integer");
|
|
617
|
-
e =
|
|
617
|
+
e = I.C(e);
|
|
618
618
|
case "number":
|
|
619
619
|
if (e === 0)
|
|
620
620
|
return this.ZERO;
|
|
621
|
-
e =
|
|
621
|
+
e = I.C(e);
|
|
622
622
|
case "bigint":
|
|
623
623
|
if (!e)
|
|
624
624
|
return this.ZERO;
|
|
625
|
-
if (e <
|
|
625
|
+
if (e < I.UMIN)
|
|
626
626
|
throw new Error("signed value for ulong");
|
|
627
|
-
if (e >
|
|
627
|
+
if (e > I.UMAX)
|
|
628
628
|
throw new Error("ulong too large");
|
|
629
|
-
return
|
|
629
|
+
return I.V.setBigUint64(0, e, !0), new M(I.V.getInt32(0, !0), I.V.getInt32(4, !0));
|
|
630
630
|
}
|
|
631
631
|
else
|
|
632
632
|
switch (typeof e) {
|
|
633
633
|
case "string":
|
|
634
634
|
if (e == "0")
|
|
635
635
|
return this.ZERO;
|
|
636
|
-
if (e = e.trim(), !
|
|
636
|
+
if (e = e.trim(), !At.test(e))
|
|
637
637
|
throw new Error("string is no integer");
|
|
638
|
-
let [t, i, r] =
|
|
638
|
+
let [t, i, r] = Ct(e);
|
|
639
639
|
if (t)
|
|
640
640
|
throw new Error("signed value for ulong");
|
|
641
641
|
return new M(i, r);
|
|
@@ -646,7 +646,7 @@ class M extends Lt {
|
|
|
646
646
|
throw new Error("number is no integer");
|
|
647
647
|
if (e < 0)
|
|
648
648
|
throw new Error("signed value for ulong");
|
|
649
|
-
return new M(e, e /
|
|
649
|
+
return new M(e, e / Fe);
|
|
650
650
|
}
|
|
651
651
|
throw new Error("unknown value " + typeof e);
|
|
652
652
|
}
|
|
@@ -654,54 +654,54 @@ class M extends Lt {
|
|
|
654
654
|
* Convert to decimal string.
|
|
655
655
|
*/
|
|
656
656
|
toString() {
|
|
657
|
-
return
|
|
657
|
+
return I ? this.toBigInt().toString() : Xe(this.lo, this.hi);
|
|
658
658
|
}
|
|
659
659
|
/**
|
|
660
660
|
* Convert to native bigint.
|
|
661
661
|
*/
|
|
662
662
|
toBigInt() {
|
|
663
|
-
return
|
|
663
|
+
return Mt(I), I.V.setInt32(0, this.lo, !0), I.V.setInt32(4, this.hi, !0), I.V.getBigUint64(0, !0);
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
666
|
M.ZERO = new M(0, 0);
|
|
667
|
-
class S extends
|
|
667
|
+
class S extends Dt {
|
|
668
668
|
/**
|
|
669
669
|
* Create instance from a `string`, `number` or `bigint`.
|
|
670
670
|
*/
|
|
671
671
|
static from(e) {
|
|
672
|
-
if (
|
|
672
|
+
if (I)
|
|
673
673
|
switch (typeof e) {
|
|
674
674
|
case "string":
|
|
675
675
|
if (e == "0")
|
|
676
676
|
return this.ZERO;
|
|
677
677
|
if (e == "")
|
|
678
678
|
throw new Error("string is no integer");
|
|
679
|
-
e =
|
|
679
|
+
e = I.C(e);
|
|
680
680
|
case "number":
|
|
681
681
|
if (e === 0)
|
|
682
682
|
return this.ZERO;
|
|
683
|
-
e =
|
|
683
|
+
e = I.C(e);
|
|
684
684
|
case "bigint":
|
|
685
685
|
if (!e)
|
|
686
686
|
return this.ZERO;
|
|
687
|
-
if (e <
|
|
687
|
+
if (e < I.MIN)
|
|
688
688
|
throw new Error("signed long too small");
|
|
689
|
-
if (e >
|
|
689
|
+
if (e > I.MAX)
|
|
690
690
|
throw new Error("signed long too large");
|
|
691
|
-
return
|
|
691
|
+
return I.V.setBigInt64(0, e, !0), new S(I.V.getInt32(0, !0), I.V.getInt32(4, !0));
|
|
692
692
|
}
|
|
693
693
|
else
|
|
694
694
|
switch (typeof e) {
|
|
695
695
|
case "string":
|
|
696
696
|
if (e == "0")
|
|
697
697
|
return this.ZERO;
|
|
698
|
-
if (e = e.trim(), !
|
|
698
|
+
if (e = e.trim(), !At.test(e))
|
|
699
699
|
throw new Error("string is no integer");
|
|
700
|
-
let [t, i, r] =
|
|
700
|
+
let [t, i, r] = Ct(e);
|
|
701
701
|
if (t) {
|
|
702
|
-
if (r >
|
|
702
|
+
if (r > ve || r == ve && i != 0)
|
|
703
703
|
throw new Error("signed long too small");
|
|
704
|
-
} else if (r >=
|
|
704
|
+
} else if (r >= ve)
|
|
705
705
|
throw new Error("signed long too large");
|
|
706
706
|
let s = new S(i, r);
|
|
707
707
|
return t ? s.negate() : s;
|
|
@@ -710,7 +710,7 @@ class S extends Lt {
|
|
|
710
710
|
return this.ZERO;
|
|
711
711
|
if (!Number.isSafeInteger(e))
|
|
712
712
|
throw new Error("number is no integer");
|
|
713
|
-
return e > 0 ? new S(e, e /
|
|
713
|
+
return e > 0 ? new S(e, e / Fe) : new S(-e, -e / Fe).negate();
|
|
714
714
|
}
|
|
715
715
|
throw new Error("unknown value " + typeof e);
|
|
716
716
|
}
|
|
@@ -718,7 +718,7 @@ class S extends Lt {
|
|
|
718
718
|
* Do we have a minus sign?
|
|
719
719
|
*/
|
|
720
720
|
isNegative() {
|
|
721
|
-
return (this.hi &
|
|
721
|
+
return (this.hi & ve) !== 0;
|
|
722
722
|
}
|
|
723
723
|
/**
|
|
724
724
|
* Negate two's complement.
|
|
@@ -732,32 +732,32 @@ class S extends Lt {
|
|
|
732
732
|
* Convert to decimal string.
|
|
733
733
|
*/
|
|
734
734
|
toString() {
|
|
735
|
-
if (
|
|
735
|
+
if (I)
|
|
736
736
|
return this.toBigInt().toString();
|
|
737
737
|
if (this.isNegative()) {
|
|
738
738
|
let e = this.negate();
|
|
739
|
-
return "-" +
|
|
739
|
+
return "-" + Xe(e.lo, e.hi);
|
|
740
740
|
}
|
|
741
|
-
return
|
|
741
|
+
return Xe(this.lo, this.hi);
|
|
742
742
|
}
|
|
743
743
|
/**
|
|
744
744
|
* Convert to native bigint.
|
|
745
745
|
*/
|
|
746
746
|
toBigInt() {
|
|
747
|
-
return
|
|
747
|
+
return Mt(I), I.V.setInt32(0, this.lo, !0), I.V.setInt32(4, this.hi, !0), I.V.getBigInt64(0, !0);
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
750
|
S.ZERO = new S(0, 0);
|
|
751
|
-
const
|
|
751
|
+
const ct = {
|
|
752
752
|
readUnknownField: !0,
|
|
753
|
-
readerFactory: (n) => new
|
|
753
|
+
readerFactory: (n) => new kn(n)
|
|
754
754
|
};
|
|
755
|
-
function
|
|
756
|
-
return n ? Object.assign(Object.assign({},
|
|
755
|
+
function vn(n) {
|
|
756
|
+
return n ? Object.assign(Object.assign({}, ct), n) : ct;
|
|
757
757
|
}
|
|
758
|
-
class
|
|
758
|
+
class kn {
|
|
759
759
|
constructor(e, t) {
|
|
760
|
-
this.varint64 =
|
|
760
|
+
this.varint64 = wn, this.uint32 = bn, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength), this.textDecoder = t ?? new TextDecoder("utf-8", {
|
|
761
761
|
fatal: !0,
|
|
762
762
|
ignoreBOM: !0
|
|
763
763
|
});
|
|
@@ -778,22 +778,22 @@ class gn {
|
|
|
778
778
|
skip(e) {
|
|
779
779
|
let t = this.pos;
|
|
780
780
|
switch (e) {
|
|
781
|
-
case
|
|
781
|
+
case L.Varint:
|
|
782
782
|
for (; this.buf[this.pos++] & 128; )
|
|
783
783
|
;
|
|
784
784
|
break;
|
|
785
|
-
case
|
|
785
|
+
case L.Bit64:
|
|
786
786
|
this.pos += 4;
|
|
787
|
-
case
|
|
787
|
+
case L.Bit32:
|
|
788
788
|
this.pos += 4;
|
|
789
789
|
break;
|
|
790
|
-
case
|
|
790
|
+
case L.LengthDelimited:
|
|
791
791
|
let i = this.uint32();
|
|
792
792
|
this.pos += i;
|
|
793
793
|
break;
|
|
794
|
-
case
|
|
794
|
+
case L.StartGroup:
|
|
795
795
|
let r;
|
|
796
|
-
for (; (r = this.tag()[1]) !==
|
|
796
|
+
for (; (r = this.tag()[1]) !== L.EndGroup; )
|
|
797
797
|
this.skip(r);
|
|
798
798
|
break;
|
|
799
799
|
default:
|
|
@@ -897,37 +897,37 @@ class gn {
|
|
|
897
897
|
return this.textDecoder.decode(this.bytes());
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
|
-
function
|
|
900
|
+
function m(n, e) {
|
|
901
901
|
if (!n)
|
|
902
902
|
throw new Error(e);
|
|
903
903
|
}
|
|
904
|
-
const
|
|
905
|
-
function
|
|
904
|
+
const In = 34028234663852886e22, Nn = -34028234663852886e22, En = 4294967295, Tn = 2147483647, Rn = -2147483648;
|
|
905
|
+
function he(n) {
|
|
906
906
|
if (typeof n != "number")
|
|
907
907
|
throw new Error("invalid int 32: " + typeof n);
|
|
908
|
-
if (!Number.isInteger(n) || n >
|
|
908
|
+
if (!Number.isInteger(n) || n > Tn || n < Rn)
|
|
909
909
|
throw new Error("invalid int 32: " + n);
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function Ce(n) {
|
|
912
912
|
if (typeof n != "number")
|
|
913
913
|
throw new Error("invalid uint 32: " + typeof n);
|
|
914
|
-
if (!Number.isInteger(n) || n >
|
|
914
|
+
if (!Number.isInteger(n) || n > En || n < 0)
|
|
915
915
|
throw new Error("invalid uint 32: " + n);
|
|
916
916
|
}
|
|
917
|
-
function
|
|
917
|
+
function tt(n) {
|
|
918
918
|
if (typeof n != "number")
|
|
919
919
|
throw new Error("invalid float 32: " + typeof n);
|
|
920
|
-
if (Number.isFinite(n) && (n >
|
|
920
|
+
if (Number.isFinite(n) && (n > In || n < Nn))
|
|
921
921
|
throw new Error("invalid float 32: " + n);
|
|
922
922
|
}
|
|
923
|
-
const
|
|
923
|
+
const ut = {
|
|
924
924
|
writeUnknownFields: !0,
|
|
925
|
-
writerFactory: () => new
|
|
925
|
+
writerFactory: () => new Ln()
|
|
926
926
|
};
|
|
927
|
-
function
|
|
928
|
-
return n ? Object.assign(Object.assign({},
|
|
927
|
+
function On(n) {
|
|
928
|
+
return n ? Object.assign(Object.assign({}, ut), n) : ut;
|
|
929
929
|
}
|
|
930
|
-
class
|
|
930
|
+
class Ln {
|
|
931
931
|
constructor(e) {
|
|
932
932
|
this.stack = [], this.textEncoder = e ?? new TextEncoder(), this.chunks = [], this.buf = [];
|
|
933
933
|
}
|
|
@@ -983,7 +983,7 @@ class kn {
|
|
|
983
983
|
* Write a `uint32` value, an unsigned 32 bit varint.
|
|
984
984
|
*/
|
|
985
985
|
uint32(e) {
|
|
986
|
-
for (
|
|
986
|
+
for (Ce(e); e > 127; )
|
|
987
987
|
this.buf.push(e & 127 | 128), e = e >>> 7;
|
|
988
988
|
return this.buf.push(e), this;
|
|
989
989
|
}
|
|
@@ -991,7 +991,7 @@ class kn {
|
|
|
991
991
|
* Write a `int32` value, a signed 32 bit varint.
|
|
992
992
|
*/
|
|
993
993
|
int32(e) {
|
|
994
|
-
return
|
|
994
|
+
return he(e), at(e, this.buf), this;
|
|
995
995
|
}
|
|
996
996
|
/**
|
|
997
997
|
* Write a `bool` value, a variant.
|
|
@@ -1016,7 +1016,7 @@ class kn {
|
|
|
1016
1016
|
* Write a `float` value, 32-bit floating point number.
|
|
1017
1017
|
*/
|
|
1018
1018
|
float(e) {
|
|
1019
|
-
|
|
1019
|
+
tt(e);
|
|
1020
1020
|
let t = new Uint8Array(4);
|
|
1021
1021
|
return new DataView(t.buffer).setFloat32(0, e, !0), this.raw(t);
|
|
1022
1022
|
}
|
|
@@ -1031,7 +1031,7 @@ class kn {
|
|
|
1031
1031
|
* Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
|
|
1032
1032
|
*/
|
|
1033
1033
|
fixed32(e) {
|
|
1034
|
-
|
|
1034
|
+
Ce(e);
|
|
1035
1035
|
let t = new Uint8Array(4);
|
|
1036
1036
|
return new DataView(t.buffer).setUint32(0, e, !0), this.raw(t);
|
|
1037
1037
|
}
|
|
@@ -1039,7 +1039,7 @@ class kn {
|
|
|
1039
1039
|
* Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
|
|
1040
1040
|
*/
|
|
1041
1041
|
sfixed32(e) {
|
|
1042
|
-
|
|
1042
|
+
he(e);
|
|
1043
1043
|
let t = new Uint8Array(4);
|
|
1044
1044
|
return new DataView(t.buffer).setInt32(0, e, !0), this.raw(t);
|
|
1045
1045
|
}
|
|
@@ -1047,7 +1047,7 @@ class kn {
|
|
|
1047
1047
|
* Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
|
|
1048
1048
|
*/
|
|
1049
1049
|
sint32(e) {
|
|
1050
|
-
return
|
|
1050
|
+
return he(e), e = (e << 1 ^ e >> 31) >>> 0, at(e, this.buf), this;
|
|
1051
1051
|
}
|
|
1052
1052
|
/**
|
|
1053
1053
|
* Write a `fixed64` value, a signed, fixed-length 64-bit integer.
|
|
@@ -1068,39 +1068,39 @@ class kn {
|
|
|
1068
1068
|
*/
|
|
1069
1069
|
int64(e) {
|
|
1070
1070
|
let t = S.from(e);
|
|
1071
|
-
return
|
|
1071
|
+
return $e(t.lo, t.hi, this.buf), this;
|
|
1072
1072
|
}
|
|
1073
1073
|
/**
|
|
1074
1074
|
* Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
|
|
1075
1075
|
*/
|
|
1076
1076
|
sint64(e) {
|
|
1077
1077
|
let t = S.from(e), i = t.hi >> 31, r = t.lo << 1 ^ i, s = (t.hi << 1 | t.lo >>> 31) ^ i;
|
|
1078
|
-
return
|
|
1078
|
+
return $e(r, s, this.buf), this;
|
|
1079
1079
|
}
|
|
1080
1080
|
/**
|
|
1081
1081
|
* Write a `uint64` value, an unsigned 64-bit varint.
|
|
1082
1082
|
*/
|
|
1083
1083
|
uint64(e) {
|
|
1084
1084
|
let t = M.from(e);
|
|
1085
|
-
return
|
|
1085
|
+
return $e(t.lo, t.hi, this.buf), this;
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
|
-
const
|
|
1088
|
+
const ft = {
|
|
1089
1089
|
emitDefaultValues: !1,
|
|
1090
1090
|
enumAsInteger: !1,
|
|
1091
1091
|
useProtoFieldName: !1,
|
|
1092
1092
|
prettySpaces: 0
|
|
1093
|
-
},
|
|
1093
|
+
}, ht = {
|
|
1094
1094
|
ignoreUnknownFields: !1
|
|
1095
1095
|
};
|
|
1096
|
-
function
|
|
1097
|
-
return n ? Object.assign(Object.assign({},
|
|
1096
|
+
function Sn(n) {
|
|
1097
|
+
return n ? Object.assign(Object.assign({}, ht), n) : ht;
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1100
|
-
return n ? Object.assign(Object.assign({},
|
|
1099
|
+
function Fn(n) {
|
|
1100
|
+
return n ? Object.assign(Object.assign({}, ft), n) : ft;
|
|
1101
1101
|
}
|
|
1102
|
-
const
|
|
1103
|
-
function
|
|
1102
|
+
const xt = Symbol.for("protobuf-ts/message-type");
|
|
1103
|
+
function lt(n) {
|
|
1104
1104
|
let e = !1;
|
|
1105
1105
|
const t = [];
|
|
1106
1106
|
for (let i = 0; i < n.length; i++) {
|
|
@@ -1109,23 +1109,23 @@ function at(n) {
|
|
|
1109
1109
|
}
|
|
1110
1110
|
return t.join("");
|
|
1111
1111
|
}
|
|
1112
|
-
var
|
|
1112
|
+
var u;
|
|
1113
1113
|
(function(n) {
|
|
1114
1114
|
n[n.DOUBLE = 1] = "DOUBLE", n[n.FLOAT = 2] = "FLOAT", n[n.INT64 = 3] = "INT64", n[n.UINT64 = 4] = "UINT64", n[n.INT32 = 5] = "INT32", n[n.FIXED64 = 6] = "FIXED64", n[n.FIXED32 = 7] = "FIXED32", n[n.BOOL = 8] = "BOOL", n[n.STRING = 9] = "STRING", n[n.BYTES = 12] = "BYTES", n[n.UINT32 = 13] = "UINT32", n[n.SFIXED32 = 15] = "SFIXED32", n[n.SFIXED64 = 16] = "SFIXED64", n[n.SINT32 = 17] = "SINT32", n[n.SINT64 = 18] = "SINT64";
|
|
1115
|
-
})(
|
|
1116
|
-
var
|
|
1115
|
+
})(u || (u = {}));
|
|
1116
|
+
var K;
|
|
1117
1117
|
(function(n) {
|
|
1118
1118
|
n[n.BIGINT = 0] = "BIGINT", n[n.STRING = 1] = "STRING", n[n.NUMBER = 2] = "NUMBER";
|
|
1119
|
-
})(
|
|
1120
|
-
var
|
|
1119
|
+
})(K || (K = {}));
|
|
1120
|
+
var Me;
|
|
1121
1121
|
(function(n) {
|
|
1122
1122
|
n[n.NO = 0] = "NO", n[n.PACKED = 1] = "PACKED", n[n.UNPACKED = 2] = "UNPACKED";
|
|
1123
|
-
})(
|
|
1124
|
-
function
|
|
1123
|
+
})(Me || (Me = {}));
|
|
1124
|
+
function Cn(n) {
|
|
1125
1125
|
var e, t, i, r;
|
|
1126
|
-
return n.localName = (e = n.localName) !== null && e !== void 0 ? e :
|
|
1126
|
+
return n.localName = (e = n.localName) !== null && e !== void 0 ? e : lt(n.name), n.jsonName = (t = n.jsonName) !== null && t !== void 0 ? t : lt(n.name), n.repeat = (i = n.repeat) !== null && i !== void 0 ? i : Me.NO, n.opt = (r = n.opt) !== null && r !== void 0 ? r : n.repeat || n.oneof ? !1 : n.kind == "message", n;
|
|
1127
1127
|
}
|
|
1128
|
-
function
|
|
1128
|
+
function Mn(n) {
|
|
1129
1129
|
if (typeof n != "object" || n === null || !n.hasOwnProperty("oneofKind"))
|
|
1130
1130
|
return !1;
|
|
1131
1131
|
switch (typeof n.oneofKind) {
|
|
@@ -1137,7 +1137,7 @@ function Tn(n) {
|
|
|
1137
1137
|
return !1;
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
|
-
class
|
|
1140
|
+
class An {
|
|
1141
1141
|
constructor(e) {
|
|
1142
1142
|
var t;
|
|
1143
1143
|
this.fields = (t = e.fields) !== null && t !== void 0 ? t : [];
|
|
@@ -1197,7 +1197,7 @@ class Rn {
|
|
|
1197
1197
|
return !0;
|
|
1198
1198
|
for (const o of s.oneofs) {
|
|
1199
1199
|
const a = e[o];
|
|
1200
|
-
if (!
|
|
1200
|
+
if (!Mn(a))
|
|
1201
1201
|
return !1;
|
|
1202
1202
|
if (a.oneofKind === void 0)
|
|
1203
1203
|
continue;
|
|
@@ -1216,7 +1216,7 @@ class Rn {
|
|
|
1216
1216
|
case "scalar":
|
|
1217
1217
|
return e === void 0 ? t.opt : s ? this.scalars(e, t.T, r, t.L) : this.scalar(e, t.T, t.L);
|
|
1218
1218
|
case "enum":
|
|
1219
|
-
return e === void 0 ? t.opt : s ? this.scalars(e,
|
|
1219
|
+
return e === void 0 ? t.opt : s ? this.scalars(e, u.INT32, r) : this.scalar(e, u.INT32);
|
|
1220
1220
|
case "message":
|
|
1221
1221
|
return e === void 0 ? !0 : s ? this.messages(e, t.T(), i, r) : this.message(e, t.T(), i, r);
|
|
1222
1222
|
case "map":
|
|
@@ -1230,7 +1230,7 @@ class Rn {
|
|
|
1230
1230
|
case "scalar":
|
|
1231
1231
|
return this.scalars(Object.values(e), t.V.T, r, t.V.L);
|
|
1232
1232
|
case "enum":
|
|
1233
|
-
return this.scalars(Object.values(e),
|
|
1233
|
+
return this.scalars(Object.values(e), u.INT32, r);
|
|
1234
1234
|
case "message":
|
|
1235
1235
|
return this.messages(Object.values(e), t.V.T(), i, r);
|
|
1236
1236
|
}
|
|
@@ -1259,27 +1259,27 @@ class Rn {
|
|
|
1259
1259
|
scalar(e, t, i) {
|
|
1260
1260
|
let r = typeof e;
|
|
1261
1261
|
switch (t) {
|
|
1262
|
-
case
|
|
1263
|
-
case
|
|
1264
|
-
case
|
|
1265
|
-
case
|
|
1266
|
-
case
|
|
1262
|
+
case u.UINT64:
|
|
1263
|
+
case u.FIXED64:
|
|
1264
|
+
case u.INT64:
|
|
1265
|
+
case u.SFIXED64:
|
|
1266
|
+
case u.SINT64:
|
|
1267
1267
|
switch (i) {
|
|
1268
|
-
case
|
|
1268
|
+
case K.BIGINT:
|
|
1269
1269
|
return r == "bigint";
|
|
1270
|
-
case
|
|
1270
|
+
case K.NUMBER:
|
|
1271
1271
|
return r == "number" && !isNaN(e);
|
|
1272
1272
|
default:
|
|
1273
1273
|
return r == "string";
|
|
1274
1274
|
}
|
|
1275
|
-
case
|
|
1275
|
+
case u.BOOL:
|
|
1276
1276
|
return r == "boolean";
|
|
1277
|
-
case
|
|
1277
|
+
case u.STRING:
|
|
1278
1278
|
return r == "string";
|
|
1279
|
-
case
|
|
1279
|
+
case u.BYTES:
|
|
1280
1280
|
return e instanceof Uint8Array;
|
|
1281
|
-
case
|
|
1282
|
-
case
|
|
1281
|
+
case u.DOUBLE:
|
|
1282
|
+
case u.FLOAT:
|
|
1283
1283
|
return r == "number" && !isNaN(e);
|
|
1284
1284
|
default:
|
|
1285
1285
|
return r == "number" && Number.isInteger(e);
|
|
@@ -1300,30 +1300,30 @@ class Rn {
|
|
|
1300
1300
|
mapKeys(e, t, i) {
|
|
1301
1301
|
let r = Object.keys(e);
|
|
1302
1302
|
switch (t) {
|
|
1303
|
-
case
|
|
1304
|
-
case
|
|
1305
|
-
case
|
|
1306
|
-
case
|
|
1307
|
-
case
|
|
1303
|
+
case u.INT32:
|
|
1304
|
+
case u.FIXED32:
|
|
1305
|
+
case u.SFIXED32:
|
|
1306
|
+
case u.SINT32:
|
|
1307
|
+
case u.UINT32:
|
|
1308
1308
|
return this.scalars(r.slice(0, i).map((s) => parseInt(s)), t, i);
|
|
1309
|
-
case
|
|
1309
|
+
case u.BOOL:
|
|
1310
1310
|
return this.scalars(r.slice(0, i).map((s) => s == "true" ? !0 : s == "false" ? !1 : s), t, i);
|
|
1311
1311
|
default:
|
|
1312
|
-
return this.scalars(r, t, i,
|
|
1312
|
+
return this.scalars(r, t, i, K.STRING);
|
|
1313
1313
|
}
|
|
1314
1314
|
}
|
|
1315
1315
|
}
|
|
1316
1316
|
function _(n, e) {
|
|
1317
1317
|
switch (e) {
|
|
1318
|
-
case
|
|
1318
|
+
case K.BIGINT:
|
|
1319
1319
|
return n.toBigInt();
|
|
1320
|
-
case
|
|
1320
|
+
case K.NUMBER:
|
|
1321
1321
|
return n.toNumber();
|
|
1322
1322
|
default:
|
|
1323
1323
|
return n.toString();
|
|
1324
1324
|
}
|
|
1325
1325
|
}
|
|
1326
|
-
class
|
|
1326
|
+
class Dn {
|
|
1327
1327
|
constructor(e) {
|
|
1328
1328
|
this.info = e;
|
|
1329
1329
|
}
|
|
@@ -1339,7 +1339,7 @@ class On {
|
|
|
1339
1339
|
// Cannot parse JSON <type of jsonValue> for <type name>#<fieldName>.
|
|
1340
1340
|
assert(e, t, i) {
|
|
1341
1341
|
if (!e) {
|
|
1342
|
-
let r =
|
|
1342
|
+
let r = Ft(i);
|
|
1343
1343
|
throw (r == "number" || r == "boolean") && (r = i.toString()), new Error(`Cannot parse JSON ${r} for ${this.info.typeName}#${t}`);
|
|
1344
1344
|
}
|
|
1345
1345
|
}
|
|
@@ -1377,48 +1377,48 @@ class On {
|
|
|
1377
1377
|
if (a.kind == "map") {
|
|
1378
1378
|
if (o === null)
|
|
1379
1379
|
continue;
|
|
1380
|
-
this.assert(
|
|
1380
|
+
this.assert(gn(o), a.name, o);
|
|
1381
1381
|
const d = h[f];
|
|
1382
|
-
for (const [
|
|
1383
|
-
this.assert(
|
|
1384
|
-
let
|
|
1382
|
+
for (const [E, g] of Object.entries(o)) {
|
|
1383
|
+
this.assert(g !== null, a.name + " map value", null);
|
|
1384
|
+
let A;
|
|
1385
1385
|
switch (a.V.kind) {
|
|
1386
1386
|
case "message":
|
|
1387
|
-
|
|
1387
|
+
A = a.V.T().internalJsonRead(g, i);
|
|
1388
1388
|
break;
|
|
1389
1389
|
case "enum":
|
|
1390
|
-
if (
|
|
1390
|
+
if (A = this.enum(a.V.T(), g, a.name, i.ignoreUnknownFields), A === !1)
|
|
1391
1391
|
continue;
|
|
1392
1392
|
break;
|
|
1393
1393
|
case "scalar":
|
|
1394
|
-
|
|
1394
|
+
A = this.scalar(g, a.V.T, a.V.L, a.name);
|
|
1395
1395
|
break;
|
|
1396
1396
|
}
|
|
1397
|
-
this.assert(
|
|
1398
|
-
let
|
|
1399
|
-
a.K ==
|
|
1397
|
+
this.assert(A !== void 0, a.name + " map value", g);
|
|
1398
|
+
let U = E;
|
|
1399
|
+
a.K == u.BOOL && (U = U == "true" ? !0 : U == "false" ? !1 : U), U = this.scalar(U, a.K, K.STRING, a.name).toString(), d[U] = A;
|
|
1400
1400
|
}
|
|
1401
1401
|
} else if (a.repeat) {
|
|
1402
1402
|
if (o === null)
|
|
1403
1403
|
continue;
|
|
1404
1404
|
this.assert(Array.isArray(o), a.name, o);
|
|
1405
1405
|
const d = h[f];
|
|
1406
|
-
for (const
|
|
1407
|
-
this.assert(
|
|
1408
|
-
let
|
|
1406
|
+
for (const E of o) {
|
|
1407
|
+
this.assert(E !== null, a.name, null);
|
|
1408
|
+
let g;
|
|
1409
1409
|
switch (a.kind) {
|
|
1410
1410
|
case "message":
|
|
1411
|
-
|
|
1411
|
+
g = a.T().internalJsonRead(E, i);
|
|
1412
1412
|
break;
|
|
1413
1413
|
case "enum":
|
|
1414
|
-
if (
|
|
1414
|
+
if (g = this.enum(a.T(), E, a.name, i.ignoreUnknownFields), g === !1)
|
|
1415
1415
|
continue;
|
|
1416
1416
|
break;
|
|
1417
1417
|
case "scalar":
|
|
1418
|
-
|
|
1418
|
+
g = this.scalar(E, a.T, a.L, a.name);
|
|
1419
1419
|
break;
|
|
1420
1420
|
}
|
|
1421
|
-
this.assert(
|
|
1421
|
+
this.assert(g !== void 0, a.name, o), d.push(g);
|
|
1422
1422
|
}
|
|
1423
1423
|
} else
|
|
1424
1424
|
switch (a.kind) {
|
|
@@ -1451,25 +1451,25 @@ class On {
|
|
|
1451
1451
|
* google.protobuf.NullValue accepts only JSON `null` (or the old `"NULL_VALUE"`).
|
|
1452
1452
|
*/
|
|
1453
1453
|
enum(e, t, i, r) {
|
|
1454
|
-
if (e[0] == "google.protobuf.NullValue" &&
|
|
1454
|
+
if (e[0] == "google.protobuf.NullValue" && m(t === null || t === "NULL_VALUE", `Unable to parse field ${this.info.typeName}#${i}, enum ${e[0]} only accepts null.`), t === null)
|
|
1455
1455
|
return 0;
|
|
1456
1456
|
switch (typeof t) {
|
|
1457
1457
|
case "number":
|
|
1458
|
-
return
|
|
1458
|
+
return m(Number.isInteger(t), `Unable to parse field ${this.info.typeName}#${i}, enum can only be integral number, got ${t}.`), t;
|
|
1459
1459
|
case "string":
|
|
1460
1460
|
let s = t;
|
|
1461
1461
|
e[2] && t.substring(0, e[2].length) === e[2] && (s = t.substring(e[2].length));
|
|
1462
1462
|
let o = e[1][s];
|
|
1463
|
-
return typeof o > "u" && r ? !1 : (
|
|
1463
|
+
return typeof o > "u" && r ? !1 : (m(typeof o == "number", `Unable to parse field ${this.info.typeName}#${i}, enum ${e[0]} has no value for "${t}".`), o);
|
|
1464
1464
|
}
|
|
1465
|
-
|
|
1465
|
+
m(!1, `Unable to parse field ${this.info.typeName}#${i}, cannot parse enum value from ${typeof t}".`);
|
|
1466
1466
|
}
|
|
1467
1467
|
scalar(e, t, i, r) {
|
|
1468
1468
|
let s;
|
|
1469
1469
|
try {
|
|
1470
1470
|
switch (t) {
|
|
1471
|
-
case
|
|
1472
|
-
case
|
|
1471
|
+
case u.DOUBLE:
|
|
1472
|
+
case u.FLOAT:
|
|
1473
1473
|
if (e === null)
|
|
1474
1474
|
return 0;
|
|
1475
1475
|
if (e === "NaN")
|
|
@@ -1497,40 +1497,40 @@ class On {
|
|
|
1497
1497
|
s = "too large or small";
|
|
1498
1498
|
break;
|
|
1499
1499
|
}
|
|
1500
|
-
return t ==
|
|
1501
|
-
case
|
|
1502
|
-
case
|
|
1503
|
-
case
|
|
1504
|
-
case
|
|
1505
|
-
case
|
|
1500
|
+
return t == u.FLOAT && tt(o), o;
|
|
1501
|
+
case u.INT32:
|
|
1502
|
+
case u.FIXED32:
|
|
1503
|
+
case u.SFIXED32:
|
|
1504
|
+
case u.SINT32:
|
|
1505
|
+
case u.UINT32:
|
|
1506
1506
|
if (e === null)
|
|
1507
1507
|
return 0;
|
|
1508
1508
|
let a;
|
|
1509
1509
|
if (typeof e == "number" ? a = e : e === "" ? s = "empty string" : typeof e == "string" && (e.trim().length !== e.length ? s = "extra whitespace" : a = Number(e)), a === void 0)
|
|
1510
1510
|
break;
|
|
1511
|
-
return t ==
|
|
1512
|
-
case
|
|
1513
|
-
case
|
|
1514
|
-
case
|
|
1511
|
+
return t == u.UINT32 ? Ce(a) : he(a), a;
|
|
1512
|
+
case u.INT64:
|
|
1513
|
+
case u.SFIXED64:
|
|
1514
|
+
case u.SINT64:
|
|
1515
1515
|
if (e === null)
|
|
1516
1516
|
return _(S.ZERO, i);
|
|
1517
1517
|
if (typeof e != "number" && typeof e != "string")
|
|
1518
1518
|
break;
|
|
1519
1519
|
return _(S.from(e), i);
|
|
1520
|
-
case
|
|
1521
|
-
case
|
|
1520
|
+
case u.FIXED64:
|
|
1521
|
+
case u.UINT64:
|
|
1522
1522
|
if (e === null)
|
|
1523
1523
|
return _(M.ZERO, i);
|
|
1524
1524
|
if (typeof e != "number" && typeof e != "string")
|
|
1525
1525
|
break;
|
|
1526
1526
|
return _(M.from(e), i);
|
|
1527
|
-
case
|
|
1527
|
+
case u.BOOL:
|
|
1528
1528
|
if (e === null)
|
|
1529
1529
|
return !1;
|
|
1530
1530
|
if (typeof e != "boolean")
|
|
1531
1531
|
break;
|
|
1532
1532
|
return e;
|
|
1533
|
-
case
|
|
1533
|
+
case u.STRING:
|
|
1534
1534
|
if (e === null)
|
|
1535
1535
|
return "";
|
|
1536
1536
|
if (typeof e != "string") {
|
|
@@ -1544,12 +1544,12 @@ class On {
|
|
|
1544
1544
|
break;
|
|
1545
1545
|
}
|
|
1546
1546
|
return e;
|
|
1547
|
-
case
|
|
1547
|
+
case u.BYTES:
|
|
1548
1548
|
if (e === null || e === "")
|
|
1549
1549
|
return new Uint8Array(0);
|
|
1550
1550
|
if (typeof e != "string")
|
|
1551
1551
|
break;
|
|
1552
|
-
return
|
|
1552
|
+
return mn(e);
|
|
1553
1553
|
}
|
|
1554
1554
|
} catch (o) {
|
|
1555
1555
|
s = o.message;
|
|
@@ -1557,7 +1557,7 @@ class On {
|
|
|
1557
1557
|
this.assert(!1, r + (s ? " - " + s : ""), e);
|
|
1558
1558
|
}
|
|
1559
1559
|
}
|
|
1560
|
-
class
|
|
1560
|
+
class xn {
|
|
1561
1561
|
constructor(e) {
|
|
1562
1562
|
var t;
|
|
1563
1563
|
this.fields = (t = e.fields) !== null && t !== void 0 ? t : [];
|
|
@@ -1578,62 +1578,62 @@ class Ln {
|
|
|
1578
1578
|
continue;
|
|
1579
1579
|
const a = s.kind == "scalar" || s.kind == "enum" ? Object.assign(Object.assign({}, t), { emitDefaultValues: !0 }) : t;
|
|
1580
1580
|
let f = this.field(s, o[s.localName], a);
|
|
1581
|
-
|
|
1581
|
+
m(f !== void 0), i[t.useProtoFieldName ? s.name : s.jsonName] = f;
|
|
1582
1582
|
}
|
|
1583
1583
|
return i;
|
|
1584
1584
|
}
|
|
1585
1585
|
field(e, t, i) {
|
|
1586
1586
|
let r;
|
|
1587
1587
|
if (e.kind == "map") {
|
|
1588
|
-
|
|
1588
|
+
m(typeof t == "object" && t !== null);
|
|
1589
1589
|
const s = {};
|
|
1590
1590
|
switch (e.V.kind) {
|
|
1591
1591
|
case "scalar":
|
|
1592
1592
|
for (const [f, h] of Object.entries(t)) {
|
|
1593
1593
|
const d = this.scalar(e.V.T, h, e.name, !1, !0);
|
|
1594
|
-
|
|
1594
|
+
m(d !== void 0), s[f.toString()] = d;
|
|
1595
1595
|
}
|
|
1596
1596
|
break;
|
|
1597
1597
|
case "message":
|
|
1598
1598
|
const o = e.V.T();
|
|
1599
1599
|
for (const [f, h] of Object.entries(t)) {
|
|
1600
1600
|
const d = this.message(o, h, e.name, i);
|
|
1601
|
-
|
|
1601
|
+
m(d !== void 0), s[f.toString()] = d;
|
|
1602
1602
|
}
|
|
1603
1603
|
break;
|
|
1604
1604
|
case "enum":
|
|
1605
1605
|
const a = e.V.T();
|
|
1606
1606
|
for (const [f, h] of Object.entries(t)) {
|
|
1607
|
-
|
|
1607
|
+
m(h === void 0 || typeof h == "number");
|
|
1608
1608
|
const d = this.enum(a, h, e.name, !1, !0, i.enumAsInteger);
|
|
1609
|
-
|
|
1609
|
+
m(d !== void 0), s[f.toString()] = d;
|
|
1610
1610
|
}
|
|
1611
1611
|
break;
|
|
1612
1612
|
}
|
|
1613
1613
|
(i.emitDefaultValues || Object.keys(s).length > 0) && (r = s);
|
|
1614
1614
|
} else if (e.repeat) {
|
|
1615
|
-
|
|
1615
|
+
m(Array.isArray(t));
|
|
1616
1616
|
const s = [];
|
|
1617
1617
|
switch (e.kind) {
|
|
1618
1618
|
case "scalar":
|
|
1619
1619
|
for (let f = 0; f < t.length; f++) {
|
|
1620
1620
|
const h = this.scalar(e.T, t[f], e.name, e.opt, !0);
|
|
1621
|
-
|
|
1621
|
+
m(h !== void 0), s.push(h);
|
|
1622
1622
|
}
|
|
1623
1623
|
break;
|
|
1624
1624
|
case "enum":
|
|
1625
1625
|
const o = e.T();
|
|
1626
1626
|
for (let f = 0; f < t.length; f++) {
|
|
1627
|
-
|
|
1627
|
+
m(t[f] === void 0 || typeof t[f] == "number");
|
|
1628
1628
|
const h = this.enum(o, t[f], e.name, e.opt, !0, i.enumAsInteger);
|
|
1629
|
-
|
|
1629
|
+
m(h !== void 0), s.push(h);
|
|
1630
1630
|
}
|
|
1631
1631
|
break;
|
|
1632
1632
|
case "message":
|
|
1633
1633
|
const a = e.T();
|
|
1634
1634
|
for (let f = 0; f < t.length; f++) {
|
|
1635
1635
|
const h = this.message(a, t[f], e.name, i);
|
|
1636
|
-
|
|
1636
|
+
m(h !== void 0), s.push(h);
|
|
1637
1637
|
}
|
|
1638
1638
|
break;
|
|
1639
1639
|
}
|
|
@@ -1659,76 +1659,76 @@ class Ln {
|
|
|
1659
1659
|
if (e[0] == "google.protobuf.NullValue")
|
|
1660
1660
|
return !s && !r ? void 0 : null;
|
|
1661
1661
|
if (t === void 0) {
|
|
1662
|
-
|
|
1662
|
+
m(r);
|
|
1663
1663
|
return;
|
|
1664
1664
|
}
|
|
1665
1665
|
if (!(t === 0 && !s && !r))
|
|
1666
|
-
return
|
|
1666
|
+
return m(typeof t == "number"), m(Number.isInteger(t)), o || !e[1].hasOwnProperty(t) ? t : e[2] ? e[2] + e[1][t] : e[1][t];
|
|
1667
1667
|
}
|
|
1668
1668
|
message(e, t, i, r) {
|
|
1669
1669
|
return t === void 0 ? r.emitDefaultValues ? null : void 0 : e.internalJsonWrite(t, r);
|
|
1670
1670
|
}
|
|
1671
1671
|
scalar(e, t, i, r, s) {
|
|
1672
1672
|
if (t === void 0) {
|
|
1673
|
-
|
|
1673
|
+
m(r);
|
|
1674
1674
|
return;
|
|
1675
1675
|
}
|
|
1676
1676
|
const o = s || r;
|
|
1677
1677
|
switch (e) {
|
|
1678
|
-
case
|
|
1679
|
-
case
|
|
1680
|
-
case
|
|
1681
|
-
return t === 0 ? o ? 0 : void 0 : (
|
|
1682
|
-
case
|
|
1683
|
-
case
|
|
1684
|
-
return t === 0 ? o ? 0 : void 0 : (
|
|
1685
|
-
case
|
|
1686
|
-
|
|
1687
|
-
case
|
|
1688
|
-
return t === 0 ? o ? 0 : void 0 : (
|
|
1689
|
-
case
|
|
1690
|
-
return t === "" ? o ? "" : void 0 : (
|
|
1691
|
-
case
|
|
1692
|
-
return t === !1 ? o ? !1 : void 0 : (
|
|
1693
|
-
case
|
|
1694
|
-
case
|
|
1695
|
-
|
|
1678
|
+
case u.INT32:
|
|
1679
|
+
case u.SFIXED32:
|
|
1680
|
+
case u.SINT32:
|
|
1681
|
+
return t === 0 ? o ? 0 : void 0 : (he(t), t);
|
|
1682
|
+
case u.FIXED32:
|
|
1683
|
+
case u.UINT32:
|
|
1684
|
+
return t === 0 ? o ? 0 : void 0 : (Ce(t), t);
|
|
1685
|
+
case u.FLOAT:
|
|
1686
|
+
tt(t);
|
|
1687
|
+
case u.DOUBLE:
|
|
1688
|
+
return t === 0 ? o ? 0 : void 0 : (m(typeof t == "number"), Number.isNaN(t) ? "NaN" : t === Number.POSITIVE_INFINITY ? "Infinity" : t === Number.NEGATIVE_INFINITY ? "-Infinity" : t);
|
|
1689
|
+
case u.STRING:
|
|
1690
|
+
return t === "" ? o ? "" : void 0 : (m(typeof t == "string"), t);
|
|
1691
|
+
case u.BOOL:
|
|
1692
|
+
return t === !1 ? o ? !1 : void 0 : (m(typeof t == "boolean"), t);
|
|
1693
|
+
case u.UINT64:
|
|
1694
|
+
case u.FIXED64:
|
|
1695
|
+
m(typeof t == "number" || typeof t == "string" || typeof t == "bigint");
|
|
1696
1696
|
let a = M.from(t);
|
|
1697
1697
|
return a.isZero() && !o ? void 0 : a.toString();
|
|
1698
|
-
case
|
|
1699
|
-
case
|
|
1700
|
-
case
|
|
1701
|
-
|
|
1698
|
+
case u.INT64:
|
|
1699
|
+
case u.SFIXED64:
|
|
1700
|
+
case u.SINT64:
|
|
1701
|
+
m(typeof t == "number" || typeof t == "string" || typeof t == "bigint");
|
|
1702
1702
|
let f = S.from(t);
|
|
1703
1703
|
return f.isZero() && !o ? void 0 : f.toString();
|
|
1704
|
-
case
|
|
1705
|
-
return
|
|
1704
|
+
case u.BYTES:
|
|
1705
|
+
return m(t instanceof Uint8Array), t.byteLength ? pn(t) : o ? "" : void 0;
|
|
1706
1706
|
}
|
|
1707
1707
|
}
|
|
1708
1708
|
}
|
|
1709
|
-
function
|
|
1709
|
+
function Ge(n, e = K.STRING) {
|
|
1710
1710
|
switch (n) {
|
|
1711
|
-
case
|
|
1711
|
+
case u.BOOL:
|
|
1712
1712
|
return !1;
|
|
1713
|
-
case
|
|
1714
|
-
case
|
|
1713
|
+
case u.UINT64:
|
|
1714
|
+
case u.FIXED64:
|
|
1715
1715
|
return _(M.ZERO, e);
|
|
1716
|
-
case
|
|
1717
|
-
case
|
|
1718
|
-
case
|
|
1716
|
+
case u.INT64:
|
|
1717
|
+
case u.SFIXED64:
|
|
1718
|
+
case u.SINT64:
|
|
1719
1719
|
return _(S.ZERO, e);
|
|
1720
|
-
case
|
|
1721
|
-
case
|
|
1720
|
+
case u.DOUBLE:
|
|
1721
|
+
case u.FLOAT:
|
|
1722
1722
|
return 0;
|
|
1723
|
-
case
|
|
1723
|
+
case u.BYTES:
|
|
1724
1724
|
return new Uint8Array(0);
|
|
1725
|
-
case
|
|
1725
|
+
case u.STRING:
|
|
1726
1726
|
return "";
|
|
1727
1727
|
default:
|
|
1728
1728
|
return 0;
|
|
1729
1729
|
}
|
|
1730
1730
|
}
|
|
1731
|
-
class
|
|
1731
|
+
class Bn {
|
|
1732
1732
|
constructor(e) {
|
|
1733
1733
|
this.info = e;
|
|
1734
1734
|
}
|
|
@@ -1754,41 +1754,41 @@ class Sn {
|
|
|
1754
1754
|
for (; e.pos < s; ) {
|
|
1755
1755
|
const [o, a] = e.tag(), f = this.fieldNoToField.get(o);
|
|
1756
1756
|
if (!f) {
|
|
1757
|
-
let
|
|
1758
|
-
if (
|
|
1757
|
+
let g = i.readUnknownField;
|
|
1758
|
+
if (g == "throw")
|
|
1759
1759
|
throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);
|
|
1760
|
-
let
|
|
1761
|
-
|
|
1760
|
+
let A = e.skip(a);
|
|
1761
|
+
g !== !1 && (g === !0 ? Se.onRead : g)(this.info.typeName, t, o, a, A);
|
|
1762
1762
|
continue;
|
|
1763
1763
|
}
|
|
1764
|
-
let h = t, d = f.repeat,
|
|
1765
|
-
switch (f.oneof && (h = h[f.oneof], h.oneofKind !==
|
|
1766
|
-
oneofKind:
|
|
1764
|
+
let h = t, d = f.repeat, E = f.localName;
|
|
1765
|
+
switch (f.oneof && (h = h[f.oneof], h.oneofKind !== E && (h = t[f.oneof] = {
|
|
1766
|
+
oneofKind: E
|
|
1767
1767
|
})), f.kind) {
|
|
1768
1768
|
case "scalar":
|
|
1769
1769
|
case "enum":
|
|
1770
|
-
let
|
|
1770
|
+
let g = f.kind == "enum" ? u.INT32 : f.T, A = f.kind == "scalar" ? f.L : void 0;
|
|
1771
1771
|
if (d) {
|
|
1772
|
-
let
|
|
1773
|
-
if (a ==
|
|
1774
|
-
let
|
|
1775
|
-
for (; e.pos <
|
|
1776
|
-
|
|
1772
|
+
let ye = h[E];
|
|
1773
|
+
if (a == L.LengthDelimited && g != u.STRING && g != u.BYTES) {
|
|
1774
|
+
let Pe = e.uint32() + e.pos;
|
|
1775
|
+
for (; e.pos < Pe; )
|
|
1776
|
+
ye.push(this.scalar(e, g, A));
|
|
1777
1777
|
} else
|
|
1778
|
-
|
|
1778
|
+
ye.push(this.scalar(e, g, A));
|
|
1779
1779
|
} else
|
|
1780
|
-
h[
|
|
1780
|
+
h[E] = this.scalar(e, g, A);
|
|
1781
1781
|
break;
|
|
1782
1782
|
case "message":
|
|
1783
1783
|
if (d) {
|
|
1784
|
-
let
|
|
1785
|
-
|
|
1784
|
+
let ye = h[E], Pe = f.T().internalBinaryRead(e, e.uint32(), i);
|
|
1785
|
+
ye.push(Pe);
|
|
1786
1786
|
} else
|
|
1787
|
-
h[
|
|
1787
|
+
h[E] = f.T().internalBinaryRead(e, e.uint32(), i, h[E]);
|
|
1788
1788
|
break;
|
|
1789
1789
|
case "map":
|
|
1790
|
-
let [
|
|
1791
|
-
h[
|
|
1790
|
+
let [U, Qt] = this.mapEntry(f, e, i);
|
|
1791
|
+
h[E][U] = Qt;
|
|
1792
1792
|
break;
|
|
1793
1793
|
}
|
|
1794
1794
|
}
|
|
@@ -1802,7 +1802,7 @@ class Sn {
|
|
|
1802
1802
|
let [f, h] = t.tag();
|
|
1803
1803
|
switch (f) {
|
|
1804
1804
|
case 1:
|
|
1805
|
-
e.K ==
|
|
1805
|
+
e.K == u.BOOL ? o = t.bool().toString() : o = this.scalar(t, e.K, K.STRING);
|
|
1806
1806
|
break;
|
|
1807
1807
|
case 2:
|
|
1808
1808
|
switch (e.V.kind) {
|
|
@@ -1822,13 +1822,13 @@ class Sn {
|
|
|
1822
1822
|
}
|
|
1823
1823
|
}
|
|
1824
1824
|
if (o === void 0) {
|
|
1825
|
-
let f =
|
|
1826
|
-
o = e.K ==
|
|
1825
|
+
let f = Ge(e.K);
|
|
1826
|
+
o = e.K == u.BOOL ? f.toString() : f;
|
|
1827
1827
|
}
|
|
1828
1828
|
if (a === void 0)
|
|
1829
1829
|
switch (e.V.kind) {
|
|
1830
1830
|
case "scalar":
|
|
1831
|
-
a =
|
|
1831
|
+
a = Ge(e.V.T, e.V.L);
|
|
1832
1832
|
break;
|
|
1833
1833
|
case "enum":
|
|
1834
1834
|
a = 0;
|
|
@@ -1841,40 +1841,40 @@ class Sn {
|
|
|
1841
1841
|
}
|
|
1842
1842
|
scalar(e, t, i) {
|
|
1843
1843
|
switch (t) {
|
|
1844
|
-
case
|
|
1844
|
+
case u.INT32:
|
|
1845
1845
|
return e.int32();
|
|
1846
|
-
case
|
|
1846
|
+
case u.STRING:
|
|
1847
1847
|
return e.string();
|
|
1848
|
-
case
|
|
1848
|
+
case u.BOOL:
|
|
1849
1849
|
return e.bool();
|
|
1850
|
-
case
|
|
1850
|
+
case u.DOUBLE:
|
|
1851
1851
|
return e.double();
|
|
1852
|
-
case
|
|
1852
|
+
case u.FLOAT:
|
|
1853
1853
|
return e.float();
|
|
1854
|
-
case
|
|
1854
|
+
case u.INT64:
|
|
1855
1855
|
return _(e.int64(), i);
|
|
1856
|
-
case
|
|
1856
|
+
case u.UINT64:
|
|
1857
1857
|
return _(e.uint64(), i);
|
|
1858
|
-
case
|
|
1858
|
+
case u.FIXED64:
|
|
1859
1859
|
return _(e.fixed64(), i);
|
|
1860
|
-
case
|
|
1860
|
+
case u.FIXED32:
|
|
1861
1861
|
return e.fixed32();
|
|
1862
|
-
case
|
|
1862
|
+
case u.BYTES:
|
|
1863
1863
|
return e.bytes();
|
|
1864
|
-
case
|
|
1864
|
+
case u.UINT32:
|
|
1865
1865
|
return e.uint32();
|
|
1866
|
-
case
|
|
1866
|
+
case u.SFIXED32:
|
|
1867
1867
|
return e.sfixed32();
|
|
1868
|
-
case
|
|
1868
|
+
case u.SFIXED64:
|
|
1869
1869
|
return _(e.sfixed64(), i);
|
|
1870
|
-
case
|
|
1870
|
+
case u.SINT32:
|
|
1871
1871
|
return e.sint32();
|
|
1872
|
-
case
|
|
1872
|
+
case u.SINT64:
|
|
1873
1873
|
return _(e.sint64(), i);
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
|
-
class
|
|
1877
|
+
class _n {
|
|
1878
1878
|
constructor(e) {
|
|
1879
1879
|
this.info = e;
|
|
1880
1880
|
}
|
|
@@ -1901,47 +1901,47 @@ class Fn {
|
|
|
1901
1901
|
switch (s.kind) {
|
|
1902
1902
|
case "scalar":
|
|
1903
1903
|
case "enum":
|
|
1904
|
-
let d = s.kind == "enum" ?
|
|
1904
|
+
let d = s.kind == "enum" ? u.INT32 : s.T;
|
|
1905
1905
|
if (f)
|
|
1906
|
-
if (
|
|
1906
|
+
if (m(Array.isArray(o)), f == Me.PACKED)
|
|
1907
1907
|
this.packed(t, d, s.no, o);
|
|
1908
1908
|
else
|
|
1909
|
-
for (const
|
|
1910
|
-
this.scalar(t, d, s.no,
|
|
1909
|
+
for (const E of o)
|
|
1910
|
+
this.scalar(t, d, s.no, E, !0);
|
|
1911
1911
|
else
|
|
1912
|
-
o === void 0 ?
|
|
1912
|
+
o === void 0 ? m(s.opt) : this.scalar(t, d, s.no, o, a || s.opt);
|
|
1913
1913
|
break;
|
|
1914
1914
|
case "message":
|
|
1915
1915
|
if (f) {
|
|
1916
|
-
|
|
1917
|
-
for (const
|
|
1918
|
-
this.message(t, i, s.T(), s.no,
|
|
1916
|
+
m(Array.isArray(o));
|
|
1917
|
+
for (const E of o)
|
|
1918
|
+
this.message(t, i, s.T(), s.no, E);
|
|
1919
1919
|
} else
|
|
1920
1920
|
this.message(t, i, s.T(), s.no, o);
|
|
1921
1921
|
break;
|
|
1922
1922
|
case "map":
|
|
1923
|
-
|
|
1924
|
-
for (const [
|
|
1925
|
-
this.mapEntry(t, i, s,
|
|
1923
|
+
m(typeof o == "object" && o !== null);
|
|
1924
|
+
for (const [E, g] of Object.entries(o))
|
|
1925
|
+
this.mapEntry(t, i, s, E, g);
|
|
1926
1926
|
break;
|
|
1927
1927
|
}
|
|
1928
1928
|
}
|
|
1929
1929
|
let r = i.writeUnknownFields;
|
|
1930
|
-
r !== !1 && (r === !0 ?
|
|
1930
|
+
r !== !1 && (r === !0 ? Se.onWrite : r)(this.info.typeName, e, t);
|
|
1931
1931
|
}
|
|
1932
1932
|
mapEntry(e, t, i, r, s) {
|
|
1933
|
-
e.tag(i.no,
|
|
1933
|
+
e.tag(i.no, L.LengthDelimited), e.fork();
|
|
1934
1934
|
let o = r;
|
|
1935
1935
|
switch (i.K) {
|
|
1936
|
-
case
|
|
1937
|
-
case
|
|
1938
|
-
case
|
|
1939
|
-
case
|
|
1940
|
-
case
|
|
1936
|
+
case u.INT32:
|
|
1937
|
+
case u.FIXED32:
|
|
1938
|
+
case u.UINT32:
|
|
1939
|
+
case u.SFIXED32:
|
|
1940
|
+
case u.SINT32:
|
|
1941
1941
|
o = Number.parseInt(r);
|
|
1942
1942
|
break;
|
|
1943
|
-
case
|
|
1944
|
-
|
|
1943
|
+
case u.BOOL:
|
|
1944
|
+
m(r == "true" || r == "false"), o = r == "true";
|
|
1945
1945
|
break;
|
|
1946
1946
|
}
|
|
1947
1947
|
switch (this.scalar(e, i.K, 1, o, !0), i.V.kind) {
|
|
@@ -1949,7 +1949,7 @@ class Fn {
|
|
|
1949
1949
|
this.scalar(e, i.V.T, 2, s, !0);
|
|
1950
1950
|
break;
|
|
1951
1951
|
case "enum":
|
|
1952
|
-
this.scalar(e,
|
|
1952
|
+
this.scalar(e, u.INT32, 2, s, !0);
|
|
1953
1953
|
break;
|
|
1954
1954
|
case "message":
|
|
1955
1955
|
this.message(e, t, i.V.T(), 2, s);
|
|
@@ -1958,7 +1958,7 @@ class Fn {
|
|
|
1958
1958
|
e.join();
|
|
1959
1959
|
}
|
|
1960
1960
|
message(e, t, i, r, s) {
|
|
1961
|
-
s !== void 0 && (i.internalBinaryWrite(s, e.tag(r,
|
|
1961
|
+
s !== void 0 && (i.internalBinaryWrite(s, e.tag(r, L.LengthDelimited).fork(), t), e.join());
|
|
1962
1962
|
}
|
|
1963
1963
|
/**
|
|
1964
1964
|
* Write a single scalar value.
|
|
@@ -1973,7 +1973,7 @@ class Fn {
|
|
|
1973
1973
|
packed(e, t, i, r) {
|
|
1974
1974
|
if (!r.length)
|
|
1975
1975
|
return;
|
|
1976
|
-
|
|
1976
|
+
m(t !== u.BYTES && t !== u.STRING), e.tag(i, L.LengthDelimited), e.fork();
|
|
1977
1977
|
let [, s] = this.scalarInfo(t);
|
|
1978
1978
|
for (let o = 0; o < r.length; o++)
|
|
1979
1979
|
e[s](r[o]);
|
|
@@ -1990,59 +1990,59 @@ class Fn {
|
|
|
1990
1990
|
* If argument `value` is omitted, [2] is always false.
|
|
1991
1991
|
*/
|
|
1992
1992
|
scalarInfo(e, t) {
|
|
1993
|
-
let i =
|
|
1993
|
+
let i = L.Varint, r, s = t === void 0, o = t === 0;
|
|
1994
1994
|
switch (e) {
|
|
1995
|
-
case
|
|
1995
|
+
case u.INT32:
|
|
1996
1996
|
r = "int32";
|
|
1997
1997
|
break;
|
|
1998
|
-
case
|
|
1999
|
-
o = s || !t.length, i =
|
|
1998
|
+
case u.STRING:
|
|
1999
|
+
o = s || !t.length, i = L.LengthDelimited, r = "string";
|
|
2000
2000
|
break;
|
|
2001
|
-
case
|
|
2001
|
+
case u.BOOL:
|
|
2002
2002
|
o = t === !1, r = "bool";
|
|
2003
2003
|
break;
|
|
2004
|
-
case
|
|
2004
|
+
case u.UINT32:
|
|
2005
2005
|
r = "uint32";
|
|
2006
2006
|
break;
|
|
2007
|
-
case
|
|
2008
|
-
i =
|
|
2007
|
+
case u.DOUBLE:
|
|
2008
|
+
i = L.Bit64, r = "double";
|
|
2009
2009
|
break;
|
|
2010
|
-
case
|
|
2011
|
-
i =
|
|
2010
|
+
case u.FLOAT:
|
|
2011
|
+
i = L.Bit32, r = "float";
|
|
2012
2012
|
break;
|
|
2013
|
-
case
|
|
2013
|
+
case u.INT64:
|
|
2014
2014
|
o = s || S.from(t).isZero(), r = "int64";
|
|
2015
2015
|
break;
|
|
2016
|
-
case
|
|
2016
|
+
case u.UINT64:
|
|
2017
2017
|
o = s || M.from(t).isZero(), r = "uint64";
|
|
2018
2018
|
break;
|
|
2019
|
-
case
|
|
2020
|
-
o = s || M.from(t).isZero(), i =
|
|
2019
|
+
case u.FIXED64:
|
|
2020
|
+
o = s || M.from(t).isZero(), i = L.Bit64, r = "fixed64";
|
|
2021
2021
|
break;
|
|
2022
|
-
case
|
|
2023
|
-
o = s || !t.byteLength, i =
|
|
2022
|
+
case u.BYTES:
|
|
2023
|
+
o = s || !t.byteLength, i = L.LengthDelimited, r = "bytes";
|
|
2024
2024
|
break;
|
|
2025
|
-
case
|
|
2026
|
-
i =
|
|
2025
|
+
case u.FIXED32:
|
|
2026
|
+
i = L.Bit32, r = "fixed32";
|
|
2027
2027
|
break;
|
|
2028
|
-
case
|
|
2029
|
-
i =
|
|
2028
|
+
case u.SFIXED32:
|
|
2029
|
+
i = L.Bit32, r = "sfixed32";
|
|
2030
2030
|
break;
|
|
2031
|
-
case
|
|
2032
|
-
o = s || S.from(t).isZero(), i =
|
|
2031
|
+
case u.SFIXED64:
|
|
2032
|
+
o = s || S.from(t).isZero(), i = L.Bit64, r = "sfixed64";
|
|
2033
2033
|
break;
|
|
2034
|
-
case
|
|
2034
|
+
case u.SINT32:
|
|
2035
2035
|
r = "sint32";
|
|
2036
2036
|
break;
|
|
2037
|
-
case
|
|
2037
|
+
case u.SINT64:
|
|
2038
2038
|
o = s || S.from(t).isZero(), r = "sint64";
|
|
2039
2039
|
break;
|
|
2040
2040
|
}
|
|
2041
2041
|
return [i, r, s || o];
|
|
2042
2042
|
}
|
|
2043
2043
|
}
|
|
2044
|
-
function
|
|
2045
|
-
const e = n.messagePrototype ? Object.create(n.messagePrototype) : Object.defineProperty({},
|
|
2044
|
+
function Vn(n) {
|
|
2045
|
+
const e = n.messagePrototype ? Object.create(n.messagePrototype) : Object.defineProperty({}, xt, { value: n });
|
|
2046
2046
|
for (let t of n.fields) {
|
|
2047
2047
|
let i = t.localName;
|
|
2048
2048
|
if (!t.opt)
|
|
@@ -2053,7 +2053,7 @@ function Cn(n) {
|
|
|
2053
2053
|
else
|
|
2054
2054
|
switch (t.kind) {
|
|
2055
2055
|
case "scalar":
|
|
2056
|
-
e[i] =
|
|
2056
|
+
e[i] = Ge(t.T, t.L);
|
|
2057
2057
|
break;
|
|
2058
2058
|
case "enum":
|
|
2059
2059
|
e[i] = 0;
|
|
@@ -2065,7 +2065,7 @@ function Cn(n) {
|
|
|
2065
2065
|
}
|
|
2066
2066
|
return e;
|
|
2067
2067
|
}
|
|
2068
|
-
function
|
|
2068
|
+
function je(n, e, t) {
|
|
2069
2069
|
let i, r = t, s;
|
|
2070
2070
|
for (let o of n.fields) {
|
|
2071
2071
|
let a = o.localName;
|
|
@@ -2112,7 +2112,7 @@ function Ke(n, e, t) {
|
|
|
2112
2112
|
}
|
|
2113
2113
|
}
|
|
2114
2114
|
}
|
|
2115
|
-
function
|
|
2115
|
+
function Kn(n, e, t) {
|
|
2116
2116
|
if (e === t)
|
|
2117
2117
|
return !0;
|
|
2118
2118
|
if (!e || !t)
|
|
@@ -2122,28 +2122,28 @@ function Mn(n, e, t) {
|
|
|
2122
2122
|
switch (i.kind) {
|
|
2123
2123
|
case "enum":
|
|
2124
2124
|
case "scalar":
|
|
2125
|
-
let a = i.kind == "enum" ?
|
|
2126
|
-
if (!(i.repeat ?
|
|
2125
|
+
let a = i.kind == "enum" ? u.INT32 : i.T;
|
|
2126
|
+
if (!(i.repeat ? dt(a, s, o) : Bt(a, s, o)))
|
|
2127
2127
|
return !1;
|
|
2128
2128
|
break;
|
|
2129
2129
|
case "map":
|
|
2130
|
-
if (!(i.V.kind == "message" ?
|
|
2130
|
+
if (!(i.V.kind == "message" ? gt(i.V.T(), ke(s), ke(o)) : dt(i.V.kind == "enum" ? u.INT32 : i.V.T, ke(s), ke(o))))
|
|
2131
2131
|
return !1;
|
|
2132
2132
|
break;
|
|
2133
2133
|
case "message":
|
|
2134
2134
|
let f = i.T();
|
|
2135
|
-
if (!(i.repeat ?
|
|
2135
|
+
if (!(i.repeat ? gt(f, s, o) : f.equals(s, o)))
|
|
2136
2136
|
return !1;
|
|
2137
2137
|
break;
|
|
2138
2138
|
}
|
|
2139
2139
|
}
|
|
2140
2140
|
return !0;
|
|
2141
2141
|
}
|
|
2142
|
-
const
|
|
2143
|
-
function
|
|
2142
|
+
const ke = Object.values;
|
|
2143
|
+
function Bt(n, e, t) {
|
|
2144
2144
|
if (e === t)
|
|
2145
2145
|
return !0;
|
|
2146
|
-
if (n !==
|
|
2146
|
+
if (n !== u.BYTES)
|
|
2147
2147
|
return !1;
|
|
2148
2148
|
let i = e, r = t;
|
|
2149
2149
|
if (i.length !== r.length)
|
|
@@ -2153,15 +2153,15 @@ function Ft(n, e, t) {
|
|
|
2153
2153
|
return !1;
|
|
2154
2154
|
return !0;
|
|
2155
2155
|
}
|
|
2156
|
-
function
|
|
2156
|
+
function dt(n, e, t) {
|
|
2157
2157
|
if (e.length !== t.length)
|
|
2158
2158
|
return !1;
|
|
2159
2159
|
for (let i = 0; i < e.length; i++)
|
|
2160
|
-
if (!
|
|
2160
|
+
if (!Bt(n, e[i], t[i]))
|
|
2161
2161
|
return !1;
|
|
2162
2162
|
return !0;
|
|
2163
2163
|
}
|
|
2164
|
-
function
|
|
2164
|
+
function gt(n, e, t) {
|
|
2165
2165
|
if (e.length !== t.length)
|
|
2166
2166
|
return !1;
|
|
2167
2167
|
for (let i = 0; i < e.length; i++)
|
|
@@ -2169,14 +2169,14 @@ function ut(n, e, t) {
|
|
|
2169
2169
|
return !1;
|
|
2170
2170
|
return !0;
|
|
2171
2171
|
}
|
|
2172
|
-
const
|
|
2173
|
-
class
|
|
2172
|
+
const _t = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})), Un = _t[xt] = {};
|
|
2173
|
+
class Pn {
|
|
2174
2174
|
constructor(e, t, i) {
|
|
2175
|
-
this.defaultCheckDepth = 16, this.typeName = e, this.fields = t.map(
|
|
2175
|
+
this.defaultCheckDepth = 16, this.typeName = e, this.fields = t.map(Cn), this.options = i ?? {}, Un.value = this, this.messagePrototype = Object.create(null, _t), this.refTypeCheck = new An(this), this.refJsonReader = new Dn(this), this.refJsonWriter = new xn(this), this.refBinReader = new Bn(this), this.refBinWriter = new _n(this);
|
|
2176
2176
|
}
|
|
2177
2177
|
create(e) {
|
|
2178
|
-
let t =
|
|
2179
|
-
return e !== void 0 &&
|
|
2178
|
+
let t = Vn(this);
|
|
2179
|
+
return e !== void 0 && je(this, t, e), t;
|
|
2180
2180
|
}
|
|
2181
2181
|
/**
|
|
2182
2182
|
* Clone the message.
|
|
@@ -2185,7 +2185,7 @@ class Dn {
|
|
|
2185
2185
|
*/
|
|
2186
2186
|
clone(e) {
|
|
2187
2187
|
let t = this.create();
|
|
2188
|
-
return
|
|
2188
|
+
return je(this, t, e), t;
|
|
2189
2189
|
}
|
|
2190
2190
|
/**
|
|
2191
2191
|
* Determines whether two message of the same type have the same field values.
|
|
@@ -2194,7 +2194,7 @@ class Dn {
|
|
|
2194
2194
|
* Will also return true if both messages are `undefined`.
|
|
2195
2195
|
*/
|
|
2196
2196
|
equals(e, t) {
|
|
2197
|
-
return
|
|
2197
|
+
return Kn(this, e, t);
|
|
2198
2198
|
}
|
|
2199
2199
|
/**
|
|
2200
2200
|
* Is the given value assignable to our message type
|
|
@@ -2214,20 +2214,20 @@ class Dn {
|
|
|
2214
2214
|
* Copy partial data into the target message.
|
|
2215
2215
|
*/
|
|
2216
2216
|
mergePartial(e, t) {
|
|
2217
|
-
|
|
2217
|
+
je(this, e, t);
|
|
2218
2218
|
}
|
|
2219
2219
|
/**
|
|
2220
2220
|
* Create a new message from binary format.
|
|
2221
2221
|
*/
|
|
2222
2222
|
fromBinary(e, t) {
|
|
2223
|
-
let i =
|
|
2223
|
+
let i = vn(t);
|
|
2224
2224
|
return this.internalBinaryRead(i.readerFactory(e), e.byteLength, i);
|
|
2225
2225
|
}
|
|
2226
2226
|
/**
|
|
2227
2227
|
* Read a new message from a JSON value.
|
|
2228
2228
|
*/
|
|
2229
2229
|
fromJson(e, t) {
|
|
2230
|
-
return this.internalJsonRead(e,
|
|
2230
|
+
return this.internalJsonRead(e, Sn(t));
|
|
2231
2231
|
}
|
|
2232
2232
|
/**
|
|
2233
2233
|
* Read a new message from a JSON string.
|
|
@@ -2241,7 +2241,7 @@ class Dn {
|
|
|
2241
2241
|
* Write the message to canonical JSON value.
|
|
2242
2242
|
*/
|
|
2243
2243
|
toJson(e, t) {
|
|
2244
|
-
return this.internalJsonWrite(e,
|
|
2244
|
+
return this.internalJsonWrite(e, Fn(t));
|
|
2245
2245
|
}
|
|
2246
2246
|
/**
|
|
2247
2247
|
* Convert the message to canonical JSON string.
|
|
@@ -2256,7 +2256,7 @@ class Dn {
|
|
|
2256
2256
|
* Write the message to binary format.
|
|
2257
2257
|
*/
|
|
2258
2258
|
toBinary(e, t) {
|
|
2259
|
-
let i =
|
|
2259
|
+
let i = On(t);
|
|
2260
2260
|
return this.internalBinaryWrite(e, i.writerFactory(), i).finish();
|
|
2261
2261
|
}
|
|
2262
2262
|
/**
|
|
@@ -2272,7 +2272,7 @@ class Dn {
|
|
|
2272
2272
|
let r = i ?? this.create();
|
|
2273
2273
|
return this.refJsonReader.read(e, r, t), r;
|
|
2274
2274
|
}
|
|
2275
|
-
throw new Error(`Unable to parse message ${this.typeName} from JSON ${
|
|
2275
|
+
throw new Error(`Unable to parse message ${this.typeName} from JSON ${Ft(e)}.`);
|
|
2276
2276
|
}
|
|
2277
2277
|
/**
|
|
2278
2278
|
* This is an internal method. If you just want to write a message
|
|
@@ -2306,74 +2306,74 @@ class Dn {
|
|
|
2306
2306
|
return this.refBinReader.read(e, s, i, t), s;
|
|
2307
2307
|
}
|
|
2308
2308
|
}
|
|
2309
|
-
var
|
|
2309
|
+
var Wn = Object.defineProperty, $n = (n, e, t) => e in n ? Wn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, jn = (n, e, t) => ($n(n, typeof e != "symbol" ? e + "" : e, t), t), nt = (n, e, t) => {
|
|
2310
2310
|
if (!e.has(n))
|
|
2311
2311
|
throw TypeError("Cannot " + t);
|
|
2312
|
-
},
|
|
2312
|
+
}, c = (n, e, t) => (nt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), b = (n, e, t) => {
|
|
2313
2313
|
if (e.has(n))
|
|
2314
2314
|
throw TypeError("Cannot add the same private member more than once");
|
|
2315
2315
|
e instanceof WeakSet ? e.add(n) : e.set(n, t);
|
|
2316
|
-
}, p = (n, e, t, i) => (
|
|
2316
|
+
}, p = (n, e, t, i) => (nt(n, e, "write to private field"), i ? i.call(n, t) : e.set(n, t), t), w = (n, e, t) => (nt(n, e, "access private method"), t), Ae = {}, Jn = {
|
|
2317
2317
|
get exports() {
|
|
2318
|
-
return
|
|
2318
|
+
return Ae;
|
|
2319
2319
|
},
|
|
2320
2320
|
set exports(n) {
|
|
2321
|
-
|
|
2321
|
+
Ae = n;
|
|
2322
2322
|
}
|
|
2323
|
-
},
|
|
2323
|
+
}, se = typeof Reflect == "object" ? Reflect : null, mt = se && typeof se.apply == "function" ? se.apply : function(n, e, t) {
|
|
2324
2324
|
return Function.prototype.apply.call(n, e, t);
|
|
2325
|
-
},
|
|
2326
|
-
|
|
2325
|
+
}, Ee;
|
|
2326
|
+
se && typeof se.ownKeys == "function" ? Ee = se.ownKeys : Object.getOwnPropertySymbols ? Ee = function(n) {
|
|
2327
2327
|
return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n));
|
|
2328
|
-
} :
|
|
2328
|
+
} : Ee = function(n) {
|
|
2329
2329
|
return Object.getOwnPropertyNames(n);
|
|
2330
2330
|
};
|
|
2331
|
-
function
|
|
2331
|
+
function Xn(n) {
|
|
2332
2332
|
console && console.warn && console.warn(n);
|
|
2333
2333
|
}
|
|
2334
|
-
var
|
|
2334
|
+
var Vt = Number.isNaN || function(n) {
|
|
2335
2335
|
return n !== n;
|
|
2336
2336
|
};
|
|
2337
|
-
function
|
|
2338
|
-
|
|
2339
|
-
}
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
var
|
|
2347
|
-
function
|
|
2337
|
+
function k() {
|
|
2338
|
+
k.init.call(this);
|
|
2339
|
+
}
|
|
2340
|
+
Jn.exports = k;
|
|
2341
|
+
Ae.once = qn;
|
|
2342
|
+
k.EventEmitter = k;
|
|
2343
|
+
k.prototype._events = void 0;
|
|
2344
|
+
k.prototype._eventsCount = 0;
|
|
2345
|
+
k.prototype._maxListeners = void 0;
|
|
2346
|
+
var pt = 10;
|
|
2347
|
+
function Ue(n) {
|
|
2348
2348
|
if (typeof n != "function")
|
|
2349
2349
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof n);
|
|
2350
2350
|
}
|
|
2351
|
-
Object.defineProperty(
|
|
2351
|
+
Object.defineProperty(k, "defaultMaxListeners", {
|
|
2352
2352
|
enumerable: !0,
|
|
2353
2353
|
get: function() {
|
|
2354
|
-
return
|
|
2354
|
+
return pt;
|
|
2355
2355
|
},
|
|
2356
2356
|
set: function(n) {
|
|
2357
|
-
if (typeof n != "number" || n < 0 ||
|
|
2357
|
+
if (typeof n != "number" || n < 0 || Vt(n))
|
|
2358
2358
|
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + n + ".");
|
|
2359
|
-
|
|
2359
|
+
pt = n;
|
|
2360
2360
|
}
|
|
2361
2361
|
});
|
|
2362
|
-
|
|
2362
|
+
k.init = function() {
|
|
2363
2363
|
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
2364
2364
|
};
|
|
2365
|
-
|
|
2366
|
-
if (typeof n != "number" || n < 0 ||
|
|
2365
|
+
k.prototype.setMaxListeners = function(n) {
|
|
2366
|
+
if (typeof n != "number" || n < 0 || Vt(n))
|
|
2367
2367
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
|
|
2368
2368
|
return this._maxListeners = n, this;
|
|
2369
2369
|
};
|
|
2370
|
-
function
|
|
2371
|
-
return n._maxListeners === void 0 ?
|
|
2370
|
+
function Kt(n) {
|
|
2371
|
+
return n._maxListeners === void 0 ? k.defaultMaxListeners : n._maxListeners;
|
|
2372
2372
|
}
|
|
2373
|
-
|
|
2374
|
-
return
|
|
2373
|
+
k.prototype.getMaxListeners = function() {
|
|
2374
|
+
return Kt(this);
|
|
2375
2375
|
};
|
|
2376
|
-
|
|
2376
|
+
k.prototype.emit = function(n) {
|
|
2377
2377
|
for (var e = [], t = 1; t < arguments.length; t++)
|
|
2378
2378
|
e.push(arguments[t]);
|
|
2379
2379
|
var i = n === "error", r = this._events;
|
|
@@ -2392,51 +2392,51 @@ b.prototype.emit = function(n) {
|
|
|
2392
2392
|
if (a === void 0)
|
|
2393
2393
|
return !1;
|
|
2394
2394
|
if (typeof a == "function")
|
|
2395
|
-
|
|
2395
|
+
mt(a, this, e);
|
|
2396
2396
|
else
|
|
2397
|
-
for (var f = a.length, h =
|
|
2398
|
-
|
|
2397
|
+
for (var f = a.length, h = jt(a, f), t = 0; t < f; ++t)
|
|
2398
|
+
mt(h[t], this, e);
|
|
2399
2399
|
return !0;
|
|
2400
2400
|
};
|
|
2401
|
-
function
|
|
2401
|
+
function Ut(n, e, t, i) {
|
|
2402
2402
|
var r, s, o;
|
|
2403
|
-
if (
|
|
2403
|
+
if (Ue(t), s = n._events, s === void 0 ? (s = n._events = /* @__PURE__ */ Object.create(null), n._eventsCount = 0) : (s.newListener !== void 0 && (n.emit(
|
|
2404
2404
|
"newListener",
|
|
2405
2405
|
e,
|
|
2406
2406
|
t.listener ? t.listener : t
|
|
2407
2407
|
), s = n._events), o = s[e]), o === void 0)
|
|
2408
2408
|
o = s[e] = t, ++n._eventsCount;
|
|
2409
|
-
else if (typeof o == "function" ? o = s[e] = i ? [t, o] : [o, t] : i ? o.unshift(t) : o.push(t), r =
|
|
2409
|
+
else if (typeof o == "function" ? o = s[e] = i ? [t, o] : [o, t] : i ? o.unshift(t) : o.push(t), r = Kt(n), r > 0 && o.length > r && !o.warned) {
|
|
2410
2410
|
o.warned = !0;
|
|
2411
2411
|
var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
2412
|
-
a.name = "MaxListenersExceededWarning", a.emitter = n, a.type = e, a.count = o.length,
|
|
2412
|
+
a.name = "MaxListenersExceededWarning", a.emitter = n, a.type = e, a.count = o.length, Xn(a);
|
|
2413
2413
|
}
|
|
2414
2414
|
return n;
|
|
2415
2415
|
}
|
|
2416
|
-
|
|
2417
|
-
return
|
|
2416
|
+
k.prototype.addListener = function(n, e) {
|
|
2417
|
+
return Ut(this, n, e, !1);
|
|
2418
2418
|
};
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
return
|
|
2419
|
+
k.prototype.on = k.prototype.addListener;
|
|
2420
|
+
k.prototype.prependListener = function(n, e) {
|
|
2421
|
+
return Ut(this, n, e, !0);
|
|
2422
2422
|
};
|
|
2423
|
-
function
|
|
2423
|
+
function Gn() {
|
|
2424
2424
|
if (!this.fired)
|
|
2425
2425
|
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
2426
2426
|
}
|
|
2427
|
-
function
|
|
2428
|
-
var i = { fired: !1, wrapFn: void 0, target: n, type: e, listener: t }, r =
|
|
2427
|
+
function Pt(n, e, t) {
|
|
2428
|
+
var i = { fired: !1, wrapFn: void 0, target: n, type: e, listener: t }, r = Gn.bind(i);
|
|
2429
2429
|
return r.listener = t, i.wrapFn = r, r;
|
|
2430
2430
|
}
|
|
2431
|
-
|
|
2432
|
-
return
|
|
2431
|
+
k.prototype.once = function(n, e) {
|
|
2432
|
+
return Ue(e), this.on(n, Pt(this, n, e)), this;
|
|
2433
2433
|
};
|
|
2434
|
-
|
|
2435
|
-
return
|
|
2434
|
+
k.prototype.prependOnceListener = function(n, e) {
|
|
2435
|
+
return Ue(e), this.prependListener(n, Pt(this, n, e)), this;
|
|
2436
2436
|
};
|
|
2437
|
-
|
|
2437
|
+
k.prototype.removeListener = function(n, e) {
|
|
2438
2438
|
var t, i, r, s, o;
|
|
2439
|
-
if (
|
|
2439
|
+
if (Ue(e), i = this._events, i === void 0)
|
|
2440
2440
|
return this;
|
|
2441
2441
|
if (t = i[n], t === void 0)
|
|
2442
2442
|
return this;
|
|
@@ -2450,12 +2450,12 @@ b.prototype.removeListener = function(n, e) {
|
|
|
2450
2450
|
}
|
|
2451
2451
|
if (r < 0)
|
|
2452
2452
|
return this;
|
|
2453
|
-
r === 0 ? t.shift() :
|
|
2453
|
+
r === 0 ? t.shift() : Zn(t, r), t.length === 1 && (i[n] = t[0]), i.removeListener !== void 0 && this.emit("removeListener", n, o || e);
|
|
2454
2454
|
}
|
|
2455
2455
|
return this;
|
|
2456
2456
|
};
|
|
2457
|
-
|
|
2458
|
-
|
|
2457
|
+
k.prototype.off = k.prototype.removeListener;
|
|
2458
|
+
k.prototype.removeAllListeners = function(n) {
|
|
2459
2459
|
var e, t, i;
|
|
2460
2460
|
if (t = this._events, t === void 0)
|
|
2461
2461
|
return this;
|
|
@@ -2474,24 +2474,24 @@ b.prototype.removeAllListeners = function(n) {
|
|
|
2474
2474
|
this.removeListener(n, e[i]);
|
|
2475
2475
|
return this;
|
|
2476
2476
|
};
|
|
2477
|
-
function
|
|
2477
|
+
function Wt(n, e, t) {
|
|
2478
2478
|
var i = n._events;
|
|
2479
2479
|
if (i === void 0)
|
|
2480
2480
|
return [];
|
|
2481
2481
|
var r = i[e];
|
|
2482
|
-
return r === void 0 ? [] : typeof r == "function" ? t ? [r.listener || r] : [r] : t ?
|
|
2482
|
+
return r === void 0 ? [] : typeof r == "function" ? t ? [r.listener || r] : [r] : t ? Yn(r) : jt(r, r.length);
|
|
2483
2483
|
}
|
|
2484
|
-
|
|
2485
|
-
return
|
|
2484
|
+
k.prototype.listeners = function(n) {
|
|
2485
|
+
return Wt(this, n, !0);
|
|
2486
2486
|
};
|
|
2487
|
-
|
|
2488
|
-
return
|
|
2487
|
+
k.prototype.rawListeners = function(n) {
|
|
2488
|
+
return Wt(this, n, !1);
|
|
2489
2489
|
};
|
|
2490
|
-
|
|
2491
|
-
return typeof n.listenerCount == "function" ? n.listenerCount(e) :
|
|
2490
|
+
k.listenerCount = function(n, e) {
|
|
2491
|
+
return typeof n.listenerCount == "function" ? n.listenerCount(e) : $t.call(n, e);
|
|
2492
2492
|
};
|
|
2493
|
-
|
|
2494
|
-
function
|
|
2493
|
+
k.prototype.listenerCount = $t;
|
|
2494
|
+
function $t(n) {
|
|
2495
2495
|
var e = this._events;
|
|
2496
2496
|
if (e !== void 0) {
|
|
2497
2497
|
var t = e[n];
|
|
@@ -2502,25 +2502,25 @@ function _t(n) {
|
|
|
2502
2502
|
}
|
|
2503
2503
|
return 0;
|
|
2504
2504
|
}
|
|
2505
|
-
|
|
2506
|
-
return this._eventsCount > 0 ?
|
|
2505
|
+
k.prototype.eventNames = function() {
|
|
2506
|
+
return this._eventsCount > 0 ? Ee(this._events) : [];
|
|
2507
2507
|
};
|
|
2508
|
-
function
|
|
2508
|
+
function jt(n, e) {
|
|
2509
2509
|
for (var t = new Array(e), i = 0; i < e; ++i)
|
|
2510
2510
|
t[i] = n[i];
|
|
2511
2511
|
return t;
|
|
2512
2512
|
}
|
|
2513
|
-
function
|
|
2513
|
+
function Zn(n, e) {
|
|
2514
2514
|
for (; e + 1 < n.length; e++)
|
|
2515
2515
|
n[e] = n[e + 1];
|
|
2516
2516
|
n.pop();
|
|
2517
2517
|
}
|
|
2518
|
-
function
|
|
2518
|
+
function Yn(n) {
|
|
2519
2519
|
for (var e = new Array(n.length), t = 0; t < e.length; ++t)
|
|
2520
2520
|
e[t] = n[t].listener || n[t];
|
|
2521
2521
|
return e;
|
|
2522
2522
|
}
|
|
2523
|
-
function
|
|
2523
|
+
function qn(n, e) {
|
|
2524
2524
|
return new Promise(function(t, i) {
|
|
2525
2525
|
function r(o) {
|
|
2526
2526
|
n.removeListener(e, s), i(o);
|
|
@@ -2528,13 +2528,13 @@ function $n(n, e) {
|
|
|
2528
2528
|
function s() {
|
|
2529
2529
|
typeof n.removeListener == "function" && n.removeListener("error", r), t([].slice.call(arguments));
|
|
2530
2530
|
}
|
|
2531
|
-
|
|
2531
|
+
Jt(n, e, s, { once: !0 }), e !== "error" && zn(n, r, { once: !0 });
|
|
2532
2532
|
});
|
|
2533
2533
|
}
|
|
2534
|
-
function
|
|
2535
|
-
typeof n.on == "function" &&
|
|
2534
|
+
function zn(n, e, t) {
|
|
2535
|
+
typeof n.on == "function" && Jt(n, "error", e, t);
|
|
2536
2536
|
}
|
|
2537
|
-
function
|
|
2537
|
+
function Jt(n, e, t, i) {
|
|
2538
2538
|
if (typeof n.on == "function")
|
|
2539
2539
|
i.once ? n.once(e, t) : n.on(e, t);
|
|
2540
2540
|
else if (typeof n.addEventListener == "function")
|
|
@@ -2544,7 +2544,7 @@ function Vt(n, e, t, i) {
|
|
|
2544
2544
|
else
|
|
2545
2545
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof n);
|
|
2546
2546
|
}
|
|
2547
|
-
class
|
|
2547
|
+
class Qn extends Pn {
|
|
2548
2548
|
constructor() {
|
|
2549
2549
|
super("message.v1.SocketMessage", [
|
|
2550
2550
|
{
|
|
@@ -2581,36 +2581,36 @@ class Jn extends Dn {
|
|
|
2581
2581
|
]);
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
|
-
const
|
|
2585
|
-
class
|
|
2584
|
+
const wt = new Qn();
|
|
2585
|
+
class Xt {
|
|
2586
2586
|
static encode(e) {
|
|
2587
|
-
return
|
|
2587
|
+
return wt.toBinary(e);
|
|
2588
2588
|
}
|
|
2589
2589
|
static decode(e) {
|
|
2590
|
-
return
|
|
2590
|
+
return wt.fromBinary(new Uint8Array(e));
|
|
2591
2591
|
}
|
|
2592
2592
|
}
|
|
2593
|
-
function
|
|
2593
|
+
function Hn(n, e) {
|
|
2594
2594
|
return Math.floor(Math.random() * (e - n + 1) + n);
|
|
2595
2595
|
}
|
|
2596
2596
|
var J;
|
|
2597
|
-
class
|
|
2597
|
+
class ei {
|
|
2598
2598
|
constructor(e = {}) {
|
|
2599
|
-
|
|
2599
|
+
jn(this, "opts"), b(this, J, void 0), this.opts = {
|
|
2600
2600
|
initialTimeout: e.initialTimeout || 1e3,
|
|
2601
2601
|
maxTimeout: e.maxTimeout || 1e4,
|
|
2602
2602
|
factor: e.factor || 2
|
|
2603
2603
|
}, p(this, J, 0);
|
|
2604
2604
|
}
|
|
2605
2605
|
async wait() {
|
|
2606
|
-
p(this, J,
|
|
2607
|
-
const e =
|
|
2606
|
+
p(this, J, c(this, J) + 1);
|
|
2607
|
+
const e = Hn(0, Math.min(this.opts.maxTimeout, this.opts.initialTimeout * 2 ** c(this, J)));
|
|
2608
2608
|
await new Promise((t) => {
|
|
2609
2609
|
setTimeout(t, e);
|
|
2610
2610
|
});
|
|
2611
2611
|
}
|
|
2612
2612
|
getAttempts() {
|
|
2613
|
-
return
|
|
2613
|
+
return c(this, J);
|
|
2614
2614
|
}
|
|
2615
2615
|
reset() {
|
|
2616
2616
|
p(this, J, 0);
|
|
@@ -2624,79 +2624,79 @@ const j = {
|
|
|
2624
2624
|
error: 3
|
|
2625
2625
|
};
|
|
2626
2626
|
var z, Q;
|
|
2627
|
-
class
|
|
2627
|
+
class ti {
|
|
2628
2628
|
constructor(e) {
|
|
2629
|
-
|
|
2629
|
+
b(this, z, void 0), b(this, Q, void 0), p(this, z, console), p(this, Q, e);
|
|
2630
2630
|
}
|
|
2631
2631
|
debug(...e) {
|
|
2632
|
-
j[
|
|
2632
|
+
j[c(this, Q)] > j.debug || c(this, z).debug("[Sockrates]:", ...e);
|
|
2633
2633
|
}
|
|
2634
2634
|
info(...e) {
|
|
2635
|
-
j[
|
|
2635
|
+
j[c(this, Q)] > j.info || c(this, z).info("[Sockrates]:", ...e);
|
|
2636
2636
|
}
|
|
2637
2637
|
warn(...e) {
|
|
2638
|
-
j[
|
|
2638
|
+
j[c(this, Q)] > j.warn || c(this, z).warn("[Sockrates]:", ...e);
|
|
2639
2639
|
}
|
|
2640
2640
|
error(...e) {
|
|
2641
|
-
j[
|
|
2641
|
+
j[c(this, Q)] > j.error || c(this, z).error("[Sockrates]:", ...e);
|
|
2642
2642
|
}
|
|
2643
2643
|
}
|
|
2644
2644
|
z = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap();
|
|
2645
|
-
var
|
|
2646
|
-
const
|
|
2647
|
-
var
|
|
2648
|
-
class
|
|
2645
|
+
var Gt = /* @__PURE__ */ ((n) => (n[n.CONNECTING = 0] = "CONNECTING", n[n.OPEN = 1] = "OPEN", n[n.CLOSING = 2] = "CLOSING", n[n.CLOSED = 3] = "CLOSED", n))(Gt || {});
|
|
2646
|
+
const bt = "2", yt = "3";
|
|
2647
|
+
var O, te, y, T, X, F, $, q, B, ne, ie, P, Ze, Zt, fe, Te, Ye, Yt, Re, Je, De, qe, ze, qt, le, Oe, oe, de, xe, Qe, ae, ge, He, zt, me, Le, pe, Be;
|
|
2648
|
+
class ni {
|
|
2649
2649
|
constructor(e, t) {
|
|
2650
|
-
|
|
2651
|
-
var i, r, s, o, a, f, h, d,
|
|
2652
|
-
p(this, te, e), p(this, X, []), p(this, F, new
|
|
2650
|
+
b(this, Ze), b(this, fe), b(this, Ye), b(this, Re), b(this, De), b(this, ze), b(this, le), b(this, oe), b(this, xe), b(this, ae), b(this, He), b(this, me), b(this, pe), b(this, O, void 0), b(this, te, void 0), b(this, y, void 0), b(this, T, void 0), b(this, X, void 0), b(this, F, void 0), b(this, $, void 0), b(this, q, void 0), b(this, B, void 0), b(this, ne, void 0), b(this, ie, void 0), b(this, P, void 0);
|
|
2651
|
+
var i, r, s, o, a, f, h, d, E, g, A;
|
|
2652
|
+
p(this, te, e), p(this, X, []), p(this, F, new Ae()), p(this, $, !0), p(this, B, !1), p(this, y, t ?? {}), (i = c(this, y)).autoReconnect ?? (i.autoReconnect = !0), (r = c(this, y)).retryConnectionInterval ?? (r.retryConnectionInterval = 1e3), (s = c(this, y)).pingTimeout ?? (s.pingTimeout = 3e4), (o = c(this, y)).connectionTimeout ?? (o.connectionTimeout = 5e3), (a = c(this, y)).debug ?? (a.debug = !0), (f = c(this, y)).maxReconnectionAttempts ?? (f.maxReconnectionAttempts = 10), (h = c(this, y)).disconnectOnPingTimeout ?? (h.disconnectOnPingTimeout = !0), (d = c(this, y)).queueOnDisconnect ?? (d.queueOnDisconnect = !1), (E = c(this, y)).flushOnReconnect ?? (E.flushOnReconnect = !1), (g = c(this, y)).clientInitiatedPings ?? (g.clientInitiatedPings = !1), (A = c(this, y)).clientInitiatedPingInterval ?? (A.clientInitiatedPingInterval = 3e4), p(this, q, {
|
|
2653
2653
|
code: void 0,
|
|
2654
2654
|
reason: void 0
|
|
2655
|
-
}), p(this,
|
|
2655
|
+
}), p(this, T, c(this, y).logger ?? new ti(c(this, y).debug ? "debug" : "info")), p(this, P, new ei());
|
|
2656
2656
|
}
|
|
2657
2657
|
/**
|
|
2658
2658
|
* Ready state of the current WebSocket.
|
|
2659
2659
|
*/
|
|
2660
2660
|
get readyState() {
|
|
2661
2661
|
var e;
|
|
2662
|
-
return (e =
|
|
2662
|
+
return (e = c(this, O)) == null ? void 0 : e.readyState;
|
|
2663
2663
|
}
|
|
2664
2664
|
/**
|
|
2665
2665
|
* Sockrates connection URL.
|
|
2666
2666
|
*/
|
|
2667
2667
|
get url() {
|
|
2668
|
-
return
|
|
2668
|
+
return c(this, te);
|
|
2669
2669
|
}
|
|
2670
2670
|
/**
|
|
2671
2671
|
* Update connection URL.
|
|
2672
2672
|
*/
|
|
2673
2673
|
updateURL(e) {
|
|
2674
|
-
p(this, te, e),
|
|
2674
|
+
p(this, te, e), w(this, ze, qt).call(this);
|
|
2675
2675
|
}
|
|
2676
2676
|
/**
|
|
2677
2677
|
* Configuration options passed to Sockrates.
|
|
2678
2678
|
*/
|
|
2679
2679
|
get config() {
|
|
2680
|
-
return
|
|
2680
|
+
return c(this, y);
|
|
2681
2681
|
}
|
|
2682
2682
|
/**
|
|
2683
2683
|
* Messages that got queued due to the
|
|
2684
2684
|
* socket not being connected.
|
|
2685
2685
|
*/
|
|
2686
2686
|
get sendQueue() {
|
|
2687
|
-
return
|
|
2687
|
+
return c(this, X);
|
|
2688
2688
|
}
|
|
2689
2689
|
/**
|
|
2690
2690
|
* Flushes all messages that were queued
|
|
2691
2691
|
* due to the socket not being connected.
|
|
2692
2692
|
*/
|
|
2693
2693
|
flush() {
|
|
2694
|
-
if (!
|
|
2694
|
+
if (!c(this, y).queueOnDisconnect)
|
|
2695
2695
|
return !1;
|
|
2696
2696
|
const e = [];
|
|
2697
|
-
return
|
|
2697
|
+
return c(this, X).forEach((t) => {
|
|
2698
2698
|
this.send(t.event, t.id, t.payload, t.metadata) || e.push(t);
|
|
2699
|
-
}), p(this, X, e),
|
|
2699
|
+
}), p(this, X, e), c(this, X);
|
|
2700
2700
|
}
|
|
2701
2701
|
async connect(e = !1) {
|
|
2702
2702
|
if (!e && [
|
|
@@ -2704,41 +2704,41 @@ class zn {
|
|
|
2704
2704
|
1
|
|
2705
2705
|
/* OPEN */
|
|
2706
2706
|
].includes(this.readyState)) {
|
|
2707
|
-
|
|
2707
|
+
c(this, T).debug("Websocket was already connecting or connected.");
|
|
2708
2708
|
return;
|
|
2709
2709
|
}
|
|
2710
|
-
if (
|
|
2710
|
+
if (c(this, $) !== !1)
|
|
2711
2711
|
return new Promise((t, i) => {
|
|
2712
|
-
|
|
2712
|
+
w(this, ae, ge).call(this), w(this, pe, Be).call(this);
|
|
2713
2713
|
try {
|
|
2714
|
-
p(this,
|
|
2714
|
+
p(this, O, new WebSocket(w(this, Ze, Zt).call(this, c(this, te)))), c(this, O).binaryType = "arraybuffer", c(this, T).debug("Connecting");
|
|
2715
2715
|
const r = setTimeout(() => {
|
|
2716
|
-
|
|
2716
|
+
c(this, T).debug("Connection timeout. Closing socket"), p(this, $, !0), w(this, pe, Be).call(this), c(this, O).close(3001, "Connection Timeout"), c(this, y).autoReconnect && !c(this, B) && (c(this, F).emit(
|
|
2717
2717
|
"reconnecting"
|
|
2718
2718
|
/* reconnecting */
|
|
2719
|
-
),
|
|
2720
|
-
},
|
|
2721
|
-
|
|
2722
|
-
|
|
2719
|
+
), w(this, le, Oe).call(this)), i(new Error("Connection timed out!"));
|
|
2720
|
+
}, c(this, y).connectionTimeout);
|
|
2721
|
+
c(this, O).onopen = () => {
|
|
2722
|
+
c(this, T).debug(`Ready State: ${Gt[c(this, O).readyState]}`), r && clearTimeout(r), w(this, xe, Qe).call(this), w(this, He, zt).call(this), p(this, q, {
|
|
2723
2723
|
code: void 0,
|
|
2724
2724
|
reason: void 0
|
|
2725
|
-
}),
|
|
2725
|
+
}), c(this, F).emit(
|
|
2726
2726
|
"connected"
|
|
2727
2727
|
/* connected */
|
|
2728
|
-
),
|
|
2729
|
-
},
|
|
2728
|
+
), c(this, y).flushOnReconnect && this.flush(), t();
|
|
2729
|
+
}, c(this, O).onclose = (s) => {
|
|
2730
2730
|
try {
|
|
2731
2731
|
r && clearTimeout(r);
|
|
2732
2732
|
const { code: o, reason: a } = s;
|
|
2733
|
-
i(a),
|
|
2733
|
+
i(a), c(this, T).debug("Socket closed. Close event:", { event: s }), c(this, T).debug(`Connection closed code: ${o}`), c(this, T).debug(`Connection closed reason: ${a}`), c(this, B) || w(this, De, qe).call(this, o, a);
|
|
2734
2734
|
} catch (o) {
|
|
2735
|
-
|
|
2735
|
+
w(this, fe, Te).call(this, o);
|
|
2736
2736
|
}
|
|
2737
|
-
},
|
|
2738
|
-
|
|
2739
|
-
},
|
|
2737
|
+
}, c(this, O).onerror = (s) => {
|
|
2738
|
+
w(this, fe, Te).call(this, s);
|
|
2739
|
+
}, c(this, O).onmessage = (s) => w(this, Ye, Yt).call(this, s);
|
|
2740
2740
|
} catch (r) {
|
|
2741
|
-
|
|
2741
|
+
w(this, fe, Te).call(this, r, i);
|
|
2742
2742
|
}
|
|
2743
2743
|
});
|
|
2744
2744
|
}
|
|
@@ -2748,10 +2748,10 @@ class zn {
|
|
|
2748
2748
|
*/
|
|
2749
2749
|
send(e, t, i, r) {
|
|
2750
2750
|
const s = { event: e, id: t, payload: i, metadata: r };
|
|
2751
|
-
if (
|
|
2752
|
-
return
|
|
2753
|
-
const o =
|
|
2754
|
-
return
|
|
2751
|
+
if (c(this, y).queueOnDisconnect && (!c(this, O) || c(this, O).readyState !== 1))
|
|
2752
|
+
return c(this, T).debug("Queuing message since socket is not connected!", s), c(this, X).push(s), !1;
|
|
2753
|
+
const o = Xt.encode(s);
|
|
2754
|
+
return w(this, oe, de).call(this, o);
|
|
2755
2755
|
}
|
|
2756
2756
|
/**
|
|
2757
2757
|
* Alias for `send`.
|
|
@@ -2763,20 +2763,20 @@ class zn {
|
|
|
2763
2763
|
* Send a raw message to the socket server.
|
|
2764
2764
|
*/
|
|
2765
2765
|
sendRaw(e) {
|
|
2766
|
-
return
|
|
2766
|
+
return w(this, oe, de).call(this, e);
|
|
2767
2767
|
}
|
|
2768
2768
|
/**
|
|
2769
2769
|
* Alias to `on`.
|
|
2770
2770
|
*/
|
|
2771
2771
|
receive(e, t) {
|
|
2772
|
-
return
|
|
2772
|
+
return c(this, F).on(e.toString(), t);
|
|
2773
2773
|
}
|
|
2774
2774
|
/**
|
|
2775
2775
|
* Event listener that is fired on receiving socket messages.
|
|
2776
2776
|
*/
|
|
2777
2777
|
on(e, t) {
|
|
2778
2778
|
if (typeof e == "string" && (e === "connected" || e === "disconnected" || e === "errored" || e === "reconnected" || e === "reconnecting" || e === "reconnectAttempt" || e === "reconnectFailure" || e === "failed")) {
|
|
2779
|
-
|
|
2779
|
+
c(this, F).on(e, t);
|
|
2780
2780
|
return;
|
|
2781
2781
|
}
|
|
2782
2782
|
this.receive(e, t);
|
|
@@ -2785,7 +2785,7 @@ class zn {
|
|
|
2785
2785
|
* Remove all event listeners that were added using `on`.
|
|
2786
2786
|
*/
|
|
2787
2787
|
removeAllListeners() {
|
|
2788
|
-
|
|
2788
|
+
c(this, F).removeAllListeners();
|
|
2789
2789
|
}
|
|
2790
2790
|
/**
|
|
2791
2791
|
* Alias to `removeListener`.
|
|
@@ -2797,7 +2797,7 @@ class zn {
|
|
|
2797
2797
|
* Remove a specific listener that was added using `on`.
|
|
2798
2798
|
*/
|
|
2799
2799
|
removeListener(e, t) {
|
|
2800
|
-
|
|
2800
|
+
c(this, F).removeListener(e.toString(), t);
|
|
2801
2801
|
}
|
|
2802
2802
|
/**
|
|
2803
2803
|
* Alias to `removeListeners`.
|
|
@@ -2809,7 +2809,7 @@ class zn {
|
|
|
2809
2809
|
* Remove all listeners for a specific event.
|
|
2810
2810
|
*/
|
|
2811
2811
|
removeListeners(e) {
|
|
2812
|
-
|
|
2812
|
+
c(this, F).listeners(e.toString()).map(
|
|
2813
2813
|
(t) => this.removeListener(e, t)
|
|
2814
2814
|
);
|
|
2815
2815
|
}
|
|
@@ -2817,13 +2817,13 @@ class zn {
|
|
|
2817
2817
|
* Disconnect the socket.
|
|
2818
2818
|
*/
|
|
2819
2819
|
disconnect() {
|
|
2820
|
-
p(this, $, !1),
|
|
2820
|
+
p(this, $, !1), w(this, ae, ge).call(this), w(this, me, Le).call(this), this.removeAllListeners(), p(this, q, {
|
|
2821
2821
|
code: 1e3,
|
|
2822
2822
|
reason: "Sockrates disconnect method called"
|
|
2823
|
-
}),
|
|
2823
|
+
}), c(this, O).close(1e3, "Sockrates disconnect method called.");
|
|
2824
2824
|
}
|
|
2825
2825
|
}
|
|
2826
|
-
|
|
2826
|
+
O = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakSet(), Zt = function(n) {
|
|
2827
2827
|
if (n.startsWith("ws://") || n.startsWith("wss://"))
|
|
2828
2828
|
return n;
|
|
2829
2829
|
if (n.startsWith("https://"))
|
|
@@ -2831,72 +2831,82 @@ R = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), I = /* @_
|
|
|
2831
2831
|
if (n.startsWith("http://"))
|
|
2832
2832
|
return `ws://${n.substring(7)}`;
|
|
2833
2833
|
throw new Error("Invalid URL. URL must start with http(s):// or ws(s)://.");
|
|
2834
|
-
},
|
|
2835
|
-
|
|
2836
|
-
},
|
|
2837
|
-
if (
|
|
2838
|
-
|
|
2834
|
+
}, fe = /* @__PURE__ */ new WeakSet(), Te = function(n, e) {
|
|
2835
|
+
c(this, T).error("Error:", { error: n }), c(this, F).emit("errored", { error: n }), e == null || e(n);
|
|
2836
|
+
}, Ye = /* @__PURE__ */ new WeakSet(), Yt = function(n) {
|
|
2837
|
+
if (w(this, xe, Qe).call(this), n.data === bt) {
|
|
2838
|
+
c(this, T).debug("Received ping from server"), w(this, oe, de).call(this, yt);
|
|
2839
|
+
return;
|
|
2840
|
+
}
|
|
2841
|
+
if (n.data === yt) {
|
|
2842
|
+
c(this, T).debug("Received pong from server");
|
|
2839
2843
|
return;
|
|
2840
2844
|
}
|
|
2841
|
-
const e =
|
|
2842
|
-
|
|
2843
|
-
},
|
|
2844
|
-
return
|
|
2845
|
-
},
|
|
2846
|
-
p(this, q, { reason: e, code: n }),
|
|
2847
|
-
},
|
|
2848
|
-
const { reason: n, code: e } =
|
|
2849
|
-
e && e !== 1e3 &&
|
|
2845
|
+
const e = Xt.decode(n.data), { id: t, payload: i } = e;
|
|
2846
|
+
c(this, T).debug("Received message", { event: e.event, messageID: t }), c(this, F).emit(e.event.toString(), { id: t, payload: i });
|
|
2847
|
+
}, Re = /* @__PURE__ */ new WeakSet(), Je = function() {
|
|
2848
|
+
return c(this, O).readyState === 1;
|
|
2849
|
+
}, De = /* @__PURE__ */ new WeakSet(), qe = function(n, e) {
|
|
2850
|
+
p(this, q, { reason: e, code: n }), c(this, F).emit("disconnected", { code: n, reason: e });
|
|
2851
|
+
}, ze = /* @__PURE__ */ new WeakSet(), qt = function() {
|
|
2852
|
+
const { reason: n, code: e } = c(this, q);
|
|
2853
|
+
e && e !== 1e3 && c(this, $) && c(this, y).autoReconnect && !c(this, B) && (c(this, T).debug(`Triggering reconnection due to ${n}.`), c(this, F).emit(
|
|
2850
2854
|
"reconnecting"
|
|
2851
2855
|
/* reconnecting */
|
|
2852
|
-
),
|
|
2853
|
-
},
|
|
2854
|
-
if (n &&
|
|
2855
|
-
|
|
2856
|
+
), w(this, le, Oe).call(this));
|
|
2857
|
+
}, le = /* @__PURE__ */ new WeakSet(), Oe = async function(n = !0) {
|
|
2858
|
+
if (n && c(this, B)) {
|
|
2859
|
+
c(this, T).debug("Reconnect called when already in a reconnect loop. Ignoring.");
|
|
2856
2860
|
return;
|
|
2857
2861
|
}
|
|
2858
|
-
if (
|
|
2859
|
-
|
|
2862
|
+
if (c(this, B) || c(this, P).reset(), c(this, y).maxReconnectionAttempts !== null && c(this, P).getAttempts() >= c(this, y).maxReconnectionAttempts) {
|
|
2863
|
+
c(this, F).emit(
|
|
2860
2864
|
"failed"
|
|
2861
2865
|
/* failed */
|
|
2862
2866
|
), p(this, B, !1);
|
|
2863
2867
|
return;
|
|
2864
2868
|
}
|
|
2865
|
-
p(this, B, !0),
|
|
2869
|
+
p(this, B, !0), w(this, pe, Be).call(this), w(this, ae, ge).call(this);
|
|
2866
2870
|
try {
|
|
2867
|
-
if (await
|
|
2871
|
+
if (await c(this, P).wait(), c(this, $) === !1)
|
|
2868
2872
|
return;
|
|
2869
|
-
if (
|
|
2873
|
+
if (c(this, T).debug(`Reconnection attempt ${c(this, P).getAttempts()}`), c(this, F).emit("reconnectAttempt", { attempt: c(this, P).getAttempts() }), await this.connect(), !w(this, Re, Je).call(this))
|
|
2870
2874
|
throw Error("Reconnect Failed");
|
|
2871
2875
|
p(this, B, !1), p(this, q, {
|
|
2872
2876
|
code: void 0,
|
|
2873
2877
|
reason: void 0
|
|
2874
|
-
}),
|
|
2878
|
+
}), c(this, F).emit(
|
|
2875
2879
|
"reconnected"
|
|
2876
2880
|
/* reconnected */
|
|
2877
2881
|
);
|
|
2878
2882
|
} catch {
|
|
2879
|
-
|
|
2883
|
+
c(this, T).debug("Failed to reconnect."), c(this, F).emit("reconnectFailure", { attempt: c(this, P).getAttempts() }), w(this, le, Oe).call(this, !1);
|
|
2880
2884
|
}
|
|
2881
|
-
},
|
|
2885
|
+
}, oe = /* @__PURE__ */ new WeakSet(), de = function(n) {
|
|
2882
2886
|
try {
|
|
2883
|
-
return
|
|
2887
|
+
return c(this, O).send(n), !0;
|
|
2884
2888
|
} catch (e) {
|
|
2885
|
-
return
|
|
2889
|
+
return c(this, T).error(e.message), !1;
|
|
2886
2890
|
}
|
|
2887
|
-
},
|
|
2888
|
-
this.config.disconnectOnPingTimeout && (
|
|
2891
|
+
}, xe = /* @__PURE__ */ new WeakSet(), Qe = function() {
|
|
2892
|
+
this.config.disconnectOnPingTimeout && (c(this, T).debug("Resetting ping timeout"), w(this, ae, ge).call(this), p(this, ne, setTimeout(() => {
|
|
2889
2893
|
var n;
|
|
2890
|
-
|
|
2894
|
+
c(this, T).debug("Disconnecting the socket due to ping timeout"), p(this, $, !0);
|
|
2891
2895
|
const e = 3002, t = "Ping timeout";
|
|
2892
|
-
(n =
|
|
2893
|
-
},
|
|
2894
|
-
},
|
|
2895
|
-
|
|
2896
|
-
},
|
|
2897
|
-
|
|
2896
|
+
(n = c(this, O)) == null || n.close(e, t), w(this, De, qe).call(this, e, t);
|
|
2897
|
+
}, c(this, y).pingTimeout)));
|
|
2898
|
+
}, ae = /* @__PURE__ */ new WeakSet(), ge = function() {
|
|
2899
|
+
c(this, ne) && (clearTimeout(c(this, ne)), p(this, ne, void 0));
|
|
2900
|
+
}, He = /* @__PURE__ */ new WeakSet(), zt = function() {
|
|
2901
|
+
w(this, me, Le).call(this), c(this, y).clientInitiatedPings && p(this, ie, setInterval(() => {
|
|
2902
|
+
w(this, Re, Je).call(this) && (c(this, T).debug("Sending client-initiated ping"), w(this, oe, de).call(this, bt));
|
|
2903
|
+
}, c(this, y).clientInitiatedPingInterval));
|
|
2904
|
+
}, me = /* @__PURE__ */ new WeakSet(), Le = function() {
|
|
2905
|
+
c(this, ie) && (clearInterval(c(this, ie)), p(this, ie, void 0));
|
|
2906
|
+
}, pe = /* @__PURE__ */ new WeakSet(), Be = function() {
|
|
2907
|
+
w(this, me, Le).call(this), c(this, O) && (c(this, O).onopen = void 0, c(this, O).onerror = void 0, c(this, O).onmessage = void 0, c(this, O).onclose = void 0);
|
|
2898
2908
|
};
|
|
2899
|
-
class
|
|
2909
|
+
class ii {
|
|
2900
2910
|
constructor(e, t) {
|
|
2901
2911
|
this.url = e, console.info(`Creating websocket with url: ${e} and config: ${t}`);
|
|
2902
2912
|
}
|
|
@@ -2913,12 +2923,12 @@ class Qn {
|
|
|
2913
2923
|
console.info(`Adding listener to websocket: ${e} with listener: ${t}`);
|
|
2914
2924
|
}
|
|
2915
2925
|
}
|
|
2916
|
-
var Z, ee,
|
|
2917
|
-
class
|
|
2926
|
+
var Z, ee, be;
|
|
2927
|
+
class ri {
|
|
2918
2928
|
constructor(e, t = !1) {
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2929
|
+
D(this, Z, null);
|
|
2930
|
+
D(this, ee, !1);
|
|
2931
|
+
D(this, be, !1);
|
|
2922
2932
|
this.wsUrl = e, this.devMode = t;
|
|
2923
2933
|
}
|
|
2924
2934
|
get connected() {
|
|
@@ -2926,191 +2936,188 @@ class Hn {
|
|
|
2926
2936
|
}
|
|
2927
2937
|
async connect(e) {
|
|
2928
2938
|
let t;
|
|
2929
|
-
this.devMode ? t = new
|
|
2939
|
+
this.devMode ? t = new ii(this.wsUrl, {
|
|
2930
2940
|
queueOnDisconnect: !0,
|
|
2931
2941
|
flushOnReconnect: !0
|
|
2932
|
-
}) : t = new
|
|
2942
|
+
}) : t = new ni(this.wsUrl, {
|
|
2933
2943
|
queueOnDisconnect: !0,
|
|
2934
2944
|
flushOnReconnect: !0
|
|
2935
|
-
}), e.participants.addListener(
|
|
2936
|
-
"
|
|
2937
|
-
(i) => t.sendRaw(JSON.stringify(i))
|
|
2938
|
-
), v.info("Connecting to websocket"), t.on("connected", () => {
|
|
2939
|
-
v.info("Connected to websocket");
|
|
2945
|
+
}), e.participants.addListener("broadcastedMessage", (i) => t.sendRaw(JSON.stringify(i))), N.info("Connecting to websocket"), t.on("connected", () => {
|
|
2946
|
+
N.info("Connected to websocket");
|
|
2940
2947
|
}), await t.connect(!0), C(this, Z, t), C(this, ee, !0);
|
|
2941
2948
|
}
|
|
2942
2949
|
disconnect() {
|
|
2943
2950
|
l(this, Z) && (l(this, Z).disconnect(), C(this, ee, !1));
|
|
2944
2951
|
}
|
|
2945
2952
|
startRecordingMessage() {
|
|
2946
|
-
if (l(this,
|
|
2953
|
+
if (l(this, be))
|
|
2947
2954
|
throw new Error("Start recording message already sent");
|
|
2948
2955
|
if (l(this, Z) && l(this, ee))
|
|
2949
|
-
C(this,
|
|
2956
|
+
C(this, be, !0), l(this, Z).sendRaw(JSON.stringify({ type: "StartRecording" }));
|
|
2950
2957
|
else
|
|
2951
2958
|
throw new Error("Not connected to websocket, make sure you have called init.");
|
|
2952
2959
|
}
|
|
2953
2960
|
}
|
|
2954
|
-
Z = new WeakMap(), ee = new WeakMap(),
|
|
2955
|
-
class
|
|
2961
|
+
Z = new WeakMap(), ee = new WeakMap(), be = new WeakMap();
|
|
2962
|
+
class si {
|
|
2956
2963
|
constructor() {
|
|
2957
2964
|
}
|
|
2958
2965
|
checkIfSDKEnabled() {
|
|
2959
|
-
return
|
|
2966
|
+
return N.info("Check if SDK enabled"), window.dyteRecordingSdk === !0 || window.realtimeKitRecordingSdk === !0;
|
|
2960
2967
|
}
|
|
2961
2968
|
checkIfRecordingTriggerAdded() {
|
|
2962
|
-
return
|
|
2969
|
+
return N.info("Check if recording trigger added"), window.triggerDyteRecording === !0 || window.triggerRealtimeKitRecording === !0;
|
|
2963
2970
|
}
|
|
2964
2971
|
checkMeetingJoined() {
|
|
2965
2972
|
var e;
|
|
2966
|
-
return
|
|
2973
|
+
return N.info("Check if meeting joined getter available"), ((e = window.realtimeKitRecording) == null ? void 0 : e.isMeetingJoined()) !== !0;
|
|
2967
2974
|
}
|
|
2968
2975
|
checkParticipantCount() {
|
|
2969
2976
|
var e;
|
|
2970
|
-
return
|
|
2977
|
+
return N.info("Check if participant count getter available"), ((e = window.realtimeKitRecording) == null ? void 0 : e.getParticipantCount()) !== void 0;
|
|
2971
2978
|
}
|
|
2972
2979
|
pageLoadTests() {
|
|
2973
|
-
|
|
2974
|
-
|
|
2980
|
+
N.info("Running on page load tests");
|
|
2981
|
+
const e = [];
|
|
2975
2982
|
if (this.checkIfSDKEnabled() || e.push("SDK not enabled"), e.length > 0)
|
|
2976
2983
|
throw new Error(e.join(", "));
|
|
2977
2984
|
}
|
|
2978
2985
|
sdkInitTests() {
|
|
2979
|
-
|
|
2980
|
-
|
|
2986
|
+
N.info("Running SDK init tests");
|
|
2987
|
+
const e = [];
|
|
2981
2988
|
if (this.checkIfRecordingTriggerAdded() || e.push("Recording trigger not added"), this.checkParticipantCount() || e.push("Participant count getter not working"), e.length > 0)
|
|
2982
2989
|
throw new Error(e.join(`
|
|
2983
2990
|
`));
|
|
2984
2991
|
}
|
|
2985
2992
|
showAlert(e) {
|
|
2986
|
-
|
|
2993
|
+
N.error(e), e += "You can contact Dyte support for help", window.alert(e);
|
|
2987
2994
|
}
|
|
2988
2995
|
}
|
|
2989
|
-
var Y,
|
|
2990
|
-
class
|
|
2996
|
+
var Y, R, x, V, ue;
|
|
2997
|
+
class ai {
|
|
2991
2998
|
/**
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
2999
|
+
* This method is used to instantiate the RealtimeKitRecording class.
|
|
3000
|
+
* @param options The options object.
|
|
3001
|
+
* @param options.waitTimeMs The time it waits after all the peer have left to leave the meeting. (If you pass
|
|
3002
|
+
* autoStop as false, this option is ignored)
|
|
3003
|
+
* @param options.autoStart If you wish to start recording as soon as the `init` is called.
|
|
3004
|
+
* @param options.autoStop If you wish to disable automatic peer leave and call `stopRecording` manually set this to `false`.
|
|
3005
|
+
* @param options.scanInterval Interval between scans for automatic peer leave.
|
|
3006
|
+
* @param options.websocketUrl The url of the websocket server to connect to. Defaults to localhost:8080/ws. Do not change this unless you know what you are doing.
|
|
3007
|
+
*/
|
|
3001
3008
|
constructor(e) {
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
e.waitTimeMs && !e.autoStop &&
|
|
3008
|
-
waitTimeMs: e.waitTimeMs ?? 1 *
|
|
3009
|
+
D(this, Y, void 0);
|
|
3010
|
+
D(this, R, void 0);
|
|
3011
|
+
D(this, x, void 0);
|
|
3012
|
+
D(this, V, void 0);
|
|
3013
|
+
D(this, ue, void 0);
|
|
3014
|
+
e.waitTimeMs && !e.autoStop && N.warn("You have passed both waitTimeMs and autoStop. waitTimeMs will be ignored"), C(this, R, {
|
|
3015
|
+
waitTimeMs: e.waitTimeMs ?? 1 * fn,
|
|
3009
3016
|
websocketUrl: e.websocketUrl ?? "ws://localhost:8080/ws",
|
|
3010
3017
|
autoStart: e.autoStart ?? !0,
|
|
3011
3018
|
autoStop: e.autoStop ?? !0,
|
|
3012
3019
|
devMode: window.navigator.webdriver == !1,
|
|
3013
|
-
scanInterval: e.scanInterval ??
|
|
3014
|
-
}), window.dyteRecordingSdk = !0, window.realtimeKitRecordingSdk = !0, window.devMode = l(this,
|
|
3020
|
+
scanInterval: e.scanInterval ?? hn
|
|
3021
|
+
}), window.dyteRecordingSdk = !0, window.realtimeKitRecordingSdk = !0, window.devMode = l(this, R).devMode, C(this, V, new si()), this.performOnPageLoadChecks();
|
|
3015
3022
|
}
|
|
3016
3023
|
/**
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3024
|
+
* The `init` method can be used to instantiate the RealtimeKitRecording class.
|
|
3025
|
+
* @param client The RealtimeKitClient instance.
|
|
3026
|
+
*/
|
|
3020
3027
|
async init(e) {
|
|
3021
|
-
|
|
3022
|
-
const t = new
|
|
3023
|
-
autoStop: l(this,
|
|
3024
|
-
waitTimeMs: l(this,
|
|
3025
|
-
scanInterval: l(this,
|
|
3026
|
-
}), i = new
|
|
3027
|
-
await i.connect(e), C(this, x, i), C(this, Y, t), this.sdkInitTests(),
|
|
3028
|
-
}
|
|
3029
|
-
/**
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3028
|
+
N.info("Initializing RealtimeKit Recording SDK");
|
|
3029
|
+
const t = new ln(new dn(e), {
|
|
3030
|
+
autoStop: l(this, R).autoStop,
|
|
3031
|
+
waitTimeMs: l(this, R).waitTimeMs,
|
|
3032
|
+
scanInterval: l(this, R).scanInterval
|
|
3033
|
+
}), i = new ri(l(this, R).websocketUrl, l(this, R).devMode);
|
|
3034
|
+
await i.connect(e), C(this, x, i), C(this, Y, t), this.sdkInitTests(), N.init(e), C(this, ue, e), l(this, R).autoStart && await this.startRecording();
|
|
3035
|
+
}
|
|
3036
|
+
/**
|
|
3037
|
+
* The `startRecording` method can be used to manually start recording.
|
|
3038
|
+
* Make sure meeting is not already joined before calling this method.
|
|
3039
|
+
* @note This method has a timeout of 2mins. If this method is not called within 2mins of the websocket
|
|
3040
|
+
* being connected, the recording will error out.
|
|
3041
|
+
*/
|
|
3035
3042
|
async startRecording() {
|
|
3036
3043
|
var e, t;
|
|
3037
|
-
if ((e = l(this,
|
|
3038
|
-
const i = "Meeting already joined. Cannot start recording. SDK will call
|
|
3039
|
-
if (
|
|
3044
|
+
if ((e = l(this, ue)) != null && e.self.roomJoined) {
|
|
3045
|
+
const i = "Meeting already joined. Cannot start recording. SDK will call meeting.join() automatically.";
|
|
3046
|
+
if (N.warn(i), l(this, R).devMode)
|
|
3040
3047
|
throw new Error(i);
|
|
3041
3048
|
}
|
|
3042
|
-
if (await ((t = l(this,
|
|
3049
|
+
if (await ((t = l(this, ue)) == null ? void 0 : t.join()), N.info("Sending start recording request"), l(this, x))
|
|
3043
3050
|
try {
|
|
3044
3051
|
l(this, x).startRecordingMessage();
|
|
3045
3052
|
} catch (i) {
|
|
3046
3053
|
const r = `Failed to start recording with error: ${i}`;
|
|
3047
|
-
if (
|
|
3054
|
+
if (N.error(r), l(this, R).devMode)
|
|
3048
3055
|
throw new Error(r);
|
|
3049
3056
|
}
|
|
3050
3057
|
}
|
|
3051
3058
|
/**
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3059
|
+
* The `stopRecording` method can be used to stop recording.
|
|
3060
|
+
* @throws Error if `autoStop` is true.
|
|
3061
|
+
*/
|
|
3055
3062
|
stopRecording() {
|
|
3056
|
-
if (
|
|
3063
|
+
if (N.info("Stopping RealtimeKit Recording SDK"), l(this, Y))
|
|
3057
3064
|
l(this, Y).stopRecording(), l(this, x) && l(this, x).connected && l(this, x).disconnect();
|
|
3058
3065
|
else {
|
|
3059
3066
|
const e = "recording controller not initialized";
|
|
3060
|
-
if (
|
|
3067
|
+
if (N.error(e), l(this, R).devMode)
|
|
3061
3068
|
throw new Error(e);
|
|
3062
3069
|
}
|
|
3063
3070
|
}
|
|
3064
3071
|
/**
|
|
3065
|
-
|
|
3066
|
-
|
|
3072
|
+
* The `cleanup` method can be used to cleanup the SDK.
|
|
3073
|
+
*/
|
|
3067
3074
|
async cleanup() {
|
|
3068
|
-
if (
|
|
3075
|
+
if (N.info("Cleaning up RealtimeKit Recording SDK"), delete window.devMode, delete window.realtimeKitRecordingSdk, delete window.dyteRecordingSdk, l(this, Y))
|
|
3069
3076
|
try {
|
|
3070
3077
|
l(this, Y).cleanup(), l(this, x) && l(this, x).connected && l(this, x).disconnect();
|
|
3071
3078
|
} catch (e) {
|
|
3072
3079
|
const t = `Failed to cleanup with error: ${e}`;
|
|
3073
|
-
if (
|
|
3080
|
+
if (N.error(t), l(this, R).devMode)
|
|
3074
3081
|
throw new Error(t);
|
|
3075
3082
|
}
|
|
3076
3083
|
else {
|
|
3077
3084
|
const e = "recording controller not initialized";
|
|
3078
|
-
if (
|
|
3085
|
+
if (N.error("recording controller not initialized"), l(this, R).devMode)
|
|
3079
3086
|
throw new Error(e);
|
|
3080
3087
|
}
|
|
3081
3088
|
}
|
|
3082
3089
|
performOnPageLoadChecks() {
|
|
3083
|
-
if (l(this,
|
|
3090
|
+
if (l(this, V))
|
|
3084
3091
|
try {
|
|
3085
|
-
l(this,
|
|
3092
|
+
l(this, V).pageLoadTests();
|
|
3086
3093
|
} catch (e) {
|
|
3087
3094
|
const t = `Failed to perform page load checks with error: ${e}`;
|
|
3088
|
-
if (typeof e == "string" && l(this,
|
|
3095
|
+
if (typeof e == "string" && l(this, R).devMode && l(this, V).showAlert(e), l(this, R).devMode)
|
|
3089
3096
|
throw new Error(t);
|
|
3090
3097
|
}
|
|
3091
3098
|
else {
|
|
3092
3099
|
const e = "SDK Checks controller not initialized";
|
|
3093
|
-
if (l(this,
|
|
3100
|
+
if (l(this, R).devMode)
|
|
3094
3101
|
throw new Error(e);
|
|
3095
3102
|
}
|
|
3096
3103
|
}
|
|
3097
3104
|
sdkInitTests() {
|
|
3098
|
-
if (l(this,
|
|
3105
|
+
if (l(this, V))
|
|
3099
3106
|
try {
|
|
3100
|
-
l(this,
|
|
3107
|
+
l(this, V).sdkInitTests();
|
|
3101
3108
|
} catch (e) {
|
|
3102
3109
|
const t = `Failed to perform sdk init checks with error: ${e}`;
|
|
3103
|
-
if (typeof e == "string" && l(this,
|
|
3110
|
+
if (typeof e == "string" && l(this, R).devMode && l(this, V).showAlert(e), l(this, R).devMode)
|
|
3104
3111
|
throw new Error(t);
|
|
3105
3112
|
}
|
|
3106
3113
|
else {
|
|
3107
3114
|
const e = "SDK Checks controller not initialized";
|
|
3108
|
-
if (l(this,
|
|
3115
|
+
if (l(this, R).devMode)
|
|
3109
3116
|
throw new Error(e);
|
|
3110
3117
|
}
|
|
3111
3118
|
}
|
|
3112
3119
|
}
|
|
3113
|
-
Y = new WeakMap(),
|
|
3120
|
+
Y = new WeakMap(), R = new WeakMap(), x = new WeakMap(), V = new WeakMap(), ue = new WeakMap();
|
|
3114
3121
|
export {
|
|
3115
|
-
|
|
3122
|
+
ai as RealtimeKitRecording
|
|
3116
3123
|
};
|