@streamlayer/sdk-web 0.20.8 → 0.24.0
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/README.md +1 -1
- package/lib/cjs/index.js +6 -0
- package/lib/es/index.js +2271 -0
- package/package.json +37 -16
- package/src/index.js +0 -29
- package/src/index.js.map +0 -1
- /package/{src → lib}/index.d.ts +0 -0
package/lib/es/index.js
ADDED
|
@@ -0,0 +1,2271 @@
|
|
|
1
|
+
import { QuestionType as J, QuestionStatus as bt } from "@streamlayer/sl-eslib/interactive/interactive.common_pb";
|
|
2
|
+
import "@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb";
|
|
3
|
+
import { SdkOverlayType as V } from "@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb";
|
|
4
|
+
import { computed as Qt, map as be, atom as dt } from "nanostores";
|
|
5
|
+
import "@nanostores/logger";
|
|
6
|
+
import "microdiff";
|
|
7
|
+
import { Code as Ie, createPromiseClient as Ee, createCallbackClient as xe } from "@connectrpc/connect";
|
|
8
|
+
import { createGrpcWebTransport as Be } from "@connectrpc/connect-web";
|
|
9
|
+
import { nanoquery as Ae } from "@nanostores/query";
|
|
10
|
+
import { Events as Fe } from "@streamlayer/sl-eslib/sports/events/events_connect";
|
|
11
|
+
import { Client as lt } from "@streamlayer/sl-eslib/sdkSettings/client/client_connect";
|
|
12
|
+
import { Users as Mt } from "@streamlayer/sl-eslib/users/users_connect";
|
|
13
|
+
import { pino as ke } from "pino";
|
|
14
|
+
import { Feed as R } from "@streamlayer/sl-eslib/interactive/feed/interactive.feed_connect";
|
|
15
|
+
import { Leaderboard as Te } from "@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_connect";
|
|
16
|
+
import Ce from "avvio";
|
|
17
|
+
var Pt = {}, Gt = {}, ft = {};
|
|
18
|
+
ft.byteLength = _e;
|
|
19
|
+
ft.toByteArray = Oe;
|
|
20
|
+
ft.fromByteArray = ve;
|
|
21
|
+
var D = [], C = [], Ue = typeof Uint8Array < "u" ? Uint8Array : Array, St = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
22
|
+
for (var Z = 0, Ne = St.length; Z < Ne; ++Z)
|
|
23
|
+
D[Z] = St[Z], C[St.charCodeAt(Z)] = Z;
|
|
24
|
+
C["-".charCodeAt(0)] = 62;
|
|
25
|
+
C["_".charCodeAt(0)] = 63;
|
|
26
|
+
function Kt(n) {
|
|
27
|
+
var r = n.length;
|
|
28
|
+
if (r % 4 > 0)
|
|
29
|
+
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
30
|
+
var o = n.indexOf("=");
|
|
31
|
+
o === -1 && (o = r);
|
|
32
|
+
var a = o === r ? 0 : 4 - o % 4;
|
|
33
|
+
return [o, a];
|
|
34
|
+
}
|
|
35
|
+
function _e(n) {
|
|
36
|
+
var r = Kt(n), o = r[0], a = r[1];
|
|
37
|
+
return (o + a) * 3 / 4 - a;
|
|
38
|
+
}
|
|
39
|
+
function Re(n, r, o) {
|
|
40
|
+
return (r + o) * 3 / 4 - o;
|
|
41
|
+
}
|
|
42
|
+
function Oe(n) {
|
|
43
|
+
var r, o = Kt(n), a = o[0], h = o[1], f = new Ue(Re(n, a, h)), p = 0, c = h > 0 ? a - 4 : a, m;
|
|
44
|
+
for (m = 0; m < c; m += 4)
|
|
45
|
+
r = C[n.charCodeAt(m)] << 18 | C[n.charCodeAt(m + 1)] << 12 | C[n.charCodeAt(m + 2)] << 6 | C[n.charCodeAt(m + 3)], f[p++] = r >> 16 & 255, f[p++] = r >> 8 & 255, f[p++] = r & 255;
|
|
46
|
+
return h === 2 && (r = C[n.charCodeAt(m)] << 2 | C[n.charCodeAt(m + 1)] >> 4, f[p++] = r & 255), h === 1 && (r = C[n.charCodeAt(m)] << 10 | C[n.charCodeAt(m + 1)] << 4 | C[n.charCodeAt(m + 2)] >> 2, f[p++] = r >> 8 & 255, f[p++] = r & 255), f;
|
|
47
|
+
}
|
|
48
|
+
function Le(n) {
|
|
49
|
+
return D[n >> 18 & 63] + D[n >> 12 & 63] + D[n >> 6 & 63] + D[n & 63];
|
|
50
|
+
}
|
|
51
|
+
function $e(n, r, o) {
|
|
52
|
+
for (var a, h = [], f = r; f < o; f += 3)
|
|
53
|
+
a = (n[f] << 16 & 16711680) + (n[f + 1] << 8 & 65280) + (n[f + 2] & 255), h.push(Le(a));
|
|
54
|
+
return h.join("");
|
|
55
|
+
}
|
|
56
|
+
function ve(n) {
|
|
57
|
+
for (var r, o = n.length, a = o % 3, h = [], f = 16383, p = 0, c = o - a; p < c; p += f)
|
|
58
|
+
h.push($e(n, p, p + f > c ? c : p + f));
|
|
59
|
+
return a === 1 ? (r = n[o - 1], h.push(
|
|
60
|
+
D[r >> 2] + D[r << 4 & 63] + "=="
|
|
61
|
+
)) : a === 2 && (r = (n[o - 2] << 8) + n[o - 1], h.push(
|
|
62
|
+
D[r >> 10] + D[r >> 4 & 63] + D[r << 2 & 63] + "="
|
|
63
|
+
)), h.join("");
|
|
64
|
+
}
|
|
65
|
+
var xt = {};
|
|
66
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
67
|
+
xt.read = function(n, r, o, a, h) {
|
|
68
|
+
var f, p, c = h * 8 - a - 1, m = (1 << c) - 1, F = m >> 1, b = -7, B = o ? h - 1 : 0, O = o ? -1 : 1, w = n[r + B];
|
|
69
|
+
for (B += O, f = w & (1 << -b) - 1, w >>= -b, b += c; b > 0; f = f * 256 + n[r + B], B += O, b -= 8)
|
|
70
|
+
;
|
|
71
|
+
for (p = f & (1 << -b) - 1, f >>= -b, b += a; b > 0; p = p * 256 + n[r + B], B += O, b -= 8)
|
|
72
|
+
;
|
|
73
|
+
if (f === 0)
|
|
74
|
+
f = 1 - F;
|
|
75
|
+
else {
|
|
76
|
+
if (f === m)
|
|
77
|
+
return p ? NaN : (w ? -1 : 1) * (1 / 0);
|
|
78
|
+
p = p + Math.pow(2, a), f = f - F;
|
|
79
|
+
}
|
|
80
|
+
return (w ? -1 : 1) * p * Math.pow(2, f - a);
|
|
81
|
+
};
|
|
82
|
+
xt.write = function(n, r, o, a, h, f) {
|
|
83
|
+
var p, c, m, F = f * 8 - h - 1, b = (1 << F) - 1, B = b >> 1, O = h === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, w = a ? 0 : f - 1, rt = a ? 1 : -1, it = r < 0 || r === 0 && 1 / r < 0 ? 1 : 0;
|
|
84
|
+
for (r = Math.abs(r), isNaN(r) || r === 1 / 0 ? (c = isNaN(r) ? 1 : 0, p = b) : (p = Math.floor(Math.log(r) / Math.LN2), r * (m = Math.pow(2, -p)) < 1 && (p--, m *= 2), p + B >= 1 ? r += O / m : r += O * Math.pow(2, 1 - B), r * m >= 2 && (p++, m /= 2), p + B >= b ? (c = 0, p = b) : p + B >= 1 ? (c = (r * m - 1) * Math.pow(2, h), p = p + B) : (c = r * Math.pow(2, B - 1) * Math.pow(2, h), p = 0)); h >= 8; n[o + w] = c & 255, w += rt, c /= 256, h -= 8)
|
|
85
|
+
;
|
|
86
|
+
for (p = p << h | c, F += h; F > 0; n[o + w] = p & 255, w += rt, p /= 256, F -= 8)
|
|
87
|
+
;
|
|
88
|
+
n[o + w - rt] |= it * 128;
|
|
89
|
+
};
|
|
90
|
+
/*!
|
|
91
|
+
* The buffer module from node.js, for the browser.
|
|
92
|
+
*
|
|
93
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
94
|
+
* @license MIT
|
|
95
|
+
*/
|
|
96
|
+
(function(n) {
|
|
97
|
+
const r = ft, o = xt, a = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
|
|
98
|
+
n.Buffer = c, n.SlowBuffer = te, n.INSPECT_MAX_BYTES = 50;
|
|
99
|
+
const h = 2147483647;
|
|
100
|
+
n.kMaxLength = h, c.TYPED_ARRAY_SUPPORT = f(), !c.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
101
|
+
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
102
|
+
);
|
|
103
|
+
function f() {
|
|
104
|
+
try {
|
|
105
|
+
const i = new Uint8Array(1), t = { foo: function() {
|
|
106
|
+
return 42;
|
|
107
|
+
} };
|
|
108
|
+
return Object.setPrototypeOf(t, Uint8Array.prototype), Object.setPrototypeOf(i, t), i.foo() === 42;
|
|
109
|
+
} catch {
|
|
110
|
+
return !1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
Object.defineProperty(c.prototype, "parent", {
|
|
114
|
+
enumerable: !0,
|
|
115
|
+
get: function() {
|
|
116
|
+
if (c.isBuffer(this))
|
|
117
|
+
return this.buffer;
|
|
118
|
+
}
|
|
119
|
+
}), Object.defineProperty(c.prototype, "offset", {
|
|
120
|
+
enumerable: !0,
|
|
121
|
+
get: function() {
|
|
122
|
+
if (c.isBuffer(this))
|
|
123
|
+
return this.byteOffset;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
function p(i) {
|
|
127
|
+
if (i > h)
|
|
128
|
+
throw new RangeError('The value "' + i + '" is invalid for option "size"');
|
|
129
|
+
const t = new Uint8Array(i);
|
|
130
|
+
return Object.setPrototypeOf(t, c.prototype), t;
|
|
131
|
+
}
|
|
132
|
+
function c(i, t, e) {
|
|
133
|
+
if (typeof i == "number") {
|
|
134
|
+
if (typeof t == "string")
|
|
135
|
+
throw new TypeError(
|
|
136
|
+
'The "string" argument must be of type string. Received type number'
|
|
137
|
+
);
|
|
138
|
+
return B(i);
|
|
139
|
+
}
|
|
140
|
+
return m(i, t, e);
|
|
141
|
+
}
|
|
142
|
+
c.poolSize = 8192;
|
|
143
|
+
function m(i, t, e) {
|
|
144
|
+
if (typeof i == "string")
|
|
145
|
+
return O(i, t);
|
|
146
|
+
if (ArrayBuffer.isView(i))
|
|
147
|
+
return rt(i);
|
|
148
|
+
if (i == null)
|
|
149
|
+
throw new TypeError(
|
|
150
|
+
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof i
|
|
151
|
+
);
|
|
152
|
+
if (L(i, ArrayBuffer) || i && L(i.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (L(i, SharedArrayBuffer) || i && L(i.buffer, SharedArrayBuffer)))
|
|
153
|
+
return it(i, t, e);
|
|
154
|
+
if (typeof i == "number")
|
|
155
|
+
throw new TypeError(
|
|
156
|
+
'The "value" argument must not be of type number. Received type number'
|
|
157
|
+
);
|
|
158
|
+
const s = i.valueOf && i.valueOf();
|
|
159
|
+
if (s != null && s !== i)
|
|
160
|
+
return c.from(s, t, e);
|
|
161
|
+
const u = Jt(i);
|
|
162
|
+
if (u)
|
|
163
|
+
return u;
|
|
164
|
+
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof i[Symbol.toPrimitive] == "function")
|
|
165
|
+
return c.from(i[Symbol.toPrimitive]("string"), t, e);
|
|
166
|
+
throw new TypeError(
|
|
167
|
+
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof i
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
c.from = function(i, t, e) {
|
|
171
|
+
return m(i, t, e);
|
|
172
|
+
}, Object.setPrototypeOf(c.prototype, Uint8Array.prototype), Object.setPrototypeOf(c, Uint8Array);
|
|
173
|
+
function F(i) {
|
|
174
|
+
if (typeof i != "number")
|
|
175
|
+
throw new TypeError('"size" argument must be of type number');
|
|
176
|
+
if (i < 0)
|
|
177
|
+
throw new RangeError('The value "' + i + '" is invalid for option "size"');
|
|
178
|
+
}
|
|
179
|
+
function b(i, t, e) {
|
|
180
|
+
return F(i), i <= 0 ? p(i) : t !== void 0 ? typeof e == "string" ? p(i).fill(t, e) : p(i).fill(t) : p(i);
|
|
181
|
+
}
|
|
182
|
+
c.alloc = function(i, t, e) {
|
|
183
|
+
return b(i, t, e);
|
|
184
|
+
};
|
|
185
|
+
function B(i) {
|
|
186
|
+
return F(i), p(i < 0 ? 0 : gt(i) | 0);
|
|
187
|
+
}
|
|
188
|
+
c.allocUnsafe = function(i) {
|
|
189
|
+
return B(i);
|
|
190
|
+
}, c.allocUnsafeSlow = function(i) {
|
|
191
|
+
return B(i);
|
|
192
|
+
};
|
|
193
|
+
function O(i, t) {
|
|
194
|
+
if ((typeof t != "string" || t === "") && (t = "utf8"), !c.isEncoding(t))
|
|
195
|
+
throw new TypeError("Unknown encoding: " + t);
|
|
196
|
+
const e = kt(i, t) | 0;
|
|
197
|
+
let s = p(e);
|
|
198
|
+
const u = s.write(i, t);
|
|
199
|
+
return u !== e && (s = s.slice(0, u)), s;
|
|
200
|
+
}
|
|
201
|
+
function w(i) {
|
|
202
|
+
const t = i.length < 0 ? 0 : gt(i.length) | 0, e = p(t);
|
|
203
|
+
for (let s = 0; s < t; s += 1)
|
|
204
|
+
e[s] = i[s] & 255;
|
|
205
|
+
return e;
|
|
206
|
+
}
|
|
207
|
+
function rt(i) {
|
|
208
|
+
if (L(i, Uint8Array)) {
|
|
209
|
+
const t = new Uint8Array(i);
|
|
210
|
+
return it(t.buffer, t.byteOffset, t.byteLength);
|
|
211
|
+
}
|
|
212
|
+
return w(i);
|
|
213
|
+
}
|
|
214
|
+
function it(i, t, e) {
|
|
215
|
+
if (t < 0 || i.byteLength < t)
|
|
216
|
+
throw new RangeError('"offset" is outside of buffer bounds');
|
|
217
|
+
if (i.byteLength < t + (e || 0))
|
|
218
|
+
throw new RangeError('"length" is outside of buffer bounds');
|
|
219
|
+
let s;
|
|
220
|
+
return t === void 0 && e === void 0 ? s = new Uint8Array(i) : e === void 0 ? s = new Uint8Array(i, t) : s = new Uint8Array(i, t, e), Object.setPrototypeOf(s, c.prototype), s;
|
|
221
|
+
}
|
|
222
|
+
function Jt(i) {
|
|
223
|
+
if (c.isBuffer(i)) {
|
|
224
|
+
const t = gt(i.length) | 0, e = p(t);
|
|
225
|
+
return e.length === 0 || i.copy(e, 0, 0, t), e;
|
|
226
|
+
}
|
|
227
|
+
if (i.length !== void 0)
|
|
228
|
+
return typeof i.length != "number" || wt(i.length) ? p(0) : w(i);
|
|
229
|
+
if (i.type === "Buffer" && Array.isArray(i.data))
|
|
230
|
+
return w(i.data);
|
|
231
|
+
}
|
|
232
|
+
function gt(i) {
|
|
233
|
+
if (i >= h)
|
|
234
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + h.toString(16) + " bytes");
|
|
235
|
+
return i | 0;
|
|
236
|
+
}
|
|
237
|
+
function te(i) {
|
|
238
|
+
return +i != i && (i = 0), c.alloc(+i);
|
|
239
|
+
}
|
|
240
|
+
c.isBuffer = function(t) {
|
|
241
|
+
return t != null && t._isBuffer === !0 && t !== c.prototype;
|
|
242
|
+
}, c.compare = function(t, e) {
|
|
243
|
+
if (L(t, Uint8Array) && (t = c.from(t, t.offset, t.byteLength)), L(e, Uint8Array) && (e = c.from(e, e.offset, e.byteLength)), !c.isBuffer(t) || !c.isBuffer(e))
|
|
244
|
+
throw new TypeError(
|
|
245
|
+
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
246
|
+
);
|
|
247
|
+
if (t === e)
|
|
248
|
+
return 0;
|
|
249
|
+
let s = t.length, u = e.length;
|
|
250
|
+
for (let d = 0, l = Math.min(s, u); d < l; ++d)
|
|
251
|
+
if (t[d] !== e[d]) {
|
|
252
|
+
s = t[d], u = e[d];
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
return s < u ? -1 : u < s ? 1 : 0;
|
|
256
|
+
}, c.isEncoding = function(t) {
|
|
257
|
+
switch (String(t).toLowerCase()) {
|
|
258
|
+
case "hex":
|
|
259
|
+
case "utf8":
|
|
260
|
+
case "utf-8":
|
|
261
|
+
case "ascii":
|
|
262
|
+
case "latin1":
|
|
263
|
+
case "binary":
|
|
264
|
+
case "base64":
|
|
265
|
+
case "ucs2":
|
|
266
|
+
case "ucs-2":
|
|
267
|
+
case "utf16le":
|
|
268
|
+
case "utf-16le":
|
|
269
|
+
return !0;
|
|
270
|
+
default:
|
|
271
|
+
return !1;
|
|
272
|
+
}
|
|
273
|
+
}, c.concat = function(t, e) {
|
|
274
|
+
if (!Array.isArray(t))
|
|
275
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
276
|
+
if (t.length === 0)
|
|
277
|
+
return c.alloc(0);
|
|
278
|
+
let s;
|
|
279
|
+
if (e === void 0)
|
|
280
|
+
for (e = 0, s = 0; s < t.length; ++s)
|
|
281
|
+
e += t[s].length;
|
|
282
|
+
const u = c.allocUnsafe(e);
|
|
283
|
+
let d = 0;
|
|
284
|
+
for (s = 0; s < t.length; ++s) {
|
|
285
|
+
let l = t[s];
|
|
286
|
+
if (L(l, Uint8Array))
|
|
287
|
+
d + l.length > u.length ? (c.isBuffer(l) || (l = c.from(l)), l.copy(u, d)) : Uint8Array.prototype.set.call(
|
|
288
|
+
u,
|
|
289
|
+
l,
|
|
290
|
+
d
|
|
291
|
+
);
|
|
292
|
+
else if (c.isBuffer(l))
|
|
293
|
+
l.copy(u, d);
|
|
294
|
+
else
|
|
295
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
296
|
+
d += l.length;
|
|
297
|
+
}
|
|
298
|
+
return u;
|
|
299
|
+
};
|
|
300
|
+
function kt(i, t) {
|
|
301
|
+
if (c.isBuffer(i))
|
|
302
|
+
return i.length;
|
|
303
|
+
if (ArrayBuffer.isView(i) || L(i, ArrayBuffer))
|
|
304
|
+
return i.byteLength;
|
|
305
|
+
if (typeof i != "string")
|
|
306
|
+
throw new TypeError(
|
|
307
|
+
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof i
|
|
308
|
+
);
|
|
309
|
+
const e = i.length, s = arguments.length > 2 && arguments[2] === !0;
|
|
310
|
+
if (!s && e === 0)
|
|
311
|
+
return 0;
|
|
312
|
+
let u = !1;
|
|
313
|
+
for (; ; )
|
|
314
|
+
switch (t) {
|
|
315
|
+
case "ascii":
|
|
316
|
+
case "latin1":
|
|
317
|
+
case "binary":
|
|
318
|
+
return e;
|
|
319
|
+
case "utf8":
|
|
320
|
+
case "utf-8":
|
|
321
|
+
return yt(i).length;
|
|
322
|
+
case "ucs2":
|
|
323
|
+
case "ucs-2":
|
|
324
|
+
case "utf16le":
|
|
325
|
+
case "utf-16le":
|
|
326
|
+
return e * 2;
|
|
327
|
+
case "hex":
|
|
328
|
+
return e >>> 1;
|
|
329
|
+
case "base64":
|
|
330
|
+
return Vt(i).length;
|
|
331
|
+
default:
|
|
332
|
+
if (u)
|
|
333
|
+
return s ? -1 : yt(i).length;
|
|
334
|
+
t = ("" + t).toLowerCase(), u = !0;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
c.byteLength = kt;
|
|
338
|
+
function ee(i, t, e) {
|
|
339
|
+
let s = !1;
|
|
340
|
+
if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((e === void 0 || e > this.length) && (e = this.length), e <= 0) || (e >>>= 0, t >>>= 0, e <= t))
|
|
341
|
+
return "";
|
|
342
|
+
for (i || (i = "utf8"); ; )
|
|
343
|
+
switch (i) {
|
|
344
|
+
case "hex":
|
|
345
|
+
return de(this, t, e);
|
|
346
|
+
case "utf8":
|
|
347
|
+
case "utf-8":
|
|
348
|
+
return Ut(this, t, e);
|
|
349
|
+
case "ascii":
|
|
350
|
+
return ce(this, t, e);
|
|
351
|
+
case "latin1":
|
|
352
|
+
case "binary":
|
|
353
|
+
return he(this, t, e);
|
|
354
|
+
case "base64":
|
|
355
|
+
return ae(this, t, e);
|
|
356
|
+
case "ucs2":
|
|
357
|
+
case "ucs-2":
|
|
358
|
+
case "utf16le":
|
|
359
|
+
case "utf-16le":
|
|
360
|
+
return le(this, t, e);
|
|
361
|
+
default:
|
|
362
|
+
if (s)
|
|
363
|
+
throw new TypeError("Unknown encoding: " + i);
|
|
364
|
+
i = (i + "").toLowerCase(), s = !0;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
c.prototype._isBuffer = !0;
|
|
368
|
+
function z(i, t, e) {
|
|
369
|
+
const s = i[t];
|
|
370
|
+
i[t] = i[e], i[e] = s;
|
|
371
|
+
}
|
|
372
|
+
c.prototype.swap16 = function() {
|
|
373
|
+
const t = this.length;
|
|
374
|
+
if (t % 2 !== 0)
|
|
375
|
+
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
376
|
+
for (let e = 0; e < t; e += 2)
|
|
377
|
+
z(this, e, e + 1);
|
|
378
|
+
return this;
|
|
379
|
+
}, c.prototype.swap32 = function() {
|
|
380
|
+
const t = this.length;
|
|
381
|
+
if (t % 4 !== 0)
|
|
382
|
+
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
383
|
+
for (let e = 0; e < t; e += 4)
|
|
384
|
+
z(this, e, e + 3), z(this, e + 1, e + 2);
|
|
385
|
+
return this;
|
|
386
|
+
}, c.prototype.swap64 = function() {
|
|
387
|
+
const t = this.length;
|
|
388
|
+
if (t % 8 !== 0)
|
|
389
|
+
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
390
|
+
for (let e = 0; e < t; e += 8)
|
|
391
|
+
z(this, e, e + 7), z(this, e + 1, e + 6), z(this, e + 2, e + 5), z(this, e + 3, e + 4);
|
|
392
|
+
return this;
|
|
393
|
+
}, c.prototype.toString = function() {
|
|
394
|
+
const t = this.length;
|
|
395
|
+
return t === 0 ? "" : arguments.length === 0 ? Ut(this, 0, t) : ee.apply(this, arguments);
|
|
396
|
+
}, c.prototype.toLocaleString = c.prototype.toString, c.prototype.equals = function(t) {
|
|
397
|
+
if (!c.isBuffer(t))
|
|
398
|
+
throw new TypeError("Argument must be a Buffer");
|
|
399
|
+
return this === t ? !0 : c.compare(this, t) === 0;
|
|
400
|
+
}, c.prototype.inspect = function() {
|
|
401
|
+
let t = "";
|
|
402
|
+
const e = n.INSPECT_MAX_BYTES;
|
|
403
|
+
return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(), this.length > e && (t += " ... "), "<Buffer " + t + ">";
|
|
404
|
+
}, a && (c.prototype[a] = c.prototype.inspect), c.prototype.compare = function(t, e, s, u, d) {
|
|
405
|
+
if (L(t, Uint8Array) && (t = c.from(t, t.offset, t.byteLength)), !c.isBuffer(t))
|
|
406
|
+
throw new TypeError(
|
|
407
|
+
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
|
|
408
|
+
);
|
|
409
|
+
if (e === void 0 && (e = 0), s === void 0 && (s = t ? t.length : 0), u === void 0 && (u = 0), d === void 0 && (d = this.length), e < 0 || s > t.length || u < 0 || d > this.length)
|
|
410
|
+
throw new RangeError("out of range index");
|
|
411
|
+
if (u >= d && e >= s)
|
|
412
|
+
return 0;
|
|
413
|
+
if (u >= d)
|
|
414
|
+
return -1;
|
|
415
|
+
if (e >= s)
|
|
416
|
+
return 1;
|
|
417
|
+
if (e >>>= 0, s >>>= 0, u >>>= 0, d >>>= 0, this === t)
|
|
418
|
+
return 0;
|
|
419
|
+
let l = d - u, g = s - e;
|
|
420
|
+
const I = Math.min(l, g), S = this.slice(u, d), E = t.slice(e, s);
|
|
421
|
+
for (let y = 0; y < I; ++y)
|
|
422
|
+
if (S[y] !== E[y]) {
|
|
423
|
+
l = S[y], g = E[y];
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
return l < g ? -1 : g < l ? 1 : 0;
|
|
427
|
+
};
|
|
428
|
+
function Tt(i, t, e, s, u) {
|
|
429
|
+
if (i.length === 0)
|
|
430
|
+
return -1;
|
|
431
|
+
if (typeof e == "string" ? (s = e, e = 0) : e > 2147483647 ? e = 2147483647 : e < -2147483648 && (e = -2147483648), e = +e, wt(e) && (e = u ? 0 : i.length - 1), e < 0 && (e = i.length + e), e >= i.length) {
|
|
432
|
+
if (u)
|
|
433
|
+
return -1;
|
|
434
|
+
e = i.length - 1;
|
|
435
|
+
} else if (e < 0)
|
|
436
|
+
if (u)
|
|
437
|
+
e = 0;
|
|
438
|
+
else
|
|
439
|
+
return -1;
|
|
440
|
+
if (typeof t == "string" && (t = c.from(t, s)), c.isBuffer(t))
|
|
441
|
+
return t.length === 0 ? -1 : Ct(i, t, e, s, u);
|
|
442
|
+
if (typeof t == "number")
|
|
443
|
+
return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? u ? Uint8Array.prototype.indexOf.call(i, t, e) : Uint8Array.prototype.lastIndexOf.call(i, t, e) : Ct(i, [t], e, s, u);
|
|
444
|
+
throw new TypeError("val must be string, number or Buffer");
|
|
445
|
+
}
|
|
446
|
+
function Ct(i, t, e, s, u) {
|
|
447
|
+
let d = 1, l = i.length, g = t.length;
|
|
448
|
+
if (s !== void 0 && (s = String(s).toLowerCase(), s === "ucs2" || s === "ucs-2" || s === "utf16le" || s === "utf-16le")) {
|
|
449
|
+
if (i.length < 2 || t.length < 2)
|
|
450
|
+
return -1;
|
|
451
|
+
d = 2, l /= 2, g /= 2, e /= 2;
|
|
452
|
+
}
|
|
453
|
+
function I(E, y) {
|
|
454
|
+
return d === 1 ? E[y] : E.readUInt16BE(y * d);
|
|
455
|
+
}
|
|
456
|
+
let S;
|
|
457
|
+
if (u) {
|
|
458
|
+
let E = -1;
|
|
459
|
+
for (S = e; S < l; S++)
|
|
460
|
+
if (I(i, S) === I(t, E === -1 ? 0 : S - E)) {
|
|
461
|
+
if (E === -1 && (E = S), S - E + 1 === g)
|
|
462
|
+
return E * d;
|
|
463
|
+
} else
|
|
464
|
+
E !== -1 && (S -= S - E), E = -1;
|
|
465
|
+
} else
|
|
466
|
+
for (e + g > l && (e = l - g), S = e; S >= 0; S--) {
|
|
467
|
+
let E = !0;
|
|
468
|
+
for (let y = 0; y < g; y++)
|
|
469
|
+
if (I(i, S + y) !== I(t, y)) {
|
|
470
|
+
E = !1;
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
if (E)
|
|
474
|
+
return S;
|
|
475
|
+
}
|
|
476
|
+
return -1;
|
|
477
|
+
}
|
|
478
|
+
c.prototype.includes = function(t, e, s) {
|
|
479
|
+
return this.indexOf(t, e, s) !== -1;
|
|
480
|
+
}, c.prototype.indexOf = function(t, e, s) {
|
|
481
|
+
return Tt(this, t, e, s, !0);
|
|
482
|
+
}, c.prototype.lastIndexOf = function(t, e, s) {
|
|
483
|
+
return Tt(this, t, e, s, !1);
|
|
484
|
+
};
|
|
485
|
+
function re(i, t, e, s) {
|
|
486
|
+
e = Number(e) || 0;
|
|
487
|
+
const u = i.length - e;
|
|
488
|
+
s ? (s = Number(s), s > u && (s = u)) : s = u;
|
|
489
|
+
const d = t.length;
|
|
490
|
+
s > d / 2 && (s = d / 2);
|
|
491
|
+
let l;
|
|
492
|
+
for (l = 0; l < s; ++l) {
|
|
493
|
+
const g = parseInt(t.substr(l * 2, 2), 16);
|
|
494
|
+
if (wt(g))
|
|
495
|
+
return l;
|
|
496
|
+
i[e + l] = g;
|
|
497
|
+
}
|
|
498
|
+
return l;
|
|
499
|
+
}
|
|
500
|
+
function ie(i, t, e, s) {
|
|
501
|
+
return at(yt(t, i.length - e), i, e, s);
|
|
502
|
+
}
|
|
503
|
+
function ne(i, t, e, s) {
|
|
504
|
+
return at(me(t), i, e, s);
|
|
505
|
+
}
|
|
506
|
+
function se(i, t, e, s) {
|
|
507
|
+
return at(Vt(t), i, e, s);
|
|
508
|
+
}
|
|
509
|
+
function oe(i, t, e, s) {
|
|
510
|
+
return at(ye(t, i.length - e), i, e, s);
|
|
511
|
+
}
|
|
512
|
+
c.prototype.write = function(t, e, s, u) {
|
|
513
|
+
if (e === void 0)
|
|
514
|
+
u = "utf8", s = this.length, e = 0;
|
|
515
|
+
else if (s === void 0 && typeof e == "string")
|
|
516
|
+
u = e, s = this.length, e = 0;
|
|
517
|
+
else if (isFinite(e))
|
|
518
|
+
e = e >>> 0, isFinite(s) ? (s = s >>> 0, u === void 0 && (u = "utf8")) : (u = s, s = void 0);
|
|
519
|
+
else
|
|
520
|
+
throw new Error(
|
|
521
|
+
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
522
|
+
);
|
|
523
|
+
const d = this.length - e;
|
|
524
|
+
if ((s === void 0 || s > d) && (s = d), t.length > 0 && (s < 0 || e < 0) || e > this.length)
|
|
525
|
+
throw new RangeError("Attempt to write outside buffer bounds");
|
|
526
|
+
u || (u = "utf8");
|
|
527
|
+
let l = !1;
|
|
528
|
+
for (; ; )
|
|
529
|
+
switch (u) {
|
|
530
|
+
case "hex":
|
|
531
|
+
return re(this, t, e, s);
|
|
532
|
+
case "utf8":
|
|
533
|
+
case "utf-8":
|
|
534
|
+
return ie(this, t, e, s);
|
|
535
|
+
case "ascii":
|
|
536
|
+
case "latin1":
|
|
537
|
+
case "binary":
|
|
538
|
+
return ne(this, t, e, s);
|
|
539
|
+
case "base64":
|
|
540
|
+
return se(this, t, e, s);
|
|
541
|
+
case "ucs2":
|
|
542
|
+
case "ucs-2":
|
|
543
|
+
case "utf16le":
|
|
544
|
+
case "utf-16le":
|
|
545
|
+
return oe(this, t, e, s);
|
|
546
|
+
default:
|
|
547
|
+
if (l)
|
|
548
|
+
throw new TypeError("Unknown encoding: " + u);
|
|
549
|
+
u = ("" + u).toLowerCase(), l = !0;
|
|
550
|
+
}
|
|
551
|
+
}, c.prototype.toJSON = function() {
|
|
552
|
+
return {
|
|
553
|
+
type: "Buffer",
|
|
554
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
function ae(i, t, e) {
|
|
558
|
+
return t === 0 && e === i.length ? r.fromByteArray(i) : r.fromByteArray(i.slice(t, e));
|
|
559
|
+
}
|
|
560
|
+
function Ut(i, t, e) {
|
|
561
|
+
e = Math.min(i.length, e);
|
|
562
|
+
const s = [];
|
|
563
|
+
let u = t;
|
|
564
|
+
for (; u < e; ) {
|
|
565
|
+
const d = i[u];
|
|
566
|
+
let l = null, g = d > 239 ? 4 : d > 223 ? 3 : d > 191 ? 2 : 1;
|
|
567
|
+
if (u + g <= e) {
|
|
568
|
+
let I, S, E, y;
|
|
569
|
+
switch (g) {
|
|
570
|
+
case 1:
|
|
571
|
+
d < 128 && (l = d);
|
|
572
|
+
break;
|
|
573
|
+
case 2:
|
|
574
|
+
I = i[u + 1], (I & 192) === 128 && (y = (d & 31) << 6 | I & 63, y > 127 && (l = y));
|
|
575
|
+
break;
|
|
576
|
+
case 3:
|
|
577
|
+
I = i[u + 1], S = i[u + 2], (I & 192) === 128 && (S & 192) === 128 && (y = (d & 15) << 12 | (I & 63) << 6 | S & 63, y > 2047 && (y < 55296 || y > 57343) && (l = y));
|
|
578
|
+
break;
|
|
579
|
+
case 4:
|
|
580
|
+
I = i[u + 1], S = i[u + 2], E = i[u + 3], (I & 192) === 128 && (S & 192) === 128 && (E & 192) === 128 && (y = (d & 15) << 18 | (I & 63) << 12 | (S & 63) << 6 | E & 63, y > 65535 && y < 1114112 && (l = y));
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
l === null ? (l = 65533, g = 1) : l > 65535 && (l -= 65536, s.push(l >>> 10 & 1023 | 55296), l = 56320 | l & 1023), s.push(l), u += g;
|
|
584
|
+
}
|
|
585
|
+
return ue(s);
|
|
586
|
+
}
|
|
587
|
+
const Nt = 4096;
|
|
588
|
+
function ue(i) {
|
|
589
|
+
const t = i.length;
|
|
590
|
+
if (t <= Nt)
|
|
591
|
+
return String.fromCharCode.apply(String, i);
|
|
592
|
+
let e = "", s = 0;
|
|
593
|
+
for (; s < t; )
|
|
594
|
+
e += String.fromCharCode.apply(
|
|
595
|
+
String,
|
|
596
|
+
i.slice(s, s += Nt)
|
|
597
|
+
);
|
|
598
|
+
return e;
|
|
599
|
+
}
|
|
600
|
+
function ce(i, t, e) {
|
|
601
|
+
let s = "";
|
|
602
|
+
e = Math.min(i.length, e);
|
|
603
|
+
for (let u = t; u < e; ++u)
|
|
604
|
+
s += String.fromCharCode(i[u] & 127);
|
|
605
|
+
return s;
|
|
606
|
+
}
|
|
607
|
+
function he(i, t, e) {
|
|
608
|
+
let s = "";
|
|
609
|
+
e = Math.min(i.length, e);
|
|
610
|
+
for (let u = t; u < e; ++u)
|
|
611
|
+
s += String.fromCharCode(i[u]);
|
|
612
|
+
return s;
|
|
613
|
+
}
|
|
614
|
+
function de(i, t, e) {
|
|
615
|
+
const s = i.length;
|
|
616
|
+
(!t || t < 0) && (t = 0), (!e || e < 0 || e > s) && (e = s);
|
|
617
|
+
let u = "";
|
|
618
|
+
for (let d = t; d < e; ++d)
|
|
619
|
+
u += we[i[d]];
|
|
620
|
+
return u;
|
|
621
|
+
}
|
|
622
|
+
function le(i, t, e) {
|
|
623
|
+
const s = i.slice(t, e);
|
|
624
|
+
let u = "";
|
|
625
|
+
for (let d = 0; d < s.length - 1; d += 2)
|
|
626
|
+
u += String.fromCharCode(s[d] + s[d + 1] * 256);
|
|
627
|
+
return u;
|
|
628
|
+
}
|
|
629
|
+
c.prototype.slice = function(t, e) {
|
|
630
|
+
const s = this.length;
|
|
631
|
+
t = ~~t, e = e === void 0 ? s : ~~e, t < 0 ? (t += s, t < 0 && (t = 0)) : t > s && (t = s), e < 0 ? (e += s, e < 0 && (e = 0)) : e > s && (e = s), e < t && (e = t);
|
|
632
|
+
const u = this.subarray(t, e);
|
|
633
|
+
return Object.setPrototypeOf(u, c.prototype), u;
|
|
634
|
+
};
|
|
635
|
+
function A(i, t, e) {
|
|
636
|
+
if (i % 1 !== 0 || i < 0)
|
|
637
|
+
throw new RangeError("offset is not uint");
|
|
638
|
+
if (i + t > e)
|
|
639
|
+
throw new RangeError("Trying to access beyond buffer length");
|
|
640
|
+
}
|
|
641
|
+
c.prototype.readUintLE = c.prototype.readUIntLE = function(t, e, s) {
|
|
642
|
+
t = t >>> 0, e = e >>> 0, s || A(t, e, this.length);
|
|
643
|
+
let u = this[t], d = 1, l = 0;
|
|
644
|
+
for (; ++l < e && (d *= 256); )
|
|
645
|
+
u += this[t + l] * d;
|
|
646
|
+
return u;
|
|
647
|
+
}, c.prototype.readUintBE = c.prototype.readUIntBE = function(t, e, s) {
|
|
648
|
+
t = t >>> 0, e = e >>> 0, s || A(t, e, this.length);
|
|
649
|
+
let u = this[t + --e], d = 1;
|
|
650
|
+
for (; e > 0 && (d *= 256); )
|
|
651
|
+
u += this[t + --e] * d;
|
|
652
|
+
return u;
|
|
653
|
+
}, c.prototype.readUint8 = c.prototype.readUInt8 = function(t, e) {
|
|
654
|
+
return t = t >>> 0, e || A(t, 1, this.length), this[t];
|
|
655
|
+
}, c.prototype.readUint16LE = c.prototype.readUInt16LE = function(t, e) {
|
|
656
|
+
return t = t >>> 0, e || A(t, 2, this.length), this[t] | this[t + 1] << 8;
|
|
657
|
+
}, c.prototype.readUint16BE = c.prototype.readUInt16BE = function(t, e) {
|
|
658
|
+
return t = t >>> 0, e || A(t, 2, this.length), this[t] << 8 | this[t + 1];
|
|
659
|
+
}, c.prototype.readUint32LE = c.prototype.readUInt32LE = function(t, e) {
|
|
660
|
+
return t = t >>> 0, e || A(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
|
|
661
|
+
}, c.prototype.readUint32BE = c.prototype.readUInt32BE = function(t, e) {
|
|
662
|
+
return t = t >>> 0, e || A(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
|
|
663
|
+
}, c.prototype.readBigUInt64LE = G(function(t) {
|
|
664
|
+
t = t >>> 0, X(t, "offset");
|
|
665
|
+
const e = this[t], s = this[t + 7];
|
|
666
|
+
(e === void 0 || s === void 0) && nt(t, this.length - 8);
|
|
667
|
+
const u = e + this[++t] * 2 ** 8 + this[++t] * 2 ** 16 + this[++t] * 2 ** 24, d = this[++t] + this[++t] * 2 ** 8 + this[++t] * 2 ** 16 + s * 2 ** 24;
|
|
668
|
+
return BigInt(u) + (BigInt(d) << BigInt(32));
|
|
669
|
+
}), c.prototype.readBigUInt64BE = G(function(t) {
|
|
670
|
+
t = t >>> 0, X(t, "offset");
|
|
671
|
+
const e = this[t], s = this[t + 7];
|
|
672
|
+
(e === void 0 || s === void 0) && nt(t, this.length - 8);
|
|
673
|
+
const u = e * 2 ** 24 + this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + this[++t], d = this[++t] * 2 ** 24 + this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + s;
|
|
674
|
+
return (BigInt(u) << BigInt(32)) + BigInt(d);
|
|
675
|
+
}), c.prototype.readIntLE = function(t, e, s) {
|
|
676
|
+
t = t >>> 0, e = e >>> 0, s || A(t, e, this.length);
|
|
677
|
+
let u = this[t], d = 1, l = 0;
|
|
678
|
+
for (; ++l < e && (d *= 256); )
|
|
679
|
+
u += this[t + l] * d;
|
|
680
|
+
return d *= 128, u >= d && (u -= Math.pow(2, 8 * e)), u;
|
|
681
|
+
}, c.prototype.readIntBE = function(t, e, s) {
|
|
682
|
+
t = t >>> 0, e = e >>> 0, s || A(t, e, this.length);
|
|
683
|
+
let u = e, d = 1, l = this[t + --u];
|
|
684
|
+
for (; u > 0 && (d *= 256); )
|
|
685
|
+
l += this[t + --u] * d;
|
|
686
|
+
return d *= 128, l >= d && (l -= Math.pow(2, 8 * e)), l;
|
|
687
|
+
}, c.prototype.readInt8 = function(t, e) {
|
|
688
|
+
return t = t >>> 0, e || A(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
|
|
689
|
+
}, c.prototype.readInt16LE = function(t, e) {
|
|
690
|
+
t = t >>> 0, e || A(t, 2, this.length);
|
|
691
|
+
const s = this[t] | this[t + 1] << 8;
|
|
692
|
+
return s & 32768 ? s | 4294901760 : s;
|
|
693
|
+
}, c.prototype.readInt16BE = function(t, e) {
|
|
694
|
+
t = t >>> 0, e || A(t, 2, this.length);
|
|
695
|
+
const s = this[t + 1] | this[t] << 8;
|
|
696
|
+
return s & 32768 ? s | 4294901760 : s;
|
|
697
|
+
}, c.prototype.readInt32LE = function(t, e) {
|
|
698
|
+
return t = t >>> 0, e || A(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
|
|
699
|
+
}, c.prototype.readInt32BE = function(t, e) {
|
|
700
|
+
return t = t >>> 0, e || A(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
|
|
701
|
+
}, c.prototype.readBigInt64LE = G(function(t) {
|
|
702
|
+
t = t >>> 0, X(t, "offset");
|
|
703
|
+
const e = this[t], s = this[t + 7];
|
|
704
|
+
(e === void 0 || s === void 0) && nt(t, this.length - 8);
|
|
705
|
+
const u = this[t + 4] + this[t + 5] * 2 ** 8 + this[t + 6] * 2 ** 16 + (s << 24);
|
|
706
|
+
return (BigInt(u) << BigInt(32)) + BigInt(e + this[++t] * 2 ** 8 + this[++t] * 2 ** 16 + this[++t] * 2 ** 24);
|
|
707
|
+
}), c.prototype.readBigInt64BE = G(function(t) {
|
|
708
|
+
t = t >>> 0, X(t, "offset");
|
|
709
|
+
const e = this[t], s = this[t + 7];
|
|
710
|
+
(e === void 0 || s === void 0) && nt(t, this.length - 8);
|
|
711
|
+
const u = (e << 24) + // Overflow
|
|
712
|
+
this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + this[++t];
|
|
713
|
+
return (BigInt(u) << BigInt(32)) + BigInt(this[++t] * 2 ** 24 + this[++t] * 2 ** 16 + this[++t] * 2 ** 8 + s);
|
|
714
|
+
}), c.prototype.readFloatLE = function(t, e) {
|
|
715
|
+
return t = t >>> 0, e || A(t, 4, this.length), o.read(this, t, !0, 23, 4);
|
|
716
|
+
}, c.prototype.readFloatBE = function(t, e) {
|
|
717
|
+
return t = t >>> 0, e || A(t, 4, this.length), o.read(this, t, !1, 23, 4);
|
|
718
|
+
}, c.prototype.readDoubleLE = function(t, e) {
|
|
719
|
+
return t = t >>> 0, e || A(t, 8, this.length), o.read(this, t, !0, 52, 8);
|
|
720
|
+
}, c.prototype.readDoubleBE = function(t, e) {
|
|
721
|
+
return t = t >>> 0, e || A(t, 8, this.length), o.read(this, t, !1, 52, 8);
|
|
722
|
+
};
|
|
723
|
+
function k(i, t, e, s, u, d) {
|
|
724
|
+
if (!c.isBuffer(i))
|
|
725
|
+
throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
726
|
+
if (t > u || t < d)
|
|
727
|
+
throw new RangeError('"value" argument is out of bounds');
|
|
728
|
+
if (e + s > i.length)
|
|
729
|
+
throw new RangeError("Index out of range");
|
|
730
|
+
}
|
|
731
|
+
c.prototype.writeUintLE = c.prototype.writeUIntLE = function(t, e, s, u) {
|
|
732
|
+
if (t = +t, e = e >>> 0, s = s >>> 0, !u) {
|
|
733
|
+
const g = Math.pow(2, 8 * s) - 1;
|
|
734
|
+
k(this, t, e, s, g, 0);
|
|
735
|
+
}
|
|
736
|
+
let d = 1, l = 0;
|
|
737
|
+
for (this[e] = t & 255; ++l < s && (d *= 256); )
|
|
738
|
+
this[e + l] = t / d & 255;
|
|
739
|
+
return e + s;
|
|
740
|
+
}, c.prototype.writeUintBE = c.prototype.writeUIntBE = function(t, e, s, u) {
|
|
741
|
+
if (t = +t, e = e >>> 0, s = s >>> 0, !u) {
|
|
742
|
+
const g = Math.pow(2, 8 * s) - 1;
|
|
743
|
+
k(this, t, e, s, g, 0);
|
|
744
|
+
}
|
|
745
|
+
let d = s - 1, l = 1;
|
|
746
|
+
for (this[e + d] = t & 255; --d >= 0 && (l *= 256); )
|
|
747
|
+
this[e + d] = t / l & 255;
|
|
748
|
+
return e + s;
|
|
749
|
+
}, c.prototype.writeUint8 = c.prototype.writeUInt8 = function(t, e, s) {
|
|
750
|
+
return t = +t, e = e >>> 0, s || k(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
|
|
751
|
+
}, c.prototype.writeUint16LE = c.prototype.writeUInt16LE = function(t, e, s) {
|
|
752
|
+
return t = +t, e = e >>> 0, s || k(this, t, e, 2, 65535, 0), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
|
|
753
|
+
}, c.prototype.writeUint16BE = c.prototype.writeUInt16BE = function(t, e, s) {
|
|
754
|
+
return t = +t, e = e >>> 0, s || k(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
|
|
755
|
+
}, c.prototype.writeUint32LE = c.prototype.writeUInt32LE = function(t, e, s) {
|
|
756
|
+
return t = +t, e = e >>> 0, s || k(this, t, e, 4, 4294967295, 0), this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = t & 255, e + 4;
|
|
757
|
+
}, c.prototype.writeUint32BE = c.prototype.writeUInt32BE = function(t, e, s) {
|
|
758
|
+
return t = +t, e = e >>> 0, s || k(this, t, e, 4, 4294967295, 0), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
|
|
759
|
+
};
|
|
760
|
+
function _t(i, t, e, s, u) {
|
|
761
|
+
Dt(t, s, u, i, e, 7);
|
|
762
|
+
let d = Number(t & BigInt(4294967295));
|
|
763
|
+
i[e++] = d, d = d >> 8, i[e++] = d, d = d >> 8, i[e++] = d, d = d >> 8, i[e++] = d;
|
|
764
|
+
let l = Number(t >> BigInt(32) & BigInt(4294967295));
|
|
765
|
+
return i[e++] = l, l = l >> 8, i[e++] = l, l = l >> 8, i[e++] = l, l = l >> 8, i[e++] = l, e;
|
|
766
|
+
}
|
|
767
|
+
function Rt(i, t, e, s, u) {
|
|
768
|
+
Dt(t, s, u, i, e, 7);
|
|
769
|
+
let d = Number(t & BigInt(4294967295));
|
|
770
|
+
i[e + 7] = d, d = d >> 8, i[e + 6] = d, d = d >> 8, i[e + 5] = d, d = d >> 8, i[e + 4] = d;
|
|
771
|
+
let l = Number(t >> BigInt(32) & BigInt(4294967295));
|
|
772
|
+
return i[e + 3] = l, l = l >> 8, i[e + 2] = l, l = l >> 8, i[e + 1] = l, l = l >> 8, i[e] = l, e + 8;
|
|
773
|
+
}
|
|
774
|
+
c.prototype.writeBigUInt64LE = G(function(t, e = 0) {
|
|
775
|
+
return _t(this, t, e, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
776
|
+
}), c.prototype.writeBigUInt64BE = G(function(t, e = 0) {
|
|
777
|
+
return Rt(this, t, e, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
778
|
+
}), c.prototype.writeIntLE = function(t, e, s, u) {
|
|
779
|
+
if (t = +t, e = e >>> 0, !u) {
|
|
780
|
+
const I = Math.pow(2, 8 * s - 1);
|
|
781
|
+
k(this, t, e, s, I - 1, -I);
|
|
782
|
+
}
|
|
783
|
+
let d = 0, l = 1, g = 0;
|
|
784
|
+
for (this[e] = t & 255; ++d < s && (l *= 256); )
|
|
785
|
+
t < 0 && g === 0 && this[e + d - 1] !== 0 && (g = 1), this[e + d] = (t / l >> 0) - g & 255;
|
|
786
|
+
return e + s;
|
|
787
|
+
}, c.prototype.writeIntBE = function(t, e, s, u) {
|
|
788
|
+
if (t = +t, e = e >>> 0, !u) {
|
|
789
|
+
const I = Math.pow(2, 8 * s - 1);
|
|
790
|
+
k(this, t, e, s, I - 1, -I);
|
|
791
|
+
}
|
|
792
|
+
let d = s - 1, l = 1, g = 0;
|
|
793
|
+
for (this[e + d] = t & 255; --d >= 0 && (l *= 256); )
|
|
794
|
+
t < 0 && g === 0 && this[e + d + 1] !== 0 && (g = 1), this[e + d] = (t / l >> 0) - g & 255;
|
|
795
|
+
return e + s;
|
|
796
|
+
}, c.prototype.writeInt8 = function(t, e, s) {
|
|
797
|
+
return t = +t, e = e >>> 0, s || k(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
|
|
798
|
+
}, c.prototype.writeInt16LE = function(t, e, s) {
|
|
799
|
+
return t = +t, e = e >>> 0, s || k(this, t, e, 2, 32767, -32768), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
|
|
800
|
+
}, c.prototype.writeInt16BE = function(t, e, s) {
|
|
801
|
+
return t = +t, e = e >>> 0, s || k(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
|
|
802
|
+
}, c.prototype.writeInt32LE = function(t, e, s) {
|
|
803
|
+
return t = +t, e = e >>> 0, s || k(this, t, e, 4, 2147483647, -2147483648), this[e] = t & 255, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24, e + 4;
|
|
804
|
+
}, c.prototype.writeInt32BE = function(t, e, s) {
|
|
805
|
+
return t = +t, e = e >>> 0, s || k(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
|
|
806
|
+
}, c.prototype.writeBigInt64LE = G(function(t, e = 0) {
|
|
807
|
+
return _t(this, t, e, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
808
|
+
}), c.prototype.writeBigInt64BE = G(function(t, e = 0) {
|
|
809
|
+
return Rt(this, t, e, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
810
|
+
});
|
|
811
|
+
function Ot(i, t, e, s, u, d) {
|
|
812
|
+
if (e + s > i.length)
|
|
813
|
+
throw new RangeError("Index out of range");
|
|
814
|
+
if (e < 0)
|
|
815
|
+
throw new RangeError("Index out of range");
|
|
816
|
+
}
|
|
817
|
+
function Lt(i, t, e, s, u) {
|
|
818
|
+
return t = +t, e = e >>> 0, u || Ot(i, t, e, 4), o.write(i, t, e, s, 23, 4), e + 4;
|
|
819
|
+
}
|
|
820
|
+
c.prototype.writeFloatLE = function(t, e, s) {
|
|
821
|
+
return Lt(this, t, e, !0, s);
|
|
822
|
+
}, c.prototype.writeFloatBE = function(t, e, s) {
|
|
823
|
+
return Lt(this, t, e, !1, s);
|
|
824
|
+
};
|
|
825
|
+
function $t(i, t, e, s, u) {
|
|
826
|
+
return t = +t, e = e >>> 0, u || Ot(i, t, e, 8), o.write(i, t, e, s, 52, 8), e + 8;
|
|
827
|
+
}
|
|
828
|
+
c.prototype.writeDoubleLE = function(t, e, s) {
|
|
829
|
+
return $t(this, t, e, !0, s);
|
|
830
|
+
}, c.prototype.writeDoubleBE = function(t, e, s) {
|
|
831
|
+
return $t(this, t, e, !1, s);
|
|
832
|
+
}, c.prototype.copy = function(t, e, s, u) {
|
|
833
|
+
if (!c.isBuffer(t))
|
|
834
|
+
throw new TypeError("argument should be a Buffer");
|
|
835
|
+
if (s || (s = 0), !u && u !== 0 && (u = this.length), e >= t.length && (e = t.length), e || (e = 0), u > 0 && u < s && (u = s), u === s || t.length === 0 || this.length === 0)
|
|
836
|
+
return 0;
|
|
837
|
+
if (e < 0)
|
|
838
|
+
throw new RangeError("targetStart out of bounds");
|
|
839
|
+
if (s < 0 || s >= this.length)
|
|
840
|
+
throw new RangeError("Index out of range");
|
|
841
|
+
if (u < 0)
|
|
842
|
+
throw new RangeError("sourceEnd out of bounds");
|
|
843
|
+
u > this.length && (u = this.length), t.length - e < u - s && (u = t.length - e + s);
|
|
844
|
+
const d = u - s;
|
|
845
|
+
return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(e, s, u) : Uint8Array.prototype.set.call(
|
|
846
|
+
t,
|
|
847
|
+
this.subarray(s, u),
|
|
848
|
+
e
|
|
849
|
+
), d;
|
|
850
|
+
}, c.prototype.fill = function(t, e, s, u) {
|
|
851
|
+
if (typeof t == "string") {
|
|
852
|
+
if (typeof e == "string" ? (u = e, e = 0, s = this.length) : typeof s == "string" && (u = s, s = this.length), u !== void 0 && typeof u != "string")
|
|
853
|
+
throw new TypeError("encoding must be a string");
|
|
854
|
+
if (typeof u == "string" && !c.isEncoding(u))
|
|
855
|
+
throw new TypeError("Unknown encoding: " + u);
|
|
856
|
+
if (t.length === 1) {
|
|
857
|
+
const l = t.charCodeAt(0);
|
|
858
|
+
(u === "utf8" && l < 128 || u === "latin1") && (t = l);
|
|
859
|
+
}
|
|
860
|
+
} else
|
|
861
|
+
typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
|
|
862
|
+
if (e < 0 || this.length < e || this.length < s)
|
|
863
|
+
throw new RangeError("Out of range index");
|
|
864
|
+
if (s <= e)
|
|
865
|
+
return this;
|
|
866
|
+
e = e >>> 0, s = s === void 0 ? this.length : s >>> 0, t || (t = 0);
|
|
867
|
+
let d;
|
|
868
|
+
if (typeof t == "number")
|
|
869
|
+
for (d = e; d < s; ++d)
|
|
870
|
+
this[d] = t;
|
|
871
|
+
else {
|
|
872
|
+
const l = c.isBuffer(t) ? t : c.from(t, u), g = l.length;
|
|
873
|
+
if (g === 0)
|
|
874
|
+
throw new TypeError('The value "' + t + '" is invalid for argument "value"');
|
|
875
|
+
for (d = 0; d < s - e; ++d)
|
|
876
|
+
this[d + e] = l[d % g];
|
|
877
|
+
}
|
|
878
|
+
return this;
|
|
879
|
+
};
|
|
880
|
+
const Y = {};
|
|
881
|
+
function mt(i, t, e) {
|
|
882
|
+
Y[i] = class extends e {
|
|
883
|
+
constructor() {
|
|
884
|
+
super(), Object.defineProperty(this, "message", {
|
|
885
|
+
value: t.apply(this, arguments),
|
|
886
|
+
writable: !0,
|
|
887
|
+
configurable: !0
|
|
888
|
+
}), this.name = `${this.name} [${i}]`, this.stack, delete this.name;
|
|
889
|
+
}
|
|
890
|
+
get code() {
|
|
891
|
+
return i;
|
|
892
|
+
}
|
|
893
|
+
set code(u) {
|
|
894
|
+
Object.defineProperty(this, "code", {
|
|
895
|
+
configurable: !0,
|
|
896
|
+
enumerable: !0,
|
|
897
|
+
value: u,
|
|
898
|
+
writable: !0
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
toString() {
|
|
902
|
+
return `${this.name} [${i}]: ${this.message}`;
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
mt(
|
|
907
|
+
"ERR_BUFFER_OUT_OF_BOUNDS",
|
|
908
|
+
function(i) {
|
|
909
|
+
return i ? `${i} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
|
|
910
|
+
},
|
|
911
|
+
RangeError
|
|
912
|
+
), mt(
|
|
913
|
+
"ERR_INVALID_ARG_TYPE",
|
|
914
|
+
function(i, t) {
|
|
915
|
+
return `The "${i}" argument must be of type number. Received type ${typeof t}`;
|
|
916
|
+
},
|
|
917
|
+
TypeError
|
|
918
|
+
), mt(
|
|
919
|
+
"ERR_OUT_OF_RANGE",
|
|
920
|
+
function(i, t, e) {
|
|
921
|
+
let s = `The value of "${i}" is out of range.`, u = e;
|
|
922
|
+
return Number.isInteger(e) && Math.abs(e) > 2 ** 32 ? u = vt(String(e)) : typeof e == "bigint" && (u = String(e), (e > BigInt(2) ** BigInt(32) || e < -(BigInt(2) ** BigInt(32))) && (u = vt(u)), u += "n"), s += ` It must be ${t}. Received ${u}`, s;
|
|
923
|
+
},
|
|
924
|
+
RangeError
|
|
925
|
+
);
|
|
926
|
+
function vt(i) {
|
|
927
|
+
let t = "", e = i.length;
|
|
928
|
+
const s = i[0] === "-" ? 1 : 0;
|
|
929
|
+
for (; e >= s + 4; e -= 3)
|
|
930
|
+
t = `_${i.slice(e - 3, e)}${t}`;
|
|
931
|
+
return `${i.slice(0, e)}${t}`;
|
|
932
|
+
}
|
|
933
|
+
function fe(i, t, e) {
|
|
934
|
+
X(t, "offset"), (i[t] === void 0 || i[t + e] === void 0) && nt(t, i.length - (e + 1));
|
|
935
|
+
}
|
|
936
|
+
function Dt(i, t, e, s, u, d) {
|
|
937
|
+
if (i > e || i < t) {
|
|
938
|
+
const l = typeof t == "bigint" ? "n" : "";
|
|
939
|
+
let g;
|
|
940
|
+
throw d > 3 ? t === 0 || t === BigInt(0) ? g = `>= 0${l} and < 2${l} ** ${(d + 1) * 8}${l}` : g = `>= -(2${l} ** ${(d + 1) * 8 - 1}${l}) and < 2 ** ${(d + 1) * 8 - 1}${l}` : g = `>= ${t}${l} and <= ${e}${l}`, new Y.ERR_OUT_OF_RANGE("value", g, i);
|
|
941
|
+
}
|
|
942
|
+
fe(s, u, d);
|
|
943
|
+
}
|
|
944
|
+
function X(i, t) {
|
|
945
|
+
if (typeof i != "number")
|
|
946
|
+
throw new Y.ERR_INVALID_ARG_TYPE(t, "number", i);
|
|
947
|
+
}
|
|
948
|
+
function nt(i, t, e) {
|
|
949
|
+
throw Math.floor(i) !== i ? (X(i, e), new Y.ERR_OUT_OF_RANGE(e || "offset", "an integer", i)) : t < 0 ? new Y.ERR_BUFFER_OUT_OF_BOUNDS() : new Y.ERR_OUT_OF_RANGE(
|
|
950
|
+
e || "offset",
|
|
951
|
+
`>= ${e ? 1 : 0} and <= ${t}`,
|
|
952
|
+
i
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
const pe = /[^+/0-9A-Za-z-_]/g;
|
|
956
|
+
function ge(i) {
|
|
957
|
+
if (i = i.split("=")[0], i = i.trim().replace(pe, ""), i.length < 2)
|
|
958
|
+
return "";
|
|
959
|
+
for (; i.length % 4 !== 0; )
|
|
960
|
+
i = i + "=";
|
|
961
|
+
return i;
|
|
962
|
+
}
|
|
963
|
+
function yt(i, t) {
|
|
964
|
+
t = t || 1 / 0;
|
|
965
|
+
let e;
|
|
966
|
+
const s = i.length;
|
|
967
|
+
let u = null;
|
|
968
|
+
const d = [];
|
|
969
|
+
for (let l = 0; l < s; ++l) {
|
|
970
|
+
if (e = i.charCodeAt(l), e > 55295 && e < 57344) {
|
|
971
|
+
if (!u) {
|
|
972
|
+
if (e > 56319) {
|
|
973
|
+
(t -= 3) > -1 && d.push(239, 191, 189);
|
|
974
|
+
continue;
|
|
975
|
+
} else if (l + 1 === s) {
|
|
976
|
+
(t -= 3) > -1 && d.push(239, 191, 189);
|
|
977
|
+
continue;
|
|
978
|
+
}
|
|
979
|
+
u = e;
|
|
980
|
+
continue;
|
|
981
|
+
}
|
|
982
|
+
if (e < 56320) {
|
|
983
|
+
(t -= 3) > -1 && d.push(239, 191, 189), u = e;
|
|
984
|
+
continue;
|
|
985
|
+
}
|
|
986
|
+
e = (u - 55296 << 10 | e - 56320) + 65536;
|
|
987
|
+
} else
|
|
988
|
+
u && (t -= 3) > -1 && d.push(239, 191, 189);
|
|
989
|
+
if (u = null, e < 128) {
|
|
990
|
+
if ((t -= 1) < 0)
|
|
991
|
+
break;
|
|
992
|
+
d.push(e);
|
|
993
|
+
} else if (e < 2048) {
|
|
994
|
+
if ((t -= 2) < 0)
|
|
995
|
+
break;
|
|
996
|
+
d.push(
|
|
997
|
+
e >> 6 | 192,
|
|
998
|
+
e & 63 | 128
|
|
999
|
+
);
|
|
1000
|
+
} else if (e < 65536) {
|
|
1001
|
+
if ((t -= 3) < 0)
|
|
1002
|
+
break;
|
|
1003
|
+
d.push(
|
|
1004
|
+
e >> 12 | 224,
|
|
1005
|
+
e >> 6 & 63 | 128,
|
|
1006
|
+
e & 63 | 128
|
|
1007
|
+
);
|
|
1008
|
+
} else if (e < 1114112) {
|
|
1009
|
+
if ((t -= 4) < 0)
|
|
1010
|
+
break;
|
|
1011
|
+
d.push(
|
|
1012
|
+
e >> 18 | 240,
|
|
1013
|
+
e >> 12 & 63 | 128,
|
|
1014
|
+
e >> 6 & 63 | 128,
|
|
1015
|
+
e & 63 | 128
|
|
1016
|
+
);
|
|
1017
|
+
} else
|
|
1018
|
+
throw new Error("Invalid code point");
|
|
1019
|
+
}
|
|
1020
|
+
return d;
|
|
1021
|
+
}
|
|
1022
|
+
function me(i) {
|
|
1023
|
+
const t = [];
|
|
1024
|
+
for (let e = 0; e < i.length; ++e)
|
|
1025
|
+
t.push(i.charCodeAt(e) & 255);
|
|
1026
|
+
return t;
|
|
1027
|
+
}
|
|
1028
|
+
function ye(i, t) {
|
|
1029
|
+
let e, s, u;
|
|
1030
|
+
const d = [];
|
|
1031
|
+
for (let l = 0; l < i.length && !((t -= 2) < 0); ++l)
|
|
1032
|
+
e = i.charCodeAt(l), s = e >> 8, u = e % 256, d.push(u), d.push(s);
|
|
1033
|
+
return d;
|
|
1034
|
+
}
|
|
1035
|
+
function Vt(i) {
|
|
1036
|
+
return r.toByteArray(ge(i));
|
|
1037
|
+
}
|
|
1038
|
+
function at(i, t, e, s) {
|
|
1039
|
+
let u;
|
|
1040
|
+
for (u = 0; u < s && !(u + e >= t.length || u >= i.length); ++u)
|
|
1041
|
+
t[u + e] = i[u];
|
|
1042
|
+
return u;
|
|
1043
|
+
}
|
|
1044
|
+
function L(i, t) {
|
|
1045
|
+
return i instanceof t || i != null && i.constructor != null && i.constructor.name != null && i.constructor.name === t.name;
|
|
1046
|
+
}
|
|
1047
|
+
function wt(i) {
|
|
1048
|
+
return i !== i;
|
|
1049
|
+
}
|
|
1050
|
+
const we = function() {
|
|
1051
|
+
const i = "0123456789abcdef", t = new Array(256);
|
|
1052
|
+
for (let e = 0; e < 16; ++e) {
|
|
1053
|
+
const s = e * 16;
|
|
1054
|
+
for (let u = 0; u < 16; ++u)
|
|
1055
|
+
t[s + u] = i[e] + i[u];
|
|
1056
|
+
}
|
|
1057
|
+
return t;
|
|
1058
|
+
}();
|
|
1059
|
+
function G(i) {
|
|
1060
|
+
return typeof BigInt > "u" ? Se : i;
|
|
1061
|
+
}
|
|
1062
|
+
function Se() {
|
|
1063
|
+
throw new Error("BigInt not supported");
|
|
1064
|
+
}
|
|
1065
|
+
})(Gt);
|
|
1066
|
+
var zt = { exports: {} }, x = zt.exports = {}, $, v;
|
|
1067
|
+
function It() {
|
|
1068
|
+
throw new Error("setTimeout has not been defined");
|
|
1069
|
+
}
|
|
1070
|
+
function Et() {
|
|
1071
|
+
throw new Error("clearTimeout has not been defined");
|
|
1072
|
+
}
|
|
1073
|
+
(function() {
|
|
1074
|
+
try {
|
|
1075
|
+
typeof setTimeout == "function" ? $ = setTimeout : $ = It;
|
|
1076
|
+
} catch {
|
|
1077
|
+
$ = It;
|
|
1078
|
+
}
|
|
1079
|
+
try {
|
|
1080
|
+
typeof clearTimeout == "function" ? v = clearTimeout : v = Et;
|
|
1081
|
+
} catch {
|
|
1082
|
+
v = Et;
|
|
1083
|
+
}
|
|
1084
|
+
})();
|
|
1085
|
+
function Ht(n) {
|
|
1086
|
+
if ($ === setTimeout)
|
|
1087
|
+
return setTimeout(n, 0);
|
|
1088
|
+
if (($ === It || !$) && setTimeout)
|
|
1089
|
+
return $ = setTimeout, setTimeout(n, 0);
|
|
1090
|
+
try {
|
|
1091
|
+
return $(n, 0);
|
|
1092
|
+
} catch {
|
|
1093
|
+
try {
|
|
1094
|
+
return $.call(null, n, 0);
|
|
1095
|
+
} catch {
|
|
1096
|
+
return $.call(this, n, 0);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
function De(n) {
|
|
1101
|
+
if (v === clearTimeout)
|
|
1102
|
+
return clearTimeout(n);
|
|
1103
|
+
if ((v === Et || !v) && clearTimeout)
|
|
1104
|
+
return v = clearTimeout, clearTimeout(n);
|
|
1105
|
+
try {
|
|
1106
|
+
return v(n);
|
|
1107
|
+
} catch {
|
|
1108
|
+
try {
|
|
1109
|
+
return v.call(null, n);
|
|
1110
|
+
} catch {
|
|
1111
|
+
return v.call(this, n);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
var M = [], tt = !1, j, ut = -1;
|
|
1116
|
+
function Ve() {
|
|
1117
|
+
!tt || !j || (tt = !1, j.length ? M = j.concat(M) : ut = -1, M.length && jt());
|
|
1118
|
+
}
|
|
1119
|
+
function jt() {
|
|
1120
|
+
if (!tt) {
|
|
1121
|
+
var n = Ht(Ve);
|
|
1122
|
+
tt = !0;
|
|
1123
|
+
for (var r = M.length; r; ) {
|
|
1124
|
+
for (j = M, M = []; ++ut < r; )
|
|
1125
|
+
j && j[ut].run();
|
|
1126
|
+
ut = -1, r = M.length;
|
|
1127
|
+
}
|
|
1128
|
+
j = null, tt = !1, De(n);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
x.nextTick = function(n) {
|
|
1132
|
+
var r = new Array(arguments.length - 1);
|
|
1133
|
+
if (arguments.length > 1)
|
|
1134
|
+
for (var o = 1; o < arguments.length; o++)
|
|
1135
|
+
r[o - 1] = arguments[o];
|
|
1136
|
+
M.push(new Wt(n, r)), M.length === 1 && !tt && Ht(jt);
|
|
1137
|
+
};
|
|
1138
|
+
function Wt(n, r) {
|
|
1139
|
+
this.fun = n, this.array = r;
|
|
1140
|
+
}
|
|
1141
|
+
Wt.prototype.run = function() {
|
|
1142
|
+
this.fun.apply(null, this.array);
|
|
1143
|
+
};
|
|
1144
|
+
x.title = "browser";
|
|
1145
|
+
x.browser = !0;
|
|
1146
|
+
x.env = {};
|
|
1147
|
+
x.argv = [];
|
|
1148
|
+
x.version = "";
|
|
1149
|
+
x.versions = {};
|
|
1150
|
+
function P() {
|
|
1151
|
+
}
|
|
1152
|
+
x.on = P;
|
|
1153
|
+
x.addListener = P;
|
|
1154
|
+
x.once = P;
|
|
1155
|
+
x.off = P;
|
|
1156
|
+
x.removeListener = P;
|
|
1157
|
+
x.removeAllListeners = P;
|
|
1158
|
+
x.emit = P;
|
|
1159
|
+
x.prependListener = P;
|
|
1160
|
+
x.prependOnceListener = P;
|
|
1161
|
+
x.listeners = function(n) {
|
|
1162
|
+
return [];
|
|
1163
|
+
};
|
|
1164
|
+
x.binding = function(n) {
|
|
1165
|
+
throw new Error("process.binding is not supported");
|
|
1166
|
+
};
|
|
1167
|
+
x.cwd = function() {
|
|
1168
|
+
return "/";
|
|
1169
|
+
};
|
|
1170
|
+
x.chdir = function(n) {
|
|
1171
|
+
throw new Error("process.chdir is not supported");
|
|
1172
|
+
};
|
|
1173
|
+
x.umask = function() {
|
|
1174
|
+
return 0;
|
|
1175
|
+
};
|
|
1176
|
+
var qe = zt.exports;
|
|
1177
|
+
(function(n) {
|
|
1178
|
+
Object.defineProperty(n, Symbol.toStringTag, { value: "Module" });
|
|
1179
|
+
const r = Gt, o = qe, a = (p) => p && p.__esModule ? p : { default: p }, h = a(o), f = globalThis || void 0 || self;
|
|
1180
|
+
Object.defineProperty(n, "Buffer", { enumerable: !0, get: () => r.Buffer }), Object.defineProperty(n, "process", { enumerable: !0, get: () => h.default }), n.global = f;
|
|
1181
|
+
})(Pt);
|
|
1182
|
+
class Qe {
|
|
1183
|
+
}
|
|
1184
|
+
window.slStore = /* @__PURE__ */ Object.create(null);
|
|
1185
|
+
class pt {
|
|
1186
|
+
/**
|
|
1187
|
+
* store instance (nanostores)
|
|
1188
|
+
*/
|
|
1189
|
+
store;
|
|
1190
|
+
name;
|
|
1191
|
+
constructor(r, o) {
|
|
1192
|
+
this.store = r, this.name = o;
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* return store instance
|
|
1196
|
+
*/
|
|
1197
|
+
getStore() {
|
|
1198
|
+
return this.store;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
const Me = (n) => {
|
|
1202
|
+
const r = Object.keys(n);
|
|
1203
|
+
return Qt(r.map((o) => n[o].getStore()), (...o) => Object.fromEntries(r.map((a, h) => [a, o[h]])));
|
|
1204
|
+
};
|
|
1205
|
+
class st extends pt {
|
|
1206
|
+
getValues = () => this.getStore().get();
|
|
1207
|
+
getValue = (r) => this.getStore().get()[r];
|
|
1208
|
+
setValue = (r, o) => this.getStore().setKey(r, o);
|
|
1209
|
+
subscribe = (...r) => this.getStore().subscribe(...r);
|
|
1210
|
+
unsubscribe = () => this.getStore().off();
|
|
1211
|
+
}
|
|
1212
|
+
const ot = (n) => be(n);
|
|
1213
|
+
var Q;
|
|
1214
|
+
(function(n) {
|
|
1215
|
+
n.ORGANIZATION = "ORGANIZATION", n.STREAM = "STREAM";
|
|
1216
|
+
})(Q || (Q = {}));
|
|
1217
|
+
const Pe = {
|
|
1218
|
+
[V.BETTING]: "betting",
|
|
1219
|
+
[V.GAMES]: "games",
|
|
1220
|
+
[V.PUBLIC_CHAT]: "publicChat",
|
|
1221
|
+
[V.TWITTER]: "twitter"
|
|
1222
|
+
};
|
|
1223
|
+
var W;
|
|
1224
|
+
(function(n) {
|
|
1225
|
+
n.Ready = "ready", n.Suspended = "suspended";
|
|
1226
|
+
})(W || (W = {}));
|
|
1227
|
+
class Bt {
|
|
1228
|
+
status;
|
|
1229
|
+
source;
|
|
1230
|
+
config;
|
|
1231
|
+
settings;
|
|
1232
|
+
listeners = /* @__PURE__ */ new Set();
|
|
1233
|
+
settingsKey;
|
|
1234
|
+
constructor({ settings: r, ...o }, a) {
|
|
1235
|
+
this.settingsKey = Pe[o.type], this.status = dt(W.Suspended), this.config = new st(ot(o), `feature:config:${this.settingsKey}`), this.settingsKey !== void 0 && r?.overlaySettings.case === this.settingsKey ? this.settings = new st(ot(r.overlaySettings.value), `feature:settings:${this.settingsKey}`) : this.settings = new st(ot({}), `feature:settings:${this.settingsKey}`), this.source = a;
|
|
1236
|
+
}
|
|
1237
|
+
get featureConfig() {
|
|
1238
|
+
return this.config.getStore();
|
|
1239
|
+
}
|
|
1240
|
+
get featureSettings() {
|
|
1241
|
+
return this.settings.getStore();
|
|
1242
|
+
}
|
|
1243
|
+
registerEventListener(r) {
|
|
1244
|
+
this.listeners.add(r);
|
|
1245
|
+
}
|
|
1246
|
+
enable = () => {
|
|
1247
|
+
this.status.set(W.Ready);
|
|
1248
|
+
};
|
|
1249
|
+
disable = () => {
|
|
1250
|
+
this.status.set(W.Suspended);
|
|
1251
|
+
};
|
|
1252
|
+
setFeatureConfig = ({ settings: r, ...o }) => {
|
|
1253
|
+
let a;
|
|
1254
|
+
for (a in o)
|
|
1255
|
+
this.config.setValue(a, o[a]);
|
|
1256
|
+
if (r?.overlaySettings.case === this.settingsKey) {
|
|
1257
|
+
const h = r.overlaySettings.value;
|
|
1258
|
+
if (h !== void 0) {
|
|
1259
|
+
let f;
|
|
1260
|
+
for (f in h)
|
|
1261
|
+
console.log(f, h[f]), h[f] !== 0 && h[f] !== "" && this.settings.setValue(f, h[f]);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
update = (r, o) => {
|
|
1266
|
+
this.source === Q.STREAM && o === Q.ORGANIZATION || (this.setFeatureConfig(r), this.source = o);
|
|
1267
|
+
};
|
|
1268
|
+
fireEvent(r) {
|
|
1269
|
+
for (const o of this.listeners.values())
|
|
1270
|
+
try {
|
|
1271
|
+
o.onEvent(r);
|
|
1272
|
+
} catch (a) {
|
|
1273
|
+
console.error(a);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
class N extends pt {
|
|
1278
|
+
getValue = () => this.getStore().get();
|
|
1279
|
+
getValues() {
|
|
1280
|
+
throw new Error("not implemented");
|
|
1281
|
+
}
|
|
1282
|
+
setValue = (r) => this.getStore().set(r);
|
|
1283
|
+
subscribe = (r) => this.getStore().subscribe(r);
|
|
1284
|
+
unsubscribe = () => this.getStore().off();
|
|
1285
|
+
listen(r) {
|
|
1286
|
+
return this.getStore().listen(r);
|
|
1287
|
+
}
|
|
1288
|
+
get() {
|
|
1289
|
+
return this.getStore().get();
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
const _ = (n) => dt(n), At = (n, r) => Qt(n, r);
|
|
1293
|
+
class U extends pt {
|
|
1294
|
+
atomStore;
|
|
1295
|
+
constructor(r, o, a) {
|
|
1296
|
+
super(r, `api:${o}`), this.atomStore = dt(), a && r.subscribe((h) => {
|
|
1297
|
+
this.atomStore.set(a(h));
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
getAtomStore = () => this.atomStore;
|
|
1301
|
+
getValue = async () => {
|
|
1302
|
+
const r = this.getStore();
|
|
1303
|
+
if (r.value === void 0)
|
|
1304
|
+
throw new Error("no store");
|
|
1305
|
+
return await r.value.promise, r.get().data;
|
|
1306
|
+
};
|
|
1307
|
+
getValues = () => {
|
|
1308
|
+
throw new Error("not implemented");
|
|
1309
|
+
};
|
|
1310
|
+
setValue = (r) => this.getStore().set({ loading: !1, data: r?.data });
|
|
1311
|
+
subscribe = (r) => this.getStore().subscribe(r);
|
|
1312
|
+
unsubscribe = () => {
|
|
1313
|
+
throw new Error("not implemented");
|
|
1314
|
+
};
|
|
1315
|
+
invalidate = () => {
|
|
1316
|
+
this.store.invalidate();
|
|
1317
|
+
};
|
|
1318
|
+
listen = (r) => this.getStore().listen(r);
|
|
1319
|
+
get() {
|
|
1320
|
+
throw new Error("not implemented");
|
|
1321
|
+
}
|
|
1322
|
+
key = () => this.getStore().key;
|
|
1323
|
+
off = () => this.getStore().off();
|
|
1324
|
+
}
|
|
1325
|
+
async function* Ge(n, r) {
|
|
1326
|
+
for await (const o of r) {
|
|
1327
|
+
n.response.message = o, n.received_at = Date.now();
|
|
1328
|
+
const a = {
|
|
1329
|
+
type: "__GRPC_DEVTOOLS_EXTENSION__",
|
|
1330
|
+
data: n
|
|
1331
|
+
};
|
|
1332
|
+
window.postMessage(a), yield o;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
const Ke = () => (n) => async (r) => {
|
|
1336
|
+
const o = {
|
|
1337
|
+
name: r.url,
|
|
1338
|
+
request: {},
|
|
1339
|
+
response: {}
|
|
1340
|
+
};
|
|
1341
|
+
o.request.header = Object.fromEntries(r.header.entries()), o.sent_at = Date.now();
|
|
1342
|
+
try {
|
|
1343
|
+
const a = await n(r);
|
|
1344
|
+
if (o.received_at = Date.now(), o.stream = a.stream, o.response.header = Object.fromEntries(a.header.entries()), o.response.trailer = Object.fromEntries(a.trailer.entries()), a.stream)
|
|
1345
|
+
return {
|
|
1346
|
+
...a,
|
|
1347
|
+
message: Ge(o, a.message)
|
|
1348
|
+
};
|
|
1349
|
+
{
|
|
1350
|
+
o.request.message = r.message, o.response.message = a.message, o.latency = o.received_at - o.sent_at;
|
|
1351
|
+
const h = {
|
|
1352
|
+
type: "__GRPC_DEVTOOLS_EXTENSION__",
|
|
1353
|
+
data: o
|
|
1354
|
+
};
|
|
1355
|
+
window.postMessage(h);
|
|
1356
|
+
}
|
|
1357
|
+
return a;
|
|
1358
|
+
} catch (a) {
|
|
1359
|
+
o.received_at = Date.now(), o.request.message = r.message, o.response.trailer = {
|
|
1360
|
+
"grpc-status": a.code,
|
|
1361
|
+
"grpc-message": a.rawMessage
|
|
1362
|
+
}, o.response.message = a.rawMessage, o.latency = o.received_at - o.sent_at;
|
|
1363
|
+
const h = {
|
|
1364
|
+
type: "__GRPC_DEVTOOLS_EXTENSION__",
|
|
1365
|
+
data: o
|
|
1366
|
+
};
|
|
1367
|
+
throw window.postMessage(h), a;
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
window.dispatchEvent(new CustomEvent("grpc_devtools_loaded"));
|
|
1371
|
+
var q;
|
|
1372
|
+
(function(n) {
|
|
1373
|
+
n.Init = "init", n.Ready = "ready", n.Connecting = "connecting", n.Connected = "connected", n.Disconnected = "disconnected", n.Failed = "failed", n.Reconnecting = "reconnecting";
|
|
1374
|
+
})(q || (q = {}));
|
|
1375
|
+
class ze {
|
|
1376
|
+
params;
|
|
1377
|
+
stream;
|
|
1378
|
+
method;
|
|
1379
|
+
name;
|
|
1380
|
+
headers;
|
|
1381
|
+
listeners;
|
|
1382
|
+
state;
|
|
1383
|
+
store;
|
|
1384
|
+
constructor(r, o, a, h) {
|
|
1385
|
+
const f = {
|
|
1386
|
+
status: q.Init,
|
|
1387
|
+
ts: /* @__PURE__ */ new Date(),
|
|
1388
|
+
log: []
|
|
1389
|
+
};
|
|
1390
|
+
this.state = new st(ot(f), `subscription:${h.name}:state`), this.name = h.name, this.headers = r, this.listeners = /* @__PURE__ */ new Map(), this.params = a, this.method = o, h.withStore && (this.store = new N(_(null), `subscription:${h.name}:store`)), "subscribe" in a && typeof a.subscribe == "function" && a.subscribe(() => {
|
|
1391
|
+
this.reconnect();
|
|
1392
|
+
}), this.updateState(q.Ready);
|
|
1393
|
+
}
|
|
1394
|
+
updateState = (r) => {
|
|
1395
|
+
this.state.setValue("status", r), this.state.setValue("ts", /* @__PURE__ */ new Date()), this.addStateLog(`status => ${r}`);
|
|
1396
|
+
};
|
|
1397
|
+
addStateLog = (r) => {
|
|
1398
|
+
const o = this.state.getStore().get().log;
|
|
1399
|
+
this.state.setValue("log", [...o, `${(/* @__PURE__ */ new Date()).toLocaleString()}: ${r}`]);
|
|
1400
|
+
};
|
|
1401
|
+
addListener = (r, o) => this.listeners.has(r) ? (this.addStateLog(`listener '${r}' not added`), !1) : (this.listeners.set(r, o), this.addStateLog(`listener '${r}' added`), !0);
|
|
1402
|
+
removeListener = (r) => {
|
|
1403
|
+
this.listeners.delete(r), this.addStateLog(`listener '${r}' removed`);
|
|
1404
|
+
};
|
|
1405
|
+
connect = () => {
|
|
1406
|
+
this.updateState(q.Connecting), this.stream && (this.addStateLog("disconnect prev connection"), this.stream());
|
|
1407
|
+
const r = "get" in this.params && typeof this.params.get == "function" ? this.params.get() : this.params;
|
|
1408
|
+
this.stream = this.method(
|
|
1409
|
+
r,
|
|
1410
|
+
// ToDo: fix types
|
|
1411
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1412
|
+
// @ts-ignore
|
|
1413
|
+
this.onData,
|
|
1414
|
+
this.onStreamError,
|
|
1415
|
+
{ headers: this.headers.getValues() }
|
|
1416
|
+
), this.updateState(q.Connected);
|
|
1417
|
+
};
|
|
1418
|
+
disconnect = () => {
|
|
1419
|
+
this.stream && this.stream(), this.listeners.clear(), this.updateState(q.Disconnected);
|
|
1420
|
+
};
|
|
1421
|
+
reconnect = () => {
|
|
1422
|
+
this.updateState(q.Reconnecting), this.connect();
|
|
1423
|
+
};
|
|
1424
|
+
getStore = () => this.store?.getStore();
|
|
1425
|
+
onData = (r) => {
|
|
1426
|
+
this.addStateLog(`received data => ${JSON.stringify(r)}`), this.store && this.store.setValue(r);
|
|
1427
|
+
for (const [, o] of this.listeners)
|
|
1428
|
+
o(r);
|
|
1429
|
+
this.addStateLog(`data routed to ${this.listeners.size} listeners`);
|
|
1430
|
+
};
|
|
1431
|
+
onStreamError = (r) => {
|
|
1432
|
+
r !== void 0 && (r.code !== Ie.Canceled && r.rawMessage !== "[canceled] BodyStreamBuffer was aborted" ? (this.updateState(q.Failed), this.state.setValue("error", r)) : this.disconnect());
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
class He {
|
|
1436
|
+
toJsonOptions = {
|
|
1437
|
+
emitDefaultValues: !1,
|
|
1438
|
+
enumAsInteger: !0,
|
|
1439
|
+
useProtoFieldName: !1
|
|
1440
|
+
};
|
|
1441
|
+
transport;
|
|
1442
|
+
nanoquery;
|
|
1443
|
+
host;
|
|
1444
|
+
interceptors = [];
|
|
1445
|
+
$headers;
|
|
1446
|
+
clients;
|
|
1447
|
+
callbackClients;
|
|
1448
|
+
subscriptions;
|
|
1449
|
+
constructor(r) {
|
|
1450
|
+
this.host = r, this.$headers = new st(ot({
|
|
1451
|
+
"sl-device-id": Pt.process?.env?.NX_DEVICE_ID || "sdk-web-dev"
|
|
1452
|
+
}), "transport:headers"), this.initInterceptors(), this.clients = /* @__PURE__ */ new Map(), this.callbackClients = /* @__PURE__ */ new Map(), this.subscriptions = /* @__PURE__ */ new Map();
|
|
1453
|
+
const [o, a, h] = Ae();
|
|
1454
|
+
this.nanoquery = { createFetcherStore: o, createMutatorStore: a, utils: h }, this.transport = Be({
|
|
1455
|
+
baseUrl: r,
|
|
1456
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1457
|
+
// @ts-ignore
|
|
1458
|
+
interceptors: this.interceptors,
|
|
1459
|
+
useBinaryFormat: !0
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
// use shared request params, based on Atom, each new Atom will create new subscription
|
|
1463
|
+
// mutate Atom, subscription automatically reconnect with new params
|
|
1464
|
+
// if headers changed, reconnect subscription with new headers automatically
|
|
1465
|
+
addSubscription = (r, o, a) => {
|
|
1466
|
+
const h = this.subscriptions.get(o);
|
|
1467
|
+
if (h)
|
|
1468
|
+
return h;
|
|
1469
|
+
const f = new ze(this.$headers, r, o, a);
|
|
1470
|
+
return this.subscriptions.set(o, f), f;
|
|
1471
|
+
};
|
|
1472
|
+
removeSubscription = (r) => {
|
|
1473
|
+
r.disconnect(), this.subscriptions.delete(r.params);
|
|
1474
|
+
};
|
|
1475
|
+
// cleanup subscriptions
|
|
1476
|
+
disconnect = () => {
|
|
1477
|
+
for (const [r, o] of this.subscriptions)
|
|
1478
|
+
o.disconnect(), this.subscriptions.delete(r);
|
|
1479
|
+
};
|
|
1480
|
+
registerInterceptor = (r) => {
|
|
1481
|
+
this.interceptors.push(r);
|
|
1482
|
+
};
|
|
1483
|
+
removeInterceptor = (r) => {
|
|
1484
|
+
this.interceptors = this.interceptors.filter((o) => o !== r);
|
|
1485
|
+
};
|
|
1486
|
+
getClient = (r) => {
|
|
1487
|
+
const o = r.typeName;
|
|
1488
|
+
if (this.clients.has(o))
|
|
1489
|
+
return this.clients.get(o);
|
|
1490
|
+
const a = Ee(r, this.transport);
|
|
1491
|
+
return this.clients.set(o, a), a;
|
|
1492
|
+
};
|
|
1493
|
+
getCallbackClient = (r) => {
|
|
1494
|
+
const o = r.typeName;
|
|
1495
|
+
if (this.callbackClients.has(o))
|
|
1496
|
+
return this.callbackClients.get(o);
|
|
1497
|
+
const a = xe(r, this.transport);
|
|
1498
|
+
return this.callbackClients.set(o, a), a;
|
|
1499
|
+
};
|
|
1500
|
+
// create unary client, used for query request
|
|
1501
|
+
createPromiseClient = (r, { params: o = [], method: a }) => {
|
|
1502
|
+
const h = this.getClient(r), f = r.methods[a].name, p = [
|
|
1503
|
+
r.typeName,
|
|
1504
|
+
f.charAt(0).toLowerCase() + f.slice(1),
|
|
1505
|
+
...Array.isArray(o) ? o : [o]
|
|
1506
|
+
], c = [r.typeName, f.charAt(0).toLowerCase() + f.slice(1)];
|
|
1507
|
+
return { client: h, queryKey: p, queryKeyStr: c.join("") };
|
|
1508
|
+
};
|
|
1509
|
+
// create callback client, used for server stream subscriptions
|
|
1510
|
+
createCallbackClient = (r) => ({ client: this.getCallbackClient(r) });
|
|
1511
|
+
setSdkKey = (r) => {
|
|
1512
|
+
this.$headers.setValue("sdk", r);
|
|
1513
|
+
};
|
|
1514
|
+
setAuth = (r) => {
|
|
1515
|
+
this.$headers.setValue("authorization", r);
|
|
1516
|
+
};
|
|
1517
|
+
setHeader = (r, o) => this.$headers.setValue(r, o);
|
|
1518
|
+
getHeader = (r) => this.$headers.getValue(r);
|
|
1519
|
+
getHeaders = () => this.$headers.getValues();
|
|
1520
|
+
initInterceptors = () => {
|
|
1521
|
+
if (this.interceptors.length !== 0)
|
|
1522
|
+
return;
|
|
1523
|
+
const r = (o) => (a) => {
|
|
1524
|
+
const h = this.$headers.getValues();
|
|
1525
|
+
for (const f in h)
|
|
1526
|
+
a.header.set(f, h[f]);
|
|
1527
|
+
return o(a);
|
|
1528
|
+
};
|
|
1529
|
+
this.interceptors.push(r), this.interceptors.push(Ke());
|
|
1530
|
+
};
|
|
1531
|
+
}
|
|
1532
|
+
const je = (n, r) => {
|
|
1533
|
+
const { client: o, queryKey: a } = r.createPromiseClient(Fe, {
|
|
1534
|
+
method: "retrieveEventId",
|
|
1535
|
+
params: [n]
|
|
1536
|
+
});
|
|
1537
|
+
return r.nanoquery.createFetcherStore(a, {
|
|
1538
|
+
fetcher: async (h, f, p) => {
|
|
1539
|
+
if (!p || typeof p != "string")
|
|
1540
|
+
return "";
|
|
1541
|
+
try {
|
|
1542
|
+
return (await o.retrieveEventId({
|
|
1543
|
+
id: p
|
|
1544
|
+
})).data?.id || "";
|
|
1545
|
+
} catch {
|
|
1546
|
+
return "";
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
});
|
|
1550
|
+
}, We = (n, r) => {
|
|
1551
|
+
const { client: o, queryKey: a } = r.createPromiseClient(lt, { method: "getStream", params: [n] });
|
|
1552
|
+
return r.nanoquery.createFetcherStore(a, {
|
|
1553
|
+
fetcher: async (h, f, p) => p ? (await o.getStream({
|
|
1554
|
+
id: p
|
|
1555
|
+
// we are sure that id is a string
|
|
1556
|
+
})).data?.attributes : void 0
|
|
1557
|
+
});
|
|
1558
|
+
}, Ye = (n, r) => {
|
|
1559
|
+
const { queryKey: o, client: a } = r.createPromiseClient(Mt, { method: "me", params: [n] });
|
|
1560
|
+
return r.nanoquery.createFetcherStore(o, {
|
|
1561
|
+
fetcher: () => a.me({})
|
|
1562
|
+
});
|
|
1563
|
+
}, Xe = (n) => {
|
|
1564
|
+
const { client: r, queryKeyStr: o } = n.createPromiseClient(Mt, { method: "bypassAuth" });
|
|
1565
|
+
return n.nanoquery.createMutatorStore(async ({ data: { userKey: a, schema: h, init: f }, getCacheUpdater: p }) => {
|
|
1566
|
+
const [c] = p(o), m = await r.bypassAuth({ userKey: a, schema: h, init: f });
|
|
1567
|
+
return c(m), m;
|
|
1568
|
+
});
|
|
1569
|
+
}, Ze = (n, r) => {
|
|
1570
|
+
const { client: o, queryKey: a } = r.createPromiseClient(lt, { method: "get", params: [n] });
|
|
1571
|
+
return r.nanoquery.createFetcherStore(a, {
|
|
1572
|
+
fetcher: async () => (await o.get({})).data?.attributes
|
|
1573
|
+
});
|
|
1574
|
+
}, Je = (n, r) => {
|
|
1575
|
+
const { client: o, queryKey: a } = r.createPromiseClient(lt, { method: "getOrganization", params: [n] });
|
|
1576
|
+
return r.nanoquery.createFetcherStore(a, {
|
|
1577
|
+
fetcher: async () => {
|
|
1578
|
+
const h = await o.getOrganization({});
|
|
1579
|
+
return h.data ? {
|
|
1580
|
+
...h.data.attributes,
|
|
1581
|
+
id: h.data.id
|
|
1582
|
+
} : void 0;
|
|
1583
|
+
}
|
|
1584
|
+
});
|
|
1585
|
+
}, tr = (n, r) => {
|
|
1586
|
+
const { client: o, queryKey: a } = r.createPromiseClient(lt, {
|
|
1587
|
+
method: "getOrganizationAdvertising",
|
|
1588
|
+
params: [n]
|
|
1589
|
+
});
|
|
1590
|
+
return r.nanoquery.createFetcherStore(a, {
|
|
1591
|
+
fetcher: async () => (await o.getOrganizationAdvertising({})).data?.attributes
|
|
1592
|
+
});
|
|
1593
|
+
}, er = (n, r, o) => {
|
|
1594
|
+
n.transport = new He(r.host), n.sdk.host = n.transport.host, n.transport.setSdkKey(r.sdkKey), o();
|
|
1595
|
+
};
|
|
1596
|
+
class Ft {
|
|
1597
|
+
delimiter = ":";
|
|
1598
|
+
prefix;
|
|
1599
|
+
constructor(r = "main") {
|
|
1600
|
+
this.prefix = `sl-sdk${this.delimiter}${r}`;
|
|
1601
|
+
}
|
|
1602
|
+
clear = () => {
|
|
1603
|
+
for (const r in window.localStorage)
|
|
1604
|
+
r.startsWith(this.prefix) && window.localStorage.removeItem(r);
|
|
1605
|
+
};
|
|
1606
|
+
generateKey = (r) => `${this.prefix}${this.delimiter}${r.join(this.delimiter)}`;
|
|
1607
|
+
write = (...r) => {
|
|
1608
|
+
const o = r.pop() || "";
|
|
1609
|
+
window.localStorage.setItem(this.generateKey(r), o);
|
|
1610
|
+
};
|
|
1611
|
+
read = (...r) => {
|
|
1612
|
+
const o = window.localStorage.getItem(this.generateKey(r));
|
|
1613
|
+
return o === null ? void 0 : o;
|
|
1614
|
+
};
|
|
1615
|
+
remove = (...r) => {
|
|
1616
|
+
window.localStorage.removeItem(this.generateKey(r));
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
var H;
|
|
1620
|
+
(function(n) {
|
|
1621
|
+
n.SCHEMA = "schema", n.TOKEN = "token";
|
|
1622
|
+
})(H || (H = {}));
|
|
1623
|
+
class Yt extends Ft {
|
|
1624
|
+
constructor() {
|
|
1625
|
+
super("user");
|
|
1626
|
+
}
|
|
1627
|
+
// Schema
|
|
1628
|
+
setSchema = (r) => {
|
|
1629
|
+
this.write(H.SCHEMA, r);
|
|
1630
|
+
};
|
|
1631
|
+
getSchema = () => this.read(H.SCHEMA);
|
|
1632
|
+
// Token
|
|
1633
|
+
setToken = (r) => {
|
|
1634
|
+
this.write(H.TOKEN, r);
|
|
1635
|
+
};
|
|
1636
|
+
getToken = () => this.read(H.TOKEN);
|
|
1637
|
+
removeToken = () => {
|
|
1638
|
+
this.remove(H.TOKEN);
|
|
1639
|
+
};
|
|
1640
|
+
clearNotification = () => {
|
|
1641
|
+
this.clear();
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
var K;
|
|
1645
|
+
(function(n) {
|
|
1646
|
+
n.DISABLED = "disabled", n.INITIALIZATION = "initialization", n.READY = "ready", n.FAILED = "failed", n.SUSPENDED = "suspended";
|
|
1647
|
+
})(K || (K = {}));
|
|
1648
|
+
const rr = (n) => {
|
|
1649
|
+
const r = new N(_(), "enabled"), o = new N(_(K.DISABLED), "status"), a = new N(_(), "userKey"), h = new N(_(), "userToken"), f = new Yt();
|
|
1650
|
+
h.listen((w) => {
|
|
1651
|
+
w ? f.setToken(w) : f.removeToken();
|
|
1652
|
+
});
|
|
1653
|
+
const p = new N(_(), "providerStreamId"), c = new U(je(p.getStore(), n), "slStreamId", (w) => w?.data), m = new U(Ye(h.getStore(), n), "user", (w) => w?.data?.data?.id), F = new U(Ze(h.getStore(), n), "userSettings"), b = new U(We(c.getAtomStore(), n), "streamSettings");
|
|
1654
|
+
c.getAtomStore().listen((w) => {
|
|
1655
|
+
(w === "" || w === void 0) && b.getStore().mutate(void 0);
|
|
1656
|
+
});
|
|
1657
|
+
const B = new U(Je(r.getStore(), n), "organizationSettings", (w) => w?.data?.id), O = new U(tr(B.getAtomStore(), n), "organizationAdvertising");
|
|
1658
|
+
return {
|
|
1659
|
+
enabled: r,
|
|
1660
|
+
status: o,
|
|
1661
|
+
providerStreamId: p,
|
|
1662
|
+
slStreamId: c,
|
|
1663
|
+
streamSettings: b,
|
|
1664
|
+
user: m,
|
|
1665
|
+
userKey: a,
|
|
1666
|
+
userToken: h,
|
|
1667
|
+
userSettings: F,
|
|
1668
|
+
organizationSettings: B,
|
|
1669
|
+
organizationAdvertising: O
|
|
1670
|
+
};
|
|
1671
|
+
};
|
|
1672
|
+
class ir extends pt {
|
|
1673
|
+
stores;
|
|
1674
|
+
constructor(r) {
|
|
1675
|
+
const o = rr(r), a = Me(o);
|
|
1676
|
+
super(a, "core"), this.stores = o;
|
|
1677
|
+
}
|
|
1678
|
+
getValue() {
|
|
1679
|
+
throw new Error("Not implemented");
|
|
1680
|
+
}
|
|
1681
|
+
getValues() {
|
|
1682
|
+
return this.stores;
|
|
1683
|
+
}
|
|
1684
|
+
setValue() {
|
|
1685
|
+
throw new Error("Not implemented");
|
|
1686
|
+
}
|
|
1687
|
+
subscribe = (r) => {
|
|
1688
|
+
let o;
|
|
1689
|
+
for (o in this.stores) {
|
|
1690
|
+
const a = r[o];
|
|
1691
|
+
o in r && a !== void 0 && this.stores[o].subscribe(r[o]);
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
unsubscribe = () => this.getStore().off();
|
|
1695
|
+
}
|
|
1696
|
+
class nr extends Qe {
|
|
1697
|
+
$coreStore;
|
|
1698
|
+
transport;
|
|
1699
|
+
$bypassLogin;
|
|
1700
|
+
constructor(r, o) {
|
|
1701
|
+
super(), this.$coreStore = r, this.transport = o, this.$bypassLogin = Xe(this.transport), this.subscribe();
|
|
1702
|
+
}
|
|
1703
|
+
me = async () => (await this.$coreStore.getValues().user.getValue())?.data;
|
|
1704
|
+
login = async (r, o) => (this.$coreStore.getValues().userKey.setValue(o), await this.$bypassLogin.mutate({ schema: r, userKey: o, init: !1 }), this.me());
|
|
1705
|
+
isAuthenticated = () => this.me();
|
|
1706
|
+
logout = () => {
|
|
1707
|
+
this.$coreStore.getValues().user.setValue(), this.$coreStore.getValues().userKey.setValue(), this.$coreStore.getValues().userToken.setValue(), this.transport.setAuth("");
|
|
1708
|
+
};
|
|
1709
|
+
/**
|
|
1710
|
+
* subscribe to user store and set auth header to the Transport on user update
|
|
1711
|
+
*/
|
|
1712
|
+
subscribe = () => {
|
|
1713
|
+
this.$bypassLogin.subscribe((r, o) => {
|
|
1714
|
+
o === "data" && (this.transport.setAuth(r?.data?.meta?.jwt), this.$coreStore.getValues().userToken.setValue(r?.data?.meta?.jwt));
|
|
1715
|
+
});
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
const sr = async (n, r, o) => {
|
|
1719
|
+
n.auth = new nr(n.store, n.transport);
|
|
1720
|
+
const a = new Yt(), h = a.getSchema(), f = a.getToken();
|
|
1721
|
+
h && f && (console.log("try to login prev user"), await n.auth.login(h, f)), n.sdk.authorizationBypass = async (p, c) => {
|
|
1722
|
+
await n.auth.login(p, c), a.setSchema("streamlayer:streamlayer");
|
|
1723
|
+
}, n.sdk.logout = () => {
|
|
1724
|
+
n.auth.logout();
|
|
1725
|
+
}, n.sdk.getUserStore = () => n.stores.user.getStore(), n.sdk.isUserAuthorized = () => n.auth.isAuthenticated(), o();
|
|
1726
|
+
}, or = (n, r, o) => {
|
|
1727
|
+
n.store = new ir(n.transport), n.stores = n.store.getValues(), n.sdk.sdkStore = n.store.getStore(), n.sdk.organizationStore = () => n.stores.organizationSettings.getStore(), n.storeUnsubscribe = () => {
|
|
1728
|
+
n.store.unsubscribe();
|
|
1729
|
+
}, o();
|
|
1730
|
+
}, ar = (n, r, o) => {
|
|
1731
|
+
console.log("core connected"), n.sdk = /* @__PURE__ */ Object.create(null), n.sdk.initializeApp = async () => {
|
|
1732
|
+
n.storeSubscribe(), n.stores.enabled.setValue("on"), n.stores.status.setValue(K.INITIALIZATION);
|
|
1733
|
+
try {
|
|
1734
|
+
const a = await n.stores.organizationSettings.getValue();
|
|
1735
|
+
return a ? (n.stores.status.setValue(K.READY), { enabled: !!a }) : (n.stores.status.setValue(K.FAILED), { err: "failed" });
|
|
1736
|
+
} catch (a) {
|
|
1737
|
+
return n.stores.enabled.setValue(), n.stores.status.setValue(K.FAILED), { err: `${a}` };
|
|
1738
|
+
}
|
|
1739
|
+
}, console.log("sdk.initializeApp added"), n.sdk.disableApp = () => {
|
|
1740
|
+
n.stores.enabled.setValue(), n.stores.status.setValue(K.DISABLED), n.storeUnsubscribe();
|
|
1741
|
+
}, n.sdk.createEventSession = (a) => {
|
|
1742
|
+
n.stores.providerStreamId.setValue(""), n.stores.providerStreamId.setValue(a);
|
|
1743
|
+
}, o();
|
|
1744
|
+
}, ur = ke({
|
|
1745
|
+
level: "trace"
|
|
1746
|
+
}), Xt = (n, r) => ur.child({ name: n }, r), cr = (n, r, o) => {
|
|
1747
|
+
const { client: a, queryKey: h } = o.createPromiseClient(Te, {
|
|
1748
|
+
method: "summary",
|
|
1749
|
+
params: [n, r]
|
|
1750
|
+
});
|
|
1751
|
+
return o.nanoquery.createFetcherStore(h, {
|
|
1752
|
+
fetcher: async (f, p, c, m) => (await a.summary({
|
|
1753
|
+
eventId: c,
|
|
1754
|
+
userId: m
|
|
1755
|
+
})).data?.attributes
|
|
1756
|
+
});
|
|
1757
|
+
}, hr = (n, r) => {
|
|
1758
|
+
const { client: o, queryKey: a } = r.createPromiseClient(R, { method: "get", params: [n] });
|
|
1759
|
+
return r.nanoquery.createFetcherStore(a, {
|
|
1760
|
+
fetcher: async (h, f, p) => (await o.get({
|
|
1761
|
+
eventId: p
|
|
1762
|
+
})).data?.attributes
|
|
1763
|
+
});
|
|
1764
|
+
}, dr = (n, r) => {
|
|
1765
|
+
const { client: o, queryKey: a } = r.createPromiseClient(R, { method: "syncQuestion", params: [n] });
|
|
1766
|
+
return r.nanoquery.createFetcherStore(a, {
|
|
1767
|
+
fetcher: async (h, f, p) => p ? (await o.syncQuestion({
|
|
1768
|
+
filter: {
|
|
1769
|
+
eventId: p
|
|
1770
|
+
}
|
|
1771
|
+
})).data?.attributes : void 0
|
|
1772
|
+
});
|
|
1773
|
+
}, lr = (n, r) => {
|
|
1774
|
+
const { client: o } = r.createCallbackClient(R), a = dt({ eventId: n.get() || "", feedId: "" });
|
|
1775
|
+
return n.subscribe((f = "") => {
|
|
1776
|
+
a.set({ eventId: f, feedId: "" });
|
|
1777
|
+
}), r.addSubscription(o.subscription, a, { name: "feedSubscription" });
|
|
1778
|
+
}, fr = (n, r) => {
|
|
1779
|
+
const { client: o } = r.createCallbackClient(R);
|
|
1780
|
+
return r.addSubscription(o.questionSubscription, { questionId: n }, { name: "questionSubscription" });
|
|
1781
|
+
}, pr = async (n, r) => {
|
|
1782
|
+
const { client: o } = r.createPromiseClient(R, { method: "questionByUser", params: [n] });
|
|
1783
|
+
return (await o.questionByUser({
|
|
1784
|
+
questionId: n
|
|
1785
|
+
})).data?.attributes?.question;
|
|
1786
|
+
}, gr = (n, r) => {
|
|
1787
|
+
const { client: o, queryKey: a } = r.createPromiseClient(R, { method: "questionByUser", params: [n] });
|
|
1788
|
+
return r.nanoquery.createFetcherStore(a, {
|
|
1789
|
+
fetcher: async (h, f, p) => (await o.questionByUser({
|
|
1790
|
+
questionId: p
|
|
1791
|
+
})).data?.attributes?.question
|
|
1792
|
+
});
|
|
1793
|
+
}, mr = (n, r) => {
|
|
1794
|
+
const { client: o, queryKey: a } = r.createPromiseClient(R, { method: "pickHistory", params: [n] });
|
|
1795
|
+
return r.nanoquery.createFetcherStore(a, {
|
|
1796
|
+
fetcher: async (h, f, p) => p ? (await o.pickHistory({
|
|
1797
|
+
eventId: p
|
|
1798
|
+
})).data?.map(({ attributes: m }) => m) : void 0
|
|
1799
|
+
});
|
|
1800
|
+
}, yr = (n, r) => {
|
|
1801
|
+
const { client: o, queryKey: a } = r.createPromiseClient(R, { method: "insightHistory", params: [n] });
|
|
1802
|
+
return r.nanoquery.createFetcherStore(a, {
|
|
1803
|
+
fetcher: async (h, f, p) => p ? (await o.insightHistory({
|
|
1804
|
+
eventId: p
|
|
1805
|
+
})).data?.map(({ attributes: m }) => m) : void 0
|
|
1806
|
+
});
|
|
1807
|
+
}, Zt = (n) => (n.gamification || (n.gamification = new wr(n)), n.gamification);
|
|
1808
|
+
class wr {
|
|
1809
|
+
/** sl event id */
|
|
1810
|
+
slStreamId;
|
|
1811
|
+
/** organization id */
|
|
1812
|
+
organizationId;
|
|
1813
|
+
/** current user id */
|
|
1814
|
+
userId;
|
|
1815
|
+
/** opened question, using to download statistics */
|
|
1816
|
+
openedQuestionId;
|
|
1817
|
+
/** opened question statistics */
|
|
1818
|
+
openedQuestion;
|
|
1819
|
+
/** last active question in feed */
|
|
1820
|
+
activeQuestionId;
|
|
1821
|
+
/** moderation id */
|
|
1822
|
+
moderationId;
|
|
1823
|
+
/** moderation */
|
|
1824
|
+
moderation;
|
|
1825
|
+
/** feed subscription to receive new active question, update last active question */
|
|
1826
|
+
feedSubscription;
|
|
1827
|
+
/** subscription to opened question (vote percentage) */
|
|
1828
|
+
questionSubscription;
|
|
1829
|
+
notifications;
|
|
1830
|
+
log;
|
|
1831
|
+
constructor(r) {
|
|
1832
|
+
if (r.gamification)
|
|
1833
|
+
throw new Error("GamificationBackground Singleton error");
|
|
1834
|
+
this.log = Xt("gamification-background"), this.slStreamId = r.stores.slStreamId.getAtomStore(), this.organizationId = r.stores.organizationSettings.getAtomStore(), this.userId = r.stores.user.getAtomStore(), this.moderationId = new N(_(), "moderationId").getStore(), this.openedQuestionId = new N(_(), "openedQuestionId").getStore(), this.notifications = r.notifications, this.moderation = new U(hr(this.slStreamId, r.transport), "gamification:moderation"), this.activeQuestionId = new U(dr(this.slStreamId, r.transport), "gamification:activeQuestionId"), this.openedQuestion = new U(gr(this.openedQuestionId, r.transport), "gamification:openedQuestion"), this.openedQuestionId.listen((o) => {
|
|
1835
|
+
this.log.debug({ questionId: o }, "received question"), o ? (this.questionSubscription = fr(o, r.transport), this.questionSubscription.addListener("feed-subscription-opened-question", (a) => {
|
|
1836
|
+
window.requestAnimationFrame(() => {
|
|
1837
|
+
this.openedQuestion?.getStore().mutate(a.data?.attributes?.question), this.openedQuestion?.getStore().invalidate();
|
|
1838
|
+
});
|
|
1839
|
+
}), this.questionSubscription.connect()) : (this.log.info("cleanup on close question"), this.openedQuestion?.getStore().mutate(void 0), this.questionSubscription !== void 0 && (r.transport.removeSubscription(this.questionSubscription), this.questionSubscription = void 0));
|
|
1840
|
+
}), this.feedSubscription = lr(this.slStreamId, r.transport), this.feedSubscription.addListener("feed-subscription-active-question", (o) => {
|
|
1841
|
+
window.requestAnimationFrame(() => {
|
|
1842
|
+
const a = this.activeQuestionId.getStore();
|
|
1843
|
+
a && a.mutate(o.data?.attributes);
|
|
1844
|
+
});
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Get id for notifications and link with current session
|
|
1849
|
+
* @param opts.prefix - id prefix (onboarding, question, tweet, ...etc)
|
|
1850
|
+
* @param opts.userId - current user id, if not presented get from sdk automatically
|
|
1851
|
+
* @param opts.eventId - current event id, if not presented get from sdk automatically
|
|
1852
|
+
* @param opts.organizationId - current organization id, if not presented get from sdk automatically
|
|
1853
|
+
* @param opts.entity - entity id (question id, tweet id, ...etc)
|
|
1854
|
+
*/
|
|
1855
|
+
getCurrentSessionId = (r) => {
|
|
1856
|
+
const o = r.eventId || this.slStreamId.get() || "", a = r.userId || this.userId.get() || "", h = r.organizationId || this.organizationId.get() || "", f = r.entity || "", p = r.prefix || "";
|
|
1857
|
+
return [h, o, a, p, f].join(":");
|
|
1858
|
+
};
|
|
1859
|
+
disconnect = () => {
|
|
1860
|
+
this.feedSubscription?.disconnect();
|
|
1861
|
+
};
|
|
1862
|
+
/**
|
|
1863
|
+
* Open question and mark notification for this question as viewed
|
|
1864
|
+
*/
|
|
1865
|
+
openQuestion = (r) => {
|
|
1866
|
+
this.openedQuestionId.set(r), this.notifications.markAsViewed(this.getCurrentSessionId({ prefix: "notification", entity: r }));
|
|
1867
|
+
};
|
|
1868
|
+
/**
|
|
1869
|
+
* Close question and mark notification for this question as viewed
|
|
1870
|
+
*/
|
|
1871
|
+
closeQuestion = (r) => {
|
|
1872
|
+
this.openedQuestionId.set(void 0), r && this.notifications.markAsViewed(this.getCurrentSessionId({ prefix: "notification", entity: r }));
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
class Sr {
|
|
1876
|
+
notificationsList;
|
|
1877
|
+
notifications;
|
|
1878
|
+
store;
|
|
1879
|
+
timeouts;
|
|
1880
|
+
waitingQueue;
|
|
1881
|
+
activeQueue;
|
|
1882
|
+
options;
|
|
1883
|
+
logger;
|
|
1884
|
+
constructor(r) {
|
|
1885
|
+
this.options = r, this.logger = Xt("notifications"), this.store = /* @__PURE__ */ new Map(), this.timeouts = /* @__PURE__ */ new Map(), this.waitingQueue = /* @__PURE__ */ new Set(), this.activeQueue = /* @__PURE__ */ new Set(), this.notifications = new N(_(/* @__PURE__ */ new Map()), "notifications-queue"), this.notificationsList = At(this.notifications.getStore(), (o) => o ? [...o.values()] : []);
|
|
1886
|
+
}
|
|
1887
|
+
addToQueue = (r) => {
|
|
1888
|
+
if (this.store.has(r.id)) {
|
|
1889
|
+
this.logger.debug({ notification: r }, "skip existed notification: %o");
|
|
1890
|
+
return;
|
|
1891
|
+
}
|
|
1892
|
+
const o = r.close, a = r.action;
|
|
1893
|
+
this.store.set(r.id, {
|
|
1894
|
+
...r,
|
|
1895
|
+
close: (...h) => {
|
|
1896
|
+
o && o(...h), this.closeNotification(r.id);
|
|
1897
|
+
},
|
|
1898
|
+
action: (...h) => {
|
|
1899
|
+
a && a(...h), this.closeNotification(r.id);
|
|
1900
|
+
}
|
|
1901
|
+
}), this.waitingQueue.add(r.id), this.logger.debug({ notification: r }, "notification added to waiting queue"), this.tickWaitingQueue();
|
|
1902
|
+
};
|
|
1903
|
+
tickWaitingQueue = () => {
|
|
1904
|
+
if (this.activeQueue.size < this.options.concurrency) {
|
|
1905
|
+
const [r] = this.waitingQueue;
|
|
1906
|
+
if (!r)
|
|
1907
|
+
return;
|
|
1908
|
+
this.activeQueue.add(r), this.waitingQueue.delete(r), this.logger.debug({ job: r }, "waiting queue tick"), this.tickActiveQueue(r);
|
|
1909
|
+
} else
|
|
1910
|
+
this.logger.debug({ queueSize: this.activeQueue.size, concurrency: this.options.concurrency }, "waiting queue tick skipped");
|
|
1911
|
+
};
|
|
1912
|
+
tickActiveQueue = (r) => {
|
|
1913
|
+
if (!r)
|
|
1914
|
+
return;
|
|
1915
|
+
const o = this.store.get(r);
|
|
1916
|
+
if (!o) {
|
|
1917
|
+
this.logger.debug({ notificationId: r }, "active queue tick skipped, notification not exist");
|
|
1918
|
+
return;
|
|
1919
|
+
}
|
|
1920
|
+
const a = setTimeout(() => {
|
|
1921
|
+
const h = r, f = new Map(this.notifications.getValue());
|
|
1922
|
+
f.set(o.id, o), this.notifications.setValue(f);
|
|
1923
|
+
const p = setTimeout(() => {
|
|
1924
|
+
this.logger.debug({ notificationId: h }, "notification hiding by autoHideDuration"), this.closeNotification(h);
|
|
1925
|
+
}, o.autoHideDuration || 5e3);
|
|
1926
|
+
this.timeouts.set(h, p), this.logger.debug({ notificationId: h, queue: [...f.values()] }, "notification displayed");
|
|
1927
|
+
}, o.delay || 0);
|
|
1928
|
+
this.timeouts.set(r, a), this.logger.debug({ notificationId: r }, "active queue tick completed"), this.tickWaitingQueue();
|
|
1929
|
+
};
|
|
1930
|
+
closeNotification = (r) => {
|
|
1931
|
+
const o = new Map(this.notifications.getValue()), a = o.get(r);
|
|
1932
|
+
if (a) {
|
|
1933
|
+
a.hiding = !0, this.notifications.setValue(o);
|
|
1934
|
+
const h = setTimeout(() => {
|
|
1935
|
+
const f = new Map(this.notifications.getValue());
|
|
1936
|
+
f.delete(r), this.notifications.setValue(f);
|
|
1937
|
+
const p = this.timeouts.get(r);
|
|
1938
|
+
p !== void 0 && (clearTimeout(p), this.timeouts.delete(r)), this.logger.debug({ notificationId: r }, "notification hidden");
|
|
1939
|
+
}, this.options.animationDelay || 0);
|
|
1940
|
+
this.timeouts.set(r, h);
|
|
1941
|
+
}
|
|
1942
|
+
this.store.delete(r), this.activeQueue.delete(r), this.waitingQueue.delete(r), this.tickWaitingQueue(), this.logger.debug({ notificationId: r }, "notification hiding");
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
var ct;
|
|
1946
|
+
(function(n) {
|
|
1947
|
+
n.OPENED = "opened";
|
|
1948
|
+
})(ct || (ct = {}));
|
|
1949
|
+
class br extends Ft {
|
|
1950
|
+
constructor() {
|
|
1951
|
+
super("notification");
|
|
1952
|
+
}
|
|
1953
|
+
setOpened = (r) => {
|
|
1954
|
+
this.write(ct.OPENED, r, "true");
|
|
1955
|
+
};
|
|
1956
|
+
isOpened = (r) => this.read(ct.OPENED, r);
|
|
1957
|
+
clearNotification = () => {
|
|
1958
|
+
this.clear();
|
|
1959
|
+
};
|
|
1960
|
+
}
|
|
1961
|
+
var et;
|
|
1962
|
+
(function(n) {
|
|
1963
|
+
n[n.ONBOARDING = 1] = "ONBOARDING", n[n.QUESTION = 2] = "QUESTION";
|
|
1964
|
+
})(et || (et = {}));
|
|
1965
|
+
class Ir {
|
|
1966
|
+
queue;
|
|
1967
|
+
storage;
|
|
1968
|
+
constructor(r = {}) {
|
|
1969
|
+
this.storage = new br(), this.queue = new Sr({ concurrency: 1, animationDelay: 300, ...r });
|
|
1970
|
+
}
|
|
1971
|
+
add = (r) => {
|
|
1972
|
+
this.storage.isOpened(r.id) || this.queue.addToQueue(r);
|
|
1973
|
+
};
|
|
1974
|
+
close = (r) => {
|
|
1975
|
+
this.queue.closeNotification(r), this.markAsViewed(r);
|
|
1976
|
+
};
|
|
1977
|
+
getQueueStore = () => this.queue.notificationsList;
|
|
1978
|
+
markAsViewed = (r) => {
|
|
1979
|
+
this.storage.setOpened(r);
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
const Er = (n, r, o) => {
|
|
1983
|
+
n.notifications = new Ir(), n.addNotification = n.notifications.add, n.sdk.getNotificationsStore = () => n.notifications.getQueueStore(), o();
|
|
1984
|
+
}, xr = (n, r) => {
|
|
1985
|
+
const { client: o } = n.createPromiseClient(R, { method: "submitAnswer" });
|
|
1986
|
+
return o.submitAnswer({ data: r });
|
|
1987
|
+
}, Br = (n, r) => {
|
|
1988
|
+
const { client: o } = n.createPromiseClient(R, { method: "submitInplay" });
|
|
1989
|
+
return o.submitInplay({ data: { eventId: +r } });
|
|
1990
|
+
}, Ar = (n, r) => {
|
|
1991
|
+
const { client: o } = n.createPromiseClient(R, { method: "skipQuestion" });
|
|
1992
|
+
return o.skipQuestion({ data: { id: r } });
|
|
1993
|
+
};
|
|
1994
|
+
var ht;
|
|
1995
|
+
(function(n) {
|
|
1996
|
+
n.ONBOARDING = "onboarding";
|
|
1997
|
+
})(ht || (ht = {}));
|
|
1998
|
+
class Fr extends Ft {
|
|
1999
|
+
constructor() {
|
|
2000
|
+
super("gamification");
|
|
2001
|
+
}
|
|
2002
|
+
saveOnboardingStatus = ({ userId: r, eventId: o, organizationId: a }, h) => {
|
|
2003
|
+
this.write(ht.ONBOARDING, a, r, o, h);
|
|
2004
|
+
};
|
|
2005
|
+
getOnboardingStatus = ({ userId: r, eventId: o, organizationId: a }) => this.read(ht.ONBOARDING, a, r, o);
|
|
2006
|
+
}
|
|
2007
|
+
const qt = /* @__PURE__ */ new Set([J.POLL, J.PREDICTION, J.TRIVIA]);
|
|
2008
|
+
var T;
|
|
2009
|
+
(function(n) {
|
|
2010
|
+
n.Unset = "unset", n.Required = "required", n.Optional = "optional", n.Completed = "completed", n.Disabled = "disabled", n.Unavailable = "unavailable";
|
|
2011
|
+
})(T || (T = {}));
|
|
2012
|
+
class kr extends Bt {
|
|
2013
|
+
/** user statistics (leaderboard panel) */
|
|
2014
|
+
userSummary;
|
|
2015
|
+
/** questions list (pick history) */
|
|
2016
|
+
questions;
|
|
2017
|
+
/** pinned leaderboard id */
|
|
2018
|
+
leaderboardId;
|
|
2019
|
+
/** onboarding status */
|
|
2020
|
+
onboardingStatus;
|
|
2021
|
+
/** opened question */
|
|
2022
|
+
openedQuestion;
|
|
2023
|
+
notifications;
|
|
2024
|
+
transport;
|
|
2025
|
+
closeFeature;
|
|
2026
|
+
openFeature;
|
|
2027
|
+
/** gamification background class, handle subscriptions and notifications for closed overlay */
|
|
2028
|
+
background;
|
|
2029
|
+
/** Browser cache */
|
|
2030
|
+
storage;
|
|
2031
|
+
constructor(r, o, a) {
|
|
2032
|
+
super(r, o), this.background = Zt(a), this.storage = new Fr(), this.leaderboardId = new N(_(this.settings.getValue("pinnedLeaderboardId")), "pinnedLeaderboardId").getStore(), this.onboardingStatus = new N(_(T.Unset), "onboardingStatus").getStore(), this.notifications = a.notifications, this.transport = a.transport, this.closeFeature = a.sdk.closeFeature, this.openFeature = () => a.sdk.openFeature(V.GAMES), this.openedQuestion = At(this.background.openedQuestion.getStore(), (h) => {
|
|
2033
|
+
if (h.data?.type && qt.has(h.data.type))
|
|
2034
|
+
return h.data;
|
|
2035
|
+
}), this.onboardingStatus.subscribe((h) => {
|
|
2036
|
+
(h === T.Optional || T.Required) && this.showOnboardingInApp();
|
|
2037
|
+
}), this.status.subscribe((h) => {
|
|
2038
|
+
h === W.Ready ? (this.notifications.close(this.background.getCurrentSessionId({ prefix: "onboarding" })), this.connect(a.transport)) : this.disconnect();
|
|
2039
|
+
}), this.onboardingStatus.subscribe((h) => {
|
|
2040
|
+
h && this.background.activeQuestionId.invalidate();
|
|
2041
|
+
}), this.background.activeQuestionId.listen((h) => {
|
|
2042
|
+
h && h.data && this.onboardingStatus.get() && qt.has(h.data.question.type) && h.data.question.status === bt.ACTIVE && this.notifications.add({
|
|
2043
|
+
type: et.QUESTION,
|
|
2044
|
+
action: () => this.openQuestion(h.data.question.id),
|
|
2045
|
+
close: () => this.closeQuestion(h.data.question.id),
|
|
2046
|
+
autoHideDuration: 5e3,
|
|
2047
|
+
id: this.background.getCurrentSessionId({ prefix: "notification", entity: h.data.question.id }),
|
|
2048
|
+
data: {
|
|
2049
|
+
title: h.data.notification.title,
|
|
2050
|
+
color: h.data.notification.indicatorColor,
|
|
2051
|
+
icon: h.data.notification.image,
|
|
2052
|
+
imageMode: h.data.notification.imageMode,
|
|
2053
|
+
imagePosition: h.data.notification.imagePosition
|
|
2054
|
+
}
|
|
2055
|
+
});
|
|
2056
|
+
}), this.onboardingProcess(), this.background.userId.subscribe((h) => {
|
|
2057
|
+
h && this.onboardingProcess();
|
|
2058
|
+
}), this.background.moderation.subscribe((h) => {
|
|
2059
|
+
h.data && this.onboardingProcess();
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2062
|
+
/**
|
|
2063
|
+
* check onboarding status, sync with browser cache
|
|
2064
|
+
* retrieve onboarding settings from api
|
|
2065
|
+
*/
|
|
2066
|
+
onboardingProcess = async () => {
|
|
2067
|
+
const r = this.background.userId.get();
|
|
2068
|
+
if (!r)
|
|
2069
|
+
return;
|
|
2070
|
+
this.storage.getOnboardingStatus({
|
|
2071
|
+
userId: r,
|
|
2072
|
+
organizationId: this.background.organizationId.get() || "",
|
|
2073
|
+
eventId: this.background.slStreamId.get() || ""
|
|
2074
|
+
}) === T.Completed && this.onboardingStatus.set(T.Completed);
|
|
2075
|
+
const a = await this.background.moderation.getValue();
|
|
2076
|
+
if (this.onboardingStatus.get() === T.Completed)
|
|
2077
|
+
return;
|
|
2078
|
+
const h = !!(a?.options?.onboardingEnabled && this.featureSettings.get().inplayGame?.onboarding?.completed), f = !!this.featureSettings.get().inplayGame?.titleCard?.optIn;
|
|
2079
|
+
h ? f ? this.onboardingStatus.set(T.Required) : this.onboardingStatus.set(T.Optional) : f ? this.onboardingStatus.set(T.Unavailable) : this.onboardingStatus.set(T.Disabled);
|
|
2080
|
+
};
|
|
2081
|
+
showOnboardingInApp = () => {
|
|
2082
|
+
const { inplayGame: r } = this.featureSettings.get();
|
|
2083
|
+
if (!r)
|
|
2084
|
+
return;
|
|
2085
|
+
const { titleCard: o, overview: a } = r;
|
|
2086
|
+
this.notifications.add({
|
|
2087
|
+
type: et.ONBOARDING,
|
|
2088
|
+
id: this.background.getCurrentSessionId({ prefix: "onboarding" }),
|
|
2089
|
+
action: this.openFeature,
|
|
2090
|
+
close: this.closeFeature,
|
|
2091
|
+
autoHideDuration: 1e5,
|
|
2092
|
+
data: {
|
|
2093
|
+
header: o?.header,
|
|
2094
|
+
title: o?.title,
|
|
2095
|
+
subtitle: o?.subtitle,
|
|
2096
|
+
graphicBg: o?.appearance?.graphic,
|
|
2097
|
+
icon: o?.media?.icon,
|
|
2098
|
+
sponsorLogo: o?.media?.sponsorLogo,
|
|
2099
|
+
primaryColor: a?.appearance?.primaryColor
|
|
2100
|
+
}
|
|
2101
|
+
});
|
|
2102
|
+
};
|
|
2103
|
+
connect = (r) => {
|
|
2104
|
+
this.userSummary ? this.userSummary.invalidate() : this.userSummary = new U(cr(this.background.slStreamId, this.background.userId, r), "gamification:userSummary"), this.questions ? this.questions.invalidate() : this.questions = new U(mr(this.background.slStreamId, r), "gamification:questions"), this.background.feedSubscription.addListener("feed-subscription-prediction-close", (o) => {
|
|
2105
|
+
window.requestAnimationFrame(async () => {
|
|
2106
|
+
const a = o.data?.attributes?.question;
|
|
2107
|
+
if (!a)
|
|
2108
|
+
return;
|
|
2109
|
+
const { status: h, type: f, id: p } = a;
|
|
2110
|
+
if (h === bt.RESOLVED && f === J.PREDICTION) {
|
|
2111
|
+
const c = this.background.getCurrentSessionId({
|
|
2112
|
+
prefix: `notification-id:${p}`
|
|
2113
|
+
}), F = (await pr(p, r))?.answers.find(({ correct: b }) => b);
|
|
2114
|
+
this.notifications.add({
|
|
2115
|
+
type: et.ONBOARDING,
|
|
2116
|
+
action: () => this.openQuestion(p),
|
|
2117
|
+
close: () => this.closeQuestion(p),
|
|
2118
|
+
autoHideDuration: 5e3,
|
|
2119
|
+
id: c,
|
|
2120
|
+
data: {
|
|
2121
|
+
title: F?.youVoted ? `Congratulations! You answered correctly! You won ${F.points} pts!` : `Better luck next time! Correct: ${F?.text}!`
|
|
2122
|
+
}
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
});
|
|
2126
|
+
}), this.background.feedSubscription.addListener("feed-subscription-questions-list", () => {
|
|
2127
|
+
window.requestAnimationFrame(() => {
|
|
2128
|
+
this.questions?.invalidate();
|
|
2129
|
+
});
|
|
2130
|
+
});
|
|
2131
|
+
};
|
|
2132
|
+
disconnect = () => {
|
|
2133
|
+
this.background.feedSubscription.removeListener("feed-subscription-questions-list");
|
|
2134
|
+
};
|
|
2135
|
+
// onboarding
|
|
2136
|
+
submitInplay = async () => {
|
|
2137
|
+
const r = this.background.slStreamId.get();
|
|
2138
|
+
r && (await Br(this.transport, r), this.onboardingStatus.set(T.Completed), this.storage.saveOnboardingStatus({
|
|
2139
|
+
organizationId: this.background.organizationId.get() || "",
|
|
2140
|
+
userId: this.background.userId.get() || "",
|
|
2141
|
+
eventId: r
|
|
2142
|
+
}, T.Completed));
|
|
2143
|
+
};
|
|
2144
|
+
submitAnswer = async (r, o) => {
|
|
2145
|
+
await xr(this.transport, { questionId: r, answerId: o }), this.questions?.invalidate();
|
|
2146
|
+
};
|
|
2147
|
+
skipQuestion = async (r) => {
|
|
2148
|
+
await Ar(this.transport, r), this.questions?.invalidate();
|
|
2149
|
+
};
|
|
2150
|
+
openQuestion = (r) => (this.openFeature(), this.background.openQuestion(r));
|
|
2151
|
+
closeQuestion = (r) => this.background.closeQuestion(r);
|
|
2152
|
+
}
|
|
2153
|
+
class Tr extends Bt {
|
|
2154
|
+
insights;
|
|
2155
|
+
closeFeature;
|
|
2156
|
+
openFeature;
|
|
2157
|
+
openedInsight;
|
|
2158
|
+
notifications;
|
|
2159
|
+
transport;
|
|
2160
|
+
background;
|
|
2161
|
+
constructor(r, o, a) {
|
|
2162
|
+
super(r, o), this.background = Zt(a), this.notifications = a.notifications, this.transport = a.transport, this.closeFeature = a.sdk.closeFeature, this.openFeature = () => a.sdk.openFeature(V.HIGHLIGHTS), this.status.subscribe((h) => {
|
|
2163
|
+
h === W.Ready ? this.connect() : this.disconnect();
|
|
2164
|
+
}), this.background.activeQuestionId.listen((h) => {
|
|
2165
|
+
h && h.data && h.data.question.type === J.FACTOID && h.data.question.status === bt.ACTIVE && this.notifications.add({
|
|
2166
|
+
type: et.QUESTION,
|
|
2167
|
+
action: () => this.openHighlight(h.data.question.id),
|
|
2168
|
+
close: () => this.closeHighlight(h.data.question.id),
|
|
2169
|
+
autoHideDuration: 5e3,
|
|
2170
|
+
id: this.background.getCurrentSessionId({ prefix: "notification", entity: h.data.question.id }),
|
|
2171
|
+
data: {
|
|
2172
|
+
title: h.data.notification.title,
|
|
2173
|
+
color: h.data.notification.indicatorColor,
|
|
2174
|
+
icon: h.data.notification.image,
|
|
2175
|
+
imageMode: h.data.notification.imageMode,
|
|
2176
|
+
imagePosition: h.data.notification.imagePosition
|
|
2177
|
+
}
|
|
2178
|
+
});
|
|
2179
|
+
}), this.openedInsight = At(this.background.openedQuestion.getStore(), (h) => {
|
|
2180
|
+
if (h.data?.type === J.FACTOID)
|
|
2181
|
+
return h.data;
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
connect = () => {
|
|
2185
|
+
this.insights ? this.insights.invalidate() : this.insights = new U(yr(this.background.slStreamId, this.transport), "gamification:insights"), this.background.feedSubscription.addListener("feed-subscription-insights-list", () => {
|
|
2186
|
+
window.requestAnimationFrame(() => {
|
|
2187
|
+
this.insights?.invalidate();
|
|
2188
|
+
});
|
|
2189
|
+
});
|
|
2190
|
+
};
|
|
2191
|
+
disconnect = () => {
|
|
2192
|
+
this.background.feedSubscription.removeListener("feed-subscription-insights-list");
|
|
2193
|
+
};
|
|
2194
|
+
openHighlight = (r) => (this.openFeature(), this.background.openQuestion(r));
|
|
2195
|
+
closeHighlight = (r) => this.background.closeQuestion(r);
|
|
2196
|
+
}
|
|
2197
|
+
V.GAMES + "", V.HIGHLIGHTS + "";
|
|
2198
|
+
class Cr extends Bt {
|
|
2199
|
+
constructor(r, o) {
|
|
2200
|
+
super(r, o);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
const Ur = (n, r, o) => n.type === V.GAMES ? new kr(n, r, o) : n.type === V.HIGHLIGHTS ? new Tr(n, r, o) : new Cr(n, r), Nr = (n, r, o) => {
|
|
2204
|
+
n.features = /* @__PURE__ */ new Map(), n.activeFeature = new N(_(), "activeFeature"), n.sdk.getFeatures = () => n.features, n.sdk.getFeature = (a) => n.features.get(a), n.sdk.getActiveFeature = () => n.activeFeature.getStore(), n.sdk.openFeature = (a) => {
|
|
2205
|
+
n.activeFeature.setValue(a);
|
|
2206
|
+
}, n.sdk.closeFeature = () => {
|
|
2207
|
+
n.activeFeature.setValue(void 0);
|
|
2208
|
+
}, n.initFeature = (a, h = Q.ORGANIZATION) => {
|
|
2209
|
+
const f = Ur(a, h, n);
|
|
2210
|
+
n.features.set(a.type, f);
|
|
2211
|
+
}, n.updateFeature = (a, h) => {
|
|
2212
|
+
n.features.get(a.type)?.update(a, h);
|
|
2213
|
+
}, n.destroyFeature = (a) => {
|
|
2214
|
+
n.features.delete(a.type);
|
|
2215
|
+
}, n.reinitializeFeatures = async () => {
|
|
2216
|
+
const a = await n.stores.organizationSettings.getValue();
|
|
2217
|
+
n.features.clear();
|
|
2218
|
+
for (const h of a?.overlays || [])
|
|
2219
|
+
n.initFeature(h, Q.ORGANIZATION);
|
|
2220
|
+
}, n.stores.providerStreamId.listen((a) => {
|
|
2221
|
+
a || n.reinitializeFeatures();
|
|
2222
|
+
}), n.storeSubscribe = () => {
|
|
2223
|
+
const a = (f, p) => {
|
|
2224
|
+
if (p?.overlays) {
|
|
2225
|
+
f === Q.STREAM && n.features.clear();
|
|
2226
|
+
for (const c of p.overlays)
|
|
2227
|
+
c.sdkEnable === !0 && (n.features.has(c.type) ? n.updateFeature(c, f) : n.initFeature(c, f));
|
|
2228
|
+
}
|
|
2229
|
+
}, h = {
|
|
2230
|
+
/**
|
|
2231
|
+
* During the initial SDK initialization, it's imperative to initialize features first,
|
|
2232
|
+
* followed by their direct subscriptions to store fields.
|
|
2233
|
+
* This section is currently in development, and it's
|
|
2234
|
+
* essential to implement checks to determine whether a feature
|
|
2235
|
+
* has already been initialized. If it has, events related to
|
|
2236
|
+
* that feature should be skipped. Conversely, if a feature is
|
|
2237
|
+
* missing in the new settings, it should be initialized again.
|
|
2238
|
+
*/
|
|
2239
|
+
organizationSettings: (f) => {
|
|
2240
|
+
if (f.data)
|
|
2241
|
+
try {
|
|
2242
|
+
a(Q.ORGANIZATION, f.data);
|
|
2243
|
+
} catch (p) {
|
|
2244
|
+
console.log(p);
|
|
2245
|
+
}
|
|
2246
|
+
},
|
|
2247
|
+
streamSettings: (f) => {
|
|
2248
|
+
if (f.data)
|
|
2249
|
+
try {
|
|
2250
|
+
a(Q.STREAM, f.data);
|
|
2251
|
+
} catch (p) {
|
|
2252
|
+
console.log(p);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
};
|
|
2256
|
+
n.store.subscribe(h);
|
|
2257
|
+
}, o();
|
|
2258
|
+
};
|
|
2259
|
+
function Wr(n, r = !0) {
|
|
2260
|
+
const o = r ? "https://grpc-web.streamlayer.io:443" : "https://grpc-web.next.streamlayer.io:443", a = Ce(/* @__PURE__ */ Object.create({}), { autostart: !1 });
|
|
2261
|
+
return a.use(ar), a.use(er, { sdkKey: n, host: o }), a.use(or), a.use(sr), a.use(Nr), a.use(Er), a.after(async (h, f, p) => {
|
|
2262
|
+
if (h)
|
|
2263
|
+
throw h;
|
|
2264
|
+
console.log(f), console.log(f.sdk), console.log(typeof f.sdk), await f.sdk.initializeApp(), p();
|
|
2265
|
+
}), a.onClose(() => {
|
|
2266
|
+
console.log("close");
|
|
2267
|
+
}), a;
|
|
2268
|
+
}
|
|
2269
|
+
export {
|
|
2270
|
+
Wr as StreamLayer
|
|
2271
|
+
};
|