@sendity/client 0.1.4 → 0.1.6
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 +9 -1
- package/dist/sendity-client.js +654 -544
- package/dist/tailwind.css +1 -1
- package/package.json +1 -1
package/dist/sendity-client.js
CHANGED
|
@@ -95,9 +95,10 @@ const pt = `<template id="sendity-tpl">
|
|
|
95
95
|
--sendity-whatsapp-bg-hover:#bbf3d6;
|
|
96
96
|
|
|
97
97
|
--sendity-btn-font-size: var(--sendity-font-size-sm);
|
|
98
|
-
--sendity-btn-
|
|
98
|
+
--sendity-btn-min-height: 2.25rem; /* 36 — Flux default button height */
|
|
99
|
+
--sendity-btn-padding: 0.5rem 0.875rem;
|
|
99
100
|
--sendity-btn-border-radius: 0.5625rem; /* 9 */
|
|
100
|
-
--sendity-btn-shadow: inset 0 1px 0 0 rgb(255 255 255 / 0.
|
|
101
|
+
--sendity-btn-shadow: inset 0 1px 0 0 rgb(255 255 255 / 0.2), 0 1px 2px 0 rgb(28 25 23 / 0.10);
|
|
101
102
|
|
|
102
103
|
--sendity-success-check-bg: var(--sendity-success-bg);
|
|
103
104
|
--sendity-success-check-color: var(--sendity-success-color);
|
|
@@ -105,18 +106,73 @@ const pt = `<template id="sendity-tpl">
|
|
|
105
106
|
--sendity-radius: 1rem; /* 16 — radius-xl */
|
|
106
107
|
--sendity-surface: #ffffff;
|
|
107
108
|
--sendity-shadow: 0 12px 28px -6px rgb(28 25 23 / 0.14), 0 6px 12px -6px rgb(28 25 23 / 0.08);
|
|
108
|
-
--sendity-shadow-
|
|
109
|
+
--sendity-shadow-success: 0 0 0 1px rgb(16 185 129 / 0.18), 0 18px 46px -18px rgb(16 185 129 / 0.78);
|
|
110
|
+
--sendity-shadow-error: 0 0 0 1px rgb(244 63 94 / 0.18), 0 18px 46px -18px rgb(244 63 94 / 0.78);
|
|
109
111
|
|
|
110
112
|
/* Card layout */
|
|
111
113
|
--sendity-width: 320px;
|
|
114
|
+
--sendity-body-height: 14.125rem;
|
|
115
|
+
--sendity-footer-height: 2.75rem;
|
|
112
116
|
--sendity-crossfade-duration: 220ms;
|
|
113
117
|
|
|
114
118
|
color-scheme: light;
|
|
119
|
+
display: inline-flex;
|
|
120
|
+
max-width: 100%;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:host([variant="no-card"]),
|
|
124
|
+
:host([no-card]) {
|
|
125
|
+
display: flex;
|
|
126
|
+
width: 100%;
|
|
127
|
+
height: 100%;
|
|
128
|
+
max-width: 100%;
|
|
129
|
+
min-height: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
:host([variant="no-card"]) .sendity,
|
|
133
|
+
:host([no-card]) .sendity,
|
|
134
|
+
.sendity.sendity--no-card {
|
|
135
|
+
width: 100%;
|
|
136
|
+
height: 100%;
|
|
137
|
+
min-height: calc(var(--sendity-body-height) + var(--sendity-footer-height));
|
|
138
|
+
border: 0;
|
|
139
|
+
border-radius: 0;
|
|
140
|
+
box-shadow: none;
|
|
141
|
+
background: transparent;
|
|
142
|
+
overflow: visible;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host([variant="no-card"]) .sendity.sendity--verified,
|
|
146
|
+
:host([variant="no-card"]) .sendity.sendity--expired,
|
|
147
|
+
:host([no-card]) .sendity.sendity--verified,
|
|
148
|
+
:host([no-card]) .sendity.sendity--expired,
|
|
149
|
+
.sendity.sendity--no-card.sendity--verified,
|
|
150
|
+
.sendity.sendity--no-card.sendity--expired {
|
|
151
|
+
box-shadow: none;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host([variant="no-card"]) .sendity-body,
|
|
155
|
+
:host([no-card]) .sendity-body,
|
|
156
|
+
.sendity.sendity--no-card .sendity-body {
|
|
157
|
+
flex: 1 1 auto;
|
|
158
|
+
height: auto;
|
|
159
|
+
min-height: 0;
|
|
160
|
+
padding: 0 0 1rem;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
:host([variant="no-card"]) .sendity-footer,
|
|
164
|
+
:host([no-card]) .sendity-footer,
|
|
165
|
+
.sendity.sendity--no-card .sendity-footer {
|
|
166
|
+
margin-top: auto;
|
|
167
|
+
flex: 0 0 var(--sendity-footer-height);
|
|
168
|
+
border-top-color: var(--sendity-border);
|
|
169
|
+
padding-inline: 0.625rem 0;
|
|
115
170
|
}
|
|
116
171
|
|
|
117
172
|
.sendity {
|
|
118
173
|
width: var(--sendity-width);
|
|
119
174
|
max-width: 100%;
|
|
175
|
+
box-sizing: border-box;
|
|
120
176
|
display: inline-flex;
|
|
121
177
|
flex-direction: column;
|
|
122
178
|
background: var(--sendity-surface);
|
|
@@ -130,15 +186,22 @@ const pt = `<template id="sendity-tpl">
|
|
|
130
186
|
transition: box-shadow .35s ease;
|
|
131
187
|
}
|
|
132
188
|
|
|
133
|
-
.sendity
|
|
134
|
-
box-shadow: var(--sendity-shadow-
|
|
189
|
+
.sendity.sendity--verified {
|
|
190
|
+
box-shadow: var(--sendity-shadow-success), var(--sendity-shadow);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.sendity.sendity--expired {
|
|
194
|
+
box-shadow: var(--sendity-shadow-error), var(--sendity-shadow);
|
|
135
195
|
}
|
|
136
196
|
|
|
137
197
|
.sendity-body {
|
|
138
198
|
position: relative;
|
|
199
|
+
box-sizing: border-box;
|
|
139
200
|
flex: 1;
|
|
140
201
|
display: flex;
|
|
141
202
|
flex-direction: column;
|
|
203
|
+
height: var(--sendity-body-height);
|
|
204
|
+
min-height: var(--sendity-body-height);
|
|
142
205
|
padding: 1.25rem 1.25rem 1rem;
|
|
143
206
|
gap: 0.875rem;
|
|
144
207
|
}
|
|
@@ -173,7 +236,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
173
236
|
text-align: center;
|
|
174
237
|
gap: 0.5rem;
|
|
175
238
|
overflow: hidden;
|
|
176
|
-
transition: opacity var(--sendity-crossfade-duration) ease, transform var(--sendity-crossfade-duration) ease, background-color var(--sendity-crossfade-duration) ease, border-color var(--sendity-crossfade-duration) ease, color var(--sendity-crossfade-duration) ease
|
|
239
|
+
transition: opacity var(--sendity-crossfade-duration) ease, transform var(--sendity-crossfade-duration) ease, background-color var(--sendity-crossfade-duration) ease, border-color var(--sendity-crossfade-duration) ease, color var(--sendity-crossfade-duration) ease;
|
|
177
240
|
}
|
|
178
241
|
|
|
179
242
|
.sendity .code--exiting {
|
|
@@ -182,15 +245,6 @@ const pt = `<template id="sendity-tpl">
|
|
|
182
245
|
pointer-events: none;
|
|
183
246
|
}
|
|
184
247
|
|
|
185
|
-
.sendity .code--collapsed {
|
|
186
|
-
max-height: 0;
|
|
187
|
-
min-height: 0;
|
|
188
|
-
padding-top: 0;
|
|
189
|
-
padding-bottom: 0;
|
|
190
|
-
margin: 0;
|
|
191
|
-
border-width: 0;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
248
|
.sendity .spinner {
|
|
195
249
|
width: 1.125rem;
|
|
196
250
|
height: 1.125rem;
|
|
@@ -272,6 +326,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
272
326
|
text-decoration: none;
|
|
273
327
|
border: 1px solid;
|
|
274
328
|
border-radius: var(--sendity-btn-border-radius);
|
|
329
|
+
min-height: var(--sendity-btn-min-height);
|
|
275
330
|
padding: var(--sendity-btn-padding);
|
|
276
331
|
box-shadow: var(--sendity-btn-shadow);
|
|
277
332
|
cursor: pointer;
|
|
@@ -293,15 +348,26 @@ const pt = `<template id="sendity-tpl">
|
|
|
293
348
|
.sendity .verifiers a.chan .icon svg,
|
|
294
349
|
.sendity .verifiers button.chan .icon svg { width: 100%; height: 100%; display: block; }
|
|
295
350
|
|
|
296
|
-
.sendity .verifiers button.chan.primary
|
|
351
|
+
.sendity .verifiers button.chan.primary,
|
|
352
|
+
.sendity .verifiers button.chan.error {
|
|
297
353
|
width: 100%;
|
|
298
354
|
color: #ffffff;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.sendity .verifiers button.chan.primary {
|
|
299
358
|
background: var(--sendity-primary-color);
|
|
300
359
|
border-color: var(--sendity-primary-color);
|
|
301
360
|
}
|
|
302
361
|
.sendity .verifiers button.chan.primary:hover { background: var(--sendity-primary-hover); border-color: var(--sendity-primary-hover); }
|
|
303
362
|
.sendity .verifiers button.chan.primary:disabled { opacity: 0.7; cursor: wait; }
|
|
304
363
|
|
|
364
|
+
.sendity .verifiers button.chan.error {
|
|
365
|
+
background: var(--sendity-error-color);
|
|
366
|
+
border-color: var(--sendity-error-color);
|
|
367
|
+
}
|
|
368
|
+
.sendity .verifiers button.chan.error:hover { background: var(--sendity-error-fg); border-color: var(--sendity-error-fg); }
|
|
369
|
+
.sendity .verifiers button.chan.error:disabled { opacity: 0.7; cursor: wait; }
|
|
370
|
+
|
|
305
371
|
.sendity .verifiers a.chan.email {
|
|
306
372
|
color: var(--sendity-email-fg);
|
|
307
373
|
background: var(--sendity-email-bg);
|
|
@@ -436,6 +502,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
436
502
|
}
|
|
437
503
|
|
|
438
504
|
.sendity .sendity-footer {
|
|
505
|
+
box-sizing: border-box;
|
|
439
506
|
border-top: 1px solid var(--sendity-border);
|
|
440
507
|
padding: 0.8125rem 1.125rem;
|
|
441
508
|
display: grid;
|
|
@@ -443,7 +510,8 @@ const pt = `<template id="sendity-tpl">
|
|
|
443
510
|
align-items: center;
|
|
444
511
|
justify-content: stretch;
|
|
445
512
|
gap: 0.5rem;
|
|
446
|
-
|
|
513
|
+
height: var(--sendity-footer-height);
|
|
514
|
+
min-height: var(--sendity-footer-height);
|
|
447
515
|
color: var(--sendity-fg-3);
|
|
448
516
|
font-size: var(--sendity-font-size-xs);
|
|
449
517
|
line-height: 1rem;
|
|
@@ -492,10 +560,24 @@ const pt = `<template id="sendity-tpl">
|
|
|
492
560
|
transform: translateY(0);
|
|
493
561
|
}
|
|
494
562
|
|
|
563
|
+
.sendity .sendity-footer.footer--verified .footer-status {
|
|
564
|
+
justify-content: center;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.sendity .sendity-footer.footer--verified .footer-status-left {
|
|
568
|
+
width: 100%;
|
|
569
|
+
justify-content: center;
|
|
570
|
+
}
|
|
571
|
+
|
|
495
572
|
.sendity .sendity-footer.footer--verified .footer-spinner {
|
|
496
573
|
display: none;
|
|
497
574
|
}
|
|
498
575
|
|
|
576
|
+
.sendity .sendity-footer.footer--verified .footer-message {
|
|
577
|
+
white-space: nowrap;
|
|
578
|
+
text-align: center;
|
|
579
|
+
}
|
|
580
|
+
|
|
499
581
|
.sendity .footer-status-left {
|
|
500
582
|
display: inline-flex;
|
|
501
583
|
align-items: center;
|
|
@@ -518,7 +600,10 @@ const pt = `<template id="sendity-tpl">
|
|
|
518
600
|
height: 0.5rem;
|
|
519
601
|
border-radius: 999px;
|
|
520
602
|
background: var(--sendity-primary-color);
|
|
603
|
+
color: var(--sendity-error-color);
|
|
521
604
|
position: relative;
|
|
605
|
+
display: inline-grid;
|
|
606
|
+
place-items: center;
|
|
522
607
|
flex: none;
|
|
523
608
|
}
|
|
524
609
|
.sendity .footer-spinner::after {
|
|
@@ -531,6 +616,21 @@ const pt = `<template id="sendity-tpl">
|
|
|
531
616
|
animation: sendity-pulse 1.6s ease-out infinite;
|
|
532
617
|
}
|
|
533
618
|
|
|
619
|
+
.sendity .footer-indicator--error {
|
|
620
|
+
width: 1rem;
|
|
621
|
+
height: 1rem;
|
|
622
|
+
background: transparent;
|
|
623
|
+
}
|
|
624
|
+
.sendity .footer-indicator--error::after {
|
|
625
|
+
content: none;
|
|
626
|
+
animation: none;
|
|
627
|
+
}
|
|
628
|
+
.sendity .footer-indicator--error svg {
|
|
629
|
+
width: 1rem;
|
|
630
|
+
height: 1rem;
|
|
631
|
+
display: block;
|
|
632
|
+
}
|
|
633
|
+
|
|
534
634
|
@keyframes sendity-pulse { to { transform: scale(2.4); opacity: 0; } }
|
|
535
635
|
|
|
536
636
|
/* Inherit dark surfaces when consumer page enables a dark theme on the host. */
|
|
@@ -561,6 +661,8 @@ const pt = `<template id="sendity-tpl">
|
|
|
561
661
|
--sendity-whatsapp-bg-hover: rgb(16 185 129 / 0.26);
|
|
562
662
|
--sendity-btn-shadow: inset 0 1px 0 0 rgb(255 255 255 / 0.06), 0 1px 2px 0 rgb(0 0 0 / 0.4);
|
|
563
663
|
--sendity-shadow: 0 12px 28px -6px rgb(0 0 0 / 0.55), 0 6px 12px -6px rgb(0 0 0 / 0.4);
|
|
664
|
+
--sendity-shadow-success: 0 0 0 1px rgb(16 185 129 / 0.24), 0 18px 46px -18px rgb(16 185 129 / 0.9);
|
|
665
|
+
--sendity-shadow-error: 0 0 0 1px rgb(244 63 94 / 0.24), 0 18px 46px -18px rgb(244 63 94 / 0.9);
|
|
564
666
|
}
|
|
565
667
|
`;
|
|
566
668
|
class qe {
|
|
@@ -654,8 +756,8 @@ class Ue extends qe {
|
|
|
654
756
|
let h = String(this.options.namespace ?? "").replace(
|
|
655
757
|
/\./g,
|
|
656
758
|
"\\"
|
|
657
|
-
),
|
|
658
|
-
i(
|
|
759
|
+
), d = s.startsWith(h) ? s.substring(h.length + 1) : "." + s;
|
|
760
|
+
i(d, a);
|
|
659
761
|
}), this;
|
|
660
762
|
}
|
|
661
763
|
/**
|
|
@@ -753,7 +855,7 @@ class Fi extends St {
|
|
|
753
855
|
}), this;
|
|
754
856
|
}
|
|
755
857
|
}
|
|
756
|
-
class
|
|
858
|
+
class xt extends qe {
|
|
757
859
|
/**
|
|
758
860
|
* Create a new class instance.
|
|
759
861
|
*/
|
|
@@ -809,7 +911,7 @@ class Tt extends qe {
|
|
|
809
911
|
*/
|
|
810
912
|
on(i, s) {
|
|
811
913
|
return this.listeners[i] = this.listeners[i] || [], this.events[i] || (this.events[i] = (a, h) => {
|
|
812
|
-
this.name === a && this.listeners[i] && this.listeners[i].forEach((
|
|
914
|
+
this.name === a && this.listeners[i] && this.listeners[i].forEach((d) => d(h));
|
|
813
915
|
}, this.socket.on(i, this.events[i])), this.listeners[i].push(s), this;
|
|
814
916
|
}
|
|
815
917
|
/**
|
|
@@ -829,7 +931,7 @@ class Tt extends qe {
|
|
|
829
931
|
)), (!s || this.listeners[i].length === 0) && (this.events[i] && (this.socket.removeListener(i, this.events[i]), delete this.events[i]), delete this.listeners[i]);
|
|
830
932
|
}
|
|
831
933
|
}
|
|
832
|
-
class
|
|
934
|
+
class Tt extends xt {
|
|
833
935
|
/**
|
|
834
936
|
* Send a whisper event to other clients in the channel.
|
|
835
937
|
*/
|
|
@@ -841,7 +943,7 @@ class xt extends Tt {
|
|
|
841
943
|
}), this;
|
|
842
944
|
}
|
|
843
945
|
}
|
|
844
|
-
class Wi extends
|
|
946
|
+
class Wi extends Tt {
|
|
845
947
|
/**
|
|
846
948
|
* Register a callback to be called anytime the member list changes.
|
|
847
949
|
*/
|
|
@@ -927,7 +1029,7 @@ class ge extends qe {
|
|
|
927
1029
|
return this;
|
|
928
1030
|
}
|
|
929
1031
|
}
|
|
930
|
-
class
|
|
1032
|
+
class Et extends ge {
|
|
931
1033
|
/**
|
|
932
1034
|
* Send a whisper event to other clients in the channel.
|
|
933
1035
|
*/
|
|
@@ -943,7 +1045,7 @@ class Bi extends ge {
|
|
|
943
1045
|
return this;
|
|
944
1046
|
}
|
|
945
1047
|
}
|
|
946
|
-
class $i extends
|
|
1048
|
+
class $i extends Et {
|
|
947
1049
|
/**
|
|
948
1050
|
* Register a callback to be called anytime the member list changes.
|
|
949
1051
|
*/
|
|
@@ -969,7 +1071,7 @@ class $i extends _t {
|
|
|
969
1071
|
return this;
|
|
970
1072
|
}
|
|
971
1073
|
}
|
|
972
|
-
const
|
|
1074
|
+
const _t = class kt {
|
|
973
1075
|
/**
|
|
974
1076
|
* Create a new class instance.
|
|
975
1077
|
*/
|
|
@@ -996,7 +1098,7 @@ const Et = class kt {
|
|
|
996
1098
|
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" ? ((s = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : s.getAttribute("content")) ?? null : null;
|
|
997
1099
|
}
|
|
998
1100
|
};
|
|
999
|
-
|
|
1101
|
+
_t._defaultOptions = {
|
|
1000
1102
|
auth: {
|
|
1001
1103
|
headers: {}
|
|
1002
1104
|
},
|
|
@@ -1011,7 +1113,7 @@ Et._defaultOptions = {
|
|
|
1011
1113
|
key: null,
|
|
1012
1114
|
namespace: "App.Events"
|
|
1013
1115
|
};
|
|
1014
|
-
let Ne =
|
|
1116
|
+
let Ne = _t;
|
|
1015
1117
|
class fe extends Ne {
|
|
1016
1118
|
constructor() {
|
|
1017
1119
|
super(...arguments), this.channels = {};
|
|
@@ -1149,7 +1251,7 @@ class fe extends Ne {
|
|
|
1149
1251
|
this.pusher.disconnect();
|
|
1150
1252
|
}
|
|
1151
1253
|
}
|
|
1152
|
-
class
|
|
1254
|
+
class Vi extends Ne {
|
|
1153
1255
|
constructor() {
|
|
1154
1256
|
super(...arguments), this.channels = {};
|
|
1155
1257
|
}
|
|
@@ -1189,7 +1291,7 @@ class Xi extends Ne {
|
|
|
1189
1291
|
* Get a channel instance by name.
|
|
1190
1292
|
*/
|
|
1191
1293
|
channel(i) {
|
|
1192
|
-
return this.channels[i] || (this.channels[i] = new
|
|
1294
|
+
return this.channels[i] || (this.channels[i] = new xt(
|
|
1193
1295
|
this.socket,
|
|
1194
1296
|
i,
|
|
1195
1297
|
this.options
|
|
@@ -1199,7 +1301,7 @@ class Xi extends Ne {
|
|
|
1199
1301
|
* Get a private channel instance by name.
|
|
1200
1302
|
*/
|
|
1201
1303
|
privateChannel(i) {
|
|
1202
|
-
return this.channels["private-" + i] || (this.channels["private-" + i] = new
|
|
1304
|
+
return this.channels["private-" + i] || (this.channels["private-" + i] = new Tt(
|
|
1203
1305
|
this.socket,
|
|
1204
1306
|
"private-" + i,
|
|
1205
1307
|
this.options
|
|
@@ -1296,7 +1398,7 @@ class mt extends Ne {
|
|
|
1296
1398
|
* Get a private channel instance by name.
|
|
1297
1399
|
*/
|
|
1298
1400
|
privateChannel(i) {
|
|
1299
|
-
return new
|
|
1401
|
+
return new Et();
|
|
1300
1402
|
}
|
|
1301
1403
|
/**
|
|
1302
1404
|
* Get a private encrypted channel instance by name.
|
|
@@ -1345,7 +1447,7 @@ class mt extends Ne {
|
|
|
1345
1447
|
disconnect() {
|
|
1346
1448
|
}
|
|
1347
1449
|
}
|
|
1348
|
-
class
|
|
1450
|
+
class Xi {
|
|
1349
1451
|
/**
|
|
1350
1452
|
* Create a new class instance.
|
|
1351
1453
|
*/
|
|
@@ -1376,7 +1478,7 @@ class Vi {
|
|
|
1376
1478
|
broadcaster: "pusher"
|
|
1377
1479
|
});
|
|
1378
1480
|
else if (this.options.broadcaster === "socket.io")
|
|
1379
|
-
this.connector = new
|
|
1481
|
+
this.connector = new Vi(this.options);
|
|
1380
1482
|
else if (this.options.broadcaster === "null")
|
|
1381
1483
|
this.connector = new mt(this.options);
|
|
1382
1484
|
else if (typeof this.options.broadcaster == "function" && Hi(this.options.broadcaster))
|
|
@@ -1506,7 +1608,7 @@ class Vi {
|
|
|
1506
1608
|
function Ji(v) {
|
|
1507
1609
|
return v && v.__esModule && Object.prototype.hasOwnProperty.call(v, "default") ? v.default : v;
|
|
1508
1610
|
}
|
|
1509
|
-
var
|
|
1611
|
+
var Pe = { exports: {} };
|
|
1510
1612
|
var gt;
|
|
1511
1613
|
function Gi() {
|
|
1512
1614
|
return gt || (gt = 1, (function(v, i) {
|
|
@@ -1518,173 +1620,173 @@ function Gi() {
|
|
|
1518
1620
|
var s = {
|
|
1519
1621
|
/***/
|
|
1520
1622
|
594(m, g) {
|
|
1521
|
-
var
|
|
1522
|
-
var
|
|
1523
|
-
return
|
|
1524
|
-
|
|
1525
|
-
} || function(
|
|
1526
|
-
for (var q in
|
|
1527
|
-
},
|
|
1623
|
+
var y = this && this.__extends || /* @__PURE__ */ (function() {
|
|
1624
|
+
var T = function(u, f) {
|
|
1625
|
+
return T = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(C, L) {
|
|
1626
|
+
C.__proto__ = L;
|
|
1627
|
+
} || function(C, L) {
|
|
1628
|
+
for (var q in L) L.hasOwnProperty(q) && (C[q] = L[q]);
|
|
1629
|
+
}, T(u, f);
|
|
1528
1630
|
};
|
|
1529
|
-
return function(
|
|
1530
|
-
|
|
1531
|
-
function
|
|
1532
|
-
this.constructor =
|
|
1631
|
+
return function(u, f) {
|
|
1632
|
+
T(u, f);
|
|
1633
|
+
function C() {
|
|
1634
|
+
this.constructor = u;
|
|
1533
1635
|
}
|
|
1534
|
-
|
|
1636
|
+
u.prototype = f === null ? Object.create(f) : (C.prototype = f.prototype, new C());
|
|
1535
1637
|
};
|
|
1536
1638
|
})();
|
|
1537
1639
|
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
1538
|
-
var
|
|
1640
|
+
var E = 256, S = (
|
|
1539
1641
|
/** @class */
|
|
1540
1642
|
(function() {
|
|
1541
|
-
function
|
|
1542
|
-
|
|
1643
|
+
function T(u) {
|
|
1644
|
+
u === void 0 && (u = "="), this._paddingCharacter = u;
|
|
1543
1645
|
}
|
|
1544
|
-
return
|
|
1545
|
-
return this._paddingCharacter ? (
|
|
1546
|
-
},
|
|
1547
|
-
for (var f = "",
|
|
1548
|
-
var
|
|
1549
|
-
f += this._encodeByte(
|
|
1646
|
+
return T.prototype.encodedLength = function(u) {
|
|
1647
|
+
return this._paddingCharacter ? (u + 2) / 3 * 4 | 0 : (u * 8 + 5) / 6 | 0;
|
|
1648
|
+
}, T.prototype.encode = function(u) {
|
|
1649
|
+
for (var f = "", C = 0; C < u.length - 2; C += 3) {
|
|
1650
|
+
var L = u[C] << 16 | u[C + 1] << 8 | u[C + 2];
|
|
1651
|
+
f += this._encodeByte(L >>> 18 & 63), f += this._encodeByte(L >>> 12 & 63), f += this._encodeByte(L >>> 6 & 63), f += this._encodeByte(L >>> 0 & 63);
|
|
1550
1652
|
}
|
|
1551
|
-
var q =
|
|
1653
|
+
var q = u.length - C;
|
|
1552
1654
|
if (q > 0) {
|
|
1553
|
-
var
|
|
1554
|
-
f += this._encodeByte(
|
|
1655
|
+
var L = u[C] << 16 | (q === 2 ? u[C + 1] << 8 : 0);
|
|
1656
|
+
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 || "";
|
|
1555
1657
|
}
|
|
1556
1658
|
return f;
|
|
1557
|
-
},
|
|
1558
|
-
return this._paddingCharacter ?
|
|
1559
|
-
},
|
|
1560
|
-
return this.maxDecodedLength(
|
|
1561
|
-
},
|
|
1562
|
-
if (
|
|
1659
|
+
}, T.prototype.maxDecodedLength = function(u) {
|
|
1660
|
+
return this._paddingCharacter ? u / 4 * 3 | 0 : (u * 6 + 7) / 8 | 0;
|
|
1661
|
+
}, T.prototype.decodedLength = function(u) {
|
|
1662
|
+
return this.maxDecodedLength(u.length - this._getPaddingLength(u));
|
|
1663
|
+
}, T.prototype.decode = function(u) {
|
|
1664
|
+
if (u.length === 0)
|
|
1563
1665
|
return new Uint8Array(0);
|
|
1564
|
-
for (var f = this._getPaddingLength(
|
|
1565
|
-
J = this._decodeChar(
|
|
1566
|
-
if (
|
|
1666
|
+
for (var f = this._getPaddingLength(u), C = u.length - f, L = new Uint8Array(this.maxDecodedLength(C)), q = 0, M = 0, z = 0, J = 0, D = 0, H = 0, G = 0; M < C - 4; M += 4)
|
|
1667
|
+
J = this._decodeChar(u.charCodeAt(M + 0)), D = this._decodeChar(u.charCodeAt(M + 1)), H = this._decodeChar(u.charCodeAt(M + 2)), G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = J << 2 | D >>> 4, L[q++] = D << 4 | H >>> 2, L[q++] = H << 6 | G, z |= J & E, z |= D & E, z |= H & E, z |= G & E;
|
|
1668
|
+
if (M < C - 1 && (J = this._decodeChar(u.charCodeAt(M)), D = this._decodeChar(u.charCodeAt(M + 1)), L[q++] = J << 2 | D >>> 4, z |= J & E, z |= D & E), M < C - 2 && (H = this._decodeChar(u.charCodeAt(M + 2)), L[q++] = D << 4 | H >>> 2, z |= H & E), M < C - 3 && (G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = H << 6 | G, z |= G & E), z !== 0)
|
|
1567
1669
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
1568
|
-
return
|
|
1569
|
-
},
|
|
1570
|
-
var f =
|
|
1571
|
-
return f += 65, f += 25 -
|
|
1572
|
-
},
|
|
1573
|
-
var f =
|
|
1574
|
-
return f += (42 -
|
|
1575
|
-
},
|
|
1670
|
+
return L;
|
|
1671
|
+
}, T.prototype._encodeByte = function(u) {
|
|
1672
|
+
var f = u;
|
|
1673
|
+
return f += 65, f += 25 - u >>> 8 & 6, f += 51 - u >>> 8 & -75, f += 61 - u >>> 8 & -15, f += 62 - u >>> 8 & 3, String.fromCharCode(f);
|
|
1674
|
+
}, T.prototype._decodeChar = function(u) {
|
|
1675
|
+
var f = E;
|
|
1676
|
+
return f += (42 - u & u - 44) >>> 8 & -E + u - 43 + 62, f += (46 - u & u - 48) >>> 8 & -E + u - 47 + 63, f += (47 - u & u - 58) >>> 8 & -E + u - 48 + 52, f += (64 - u & u - 91) >>> 8 & -E + u - 65 + 0, f += (96 - u & u - 123) >>> 8 & -E + u - 97 + 26, f;
|
|
1677
|
+
}, T.prototype._getPaddingLength = function(u) {
|
|
1576
1678
|
var f = 0;
|
|
1577
1679
|
if (this._paddingCharacter) {
|
|
1578
|
-
for (var
|
|
1680
|
+
for (var C = u.length - 1; C >= 0 && u[C] === this._paddingCharacter; C--)
|
|
1579
1681
|
f++;
|
|
1580
|
-
if (
|
|
1682
|
+
if (u.length < 4 || f > 2)
|
|
1581
1683
|
throw new Error("Base64Coder: incorrect padding");
|
|
1582
1684
|
}
|
|
1583
1685
|
return f;
|
|
1584
|
-
},
|
|
1686
|
+
}, T;
|
|
1585
1687
|
})()
|
|
1586
1688
|
);
|
|
1587
|
-
g.Coder =
|
|
1588
|
-
var
|
|
1589
|
-
function T
|
|
1590
|
-
return
|
|
1689
|
+
g.Coder = S;
|
|
1690
|
+
var O = new S();
|
|
1691
|
+
function x(T) {
|
|
1692
|
+
return O.encode(T);
|
|
1591
1693
|
}
|
|
1592
|
-
g.encode =
|
|
1593
|
-
function A(
|
|
1594
|
-
return
|
|
1694
|
+
g.encode = x;
|
|
1695
|
+
function A(T) {
|
|
1696
|
+
return O.decode(T);
|
|
1595
1697
|
}
|
|
1596
1698
|
g.decode = A;
|
|
1597
1699
|
var F = (
|
|
1598
1700
|
/** @class */
|
|
1599
|
-
(function(
|
|
1600
|
-
|
|
1601
|
-
function
|
|
1602
|
-
return
|
|
1701
|
+
(function(T) {
|
|
1702
|
+
y(u, T);
|
|
1703
|
+
function u() {
|
|
1704
|
+
return T !== null && T.apply(this, arguments) || this;
|
|
1603
1705
|
}
|
|
1604
|
-
return
|
|
1605
|
-
var
|
|
1606
|
-
return
|
|
1607
|
-
},
|
|
1608
|
-
var
|
|
1609
|
-
return
|
|
1610
|
-
},
|
|
1611
|
-
})(
|
|
1706
|
+
return u.prototype._encodeByte = function(f) {
|
|
1707
|
+
var C = f;
|
|
1708
|
+
return C += 65, C += 25 - f >>> 8 & 6, C += 51 - f >>> 8 & -75, C += 61 - f >>> 8 & -13, C += 62 - f >>> 8 & 49, String.fromCharCode(C);
|
|
1709
|
+
}, u.prototype._decodeChar = function(f) {
|
|
1710
|
+
var C = E;
|
|
1711
|
+
return C += (44 - f & f - 46) >>> 8 & -E + f - 45 + 62, C += (94 - f & f - 96) >>> 8 & -E + f - 95 + 63, C += (47 - f & f - 58) >>> 8 & -E + f - 48 + 52, C += (64 - f & f - 91) >>> 8 & -E + f - 65 + 0, C += (96 - f & f - 123) >>> 8 & -E + f - 97 + 26, C;
|
|
1712
|
+
}, u;
|
|
1713
|
+
})(S)
|
|
1612
1714
|
);
|
|
1613
1715
|
g.URLSafeCoder = F;
|
|
1614
1716
|
var N = new F();
|
|
1615
|
-
function W(
|
|
1616
|
-
return N.encode(
|
|
1717
|
+
function W(T) {
|
|
1718
|
+
return N.encode(T);
|
|
1617
1719
|
}
|
|
1618
1720
|
g.encodeURLSafe = W;
|
|
1619
|
-
function te(
|
|
1620
|
-
return N.decode(
|
|
1721
|
+
function te(T) {
|
|
1722
|
+
return N.decode(T);
|
|
1621
1723
|
}
|
|
1622
|
-
g.decodeURLSafe = te, g.encodedLength = function(
|
|
1623
|
-
return
|
|
1624
|
-
}, g.maxDecodedLength = function(
|
|
1625
|
-
return
|
|
1626
|
-
}, g.decodedLength = function(
|
|
1627
|
-
return
|
|
1724
|
+
g.decodeURLSafe = te, g.encodedLength = function(T) {
|
|
1725
|
+
return O.encodedLength(T);
|
|
1726
|
+
}, g.maxDecodedLength = function(T) {
|
|
1727
|
+
return O.maxDecodedLength(T);
|
|
1728
|
+
}, g.decodedLength = function(T) {
|
|
1729
|
+
return O.decodedLength(T);
|
|
1628
1730
|
};
|
|
1629
1731
|
},
|
|
1630
1732
|
/***/
|
|
1631
1733
|
978(m, g) {
|
|
1632
|
-
var
|
|
1633
|
-
function
|
|
1634
|
-
for (var
|
|
1635
|
-
var A =
|
|
1734
|
+
var y = "utf8: invalid source encoding";
|
|
1735
|
+
function E(S) {
|
|
1736
|
+
for (var O = [], x = 0; x < S.length; x++) {
|
|
1737
|
+
var A = S[x];
|
|
1636
1738
|
if (A & 128) {
|
|
1637
1739
|
var F = void 0;
|
|
1638
1740
|
if (A < 224) {
|
|
1639
|
-
if (
|
|
1640
|
-
throw new Error(
|
|
1641
|
-
var N =
|
|
1741
|
+
if (x >= S.length)
|
|
1742
|
+
throw new Error(y);
|
|
1743
|
+
var N = S[++x];
|
|
1642
1744
|
if ((N & 192) !== 128)
|
|
1643
|
-
throw new Error(
|
|
1745
|
+
throw new Error(y);
|
|
1644
1746
|
A = (A & 31) << 6 | N & 63, F = 128;
|
|
1645
1747
|
} else if (A < 240) {
|
|
1646
|
-
if (
|
|
1647
|
-
throw new Error(
|
|
1648
|
-
var N =
|
|
1748
|
+
if (x >= S.length - 1)
|
|
1749
|
+
throw new Error(y);
|
|
1750
|
+
var N = S[++x], W = S[++x];
|
|
1649
1751
|
if ((N & 192) !== 128 || (W & 192) !== 128)
|
|
1650
|
-
throw new Error(
|
|
1752
|
+
throw new Error(y);
|
|
1651
1753
|
A = (A & 15) << 12 | (N & 63) << 6 | W & 63, F = 2048;
|
|
1652
1754
|
} else if (A < 248) {
|
|
1653
|
-
if (
|
|
1654
|
-
throw new Error(
|
|
1655
|
-
var N =
|
|
1755
|
+
if (x >= S.length - 2)
|
|
1756
|
+
throw new Error(y);
|
|
1757
|
+
var N = S[++x], W = S[++x], te = S[++x];
|
|
1656
1758
|
if ((N & 192) !== 128 || (W & 192) !== 128 || (te & 192) !== 128)
|
|
1657
|
-
throw new Error(
|
|
1759
|
+
throw new Error(y);
|
|
1658
1760
|
A = (A & 15) << 18 | (N & 63) << 12 | (W & 63) << 6 | te & 63, F = 65536;
|
|
1659
1761
|
} else
|
|
1660
|
-
throw new Error(
|
|
1762
|
+
throw new Error(y);
|
|
1661
1763
|
if (A < F || A >= 55296 && A <= 57343)
|
|
1662
|
-
throw new Error(
|
|
1764
|
+
throw new Error(y);
|
|
1663
1765
|
if (A >= 65536) {
|
|
1664
1766
|
if (A > 1114111)
|
|
1665
|
-
throw new Error(
|
|
1666
|
-
A -= 65536,
|
|
1767
|
+
throw new Error(y);
|
|
1768
|
+
A -= 65536, O.push(String.fromCharCode(55296 | A >> 10)), A = 56320 | A & 1023;
|
|
1667
1769
|
}
|
|
1668
1770
|
}
|
|
1669
|
-
|
|
1771
|
+
O.push(String.fromCharCode(A));
|
|
1670
1772
|
}
|
|
1671
|
-
return
|
|
1773
|
+
return O.join("");
|
|
1672
1774
|
}
|
|
1673
|
-
g.D4 =
|
|
1775
|
+
g.D4 = E;
|
|
1674
1776
|
},
|
|
1675
1777
|
/***/
|
|
1676
|
-
721(m, g,
|
|
1677
|
-
m.exports =
|
|
1778
|
+
721(m, g, y) {
|
|
1779
|
+
m.exports = y(207).default;
|
|
1678
1780
|
},
|
|
1679
1781
|
/***/
|
|
1680
|
-
207(m, g,
|
|
1681
|
-
|
|
1782
|
+
207(m, g, y) {
|
|
1783
|
+
y.d(g, {
|
|
1682
1784
|
default: () => (
|
|
1683
1785
|
/* binding */
|
|
1684
|
-
|
|
1786
|
+
de
|
|
1685
1787
|
)
|
|
1686
1788
|
});
|
|
1687
|
-
class
|
|
1789
|
+
class E {
|
|
1688
1790
|
constructor(e, t) {
|
|
1689
1791
|
this.lastId = 0, this.prefix = e, this.name = t;
|
|
1690
1792
|
}
|
|
@@ -1699,7 +1801,7 @@ function Gi() {
|
|
|
1699
1801
|
delete this[e.number];
|
|
1700
1802
|
}
|
|
1701
1803
|
}
|
|
1702
|
-
var
|
|
1804
|
+
var S = new E("_pusher_script_", "Pusher.ScriptReceivers"), O = {
|
|
1703
1805
|
VERSION: "8.5.0",
|
|
1704
1806
|
PROTOCOL: 7,
|
|
1705
1807
|
wsPort: 80,
|
|
@@ -1727,10 +1829,10 @@ function Gi() {
|
|
|
1727
1829
|
cdn_https: "https://js.pusher.com",
|
|
1728
1830
|
dependency_suffix: ""
|
|
1729
1831
|
};
|
|
1730
|
-
const
|
|
1832
|
+
const x = O;
|
|
1731
1833
|
class A {
|
|
1732
1834
|
constructor(e) {
|
|
1733
|
-
this.options = e, this.receivers = e.receivers ||
|
|
1835
|
+
this.options = e, this.receivers = e.receivers || S, this.loading = {};
|
|
1734
1836
|
}
|
|
1735
1837
|
load(e, t, r) {
|
|
1736
1838
|
var o = this;
|
|
@@ -1738,32 +1840,32 @@ function Gi() {
|
|
|
1738
1840
|
o.loading[e].push(r);
|
|
1739
1841
|
else {
|
|
1740
1842
|
o.loading[e] = [r];
|
|
1741
|
-
var c =
|
|
1843
|
+
var c = w.createScriptRequest(o.getPath(e, t)), l = o.receivers.create(function(p) {
|
|
1742
1844
|
if (o.receivers.remove(l), o.loading[e]) {
|
|
1743
|
-
var
|
|
1845
|
+
var b = o.loading[e];
|
|
1744
1846
|
delete o.loading[e];
|
|
1745
|
-
for (var
|
|
1746
|
-
|
|
1747
|
-
}, k = 0; k <
|
|
1748
|
-
|
|
1847
|
+
for (var _ = function(R) {
|
|
1848
|
+
R || c.cleanup();
|
|
1849
|
+
}, k = 0; k < b.length; k++)
|
|
1850
|
+
b[k](p, _);
|
|
1749
1851
|
}
|
|
1750
1852
|
});
|
|
1751
1853
|
c.send(l);
|
|
1752
1854
|
}
|
|
1753
1855
|
}
|
|
1754
1856
|
getRoot(e) {
|
|
1755
|
-
var t, r =
|
|
1857
|
+
var t, r = w.getDocument().location.protocol;
|
|
1756
1858
|
return e && e.useTLS || r === "https:" ? t = this.options.cdn_https : t = this.options.cdn_http, t.replace(/\/*$/, "") + "/" + this.options.version;
|
|
1757
1859
|
}
|
|
1758
1860
|
getPath(e, t) {
|
|
1759
1861
|
return this.getRoot(t) + "/" + e + this.options.suffix + ".js";
|
|
1760
1862
|
}
|
|
1761
1863
|
}
|
|
1762
|
-
var F = new
|
|
1763
|
-
cdn_http:
|
|
1764
|
-
cdn_https:
|
|
1765
|
-
version:
|
|
1766
|
-
suffix:
|
|
1864
|
+
var F = new E("_pusher_dependencies", "Pusher.DependenciesReceivers"), N = new A({
|
|
1865
|
+
cdn_http: x.cdn_http,
|
|
1866
|
+
cdn_https: x.cdn_https,
|
|
1867
|
+
version: x.VERSION,
|
|
1868
|
+
suffix: x.dependency_suffix,
|
|
1767
1869
|
receivers: F
|
|
1768
1870
|
});
|
|
1769
1871
|
const W = {
|
|
@@ -1785,28 +1887,28 @@ function Gi() {
|
|
|
1785
1887
|
fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"
|
|
1786
1888
|
}
|
|
1787
1889
|
}
|
|
1788
|
-
},
|
|
1890
|
+
}, T = { buildLogSuffix: function(n) {
|
|
1789
1891
|
const e = "See:", t = W.urls[n];
|
|
1790
1892
|
if (!t)
|
|
1791
1893
|
return "";
|
|
1792
1894
|
let r;
|
|
1793
1895
|
return t.fullUrl ? r = t.fullUrl : t.path && (r = W.baseUrl + t.path), r ? `${e} ${r}` : "";
|
|
1794
1896
|
} };
|
|
1795
|
-
var
|
|
1897
|
+
var u;
|
|
1796
1898
|
(function(n) {
|
|
1797
1899
|
n.UserAuthentication = "user-authentication", n.ChannelAuthorization = "channel-authorization";
|
|
1798
|
-
})(
|
|
1900
|
+
})(u || (u = {}));
|
|
1799
1901
|
class f extends Error {
|
|
1800
1902
|
constructor(e) {
|
|
1801
1903
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1802
1904
|
}
|
|
1803
1905
|
}
|
|
1804
|
-
class
|
|
1906
|
+
class C extends Error {
|
|
1805
1907
|
constructor(e) {
|
|
1806
1908
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1807
1909
|
}
|
|
1808
1910
|
}
|
|
1809
|
-
class
|
|
1911
|
+
class L extends Error {
|
|
1810
1912
|
constructor(e) {
|
|
1811
1913
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1812
1914
|
}
|
|
@@ -1816,7 +1918,7 @@ function Gi() {
|
|
|
1816
1918
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1817
1919
|
}
|
|
1818
1920
|
}
|
|
1819
|
-
class
|
|
1921
|
+
class M extends Error {
|
|
1820
1922
|
constructor(e) {
|
|
1821
1923
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1822
1924
|
}
|
|
@@ -1841,8 +1943,8 @@ function Gi() {
|
|
|
1841
1943
|
super(t), this.status = e, Object.setPrototypeOf(this, new.target.prototype);
|
|
1842
1944
|
}
|
|
1843
1945
|
}
|
|
1844
|
-
const
|
|
1845
|
-
const c =
|
|
1946
|
+
const Lt = function(n, e, t, r, o) {
|
|
1947
|
+
const c = w.createXHR();
|
|
1846
1948
|
c.open("POST", t.endpoint, !0), c.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
1847
1949
|
for (var l in t.headers)
|
|
1848
1950
|
c.setRequestHeader(l, t.headers[l]);
|
|
@@ -1854,28 +1956,28 @@ function Gi() {
|
|
|
1854
1956
|
return c.onreadystatechange = function() {
|
|
1855
1957
|
if (c.readyState === 4)
|
|
1856
1958
|
if (c.status === 200) {
|
|
1857
|
-
let p,
|
|
1959
|
+
let p, b = !1;
|
|
1858
1960
|
try {
|
|
1859
|
-
p = JSON.parse(c.responseText),
|
|
1961
|
+
p = JSON.parse(c.responseText), b = !0;
|
|
1860
1962
|
} catch {
|
|
1861
1963
|
o(new H(200, `JSON returned from ${r.toString()} endpoint was invalid, yet status code was 200. Data was: ${c.responseText}`), null);
|
|
1862
1964
|
}
|
|
1863
|
-
|
|
1965
|
+
b && o(null, p);
|
|
1864
1966
|
} else {
|
|
1865
1967
|
let p = "";
|
|
1866
1968
|
switch (r) {
|
|
1867
|
-
case
|
|
1868
|
-
p =
|
|
1969
|
+
case u.UserAuthentication:
|
|
1970
|
+
p = T.buildLogSuffix("authenticationEndpoint");
|
|
1869
1971
|
break;
|
|
1870
|
-
case
|
|
1871
|
-
p = `Clients must be authorized to join private or presence channels. ${
|
|
1972
|
+
case u.ChannelAuthorization:
|
|
1973
|
+
p = `Clients must be authorized to join private or presence channels. ${T.buildLogSuffix("authorizationEndpoint")}`;
|
|
1872
1974
|
break;
|
|
1873
1975
|
}
|
|
1874
1976
|
o(new H(c.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${c.status} from ${t.endpoint}. ${p}`), null);
|
|
1875
1977
|
}
|
|
1876
1978
|
}, c.send(e), c;
|
|
1877
1979
|
};
|
|
1878
|
-
function
|
|
1980
|
+
function Pt(n) {
|
|
1879
1981
|
return qt(It(n));
|
|
1880
1982
|
}
|
|
1881
1983
|
var ne = String.fromCharCode, oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Rt = function(n) {
|
|
@@ -1911,7 +2013,7 @@ function Gi() {
|
|
|
1911
2013
|
function Nt(n) {
|
|
1912
2014
|
window.clearTimeout(n);
|
|
1913
2015
|
}
|
|
1914
|
-
function
|
|
2016
|
+
function Mt(n) {
|
|
1915
2017
|
window.clearInterval(n);
|
|
1916
2018
|
}
|
|
1917
2019
|
class Y extends ze {
|
|
@@ -1921,9 +2023,9 @@ function Gi() {
|
|
|
1921
2023
|
});
|
|
1922
2024
|
}
|
|
1923
2025
|
}
|
|
1924
|
-
class
|
|
2026
|
+
class jt extends ze {
|
|
1925
2027
|
constructor(e, t) {
|
|
1926
|
-
super(setInterval,
|
|
2028
|
+
super(setInterval, Mt, e, function(r) {
|
|
1927
2029
|
return t(), r;
|
|
1928
2030
|
});
|
|
1929
2031
|
}
|
|
@@ -1943,11 +2045,11 @@ function Gi() {
|
|
|
1943
2045
|
}
|
|
1944
2046
|
};
|
|
1945
2047
|
const U = zt;
|
|
1946
|
-
function
|
|
2048
|
+
function j(n, ...e) {
|
|
1947
2049
|
for (var t = 0; t < e.length; t++) {
|
|
1948
2050
|
var r = e[t];
|
|
1949
2051
|
for (var o in r)
|
|
1950
|
-
r[o] && r[o].constructor && r[o].constructor === Object ? n[o] =
|
|
2052
|
+
r[o] && r[o].constructor && r[o].constructor === Object ? n[o] = j(n[o] || {}, r[o]) : n[o] = r[o];
|
|
1951
2053
|
}
|
|
1952
2054
|
return n;
|
|
1953
2055
|
}
|
|
@@ -2032,19 +2134,19 @@ function Gi() {
|
|
|
2032
2134
|
}
|
|
2033
2135
|
function $t(n) {
|
|
2034
2136
|
return Ft(n, function(e) {
|
|
2035
|
-
return typeof e == "object" && (e = ae(e)), encodeURIComponent(
|
|
2137
|
+
return typeof e == "object" && (e = ae(e)), encodeURIComponent(Pt(e.toString()));
|
|
2036
2138
|
});
|
|
2037
2139
|
}
|
|
2038
|
-
function
|
|
2140
|
+
function Vt(n) {
|
|
2039
2141
|
var e = Be(n, function(r) {
|
|
2040
2142
|
return r !== void 0;
|
|
2041
2143
|
}), t = Fe(Wt($t(e)), U.method("join", "=")).join("&");
|
|
2042
2144
|
return t;
|
|
2043
2145
|
}
|
|
2044
|
-
function
|
|
2146
|
+
function Xt(n) {
|
|
2045
2147
|
var e = [], t = [];
|
|
2046
2148
|
return (function r(o, c) {
|
|
2047
|
-
var l, p,
|
|
2149
|
+
var l, p, b;
|
|
2048
2150
|
switch (typeof o) {
|
|
2049
2151
|
case "object":
|
|
2050
2152
|
if (!o)
|
|
@@ -2053,14 +2155,14 @@ function Gi() {
|
|
|
2053
2155
|
if (e[l] === o)
|
|
2054
2156
|
return { $ref: t[l] };
|
|
2055
2157
|
if (e.push(o), t.push(c), Object.prototype.toString.apply(o) === "[object Array]")
|
|
2056
|
-
for (
|
|
2057
|
-
|
|
2158
|
+
for (b = [], l = 0; l < o.length; l += 1)
|
|
2159
|
+
b[l] = r(o[l], c + "[" + l + "]");
|
|
2058
2160
|
else {
|
|
2059
|
-
|
|
2161
|
+
b = {};
|
|
2060
2162
|
for (p in o)
|
|
2061
|
-
Object.prototype.hasOwnProperty.call(o, p) && (
|
|
2163
|
+
Object.prototype.hasOwnProperty.call(o, p) && (b[p] = r(o[p], c + "[" + JSON.stringify(p) + "]"));
|
|
2062
2164
|
}
|
|
2063
|
-
return
|
|
2165
|
+
return b;
|
|
2064
2166
|
case "number":
|
|
2065
2167
|
case "string":
|
|
2066
2168
|
case "boolean":
|
|
@@ -2072,7 +2174,7 @@ function Gi() {
|
|
|
2072
2174
|
try {
|
|
2073
2175
|
return JSON.stringify(n);
|
|
2074
2176
|
} catch {
|
|
2075
|
-
return JSON.stringify(
|
|
2177
|
+
return JSON.stringify(Xt(n));
|
|
2076
2178
|
}
|
|
2077
2179
|
}
|
|
2078
2180
|
class Jt {
|
|
@@ -2098,22 +2200,22 @@ function Gi() {
|
|
|
2098
2200
|
}
|
|
2099
2201
|
log(e, ...t) {
|
|
2100
2202
|
var r = Ht.apply(this, arguments);
|
|
2101
|
-
|
|
2203
|
+
de.log ? de.log(r) : de.logToConsole && e.bind(this)(r);
|
|
2102
2204
|
}
|
|
2103
2205
|
}
|
|
2104
|
-
const
|
|
2206
|
+
const P = new Jt();
|
|
2105
2207
|
var Gt = function(n, e, t, r, o) {
|
|
2106
|
-
(t.headers !== void 0 || t.headersProvider != null) &&
|
|
2208
|
+
(t.headers !== void 0 || t.headersProvider != null) && P.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
2107
2209
|
var c = n.nextAuthCallbackID.toString();
|
|
2108
2210
|
n.nextAuthCallbackID++;
|
|
2109
2211
|
var l = n.getDocument(), p = l.createElement("script");
|
|
2110
2212
|
n.auth_callbacks[c] = function(k) {
|
|
2111
2213
|
o(null, k);
|
|
2112
2214
|
};
|
|
2113
|
-
var
|
|
2114
|
-
p.src = t.endpoint + "?callback=" + encodeURIComponent(
|
|
2115
|
-
var
|
|
2116
|
-
|
|
2215
|
+
var b = "Pusher.auth_callbacks['" + c + "']";
|
|
2216
|
+
p.src = t.endpoint + "?callback=" + encodeURIComponent(b) + "&" + e;
|
|
2217
|
+
var _ = l.getElementsByTagName("head")[0] || l.documentElement;
|
|
2218
|
+
_.insertBefore(p, _.firstChild);
|
|
2117
2219
|
};
|
|
2118
2220
|
const Yt = Gt;
|
|
2119
2221
|
class Kt {
|
|
@@ -2142,8 +2244,8 @@ function Gi() {
|
|
|
2142
2244
|
}
|
|
2143
2245
|
send(e) {
|
|
2144
2246
|
if (!this.request) {
|
|
2145
|
-
var t =
|
|
2146
|
-
this.request =
|
|
2247
|
+
var t = Vt(this.data), r = this.url + "/" + e.number + "?" + t;
|
|
2248
|
+
this.request = w.createScriptRequest(r), this.request.send(e);
|
|
2147
2249
|
}
|
|
2148
2250
|
}
|
|
2149
2251
|
cleanup() {
|
|
@@ -2152,8 +2254,8 @@ function Gi() {
|
|
|
2152
2254
|
}
|
|
2153
2255
|
var Zt = function(n, e) {
|
|
2154
2256
|
return function(t, r) {
|
|
2155
|
-
var o = "http" + (e ? "s" : "") + "://", c = o + (n.host || n.options.host) + n.options.path, l =
|
|
2156
|
-
|
|
2257
|
+
var o = "http" + (e ? "s" : "") + "://", c = o + (n.host || n.options.host) + n.options.path, l = w.createJSONPRequest(c, t), p = w.ScriptReceivers.create(function(b, _) {
|
|
2258
|
+
S.remove(p), l.cleanup(), _ && _.host && (n.host = _.host), r && r(b, _);
|
|
2157
2259
|
});
|
|
2158
2260
|
l.send(p);
|
|
2159
2261
|
};
|
|
@@ -2162,30 +2264,30 @@ function Gi() {
|
|
|
2162
2264
|
getAgent: Zt
|
|
2163
2265
|
};
|
|
2164
2266
|
const tn = en;
|
|
2165
|
-
function
|
|
2267
|
+
function ye(n, e, t) {
|
|
2166
2268
|
var r = n + (e.useTLS ? "s" : ""), o = e.useTLS ? e.hostTLS : e.hostNonTLS;
|
|
2167
2269
|
return r + "://" + o + t;
|
|
2168
2270
|
}
|
|
2169
|
-
function
|
|
2170
|
-
var t = "/app/" + n, r = "?protocol=" +
|
|
2271
|
+
function be(n, e) {
|
|
2272
|
+
var t = "/app/" + n, r = "?protocol=" + x.PROTOCOL + "&client=js&version=" + x.VERSION + (e ? "&" + e : "");
|
|
2171
2273
|
return t + r;
|
|
2172
2274
|
}
|
|
2173
2275
|
var nn = {
|
|
2174
2276
|
getInitial: function(n, e) {
|
|
2175
|
-
var t = (e.httpPath || "") +
|
|
2176
|
-
return
|
|
2277
|
+
var t = (e.httpPath || "") + be(n, "flash=false");
|
|
2278
|
+
return ye("ws", e, t);
|
|
2177
2279
|
}
|
|
2178
2280
|
}, rn = {
|
|
2179
2281
|
getInitial: function(n, e) {
|
|
2180
|
-
var t = (e.httpPath || "/pusher") +
|
|
2181
|
-
return
|
|
2282
|
+
var t = (e.httpPath || "/pusher") + be(n);
|
|
2283
|
+
return ye("http", e, t);
|
|
2182
2284
|
}
|
|
2183
2285
|
}, sn = {
|
|
2184
2286
|
getInitial: function(n, e) {
|
|
2185
|
-
return
|
|
2287
|
+
return ye("http", e, e.httpPath || "/pusher");
|
|
2186
2288
|
},
|
|
2187
2289
|
getPath: function(n, e) {
|
|
2188
|
-
return
|
|
2290
|
+
return be(n);
|
|
2189
2291
|
}
|
|
2190
2292
|
};
|
|
2191
2293
|
class on {
|
|
@@ -2258,7 +2360,7 @@ function Gi() {
|
|
|
2258
2360
|
}
|
|
2259
2361
|
class an extends $ {
|
|
2260
2362
|
constructor(e, t, r, o, c) {
|
|
2261
|
-
super(), this.initialize =
|
|
2363
|
+
super(), this.initialize = w.transportConnectionInitializer, this.hooks = e, this.name = t, this.priority = r, this.key = o, this.options = c, this.state = "new", this.timeline = c.timeline, this.activityTimeout = c.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
2262
2364
|
}
|
|
2263
2365
|
handlesActivityChecks() {
|
|
2264
2366
|
return !!this.hooks.handlesActivityChecks;
|
|
@@ -2277,7 +2379,7 @@ function Gi() {
|
|
|
2277
2379
|
this.onError(t), this.changeState("closed");
|
|
2278
2380
|
}), !1;
|
|
2279
2381
|
}
|
|
2280
|
-
return this.bindListeners(),
|
|
2382
|
+
return this.bindListeners(), P.debug("Connecting", { transport: this.name, url: e }), this.changeState("connecting"), !0;
|
|
2281
2383
|
}
|
|
2282
2384
|
close() {
|
|
2283
2385
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
@@ -2332,7 +2434,7 @@ function Gi() {
|
|
|
2332
2434
|
})), this.emit(e, t);
|
|
2333
2435
|
}
|
|
2334
2436
|
buildTimelineMessage(e) {
|
|
2335
|
-
return
|
|
2437
|
+
return j({ cid: this.id }, e);
|
|
2336
2438
|
}
|
|
2337
2439
|
}
|
|
2338
2440
|
class ee {
|
|
@@ -2351,40 +2453,40 @@ function Gi() {
|
|
|
2351
2453
|
handlesActivityChecks: !1,
|
|
2352
2454
|
supportsPing: !1,
|
|
2353
2455
|
isInitialized: function() {
|
|
2354
|
-
return !!
|
|
2456
|
+
return !!w.getWebSocketAPI();
|
|
2355
2457
|
},
|
|
2356
2458
|
isSupported: function() {
|
|
2357
|
-
return !!
|
|
2459
|
+
return !!w.getWebSocketAPI();
|
|
2358
2460
|
},
|
|
2359
2461
|
getSocket: function(n) {
|
|
2360
|
-
return
|
|
2462
|
+
return w.createWebSocket(n);
|
|
2361
2463
|
}
|
|
2362
|
-
}),
|
|
2464
|
+
}), Ve = {
|
|
2363
2465
|
urls: rn,
|
|
2364
2466
|
handlesActivityChecks: !1,
|
|
2365
2467
|
supportsPing: !0,
|
|
2366
2468
|
isInitialized: function() {
|
|
2367
2469
|
return !0;
|
|
2368
2470
|
}
|
|
2369
|
-
},
|
|
2471
|
+
}, Xe = j({
|
|
2370
2472
|
getSocket: function(n) {
|
|
2371
|
-
return
|
|
2473
|
+
return w.HTTPFactory.createStreamingSocket(n);
|
|
2372
2474
|
}
|
|
2373
|
-
},
|
|
2475
|
+
}, Ve), Je = j({
|
|
2374
2476
|
getSocket: function(n) {
|
|
2375
|
-
return
|
|
2477
|
+
return w.HTTPFactory.createPollingSocket(n);
|
|
2376
2478
|
}
|
|
2377
|
-
},
|
|
2479
|
+
}, Ve), Ge = {
|
|
2378
2480
|
isSupported: function() {
|
|
2379
|
-
return
|
|
2481
|
+
return w.isXHRSupported();
|
|
2380
2482
|
}
|
|
2381
|
-
}, hn = new ee(
|
|
2483
|
+
}, hn = new ee(j({}, Xe, Ge)), ln = new ee(j({}, Je, Ge)), dn = {
|
|
2382
2484
|
ws: cn,
|
|
2383
2485
|
xhr_streaming: hn,
|
|
2384
2486
|
xhr_polling: ln
|
|
2385
2487
|
};
|
|
2386
|
-
const ce =
|
|
2387
|
-
var
|
|
2488
|
+
const ce = dn;
|
|
2489
|
+
var un = new ee({
|
|
2388
2490
|
file: "sockjs",
|
|
2389
2491
|
urls: sn,
|
|
2390
2492
|
handlesActivityChecks: !0,
|
|
@@ -2410,11 +2512,11 @@ function Gi() {
|
|
|
2410
2512
|
}
|
|
2411
2513
|
}), Ye = {
|
|
2412
2514
|
isSupported: function(n) {
|
|
2413
|
-
var e =
|
|
2515
|
+
var e = w.isXDRSupported(n.useTLS);
|
|
2414
2516
|
return e;
|
|
2415
2517
|
}
|
|
2416
|
-
}, fn = new ee(
|
|
2417
|
-
ce.xdr_streaming = fn, ce.xdr_polling = pn, ce.sockjs =
|
|
2518
|
+
}, fn = new ee(j({}, Xe, Ye)), pn = new ee(j({}, Je, Ye));
|
|
2519
|
+
ce.xdr_streaming = fn, ce.xdr_polling = pn, ce.sockjs = un;
|
|
2418
2520
|
const mn = ce;
|
|
2419
2521
|
class gn extends $ {
|
|
2420
2522
|
constructor() {
|
|
@@ -2431,20 +2533,20 @@ function Gi() {
|
|
|
2431
2533
|
}
|
|
2432
2534
|
}
|
|
2433
2535
|
var vn = new gn();
|
|
2434
|
-
class
|
|
2536
|
+
class yn {
|
|
2435
2537
|
constructor(e, t, r) {
|
|
2436
2538
|
this.manager = e, this.transport = t, this.minPingDelay = r.minPingDelay, this.maxPingDelay = r.maxPingDelay, this.pingDelay = void 0;
|
|
2437
2539
|
}
|
|
2438
2540
|
createConnection(e, t, r, o) {
|
|
2439
|
-
o =
|
|
2541
|
+
o = j({}, o, {
|
|
2440
2542
|
activityTimeout: this.pingDelay
|
|
2441
2543
|
});
|
|
2442
2544
|
var c = this.transport.createConnection(e, t, r, o), l = null, p = function() {
|
|
2443
|
-
c.unbind("open", p), c.bind("closed",
|
|
2444
|
-
},
|
|
2445
|
-
if (c.unbind("closed",
|
|
2545
|
+
c.unbind("open", p), c.bind("closed", b), l = U.now();
|
|
2546
|
+
}, b = (_) => {
|
|
2547
|
+
if (c.unbind("closed", b), _.code === 1002 || _.code === 1003)
|
|
2446
2548
|
this.manager.reportDeath();
|
|
2447
|
-
else if (!
|
|
2549
|
+
else if (!_.wasClean && l) {
|
|
2448
2550
|
var k = U.now() - l;
|
|
2449
2551
|
k < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(k / 2, this.minPingDelay));
|
|
2450
2552
|
}
|
|
@@ -2509,7 +2611,7 @@ function Gi() {
|
|
|
2509
2611
|
} : null;
|
|
2510
2612
|
}
|
|
2511
2613
|
}, K = Ke;
|
|
2512
|
-
class
|
|
2614
|
+
class bn extends $ {
|
|
2513
2615
|
constructor(e, t) {
|
|
2514
2616
|
super(), this.id = e, this.transport = t, this.activityTimeout = t.activityTimeout, this.bindListeners();
|
|
2515
2617
|
}
|
|
@@ -2521,7 +2623,7 @@ function Gi() {
|
|
|
2521
2623
|
}
|
|
2522
2624
|
send_event(e, t, r) {
|
|
2523
2625
|
var o = { event: e, data: t };
|
|
2524
|
-
return r && (o.channel = r),
|
|
2626
|
+
return r && (o.channel = r), P.debug("Event sent", o), this.send(K.encodeMessage(o));
|
|
2525
2627
|
}
|
|
2526
2628
|
ping() {
|
|
2527
2629
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -2543,7 +2645,7 @@ function Gi() {
|
|
|
2543
2645
|
});
|
|
2544
2646
|
}
|
|
2545
2647
|
if (o !== void 0) {
|
|
2546
|
-
switch (
|
|
2648
|
+
switch (P.debug("Event recd", o), o.event) {
|
|
2547
2649
|
case "pusher:error":
|
|
2548
2650
|
this.emit("error", {
|
|
2549
2651
|
type: "PusherError",
|
|
@@ -2601,7 +2703,7 @@ function Gi() {
|
|
|
2601
2703
|
return;
|
|
2602
2704
|
}
|
|
2603
2705
|
t.action === "connected" ? this.finish("connected", {
|
|
2604
|
-
connection: new
|
|
2706
|
+
connection: new bn(t.id, this.transport),
|
|
2605
2707
|
activityTimeout: t.activityTimeout
|
|
2606
2708
|
}) : (this.finish(t.action, { error: t.error }), this.transport.close());
|
|
2607
2709
|
}, this.onClosed = (e) => {
|
|
@@ -2614,7 +2716,7 @@ function Gi() {
|
|
|
2614
2716
|
this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
|
|
2615
2717
|
}
|
|
2616
2718
|
finish(e, t) {
|
|
2617
|
-
this.callback(
|
|
2719
|
+
this.callback(j({ transport: this.transport, action: e }, t));
|
|
2618
2720
|
}
|
|
2619
2721
|
}
|
|
2620
2722
|
class Cn {
|
|
@@ -2622,13 +2724,13 @@ function Gi() {
|
|
|
2622
2724
|
this.timeline = e, this.options = t || {};
|
|
2623
2725
|
}
|
|
2624
2726
|
send(e, t) {
|
|
2625
|
-
this.timeline.isEmpty() || this.timeline.send(
|
|
2727
|
+
this.timeline.isEmpty() || this.timeline.send(w.TimelineTransport.getAgent(this, e), t);
|
|
2626
2728
|
}
|
|
2627
2729
|
}
|
|
2628
2730
|
class Ce extends $ {
|
|
2629
2731
|
constructor(e, t) {
|
|
2630
2732
|
super(function(r, o) {
|
|
2631
|
-
|
|
2733
|
+
P.debug("No callbacks on " + e + " for " + r);
|
|
2632
2734
|
}), this.name = e, this.pusher = t, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
2633
2735
|
}
|
|
2634
2736
|
authorize(e, t) {
|
|
@@ -2638,8 +2740,8 @@ function Gi() {
|
|
|
2638
2740
|
if (e.indexOf("client-") !== 0)
|
|
2639
2741
|
throw new f("Event '" + e + "' does not start with 'client-'");
|
|
2640
2742
|
if (!this.subscribed) {
|
|
2641
|
-
var r =
|
|
2642
|
-
|
|
2743
|
+
var r = T.buildLogSuffix("triggeringClientEvents");
|
|
2744
|
+
P.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`);
|
|
2643
2745
|
}
|
|
2644
2746
|
return this.pusher.send_event(e, t, this.name);
|
|
2645
2747
|
}
|
|
@@ -2665,7 +2767,7 @@ function Gi() {
|
|
|
2665
2767
|
}
|
|
2666
2768
|
subscribe() {
|
|
2667
2769
|
this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (e, t) => {
|
|
2668
|
-
e ? (this.subscriptionPending = !1,
|
|
2770
|
+
e ? (this.subscriptionPending = !1, P.error(e.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
|
|
2669
2771
|
type: "AuthError",
|
|
2670
2772
|
error: e.message
|
|
2671
2773
|
}, e instanceof H ? { status: e.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
|
|
@@ -2727,7 +2829,7 @@ function Gi() {
|
|
|
2727
2829
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
2728
2830
|
}
|
|
2729
2831
|
}
|
|
2730
|
-
var
|
|
2832
|
+
var xn = function(n, e, t, r) {
|
|
2731
2833
|
function o(c) {
|
|
2732
2834
|
return c instanceof t ? c : new t(function(l) {
|
|
2733
2835
|
l(c);
|
|
@@ -2736,30 +2838,30 @@ function Gi() {
|
|
|
2736
2838
|
return new (t || (t = Promise))(function(c, l) {
|
|
2737
2839
|
function p(k) {
|
|
2738
2840
|
try {
|
|
2739
|
-
|
|
2740
|
-
} catch (
|
|
2741
|
-
l(
|
|
2841
|
+
_(r.next(k));
|
|
2842
|
+
} catch (R) {
|
|
2843
|
+
l(R);
|
|
2742
2844
|
}
|
|
2743
2845
|
}
|
|
2744
|
-
function
|
|
2846
|
+
function b(k) {
|
|
2745
2847
|
try {
|
|
2746
|
-
|
|
2747
|
-
} catch (
|
|
2748
|
-
l(
|
|
2848
|
+
_(r.throw(k));
|
|
2849
|
+
} catch (R) {
|
|
2850
|
+
l(R);
|
|
2749
2851
|
}
|
|
2750
2852
|
}
|
|
2751
|
-
function
|
|
2752
|
-
k.done ? c(k.value) : o(k.value).then(p,
|
|
2853
|
+
function _(k) {
|
|
2854
|
+
k.done ? c(k.value) : o(k.value).then(p, b);
|
|
2753
2855
|
}
|
|
2754
|
-
|
|
2856
|
+
_((r = r.apply(n, e || [])).next());
|
|
2755
2857
|
});
|
|
2756
2858
|
};
|
|
2757
|
-
class
|
|
2859
|
+
class Tn extends Se {
|
|
2758
2860
|
constructor(e, t) {
|
|
2759
2861
|
super(e, t), this.members = new Sn();
|
|
2760
2862
|
}
|
|
2761
2863
|
authorize(e, t) {
|
|
2762
|
-
super.authorize(e, (r, o) =>
|
|
2864
|
+
super.authorize(e, (r, o) => xn(this, void 0, void 0, function* () {
|
|
2763
2865
|
if (!r)
|
|
2764
2866
|
if (o = o, o.channel_data != null) {
|
|
2765
2867
|
var c = JSON.parse(o.channel_data);
|
|
@@ -2767,8 +2869,8 @@ function Gi() {
|
|
|
2767
2869
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
2768
2870
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
2769
2871
|
else {
|
|
2770
|
-
let l =
|
|
2771
|
-
|
|
2872
|
+
let l = T.buildLogSuffix("authorizationEndpoint");
|
|
2873
|
+
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");
|
|
2772
2874
|
return;
|
|
2773
2875
|
}
|
|
2774
2876
|
t(r, o);
|
|
@@ -2809,8 +2911,8 @@ function Gi() {
|
|
|
2809
2911
|
this.members.reset(), super.disconnect();
|
|
2810
2912
|
}
|
|
2811
2913
|
}
|
|
2812
|
-
var
|
|
2813
|
-
class
|
|
2914
|
+
var En = y(978), xe = y(594);
|
|
2915
|
+
class _n extends Se {
|
|
2814
2916
|
constructor(e, t, r) {
|
|
2815
2917
|
super(e, t), this.key = null, this.nacl = r;
|
|
2816
2918
|
}
|
|
@@ -2825,7 +2927,7 @@ function Gi() {
|
|
|
2825
2927
|
t(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2826
2928
|
return;
|
|
2827
2929
|
}
|
|
2828
|
-
this.key = (0,
|
|
2930
|
+
this.key = (0, xe.decode)(c), delete o.shared_secret, t(null, o);
|
|
2829
2931
|
});
|
|
2830
2932
|
}
|
|
2831
2933
|
trigger(e, t) {
|
|
@@ -2841,32 +2943,32 @@ function Gi() {
|
|
|
2841
2943
|
}
|
|
2842
2944
|
handleEncryptedEvent(e, t) {
|
|
2843
2945
|
if (!this.key) {
|
|
2844
|
-
|
|
2946
|
+
P.debug("Received encrypted event before key has been retrieved from the authEndpoint");
|
|
2845
2947
|
return;
|
|
2846
2948
|
}
|
|
2847
2949
|
if (!t.ciphertext || !t.nonce) {
|
|
2848
|
-
|
|
2950
|
+
P.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + t);
|
|
2849
2951
|
return;
|
|
2850
2952
|
}
|
|
2851
|
-
let r = (0,
|
|
2953
|
+
let r = (0, xe.decode)(t.ciphertext);
|
|
2852
2954
|
if (r.length < this.nacl.secretbox.overheadLength) {
|
|
2853
|
-
|
|
2955
|
+
P.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);
|
|
2854
2956
|
return;
|
|
2855
2957
|
}
|
|
2856
|
-
let o = (0,
|
|
2958
|
+
let o = (0, xe.decode)(t.nonce);
|
|
2857
2959
|
if (o.length < this.nacl.secretbox.nonceLength) {
|
|
2858
|
-
|
|
2960
|
+
P.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${o.length}`);
|
|
2859
2961
|
return;
|
|
2860
2962
|
}
|
|
2861
2963
|
let c = this.nacl.secretbox.open(r, o, this.key);
|
|
2862
2964
|
if (c === null) {
|
|
2863
|
-
|
|
2965
|
+
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) => {
|
|
2864
2966
|
if (l) {
|
|
2865
|
-
|
|
2967
|
+
P.error(`Failed to make a request to the authEndpoint: ${p}. Unable to fetch new key, so dropping encrypted event`);
|
|
2866
2968
|
return;
|
|
2867
2969
|
}
|
|
2868
2970
|
if (c = this.nacl.secretbox.open(r, o, this.key), c === null) {
|
|
2869
|
-
|
|
2971
|
+
P.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
2870
2972
|
return;
|
|
2871
2973
|
}
|
|
2872
2974
|
this.emit(e, this.getDataToEmit(c));
|
|
@@ -2876,7 +2978,7 @@ function Gi() {
|
|
|
2876
2978
|
this.emit(e, this.getDataToEmit(c));
|
|
2877
2979
|
}
|
|
2878
2980
|
getDataToEmit(e) {
|
|
2879
|
-
let t = (0,
|
|
2981
|
+
let t = (0, En.D4)(e);
|
|
2880
2982
|
try {
|
|
2881
2983
|
return JSON.parse(t);
|
|
2882
2984
|
} catch {
|
|
@@ -2887,7 +2989,7 @@ function Gi() {
|
|
|
2887
2989
|
class kn extends $ {
|
|
2888
2990
|
constructor(e, t) {
|
|
2889
2991
|
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);
|
|
2890
|
-
var r =
|
|
2992
|
+
var r = w.getNetwork();
|
|
2891
2993
|
r.bind("online", () => {
|
|
2892
2994
|
this.timeline.info({ netinfo: "online" }), (this.state === "connecting" || this.state === "unavailable") && this.retryIn(0);
|
|
2893
2995
|
}), r.bind("offline", () => {
|
|
@@ -2973,7 +3075,7 @@ function Gi() {
|
|
|
2973
3075
|
this.activityTimer && this.activityTimer.ensureAborted();
|
|
2974
3076
|
}
|
|
2975
3077
|
buildConnectionCallbacks(e) {
|
|
2976
|
-
return
|
|
3078
|
+
return j({}, e, {
|
|
2977
3079
|
message: (t) => {
|
|
2978
3080
|
this.resetActivityCheck(), this.emit("message", t);
|
|
2979
3081
|
},
|
|
@@ -2992,7 +3094,7 @@ function Gi() {
|
|
|
2992
3094
|
});
|
|
2993
3095
|
}
|
|
2994
3096
|
buildHandshakeCallbacks(e) {
|
|
2995
|
-
return
|
|
3097
|
+
return j({}, e, {
|
|
2996
3098
|
connected: (t) => {
|
|
2997
3099
|
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 });
|
|
2998
3100
|
}
|
|
@@ -3036,7 +3138,7 @@ function Gi() {
|
|
|
3036
3138
|
var r = this.state;
|
|
3037
3139
|
if (this.state = e, r !== e) {
|
|
3038
3140
|
var o = e;
|
|
3039
|
-
o === "connected" && (o += " with new socket ID " + t.socket_id),
|
|
3141
|
+
o === "connected" && (o += " with new socket ID " + t.socket_id), P.debug("State changed", r + " -> " + o), this.timeline.info({ state: e, params: t }), this.emit("state_change", { previous: r, current: e }), this.emit(e, t);
|
|
3040
3142
|
}
|
|
3041
3143
|
}
|
|
3042
3144
|
shouldRetry() {
|
|
@@ -3048,7 +3150,7 @@ function Gi() {
|
|
|
3048
3150
|
this.channels = {};
|
|
3049
3151
|
}
|
|
3050
3152
|
add(e, t) {
|
|
3051
|
-
return this.channels[e] || (this.channels[e] =
|
|
3153
|
+
return this.channels[e] || (this.channels[e] = Ln(e, t)), this.channels[e];
|
|
3052
3154
|
}
|
|
3053
3155
|
all() {
|
|
3054
3156
|
return Dt(this.channels);
|
|
@@ -3066,23 +3168,23 @@ function Gi() {
|
|
|
3066
3168
|
});
|
|
3067
3169
|
}
|
|
3068
3170
|
}
|
|
3069
|
-
function
|
|
3171
|
+
function Ln(n, e) {
|
|
3070
3172
|
if (n.indexOf("private-encrypted-") === 0) {
|
|
3071
3173
|
if (e.config.nacl)
|
|
3072
|
-
return
|
|
3073
|
-
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r =
|
|
3174
|
+
return V.createEncryptedChannel(n, e, e.config.nacl);
|
|
3175
|
+
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r = T.buildLogSuffix("encryptedChannelSupport");
|
|
3074
3176
|
throw new z(`${t}. ${r}`);
|
|
3075
3177
|
} else {
|
|
3076
3178
|
if (n.indexOf("private-") === 0)
|
|
3077
|
-
return
|
|
3179
|
+
return V.createPrivateChannel(n, e);
|
|
3078
3180
|
if (n.indexOf("presence-") === 0)
|
|
3079
|
-
return
|
|
3181
|
+
return V.createPresenceChannel(n, e);
|
|
3080
3182
|
if (n.indexOf("#") === 0)
|
|
3081
|
-
throw new
|
|
3082
|
-
return
|
|
3183
|
+
throw new C('Cannot create a channel with name "' + n + '".');
|
|
3184
|
+
return V.createChannel(n, e);
|
|
3083
3185
|
}
|
|
3084
3186
|
}
|
|
3085
|
-
var
|
|
3187
|
+
var Pn = {
|
|
3086
3188
|
createChannels() {
|
|
3087
3189
|
return new An();
|
|
3088
3190
|
},
|
|
@@ -3096,10 +3198,10 @@ function Gi() {
|
|
|
3096
3198
|
return new Se(n, e);
|
|
3097
3199
|
},
|
|
3098
3200
|
createPresenceChannel(n, e) {
|
|
3099
|
-
return new
|
|
3201
|
+
return new Tn(n, e);
|
|
3100
3202
|
},
|
|
3101
3203
|
createEncryptedChannel(n, e, t) {
|
|
3102
|
-
return new
|
|
3204
|
+
return new _n(n, e, t);
|
|
3103
3205
|
},
|
|
3104
3206
|
createTimelineSender(n, e) {
|
|
3105
3207
|
return new Cn(n, e);
|
|
@@ -3108,16 +3210,16 @@ function Gi() {
|
|
|
3108
3210
|
return new wn(n, e);
|
|
3109
3211
|
},
|
|
3110
3212
|
createAssistantToTheTransportManager(n, e, t) {
|
|
3111
|
-
return new
|
|
3213
|
+
return new yn(n, e, t);
|
|
3112
3214
|
}
|
|
3113
3215
|
};
|
|
3114
|
-
const
|
|
3216
|
+
const V = Pn;
|
|
3115
3217
|
class Qe {
|
|
3116
3218
|
constructor(e) {
|
|
3117
3219
|
this.options = e || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
3118
3220
|
}
|
|
3119
3221
|
getAssistant(e) {
|
|
3120
|
-
return
|
|
3222
|
+
return V.createAssistantToTheTransportManager(this, e, {
|
|
3121
3223
|
minPingDelay: this.options.minPingDelay,
|
|
3122
3224
|
maxPingDelay: this.options.maxPingDelay
|
|
3123
3225
|
});
|
|
@@ -3137,15 +3239,15 @@ function Gi() {
|
|
|
3137
3239
|
return $e(this.strategies, U.method("isSupported"));
|
|
3138
3240
|
}
|
|
3139
3241
|
connect(e, t) {
|
|
3140
|
-
var r = this.strategies, o = 0, c = this.timeout, l = null, p = (
|
|
3141
|
-
|
|
3242
|
+
var r = this.strategies, o = 0, c = this.timeout, l = null, p = (b, _) => {
|
|
3243
|
+
_ ? t(null, _) : (o = o + 1, this.loop && (o = o % r.length), o < r.length ? (c && (c = c * 2, this.timeoutLimit && (c = Math.min(c, this.timeoutLimit))), l = this.tryStrategy(r[o], e, { timeout: c, failFast: this.failFast }, p)) : t(!0));
|
|
3142
3244
|
};
|
|
3143
3245
|
return l = this.tryStrategy(r[o], e, { timeout: c, failFast: this.failFast }, p), {
|
|
3144
3246
|
abort: function() {
|
|
3145
3247
|
l.abort();
|
|
3146
3248
|
},
|
|
3147
|
-
forceMinPriority: function(
|
|
3148
|
-
e =
|
|
3249
|
+
forceMinPriority: function(b) {
|
|
3250
|
+
e = b, l && l.forceMinPriority(b);
|
|
3149
3251
|
}
|
|
3150
3252
|
};
|
|
3151
3253
|
}
|
|
@@ -3153,8 +3255,8 @@ function Gi() {
|
|
|
3153
3255
|
var c = null, l = null;
|
|
3154
3256
|
return r.timeout > 0 && (c = new Y(r.timeout, function() {
|
|
3155
3257
|
l.abort(), o(!0);
|
|
3156
|
-
})), l = e.connect(t, function(p,
|
|
3157
|
-
p && c && c.isRunning() && !r.failFast || (c && c.ensureAborted(), o(p,
|
|
3258
|
+
})), l = e.connect(t, function(p, b) {
|
|
3259
|
+
p && c && c.isRunning() && !r.failFast || (c && c.ensureAborted(), o(p, b));
|
|
3158
3260
|
}), {
|
|
3159
3261
|
abort: function() {
|
|
3160
3262
|
c && c.ensureAborted(), l.abort();
|
|
@@ -3165,7 +3267,7 @@ function Gi() {
|
|
|
3165
3267
|
};
|
|
3166
3268
|
}
|
|
3167
3269
|
}
|
|
3168
|
-
class
|
|
3270
|
+
class Te {
|
|
3169
3271
|
constructor(e) {
|
|
3170
3272
|
this.strategies = e;
|
|
3171
3273
|
}
|
|
@@ -3229,27 +3331,27 @@ function Gi() {
|
|
|
3229
3331
|
failFast: !0
|
|
3230
3332
|
}))) : c++);
|
|
3231
3333
|
}
|
|
3232
|
-
var
|
|
3233
|
-
|
|
3334
|
+
var b = U.now(), _ = l.pop().connect(e, function k(R, ue) {
|
|
3335
|
+
R ? (Ze(r), l.length > 0 ? (b = U.now(), _ = l.pop().connect(e, k)) : t(R)) : (Nn(r, ue.transport.name, U.now() - b, c), t(null, ue));
|
|
3234
3336
|
});
|
|
3235
3337
|
return {
|
|
3236
3338
|
abort: function() {
|
|
3237
|
-
|
|
3339
|
+
_.abort();
|
|
3238
3340
|
},
|
|
3239
3341
|
forceMinPriority: function(k) {
|
|
3240
|
-
e = k,
|
|
3342
|
+
e = k, _ && _.forceMinPriority(k);
|
|
3241
3343
|
}
|
|
3242
3344
|
};
|
|
3243
3345
|
}
|
|
3244
3346
|
}
|
|
3245
|
-
function
|
|
3347
|
+
function Ee(n) {
|
|
3246
3348
|
return "pusherTransport" + (n ? "TLS" : "NonTLS");
|
|
3247
3349
|
}
|
|
3248
3350
|
function Un(n) {
|
|
3249
|
-
var e =
|
|
3351
|
+
var e = w.getLocalStorage();
|
|
3250
3352
|
if (e)
|
|
3251
3353
|
try {
|
|
3252
|
-
var t = e[
|
|
3354
|
+
var t = e[Ee(n)];
|
|
3253
3355
|
if (t)
|
|
3254
3356
|
return JSON.parse(t);
|
|
3255
3357
|
} catch {
|
|
@@ -3258,10 +3360,10 @@ function Gi() {
|
|
|
3258
3360
|
return null;
|
|
3259
3361
|
}
|
|
3260
3362
|
function Nn(n, e, t, r) {
|
|
3261
|
-
var o =
|
|
3363
|
+
var o = w.getLocalStorage();
|
|
3262
3364
|
if (o)
|
|
3263
3365
|
try {
|
|
3264
|
-
o[
|
|
3366
|
+
o[Ee(n)] = ae({
|
|
3265
3367
|
timestamp: U.now(),
|
|
3266
3368
|
transport: e,
|
|
3267
3369
|
latency: t,
|
|
@@ -3271,10 +3373,10 @@ function Gi() {
|
|
|
3271
3373
|
}
|
|
3272
3374
|
}
|
|
3273
3375
|
function Ze(n) {
|
|
3274
|
-
var e =
|
|
3376
|
+
var e = w.getLocalStorage();
|
|
3275
3377
|
if (e)
|
|
3276
3378
|
try {
|
|
3277
|
-
delete e[
|
|
3379
|
+
delete e[Ee(n)];
|
|
3278
3380
|
} catch {
|
|
3279
3381
|
}
|
|
3280
3382
|
}
|
|
@@ -3312,7 +3414,7 @@ function Gi() {
|
|
|
3312
3414
|
return r.connect(e, t);
|
|
3313
3415
|
}
|
|
3314
3416
|
}
|
|
3315
|
-
class
|
|
3417
|
+
class Mn {
|
|
3316
3418
|
constructor(e) {
|
|
3317
3419
|
this.strategy = e;
|
|
3318
3420
|
}
|
|
@@ -3331,11 +3433,11 @@ function Gi() {
|
|
|
3331
3433
|
return n.isSupported();
|
|
3332
3434
|
};
|
|
3333
3435
|
}
|
|
3334
|
-
var
|
|
3436
|
+
var jn = function(n, e, t) {
|
|
3335
3437
|
var r = {};
|
|
3336
|
-
function o(
|
|
3337
|
-
var ft = t(n,
|
|
3338
|
-
return r[
|
|
3438
|
+
function o(ut, Ui, Ni, Mi, ji) {
|
|
3439
|
+
var ft = t(n, ut, Ui, Ni, Mi, ji);
|
|
3440
|
+
return r[ut] = ft, ft;
|
|
3339
3441
|
}
|
|
3340
3442
|
var c = Object.assign({}, e, {
|
|
3341
3443
|
hostNonTLS: n.wsHost + ":" + n.wsPort,
|
|
@@ -3347,41 +3449,41 @@ function Gi() {
|
|
|
3347
3449
|
hostNonTLS: n.httpHost + ":" + n.httpPort,
|
|
3348
3450
|
hostTLS: n.httpHost + ":" + n.httpsPort,
|
|
3349
3451
|
httpPath: n.httpPath
|
|
3350
|
-
}),
|
|
3452
|
+
}), b = {
|
|
3351
3453
|
loop: !0,
|
|
3352
3454
|
timeout: 15e3,
|
|
3353
3455
|
timeoutLimit: 6e4
|
|
3354
|
-
},
|
|
3456
|
+
}, _ = new Qe({
|
|
3355
3457
|
minPingDelay: 1e4,
|
|
3356
3458
|
maxPingDelay: n.activityTimeout
|
|
3357
3459
|
}), k = new Qe({
|
|
3358
3460
|
lives: 2,
|
|
3359
3461
|
minPingDelay: 1e4,
|
|
3360
3462
|
maxPingDelay: n.activityTimeout
|
|
3361
|
-
}),
|
|
3463
|
+
}), R = o("ws", "ws", 3, c, _), ue = o("wss", "ws", 3, l, _), Pi = o("sockjs", "sockjs", 1, p), ot = o("xhr_streaming", "xhr_streaming", 1, p, k), Ri = o("xdr_streaming", "xdr_streaming", 1, p, k), at = o("xhr_polling", "xhr_polling", 1, p), Ii = o("xdr_polling", "xdr_polling", 1, p), ct = new Q([R], b), Oi = new Q([ue], b), qi = new Q([Pi], b), ht = new Q([
|
|
3362
3464
|
new re(se(ot), ot, Ri)
|
|
3363
|
-
],
|
|
3465
|
+
], b), lt = new Q([
|
|
3364
3466
|
new re(se(at), at, Ii)
|
|
3365
|
-
],
|
|
3366
|
-
new re(se(ht), new
|
|
3467
|
+
], b), dt = new Q([
|
|
3468
|
+
new re(se(ht), new Te([
|
|
3367
3469
|
ht,
|
|
3368
3470
|
new he(lt, { delay: 4e3 })
|
|
3369
3471
|
]), lt)
|
|
3370
|
-
],
|
|
3371
|
-
return e.useTLS ?
|
|
3472
|
+
], b), Ae = new re(se(dt), dt, qi), Le;
|
|
3473
|
+
return e.useTLS ? Le = new Te([
|
|
3372
3474
|
ct,
|
|
3373
3475
|
new he(Ae, { delay: 2e3 })
|
|
3374
|
-
]) :
|
|
3476
|
+
]) : Le = new Te([
|
|
3375
3477
|
ct,
|
|
3376
3478
|
new he(Oi, { delay: 2e3 }),
|
|
3377
3479
|
new he(Ae, { delay: 5e3 })
|
|
3378
|
-
]), new qn(new
|
|
3480
|
+
]), new qn(new Mn(new re(se(R), Le, Ae)), r, {
|
|
3379
3481
|
ttl: 18e5,
|
|
3380
3482
|
timeline: e.timeline,
|
|
3381
3483
|
useTLS: e.useTLS
|
|
3382
3484
|
});
|
|
3383
3485
|
};
|
|
3384
|
-
const zn =
|
|
3486
|
+
const zn = jn;
|
|
3385
3487
|
function Hn() {
|
|
3386
3488
|
var n = this;
|
|
3387
3489
|
n.timeline.info(n.buildTimelineMessage({
|
|
@@ -3394,7 +3496,7 @@ function Gi() {
|
|
|
3394
3496
|
getRequest: function(n) {
|
|
3395
3497
|
var e = new window.XDomainRequest();
|
|
3396
3498
|
return e.ontimeout = function() {
|
|
3397
|
-
n.emit("error", new
|
|
3499
|
+
n.emit("error", new L()), n.close();
|
|
3398
3500
|
}, e.onerror = function(t) {
|
|
3399
3501
|
n.emit("error", t), n.close();
|
|
3400
3502
|
}, e.onprogress = function() {
|
|
@@ -3415,10 +3517,10 @@ function Gi() {
|
|
|
3415
3517
|
start(e) {
|
|
3416
3518
|
this.position = 0, this.xhr = this.hooks.getRequest(this), this.unloader = () => {
|
|
3417
3519
|
this.close();
|
|
3418
|
-
},
|
|
3520
|
+
}, w.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(e);
|
|
3419
3521
|
}
|
|
3420
3522
|
close() {
|
|
3421
|
-
this.unloader && (
|
|
3523
|
+
this.unloader && (w.removeUnloadListener(this.unloader), this.unloader = null), this.xhr && (this.hooks.abortRequest(this.xhr), this.xhr = null);
|
|
3422
3524
|
}
|
|
3423
3525
|
onChunk(e, t) {
|
|
3424
3526
|
for (; ; ) {
|
|
@@ -3439,15 +3541,15 @@ function Gi() {
|
|
|
3439
3541
|
return this.position === e.length && e.length > Wn;
|
|
3440
3542
|
}
|
|
3441
3543
|
}
|
|
3442
|
-
var
|
|
3544
|
+
var _e;
|
|
3443
3545
|
(function(n) {
|
|
3444
3546
|
n[n.CONNECTING = 0] = "CONNECTING", n[n.OPEN = 1] = "OPEN", n[n.CLOSED = 3] = "CLOSED";
|
|
3445
|
-
})(
|
|
3446
|
-
const Z =
|
|
3547
|
+
})(_e || (_e = {}));
|
|
3548
|
+
const Z = _e;
|
|
3447
3549
|
var $n = 1;
|
|
3448
|
-
class
|
|
3550
|
+
class Vn {
|
|
3449
3551
|
constructor(e, t) {
|
|
3450
|
-
this.hooks = e, this.session = tt(1e3) + "/" + Yn(8), this.location =
|
|
3552
|
+
this.hooks = e, this.session = tt(1e3) + "/" + Yn(8), this.location = Xn(t), this.readyState = Z.CONNECTING, this.openStream();
|
|
3451
3553
|
}
|
|
3452
3554
|
send(e) {
|
|
3453
3555
|
return this.sendRaw(JSON.stringify([e]));
|
|
@@ -3461,7 +3563,7 @@ function Gi() {
|
|
|
3461
3563
|
sendRaw(e) {
|
|
3462
3564
|
if (this.readyState === Z.OPEN)
|
|
3463
3565
|
try {
|
|
3464
|
-
return
|
|
3566
|
+
return w.createSocketRequest("POST", et(Jn(this.location, this.session))).start(e), !0;
|
|
3465
3567
|
} catch {
|
|
3466
3568
|
return !1;
|
|
3467
3569
|
}
|
|
@@ -3516,7 +3618,7 @@ function Gi() {
|
|
|
3516
3618
|
this.onerror && this.onerror(e);
|
|
3517
3619
|
}
|
|
3518
3620
|
openStream() {
|
|
3519
|
-
this.stream =
|
|
3621
|
+
this.stream = w.createSocketRequest("POST", et(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (e) => {
|
|
3520
3622
|
this.onChunk(e);
|
|
3521
3623
|
}), this.stream.bind("finished", (e) => {
|
|
3522
3624
|
this.hooks.onFinished(this, e);
|
|
@@ -3535,7 +3637,7 @@ function Gi() {
|
|
|
3535
3637
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
3536
3638
|
}
|
|
3537
3639
|
}
|
|
3538
|
-
function
|
|
3640
|
+
function Xn(n) {
|
|
3539
3641
|
var e = /([^\?]*)\/*(\??.*)/.exec(n);
|
|
3540
3642
|
return {
|
|
3541
3643
|
base: e[1],
|
|
@@ -3554,14 +3656,14 @@ function Gi() {
|
|
|
3554
3656
|
return t[1] + e + t[3];
|
|
3555
3657
|
}
|
|
3556
3658
|
function tt(n) {
|
|
3557
|
-
return
|
|
3659
|
+
return w.randomInt(n);
|
|
3558
3660
|
}
|
|
3559
3661
|
function Yn(n) {
|
|
3560
3662
|
for (var e = [], t = 0; t < n; t++)
|
|
3561
3663
|
e.push(tt(32).toString(32));
|
|
3562
3664
|
return e.join("");
|
|
3563
3665
|
}
|
|
3564
|
-
const Kn =
|
|
3666
|
+
const Kn = Vn;
|
|
3565
3667
|
var Qn = {
|
|
3566
3668
|
getReceiveURL: function(n, e) {
|
|
3567
3669
|
return n.base + "/" + e + "/xhr_streaming" + n.queryString;
|
|
@@ -3593,7 +3695,7 @@ function Gi() {
|
|
|
3593
3695
|
const ti = ei;
|
|
3594
3696
|
var ni = {
|
|
3595
3697
|
getRequest: function(n) {
|
|
3596
|
-
var e =
|
|
3698
|
+
var e = w.getXHRAPI(), t = new e();
|
|
3597
3699
|
return t.onreadystatechange = t.onprogress = function() {
|
|
3598
3700
|
switch (t.readyState) {
|
|
3599
3701
|
case 3:
|
|
@@ -3634,7 +3736,7 @@ function Gi() {
|
|
|
3634
3736
|
var si = {
|
|
3635
3737
|
nextAuthCallbackID: 1,
|
|
3636
3738
|
auth_callbacks: {},
|
|
3637
|
-
ScriptReceivers:
|
|
3739
|
+
ScriptReceivers: S,
|
|
3638
3740
|
DependenciesReceivers: F,
|
|
3639
3741
|
getDefaultStrategy: zn,
|
|
3640
3742
|
Transports: mn,
|
|
@@ -3661,7 +3763,7 @@ function Gi() {
|
|
|
3661
3763
|
return this.getDocument().location.protocol;
|
|
3662
3764
|
},
|
|
3663
3765
|
getAuthorizers() {
|
|
3664
|
-
return { ajax:
|
|
3766
|
+
return { ajax: Lt, jsonp: Yt };
|
|
3665
3767
|
},
|
|
3666
3768
|
onDocumentBody(n) {
|
|
3667
3769
|
document.body ? n() : setTimeout(() => {
|
|
@@ -3725,7 +3827,7 @@ function Gi() {
|
|
|
3725
3827
|
}() * n);
|
|
3726
3828
|
}
|
|
3727
3829
|
};
|
|
3728
|
-
const
|
|
3830
|
+
const w = si;
|
|
3729
3831
|
var ke;
|
|
3730
3832
|
(function(n) {
|
|
3731
3833
|
n[n.ERROR = 3] = "ERROR", n[n.INFO = 6] = "INFO", n[n.DEBUG = 7] = "DEBUG";
|
|
@@ -3736,7 +3838,7 @@ function Gi() {
|
|
|
3736
3838
|
this.key = e, this.session = t, this.events = [], this.options = r || {}, this.sent = 0, this.uniqueID = 0;
|
|
3737
3839
|
}
|
|
3738
3840
|
log(e, t) {
|
|
3739
|
-
e <= this.options.level && (this.events.push(
|
|
3841
|
+
e <= this.options.level && (this.events.push(j({}, t, { timestamp: U.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
3740
3842
|
}
|
|
3741
3843
|
error(e) {
|
|
3742
3844
|
this.log(le.ERROR, e);
|
|
@@ -3751,7 +3853,7 @@ function Gi() {
|
|
|
3751
3853
|
return this.events.length === 0;
|
|
3752
3854
|
}
|
|
3753
3855
|
send(e, t) {
|
|
3754
|
-
var r =
|
|
3856
|
+
var r = j({
|
|
3755
3857
|
session: this.session,
|
|
3756
3858
|
bundle: this.sent + 1,
|
|
3757
3859
|
key: this.key,
|
|
@@ -3786,24 +3888,24 @@ function Gi() {
|
|
|
3786
3888
|
var r = !1, o = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), c = null, l = function() {
|
|
3787
3889
|
o.unbind("initialized", l), o.connect();
|
|
3788
3890
|
}, p = function() {
|
|
3789
|
-
c =
|
|
3790
|
-
r = !0, k(), t(null,
|
|
3891
|
+
c = V.createHandshake(o, function(R) {
|
|
3892
|
+
r = !0, k(), t(null, R);
|
|
3791
3893
|
});
|
|
3792
|
-
},
|
|
3793
|
-
k(), t(
|
|
3794
|
-
},
|
|
3894
|
+
}, b = function(R) {
|
|
3895
|
+
k(), t(R);
|
|
3896
|
+
}, _ = function() {
|
|
3795
3897
|
k();
|
|
3796
|
-
var
|
|
3797
|
-
|
|
3898
|
+
var R;
|
|
3899
|
+
R = ae(o), t(new M(R));
|
|
3798
3900
|
}, k = function() {
|
|
3799
|
-
o.unbind("initialized", l), o.unbind("open", p), o.unbind("error",
|
|
3901
|
+
o.unbind("initialized", l), o.unbind("open", p), o.unbind("error", b), o.unbind("closed", _);
|
|
3800
3902
|
};
|
|
3801
|
-
return o.bind("initialized", l), o.bind("open", p), o.bind("error",
|
|
3903
|
+
return o.bind("initialized", l), o.bind("open", p), o.bind("error", b), o.bind("closed", _), o.initialize(), {
|
|
3802
3904
|
abort: () => {
|
|
3803
3905
|
r || (k(), c ? c.close() : o.close());
|
|
3804
3906
|
},
|
|
3805
|
-
forceMinPriority: (
|
|
3806
|
-
r || this.priority <
|
|
3907
|
+
forceMinPriority: (R) => {
|
|
3908
|
+
r || this.priority < R && (c ? c.close() : o.close());
|
|
3807
3909
|
}
|
|
3808
3910
|
};
|
|
3809
3911
|
}
|
|
@@ -3818,13 +3920,13 @@ function Gi() {
|
|
|
3818
3920
|
}
|
|
3819
3921
|
};
|
|
3820
3922
|
}
|
|
3821
|
-
const { Transports: ci } =
|
|
3923
|
+
const { Transports: ci } = w;
|
|
3822
3924
|
var hi = function(n, e, t, r, o, c) {
|
|
3823
3925
|
var l = ci[t];
|
|
3824
3926
|
if (!l)
|
|
3825
3927
|
throw new J(t);
|
|
3826
|
-
var p = (!n.enabledTransports || He(n.enabledTransports, e) !== -1) && (!n.disabledTransports || He(n.disabledTransports, e) === -1),
|
|
3827
|
-
return p ? (o = Object.assign({ ignoreNullOrigin: n.ignoreNullOrigin }, o),
|
|
3928
|
+
var p = (!n.enabledTransports || He(n.enabledTransports, e) !== -1) && (!n.disabledTransports || He(n.disabledTransports, e) === -1), b;
|
|
3929
|
+
return p ? (o = Object.assign({ ignoreNullOrigin: n.ignoreNullOrigin }, o), b = new ai(e, r, c ? c.getAssistant(l) : l, o)) : b = li, b;
|
|
3828
3930
|
}, li = {
|
|
3829
3931
|
isSupported: function() {
|
|
3830
3932
|
return !1;
|
|
@@ -3842,14 +3944,14 @@ function Gi() {
|
|
|
3842
3944
|
};
|
|
3843
3945
|
}
|
|
3844
3946
|
};
|
|
3845
|
-
function
|
|
3947
|
+
function di(n) {
|
|
3846
3948
|
if (n == null)
|
|
3847
3949
|
throw "You must pass an options object";
|
|
3848
3950
|
if (n.cluster == null)
|
|
3849
3951
|
throw "Options object must provide a cluster";
|
|
3850
|
-
"disableStats" in n &&
|
|
3952
|
+
"disableStats" in n && P.warn("The disableStats option is deprecated in favor of enableStats");
|
|
3851
3953
|
}
|
|
3852
|
-
const
|
|
3954
|
+
const ui = (n, e) => {
|
|
3853
3955
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
3854
3956
|
for (var r in e.params)
|
|
3855
3957
|
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e.params[r]);
|
|
@@ -3860,11 +3962,11 @@ function Gi() {
|
|
|
3860
3962
|
}
|
|
3861
3963
|
return t;
|
|
3862
3964
|
}, fi = (n) => {
|
|
3863
|
-
if (typeof
|
|
3965
|
+
if (typeof w.getAuthorizers()[n.transport] > "u")
|
|
3864
3966
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3865
3967
|
return (e, t) => {
|
|
3866
|
-
const r =
|
|
3867
|
-
|
|
3968
|
+
const r = ui(e, n);
|
|
3969
|
+
w.getAuthorizers()[n.transport](w, r, n, u.UserAuthentication, t);
|
|
3868
3970
|
};
|
|
3869
3971
|
}, pi = (n, e) => {
|
|
3870
3972
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
@@ -3878,11 +3980,11 @@ function Gi() {
|
|
|
3878
3980
|
}
|
|
3879
3981
|
return t;
|
|
3880
3982
|
}, mi = (n) => {
|
|
3881
|
-
if (typeof
|
|
3983
|
+
if (typeof w.getAuthorizers()[n.transport] > "u")
|
|
3882
3984
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3883
3985
|
return (e, t) => {
|
|
3884
3986
|
const r = pi(e, n);
|
|
3885
|
-
|
|
3987
|
+
w.getAuthorizers()[n.transport](w, r, n, u.ChannelAuthorization, t);
|
|
3886
3988
|
};
|
|
3887
3989
|
}, gi = (n, e, t) => {
|
|
3888
3990
|
const r = {
|
|
@@ -3900,67 +4002,67 @@ function Gi() {
|
|
|
3900
4002
|
};
|
|
3901
4003
|
function rt(n, e) {
|
|
3902
4004
|
let t = {
|
|
3903
|
-
activityTimeout: n.activityTimeout ||
|
|
4005
|
+
activityTimeout: n.activityTimeout || x.activityTimeout,
|
|
3904
4006
|
cluster: n.cluster,
|
|
3905
|
-
httpPath: n.httpPath ||
|
|
3906
|
-
httpPort: n.httpPort ||
|
|
3907
|
-
httpsPort: n.httpsPort ||
|
|
3908
|
-
pongTimeout: n.pongTimeout ||
|
|
3909
|
-
statsHost: n.statsHost ||
|
|
3910
|
-
unavailableTimeout: n.unavailableTimeout ||
|
|
3911
|
-
wsPath: n.wsPath ||
|
|
3912
|
-
wsPort: n.wsPort ||
|
|
3913
|
-
wssPort: n.wssPort ||
|
|
4007
|
+
httpPath: n.httpPath || x.httpPath,
|
|
4008
|
+
httpPort: n.httpPort || x.httpPort,
|
|
4009
|
+
httpsPort: n.httpsPort || x.httpsPort,
|
|
4010
|
+
pongTimeout: n.pongTimeout || x.pongTimeout,
|
|
4011
|
+
statsHost: n.statsHost || x.stats_host,
|
|
4012
|
+
unavailableTimeout: n.unavailableTimeout || x.unavailableTimeout,
|
|
4013
|
+
wsPath: n.wsPath || x.wsPath,
|
|
4014
|
+
wsPort: n.wsPort || x.wsPort,
|
|
4015
|
+
wssPort: n.wssPort || x.wssPort,
|
|
3914
4016
|
enableStats: Ci(n),
|
|
3915
4017
|
httpHost: vi(n),
|
|
3916
4018
|
useTLS: wi(n),
|
|
3917
|
-
wsHost:
|
|
4019
|
+
wsHost: yi(n),
|
|
3918
4020
|
userAuthenticator: Si(n),
|
|
3919
|
-
channelAuthorizer:
|
|
4021
|
+
channelAuthorizer: Ti(n, e)
|
|
3920
4022
|
};
|
|
3921
4023
|
return "disabledTransports" in n && (t.disabledTransports = n.disabledTransports), "enabledTransports" in n && (t.enabledTransports = n.enabledTransports), "ignoreNullOrigin" in n && (t.ignoreNullOrigin = n.ignoreNullOrigin), "timelineParams" in n && (t.timelineParams = n.timelineParams), "nacl" in n && (t.nacl = n.nacl), t;
|
|
3922
4024
|
}
|
|
3923
4025
|
function vi(n) {
|
|
3924
|
-
return n.httpHost ? n.httpHost : n.cluster ? `sockjs-${n.cluster}.pusher.com` :
|
|
3925
|
-
}
|
|
3926
|
-
function bi(n) {
|
|
3927
|
-
return n.wsHost ? n.wsHost : yi(n.cluster);
|
|
4026
|
+
return n.httpHost ? n.httpHost : n.cluster ? `sockjs-${n.cluster}.pusher.com` : x.httpHost;
|
|
3928
4027
|
}
|
|
3929
4028
|
function yi(n) {
|
|
4029
|
+
return n.wsHost ? n.wsHost : bi(n.cluster);
|
|
4030
|
+
}
|
|
4031
|
+
function bi(n) {
|
|
3930
4032
|
return `ws-${n}.pusher.com`;
|
|
3931
4033
|
}
|
|
3932
4034
|
function wi(n) {
|
|
3933
|
-
return
|
|
4035
|
+
return w.getProtocol() === "https:" ? !0 : n.forceTLS !== !1;
|
|
3934
4036
|
}
|
|
3935
4037
|
function Ci(n) {
|
|
3936
4038
|
return "enableStats" in n ? n.enableStats : "disableStats" in n ? !n.disableStats : !1;
|
|
3937
4039
|
}
|
|
3938
4040
|
const st = (n) => "customHandler" in n && n.customHandler != null;
|
|
3939
4041
|
function Si(n) {
|
|
3940
|
-
const e = Object.assign(Object.assign({},
|
|
4042
|
+
const e = Object.assign(Object.assign({}, x.userAuthentication), n.userAuthentication);
|
|
3941
4043
|
return st(e) ? e.customHandler : fi(e);
|
|
3942
4044
|
}
|
|
3943
|
-
function
|
|
4045
|
+
function xi(n, e) {
|
|
3944
4046
|
let t;
|
|
3945
4047
|
if ("channelAuthorization" in n)
|
|
3946
|
-
t = Object.assign(Object.assign({},
|
|
4048
|
+
t = Object.assign(Object.assign({}, x.channelAuthorization), n.channelAuthorization);
|
|
3947
4049
|
else if (t = {
|
|
3948
|
-
transport: n.authTransport ||
|
|
3949
|
-
endpoint: n.authEndpoint ||
|
|
4050
|
+
transport: n.authTransport || x.authTransport,
|
|
4051
|
+
endpoint: n.authEndpoint || x.authEndpoint
|
|
3950
4052
|
}, "auth" in n && ("params" in n.auth && (t.params = n.auth.params), "headers" in n.auth && (t.headers = n.auth.headers)), "authorizer" in n)
|
|
3951
4053
|
return {
|
|
3952
4054
|
customHandler: gi(e, t, n.authorizer)
|
|
3953
4055
|
};
|
|
3954
4056
|
return t;
|
|
3955
4057
|
}
|
|
3956
|
-
function
|
|
3957
|
-
const t =
|
|
4058
|
+
function Ti(n, e) {
|
|
4059
|
+
const t = xi(n, e);
|
|
3958
4060
|
return st(t) ? t.customHandler : mi(t);
|
|
3959
4061
|
}
|
|
3960
|
-
class
|
|
4062
|
+
class Ei extends $ {
|
|
3961
4063
|
constructor(e) {
|
|
3962
4064
|
super(function(t, r) {
|
|
3963
|
-
|
|
4065
|
+
P.debug(`No callbacks on watchlist events for ${t}`);
|
|
3964
4066
|
}), this.pusher = e, this.bindWatchlistInternalEvent();
|
|
3965
4067
|
}
|
|
3966
4068
|
handleEvent(e) {
|
|
@@ -3975,20 +4077,20 @@ function Gi() {
|
|
|
3975
4077
|
});
|
|
3976
4078
|
}
|
|
3977
4079
|
}
|
|
3978
|
-
function
|
|
4080
|
+
function _i() {
|
|
3979
4081
|
let n, e;
|
|
3980
4082
|
return { promise: new Promise((r, o) => {
|
|
3981
4083
|
n = r, e = o;
|
|
3982
4084
|
}), resolve: n, reject: e };
|
|
3983
4085
|
}
|
|
3984
|
-
const ki =
|
|
4086
|
+
const ki = _i;
|
|
3985
4087
|
class Ai extends $ {
|
|
3986
4088
|
constructor(e) {
|
|
3987
4089
|
super(function(t, r) {
|
|
3988
|
-
|
|
4090
|
+
P.debug("No callbacks on user for " + t);
|
|
3989
4091
|
}), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (t, r) => {
|
|
3990
4092
|
if (t) {
|
|
3991
|
-
|
|
4093
|
+
P.warn(`Error during signin: ${t}`), this._cleanup();
|
|
3992
4094
|
return;
|
|
3993
4095
|
}
|
|
3994
4096
|
this.pusher.send_event("pusher:signin", {
|
|
@@ -3997,7 +4099,7 @@ function Gi() {
|
|
|
3997
4099
|
});
|
|
3998
4100
|
}, this.pusher = e, this.pusher.connection.bind("state_change", ({ previous: t, current: r }) => {
|
|
3999
4101
|
t !== "connected" && r === "connected" && this._signin(), t === "connected" && r !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
4000
|
-
}), this.watchlist = new
|
|
4102
|
+
}), this.watchlist = new Ei(e), this.pusher.connection.bind("message", (t) => {
|
|
4001
4103
|
var r = t.event;
|
|
4002
4104
|
r === "pusher:signin_success" && this._onSigninSuccess(t.data), this.serverToUserChannel && this.serverToUserChannel.name === t.channel && this.serverToUserChannel.handleEvent(t);
|
|
4003
4105
|
});
|
|
@@ -4014,11 +4116,11 @@ function Gi() {
|
|
|
4014
4116
|
try {
|
|
4015
4117
|
this.user_data = JSON.parse(e.user_data);
|
|
4016
4118
|
} catch {
|
|
4017
|
-
|
|
4119
|
+
P.error(`Failed parsing user data after signin: ${e.user_data}`), this._cleanup();
|
|
4018
4120
|
return;
|
|
4019
4121
|
}
|
|
4020
4122
|
if (typeof this.user_data.id != "string" || this.user_data.id === "") {
|
|
4021
|
-
|
|
4123
|
+
P.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
|
|
4022
4124
|
return;
|
|
4023
4125
|
}
|
|
4024
4126
|
this._signinDoneResolve(), this._subscribeChannels();
|
|
@@ -4045,31 +4147,31 @@ function Gi() {
|
|
|
4045
4147
|
e.then(r).catch(r), this.signinDonePromise = e, this._signinDoneResolve = t;
|
|
4046
4148
|
}
|
|
4047
4149
|
}
|
|
4048
|
-
class
|
|
4150
|
+
class I {
|
|
4049
4151
|
static ready() {
|
|
4050
|
-
|
|
4051
|
-
for (var e = 0, t =
|
|
4052
|
-
|
|
4152
|
+
I.isReady = !0;
|
|
4153
|
+
for (var e = 0, t = I.instances.length; e < t; e++)
|
|
4154
|
+
I.instances[e].connect();
|
|
4053
4155
|
}
|
|
4054
4156
|
static getClientFeatures() {
|
|
4055
|
-
return De(Be({ ws:
|
|
4157
|
+
return De(Be({ ws: w.Transports.ws }, function(e) {
|
|
4056
4158
|
return e.isSupported({});
|
|
4057
4159
|
}));
|
|
4058
4160
|
}
|
|
4059
4161
|
constructor(e, t) {
|
|
4060
|
-
|
|
4162
|
+
Li(e), di(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels = V.createChannels(), this.global_emitter = new $(), this.sessionID = w.randomInt(1e9), this.timeline = new oi(this.key, this.sessionID, {
|
|
4061
4163
|
cluster: this.config.cluster,
|
|
4062
|
-
features:
|
|
4164
|
+
features: I.getClientFeatures(),
|
|
4063
4165
|
params: this.config.timelineParams || {},
|
|
4064
4166
|
limit: 50,
|
|
4065
4167
|
level: le.INFO,
|
|
4066
|
-
version:
|
|
4067
|
-
}), this.config.enableStats && (this.timelineSender =
|
|
4168
|
+
version: x.VERSION
|
|
4169
|
+
}), this.config.enableStats && (this.timelineSender = V.createTimelineSender(this.timeline, {
|
|
4068
4170
|
host: this.config.statsHost,
|
|
4069
|
-
path: "/timeline/v2/" +
|
|
4171
|
+
path: "/timeline/v2/" + w.TimelineTransport.name
|
|
4070
4172
|
}));
|
|
4071
|
-
var r = (o) =>
|
|
4072
|
-
this.connection =
|
|
4173
|
+
var r = (o) => w.getDefaultStrategy(this.config, o, hi);
|
|
4174
|
+
this.connection = V.createConnectionManager(this.key, {
|
|
4073
4175
|
getStrategy: r,
|
|
4074
4176
|
timeline: this.timeline,
|
|
4075
4177
|
activityTimeout: this.config.activityTimeout,
|
|
@@ -4090,8 +4192,8 @@ function Gi() {
|
|
|
4090
4192
|
}), this.connection.bind("disconnected", () => {
|
|
4091
4193
|
this.channels.disconnect();
|
|
4092
4194
|
}), this.connection.bind("error", (o) => {
|
|
4093
|
-
|
|
4094
|
-
}),
|
|
4195
|
+
P.warn(o);
|
|
4196
|
+
}), I.instances.push(this), this.timeline.info({ instances: I.instances.length }), this.user = new Ai(this), I.isReady && this.connect();
|
|
4095
4197
|
}
|
|
4096
4198
|
switchCluster(e) {
|
|
4097
4199
|
const { appKey: t, cluster: r } = e;
|
|
@@ -4106,7 +4208,7 @@ function Gi() {
|
|
|
4106
4208
|
connect() {
|
|
4107
4209
|
if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
|
|
4108
4210
|
var e = this.connection.isUsingTLS(), t = this.timelineSender;
|
|
4109
|
-
this.timelineSenderTimer = new
|
|
4211
|
+
this.timelineSenderTimer = new jt(6e4, function() {
|
|
4110
4212
|
t.send(e);
|
|
4111
4213
|
});
|
|
4112
4214
|
}
|
|
@@ -4152,13 +4254,13 @@ function Gi() {
|
|
|
4152
4254
|
this.user.signin();
|
|
4153
4255
|
}
|
|
4154
4256
|
}
|
|
4155
|
-
|
|
4156
|
-
const
|
|
4157
|
-
function
|
|
4257
|
+
I.instances = [], I.isReady = !1, I.logToConsole = !1, I.Runtime = w, I.ScriptReceivers = w.ScriptReceivers, I.DependenciesReceivers = w.DependenciesReceivers, I.auth_callbacks = w.auth_callbacks;
|
|
4258
|
+
const de = I;
|
|
4259
|
+
function Li(n) {
|
|
4158
4260
|
if (n == null)
|
|
4159
4261
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
4160
4262
|
}
|
|
4161
|
-
|
|
4263
|
+
w.setup(I);
|
|
4162
4264
|
}
|
|
4163
4265
|
/******/
|
|
4164
4266
|
}, a = {};
|
|
@@ -4166,7 +4268,7 @@ function Gi() {
|
|
|
4166
4268
|
var g = a[m];
|
|
4167
4269
|
if (g !== void 0)
|
|
4168
4270
|
return g.exports;
|
|
4169
|
-
var
|
|
4271
|
+
var y = a[m] = {
|
|
4170
4272
|
/******/
|
|
4171
4273
|
// no module.id needed
|
|
4172
4274
|
/******/
|
|
@@ -4175,17 +4277,17 @@ function Gi() {
|
|
|
4175
4277
|
exports: {}
|
|
4176
4278
|
/******/
|
|
4177
4279
|
};
|
|
4178
|
-
return s[m].call(
|
|
4280
|
+
return s[m].call(y.exports, y, y.exports, h), y.exports;
|
|
4179
4281
|
}
|
|
4180
4282
|
h.d = (m, g) => {
|
|
4181
|
-
for (var
|
|
4182
|
-
h.o(g,
|
|
4283
|
+
for (var y in g)
|
|
4284
|
+
h.o(g, y) && !h.o(m, y) && Object.defineProperty(m, y, { enumerable: !0, get: g[y] });
|
|
4183
4285
|
}, h.o = (m, g) => Object.prototype.hasOwnProperty.call(m, g);
|
|
4184
|
-
var
|
|
4185
|
-
return
|
|
4286
|
+
var d = h(721);
|
|
4287
|
+
return d;
|
|
4186
4288
|
})()
|
|
4187
4289
|
));
|
|
4188
|
-
})(
|
|
4290
|
+
})(Pe)), Pe.exports;
|
|
4189
4291
|
}
|
|
4190
4292
|
var Yi = Gi();
|
|
4191
4293
|
const Ki = /* @__PURE__ */ Ji(Yi), Re = "/vendor/sendity-client/tailwind.css", Qi = {
|
|
@@ -4255,7 +4357,7 @@ Code : (Code)`,
|
|
|
4255
4357
|
whatsappText: "Connectez-moi à (Host) avec ce code : (Code)"
|
|
4256
4358
|
}
|
|
4257
4359
|
};
|
|
4258
|
-
function
|
|
4360
|
+
function X(v) {
|
|
4259
4361
|
switch (v) {
|
|
4260
4362
|
case "de":
|
|
4261
4363
|
return Zi;
|
|
@@ -4266,16 +4368,16 @@ function V(v) {
|
|
|
4266
4368
|
}
|
|
4267
4369
|
}
|
|
4268
4370
|
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>
|
|
4269
|
-
`,
|
|
4270
|
-
function
|
|
4371
|
+
`, 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>', nr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM7.22 6.22a.75.75 0 0 0-1.06 1.06L8.88 10l-2.72 2.72a.75.75 0 1 0 1.06 1.06L9.94 11.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L11 10l2.72-2.72a.75.75 0 0 0-1.06-1.06L9.94 8.94 7.22 6.22Z" clip-rule="evenodd" /></svg>', Me = "sendityAuthRequest", ir = "https://sendity.io/api", rr = 600 * 1e3, sr = 5e3, or = 15e3, Ie = 2e3, pe = 220, At = 0;
|
|
4372
|
+
function je(v, i) {
|
|
4271
4373
|
return `sendity:auth-request:${encodeURIComponent(v)}:${encodeURIComponent(i)}`;
|
|
4272
4374
|
}
|
|
4273
|
-
function
|
|
4274
|
-
v.removeItem(
|
|
4275
|
-
const h =
|
|
4276
|
-
if (!
|
|
4375
|
+
function bt(v, i, s, a = Date.now()) {
|
|
4376
|
+
v.removeItem(Me);
|
|
4377
|
+
const h = je(i, s), d = v.getItem(h);
|
|
4378
|
+
if (!d) return null;
|
|
4277
4379
|
try {
|
|
4278
|
-
const m = JSON.parse(
|
|
4380
|
+
const m = JSON.parse(d);
|
|
4279
4381
|
if (typeof m.id != "string" || typeof m.clientSecret != "string" || typeof m.createdAt != "number")
|
|
4280
4382
|
throw new Error("invalid stored auth request");
|
|
4281
4383
|
return a - m.createdAt >= rr ? (v.removeItem(h), null) : { id: m.id, clientSecret: m.clientSecret };
|
|
@@ -4284,13 +4386,13 @@ function yt(v, i, s, a = Date.now()) {
|
|
|
4284
4386
|
}
|
|
4285
4387
|
}
|
|
4286
4388
|
function ar(v, i, s, a, h = Date.now()) {
|
|
4287
|
-
v.setItem(
|
|
4389
|
+
v.setItem(je(i, s), JSON.stringify({ ...a, createdAt: h }));
|
|
4288
4390
|
}
|
|
4289
4391
|
function wt(v, i, s) {
|
|
4290
|
-
v.removeItem(
|
|
4392
|
+
v.removeItem(je(i, s)), v.removeItem(Me);
|
|
4291
4393
|
}
|
|
4292
4394
|
function me() {
|
|
4293
|
-
return window.localStorage.removeItem(
|
|
4395
|
+
return window.localStorage.removeItem(Me), window.sessionStorage;
|
|
4294
4396
|
}
|
|
4295
4397
|
function cr(v, i = window.location.origin) {
|
|
4296
4398
|
return v.filter((s) => hr(s, i));
|
|
@@ -4308,19 +4410,19 @@ function lr(v, i, s) {
|
|
|
4308
4410
|
}
|
|
4309
4411
|
const ve = class ve extends HTMLElement {
|
|
4310
4412
|
constructor() {
|
|
4311
|
-
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.authStartObserver = null, this.authFlowStarted = !1, 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;
|
|
4413
|
+
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = null, this.rootEl = 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.footerIndicatorEl = null, this.footerObserver = null, this.authStartObserver = null, this.authFlowStarted = !1, 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.activeVerifyUrls = [], this.authenticated = !1;
|
|
4312
4414
|
const i = this.attachShadow({ mode: "open" });
|
|
4313
4415
|
this.injectTailwind(i);
|
|
4314
4416
|
const s = document.createElement("div");
|
|
4315
4417
|
s.innerHTML = pt;
|
|
4316
|
-
const a = s.querySelector("template"), h = a ? a.content.cloneNode(!0) : document.createRange().createContextualFragment(pt),
|
|
4317
|
-
|
|
4418
|
+
const a = s.querySelector("template"), h = a ? a.content.cloneNode(!0) : document.createRange().createContextualFragment(pt), d = document.createElement("style");
|
|
4419
|
+
d.textContent = zi, i.appendChild(d), i.appendChild(h);
|
|
4318
4420
|
}
|
|
4319
4421
|
static get observedAttributes() {
|
|
4320
|
-
return ["server-url", "public-key", "
|
|
4422
|
+
return ["server-url", "public-key", "lang", "transport", "hide-footer", "footer", "authenticated-event-delay-ms", "variant", "no-card"];
|
|
4321
4423
|
}
|
|
4322
4424
|
connectedCallback() {
|
|
4323
|
-
this.codeContainerEl = this.shadowRoot?.querySelector(".code"), this.codeEl = this.shadowRoot?.querySelector(".formatted-code"), this.promptEl = this.shadowRoot?.querySelector(".prompt"), this.successEl = this.shadowRoot?.querySelector(".success"), this.spinnerEl = this.shadowRoot?.querySelector(".spinner"), this.verifiersEl = this.shadowRoot?.querySelector(".verifiers"), this.footerEl = this.shadowRoot?.querySelector(".sendity-footer"), this.footerBrandEl = this.shadowRoot?.querySelector(".footer-brand"), this.footerStatusEl = this.shadowRoot?.querySelector(".footer-status"), this.footerMessageEl = this.shadowRoot?.querySelector(".footer-message"), this.footerTimerEl = this.shadowRoot?.querySelector(".footer-timer");
|
|
4425
|
+
this.rootEl = this.shadowRoot?.querySelector(".sendity"), this.codeContainerEl = this.shadowRoot?.querySelector(".code"), this.codeEl = this.shadowRoot?.querySelector(".formatted-code"), this.promptEl = this.shadowRoot?.querySelector(".prompt"), this.successEl = this.shadowRoot?.querySelector(".success"), this.spinnerEl = this.shadowRoot?.querySelector(".spinner"), this.verifiersEl = this.shadowRoot?.querySelector(".verifiers"), this.footerEl = this.shadowRoot?.querySelector(".sendity-footer"), this.footerBrandEl = this.shadowRoot?.querySelector(".footer-brand"), this.footerStatusEl = this.shadowRoot?.querySelector(".footer-status"), this.footerMessageEl = this.shadowRoot?.querySelector(".footer-message"), this.footerTimerEl = this.shadowRoot?.querySelector(".footer-timer"), this.footerIndicatorEl = this.shadowRoot?.querySelector(".footer-spinner"), this.syncLayoutVariant();
|
|
4324
4426
|
try {
|
|
4325
4427
|
this.currentConfig = this.resolveConfig();
|
|
4326
4428
|
} catch (i) {
|
|
@@ -4329,14 +4431,20 @@ const ve = class ve extends HTMLElement {
|
|
|
4329
4431
|
}
|
|
4330
4432
|
this.configureFooter(), this.dispatchPublicEvent("sendity:ready", {
|
|
4331
4433
|
transport: this.currentConfig.transport,
|
|
4332
|
-
channel: this.primaryChannel(this.
|
|
4333
|
-
}), this.showPlaceholderCode(), this.
|
|
4434
|
+
channel: this.primaryChannel(this.activeVerifyUrls)
|
|
4435
|
+
}), this.showPlaceholderCode(), this.startWhenVisible();
|
|
4334
4436
|
}
|
|
4335
4437
|
disconnectedCallback() {
|
|
4336
4438
|
this.stop(), this.destroyed = !0;
|
|
4337
4439
|
}
|
|
4338
4440
|
attributeChangedCallback() {
|
|
4339
|
-
this.isConnected && (this.currentConfig = this.resolveConfig(), this.configureFooter()
|
|
4441
|
+
this.isConnected && (this.syncLayoutVariant(), this.currentConfig = this.resolveConfig(), this.configureFooter());
|
|
4442
|
+
}
|
|
4443
|
+
isNoCardVariant() {
|
|
4444
|
+
return this.getAttribute("variant") === "no-card" || this.hasAttribute("no-card");
|
|
4445
|
+
}
|
|
4446
|
+
syncLayoutVariant() {
|
|
4447
|
+
this.rootEl?.classList.toggle("sendity--no-card", this.isNoCardVariant());
|
|
4340
4448
|
}
|
|
4341
4449
|
startWhenVisible() {
|
|
4342
4450
|
if (!(this.authFlowStarted || this.destroyed)) {
|
|
@@ -4396,7 +4504,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4396
4504
|
this.footerEl.hidden = !0, this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.footerObserver?.disconnect(), this.footerObserver = null;
|
|
4397
4505
|
return;
|
|
4398
4506
|
}
|
|
4399
|
-
this.footerEl.hidden = !1, this.footerEl.classList.remove("footer--waiting", "footer--transitioning", "footer--leaving"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.setAttribute("hidden", ""), this.observeFooterVisibility();
|
|
4507
|
+
this.footerEl.hidden = !1, this.footerEl.classList.remove("footer--waiting", "footer--transitioning", "footer--leaving", "footer--verified"), this.setFooterIndicatorWaiting(), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.setAttribute("hidden", ""), this.observeFooterVisibility();
|
|
4400
4508
|
}
|
|
4401
4509
|
}
|
|
4402
4510
|
isFooterHidden() {
|
|
@@ -4413,8 +4521,14 @@ const ve = class ve extends HTMLElement {
|
|
|
4413
4521
|
this.footerWaitTimer = null, this.showFooterWaitingState();
|
|
4414
4522
|
}, or));
|
|
4415
4523
|
}
|
|
4524
|
+
setFooterIndicatorWaiting() {
|
|
4525
|
+
this.footerIndicatorEl && (this.footerIndicatorEl.classList.remove("footer-indicator--error"), this.footerIndicatorEl.innerHTML = "", this.footerIndicatorEl.removeAttribute("hidden"));
|
|
4526
|
+
}
|
|
4527
|
+
setFooterIndicatorError() {
|
|
4528
|
+
this.footerIndicatorEl && (this.footerIndicatorEl.classList.add("footer-indicator--error"), this.footerIndicatorEl.innerHTML = nr, this.footerIndicatorEl.removeAttribute("hidden"));
|
|
4529
|
+
}
|
|
4416
4530
|
showFooterWaitingState() {
|
|
4417
|
-
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(() => {
|
|
4531
|
+
this.isFooterHidden() || (this.currentConfig && this.footerMessageEl && (this.footerMessageEl.textContent = this.waitingFooterMessage()), this.setFooterIndicatorWaiting(), 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(() => {
|
|
4418
4532
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4419
4533
|
}, pe), this.startCountdown());
|
|
4420
4534
|
}
|
|
@@ -4431,8 +4545,8 @@ const ve = class ve extends HTMLElement {
|
|
|
4431
4545
|
this.footerTimerEl.setAttribute("hidden", "");
|
|
4432
4546
|
return;
|
|
4433
4547
|
}
|
|
4434
|
-
const a = Math.max(0, Math.floor((s - Date.now()) / 1e3)), h = Math.floor(a / 60),
|
|
4435
|
-
this.footerTimerEl.textContent = `${h}:${
|
|
4548
|
+
const a = Math.max(0, Math.floor((s - Date.now()) / 1e3)), h = Math.floor(a / 60), d = String(a % 60).padStart(2, "0");
|
|
4549
|
+
this.footerTimerEl.textContent = `${h}:${d}`, 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());
|
|
4436
4550
|
};
|
|
4437
4551
|
i(), this.timerInterval = window.setInterval(i, 1e3);
|
|
4438
4552
|
}
|
|
@@ -4441,9 +4555,9 @@ const ve = class ve extends HTMLElement {
|
|
|
4441
4555
|
}
|
|
4442
4556
|
showExpiredState() {
|
|
4443
4557
|
if (!(this.authenticated || this.destroyed || !this.currentConfig)) {
|
|
4444
|
-
if (this.stopAuthTransports(), this.codeContainerEl?.classList.remove("code--active", "code--placeholder"), this.codeContainerEl?.classList.add("code--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.codeEl?.removeAttribute("hidden"), !this.isFooterHidden()) {
|
|
4445
|
-
const i =
|
|
4446
|
-
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(() => {
|
|
4558
|
+
if (this.stopAuthTransports(), this.rootEl?.classList.remove("sendity--verified"), this.rootEl?.classList.add("sendity--expired"), this.codeContainerEl?.classList.remove("code--active", "code--placeholder"), this.codeContainerEl?.classList.add("code--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.codeEl?.removeAttribute("hidden"), !this.isFooterHidden()) {
|
|
4559
|
+
const i = X(this.currentConfig.lang);
|
|
4560
|
+
this.footerMessageEl && (this.footerMessageEl.textContent = i.ui.codeExpired), this.setFooterIndicatorError(), 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(() => {
|
|
4447
4561
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4448
4562
|
}, pe);
|
|
4449
4563
|
}
|
|
@@ -4452,12 +4566,12 @@ const ve = class ve extends HTMLElement {
|
|
|
4452
4566
|
}
|
|
4453
4567
|
renderExpiredAction() {
|
|
4454
4568
|
if (!this.verifiersEl || !this.currentConfig) return;
|
|
4455
|
-
const i =
|
|
4569
|
+
const i = X(this.currentConfig.lang);
|
|
4456
4570
|
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden");
|
|
4457
4571
|
const s = document.createElement("button");
|
|
4458
|
-
s.type = "button", s.className = "chan
|
|
4459
|
-
s.disabled = !0, this.requestNewAuthRequest().catch((
|
|
4460
|
-
console.warn("[sendity-auth] failed to request a new code",
|
|
4572
|
+
s.type = "button", s.className = "chan error", s.addEventListener("click", () => {
|
|
4573
|
+
s.disabled = !0, this.requestNewAuthRequest().catch((d) => {
|
|
4574
|
+
console.warn("[sendity-auth] failed to request a new code", d), s.disabled = !1;
|
|
4461
4575
|
});
|
|
4462
4576
|
});
|
|
4463
4577
|
const a = document.createElement("span");
|
|
@@ -4468,9 +4582,9 @@ const ve = class ve extends HTMLElement {
|
|
|
4468
4582
|
async requestNewAuthRequest() {
|
|
4469
4583
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4470
4584
|
const i = this.currentConfig;
|
|
4471
|
-
this.stopAuthTransports(), this.stopCountdown(), this.codeContainerEl?.classList.remove("code--expired");
|
|
4585
|
+
this.stopAuthTransports(), this.stopCountdown(), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.setFooterIndicatorWaiting(), this.codeContainerEl?.classList.remove("code--expired");
|
|
4472
4586
|
const s = await this.createAuthRequest(i.serverUrl, i.publicKey, me());
|
|
4473
|
-
this.
|
|
4587
|
+
this.showFooterWaitingState(), this.configureRealtime(s);
|
|
4474
4588
|
}
|
|
4475
4589
|
handleInitialError(i) {
|
|
4476
4590
|
console.error("[sendity-auth] Unable to initialize authentication", i), this.renderError("Unable to initialize authentication, see console for details"), this.dispatchEvent(
|
|
@@ -4485,24 +4599,13 @@ const ve = class ve extends HTMLElement {
|
|
|
4485
4599
|
const i = {
|
|
4486
4600
|
lang: navigator.language?.startsWith("de") ? "de" : navigator.language?.startsWith("fr") ? "fr" : "en",
|
|
4487
4601
|
transport: "auto"
|
|
4488
|
-
}, s = (
|
|
4602
|
+
}, s = (E) => this.getAttribute(E) ?? void 0, a = s("server-url")?.trim() || ir, h = s("public-key")?.trim();
|
|
4489
4603
|
if (!h)
|
|
4490
4604
|
throw new Error("Missing required sendity-auth attribute: public-key");
|
|
4491
|
-
let
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
if (u = JSON.parse(m), !Array.isArray(u)) throw new Error("verify-urls not array");
|
|
4496
|
-
u = u.map(String);
|
|
4497
|
-
} catch {
|
|
4498
|
-
u = m.split(",").map((R) => R.trim()).filter(Boolean);
|
|
4499
|
-
}
|
|
4500
|
-
if (u = cr(u), u.length === 0)
|
|
4501
|
-
throw new Error("Missing required sendity-auth attribute: verify-urls");
|
|
4502
|
-
let g = s("lang") || i.lang;
|
|
4503
|
-
g !== "en" && g !== "de" && g !== "fr" && (g = i.lang);
|
|
4504
|
-
const b = s("transport"), _ = b === "push" || b === "polling" ? b : i.transport, w = this.parseAuthenticatedEventDelayMs(s("authenticated-event-delay-ms"));
|
|
4505
|
-
return { serverUrl: a, publicKey: h, verifyUrls: u, lang: g, transport: _, authenticatedEventDelayMs: w };
|
|
4605
|
+
let d = s("lang") || i.lang;
|
|
4606
|
+
d !== "en" && d !== "de" && d !== "fr" && (d = i.lang);
|
|
4607
|
+
const m = s("transport"), g = m === "push" || m === "polling" ? m : i.transport, y = this.parseAuthenticatedEventDelayMs(s("authenticated-event-delay-ms"));
|
|
4608
|
+
return { serverUrl: a, publicKey: h, lang: d, transport: g, authenticatedEventDelayMs: y };
|
|
4506
4609
|
}
|
|
4507
4610
|
parseAuthenticatedEventDelayMs(i) {
|
|
4508
4611
|
if (i === void 0 || i.trim() === "") return Ie;
|
|
@@ -4520,43 +4623,43 @@ const ve = class ve extends HTMLElement {
|
|
|
4520
4623
|
body: JSON.stringify({ public_key: s })
|
|
4521
4624
|
});
|
|
4522
4625
|
if (!h.ok) throw new Error(`Auth request creation failed: ${h.status}`);
|
|
4523
|
-
const
|
|
4524
|
-
if (!
|
|
4525
|
-
const m = this.extractClientSecret(
|
|
4626
|
+
const d = await h.json();
|
|
4627
|
+
if (!d.id) throw new Error("Missing id from server response");
|
|
4628
|
+
const m = this.extractClientSecret(d);
|
|
4526
4629
|
if (!m) throw new Error("Missing client secret from server response");
|
|
4527
|
-
return ar(a, i, s, { id: String(
|
|
4528
|
-
verificationId: String(
|
|
4529
|
-
code:
|
|
4530
|
-
channel: this.primaryChannel(this.
|
|
4531
|
-
}),
|
|
4630
|
+
return ar(a, i, s, { id: String(d.id), clientSecret: m }), this.activeAuthRequestId = String(d.id), this.activeAuthRequestSecret = m, this.updateActiveAuthRequestExpiry(d), this.applyVerifyUrlsFromResponse(d), this.updateCode(d.formattedCode ?? d.code), this.dispatchPublicEvent("sendity:challenge-created", {
|
|
4631
|
+
verificationId: String(d.id),
|
|
4632
|
+
code: d.formattedCode ?? d.code ?? "",
|
|
4633
|
+
channel: this.primaryChannel(this.activeVerifyUrls)
|
|
4634
|
+
}), d;
|
|
4532
4635
|
}
|
|
4533
4636
|
async step() {
|
|
4534
4637
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4535
|
-
const { serverUrl: i, publicKey: s } = this.currentConfig, a = me(), h =
|
|
4536
|
-
if (!
|
|
4638
|
+
const { serverUrl: i, publicKey: s } = this.currentConfig, a = me(), h = bt(a, i, s), d = h?.id;
|
|
4639
|
+
if (!d)
|
|
4537
4640
|
return await this.createAuthRequest(i, s, a);
|
|
4538
|
-
this.activeAuthRequestId =
|
|
4641
|
+
this.activeAuthRequestId = d, this.activeAuthRequestSecret = h.clientSecret;
|
|
4539
4642
|
const m = await fetch(
|
|
4540
|
-
this.authRequestStatusUrl(i,
|
|
4643
|
+
this.authRequestStatusUrl(i, d),
|
|
4541
4644
|
this.authRequestStatusInit(h.clientSecret)
|
|
4542
4645
|
);
|
|
4543
4646
|
if (m.status !== 200)
|
|
4544
4647
|
return wt(a, i, s), await this.step();
|
|
4545
4648
|
const g = await m.json();
|
|
4546
|
-
if (g.status === "verified")
|
|
4649
|
+
if (this.applyVerifyUrlsFromResponse(g), g.status === "verified")
|
|
4547
4650
|
return this.handleAuthenticated(g), g;
|
|
4548
4651
|
if (g.status === "expired")
|
|
4549
4652
|
return this.updateActiveAuthRequestExpiry(g), this.updateCode(g.formattedCode ?? g.code), this.showExpiredState(), g;
|
|
4550
4653
|
g.id && (this.activeAuthRequestId = String(g.id));
|
|
4551
|
-
const
|
|
4552
|
-
return
|
|
4654
|
+
const y = this.extractClientSecret(g);
|
|
4655
|
+
return y && (this.activeAuthRequestSecret = y), this.updateActiveAuthRequestExpiry(g), this.updateCode(g.formattedCode ?? g.code), g;
|
|
4553
4656
|
}
|
|
4554
4657
|
configureRealtime(i) {
|
|
4555
4658
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4556
4659
|
const { transport: s } = this.currentConfig, a = i?.broadcasting, h = !!(a?.key && a.channel && a.authEndpoint);
|
|
4557
|
-
let
|
|
4558
|
-
s !== "polling" && h && a ?
|
|
4559
|
-
const m = lr(s, h,
|
|
4660
|
+
let d = !1;
|
|
4661
|
+
s !== "polling" && h && a ? d = this.subscribeToBroadcasting(a) : s === "push" && console.warn("[sendity-auth] Push transport requested, but server response does not contain broadcasting metadata");
|
|
4662
|
+
const m = lr(s, h, d);
|
|
4560
4663
|
m.start && this.startPolling(m.delayMs);
|
|
4561
4664
|
}
|
|
4562
4665
|
subscribeToBroadcasting(i) {
|
|
@@ -4564,7 +4667,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4564
4667
|
try {
|
|
4565
4668
|
window.Pusher = Ki;
|
|
4566
4669
|
const s = (i.scheme ?? "https") === "https", a = i.port ?? (s ? 443 : 80);
|
|
4567
|
-
return this.echo = new
|
|
4670
|
+
return this.echo = new Xi({
|
|
4568
4671
|
broadcaster: "reverb",
|
|
4569
4672
|
key: i.key,
|
|
4570
4673
|
wsHost: i.host ?? new URL(this.currentConfig.serverUrl).hostname,
|
|
@@ -4622,7 +4725,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4622
4725
|
this.dispatchEvent(new CustomEvent(i, { bubbles: !0, composed: !0, detail: s }));
|
|
4623
4726
|
}
|
|
4624
4727
|
toPublicAuthenticatedDetail(i) {
|
|
4625
|
-
const s = String(i.auth_request_id ?? i.authRequestId ?? this.activeAuthRequestId ?? ""), a = i.channel ?? this.primaryChannel(this.
|
|
4728
|
+
const s = String(i.auth_request_id ?? i.authRequestId ?? this.activeAuthRequestId ?? ""), a = i.channel ?? this.primaryChannel(this.activeVerifyUrls), h = i.expires_at ?? i.expiresAt;
|
|
4626
4729
|
return {
|
|
4627
4730
|
sessionId: s,
|
|
4628
4731
|
channel: a,
|
|
@@ -4636,6 +4739,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4636
4739
|
const s = i[0] ?? "";
|
|
4637
4740
|
return s.startsWith("mailto:") ? "email" : s.startsWith("whatsapp:") || s.startsWith("whatsapp://") ? "whatsapp" : "unknown";
|
|
4638
4741
|
}
|
|
4742
|
+
applyVerifyUrlsFromResponse(i) {
|
|
4743
|
+
const s = Array.isArray(i.verify_urls) ? i.verify_urls : Array.isArray(i.verifyUrls) ? i.verifyUrls : [], a = Array.isArray(i.verification_endpoints) ? i.verification_endpoints.map((d) => typeof d.url == "string" ? d.url : typeof d.scheme == "string" && typeof d.recipient == "string" ? `${d.scheme}:${d.recipient}` : "") : [], h = cr([...s, ...a].map(String));
|
|
4744
|
+
h.length !== 0 && (this.activeVerifyUrls = [...new Set(h)], this.renderVerifiers(this.activeVerifyUrls));
|
|
4745
|
+
}
|
|
4639
4746
|
authRequestStatusUrl(i, s) {
|
|
4640
4747
|
return new URL(this.joinUrl(i, `/auth-requests/${encodeURIComponent(s)}`)).toString();
|
|
4641
4748
|
}
|
|
@@ -4658,7 +4765,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4658
4765
|
}
|
|
4659
4766
|
waitingFooterMessage() {
|
|
4660
4767
|
if (!this.currentConfig) return "";
|
|
4661
|
-
const i =
|
|
4768
|
+
const i = X(this.currentConfig.lang), s = this.formatExpiryTime(this.activeAuthRequestExpiresAt, this.currentConfig.lang);
|
|
4662
4769
|
return s ? i.ui.footerWaitingUntil.replace("(Time)", s) : i.ui.footerWaiting;
|
|
4663
4770
|
}
|
|
4664
4771
|
formatExpiryTime(i, s) {
|
|
@@ -4678,7 +4785,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4678
4785
|
}
|
|
4679
4786
|
async fetchAuthorizationAfterAuthenticatedSignal() {
|
|
4680
4787
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4681
|
-
const i =
|
|
4788
|
+
const i = bt(me(), this.currentConfig.serverUrl, this.currentConfig.publicKey), s = this.activeAuthRequestId ?? i?.id, a = this.activeAuthRequestSecret ?? i?.clientSecret;
|
|
4682
4789
|
if (!s || !a)
|
|
4683
4790
|
throw new Error("Cannot fetch authorization without an active auth request id and client secret");
|
|
4684
4791
|
const h = await fetch(
|
|
@@ -4687,9 +4794,9 @@ const ve = class ve extends HTMLElement {
|
|
|
4687
4794
|
);
|
|
4688
4795
|
if (!h.ok)
|
|
4689
4796
|
throw new Error(`Authorization fetch failed: ${h.status}`);
|
|
4690
|
-
const
|
|
4691
|
-
if (
|
|
4692
|
-
this.handleAuthenticated(
|
|
4797
|
+
const d = await h.json();
|
|
4798
|
+
if (d.status === "verified" && d.authorization) {
|
|
4799
|
+
this.handleAuthenticated(d);
|
|
4693
4800
|
return;
|
|
4694
4801
|
}
|
|
4695
4802
|
throw new Error("Verified auth request did not include authorization");
|
|
@@ -4701,39 +4808,39 @@ const ve = class ve extends HTMLElement {
|
|
|
4701
4808
|
this.lastCode = a, this.codeEl.textContent = a, this.codeContainerEl?.classList.remove("code--expired", "code--placeholder"), this.showCodeState();
|
|
4702
4809
|
} else
|
|
4703
4810
|
this.lastCode = void 0, this.showPlaceholderCode();
|
|
4704
|
-
this.currentConfig && this.renderVerifiers(this.
|
|
4811
|
+
this.currentConfig && this.renderVerifiers(this.activeVerifyUrls);
|
|
4705
4812
|
}
|
|
4706
4813
|
showPlaceholderCode() {
|
|
4707
|
-
this.codeEl && (this.lastCode = void 0, this.spinnerEl?.setAttribute("hidden", ""), this.codeEl.textContent = this.randomPlaceholderCode(), this.codeEl.removeAttribute("hidden"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--exiting"
|
|
4814
|
+
this.codeEl && (this.lastCode = void 0, this.spinnerEl?.setAttribute("hidden", ""), this.codeEl.textContent = this.randomPlaceholderCode(), this.codeEl.removeAttribute("hidden"), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--exiting"), this.codeContainerEl?.classList.add("code--placeholder"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", ""));
|
|
4708
4815
|
}
|
|
4709
4816
|
randomPlaceholderCode() {
|
|
4710
4817
|
const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", s = () => i[Math.floor(Math.random() * i.length)], a = () => `${s()}${s()}${s()}`;
|
|
4711
4818
|
return `SDY-${a()}-${a()}`;
|
|
4712
4819
|
}
|
|
4713
4820
|
renderError(i) {
|
|
4714
|
-
this.codeEl && (this.codeEl.textContent = i), this.verifiersEl && (this.verifiersEl.innerHTML = "");
|
|
4821
|
+
this.rootEl?.classList.remove("sendity--verified"), this.rootEl?.classList.add("sendity--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--placeholder", "code--exiting"), this.codeContainerEl?.classList.add("code--expired"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.codeEl && (this.codeEl.textContent = i, this.codeEl.removeAttribute("hidden")), this.verifiersEl && (this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden")), this.isFooterHidden() || (this.setFooterIndicatorError(), this.footerMessageEl && (this.footerMessageEl.textContent = i), this.footerEl?.classList.add("footer--waiting"), this.footerBrandEl?.setAttribute("hidden", ""), this.footerStatusEl?.removeAttribute("hidden"), this.footerTimerEl?.setAttribute("hidden", ""));
|
|
4715
4822
|
}
|
|
4716
4823
|
showLoading() {
|
|
4717
4824
|
this.spinnerEl?.removeAttribute("hidden"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--placeholder"), this.codeEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", "");
|
|
4718
4825
|
}
|
|
4719
4826
|
showCodeState() {
|
|
4720
|
-
if (this.spinnerEl?.setAttribute("hidden", ""), this.
|
|
4721
|
-
const i =
|
|
4827
|
+
if (this.spinnerEl?.setAttribute("hidden", ""), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--verified", "code--placeholder"), this.codeContainerEl?.classList.remove("code--exiting"), 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) {
|
|
4828
|
+
const i = X(this.currentConfig.lang);
|
|
4722
4829
|
this.promptEl.textContent = i.ui.sendCodePrompt, this.promptEl.classList.remove("prompt--exiting"), this.promptEl.removeAttribute("aria-hidden"), this.promptEl.removeAttribute("hidden");
|
|
4723
4830
|
}
|
|
4724
4831
|
this.successEl?.setAttribute("hidden", "");
|
|
4725
4832
|
}
|
|
4726
4833
|
showSuccess(i) {
|
|
4727
|
-
this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--active", "code--placeholder"), this.codeContainerEl?.classList.add("code--verified", "code--exiting"), this.promptEl?.classList.add("prompt--exiting"), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.stopCountdown();
|
|
4834
|
+
this.rootEl?.classList.remove("sendity--expired"), this.rootEl?.classList.add("sendity--verified"), this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--active", "code--placeholder"), this.codeContainerEl?.classList.add("code--verified", "code--exiting"), this.promptEl?.classList.add("prompt--exiting"), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.stopCountdown();
|
|
4728
4835
|
const s = this.isFooterHidden();
|
|
4729
4836
|
if (this.footerEl && (this.footerEl.hidden = s, this.footerEl.classList.remove("footer--leaving"), s || (this.footerEl.classList.add("footer--waiting", "footer--transitioning", "footer--verified"), window.setTimeout(() => {
|
|
4730
4837
|
this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl && (this.footerBrandEl.hidden = !0);
|
|
4731
4838
|
}, pe))), this.footerStatusEl && (this.footerStatusEl.hidden = s), this.footerMessageEl) {
|
|
4732
|
-
const a = i.
|
|
4733
|
-
this.footerMessageEl.textContent = a
|
|
4839
|
+
const a = i.channel ?? this.primaryChannel(this.activeVerifyUrls);
|
|
4840
|
+
this.footerMessageEl.textContent = this.verifiedSigningInMessage(a);
|
|
4734
4841
|
}
|
|
4735
|
-
if (this.footerTimerEl && (this.footerTimerEl.hidden = !
|
|
4736
|
-
const a =
|
|
4842
|
+
if (this.footerTimerEl && (this.footerTimerEl.hidden = !0, this.footerTimerEl.classList.remove("low"), this.footerTimerEl.textContent = ""), this.verifiersEl?.classList.add("verifiers--exiting"), this.currentConfig && this.successEl) {
|
|
4843
|
+
const a = X(this.currentConfig.lang), h = i.name && i.name.trim().length > 0 ? a.ui.successGreeting.replace("(Name)", i.name) : "You're in!";
|
|
4737
4844
|
this.successEl.innerHTML = `
|
|
4738
4845
|
<span class="success-check" aria-hidden="true">
|
|
4739
4846
|
<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>
|
|
@@ -4745,16 +4852,19 @@ const ve = class ve extends HTMLElement {
|
|
|
4745
4852
|
this.successTransitionTimer = null, this.verifiersEl && this.verifiersEl.setAttribute("aria-hidden", "true"), this.codeContainerEl?.setAttribute("aria-hidden", "true"), this.promptEl?.setAttribute("aria-hidden", "true");
|
|
4746
4853
|
}, pe);
|
|
4747
4854
|
}
|
|
4855
|
+
verifiedSigningInMessage(i) {
|
|
4856
|
+
return `Verified ${i === "whatsapp" ? "your phone number" : "your email address"} · signing you in...`;
|
|
4857
|
+
}
|
|
4748
4858
|
destinationAddressForChannel(i) {
|
|
4749
|
-
const s = this.
|
|
4859
|
+
const s = this.activeVerifyUrls, a = s.find((h) => this.channelClass(h) === i) ?? s[0];
|
|
4750
4860
|
if (!a) return null;
|
|
4751
4861
|
try {
|
|
4752
4862
|
const h = new URL(a, window.location.origin);
|
|
4753
4863
|
if (h.protocol === "mailto:")
|
|
4754
4864
|
return decodeURIComponent(h.pathname || h.href.replace(/^mailto:/, "").split("?")[0]) || null;
|
|
4755
4865
|
if (h.protocol === "whatsapp:" || h.protocol === "whatsapp://") {
|
|
4756
|
-
const
|
|
4757
|
-
return
|
|
4866
|
+
const d = h.searchParams.get("phone") || h.pathname.replace(/^\/+/, "");
|
|
4867
|
+
return d ? `+${d.replace(/^\+/, "")}` : null;
|
|
4758
4868
|
}
|
|
4759
4869
|
} catch {
|
|
4760
4870
|
if (a.startsWith("mailto:")) return a.replace(/^mailto:/, "").split("?")[0] || null;
|
|
@@ -4771,30 +4881,30 @@ const ve = class ve extends HTMLElement {
|
|
|
4771
4881
|
const s = this.currentConfig;
|
|
4772
4882
|
i.forEach((a, h) => {
|
|
4773
4883
|
if (h > 0 && i.length === 2) {
|
|
4774
|
-
const
|
|
4775
|
-
|
|
4776
|
-
const
|
|
4777
|
-
|
|
4884
|
+
const S = document.createElement("div");
|
|
4885
|
+
S.className = "divider", S.setAttribute("aria-hidden", "true");
|
|
4886
|
+
const O = document.createElement("span");
|
|
4887
|
+
O.textContent = s.lang === "de" ? "oder" : s.lang === "fr" ? "ou" : "or", S.appendChild(O), this.verifiersEl.appendChild(S);
|
|
4778
4888
|
}
|
|
4779
|
-
const
|
|
4780
|
-
|
|
4889
|
+
const d = document.createElement("div");
|
|
4890
|
+
d.className = "opt";
|
|
4781
4891
|
const m = document.createElement("a");
|
|
4782
4892
|
m.className = "chan " + this.channelClass(a), m.href = this.buildLink(a, s.lang), m.target = "_blank", m.rel = "noopener noreferrer", m.addEventListener("click", () => {
|
|
4783
4893
|
this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.showFooterWaitingState();
|
|
4784
4894
|
});
|
|
4785
4895
|
const g = this.iconForUrl(a);
|
|
4786
4896
|
if (g) {
|
|
4787
|
-
const
|
|
4788
|
-
|
|
4897
|
+
const S = document.createElement("span");
|
|
4898
|
+
S.className = "icon", S.setAttribute("aria-hidden", "true"), S.innerHTML = g, m.appendChild(S);
|
|
4789
4899
|
}
|
|
4790
|
-
const
|
|
4791
|
-
|
|
4792
|
-
const
|
|
4793
|
-
if (
|
|
4794
|
-
const
|
|
4795
|
-
|
|
4900
|
+
const y = document.createElement("span");
|
|
4901
|
+
y.className = "label", y.textContent = this.channelLabel(a, s.lang), m.appendChild(y), d.appendChild(m);
|
|
4902
|
+
const E = this.destinationText(a, s.lang);
|
|
4903
|
+
if (E) {
|
|
4904
|
+
const S = document.createElement("a");
|
|
4905
|
+
S.className = "dest", S.href = m.href, S.target = "_blank", S.rel = "noopener noreferrer", S.textContent = E, d.appendChild(S);
|
|
4796
4906
|
}
|
|
4797
|
-
this.verifiersEl.appendChild(
|
|
4907
|
+
this.verifiersEl.appendChild(d);
|
|
4798
4908
|
});
|
|
4799
4909
|
}
|
|
4800
4910
|
channelClass(i) {
|
|
@@ -4809,30 +4919,30 @@ const ve = class ve extends HTMLElement {
|
|
|
4809
4919
|
return "generic";
|
|
4810
4920
|
}
|
|
4811
4921
|
channelLabel(i, s) {
|
|
4812
|
-
const a =
|
|
4922
|
+
const a = X(s), h = this.channelClass(i);
|
|
4813
4923
|
if (h === "email") return a.labels.email;
|
|
4814
4924
|
if (h === "whatsapp") return a.labels.whatsapp;
|
|
4815
4925
|
try {
|
|
4816
|
-
const
|
|
4817
|
-
return
|
|
4926
|
+
const d = new URL(i, window.location.origin);
|
|
4927
|
+
return d.protocol.startsWith("http") ? d.hostname : d.protocol.replace(":", "");
|
|
4818
4928
|
} catch {
|
|
4819
4929
|
return i;
|
|
4820
4930
|
}
|
|
4821
4931
|
}
|
|
4822
4932
|
destinationText(i, s) {
|
|
4823
|
-
const h =
|
|
4933
|
+
const h = X(s).ui.toPrefix ?? "to";
|
|
4824
4934
|
try {
|
|
4825
|
-
const
|
|
4826
|
-
if (
|
|
4827
|
-
const m = decodeURIComponent(
|
|
4935
|
+
const d = new URL(i, window.location.origin);
|
|
4936
|
+
if (d.protocol === "mailto:") {
|
|
4937
|
+
const m = decodeURIComponent(d.pathname || d.href.replace(/^mailto:/, "").split("?")[0]);
|
|
4828
4938
|
return m ? `${h} ${m}` : null;
|
|
4829
4939
|
}
|
|
4830
|
-
if (
|
|
4831
|
-
const m =
|
|
4940
|
+
if (d.protocol === "whatsapp:" || d.protocol === "whatsapp://") {
|
|
4941
|
+
const m = d.searchParams.get("phone") || d.pathname.replace(/^\/+/, "");
|
|
4832
4942
|
return m ? `${h} +${m.replace(/^\+/, "")}` : null;
|
|
4833
4943
|
}
|
|
4834
|
-
if (
|
|
4835
|
-
const m =
|
|
4944
|
+
if (d.protocol.startsWith("http") && (d.hostname === "wa.me" || d.hostname === "api.whatsapp.com")) {
|
|
4945
|
+
const m = d.pathname.replace(/^\/+/, "").replace(/[^0-9]/g, "");
|
|
4836
4946
|
return m ? `${h} +${m}` : null;
|
|
4837
4947
|
}
|
|
4838
4948
|
} catch {
|
|
@@ -4843,15 +4953,15 @@ const ve = class ve extends HTMLElement {
|
|
|
4843
4953
|
try {
|
|
4844
4954
|
const s = new URL(i, window.location.origin);
|
|
4845
4955
|
if (s.protocol === "mailto:") return vt;
|
|
4846
|
-
if (s.protocol === "whatsapp:" || s.protocol === "whatsapp://") return
|
|
4956
|
+
if (s.protocol === "whatsapp:" || s.protocol === "whatsapp://") return yt;
|
|
4847
4957
|
} catch {
|
|
4848
4958
|
if (i.startsWith("mailto:")) return vt;
|
|
4849
|
-
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) return
|
|
4959
|
+
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) return yt;
|
|
4850
4960
|
}
|
|
4851
4961
|
return null;
|
|
4852
4962
|
}
|
|
4853
4963
|
labelForUrl(i, s) {
|
|
4854
|
-
const a =
|
|
4964
|
+
const a = X(s);
|
|
4855
4965
|
try {
|
|
4856
4966
|
const h = new URL(i, window.location.origin);
|
|
4857
4967
|
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(":", "");
|
|
@@ -4860,19 +4970,19 @@ const ve = class ve extends HTMLElement {
|
|
|
4860
4970
|
}
|
|
4861
4971
|
}
|
|
4862
4972
|
buildLink(i, s) {
|
|
4863
|
-
const a = this.lastCode, h =
|
|
4973
|
+
const a = this.lastCode, h = X(s), d = window.location.host;
|
|
4864
4974
|
if (!a) return i;
|
|
4865
4975
|
if (i.startsWith("mailto:")) {
|
|
4866
|
-
const [m, g = ""] = i.split("?"),
|
|
4867
|
-
|
|
4868
|
-
const
|
|
4869
|
-
return `${m}?${
|
|
4976
|
+
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), E = this.applyTemplate(h.templates.emailSubject, d, a), S = this.applyTemplate(h.templates.emailBody, d, a);
|
|
4977
|
+
y.set("subject", E), y.set("body", S);
|
|
4978
|
+
const O = this.toQuery(y);
|
|
4979
|
+
return `${m}?${O}`;
|
|
4870
4980
|
}
|
|
4871
4981
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) {
|
|
4872
|
-
const [m, g = ""] = i.split("?"),
|
|
4873
|
-
|
|
4874
|
-
const
|
|
4875
|
-
return `${m}?${
|
|
4982
|
+
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), E = this.applyTemplate(h.templates.whatsappText, d, a);
|
|
4983
|
+
y.set("text", E);
|
|
4984
|
+
const S = this.toQuery(y);
|
|
4985
|
+
return `${m}?${S}`;
|
|
4876
4986
|
}
|
|
4877
4987
|
return i;
|
|
4878
4988
|
}
|
|
@@ -4885,8 +4995,8 @@ const ve = class ve extends HTMLElement {
|
|
|
4885
4995
|
toQuery(i) {
|
|
4886
4996
|
const s = [];
|
|
4887
4997
|
return i.forEach((a, h) => {
|
|
4888
|
-
const
|
|
4889
|
-
s.push(`${
|
|
4998
|
+
const d = encodeURIComponent(h), m = encodeURIComponent(a);
|
|
4999
|
+
s.push(`${d}=${m}`);
|
|
4890
5000
|
}), s.join("&");
|
|
4891
5001
|
}
|
|
4892
5002
|
joinUrl(i, s) {
|