@sendity/client 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/sendity.d.ts +3 -0
- package/dist/i18n/sendity.en.d.ts +2 -0
- package/dist/sendity-client.js +458 -391
- package/package.json +1 -1
package/dist/sendity-client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const pt = `<template id="sendity-tpl">
|
|
2
2
|
<div class="sendity" role="region" aria-label="Sendity authentication">
|
|
3
3
|
<div class="sendity-body">
|
|
4
4
|
<slot id="prompt">
|
|
@@ -29,7 +29,7 @@ const ft = `<template id="sendity-tpl">
|
|
|
29
29
|
</footer>
|
|
30
30
|
</div>
|
|
31
31
|
</template>
|
|
32
|
-
`,
|
|
32
|
+
`, zi = `/* Sendity client — passwordless channel-control authentication widget.
|
|
33
33
|
Design tokens mirror the Sendity Design System (emerald accent, stone neutral,
|
|
34
34
|
Zilla Slab display / Geist UI / Geist Mono). All values are overridable via
|
|
35
35
|
CSS custom properties so the host page can theme the widget.
|
|
@@ -237,7 +237,20 @@ const ft = `<template id="sendity-tpl">
|
|
|
237
237
|
min-width: 0;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
.sendity .
|
|
240
|
+
.sendity .code--expired {
|
|
241
|
+
color: var(--sendity-error-color);
|
|
242
|
+
border-color: var(--sendity-error-color);
|
|
243
|
+
background: var(--sendity-error-bg);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.sendity .code--expired .formatted-code {
|
|
247
|
+
text-decoration: line-through;
|
|
248
|
+
text-decoration-thickness: 0.12em;
|
|
249
|
+
text-decoration-color: currentColor;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.sendity .verifiers a.chan,
|
|
253
|
+
.sendity .verifiers button.chan {
|
|
241
254
|
display: inline-flex;
|
|
242
255
|
align-items: center;
|
|
243
256
|
justify-content: center;
|
|
@@ -255,16 +268,29 @@ const ft = `<template id="sendity-tpl">
|
|
|
255
268
|
transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
|
|
256
269
|
}
|
|
257
270
|
|
|
258
|
-
.sendity .verifiers a.chan:active
|
|
259
|
-
.sendity .verifiers
|
|
271
|
+
.sendity .verifiers a.chan:active,
|
|
272
|
+
.sendity .verifiers button.chan:active { transform: scale(0.98); }
|
|
273
|
+
.sendity .verifiers a.chan:focus-visible,
|
|
274
|
+
.sendity .verifiers button.chan:focus-visible { outline: 2px solid var(--sendity-primary-color); outline-offset: 2px; }
|
|
260
275
|
|
|
261
|
-
.sendity .verifiers a.chan .icon
|
|
276
|
+
.sendity .verifiers a.chan .icon,
|
|
277
|
+
.sendity .verifiers button.chan .icon {
|
|
262
278
|
width: 1em;
|
|
263
279
|
height: 1em;
|
|
264
280
|
display: inline-flex;
|
|
265
281
|
flex: none;
|
|
266
282
|
}
|
|
267
|
-
.sendity .verifiers a.chan .icon svg
|
|
283
|
+
.sendity .verifiers a.chan .icon svg,
|
|
284
|
+
.sendity .verifiers button.chan .icon svg { width: 100%; height: 100%; display: block; }
|
|
285
|
+
|
|
286
|
+
.sendity .verifiers button.chan.primary {
|
|
287
|
+
width: 100%;
|
|
288
|
+
color: #ffffff;
|
|
289
|
+
background: var(--sendity-primary-color);
|
|
290
|
+
border-color: var(--sendity-primary-color);
|
|
291
|
+
}
|
|
292
|
+
.sendity .verifiers button.chan.primary:hover { background: var(--sendity-primary-hover); border-color: var(--sendity-primary-hover); }
|
|
293
|
+
.sendity .verifiers button.chan.primary:disabled { opacity: 0.7; cursor: wait; }
|
|
268
294
|
|
|
269
295
|
.sendity .verifiers a.chan.email {
|
|
270
296
|
color: var(--sendity-email-fg);
|
|
@@ -576,7 +602,7 @@ class Ct {
|
|
|
576
602
|
this.namespace = i;
|
|
577
603
|
}
|
|
578
604
|
}
|
|
579
|
-
function
|
|
605
|
+
function Hi(v) {
|
|
580
606
|
try {
|
|
581
607
|
return Reflect.construct(String, [], v), !0;
|
|
582
608
|
} catch {
|
|
@@ -671,7 +697,7 @@ class St extends Ue {
|
|
|
671
697
|
), this;
|
|
672
698
|
}
|
|
673
699
|
}
|
|
674
|
-
class
|
|
700
|
+
class Di extends Ue {
|
|
675
701
|
/**
|
|
676
702
|
* Send a whisper event to other clients in the channel.
|
|
677
703
|
*/
|
|
@@ -843,7 +869,7 @@ class Fi extends _t {
|
|
|
843
869
|
), this;
|
|
844
870
|
}
|
|
845
871
|
}
|
|
846
|
-
class
|
|
872
|
+
class ge extends qe {
|
|
847
873
|
/**
|
|
848
874
|
* Subscribe to a channel.
|
|
849
875
|
*/
|
|
@@ -891,7 +917,7 @@ class fe extends qe {
|
|
|
891
917
|
return this;
|
|
892
918
|
}
|
|
893
919
|
}
|
|
894
|
-
class xt extends
|
|
920
|
+
class xt extends ge {
|
|
895
921
|
/**
|
|
896
922
|
* Send a whisper event to other clients in the channel.
|
|
897
923
|
*/
|
|
@@ -899,7 +925,7 @@ class xt extends fe {
|
|
|
899
925
|
return this;
|
|
900
926
|
}
|
|
901
927
|
}
|
|
902
|
-
class Bi extends
|
|
928
|
+
class Bi extends ge {
|
|
903
929
|
/**
|
|
904
930
|
* Send a whisper event to other clients in the channel.
|
|
905
931
|
*/
|
|
@@ -933,7 +959,7 @@ class $i extends xt {
|
|
|
933
959
|
return this;
|
|
934
960
|
}
|
|
935
961
|
}
|
|
936
|
-
const
|
|
962
|
+
const Et = class kt {
|
|
937
963
|
/**
|
|
938
964
|
* Create a new class instance.
|
|
939
965
|
*/
|
|
@@ -945,7 +971,7 @@ const kt = class Et {
|
|
|
945
971
|
*/
|
|
946
972
|
setOptions(i) {
|
|
947
973
|
this.options = {
|
|
948
|
-
...
|
|
974
|
+
...kt._defaultOptions,
|
|
949
975
|
...i,
|
|
950
976
|
broadcaster: i.broadcaster
|
|
951
977
|
};
|
|
@@ -960,7 +986,7 @@ const kt = class Et {
|
|
|
960
986
|
return typeof window < "u" && (i = window.Laravel) != null && i.csrfToken ? window.Laravel.csrfToken : this.options.csrfToken ? this.options.csrfToken : typeof document < "u" && typeof document.querySelector == "function" ? ((o = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : o.getAttribute("content")) ?? null : null;
|
|
961
987
|
}
|
|
962
988
|
};
|
|
963
|
-
|
|
989
|
+
Et._defaultOptions = {
|
|
964
990
|
auth: {
|
|
965
991
|
headers: {}
|
|
966
992
|
},
|
|
@@ -975,8 +1001,8 @@ kt._defaultOptions = {
|
|
|
975
1001
|
key: null,
|
|
976
1002
|
namespace: "App.Events"
|
|
977
1003
|
};
|
|
978
|
-
let
|
|
979
|
-
class
|
|
1004
|
+
let Ne = Et;
|
|
1005
|
+
class fe extends Ne {
|
|
980
1006
|
constructor() {
|
|
981
1007
|
super(...arguments), this.channels = {};
|
|
982
1008
|
}
|
|
@@ -1034,7 +1060,7 @@ class pe extends je {
|
|
|
1034
1060
|
* Get a private encrypted channel instance by name.
|
|
1035
1061
|
*/
|
|
1036
1062
|
encryptedPrivateChannel(i) {
|
|
1037
|
-
return this.channels["private-encrypted-" + i] || (this.channels["private-encrypted-" + i] = new
|
|
1063
|
+
return this.channels["private-encrypted-" + i] || (this.channels["private-encrypted-" + i] = new Di(
|
|
1038
1064
|
this.pusher,
|
|
1039
1065
|
"private-encrypted-" + i,
|
|
1040
1066
|
this.options
|
|
@@ -1113,7 +1139,7 @@ class pe extends je {
|
|
|
1113
1139
|
this.pusher.disconnect();
|
|
1114
1140
|
}
|
|
1115
1141
|
}
|
|
1116
|
-
class Xi extends
|
|
1142
|
+
class Xi extends Ne {
|
|
1117
1143
|
constructor() {
|
|
1118
1144
|
super(...arguments), this.channels = {};
|
|
1119
1145
|
}
|
|
@@ -1235,7 +1261,7 @@ class Xi extends je {
|
|
|
1235
1261
|
this.socket.disconnect();
|
|
1236
1262
|
}
|
|
1237
1263
|
}
|
|
1238
|
-
class mt extends
|
|
1264
|
+
class mt extends Ne {
|
|
1239
1265
|
constructor() {
|
|
1240
1266
|
super(...arguments), this.channels = {};
|
|
1241
1267
|
}
|
|
@@ -1248,13 +1274,13 @@ class mt extends je {
|
|
|
1248
1274
|
* Listen for an event on a channel instance.
|
|
1249
1275
|
*/
|
|
1250
1276
|
listen(i, o, a) {
|
|
1251
|
-
return new
|
|
1277
|
+
return new ge();
|
|
1252
1278
|
}
|
|
1253
1279
|
/**
|
|
1254
1280
|
* Get a channel instance by name.
|
|
1255
1281
|
*/
|
|
1256
1282
|
channel(i) {
|
|
1257
|
-
return new
|
|
1283
|
+
return new ge();
|
|
1258
1284
|
}
|
|
1259
1285
|
/**
|
|
1260
1286
|
* Get a private channel instance by name.
|
|
@@ -1309,7 +1335,7 @@ class mt extends je {
|
|
|
1309
1335
|
disconnect() {
|
|
1310
1336
|
}
|
|
1311
1337
|
}
|
|
1312
|
-
class
|
|
1338
|
+
class Vi {
|
|
1313
1339
|
/**
|
|
1314
1340
|
* Create a new class instance.
|
|
1315
1341
|
*/
|
|
@@ -1327,14 +1353,14 @@ class Ji {
|
|
|
1327
1353
|
*/
|
|
1328
1354
|
connect() {
|
|
1329
1355
|
if (this.options.broadcaster === "reverb")
|
|
1330
|
-
this.connector = new
|
|
1356
|
+
this.connector = new fe({
|
|
1331
1357
|
...this.options,
|
|
1332
1358
|
cluster: ""
|
|
1333
1359
|
});
|
|
1334
1360
|
else if (this.options.broadcaster === "pusher")
|
|
1335
|
-
this.connector = new
|
|
1361
|
+
this.connector = new fe(this.options);
|
|
1336
1362
|
else if (this.options.broadcaster === "ably")
|
|
1337
|
-
this.connector = new
|
|
1363
|
+
this.connector = new fe({
|
|
1338
1364
|
...this.options,
|
|
1339
1365
|
cluster: "",
|
|
1340
1366
|
broadcaster: "pusher"
|
|
@@ -1343,7 +1369,7 @@ class Ji {
|
|
|
1343
1369
|
this.connector = new Xi(this.options);
|
|
1344
1370
|
else if (this.options.broadcaster === "null")
|
|
1345
1371
|
this.connector = new mt(this.options);
|
|
1346
|
-
else if (typeof this.options.broadcaster == "function" &&
|
|
1372
|
+
else if (typeof this.options.broadcaster == "function" && Hi(this.options.broadcaster))
|
|
1347
1373
|
this.connector = new this.options.broadcaster(this.options);
|
|
1348
1374
|
else
|
|
1349
1375
|
throw new Error(
|
|
@@ -1406,7 +1432,7 @@ class Ji {
|
|
|
1406
1432
|
);
|
|
1407
1433
|
}
|
|
1408
1434
|
connectorSupportsEncryptedPrivateChannels(i) {
|
|
1409
|
-
return i instanceof
|
|
1435
|
+
return i instanceof fe || i instanceof mt;
|
|
1410
1436
|
}
|
|
1411
1437
|
/**
|
|
1412
1438
|
* Get the Socket ID for the connection.
|
|
@@ -1467,10 +1493,10 @@ class Ji {
|
|
|
1467
1493
|
);
|
|
1468
1494
|
}
|
|
1469
1495
|
}
|
|
1470
|
-
function
|
|
1496
|
+
function Ji(v) {
|
|
1471
1497
|
return v && v.__esModule && Object.prototype.hasOwnProperty.call(v, "default") ? v.default : v;
|
|
1472
1498
|
}
|
|
1473
|
-
var
|
|
1499
|
+
var Pe = { exports: {} };
|
|
1474
1500
|
var gt;
|
|
1475
1501
|
function Gi() {
|
|
1476
1502
|
return gt || (gt = 1, (function(v, i) {
|
|
@@ -1483,19 +1509,19 @@ function Gi() {
|
|
|
1483
1509
|
/***/
|
|
1484
1510
|
594(m, g) {
|
|
1485
1511
|
var y = this && this.__extends || /* @__PURE__ */ (function() {
|
|
1486
|
-
var _ = function(d,
|
|
1487
|
-
return _ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(S,
|
|
1488
|
-
S.__proto__ =
|
|
1489
|
-
} || function(S,
|
|
1490
|
-
for (var q in
|
|
1491
|
-
}, _(d,
|
|
1512
|
+
var _ = function(d, f) {
|
|
1513
|
+
return _ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(S, L) {
|
|
1514
|
+
S.__proto__ = L;
|
|
1515
|
+
} || function(S, L) {
|
|
1516
|
+
for (var q in L) L.hasOwnProperty(q) && (S[q] = L[q]);
|
|
1517
|
+
}, _(d, f);
|
|
1492
1518
|
};
|
|
1493
|
-
return function(d,
|
|
1494
|
-
_(d,
|
|
1519
|
+
return function(d, f) {
|
|
1520
|
+
_(d, f);
|
|
1495
1521
|
function S() {
|
|
1496
1522
|
this.constructor = d;
|
|
1497
1523
|
}
|
|
1498
|
-
d.prototype =
|
|
1524
|
+
d.prototype = f === null ? Object.create(f) : (S.prototype = f.prototype, new S());
|
|
1499
1525
|
};
|
|
1500
1526
|
})();
|
|
1501
1527
|
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
@@ -1508,16 +1534,16 @@ function Gi() {
|
|
|
1508
1534
|
return _.prototype.encodedLength = function(d) {
|
|
1509
1535
|
return this._paddingCharacter ? (d + 2) / 3 * 4 | 0 : (d * 8 + 5) / 6 | 0;
|
|
1510
1536
|
}, _.prototype.encode = function(d) {
|
|
1511
|
-
for (var
|
|
1512
|
-
var
|
|
1513
|
-
|
|
1537
|
+
for (var f = "", S = 0; S < d.length - 2; S += 3) {
|
|
1538
|
+
var L = d[S] << 16 | d[S + 1] << 8 | d[S + 2];
|
|
1539
|
+
f += this._encodeByte(L >>> 18 & 63), f += this._encodeByte(L >>> 12 & 63), f += this._encodeByte(L >>> 6 & 63), f += this._encodeByte(L >>> 0 & 63);
|
|
1514
1540
|
}
|
|
1515
1541
|
var q = d.length - S;
|
|
1516
1542
|
if (q > 0) {
|
|
1517
|
-
var
|
|
1518
|
-
|
|
1543
|
+
var L = d[S] << 16 | (q === 2 ? d[S + 1] << 8 : 0);
|
|
1544
|
+
f += this._encodeByte(L >>> 18 & 63), f += this._encodeByte(L >>> 12 & 63), q === 2 ? f += this._encodeByte(L >>> 6 & 63) : f += this._paddingCharacter || "", f += this._paddingCharacter || "";
|
|
1519
1545
|
}
|
|
1520
|
-
return
|
|
1546
|
+
return f;
|
|
1521
1547
|
}, _.prototype.maxDecodedLength = function(d) {
|
|
1522
1548
|
return this._paddingCharacter ? d / 4 * 3 | 0 : (d * 6 + 7) / 8 | 0;
|
|
1523
1549
|
}, _.prototype.decodedLength = function(d) {
|
|
@@ -1525,26 +1551,26 @@ function Gi() {
|
|
|
1525
1551
|
}, _.prototype.decode = function(d) {
|
|
1526
1552
|
if (d.length === 0)
|
|
1527
1553
|
return new Uint8Array(0);
|
|
1528
|
-
for (var
|
|
1529
|
-
J = this._decodeChar(d.charCodeAt(
|
|
1530
|
-
if (
|
|
1554
|
+
for (var f = this._getPaddingLength(d), S = d.length - f, L = new Uint8Array(this.maxDecodedLength(S)), q = 0, j = 0, z = 0, J = 0, D = 0, H = 0, G = 0; j < S - 4; j += 4)
|
|
1555
|
+
J = this._decodeChar(d.charCodeAt(j + 0)), D = this._decodeChar(d.charCodeAt(j + 1)), H = this._decodeChar(d.charCodeAt(j + 2)), G = this._decodeChar(d.charCodeAt(j + 3)), L[q++] = J << 2 | D >>> 4, L[q++] = D << 4 | H >>> 2, L[q++] = H << 6 | G, z |= J & x, z |= D & x, z |= H & x, z |= G & x;
|
|
1556
|
+
if (j < S - 1 && (J = this._decodeChar(d.charCodeAt(j)), D = this._decodeChar(d.charCodeAt(j + 1)), L[q++] = J << 2 | D >>> 4, z |= J & x, z |= D & x), j < S - 2 && (H = this._decodeChar(d.charCodeAt(j + 2)), L[q++] = D << 4 | H >>> 2, z |= H & x), j < S - 3 && (G = this._decodeChar(d.charCodeAt(j + 3)), L[q++] = H << 6 | G, z |= G & x), z !== 0)
|
|
1531
1557
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
1532
|
-
return
|
|
1558
|
+
return L;
|
|
1533
1559
|
}, _.prototype._encodeByte = function(d) {
|
|
1534
|
-
var
|
|
1535
|
-
return
|
|
1560
|
+
var f = d;
|
|
1561
|
+
return f += 65, f += 25 - d >>> 8 & 6, f += 51 - d >>> 8 & -75, f += 61 - d >>> 8 & -15, f += 62 - d >>> 8 & 3, String.fromCharCode(f);
|
|
1536
1562
|
}, _.prototype._decodeChar = function(d) {
|
|
1537
|
-
var
|
|
1538
|
-
return
|
|
1563
|
+
var f = x;
|
|
1564
|
+
return f += (42 - d & d - 44) >>> 8 & -x + d - 43 + 62, f += (46 - d & d - 48) >>> 8 & -x + d - 47 + 63, f += (47 - d & d - 58) >>> 8 & -x + d - 48 + 52, f += (64 - d & d - 91) >>> 8 & -x + d - 65 + 0, f += (96 - d & d - 123) >>> 8 & -x + d - 97 + 26, f;
|
|
1539
1565
|
}, _.prototype._getPaddingLength = function(d) {
|
|
1540
|
-
var
|
|
1566
|
+
var f = 0;
|
|
1541
1567
|
if (this._paddingCharacter) {
|
|
1542
1568
|
for (var S = d.length - 1; S >= 0 && d[S] === this._paddingCharacter; S--)
|
|
1543
|
-
|
|
1544
|
-
if (d.length < 4 ||
|
|
1569
|
+
f++;
|
|
1570
|
+
if (d.length < 4 || f > 2)
|
|
1545
1571
|
throw new Error("Base64Coder: incorrect padding");
|
|
1546
1572
|
}
|
|
1547
|
-
return
|
|
1573
|
+
return f;
|
|
1548
1574
|
}, _;
|
|
1549
1575
|
})()
|
|
1550
1576
|
);
|
|
@@ -1565,23 +1591,23 @@ function Gi() {
|
|
|
1565
1591
|
function d() {
|
|
1566
1592
|
return _ !== null && _.apply(this, arguments) || this;
|
|
1567
1593
|
}
|
|
1568
|
-
return d.prototype._encodeByte = function(
|
|
1569
|
-
var S =
|
|
1570
|
-
return S += 65, S += 25 -
|
|
1571
|
-
}, d.prototype._decodeChar = function(
|
|
1594
|
+
return d.prototype._encodeByte = function(f) {
|
|
1595
|
+
var S = f;
|
|
1596
|
+
return S += 65, S += 25 - f >>> 8 & 6, S += 51 - f >>> 8 & -75, S += 61 - f >>> 8 & -13, S += 62 - f >>> 8 & 49, String.fromCharCode(S);
|
|
1597
|
+
}, d.prototype._decodeChar = function(f) {
|
|
1572
1598
|
var S = x;
|
|
1573
|
-
return S += (44 -
|
|
1599
|
+
return S += (44 - f & f - 46) >>> 8 & -x + f - 45 + 62, S += (94 - f & f - 96) >>> 8 & -x + f - 95 + 63, S += (47 - f & f - 58) >>> 8 & -x + f - 48 + 52, S += (64 - f & f - 91) >>> 8 & -x + f - 65 + 0, S += (96 - f & f - 123) >>> 8 & -x + f - 97 + 26, S;
|
|
1574
1600
|
}, d;
|
|
1575
1601
|
})(w)
|
|
1576
1602
|
);
|
|
1577
1603
|
g.URLSafeCoder = W;
|
|
1578
|
-
var
|
|
1604
|
+
var N = new W();
|
|
1579
1605
|
function F(_) {
|
|
1580
|
-
return
|
|
1606
|
+
return N.encode(_);
|
|
1581
1607
|
}
|
|
1582
1608
|
g.encodeURLSafe = F;
|
|
1583
1609
|
function te(_) {
|
|
1584
|
-
return
|
|
1610
|
+
return N.decode(_);
|
|
1585
1611
|
}
|
|
1586
1612
|
g.decodeURLSafe = te, g.encodedLength = function(_) {
|
|
1587
1613
|
return R.encodedLength(_);
|
|
@@ -1602,24 +1628,24 @@ function Gi() {
|
|
|
1602
1628
|
if (A < 224) {
|
|
1603
1629
|
if (T >= w.length)
|
|
1604
1630
|
throw new Error(y);
|
|
1605
|
-
var
|
|
1606
|
-
if ((
|
|
1631
|
+
var N = w[++T];
|
|
1632
|
+
if ((N & 192) !== 128)
|
|
1607
1633
|
throw new Error(y);
|
|
1608
|
-
A = (A & 31) << 6 |
|
|
1634
|
+
A = (A & 31) << 6 | N & 63, W = 128;
|
|
1609
1635
|
} else if (A < 240) {
|
|
1610
1636
|
if (T >= w.length - 1)
|
|
1611
1637
|
throw new Error(y);
|
|
1612
|
-
var
|
|
1613
|
-
if ((
|
|
1638
|
+
var N = w[++T], F = w[++T];
|
|
1639
|
+
if ((N & 192) !== 128 || (F & 192) !== 128)
|
|
1614
1640
|
throw new Error(y);
|
|
1615
|
-
A = (A & 15) << 12 | (
|
|
1641
|
+
A = (A & 15) << 12 | (N & 63) << 6 | F & 63, W = 2048;
|
|
1616
1642
|
} else if (A < 248) {
|
|
1617
1643
|
if (T >= w.length - 2)
|
|
1618
1644
|
throw new Error(y);
|
|
1619
|
-
var
|
|
1620
|
-
if ((
|
|
1645
|
+
var N = w[++T], F = w[++T], te = w[++T];
|
|
1646
|
+
if ((N & 192) !== 128 || (F & 192) !== 128 || (te & 192) !== 128)
|
|
1621
1647
|
throw new Error(y);
|
|
1622
|
-
A = (A & 15) << 18 | (
|
|
1648
|
+
A = (A & 15) << 18 | (N & 63) << 12 | (F & 63) << 6 | te & 63, W = 65536;
|
|
1623
1649
|
} else
|
|
1624
1650
|
throw new Error(y);
|
|
1625
1651
|
if (A < W || A >= 55296 && A <= 57343)
|
|
@@ -1702,14 +1728,14 @@ function Gi() {
|
|
|
1702
1728
|
s.loading[e].push(r);
|
|
1703
1729
|
else {
|
|
1704
1730
|
s.loading[e] = [r];
|
|
1705
|
-
var c = C.createScriptRequest(s.getPath(e, t)), l = s.receivers.create(function(
|
|
1731
|
+
var c = C.createScriptRequest(s.getPath(e, t)), l = s.receivers.create(function(p) {
|
|
1706
1732
|
if (s.receivers.remove(l), s.loading[e]) {
|
|
1707
1733
|
var b = s.loading[e];
|
|
1708
1734
|
delete s.loading[e];
|
|
1709
|
-
for (var
|
|
1735
|
+
for (var E = function(I) {
|
|
1710
1736
|
I || c.cleanup();
|
|
1711
|
-
},
|
|
1712
|
-
b[
|
|
1737
|
+
}, k = 0; k < b.length; k++)
|
|
1738
|
+
b[k](p, E);
|
|
1713
1739
|
}
|
|
1714
1740
|
});
|
|
1715
1741
|
c.send(l);
|
|
@@ -1723,7 +1749,7 @@ function Gi() {
|
|
|
1723
1749
|
return this.getRoot(t) + "/" + e + this.options.suffix + ".js";
|
|
1724
1750
|
}
|
|
1725
1751
|
}
|
|
1726
|
-
var W = new x("_pusher_dependencies", "Pusher.DependenciesReceivers"),
|
|
1752
|
+
var W = new x("_pusher_dependencies", "Pusher.DependenciesReceivers"), N = new A({
|
|
1727
1753
|
cdn_http: T.cdn_http,
|
|
1728
1754
|
cdn_https: T.cdn_https,
|
|
1729
1755
|
version: T.VERSION,
|
|
@@ -1760,7 +1786,7 @@ function Gi() {
|
|
|
1760
1786
|
(function(n) {
|
|
1761
1787
|
n.UserAuthentication = "user-authentication", n.ChannelAuthorization = "channel-authorization";
|
|
1762
1788
|
})(d || (d = {}));
|
|
1763
|
-
class
|
|
1789
|
+
class f extends Error {
|
|
1764
1790
|
constructor(e) {
|
|
1765
1791
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1766
1792
|
}
|
|
@@ -1770,7 +1796,7 @@ function Gi() {
|
|
|
1770
1796
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1771
1797
|
}
|
|
1772
1798
|
}
|
|
1773
|
-
class
|
|
1799
|
+
class L extends Error {
|
|
1774
1800
|
constructor(e) {
|
|
1775
1801
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1776
1802
|
}
|
|
@@ -1780,12 +1806,12 @@ function Gi() {
|
|
|
1780
1806
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1781
1807
|
}
|
|
1782
1808
|
}
|
|
1783
|
-
class
|
|
1809
|
+
class j extends Error {
|
|
1784
1810
|
constructor(e) {
|
|
1785
1811
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1786
1812
|
}
|
|
1787
1813
|
}
|
|
1788
|
-
class
|
|
1814
|
+
class z extends Error {
|
|
1789
1815
|
constructor(e) {
|
|
1790
1816
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1791
1817
|
}
|
|
@@ -1795,51 +1821,51 @@ function Gi() {
|
|
|
1795
1821
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1796
1822
|
}
|
|
1797
1823
|
}
|
|
1798
|
-
class
|
|
1824
|
+
class D extends Error {
|
|
1799
1825
|
constructor(e) {
|
|
1800
1826
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1801
1827
|
}
|
|
1802
1828
|
}
|
|
1803
|
-
class
|
|
1829
|
+
class H extends Error {
|
|
1804
1830
|
constructor(e, t) {
|
|
1805
1831
|
super(t), this.status = e, Object.setPrototypeOf(this, new.target.prototype);
|
|
1806
1832
|
}
|
|
1807
1833
|
}
|
|
1808
|
-
const
|
|
1834
|
+
const Lt = function(n, e, t, r, s) {
|
|
1809
1835
|
const c = C.createXHR();
|
|
1810
1836
|
c.open("POST", t.endpoint, !0), c.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
1811
1837
|
for (var l in t.headers)
|
|
1812
1838
|
c.setRequestHeader(l, t.headers[l]);
|
|
1813
1839
|
if (t.headersProvider != null) {
|
|
1814
|
-
let
|
|
1815
|
-
for (var l in
|
|
1816
|
-
c.setRequestHeader(l,
|
|
1840
|
+
let p = t.headersProvider();
|
|
1841
|
+
for (var l in p)
|
|
1842
|
+
c.setRequestHeader(l, p[l]);
|
|
1817
1843
|
}
|
|
1818
1844
|
return c.onreadystatechange = function() {
|
|
1819
1845
|
if (c.readyState === 4)
|
|
1820
1846
|
if (c.status === 200) {
|
|
1821
|
-
let
|
|
1847
|
+
let p, b = !1;
|
|
1822
1848
|
try {
|
|
1823
|
-
|
|
1849
|
+
p = JSON.parse(c.responseText), b = !0;
|
|
1824
1850
|
} catch {
|
|
1825
|
-
s(new
|
|
1851
|
+
s(new H(200, `JSON returned from ${r.toString()} endpoint was invalid, yet status code was 200. Data was: ${c.responseText}`), null);
|
|
1826
1852
|
}
|
|
1827
|
-
b && s(null,
|
|
1853
|
+
b && s(null, p);
|
|
1828
1854
|
} else {
|
|
1829
|
-
let
|
|
1855
|
+
let p = "";
|
|
1830
1856
|
switch (r) {
|
|
1831
1857
|
case d.UserAuthentication:
|
|
1832
|
-
|
|
1858
|
+
p = _.buildLogSuffix("authenticationEndpoint");
|
|
1833
1859
|
break;
|
|
1834
1860
|
case d.ChannelAuthorization:
|
|
1835
|
-
|
|
1861
|
+
p = `Clients must be authorized to join private or presence channels. ${_.buildLogSuffix("authorizationEndpoint")}`;
|
|
1836
1862
|
break;
|
|
1837
1863
|
}
|
|
1838
|
-
s(new
|
|
1864
|
+
s(new H(c.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${c.status} from ${t.endpoint}. ${p}`), null);
|
|
1839
1865
|
}
|
|
1840
1866
|
}, c.send(e), c;
|
|
1841
1867
|
};
|
|
1842
|
-
function
|
|
1868
|
+
function Pt(n) {
|
|
1843
1869
|
return qt(It(n));
|
|
1844
1870
|
}
|
|
1845
1871
|
var ne = String.fromCharCode, oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Rt = function(n) {
|
|
@@ -1871,33 +1897,33 @@ function Gi() {
|
|
|
1871
1897
|
this.timer && (this.clear(this.timer), this.timer = null);
|
|
1872
1898
|
}
|
|
1873
1899
|
}
|
|
1874
|
-
const
|
|
1875
|
-
function
|
|
1900
|
+
const ze = Ut;
|
|
1901
|
+
function Nt(n) {
|
|
1876
1902
|
window.clearTimeout(n);
|
|
1877
1903
|
}
|
|
1878
|
-
function
|
|
1904
|
+
function jt(n) {
|
|
1879
1905
|
window.clearInterval(n);
|
|
1880
1906
|
}
|
|
1881
|
-
class
|
|
1907
|
+
class Y extends ze {
|
|
1882
1908
|
constructor(e, t) {
|
|
1883
|
-
super(setTimeout,
|
|
1909
|
+
super(setTimeout, Nt, e, function(r) {
|
|
1884
1910
|
return t(), null;
|
|
1885
1911
|
});
|
|
1886
1912
|
}
|
|
1887
1913
|
}
|
|
1888
|
-
class
|
|
1914
|
+
class Mt extends ze {
|
|
1889
1915
|
constructor(e, t) {
|
|
1890
|
-
super(setInterval,
|
|
1916
|
+
super(setInterval, jt, e, function(r) {
|
|
1891
1917
|
return t(), r;
|
|
1892
1918
|
});
|
|
1893
1919
|
}
|
|
1894
1920
|
}
|
|
1895
|
-
var
|
|
1921
|
+
var zt = {
|
|
1896
1922
|
now() {
|
|
1897
1923
|
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
|
|
1898
1924
|
},
|
|
1899
1925
|
defer(n) {
|
|
1900
|
-
return new
|
|
1926
|
+
return new Y(0, n);
|
|
1901
1927
|
},
|
|
1902
1928
|
method(n, ...e) {
|
|
1903
1929
|
var t = Array.prototype.slice.call(arguments, 1);
|
|
@@ -1906,21 +1932,21 @@ function Gi() {
|
|
|
1906
1932
|
};
|
|
1907
1933
|
}
|
|
1908
1934
|
};
|
|
1909
|
-
const U =
|
|
1910
|
-
function
|
|
1935
|
+
const U = zt;
|
|
1936
|
+
function M(n, ...e) {
|
|
1911
1937
|
for (var t = 0; t < e.length; t++) {
|
|
1912
1938
|
var r = e[t];
|
|
1913
1939
|
for (var s in r)
|
|
1914
|
-
r[s] && r[s].constructor && r[s].constructor === Object ? n[s] =
|
|
1940
|
+
r[s] && r[s].constructor && r[s].constructor === Object ? n[s] = M(n[s] || {}, r[s]) : n[s] = r[s];
|
|
1915
1941
|
}
|
|
1916
1942
|
return n;
|
|
1917
1943
|
}
|
|
1918
|
-
function
|
|
1944
|
+
function Ht() {
|
|
1919
1945
|
for (var n = ["Pusher"], e = 0; e < arguments.length; e++)
|
|
1920
1946
|
typeof arguments[e] == "string" ? n.push(arguments[e]) : n.push(ae(arguments[e]));
|
|
1921
1947
|
return n.join(" : ");
|
|
1922
1948
|
}
|
|
1923
|
-
function
|
|
1949
|
+
function He(n, e) {
|
|
1924
1950
|
var t = Array.prototype.indexOf;
|
|
1925
1951
|
if (n === null)
|
|
1926
1952
|
return -1;
|
|
@@ -1935,13 +1961,13 @@ function Gi() {
|
|
|
1935
1961
|
for (var t in n)
|
|
1936
1962
|
Object.prototype.hasOwnProperty.call(n, t) && e(n[t], t, n);
|
|
1937
1963
|
}
|
|
1938
|
-
function
|
|
1964
|
+
function De(n) {
|
|
1939
1965
|
var e = [];
|
|
1940
1966
|
return B(n, function(t, r) {
|
|
1941
1967
|
e.push(r);
|
|
1942
1968
|
}), e;
|
|
1943
1969
|
}
|
|
1944
|
-
function
|
|
1970
|
+
function Dt(n) {
|
|
1945
1971
|
var e = [];
|
|
1946
1972
|
return B(n, function(t) {
|
|
1947
1973
|
e.push(t);
|
|
@@ -1996,7 +2022,7 @@ function Gi() {
|
|
|
1996
2022
|
}
|
|
1997
2023
|
function $t(n) {
|
|
1998
2024
|
return Wt(n, function(e) {
|
|
1999
|
-
return typeof e == "object" && (e = ae(e)), encodeURIComponent(
|
|
2025
|
+
return typeof e == "object" && (e = ae(e)), encodeURIComponent(Pt(e.toString()));
|
|
2000
2026
|
});
|
|
2001
2027
|
}
|
|
2002
2028
|
function Xt(n) {
|
|
@@ -2005,10 +2031,10 @@ function Gi() {
|
|
|
2005
2031
|
}), t = We(Ft($t(e)), U.method("join", "=")).join("&");
|
|
2006
2032
|
return t;
|
|
2007
2033
|
}
|
|
2008
|
-
function
|
|
2034
|
+
function Vt(n) {
|
|
2009
2035
|
var e = [], t = [];
|
|
2010
2036
|
return (function r(s, c) {
|
|
2011
|
-
var l,
|
|
2037
|
+
var l, p, b;
|
|
2012
2038
|
switch (typeof s) {
|
|
2013
2039
|
case "object":
|
|
2014
2040
|
if (!s)
|
|
@@ -2021,8 +2047,8 @@ function Gi() {
|
|
|
2021
2047
|
b[l] = r(s[l], c + "[" + l + "]");
|
|
2022
2048
|
else {
|
|
2023
2049
|
b = {};
|
|
2024
|
-
for (
|
|
2025
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
2050
|
+
for (p in s)
|
|
2051
|
+
Object.prototype.hasOwnProperty.call(s, p) && (b[p] = r(s[p], c + "[" + JSON.stringify(p) + "]"));
|
|
2026
2052
|
}
|
|
2027
2053
|
return b;
|
|
2028
2054
|
case "number":
|
|
@@ -2036,10 +2062,10 @@ function Gi() {
|
|
|
2036
2062
|
try {
|
|
2037
2063
|
return JSON.stringify(n);
|
|
2038
2064
|
} catch {
|
|
2039
|
-
return JSON.stringify(
|
|
2065
|
+
return JSON.stringify(Vt(n));
|
|
2040
2066
|
}
|
|
2041
2067
|
}
|
|
2042
|
-
class
|
|
2068
|
+
class Jt {
|
|
2043
2069
|
constructor() {
|
|
2044
2070
|
this.globalLog = (e) => {
|
|
2045
2071
|
window.console && window.console.log && window.console.log(e);
|
|
@@ -2061,26 +2087,26 @@ function Gi() {
|
|
|
2061
2087
|
window.console && window.console.error ? window.console.error(e) : this.globalLogWarn(e);
|
|
2062
2088
|
}
|
|
2063
2089
|
log(e, ...t) {
|
|
2064
|
-
var r =
|
|
2090
|
+
var r = Ht.apply(this, arguments);
|
|
2065
2091
|
ue.log ? ue.log(r) : ue.logToConsole && e.bind(this)(r);
|
|
2066
2092
|
}
|
|
2067
2093
|
}
|
|
2068
|
-
const
|
|
2094
|
+
const P = new Jt();
|
|
2069
2095
|
var Gt = function(n, e, t, r, s) {
|
|
2070
|
-
(t.headers !== void 0 || t.headersProvider != null) &&
|
|
2096
|
+
(t.headers !== void 0 || t.headersProvider != null) && P.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
2071
2097
|
var c = n.nextAuthCallbackID.toString();
|
|
2072
2098
|
n.nextAuthCallbackID++;
|
|
2073
|
-
var l = n.getDocument(),
|
|
2074
|
-
n.auth_callbacks[c] = function(
|
|
2075
|
-
s(null,
|
|
2099
|
+
var l = n.getDocument(), p = l.createElement("script");
|
|
2100
|
+
n.auth_callbacks[c] = function(k) {
|
|
2101
|
+
s(null, k);
|
|
2076
2102
|
};
|
|
2077
2103
|
var b = "Pusher.auth_callbacks['" + c + "']";
|
|
2078
|
-
|
|
2079
|
-
var
|
|
2080
|
-
|
|
2104
|
+
p.src = t.endpoint + "?callback=" + encodeURIComponent(b) + "&" + e;
|
|
2105
|
+
var E = l.getElementsByTagName("head")[0] || l.documentElement;
|
|
2106
|
+
E.insertBefore(p, E.firstChild);
|
|
2081
2107
|
};
|
|
2082
2108
|
const Yt = Gt;
|
|
2083
|
-
class
|
|
2109
|
+
class Kt {
|
|
2084
2110
|
constructor(e) {
|
|
2085
2111
|
this.src = e;
|
|
2086
2112
|
}
|
|
@@ -2100,7 +2126,7 @@ function Gi() {
|
|
|
2100
2126
|
this.script && (this.script.onload = this.script.onerror = null, this.script.onreadystatechange = null), this.script && this.script.parentNode && this.script.parentNode.removeChild(this.script), this.errorScript && this.errorScript.parentNode && this.errorScript.parentNode.removeChild(this.errorScript), this.script = null, this.errorScript = null;
|
|
2101
2127
|
}
|
|
2102
2128
|
}
|
|
2103
|
-
class
|
|
2129
|
+
class Qt {
|
|
2104
2130
|
constructor(e, t) {
|
|
2105
2131
|
this.url = e, this.data = t;
|
|
2106
2132
|
}
|
|
@@ -2116,40 +2142,40 @@ function Gi() {
|
|
|
2116
2142
|
}
|
|
2117
2143
|
var Zt = function(n, e) {
|
|
2118
2144
|
return function(t, r) {
|
|
2119
|
-
var s = "http" + (e ? "s" : "") + "://", c = s + (n.host || n.options.host) + n.options.path, l = C.createJSONPRequest(c, t),
|
|
2120
|
-
w.remove(
|
|
2145
|
+
var s = "http" + (e ? "s" : "") + "://", c = s + (n.host || n.options.host) + n.options.path, l = C.createJSONPRequest(c, t), p = C.ScriptReceivers.create(function(b, E) {
|
|
2146
|
+
w.remove(p), l.cleanup(), E && E.host && (n.host = E.host), r && r(b, E);
|
|
2121
2147
|
});
|
|
2122
|
-
l.send(
|
|
2148
|
+
l.send(p);
|
|
2123
2149
|
};
|
|
2124
2150
|
}, en = {
|
|
2125
2151
|
name: "jsonp",
|
|
2126
2152
|
getAgent: Zt
|
|
2127
2153
|
};
|
|
2128
2154
|
const tn = en;
|
|
2129
|
-
function
|
|
2155
|
+
function ye(n, e, t) {
|
|
2130
2156
|
var r = n + (e.useTLS ? "s" : ""), s = e.useTLS ? e.hostTLS : e.hostNonTLS;
|
|
2131
2157
|
return r + "://" + s + t;
|
|
2132
2158
|
}
|
|
2133
|
-
function
|
|
2159
|
+
function be(n, e) {
|
|
2134
2160
|
var t = "/app/" + n, r = "?protocol=" + T.PROTOCOL + "&client=js&version=" + T.VERSION + (e ? "&" + e : "");
|
|
2135
2161
|
return t + r;
|
|
2136
2162
|
}
|
|
2137
2163
|
var nn = {
|
|
2138
2164
|
getInitial: function(n, e) {
|
|
2139
|
-
var t = (e.httpPath || "") +
|
|
2140
|
-
return
|
|
2165
|
+
var t = (e.httpPath || "") + be(n, "flash=false");
|
|
2166
|
+
return ye("ws", e, t);
|
|
2141
2167
|
}
|
|
2142
2168
|
}, rn = {
|
|
2143
2169
|
getInitial: function(n, e) {
|
|
2144
|
-
var t = (e.httpPath || "/pusher") +
|
|
2145
|
-
return
|
|
2170
|
+
var t = (e.httpPath || "/pusher") + be(n);
|
|
2171
|
+
return ye("http", e, t);
|
|
2146
2172
|
}
|
|
2147
2173
|
}, sn = {
|
|
2148
2174
|
getInitial: function(n, e) {
|
|
2149
|
-
return
|
|
2175
|
+
return ye("http", e, e.httpPath || "/pusher");
|
|
2150
2176
|
},
|
|
2151
2177
|
getPath: function(n, e) {
|
|
2152
|
-
return
|
|
2178
|
+
return be(n);
|
|
2153
2179
|
}
|
|
2154
2180
|
};
|
|
2155
2181
|
class on {
|
|
@@ -2157,10 +2183,10 @@ function Gi() {
|
|
|
2157
2183
|
this._callbacks = {};
|
|
2158
2184
|
}
|
|
2159
2185
|
get(e) {
|
|
2160
|
-
return this._callbacks[
|
|
2186
|
+
return this._callbacks[we(e)];
|
|
2161
2187
|
}
|
|
2162
2188
|
add(e, t, r) {
|
|
2163
|
-
var s =
|
|
2189
|
+
var s = we(e);
|
|
2164
2190
|
this._callbacks[s] = this._callbacks[s] || [], this._callbacks[s].push({
|
|
2165
2191
|
fn: t,
|
|
2166
2192
|
context: r
|
|
@@ -2171,7 +2197,7 @@ function Gi() {
|
|
|
2171
2197
|
this._callbacks = {};
|
|
2172
2198
|
return;
|
|
2173
2199
|
}
|
|
2174
|
-
var s = e ? [
|
|
2200
|
+
var s = e ? [we(e)] : De(this._callbacks);
|
|
2175
2201
|
t || r ? this.removeCallback(s, t, r) : this.removeAllCallbacks(s);
|
|
2176
2202
|
}
|
|
2177
2203
|
removeCallback(e, t, r) {
|
|
@@ -2187,7 +2213,7 @@ function Gi() {
|
|
|
2187
2213
|
}, this);
|
|
2188
2214
|
}
|
|
2189
2215
|
}
|
|
2190
|
-
function
|
|
2216
|
+
function we(n) {
|
|
2191
2217
|
return "_" + n;
|
|
2192
2218
|
}
|
|
2193
2219
|
class $ {
|
|
@@ -2241,7 +2267,7 @@ function Gi() {
|
|
|
2241
2267
|
this.onError(t), this.changeState("closed");
|
|
2242
2268
|
}), !1;
|
|
2243
2269
|
}
|
|
2244
|
-
return this.bindListeners(),
|
|
2270
|
+
return this.bindListeners(), P.debug("Connecting", { transport: this.name, url: e }), this.changeState("connecting"), !0;
|
|
2245
2271
|
}
|
|
2246
2272
|
close() {
|
|
2247
2273
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
@@ -2296,7 +2322,7 @@ function Gi() {
|
|
|
2296
2322
|
})), this.emit(e, t);
|
|
2297
2323
|
}
|
|
2298
2324
|
buildTimelineMessage(e) {
|
|
2299
|
-
return
|
|
2325
|
+
return M({ cid: this.id }, e);
|
|
2300
2326
|
}
|
|
2301
2327
|
}
|
|
2302
2328
|
class ee {
|
|
@@ -2330,11 +2356,11 @@ function Gi() {
|
|
|
2330
2356
|
isInitialized: function() {
|
|
2331
2357
|
return !0;
|
|
2332
2358
|
}
|
|
2333
|
-
},
|
|
2359
|
+
}, Ve = M({
|
|
2334
2360
|
getSocket: function(n) {
|
|
2335
2361
|
return C.HTTPFactory.createStreamingSocket(n);
|
|
2336
2362
|
}
|
|
2337
|
-
}, Xe),
|
|
2363
|
+
}, Xe), Je = M({
|
|
2338
2364
|
getSocket: function(n) {
|
|
2339
2365
|
return C.HTTPFactory.createPollingSocket(n);
|
|
2340
2366
|
}
|
|
@@ -2342,7 +2368,7 @@ function Gi() {
|
|
|
2342
2368
|
isSupported: function() {
|
|
2343
2369
|
return C.isXHRSupported();
|
|
2344
2370
|
}
|
|
2345
|
-
}, hn = new ee(
|
|
2371
|
+
}, hn = new ee(M({}, Ve, Ge)), ln = new ee(M({}, Je, Ge)), un = {
|
|
2346
2372
|
ws: cn,
|
|
2347
2373
|
xhr_streaming: hn,
|
|
2348
2374
|
xhr_polling: ln
|
|
@@ -2361,7 +2387,7 @@ function Gi() {
|
|
|
2361
2387
|
},
|
|
2362
2388
|
getSocket: function(n, e) {
|
|
2363
2389
|
return new window.SockJS(n, null, {
|
|
2364
|
-
js_path:
|
|
2390
|
+
js_path: N.getPath("sockjs", {
|
|
2365
2391
|
useTLS: e.useTLS
|
|
2366
2392
|
}),
|
|
2367
2393
|
ignore_null_origin: e.ignoreNullOrigin
|
|
@@ -2377,8 +2403,8 @@ function Gi() {
|
|
|
2377
2403
|
var e = C.isXDRSupported(n.useTLS);
|
|
2378
2404
|
return e;
|
|
2379
2405
|
}
|
|
2380
|
-
},
|
|
2381
|
-
ce.xdr_streaming =
|
|
2406
|
+
}, fn = new ee(M({}, Ve, Ye)), pn = new ee(M({}, Je, Ye));
|
|
2407
|
+
ce.xdr_streaming = fn, ce.xdr_polling = pn, ce.sockjs = dn;
|
|
2382
2408
|
const mn = ce;
|
|
2383
2409
|
class gn extends $ {
|
|
2384
2410
|
constructor() {
|
|
@@ -2400,26 +2426,26 @@ function Gi() {
|
|
|
2400
2426
|
this.manager = e, this.transport = t, this.minPingDelay = r.minPingDelay, this.maxPingDelay = r.maxPingDelay, this.pingDelay = void 0;
|
|
2401
2427
|
}
|
|
2402
2428
|
createConnection(e, t, r, s) {
|
|
2403
|
-
s =
|
|
2429
|
+
s = M({}, s, {
|
|
2404
2430
|
activityTimeout: this.pingDelay
|
|
2405
2431
|
});
|
|
2406
|
-
var c = this.transport.createConnection(e, t, r, s), l = null,
|
|
2407
|
-
c.unbind("open",
|
|
2408
|
-
}, b = (
|
|
2409
|
-
if (c.unbind("closed", b),
|
|
2432
|
+
var c = this.transport.createConnection(e, t, r, s), l = null, p = function() {
|
|
2433
|
+
c.unbind("open", p), c.bind("closed", b), l = U.now();
|
|
2434
|
+
}, b = (E) => {
|
|
2435
|
+
if (c.unbind("closed", b), E.code === 1002 || E.code === 1003)
|
|
2410
2436
|
this.manager.reportDeath();
|
|
2411
|
-
else if (!
|
|
2412
|
-
var
|
|
2413
|
-
|
|
2437
|
+
else if (!E.wasClean && l) {
|
|
2438
|
+
var k = U.now() - l;
|
|
2439
|
+
k < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(k / 2, this.minPingDelay));
|
|
2414
2440
|
}
|
|
2415
2441
|
};
|
|
2416
|
-
return c.bind("open",
|
|
2442
|
+
return c.bind("open", p), c;
|
|
2417
2443
|
}
|
|
2418
2444
|
isSupported(e) {
|
|
2419
2445
|
return this.manager.isAlive() && this.transport.isSupported(e);
|
|
2420
2446
|
}
|
|
2421
2447
|
}
|
|
2422
|
-
const
|
|
2448
|
+
const Ke = {
|
|
2423
2449
|
decodeMessage: function(n) {
|
|
2424
2450
|
try {
|
|
2425
2451
|
var e = JSON.parse(n.data), t = e.data;
|
|
@@ -2442,7 +2468,7 @@ function Gi() {
|
|
|
2442
2468
|
return JSON.stringify(n);
|
|
2443
2469
|
},
|
|
2444
2470
|
processHandshake: function(n) {
|
|
2445
|
-
var e =
|
|
2471
|
+
var e = Ke.decodeMessage(n);
|
|
2446
2472
|
if (e.event === "pusher:connection_established") {
|
|
2447
2473
|
if (!e.data.activity_timeout)
|
|
2448
2474
|
throw "No activity timeout specified in handshake";
|
|
@@ -2472,7 +2498,7 @@ function Gi() {
|
|
|
2472
2498
|
}
|
|
2473
2499
|
} : null;
|
|
2474
2500
|
}
|
|
2475
|
-
},
|
|
2501
|
+
}, K = Ke;
|
|
2476
2502
|
class bn extends $ {
|
|
2477
2503
|
constructor(e, t) {
|
|
2478
2504
|
super(), this.id = e, this.transport = t, this.activityTimeout = t.activityTimeout, this.bindListeners();
|
|
@@ -2485,7 +2511,7 @@ function Gi() {
|
|
|
2485
2511
|
}
|
|
2486
2512
|
send_event(e, t, r) {
|
|
2487
2513
|
var s = { event: e, data: t };
|
|
2488
|
-
return r && (s.channel = r),
|
|
2514
|
+
return r && (s.channel = r), P.debug("Event sent", s), this.send(K.encodeMessage(s));
|
|
2489
2515
|
}
|
|
2490
2516
|
ping() {
|
|
2491
2517
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -2498,7 +2524,7 @@ function Gi() {
|
|
|
2498
2524
|
message: (r) => {
|
|
2499
2525
|
var s;
|
|
2500
2526
|
try {
|
|
2501
|
-
s =
|
|
2527
|
+
s = K.decodeMessage(r);
|
|
2502
2528
|
} catch (c) {
|
|
2503
2529
|
this.emit("error", {
|
|
2504
2530
|
type: "MessageParseError",
|
|
@@ -2507,7 +2533,7 @@ function Gi() {
|
|
|
2507
2533
|
});
|
|
2508
2534
|
}
|
|
2509
2535
|
if (s !== void 0) {
|
|
2510
|
-
switch (
|
|
2536
|
+
switch (P.debug("Event recd", s), s.event) {
|
|
2511
2537
|
case "pusher:error":
|
|
2512
2538
|
this.emit("error", {
|
|
2513
2539
|
type: "PusherError",
|
|
@@ -2543,7 +2569,7 @@ function Gi() {
|
|
|
2543
2569
|
});
|
|
2544
2570
|
}
|
|
2545
2571
|
handleCloseEvent(e) {
|
|
2546
|
-
var t =
|
|
2572
|
+
var t = K.getCloseAction(e), r = K.getCloseError(e);
|
|
2547
2573
|
r && this.emit("error", r), t && this.emit(t, { action: t, error: r });
|
|
2548
2574
|
}
|
|
2549
2575
|
}
|
|
@@ -2559,7 +2585,7 @@ function Gi() {
|
|
|
2559
2585
|
this.unbindListeners();
|
|
2560
2586
|
var t;
|
|
2561
2587
|
try {
|
|
2562
|
-
t =
|
|
2588
|
+
t = K.processHandshake(e);
|
|
2563
2589
|
} catch (r) {
|
|
2564
2590
|
this.finish("error", { error: r }), this.transport.close();
|
|
2565
2591
|
return;
|
|
@@ -2570,7 +2596,7 @@ function Gi() {
|
|
|
2570
2596
|
}) : (this.finish(t.action, { error: t.error }), this.transport.close());
|
|
2571
2597
|
}, this.onClosed = (e) => {
|
|
2572
2598
|
this.unbindListeners();
|
|
2573
|
-
var t =
|
|
2599
|
+
var t = K.getCloseAction(e) || "backoff", r = K.getCloseError(e);
|
|
2574
2600
|
this.finish(t, { error: r });
|
|
2575
2601
|
}, this.transport.bind("message", this.onMessage), this.transport.bind("closed", this.onClosed);
|
|
2576
2602
|
}
|
|
@@ -2578,7 +2604,7 @@ function Gi() {
|
|
|
2578
2604
|
this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
|
|
2579
2605
|
}
|
|
2580
2606
|
finish(e, t) {
|
|
2581
|
-
this.callback(
|
|
2607
|
+
this.callback(M({ transport: this.transport, action: e }, t));
|
|
2582
2608
|
}
|
|
2583
2609
|
}
|
|
2584
2610
|
class Cn {
|
|
@@ -2589,10 +2615,10 @@ function Gi() {
|
|
|
2589
2615
|
this.timeline.isEmpty() || this.timeline.send(C.TimelineTransport.getAgent(this, e), t);
|
|
2590
2616
|
}
|
|
2591
2617
|
}
|
|
2592
|
-
class
|
|
2618
|
+
class Ce extends $ {
|
|
2593
2619
|
constructor(e, t) {
|
|
2594
2620
|
super(function(r, s) {
|
|
2595
|
-
|
|
2621
|
+
P.debug("No callbacks on " + e + " for " + r);
|
|
2596
2622
|
}), this.name = e, this.pusher = t, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
2597
2623
|
}
|
|
2598
2624
|
authorize(e, t) {
|
|
@@ -2600,10 +2626,10 @@ function Gi() {
|
|
|
2600
2626
|
}
|
|
2601
2627
|
trigger(e, t) {
|
|
2602
2628
|
if (e.indexOf("client-") !== 0)
|
|
2603
|
-
throw new
|
|
2629
|
+
throw new f("Event '" + e + "' does not start with 'client-'");
|
|
2604
2630
|
if (!this.subscribed) {
|
|
2605
2631
|
var r = _.buildLogSuffix("triggeringClientEvents");
|
|
2606
|
-
|
|
2632
|
+
P.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`);
|
|
2607
2633
|
}
|
|
2608
2634
|
return this.pusher.send_event(e, t, this.name);
|
|
2609
2635
|
}
|
|
@@ -2629,10 +2655,10 @@ function Gi() {
|
|
|
2629
2655
|
}
|
|
2630
2656
|
subscribe() {
|
|
2631
2657
|
this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (e, t) => {
|
|
2632
|
-
e ? (this.subscriptionPending = !1,
|
|
2658
|
+
e ? (this.subscriptionPending = !1, P.error(e.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
|
|
2633
2659
|
type: "AuthError",
|
|
2634
2660
|
error: e.message
|
|
2635
|
-
}, e instanceof
|
|
2661
|
+
}, e instanceof H ? { status: e.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
|
|
2636
2662
|
auth: t.auth,
|
|
2637
2663
|
channel_data: t.channel_data,
|
|
2638
2664
|
channel: this.name
|
|
@@ -2651,7 +2677,7 @@ function Gi() {
|
|
|
2651
2677
|
this.subscriptionCancelled = !1;
|
|
2652
2678
|
}
|
|
2653
2679
|
}
|
|
2654
|
-
class
|
|
2680
|
+
class Se extends Ce {
|
|
2655
2681
|
authorize(e, t) {
|
|
2656
2682
|
return this.pusher.config.channelAuthorizer({
|
|
2657
2683
|
channelName: this.name,
|
|
@@ -2698,27 +2724,27 @@ function Gi() {
|
|
|
2698
2724
|
});
|
|
2699
2725
|
}
|
|
2700
2726
|
return new (t || (t = Promise))(function(c, l) {
|
|
2701
|
-
function
|
|
2727
|
+
function p(k) {
|
|
2702
2728
|
try {
|
|
2703
|
-
|
|
2729
|
+
E(r.next(k));
|
|
2704
2730
|
} catch (I) {
|
|
2705
2731
|
l(I);
|
|
2706
2732
|
}
|
|
2707
2733
|
}
|
|
2708
|
-
function b(
|
|
2734
|
+
function b(k) {
|
|
2709
2735
|
try {
|
|
2710
|
-
|
|
2736
|
+
E(r.throw(k));
|
|
2711
2737
|
} catch (I) {
|
|
2712
2738
|
l(I);
|
|
2713
2739
|
}
|
|
2714
2740
|
}
|
|
2715
|
-
function k
|
|
2716
|
-
|
|
2741
|
+
function E(k) {
|
|
2742
|
+
k.done ? c(k.value) : s(k.value).then(p, b);
|
|
2717
2743
|
}
|
|
2718
|
-
|
|
2744
|
+
E((r = r.apply(n, e || [])).next());
|
|
2719
2745
|
});
|
|
2720
2746
|
};
|
|
2721
|
-
class _n extends
|
|
2747
|
+
class _n extends Se {
|
|
2722
2748
|
constructor(e, t) {
|
|
2723
2749
|
super(e, t), this.members = new Sn();
|
|
2724
2750
|
}
|
|
@@ -2732,7 +2758,7 @@ function Gi() {
|
|
|
2732
2758
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
2733
2759
|
else {
|
|
2734
2760
|
let l = _.buildLogSuffix("authorizationEndpoint");
|
|
2735
|
-
|
|
2761
|
+
P.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${l}, or the user should be signed in.`), t("Invalid auth response");
|
|
2736
2762
|
return;
|
|
2737
2763
|
}
|
|
2738
2764
|
t(r, s);
|
|
@@ -2773,8 +2799,8 @@ function Gi() {
|
|
|
2773
2799
|
this.members.reset(), super.disconnect();
|
|
2774
2800
|
}
|
|
2775
2801
|
}
|
|
2776
|
-
var xn = y(978),
|
|
2777
|
-
class
|
|
2802
|
+
var xn = y(978), Te = y(594);
|
|
2803
|
+
class En extends Se {
|
|
2778
2804
|
constructor(e, t, r) {
|
|
2779
2805
|
super(e, t), this.key = null, this.nacl = r;
|
|
2780
2806
|
}
|
|
@@ -2789,11 +2815,11 @@ function Gi() {
|
|
|
2789
2815
|
t(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2790
2816
|
return;
|
|
2791
2817
|
}
|
|
2792
|
-
this.key = (0,
|
|
2818
|
+
this.key = (0, Te.decode)(c), delete s.shared_secret, t(null, s);
|
|
2793
2819
|
});
|
|
2794
2820
|
}
|
|
2795
2821
|
trigger(e, t) {
|
|
2796
|
-
throw new
|
|
2822
|
+
throw new z("Client events are not currently supported for encrypted channels");
|
|
2797
2823
|
}
|
|
2798
2824
|
handleEvent(e) {
|
|
2799
2825
|
var t = e.event, r = e.data;
|
|
@@ -2805,32 +2831,32 @@ function Gi() {
|
|
|
2805
2831
|
}
|
|
2806
2832
|
handleEncryptedEvent(e, t) {
|
|
2807
2833
|
if (!this.key) {
|
|
2808
|
-
|
|
2834
|
+
P.debug("Received encrypted event before key has been retrieved from the authEndpoint");
|
|
2809
2835
|
return;
|
|
2810
2836
|
}
|
|
2811
2837
|
if (!t.ciphertext || !t.nonce) {
|
|
2812
|
-
|
|
2838
|
+
P.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + t);
|
|
2813
2839
|
return;
|
|
2814
2840
|
}
|
|
2815
|
-
let r = (0,
|
|
2841
|
+
let r = (0, Te.decode)(t.ciphertext);
|
|
2816
2842
|
if (r.length < this.nacl.secretbox.overheadLength) {
|
|
2817
|
-
|
|
2843
|
+
P.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);
|
|
2818
2844
|
return;
|
|
2819
2845
|
}
|
|
2820
|
-
let s = (0,
|
|
2846
|
+
let s = (0, Te.decode)(t.nonce);
|
|
2821
2847
|
if (s.length < this.nacl.secretbox.nonceLength) {
|
|
2822
|
-
|
|
2848
|
+
P.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${s.length}`);
|
|
2823
2849
|
return;
|
|
2824
2850
|
}
|
|
2825
2851
|
let c = this.nacl.secretbox.open(r, s, this.key);
|
|
2826
2852
|
if (c === null) {
|
|
2827
|
-
|
|
2853
|
+
P.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (l, p) => {
|
|
2828
2854
|
if (l) {
|
|
2829
|
-
|
|
2855
|
+
P.error(`Failed to make a request to the authEndpoint: ${p}. Unable to fetch new key, so dropping encrypted event`);
|
|
2830
2856
|
return;
|
|
2831
2857
|
}
|
|
2832
2858
|
if (c = this.nacl.secretbox.open(r, s, this.key), c === null) {
|
|
2833
|
-
|
|
2859
|
+
P.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
2834
2860
|
return;
|
|
2835
2861
|
}
|
|
2836
2862
|
this.emit(e, this.getDataToEmit(c));
|
|
@@ -2848,7 +2874,7 @@ function Gi() {
|
|
|
2848
2874
|
}
|
|
2849
2875
|
}
|
|
2850
2876
|
}
|
|
2851
|
-
class
|
|
2877
|
+
class kn extends $ {
|
|
2852
2878
|
constructor(e, t) {
|
|
2853
2879
|
super(), this.state = "initialized", this.connection = null, this.key = e, this.options = t, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
|
|
2854
2880
|
var r = C.getNetwork();
|
|
@@ -2908,7 +2934,7 @@ function Gi() {
|
|
|
2908
2934
|
});
|
|
2909
2935
|
}
|
|
2910
2936
|
retryIn(e) {
|
|
2911
|
-
this.timeline.info({ action: "retry", delay: e }), e > 0 && this.emit("connecting_in", Math.round(e / 1e3)), this.retryTimer = new
|
|
2937
|
+
this.timeline.info({ action: "retry", delay: e }), e > 0 && this.emit("connecting_in", Math.round(e / 1e3)), this.retryTimer = new Y(e || 0, () => {
|
|
2912
2938
|
this.disconnectInternally(), this.connect();
|
|
2913
2939
|
});
|
|
2914
2940
|
}
|
|
@@ -2916,7 +2942,7 @@ function Gi() {
|
|
|
2916
2942
|
this.retryTimer && (this.retryTimer.ensureAborted(), this.retryTimer = null);
|
|
2917
2943
|
}
|
|
2918
2944
|
setUnavailableTimer() {
|
|
2919
|
-
this.unavailableTimer = new
|
|
2945
|
+
this.unavailableTimer = new Y(this.options.unavailableTimeout, () => {
|
|
2920
2946
|
this.updateState("unavailable");
|
|
2921
2947
|
});
|
|
2922
2948
|
}
|
|
@@ -2924,12 +2950,12 @@ function Gi() {
|
|
|
2924
2950
|
this.unavailableTimer && this.unavailableTimer.ensureAborted();
|
|
2925
2951
|
}
|
|
2926
2952
|
sendActivityCheck() {
|
|
2927
|
-
this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new
|
|
2953
|
+
this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new Y(this.options.pongTimeout, () => {
|
|
2928
2954
|
this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
|
|
2929
2955
|
});
|
|
2930
2956
|
}
|
|
2931
2957
|
resetActivityCheck() {
|
|
2932
|
-
this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new
|
|
2958
|
+
this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new Y(this.activityTimeout, () => {
|
|
2933
2959
|
this.sendActivityCheck();
|
|
2934
2960
|
}));
|
|
2935
2961
|
}
|
|
@@ -2937,7 +2963,7 @@ function Gi() {
|
|
|
2937
2963
|
this.activityTimer && this.activityTimer.ensureAborted();
|
|
2938
2964
|
}
|
|
2939
2965
|
buildConnectionCallbacks(e) {
|
|
2940
|
-
return
|
|
2966
|
+
return M({}, e, {
|
|
2941
2967
|
message: (t) => {
|
|
2942
2968
|
this.resetActivityCheck(), this.emit("message", t);
|
|
2943
2969
|
},
|
|
@@ -2956,7 +2982,7 @@ function Gi() {
|
|
|
2956
2982
|
});
|
|
2957
2983
|
}
|
|
2958
2984
|
buildHandshakeCallbacks(e) {
|
|
2959
|
-
return
|
|
2985
|
+
return M({}, e, {
|
|
2960
2986
|
connected: (t) => {
|
|
2961
2987
|
this.activityTimeout = Math.min(this.options.activityTimeout, t.activityTimeout, t.connection.activityTimeout || 1 / 0), this.clearUnavailableTimer(), this.setConnection(t.connection), this.socket_id = this.connection.id, this.updateState("connected", { socket_id: this.socket_id });
|
|
2962
2988
|
}
|
|
@@ -3000,7 +3026,7 @@ function Gi() {
|
|
|
3000
3026
|
var r = this.state;
|
|
3001
3027
|
if (this.state = e, r !== e) {
|
|
3002
3028
|
var s = e;
|
|
3003
|
-
s === "connected" && (s += " with new socket ID " + t.socket_id),
|
|
3029
|
+
s === "connected" && (s += " with new socket ID " + t.socket_id), P.debug("State changed", r + " -> " + s), this.timeline.info({ state: e, params: t }), this.emit("state_change", { previous: r, current: e }), this.emit(e, t);
|
|
3004
3030
|
}
|
|
3005
3031
|
}
|
|
3006
3032
|
shouldRetry() {
|
|
@@ -3012,10 +3038,10 @@ function Gi() {
|
|
|
3012
3038
|
this.channels = {};
|
|
3013
3039
|
}
|
|
3014
3040
|
add(e, t) {
|
|
3015
|
-
return this.channels[e] || (this.channels[e] =
|
|
3041
|
+
return this.channels[e] || (this.channels[e] = Ln(e, t)), this.channels[e];
|
|
3016
3042
|
}
|
|
3017
3043
|
all() {
|
|
3018
|
-
return
|
|
3044
|
+
return Dt(this.channels);
|
|
3019
3045
|
}
|
|
3020
3046
|
find(e) {
|
|
3021
3047
|
return this.channels[e];
|
|
@@ -3030,12 +3056,12 @@ function Gi() {
|
|
|
3030
3056
|
});
|
|
3031
3057
|
}
|
|
3032
3058
|
}
|
|
3033
|
-
function
|
|
3059
|
+
function Ln(n, e) {
|
|
3034
3060
|
if (n.indexOf("private-encrypted-") === 0) {
|
|
3035
3061
|
if (e.config.nacl)
|
|
3036
3062
|
return X.createEncryptedChannel(n, e, e.config.nacl);
|
|
3037
3063
|
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r = _.buildLogSuffix("encryptedChannelSupport");
|
|
3038
|
-
throw new
|
|
3064
|
+
throw new z(`${t}. ${r}`);
|
|
3039
3065
|
} else {
|
|
3040
3066
|
if (n.indexOf("private-") === 0)
|
|
3041
3067
|
return X.createPrivateChannel(n, e);
|
|
@@ -3046,24 +3072,24 @@ function Gi() {
|
|
|
3046
3072
|
return X.createChannel(n, e);
|
|
3047
3073
|
}
|
|
3048
3074
|
}
|
|
3049
|
-
var
|
|
3075
|
+
var Pn = {
|
|
3050
3076
|
createChannels() {
|
|
3051
3077
|
return new An();
|
|
3052
3078
|
},
|
|
3053
3079
|
createConnectionManager(n, e) {
|
|
3054
|
-
return new
|
|
3080
|
+
return new kn(n, e);
|
|
3055
3081
|
},
|
|
3056
3082
|
createChannel(n, e) {
|
|
3057
|
-
return new
|
|
3083
|
+
return new Ce(n, e);
|
|
3058
3084
|
},
|
|
3059
3085
|
createPrivateChannel(n, e) {
|
|
3060
|
-
return new
|
|
3086
|
+
return new Se(n, e);
|
|
3061
3087
|
},
|
|
3062
3088
|
createPresenceChannel(n, e) {
|
|
3063
3089
|
return new _n(n, e);
|
|
3064
3090
|
},
|
|
3065
3091
|
createEncryptedChannel(n, e, t) {
|
|
3066
|
-
return new
|
|
3092
|
+
return new En(n, e, t);
|
|
3067
3093
|
},
|
|
3068
3094
|
createTimelineSender(n, e) {
|
|
3069
3095
|
return new Cn(n, e);
|
|
@@ -3075,8 +3101,8 @@ function Gi() {
|
|
|
3075
3101
|
return new yn(n, e, t);
|
|
3076
3102
|
}
|
|
3077
3103
|
};
|
|
3078
|
-
const X =
|
|
3079
|
-
class
|
|
3104
|
+
const X = Pn;
|
|
3105
|
+
class Qe {
|
|
3080
3106
|
constructor(e) {
|
|
3081
3107
|
this.options = e || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
3082
3108
|
}
|
|
@@ -3101,10 +3127,10 @@ function Gi() {
|
|
|
3101
3127
|
return $e(this.strategies, U.method("isSupported"));
|
|
3102
3128
|
}
|
|
3103
3129
|
connect(e, t) {
|
|
3104
|
-
var r = this.strategies, s = 0, c = this.timeout, l = null,
|
|
3105
|
-
|
|
3130
|
+
var r = this.strategies, s = 0, c = this.timeout, l = null, p = (b, E) => {
|
|
3131
|
+
E ? t(null, E) : (s = s + 1, this.loop && (s = s % r.length), s < r.length ? (c && (c = c * 2, this.timeoutLimit && (c = Math.min(c, this.timeoutLimit))), l = this.tryStrategy(r[s], e, { timeout: c, failFast: this.failFast }, p)) : t(!0));
|
|
3106
3132
|
};
|
|
3107
|
-
return l = this.tryStrategy(r[s], e, { timeout: c, failFast: this.failFast },
|
|
3133
|
+
return l = this.tryStrategy(r[s], e, { timeout: c, failFast: this.failFast }, p), {
|
|
3108
3134
|
abort: function() {
|
|
3109
3135
|
l.abort();
|
|
3110
3136
|
},
|
|
@@ -3115,21 +3141,21 @@ function Gi() {
|
|
|
3115
3141
|
}
|
|
3116
3142
|
tryStrategy(e, t, r, s) {
|
|
3117
3143
|
var c = null, l = null;
|
|
3118
|
-
return r.timeout > 0 && (c = new
|
|
3144
|
+
return r.timeout > 0 && (c = new Y(r.timeout, function() {
|
|
3119
3145
|
l.abort(), s(!0);
|
|
3120
|
-
})), l = e.connect(t, function(
|
|
3121
|
-
|
|
3146
|
+
})), l = e.connect(t, function(p, b) {
|
|
3147
|
+
p && c && c.isRunning() && !r.failFast || (c && c.ensureAborted(), s(p, b));
|
|
3122
3148
|
}), {
|
|
3123
3149
|
abort: function() {
|
|
3124
3150
|
c && c.ensureAborted(), l.abort();
|
|
3125
3151
|
},
|
|
3126
|
-
forceMinPriority: function(
|
|
3127
|
-
l.forceMinPriority(
|
|
3152
|
+
forceMinPriority: function(p) {
|
|
3153
|
+
l.forceMinPriority(p);
|
|
3128
3154
|
}
|
|
3129
3155
|
};
|
|
3130
3156
|
}
|
|
3131
3157
|
}
|
|
3132
|
-
class
|
|
3158
|
+
class _e {
|
|
3133
3159
|
constructor(e) {
|
|
3134
3160
|
this.strategies = e;
|
|
3135
3161
|
}
|
|
@@ -3143,16 +3169,16 @@ function Gi() {
|
|
|
3143
3169
|
In(s) && t(!0);
|
|
3144
3170
|
return;
|
|
3145
3171
|
}
|
|
3146
|
-
ie(s, function(
|
|
3147
|
-
|
|
3172
|
+
ie(s, function(p) {
|
|
3173
|
+
p.forceMinPriority(l.transport.priority);
|
|
3148
3174
|
}), t(null, l);
|
|
3149
3175
|
};
|
|
3150
3176
|
});
|
|
3151
3177
|
}
|
|
3152
3178
|
}
|
|
3153
3179
|
function Rn(n, e, t) {
|
|
3154
|
-
var r = We(n, function(s, c, l,
|
|
3155
|
-
return s.connect(e, t(c,
|
|
3180
|
+
var r = We(n, function(s, c, l, p) {
|
|
3181
|
+
return s.connect(e, t(c, p));
|
|
3156
3182
|
});
|
|
3157
3183
|
return {
|
|
3158
3184
|
abort: function() {
|
|
@@ -3183,37 +3209,37 @@ function Gi() {
|
|
|
3183
3209
|
connect(e, t) {
|
|
3184
3210
|
var r = this.usingTLS, s = Un(r), c = s && s.cacheSkipCount ? s.cacheSkipCount : 0, l = [this.strategy];
|
|
3185
3211
|
if (s && s.timestamp + this.ttl >= U.now()) {
|
|
3186
|
-
var
|
|
3187
|
-
|
|
3212
|
+
var p = this.transports[s.transport];
|
|
3213
|
+
p && (["ws", "wss"].includes(s.transport) || c > 3 ? (this.timeline.info({
|
|
3188
3214
|
cached: !0,
|
|
3189
3215
|
transport: s.transport,
|
|
3190
3216
|
latency: s.latency
|
|
3191
|
-
}), l.push(new Q([
|
|
3217
|
+
}), l.push(new Q([p], {
|
|
3192
3218
|
timeout: s.latency * 2 + 1e3,
|
|
3193
3219
|
failFast: !0
|
|
3194
3220
|
}))) : c++);
|
|
3195
3221
|
}
|
|
3196
|
-
var b = U.now(),
|
|
3197
|
-
I ? (Ze(r), l.length > 0 ? (b = U.now(),
|
|
3222
|
+
var b = U.now(), E = l.pop().connect(e, function k(I, de) {
|
|
3223
|
+
I ? (Ze(r), l.length > 0 ? (b = U.now(), E = l.pop().connect(e, k)) : t(I)) : (Nn(r, de.transport.name, U.now() - b, c), t(null, de));
|
|
3198
3224
|
});
|
|
3199
3225
|
return {
|
|
3200
3226
|
abort: function() {
|
|
3201
|
-
|
|
3227
|
+
E.abort();
|
|
3202
3228
|
},
|
|
3203
|
-
forceMinPriority: function(
|
|
3204
|
-
e =
|
|
3229
|
+
forceMinPriority: function(k) {
|
|
3230
|
+
e = k, E && E.forceMinPriority(k);
|
|
3205
3231
|
}
|
|
3206
3232
|
};
|
|
3207
3233
|
}
|
|
3208
3234
|
}
|
|
3209
|
-
function
|
|
3235
|
+
function xe(n) {
|
|
3210
3236
|
return "pusherTransport" + (n ? "TLS" : "NonTLS");
|
|
3211
3237
|
}
|
|
3212
3238
|
function Un(n) {
|
|
3213
3239
|
var e = C.getLocalStorage();
|
|
3214
3240
|
if (e)
|
|
3215
3241
|
try {
|
|
3216
|
-
var t = e[
|
|
3242
|
+
var t = e[xe(n)];
|
|
3217
3243
|
if (t)
|
|
3218
3244
|
return JSON.parse(t);
|
|
3219
3245
|
} catch {
|
|
@@ -3221,11 +3247,11 @@ function Gi() {
|
|
|
3221
3247
|
}
|
|
3222
3248
|
return null;
|
|
3223
3249
|
}
|
|
3224
|
-
function
|
|
3250
|
+
function Nn(n, e, t, r) {
|
|
3225
3251
|
var s = C.getLocalStorage();
|
|
3226
3252
|
if (s)
|
|
3227
3253
|
try {
|
|
3228
|
-
s[
|
|
3254
|
+
s[xe(n)] = ae({
|
|
3229
3255
|
timestamp: U.now(),
|
|
3230
3256
|
transport: e,
|
|
3231
3257
|
latency: t,
|
|
@@ -3238,7 +3264,7 @@ function Gi() {
|
|
|
3238
3264
|
var e = C.getLocalStorage();
|
|
3239
3265
|
if (e)
|
|
3240
3266
|
try {
|
|
3241
|
-
delete e[
|
|
3267
|
+
delete e[xe(n)];
|
|
3242
3268
|
} catch {
|
|
3243
3269
|
}
|
|
3244
3270
|
}
|
|
@@ -3250,7 +3276,7 @@ function Gi() {
|
|
|
3250
3276
|
return this.strategy.isSupported();
|
|
3251
3277
|
}
|
|
3252
3278
|
connect(e, t) {
|
|
3253
|
-
var r = this.strategy, s, c = new
|
|
3279
|
+
var r = this.strategy, s, c = new Y(this.options.delay, function() {
|
|
3254
3280
|
s = r.connect(e, t);
|
|
3255
3281
|
});
|
|
3256
3282
|
return {
|
|
@@ -3276,7 +3302,7 @@ function Gi() {
|
|
|
3276
3302
|
return r.connect(e, t);
|
|
3277
3303
|
}
|
|
3278
3304
|
}
|
|
3279
|
-
class
|
|
3305
|
+
class jn {
|
|
3280
3306
|
constructor(e) {
|
|
3281
3307
|
this.strategy = e;
|
|
3282
3308
|
}
|
|
@@ -3295,11 +3321,11 @@ function Gi() {
|
|
|
3295
3321
|
return n.isSupported();
|
|
3296
3322
|
};
|
|
3297
3323
|
}
|
|
3298
|
-
var
|
|
3324
|
+
var Mn = function(n, e, t) {
|
|
3299
3325
|
var r = {};
|
|
3300
|
-
function s(dt, Ui,
|
|
3301
|
-
var
|
|
3302
|
-
return r[dt] =
|
|
3326
|
+
function s(dt, Ui, Ni, ji, Mi) {
|
|
3327
|
+
var ft = t(n, dt, Ui, Ni, ji, Mi);
|
|
3328
|
+
return r[dt] = ft, ft;
|
|
3303
3329
|
}
|
|
3304
3330
|
var c = Object.assign({}, e, {
|
|
3305
3331
|
hostNonTLS: n.wsHost + ":" + n.wsPort,
|
|
@@ -3307,7 +3333,7 @@ function Gi() {
|
|
|
3307
3333
|
httpPath: n.wsPath
|
|
3308
3334
|
}), l = Object.assign({}, c, {
|
|
3309
3335
|
useTLS: !0
|
|
3310
|
-
}),
|
|
3336
|
+
}), p = Object.assign({}, e, {
|
|
3311
3337
|
hostNonTLS: n.httpHost + ":" + n.httpPort,
|
|
3312
3338
|
hostTLS: n.httpHost + ":" + n.httpsPort,
|
|
3313
3339
|
httpPath: n.httpPath
|
|
@@ -3315,50 +3341,50 @@ function Gi() {
|
|
|
3315
3341
|
loop: !0,
|
|
3316
3342
|
timeout: 15e3,
|
|
3317
3343
|
timeoutLimit: 6e4
|
|
3318
|
-
},
|
|
3344
|
+
}, E = new Qe({
|
|
3319
3345
|
minPingDelay: 1e4,
|
|
3320
3346
|
maxPingDelay: n.activityTimeout
|
|
3321
|
-
}),
|
|
3347
|
+
}), k = new Qe({
|
|
3322
3348
|
lives: 2,
|
|
3323
3349
|
minPingDelay: 1e4,
|
|
3324
3350
|
maxPingDelay: n.activityTimeout
|
|
3325
|
-
}), I = s("ws", "ws", 3, c,
|
|
3351
|
+
}), I = s("ws", "ws", 3, c, E), de = s("wss", "ws", 3, l, E), Pi = s("sockjs", "sockjs", 1, p), ot = s("xhr_streaming", "xhr_streaming", 1, p, k), Ri = s("xdr_streaming", "xdr_streaming", 1, p, k), at = s("xhr_polling", "xhr_polling", 1, p), Ii = s("xdr_polling", "xdr_polling", 1, p), ct = new Q([I], b), Oi = new Q([de], b), qi = new Q([Pi], b), ht = new Q([
|
|
3326
3352
|
new re(se(ot), ot, Ri)
|
|
3327
3353
|
], b), lt = new Q([
|
|
3328
3354
|
new re(se(at), at, Ii)
|
|
3329
3355
|
], b), ut = new Q([
|
|
3330
|
-
new re(se(ht), new
|
|
3356
|
+
new re(se(ht), new _e([
|
|
3331
3357
|
ht,
|
|
3332
3358
|
new he(lt, { delay: 4e3 })
|
|
3333
3359
|
]), lt)
|
|
3334
|
-
], b),
|
|
3335
|
-
return e.useTLS ?
|
|
3360
|
+
], b), Ae = new re(se(ut), ut, qi), Le;
|
|
3361
|
+
return e.useTLS ? Le = new _e([
|
|
3336
3362
|
ct,
|
|
3337
|
-
new he(
|
|
3338
|
-
]) :
|
|
3363
|
+
new he(Ae, { delay: 2e3 })
|
|
3364
|
+
]) : Le = new _e([
|
|
3339
3365
|
ct,
|
|
3340
3366
|
new he(Oi, { delay: 2e3 }),
|
|
3341
|
-
new he(
|
|
3342
|
-
]), new qn(new
|
|
3367
|
+
new he(Ae, { delay: 5e3 })
|
|
3368
|
+
]), new qn(new jn(new re(se(I), Le, Ae)), r, {
|
|
3343
3369
|
ttl: 18e5,
|
|
3344
3370
|
timeline: e.timeline,
|
|
3345
3371
|
useTLS: e.useTLS
|
|
3346
3372
|
});
|
|
3347
3373
|
};
|
|
3348
|
-
const
|
|
3349
|
-
function
|
|
3374
|
+
const zn = Mn;
|
|
3375
|
+
function Hn() {
|
|
3350
3376
|
var n = this;
|
|
3351
3377
|
n.timeline.info(n.buildTimelineMessage({
|
|
3352
3378
|
transport: n.name + (n.options.useTLS ? "s" : "")
|
|
3353
|
-
})), n.hooks.isInitialized() ? n.changeState("initialized") : n.hooks.file ? (n.changeState("initializing"),
|
|
3379
|
+
})), n.hooks.isInitialized() ? n.changeState("initialized") : n.hooks.file ? (n.changeState("initializing"), N.load(n.hooks.file, { useTLS: n.options.useTLS }, function(e, t) {
|
|
3354
3380
|
n.hooks.isInitialized() ? (n.changeState("initialized"), t(!0)) : (e && n.onError(e), n.onClose(), t(!1));
|
|
3355
3381
|
})) : n.onClose();
|
|
3356
3382
|
}
|
|
3357
|
-
var
|
|
3383
|
+
var Dn = {
|
|
3358
3384
|
getRequest: function(n) {
|
|
3359
3385
|
var e = new window.XDomainRequest();
|
|
3360
3386
|
return e.ontimeout = function() {
|
|
3361
|
-
n.emit("error", new
|
|
3387
|
+
n.emit("error", new L()), n.close();
|
|
3362
3388
|
}, e.onerror = function(t) {
|
|
3363
3389
|
n.emit("error", t), n.close();
|
|
3364
3390
|
}, e.onprogress = function() {
|
|
@@ -3371,7 +3397,7 @@ function Gi() {
|
|
|
3371
3397
|
n.ontimeout = n.onerror = n.onprogress = n.onload = null, n.abort();
|
|
3372
3398
|
}
|
|
3373
3399
|
};
|
|
3374
|
-
const Wn =
|
|
3400
|
+
const Wn = Dn, Fn = 256 * 1024;
|
|
3375
3401
|
class Bn extends $ {
|
|
3376
3402
|
constructor(e, t, r) {
|
|
3377
3403
|
super(), this.hooks = e, this.method = t, this.url = r;
|
|
@@ -3403,15 +3429,15 @@ function Gi() {
|
|
|
3403
3429
|
return this.position === e.length && e.length > Fn;
|
|
3404
3430
|
}
|
|
3405
3431
|
}
|
|
3406
|
-
var
|
|
3432
|
+
var Ee;
|
|
3407
3433
|
(function(n) {
|
|
3408
3434
|
n[n.CONNECTING = 0] = "CONNECTING", n[n.OPEN = 1] = "OPEN", n[n.CLOSED = 3] = "CLOSED";
|
|
3409
|
-
})(
|
|
3410
|
-
const
|
|
3435
|
+
})(Ee || (Ee = {}));
|
|
3436
|
+
const Z = Ee;
|
|
3411
3437
|
var $n = 1;
|
|
3412
3438
|
class Xn {
|
|
3413
3439
|
constructor(e, t) {
|
|
3414
|
-
this.hooks = e, this.session = tt(1e3) + "/" + Yn(8), this.location =
|
|
3440
|
+
this.hooks = e, this.session = tt(1e3) + "/" + Yn(8), this.location = Vn(t), this.readyState = Z.CONNECTING, this.openStream();
|
|
3415
3441
|
}
|
|
3416
3442
|
send(e) {
|
|
3417
3443
|
return this.sendRaw(JSON.stringify([e]));
|
|
@@ -3423,9 +3449,9 @@ function Gi() {
|
|
|
3423
3449
|
this.onClose(e, t, !0);
|
|
3424
3450
|
}
|
|
3425
3451
|
sendRaw(e) {
|
|
3426
|
-
if (this.readyState ===
|
|
3452
|
+
if (this.readyState === Z.OPEN)
|
|
3427
3453
|
try {
|
|
3428
|
-
return C.createSocketRequest("POST", et(
|
|
3454
|
+
return C.createSocketRequest("POST", et(Jn(this.location, this.session))).start(e), !0;
|
|
3429
3455
|
} catch {
|
|
3430
3456
|
return !1;
|
|
3431
3457
|
}
|
|
@@ -3436,7 +3462,7 @@ function Gi() {
|
|
|
3436
3462
|
this.closeStream(), this.openStream();
|
|
3437
3463
|
}
|
|
3438
3464
|
onClose(e, t, r) {
|
|
3439
|
-
this.closeStream(), this.readyState =
|
|
3465
|
+
this.closeStream(), this.readyState = Z.CLOSED, this.onclose && this.onclose({
|
|
3440
3466
|
code: e,
|
|
3441
3467
|
reason: t,
|
|
3442
3468
|
wasClean: r
|
|
@@ -3444,7 +3470,7 @@ function Gi() {
|
|
|
3444
3470
|
}
|
|
3445
3471
|
onChunk(e) {
|
|
3446
3472
|
if (e.status === 200) {
|
|
3447
|
-
this.readyState ===
|
|
3473
|
+
this.readyState === Z.OPEN && this.onActivity();
|
|
3448
3474
|
var t, r = e.data.slice(0, 1);
|
|
3449
3475
|
switch (r) {
|
|
3450
3476
|
case "o":
|
|
@@ -3468,10 +3494,10 @@ function Gi() {
|
|
|
3468
3494
|
}
|
|
3469
3495
|
}
|
|
3470
3496
|
onOpen(e) {
|
|
3471
|
-
this.readyState ===
|
|
3497
|
+
this.readyState === Z.CONNECTING ? (e && e.hostname && (this.location.base = Gn(this.location.base, e.hostname)), this.readyState = Z.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
3472
3498
|
}
|
|
3473
3499
|
onEvent(e) {
|
|
3474
|
-
this.readyState ===
|
|
3500
|
+
this.readyState === Z.OPEN && this.onmessage && this.onmessage({ data: e });
|
|
3475
3501
|
}
|
|
3476
3502
|
onActivity() {
|
|
3477
3503
|
this.onactivity && this.onactivity();
|
|
@@ -3499,14 +3525,14 @@ function Gi() {
|
|
|
3499
3525
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
3500
3526
|
}
|
|
3501
3527
|
}
|
|
3502
|
-
function
|
|
3528
|
+
function Vn(n) {
|
|
3503
3529
|
var e = /([^\?]*)\/*(\??.*)/.exec(n);
|
|
3504
3530
|
return {
|
|
3505
3531
|
base: e[1],
|
|
3506
3532
|
queryString: e[2]
|
|
3507
3533
|
};
|
|
3508
3534
|
}
|
|
3509
|
-
function
|
|
3535
|
+
function Jn(n, e) {
|
|
3510
3536
|
return n.base + "/" + e + "/xhr_send";
|
|
3511
3537
|
}
|
|
3512
3538
|
function et(n) {
|
|
@@ -3525,8 +3551,8 @@ function Gi() {
|
|
|
3525
3551
|
e.push(tt(32).toString(32));
|
|
3526
3552
|
return e.join("");
|
|
3527
3553
|
}
|
|
3528
|
-
const
|
|
3529
|
-
var
|
|
3554
|
+
const Kn = Xn;
|
|
3555
|
+
var Qn = {
|
|
3530
3556
|
getReceiveURL: function(n, e) {
|
|
3531
3557
|
return n.base + "/" + e + "/xhr_streaming" + n.queryString;
|
|
3532
3558
|
},
|
|
@@ -3540,7 +3566,7 @@ function Gi() {
|
|
|
3540
3566
|
n.onClose(1006, "Connection interrupted (" + e + ")", !1);
|
|
3541
3567
|
}
|
|
3542
3568
|
};
|
|
3543
|
-
const Zn =
|
|
3569
|
+
const Zn = Qn;
|
|
3544
3570
|
var ei = {
|
|
3545
3571
|
getReceiveURL: function(n, e) {
|
|
3546
3572
|
return n.base + "/" + e + "/xhr" + n.queryString;
|
|
@@ -3582,7 +3608,7 @@ function Gi() {
|
|
|
3582
3608
|
return this.createSocket(ti, n);
|
|
3583
3609
|
},
|
|
3584
3610
|
createSocket(n, e) {
|
|
3585
|
-
return new
|
|
3611
|
+
return new Kn(n, e);
|
|
3586
3612
|
},
|
|
3587
3613
|
createXHR(n, e) {
|
|
3588
3614
|
return this.createRequest(ii, n, e);
|
|
@@ -3600,9 +3626,9 @@ function Gi() {
|
|
|
3600
3626
|
auth_callbacks: {},
|
|
3601
3627
|
ScriptReceivers: w,
|
|
3602
3628
|
DependenciesReceivers: W,
|
|
3603
|
-
getDefaultStrategy:
|
|
3629
|
+
getDefaultStrategy: zn,
|
|
3604
3630
|
Transports: mn,
|
|
3605
|
-
transportConnectionInitializer:
|
|
3631
|
+
transportConnectionInitializer: Hn,
|
|
3606
3632
|
HTTPFactory: nt,
|
|
3607
3633
|
TimelineTransport: tn,
|
|
3608
3634
|
getXHRAPI() {
|
|
@@ -3616,7 +3642,7 @@ function Gi() {
|
|
|
3616
3642
|
var e = () => {
|
|
3617
3643
|
this.onDocumentBody(n.ready);
|
|
3618
3644
|
};
|
|
3619
|
-
window.JSON ? e() :
|
|
3645
|
+
window.JSON ? e() : N.load("json2", {}, e);
|
|
3620
3646
|
},
|
|
3621
3647
|
getDocument() {
|
|
3622
3648
|
return document;
|
|
@@ -3625,7 +3651,7 @@ function Gi() {
|
|
|
3625
3651
|
return this.getDocument().location.protocol;
|
|
3626
3652
|
},
|
|
3627
3653
|
getAuthorizers() {
|
|
3628
|
-
return { ajax:
|
|
3654
|
+
return { ajax: Lt, jsonp: Yt };
|
|
3629
3655
|
},
|
|
3630
3656
|
onDocumentBody(n) {
|
|
3631
3657
|
document.body ? n() : setTimeout(() => {
|
|
@@ -3633,10 +3659,10 @@ function Gi() {
|
|
|
3633
3659
|
}, 0);
|
|
3634
3660
|
},
|
|
3635
3661
|
createJSONPRequest(n, e) {
|
|
3636
|
-
return new
|
|
3662
|
+
return new Qt(n, e);
|
|
3637
3663
|
},
|
|
3638
3664
|
createScriptRequest(n) {
|
|
3639
|
-
return new
|
|
3665
|
+
return new Kt(n);
|
|
3640
3666
|
},
|
|
3641
3667
|
getLocalStorage() {
|
|
3642
3668
|
try {
|
|
@@ -3690,17 +3716,17 @@ function Gi() {
|
|
|
3690
3716
|
}
|
|
3691
3717
|
};
|
|
3692
3718
|
const C = si;
|
|
3693
|
-
var
|
|
3719
|
+
var ke;
|
|
3694
3720
|
(function(n) {
|
|
3695
3721
|
n[n.ERROR = 3] = "ERROR", n[n.INFO = 6] = "INFO", n[n.DEBUG = 7] = "DEBUG";
|
|
3696
|
-
})(
|
|
3697
|
-
const le =
|
|
3722
|
+
})(ke || (ke = {}));
|
|
3723
|
+
const le = ke;
|
|
3698
3724
|
class oi {
|
|
3699
3725
|
constructor(e, t, r) {
|
|
3700
3726
|
this.key = e, this.session = t, this.events = [], this.options = r || {}, this.sent = 0, this.uniqueID = 0;
|
|
3701
3727
|
}
|
|
3702
3728
|
log(e, t) {
|
|
3703
|
-
e <= this.options.level && (this.events.push(
|
|
3729
|
+
e <= this.options.level && (this.events.push(M({}, t, { timestamp: U.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
3704
3730
|
}
|
|
3705
3731
|
error(e) {
|
|
3706
3732
|
this.log(le.ERROR, e);
|
|
@@ -3715,7 +3741,7 @@ function Gi() {
|
|
|
3715
3741
|
return this.events.length === 0;
|
|
3716
3742
|
}
|
|
3717
3743
|
send(e, t) {
|
|
3718
|
-
var r =
|
|
3744
|
+
var r = M({
|
|
3719
3745
|
session: this.session,
|
|
3720
3746
|
bundle: this.sent + 1,
|
|
3721
3747
|
key: this.key,
|
|
@@ -3746,25 +3772,25 @@ function Gi() {
|
|
|
3746
3772
|
if (this.isSupported()) {
|
|
3747
3773
|
if (this.priority < e)
|
|
3748
3774
|
return it(new q(), t);
|
|
3749
|
-
} else return it(new
|
|
3775
|
+
} else return it(new D(), t);
|
|
3750
3776
|
var r = !1, s = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), c = null, l = function() {
|
|
3751
3777
|
s.unbind("initialized", l), s.connect();
|
|
3752
|
-
},
|
|
3778
|
+
}, p = function() {
|
|
3753
3779
|
c = X.createHandshake(s, function(I) {
|
|
3754
|
-
r = !0,
|
|
3780
|
+
r = !0, k(), t(null, I);
|
|
3755
3781
|
});
|
|
3756
3782
|
}, b = function(I) {
|
|
3757
|
-
|
|
3758
|
-
}, k = function() {
|
|
3759
|
-
E();
|
|
3760
|
-
var I;
|
|
3761
|
-
I = ae(s), t(new N(I));
|
|
3783
|
+
k(), t(I);
|
|
3762
3784
|
}, E = function() {
|
|
3763
|
-
|
|
3785
|
+
k();
|
|
3786
|
+
var I;
|
|
3787
|
+
I = ae(s), t(new j(I));
|
|
3788
|
+
}, k = function() {
|
|
3789
|
+
s.unbind("initialized", l), s.unbind("open", p), s.unbind("error", b), s.unbind("closed", E);
|
|
3764
3790
|
};
|
|
3765
|
-
return s.bind("initialized", l), s.bind("open",
|
|
3791
|
+
return s.bind("initialized", l), s.bind("open", p), s.bind("error", b), s.bind("closed", E), s.initialize(), {
|
|
3766
3792
|
abort: () => {
|
|
3767
|
-
r || (
|
|
3793
|
+
r || (k(), c ? c.close() : s.close());
|
|
3768
3794
|
},
|
|
3769
3795
|
forceMinPriority: (I) => {
|
|
3770
3796
|
r || this.priority < I && (c ? c.close() : s.close());
|
|
@@ -3787,15 +3813,15 @@ function Gi() {
|
|
|
3787
3813
|
var l = ci[t];
|
|
3788
3814
|
if (!l)
|
|
3789
3815
|
throw new J(t);
|
|
3790
|
-
var
|
|
3791
|
-
return
|
|
3816
|
+
var p = (!n.enabledTransports || He(n.enabledTransports, e) !== -1) && (!n.disabledTransports || He(n.disabledTransports, e) === -1), b;
|
|
3817
|
+
return p ? (s = Object.assign({ ignoreNullOrigin: n.ignoreNullOrigin }, s), b = new ai(e, r, c ? c.getAssistant(l) : l, s)) : b = li, b;
|
|
3792
3818
|
}, li = {
|
|
3793
3819
|
isSupported: function() {
|
|
3794
3820
|
return !1;
|
|
3795
3821
|
},
|
|
3796
3822
|
connect: function(n, e) {
|
|
3797
3823
|
var t = U.defer(function() {
|
|
3798
|
-
e(new
|
|
3824
|
+
e(new D());
|
|
3799
3825
|
});
|
|
3800
3826
|
return {
|
|
3801
3827
|
abort: function() {
|
|
@@ -3811,7 +3837,7 @@ function Gi() {
|
|
|
3811
3837
|
throw "You must pass an options object";
|
|
3812
3838
|
if (n.cluster == null)
|
|
3813
3839
|
throw "Options object must provide a cluster";
|
|
3814
|
-
"disableStats" in n &&
|
|
3840
|
+
"disableStats" in n && P.warn("The disableStats option is deprecated in favor of enableStats");
|
|
3815
3841
|
}
|
|
3816
3842
|
const di = (n, e) => {
|
|
3817
3843
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
@@ -3823,14 +3849,14 @@ function Gi() {
|
|
|
3823
3849
|
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(s[r]);
|
|
3824
3850
|
}
|
|
3825
3851
|
return t;
|
|
3826
|
-
},
|
|
3852
|
+
}, fi = (n) => {
|
|
3827
3853
|
if (typeof C.getAuthorizers()[n.transport] > "u")
|
|
3828
3854
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3829
3855
|
return (e, t) => {
|
|
3830
3856
|
const r = di(e, n);
|
|
3831
3857
|
C.getAuthorizers()[n.transport](C, r, n, d.UserAuthentication, t);
|
|
3832
3858
|
};
|
|
3833
|
-
},
|
|
3859
|
+
}, pi = (n, e) => {
|
|
3834
3860
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
3835
3861
|
t += "&channel_name=" + encodeURIComponent(n.channelName);
|
|
3836
3862
|
for (var r in e.params)
|
|
@@ -3845,7 +3871,7 @@ function Gi() {
|
|
|
3845
3871
|
if (typeof C.getAuthorizers()[n.transport] > "u")
|
|
3846
3872
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3847
3873
|
return (e, t) => {
|
|
3848
|
-
const r =
|
|
3874
|
+
const r = pi(e, n);
|
|
3849
3875
|
C.getAuthorizers()[n.transport](C, r, n, d.ChannelAuthorization, t);
|
|
3850
3876
|
};
|
|
3851
3877
|
}, gi = (n, e, t) => {
|
|
@@ -3902,7 +3928,7 @@ function Gi() {
|
|
|
3902
3928
|
const st = (n) => "customHandler" in n && n.customHandler != null;
|
|
3903
3929
|
function Si(n) {
|
|
3904
3930
|
const e = Object.assign(Object.assign({}, T.userAuthentication), n.userAuthentication);
|
|
3905
|
-
return st(e) ? e.customHandler :
|
|
3931
|
+
return st(e) ? e.customHandler : fi(e);
|
|
3906
3932
|
}
|
|
3907
3933
|
function Ti(n, e) {
|
|
3908
3934
|
let t;
|
|
@@ -3924,7 +3950,7 @@ function Gi() {
|
|
|
3924
3950
|
class xi extends $ {
|
|
3925
3951
|
constructor(e) {
|
|
3926
3952
|
super(function(t, r) {
|
|
3927
|
-
|
|
3953
|
+
P.debug(`No callbacks on watchlist events for ${t}`);
|
|
3928
3954
|
}), this.pusher = e, this.bindWatchlistInternalEvent();
|
|
3929
3955
|
}
|
|
3930
3956
|
handleEvent(e) {
|
|
@@ -3939,20 +3965,20 @@ function Gi() {
|
|
|
3939
3965
|
});
|
|
3940
3966
|
}
|
|
3941
3967
|
}
|
|
3942
|
-
function
|
|
3968
|
+
function Ei() {
|
|
3943
3969
|
let n, e;
|
|
3944
3970
|
return { promise: new Promise((r, s) => {
|
|
3945
3971
|
n = r, e = s;
|
|
3946
3972
|
}), resolve: n, reject: e };
|
|
3947
3973
|
}
|
|
3948
|
-
const
|
|
3974
|
+
const ki = Ei;
|
|
3949
3975
|
class Ai extends $ {
|
|
3950
3976
|
constructor(e) {
|
|
3951
3977
|
super(function(t, r) {
|
|
3952
|
-
|
|
3978
|
+
P.debug("No callbacks on user for " + t);
|
|
3953
3979
|
}), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (t, r) => {
|
|
3954
3980
|
if (t) {
|
|
3955
|
-
|
|
3981
|
+
P.warn(`Error during signin: ${t}`), this._cleanup();
|
|
3956
3982
|
return;
|
|
3957
3983
|
}
|
|
3958
3984
|
this.pusher.send_event("pusher:signin", {
|
|
@@ -3978,11 +4004,11 @@ function Gi() {
|
|
|
3978
4004
|
try {
|
|
3979
4005
|
this.user_data = JSON.parse(e.user_data);
|
|
3980
4006
|
} catch {
|
|
3981
|
-
|
|
4007
|
+
P.error(`Failed parsing user data after signin: ${e.user_data}`), this._cleanup();
|
|
3982
4008
|
return;
|
|
3983
4009
|
}
|
|
3984
4010
|
if (typeof this.user_data.id != "string" || this.user_data.id === "") {
|
|
3985
|
-
|
|
4011
|
+
P.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
|
|
3986
4012
|
return;
|
|
3987
4013
|
}
|
|
3988
4014
|
this._signinDoneResolve(), this._subscribeChannels();
|
|
@@ -3991,7 +4017,7 @@ function Gi() {
|
|
|
3991
4017
|
const e = (t) => {
|
|
3992
4018
|
t.subscriptionPending && t.subscriptionCancelled ? t.reinstateSubscription() : !t.subscriptionPending && this.pusher.connection.state === "connected" && t.subscribe();
|
|
3993
4019
|
};
|
|
3994
|
-
this.serverToUserChannel = new
|
|
4020
|
+
this.serverToUserChannel = new Ce(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((t, r) => {
|
|
3995
4021
|
t.indexOf("pusher_internal:") === 0 || t.indexOf("pusher:") === 0 || this.emit(t, r);
|
|
3996
4022
|
}), e(this.serverToUserChannel);
|
|
3997
4023
|
}
|
|
@@ -4001,7 +4027,7 @@ function Gi() {
|
|
|
4001
4027
|
_newSigninPromiseIfNeeded() {
|
|
4002
4028
|
if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done)
|
|
4003
4029
|
return;
|
|
4004
|
-
const { promise: e, resolve: t } =
|
|
4030
|
+
const { promise: e, resolve: t } = ki();
|
|
4005
4031
|
e.done = !1;
|
|
4006
4032
|
const r = () => {
|
|
4007
4033
|
e.done = !0;
|
|
@@ -4016,12 +4042,12 @@ function Gi() {
|
|
|
4016
4042
|
O.instances[e].connect();
|
|
4017
4043
|
}
|
|
4018
4044
|
static getClientFeatures() {
|
|
4019
|
-
return
|
|
4045
|
+
return De(Be({ ws: C.Transports.ws }, function(e) {
|
|
4020
4046
|
return e.isSupported({});
|
|
4021
4047
|
}));
|
|
4022
4048
|
}
|
|
4023
4049
|
constructor(e, t) {
|
|
4024
|
-
|
|
4050
|
+
Li(e), ui(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels = X.createChannels(), this.global_emitter = new $(), this.sessionID = C.randomInt(1e9), this.timeline = new oi(this.key, this.sessionID, {
|
|
4025
4051
|
cluster: this.config.cluster,
|
|
4026
4052
|
features: O.getClientFeatures(),
|
|
4027
4053
|
params: this.config.timelineParams || {},
|
|
@@ -4045,8 +4071,8 @@ function Gi() {
|
|
|
4045
4071
|
}), this.connection.bind("message", (s) => {
|
|
4046
4072
|
var c = s.event, l = c.indexOf("pusher_internal:") === 0;
|
|
4047
4073
|
if (s.channel) {
|
|
4048
|
-
var
|
|
4049
|
-
|
|
4074
|
+
var p = this.channel(s.channel);
|
|
4075
|
+
p && p.handleEvent(s);
|
|
4050
4076
|
}
|
|
4051
4077
|
l || this.global_emitter.emit(s.event, s.data);
|
|
4052
4078
|
}), this.connection.bind("connecting", () => {
|
|
@@ -4054,7 +4080,7 @@ function Gi() {
|
|
|
4054
4080
|
}), this.connection.bind("disconnected", () => {
|
|
4055
4081
|
this.channels.disconnect();
|
|
4056
4082
|
}), this.connection.bind("error", (s) => {
|
|
4057
|
-
|
|
4083
|
+
P.warn(s);
|
|
4058
4084
|
}), O.instances.push(this), this.timeline.info({ instances: O.instances.length }), this.user = new Ai(this), O.isReady && this.connect();
|
|
4059
4085
|
}
|
|
4060
4086
|
switchCluster(e) {
|
|
@@ -4070,7 +4096,7 @@ function Gi() {
|
|
|
4070
4096
|
connect() {
|
|
4071
4097
|
if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
|
|
4072
4098
|
var e = this.connection.isUsingTLS(), t = this.timelineSender;
|
|
4073
|
-
this.timelineSenderTimer = new
|
|
4099
|
+
this.timelineSenderTimer = new Mt(6e4, function() {
|
|
4074
4100
|
t.send(e);
|
|
4075
4101
|
});
|
|
4076
4102
|
}
|
|
@@ -4118,7 +4144,7 @@ function Gi() {
|
|
|
4118
4144
|
}
|
|
4119
4145
|
O.instances = [], O.isReady = !1, O.logToConsole = !1, O.Runtime = C, O.ScriptReceivers = C.ScriptReceivers, O.DependenciesReceivers = C.DependenciesReceivers, O.auth_callbacks = C.auth_callbacks;
|
|
4120
4146
|
const ue = O;
|
|
4121
|
-
function
|
|
4147
|
+
function Li(n) {
|
|
4122
4148
|
if (n == null)
|
|
4123
4149
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
4124
4150
|
}
|
|
@@ -4149,10 +4175,10 @@ function Gi() {
|
|
|
4149
4175
|
return u;
|
|
4150
4176
|
})()
|
|
4151
4177
|
));
|
|
4152
|
-
})(
|
|
4178
|
+
})(Pe)), Pe.exports;
|
|
4153
4179
|
}
|
|
4154
4180
|
var Yi = Gi();
|
|
4155
|
-
const
|
|
4181
|
+
const Ki = /* @__PURE__ */ Ji(Yi), Re = "/vendor/sendity-client/tailwind.css", Qi = {
|
|
4156
4182
|
labels: {
|
|
4157
4183
|
email: "Email",
|
|
4158
4184
|
whatsapp: "WhatsApp"
|
|
@@ -4163,7 +4189,9 @@ const Qi = /* @__PURE__ */ Vi(Yi), Pe = "/vendor/sendity-client/tailwind.css", K
|
|
|
4163
4189
|
by: "by",
|
|
4164
4190
|
toPrefix: "to",
|
|
4165
4191
|
footerWaiting: "Ready to receive your code…",
|
|
4166
|
-
footerWaitingUntil: "Ready to receive your code…"
|
|
4192
|
+
footerWaitingUntil: "Ready to receive your code…",
|
|
4193
|
+
codeExpired: "Code expired, request a new one.",
|
|
4194
|
+
getNewCode: "Get new code"
|
|
4167
4195
|
},
|
|
4168
4196
|
templates: {
|
|
4169
4197
|
emailSubject: "Sign me into (Host) with this code: (Code)",
|
|
@@ -4183,7 +4211,9 @@ Code: (Code)`,
|
|
|
4183
4211
|
by: "per",
|
|
4184
4212
|
toPrefix: "an",
|
|
4185
4213
|
footerWaiting: "Bereit zum Empfangen Deines Codes …",
|
|
4186
|
-
footerWaitingUntil: "Bereit zum Empfangen Deines Codes …"
|
|
4214
|
+
footerWaitingUntil: "Bereit zum Empfangen Deines Codes …",
|
|
4215
|
+
codeExpired: "Code abgelaufen, fordere einen neuen an.",
|
|
4216
|
+
getNewCode: "Neuen Code anfordern"
|
|
4187
4217
|
},
|
|
4188
4218
|
templates: {
|
|
4189
4219
|
emailSubject: "Melde mich bei (Host) mit diesem Code an: (Code)",
|
|
@@ -4203,7 +4233,9 @@ Code: (Code)`,
|
|
|
4203
4233
|
by: "par",
|
|
4204
4234
|
toPrefix: "à",
|
|
4205
4235
|
footerWaiting: "Prêt à recevoir votre code…",
|
|
4206
|
-
footerWaitingUntil: "Prêt à recevoir votre code…"
|
|
4236
|
+
footerWaitingUntil: "Prêt à recevoir votre code…",
|
|
4237
|
+
codeExpired: "Code expiré, demandez-en un nouveau.",
|
|
4238
|
+
getNewCode: "Nouveau code"
|
|
4207
4239
|
},
|
|
4208
4240
|
templates: {
|
|
4209
4241
|
emailSubject: "Connectez-moi à (Host) avec ce code : (Code)",
|
|
@@ -4213,47 +4245,47 @@ Code : (Code)`,
|
|
|
4213
4245
|
whatsappText: "Connectez-moi à (Host) avec ce code : (Code)"
|
|
4214
4246
|
}
|
|
4215
4247
|
};
|
|
4216
|
-
function
|
|
4248
|
+
function V(v) {
|
|
4217
4249
|
switch (v) {
|
|
4218
4250
|
case "de":
|
|
4219
4251
|
return Zi;
|
|
4220
4252
|
case "fr":
|
|
4221
4253
|
return er;
|
|
4222
4254
|
default:
|
|
4223
|
-
return
|
|
4255
|
+
return Qi;
|
|
4224
4256
|
}
|
|
4225
4257
|
}
|
|
4226
4258
|
const vt = `<svg role="img" viewBox="0 0 512 512" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>Email</title><path d="M64 112c-8.8 0-16 7.2-16 16l0 22.1L220.5 291.7c20.7 17 50.4 17 71.1 0L464 150.1l0-22.1c0-8.8-7.2-16-16-16L64 112zM48 212.2L48 384c0 8.8 7.2 16 16 16l384 0c8.8 0 16-7.2 16-16l0-171.8L322 328.8c-38.4 31.5-93.7 31.5-132 0L48 212.2zM0 128C0 92.7 28.7 64 64 64l384 0c35.3 0 64 28.7 64 64l0 256c0 35.3-28.7 64-64 64L64 448c-35.3 0-64-28.7-64-64L0 128z"/></svg>
|
|
4227
|
-
`, yt = '<svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>WhatsApp</title><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>',
|
|
4228
|
-
function
|
|
4259
|
+
`, yt = '<svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>WhatsApp</title><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>', tr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.998 9.332A5.002 5.002 0 0 1 13.2 5.5H11a1 1 0 1 0 0 2h4.5a1 1 0 0 0 1-1V2a1 1 0 1 0-2 0v1.74A7.002 7.002 0 0 0 3 9.332a1 1 0 1 0 1.998 0ZM15.002 10.668A5.002 5.002 0 0 1 6.8 14.5H9a1 1 0 1 0 0-2H4.5a1 1 0 0 0-1 1V18a1 1 0 1 0 2 0v-1.74a7.002 7.002 0 0 0 11.5-5.592 1 1 0 1 0-1.998 0Z" clip-rule="evenodd" /></svg>', je = "sendityAuthRequest", nr = "https://sendity.io/api", ir = ["mailto:verify@sendity.io"], rr = 600 * 1e3, sr = 5e3, or = 15e3, Ie = 2e3, pe = 220, At = 0;
|
|
4260
|
+
function Me(v, i) {
|
|
4229
4261
|
return `sendity:auth-request:${encodeURIComponent(v)}:${encodeURIComponent(i)}`;
|
|
4230
4262
|
}
|
|
4231
4263
|
function bt(v, i, o, a = Date.now()) {
|
|
4232
|
-
v.removeItem(
|
|
4233
|
-
const h =
|
|
4264
|
+
v.removeItem(je);
|
|
4265
|
+
const h = Me(i, o), u = v.getItem(h);
|
|
4234
4266
|
if (!u) return null;
|
|
4235
4267
|
try {
|
|
4236
4268
|
const m = JSON.parse(u);
|
|
4237
4269
|
if (typeof m.id != "string" || typeof m.clientSecret != "string" || typeof m.createdAt != "number")
|
|
4238
4270
|
throw new Error("invalid stored auth request");
|
|
4239
|
-
return a - m.createdAt >=
|
|
4271
|
+
return a - m.createdAt >= rr ? (v.removeItem(h), null) : { id: m.id, clientSecret: m.clientSecret };
|
|
4240
4272
|
} catch {
|
|
4241
4273
|
return v.removeItem(h), null;
|
|
4242
4274
|
}
|
|
4243
4275
|
}
|
|
4244
|
-
function
|
|
4245
|
-
v.setItem(
|
|
4276
|
+
function ar(v, i, o, a, h = Date.now()) {
|
|
4277
|
+
v.setItem(Me(i, o), JSON.stringify({ ...a, createdAt: h }));
|
|
4246
4278
|
}
|
|
4247
4279
|
function wt(v, i, o) {
|
|
4248
|
-
v.removeItem(
|
|
4280
|
+
v.removeItem(Me(i, o)), v.removeItem(je);
|
|
4249
4281
|
}
|
|
4250
|
-
function
|
|
4251
|
-
return window.localStorage.removeItem(
|
|
4282
|
+
function me() {
|
|
4283
|
+
return window.localStorage.removeItem(je), window.sessionStorage;
|
|
4252
4284
|
}
|
|
4253
|
-
function
|
|
4254
|
-
return v.filter((o) =>
|
|
4285
|
+
function cr(v, i = window.location.origin) {
|
|
4286
|
+
return v.filter((o) => hr(o, i));
|
|
4255
4287
|
}
|
|
4256
|
-
function
|
|
4288
|
+
function hr(v, i) {
|
|
4257
4289
|
try {
|
|
4258
4290
|
const o = new URL(v, i);
|
|
4259
4291
|
return ["http:", "https:", "mailto:", "whatsapp:"].includes(o.protocol);
|
|
@@ -4261,18 +4293,18 @@ function cr(v, i) {
|
|
|
4261
4293
|
return !1;
|
|
4262
4294
|
}
|
|
4263
4295
|
}
|
|
4264
|
-
function
|
|
4296
|
+
function lr(v, i, o) {
|
|
4265
4297
|
return v === "push" ? { start: !1, delayMs: 0 } : v === "polling" || !i || !o ? { start: !0, delayMs: 0 } : { start: !0, delayMs: At };
|
|
4266
4298
|
}
|
|
4267
|
-
const
|
|
4299
|
+
const ve = class ve extends HTMLElement {
|
|
4268
4300
|
constructor() {
|
|
4269
4301
|
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = null, this.codeContainerEl = null, this.codeEl = null, this.promptEl = null, this.successEl = null, this.spinnerEl = null, this.verifiersEl = null, this.footerEl = null, this.footerBrandEl = null, this.footerStatusEl = null, this.footerMessageEl = null, this.footerTimerEl = null, this.footerObserver = null, this.footerWaitTimer = null, this.footerTransitionTimer = null, this.successTransitionTimer = null, this.timerInterval = null, this.currentConfig = null, this.destroyed = !1, this.lastCode = void 0, this.echo = null, this.authenticated = !1;
|
|
4270
4302
|
const i = this.attachShadow({ mode: "open" });
|
|
4271
4303
|
this.injectTailwind(i);
|
|
4272
4304
|
const o = document.createElement("div");
|
|
4273
|
-
o.innerHTML =
|
|
4274
|
-
const a = o.querySelector("template"), h = a ? a.content.cloneNode(!0) : document.createRange().createContextualFragment(
|
|
4275
|
-
u.textContent =
|
|
4305
|
+
o.innerHTML = pt;
|
|
4306
|
+
const a = o.querySelector("template"), h = a ? a.content.cloneNode(!0) : document.createRange().createContextualFragment(pt), u = document.createElement("style");
|
|
4307
|
+
u.textContent = zi, i.appendChild(u), i.appendChild(h);
|
|
4276
4308
|
}
|
|
4277
4309
|
static get observedAttributes() {
|
|
4278
4310
|
return ["server-url", "public-key", "verify-urls", "lang", "transport", "hide-footer", "footer", "authenticated-event-delay-ms"];
|
|
@@ -4319,11 +4351,11 @@ const me = class me extends HTMLElement {
|
|
|
4319
4351
|
o.textContent = a.tailwindCssText;
|
|
4320
4352
|
else {
|
|
4321
4353
|
const h = document.createElement("link");
|
|
4322
|
-
h.rel = "stylesheet", h.href =
|
|
4354
|
+
h.rel = "stylesheet", h.href = Re, i.insertBefore(h, o);
|
|
4323
4355
|
}
|
|
4324
4356
|
return;
|
|
4325
4357
|
}
|
|
4326
|
-
a.tailwindLoading || (a.tailwindLoading = fetch(
|
|
4358
|
+
a.tailwindLoading || (a.tailwindLoading = fetch(Re).then((h) => h.ok ? h.text() : Promise.reject(new Error(`HTTP ${h.status}`))).then((h) => {
|
|
4327
4359
|
a.tailwindCssText = h;
|
|
4328
4360
|
}).catch((h) => {
|
|
4329
4361
|
console.warn("[sendity-auth] Failed to load Tailwind CSS for Shadow DOM", h), a.tailwindCssText = "";
|
|
@@ -4333,7 +4365,7 @@ const me = class me extends HTMLElement {
|
|
|
4333
4365
|
o.textContent = a.tailwindCssText;
|
|
4334
4366
|
else {
|
|
4335
4367
|
const h = document.createElement("link");
|
|
4336
|
-
h.rel = "stylesheet", h.href =
|
|
4368
|
+
h.rel = "stylesheet", h.href = Re, i.insertBefore(h, o);
|
|
4337
4369
|
}
|
|
4338
4370
|
});
|
|
4339
4371
|
}
|
|
@@ -4358,12 +4390,12 @@ const me = class me extends HTMLElement {
|
|
|
4358
4390
|
scheduleFooterWaitingState() {
|
|
4359
4391
|
this.footerWaitTimer !== null || this.isFooterHidden() || (this.footerWaitTimer = window.setTimeout(() => {
|
|
4360
4392
|
this.footerWaitTimer = null, this.showFooterWaitingState();
|
|
4361
|
-
},
|
|
4393
|
+
}, or));
|
|
4362
4394
|
}
|
|
4363
4395
|
showFooterWaitingState() {
|
|
4364
4396
|
this.isFooterHidden() || (this.currentConfig && this.footerMessageEl && (this.footerMessageEl.textContent = this.waitingFooterMessage()), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4365
4397
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4366
|
-
},
|
|
4398
|
+
}, pe), this.startCountdown());
|
|
4367
4399
|
}
|
|
4368
4400
|
startCountdown() {
|
|
4369
4401
|
if (this.timerInterval !== null || !this.footerTimerEl) return;
|
|
@@ -4379,13 +4411,46 @@ const me = class me extends HTMLElement {
|
|
|
4379
4411
|
return;
|
|
4380
4412
|
}
|
|
4381
4413
|
const a = Math.max(0, Math.floor((o - Date.now()) / 1e3)), h = Math.floor(a / 60), u = String(a % 60).padStart(2, "0");
|
|
4382
|
-
this.footerTimerEl.textContent = `${h}:${u}`, this.footerTimerEl.classList.toggle("low", a > 0 && a <= 60), this.footerTimerEl.removeAttribute("hidden"), a <= 0 && this.timerInterval !== null && (clearInterval(this.timerInterval), this.timerInterval = null);
|
|
4414
|
+
this.footerTimerEl.textContent = `${h}:${u}`, this.footerTimerEl.classList.toggle("low", a > 0 && a <= 60), this.footerTimerEl.removeAttribute("hidden"), a <= 0 && this.timerInterval !== null && (clearInterval(this.timerInterval), this.timerInterval = null, this.showExpiredState());
|
|
4383
4415
|
};
|
|
4384
4416
|
i(), this.timerInterval = window.setInterval(i, 1e3);
|
|
4385
4417
|
}
|
|
4386
4418
|
stopCountdown() {
|
|
4387
4419
|
this.timerInterval !== null && (clearInterval(this.timerInterval), this.timerInterval = null);
|
|
4388
4420
|
}
|
|
4421
|
+
showExpiredState() {
|
|
4422
|
+
if (!(this.authenticated || this.destroyed || !this.currentConfig)) {
|
|
4423
|
+
if (this.stopAuthTransports(), this.codeContainerEl?.classList.remove("code--active"), this.codeContainerEl?.classList.add("code--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.codeEl?.removeAttribute("hidden"), !this.isFooterHidden()) {
|
|
4424
|
+
const i = V(this.currentConfig.lang);
|
|
4425
|
+
this.footerMessageEl && (this.footerMessageEl.textContent = i.ui.codeExpired), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTimerEl?.setAttribute("hidden", ""), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4426
|
+
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4427
|
+
}, pe);
|
|
4428
|
+
}
|
|
4429
|
+
this.renderExpiredAction();
|
|
4430
|
+
}
|
|
4431
|
+
}
|
|
4432
|
+
renderExpiredAction() {
|
|
4433
|
+
if (!this.verifiersEl || !this.currentConfig) return;
|
|
4434
|
+
const i = V(this.currentConfig.lang);
|
|
4435
|
+
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden");
|
|
4436
|
+
const o = document.createElement("button");
|
|
4437
|
+
o.type = "button", o.className = "chan primary", o.addEventListener("click", () => {
|
|
4438
|
+
o.disabled = !0, this.requestNewAuthRequest().catch((u) => {
|
|
4439
|
+
console.warn("[sendity-auth] failed to request a new code", u), o.disabled = !1;
|
|
4440
|
+
});
|
|
4441
|
+
});
|
|
4442
|
+
const a = document.createElement("span");
|
|
4443
|
+
a.className = "icon", a.setAttribute("aria-hidden", "true"), a.innerHTML = tr, o.appendChild(a);
|
|
4444
|
+
const h = document.createElement("span");
|
|
4445
|
+
h.className = "label", h.textContent = i.ui.getNewCode, o.appendChild(h), this.verifiersEl.appendChild(o);
|
|
4446
|
+
}
|
|
4447
|
+
async requestNewAuthRequest() {
|
|
4448
|
+
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4449
|
+
const i = this.currentConfig;
|
|
4450
|
+
this.stopAuthTransports(), this.stopCountdown(), this.codeContainerEl?.classList.remove("code--expired");
|
|
4451
|
+
const o = await this.createAuthRequest(i.serverUrl, i.publicKey, me());
|
|
4452
|
+
this.renderVerifiers(i.verifyUrls), this.showFooterWaitingState(), this.configureRealtime(o);
|
|
4453
|
+
}
|
|
4389
4454
|
handleInitialError(i) {
|
|
4390
4455
|
console.error("[sendity-auth] Unable to initialize authentication", i), this.renderError("Unable to initialize authentication, see console for details"), this.dispatchEvent(
|
|
4391
4456
|
new CustomEvent("sendity:error", {
|
|
@@ -4399,10 +4464,10 @@ const me = class me extends HTMLElement {
|
|
|
4399
4464
|
const i = {
|
|
4400
4465
|
lang: navigator.language?.startsWith("de") ? "de" : navigator.language?.startsWith("fr") ? "fr" : "en",
|
|
4401
4466
|
transport: "auto"
|
|
4402
|
-
}, o = (R) => this.getAttribute(R) ?? void 0, a = o("server-url")?.trim() ||
|
|
4467
|
+
}, o = (R) => this.getAttribute(R) ?? void 0, a = o("server-url")?.trim() || nr, h = o("public-key")?.trim();
|
|
4403
4468
|
if (!h)
|
|
4404
4469
|
throw new Error("Missing required sendity-auth attribute: public-key");
|
|
4405
|
-
let u = [...
|
|
4470
|
+
let u = [...ir];
|
|
4406
4471
|
const m = o("verify-urls");
|
|
4407
4472
|
if (m)
|
|
4408
4473
|
try {
|
|
@@ -4411,7 +4476,7 @@ const me = class me extends HTMLElement {
|
|
|
4411
4476
|
} catch {
|
|
4412
4477
|
u = m.split(",").map((R) => R.trim()).filter(Boolean);
|
|
4413
4478
|
}
|
|
4414
|
-
if (u =
|
|
4479
|
+
if (u = cr(u), u.length === 0)
|
|
4415
4480
|
throw new Error("Missing required sendity-auth attribute: verify-urls");
|
|
4416
4481
|
let g = o("lang") || i.lang;
|
|
4417
4482
|
g !== "en" && g !== "de" && g !== "fr" && (g = i.lang);
|
|
@@ -4419,9 +4484,9 @@ const me = class me extends HTMLElement {
|
|
|
4419
4484
|
return { serverUrl: a, publicKey: h, verifyUrls: u, lang: g, transport: x, authenticatedEventDelayMs: w };
|
|
4420
4485
|
}
|
|
4421
4486
|
parseAuthenticatedEventDelayMs(i) {
|
|
4422
|
-
if (i === void 0 || i.trim() === "") return
|
|
4487
|
+
if (i === void 0 || i.trim() === "") return Ie;
|
|
4423
4488
|
const o = Number(i);
|
|
4424
|
-
return !Number.isFinite(o) || o < 0 ?
|
|
4489
|
+
return !Number.isFinite(o) || o < 0 ? Ie : Math.round(o);
|
|
4425
4490
|
}
|
|
4426
4491
|
async createAuthRequest(i, o, a) {
|
|
4427
4492
|
const h = await fetch(this.joinUrl(i, "/auth-requests"), {
|
|
@@ -4438,7 +4503,7 @@ const me = class me extends HTMLElement {
|
|
|
4438
4503
|
if (!u.id) throw new Error("Missing id from server response");
|
|
4439
4504
|
const m = this.extractClientSecret(u);
|
|
4440
4505
|
if (!m) throw new Error("Missing client secret from server response");
|
|
4441
|
-
return
|
|
4506
|
+
return ar(a, i, o, { id: String(u.id), clientSecret: m }), this.activeAuthRequestId = String(u.id), this.activeAuthRequestSecret = m, this.updateActiveAuthRequestExpiry(u), this.updateCode(u.formattedCode ?? u.code), this.dispatchPublicEvent("sendity:challenge-created", {
|
|
4442
4507
|
verificationId: String(u.id),
|
|
4443
4508
|
code: u.formattedCode ?? u.code ?? "",
|
|
4444
4509
|
channel: this.primaryChannel(this.currentConfig?.verifyUrls ?? [])
|
|
@@ -4446,7 +4511,7 @@ const me = class me extends HTMLElement {
|
|
|
4446
4511
|
}
|
|
4447
4512
|
async step() {
|
|
4448
4513
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4449
|
-
const { serverUrl: i, publicKey: o } = this.currentConfig, a =
|
|
4514
|
+
const { serverUrl: i, publicKey: o } = this.currentConfig, a = me(), h = bt(a, i, o), u = h?.id;
|
|
4450
4515
|
if (!u)
|
|
4451
4516
|
return await this.createAuthRequest(i, o, a);
|
|
4452
4517
|
this.activeAuthRequestId = u, this.activeAuthRequestSecret = h.clientSecret;
|
|
@@ -4459,6 +4524,8 @@ const me = class me extends HTMLElement {
|
|
|
4459
4524
|
const g = await m.json();
|
|
4460
4525
|
if (g.status === "verified")
|
|
4461
4526
|
return this.handleAuthenticated(g), g;
|
|
4527
|
+
if (g.status === "expired")
|
|
4528
|
+
return this.updateActiveAuthRequestExpiry(g), this.updateCode(g.formattedCode ?? g.code), this.showExpiredState(), g;
|
|
4462
4529
|
g.id && (this.activeAuthRequestId = String(g.id));
|
|
4463
4530
|
const y = this.extractClientSecret(g);
|
|
4464
4531
|
return y && (this.activeAuthRequestSecret = y), this.updateActiveAuthRequestExpiry(g), this.updateCode(g.formattedCode ?? g.code), g;
|
|
@@ -4468,15 +4535,15 @@ const me = class me extends HTMLElement {
|
|
|
4468
4535
|
const { transport: o } = this.currentConfig, a = i?.broadcasting, h = !!(a?.key && a.channel && a.authEndpoint);
|
|
4469
4536
|
let u = !1;
|
|
4470
4537
|
o !== "polling" && h && a ? u = this.subscribeToBroadcasting(a) : o === "push" && console.warn("[sendity-auth] Push transport requested, but server response does not contain broadcasting metadata");
|
|
4471
|
-
const m =
|
|
4538
|
+
const m = lr(o, h, u);
|
|
4472
4539
|
m.start && this.startPolling(m.delayMs);
|
|
4473
4540
|
}
|
|
4474
4541
|
subscribeToBroadcasting(i) {
|
|
4475
4542
|
if (!this.currentConfig || !i.key || !i.channel || !i.authEndpoint) return !1;
|
|
4476
4543
|
try {
|
|
4477
|
-
window.Pusher =
|
|
4544
|
+
window.Pusher = Ki;
|
|
4478
4545
|
const o = (i.scheme ?? "https") === "https", a = i.port ?? (o ? 443 : 80);
|
|
4479
|
-
return this.echo = new
|
|
4546
|
+
return this.echo = new Vi({
|
|
4480
4547
|
broadcaster: "reverb",
|
|
4481
4548
|
key: i.key,
|
|
4482
4549
|
wsHost: i.host ?? new URL(this.currentConfig.serverUrl).hostname,
|
|
@@ -4507,7 +4574,7 @@ const me = class me extends HTMLElement {
|
|
|
4507
4574
|
const o = () => {
|
|
4508
4575
|
this.pollTimer !== null || this.authenticated || this.destroyed || (this.pollTimer = window.setInterval(() => {
|
|
4509
4576
|
this.step().catch((a) => console.warn("[sendity-auth] poll failed", a));
|
|
4510
|
-
},
|
|
4577
|
+
}, sr));
|
|
4511
4578
|
};
|
|
4512
4579
|
i > 0 ? this.fallbackPollTimer = window.setTimeout(() => {
|
|
4513
4580
|
this.fallbackPollTimer = null, o();
|
|
@@ -4521,8 +4588,8 @@ const me = class me extends HTMLElement {
|
|
|
4521
4588
|
});
|
|
4522
4589
|
return;
|
|
4523
4590
|
}
|
|
4524
|
-
this.authenticated = !0, this.currentConfig && wt(
|
|
4525
|
-
const o = this.toPublicAuthenticatedDetail(i), a = this.currentConfig?.authenticatedEventDelayMs ??
|
|
4591
|
+
this.authenticated = !0, this.currentConfig && wt(me(), this.currentConfig.serverUrl, this.currentConfig.publicKey), this.stopAuthTransports(), this.showSuccess(i);
|
|
4592
|
+
const o = this.toPublicAuthenticatedDetail(i), a = this.currentConfig?.authenticatedEventDelayMs ?? Ie;
|
|
4526
4593
|
this.authenticatedEventTimer = window.setTimeout(() => {
|
|
4527
4594
|
this.authenticatedEventTimer = null, !this.destroyed && this.dispatchPublicEvent("sendity:authenticated", o);
|
|
4528
4595
|
}, a);
|
|
@@ -4570,7 +4637,7 @@ const me = class me extends HTMLElement {
|
|
|
4570
4637
|
}
|
|
4571
4638
|
waitingFooterMessage() {
|
|
4572
4639
|
if (!this.currentConfig) return "";
|
|
4573
|
-
const i =
|
|
4640
|
+
const i = V(this.currentConfig.lang), o = this.formatExpiryTime(this.activeAuthRequestExpiresAt, this.currentConfig.lang);
|
|
4574
4641
|
return o ? i.ui.footerWaitingUntil.replace("(Time)", o) : i.ui.footerWaiting;
|
|
4575
4642
|
}
|
|
4576
4643
|
formatExpiryTime(i, o) {
|
|
@@ -4590,7 +4657,7 @@ const me = class me extends HTMLElement {
|
|
|
4590
4657
|
}
|
|
4591
4658
|
async fetchAuthorizationAfterAuthenticatedSignal() {
|
|
4592
4659
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4593
|
-
const i = bt(
|
|
4660
|
+
const i = bt(me(), this.currentConfig.serverUrl, this.currentConfig.publicKey), o = this.activeAuthRequestId ?? i?.id, a = this.activeAuthRequestSecret ?? i?.clientSecret;
|
|
4594
4661
|
if (!o || !a)
|
|
4595
4662
|
throw new Error("Cannot fetch authorization without an active auth request id and client secret");
|
|
4596
4663
|
const h = await fetch(
|
|
@@ -4610,7 +4677,7 @@ const me = class me extends HTMLElement {
|
|
|
4610
4677
|
if (!this.codeEl) return;
|
|
4611
4678
|
if (!!(i && String(i).trim().length > 0)) {
|
|
4612
4679
|
const a = String(i);
|
|
4613
|
-
this.lastCode = a, this.codeEl.textContent = a, this.showCodeState();
|
|
4680
|
+
this.lastCode = a, this.codeEl.textContent = a, this.codeContainerEl?.classList.remove("code--expired"), this.showCodeState();
|
|
4614
4681
|
} else {
|
|
4615
4682
|
this.lastCode = void 0;
|
|
4616
4683
|
const a = this.codeEl.getAttribute("data-placeholder") || "••••";
|
|
@@ -4622,11 +4689,11 @@ const me = class me extends HTMLElement {
|
|
|
4622
4689
|
this.codeEl && (this.codeEl.textContent = i), this.verifiersEl && (this.verifiersEl.innerHTML = "");
|
|
4623
4690
|
}
|
|
4624
4691
|
showLoading() {
|
|
4625
|
-
this.spinnerEl?.removeAttribute("hidden"), this.codeContainerEl?.classList.remove("code--active", "code--verified"), this.codeEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", "");
|
|
4692
|
+
this.spinnerEl?.removeAttribute("hidden"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired"), this.codeEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", "");
|
|
4626
4693
|
}
|
|
4627
4694
|
showCodeState() {
|
|
4628
4695
|
if (this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--verified"), this.codeContainerEl?.classList.remove("code--exiting", "code--collapsed"), this.codeContainerEl?.classList.add("code--active"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.verifiersEl?.classList.remove("verifiers--exiting"), this.verifiersEl?.removeAttribute("aria-hidden"), this.codeEl?.removeAttribute("hidden"), this.currentConfig && this.promptEl) {
|
|
4629
|
-
const i =
|
|
4696
|
+
const i = V(this.currentConfig.lang);
|
|
4630
4697
|
this.promptEl.textContent = i.ui.sendCodePrompt, this.promptEl.classList.remove("prompt--exiting"), this.promptEl.removeAttribute("aria-hidden"), this.promptEl.removeAttribute("hidden");
|
|
4631
4698
|
}
|
|
4632
4699
|
this.successEl?.setAttribute("hidden", "");
|
|
@@ -4636,12 +4703,12 @@ const me = class me extends HTMLElement {
|
|
|
4636
4703
|
const o = this.isFooterHidden();
|
|
4637
4704
|
if (this.footerEl && (this.footerEl.hidden = o, this.footerEl.classList.remove("footer--leaving"), o || (this.footerEl.classList.add("footer--waiting", "footer--transitioning", "footer--verified"), window.setTimeout(() => {
|
|
4638
4705
|
this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl && (this.footerBrandEl.hidden = !0);
|
|
4639
|
-
},
|
|
4706
|
+
}, pe))), this.footerStatusEl && (this.footerStatusEl.hidden = o), this.footerMessageEl) {
|
|
4640
4707
|
const a = i.identifier && i.identifier.trim().length > 0 ? i.identifier.trim() : this.destinationAddressForChannel(i.channel ?? this.primaryChannel(this.currentConfig?.verifyUrls ?? []));
|
|
4641
4708
|
this.footerMessageEl.textContent = a ? `Verified ${a}` : "Verified";
|
|
4642
4709
|
}
|
|
4643
4710
|
if (this.footerTimerEl && (this.footerTimerEl.hidden = !1, this.footerTimerEl.classList.remove("low"), this.footerTimerEl.textContent = "· Signing you in..."), this.verifiersEl?.classList.add("verifiers--exiting"), this.currentConfig && this.successEl) {
|
|
4644
|
-
const a =
|
|
4711
|
+
const a = V(this.currentConfig.lang), h = i.name && i.name.trim().length > 0 ? a.ui.successGreeting.replace("(Name)", i.name) : "You're in!";
|
|
4645
4712
|
this.successEl.innerHTML = `
|
|
4646
4713
|
<span class="success-check" aria-hidden="true">
|
|
4647
4714
|
<svg viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>
|
|
@@ -4651,7 +4718,7 @@ const me = class me extends HTMLElement {
|
|
|
4651
4718
|
}
|
|
4652
4719
|
this.successTransitionTimer !== null && clearTimeout(this.successTransitionTimer), this.successTransitionTimer = window.setTimeout(() => {
|
|
4653
4720
|
this.successTransitionTimer = null, this.verifiersEl && this.verifiersEl.setAttribute("aria-hidden", "true"), this.codeContainerEl?.setAttribute("aria-hidden", "true"), this.promptEl?.setAttribute("aria-hidden", "true");
|
|
4654
|
-
},
|
|
4721
|
+
}, pe);
|
|
4655
4722
|
}
|
|
4656
4723
|
destinationAddressForChannel(i) {
|
|
4657
4724
|
const o = this.currentConfig?.verifyUrls ?? [], a = o.find((h) => this.channelClass(h) === i) ?? o[0];
|
|
@@ -4717,7 +4784,7 @@ const me = class me extends HTMLElement {
|
|
|
4717
4784
|
return "generic";
|
|
4718
4785
|
}
|
|
4719
4786
|
channelLabel(i, o) {
|
|
4720
|
-
const a =
|
|
4787
|
+
const a = V(o), h = this.channelClass(i);
|
|
4721
4788
|
if (h === "email") return a.labels.email;
|
|
4722
4789
|
if (h === "whatsapp") return a.labels.whatsapp;
|
|
4723
4790
|
try {
|
|
@@ -4728,7 +4795,7 @@ const me = class me extends HTMLElement {
|
|
|
4728
4795
|
}
|
|
4729
4796
|
}
|
|
4730
4797
|
destinationText(i, o) {
|
|
4731
|
-
const h =
|
|
4798
|
+
const h = V(o).ui.toPrefix ?? "to";
|
|
4732
4799
|
try {
|
|
4733
4800
|
const u = new URL(i, window.location.origin);
|
|
4734
4801
|
if (u.protocol === "mailto:") {
|
|
@@ -4759,7 +4826,7 @@ const me = class me extends HTMLElement {
|
|
|
4759
4826
|
return null;
|
|
4760
4827
|
}
|
|
4761
4828
|
labelForUrl(i, o) {
|
|
4762
|
-
const a =
|
|
4829
|
+
const a = V(o);
|
|
4763
4830
|
try {
|
|
4764
4831
|
const h = new URL(i, window.location.origin);
|
|
4765
4832
|
return h.protocol === "mailto:" ? `${a.ui.by} ${a.labels.email}` : h.protocol.startsWith("http") ? h.hostname : h.protocol === "whatsapp:" ? `${a.ui.by} ${a.labels.whatsapp}` : h.protocol.replace(":", "");
|
|
@@ -4768,7 +4835,7 @@ const me = class me extends HTMLElement {
|
|
|
4768
4835
|
}
|
|
4769
4836
|
}
|
|
4770
4837
|
buildLink(i, o) {
|
|
4771
|
-
const a = this.lastCode, h =
|
|
4838
|
+
const a = this.lastCode, h = V(o), u = window.location.host;
|
|
4772
4839
|
if (!a) return i;
|
|
4773
4840
|
if (i.startsWith("mailto:")) {
|
|
4774
4841
|
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), x = this.applyTemplate(h.templates.emailSubject, u, a), w = this.applyTemplate(h.templates.emailBody, u, a);
|
|
@@ -4801,8 +4868,8 @@ const me = class me extends HTMLElement {
|
|
|
4801
4868
|
return i.endsWith("/") && o.startsWith("/") ? i + o.slice(1) : !i.endsWith("/") && !o.startsWith("/") ? i + "/" + o : i + o;
|
|
4802
4869
|
}
|
|
4803
4870
|
};
|
|
4804
|
-
|
|
4805
|
-
let Oe =
|
|
4871
|
+
ve.tailwindCssText = null, ve.tailwindLoading = null;
|
|
4872
|
+
let Oe = ve;
|
|
4806
4873
|
customElements.get("sendity-auth") || customElements.define("sendity-auth", Oe);
|
|
4807
4874
|
export {
|
|
4808
4875
|
Oe as Sendity
|