@sendity/client 0.1.2 → 0.1.4
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 +8 -0
- package/dist/i18n/sendity.en.d.ts +2 -0
- package/dist/sendity-client.js +860 -768
- package/dist/tailwind.css +1 -1
- package/package.json +1 -1
package/dist/sendity-client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const pt = `<template id="sendity-tpl">
|
|
2
2
|
<div class="sendity" role="region" aria-label="Sendity authentication">
|
|
3
3
|
<div class="sendity-body">
|
|
4
4
|
<slot id="prompt">
|
|
@@ -29,7 +29,7 @@ const ft = `<template id="sendity-tpl">
|
|
|
29
29
|
</footer>
|
|
30
30
|
</div>
|
|
31
31
|
</template>
|
|
32
|
-
`,
|
|
32
|
+
`, zi = `/* Sendity client — passwordless channel-control authentication widget.
|
|
33
33
|
Design tokens mirror the Sendity Design System (emerald accent, stone neutral,
|
|
34
34
|
Zilla Slab display / Geist UI / Geist Mono). All values are overridable via
|
|
35
35
|
CSS custom properties so the host page can theme the widget.
|
|
@@ -210,6 +210,16 @@ const ft = `<template id="sendity-tpl">
|
|
|
210
210
|
font-family: var(--sendity-code-font-family);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
.sendity .code--placeholder .formatted-code {
|
|
214
|
+
filter: blur(0.45rem);
|
|
215
|
+
opacity: 0.55;
|
|
216
|
+
user-select: none;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.sendity .code--placeholder {
|
|
220
|
+
pointer-events: none;
|
|
221
|
+
}
|
|
222
|
+
|
|
213
223
|
.sendity .verifiers {
|
|
214
224
|
display: grid;
|
|
215
225
|
grid-template-columns: 1fr;
|
|
@@ -237,7 +247,20 @@ const ft = `<template id="sendity-tpl">
|
|
|
237
247
|
min-width: 0;
|
|
238
248
|
}
|
|
239
249
|
|
|
240
|
-
.sendity .
|
|
250
|
+
.sendity .code--expired {
|
|
251
|
+
color: var(--sendity-error-color);
|
|
252
|
+
border-color: var(--sendity-error-color);
|
|
253
|
+
background: var(--sendity-error-bg);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.sendity .code--expired .formatted-code {
|
|
257
|
+
text-decoration: line-through;
|
|
258
|
+
text-decoration-thickness: 0.12em;
|
|
259
|
+
text-decoration-color: currentColor;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.sendity .verifiers a.chan,
|
|
263
|
+
.sendity .verifiers button.chan {
|
|
241
264
|
display: inline-flex;
|
|
242
265
|
align-items: center;
|
|
243
266
|
justify-content: center;
|
|
@@ -255,16 +278,29 @@ const ft = `<template id="sendity-tpl">
|
|
|
255
278
|
transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
|
|
256
279
|
}
|
|
257
280
|
|
|
258
|
-
.sendity .verifiers a.chan:active
|
|
259
|
-
.sendity .verifiers
|
|
281
|
+
.sendity .verifiers a.chan:active,
|
|
282
|
+
.sendity .verifiers button.chan:active { transform: scale(0.98); }
|
|
283
|
+
.sendity .verifiers a.chan:focus-visible,
|
|
284
|
+
.sendity .verifiers button.chan:focus-visible { outline: 2px solid var(--sendity-primary-color); outline-offset: 2px; }
|
|
260
285
|
|
|
261
|
-
.sendity .verifiers a.chan .icon
|
|
286
|
+
.sendity .verifiers a.chan .icon,
|
|
287
|
+
.sendity .verifiers button.chan .icon {
|
|
262
288
|
width: 1em;
|
|
263
289
|
height: 1em;
|
|
264
290
|
display: inline-flex;
|
|
265
291
|
flex: none;
|
|
266
292
|
}
|
|
267
|
-
.sendity .verifiers a.chan .icon svg
|
|
293
|
+
.sendity .verifiers a.chan .icon svg,
|
|
294
|
+
.sendity .verifiers button.chan .icon svg { width: 100%; height: 100%; display: block; }
|
|
295
|
+
|
|
296
|
+
.sendity .verifiers button.chan.primary {
|
|
297
|
+
width: 100%;
|
|
298
|
+
color: #ffffff;
|
|
299
|
+
background: var(--sendity-primary-color);
|
|
300
|
+
border-color: var(--sendity-primary-color);
|
|
301
|
+
}
|
|
302
|
+
.sendity .verifiers button.chan.primary:hover { background: var(--sendity-primary-hover); border-color: var(--sendity-primary-hover); }
|
|
303
|
+
.sendity .verifiers button.chan.primary:disabled { opacity: 0.7; cursor: wait; }
|
|
268
304
|
|
|
269
305
|
.sendity .verifiers a.chan.email {
|
|
270
306
|
color: var(--sendity-email-fg);
|
|
@@ -534,8 +570,8 @@ class qe {
|
|
|
534
570
|
/**
|
|
535
571
|
* Listen for a whisper event on the channel instance.
|
|
536
572
|
*/
|
|
537
|
-
listenForWhisper(i,
|
|
538
|
-
return this.listen(".client-" + i,
|
|
573
|
+
listenForWhisper(i, s) {
|
|
574
|
+
return this.listen(".client-" + i, s);
|
|
539
575
|
}
|
|
540
576
|
/**
|
|
541
577
|
* Listen for an event on the channel instance.
|
|
@@ -552,8 +588,8 @@ class qe {
|
|
|
552
588
|
/**
|
|
553
589
|
* Stop listening for a whisper event on the channel instance.
|
|
554
590
|
*/
|
|
555
|
-
stopListeningForWhisper(i,
|
|
556
|
-
return this.stopListening(".client-" + i,
|
|
591
|
+
stopListeningForWhisper(i, s) {
|
|
592
|
+
return this.stopListening(".client-" + i, s);
|
|
557
593
|
}
|
|
558
594
|
}
|
|
559
595
|
class Ct {
|
|
@@ -576,7 +612,7 @@ class Ct {
|
|
|
576
612
|
this.namespace = i;
|
|
577
613
|
}
|
|
578
614
|
}
|
|
579
|
-
function
|
|
615
|
+
function Hi(v) {
|
|
580
616
|
try {
|
|
581
617
|
return Reflect.construct(String, [], v), !0;
|
|
582
618
|
} catch {
|
|
@@ -587,8 +623,8 @@ class Ue extends qe {
|
|
|
587
623
|
/**
|
|
588
624
|
* Create a new class instance.
|
|
589
625
|
*/
|
|
590
|
-
constructor(i,
|
|
591
|
-
super(), this.name =
|
|
626
|
+
constructor(i, s, a) {
|
|
627
|
+
super(), this.name = s, this.pusher = i, this.options = a, this.eventFormatter = new Ct(this.options.namespace), this.subscribe();
|
|
592
628
|
}
|
|
593
629
|
/**
|
|
594
630
|
* Subscribe to a Pusher channel.
|
|
@@ -605,30 +641,30 @@ class Ue extends qe {
|
|
|
605
641
|
/**
|
|
606
642
|
* Listen for an event on the channel instance.
|
|
607
643
|
*/
|
|
608
|
-
listen(i,
|
|
609
|
-
return this.on(this.eventFormatter.format(i),
|
|
644
|
+
listen(i, s) {
|
|
645
|
+
return this.on(this.eventFormatter.format(i), s), this;
|
|
610
646
|
}
|
|
611
647
|
/**
|
|
612
648
|
* Listen for all events on the channel instance.
|
|
613
649
|
*/
|
|
614
650
|
listenToAll(i) {
|
|
615
|
-
return this.subscription.bind_global((
|
|
616
|
-
if (
|
|
651
|
+
return this.subscription.bind_global((s, a) => {
|
|
652
|
+
if (s.startsWith("pusher:"))
|
|
617
653
|
return;
|
|
618
654
|
let h = String(this.options.namespace ?? "").replace(
|
|
619
655
|
/\./g,
|
|
620
656
|
"\\"
|
|
621
|
-
), u =
|
|
657
|
+
), u = s.startsWith(h) ? s.substring(h.length + 1) : "." + s;
|
|
622
658
|
i(u, a);
|
|
623
659
|
}), this;
|
|
624
660
|
}
|
|
625
661
|
/**
|
|
626
662
|
* Stop listening for an event on the channel instance.
|
|
627
663
|
*/
|
|
628
|
-
stopListening(i,
|
|
629
|
-
return
|
|
664
|
+
stopListening(i, s) {
|
|
665
|
+
return s ? this.subscription.unbind(
|
|
630
666
|
this.eventFormatter.format(i),
|
|
631
|
-
|
|
667
|
+
s
|
|
632
668
|
) : this.subscription.unbind(this.eventFormatter.format(i)), this;
|
|
633
669
|
}
|
|
634
670
|
/**
|
|
@@ -649,71 +685,71 @@ class Ue extends qe {
|
|
|
649
685
|
* Register a callback to be called anytime a subscription error occurs.
|
|
650
686
|
*/
|
|
651
687
|
error(i) {
|
|
652
|
-
return this.on("pusher:subscription_error", (
|
|
653
|
-
i(
|
|
688
|
+
return this.on("pusher:subscription_error", (s) => {
|
|
689
|
+
i(s);
|
|
654
690
|
}), this;
|
|
655
691
|
}
|
|
656
692
|
/**
|
|
657
693
|
* Bind a channel to an event.
|
|
658
694
|
*/
|
|
659
|
-
on(i,
|
|
660
|
-
return this.subscription.bind(i,
|
|
695
|
+
on(i, s) {
|
|
696
|
+
return this.subscription.bind(i, s), this;
|
|
661
697
|
}
|
|
662
698
|
}
|
|
663
699
|
class St extends Ue {
|
|
664
700
|
/**
|
|
665
701
|
* Send a whisper event to other clients in the channel.
|
|
666
702
|
*/
|
|
667
|
-
whisper(i,
|
|
703
|
+
whisper(i, s) {
|
|
668
704
|
return this.pusher.channels.channels[this.name].trigger(
|
|
669
705
|
`client-${i}`,
|
|
670
|
-
|
|
706
|
+
s
|
|
671
707
|
), this;
|
|
672
708
|
}
|
|
673
709
|
}
|
|
674
|
-
class
|
|
710
|
+
class Di extends Ue {
|
|
675
711
|
/**
|
|
676
712
|
* Send a whisper event to other clients in the channel.
|
|
677
713
|
*/
|
|
678
|
-
whisper(i,
|
|
714
|
+
whisper(i, s) {
|
|
679
715
|
return this.pusher.channels.channels[this.name].trigger(
|
|
680
716
|
`client-${i}`,
|
|
681
|
-
|
|
717
|
+
s
|
|
682
718
|
), this;
|
|
683
719
|
}
|
|
684
720
|
}
|
|
685
|
-
class
|
|
721
|
+
class Fi extends St {
|
|
686
722
|
/**
|
|
687
723
|
* Register a callback to be called anytime the member list changes.
|
|
688
724
|
*/
|
|
689
725
|
here(i) {
|
|
690
|
-
return this.on("pusher:subscription_succeeded", (
|
|
691
|
-
i(Object.keys(
|
|
726
|
+
return this.on("pusher:subscription_succeeded", (s) => {
|
|
727
|
+
i(Object.keys(s.members).map((a) => s.members[a]));
|
|
692
728
|
}), this;
|
|
693
729
|
}
|
|
694
730
|
/**
|
|
695
731
|
* Listen for someone joining the channel.
|
|
696
732
|
*/
|
|
697
733
|
joining(i) {
|
|
698
|
-
return this.on("pusher:member_added", (
|
|
699
|
-
i(
|
|
734
|
+
return this.on("pusher:member_added", (s) => {
|
|
735
|
+
i(s.info);
|
|
700
736
|
}), this;
|
|
701
737
|
}
|
|
702
738
|
/**
|
|
703
739
|
* Send a whisper event to other clients in the channel.
|
|
704
740
|
*/
|
|
705
|
-
whisper(i,
|
|
741
|
+
whisper(i, s) {
|
|
706
742
|
return this.pusher.channels.channels[this.name].trigger(
|
|
707
743
|
`client-${i}`,
|
|
708
|
-
|
|
744
|
+
s
|
|
709
745
|
), this;
|
|
710
746
|
}
|
|
711
747
|
/**
|
|
712
748
|
* Listen for someone leaving the channel.
|
|
713
749
|
*/
|
|
714
750
|
leaving(i) {
|
|
715
|
-
return this.on("pusher:member_removed", (
|
|
716
|
-
i(
|
|
751
|
+
return this.on("pusher:member_removed", (s) => {
|
|
752
|
+
i(s.info);
|
|
717
753
|
}), this;
|
|
718
754
|
}
|
|
719
755
|
}
|
|
@@ -721,8 +757,8 @@ class Tt extends qe {
|
|
|
721
757
|
/**
|
|
722
758
|
* Create a new class instance.
|
|
723
759
|
*/
|
|
724
|
-
constructor(i,
|
|
725
|
-
super(), this.events = {}, this.listeners = {}, this.name =
|
|
760
|
+
constructor(i, s, a) {
|
|
761
|
+
super(), this.events = {}, this.listeners = {}, this.name = s, this.socket = i, this.options = a, this.eventFormatter = new Ct(this.options.namespace), this.subscribe();
|
|
726
762
|
}
|
|
727
763
|
/**
|
|
728
764
|
* Subscribe to a Socket.io channel.
|
|
@@ -745,21 +781,21 @@ class Tt extends qe {
|
|
|
745
781
|
/**
|
|
746
782
|
* Listen for an event on the channel instance.
|
|
747
783
|
*/
|
|
748
|
-
listen(i,
|
|
749
|
-
return this.on(this.eventFormatter.format(i),
|
|
784
|
+
listen(i, s) {
|
|
785
|
+
return this.on(this.eventFormatter.format(i), s), this;
|
|
750
786
|
}
|
|
751
787
|
/**
|
|
752
788
|
* Stop listening for an event on the channel instance.
|
|
753
789
|
*/
|
|
754
|
-
stopListening(i,
|
|
755
|
-
return this.unbindEvent(this.eventFormatter.format(i),
|
|
790
|
+
stopListening(i, s) {
|
|
791
|
+
return this.unbindEvent(this.eventFormatter.format(i), s), this;
|
|
756
792
|
}
|
|
757
793
|
/**
|
|
758
794
|
* Register a callback to be called anytime a subscription succeeds.
|
|
759
795
|
*/
|
|
760
796
|
subscribed(i) {
|
|
761
|
-
return this.on("connect", (
|
|
762
|
-
i(
|
|
797
|
+
return this.on("connect", (s) => {
|
|
798
|
+
i(s);
|
|
763
799
|
}), this;
|
|
764
800
|
}
|
|
765
801
|
/**
|
|
@@ -771,10 +807,10 @@ class Tt extends qe {
|
|
|
771
807
|
/**
|
|
772
808
|
* Bind the channel's socket to an event and store the callback.
|
|
773
809
|
*/
|
|
774
|
-
on(i,
|
|
810
|
+
on(i, s) {
|
|
775
811
|
return this.listeners[i] = this.listeners[i] || [], this.events[i] || (this.events[i] = (a, h) => {
|
|
776
812
|
this.name === a && this.listeners[i] && this.listeners[i].forEach((u) => u(h));
|
|
777
|
-
}, this.socket.on(i, this.events[i])), this.listeners[i].push(
|
|
813
|
+
}, this.socket.on(i, this.events[i])), this.listeners[i].push(s), this;
|
|
778
814
|
}
|
|
779
815
|
/**
|
|
780
816
|
* Unbind the channel's socket from all stored event callbacks.
|
|
@@ -787,31 +823,31 @@ class Tt extends qe {
|
|
|
787
823
|
/**
|
|
788
824
|
* Unbind the listeners for the given event.
|
|
789
825
|
*/
|
|
790
|
-
unbindEvent(i,
|
|
791
|
-
this.listeners[i] = this.listeners[i] || [],
|
|
792
|
-
(a) => a !==
|
|
793
|
-
)), (!
|
|
826
|
+
unbindEvent(i, s) {
|
|
827
|
+
this.listeners[i] = this.listeners[i] || [], s && (this.listeners[i] = this.listeners[i].filter(
|
|
828
|
+
(a) => a !== s
|
|
829
|
+
)), (!s || this.listeners[i].length === 0) && (this.events[i] && (this.socket.removeListener(i, this.events[i]), delete this.events[i]), delete this.listeners[i]);
|
|
794
830
|
}
|
|
795
831
|
}
|
|
796
|
-
class
|
|
832
|
+
class xt extends Tt {
|
|
797
833
|
/**
|
|
798
834
|
* Send a whisper event to other clients in the channel.
|
|
799
835
|
*/
|
|
800
|
-
whisper(i,
|
|
836
|
+
whisper(i, s) {
|
|
801
837
|
return this.socket.emit("client event", {
|
|
802
838
|
channel: this.name,
|
|
803
839
|
event: `client-${i}`,
|
|
804
|
-
data:
|
|
840
|
+
data: s
|
|
805
841
|
}), this;
|
|
806
842
|
}
|
|
807
843
|
}
|
|
808
|
-
class
|
|
844
|
+
class Wi extends xt {
|
|
809
845
|
/**
|
|
810
846
|
* Register a callback to be called anytime the member list changes.
|
|
811
847
|
*/
|
|
812
848
|
here(i) {
|
|
813
|
-
return this.on("presence:subscribed", (
|
|
814
|
-
i(
|
|
849
|
+
return this.on("presence:subscribed", (s) => {
|
|
850
|
+
i(s.map((a) => a.user_info));
|
|
815
851
|
}), this;
|
|
816
852
|
}
|
|
817
853
|
/**
|
|
@@ -820,17 +856,17 @@ class Fi extends _t {
|
|
|
820
856
|
joining(i) {
|
|
821
857
|
return this.on(
|
|
822
858
|
"presence:joining",
|
|
823
|
-
(
|
|
859
|
+
(s) => i(s.user_info)
|
|
824
860
|
), this;
|
|
825
861
|
}
|
|
826
862
|
/**
|
|
827
863
|
* Send a whisper event to other clients in the channel.
|
|
828
864
|
*/
|
|
829
|
-
whisper(i,
|
|
865
|
+
whisper(i, s) {
|
|
830
866
|
return this.socket.emit("client event", {
|
|
831
867
|
channel: this.name,
|
|
832
868
|
event: `client-${i}`,
|
|
833
|
-
data:
|
|
869
|
+
data: s
|
|
834
870
|
}), this;
|
|
835
871
|
}
|
|
836
872
|
/**
|
|
@@ -839,11 +875,11 @@ class Fi extends _t {
|
|
|
839
875
|
leaving(i) {
|
|
840
876
|
return this.on(
|
|
841
877
|
"presence:leaving",
|
|
842
|
-
(
|
|
878
|
+
(s) => i(s.user_info)
|
|
843
879
|
), this;
|
|
844
880
|
}
|
|
845
881
|
}
|
|
846
|
-
class
|
|
882
|
+
class ge extends qe {
|
|
847
883
|
/**
|
|
848
884
|
* Subscribe to a channel.
|
|
849
885
|
*/
|
|
@@ -857,7 +893,7 @@ class fe extends qe {
|
|
|
857
893
|
/**
|
|
858
894
|
* Listen for an event on the channel instance.
|
|
859
895
|
*/
|
|
860
|
-
listen(i,
|
|
896
|
+
listen(i, s) {
|
|
861
897
|
return this;
|
|
862
898
|
}
|
|
863
899
|
/**
|
|
@@ -869,7 +905,7 @@ class fe extends qe {
|
|
|
869
905
|
/**
|
|
870
906
|
* Stop listening for an event on the channel instance.
|
|
871
907
|
*/
|
|
872
|
-
stopListening(i,
|
|
908
|
+
stopListening(i, s) {
|
|
873
909
|
return this;
|
|
874
910
|
}
|
|
875
911
|
/**
|
|
@@ -887,27 +923,27 @@ class fe extends qe {
|
|
|
887
923
|
/**
|
|
888
924
|
* Bind a channel to an event.
|
|
889
925
|
*/
|
|
890
|
-
on(i,
|
|
926
|
+
on(i, s) {
|
|
891
927
|
return this;
|
|
892
928
|
}
|
|
893
929
|
}
|
|
894
|
-
class
|
|
930
|
+
class _t extends ge {
|
|
895
931
|
/**
|
|
896
932
|
* Send a whisper event to other clients in the channel.
|
|
897
933
|
*/
|
|
898
|
-
whisper(i,
|
|
934
|
+
whisper(i, s) {
|
|
899
935
|
return this;
|
|
900
936
|
}
|
|
901
937
|
}
|
|
902
|
-
class Bi extends
|
|
938
|
+
class Bi extends ge {
|
|
903
939
|
/**
|
|
904
940
|
* Send a whisper event to other clients in the channel.
|
|
905
941
|
*/
|
|
906
|
-
whisper(i,
|
|
942
|
+
whisper(i, s) {
|
|
907
943
|
return this;
|
|
908
944
|
}
|
|
909
945
|
}
|
|
910
|
-
class $i extends
|
|
946
|
+
class $i extends _t {
|
|
911
947
|
/**
|
|
912
948
|
* Register a callback to be called anytime the member list changes.
|
|
913
949
|
*/
|
|
@@ -923,7 +959,7 @@ class $i extends xt {
|
|
|
923
959
|
/**
|
|
924
960
|
* Send a whisper event to other clients in the channel.
|
|
925
961
|
*/
|
|
926
|
-
whisper(i,
|
|
962
|
+
whisper(i, s) {
|
|
927
963
|
return this;
|
|
928
964
|
}
|
|
929
965
|
/**
|
|
@@ -933,7 +969,7 @@ class $i extends xt {
|
|
|
933
969
|
return this;
|
|
934
970
|
}
|
|
935
971
|
}
|
|
936
|
-
const
|
|
972
|
+
const Et = class kt {
|
|
937
973
|
/**
|
|
938
974
|
* Create a new class instance.
|
|
939
975
|
*/
|
|
@@ -945,22 +981,22 @@ const kt = class Et {
|
|
|
945
981
|
*/
|
|
946
982
|
setOptions(i) {
|
|
947
983
|
this.options = {
|
|
948
|
-
...
|
|
984
|
+
...kt._defaultOptions,
|
|
949
985
|
...i,
|
|
950
986
|
broadcaster: i.broadcaster
|
|
951
987
|
};
|
|
952
|
-
let
|
|
953
|
-
|
|
988
|
+
let s = this.csrfToken();
|
|
989
|
+
s && (this.options.auth.headers["X-CSRF-TOKEN"] = s, this.options.userAuthentication.headers["X-CSRF-TOKEN"] = s), s = this.options.bearerToken, s && (this.options.auth.headers.Authorization = "Bearer " + s, this.options.userAuthentication.headers.Authorization = "Bearer " + s);
|
|
954
990
|
}
|
|
955
991
|
/**
|
|
956
992
|
* Extract the CSRF token from the page.
|
|
957
993
|
*/
|
|
958
994
|
csrfToken() {
|
|
959
|
-
var i,
|
|
960
|
-
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" ? ((
|
|
995
|
+
var i, s;
|
|
996
|
+
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;
|
|
961
997
|
}
|
|
962
998
|
};
|
|
963
|
-
|
|
999
|
+
Et._defaultOptions = {
|
|
964
1000
|
auth: {
|
|
965
1001
|
headers: {}
|
|
966
1002
|
},
|
|
@@ -975,8 +1011,8 @@ kt._defaultOptions = {
|
|
|
975
1011
|
key: null,
|
|
976
1012
|
namespace: "App.Events"
|
|
977
1013
|
};
|
|
978
|
-
let
|
|
979
|
-
class
|
|
1014
|
+
let Ne = Et;
|
|
1015
|
+
class fe extends Ne {
|
|
980
1016
|
constructor() {
|
|
981
1017
|
super(...arguments), this.channels = {};
|
|
982
1018
|
}
|
|
@@ -1007,8 +1043,8 @@ class pe extends je {
|
|
|
1007
1043
|
/**
|
|
1008
1044
|
* Listen for an event on a channel instance.
|
|
1009
1045
|
*/
|
|
1010
|
-
listen(i,
|
|
1011
|
-
return this.channel(i).listen(
|
|
1046
|
+
listen(i, s, a) {
|
|
1047
|
+
return this.channel(i).listen(s, a);
|
|
1012
1048
|
}
|
|
1013
1049
|
/**
|
|
1014
1050
|
* Get a channel instance by name.
|
|
@@ -1034,7 +1070,7 @@ class pe extends je {
|
|
|
1034
1070
|
* Get a private encrypted channel instance by name.
|
|
1035
1071
|
*/
|
|
1036
1072
|
encryptedPrivateChannel(i) {
|
|
1037
|
-
return this.channels["private-encrypted-" + i] || (this.channels["private-encrypted-" + i] = new
|
|
1073
|
+
return this.channels["private-encrypted-" + i] || (this.channels["private-encrypted-" + i] = new Di(
|
|
1038
1074
|
this.pusher,
|
|
1039
1075
|
"private-encrypted-" + i,
|
|
1040
1076
|
this.options
|
|
@@ -1044,7 +1080,7 @@ class pe extends je {
|
|
|
1044
1080
|
* Get a presence channel instance by name.
|
|
1045
1081
|
*/
|
|
1046
1082
|
presenceChannel(i) {
|
|
1047
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1083
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Fi(
|
|
1048
1084
|
this.pusher,
|
|
1049
1085
|
"presence-" + i,
|
|
1050
1086
|
this.options
|
|
@@ -1059,8 +1095,8 @@ class pe extends je {
|
|
|
1059
1095
|
"private-" + i,
|
|
1060
1096
|
"private-encrypted-" + i,
|
|
1061
1097
|
"presence-" + i
|
|
1062
|
-
].forEach((
|
|
1063
|
-
this.leaveChannel(
|
|
1098
|
+
].forEach((s) => {
|
|
1099
|
+
this.leaveChannel(s);
|
|
1064
1100
|
});
|
|
1065
1101
|
}
|
|
1066
1102
|
/**
|
|
@@ -1095,14 +1131,14 @@ class pe extends je {
|
|
|
1095
1131
|
* Subscribe to connection status changes.
|
|
1096
1132
|
*/
|
|
1097
1133
|
onConnectionChange(i) {
|
|
1098
|
-
const
|
|
1134
|
+
const s = () => {
|
|
1099
1135
|
i(this.connectionStatus());
|
|
1100
1136
|
}, a = ["state_change", "connected", "disconnected"];
|
|
1101
1137
|
return a.forEach((h) => {
|
|
1102
|
-
this.pusher.connection.bind(h,
|
|
1138
|
+
this.pusher.connection.bind(h, s);
|
|
1103
1139
|
}), () => {
|
|
1104
1140
|
a.forEach((h) => {
|
|
1105
|
-
this.pusher.connection.unbind(h,
|
|
1141
|
+
this.pusher.connection.unbind(h, s);
|
|
1106
1142
|
});
|
|
1107
1143
|
};
|
|
1108
1144
|
}
|
|
@@ -1113,7 +1149,7 @@ class pe extends je {
|
|
|
1113
1149
|
this.pusher.disconnect();
|
|
1114
1150
|
}
|
|
1115
1151
|
}
|
|
1116
|
-
class Xi extends
|
|
1152
|
+
class Xi extends Ne {
|
|
1117
1153
|
constructor() {
|
|
1118
1154
|
super(...arguments), this.channels = {};
|
|
1119
1155
|
}
|
|
@@ -1126,8 +1162,8 @@ class Xi extends je {
|
|
|
1126
1162
|
this.options.host ?? void 0,
|
|
1127
1163
|
this.options
|
|
1128
1164
|
), this.socket.io.on("reconnect", () => {
|
|
1129
|
-
Object.values(this.channels).forEach((
|
|
1130
|
-
|
|
1165
|
+
Object.values(this.channels).forEach((s) => {
|
|
1166
|
+
s.subscribe();
|
|
1131
1167
|
});
|
|
1132
1168
|
});
|
|
1133
1169
|
}
|
|
@@ -1146,8 +1182,8 @@ class Xi extends je {
|
|
|
1146
1182
|
/**
|
|
1147
1183
|
* Listen for an event on a channel instance.
|
|
1148
1184
|
*/
|
|
1149
|
-
listen(i,
|
|
1150
|
-
return this.channel(i).listen(
|
|
1185
|
+
listen(i, s, a) {
|
|
1186
|
+
return this.channel(i).listen(s, a);
|
|
1151
1187
|
}
|
|
1152
1188
|
/**
|
|
1153
1189
|
* Get a channel instance by name.
|
|
@@ -1163,7 +1199,7 @@ class Xi extends je {
|
|
|
1163
1199
|
* Get a private channel instance by name.
|
|
1164
1200
|
*/
|
|
1165
1201
|
privateChannel(i) {
|
|
1166
|
-
return this.channels["private-" + i] || (this.channels["private-" + i] = new
|
|
1202
|
+
return this.channels["private-" + i] || (this.channels["private-" + i] = new xt(
|
|
1167
1203
|
this.socket,
|
|
1168
1204
|
"private-" + i,
|
|
1169
1205
|
this.options
|
|
@@ -1173,7 +1209,7 @@ class Xi extends je {
|
|
|
1173
1209
|
* Get a presence channel instance by name.
|
|
1174
1210
|
*/
|
|
1175
1211
|
presenceChannel(i) {
|
|
1176
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1212
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Wi(
|
|
1177
1213
|
this.socket,
|
|
1178
1214
|
"presence-" + i,
|
|
1179
1215
|
this.options
|
|
@@ -1183,8 +1219,8 @@ class Xi extends je {
|
|
|
1183
1219
|
* Leave the given channel, as well as its private and presence variants.
|
|
1184
1220
|
*/
|
|
1185
1221
|
leave(i) {
|
|
1186
|
-
[i, "private-" + i, "presence-" + i].forEach((
|
|
1187
|
-
this.leaveChannel(
|
|
1222
|
+
[i, "private-" + i, "presence-" + i].forEach((s) => {
|
|
1223
|
+
this.leaveChannel(s);
|
|
1188
1224
|
});
|
|
1189
1225
|
}
|
|
1190
1226
|
/**
|
|
@@ -1209,7 +1245,7 @@ class Xi extends je {
|
|
|
1209
1245
|
* Subscribe to connection status changes.
|
|
1210
1246
|
*/
|
|
1211
1247
|
onConnectionChange(i) {
|
|
1212
|
-
const
|
|
1248
|
+
const s = () => {
|
|
1213
1249
|
i(this.connectionStatus());
|
|
1214
1250
|
}, a = [
|
|
1215
1251
|
"connect",
|
|
@@ -1221,10 +1257,10 @@ class Xi extends je {
|
|
|
1221
1257
|
"reconnect_failed"
|
|
1222
1258
|
];
|
|
1223
1259
|
return a.forEach((h) => {
|
|
1224
|
-
this.socket.on(h,
|
|
1260
|
+
this.socket.on(h, s);
|
|
1225
1261
|
}), () => {
|
|
1226
1262
|
a.forEach((h) => {
|
|
1227
|
-
this.socket.off(h,
|
|
1263
|
+
this.socket.off(h, s);
|
|
1228
1264
|
});
|
|
1229
1265
|
};
|
|
1230
1266
|
}
|
|
@@ -1235,7 +1271,7 @@ class Xi extends je {
|
|
|
1235
1271
|
this.socket.disconnect();
|
|
1236
1272
|
}
|
|
1237
1273
|
}
|
|
1238
|
-
class mt extends
|
|
1274
|
+
class mt extends Ne {
|
|
1239
1275
|
constructor() {
|
|
1240
1276
|
super(...arguments), this.channels = {};
|
|
1241
1277
|
}
|
|
@@ -1247,20 +1283,20 @@ class mt extends je {
|
|
|
1247
1283
|
/**
|
|
1248
1284
|
* Listen for an event on a channel instance.
|
|
1249
1285
|
*/
|
|
1250
|
-
listen(i,
|
|
1251
|
-
return new
|
|
1286
|
+
listen(i, s, a) {
|
|
1287
|
+
return new ge();
|
|
1252
1288
|
}
|
|
1253
1289
|
/**
|
|
1254
1290
|
* Get a channel instance by name.
|
|
1255
1291
|
*/
|
|
1256
1292
|
channel(i) {
|
|
1257
|
-
return new
|
|
1293
|
+
return new ge();
|
|
1258
1294
|
}
|
|
1259
1295
|
/**
|
|
1260
1296
|
* Get a private channel instance by name.
|
|
1261
1297
|
*/
|
|
1262
1298
|
privateChannel(i) {
|
|
1263
|
-
return new
|
|
1299
|
+
return new _t();
|
|
1264
1300
|
}
|
|
1265
1301
|
/**
|
|
1266
1302
|
* Get a private encrypted channel instance by name.
|
|
@@ -1309,7 +1345,7 @@ class mt extends je {
|
|
|
1309
1345
|
disconnect() {
|
|
1310
1346
|
}
|
|
1311
1347
|
}
|
|
1312
|
-
class
|
|
1348
|
+
class Vi {
|
|
1313
1349
|
/**
|
|
1314
1350
|
* Create a new class instance.
|
|
1315
1351
|
*/
|
|
@@ -1327,14 +1363,14 @@ class Ji {
|
|
|
1327
1363
|
*/
|
|
1328
1364
|
connect() {
|
|
1329
1365
|
if (this.options.broadcaster === "reverb")
|
|
1330
|
-
this.connector = new
|
|
1366
|
+
this.connector = new fe({
|
|
1331
1367
|
...this.options,
|
|
1332
1368
|
cluster: ""
|
|
1333
1369
|
});
|
|
1334
1370
|
else if (this.options.broadcaster === "pusher")
|
|
1335
|
-
this.connector = new
|
|
1371
|
+
this.connector = new fe(this.options);
|
|
1336
1372
|
else if (this.options.broadcaster === "ably")
|
|
1337
|
-
this.connector = new
|
|
1373
|
+
this.connector = new fe({
|
|
1338
1374
|
...this.options,
|
|
1339
1375
|
cluster: "",
|
|
1340
1376
|
broadcaster: "pusher"
|
|
@@ -1343,7 +1379,7 @@ class Ji {
|
|
|
1343
1379
|
this.connector = new Xi(this.options);
|
|
1344
1380
|
else if (this.options.broadcaster === "null")
|
|
1345
1381
|
this.connector = new mt(this.options);
|
|
1346
|
-
else if (typeof this.options.broadcaster == "function" &&
|
|
1382
|
+
else if (typeof this.options.broadcaster == "function" && Hi(this.options.broadcaster))
|
|
1347
1383
|
this.connector = new this.options.broadcaster(this.options);
|
|
1348
1384
|
else
|
|
1349
1385
|
throw new Error(
|
|
@@ -1384,8 +1420,8 @@ class Ji {
|
|
|
1384
1420
|
/**
|
|
1385
1421
|
* Listen for an event on a channel instance.
|
|
1386
1422
|
*/
|
|
1387
|
-
listen(i,
|
|
1388
|
-
return this.connector.listen(i,
|
|
1423
|
+
listen(i, s, a) {
|
|
1424
|
+
return this.connector.listen(i, s, a);
|
|
1389
1425
|
}
|
|
1390
1426
|
/**
|
|
1391
1427
|
* Get a private channel instance by name.
|
|
@@ -1406,7 +1442,7 @@ class Ji {
|
|
|
1406
1442
|
);
|
|
1407
1443
|
}
|
|
1408
1444
|
connectorSupportsEncryptedPrivateChannels(i) {
|
|
1409
|
-
return i instanceof
|
|
1445
|
+
return i instanceof fe || i instanceof mt;
|
|
1410
1446
|
}
|
|
1411
1447
|
/**
|
|
1412
1448
|
* Get the Socket ID for the connection.
|
|
@@ -1432,8 +1468,8 @@ class Ji {
|
|
|
1432
1468
|
*/
|
|
1433
1469
|
registerVueRequestInterceptor() {
|
|
1434
1470
|
Vue.http.interceptors.push(
|
|
1435
|
-
(i,
|
|
1436
|
-
this.socketId() && i.headers.set("X-Socket-ID", this.socketId()),
|
|
1471
|
+
(i, s) => {
|
|
1472
|
+
this.socketId() && i.headers.set("X-Socket-ID", this.socketId()), s();
|
|
1437
1473
|
}
|
|
1438
1474
|
);
|
|
1439
1475
|
}
|
|
@@ -1450,7 +1486,7 @@ class Ji {
|
|
|
1450
1486
|
*/
|
|
1451
1487
|
registerjQueryAjaxSetup() {
|
|
1452
1488
|
typeof jQuery.ajax < "u" && jQuery.ajaxPrefilter(
|
|
1453
|
-
(i,
|
|
1489
|
+
(i, s, a) => {
|
|
1454
1490
|
this.socketId() && a.setRequestHeader("X-Socket-Id", this.socketId());
|
|
1455
1491
|
}
|
|
1456
1492
|
);
|
|
@@ -1467,10 +1503,10 @@ class Ji {
|
|
|
1467
1503
|
);
|
|
1468
1504
|
}
|
|
1469
1505
|
}
|
|
1470
|
-
function
|
|
1506
|
+
function Ji(v) {
|
|
1471
1507
|
return v && v.__esModule && Object.prototype.hasOwnProperty.call(v, "default") ? v.default : v;
|
|
1472
1508
|
}
|
|
1473
|
-
var
|
|
1509
|
+
var Le = { exports: {} };
|
|
1474
1510
|
var gt;
|
|
1475
1511
|
function Gi() {
|
|
1476
1512
|
return gt || (gt = 1, (function(v, i) {
|
|
@@ -1479,154 +1515,154 @@ function Gi() {
|
|
|
1479
1515
|
})(self, () => (
|
|
1480
1516
|
/******/
|
|
1481
1517
|
(() => {
|
|
1482
|
-
var
|
|
1518
|
+
var s = {
|
|
1483
1519
|
/***/
|
|
1484
1520
|
594(m, g) {
|
|
1485
|
-
var
|
|
1486
|
-
var
|
|
1487
|
-
return
|
|
1521
|
+
var b = this && this.__extends || /* @__PURE__ */ (function() {
|
|
1522
|
+
var x = function(d, f) {
|
|
1523
|
+
return x = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(S, P) {
|
|
1488
1524
|
S.__proto__ = P;
|
|
1489
1525
|
} || function(S, P) {
|
|
1490
1526
|
for (var q in P) P.hasOwnProperty(q) && (S[q] = P[q]);
|
|
1491
|
-
},
|
|
1527
|
+
}, x(d, f);
|
|
1492
1528
|
};
|
|
1493
|
-
return function(d,
|
|
1494
|
-
|
|
1529
|
+
return function(d, f) {
|
|
1530
|
+
x(d, f);
|
|
1495
1531
|
function S() {
|
|
1496
1532
|
this.constructor = d;
|
|
1497
1533
|
}
|
|
1498
|
-
d.prototype =
|
|
1534
|
+
d.prototype = f === null ? Object.create(f) : (S.prototype = f.prototype, new S());
|
|
1499
1535
|
};
|
|
1500
1536
|
})();
|
|
1501
1537
|
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
1502
|
-
var
|
|
1538
|
+
var _ = 256, w = (
|
|
1503
1539
|
/** @class */
|
|
1504
1540
|
(function() {
|
|
1505
|
-
function
|
|
1541
|
+
function x(d) {
|
|
1506
1542
|
d === void 0 && (d = "="), this._paddingCharacter = d;
|
|
1507
1543
|
}
|
|
1508
|
-
return
|
|
1544
|
+
return x.prototype.encodedLength = function(d) {
|
|
1509
1545
|
return this._paddingCharacter ? (d + 2) / 3 * 4 | 0 : (d * 8 + 5) / 6 | 0;
|
|
1510
|
-
},
|
|
1511
|
-
for (var
|
|
1546
|
+
}, x.prototype.encode = function(d) {
|
|
1547
|
+
for (var f = "", S = 0; S < d.length - 2; S += 3) {
|
|
1512
1548
|
var P = d[S] << 16 | d[S + 1] << 8 | d[S + 2];
|
|
1513
|
-
|
|
1549
|
+
f += this._encodeByte(P >>> 18 & 63), f += this._encodeByte(P >>> 12 & 63), f += this._encodeByte(P >>> 6 & 63), f += this._encodeByte(P >>> 0 & 63);
|
|
1514
1550
|
}
|
|
1515
1551
|
var q = d.length - S;
|
|
1516
1552
|
if (q > 0) {
|
|
1517
1553
|
var P = d[S] << 16 | (q === 2 ? d[S + 1] << 8 : 0);
|
|
1518
|
-
|
|
1554
|
+
f += this._encodeByte(P >>> 18 & 63), f += this._encodeByte(P >>> 12 & 63), q === 2 ? f += this._encodeByte(P >>> 6 & 63) : f += this._paddingCharacter || "", f += this._paddingCharacter || "";
|
|
1519
1555
|
}
|
|
1520
|
-
return
|
|
1521
|
-
},
|
|
1556
|
+
return f;
|
|
1557
|
+
}, x.prototype.maxDecodedLength = function(d) {
|
|
1522
1558
|
return this._paddingCharacter ? d / 4 * 3 | 0 : (d * 6 + 7) / 8 | 0;
|
|
1523
|
-
},
|
|
1559
|
+
}, x.prototype.decodedLength = function(d) {
|
|
1524
1560
|
return this.maxDecodedLength(d.length - this._getPaddingLength(d));
|
|
1525
|
-
},
|
|
1561
|
+
}, x.prototype.decode = function(d) {
|
|
1526
1562
|
if (d.length === 0)
|
|
1527
1563
|
return new Uint8Array(0);
|
|
1528
|
-
for (var
|
|
1529
|
-
J = this._decodeChar(d.charCodeAt(
|
|
1530
|
-
if (
|
|
1564
|
+
for (var f = this._getPaddingLength(d), S = d.length - f, P = new Uint8Array(this.maxDecodedLength(S)), q = 0, j = 0, z = 0, J = 0, D = 0, H = 0, G = 0; j < S - 4; j += 4)
|
|
1565
|
+
J = this._decodeChar(d.charCodeAt(j + 0)), D = this._decodeChar(d.charCodeAt(j + 1)), H = this._decodeChar(d.charCodeAt(j + 2)), G = this._decodeChar(d.charCodeAt(j + 3)), P[q++] = J << 2 | D >>> 4, P[q++] = D << 4 | H >>> 2, P[q++] = H << 6 | G, z |= J & _, z |= D & _, z |= H & _, z |= G & _;
|
|
1566
|
+
if (j < S - 1 && (J = this._decodeChar(d.charCodeAt(j)), D = this._decodeChar(d.charCodeAt(j + 1)), P[q++] = J << 2 | D >>> 4, z |= J & _, z |= D & _), j < S - 2 && (H = this._decodeChar(d.charCodeAt(j + 2)), P[q++] = D << 4 | H >>> 2, z |= H & _), j < S - 3 && (G = this._decodeChar(d.charCodeAt(j + 3)), P[q++] = H << 6 | G, z |= G & _), z !== 0)
|
|
1531
1567
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
1532
1568
|
return P;
|
|
1533
|
-
},
|
|
1534
|
-
var
|
|
1535
|
-
return
|
|
1536
|
-
},
|
|
1537
|
-
var
|
|
1538
|
-
return
|
|
1539
|
-
},
|
|
1540
|
-
var
|
|
1569
|
+
}, x.prototype._encodeByte = function(d) {
|
|
1570
|
+
var f = d;
|
|
1571
|
+
return f += 65, f += 25 - d >>> 8 & 6, f += 51 - d >>> 8 & -75, f += 61 - d >>> 8 & -15, f += 62 - d >>> 8 & 3, String.fromCharCode(f);
|
|
1572
|
+
}, x.prototype._decodeChar = function(d) {
|
|
1573
|
+
var f = _;
|
|
1574
|
+
return f += (42 - d & d - 44) >>> 8 & -_ + d - 43 + 62, f += (46 - d & d - 48) >>> 8 & -_ + d - 47 + 63, f += (47 - d & d - 58) >>> 8 & -_ + d - 48 + 52, f += (64 - d & d - 91) >>> 8 & -_ + d - 65 + 0, f += (96 - d & d - 123) >>> 8 & -_ + d - 97 + 26, f;
|
|
1575
|
+
}, x.prototype._getPaddingLength = function(d) {
|
|
1576
|
+
var f = 0;
|
|
1541
1577
|
if (this._paddingCharacter) {
|
|
1542
1578
|
for (var S = d.length - 1; S >= 0 && d[S] === this._paddingCharacter; S--)
|
|
1543
|
-
|
|
1544
|
-
if (d.length < 4 ||
|
|
1579
|
+
f++;
|
|
1580
|
+
if (d.length < 4 || f > 2)
|
|
1545
1581
|
throw new Error("Base64Coder: incorrect padding");
|
|
1546
1582
|
}
|
|
1547
|
-
return
|
|
1548
|
-
},
|
|
1583
|
+
return f;
|
|
1584
|
+
}, x;
|
|
1549
1585
|
})()
|
|
1550
1586
|
);
|
|
1551
1587
|
g.Coder = w;
|
|
1552
1588
|
var R = new w();
|
|
1553
|
-
function T(
|
|
1554
|
-
return R.encode(
|
|
1589
|
+
function T(x) {
|
|
1590
|
+
return R.encode(x);
|
|
1555
1591
|
}
|
|
1556
1592
|
g.encode = T;
|
|
1557
|
-
function A(
|
|
1558
|
-
return R.decode(
|
|
1593
|
+
function A(x) {
|
|
1594
|
+
return R.decode(x);
|
|
1559
1595
|
}
|
|
1560
1596
|
g.decode = A;
|
|
1561
|
-
var
|
|
1597
|
+
var F = (
|
|
1562
1598
|
/** @class */
|
|
1563
|
-
(function(
|
|
1564
|
-
|
|
1599
|
+
(function(x) {
|
|
1600
|
+
b(d, x);
|
|
1565
1601
|
function d() {
|
|
1566
|
-
return
|
|
1602
|
+
return x !== null && x.apply(this, arguments) || this;
|
|
1567
1603
|
}
|
|
1568
|
-
return d.prototype._encodeByte = function(
|
|
1569
|
-
var S =
|
|
1570
|
-
return S += 65, S += 25 -
|
|
1571
|
-
}, d.prototype._decodeChar = function(
|
|
1572
|
-
var S =
|
|
1573
|
-
return S += (44 -
|
|
1604
|
+
return d.prototype._encodeByte = function(f) {
|
|
1605
|
+
var S = f;
|
|
1606
|
+
return S += 65, S += 25 - f >>> 8 & 6, S += 51 - f >>> 8 & -75, S += 61 - f >>> 8 & -13, S += 62 - f >>> 8 & 49, String.fromCharCode(S);
|
|
1607
|
+
}, d.prototype._decodeChar = function(f) {
|
|
1608
|
+
var S = _;
|
|
1609
|
+
return S += (44 - f & f - 46) >>> 8 & -_ + f - 45 + 62, S += (94 - f & f - 96) >>> 8 & -_ + f - 95 + 63, S += (47 - f & f - 58) >>> 8 & -_ + f - 48 + 52, S += (64 - f & f - 91) >>> 8 & -_ + f - 65 + 0, S += (96 - f & f - 123) >>> 8 & -_ + f - 97 + 26, S;
|
|
1574
1610
|
}, d;
|
|
1575
1611
|
})(w)
|
|
1576
1612
|
);
|
|
1577
|
-
g.URLSafeCoder =
|
|
1578
|
-
var
|
|
1579
|
-
function
|
|
1580
|
-
return
|
|
1613
|
+
g.URLSafeCoder = F;
|
|
1614
|
+
var N = new F();
|
|
1615
|
+
function W(x) {
|
|
1616
|
+
return N.encode(x);
|
|
1581
1617
|
}
|
|
1582
|
-
g.encodeURLSafe =
|
|
1583
|
-
function te(
|
|
1584
|
-
return
|
|
1618
|
+
g.encodeURLSafe = W;
|
|
1619
|
+
function te(x) {
|
|
1620
|
+
return N.decode(x);
|
|
1585
1621
|
}
|
|
1586
|
-
g.decodeURLSafe = te, g.encodedLength = function(
|
|
1587
|
-
return R.encodedLength(
|
|
1588
|
-
}, g.maxDecodedLength = function(
|
|
1589
|
-
return R.maxDecodedLength(
|
|
1590
|
-
}, g.decodedLength = function(
|
|
1591
|
-
return R.decodedLength(
|
|
1622
|
+
g.decodeURLSafe = te, g.encodedLength = function(x) {
|
|
1623
|
+
return R.encodedLength(x);
|
|
1624
|
+
}, g.maxDecodedLength = function(x) {
|
|
1625
|
+
return R.maxDecodedLength(x);
|
|
1626
|
+
}, g.decodedLength = function(x) {
|
|
1627
|
+
return R.decodedLength(x);
|
|
1592
1628
|
};
|
|
1593
1629
|
},
|
|
1594
1630
|
/***/
|
|
1595
1631
|
978(m, g) {
|
|
1596
|
-
var
|
|
1597
|
-
function
|
|
1632
|
+
var b = "utf8: invalid source encoding";
|
|
1633
|
+
function _(w) {
|
|
1598
1634
|
for (var R = [], T = 0; T < w.length; T++) {
|
|
1599
1635
|
var A = w[T];
|
|
1600
1636
|
if (A & 128) {
|
|
1601
|
-
var
|
|
1637
|
+
var F = void 0;
|
|
1602
1638
|
if (A < 224) {
|
|
1603
1639
|
if (T >= w.length)
|
|
1604
|
-
throw new Error(
|
|
1605
|
-
var
|
|
1606
|
-
if ((
|
|
1607
|
-
throw new Error(
|
|
1608
|
-
A = (A & 31) << 6 |
|
|
1640
|
+
throw new Error(b);
|
|
1641
|
+
var N = w[++T];
|
|
1642
|
+
if ((N & 192) !== 128)
|
|
1643
|
+
throw new Error(b);
|
|
1644
|
+
A = (A & 31) << 6 | N & 63, F = 128;
|
|
1609
1645
|
} else if (A < 240) {
|
|
1610
1646
|
if (T >= w.length - 1)
|
|
1611
|
-
throw new Error(
|
|
1612
|
-
var
|
|
1613
|
-
if ((
|
|
1614
|
-
throw new Error(
|
|
1615
|
-
A = (A & 15) << 12 | (
|
|
1647
|
+
throw new Error(b);
|
|
1648
|
+
var N = w[++T], W = w[++T];
|
|
1649
|
+
if ((N & 192) !== 128 || (W & 192) !== 128)
|
|
1650
|
+
throw new Error(b);
|
|
1651
|
+
A = (A & 15) << 12 | (N & 63) << 6 | W & 63, F = 2048;
|
|
1616
1652
|
} else if (A < 248) {
|
|
1617
1653
|
if (T >= w.length - 2)
|
|
1618
|
-
throw new Error(
|
|
1619
|
-
var
|
|
1620
|
-
if ((
|
|
1621
|
-
throw new Error(
|
|
1622
|
-
A = (A & 15) << 18 | (
|
|
1654
|
+
throw new Error(b);
|
|
1655
|
+
var N = w[++T], W = w[++T], te = w[++T];
|
|
1656
|
+
if ((N & 192) !== 128 || (W & 192) !== 128 || (te & 192) !== 128)
|
|
1657
|
+
throw new Error(b);
|
|
1658
|
+
A = (A & 15) << 18 | (N & 63) << 12 | (W & 63) << 6 | te & 63, F = 65536;
|
|
1623
1659
|
} else
|
|
1624
|
-
throw new Error(
|
|
1625
|
-
if (A <
|
|
1626
|
-
throw new Error(
|
|
1660
|
+
throw new Error(b);
|
|
1661
|
+
if (A < F || A >= 55296 && A <= 57343)
|
|
1662
|
+
throw new Error(b);
|
|
1627
1663
|
if (A >= 65536) {
|
|
1628
1664
|
if (A > 1114111)
|
|
1629
|
-
throw new Error(
|
|
1665
|
+
throw new Error(b);
|
|
1630
1666
|
A -= 65536, R.push(String.fromCharCode(55296 | A >> 10)), A = 56320 | A & 1023;
|
|
1631
1667
|
}
|
|
1632
1668
|
}
|
|
@@ -1634,36 +1670,36 @@ function Gi() {
|
|
|
1634
1670
|
}
|
|
1635
1671
|
return R.join("");
|
|
1636
1672
|
}
|
|
1637
|
-
g.D4 =
|
|
1673
|
+
g.D4 = _;
|
|
1638
1674
|
},
|
|
1639
1675
|
/***/
|
|
1640
|
-
721(m, g,
|
|
1641
|
-
m.exports =
|
|
1676
|
+
721(m, g, b) {
|
|
1677
|
+
m.exports = b(207).default;
|
|
1642
1678
|
},
|
|
1643
1679
|
/***/
|
|
1644
|
-
207(m, g,
|
|
1645
|
-
|
|
1680
|
+
207(m, g, b) {
|
|
1681
|
+
b.d(g, {
|
|
1646
1682
|
default: () => (
|
|
1647
1683
|
/* binding */
|
|
1648
1684
|
ue
|
|
1649
1685
|
)
|
|
1650
1686
|
});
|
|
1651
|
-
class
|
|
1687
|
+
class _ {
|
|
1652
1688
|
constructor(e, t) {
|
|
1653
1689
|
this.lastId = 0, this.prefix = e, this.name = t;
|
|
1654
1690
|
}
|
|
1655
1691
|
create(e) {
|
|
1656
1692
|
this.lastId++;
|
|
1657
|
-
var t = this.lastId, r = this.prefix + t,
|
|
1693
|
+
var t = this.lastId, r = this.prefix + t, o = this.name + "[" + t + "]", c = !1, l = function() {
|
|
1658
1694
|
c || (e.apply(null, arguments), c = !0);
|
|
1659
1695
|
};
|
|
1660
|
-
return this[t] = l, { number: t, id: r, name:
|
|
1696
|
+
return this[t] = l, { number: t, id: r, name: o, callback: l };
|
|
1661
1697
|
}
|
|
1662
1698
|
remove(e) {
|
|
1663
1699
|
delete this[e.number];
|
|
1664
1700
|
}
|
|
1665
1701
|
}
|
|
1666
|
-
var w = new
|
|
1702
|
+
var w = new _("_pusher_script_", "Pusher.ScriptReceivers"), R = {
|
|
1667
1703
|
VERSION: "8.5.0",
|
|
1668
1704
|
PROTOCOL: 7,
|
|
1669
1705
|
wsPort: 80,
|
|
@@ -1697,19 +1733,19 @@ function Gi() {
|
|
|
1697
1733
|
this.options = e, this.receivers = e.receivers || w, this.loading = {};
|
|
1698
1734
|
}
|
|
1699
1735
|
load(e, t, r) {
|
|
1700
|
-
var
|
|
1701
|
-
if (
|
|
1702
|
-
|
|
1736
|
+
var o = this;
|
|
1737
|
+
if (o.loading[e] && o.loading[e].length > 0)
|
|
1738
|
+
o.loading[e].push(r);
|
|
1703
1739
|
else {
|
|
1704
|
-
|
|
1705
|
-
var c = C.createScriptRequest(
|
|
1706
|
-
if (
|
|
1707
|
-
var
|
|
1708
|
-
delete
|
|
1709
|
-
for (var
|
|
1740
|
+
o.loading[e] = [r];
|
|
1741
|
+
var c = C.createScriptRequest(o.getPath(e, t)), l = o.receivers.create(function(p) {
|
|
1742
|
+
if (o.receivers.remove(l), o.loading[e]) {
|
|
1743
|
+
var y = o.loading[e];
|
|
1744
|
+
delete o.loading[e];
|
|
1745
|
+
for (var E = function(I) {
|
|
1710
1746
|
I || c.cleanup();
|
|
1711
|
-
},
|
|
1712
|
-
|
|
1747
|
+
}, k = 0; k < y.length; k++)
|
|
1748
|
+
y[k](p, E);
|
|
1713
1749
|
}
|
|
1714
1750
|
});
|
|
1715
1751
|
c.send(l);
|
|
@@ -1723,14 +1759,14 @@ function Gi() {
|
|
|
1723
1759
|
return this.getRoot(t) + "/" + e + this.options.suffix + ".js";
|
|
1724
1760
|
}
|
|
1725
1761
|
}
|
|
1726
|
-
var
|
|
1762
|
+
var F = new _("_pusher_dependencies", "Pusher.DependenciesReceivers"), N = new A({
|
|
1727
1763
|
cdn_http: T.cdn_http,
|
|
1728
1764
|
cdn_https: T.cdn_https,
|
|
1729
1765
|
version: T.VERSION,
|
|
1730
1766
|
suffix: T.dependency_suffix,
|
|
1731
|
-
receivers:
|
|
1767
|
+
receivers: F
|
|
1732
1768
|
});
|
|
1733
|
-
const
|
|
1769
|
+
const W = {
|
|
1734
1770
|
baseUrl: "https://pusher.com",
|
|
1735
1771
|
urls: {
|
|
1736
1772
|
authenticationEndpoint: {
|
|
@@ -1749,18 +1785,18 @@ function Gi() {
|
|
|
1749
1785
|
fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"
|
|
1750
1786
|
}
|
|
1751
1787
|
}
|
|
1752
|
-
},
|
|
1753
|
-
const e = "See:", t =
|
|
1788
|
+
}, x = { buildLogSuffix: function(n) {
|
|
1789
|
+
const e = "See:", t = W.urls[n];
|
|
1754
1790
|
if (!t)
|
|
1755
1791
|
return "";
|
|
1756
1792
|
let r;
|
|
1757
|
-
return t.fullUrl ? r = t.fullUrl : t.path && (r =
|
|
1793
|
+
return t.fullUrl ? r = t.fullUrl : t.path && (r = W.baseUrl + t.path), r ? `${e} ${r}` : "";
|
|
1758
1794
|
} };
|
|
1759
1795
|
var d;
|
|
1760
1796
|
(function(n) {
|
|
1761
1797
|
n.UserAuthentication = "user-authentication", n.ChannelAuthorization = "channel-authorization";
|
|
1762
1798
|
})(d || (d = {}));
|
|
1763
|
-
class
|
|
1799
|
+
class f extends Error {
|
|
1764
1800
|
constructor(e) {
|
|
1765
1801
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1766
1802
|
}
|
|
@@ -1780,12 +1816,12 @@ function Gi() {
|
|
|
1780
1816
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1781
1817
|
}
|
|
1782
1818
|
}
|
|
1783
|
-
class
|
|
1819
|
+
class j extends Error {
|
|
1784
1820
|
constructor(e) {
|
|
1785
1821
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1786
1822
|
}
|
|
1787
1823
|
}
|
|
1788
|
-
class
|
|
1824
|
+
class z extends Error {
|
|
1789
1825
|
constructor(e) {
|
|
1790
1826
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1791
1827
|
}
|
|
@@ -1795,47 +1831,47 @@ function Gi() {
|
|
|
1795
1831
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1796
1832
|
}
|
|
1797
1833
|
}
|
|
1798
|
-
class
|
|
1834
|
+
class D extends Error {
|
|
1799
1835
|
constructor(e) {
|
|
1800
1836
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1801
1837
|
}
|
|
1802
1838
|
}
|
|
1803
|
-
class
|
|
1839
|
+
class H extends Error {
|
|
1804
1840
|
constructor(e, t) {
|
|
1805
1841
|
super(t), this.status = e, Object.setPrototypeOf(this, new.target.prototype);
|
|
1806
1842
|
}
|
|
1807
1843
|
}
|
|
1808
|
-
const Pt = function(n, e, t, r,
|
|
1844
|
+
const Pt = function(n, e, t, r, o) {
|
|
1809
1845
|
const c = C.createXHR();
|
|
1810
1846
|
c.open("POST", t.endpoint, !0), c.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
1811
1847
|
for (var l in t.headers)
|
|
1812
1848
|
c.setRequestHeader(l, t.headers[l]);
|
|
1813
1849
|
if (t.headersProvider != null) {
|
|
1814
|
-
let
|
|
1815
|
-
for (var l in
|
|
1816
|
-
c.setRequestHeader(l,
|
|
1850
|
+
let p = t.headersProvider();
|
|
1851
|
+
for (var l in p)
|
|
1852
|
+
c.setRequestHeader(l, p[l]);
|
|
1817
1853
|
}
|
|
1818
1854
|
return c.onreadystatechange = function() {
|
|
1819
1855
|
if (c.readyState === 4)
|
|
1820
1856
|
if (c.status === 200) {
|
|
1821
|
-
let
|
|
1857
|
+
let p, y = !1;
|
|
1822
1858
|
try {
|
|
1823
|
-
|
|
1859
|
+
p = JSON.parse(c.responseText), y = !0;
|
|
1824
1860
|
} catch {
|
|
1825
|
-
|
|
1861
|
+
o(new H(200, `JSON returned from ${r.toString()} endpoint was invalid, yet status code was 200. Data was: ${c.responseText}`), null);
|
|
1826
1862
|
}
|
|
1827
|
-
|
|
1863
|
+
y && o(null, p);
|
|
1828
1864
|
} else {
|
|
1829
|
-
let
|
|
1865
|
+
let p = "";
|
|
1830
1866
|
switch (r) {
|
|
1831
1867
|
case d.UserAuthentication:
|
|
1832
|
-
|
|
1868
|
+
p = x.buildLogSuffix("authenticationEndpoint");
|
|
1833
1869
|
break;
|
|
1834
1870
|
case d.ChannelAuthorization:
|
|
1835
|
-
|
|
1871
|
+
p = `Clients must be authorized to join private or presence channels. ${x.buildLogSuffix("authorizationEndpoint")}`;
|
|
1836
1872
|
break;
|
|
1837
1873
|
}
|
|
1838
|
-
|
|
1874
|
+
o(new H(c.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${c.status} from ${t.endpoint}. ${p}`), null);
|
|
1839
1875
|
}
|
|
1840
1876
|
}, c.send(e), c;
|
|
1841
1877
|
};
|
|
@@ -1859,9 +1895,9 @@ function Gi() {
|
|
|
1859
1895
|
return n.replace(/[\s\S]{1,3}/g, Ot);
|
|
1860
1896
|
};
|
|
1861
1897
|
class Ut {
|
|
1862
|
-
constructor(e, t, r,
|
|
1898
|
+
constructor(e, t, r, o) {
|
|
1863
1899
|
this.clear = t, this.timer = e(() => {
|
|
1864
|
-
this.timer && (this.timer =
|
|
1900
|
+
this.timer && (this.timer = o(this.timer));
|
|
1865
1901
|
}, r);
|
|
1866
1902
|
}
|
|
1867
1903
|
isRunning() {
|
|
@@ -1871,33 +1907,33 @@ function Gi() {
|
|
|
1871
1907
|
this.timer && (this.clear(this.timer), this.timer = null);
|
|
1872
1908
|
}
|
|
1873
1909
|
}
|
|
1874
|
-
const
|
|
1875
|
-
function
|
|
1910
|
+
const ze = Ut;
|
|
1911
|
+
function Nt(n) {
|
|
1876
1912
|
window.clearTimeout(n);
|
|
1877
1913
|
}
|
|
1878
|
-
function
|
|
1914
|
+
function jt(n) {
|
|
1879
1915
|
window.clearInterval(n);
|
|
1880
1916
|
}
|
|
1881
|
-
class
|
|
1917
|
+
class Y extends ze {
|
|
1882
1918
|
constructor(e, t) {
|
|
1883
|
-
super(setTimeout,
|
|
1919
|
+
super(setTimeout, Nt, e, function(r) {
|
|
1884
1920
|
return t(), null;
|
|
1885
1921
|
});
|
|
1886
1922
|
}
|
|
1887
1923
|
}
|
|
1888
|
-
class
|
|
1924
|
+
class Mt extends ze {
|
|
1889
1925
|
constructor(e, t) {
|
|
1890
|
-
super(setInterval,
|
|
1926
|
+
super(setInterval, jt, e, function(r) {
|
|
1891
1927
|
return t(), r;
|
|
1892
1928
|
});
|
|
1893
1929
|
}
|
|
1894
1930
|
}
|
|
1895
|
-
var
|
|
1931
|
+
var zt = {
|
|
1896
1932
|
now() {
|
|
1897
1933
|
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
|
|
1898
1934
|
},
|
|
1899
1935
|
defer(n) {
|
|
1900
|
-
return new
|
|
1936
|
+
return new Y(0, n);
|
|
1901
1937
|
},
|
|
1902
1938
|
method(n, ...e) {
|
|
1903
1939
|
var t = Array.prototype.slice.call(arguments, 1);
|
|
@@ -1906,27 +1942,27 @@ function Gi() {
|
|
|
1906
1942
|
};
|
|
1907
1943
|
}
|
|
1908
1944
|
};
|
|
1909
|
-
const U =
|
|
1910
|
-
function
|
|
1945
|
+
const U = zt;
|
|
1946
|
+
function M(n, ...e) {
|
|
1911
1947
|
for (var t = 0; t < e.length; t++) {
|
|
1912
1948
|
var r = e[t];
|
|
1913
|
-
for (var
|
|
1914
|
-
r[
|
|
1949
|
+
for (var o in r)
|
|
1950
|
+
r[o] && r[o].constructor && r[o].constructor === Object ? n[o] = M(n[o] || {}, r[o]) : n[o] = r[o];
|
|
1915
1951
|
}
|
|
1916
1952
|
return n;
|
|
1917
1953
|
}
|
|
1918
|
-
function
|
|
1954
|
+
function Ht() {
|
|
1919
1955
|
for (var n = ["Pusher"], e = 0; e < arguments.length; e++)
|
|
1920
1956
|
typeof arguments[e] == "string" ? n.push(arguments[e]) : n.push(ae(arguments[e]));
|
|
1921
1957
|
return n.join(" : ");
|
|
1922
1958
|
}
|
|
1923
|
-
function
|
|
1959
|
+
function He(n, e) {
|
|
1924
1960
|
var t = Array.prototype.indexOf;
|
|
1925
1961
|
if (n === null)
|
|
1926
1962
|
return -1;
|
|
1927
1963
|
if (t && n.indexOf === t)
|
|
1928
1964
|
return n.indexOf(e);
|
|
1929
|
-
for (var r = 0,
|
|
1965
|
+
for (var r = 0, o = n.length; r < o; r++)
|
|
1930
1966
|
if (n[r] === e)
|
|
1931
1967
|
return r;
|
|
1932
1968
|
return -1;
|
|
@@ -1935,13 +1971,13 @@ function Gi() {
|
|
|
1935
1971
|
for (var t in n)
|
|
1936
1972
|
Object.prototype.hasOwnProperty.call(n, t) && e(n[t], t, n);
|
|
1937
1973
|
}
|
|
1938
|
-
function
|
|
1974
|
+
function De(n) {
|
|
1939
1975
|
var e = [];
|
|
1940
1976
|
return B(n, function(t, r) {
|
|
1941
1977
|
e.push(r);
|
|
1942
1978
|
}), e;
|
|
1943
1979
|
}
|
|
1944
|
-
function
|
|
1980
|
+
function Dt(n) {
|
|
1945
1981
|
var e = [];
|
|
1946
1982
|
return B(n, function(t) {
|
|
1947
1983
|
e.push(t);
|
|
@@ -1951,20 +1987,20 @@ function Gi() {
|
|
|
1951
1987
|
for (var r = 0; r < n.length; r++)
|
|
1952
1988
|
e.call(t || window, n[r], r, n);
|
|
1953
1989
|
}
|
|
1954
|
-
function
|
|
1990
|
+
function Fe(n, e) {
|
|
1955
1991
|
for (var t = [], r = 0; r < n.length; r++)
|
|
1956
1992
|
t.push(e(n[r], r, n, t));
|
|
1957
1993
|
return t;
|
|
1958
1994
|
}
|
|
1959
|
-
function
|
|
1995
|
+
function Ft(n, e) {
|
|
1960
1996
|
var t = {};
|
|
1961
|
-
return B(n, function(r,
|
|
1962
|
-
t[
|
|
1997
|
+
return B(n, function(r, o) {
|
|
1998
|
+
t[o] = e(r);
|
|
1963
1999
|
}), t;
|
|
1964
2000
|
}
|
|
1965
|
-
function
|
|
1966
|
-
e = e || function(
|
|
1967
|
-
return !!
|
|
2001
|
+
function We(n, e) {
|
|
2002
|
+
e = e || function(o) {
|
|
2003
|
+
return !!o;
|
|
1968
2004
|
};
|
|
1969
2005
|
for (var t = [], r = 0; r < n.length; r++)
|
|
1970
2006
|
e(n[r], r, n, t) && t.push(n[r]);
|
|
@@ -1972,11 +2008,11 @@ function Gi() {
|
|
|
1972
2008
|
}
|
|
1973
2009
|
function Be(n, e) {
|
|
1974
2010
|
var t = {};
|
|
1975
|
-
return B(n, function(r,
|
|
1976
|
-
(e && e(r,
|
|
2011
|
+
return B(n, function(r, o) {
|
|
2012
|
+
(e && e(r, o, n, t) || r) && (t[o] = r);
|
|
1977
2013
|
}), t;
|
|
1978
2014
|
}
|
|
1979
|
-
function
|
|
2015
|
+
function Wt(n) {
|
|
1980
2016
|
var e = [];
|
|
1981
2017
|
return B(n, function(t, r) {
|
|
1982
2018
|
e.push([r, t]);
|
|
@@ -1995,40 +2031,40 @@ function Gi() {
|
|
|
1995
2031
|
return !0;
|
|
1996
2032
|
}
|
|
1997
2033
|
function $t(n) {
|
|
1998
|
-
return
|
|
2034
|
+
return Ft(n, function(e) {
|
|
1999
2035
|
return typeof e == "object" && (e = ae(e)), encodeURIComponent(Lt(e.toString()));
|
|
2000
2036
|
});
|
|
2001
2037
|
}
|
|
2002
2038
|
function Xt(n) {
|
|
2003
2039
|
var e = Be(n, function(r) {
|
|
2004
2040
|
return r !== void 0;
|
|
2005
|
-
}), t =
|
|
2041
|
+
}), t = Fe(Wt($t(e)), U.method("join", "=")).join("&");
|
|
2006
2042
|
return t;
|
|
2007
2043
|
}
|
|
2008
|
-
function
|
|
2044
|
+
function Vt(n) {
|
|
2009
2045
|
var e = [], t = [];
|
|
2010
|
-
return (function r(
|
|
2011
|
-
var l,
|
|
2012
|
-
switch (typeof
|
|
2046
|
+
return (function r(o, c) {
|
|
2047
|
+
var l, p, y;
|
|
2048
|
+
switch (typeof o) {
|
|
2013
2049
|
case "object":
|
|
2014
|
-
if (!
|
|
2050
|
+
if (!o)
|
|
2015
2051
|
return null;
|
|
2016
2052
|
for (l = 0; l < e.length; l += 1)
|
|
2017
|
-
if (e[l] ===
|
|
2053
|
+
if (e[l] === o)
|
|
2018
2054
|
return { $ref: t[l] };
|
|
2019
|
-
if (e.push(
|
|
2020
|
-
for (
|
|
2021
|
-
|
|
2055
|
+
if (e.push(o), t.push(c), Object.prototype.toString.apply(o) === "[object Array]")
|
|
2056
|
+
for (y = [], l = 0; l < o.length; l += 1)
|
|
2057
|
+
y[l] = r(o[l], c + "[" + l + "]");
|
|
2022
2058
|
else {
|
|
2023
|
-
|
|
2024
|
-
for (
|
|
2025
|
-
Object.prototype.hasOwnProperty.call(
|
|
2059
|
+
y = {};
|
|
2060
|
+
for (p in o)
|
|
2061
|
+
Object.prototype.hasOwnProperty.call(o, p) && (y[p] = r(o[p], c + "[" + JSON.stringify(p) + "]"));
|
|
2026
2062
|
}
|
|
2027
|
-
return
|
|
2063
|
+
return y;
|
|
2028
2064
|
case "number":
|
|
2029
2065
|
case "string":
|
|
2030
2066
|
case "boolean":
|
|
2031
|
-
return
|
|
2067
|
+
return o;
|
|
2032
2068
|
}
|
|
2033
2069
|
})(n, "$");
|
|
2034
2070
|
}
|
|
@@ -2036,10 +2072,10 @@ function Gi() {
|
|
|
2036
2072
|
try {
|
|
2037
2073
|
return JSON.stringify(n);
|
|
2038
2074
|
} catch {
|
|
2039
|
-
return JSON.stringify(
|
|
2075
|
+
return JSON.stringify(Vt(n));
|
|
2040
2076
|
}
|
|
2041
2077
|
}
|
|
2042
|
-
class
|
|
2078
|
+
class Jt {
|
|
2043
2079
|
constructor() {
|
|
2044
2080
|
this.globalLog = (e) => {
|
|
2045
2081
|
window.console && window.console.log && window.console.log(e);
|
|
@@ -2061,26 +2097,26 @@ function Gi() {
|
|
|
2061
2097
|
window.console && window.console.error ? window.console.error(e) : this.globalLogWarn(e);
|
|
2062
2098
|
}
|
|
2063
2099
|
log(e, ...t) {
|
|
2064
|
-
var r =
|
|
2100
|
+
var r = Ht.apply(this, arguments);
|
|
2065
2101
|
ue.log ? ue.log(r) : ue.logToConsole && e.bind(this)(r);
|
|
2066
2102
|
}
|
|
2067
2103
|
}
|
|
2068
|
-
const L = new
|
|
2069
|
-
var Gt = function(n, e, t, r,
|
|
2104
|
+
const L = new Jt();
|
|
2105
|
+
var Gt = function(n, e, t, r, o) {
|
|
2070
2106
|
(t.headers !== void 0 || t.headersProvider != null) && L.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
2071
2107
|
var c = n.nextAuthCallbackID.toString();
|
|
2072
2108
|
n.nextAuthCallbackID++;
|
|
2073
|
-
var l = n.getDocument(),
|
|
2074
|
-
n.auth_callbacks[c] = function(
|
|
2075
|
-
|
|
2109
|
+
var l = n.getDocument(), p = l.createElement("script");
|
|
2110
|
+
n.auth_callbacks[c] = function(k) {
|
|
2111
|
+
o(null, k);
|
|
2076
2112
|
};
|
|
2077
|
-
var
|
|
2078
|
-
|
|
2079
|
-
var
|
|
2080
|
-
|
|
2113
|
+
var y = "Pusher.auth_callbacks['" + c + "']";
|
|
2114
|
+
p.src = t.endpoint + "?callback=" + encodeURIComponent(y) + "&" + e;
|
|
2115
|
+
var E = l.getElementsByTagName("head")[0] || l.documentElement;
|
|
2116
|
+
E.insertBefore(p, E.firstChild);
|
|
2081
2117
|
};
|
|
2082
2118
|
const Yt = Gt;
|
|
2083
|
-
class
|
|
2119
|
+
class Kt {
|
|
2084
2120
|
constructor(e) {
|
|
2085
2121
|
this.src = e;
|
|
2086
2122
|
}
|
|
@@ -2093,14 +2129,14 @@ function Gi() {
|
|
|
2093
2129
|
}) : t.script.onreadystatechange = function() {
|
|
2094
2130
|
(t.script.readyState === "loaded" || t.script.readyState === "complete") && e.callback(null);
|
|
2095
2131
|
}, t.script.async === void 0 && document.attachEvent && /opera/i.test(navigator.userAgent) ? (t.errorScript = document.createElement("script"), t.errorScript.id = e.id + "_error", t.errorScript.text = e.name + "('" + r + "');", t.script.async = t.errorScript.async = !1) : t.script.async = !0;
|
|
2096
|
-
var
|
|
2097
|
-
|
|
2132
|
+
var o = document.getElementsByTagName("head")[0];
|
|
2133
|
+
o.insertBefore(t.script, o.firstChild), t.errorScript && o.insertBefore(t.errorScript, t.script.nextSibling);
|
|
2098
2134
|
}
|
|
2099
2135
|
cleanup() {
|
|
2100
2136
|
this.script && (this.script.onload = this.script.onerror = null, this.script.onreadystatechange = null), this.script && this.script.parentNode && this.script.parentNode.removeChild(this.script), this.errorScript && this.errorScript.parentNode && this.errorScript.parentNode.removeChild(this.errorScript), this.script = null, this.errorScript = null;
|
|
2101
2137
|
}
|
|
2102
2138
|
}
|
|
2103
|
-
class
|
|
2139
|
+
class Qt {
|
|
2104
2140
|
constructor(e, t) {
|
|
2105
2141
|
this.url = e, this.data = t;
|
|
2106
2142
|
}
|
|
@@ -2116,40 +2152,40 @@ function Gi() {
|
|
|
2116
2152
|
}
|
|
2117
2153
|
var Zt = function(n, e) {
|
|
2118
2154
|
return function(t, r) {
|
|
2119
|
-
var
|
|
2120
|
-
w.remove(
|
|
2155
|
+
var o = "http" + (e ? "s" : "") + "://", c = o + (n.host || n.options.host) + n.options.path, l = C.createJSONPRequest(c, t), p = C.ScriptReceivers.create(function(y, E) {
|
|
2156
|
+
w.remove(p), l.cleanup(), E && E.host && (n.host = E.host), r && r(y, E);
|
|
2121
2157
|
});
|
|
2122
|
-
l.send(
|
|
2158
|
+
l.send(p);
|
|
2123
2159
|
};
|
|
2124
2160
|
}, en = {
|
|
2125
2161
|
name: "jsonp",
|
|
2126
2162
|
getAgent: Zt
|
|
2127
2163
|
};
|
|
2128
2164
|
const tn = en;
|
|
2129
|
-
function
|
|
2130
|
-
var r = n + (e.useTLS ? "s" : ""),
|
|
2131
|
-
return r + "://" +
|
|
2165
|
+
function be(n, e, t) {
|
|
2166
|
+
var r = n + (e.useTLS ? "s" : ""), o = e.useTLS ? e.hostTLS : e.hostNonTLS;
|
|
2167
|
+
return r + "://" + o + t;
|
|
2132
2168
|
}
|
|
2133
|
-
function
|
|
2169
|
+
function ye(n, e) {
|
|
2134
2170
|
var t = "/app/" + n, r = "?protocol=" + T.PROTOCOL + "&client=js&version=" + T.VERSION + (e ? "&" + e : "");
|
|
2135
2171
|
return t + r;
|
|
2136
2172
|
}
|
|
2137
2173
|
var nn = {
|
|
2138
2174
|
getInitial: function(n, e) {
|
|
2139
|
-
var t = (e.httpPath || "") +
|
|
2140
|
-
return
|
|
2175
|
+
var t = (e.httpPath || "") + ye(n, "flash=false");
|
|
2176
|
+
return be("ws", e, t);
|
|
2141
2177
|
}
|
|
2142
2178
|
}, rn = {
|
|
2143
2179
|
getInitial: function(n, e) {
|
|
2144
|
-
var t = (e.httpPath || "/pusher") +
|
|
2145
|
-
return
|
|
2180
|
+
var t = (e.httpPath || "/pusher") + ye(n);
|
|
2181
|
+
return be("http", e, t);
|
|
2146
2182
|
}
|
|
2147
2183
|
}, sn = {
|
|
2148
2184
|
getInitial: function(n, e) {
|
|
2149
|
-
return
|
|
2185
|
+
return be("http", e, e.httpPath || "/pusher");
|
|
2150
2186
|
},
|
|
2151
2187
|
getPath: function(n, e) {
|
|
2152
|
-
return
|
|
2188
|
+
return ye(n);
|
|
2153
2189
|
}
|
|
2154
2190
|
};
|
|
2155
2191
|
class on {
|
|
@@ -2157,11 +2193,11 @@ function Gi() {
|
|
|
2157
2193
|
this._callbacks = {};
|
|
2158
2194
|
}
|
|
2159
2195
|
get(e) {
|
|
2160
|
-
return this._callbacks[
|
|
2196
|
+
return this._callbacks[we(e)];
|
|
2161
2197
|
}
|
|
2162
2198
|
add(e, t, r) {
|
|
2163
|
-
var
|
|
2164
|
-
this._callbacks[
|
|
2199
|
+
var o = we(e);
|
|
2200
|
+
this._callbacks[o] = this._callbacks[o] || [], this._callbacks[o].push({
|
|
2165
2201
|
fn: t,
|
|
2166
2202
|
context: r
|
|
2167
2203
|
});
|
|
@@ -2171,14 +2207,14 @@ function Gi() {
|
|
|
2171
2207
|
this._callbacks = {};
|
|
2172
2208
|
return;
|
|
2173
2209
|
}
|
|
2174
|
-
var
|
|
2175
|
-
t || r ? this.removeCallback(
|
|
2210
|
+
var o = e ? [we(e)] : De(this._callbacks);
|
|
2211
|
+
t || r ? this.removeCallback(o, t, r) : this.removeAllCallbacks(o);
|
|
2176
2212
|
}
|
|
2177
2213
|
removeCallback(e, t, r) {
|
|
2178
|
-
ie(e, function(
|
|
2179
|
-
this._callbacks[
|
|
2214
|
+
ie(e, function(o) {
|
|
2215
|
+
this._callbacks[o] = We(this._callbacks[o] || [], function(c) {
|
|
2180
2216
|
return t && t !== c.fn || r && r !== c.context;
|
|
2181
|
-
}), this._callbacks[
|
|
2217
|
+
}), this._callbacks[o].length === 0 && delete this._callbacks[o];
|
|
2182
2218
|
}, this);
|
|
2183
2219
|
}
|
|
2184
2220
|
removeAllCallbacks(e) {
|
|
@@ -2187,7 +2223,7 @@ function Gi() {
|
|
|
2187
2223
|
}, this);
|
|
2188
2224
|
}
|
|
2189
2225
|
}
|
|
2190
|
-
function
|
|
2226
|
+
function we(n) {
|
|
2191
2227
|
return "_" + n;
|
|
2192
2228
|
}
|
|
2193
2229
|
class $ {
|
|
@@ -2204,25 +2240,25 @@ function Gi() {
|
|
|
2204
2240
|
return this.callbacks.remove(e, t, r), this;
|
|
2205
2241
|
}
|
|
2206
2242
|
unbind_global(e) {
|
|
2207
|
-
return e ? (this.global_callbacks =
|
|
2243
|
+
return e ? (this.global_callbacks = We(this.global_callbacks || [], (t) => t !== e), this) : (this.global_callbacks = [], this);
|
|
2208
2244
|
}
|
|
2209
2245
|
unbind_all() {
|
|
2210
2246
|
return this.unbind(), this.unbind_global(), this;
|
|
2211
2247
|
}
|
|
2212
2248
|
emit(e, t, r) {
|
|
2213
|
-
for (var
|
|
2214
|
-
this.global_callbacks[
|
|
2249
|
+
for (var o = 0; o < this.global_callbacks.length; o++)
|
|
2250
|
+
this.global_callbacks[o](e, t);
|
|
2215
2251
|
var c = this.callbacks.get(e), l = [];
|
|
2216
2252
|
if (r ? l.push(t, r) : t && l.push(t), c && c.length > 0)
|
|
2217
|
-
for (var
|
|
2218
|
-
c[
|
|
2253
|
+
for (var o = 0; o < c.length; o++)
|
|
2254
|
+
c[o].fn.apply(c[o].context || window, l);
|
|
2219
2255
|
else this.failThrough && this.failThrough(e, t);
|
|
2220
2256
|
return this;
|
|
2221
2257
|
}
|
|
2222
2258
|
}
|
|
2223
2259
|
class an extends $ {
|
|
2224
|
-
constructor(e, t, r,
|
|
2225
|
-
super(), this.initialize = C.transportConnectionInitializer, this.hooks = e, this.name = t, this.priority = r, this.key =
|
|
2260
|
+
constructor(e, t, r, o, c) {
|
|
2261
|
+
super(), this.initialize = C.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();
|
|
2226
2262
|
}
|
|
2227
2263
|
handlesActivityChecks() {
|
|
2228
2264
|
return !!this.hooks.handlesActivityChecks;
|
|
@@ -2296,7 +2332,7 @@ function Gi() {
|
|
|
2296
2332
|
})), this.emit(e, t);
|
|
2297
2333
|
}
|
|
2298
2334
|
buildTimelineMessage(e) {
|
|
2299
|
-
return
|
|
2335
|
+
return M({ cid: this.id }, e);
|
|
2300
2336
|
}
|
|
2301
2337
|
}
|
|
2302
2338
|
class ee {
|
|
@@ -2306,8 +2342,8 @@ function Gi() {
|
|
|
2306
2342
|
isSupported(e) {
|
|
2307
2343
|
return this.hooks.isSupported(e);
|
|
2308
2344
|
}
|
|
2309
|
-
createConnection(e, t, r,
|
|
2310
|
-
return new an(this.hooks, e, t, r,
|
|
2345
|
+
createConnection(e, t, r, o) {
|
|
2346
|
+
return new an(this.hooks, e, t, r, o);
|
|
2311
2347
|
}
|
|
2312
2348
|
}
|
|
2313
2349
|
var cn = new ee({
|
|
@@ -2330,11 +2366,11 @@ function Gi() {
|
|
|
2330
2366
|
isInitialized: function() {
|
|
2331
2367
|
return !0;
|
|
2332
2368
|
}
|
|
2333
|
-
},
|
|
2369
|
+
}, Ve = M({
|
|
2334
2370
|
getSocket: function(n) {
|
|
2335
2371
|
return C.HTTPFactory.createStreamingSocket(n);
|
|
2336
2372
|
}
|
|
2337
|
-
}, Xe),
|
|
2373
|
+
}, Xe), Je = M({
|
|
2338
2374
|
getSocket: function(n) {
|
|
2339
2375
|
return C.HTTPFactory.createPollingSocket(n);
|
|
2340
2376
|
}
|
|
@@ -2342,7 +2378,7 @@ function Gi() {
|
|
|
2342
2378
|
isSupported: function() {
|
|
2343
2379
|
return C.isXHRSupported();
|
|
2344
2380
|
}
|
|
2345
|
-
}, hn = new ee(
|
|
2381
|
+
}, hn = new ee(M({}, Ve, Ge)), ln = new ee(M({}, Je, Ge)), un = {
|
|
2346
2382
|
ws: cn,
|
|
2347
2383
|
xhr_streaming: hn,
|
|
2348
2384
|
xhr_polling: ln
|
|
@@ -2361,7 +2397,7 @@ function Gi() {
|
|
|
2361
2397
|
},
|
|
2362
2398
|
getSocket: function(n, e) {
|
|
2363
2399
|
return new window.SockJS(n, null, {
|
|
2364
|
-
js_path:
|
|
2400
|
+
js_path: N.getPath("sockjs", {
|
|
2365
2401
|
useTLS: e.useTLS
|
|
2366
2402
|
}),
|
|
2367
2403
|
ignore_null_origin: e.ignoreNullOrigin
|
|
@@ -2377,8 +2413,8 @@ function Gi() {
|
|
|
2377
2413
|
var e = C.isXDRSupported(n.useTLS);
|
|
2378
2414
|
return e;
|
|
2379
2415
|
}
|
|
2380
|
-
},
|
|
2381
|
-
ce.xdr_streaming =
|
|
2416
|
+
}, fn = new ee(M({}, Ve, Ye)), pn = new ee(M({}, Je, Ye));
|
|
2417
|
+
ce.xdr_streaming = fn, ce.xdr_polling = pn, ce.sockjs = dn;
|
|
2382
2418
|
const mn = ce;
|
|
2383
2419
|
class gn extends $ {
|
|
2384
2420
|
constructor() {
|
|
@@ -2395,31 +2431,31 @@ function Gi() {
|
|
|
2395
2431
|
}
|
|
2396
2432
|
}
|
|
2397
2433
|
var vn = new gn();
|
|
2398
|
-
class
|
|
2434
|
+
class bn {
|
|
2399
2435
|
constructor(e, t, r) {
|
|
2400
2436
|
this.manager = e, this.transport = t, this.minPingDelay = r.minPingDelay, this.maxPingDelay = r.maxPingDelay, this.pingDelay = void 0;
|
|
2401
2437
|
}
|
|
2402
|
-
createConnection(e, t, r,
|
|
2403
|
-
|
|
2438
|
+
createConnection(e, t, r, o) {
|
|
2439
|
+
o = M({}, o, {
|
|
2404
2440
|
activityTimeout: this.pingDelay
|
|
2405
2441
|
});
|
|
2406
|
-
var c = this.transport.createConnection(e, t, r,
|
|
2407
|
-
c.unbind("open",
|
|
2408
|
-
},
|
|
2409
|
-
if (c.unbind("closed",
|
|
2442
|
+
var c = this.transport.createConnection(e, t, r, o), l = null, p = function() {
|
|
2443
|
+
c.unbind("open", p), c.bind("closed", y), l = U.now();
|
|
2444
|
+
}, y = (E) => {
|
|
2445
|
+
if (c.unbind("closed", y), E.code === 1002 || E.code === 1003)
|
|
2410
2446
|
this.manager.reportDeath();
|
|
2411
|
-
else if (!
|
|
2412
|
-
var
|
|
2413
|
-
|
|
2447
|
+
else if (!E.wasClean && l) {
|
|
2448
|
+
var k = U.now() - l;
|
|
2449
|
+
k < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(k / 2, this.minPingDelay));
|
|
2414
2450
|
}
|
|
2415
2451
|
};
|
|
2416
|
-
return c.bind("open",
|
|
2452
|
+
return c.bind("open", p), c;
|
|
2417
2453
|
}
|
|
2418
2454
|
isSupported(e) {
|
|
2419
2455
|
return this.manager.isAlive() && this.transport.isSupported(e);
|
|
2420
2456
|
}
|
|
2421
2457
|
}
|
|
2422
|
-
const
|
|
2458
|
+
const Ke = {
|
|
2423
2459
|
decodeMessage: function(n) {
|
|
2424
2460
|
try {
|
|
2425
2461
|
var e = JSON.parse(n.data), t = e.data;
|
|
@@ -2434,15 +2470,15 @@ function Gi() {
|
|
|
2434
2470
|
data: t
|
|
2435
2471
|
};
|
|
2436
2472
|
return e.user_id && (r.user_id = e.user_id), r;
|
|
2437
|
-
} catch (
|
|
2438
|
-
throw { type: "MessageParseError", error:
|
|
2473
|
+
} catch (o) {
|
|
2474
|
+
throw { type: "MessageParseError", error: o, data: n.data };
|
|
2439
2475
|
}
|
|
2440
2476
|
},
|
|
2441
2477
|
encodeMessage: function(n) {
|
|
2442
2478
|
return JSON.stringify(n);
|
|
2443
2479
|
},
|
|
2444
2480
|
processHandshake: function(n) {
|
|
2445
|
-
var e =
|
|
2481
|
+
var e = Ke.decodeMessage(n);
|
|
2446
2482
|
if (e.event === "pusher:connection_established") {
|
|
2447
2483
|
if (!e.data.activity_timeout)
|
|
2448
2484
|
throw "No activity timeout specified in handshake";
|
|
@@ -2472,8 +2508,8 @@ function Gi() {
|
|
|
2472
2508
|
}
|
|
2473
2509
|
} : null;
|
|
2474
2510
|
}
|
|
2475
|
-
},
|
|
2476
|
-
class
|
|
2511
|
+
}, K = Ke;
|
|
2512
|
+
class yn extends $ {
|
|
2477
2513
|
constructor(e, t) {
|
|
2478
2514
|
super(), this.id = e, this.transport = t, this.activityTimeout = t.activityTimeout, this.bindListeners();
|
|
2479
2515
|
}
|
|
@@ -2484,8 +2520,8 @@ function Gi() {
|
|
|
2484
2520
|
return this.transport.send(e);
|
|
2485
2521
|
}
|
|
2486
2522
|
send_event(e, t, r) {
|
|
2487
|
-
var
|
|
2488
|
-
return r && (
|
|
2523
|
+
var o = { event: e, data: t };
|
|
2524
|
+
return r && (o.channel = r), L.debug("Event sent", o), this.send(K.encodeMessage(o));
|
|
2489
2525
|
}
|
|
2490
2526
|
ping() {
|
|
2491
2527
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -2496,9 +2532,9 @@ function Gi() {
|
|
|
2496
2532
|
bindListeners() {
|
|
2497
2533
|
var e = {
|
|
2498
2534
|
message: (r) => {
|
|
2499
|
-
var
|
|
2535
|
+
var o;
|
|
2500
2536
|
try {
|
|
2501
|
-
|
|
2537
|
+
o = K.decodeMessage(r);
|
|
2502
2538
|
} catch (c) {
|
|
2503
2539
|
this.emit("error", {
|
|
2504
2540
|
type: "MessageParseError",
|
|
@@ -2506,12 +2542,12 @@ function Gi() {
|
|
|
2506
2542
|
data: r.data
|
|
2507
2543
|
});
|
|
2508
2544
|
}
|
|
2509
|
-
if (
|
|
2510
|
-
switch (L.debug("Event recd",
|
|
2545
|
+
if (o !== void 0) {
|
|
2546
|
+
switch (L.debug("Event recd", o), o.event) {
|
|
2511
2547
|
case "pusher:error":
|
|
2512
2548
|
this.emit("error", {
|
|
2513
2549
|
type: "PusherError",
|
|
2514
|
-
data:
|
|
2550
|
+
data: o.data
|
|
2515
2551
|
});
|
|
2516
2552
|
break;
|
|
2517
2553
|
case "pusher:ping":
|
|
@@ -2521,7 +2557,7 @@ function Gi() {
|
|
|
2521
2557
|
this.emit("pong");
|
|
2522
2558
|
break;
|
|
2523
2559
|
}
|
|
2524
|
-
this.emit("message",
|
|
2560
|
+
this.emit("message", o);
|
|
2525
2561
|
}
|
|
2526
2562
|
},
|
|
2527
2563
|
activity: () => {
|
|
@@ -2534,16 +2570,16 @@ function Gi() {
|
|
|
2534
2570
|
t(), r && r.code && this.handleCloseEvent(r), this.transport = null, this.emit("closed");
|
|
2535
2571
|
}
|
|
2536
2572
|
}, t = () => {
|
|
2537
|
-
B(e, (r,
|
|
2538
|
-
this.transport.unbind(
|
|
2573
|
+
B(e, (r, o) => {
|
|
2574
|
+
this.transport.unbind(o, r);
|
|
2539
2575
|
});
|
|
2540
2576
|
};
|
|
2541
|
-
B(e, (r,
|
|
2542
|
-
this.transport.bind(
|
|
2577
|
+
B(e, (r, o) => {
|
|
2578
|
+
this.transport.bind(o, r);
|
|
2543
2579
|
});
|
|
2544
2580
|
}
|
|
2545
2581
|
handleCloseEvent(e) {
|
|
2546
|
-
var t =
|
|
2582
|
+
var t = K.getCloseAction(e), r = K.getCloseError(e);
|
|
2547
2583
|
r && this.emit("error", r), t && this.emit(t, { action: t, error: r });
|
|
2548
2584
|
}
|
|
2549
2585
|
}
|
|
@@ -2559,18 +2595,18 @@ function Gi() {
|
|
|
2559
2595
|
this.unbindListeners();
|
|
2560
2596
|
var t;
|
|
2561
2597
|
try {
|
|
2562
|
-
t =
|
|
2598
|
+
t = K.processHandshake(e);
|
|
2563
2599
|
} catch (r) {
|
|
2564
2600
|
this.finish("error", { error: r }), this.transport.close();
|
|
2565
2601
|
return;
|
|
2566
2602
|
}
|
|
2567
2603
|
t.action === "connected" ? this.finish("connected", {
|
|
2568
|
-
connection: new
|
|
2604
|
+
connection: new yn(t.id, this.transport),
|
|
2569
2605
|
activityTimeout: t.activityTimeout
|
|
2570
2606
|
}) : (this.finish(t.action, { error: t.error }), this.transport.close());
|
|
2571
2607
|
}, this.onClosed = (e) => {
|
|
2572
2608
|
this.unbindListeners();
|
|
2573
|
-
var t =
|
|
2609
|
+
var t = K.getCloseAction(e) || "backoff", r = K.getCloseError(e);
|
|
2574
2610
|
this.finish(t, { error: r });
|
|
2575
2611
|
}, this.transport.bind("message", this.onMessage), this.transport.bind("closed", this.onClosed);
|
|
2576
2612
|
}
|
|
@@ -2578,7 +2614,7 @@ function Gi() {
|
|
|
2578
2614
|
this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
|
|
2579
2615
|
}
|
|
2580
2616
|
finish(e, t) {
|
|
2581
|
-
this.callback(
|
|
2617
|
+
this.callback(M({ transport: this.transport, action: e }, t));
|
|
2582
2618
|
}
|
|
2583
2619
|
}
|
|
2584
2620
|
class Cn {
|
|
@@ -2589,9 +2625,9 @@ function Gi() {
|
|
|
2589
2625
|
this.timeline.isEmpty() || this.timeline.send(C.TimelineTransport.getAgent(this, e), t);
|
|
2590
2626
|
}
|
|
2591
2627
|
}
|
|
2592
|
-
class
|
|
2628
|
+
class Ce extends $ {
|
|
2593
2629
|
constructor(e, t) {
|
|
2594
|
-
super(function(r,
|
|
2630
|
+
super(function(r, o) {
|
|
2595
2631
|
L.debug("No callbacks on " + e + " for " + r);
|
|
2596
2632
|
}), this.name = e, this.pusher = t, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
2597
2633
|
}
|
|
@@ -2600,9 +2636,9 @@ function Gi() {
|
|
|
2600
2636
|
}
|
|
2601
2637
|
trigger(e, t) {
|
|
2602
2638
|
if (e.indexOf("client-") !== 0)
|
|
2603
|
-
throw new
|
|
2639
|
+
throw new f("Event '" + e + "' does not start with 'client-'");
|
|
2604
2640
|
if (!this.subscribed) {
|
|
2605
|
-
var r =
|
|
2641
|
+
var r = x.buildLogSuffix("triggeringClientEvents");
|
|
2606
2642
|
L.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`);
|
|
2607
2643
|
}
|
|
2608
2644
|
return this.pusher.send_event(e, t, this.name);
|
|
@@ -2617,8 +2653,8 @@ function Gi() {
|
|
|
2617
2653
|
else if (t === "pusher_internal:subscription_count")
|
|
2618
2654
|
this.handleSubscriptionCountEvent(e);
|
|
2619
2655
|
else if (t.indexOf("pusher_internal:") !== 0) {
|
|
2620
|
-
var
|
|
2621
|
-
this.emit(t, r,
|
|
2656
|
+
var o = {};
|
|
2657
|
+
this.emit(t, r, o);
|
|
2622
2658
|
}
|
|
2623
2659
|
}
|
|
2624
2660
|
handleSubscriptionSucceededEvent(e) {
|
|
@@ -2632,7 +2668,7 @@ function Gi() {
|
|
|
2632
2668
|
e ? (this.subscriptionPending = !1, L.error(e.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
|
|
2633
2669
|
type: "AuthError",
|
|
2634
2670
|
error: e.message
|
|
2635
|
-
}, e instanceof
|
|
2671
|
+
}, e instanceof H ? { status: e.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
|
|
2636
2672
|
auth: t.auth,
|
|
2637
2673
|
channel_data: t.channel_data,
|
|
2638
2674
|
channel: this.name
|
|
@@ -2651,7 +2687,7 @@ function Gi() {
|
|
|
2651
2687
|
this.subscriptionCancelled = !1;
|
|
2652
2688
|
}
|
|
2653
2689
|
}
|
|
2654
|
-
class
|
|
2690
|
+
class Se extends Ce {
|
|
2655
2691
|
authorize(e, t) {
|
|
2656
2692
|
return this.pusher.config.channelAuthorizer({
|
|
2657
2693
|
channelName: this.name,
|
|
@@ -2692,50 +2728,50 @@ function Gi() {
|
|
|
2692
2728
|
}
|
|
2693
2729
|
}
|
|
2694
2730
|
var Tn = function(n, e, t, r) {
|
|
2695
|
-
function
|
|
2731
|
+
function o(c) {
|
|
2696
2732
|
return c instanceof t ? c : new t(function(l) {
|
|
2697
2733
|
l(c);
|
|
2698
2734
|
});
|
|
2699
2735
|
}
|
|
2700
2736
|
return new (t || (t = Promise))(function(c, l) {
|
|
2701
|
-
function
|
|
2737
|
+
function p(k) {
|
|
2702
2738
|
try {
|
|
2703
|
-
|
|
2739
|
+
E(r.next(k));
|
|
2704
2740
|
} catch (I) {
|
|
2705
2741
|
l(I);
|
|
2706
2742
|
}
|
|
2707
2743
|
}
|
|
2708
|
-
function
|
|
2744
|
+
function y(k) {
|
|
2709
2745
|
try {
|
|
2710
|
-
|
|
2746
|
+
E(r.throw(k));
|
|
2711
2747
|
} catch (I) {
|
|
2712
2748
|
l(I);
|
|
2713
2749
|
}
|
|
2714
2750
|
}
|
|
2715
|
-
function k
|
|
2716
|
-
|
|
2751
|
+
function E(k) {
|
|
2752
|
+
k.done ? c(k.value) : o(k.value).then(p, y);
|
|
2717
2753
|
}
|
|
2718
|
-
|
|
2754
|
+
E((r = r.apply(n, e || [])).next());
|
|
2719
2755
|
});
|
|
2720
2756
|
};
|
|
2721
|
-
class
|
|
2757
|
+
class xn extends Se {
|
|
2722
2758
|
constructor(e, t) {
|
|
2723
2759
|
super(e, t), this.members = new Sn();
|
|
2724
2760
|
}
|
|
2725
2761
|
authorize(e, t) {
|
|
2726
|
-
super.authorize(e, (r,
|
|
2762
|
+
super.authorize(e, (r, o) => Tn(this, void 0, void 0, function* () {
|
|
2727
2763
|
if (!r)
|
|
2728
|
-
if (
|
|
2729
|
-
var c = JSON.parse(
|
|
2764
|
+
if (o = o, o.channel_data != null) {
|
|
2765
|
+
var c = JSON.parse(o.channel_data);
|
|
2730
2766
|
this.members.setMyID(c.user_id);
|
|
2731
2767
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
2732
2768
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
2733
2769
|
else {
|
|
2734
|
-
let l =
|
|
2770
|
+
let l = x.buildLogSuffix("authorizationEndpoint");
|
|
2735
2771
|
L.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${l}, or the user should be signed in.`), t("Invalid auth response");
|
|
2736
2772
|
return;
|
|
2737
2773
|
}
|
|
2738
|
-
t(r,
|
|
2774
|
+
t(r, o);
|
|
2739
2775
|
}));
|
|
2740
2776
|
}
|
|
2741
2777
|
handleEvent(e) {
|
|
@@ -2743,8 +2779,8 @@ function Gi() {
|
|
|
2743
2779
|
if (t.indexOf("pusher_internal:") === 0)
|
|
2744
2780
|
this.handleInternalEvent(e);
|
|
2745
2781
|
else {
|
|
2746
|
-
var r = e.data,
|
|
2747
|
-
e.user_id && (
|
|
2782
|
+
var r = e.data, o = {};
|
|
2783
|
+
e.user_id && (o.user_id = e.user_id), this.emit(t, r, o);
|
|
2748
2784
|
}
|
|
2749
2785
|
}
|
|
2750
2786
|
handleInternalEvent(e) {
|
|
@@ -2757,8 +2793,8 @@ function Gi() {
|
|
|
2757
2793
|
this.handleSubscriptionCountEvent(e);
|
|
2758
2794
|
break;
|
|
2759
2795
|
case "pusher_internal:member_added":
|
|
2760
|
-
var
|
|
2761
|
-
this.emit("pusher:member_added",
|
|
2796
|
+
var o = this.members.addMember(r);
|
|
2797
|
+
this.emit("pusher:member_added", o);
|
|
2762
2798
|
break;
|
|
2763
2799
|
case "pusher_internal:member_removed":
|
|
2764
2800
|
var c = this.members.removeMember(r);
|
|
@@ -2773,27 +2809,27 @@ function Gi() {
|
|
|
2773
2809
|
this.members.reset(), super.disconnect();
|
|
2774
2810
|
}
|
|
2775
2811
|
}
|
|
2776
|
-
var
|
|
2777
|
-
class
|
|
2812
|
+
var _n = b(978), Te = b(594);
|
|
2813
|
+
class En extends Se {
|
|
2778
2814
|
constructor(e, t, r) {
|
|
2779
2815
|
super(e, t), this.key = null, this.nacl = r;
|
|
2780
2816
|
}
|
|
2781
2817
|
authorize(e, t) {
|
|
2782
|
-
super.authorize(e, (r,
|
|
2818
|
+
super.authorize(e, (r, o) => {
|
|
2783
2819
|
if (r) {
|
|
2784
|
-
t(r,
|
|
2820
|
+
t(r, o);
|
|
2785
2821
|
return;
|
|
2786
2822
|
}
|
|
2787
|
-
let c =
|
|
2823
|
+
let c = o.shared_secret;
|
|
2788
2824
|
if (!c) {
|
|
2789
2825
|
t(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2790
2826
|
return;
|
|
2791
2827
|
}
|
|
2792
|
-
this.key = (0,
|
|
2828
|
+
this.key = (0, Te.decode)(c), delete o.shared_secret, t(null, o);
|
|
2793
2829
|
});
|
|
2794
2830
|
}
|
|
2795
2831
|
trigger(e, t) {
|
|
2796
|
-
throw new
|
|
2832
|
+
throw new z("Client events are not currently supported for encrypted channels");
|
|
2797
2833
|
}
|
|
2798
2834
|
handleEvent(e) {
|
|
2799
2835
|
var t = e.event, r = e.data;
|
|
@@ -2812,24 +2848,24 @@ function Gi() {
|
|
|
2812
2848
|
L.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + t);
|
|
2813
2849
|
return;
|
|
2814
2850
|
}
|
|
2815
|
-
let r = (0,
|
|
2851
|
+
let r = (0, Te.decode)(t.ciphertext);
|
|
2816
2852
|
if (r.length < this.nacl.secretbox.overheadLength) {
|
|
2817
2853
|
L.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);
|
|
2818
2854
|
return;
|
|
2819
2855
|
}
|
|
2820
|
-
let
|
|
2821
|
-
if (
|
|
2822
|
-
L.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${
|
|
2856
|
+
let o = (0, Te.decode)(t.nonce);
|
|
2857
|
+
if (o.length < this.nacl.secretbox.nonceLength) {
|
|
2858
|
+
L.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${o.length}`);
|
|
2823
2859
|
return;
|
|
2824
2860
|
}
|
|
2825
|
-
let c = this.nacl.secretbox.open(r,
|
|
2861
|
+
let c = this.nacl.secretbox.open(r, o, this.key);
|
|
2826
2862
|
if (c === null) {
|
|
2827
|
-
L.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,
|
|
2863
|
+
L.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (l, p) => {
|
|
2828
2864
|
if (l) {
|
|
2829
|
-
L.error(`Failed to make a request to the authEndpoint: ${
|
|
2865
|
+
L.error(`Failed to make a request to the authEndpoint: ${p}. Unable to fetch new key, so dropping encrypted event`);
|
|
2830
2866
|
return;
|
|
2831
2867
|
}
|
|
2832
|
-
if (c = this.nacl.secretbox.open(r,
|
|
2868
|
+
if (c = this.nacl.secretbox.open(r, o, this.key), c === null) {
|
|
2833
2869
|
L.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
2834
2870
|
return;
|
|
2835
2871
|
}
|
|
@@ -2840,7 +2876,7 @@ function Gi() {
|
|
|
2840
2876
|
this.emit(e, this.getDataToEmit(c));
|
|
2841
2877
|
}
|
|
2842
2878
|
getDataToEmit(e) {
|
|
2843
|
-
let t = (0,
|
|
2879
|
+
let t = (0, _n.D4)(e);
|
|
2844
2880
|
try {
|
|
2845
2881
|
return JSON.parse(t);
|
|
2846
2882
|
} catch {
|
|
@@ -2848,7 +2884,7 @@ function Gi() {
|
|
|
2848
2884
|
}
|
|
2849
2885
|
}
|
|
2850
2886
|
}
|
|
2851
|
-
class
|
|
2887
|
+
class kn extends $ {
|
|
2852
2888
|
constructor(e, t) {
|
|
2853
2889
|
super(), this.state = "initialized", this.connection = null, this.key = e, this.options = t, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
|
|
2854
2890
|
var r = C.getNetwork();
|
|
@@ -2908,7 +2944,7 @@ function Gi() {
|
|
|
2908
2944
|
});
|
|
2909
2945
|
}
|
|
2910
2946
|
retryIn(e) {
|
|
2911
|
-
this.timeline.info({ action: "retry", delay: e }), e > 0 && this.emit("connecting_in", Math.round(e / 1e3)), this.retryTimer = new
|
|
2947
|
+
this.timeline.info({ action: "retry", delay: e }), e > 0 && this.emit("connecting_in", Math.round(e / 1e3)), this.retryTimer = new Y(e || 0, () => {
|
|
2912
2948
|
this.disconnectInternally(), this.connect();
|
|
2913
2949
|
});
|
|
2914
2950
|
}
|
|
@@ -2916,7 +2952,7 @@ function Gi() {
|
|
|
2916
2952
|
this.retryTimer && (this.retryTimer.ensureAborted(), this.retryTimer = null);
|
|
2917
2953
|
}
|
|
2918
2954
|
setUnavailableTimer() {
|
|
2919
|
-
this.unavailableTimer = new
|
|
2955
|
+
this.unavailableTimer = new Y(this.options.unavailableTimeout, () => {
|
|
2920
2956
|
this.updateState("unavailable");
|
|
2921
2957
|
});
|
|
2922
2958
|
}
|
|
@@ -2924,12 +2960,12 @@ function Gi() {
|
|
|
2924
2960
|
this.unavailableTimer && this.unavailableTimer.ensureAborted();
|
|
2925
2961
|
}
|
|
2926
2962
|
sendActivityCheck() {
|
|
2927
|
-
this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new
|
|
2963
|
+
this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new Y(this.options.pongTimeout, () => {
|
|
2928
2964
|
this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
|
|
2929
2965
|
});
|
|
2930
2966
|
}
|
|
2931
2967
|
resetActivityCheck() {
|
|
2932
|
-
this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new
|
|
2968
|
+
this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new Y(this.activityTimeout, () => {
|
|
2933
2969
|
this.sendActivityCheck();
|
|
2934
2970
|
}));
|
|
2935
2971
|
}
|
|
@@ -2937,7 +2973,7 @@ function Gi() {
|
|
|
2937
2973
|
this.activityTimer && this.activityTimer.ensureAborted();
|
|
2938
2974
|
}
|
|
2939
2975
|
buildConnectionCallbacks(e) {
|
|
2940
|
-
return
|
|
2976
|
+
return M({}, e, {
|
|
2941
2977
|
message: (t) => {
|
|
2942
2978
|
this.resetActivityCheck(), this.emit("message", t);
|
|
2943
2979
|
},
|
|
@@ -2956,7 +2992,7 @@ function Gi() {
|
|
|
2956
2992
|
});
|
|
2957
2993
|
}
|
|
2958
2994
|
buildHandshakeCallbacks(e) {
|
|
2959
|
-
return
|
|
2995
|
+
return M({}, e, {
|
|
2960
2996
|
connected: (t) => {
|
|
2961
2997
|
this.activityTimeout = Math.min(this.options.activityTimeout, t.activityTimeout, t.connection.activityTimeout || 1 / 0), this.clearUnavailableTimer(), this.setConnection(t.connection), this.socket_id = this.connection.id, this.updateState("connected", { socket_id: this.socket_id });
|
|
2962
2998
|
}
|
|
@@ -2999,8 +3035,8 @@ function Gi() {
|
|
|
2999
3035
|
updateState(e, t) {
|
|
3000
3036
|
var r = this.state;
|
|
3001
3037
|
if (this.state = e, r !== e) {
|
|
3002
|
-
var
|
|
3003
|
-
|
|
3038
|
+
var o = e;
|
|
3039
|
+
o === "connected" && (o += " with new socket ID " + t.socket_id), L.debug("State changed", r + " -> " + o), this.timeline.info({ state: e, params: t }), this.emit("state_change", { previous: r, current: e }), this.emit(e, t);
|
|
3004
3040
|
}
|
|
3005
3041
|
}
|
|
3006
3042
|
shouldRetry() {
|
|
@@ -3015,7 +3051,7 @@ function Gi() {
|
|
|
3015
3051
|
return this.channels[e] || (this.channels[e] = Pn(e, t)), this.channels[e];
|
|
3016
3052
|
}
|
|
3017
3053
|
all() {
|
|
3018
|
-
return
|
|
3054
|
+
return Dt(this.channels);
|
|
3019
3055
|
}
|
|
3020
3056
|
find(e) {
|
|
3021
3057
|
return this.channels[e];
|
|
@@ -3034,8 +3070,8 @@ function Gi() {
|
|
|
3034
3070
|
if (n.indexOf("private-encrypted-") === 0) {
|
|
3035
3071
|
if (e.config.nacl)
|
|
3036
3072
|
return X.createEncryptedChannel(n, e, e.config.nacl);
|
|
3037
|
-
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r =
|
|
3038
|
-
throw new
|
|
3073
|
+
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r = x.buildLogSuffix("encryptedChannelSupport");
|
|
3074
|
+
throw new z(`${t}. ${r}`);
|
|
3039
3075
|
} else {
|
|
3040
3076
|
if (n.indexOf("private-") === 0)
|
|
3041
3077
|
return X.createPrivateChannel(n, e);
|
|
@@ -3051,19 +3087,19 @@ function Gi() {
|
|
|
3051
3087
|
return new An();
|
|
3052
3088
|
},
|
|
3053
3089
|
createConnectionManager(n, e) {
|
|
3054
|
-
return new
|
|
3090
|
+
return new kn(n, e);
|
|
3055
3091
|
},
|
|
3056
3092
|
createChannel(n, e) {
|
|
3057
|
-
return new
|
|
3093
|
+
return new Ce(n, e);
|
|
3058
3094
|
},
|
|
3059
3095
|
createPrivateChannel(n, e) {
|
|
3060
|
-
return new
|
|
3096
|
+
return new Se(n, e);
|
|
3061
3097
|
},
|
|
3062
3098
|
createPresenceChannel(n, e) {
|
|
3063
|
-
return new
|
|
3099
|
+
return new xn(n, e);
|
|
3064
3100
|
},
|
|
3065
3101
|
createEncryptedChannel(n, e, t) {
|
|
3066
|
-
return new
|
|
3102
|
+
return new En(n, e, t);
|
|
3067
3103
|
},
|
|
3068
3104
|
createTimelineSender(n, e) {
|
|
3069
3105
|
return new Cn(n, e);
|
|
@@ -3072,11 +3108,11 @@ function Gi() {
|
|
|
3072
3108
|
return new wn(n, e);
|
|
3073
3109
|
},
|
|
3074
3110
|
createAssistantToTheTransportManager(n, e, t) {
|
|
3075
|
-
return new
|
|
3111
|
+
return new bn(n, e, t);
|
|
3076
3112
|
}
|
|
3077
3113
|
};
|
|
3078
3114
|
const X = Ln;
|
|
3079
|
-
class
|
|
3115
|
+
class Qe {
|
|
3080
3116
|
constructor(e) {
|
|
3081
3117
|
this.options = e || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
3082
3118
|
}
|
|
@@ -3101,35 +3137,35 @@ function Gi() {
|
|
|
3101
3137
|
return $e(this.strategies, U.method("isSupported"));
|
|
3102
3138
|
}
|
|
3103
3139
|
connect(e, t) {
|
|
3104
|
-
var r = this.strategies,
|
|
3105
|
-
|
|
3140
|
+
var r = this.strategies, o = 0, c = this.timeout, l = null, p = (y, E) => {
|
|
3141
|
+
E ? t(null, E) : (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));
|
|
3106
3142
|
};
|
|
3107
|
-
return l = this.tryStrategy(r[
|
|
3143
|
+
return l = this.tryStrategy(r[o], e, { timeout: c, failFast: this.failFast }, p), {
|
|
3108
3144
|
abort: function() {
|
|
3109
3145
|
l.abort();
|
|
3110
3146
|
},
|
|
3111
|
-
forceMinPriority: function(
|
|
3112
|
-
e =
|
|
3147
|
+
forceMinPriority: function(y) {
|
|
3148
|
+
e = y, l && l.forceMinPriority(y);
|
|
3113
3149
|
}
|
|
3114
3150
|
};
|
|
3115
3151
|
}
|
|
3116
|
-
tryStrategy(e, t, r,
|
|
3152
|
+
tryStrategy(e, t, r, o) {
|
|
3117
3153
|
var c = null, l = null;
|
|
3118
|
-
return r.timeout > 0 && (c = new
|
|
3119
|
-
l.abort(),
|
|
3120
|
-
})), l = e.connect(t, function(
|
|
3121
|
-
|
|
3154
|
+
return r.timeout > 0 && (c = new Y(r.timeout, function() {
|
|
3155
|
+
l.abort(), o(!0);
|
|
3156
|
+
})), l = e.connect(t, function(p, y) {
|
|
3157
|
+
p && c && c.isRunning() && !r.failFast || (c && c.ensureAborted(), o(p, y));
|
|
3122
3158
|
}), {
|
|
3123
3159
|
abort: function() {
|
|
3124
3160
|
c && c.ensureAborted(), l.abort();
|
|
3125
3161
|
},
|
|
3126
|
-
forceMinPriority: function(
|
|
3127
|
-
l.forceMinPriority(
|
|
3162
|
+
forceMinPriority: function(p) {
|
|
3163
|
+
l.forceMinPriority(p);
|
|
3128
3164
|
}
|
|
3129
3165
|
};
|
|
3130
3166
|
}
|
|
3131
3167
|
}
|
|
3132
|
-
class
|
|
3168
|
+
class xe {
|
|
3133
3169
|
constructor(e) {
|
|
3134
3170
|
this.strategies = e;
|
|
3135
3171
|
}
|
|
@@ -3137,30 +3173,30 @@ function Gi() {
|
|
|
3137
3173
|
return $e(this.strategies, U.method("isSupported"));
|
|
3138
3174
|
}
|
|
3139
3175
|
connect(e, t) {
|
|
3140
|
-
return Rn(this.strategies, e, function(r,
|
|
3176
|
+
return Rn(this.strategies, e, function(r, o) {
|
|
3141
3177
|
return function(c, l) {
|
|
3142
|
-
if (
|
|
3143
|
-
In(
|
|
3178
|
+
if (o[r].error = c, c) {
|
|
3179
|
+
In(o) && t(!0);
|
|
3144
3180
|
return;
|
|
3145
3181
|
}
|
|
3146
|
-
ie(
|
|
3147
|
-
|
|
3182
|
+
ie(o, function(p) {
|
|
3183
|
+
p.forceMinPriority(l.transport.priority);
|
|
3148
3184
|
}), t(null, l);
|
|
3149
3185
|
};
|
|
3150
3186
|
});
|
|
3151
3187
|
}
|
|
3152
3188
|
}
|
|
3153
3189
|
function Rn(n, e, t) {
|
|
3154
|
-
var r =
|
|
3155
|
-
return
|
|
3190
|
+
var r = Fe(n, function(o, c, l, p) {
|
|
3191
|
+
return o.connect(e, t(c, p));
|
|
3156
3192
|
});
|
|
3157
3193
|
return {
|
|
3158
3194
|
abort: function() {
|
|
3159
3195
|
ie(r, On);
|
|
3160
3196
|
},
|
|
3161
|
-
forceMinPriority: function(
|
|
3197
|
+
forceMinPriority: function(o) {
|
|
3162
3198
|
ie(r, function(c) {
|
|
3163
|
-
c.forceMinPriority(
|
|
3199
|
+
c.forceMinPriority(o);
|
|
3164
3200
|
});
|
|
3165
3201
|
}
|
|
3166
3202
|
};
|
|
@@ -3181,39 +3217,39 @@ function Gi() {
|
|
|
3181
3217
|
return this.strategy.isSupported();
|
|
3182
3218
|
}
|
|
3183
3219
|
connect(e, t) {
|
|
3184
|
-
var r = this.usingTLS,
|
|
3185
|
-
if (
|
|
3186
|
-
var
|
|
3187
|
-
|
|
3220
|
+
var r = this.usingTLS, o = Un(r), c = o && o.cacheSkipCount ? o.cacheSkipCount : 0, l = [this.strategy];
|
|
3221
|
+
if (o && o.timestamp + this.ttl >= U.now()) {
|
|
3222
|
+
var p = this.transports[o.transport];
|
|
3223
|
+
p && (["ws", "wss"].includes(o.transport) || c > 3 ? (this.timeline.info({
|
|
3188
3224
|
cached: !0,
|
|
3189
|
-
transport:
|
|
3190
|
-
latency:
|
|
3191
|
-
}), l.push(new Q([
|
|
3192
|
-
timeout:
|
|
3225
|
+
transport: o.transport,
|
|
3226
|
+
latency: o.latency
|
|
3227
|
+
}), l.push(new Q([p], {
|
|
3228
|
+
timeout: o.latency * 2 + 1e3,
|
|
3193
3229
|
failFast: !0
|
|
3194
3230
|
}))) : c++);
|
|
3195
3231
|
}
|
|
3196
|
-
var
|
|
3197
|
-
I ? (Ze(r), l.length > 0 ? (
|
|
3232
|
+
var y = U.now(), E = l.pop().connect(e, function k(I, de) {
|
|
3233
|
+
I ? (Ze(r), l.length > 0 ? (y = U.now(), E = l.pop().connect(e, k)) : t(I)) : (Nn(r, de.transport.name, U.now() - y, c), t(null, de));
|
|
3198
3234
|
});
|
|
3199
3235
|
return {
|
|
3200
3236
|
abort: function() {
|
|
3201
|
-
|
|
3237
|
+
E.abort();
|
|
3202
3238
|
},
|
|
3203
|
-
forceMinPriority: function(
|
|
3204
|
-
e =
|
|
3239
|
+
forceMinPriority: function(k) {
|
|
3240
|
+
e = k, E && E.forceMinPriority(k);
|
|
3205
3241
|
}
|
|
3206
3242
|
};
|
|
3207
3243
|
}
|
|
3208
3244
|
}
|
|
3209
|
-
function
|
|
3245
|
+
function _e(n) {
|
|
3210
3246
|
return "pusherTransport" + (n ? "TLS" : "NonTLS");
|
|
3211
3247
|
}
|
|
3212
3248
|
function Un(n) {
|
|
3213
3249
|
var e = C.getLocalStorage();
|
|
3214
3250
|
if (e)
|
|
3215
3251
|
try {
|
|
3216
|
-
var t = e[
|
|
3252
|
+
var t = e[_e(n)];
|
|
3217
3253
|
if (t)
|
|
3218
3254
|
return JSON.parse(t);
|
|
3219
3255
|
} catch {
|
|
@@ -3221,11 +3257,11 @@ function Gi() {
|
|
|
3221
3257
|
}
|
|
3222
3258
|
return null;
|
|
3223
3259
|
}
|
|
3224
|
-
function
|
|
3225
|
-
var
|
|
3226
|
-
if (
|
|
3260
|
+
function Nn(n, e, t, r) {
|
|
3261
|
+
var o = C.getLocalStorage();
|
|
3262
|
+
if (o)
|
|
3227
3263
|
try {
|
|
3228
|
-
|
|
3264
|
+
o[_e(n)] = ae({
|
|
3229
3265
|
timestamp: U.now(),
|
|
3230
3266
|
transport: e,
|
|
3231
3267
|
latency: t,
|
|
@@ -3238,7 +3274,7 @@ function Gi() {
|
|
|
3238
3274
|
var e = C.getLocalStorage();
|
|
3239
3275
|
if (e)
|
|
3240
3276
|
try {
|
|
3241
|
-
delete e[
|
|
3277
|
+
delete e[_e(n)];
|
|
3242
3278
|
} catch {
|
|
3243
3279
|
}
|
|
3244
3280
|
}
|
|
@@ -3250,15 +3286,15 @@ function Gi() {
|
|
|
3250
3286
|
return this.strategy.isSupported();
|
|
3251
3287
|
}
|
|
3252
3288
|
connect(e, t) {
|
|
3253
|
-
var r = this.strategy,
|
|
3254
|
-
|
|
3289
|
+
var r = this.strategy, o, c = new Y(this.options.delay, function() {
|
|
3290
|
+
o = r.connect(e, t);
|
|
3255
3291
|
});
|
|
3256
3292
|
return {
|
|
3257
3293
|
abort: function() {
|
|
3258
|
-
c.ensureAborted(),
|
|
3294
|
+
c.ensureAborted(), o && o.abort();
|
|
3259
3295
|
},
|
|
3260
3296
|
forceMinPriority: function(l) {
|
|
3261
|
-
e = l,
|
|
3297
|
+
e = l, o && o.forceMinPriority(l);
|
|
3262
3298
|
}
|
|
3263
3299
|
};
|
|
3264
3300
|
}
|
|
@@ -3276,7 +3312,7 @@ function Gi() {
|
|
|
3276
3312
|
return r.connect(e, t);
|
|
3277
3313
|
}
|
|
3278
3314
|
}
|
|
3279
|
-
class
|
|
3315
|
+
class jn {
|
|
3280
3316
|
constructor(e) {
|
|
3281
3317
|
this.strategy = e;
|
|
3282
3318
|
}
|
|
@@ -3284,8 +3320,8 @@ function Gi() {
|
|
|
3284
3320
|
return this.strategy.isSupported();
|
|
3285
3321
|
}
|
|
3286
3322
|
connect(e, t) {
|
|
3287
|
-
var r = this.strategy.connect(e, function(
|
|
3288
|
-
c && r.abort(), t(
|
|
3323
|
+
var r = this.strategy.connect(e, function(o, c) {
|
|
3324
|
+
c && r.abort(), t(o, c);
|
|
3289
3325
|
});
|
|
3290
3326
|
return r;
|
|
3291
3327
|
}
|
|
@@ -3295,11 +3331,11 @@ function Gi() {
|
|
|
3295
3331
|
return n.isSupported();
|
|
3296
3332
|
};
|
|
3297
3333
|
}
|
|
3298
|
-
var
|
|
3334
|
+
var Mn = function(n, e, t) {
|
|
3299
3335
|
var r = {};
|
|
3300
|
-
function
|
|
3301
|
-
var
|
|
3302
|
-
return r[dt] =
|
|
3336
|
+
function o(dt, Ui, Ni, ji, Mi) {
|
|
3337
|
+
var ft = t(n, dt, Ui, Ni, ji, Mi);
|
|
3338
|
+
return r[dt] = ft, ft;
|
|
3303
3339
|
}
|
|
3304
3340
|
var c = Object.assign({}, e, {
|
|
3305
3341
|
hostNonTLS: n.wsHost + ":" + n.wsPort,
|
|
@@ -3307,54 +3343,54 @@ function Gi() {
|
|
|
3307
3343
|
httpPath: n.wsPath
|
|
3308
3344
|
}), l = Object.assign({}, c, {
|
|
3309
3345
|
useTLS: !0
|
|
3310
|
-
}),
|
|
3346
|
+
}), p = Object.assign({}, e, {
|
|
3311
3347
|
hostNonTLS: n.httpHost + ":" + n.httpPort,
|
|
3312
3348
|
hostTLS: n.httpHost + ":" + n.httpsPort,
|
|
3313
3349
|
httpPath: n.httpPath
|
|
3314
|
-
}),
|
|
3350
|
+
}), y = {
|
|
3315
3351
|
loop: !0,
|
|
3316
3352
|
timeout: 15e3,
|
|
3317
3353
|
timeoutLimit: 6e4
|
|
3318
|
-
},
|
|
3354
|
+
}, E = new Qe({
|
|
3319
3355
|
minPingDelay: 1e4,
|
|
3320
3356
|
maxPingDelay: n.activityTimeout
|
|
3321
|
-
}),
|
|
3357
|
+
}), k = new Qe({
|
|
3322
3358
|
lives: 2,
|
|
3323
3359
|
minPingDelay: 1e4,
|
|
3324
3360
|
maxPingDelay: n.activityTimeout
|
|
3325
|
-
}), I =
|
|
3361
|
+
}), I = o("ws", "ws", 3, c, E), de = o("wss", "ws", 3, l, E), Li = 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([I], y), Oi = new Q([de], y), qi = new Q([Li], y), ht = new Q([
|
|
3326
3362
|
new re(se(ot), ot, Ri)
|
|
3327
|
-
],
|
|
3363
|
+
], y), lt = new Q([
|
|
3328
3364
|
new re(se(at), at, Ii)
|
|
3329
|
-
],
|
|
3330
|
-
new re(se(ht), new
|
|
3365
|
+
], y), ut = new Q([
|
|
3366
|
+
new re(se(ht), new xe([
|
|
3331
3367
|
ht,
|
|
3332
3368
|
new he(lt, { delay: 4e3 })
|
|
3333
3369
|
]), lt)
|
|
3334
|
-
],
|
|
3335
|
-
return e.useTLS ?
|
|
3370
|
+
], y), Ae = new re(se(ut), ut, qi), Pe;
|
|
3371
|
+
return e.useTLS ? Pe = new xe([
|
|
3336
3372
|
ct,
|
|
3337
|
-
new he(
|
|
3338
|
-
]) :
|
|
3373
|
+
new he(Ae, { delay: 2e3 })
|
|
3374
|
+
]) : Pe = new xe([
|
|
3339
3375
|
ct,
|
|
3340
3376
|
new he(Oi, { delay: 2e3 }),
|
|
3341
|
-
new he(
|
|
3342
|
-
]), new qn(new
|
|
3377
|
+
new he(Ae, { delay: 5e3 })
|
|
3378
|
+
]), new qn(new jn(new re(se(I), Pe, Ae)), r, {
|
|
3343
3379
|
ttl: 18e5,
|
|
3344
3380
|
timeline: e.timeline,
|
|
3345
3381
|
useTLS: e.useTLS
|
|
3346
3382
|
});
|
|
3347
3383
|
};
|
|
3348
|
-
const
|
|
3349
|
-
function
|
|
3384
|
+
const zn = Mn;
|
|
3385
|
+
function Hn() {
|
|
3350
3386
|
var n = this;
|
|
3351
3387
|
n.timeline.info(n.buildTimelineMessage({
|
|
3352
3388
|
transport: n.name + (n.options.useTLS ? "s" : "")
|
|
3353
|
-
})), n.hooks.isInitialized() ? n.changeState("initialized") : n.hooks.file ? (n.changeState("initializing"),
|
|
3389
|
+
})), n.hooks.isInitialized() ? n.changeState("initialized") : n.hooks.file ? (n.changeState("initializing"), N.load(n.hooks.file, { useTLS: n.options.useTLS }, function(e, t) {
|
|
3354
3390
|
n.hooks.isInitialized() ? (n.changeState("initialized"), t(!0)) : (e && n.onError(e), n.onClose(), t(!1));
|
|
3355
3391
|
})) : n.onClose();
|
|
3356
3392
|
}
|
|
3357
|
-
var
|
|
3393
|
+
var Dn = {
|
|
3358
3394
|
getRequest: function(n) {
|
|
3359
3395
|
var e = new window.XDomainRequest();
|
|
3360
3396
|
return e.ontimeout = function() {
|
|
@@ -3371,7 +3407,7 @@ function Gi() {
|
|
|
3371
3407
|
n.ontimeout = n.onerror = n.onprogress = n.onload = null, n.abort();
|
|
3372
3408
|
}
|
|
3373
3409
|
};
|
|
3374
|
-
const
|
|
3410
|
+
const Fn = Dn, Wn = 256 * 1024;
|
|
3375
3411
|
class Bn extends $ {
|
|
3376
3412
|
constructor(e, t, r) {
|
|
3377
3413
|
super(), this.hooks = e, this.method = t, this.url = r;
|
|
@@ -3400,18 +3436,18 @@ function Gi() {
|
|
|
3400
3436
|
return r !== -1 ? (this.position += r + 1, t.slice(0, r)) : null;
|
|
3401
3437
|
}
|
|
3402
3438
|
isBufferTooLong(e) {
|
|
3403
|
-
return this.position === e.length && e.length >
|
|
3439
|
+
return this.position === e.length && e.length > Wn;
|
|
3404
3440
|
}
|
|
3405
3441
|
}
|
|
3406
|
-
var
|
|
3442
|
+
var Ee;
|
|
3407
3443
|
(function(n) {
|
|
3408
3444
|
n[n.CONNECTING = 0] = "CONNECTING", n[n.OPEN = 1] = "OPEN", n[n.CLOSED = 3] = "CLOSED";
|
|
3409
|
-
})(
|
|
3410
|
-
const
|
|
3445
|
+
})(Ee || (Ee = {}));
|
|
3446
|
+
const Z = Ee;
|
|
3411
3447
|
var $n = 1;
|
|
3412
3448
|
class Xn {
|
|
3413
3449
|
constructor(e, t) {
|
|
3414
|
-
this.hooks = e, this.session = tt(1e3) + "/" + Yn(8), this.location =
|
|
3450
|
+
this.hooks = e, this.session = tt(1e3) + "/" + Yn(8), this.location = Vn(t), this.readyState = Z.CONNECTING, this.openStream();
|
|
3415
3451
|
}
|
|
3416
3452
|
send(e) {
|
|
3417
3453
|
return this.sendRaw(JSON.stringify([e]));
|
|
@@ -3423,9 +3459,9 @@ function Gi() {
|
|
|
3423
3459
|
this.onClose(e, t, !0);
|
|
3424
3460
|
}
|
|
3425
3461
|
sendRaw(e) {
|
|
3426
|
-
if (this.readyState ===
|
|
3462
|
+
if (this.readyState === Z.OPEN)
|
|
3427
3463
|
try {
|
|
3428
|
-
return C.createSocketRequest("POST", et(
|
|
3464
|
+
return C.createSocketRequest("POST", et(Jn(this.location, this.session))).start(e), !0;
|
|
3429
3465
|
} catch {
|
|
3430
3466
|
return !1;
|
|
3431
3467
|
}
|
|
@@ -3436,7 +3472,7 @@ function Gi() {
|
|
|
3436
3472
|
this.closeStream(), this.openStream();
|
|
3437
3473
|
}
|
|
3438
3474
|
onClose(e, t, r) {
|
|
3439
|
-
this.closeStream(), this.readyState =
|
|
3475
|
+
this.closeStream(), this.readyState = Z.CLOSED, this.onclose && this.onclose({
|
|
3440
3476
|
code: e,
|
|
3441
3477
|
reason: t,
|
|
3442
3478
|
wasClean: r
|
|
@@ -3444,7 +3480,7 @@ function Gi() {
|
|
|
3444
3480
|
}
|
|
3445
3481
|
onChunk(e) {
|
|
3446
3482
|
if (e.status === 200) {
|
|
3447
|
-
this.readyState ===
|
|
3483
|
+
this.readyState === Z.OPEN && this.onActivity();
|
|
3448
3484
|
var t, r = e.data.slice(0, 1);
|
|
3449
3485
|
switch (r) {
|
|
3450
3486
|
case "o":
|
|
@@ -3452,8 +3488,8 @@ function Gi() {
|
|
|
3452
3488
|
break;
|
|
3453
3489
|
case "a":
|
|
3454
3490
|
t = JSON.parse(e.data.slice(1) || "[]");
|
|
3455
|
-
for (var
|
|
3456
|
-
this.onEvent(t[
|
|
3491
|
+
for (var o = 0; o < t.length; o++)
|
|
3492
|
+
this.onEvent(t[o]);
|
|
3457
3493
|
break;
|
|
3458
3494
|
case "m":
|
|
3459
3495
|
t = JSON.parse(e.data.slice(1) || "null"), this.onEvent(t);
|
|
@@ -3468,10 +3504,10 @@ function Gi() {
|
|
|
3468
3504
|
}
|
|
3469
3505
|
}
|
|
3470
3506
|
onOpen(e) {
|
|
3471
|
-
this.readyState ===
|
|
3507
|
+
this.readyState === Z.CONNECTING ? (e && e.hostname && (this.location.base = Gn(this.location.base, e.hostname)), this.readyState = Z.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
3472
3508
|
}
|
|
3473
3509
|
onEvent(e) {
|
|
3474
|
-
this.readyState ===
|
|
3510
|
+
this.readyState === Z.OPEN && this.onmessage && this.onmessage({ data: e });
|
|
3475
3511
|
}
|
|
3476
3512
|
onActivity() {
|
|
3477
3513
|
this.onactivity && this.onactivity();
|
|
@@ -3499,14 +3535,14 @@ function Gi() {
|
|
|
3499
3535
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
3500
3536
|
}
|
|
3501
3537
|
}
|
|
3502
|
-
function
|
|
3538
|
+
function Vn(n) {
|
|
3503
3539
|
var e = /([^\?]*)\/*(\??.*)/.exec(n);
|
|
3504
3540
|
return {
|
|
3505
3541
|
base: e[1],
|
|
3506
3542
|
queryString: e[2]
|
|
3507
3543
|
};
|
|
3508
3544
|
}
|
|
3509
|
-
function
|
|
3545
|
+
function Jn(n, e) {
|
|
3510
3546
|
return n.base + "/" + e + "/xhr_send";
|
|
3511
3547
|
}
|
|
3512
3548
|
function et(n) {
|
|
@@ -3525,8 +3561,8 @@ function Gi() {
|
|
|
3525
3561
|
e.push(tt(32).toString(32));
|
|
3526
3562
|
return e.join("");
|
|
3527
3563
|
}
|
|
3528
|
-
const
|
|
3529
|
-
var
|
|
3564
|
+
const Kn = Xn;
|
|
3565
|
+
var Qn = {
|
|
3530
3566
|
getReceiveURL: function(n, e) {
|
|
3531
3567
|
return n.base + "/" + e + "/xhr_streaming" + n.queryString;
|
|
3532
3568
|
},
|
|
@@ -3540,7 +3576,7 @@ function Gi() {
|
|
|
3540
3576
|
n.onClose(1006, "Connection interrupted (" + e + ")", !1);
|
|
3541
3577
|
}
|
|
3542
3578
|
};
|
|
3543
|
-
const Zn =
|
|
3579
|
+
const Zn = Qn;
|
|
3544
3580
|
var ei = {
|
|
3545
3581
|
getReceiveURL: function(n, e) {
|
|
3546
3582
|
return n.base + "/" + e + "/xhr" + n.queryString;
|
|
@@ -3582,7 +3618,7 @@ function Gi() {
|
|
|
3582
3618
|
return this.createSocket(ti, n);
|
|
3583
3619
|
},
|
|
3584
3620
|
createSocket(n, e) {
|
|
3585
|
-
return new
|
|
3621
|
+
return new Kn(n, e);
|
|
3586
3622
|
},
|
|
3587
3623
|
createXHR(n, e) {
|
|
3588
3624
|
return this.createRequest(ii, n, e);
|
|
@@ -3593,16 +3629,16 @@ function Gi() {
|
|
|
3593
3629
|
};
|
|
3594
3630
|
const nt = ri;
|
|
3595
3631
|
nt.createXDR = function(n, e) {
|
|
3596
|
-
return this.createRequest(
|
|
3632
|
+
return this.createRequest(Fn, n, e);
|
|
3597
3633
|
};
|
|
3598
3634
|
var si = {
|
|
3599
3635
|
nextAuthCallbackID: 1,
|
|
3600
3636
|
auth_callbacks: {},
|
|
3601
3637
|
ScriptReceivers: w,
|
|
3602
|
-
DependenciesReceivers:
|
|
3603
|
-
getDefaultStrategy:
|
|
3638
|
+
DependenciesReceivers: F,
|
|
3639
|
+
getDefaultStrategy: zn,
|
|
3604
3640
|
Transports: mn,
|
|
3605
|
-
transportConnectionInitializer:
|
|
3641
|
+
transportConnectionInitializer: Hn,
|
|
3606
3642
|
HTTPFactory: nt,
|
|
3607
3643
|
TimelineTransport: tn,
|
|
3608
3644
|
getXHRAPI() {
|
|
@@ -3616,7 +3652,7 @@ function Gi() {
|
|
|
3616
3652
|
var e = () => {
|
|
3617
3653
|
this.onDocumentBody(n.ready);
|
|
3618
3654
|
};
|
|
3619
|
-
window.JSON ? e() :
|
|
3655
|
+
window.JSON ? e() : N.load("json2", {}, e);
|
|
3620
3656
|
},
|
|
3621
3657
|
getDocument() {
|
|
3622
3658
|
return document;
|
|
@@ -3633,10 +3669,10 @@ function Gi() {
|
|
|
3633
3669
|
}, 0);
|
|
3634
3670
|
},
|
|
3635
3671
|
createJSONPRequest(n, e) {
|
|
3636
|
-
return new
|
|
3672
|
+
return new Qt(n, e);
|
|
3637
3673
|
},
|
|
3638
3674
|
createScriptRequest(n) {
|
|
3639
|
-
return new
|
|
3675
|
+
return new Kt(n);
|
|
3640
3676
|
},
|
|
3641
3677
|
getLocalStorage() {
|
|
3642
3678
|
try {
|
|
@@ -3690,17 +3726,17 @@ function Gi() {
|
|
|
3690
3726
|
}
|
|
3691
3727
|
};
|
|
3692
3728
|
const C = si;
|
|
3693
|
-
var
|
|
3729
|
+
var ke;
|
|
3694
3730
|
(function(n) {
|
|
3695
3731
|
n[n.ERROR = 3] = "ERROR", n[n.INFO = 6] = "INFO", n[n.DEBUG = 7] = "DEBUG";
|
|
3696
|
-
})(
|
|
3697
|
-
const le =
|
|
3732
|
+
})(ke || (ke = {}));
|
|
3733
|
+
const le = ke;
|
|
3698
3734
|
class oi {
|
|
3699
3735
|
constructor(e, t, r) {
|
|
3700
3736
|
this.key = e, this.session = t, this.events = [], this.options = r || {}, this.sent = 0, this.uniqueID = 0;
|
|
3701
3737
|
}
|
|
3702
3738
|
log(e, t) {
|
|
3703
|
-
e <= this.options.level && (this.events.push(
|
|
3739
|
+
e <= this.options.level && (this.events.push(M({}, t, { timestamp: U.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
3704
3740
|
}
|
|
3705
3741
|
error(e) {
|
|
3706
3742
|
this.log(le.ERROR, e);
|
|
@@ -3715,7 +3751,7 @@ function Gi() {
|
|
|
3715
3751
|
return this.events.length === 0;
|
|
3716
3752
|
}
|
|
3717
3753
|
send(e, t) {
|
|
3718
|
-
var r =
|
|
3754
|
+
var r = M({
|
|
3719
3755
|
session: this.session,
|
|
3720
3756
|
bundle: this.sent + 1,
|
|
3721
3757
|
key: this.key,
|
|
@@ -3725,8 +3761,8 @@ function Gi() {
|
|
|
3725
3761
|
features: this.options.features,
|
|
3726
3762
|
timeline: this.events
|
|
3727
3763
|
}, this.options.params);
|
|
3728
|
-
return this.events = [], e(r, (
|
|
3729
|
-
|
|
3764
|
+
return this.events = [], e(r, (o, c) => {
|
|
3765
|
+
o || this.sent++, t && t(o, c);
|
|
3730
3766
|
}), !0;
|
|
3731
3767
|
}
|
|
3732
3768
|
generateUniqueID() {
|
|
@@ -3734,8 +3770,8 @@ function Gi() {
|
|
|
3734
3770
|
}
|
|
3735
3771
|
}
|
|
3736
3772
|
class ai {
|
|
3737
|
-
constructor(e, t, r,
|
|
3738
|
-
this.name = e, this.priority = t, this.transport = r, this.options =
|
|
3773
|
+
constructor(e, t, r, o) {
|
|
3774
|
+
this.name = e, this.priority = t, this.transport = r, this.options = o || {};
|
|
3739
3775
|
}
|
|
3740
3776
|
isSupported() {
|
|
3741
3777
|
return this.transport.isSupported({
|
|
@@ -3746,28 +3782,28 @@ function Gi() {
|
|
|
3746
3782
|
if (this.isSupported()) {
|
|
3747
3783
|
if (this.priority < e)
|
|
3748
3784
|
return it(new q(), t);
|
|
3749
|
-
} else return it(new
|
|
3750
|
-
var r = !1,
|
|
3751
|
-
|
|
3752
|
-
},
|
|
3753
|
-
c = X.createHandshake(
|
|
3754
|
-
r = !0,
|
|
3785
|
+
} else return it(new D(), t);
|
|
3786
|
+
var r = !1, o = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), c = null, l = function() {
|
|
3787
|
+
o.unbind("initialized", l), o.connect();
|
|
3788
|
+
}, p = function() {
|
|
3789
|
+
c = X.createHandshake(o, function(I) {
|
|
3790
|
+
r = !0, k(), t(null, I);
|
|
3755
3791
|
});
|
|
3756
|
-
},
|
|
3757
|
-
|
|
3758
|
-
}, k = function() {
|
|
3759
|
-
E();
|
|
3760
|
-
var I;
|
|
3761
|
-
I = ae(s), t(new N(I));
|
|
3792
|
+
}, y = function(I) {
|
|
3793
|
+
k(), t(I);
|
|
3762
3794
|
}, E = function() {
|
|
3763
|
-
|
|
3795
|
+
k();
|
|
3796
|
+
var I;
|
|
3797
|
+
I = ae(o), t(new j(I));
|
|
3798
|
+
}, k = function() {
|
|
3799
|
+
o.unbind("initialized", l), o.unbind("open", p), o.unbind("error", y), o.unbind("closed", E);
|
|
3764
3800
|
};
|
|
3765
|
-
return
|
|
3801
|
+
return o.bind("initialized", l), o.bind("open", p), o.bind("error", y), o.bind("closed", E), o.initialize(), {
|
|
3766
3802
|
abort: () => {
|
|
3767
|
-
r || (
|
|
3803
|
+
r || (k(), c ? c.close() : o.close());
|
|
3768
3804
|
},
|
|
3769
3805
|
forceMinPriority: (I) => {
|
|
3770
|
-
r || this.priority < I && (c ? c.close() :
|
|
3806
|
+
r || this.priority < I && (c ? c.close() : o.close());
|
|
3771
3807
|
}
|
|
3772
3808
|
};
|
|
3773
3809
|
}
|
|
@@ -3783,19 +3819,19 @@ function Gi() {
|
|
|
3783
3819
|
};
|
|
3784
3820
|
}
|
|
3785
3821
|
const { Transports: ci } = C;
|
|
3786
|
-
var hi = function(n, e, t, r,
|
|
3822
|
+
var hi = function(n, e, t, r, o, c) {
|
|
3787
3823
|
var l = ci[t];
|
|
3788
3824
|
if (!l)
|
|
3789
3825
|
throw new J(t);
|
|
3790
|
-
var
|
|
3791
|
-
return
|
|
3826
|
+
var p = (!n.enabledTransports || He(n.enabledTransports, e) !== -1) && (!n.disabledTransports || He(n.disabledTransports, e) === -1), y;
|
|
3827
|
+
return p ? (o = Object.assign({ ignoreNullOrigin: n.ignoreNullOrigin }, o), y = new ai(e, r, c ? c.getAssistant(l) : l, o)) : y = li, y;
|
|
3792
3828
|
}, li = {
|
|
3793
3829
|
isSupported: function() {
|
|
3794
3830
|
return !1;
|
|
3795
3831
|
},
|
|
3796
3832
|
connect: function(n, e) {
|
|
3797
3833
|
var t = U.defer(function() {
|
|
3798
|
-
e(new
|
|
3834
|
+
e(new D());
|
|
3799
3835
|
});
|
|
3800
3836
|
return {
|
|
3801
3837
|
abort: function() {
|
|
@@ -3818,34 +3854,34 @@ function Gi() {
|
|
|
3818
3854
|
for (var r in e.params)
|
|
3819
3855
|
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e.params[r]);
|
|
3820
3856
|
if (e.paramsProvider != null) {
|
|
3821
|
-
let
|
|
3822
|
-
for (var r in
|
|
3823
|
-
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(
|
|
3857
|
+
let o = e.paramsProvider();
|
|
3858
|
+
for (var r in o)
|
|
3859
|
+
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(o[r]);
|
|
3824
3860
|
}
|
|
3825
3861
|
return t;
|
|
3826
|
-
},
|
|
3862
|
+
}, fi = (n) => {
|
|
3827
3863
|
if (typeof C.getAuthorizers()[n.transport] > "u")
|
|
3828
3864
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3829
3865
|
return (e, t) => {
|
|
3830
3866
|
const r = di(e, n);
|
|
3831
3867
|
C.getAuthorizers()[n.transport](C, r, n, d.UserAuthentication, t);
|
|
3832
3868
|
};
|
|
3833
|
-
},
|
|
3869
|
+
}, pi = (n, e) => {
|
|
3834
3870
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
3835
3871
|
t += "&channel_name=" + encodeURIComponent(n.channelName);
|
|
3836
3872
|
for (var r in e.params)
|
|
3837
3873
|
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e.params[r]);
|
|
3838
3874
|
if (e.paramsProvider != null) {
|
|
3839
|
-
let
|
|
3840
|
-
for (var r in
|
|
3841
|
-
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(
|
|
3875
|
+
let o = e.paramsProvider();
|
|
3876
|
+
for (var r in o)
|
|
3877
|
+
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(o[r]);
|
|
3842
3878
|
}
|
|
3843
3879
|
return t;
|
|
3844
3880
|
}, mi = (n) => {
|
|
3845
3881
|
if (typeof C.getAuthorizers()[n.transport] > "u")
|
|
3846
3882
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3847
3883
|
return (e, t) => {
|
|
3848
|
-
const r =
|
|
3884
|
+
const r = pi(e, n);
|
|
3849
3885
|
C.getAuthorizers()[n.transport](C, r, n, d.ChannelAuthorization, t);
|
|
3850
3886
|
};
|
|
3851
3887
|
}, gi = (n, e, t) => {
|
|
@@ -3857,9 +3893,9 @@ function Gi() {
|
|
|
3857
3893
|
headers: e.headers
|
|
3858
3894
|
}
|
|
3859
3895
|
};
|
|
3860
|
-
return (
|
|
3861
|
-
const l = n.channel(
|
|
3862
|
-
t(l, r).authorize(
|
|
3896
|
+
return (o, c) => {
|
|
3897
|
+
const l = n.channel(o.channelName);
|
|
3898
|
+
t(l, r).authorize(o.socketId, c);
|
|
3863
3899
|
};
|
|
3864
3900
|
};
|
|
3865
3901
|
function rt(n, e) {
|
|
@@ -3878,19 +3914,19 @@ function Gi() {
|
|
|
3878
3914
|
enableStats: Ci(n),
|
|
3879
3915
|
httpHost: vi(n),
|
|
3880
3916
|
useTLS: wi(n),
|
|
3881
|
-
wsHost:
|
|
3917
|
+
wsHost: bi(n),
|
|
3882
3918
|
userAuthenticator: Si(n),
|
|
3883
|
-
channelAuthorizer:
|
|
3919
|
+
channelAuthorizer: xi(n, e)
|
|
3884
3920
|
};
|
|
3885
3921
|
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;
|
|
3886
3922
|
}
|
|
3887
3923
|
function vi(n) {
|
|
3888
3924
|
return n.httpHost ? n.httpHost : n.cluster ? `sockjs-${n.cluster}.pusher.com` : T.httpHost;
|
|
3889
3925
|
}
|
|
3890
|
-
function yi(n) {
|
|
3891
|
-
return n.wsHost ? n.wsHost : bi(n.cluster);
|
|
3892
|
-
}
|
|
3893
3926
|
function bi(n) {
|
|
3927
|
+
return n.wsHost ? n.wsHost : yi(n.cluster);
|
|
3928
|
+
}
|
|
3929
|
+
function yi(n) {
|
|
3894
3930
|
return `ws-${n}.pusher.com`;
|
|
3895
3931
|
}
|
|
3896
3932
|
function wi(n) {
|
|
@@ -3902,7 +3938,7 @@ function Gi() {
|
|
|
3902
3938
|
const st = (n) => "customHandler" in n && n.customHandler != null;
|
|
3903
3939
|
function Si(n) {
|
|
3904
3940
|
const e = Object.assign(Object.assign({}, T.userAuthentication), n.userAuthentication);
|
|
3905
|
-
return st(e) ? e.customHandler :
|
|
3941
|
+
return st(e) ? e.customHandler : fi(e);
|
|
3906
3942
|
}
|
|
3907
3943
|
function Ti(n, e) {
|
|
3908
3944
|
let t;
|
|
@@ -3917,11 +3953,11 @@ function Gi() {
|
|
|
3917
3953
|
};
|
|
3918
3954
|
return t;
|
|
3919
3955
|
}
|
|
3920
|
-
function
|
|
3956
|
+
function xi(n, e) {
|
|
3921
3957
|
const t = Ti(n, e);
|
|
3922
3958
|
return st(t) ? t.customHandler : mi(t);
|
|
3923
3959
|
}
|
|
3924
|
-
class
|
|
3960
|
+
class _i extends $ {
|
|
3925
3961
|
constructor(e) {
|
|
3926
3962
|
super(function(t, r) {
|
|
3927
3963
|
L.debug(`No callbacks on watchlist events for ${t}`);
|
|
@@ -3939,13 +3975,13 @@ function Gi() {
|
|
|
3939
3975
|
});
|
|
3940
3976
|
}
|
|
3941
3977
|
}
|
|
3942
|
-
function
|
|
3978
|
+
function Ei() {
|
|
3943
3979
|
let n, e;
|
|
3944
|
-
return { promise: new Promise((r,
|
|
3945
|
-
n = r, e =
|
|
3980
|
+
return { promise: new Promise((r, o) => {
|
|
3981
|
+
n = r, e = o;
|
|
3946
3982
|
}), resolve: n, reject: e };
|
|
3947
3983
|
}
|
|
3948
|
-
const
|
|
3984
|
+
const ki = Ei;
|
|
3949
3985
|
class Ai extends $ {
|
|
3950
3986
|
constructor(e) {
|
|
3951
3987
|
super(function(t, r) {
|
|
@@ -3961,7 +3997,7 @@ function Gi() {
|
|
|
3961
3997
|
});
|
|
3962
3998
|
}, this.pusher = e, this.pusher.connection.bind("state_change", ({ previous: t, current: r }) => {
|
|
3963
3999
|
t !== "connected" && r === "connected" && this._signin(), t === "connected" && r !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
3964
|
-
}), this.watchlist = new
|
|
4000
|
+
}), this.watchlist = new _i(e), this.pusher.connection.bind("message", (t) => {
|
|
3965
4001
|
var r = t.event;
|
|
3966
4002
|
r === "pusher:signin_success" && this._onSigninSuccess(t.data), this.serverToUserChannel && this.serverToUserChannel.name === t.channel && this.serverToUserChannel.handleEvent(t);
|
|
3967
4003
|
});
|
|
@@ -3991,7 +4027,7 @@ function Gi() {
|
|
|
3991
4027
|
const e = (t) => {
|
|
3992
4028
|
t.subscriptionPending && t.subscriptionCancelled ? t.reinstateSubscription() : !t.subscriptionPending && this.pusher.connection.state === "connected" && t.subscribe();
|
|
3993
4029
|
};
|
|
3994
|
-
this.serverToUserChannel = new
|
|
4030
|
+
this.serverToUserChannel = new Ce(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((t, r) => {
|
|
3995
4031
|
t.indexOf("pusher_internal:") === 0 || t.indexOf("pusher:") === 0 || this.emit(t, r);
|
|
3996
4032
|
}), e(this.serverToUserChannel);
|
|
3997
4033
|
}
|
|
@@ -4001,7 +4037,7 @@ function Gi() {
|
|
|
4001
4037
|
_newSigninPromiseIfNeeded() {
|
|
4002
4038
|
if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done)
|
|
4003
4039
|
return;
|
|
4004
|
-
const { promise: e, resolve: t } =
|
|
4040
|
+
const { promise: e, resolve: t } = ki();
|
|
4005
4041
|
e.done = !1;
|
|
4006
4042
|
const r = () => {
|
|
4007
4043
|
e.done = !0;
|
|
@@ -4016,7 +4052,7 @@ function Gi() {
|
|
|
4016
4052
|
O.instances[e].connect();
|
|
4017
4053
|
}
|
|
4018
4054
|
static getClientFeatures() {
|
|
4019
|
-
return
|
|
4055
|
+
return De(Be({ ws: C.Transports.ws }, function(e) {
|
|
4020
4056
|
return e.isSupported({});
|
|
4021
4057
|
}));
|
|
4022
4058
|
}
|
|
@@ -4032,7 +4068,7 @@ function Gi() {
|
|
|
4032
4068
|
host: this.config.statsHost,
|
|
4033
4069
|
path: "/timeline/v2/" + C.TimelineTransport.name
|
|
4034
4070
|
}));
|
|
4035
|
-
var r = (
|
|
4071
|
+
var r = (o) => C.getDefaultStrategy(this.config, o, hi);
|
|
4036
4072
|
this.connection = X.createConnectionManager(this.key, {
|
|
4037
4073
|
getStrategy: r,
|
|
4038
4074
|
timeline: this.timeline,
|
|
@@ -4042,19 +4078,19 @@ function Gi() {
|
|
|
4042
4078
|
useTLS: !!this.config.useTLS
|
|
4043
4079
|
}), this.connection.bind("connected", () => {
|
|
4044
4080
|
this.subscribeAll(), this.timelineSender && this.timelineSender.send(this.connection.isUsingTLS());
|
|
4045
|
-
}), this.connection.bind("message", (
|
|
4046
|
-
var c =
|
|
4047
|
-
if (
|
|
4048
|
-
var
|
|
4049
|
-
|
|
4081
|
+
}), this.connection.bind("message", (o) => {
|
|
4082
|
+
var c = o.event, l = c.indexOf("pusher_internal:") === 0;
|
|
4083
|
+
if (o.channel) {
|
|
4084
|
+
var p = this.channel(o.channel);
|
|
4085
|
+
p && p.handleEvent(o);
|
|
4050
4086
|
}
|
|
4051
|
-
l || this.global_emitter.emit(
|
|
4087
|
+
l || this.global_emitter.emit(o.event, o.data);
|
|
4052
4088
|
}), this.connection.bind("connecting", () => {
|
|
4053
4089
|
this.channels.disconnect();
|
|
4054
4090
|
}), this.connection.bind("disconnected", () => {
|
|
4055
4091
|
this.channels.disconnect();
|
|
4056
|
-
}), this.connection.bind("error", (
|
|
4057
|
-
L.warn(
|
|
4092
|
+
}), this.connection.bind("error", (o) => {
|
|
4093
|
+
L.warn(o);
|
|
4058
4094
|
}), O.instances.push(this), this.timeline.info({ instances: O.instances.length }), this.user = new Ai(this), O.isReady && this.connect();
|
|
4059
4095
|
}
|
|
4060
4096
|
switchCluster(e) {
|
|
@@ -4070,7 +4106,7 @@ function Gi() {
|
|
|
4070
4106
|
connect() {
|
|
4071
4107
|
if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
|
|
4072
4108
|
var e = this.connection.isUsingTLS(), t = this.timelineSender;
|
|
4073
|
-
this.timelineSenderTimer = new
|
|
4109
|
+
this.timelineSenderTimer = new Mt(6e4, function() {
|
|
4074
4110
|
t.send(e);
|
|
4075
4111
|
});
|
|
4076
4112
|
}
|
|
@@ -4130,7 +4166,7 @@ function Gi() {
|
|
|
4130
4166
|
var g = a[m];
|
|
4131
4167
|
if (g !== void 0)
|
|
4132
4168
|
return g.exports;
|
|
4133
|
-
var
|
|
4169
|
+
var b = a[m] = {
|
|
4134
4170
|
/******/
|
|
4135
4171
|
// no module.id needed
|
|
4136
4172
|
/******/
|
|
@@ -4139,20 +4175,20 @@ function Gi() {
|
|
|
4139
4175
|
exports: {}
|
|
4140
4176
|
/******/
|
|
4141
4177
|
};
|
|
4142
|
-
return
|
|
4178
|
+
return s[m].call(b.exports, b, b.exports, h), b.exports;
|
|
4143
4179
|
}
|
|
4144
4180
|
h.d = (m, g) => {
|
|
4145
|
-
for (var
|
|
4146
|
-
h.o(g,
|
|
4181
|
+
for (var b in g)
|
|
4182
|
+
h.o(g, b) && !h.o(m, b) && Object.defineProperty(m, b, { enumerable: !0, get: g[b] });
|
|
4147
4183
|
}, h.o = (m, g) => Object.prototype.hasOwnProperty.call(m, g);
|
|
4148
4184
|
var u = h(721);
|
|
4149
4185
|
return u;
|
|
4150
4186
|
})()
|
|
4151
4187
|
));
|
|
4152
|
-
})(
|
|
4188
|
+
})(Le)), Le.exports;
|
|
4153
4189
|
}
|
|
4154
4190
|
var Yi = Gi();
|
|
4155
|
-
const
|
|
4191
|
+
const Ki = /* @__PURE__ */ Ji(Yi), Re = "/vendor/sendity-client/tailwind.css", Qi = {
|
|
4156
4192
|
labels: {
|
|
4157
4193
|
email: "Email",
|
|
4158
4194
|
whatsapp: "WhatsApp"
|
|
@@ -4163,7 +4199,9 @@ const Qi = /* @__PURE__ */ Vi(Yi), Pe = "/vendor/sendity-client/tailwind.css", K
|
|
|
4163
4199
|
by: "by",
|
|
4164
4200
|
toPrefix: "to",
|
|
4165
4201
|
footerWaiting: "Ready to receive your code…",
|
|
4166
|
-
footerWaitingUntil: "Ready to receive your code…"
|
|
4202
|
+
footerWaitingUntil: "Ready to receive your code…",
|
|
4203
|
+
codeExpired: "Code expired, request a new one.",
|
|
4204
|
+
getNewCode: "Get new code"
|
|
4167
4205
|
},
|
|
4168
4206
|
templates: {
|
|
4169
4207
|
emailSubject: "Sign me into (Host) with this code: (Code)",
|
|
@@ -4183,7 +4221,9 @@ Code: (Code)`,
|
|
|
4183
4221
|
by: "per",
|
|
4184
4222
|
toPrefix: "an",
|
|
4185
4223
|
footerWaiting: "Bereit zum Empfangen Deines Codes …",
|
|
4186
|
-
footerWaitingUntil: "Bereit zum Empfangen Deines Codes …"
|
|
4224
|
+
footerWaitingUntil: "Bereit zum Empfangen Deines Codes …",
|
|
4225
|
+
codeExpired: "Code abgelaufen, fordere einen neuen an.",
|
|
4226
|
+
getNewCode: "Neuen Code anfordern"
|
|
4187
4227
|
},
|
|
4188
4228
|
templates: {
|
|
4189
4229
|
emailSubject: "Melde mich bei (Host) mit diesem Code an: (Code)",
|
|
@@ -4203,7 +4243,9 @@ Code: (Code)`,
|
|
|
4203
4243
|
by: "par",
|
|
4204
4244
|
toPrefix: "à",
|
|
4205
4245
|
footerWaiting: "Prêt à recevoir votre code…",
|
|
4206
|
-
footerWaitingUntil: "Prêt à recevoir votre code…"
|
|
4246
|
+
footerWaitingUntil: "Prêt à recevoir votre code…",
|
|
4247
|
+
codeExpired: "Code expiré, demandez-en un nouveau.",
|
|
4248
|
+
getNewCode: "Nouveau code"
|
|
4207
4249
|
},
|
|
4208
4250
|
templates: {
|
|
4209
4251
|
emailSubject: "Connectez-moi à (Host) avec ce code : (Code)",
|
|
@@ -4213,66 +4255,66 @@ Code : (Code)`,
|
|
|
4213
4255
|
whatsappText: "Connectez-moi à (Host) avec ce code : (Code)"
|
|
4214
4256
|
}
|
|
4215
4257
|
};
|
|
4216
|
-
function
|
|
4258
|
+
function V(v) {
|
|
4217
4259
|
switch (v) {
|
|
4218
4260
|
case "de":
|
|
4219
4261
|
return Zi;
|
|
4220
4262
|
case "fr":
|
|
4221
4263
|
return er;
|
|
4222
4264
|
default:
|
|
4223
|
-
return
|
|
4265
|
+
return Qi;
|
|
4224
4266
|
}
|
|
4225
4267
|
}
|
|
4226
4268
|
const vt = `<svg role="img" viewBox="0 0 512 512" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>Email</title><path d="M64 112c-8.8 0-16 7.2-16 16l0 22.1L220.5 291.7c20.7 17 50.4 17 71.1 0L464 150.1l0-22.1c0-8.8-7.2-16-16-16L64 112zM48 212.2L48 384c0 8.8 7.2 16 16 16l384 0c8.8 0 16-7.2 16-16l0-171.8L322 328.8c-38.4 31.5-93.7 31.5-132 0L48 212.2zM0 128C0 92.7 28.7 64 64 64l384 0c35.3 0 64 28.7 64 64l0 256c0 35.3-28.7 64-64 64L64 448c-35.3 0-64-28.7-64-64L0 128z"/></svg>
|
|
4227
|
-
`,
|
|
4228
|
-
function
|
|
4269
|
+
`, bt = '<svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>WhatsApp</title><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>', tr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.998 9.332A5.002 5.002 0 0 1 13.2 5.5H11a1 1 0 1 0 0 2h4.5a1 1 0 0 0 1-1V2a1 1 0 1 0-2 0v1.74A7.002 7.002 0 0 0 3 9.332a1 1 0 1 0 1.998 0ZM15.002 10.668A5.002 5.002 0 0 1 6.8 14.5H9a1 1 0 1 0 0-2H4.5a1 1 0 0 0-1 1V18a1 1 0 1 0 2 0v-1.74a7.002 7.002 0 0 0 11.5-5.592 1 1 0 1 0-1.998 0Z" clip-rule="evenodd" /></svg>', je = "sendityAuthRequest", nr = "https://sendity.io/api", ir = ["mailto:verify@sendity.io"], rr = 600 * 1e3, sr = 5e3, or = 15e3, Ie = 2e3, pe = 220, At = 0;
|
|
4270
|
+
function Me(v, i) {
|
|
4229
4271
|
return `sendity:auth-request:${encodeURIComponent(v)}:${encodeURIComponent(i)}`;
|
|
4230
4272
|
}
|
|
4231
|
-
function
|
|
4232
|
-
v.removeItem(
|
|
4233
|
-
const h =
|
|
4273
|
+
function yt(v, i, s, a = Date.now()) {
|
|
4274
|
+
v.removeItem(je);
|
|
4275
|
+
const h = Me(i, s), u = v.getItem(h);
|
|
4234
4276
|
if (!u) return null;
|
|
4235
4277
|
try {
|
|
4236
4278
|
const m = JSON.parse(u);
|
|
4237
4279
|
if (typeof m.id != "string" || typeof m.clientSecret != "string" || typeof m.createdAt != "number")
|
|
4238
4280
|
throw new Error("invalid stored auth request");
|
|
4239
|
-
return a - m.createdAt >=
|
|
4281
|
+
return a - m.createdAt >= rr ? (v.removeItem(h), null) : { id: m.id, clientSecret: m.clientSecret };
|
|
4240
4282
|
} catch {
|
|
4241
4283
|
return v.removeItem(h), null;
|
|
4242
4284
|
}
|
|
4243
4285
|
}
|
|
4244
|
-
function
|
|
4245
|
-
v.setItem(
|
|
4286
|
+
function ar(v, i, s, a, h = Date.now()) {
|
|
4287
|
+
v.setItem(Me(i, s), JSON.stringify({ ...a, createdAt: h }));
|
|
4246
4288
|
}
|
|
4247
|
-
function wt(v, i,
|
|
4248
|
-
v.removeItem(
|
|
4289
|
+
function wt(v, i, s) {
|
|
4290
|
+
v.removeItem(Me(i, s)), v.removeItem(je);
|
|
4249
4291
|
}
|
|
4250
|
-
function
|
|
4251
|
-
return window.localStorage.removeItem(
|
|
4292
|
+
function me() {
|
|
4293
|
+
return window.localStorage.removeItem(je), window.sessionStorage;
|
|
4252
4294
|
}
|
|
4253
|
-
function
|
|
4254
|
-
return v.filter((
|
|
4295
|
+
function cr(v, i = window.location.origin) {
|
|
4296
|
+
return v.filter((s) => hr(s, i));
|
|
4255
4297
|
}
|
|
4256
|
-
function
|
|
4298
|
+
function hr(v, i) {
|
|
4257
4299
|
try {
|
|
4258
|
-
const
|
|
4259
|
-
return ["http:", "https:", "mailto:", "whatsapp:"].includes(
|
|
4300
|
+
const s = new URL(v, i);
|
|
4301
|
+
return ["http:", "https:", "mailto:", "whatsapp:"].includes(s.protocol);
|
|
4260
4302
|
} catch {
|
|
4261
4303
|
return !1;
|
|
4262
4304
|
}
|
|
4263
4305
|
}
|
|
4264
|
-
function
|
|
4265
|
-
return v === "push" ? { start: !1, delayMs: 0 } : v === "polling" || !i || !
|
|
4306
|
+
function lr(v, i, s) {
|
|
4307
|
+
return v === "push" ? { start: !1, delayMs: 0 } : v === "polling" || !i || !s ? { start: !0, delayMs: 0 } : { start: !0, delayMs: At };
|
|
4266
4308
|
}
|
|
4267
|
-
const
|
|
4309
|
+
const ve = class ve extends HTMLElement {
|
|
4268
4310
|
constructor() {
|
|
4269
|
-
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = null, this.codeContainerEl = null, this.codeEl = null, this.promptEl = null, this.successEl = null, this.spinnerEl = null, this.verifiersEl = null, this.footerEl = null, this.footerBrandEl = null, this.footerStatusEl = null, this.footerMessageEl = null, this.footerTimerEl = null, this.footerObserver = null, this.footerWaitTimer = null, this.footerTransitionTimer = null, this.successTransitionTimer = null, this.timerInterval = null, this.currentConfig = null, this.destroyed = !1, this.lastCode = void 0, this.echo = null, this.authenticated = !1;
|
|
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;
|
|
4270
4312
|
const i = this.attachShadow({ mode: "open" });
|
|
4271
4313
|
this.injectTailwind(i);
|
|
4272
|
-
const
|
|
4273
|
-
|
|
4274
|
-
const a =
|
|
4275
|
-
u.textContent =
|
|
4314
|
+
const s = document.createElement("div");
|
|
4315
|
+
s.innerHTML = pt;
|
|
4316
|
+
const a = s.querySelector("template"), h = a ? a.content.cloneNode(!0) : document.createRange().createContextualFragment(pt), u = document.createElement("style");
|
|
4317
|
+
u.textContent = zi, i.appendChild(u), i.appendChild(h);
|
|
4276
4318
|
}
|
|
4277
4319
|
static get observedAttributes() {
|
|
4278
4320
|
return ["server-url", "public-key", "verify-urls", "lang", "transport", "hide-footer", "footer", "authenticated-event-delay-ms"];
|
|
@@ -4288,7 +4330,7 @@ const me = class me extends HTMLElement {
|
|
|
4288
4330
|
this.configureFooter(), this.dispatchPublicEvent("sendity:ready", {
|
|
4289
4331
|
transport: this.currentConfig.transport,
|
|
4290
4332
|
channel: this.primaryChannel(this.currentConfig.verifyUrls)
|
|
4291
|
-
}), this.
|
|
4333
|
+
}), this.showPlaceholderCode(), this.renderVerifiers(this.currentConfig.verifyUrls), this.startWhenVisible();
|
|
4292
4334
|
}
|
|
4293
4335
|
disconnectedCallback() {
|
|
4294
4336
|
this.stop(), this.destroyed = !0;
|
|
@@ -4296,44 +4338,55 @@ const me = class me extends HTMLElement {
|
|
|
4296
4338
|
attributeChangedCallback() {
|
|
4297
4339
|
this.isConnected && (this.currentConfig = this.resolveConfig(), this.configureFooter(), this.renderVerifiers(this.currentConfig.verifyUrls));
|
|
4298
4340
|
}
|
|
4341
|
+
startWhenVisible() {
|
|
4342
|
+
if (!(this.authFlowStarted || this.destroyed)) {
|
|
4343
|
+
if (!("IntersectionObserver" in window)) {
|
|
4344
|
+
this.start();
|
|
4345
|
+
return;
|
|
4346
|
+
}
|
|
4347
|
+
this.authStartObserver?.disconnect(), this.authStartObserver = new IntersectionObserver((i) => {
|
|
4348
|
+
i.some((a) => a.isIntersecting && a.intersectionRatio > 0) && (this.authStartObserver?.disconnect(), this.authStartObserver = null, this.start());
|
|
4349
|
+
}), this.authStartObserver.observe(this);
|
|
4350
|
+
}
|
|
4351
|
+
}
|
|
4299
4352
|
start() {
|
|
4300
|
-
this.step().then((i) => {
|
|
4353
|
+
this.authFlowStarted || (this.authFlowStarted = !0, this.step().then((i) => {
|
|
4301
4354
|
this.authenticated || this.destroyed || this.configureRealtime(i);
|
|
4302
4355
|
}).catch((i) => {
|
|
4303
4356
|
this.handleInitialError(i);
|
|
4304
|
-
});
|
|
4357
|
+
}));
|
|
4305
4358
|
}
|
|
4306
4359
|
stop() {
|
|
4307
|
-
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null), this.fallbackPollTimer !== null && (clearTimeout(this.fallbackPollTimer), this.fallbackPollTimer = null), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.authenticatedEventTimer !== null && (clearTimeout(this.authenticatedEventTimer), this.authenticatedEventTimer = null), this.footerTransitionTimer !== null && (clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = null), this.successTransitionTimer !== null && (clearTimeout(this.successTransitionTimer), this.successTransitionTimer = null), this.stopCountdown(), this.footerObserver?.disconnect(), this.footerObserver = null, this.echo && this.activeAuthRequestId && this.echo.leave(`sendity.auth-requests.${this.activeAuthRequestId}`), this.echo?.disconnect(), this.echo = null;
|
|
4360
|
+
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null), this.fallbackPollTimer !== null && (clearTimeout(this.fallbackPollTimer), this.fallbackPollTimer = null), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.authenticatedEventTimer !== null && (clearTimeout(this.authenticatedEventTimer), this.authenticatedEventTimer = null), this.footerTransitionTimer !== null && (clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = null), this.successTransitionTimer !== null && (clearTimeout(this.successTransitionTimer), this.successTransitionTimer = null), this.stopCountdown(), this.footerObserver?.disconnect(), this.footerObserver = null, this.authStartObserver?.disconnect(), this.authStartObserver = null, this.echo && this.activeAuthRequestId && this.echo.leave(`sendity.auth-requests.${this.activeAuthRequestId}`), this.echo?.disconnect(), this.echo = null;
|
|
4308
4361
|
}
|
|
4309
4362
|
// Inject Tailwind CSS into the Shadow DOM so Tailwind utility classes
|
|
4310
4363
|
// used in sendity.html work within the component. We cache the processed
|
|
4311
4364
|
// CSS text across instances to avoid redundant network requests and ensure
|
|
4312
4365
|
// the Tailwind layer is inserted before component CSS.
|
|
4313
4366
|
injectTailwind(i) {
|
|
4314
|
-
const
|
|
4315
|
-
|
|
4367
|
+
const s = document.createElement("style");
|
|
4368
|
+
s.setAttribute("data-sendity-tw", ""), i.appendChild(s);
|
|
4316
4369
|
const a = this.constructor;
|
|
4317
4370
|
if (a.tailwindCssText !== null) {
|
|
4318
4371
|
if (a.tailwindCssText)
|
|
4319
|
-
|
|
4372
|
+
s.textContent = a.tailwindCssText;
|
|
4320
4373
|
else {
|
|
4321
4374
|
const h = document.createElement("link");
|
|
4322
|
-
h.rel = "stylesheet", h.href =
|
|
4375
|
+
h.rel = "stylesheet", h.href = Re, i.insertBefore(h, s);
|
|
4323
4376
|
}
|
|
4324
4377
|
return;
|
|
4325
4378
|
}
|
|
4326
|
-
a.tailwindLoading || (a.tailwindLoading = fetch(
|
|
4379
|
+
a.tailwindLoading || (a.tailwindLoading = fetch(Re).then((h) => h.ok ? h.text() : Promise.reject(new Error(`HTTP ${h.status}`))).then((h) => {
|
|
4327
4380
|
a.tailwindCssText = h;
|
|
4328
4381
|
}).catch((h) => {
|
|
4329
4382
|
console.warn("[sendity-auth] Failed to load Tailwind CSS for Shadow DOM", h), a.tailwindCssText = "";
|
|
4330
4383
|
})), a.tailwindLoading.then(() => {
|
|
4331
4384
|
if (!this.destroyed && i)
|
|
4332
4385
|
if (a.tailwindCssText)
|
|
4333
|
-
|
|
4386
|
+
s.textContent = a.tailwindCssText;
|
|
4334
4387
|
else {
|
|
4335
4388
|
const h = document.createElement("link");
|
|
4336
|
-
h.rel = "stylesheet", h.href =
|
|
4389
|
+
h.rel = "stylesheet", h.href = Re, i.insertBefore(h, s);
|
|
4337
4390
|
}
|
|
4338
4391
|
});
|
|
4339
4392
|
}
|
|
@@ -4358,12 +4411,12 @@ const me = class me extends HTMLElement {
|
|
|
4358
4411
|
scheduleFooterWaitingState() {
|
|
4359
4412
|
this.footerWaitTimer !== null || this.isFooterHidden() || (this.footerWaitTimer = window.setTimeout(() => {
|
|
4360
4413
|
this.footerWaitTimer = null, this.showFooterWaitingState();
|
|
4361
|
-
},
|
|
4414
|
+
}, or));
|
|
4362
4415
|
}
|
|
4363
4416
|
showFooterWaitingState() {
|
|
4364
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(() => {
|
|
4365
4418
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4366
|
-
},
|
|
4419
|
+
}, pe), this.startCountdown());
|
|
4367
4420
|
}
|
|
4368
4421
|
startCountdown() {
|
|
4369
4422
|
if (this.timerInterval !== null || !this.footerTimerEl) return;
|
|
@@ -4373,19 +4426,52 @@ const me = class me extends HTMLElement {
|
|
|
4373
4426
|
}
|
|
4374
4427
|
const i = () => {
|
|
4375
4428
|
if (!this.footerTimerEl || !this.activeAuthRequestExpiresAt) return;
|
|
4376
|
-
const
|
|
4377
|
-
if (Number.isNaN(
|
|
4429
|
+
const s = new Date(this.activeAuthRequestExpiresAt).getTime();
|
|
4430
|
+
if (Number.isNaN(s)) {
|
|
4378
4431
|
this.footerTimerEl.setAttribute("hidden", "");
|
|
4379
4432
|
return;
|
|
4380
4433
|
}
|
|
4381
|
-
const a = Math.max(0, Math.floor((
|
|
4382
|
-
this.footerTimerEl.textContent = `${h}:${u}`, this.footerTimerEl.classList.toggle("low", a > 0 && a <= 60), this.footerTimerEl.removeAttribute("hidden"), a <= 0 && this.timerInterval !== null && (clearInterval(this.timerInterval), this.timerInterval = null);
|
|
4434
|
+
const a = Math.max(0, Math.floor((s - Date.now()) / 1e3)), h = Math.floor(a / 60), u = String(a % 60).padStart(2, "0");
|
|
4435
|
+
this.footerTimerEl.textContent = `${h}:${u}`, this.footerTimerEl.classList.toggle("low", a > 0 && a <= 60), this.footerTimerEl.removeAttribute("hidden"), a <= 0 && this.timerInterval !== null && (clearInterval(this.timerInterval), this.timerInterval = null, this.showExpiredState());
|
|
4383
4436
|
};
|
|
4384
4437
|
i(), this.timerInterval = window.setInterval(i, 1e3);
|
|
4385
4438
|
}
|
|
4386
4439
|
stopCountdown() {
|
|
4387
4440
|
this.timerInterval !== null && (clearInterval(this.timerInterval), this.timerInterval = null);
|
|
4388
4441
|
}
|
|
4442
|
+
showExpiredState() {
|
|
4443
|
+
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 = V(this.currentConfig.lang);
|
|
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(() => {
|
|
4447
|
+
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4448
|
+
}, pe);
|
|
4449
|
+
}
|
|
4450
|
+
this.renderExpiredAction();
|
|
4451
|
+
}
|
|
4452
|
+
}
|
|
4453
|
+
renderExpiredAction() {
|
|
4454
|
+
if (!this.verifiersEl || !this.currentConfig) return;
|
|
4455
|
+
const i = V(this.currentConfig.lang);
|
|
4456
|
+
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden");
|
|
4457
|
+
const s = document.createElement("button");
|
|
4458
|
+
s.type = "button", s.className = "chan primary", s.addEventListener("click", () => {
|
|
4459
|
+
s.disabled = !0, this.requestNewAuthRequest().catch((u) => {
|
|
4460
|
+
console.warn("[sendity-auth] failed to request a new code", u), s.disabled = !1;
|
|
4461
|
+
});
|
|
4462
|
+
});
|
|
4463
|
+
const a = document.createElement("span");
|
|
4464
|
+
a.className = "icon", a.setAttribute("aria-hidden", "true"), a.innerHTML = tr, s.appendChild(a);
|
|
4465
|
+
const h = document.createElement("span");
|
|
4466
|
+
h.className = "label", h.textContent = i.ui.getNewCode, s.appendChild(h), this.verifiersEl.appendChild(s);
|
|
4467
|
+
}
|
|
4468
|
+
async requestNewAuthRequest() {
|
|
4469
|
+
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4470
|
+
const i = this.currentConfig;
|
|
4471
|
+
this.stopAuthTransports(), this.stopCountdown(), this.codeContainerEl?.classList.remove("code--expired");
|
|
4472
|
+
const s = await this.createAuthRequest(i.serverUrl, i.publicKey, me());
|
|
4473
|
+
this.renderVerifiers(i.verifyUrls), this.showFooterWaitingState(), this.configureRealtime(s);
|
|
4474
|
+
}
|
|
4389
4475
|
handleInitialError(i) {
|
|
4390
4476
|
console.error("[sendity-auth] Unable to initialize authentication", i), this.renderError("Unable to initialize authentication, see console for details"), this.dispatchEvent(
|
|
4391
4477
|
new CustomEvent("sendity:error", {
|
|
@@ -4399,11 +4485,11 @@ const me = class me extends HTMLElement {
|
|
|
4399
4485
|
const i = {
|
|
4400
4486
|
lang: navigator.language?.startsWith("de") ? "de" : navigator.language?.startsWith("fr") ? "fr" : "en",
|
|
4401
4487
|
transport: "auto"
|
|
4402
|
-
},
|
|
4488
|
+
}, s = (R) => this.getAttribute(R) ?? void 0, a = s("server-url")?.trim() || nr, h = s("public-key")?.trim();
|
|
4403
4489
|
if (!h)
|
|
4404
4490
|
throw new Error("Missing required sendity-auth attribute: public-key");
|
|
4405
|
-
let u = [...
|
|
4406
|
-
const m =
|
|
4491
|
+
let u = [...ir];
|
|
4492
|
+
const m = s("verify-urls");
|
|
4407
4493
|
if (m)
|
|
4408
4494
|
try {
|
|
4409
4495
|
if (u = JSON.parse(m), !Array.isArray(u)) throw new Error("verify-urls not array");
|
|
@@ -4411,19 +4497,19 @@ const me = class me extends HTMLElement {
|
|
|
4411
4497
|
} catch {
|
|
4412
4498
|
u = m.split(",").map((R) => R.trim()).filter(Boolean);
|
|
4413
4499
|
}
|
|
4414
|
-
if (u =
|
|
4500
|
+
if (u = cr(u), u.length === 0)
|
|
4415
4501
|
throw new Error("Missing required sendity-auth attribute: verify-urls");
|
|
4416
|
-
let g =
|
|
4502
|
+
let g = s("lang") || i.lang;
|
|
4417
4503
|
g !== "en" && g !== "de" && g !== "fr" && (g = i.lang);
|
|
4418
|
-
const
|
|
4419
|
-
return { serverUrl: a, publicKey: h, verifyUrls: u, lang: g, transport:
|
|
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 };
|
|
4420
4506
|
}
|
|
4421
4507
|
parseAuthenticatedEventDelayMs(i) {
|
|
4422
|
-
if (i === void 0 || i.trim() === "") return
|
|
4423
|
-
const
|
|
4424
|
-
return !Number.isFinite(
|
|
4508
|
+
if (i === void 0 || i.trim() === "") return Ie;
|
|
4509
|
+
const s = Number(i);
|
|
4510
|
+
return !Number.isFinite(s) || s < 0 ? Ie : Math.round(s);
|
|
4425
4511
|
}
|
|
4426
|
-
async createAuthRequest(i,
|
|
4512
|
+
async createAuthRequest(i, s, a) {
|
|
4427
4513
|
const h = await fetch(this.joinUrl(i, "/auth-requests"), {
|
|
4428
4514
|
method: "POST",
|
|
4429
4515
|
mode: "cors",
|
|
@@ -4431,14 +4517,14 @@ const me = class me extends HTMLElement {
|
|
|
4431
4517
|
"Content-Type": "application/json",
|
|
4432
4518
|
Accept: "application/json"
|
|
4433
4519
|
},
|
|
4434
|
-
body: JSON.stringify({ public_key:
|
|
4520
|
+
body: JSON.stringify({ public_key: s })
|
|
4435
4521
|
});
|
|
4436
4522
|
if (!h.ok) throw new Error(`Auth request creation failed: ${h.status}`);
|
|
4437
4523
|
const u = await h.json();
|
|
4438
4524
|
if (!u.id) throw new Error("Missing id from server response");
|
|
4439
4525
|
const m = this.extractClientSecret(u);
|
|
4440
4526
|
if (!m) throw new Error("Missing client secret from server response");
|
|
4441
|
-
return
|
|
4527
|
+
return ar(a, i, s, { id: String(u.id), clientSecret: m }), this.activeAuthRequestId = String(u.id), this.activeAuthRequestSecret = m, this.updateActiveAuthRequestExpiry(u), this.updateCode(u.formattedCode ?? u.code), this.dispatchPublicEvent("sendity:challenge-created", {
|
|
4442
4528
|
verificationId: String(u.id),
|
|
4443
4529
|
code: u.formattedCode ?? u.code ?? "",
|
|
4444
4530
|
channel: this.primaryChannel(this.currentConfig?.verifyUrls ?? [])
|
|
@@ -4446,45 +4532,47 @@ const me = class me extends HTMLElement {
|
|
|
4446
4532
|
}
|
|
4447
4533
|
async step() {
|
|
4448
4534
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4449
|
-
const { serverUrl: i, publicKey:
|
|
4535
|
+
const { serverUrl: i, publicKey: s } = this.currentConfig, a = me(), h = yt(a, i, s), u = h?.id;
|
|
4450
4536
|
if (!u)
|
|
4451
|
-
return await this.createAuthRequest(i,
|
|
4537
|
+
return await this.createAuthRequest(i, s, a);
|
|
4452
4538
|
this.activeAuthRequestId = u, this.activeAuthRequestSecret = h.clientSecret;
|
|
4453
4539
|
const m = await fetch(
|
|
4454
4540
|
this.authRequestStatusUrl(i, u),
|
|
4455
4541
|
this.authRequestStatusInit(h.clientSecret)
|
|
4456
4542
|
);
|
|
4457
4543
|
if (m.status !== 200)
|
|
4458
|
-
return wt(a, i,
|
|
4544
|
+
return wt(a, i, s), await this.step();
|
|
4459
4545
|
const g = await m.json();
|
|
4460
4546
|
if (g.status === "verified")
|
|
4461
4547
|
return this.handleAuthenticated(g), g;
|
|
4548
|
+
if (g.status === "expired")
|
|
4549
|
+
return this.updateActiveAuthRequestExpiry(g), this.updateCode(g.formattedCode ?? g.code), this.showExpiredState(), g;
|
|
4462
4550
|
g.id && (this.activeAuthRequestId = String(g.id));
|
|
4463
|
-
const
|
|
4464
|
-
return
|
|
4551
|
+
const b = this.extractClientSecret(g);
|
|
4552
|
+
return b && (this.activeAuthRequestSecret = b), this.updateActiveAuthRequestExpiry(g), this.updateCode(g.formattedCode ?? g.code), g;
|
|
4465
4553
|
}
|
|
4466
4554
|
configureRealtime(i) {
|
|
4467
4555
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4468
|
-
const { transport:
|
|
4556
|
+
const { transport: s } = this.currentConfig, a = i?.broadcasting, h = !!(a?.key && a.channel && a.authEndpoint);
|
|
4469
4557
|
let u = !1;
|
|
4470
|
-
|
|
4471
|
-
const m =
|
|
4558
|
+
s !== "polling" && h && a ? u = this.subscribeToBroadcasting(a) : s === "push" && console.warn("[sendity-auth] Push transport requested, but server response does not contain broadcasting metadata");
|
|
4559
|
+
const m = lr(s, h, u);
|
|
4472
4560
|
m.start && this.startPolling(m.delayMs);
|
|
4473
4561
|
}
|
|
4474
4562
|
subscribeToBroadcasting(i) {
|
|
4475
4563
|
if (!this.currentConfig || !i.key || !i.channel || !i.authEndpoint) return !1;
|
|
4476
4564
|
try {
|
|
4477
|
-
window.Pusher =
|
|
4478
|
-
const
|
|
4479
|
-
return this.echo = new
|
|
4565
|
+
window.Pusher = Ki;
|
|
4566
|
+
const s = (i.scheme ?? "https") === "https", a = i.port ?? (s ? 443 : 80);
|
|
4567
|
+
return this.echo = new Vi({
|
|
4480
4568
|
broadcaster: "reverb",
|
|
4481
4569
|
key: i.key,
|
|
4482
4570
|
wsHost: i.host ?? new URL(this.currentConfig.serverUrl).hostname,
|
|
4483
4571
|
wsPort: a,
|
|
4484
4572
|
wssPort: a,
|
|
4485
4573
|
wsPath: i.wsPath ?? "/ws",
|
|
4486
|
-
forceTLS:
|
|
4487
|
-
encrypted:
|
|
4574
|
+
forceTLS: s,
|
|
4575
|
+
encrypted: s,
|
|
4488
4576
|
enabledTransports: ["ws", "wss"],
|
|
4489
4577
|
authEndpoint: this.joinUrl(this.currentConfig.serverUrl, i.authEndpoint),
|
|
4490
4578
|
auth: {
|
|
@@ -4498,20 +4586,20 @@ const me = class me extends HTMLElement {
|
|
|
4498
4586
|
}), this.echo.private(i.channel).listen(i.event ?? ".authenticated", (h) => {
|
|
4499
4587
|
this.handleAuthenticated(h);
|
|
4500
4588
|
}), !0;
|
|
4501
|
-
} catch (
|
|
4502
|
-
return console.warn("[sendity-auth] realtime subscription failed, falling back to polling if enabled",
|
|
4589
|
+
} catch (s) {
|
|
4590
|
+
return console.warn("[sendity-auth] realtime subscription failed, falling back to polling if enabled", s), this.currentConfig.transport === "auto" && this.startPolling(At), !1;
|
|
4503
4591
|
}
|
|
4504
4592
|
}
|
|
4505
4593
|
startPolling(i) {
|
|
4506
4594
|
if (this.pollTimer !== null || this.authenticated) return;
|
|
4507
|
-
const
|
|
4595
|
+
const s = () => {
|
|
4508
4596
|
this.pollTimer !== null || this.authenticated || this.destroyed || (this.pollTimer = window.setInterval(() => {
|
|
4509
4597
|
this.step().catch((a) => console.warn("[sendity-auth] poll failed", a));
|
|
4510
|
-
},
|
|
4598
|
+
}, sr));
|
|
4511
4599
|
};
|
|
4512
4600
|
i > 0 ? this.fallbackPollTimer = window.setTimeout(() => {
|
|
4513
|
-
this.fallbackPollTimer = null,
|
|
4514
|
-
}, i) :
|
|
4601
|
+
this.fallbackPollTimer = null, s();
|
|
4602
|
+
}, i) : s();
|
|
4515
4603
|
}
|
|
4516
4604
|
handleAuthenticated(i) {
|
|
4517
4605
|
if (this.authenticated) return;
|
|
@@ -4521,35 +4609,35 @@ const me = class me extends HTMLElement {
|
|
|
4521
4609
|
});
|
|
4522
4610
|
return;
|
|
4523
4611
|
}
|
|
4524
|
-
this.authenticated = !0, this.currentConfig && wt(
|
|
4525
|
-
const
|
|
4612
|
+
this.authenticated = !0, this.currentConfig && wt(me(), this.currentConfig.serverUrl, this.currentConfig.publicKey), this.stopAuthTransports(), this.showSuccess(i);
|
|
4613
|
+
const s = this.toPublicAuthenticatedDetail(i), a = this.currentConfig?.authenticatedEventDelayMs ?? Ie;
|
|
4526
4614
|
this.authenticatedEventTimer = window.setTimeout(() => {
|
|
4527
|
-
this.authenticatedEventTimer = null, !this.destroyed && this.dispatchPublicEvent("sendity:authenticated",
|
|
4615
|
+
this.authenticatedEventTimer = null, !this.destroyed && this.dispatchPublicEvent("sendity:authenticated", s);
|
|
4528
4616
|
}, a);
|
|
4529
4617
|
}
|
|
4530
4618
|
stopAuthTransports() {
|
|
4531
4619
|
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null), this.fallbackPollTimer !== null && (clearTimeout(this.fallbackPollTimer), this.fallbackPollTimer = null), this.echo && this.activeAuthRequestId && this.echo.leave(`sendity.auth-requests.${this.activeAuthRequestId}`), this.echo?.disconnect(), this.echo = null;
|
|
4532
4620
|
}
|
|
4533
|
-
dispatchPublicEvent(i,
|
|
4534
|
-
this.dispatchEvent(new CustomEvent(i, { bubbles: !0, composed: !0, detail:
|
|
4621
|
+
dispatchPublicEvent(i, s) {
|
|
4622
|
+
this.dispatchEvent(new CustomEvent(i, { bubbles: !0, composed: !0, detail: s }));
|
|
4535
4623
|
}
|
|
4536
4624
|
toPublicAuthenticatedDetail(i) {
|
|
4537
|
-
const
|
|
4625
|
+
const s = String(i.auth_request_id ?? i.authRequestId ?? this.activeAuthRequestId ?? ""), a = i.channel ?? this.primaryChannel(this.currentConfig?.verifyUrls ?? []), h = i.expires_at ?? i.expiresAt;
|
|
4538
4626
|
return {
|
|
4539
|
-
sessionId:
|
|
4627
|
+
sessionId: s,
|
|
4540
4628
|
channel: a,
|
|
4541
4629
|
...i.identifier ? { address: i.identifier } : {},
|
|
4542
|
-
verificationId:
|
|
4630
|
+
verificationId: s,
|
|
4543
4631
|
signedResult: String(i.authorization ?? ""),
|
|
4544
4632
|
...h ? { expiresAt: String(h) } : {}
|
|
4545
4633
|
};
|
|
4546
4634
|
}
|
|
4547
4635
|
primaryChannel(i) {
|
|
4548
|
-
const
|
|
4549
|
-
return
|
|
4636
|
+
const s = i[0] ?? "";
|
|
4637
|
+
return s.startsWith("mailto:") ? "email" : s.startsWith("whatsapp:") || s.startsWith("whatsapp://") ? "whatsapp" : "unknown";
|
|
4550
4638
|
}
|
|
4551
|
-
authRequestStatusUrl(i,
|
|
4552
|
-
return new URL(this.joinUrl(i, `/auth-requests/${encodeURIComponent(
|
|
4639
|
+
authRequestStatusUrl(i, s) {
|
|
4640
|
+
return new URL(this.joinUrl(i, `/auth-requests/${encodeURIComponent(s)}`)).toString();
|
|
4553
4641
|
}
|
|
4554
4642
|
authRequestStatusInit(i) {
|
|
4555
4643
|
return {
|
|
@@ -4565,18 +4653,18 @@ const me = class me extends HTMLElement {
|
|
|
4565
4653
|
return String(i.client_secret ?? i.clientSecret ?? "");
|
|
4566
4654
|
}
|
|
4567
4655
|
updateActiveAuthRequestExpiry(i) {
|
|
4568
|
-
const
|
|
4569
|
-
|
|
4656
|
+
const s = i.expires_at ?? i.expiresAt;
|
|
4657
|
+
s && (this.activeAuthRequestExpiresAt = String(s));
|
|
4570
4658
|
}
|
|
4571
4659
|
waitingFooterMessage() {
|
|
4572
4660
|
if (!this.currentConfig) return "";
|
|
4573
|
-
const i =
|
|
4574
|
-
return
|
|
4661
|
+
const i = V(this.currentConfig.lang), s = this.formatExpiryTime(this.activeAuthRequestExpiresAt, this.currentConfig.lang);
|
|
4662
|
+
return s ? i.ui.footerWaitingUntil.replace("(Time)", s) : i.ui.footerWaiting;
|
|
4575
4663
|
}
|
|
4576
|
-
formatExpiryTime(i,
|
|
4664
|
+
formatExpiryTime(i, s) {
|
|
4577
4665
|
if (!i) return null;
|
|
4578
4666
|
const a = new Date(i);
|
|
4579
|
-
return Number.isNaN(a.getTime()) ? null : new Intl.DateTimeFormat(this.localeForLang(
|
|
4667
|
+
return Number.isNaN(a.getTime()) ? null : new Intl.DateTimeFormat(this.localeForLang(s), { timeStyle: "short" }).format(a);
|
|
4580
4668
|
}
|
|
4581
4669
|
localeForLang(i) {
|
|
4582
4670
|
switch (i) {
|
|
@@ -4590,11 +4678,11 @@ const me = class me extends HTMLElement {
|
|
|
4590
4678
|
}
|
|
4591
4679
|
async fetchAuthorizationAfterAuthenticatedSignal() {
|
|
4592
4680
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4593
|
-
const i =
|
|
4594
|
-
if (!
|
|
4681
|
+
const i = yt(me(), this.currentConfig.serverUrl, this.currentConfig.publicKey), s = this.activeAuthRequestId ?? i?.id, a = this.activeAuthRequestSecret ?? i?.clientSecret;
|
|
4682
|
+
if (!s || !a)
|
|
4595
4683
|
throw new Error("Cannot fetch authorization without an active auth request id and client secret");
|
|
4596
4684
|
const h = await fetch(
|
|
4597
|
-
this.authRequestStatusUrl(this.currentConfig.serverUrl,
|
|
4685
|
+
this.authRequestStatusUrl(this.currentConfig.serverUrl, s),
|
|
4598
4686
|
this.authRequestStatusInit(a)
|
|
4599
4687
|
);
|
|
4600
4688
|
if (!h.ok)
|
|
@@ -4610,38 +4698,42 @@ const me = class me extends HTMLElement {
|
|
|
4610
4698
|
if (!this.codeEl) return;
|
|
4611
4699
|
if (!!(i && String(i).trim().length > 0)) {
|
|
4612
4700
|
const a = String(i);
|
|
4613
|
-
this.lastCode = a, this.codeEl.textContent = a, this.showCodeState();
|
|
4614
|
-
} else
|
|
4615
|
-
this.lastCode = void 0;
|
|
4616
|
-
const a = this.codeEl.getAttribute("data-placeholder") || "••••";
|
|
4617
|
-
this.codeEl.textContent = a, this.showLoading();
|
|
4618
|
-
}
|
|
4701
|
+
this.lastCode = a, this.codeEl.textContent = a, this.codeContainerEl?.classList.remove("code--expired", "code--placeholder"), this.showCodeState();
|
|
4702
|
+
} else
|
|
4703
|
+
this.lastCode = void 0, this.showPlaceholderCode();
|
|
4619
4704
|
this.currentConfig && this.renderVerifiers(this.currentConfig.verifyUrls);
|
|
4620
4705
|
}
|
|
4706
|
+
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", "code--collapsed"), this.codeContainerEl?.classList.add("code--placeholder"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", ""));
|
|
4708
|
+
}
|
|
4709
|
+
randomPlaceholderCode() {
|
|
4710
|
+
const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", s = () => i[Math.floor(Math.random() * i.length)], a = () => `${s()}${s()}${s()}`;
|
|
4711
|
+
return `SDY-${a()}-${a()}`;
|
|
4712
|
+
}
|
|
4621
4713
|
renderError(i) {
|
|
4622
4714
|
this.codeEl && (this.codeEl.textContent = i), this.verifiersEl && (this.verifiersEl.innerHTML = "");
|
|
4623
4715
|
}
|
|
4624
4716
|
showLoading() {
|
|
4625
|
-
this.spinnerEl?.removeAttribute("hidden"), this.codeContainerEl?.classList.remove("code--active", "code--verified"), this.codeEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", "");
|
|
4717
|
+
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", "");
|
|
4626
4718
|
}
|
|
4627
4719
|
showCodeState() {
|
|
4628
|
-
if (this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--verified"), this.codeContainerEl?.classList.remove("code--exiting", "code--collapsed"), this.codeContainerEl?.classList.add("code--active"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.verifiersEl?.classList.remove("verifiers--exiting"), this.verifiersEl?.removeAttribute("aria-hidden"), this.codeEl?.removeAttribute("hidden"), this.currentConfig && this.promptEl) {
|
|
4629
|
-
const i =
|
|
4720
|
+
if (this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--verified", "code--placeholder"), this.codeContainerEl?.classList.remove("code--exiting", "code--collapsed"), this.codeContainerEl?.classList.add("code--active"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.verifiersEl?.classList.remove("verifiers--exiting"), this.verifiersEl?.removeAttribute("aria-hidden"), this.codeEl?.removeAttribute("hidden"), this.currentConfig && this.promptEl) {
|
|
4721
|
+
const i = V(this.currentConfig.lang);
|
|
4630
4722
|
this.promptEl.textContent = i.ui.sendCodePrompt, this.promptEl.classList.remove("prompt--exiting"), this.promptEl.removeAttribute("aria-hidden"), this.promptEl.removeAttribute("hidden");
|
|
4631
4723
|
}
|
|
4632
4724
|
this.successEl?.setAttribute("hidden", "");
|
|
4633
4725
|
}
|
|
4634
4726
|
showSuccess(i) {
|
|
4635
|
-
this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--active"), 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();
|
|
4636
|
-
const
|
|
4637
|
-
if (this.footerEl && (this.footerEl.hidden =
|
|
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();
|
|
4728
|
+
const s = this.isFooterHidden();
|
|
4729
|
+
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(() => {
|
|
4638
4730
|
this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl && (this.footerBrandEl.hidden = !0);
|
|
4639
|
-
},
|
|
4731
|
+
}, pe))), this.footerStatusEl && (this.footerStatusEl.hidden = s), this.footerMessageEl) {
|
|
4640
4732
|
const a = i.identifier && i.identifier.trim().length > 0 ? i.identifier.trim() : this.destinationAddressForChannel(i.channel ?? this.primaryChannel(this.currentConfig?.verifyUrls ?? []));
|
|
4641
4733
|
this.footerMessageEl.textContent = a ? `Verified ${a}` : "Verified";
|
|
4642
4734
|
}
|
|
4643
4735
|
if (this.footerTimerEl && (this.footerTimerEl.hidden = !1, this.footerTimerEl.classList.remove("low"), this.footerTimerEl.textContent = "· Signing you in..."), this.verifiersEl?.classList.add("verifiers--exiting"), this.currentConfig && this.successEl) {
|
|
4644
|
-
const a =
|
|
4736
|
+
const a = V(this.currentConfig.lang), h = i.name && i.name.trim().length > 0 ? a.ui.successGreeting.replace("(Name)", i.name) : "You're in!";
|
|
4645
4737
|
this.successEl.innerHTML = `
|
|
4646
4738
|
<span class="success-check" aria-hidden="true">
|
|
4647
4739
|
<svg viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>
|
|
@@ -4651,10 +4743,10 @@ const me = class me extends HTMLElement {
|
|
|
4651
4743
|
}
|
|
4652
4744
|
this.successTransitionTimer !== null && clearTimeout(this.successTransitionTimer), this.successTransitionTimer = window.setTimeout(() => {
|
|
4653
4745
|
this.successTransitionTimer = null, this.verifiersEl && this.verifiersEl.setAttribute("aria-hidden", "true"), this.codeContainerEl?.setAttribute("aria-hidden", "true"), this.promptEl?.setAttribute("aria-hidden", "true");
|
|
4654
|
-
},
|
|
4746
|
+
}, pe);
|
|
4655
4747
|
}
|
|
4656
4748
|
destinationAddressForChannel(i) {
|
|
4657
|
-
const
|
|
4749
|
+
const s = this.currentConfig?.verifyUrls ?? [], a = s.find((h) => this.channelClass(h) === i) ?? s[0];
|
|
4658
4750
|
if (!a) return null;
|
|
4659
4751
|
try {
|
|
4660
4752
|
const h = new URL(a, window.location.origin);
|
|
@@ -4676,18 +4768,18 @@ const me = class me extends HTMLElement {
|
|
|
4676
4768
|
renderVerifiers(i) {
|
|
4677
4769
|
if (!this.verifiersEl) return;
|
|
4678
4770
|
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.toggle("is-two", i.length === 2);
|
|
4679
|
-
const
|
|
4771
|
+
const s = this.currentConfig;
|
|
4680
4772
|
i.forEach((a, h) => {
|
|
4681
4773
|
if (h > 0 && i.length === 2) {
|
|
4682
4774
|
const w = document.createElement("div");
|
|
4683
4775
|
w.className = "divider", w.setAttribute("aria-hidden", "true");
|
|
4684
4776
|
const R = document.createElement("span");
|
|
4685
|
-
R.textContent =
|
|
4777
|
+
R.textContent = s.lang === "de" ? "oder" : s.lang === "fr" ? "ou" : "or", w.appendChild(R), this.verifiersEl.appendChild(w);
|
|
4686
4778
|
}
|
|
4687
4779
|
const u = document.createElement("div");
|
|
4688
4780
|
u.className = "opt";
|
|
4689
4781
|
const m = document.createElement("a");
|
|
4690
|
-
m.className = "chan " + this.channelClass(a), m.href = this.buildLink(a,
|
|
4782
|
+
m.className = "chan " + this.channelClass(a), m.href = this.buildLink(a, s.lang), m.target = "_blank", m.rel = "noopener noreferrer", m.addEventListener("click", () => {
|
|
4691
4783
|
this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.showFooterWaitingState();
|
|
4692
4784
|
});
|
|
4693
4785
|
const g = this.iconForUrl(a);
|
|
@@ -4695,29 +4787,29 @@ const me = class me extends HTMLElement {
|
|
|
4695
4787
|
const w = document.createElement("span");
|
|
4696
4788
|
w.className = "icon", w.setAttribute("aria-hidden", "true"), w.innerHTML = g, m.appendChild(w);
|
|
4697
4789
|
}
|
|
4698
|
-
const
|
|
4699
|
-
|
|
4700
|
-
const
|
|
4701
|
-
if (
|
|
4790
|
+
const b = document.createElement("span");
|
|
4791
|
+
b.className = "label", b.textContent = this.channelLabel(a, s.lang), m.appendChild(b), u.appendChild(m);
|
|
4792
|
+
const _ = this.destinationText(a, s.lang);
|
|
4793
|
+
if (_) {
|
|
4702
4794
|
const w = document.createElement("a");
|
|
4703
|
-
w.className = "dest", w.href = m.href, w.target = "_blank", w.rel = "noopener noreferrer", w.textContent =
|
|
4795
|
+
w.className = "dest", w.href = m.href, w.target = "_blank", w.rel = "noopener noreferrer", w.textContent = _, u.appendChild(w);
|
|
4704
4796
|
}
|
|
4705
4797
|
this.verifiersEl.appendChild(u);
|
|
4706
4798
|
});
|
|
4707
4799
|
}
|
|
4708
4800
|
channelClass(i) {
|
|
4709
4801
|
try {
|
|
4710
|
-
const
|
|
4711
|
-
if (
|
|
4712
|
-
if (
|
|
4802
|
+
const s = new URL(i, window.location.origin);
|
|
4803
|
+
if (s.protocol === "mailto:") return "email";
|
|
4804
|
+
if (s.protocol === "whatsapp:" || s.protocol === "whatsapp://") return "whatsapp";
|
|
4713
4805
|
} catch {
|
|
4714
4806
|
if (i.startsWith("mailto:")) return "email";
|
|
4715
4807
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) return "whatsapp";
|
|
4716
4808
|
}
|
|
4717
4809
|
return "generic";
|
|
4718
4810
|
}
|
|
4719
|
-
channelLabel(i,
|
|
4720
|
-
const a =
|
|
4811
|
+
channelLabel(i, s) {
|
|
4812
|
+
const a = V(s), h = this.channelClass(i);
|
|
4721
4813
|
if (h === "email") return a.labels.email;
|
|
4722
4814
|
if (h === "whatsapp") return a.labels.whatsapp;
|
|
4723
4815
|
try {
|
|
@@ -4727,8 +4819,8 @@ const me = class me extends HTMLElement {
|
|
|
4727
4819
|
return i;
|
|
4728
4820
|
}
|
|
4729
4821
|
}
|
|
4730
|
-
destinationText(i,
|
|
4731
|
-
const h =
|
|
4822
|
+
destinationText(i, s) {
|
|
4823
|
+
const h = V(s).ui.toPrefix ?? "to";
|
|
4732
4824
|
try {
|
|
4733
4825
|
const u = new URL(i, window.location.origin);
|
|
4734
4826
|
if (u.protocol === "mailto:") {
|
|
@@ -4749,17 +4841,17 @@ const me = class me extends HTMLElement {
|
|
|
4749
4841
|
}
|
|
4750
4842
|
iconForUrl(i) {
|
|
4751
4843
|
try {
|
|
4752
|
-
const
|
|
4753
|
-
if (
|
|
4754
|
-
if (
|
|
4844
|
+
const s = new URL(i, window.location.origin);
|
|
4845
|
+
if (s.protocol === "mailto:") return vt;
|
|
4846
|
+
if (s.protocol === "whatsapp:" || s.protocol === "whatsapp://") return bt;
|
|
4755
4847
|
} catch {
|
|
4756
4848
|
if (i.startsWith("mailto:")) return vt;
|
|
4757
|
-
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) return
|
|
4849
|
+
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) return bt;
|
|
4758
4850
|
}
|
|
4759
4851
|
return null;
|
|
4760
4852
|
}
|
|
4761
|
-
labelForUrl(i,
|
|
4762
|
-
const a =
|
|
4853
|
+
labelForUrl(i, s) {
|
|
4854
|
+
const a = V(s);
|
|
4763
4855
|
try {
|
|
4764
4856
|
const h = new URL(i, window.location.origin);
|
|
4765
4857
|
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(":", "");
|
|
@@ -4767,42 +4859,42 @@ const me = class me extends HTMLElement {
|
|
|
4767
4859
|
return i.startsWith("mailto:") ? `${a.ui.by} ${a.labels.email}` : i.startsWith("whatsapp:") || i.startsWith("whatsapp://") ? `${a.ui.by} ${a.labels.whatsapp}` : i;
|
|
4768
4860
|
}
|
|
4769
4861
|
}
|
|
4770
|
-
buildLink(i,
|
|
4771
|
-
const a = this.lastCode, h =
|
|
4862
|
+
buildLink(i, s) {
|
|
4863
|
+
const a = this.lastCode, h = V(s), u = window.location.host;
|
|
4772
4864
|
if (!a) return i;
|
|
4773
4865
|
if (i.startsWith("mailto:")) {
|
|
4774
|
-
const [m, g = ""] = i.split("?"),
|
|
4775
|
-
|
|
4776
|
-
const R = this.toQuery(
|
|
4866
|
+
const [m, g = ""] = i.split("?"), b = new URLSearchParams(g), _ = this.applyTemplate(h.templates.emailSubject, u, a), w = this.applyTemplate(h.templates.emailBody, u, a);
|
|
4867
|
+
b.set("subject", _), b.set("body", w);
|
|
4868
|
+
const R = this.toQuery(b);
|
|
4777
4869
|
return `${m}?${R}`;
|
|
4778
4870
|
}
|
|
4779
4871
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) {
|
|
4780
|
-
const [m, g = ""] = i.split("?"),
|
|
4781
|
-
|
|
4782
|
-
const w = this.toQuery(
|
|
4872
|
+
const [m, g = ""] = i.split("?"), b = new URLSearchParams(g), _ = this.applyTemplate(h.templates.whatsappText, u, a);
|
|
4873
|
+
b.set("text", _);
|
|
4874
|
+
const w = this.toQuery(b);
|
|
4783
4875
|
return `${m}?${w}`;
|
|
4784
4876
|
}
|
|
4785
4877
|
return i;
|
|
4786
4878
|
}
|
|
4787
|
-
applyTemplate(i,
|
|
4788
|
-
return i.replaceAll("(Host)",
|
|
4879
|
+
applyTemplate(i, s, a) {
|
|
4880
|
+
return i.replaceAll("(Host)", s).replaceAll("(Code)", a);
|
|
4789
4881
|
}
|
|
4790
4882
|
// Build query string without using URLSearchParams.toString() because it encodes
|
|
4791
4883
|
// spaces as '+', which breaks expectations for many mail clients handling mailto:
|
|
4792
4884
|
// We use encodeURIComponent so spaces become '%20' and follow RFC 3986 style.
|
|
4793
4885
|
toQuery(i) {
|
|
4794
|
-
const
|
|
4886
|
+
const s = [];
|
|
4795
4887
|
return i.forEach((a, h) => {
|
|
4796
4888
|
const u = encodeURIComponent(h), m = encodeURIComponent(a);
|
|
4797
|
-
|
|
4798
|
-
}),
|
|
4889
|
+
s.push(`${u}=${m}`);
|
|
4890
|
+
}), s.join("&");
|
|
4799
4891
|
}
|
|
4800
|
-
joinUrl(i,
|
|
4801
|
-
return i.endsWith("/") &&
|
|
4892
|
+
joinUrl(i, s) {
|
|
4893
|
+
return i.endsWith("/") && s.startsWith("/") ? i + s.slice(1) : !i.endsWith("/") && !s.startsWith("/") ? i + "/" + s : i + s;
|
|
4802
4894
|
}
|
|
4803
4895
|
};
|
|
4804
|
-
|
|
4805
|
-
let Oe =
|
|
4896
|
+
ve.tailwindCssText = null, ve.tailwindLoading = null;
|
|
4897
|
+
let Oe = ve;
|
|
4806
4898
|
customElements.get("sendity-auth") || customElements.define("sendity-auth", Oe);
|
|
4807
4899
|
export {
|
|
4808
4900
|
Oe as Sendity
|