@sendity/client 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/sendity.d.ts +9 -0
- package/dist/sendity-client.js +696 -627
- package/dist/tailwind.css +1 -1
- package/package.json +1 -1
package/dist/sendity-client.js
CHANGED
|
@@ -105,10 +105,12 @@ const pt = `<template id="sendity-tpl">
|
|
|
105
105
|
--sendity-radius: 1rem; /* 16 — radius-xl */
|
|
106
106
|
--sendity-surface: #ffffff;
|
|
107
107
|
--sendity-shadow: 0 12px 28px -6px rgb(28 25 23 / 0.14), 0 6px 12px -6px rgb(28 25 23 / 0.08);
|
|
108
|
-
--sendity-shadow-
|
|
108
|
+
--sendity-shadow-success: 0 0 0 1px rgb(16 185 129 / 0.18), 0 18px 46px -18px rgb(16 185 129 / 0.78);
|
|
109
|
+
--sendity-shadow-error: 0 0 0 1px rgb(244 63 94 / 0.18), 0 18px 46px -18px rgb(244 63 94 / 0.78);
|
|
109
110
|
|
|
110
111
|
/* Card layout */
|
|
111
112
|
--sendity-width: 320px;
|
|
113
|
+
--sendity-body-min-height: 11.875rem;
|
|
112
114
|
--sendity-crossfade-duration: 220ms;
|
|
113
115
|
|
|
114
116
|
color-scheme: light;
|
|
@@ -130,8 +132,12 @@ const pt = `<template id="sendity-tpl">
|
|
|
130
132
|
transition: box-shadow .35s ease;
|
|
131
133
|
}
|
|
132
134
|
|
|
133
|
-
.sendity
|
|
134
|
-
box-shadow: var(--sendity-shadow-
|
|
135
|
+
.sendity.sendity--verified {
|
|
136
|
+
box-shadow: var(--sendity-shadow-success), var(--sendity-shadow);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.sendity.sendity--expired {
|
|
140
|
+
box-shadow: var(--sendity-shadow-error), var(--sendity-shadow);
|
|
135
141
|
}
|
|
136
142
|
|
|
137
143
|
.sendity-body {
|
|
@@ -139,6 +145,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
139
145
|
flex: 1;
|
|
140
146
|
display: flex;
|
|
141
147
|
flex-direction: column;
|
|
148
|
+
min-height: var(--sendity-body-min-height);
|
|
142
149
|
padding: 1.25rem 1.25rem 1rem;
|
|
143
150
|
gap: 0.875rem;
|
|
144
151
|
}
|
|
@@ -210,6 +217,16 @@ const pt = `<template id="sendity-tpl">
|
|
|
210
217
|
font-family: var(--sendity-code-font-family);
|
|
211
218
|
}
|
|
212
219
|
|
|
220
|
+
.sendity .code--placeholder .formatted-code {
|
|
221
|
+
filter: blur(0.45rem);
|
|
222
|
+
opacity: 0.55;
|
|
223
|
+
user-select: none;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.sendity .code--placeholder {
|
|
227
|
+
pointer-events: none;
|
|
228
|
+
}
|
|
229
|
+
|
|
213
230
|
.sendity .verifiers {
|
|
214
231
|
display: grid;
|
|
215
232
|
grid-template-columns: 1fr;
|
|
@@ -283,15 +300,26 @@ const pt = `<template id="sendity-tpl">
|
|
|
283
300
|
.sendity .verifiers a.chan .icon svg,
|
|
284
301
|
.sendity .verifiers button.chan .icon svg { width: 100%; height: 100%; display: block; }
|
|
285
302
|
|
|
286
|
-
.sendity .verifiers button.chan.primary
|
|
303
|
+
.sendity .verifiers button.chan.primary,
|
|
304
|
+
.sendity .verifiers button.chan.error {
|
|
287
305
|
width: 100%;
|
|
288
306
|
color: #ffffff;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.sendity .verifiers button.chan.primary {
|
|
289
310
|
background: var(--sendity-primary-color);
|
|
290
311
|
border-color: var(--sendity-primary-color);
|
|
291
312
|
}
|
|
292
313
|
.sendity .verifiers button.chan.primary:hover { background: var(--sendity-primary-hover); border-color: var(--sendity-primary-hover); }
|
|
293
314
|
.sendity .verifiers button.chan.primary:disabled { opacity: 0.7; cursor: wait; }
|
|
294
315
|
|
|
316
|
+
.sendity .verifiers button.chan.error {
|
|
317
|
+
background: var(--sendity-error-color);
|
|
318
|
+
border-color: var(--sendity-error-color);
|
|
319
|
+
}
|
|
320
|
+
.sendity .verifiers button.chan.error:hover { background: var(--sendity-error-fg); border-color: var(--sendity-error-fg); }
|
|
321
|
+
.sendity .verifiers button.chan.error:disabled { opacity: 0.7; cursor: wait; }
|
|
322
|
+
|
|
295
323
|
.sendity .verifiers a.chan.email {
|
|
296
324
|
color: var(--sendity-email-fg);
|
|
297
325
|
background: var(--sendity-email-bg);
|
|
@@ -508,7 +536,10 @@ const pt = `<template id="sendity-tpl">
|
|
|
508
536
|
height: 0.5rem;
|
|
509
537
|
border-radius: 999px;
|
|
510
538
|
background: var(--sendity-primary-color);
|
|
539
|
+
color: var(--sendity-error-color);
|
|
511
540
|
position: relative;
|
|
541
|
+
display: inline-grid;
|
|
542
|
+
place-items: center;
|
|
512
543
|
flex: none;
|
|
513
544
|
}
|
|
514
545
|
.sendity .footer-spinner::after {
|
|
@@ -521,6 +552,21 @@ const pt = `<template id="sendity-tpl">
|
|
|
521
552
|
animation: sendity-pulse 1.6s ease-out infinite;
|
|
522
553
|
}
|
|
523
554
|
|
|
555
|
+
.sendity .footer-indicator--error {
|
|
556
|
+
width: 1rem;
|
|
557
|
+
height: 1rem;
|
|
558
|
+
background: transparent;
|
|
559
|
+
}
|
|
560
|
+
.sendity .footer-indicator--error::after {
|
|
561
|
+
content: none;
|
|
562
|
+
animation: none;
|
|
563
|
+
}
|
|
564
|
+
.sendity .footer-indicator--error svg {
|
|
565
|
+
width: 1rem;
|
|
566
|
+
height: 1rem;
|
|
567
|
+
display: block;
|
|
568
|
+
}
|
|
569
|
+
|
|
524
570
|
@keyframes sendity-pulse { to { transform: scale(2.4); opacity: 0; } }
|
|
525
571
|
|
|
526
572
|
/* Inherit dark surfaces when consumer page enables a dark theme on the host. */
|
|
@@ -551,6 +597,8 @@ const pt = `<template id="sendity-tpl">
|
|
|
551
597
|
--sendity-whatsapp-bg-hover: rgb(16 185 129 / 0.26);
|
|
552
598
|
--sendity-btn-shadow: inset 0 1px 0 0 rgb(255 255 255 / 0.06), 0 1px 2px 0 rgb(0 0 0 / 0.4);
|
|
553
599
|
--sendity-shadow: 0 12px 28px -6px rgb(0 0 0 / 0.55), 0 6px 12px -6px rgb(0 0 0 / 0.4);
|
|
600
|
+
--sendity-shadow-success: 0 0 0 1px rgb(16 185 129 / 0.24), 0 18px 46px -18px rgb(16 185 129 / 0.9);
|
|
601
|
+
--sendity-shadow-error: 0 0 0 1px rgb(244 63 94 / 0.24), 0 18px 46px -18px rgb(244 63 94 / 0.9);
|
|
554
602
|
}
|
|
555
603
|
`;
|
|
556
604
|
class qe {
|
|
@@ -560,8 +608,8 @@ class qe {
|
|
|
560
608
|
/**
|
|
561
609
|
* Listen for a whisper event on the channel instance.
|
|
562
610
|
*/
|
|
563
|
-
listenForWhisper(i,
|
|
564
|
-
return this.listen(".client-" + i,
|
|
611
|
+
listenForWhisper(i, s) {
|
|
612
|
+
return this.listen(".client-" + i, s);
|
|
565
613
|
}
|
|
566
614
|
/**
|
|
567
615
|
* Listen for an event on the channel instance.
|
|
@@ -578,8 +626,8 @@ class qe {
|
|
|
578
626
|
/**
|
|
579
627
|
* Stop listening for a whisper event on the channel instance.
|
|
580
628
|
*/
|
|
581
|
-
stopListeningForWhisper(i,
|
|
582
|
-
return this.stopListening(".client-" + i,
|
|
629
|
+
stopListeningForWhisper(i, s) {
|
|
630
|
+
return this.stopListening(".client-" + i, s);
|
|
583
631
|
}
|
|
584
632
|
}
|
|
585
633
|
class Ct {
|
|
@@ -613,8 +661,8 @@ class Ue extends qe {
|
|
|
613
661
|
/**
|
|
614
662
|
* Create a new class instance.
|
|
615
663
|
*/
|
|
616
|
-
constructor(i,
|
|
617
|
-
super(), this.name =
|
|
664
|
+
constructor(i, s, a) {
|
|
665
|
+
super(), this.name = s, this.pusher = i, this.options = a, this.eventFormatter = new Ct(this.options.namespace), this.subscribe();
|
|
618
666
|
}
|
|
619
667
|
/**
|
|
620
668
|
* Subscribe to a Pusher channel.
|
|
@@ -631,30 +679,30 @@ class Ue extends qe {
|
|
|
631
679
|
/**
|
|
632
680
|
* Listen for an event on the channel instance.
|
|
633
681
|
*/
|
|
634
|
-
listen(i,
|
|
635
|
-
return this.on(this.eventFormatter.format(i),
|
|
682
|
+
listen(i, s) {
|
|
683
|
+
return this.on(this.eventFormatter.format(i), s), this;
|
|
636
684
|
}
|
|
637
685
|
/**
|
|
638
686
|
* Listen for all events on the channel instance.
|
|
639
687
|
*/
|
|
640
688
|
listenToAll(i) {
|
|
641
|
-
return this.subscription.bind_global((
|
|
642
|
-
if (
|
|
689
|
+
return this.subscription.bind_global((s, a) => {
|
|
690
|
+
if (s.startsWith("pusher:"))
|
|
643
691
|
return;
|
|
644
692
|
let h = String(this.options.namespace ?? "").replace(
|
|
645
693
|
/\./g,
|
|
646
694
|
"\\"
|
|
647
|
-
),
|
|
648
|
-
i(
|
|
695
|
+
), d = s.startsWith(h) ? s.substring(h.length + 1) : "." + s;
|
|
696
|
+
i(d, a);
|
|
649
697
|
}), this;
|
|
650
698
|
}
|
|
651
699
|
/**
|
|
652
700
|
* Stop listening for an event on the channel instance.
|
|
653
701
|
*/
|
|
654
|
-
stopListening(i,
|
|
655
|
-
return
|
|
702
|
+
stopListening(i, s) {
|
|
703
|
+
return s ? this.subscription.unbind(
|
|
656
704
|
this.eventFormatter.format(i),
|
|
657
|
-
|
|
705
|
+
s
|
|
658
706
|
) : this.subscription.unbind(this.eventFormatter.format(i)), this;
|
|
659
707
|
}
|
|
660
708
|
/**
|
|
@@ -675,25 +723,25 @@ class Ue extends qe {
|
|
|
675
723
|
* Register a callback to be called anytime a subscription error occurs.
|
|
676
724
|
*/
|
|
677
725
|
error(i) {
|
|
678
|
-
return this.on("pusher:subscription_error", (
|
|
679
|
-
i(
|
|
726
|
+
return this.on("pusher:subscription_error", (s) => {
|
|
727
|
+
i(s);
|
|
680
728
|
}), this;
|
|
681
729
|
}
|
|
682
730
|
/**
|
|
683
731
|
* Bind a channel to an event.
|
|
684
732
|
*/
|
|
685
|
-
on(i,
|
|
686
|
-
return this.subscription.bind(i,
|
|
733
|
+
on(i, s) {
|
|
734
|
+
return this.subscription.bind(i, s), this;
|
|
687
735
|
}
|
|
688
736
|
}
|
|
689
737
|
class St extends Ue {
|
|
690
738
|
/**
|
|
691
739
|
* Send a whisper event to other clients in the channel.
|
|
692
740
|
*/
|
|
693
|
-
whisper(i,
|
|
741
|
+
whisper(i, s) {
|
|
694
742
|
return this.pusher.channels.channels[this.name].trigger(
|
|
695
743
|
`client-${i}`,
|
|
696
|
-
|
|
744
|
+
s
|
|
697
745
|
), this;
|
|
698
746
|
}
|
|
699
747
|
}
|
|
@@ -701,45 +749,45 @@ class Di extends Ue {
|
|
|
701
749
|
/**
|
|
702
750
|
* Send a whisper event to other clients in the channel.
|
|
703
751
|
*/
|
|
704
|
-
whisper(i,
|
|
752
|
+
whisper(i, s) {
|
|
705
753
|
return this.pusher.channels.channels[this.name].trigger(
|
|
706
754
|
`client-${i}`,
|
|
707
|
-
|
|
755
|
+
s
|
|
708
756
|
), this;
|
|
709
757
|
}
|
|
710
758
|
}
|
|
711
|
-
class
|
|
759
|
+
class Fi extends St {
|
|
712
760
|
/**
|
|
713
761
|
* Register a callback to be called anytime the member list changes.
|
|
714
762
|
*/
|
|
715
763
|
here(i) {
|
|
716
|
-
return this.on("pusher:subscription_succeeded", (
|
|
717
|
-
i(Object.keys(
|
|
764
|
+
return this.on("pusher:subscription_succeeded", (s) => {
|
|
765
|
+
i(Object.keys(s.members).map((a) => s.members[a]));
|
|
718
766
|
}), this;
|
|
719
767
|
}
|
|
720
768
|
/**
|
|
721
769
|
* Listen for someone joining the channel.
|
|
722
770
|
*/
|
|
723
771
|
joining(i) {
|
|
724
|
-
return this.on("pusher:member_added", (
|
|
725
|
-
i(
|
|
772
|
+
return this.on("pusher:member_added", (s) => {
|
|
773
|
+
i(s.info);
|
|
726
774
|
}), this;
|
|
727
775
|
}
|
|
728
776
|
/**
|
|
729
777
|
* Send a whisper event to other clients in the channel.
|
|
730
778
|
*/
|
|
731
|
-
whisper(i,
|
|
779
|
+
whisper(i, s) {
|
|
732
780
|
return this.pusher.channels.channels[this.name].trigger(
|
|
733
781
|
`client-${i}`,
|
|
734
|
-
|
|
782
|
+
s
|
|
735
783
|
), this;
|
|
736
784
|
}
|
|
737
785
|
/**
|
|
738
786
|
* Listen for someone leaving the channel.
|
|
739
787
|
*/
|
|
740
788
|
leaving(i) {
|
|
741
|
-
return this.on("pusher:member_removed", (
|
|
742
|
-
i(
|
|
789
|
+
return this.on("pusher:member_removed", (s) => {
|
|
790
|
+
i(s.info);
|
|
743
791
|
}), this;
|
|
744
792
|
}
|
|
745
793
|
}
|
|
@@ -747,8 +795,8 @@ class Tt extends qe {
|
|
|
747
795
|
/**
|
|
748
796
|
* Create a new class instance.
|
|
749
797
|
*/
|
|
750
|
-
constructor(i,
|
|
751
|
-
super(), this.events = {}, this.listeners = {}, this.name =
|
|
798
|
+
constructor(i, s, a) {
|
|
799
|
+
super(), this.events = {}, this.listeners = {}, this.name = s, this.socket = i, this.options = a, this.eventFormatter = new Ct(this.options.namespace), this.subscribe();
|
|
752
800
|
}
|
|
753
801
|
/**
|
|
754
802
|
* Subscribe to a Socket.io channel.
|
|
@@ -771,21 +819,21 @@ class Tt extends qe {
|
|
|
771
819
|
/**
|
|
772
820
|
* Listen for an event on the channel instance.
|
|
773
821
|
*/
|
|
774
|
-
listen(i,
|
|
775
|
-
return this.on(this.eventFormatter.format(i),
|
|
822
|
+
listen(i, s) {
|
|
823
|
+
return this.on(this.eventFormatter.format(i), s), this;
|
|
776
824
|
}
|
|
777
825
|
/**
|
|
778
826
|
* Stop listening for an event on the channel instance.
|
|
779
827
|
*/
|
|
780
|
-
stopListening(i,
|
|
781
|
-
return this.unbindEvent(this.eventFormatter.format(i),
|
|
828
|
+
stopListening(i, s) {
|
|
829
|
+
return this.unbindEvent(this.eventFormatter.format(i), s), this;
|
|
782
830
|
}
|
|
783
831
|
/**
|
|
784
832
|
* Register a callback to be called anytime a subscription succeeds.
|
|
785
833
|
*/
|
|
786
834
|
subscribed(i) {
|
|
787
|
-
return this.on("connect", (
|
|
788
|
-
i(
|
|
835
|
+
return this.on("connect", (s) => {
|
|
836
|
+
i(s);
|
|
789
837
|
}), this;
|
|
790
838
|
}
|
|
791
839
|
/**
|
|
@@ -797,10 +845,10 @@ class Tt extends qe {
|
|
|
797
845
|
/**
|
|
798
846
|
* Bind the channel's socket to an event and store the callback.
|
|
799
847
|
*/
|
|
800
|
-
on(i,
|
|
848
|
+
on(i, s) {
|
|
801
849
|
return this.listeners[i] = this.listeners[i] || [], this.events[i] || (this.events[i] = (a, h) => {
|
|
802
|
-
this.name === a && this.listeners[i] && this.listeners[i].forEach((
|
|
803
|
-
}, this.socket.on(i, this.events[i])), this.listeners[i].push(
|
|
850
|
+
this.name === a && this.listeners[i] && this.listeners[i].forEach((d) => d(h));
|
|
851
|
+
}, this.socket.on(i, this.events[i])), this.listeners[i].push(s), this;
|
|
804
852
|
}
|
|
805
853
|
/**
|
|
806
854
|
* Unbind the channel's socket from all stored event callbacks.
|
|
@@ -813,31 +861,31 @@ class Tt extends qe {
|
|
|
813
861
|
/**
|
|
814
862
|
* Unbind the listeners for the given event.
|
|
815
863
|
*/
|
|
816
|
-
unbindEvent(i,
|
|
817
|
-
this.listeners[i] = this.listeners[i] || [],
|
|
818
|
-
(a) => a !==
|
|
819
|
-
)), (!
|
|
864
|
+
unbindEvent(i, s) {
|
|
865
|
+
this.listeners[i] = this.listeners[i] || [], s && (this.listeners[i] = this.listeners[i].filter(
|
|
866
|
+
(a) => a !== s
|
|
867
|
+
)), (!s || this.listeners[i].length === 0) && (this.events[i] && (this.socket.removeListener(i, this.events[i]), delete this.events[i]), delete this.listeners[i]);
|
|
820
868
|
}
|
|
821
869
|
}
|
|
822
|
-
class
|
|
870
|
+
class xt extends Tt {
|
|
823
871
|
/**
|
|
824
872
|
* Send a whisper event to other clients in the channel.
|
|
825
873
|
*/
|
|
826
|
-
whisper(i,
|
|
874
|
+
whisper(i, s) {
|
|
827
875
|
return this.socket.emit("client event", {
|
|
828
876
|
channel: this.name,
|
|
829
877
|
event: `client-${i}`,
|
|
830
|
-
data:
|
|
878
|
+
data: s
|
|
831
879
|
}), this;
|
|
832
880
|
}
|
|
833
881
|
}
|
|
834
|
-
class
|
|
882
|
+
class Wi extends xt {
|
|
835
883
|
/**
|
|
836
884
|
* Register a callback to be called anytime the member list changes.
|
|
837
885
|
*/
|
|
838
886
|
here(i) {
|
|
839
|
-
return this.on("presence:subscribed", (
|
|
840
|
-
i(
|
|
887
|
+
return this.on("presence:subscribed", (s) => {
|
|
888
|
+
i(s.map((a) => a.user_info));
|
|
841
889
|
}), this;
|
|
842
890
|
}
|
|
843
891
|
/**
|
|
@@ -846,17 +894,17 @@ class Fi extends _t {
|
|
|
846
894
|
joining(i) {
|
|
847
895
|
return this.on(
|
|
848
896
|
"presence:joining",
|
|
849
|
-
(
|
|
897
|
+
(s) => i(s.user_info)
|
|
850
898
|
), this;
|
|
851
899
|
}
|
|
852
900
|
/**
|
|
853
901
|
* Send a whisper event to other clients in the channel.
|
|
854
902
|
*/
|
|
855
|
-
whisper(i,
|
|
903
|
+
whisper(i, s) {
|
|
856
904
|
return this.socket.emit("client event", {
|
|
857
905
|
channel: this.name,
|
|
858
906
|
event: `client-${i}`,
|
|
859
|
-
data:
|
|
907
|
+
data: s
|
|
860
908
|
}), this;
|
|
861
909
|
}
|
|
862
910
|
/**
|
|
@@ -865,7 +913,7 @@ class Fi extends _t {
|
|
|
865
913
|
leaving(i) {
|
|
866
914
|
return this.on(
|
|
867
915
|
"presence:leaving",
|
|
868
|
-
(
|
|
916
|
+
(s) => i(s.user_info)
|
|
869
917
|
), this;
|
|
870
918
|
}
|
|
871
919
|
}
|
|
@@ -883,7 +931,7 @@ class ge extends qe {
|
|
|
883
931
|
/**
|
|
884
932
|
* Listen for an event on the channel instance.
|
|
885
933
|
*/
|
|
886
|
-
listen(i,
|
|
934
|
+
listen(i, s) {
|
|
887
935
|
return this;
|
|
888
936
|
}
|
|
889
937
|
/**
|
|
@@ -895,7 +943,7 @@ class ge extends qe {
|
|
|
895
943
|
/**
|
|
896
944
|
* Stop listening for an event on the channel instance.
|
|
897
945
|
*/
|
|
898
|
-
stopListening(i,
|
|
946
|
+
stopListening(i, s) {
|
|
899
947
|
return this;
|
|
900
948
|
}
|
|
901
949
|
/**
|
|
@@ -913,15 +961,15 @@ class ge extends qe {
|
|
|
913
961
|
/**
|
|
914
962
|
* Bind a channel to an event.
|
|
915
963
|
*/
|
|
916
|
-
on(i,
|
|
964
|
+
on(i, s) {
|
|
917
965
|
return this;
|
|
918
966
|
}
|
|
919
967
|
}
|
|
920
|
-
class
|
|
968
|
+
class Et extends ge {
|
|
921
969
|
/**
|
|
922
970
|
* Send a whisper event to other clients in the channel.
|
|
923
971
|
*/
|
|
924
|
-
whisper(i,
|
|
972
|
+
whisper(i, s) {
|
|
925
973
|
return this;
|
|
926
974
|
}
|
|
927
975
|
}
|
|
@@ -929,11 +977,11 @@ class Bi extends ge {
|
|
|
929
977
|
/**
|
|
930
978
|
* Send a whisper event to other clients in the channel.
|
|
931
979
|
*/
|
|
932
|
-
whisper(i,
|
|
980
|
+
whisper(i, s) {
|
|
933
981
|
return this;
|
|
934
982
|
}
|
|
935
983
|
}
|
|
936
|
-
class $i extends
|
|
984
|
+
class $i extends Et {
|
|
937
985
|
/**
|
|
938
986
|
* Register a callback to be called anytime the member list changes.
|
|
939
987
|
*/
|
|
@@ -949,7 +997,7 @@ class $i extends xt {
|
|
|
949
997
|
/**
|
|
950
998
|
* Send a whisper event to other clients in the channel.
|
|
951
999
|
*/
|
|
952
|
-
whisper(i,
|
|
1000
|
+
whisper(i, s) {
|
|
953
1001
|
return this;
|
|
954
1002
|
}
|
|
955
1003
|
/**
|
|
@@ -959,7 +1007,7 @@ class $i extends xt {
|
|
|
959
1007
|
return this;
|
|
960
1008
|
}
|
|
961
1009
|
}
|
|
962
|
-
const
|
|
1010
|
+
const _t = class kt {
|
|
963
1011
|
/**
|
|
964
1012
|
* Create a new class instance.
|
|
965
1013
|
*/
|
|
@@ -975,18 +1023,18 @@ const Et = class kt {
|
|
|
975
1023
|
...i,
|
|
976
1024
|
broadcaster: i.broadcaster
|
|
977
1025
|
};
|
|
978
|
-
let
|
|
979
|
-
|
|
1026
|
+
let s = this.csrfToken();
|
|
1027
|
+
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);
|
|
980
1028
|
}
|
|
981
1029
|
/**
|
|
982
1030
|
* Extract the CSRF token from the page.
|
|
983
1031
|
*/
|
|
984
1032
|
csrfToken() {
|
|
985
|
-
var i,
|
|
986
|
-
return typeof window < "u" && (i = window.Laravel) != null && i.csrfToken ? window.Laravel.csrfToken : this.options.csrfToken ? this.options.csrfToken : typeof document < "u" && typeof document.querySelector == "function" ? ((
|
|
1033
|
+
var i, s;
|
|
1034
|
+
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;
|
|
987
1035
|
}
|
|
988
1036
|
};
|
|
989
|
-
|
|
1037
|
+
_t._defaultOptions = {
|
|
990
1038
|
auth: {
|
|
991
1039
|
headers: {}
|
|
992
1040
|
},
|
|
@@ -1001,7 +1049,7 @@ Et._defaultOptions = {
|
|
|
1001
1049
|
key: null,
|
|
1002
1050
|
namespace: "App.Events"
|
|
1003
1051
|
};
|
|
1004
|
-
let Ne =
|
|
1052
|
+
let Ne = _t;
|
|
1005
1053
|
class fe extends Ne {
|
|
1006
1054
|
constructor() {
|
|
1007
1055
|
super(...arguments), this.channels = {};
|
|
@@ -1033,8 +1081,8 @@ class fe extends Ne {
|
|
|
1033
1081
|
/**
|
|
1034
1082
|
* Listen for an event on a channel instance.
|
|
1035
1083
|
*/
|
|
1036
|
-
listen(i,
|
|
1037
|
-
return this.channel(i).listen(
|
|
1084
|
+
listen(i, s, a) {
|
|
1085
|
+
return this.channel(i).listen(s, a);
|
|
1038
1086
|
}
|
|
1039
1087
|
/**
|
|
1040
1088
|
* Get a channel instance by name.
|
|
@@ -1070,7 +1118,7 @@ class fe extends Ne {
|
|
|
1070
1118
|
* Get a presence channel instance by name.
|
|
1071
1119
|
*/
|
|
1072
1120
|
presenceChannel(i) {
|
|
1073
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1121
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Fi(
|
|
1074
1122
|
this.pusher,
|
|
1075
1123
|
"presence-" + i,
|
|
1076
1124
|
this.options
|
|
@@ -1085,8 +1133,8 @@ class fe extends Ne {
|
|
|
1085
1133
|
"private-" + i,
|
|
1086
1134
|
"private-encrypted-" + i,
|
|
1087
1135
|
"presence-" + i
|
|
1088
|
-
].forEach((
|
|
1089
|
-
this.leaveChannel(
|
|
1136
|
+
].forEach((s) => {
|
|
1137
|
+
this.leaveChannel(s);
|
|
1090
1138
|
});
|
|
1091
1139
|
}
|
|
1092
1140
|
/**
|
|
@@ -1121,14 +1169,14 @@ class fe extends Ne {
|
|
|
1121
1169
|
* Subscribe to connection status changes.
|
|
1122
1170
|
*/
|
|
1123
1171
|
onConnectionChange(i) {
|
|
1124
|
-
const
|
|
1172
|
+
const s = () => {
|
|
1125
1173
|
i(this.connectionStatus());
|
|
1126
1174
|
}, a = ["state_change", "connected", "disconnected"];
|
|
1127
1175
|
return a.forEach((h) => {
|
|
1128
|
-
this.pusher.connection.bind(h,
|
|
1176
|
+
this.pusher.connection.bind(h, s);
|
|
1129
1177
|
}), () => {
|
|
1130
1178
|
a.forEach((h) => {
|
|
1131
|
-
this.pusher.connection.unbind(h,
|
|
1179
|
+
this.pusher.connection.unbind(h, s);
|
|
1132
1180
|
});
|
|
1133
1181
|
};
|
|
1134
1182
|
}
|
|
@@ -1152,8 +1200,8 @@ class Xi extends Ne {
|
|
|
1152
1200
|
this.options.host ?? void 0,
|
|
1153
1201
|
this.options
|
|
1154
1202
|
), this.socket.io.on("reconnect", () => {
|
|
1155
|
-
Object.values(this.channels).forEach((
|
|
1156
|
-
|
|
1203
|
+
Object.values(this.channels).forEach((s) => {
|
|
1204
|
+
s.subscribe();
|
|
1157
1205
|
});
|
|
1158
1206
|
});
|
|
1159
1207
|
}
|
|
@@ -1172,8 +1220,8 @@ class Xi extends Ne {
|
|
|
1172
1220
|
/**
|
|
1173
1221
|
* Listen for an event on a channel instance.
|
|
1174
1222
|
*/
|
|
1175
|
-
listen(i,
|
|
1176
|
-
return this.channel(i).listen(
|
|
1223
|
+
listen(i, s, a) {
|
|
1224
|
+
return this.channel(i).listen(s, a);
|
|
1177
1225
|
}
|
|
1178
1226
|
/**
|
|
1179
1227
|
* Get a channel instance by name.
|
|
@@ -1189,7 +1237,7 @@ class Xi extends Ne {
|
|
|
1189
1237
|
* Get a private channel instance by name.
|
|
1190
1238
|
*/
|
|
1191
1239
|
privateChannel(i) {
|
|
1192
|
-
return this.channels["private-" + i] || (this.channels["private-" + i] = new
|
|
1240
|
+
return this.channels["private-" + i] || (this.channels["private-" + i] = new xt(
|
|
1193
1241
|
this.socket,
|
|
1194
1242
|
"private-" + i,
|
|
1195
1243
|
this.options
|
|
@@ -1199,7 +1247,7 @@ class Xi extends Ne {
|
|
|
1199
1247
|
* Get a presence channel instance by name.
|
|
1200
1248
|
*/
|
|
1201
1249
|
presenceChannel(i) {
|
|
1202
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1250
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Wi(
|
|
1203
1251
|
this.socket,
|
|
1204
1252
|
"presence-" + i,
|
|
1205
1253
|
this.options
|
|
@@ -1209,8 +1257,8 @@ class Xi extends Ne {
|
|
|
1209
1257
|
* Leave the given channel, as well as its private and presence variants.
|
|
1210
1258
|
*/
|
|
1211
1259
|
leave(i) {
|
|
1212
|
-
[i, "private-" + i, "presence-" + i].forEach((
|
|
1213
|
-
this.leaveChannel(
|
|
1260
|
+
[i, "private-" + i, "presence-" + i].forEach((s) => {
|
|
1261
|
+
this.leaveChannel(s);
|
|
1214
1262
|
});
|
|
1215
1263
|
}
|
|
1216
1264
|
/**
|
|
@@ -1235,7 +1283,7 @@ class Xi extends Ne {
|
|
|
1235
1283
|
* Subscribe to connection status changes.
|
|
1236
1284
|
*/
|
|
1237
1285
|
onConnectionChange(i) {
|
|
1238
|
-
const
|
|
1286
|
+
const s = () => {
|
|
1239
1287
|
i(this.connectionStatus());
|
|
1240
1288
|
}, a = [
|
|
1241
1289
|
"connect",
|
|
@@ -1247,10 +1295,10 @@ class Xi extends Ne {
|
|
|
1247
1295
|
"reconnect_failed"
|
|
1248
1296
|
];
|
|
1249
1297
|
return a.forEach((h) => {
|
|
1250
|
-
this.socket.on(h,
|
|
1298
|
+
this.socket.on(h, s);
|
|
1251
1299
|
}), () => {
|
|
1252
1300
|
a.forEach((h) => {
|
|
1253
|
-
this.socket.off(h,
|
|
1301
|
+
this.socket.off(h, s);
|
|
1254
1302
|
});
|
|
1255
1303
|
};
|
|
1256
1304
|
}
|
|
@@ -1273,7 +1321,7 @@ class mt extends Ne {
|
|
|
1273
1321
|
/**
|
|
1274
1322
|
* Listen for an event on a channel instance.
|
|
1275
1323
|
*/
|
|
1276
|
-
listen(i,
|
|
1324
|
+
listen(i, s, a) {
|
|
1277
1325
|
return new ge();
|
|
1278
1326
|
}
|
|
1279
1327
|
/**
|
|
@@ -1286,7 +1334,7 @@ class mt extends Ne {
|
|
|
1286
1334
|
* Get a private channel instance by name.
|
|
1287
1335
|
*/
|
|
1288
1336
|
privateChannel(i) {
|
|
1289
|
-
return new
|
|
1337
|
+
return new Et();
|
|
1290
1338
|
}
|
|
1291
1339
|
/**
|
|
1292
1340
|
* Get a private encrypted channel instance by name.
|
|
@@ -1410,8 +1458,8 @@ class Vi {
|
|
|
1410
1458
|
/**
|
|
1411
1459
|
* Listen for an event on a channel instance.
|
|
1412
1460
|
*/
|
|
1413
|
-
listen(i,
|
|
1414
|
-
return this.connector.listen(i,
|
|
1461
|
+
listen(i, s, a) {
|
|
1462
|
+
return this.connector.listen(i, s, a);
|
|
1415
1463
|
}
|
|
1416
1464
|
/**
|
|
1417
1465
|
* Get a private channel instance by name.
|
|
@@ -1458,8 +1506,8 @@ class Vi {
|
|
|
1458
1506
|
*/
|
|
1459
1507
|
registerVueRequestInterceptor() {
|
|
1460
1508
|
Vue.http.interceptors.push(
|
|
1461
|
-
(i,
|
|
1462
|
-
this.socketId() && i.headers.set("X-Socket-ID", this.socketId()),
|
|
1509
|
+
(i, s) => {
|
|
1510
|
+
this.socketId() && i.headers.set("X-Socket-ID", this.socketId()), s();
|
|
1463
1511
|
}
|
|
1464
1512
|
);
|
|
1465
1513
|
}
|
|
@@ -1476,7 +1524,7 @@ class Vi {
|
|
|
1476
1524
|
*/
|
|
1477
1525
|
registerjQueryAjaxSetup() {
|
|
1478
1526
|
typeof jQuery.ajax < "u" && jQuery.ajaxPrefilter(
|
|
1479
|
-
(i,
|
|
1527
|
+
(i, s, a) => {
|
|
1480
1528
|
this.socketId() && a.setRequestHeader("X-Socket-Id", this.socketId());
|
|
1481
1529
|
}
|
|
1482
1530
|
);
|
|
@@ -1505,150 +1553,150 @@ function Gi() {
|
|
|
1505
1553
|
})(self, () => (
|
|
1506
1554
|
/******/
|
|
1507
1555
|
(() => {
|
|
1508
|
-
var
|
|
1556
|
+
var s = {
|
|
1509
1557
|
/***/
|
|
1510
1558
|
594(m, g) {
|
|
1511
1559
|
var y = this && this.__extends || /* @__PURE__ */ (function() {
|
|
1512
|
-
var
|
|
1513
|
-
return
|
|
1560
|
+
var x = function(u, f) {
|
|
1561
|
+
return x = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(S, L) {
|
|
1514
1562
|
S.__proto__ = L;
|
|
1515
1563
|
} || function(S, L) {
|
|
1516
1564
|
for (var q in L) L.hasOwnProperty(q) && (S[q] = L[q]);
|
|
1517
|
-
},
|
|
1565
|
+
}, x(u, f);
|
|
1518
1566
|
};
|
|
1519
|
-
return function(
|
|
1520
|
-
|
|
1567
|
+
return function(u, f) {
|
|
1568
|
+
x(u, f);
|
|
1521
1569
|
function S() {
|
|
1522
|
-
this.constructor =
|
|
1570
|
+
this.constructor = u;
|
|
1523
1571
|
}
|
|
1524
|
-
|
|
1572
|
+
u.prototype = f === null ? Object.create(f) : (S.prototype = f.prototype, new S());
|
|
1525
1573
|
};
|
|
1526
1574
|
})();
|
|
1527
1575
|
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
1528
|
-
var
|
|
1576
|
+
var E = 256, w = (
|
|
1529
1577
|
/** @class */
|
|
1530
1578
|
(function() {
|
|
1531
|
-
function
|
|
1532
|
-
|
|
1579
|
+
function x(u) {
|
|
1580
|
+
u === void 0 && (u = "="), this._paddingCharacter = u;
|
|
1533
1581
|
}
|
|
1534
|
-
return
|
|
1535
|
-
return this._paddingCharacter ? (
|
|
1536
|
-
},
|
|
1537
|
-
for (var f = "", S = 0; S <
|
|
1538
|
-
var L =
|
|
1582
|
+
return x.prototype.encodedLength = function(u) {
|
|
1583
|
+
return this._paddingCharacter ? (u + 2) / 3 * 4 | 0 : (u * 8 + 5) / 6 | 0;
|
|
1584
|
+
}, x.prototype.encode = function(u) {
|
|
1585
|
+
for (var f = "", S = 0; S < u.length - 2; S += 3) {
|
|
1586
|
+
var L = u[S] << 16 | u[S + 1] << 8 | u[S + 2];
|
|
1539
1587
|
f += this._encodeByte(L >>> 18 & 63), f += this._encodeByte(L >>> 12 & 63), f += this._encodeByte(L >>> 6 & 63), f += this._encodeByte(L >>> 0 & 63);
|
|
1540
1588
|
}
|
|
1541
|
-
var q =
|
|
1589
|
+
var q = u.length - S;
|
|
1542
1590
|
if (q > 0) {
|
|
1543
|
-
var L =
|
|
1591
|
+
var L = u[S] << 16 | (q === 2 ? u[S + 1] << 8 : 0);
|
|
1544
1592
|
f += this._encodeByte(L >>> 18 & 63), f += this._encodeByte(L >>> 12 & 63), q === 2 ? f += this._encodeByte(L >>> 6 & 63) : f += this._paddingCharacter || "", f += this._paddingCharacter || "";
|
|
1545
1593
|
}
|
|
1546
1594
|
return f;
|
|
1547
|
-
},
|
|
1548
|
-
return this._paddingCharacter ?
|
|
1549
|
-
},
|
|
1550
|
-
return this.maxDecodedLength(
|
|
1551
|
-
},
|
|
1552
|
-
if (
|
|
1595
|
+
}, x.prototype.maxDecodedLength = function(u) {
|
|
1596
|
+
return this._paddingCharacter ? u / 4 * 3 | 0 : (u * 6 + 7) / 8 | 0;
|
|
1597
|
+
}, x.prototype.decodedLength = function(u) {
|
|
1598
|
+
return this.maxDecodedLength(u.length - this._getPaddingLength(u));
|
|
1599
|
+
}, x.prototype.decode = function(u) {
|
|
1600
|
+
if (u.length === 0)
|
|
1553
1601
|
return new Uint8Array(0);
|
|
1554
|
-
for (var f = this._getPaddingLength(
|
|
1555
|
-
J = this._decodeChar(
|
|
1556
|
-
if (
|
|
1602
|
+
for (var f = this._getPaddingLength(u), S = u.length - f, L = new Uint8Array(this.maxDecodedLength(S)), q = 0, M = 0, z = 0, J = 0, D = 0, H = 0, G = 0; M < S - 4; M += 4)
|
|
1603
|
+
J = this._decodeChar(u.charCodeAt(M + 0)), D = this._decodeChar(u.charCodeAt(M + 1)), H = this._decodeChar(u.charCodeAt(M + 2)), G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = J << 2 | D >>> 4, L[q++] = D << 4 | H >>> 2, L[q++] = H << 6 | G, z |= J & E, z |= D & E, z |= H & E, z |= G & E;
|
|
1604
|
+
if (M < S - 1 && (J = this._decodeChar(u.charCodeAt(M)), D = this._decodeChar(u.charCodeAt(M + 1)), L[q++] = J << 2 | D >>> 4, z |= J & E, z |= D & E), M < S - 2 && (H = this._decodeChar(u.charCodeAt(M + 2)), L[q++] = D << 4 | H >>> 2, z |= H & E), M < S - 3 && (G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = H << 6 | G, z |= G & E), z !== 0)
|
|
1557
1605
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
1558
1606
|
return L;
|
|
1559
|
-
},
|
|
1560
|
-
var f =
|
|
1561
|
-
return f += 65, f += 25 -
|
|
1562
|
-
},
|
|
1563
|
-
var f =
|
|
1564
|
-
return f += (42 -
|
|
1565
|
-
},
|
|
1607
|
+
}, x.prototype._encodeByte = function(u) {
|
|
1608
|
+
var f = u;
|
|
1609
|
+
return f += 65, f += 25 - u >>> 8 & 6, f += 51 - u >>> 8 & -75, f += 61 - u >>> 8 & -15, f += 62 - u >>> 8 & 3, String.fromCharCode(f);
|
|
1610
|
+
}, x.prototype._decodeChar = function(u) {
|
|
1611
|
+
var f = E;
|
|
1612
|
+
return f += (42 - u & u - 44) >>> 8 & -E + u - 43 + 62, f += (46 - u & u - 48) >>> 8 & -E + u - 47 + 63, f += (47 - u & u - 58) >>> 8 & -E + u - 48 + 52, f += (64 - u & u - 91) >>> 8 & -E + u - 65 + 0, f += (96 - u & u - 123) >>> 8 & -E + u - 97 + 26, f;
|
|
1613
|
+
}, x.prototype._getPaddingLength = function(u) {
|
|
1566
1614
|
var f = 0;
|
|
1567
1615
|
if (this._paddingCharacter) {
|
|
1568
|
-
for (var S =
|
|
1616
|
+
for (var S = u.length - 1; S >= 0 && u[S] === this._paddingCharacter; S--)
|
|
1569
1617
|
f++;
|
|
1570
|
-
if (
|
|
1618
|
+
if (u.length < 4 || f > 2)
|
|
1571
1619
|
throw new Error("Base64Coder: incorrect padding");
|
|
1572
1620
|
}
|
|
1573
1621
|
return f;
|
|
1574
|
-
},
|
|
1622
|
+
}, x;
|
|
1575
1623
|
})()
|
|
1576
1624
|
);
|
|
1577
1625
|
g.Coder = w;
|
|
1578
1626
|
var R = new w();
|
|
1579
|
-
function T(
|
|
1580
|
-
return R.encode(
|
|
1627
|
+
function T(x) {
|
|
1628
|
+
return R.encode(x);
|
|
1581
1629
|
}
|
|
1582
1630
|
g.encode = T;
|
|
1583
|
-
function A(
|
|
1584
|
-
return R.decode(
|
|
1631
|
+
function A(x) {
|
|
1632
|
+
return R.decode(x);
|
|
1585
1633
|
}
|
|
1586
1634
|
g.decode = A;
|
|
1587
|
-
var
|
|
1635
|
+
var F = (
|
|
1588
1636
|
/** @class */
|
|
1589
|
-
(function(
|
|
1590
|
-
y(
|
|
1591
|
-
function
|
|
1592
|
-
return
|
|
1637
|
+
(function(x) {
|
|
1638
|
+
y(u, x);
|
|
1639
|
+
function u() {
|
|
1640
|
+
return x !== null && x.apply(this, arguments) || this;
|
|
1593
1641
|
}
|
|
1594
|
-
return
|
|
1642
|
+
return u.prototype._encodeByte = function(f) {
|
|
1595
1643
|
var S = f;
|
|
1596
1644
|
return S += 65, S += 25 - f >>> 8 & 6, S += 51 - f >>> 8 & -75, S += 61 - f >>> 8 & -13, S += 62 - f >>> 8 & 49, String.fromCharCode(S);
|
|
1597
|
-
},
|
|
1598
|
-
var S =
|
|
1599
|
-
return S += (44 - f & f - 46) >>> 8 & -
|
|
1600
|
-
},
|
|
1645
|
+
}, u.prototype._decodeChar = function(f) {
|
|
1646
|
+
var S = E;
|
|
1647
|
+
return S += (44 - f & f - 46) >>> 8 & -E + f - 45 + 62, S += (94 - f & f - 96) >>> 8 & -E + f - 95 + 63, S += (47 - f & f - 58) >>> 8 & -E + f - 48 + 52, S += (64 - f & f - 91) >>> 8 & -E + f - 65 + 0, S += (96 - f & f - 123) >>> 8 & -E + f - 97 + 26, S;
|
|
1648
|
+
}, u;
|
|
1601
1649
|
})(w)
|
|
1602
1650
|
);
|
|
1603
|
-
g.URLSafeCoder =
|
|
1604
|
-
var N = new
|
|
1605
|
-
function
|
|
1606
|
-
return N.encode(
|
|
1651
|
+
g.URLSafeCoder = F;
|
|
1652
|
+
var N = new F();
|
|
1653
|
+
function W(x) {
|
|
1654
|
+
return N.encode(x);
|
|
1607
1655
|
}
|
|
1608
|
-
g.encodeURLSafe =
|
|
1609
|
-
function te(
|
|
1610
|
-
return N.decode(
|
|
1656
|
+
g.encodeURLSafe = W;
|
|
1657
|
+
function te(x) {
|
|
1658
|
+
return N.decode(x);
|
|
1611
1659
|
}
|
|
1612
|
-
g.decodeURLSafe = te, g.encodedLength = function(
|
|
1613
|
-
return R.encodedLength(
|
|
1614
|
-
}, g.maxDecodedLength = function(
|
|
1615
|
-
return R.maxDecodedLength(
|
|
1616
|
-
}, g.decodedLength = function(
|
|
1617
|
-
return R.decodedLength(
|
|
1660
|
+
g.decodeURLSafe = te, g.encodedLength = function(x) {
|
|
1661
|
+
return R.encodedLength(x);
|
|
1662
|
+
}, g.maxDecodedLength = function(x) {
|
|
1663
|
+
return R.maxDecodedLength(x);
|
|
1664
|
+
}, g.decodedLength = function(x) {
|
|
1665
|
+
return R.decodedLength(x);
|
|
1618
1666
|
};
|
|
1619
1667
|
},
|
|
1620
1668
|
/***/
|
|
1621
1669
|
978(m, g) {
|
|
1622
1670
|
var y = "utf8: invalid source encoding";
|
|
1623
|
-
function
|
|
1671
|
+
function E(w) {
|
|
1624
1672
|
for (var R = [], T = 0; T < w.length; T++) {
|
|
1625
1673
|
var A = w[T];
|
|
1626
1674
|
if (A & 128) {
|
|
1627
|
-
var
|
|
1675
|
+
var F = void 0;
|
|
1628
1676
|
if (A < 224) {
|
|
1629
1677
|
if (T >= w.length)
|
|
1630
1678
|
throw new Error(y);
|
|
1631
1679
|
var N = w[++T];
|
|
1632
1680
|
if ((N & 192) !== 128)
|
|
1633
1681
|
throw new Error(y);
|
|
1634
|
-
A = (A & 31) << 6 | N & 63,
|
|
1682
|
+
A = (A & 31) << 6 | N & 63, F = 128;
|
|
1635
1683
|
} else if (A < 240) {
|
|
1636
1684
|
if (T >= w.length - 1)
|
|
1637
1685
|
throw new Error(y);
|
|
1638
|
-
var N = w[++T],
|
|
1639
|
-
if ((N & 192) !== 128 || (
|
|
1686
|
+
var N = w[++T], W = w[++T];
|
|
1687
|
+
if ((N & 192) !== 128 || (W & 192) !== 128)
|
|
1640
1688
|
throw new Error(y);
|
|
1641
|
-
A = (A & 15) << 12 | (N & 63) << 6 |
|
|
1689
|
+
A = (A & 15) << 12 | (N & 63) << 6 | W & 63, F = 2048;
|
|
1642
1690
|
} else if (A < 248) {
|
|
1643
1691
|
if (T >= w.length - 2)
|
|
1644
1692
|
throw new Error(y);
|
|
1645
|
-
var N = w[++T],
|
|
1646
|
-
if ((N & 192) !== 128 || (
|
|
1693
|
+
var N = w[++T], W = w[++T], te = w[++T];
|
|
1694
|
+
if ((N & 192) !== 128 || (W & 192) !== 128 || (te & 192) !== 128)
|
|
1647
1695
|
throw new Error(y);
|
|
1648
|
-
A = (A & 15) << 18 | (N & 63) << 12 | (
|
|
1696
|
+
A = (A & 15) << 18 | (N & 63) << 12 | (W & 63) << 6 | te & 63, F = 65536;
|
|
1649
1697
|
} else
|
|
1650
1698
|
throw new Error(y);
|
|
1651
|
-
if (A <
|
|
1699
|
+
if (A < F || A >= 55296 && A <= 57343)
|
|
1652
1700
|
throw new Error(y);
|
|
1653
1701
|
if (A >= 65536) {
|
|
1654
1702
|
if (A > 1114111)
|
|
@@ -1660,7 +1708,7 @@ function Gi() {
|
|
|
1660
1708
|
}
|
|
1661
1709
|
return R.join("");
|
|
1662
1710
|
}
|
|
1663
|
-
g.D4 =
|
|
1711
|
+
g.D4 = E;
|
|
1664
1712
|
},
|
|
1665
1713
|
/***/
|
|
1666
1714
|
721(m, g, y) {
|
|
@@ -1671,25 +1719,25 @@ function Gi() {
|
|
|
1671
1719
|
y.d(g, {
|
|
1672
1720
|
default: () => (
|
|
1673
1721
|
/* binding */
|
|
1674
|
-
|
|
1722
|
+
de
|
|
1675
1723
|
)
|
|
1676
1724
|
});
|
|
1677
|
-
class
|
|
1725
|
+
class E {
|
|
1678
1726
|
constructor(e, t) {
|
|
1679
1727
|
this.lastId = 0, this.prefix = e, this.name = t;
|
|
1680
1728
|
}
|
|
1681
1729
|
create(e) {
|
|
1682
1730
|
this.lastId++;
|
|
1683
|
-
var t = this.lastId, r = this.prefix + t,
|
|
1731
|
+
var t = this.lastId, r = this.prefix + t, o = this.name + "[" + t + "]", c = !1, l = function() {
|
|
1684
1732
|
c || (e.apply(null, arguments), c = !0);
|
|
1685
1733
|
};
|
|
1686
|
-
return this[t] = l, { number: t, id: r, name:
|
|
1734
|
+
return this[t] = l, { number: t, id: r, name: o, callback: l };
|
|
1687
1735
|
}
|
|
1688
1736
|
remove(e) {
|
|
1689
1737
|
delete this[e.number];
|
|
1690
1738
|
}
|
|
1691
1739
|
}
|
|
1692
|
-
var w = new
|
|
1740
|
+
var w = new E("_pusher_script_", "Pusher.ScriptReceivers"), R = {
|
|
1693
1741
|
VERSION: "8.5.0",
|
|
1694
1742
|
PROTOCOL: 7,
|
|
1695
1743
|
wsPort: 80,
|
|
@@ -1723,19 +1771,19 @@ function Gi() {
|
|
|
1723
1771
|
this.options = e, this.receivers = e.receivers || w, this.loading = {};
|
|
1724
1772
|
}
|
|
1725
1773
|
load(e, t, r) {
|
|
1726
|
-
var
|
|
1727
|
-
if (
|
|
1728
|
-
|
|
1774
|
+
var o = this;
|
|
1775
|
+
if (o.loading[e] && o.loading[e].length > 0)
|
|
1776
|
+
o.loading[e].push(r);
|
|
1729
1777
|
else {
|
|
1730
|
-
|
|
1731
|
-
var c = C.createScriptRequest(
|
|
1732
|
-
if (
|
|
1733
|
-
var b =
|
|
1734
|
-
delete
|
|
1735
|
-
for (var
|
|
1778
|
+
o.loading[e] = [r];
|
|
1779
|
+
var c = C.createScriptRequest(o.getPath(e, t)), l = o.receivers.create(function(p) {
|
|
1780
|
+
if (o.receivers.remove(l), o.loading[e]) {
|
|
1781
|
+
var b = o.loading[e];
|
|
1782
|
+
delete o.loading[e];
|
|
1783
|
+
for (var _ = function(I) {
|
|
1736
1784
|
I || c.cleanup();
|
|
1737
1785
|
}, k = 0; k < b.length; k++)
|
|
1738
|
-
b[k](p,
|
|
1786
|
+
b[k](p, _);
|
|
1739
1787
|
}
|
|
1740
1788
|
});
|
|
1741
1789
|
c.send(l);
|
|
@@ -1749,14 +1797,14 @@ function Gi() {
|
|
|
1749
1797
|
return this.getRoot(t) + "/" + e + this.options.suffix + ".js";
|
|
1750
1798
|
}
|
|
1751
1799
|
}
|
|
1752
|
-
var
|
|
1800
|
+
var F = new E("_pusher_dependencies", "Pusher.DependenciesReceivers"), N = new A({
|
|
1753
1801
|
cdn_http: T.cdn_http,
|
|
1754
1802
|
cdn_https: T.cdn_https,
|
|
1755
1803
|
version: T.VERSION,
|
|
1756
1804
|
suffix: T.dependency_suffix,
|
|
1757
|
-
receivers:
|
|
1805
|
+
receivers: F
|
|
1758
1806
|
});
|
|
1759
|
-
const
|
|
1807
|
+
const W = {
|
|
1760
1808
|
baseUrl: "https://pusher.com",
|
|
1761
1809
|
urls: {
|
|
1762
1810
|
authenticationEndpoint: {
|
|
@@ -1775,17 +1823,17 @@ function Gi() {
|
|
|
1775
1823
|
fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"
|
|
1776
1824
|
}
|
|
1777
1825
|
}
|
|
1778
|
-
},
|
|
1779
|
-
const e = "See:", t =
|
|
1826
|
+
}, x = { buildLogSuffix: function(n) {
|
|
1827
|
+
const e = "See:", t = W.urls[n];
|
|
1780
1828
|
if (!t)
|
|
1781
1829
|
return "";
|
|
1782
1830
|
let r;
|
|
1783
|
-
return t.fullUrl ? r = t.fullUrl : t.path && (r =
|
|
1831
|
+
return t.fullUrl ? r = t.fullUrl : t.path && (r = W.baseUrl + t.path), r ? `${e} ${r}` : "";
|
|
1784
1832
|
} };
|
|
1785
|
-
var
|
|
1833
|
+
var u;
|
|
1786
1834
|
(function(n) {
|
|
1787
1835
|
n.UserAuthentication = "user-authentication", n.ChannelAuthorization = "channel-authorization";
|
|
1788
|
-
})(
|
|
1836
|
+
})(u || (u = {}));
|
|
1789
1837
|
class f extends Error {
|
|
1790
1838
|
constructor(e) {
|
|
1791
1839
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
@@ -1806,7 +1854,7 @@ function Gi() {
|
|
|
1806
1854
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1807
1855
|
}
|
|
1808
1856
|
}
|
|
1809
|
-
class
|
|
1857
|
+
class M extends Error {
|
|
1810
1858
|
constructor(e) {
|
|
1811
1859
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1812
1860
|
}
|
|
@@ -1831,7 +1879,7 @@ function Gi() {
|
|
|
1831
1879
|
super(t), this.status = e, Object.setPrototypeOf(this, new.target.prototype);
|
|
1832
1880
|
}
|
|
1833
1881
|
}
|
|
1834
|
-
const Lt = function(n, e, t, r,
|
|
1882
|
+
const Lt = function(n, e, t, r, o) {
|
|
1835
1883
|
const c = C.createXHR();
|
|
1836
1884
|
c.open("POST", t.endpoint, !0), c.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
1837
1885
|
for (var l in t.headers)
|
|
@@ -1848,20 +1896,20 @@ function Gi() {
|
|
|
1848
1896
|
try {
|
|
1849
1897
|
p = JSON.parse(c.responseText), b = !0;
|
|
1850
1898
|
} catch {
|
|
1851
|
-
|
|
1899
|
+
o(new H(200, `JSON returned from ${r.toString()} endpoint was invalid, yet status code was 200. Data was: ${c.responseText}`), null);
|
|
1852
1900
|
}
|
|
1853
|
-
b &&
|
|
1901
|
+
b && o(null, p);
|
|
1854
1902
|
} else {
|
|
1855
1903
|
let p = "";
|
|
1856
1904
|
switch (r) {
|
|
1857
|
-
case
|
|
1858
|
-
p =
|
|
1905
|
+
case u.UserAuthentication:
|
|
1906
|
+
p = x.buildLogSuffix("authenticationEndpoint");
|
|
1859
1907
|
break;
|
|
1860
|
-
case
|
|
1861
|
-
p = `Clients must be authorized to join private or presence channels. ${
|
|
1908
|
+
case u.ChannelAuthorization:
|
|
1909
|
+
p = `Clients must be authorized to join private or presence channels. ${x.buildLogSuffix("authorizationEndpoint")}`;
|
|
1862
1910
|
break;
|
|
1863
1911
|
}
|
|
1864
|
-
|
|
1912
|
+
o(new H(c.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${c.status} from ${t.endpoint}. ${p}`), null);
|
|
1865
1913
|
}
|
|
1866
1914
|
}, c.send(e), c;
|
|
1867
1915
|
};
|
|
@@ -1885,9 +1933,9 @@ function Gi() {
|
|
|
1885
1933
|
return n.replace(/[\s\S]{1,3}/g, Ot);
|
|
1886
1934
|
};
|
|
1887
1935
|
class Ut {
|
|
1888
|
-
constructor(e, t, r,
|
|
1936
|
+
constructor(e, t, r, o) {
|
|
1889
1937
|
this.clear = t, this.timer = e(() => {
|
|
1890
|
-
this.timer && (this.timer =
|
|
1938
|
+
this.timer && (this.timer = o(this.timer));
|
|
1891
1939
|
}, r);
|
|
1892
1940
|
}
|
|
1893
1941
|
isRunning() {
|
|
@@ -1901,7 +1949,7 @@ function Gi() {
|
|
|
1901
1949
|
function Nt(n) {
|
|
1902
1950
|
window.clearTimeout(n);
|
|
1903
1951
|
}
|
|
1904
|
-
function
|
|
1952
|
+
function Mt(n) {
|
|
1905
1953
|
window.clearInterval(n);
|
|
1906
1954
|
}
|
|
1907
1955
|
class Y extends ze {
|
|
@@ -1911,9 +1959,9 @@ function Gi() {
|
|
|
1911
1959
|
});
|
|
1912
1960
|
}
|
|
1913
1961
|
}
|
|
1914
|
-
class
|
|
1962
|
+
class jt extends ze {
|
|
1915
1963
|
constructor(e, t) {
|
|
1916
|
-
super(setInterval,
|
|
1964
|
+
super(setInterval, Mt, e, function(r) {
|
|
1917
1965
|
return t(), r;
|
|
1918
1966
|
});
|
|
1919
1967
|
}
|
|
@@ -1933,11 +1981,11 @@ function Gi() {
|
|
|
1933
1981
|
}
|
|
1934
1982
|
};
|
|
1935
1983
|
const U = zt;
|
|
1936
|
-
function
|
|
1984
|
+
function j(n, ...e) {
|
|
1937
1985
|
for (var t = 0; t < e.length; t++) {
|
|
1938
1986
|
var r = e[t];
|
|
1939
|
-
for (var
|
|
1940
|
-
r[
|
|
1987
|
+
for (var o in r)
|
|
1988
|
+
r[o] && r[o].constructor && r[o].constructor === Object ? n[o] = j(n[o] || {}, r[o]) : n[o] = r[o];
|
|
1941
1989
|
}
|
|
1942
1990
|
return n;
|
|
1943
1991
|
}
|
|
@@ -1952,7 +2000,7 @@ function Gi() {
|
|
|
1952
2000
|
return -1;
|
|
1953
2001
|
if (t && n.indexOf === t)
|
|
1954
2002
|
return n.indexOf(e);
|
|
1955
|
-
for (var r = 0,
|
|
2003
|
+
for (var r = 0, o = n.length; r < o; r++)
|
|
1956
2004
|
if (n[r] === e)
|
|
1957
2005
|
return r;
|
|
1958
2006
|
return -1;
|
|
@@ -1977,20 +2025,20 @@ function Gi() {
|
|
|
1977
2025
|
for (var r = 0; r < n.length; r++)
|
|
1978
2026
|
e.call(t || window, n[r], r, n);
|
|
1979
2027
|
}
|
|
1980
|
-
function
|
|
2028
|
+
function Fe(n, e) {
|
|
1981
2029
|
for (var t = [], r = 0; r < n.length; r++)
|
|
1982
2030
|
t.push(e(n[r], r, n, t));
|
|
1983
2031
|
return t;
|
|
1984
2032
|
}
|
|
1985
|
-
function
|
|
2033
|
+
function Ft(n, e) {
|
|
1986
2034
|
var t = {};
|
|
1987
|
-
return B(n, function(r,
|
|
1988
|
-
t[
|
|
2035
|
+
return B(n, function(r, o) {
|
|
2036
|
+
t[o] = e(r);
|
|
1989
2037
|
}), t;
|
|
1990
2038
|
}
|
|
1991
|
-
function
|
|
1992
|
-
e = e || function(
|
|
1993
|
-
return !!
|
|
2039
|
+
function We(n, e) {
|
|
2040
|
+
e = e || function(o) {
|
|
2041
|
+
return !!o;
|
|
1994
2042
|
};
|
|
1995
2043
|
for (var t = [], r = 0; r < n.length; r++)
|
|
1996
2044
|
e(n[r], r, n, t) && t.push(n[r]);
|
|
@@ -1998,11 +2046,11 @@ function Gi() {
|
|
|
1998
2046
|
}
|
|
1999
2047
|
function Be(n, e) {
|
|
2000
2048
|
var t = {};
|
|
2001
|
-
return B(n, function(r,
|
|
2002
|
-
(e && e(r,
|
|
2049
|
+
return B(n, function(r, o) {
|
|
2050
|
+
(e && e(r, o, n, t) || r) && (t[o] = r);
|
|
2003
2051
|
}), t;
|
|
2004
2052
|
}
|
|
2005
|
-
function
|
|
2053
|
+
function Wt(n) {
|
|
2006
2054
|
var e = [];
|
|
2007
2055
|
return B(n, function(t, r) {
|
|
2008
2056
|
e.push([r, t]);
|
|
@@ -2021,40 +2069,40 @@ function Gi() {
|
|
|
2021
2069
|
return !0;
|
|
2022
2070
|
}
|
|
2023
2071
|
function $t(n) {
|
|
2024
|
-
return
|
|
2072
|
+
return Ft(n, function(e) {
|
|
2025
2073
|
return typeof e == "object" && (e = ae(e)), encodeURIComponent(Pt(e.toString()));
|
|
2026
2074
|
});
|
|
2027
2075
|
}
|
|
2028
2076
|
function Xt(n) {
|
|
2029
2077
|
var e = Be(n, function(r) {
|
|
2030
2078
|
return r !== void 0;
|
|
2031
|
-
}), t =
|
|
2079
|
+
}), t = Fe(Wt($t(e)), U.method("join", "=")).join("&");
|
|
2032
2080
|
return t;
|
|
2033
2081
|
}
|
|
2034
2082
|
function Vt(n) {
|
|
2035
2083
|
var e = [], t = [];
|
|
2036
|
-
return (function r(
|
|
2084
|
+
return (function r(o, c) {
|
|
2037
2085
|
var l, p, b;
|
|
2038
|
-
switch (typeof
|
|
2086
|
+
switch (typeof o) {
|
|
2039
2087
|
case "object":
|
|
2040
|
-
if (!
|
|
2088
|
+
if (!o)
|
|
2041
2089
|
return null;
|
|
2042
2090
|
for (l = 0; l < e.length; l += 1)
|
|
2043
|
-
if (e[l] ===
|
|
2091
|
+
if (e[l] === o)
|
|
2044
2092
|
return { $ref: t[l] };
|
|
2045
|
-
if (e.push(
|
|
2046
|
-
for (b = [], l = 0; l <
|
|
2047
|
-
b[l] = r(
|
|
2093
|
+
if (e.push(o), t.push(c), Object.prototype.toString.apply(o) === "[object Array]")
|
|
2094
|
+
for (b = [], l = 0; l < o.length; l += 1)
|
|
2095
|
+
b[l] = r(o[l], c + "[" + l + "]");
|
|
2048
2096
|
else {
|
|
2049
2097
|
b = {};
|
|
2050
|
-
for (p in
|
|
2051
|
-
Object.prototype.hasOwnProperty.call(
|
|
2098
|
+
for (p in o)
|
|
2099
|
+
Object.prototype.hasOwnProperty.call(o, p) && (b[p] = r(o[p], c + "[" + JSON.stringify(p) + "]"));
|
|
2052
2100
|
}
|
|
2053
2101
|
return b;
|
|
2054
2102
|
case "number":
|
|
2055
2103
|
case "string":
|
|
2056
2104
|
case "boolean":
|
|
2057
|
-
return
|
|
2105
|
+
return o;
|
|
2058
2106
|
}
|
|
2059
2107
|
})(n, "$");
|
|
2060
2108
|
}
|
|
@@ -2088,22 +2136,22 @@ function Gi() {
|
|
|
2088
2136
|
}
|
|
2089
2137
|
log(e, ...t) {
|
|
2090
2138
|
var r = Ht.apply(this, arguments);
|
|
2091
|
-
|
|
2139
|
+
de.log ? de.log(r) : de.logToConsole && e.bind(this)(r);
|
|
2092
2140
|
}
|
|
2093
2141
|
}
|
|
2094
2142
|
const P = new Jt();
|
|
2095
|
-
var Gt = function(n, e, t, r,
|
|
2143
|
+
var Gt = function(n, e, t, r, o) {
|
|
2096
2144
|
(t.headers !== void 0 || t.headersProvider != null) && P.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
2097
2145
|
var c = n.nextAuthCallbackID.toString();
|
|
2098
2146
|
n.nextAuthCallbackID++;
|
|
2099
2147
|
var l = n.getDocument(), p = l.createElement("script");
|
|
2100
2148
|
n.auth_callbacks[c] = function(k) {
|
|
2101
|
-
|
|
2149
|
+
o(null, k);
|
|
2102
2150
|
};
|
|
2103
2151
|
var b = "Pusher.auth_callbacks['" + c + "']";
|
|
2104
2152
|
p.src = t.endpoint + "?callback=" + encodeURIComponent(b) + "&" + e;
|
|
2105
|
-
var
|
|
2106
|
-
|
|
2153
|
+
var _ = l.getElementsByTagName("head")[0] || l.documentElement;
|
|
2154
|
+
_.insertBefore(p, _.firstChild);
|
|
2107
2155
|
};
|
|
2108
2156
|
const Yt = Gt;
|
|
2109
2157
|
class Kt {
|
|
@@ -2119,8 +2167,8 @@ function Gi() {
|
|
|
2119
2167
|
}) : t.script.onreadystatechange = function() {
|
|
2120
2168
|
(t.script.readyState === "loaded" || t.script.readyState === "complete") && e.callback(null);
|
|
2121
2169
|
}, 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;
|
|
2122
|
-
var
|
|
2123
|
-
|
|
2170
|
+
var o = document.getElementsByTagName("head")[0];
|
|
2171
|
+
o.insertBefore(t.script, o.firstChild), t.errorScript && o.insertBefore(t.errorScript, t.script.nextSibling);
|
|
2124
2172
|
}
|
|
2125
2173
|
cleanup() {
|
|
2126
2174
|
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;
|
|
@@ -2142,8 +2190,8 @@ function Gi() {
|
|
|
2142
2190
|
}
|
|
2143
2191
|
var Zt = function(n, e) {
|
|
2144
2192
|
return function(t, r) {
|
|
2145
|
-
var
|
|
2146
|
-
w.remove(p), l.cleanup(),
|
|
2193
|
+
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(b, _) {
|
|
2194
|
+
w.remove(p), l.cleanup(), _ && _.host && (n.host = _.host), r && r(b, _);
|
|
2147
2195
|
});
|
|
2148
2196
|
l.send(p);
|
|
2149
2197
|
};
|
|
@@ -2153,8 +2201,8 @@ function Gi() {
|
|
|
2153
2201
|
};
|
|
2154
2202
|
const tn = en;
|
|
2155
2203
|
function ye(n, e, t) {
|
|
2156
|
-
var r = n + (e.useTLS ? "s" : ""),
|
|
2157
|
-
return r + "://" +
|
|
2204
|
+
var r = n + (e.useTLS ? "s" : ""), o = e.useTLS ? e.hostTLS : e.hostNonTLS;
|
|
2205
|
+
return r + "://" + o + t;
|
|
2158
2206
|
}
|
|
2159
2207
|
function be(n, e) {
|
|
2160
2208
|
var t = "/app/" + n, r = "?protocol=" + T.PROTOCOL + "&client=js&version=" + T.VERSION + (e ? "&" + e : "");
|
|
@@ -2186,8 +2234,8 @@ function Gi() {
|
|
|
2186
2234
|
return this._callbacks[we(e)];
|
|
2187
2235
|
}
|
|
2188
2236
|
add(e, t, r) {
|
|
2189
|
-
var
|
|
2190
|
-
this._callbacks[
|
|
2237
|
+
var o = we(e);
|
|
2238
|
+
this._callbacks[o] = this._callbacks[o] || [], this._callbacks[o].push({
|
|
2191
2239
|
fn: t,
|
|
2192
2240
|
context: r
|
|
2193
2241
|
});
|
|
@@ -2197,14 +2245,14 @@ function Gi() {
|
|
|
2197
2245
|
this._callbacks = {};
|
|
2198
2246
|
return;
|
|
2199
2247
|
}
|
|
2200
|
-
var
|
|
2201
|
-
t || r ? this.removeCallback(
|
|
2248
|
+
var o = e ? [we(e)] : De(this._callbacks);
|
|
2249
|
+
t || r ? this.removeCallback(o, t, r) : this.removeAllCallbacks(o);
|
|
2202
2250
|
}
|
|
2203
2251
|
removeCallback(e, t, r) {
|
|
2204
|
-
ie(e, function(
|
|
2205
|
-
this._callbacks[
|
|
2252
|
+
ie(e, function(o) {
|
|
2253
|
+
this._callbacks[o] = We(this._callbacks[o] || [], function(c) {
|
|
2206
2254
|
return t && t !== c.fn || r && r !== c.context;
|
|
2207
|
-
}), this._callbacks[
|
|
2255
|
+
}), this._callbacks[o].length === 0 && delete this._callbacks[o];
|
|
2208
2256
|
}, this);
|
|
2209
2257
|
}
|
|
2210
2258
|
removeAllCallbacks(e) {
|
|
@@ -2230,25 +2278,25 @@ function Gi() {
|
|
|
2230
2278
|
return this.callbacks.remove(e, t, r), this;
|
|
2231
2279
|
}
|
|
2232
2280
|
unbind_global(e) {
|
|
2233
|
-
return e ? (this.global_callbacks =
|
|
2281
|
+
return e ? (this.global_callbacks = We(this.global_callbacks || [], (t) => t !== e), this) : (this.global_callbacks = [], this);
|
|
2234
2282
|
}
|
|
2235
2283
|
unbind_all() {
|
|
2236
2284
|
return this.unbind(), this.unbind_global(), this;
|
|
2237
2285
|
}
|
|
2238
2286
|
emit(e, t, r) {
|
|
2239
|
-
for (var
|
|
2240
|
-
this.global_callbacks[
|
|
2287
|
+
for (var o = 0; o < this.global_callbacks.length; o++)
|
|
2288
|
+
this.global_callbacks[o](e, t);
|
|
2241
2289
|
var c = this.callbacks.get(e), l = [];
|
|
2242
2290
|
if (r ? l.push(t, r) : t && l.push(t), c && c.length > 0)
|
|
2243
|
-
for (var
|
|
2244
|
-
c[
|
|
2291
|
+
for (var o = 0; o < c.length; o++)
|
|
2292
|
+
c[o].fn.apply(c[o].context || window, l);
|
|
2245
2293
|
else this.failThrough && this.failThrough(e, t);
|
|
2246
2294
|
return this;
|
|
2247
2295
|
}
|
|
2248
2296
|
}
|
|
2249
2297
|
class an extends $ {
|
|
2250
|
-
constructor(e, t, r,
|
|
2251
|
-
super(), this.initialize = C.transportConnectionInitializer, this.hooks = e, this.name = t, this.priority = r, this.key =
|
|
2298
|
+
constructor(e, t, r, o, c) {
|
|
2299
|
+
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();
|
|
2252
2300
|
}
|
|
2253
2301
|
handlesActivityChecks() {
|
|
2254
2302
|
return !!this.hooks.handlesActivityChecks;
|
|
@@ -2322,7 +2370,7 @@ function Gi() {
|
|
|
2322
2370
|
})), this.emit(e, t);
|
|
2323
2371
|
}
|
|
2324
2372
|
buildTimelineMessage(e) {
|
|
2325
|
-
return
|
|
2373
|
+
return j({ cid: this.id }, e);
|
|
2326
2374
|
}
|
|
2327
2375
|
}
|
|
2328
2376
|
class ee {
|
|
@@ -2332,8 +2380,8 @@ function Gi() {
|
|
|
2332
2380
|
isSupported(e) {
|
|
2333
2381
|
return this.hooks.isSupported(e);
|
|
2334
2382
|
}
|
|
2335
|
-
createConnection(e, t, r,
|
|
2336
|
-
return new an(this.hooks, e, t, r,
|
|
2383
|
+
createConnection(e, t, r, o) {
|
|
2384
|
+
return new an(this.hooks, e, t, r, o);
|
|
2337
2385
|
}
|
|
2338
2386
|
}
|
|
2339
2387
|
var cn = new ee({
|
|
@@ -2356,11 +2404,11 @@ function Gi() {
|
|
|
2356
2404
|
isInitialized: function() {
|
|
2357
2405
|
return !0;
|
|
2358
2406
|
}
|
|
2359
|
-
}, Ve =
|
|
2407
|
+
}, Ve = j({
|
|
2360
2408
|
getSocket: function(n) {
|
|
2361
2409
|
return C.HTTPFactory.createStreamingSocket(n);
|
|
2362
2410
|
}
|
|
2363
|
-
}, Xe), Je =
|
|
2411
|
+
}, Xe), Je = j({
|
|
2364
2412
|
getSocket: function(n) {
|
|
2365
2413
|
return C.HTTPFactory.createPollingSocket(n);
|
|
2366
2414
|
}
|
|
@@ -2368,13 +2416,13 @@ function Gi() {
|
|
|
2368
2416
|
isSupported: function() {
|
|
2369
2417
|
return C.isXHRSupported();
|
|
2370
2418
|
}
|
|
2371
|
-
}, hn = new ee(
|
|
2419
|
+
}, hn = new ee(j({}, Ve, Ge)), ln = new ee(j({}, Je, Ge)), dn = {
|
|
2372
2420
|
ws: cn,
|
|
2373
2421
|
xhr_streaming: hn,
|
|
2374
2422
|
xhr_polling: ln
|
|
2375
2423
|
};
|
|
2376
|
-
const ce =
|
|
2377
|
-
var
|
|
2424
|
+
const ce = dn;
|
|
2425
|
+
var un = new ee({
|
|
2378
2426
|
file: "sockjs",
|
|
2379
2427
|
urls: sn,
|
|
2380
2428
|
handlesActivityChecks: !0,
|
|
@@ -2403,8 +2451,8 @@ function Gi() {
|
|
|
2403
2451
|
var e = C.isXDRSupported(n.useTLS);
|
|
2404
2452
|
return e;
|
|
2405
2453
|
}
|
|
2406
|
-
}, fn = new ee(
|
|
2407
|
-
ce.xdr_streaming = fn, ce.xdr_polling = pn, ce.sockjs =
|
|
2454
|
+
}, fn = new ee(j({}, Ve, Ye)), pn = new ee(j({}, Je, Ye));
|
|
2455
|
+
ce.xdr_streaming = fn, ce.xdr_polling = pn, ce.sockjs = un;
|
|
2408
2456
|
const mn = ce;
|
|
2409
2457
|
class gn extends $ {
|
|
2410
2458
|
constructor() {
|
|
@@ -2425,16 +2473,16 @@ function Gi() {
|
|
|
2425
2473
|
constructor(e, t, r) {
|
|
2426
2474
|
this.manager = e, this.transport = t, this.minPingDelay = r.minPingDelay, this.maxPingDelay = r.maxPingDelay, this.pingDelay = void 0;
|
|
2427
2475
|
}
|
|
2428
|
-
createConnection(e, t, r,
|
|
2429
|
-
|
|
2476
|
+
createConnection(e, t, r, o) {
|
|
2477
|
+
o = j({}, o, {
|
|
2430
2478
|
activityTimeout: this.pingDelay
|
|
2431
2479
|
});
|
|
2432
|
-
var c = this.transport.createConnection(e, t, r,
|
|
2480
|
+
var c = this.transport.createConnection(e, t, r, o), l = null, p = function() {
|
|
2433
2481
|
c.unbind("open", p), c.bind("closed", b), l = U.now();
|
|
2434
|
-
}, b = (
|
|
2435
|
-
if (c.unbind("closed", b),
|
|
2482
|
+
}, b = (_) => {
|
|
2483
|
+
if (c.unbind("closed", b), _.code === 1002 || _.code === 1003)
|
|
2436
2484
|
this.manager.reportDeath();
|
|
2437
|
-
else if (!
|
|
2485
|
+
else if (!_.wasClean && l) {
|
|
2438
2486
|
var k = U.now() - l;
|
|
2439
2487
|
k < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(k / 2, this.minPingDelay));
|
|
2440
2488
|
}
|
|
@@ -2460,8 +2508,8 @@ function Gi() {
|
|
|
2460
2508
|
data: t
|
|
2461
2509
|
};
|
|
2462
2510
|
return e.user_id && (r.user_id = e.user_id), r;
|
|
2463
|
-
} catch (
|
|
2464
|
-
throw { type: "MessageParseError", error:
|
|
2511
|
+
} catch (o) {
|
|
2512
|
+
throw { type: "MessageParseError", error: o, data: n.data };
|
|
2465
2513
|
}
|
|
2466
2514
|
},
|
|
2467
2515
|
encodeMessage: function(n) {
|
|
@@ -2510,8 +2558,8 @@ function Gi() {
|
|
|
2510
2558
|
return this.transport.send(e);
|
|
2511
2559
|
}
|
|
2512
2560
|
send_event(e, t, r) {
|
|
2513
|
-
var
|
|
2514
|
-
return r && (
|
|
2561
|
+
var o = { event: e, data: t };
|
|
2562
|
+
return r && (o.channel = r), P.debug("Event sent", o), this.send(K.encodeMessage(o));
|
|
2515
2563
|
}
|
|
2516
2564
|
ping() {
|
|
2517
2565
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -2522,9 +2570,9 @@ function Gi() {
|
|
|
2522
2570
|
bindListeners() {
|
|
2523
2571
|
var e = {
|
|
2524
2572
|
message: (r) => {
|
|
2525
|
-
var
|
|
2573
|
+
var o;
|
|
2526
2574
|
try {
|
|
2527
|
-
|
|
2575
|
+
o = K.decodeMessage(r);
|
|
2528
2576
|
} catch (c) {
|
|
2529
2577
|
this.emit("error", {
|
|
2530
2578
|
type: "MessageParseError",
|
|
@@ -2532,12 +2580,12 @@ function Gi() {
|
|
|
2532
2580
|
data: r.data
|
|
2533
2581
|
});
|
|
2534
2582
|
}
|
|
2535
|
-
if (
|
|
2536
|
-
switch (P.debug("Event recd",
|
|
2583
|
+
if (o !== void 0) {
|
|
2584
|
+
switch (P.debug("Event recd", o), o.event) {
|
|
2537
2585
|
case "pusher:error":
|
|
2538
2586
|
this.emit("error", {
|
|
2539
2587
|
type: "PusherError",
|
|
2540
|
-
data:
|
|
2588
|
+
data: o.data
|
|
2541
2589
|
});
|
|
2542
2590
|
break;
|
|
2543
2591
|
case "pusher:ping":
|
|
@@ -2547,7 +2595,7 @@ function Gi() {
|
|
|
2547
2595
|
this.emit("pong");
|
|
2548
2596
|
break;
|
|
2549
2597
|
}
|
|
2550
|
-
this.emit("message",
|
|
2598
|
+
this.emit("message", o);
|
|
2551
2599
|
}
|
|
2552
2600
|
},
|
|
2553
2601
|
activity: () => {
|
|
@@ -2560,12 +2608,12 @@ function Gi() {
|
|
|
2560
2608
|
t(), r && r.code && this.handleCloseEvent(r), this.transport = null, this.emit("closed");
|
|
2561
2609
|
}
|
|
2562
2610
|
}, t = () => {
|
|
2563
|
-
B(e, (r,
|
|
2564
|
-
this.transport.unbind(
|
|
2611
|
+
B(e, (r, o) => {
|
|
2612
|
+
this.transport.unbind(o, r);
|
|
2565
2613
|
});
|
|
2566
2614
|
};
|
|
2567
|
-
B(e, (r,
|
|
2568
|
-
this.transport.bind(
|
|
2615
|
+
B(e, (r, o) => {
|
|
2616
|
+
this.transport.bind(o, r);
|
|
2569
2617
|
});
|
|
2570
2618
|
}
|
|
2571
2619
|
handleCloseEvent(e) {
|
|
@@ -2604,7 +2652,7 @@ function Gi() {
|
|
|
2604
2652
|
this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
|
|
2605
2653
|
}
|
|
2606
2654
|
finish(e, t) {
|
|
2607
|
-
this.callback(
|
|
2655
|
+
this.callback(j({ transport: this.transport, action: e }, t));
|
|
2608
2656
|
}
|
|
2609
2657
|
}
|
|
2610
2658
|
class Cn {
|
|
@@ -2617,7 +2665,7 @@ function Gi() {
|
|
|
2617
2665
|
}
|
|
2618
2666
|
class Ce extends $ {
|
|
2619
2667
|
constructor(e, t) {
|
|
2620
|
-
super(function(r,
|
|
2668
|
+
super(function(r, o) {
|
|
2621
2669
|
P.debug("No callbacks on " + e + " for " + r);
|
|
2622
2670
|
}), this.name = e, this.pusher = t, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
2623
2671
|
}
|
|
@@ -2628,7 +2676,7 @@ function Gi() {
|
|
|
2628
2676
|
if (e.indexOf("client-") !== 0)
|
|
2629
2677
|
throw new f("Event '" + e + "' does not start with 'client-'");
|
|
2630
2678
|
if (!this.subscribed) {
|
|
2631
|
-
var r =
|
|
2679
|
+
var r = x.buildLogSuffix("triggeringClientEvents");
|
|
2632
2680
|
P.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`);
|
|
2633
2681
|
}
|
|
2634
2682
|
return this.pusher.send_event(e, t, this.name);
|
|
@@ -2643,8 +2691,8 @@ function Gi() {
|
|
|
2643
2691
|
else if (t === "pusher_internal:subscription_count")
|
|
2644
2692
|
this.handleSubscriptionCountEvent(e);
|
|
2645
2693
|
else if (t.indexOf("pusher_internal:") !== 0) {
|
|
2646
|
-
var
|
|
2647
|
-
this.emit(t, r,
|
|
2694
|
+
var o = {};
|
|
2695
|
+
this.emit(t, r, o);
|
|
2648
2696
|
}
|
|
2649
2697
|
}
|
|
2650
2698
|
handleSubscriptionSucceededEvent(e) {
|
|
@@ -2718,7 +2766,7 @@ function Gi() {
|
|
|
2718
2766
|
}
|
|
2719
2767
|
}
|
|
2720
2768
|
var Tn = function(n, e, t, r) {
|
|
2721
|
-
function
|
|
2769
|
+
function o(c) {
|
|
2722
2770
|
return c instanceof t ? c : new t(function(l) {
|
|
2723
2771
|
l(c);
|
|
2724
2772
|
});
|
|
@@ -2726,42 +2774,42 @@ function Gi() {
|
|
|
2726
2774
|
return new (t || (t = Promise))(function(c, l) {
|
|
2727
2775
|
function p(k) {
|
|
2728
2776
|
try {
|
|
2729
|
-
|
|
2777
|
+
_(r.next(k));
|
|
2730
2778
|
} catch (I) {
|
|
2731
2779
|
l(I);
|
|
2732
2780
|
}
|
|
2733
2781
|
}
|
|
2734
2782
|
function b(k) {
|
|
2735
2783
|
try {
|
|
2736
|
-
|
|
2784
|
+
_(r.throw(k));
|
|
2737
2785
|
} catch (I) {
|
|
2738
2786
|
l(I);
|
|
2739
2787
|
}
|
|
2740
2788
|
}
|
|
2741
|
-
function
|
|
2742
|
-
k.done ? c(k.value) :
|
|
2789
|
+
function _(k) {
|
|
2790
|
+
k.done ? c(k.value) : o(k.value).then(p, b);
|
|
2743
2791
|
}
|
|
2744
|
-
|
|
2792
|
+
_((r = r.apply(n, e || [])).next());
|
|
2745
2793
|
});
|
|
2746
2794
|
};
|
|
2747
|
-
class
|
|
2795
|
+
class xn extends Se {
|
|
2748
2796
|
constructor(e, t) {
|
|
2749
2797
|
super(e, t), this.members = new Sn();
|
|
2750
2798
|
}
|
|
2751
2799
|
authorize(e, t) {
|
|
2752
|
-
super.authorize(e, (r,
|
|
2800
|
+
super.authorize(e, (r, o) => Tn(this, void 0, void 0, function* () {
|
|
2753
2801
|
if (!r)
|
|
2754
|
-
if (
|
|
2755
|
-
var c = JSON.parse(
|
|
2802
|
+
if (o = o, o.channel_data != null) {
|
|
2803
|
+
var c = JSON.parse(o.channel_data);
|
|
2756
2804
|
this.members.setMyID(c.user_id);
|
|
2757
2805
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
2758
2806
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
2759
2807
|
else {
|
|
2760
|
-
let l =
|
|
2808
|
+
let l = x.buildLogSuffix("authorizationEndpoint");
|
|
2761
2809
|
P.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${l}, or the user should be signed in.`), t("Invalid auth response");
|
|
2762
2810
|
return;
|
|
2763
2811
|
}
|
|
2764
|
-
t(r,
|
|
2812
|
+
t(r, o);
|
|
2765
2813
|
}));
|
|
2766
2814
|
}
|
|
2767
2815
|
handleEvent(e) {
|
|
@@ -2769,8 +2817,8 @@ function Gi() {
|
|
|
2769
2817
|
if (t.indexOf("pusher_internal:") === 0)
|
|
2770
2818
|
this.handleInternalEvent(e);
|
|
2771
2819
|
else {
|
|
2772
|
-
var r = e.data,
|
|
2773
|
-
e.user_id && (
|
|
2820
|
+
var r = e.data, o = {};
|
|
2821
|
+
e.user_id && (o.user_id = e.user_id), this.emit(t, r, o);
|
|
2774
2822
|
}
|
|
2775
2823
|
}
|
|
2776
2824
|
handleInternalEvent(e) {
|
|
@@ -2783,8 +2831,8 @@ function Gi() {
|
|
|
2783
2831
|
this.handleSubscriptionCountEvent(e);
|
|
2784
2832
|
break;
|
|
2785
2833
|
case "pusher_internal:member_added":
|
|
2786
|
-
var
|
|
2787
|
-
this.emit("pusher:member_added",
|
|
2834
|
+
var o = this.members.addMember(r);
|
|
2835
|
+
this.emit("pusher:member_added", o);
|
|
2788
2836
|
break;
|
|
2789
2837
|
case "pusher_internal:member_removed":
|
|
2790
2838
|
var c = this.members.removeMember(r);
|
|
@@ -2799,23 +2847,23 @@ function Gi() {
|
|
|
2799
2847
|
this.members.reset(), super.disconnect();
|
|
2800
2848
|
}
|
|
2801
2849
|
}
|
|
2802
|
-
var
|
|
2803
|
-
class
|
|
2850
|
+
var En = y(978), Te = y(594);
|
|
2851
|
+
class _n extends Se {
|
|
2804
2852
|
constructor(e, t, r) {
|
|
2805
2853
|
super(e, t), this.key = null, this.nacl = r;
|
|
2806
2854
|
}
|
|
2807
2855
|
authorize(e, t) {
|
|
2808
|
-
super.authorize(e, (r,
|
|
2856
|
+
super.authorize(e, (r, o) => {
|
|
2809
2857
|
if (r) {
|
|
2810
|
-
t(r,
|
|
2858
|
+
t(r, o);
|
|
2811
2859
|
return;
|
|
2812
2860
|
}
|
|
2813
|
-
let c =
|
|
2861
|
+
let c = o.shared_secret;
|
|
2814
2862
|
if (!c) {
|
|
2815
2863
|
t(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2816
2864
|
return;
|
|
2817
2865
|
}
|
|
2818
|
-
this.key = (0, Te.decode)(c), delete
|
|
2866
|
+
this.key = (0, Te.decode)(c), delete o.shared_secret, t(null, o);
|
|
2819
2867
|
});
|
|
2820
2868
|
}
|
|
2821
2869
|
trigger(e, t) {
|
|
@@ -2843,19 +2891,19 @@ function Gi() {
|
|
|
2843
2891
|
P.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);
|
|
2844
2892
|
return;
|
|
2845
2893
|
}
|
|
2846
|
-
let
|
|
2847
|
-
if (
|
|
2848
|
-
P.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${
|
|
2894
|
+
let o = (0, Te.decode)(t.nonce);
|
|
2895
|
+
if (o.length < this.nacl.secretbox.nonceLength) {
|
|
2896
|
+
P.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${o.length}`);
|
|
2849
2897
|
return;
|
|
2850
2898
|
}
|
|
2851
|
-
let c = this.nacl.secretbox.open(r,
|
|
2899
|
+
let c = this.nacl.secretbox.open(r, o, this.key);
|
|
2852
2900
|
if (c === null) {
|
|
2853
2901
|
P.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (l, p) => {
|
|
2854
2902
|
if (l) {
|
|
2855
2903
|
P.error(`Failed to make a request to the authEndpoint: ${p}. Unable to fetch new key, so dropping encrypted event`);
|
|
2856
2904
|
return;
|
|
2857
2905
|
}
|
|
2858
|
-
if (c = this.nacl.secretbox.open(r,
|
|
2906
|
+
if (c = this.nacl.secretbox.open(r, o, this.key), c === null) {
|
|
2859
2907
|
P.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
2860
2908
|
return;
|
|
2861
2909
|
}
|
|
@@ -2866,7 +2914,7 @@ function Gi() {
|
|
|
2866
2914
|
this.emit(e, this.getDataToEmit(c));
|
|
2867
2915
|
}
|
|
2868
2916
|
getDataToEmit(e) {
|
|
2869
|
-
let t = (0,
|
|
2917
|
+
let t = (0, En.D4)(e);
|
|
2870
2918
|
try {
|
|
2871
2919
|
return JSON.parse(t);
|
|
2872
2920
|
} catch {
|
|
@@ -2963,7 +3011,7 @@ function Gi() {
|
|
|
2963
3011
|
this.activityTimer && this.activityTimer.ensureAborted();
|
|
2964
3012
|
}
|
|
2965
3013
|
buildConnectionCallbacks(e) {
|
|
2966
|
-
return
|
|
3014
|
+
return j({}, e, {
|
|
2967
3015
|
message: (t) => {
|
|
2968
3016
|
this.resetActivityCheck(), this.emit("message", t);
|
|
2969
3017
|
},
|
|
@@ -2982,7 +3030,7 @@ function Gi() {
|
|
|
2982
3030
|
});
|
|
2983
3031
|
}
|
|
2984
3032
|
buildHandshakeCallbacks(e) {
|
|
2985
|
-
return
|
|
3033
|
+
return j({}, e, {
|
|
2986
3034
|
connected: (t) => {
|
|
2987
3035
|
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 });
|
|
2988
3036
|
}
|
|
@@ -3025,8 +3073,8 @@ function Gi() {
|
|
|
3025
3073
|
updateState(e, t) {
|
|
3026
3074
|
var r = this.state;
|
|
3027
3075
|
if (this.state = e, r !== e) {
|
|
3028
|
-
var
|
|
3029
|
-
|
|
3076
|
+
var o = e;
|
|
3077
|
+
o === "connected" && (o += " with new socket ID " + t.socket_id), P.debug("State changed", r + " -> " + o), this.timeline.info({ state: e, params: t }), this.emit("state_change", { previous: r, current: e }), this.emit(e, t);
|
|
3030
3078
|
}
|
|
3031
3079
|
}
|
|
3032
3080
|
shouldRetry() {
|
|
@@ -3060,7 +3108,7 @@ function Gi() {
|
|
|
3060
3108
|
if (n.indexOf("private-encrypted-") === 0) {
|
|
3061
3109
|
if (e.config.nacl)
|
|
3062
3110
|
return X.createEncryptedChannel(n, e, e.config.nacl);
|
|
3063
|
-
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r =
|
|
3111
|
+
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r = x.buildLogSuffix("encryptedChannelSupport");
|
|
3064
3112
|
throw new z(`${t}. ${r}`);
|
|
3065
3113
|
} else {
|
|
3066
3114
|
if (n.indexOf("private-") === 0)
|
|
@@ -3086,10 +3134,10 @@ function Gi() {
|
|
|
3086
3134
|
return new Se(n, e);
|
|
3087
3135
|
},
|
|
3088
3136
|
createPresenceChannel(n, e) {
|
|
3089
|
-
return new
|
|
3137
|
+
return new xn(n, e);
|
|
3090
3138
|
},
|
|
3091
3139
|
createEncryptedChannel(n, e, t) {
|
|
3092
|
-
return new
|
|
3140
|
+
return new _n(n, e, t);
|
|
3093
3141
|
},
|
|
3094
3142
|
createTimelineSender(n, e) {
|
|
3095
3143
|
return new Cn(n, e);
|
|
@@ -3127,10 +3175,10 @@ function Gi() {
|
|
|
3127
3175
|
return $e(this.strategies, U.method("isSupported"));
|
|
3128
3176
|
}
|
|
3129
3177
|
connect(e, t) {
|
|
3130
|
-
var r = this.strategies,
|
|
3131
|
-
|
|
3178
|
+
var r = this.strategies, o = 0, c = this.timeout, l = null, p = (b, _) => {
|
|
3179
|
+
_ ? t(null, _) : (o = o + 1, this.loop && (o = o % r.length), o < r.length ? (c && (c = c * 2, this.timeoutLimit && (c = Math.min(c, this.timeoutLimit))), l = this.tryStrategy(r[o], e, { timeout: c, failFast: this.failFast }, p)) : t(!0));
|
|
3132
3180
|
};
|
|
3133
|
-
return l = this.tryStrategy(r[
|
|
3181
|
+
return l = this.tryStrategy(r[o], e, { timeout: c, failFast: this.failFast }, p), {
|
|
3134
3182
|
abort: function() {
|
|
3135
3183
|
l.abort();
|
|
3136
3184
|
},
|
|
@@ -3139,12 +3187,12 @@ function Gi() {
|
|
|
3139
3187
|
}
|
|
3140
3188
|
};
|
|
3141
3189
|
}
|
|
3142
|
-
tryStrategy(e, t, r,
|
|
3190
|
+
tryStrategy(e, t, r, o) {
|
|
3143
3191
|
var c = null, l = null;
|
|
3144
3192
|
return r.timeout > 0 && (c = new Y(r.timeout, function() {
|
|
3145
|
-
l.abort(),
|
|
3193
|
+
l.abort(), o(!0);
|
|
3146
3194
|
})), l = e.connect(t, function(p, b) {
|
|
3147
|
-
p && c && c.isRunning() && !r.failFast || (c && c.ensureAborted(),
|
|
3195
|
+
p && c && c.isRunning() && !r.failFast || (c && c.ensureAborted(), o(p, b));
|
|
3148
3196
|
}), {
|
|
3149
3197
|
abort: function() {
|
|
3150
3198
|
c && c.ensureAborted(), l.abort();
|
|
@@ -3155,7 +3203,7 @@ function Gi() {
|
|
|
3155
3203
|
};
|
|
3156
3204
|
}
|
|
3157
3205
|
}
|
|
3158
|
-
class
|
|
3206
|
+
class xe {
|
|
3159
3207
|
constructor(e) {
|
|
3160
3208
|
this.strategies = e;
|
|
3161
3209
|
}
|
|
@@ -3163,13 +3211,13 @@ function Gi() {
|
|
|
3163
3211
|
return $e(this.strategies, U.method("isSupported"));
|
|
3164
3212
|
}
|
|
3165
3213
|
connect(e, t) {
|
|
3166
|
-
return Rn(this.strategies, e, function(r,
|
|
3214
|
+
return Rn(this.strategies, e, function(r, o) {
|
|
3167
3215
|
return function(c, l) {
|
|
3168
|
-
if (
|
|
3169
|
-
In(
|
|
3216
|
+
if (o[r].error = c, c) {
|
|
3217
|
+
In(o) && t(!0);
|
|
3170
3218
|
return;
|
|
3171
3219
|
}
|
|
3172
|
-
ie(
|
|
3220
|
+
ie(o, function(p) {
|
|
3173
3221
|
p.forceMinPriority(l.transport.priority);
|
|
3174
3222
|
}), t(null, l);
|
|
3175
3223
|
};
|
|
@@ -3177,16 +3225,16 @@ function Gi() {
|
|
|
3177
3225
|
}
|
|
3178
3226
|
}
|
|
3179
3227
|
function Rn(n, e, t) {
|
|
3180
|
-
var r =
|
|
3181
|
-
return
|
|
3228
|
+
var r = Fe(n, function(o, c, l, p) {
|
|
3229
|
+
return o.connect(e, t(c, p));
|
|
3182
3230
|
});
|
|
3183
3231
|
return {
|
|
3184
3232
|
abort: function() {
|
|
3185
3233
|
ie(r, On);
|
|
3186
3234
|
},
|
|
3187
|
-
forceMinPriority: function(
|
|
3235
|
+
forceMinPriority: function(o) {
|
|
3188
3236
|
ie(r, function(c) {
|
|
3189
|
-
c.forceMinPriority(
|
|
3237
|
+
c.forceMinPriority(o);
|
|
3190
3238
|
});
|
|
3191
3239
|
}
|
|
3192
3240
|
};
|
|
@@ -3207,39 +3255,39 @@ function Gi() {
|
|
|
3207
3255
|
return this.strategy.isSupported();
|
|
3208
3256
|
}
|
|
3209
3257
|
connect(e, t) {
|
|
3210
|
-
var r = this.usingTLS,
|
|
3211
|
-
if (
|
|
3212
|
-
var p = this.transports[
|
|
3213
|
-
p && (["ws", "wss"].includes(
|
|
3258
|
+
var r = this.usingTLS, o = Un(r), c = o && o.cacheSkipCount ? o.cacheSkipCount : 0, l = [this.strategy];
|
|
3259
|
+
if (o && o.timestamp + this.ttl >= U.now()) {
|
|
3260
|
+
var p = this.transports[o.transport];
|
|
3261
|
+
p && (["ws", "wss"].includes(o.transport) || c > 3 ? (this.timeline.info({
|
|
3214
3262
|
cached: !0,
|
|
3215
|
-
transport:
|
|
3216
|
-
latency:
|
|
3263
|
+
transport: o.transport,
|
|
3264
|
+
latency: o.latency
|
|
3217
3265
|
}), l.push(new Q([p], {
|
|
3218
|
-
timeout:
|
|
3266
|
+
timeout: o.latency * 2 + 1e3,
|
|
3219
3267
|
failFast: !0
|
|
3220
3268
|
}))) : c++);
|
|
3221
3269
|
}
|
|
3222
|
-
var b = U.now(),
|
|
3223
|
-
I ? (Ze(r), l.length > 0 ? (b = U.now(),
|
|
3270
|
+
var b = U.now(), _ = l.pop().connect(e, function k(I, ue) {
|
|
3271
|
+
I ? (Ze(r), l.length > 0 ? (b = U.now(), _ = l.pop().connect(e, k)) : t(I)) : (Nn(r, ue.transport.name, U.now() - b, c), t(null, ue));
|
|
3224
3272
|
});
|
|
3225
3273
|
return {
|
|
3226
3274
|
abort: function() {
|
|
3227
|
-
|
|
3275
|
+
_.abort();
|
|
3228
3276
|
},
|
|
3229
3277
|
forceMinPriority: function(k) {
|
|
3230
|
-
e = k,
|
|
3278
|
+
e = k, _ && _.forceMinPriority(k);
|
|
3231
3279
|
}
|
|
3232
3280
|
};
|
|
3233
3281
|
}
|
|
3234
3282
|
}
|
|
3235
|
-
function
|
|
3283
|
+
function Ee(n) {
|
|
3236
3284
|
return "pusherTransport" + (n ? "TLS" : "NonTLS");
|
|
3237
3285
|
}
|
|
3238
3286
|
function Un(n) {
|
|
3239
3287
|
var e = C.getLocalStorage();
|
|
3240
3288
|
if (e)
|
|
3241
3289
|
try {
|
|
3242
|
-
var t = e[
|
|
3290
|
+
var t = e[Ee(n)];
|
|
3243
3291
|
if (t)
|
|
3244
3292
|
return JSON.parse(t);
|
|
3245
3293
|
} catch {
|
|
@@ -3248,10 +3296,10 @@ function Gi() {
|
|
|
3248
3296
|
return null;
|
|
3249
3297
|
}
|
|
3250
3298
|
function Nn(n, e, t, r) {
|
|
3251
|
-
var
|
|
3252
|
-
if (
|
|
3299
|
+
var o = C.getLocalStorage();
|
|
3300
|
+
if (o)
|
|
3253
3301
|
try {
|
|
3254
|
-
|
|
3302
|
+
o[Ee(n)] = ae({
|
|
3255
3303
|
timestamp: U.now(),
|
|
3256
3304
|
transport: e,
|
|
3257
3305
|
latency: t,
|
|
@@ -3264,7 +3312,7 @@ function Gi() {
|
|
|
3264
3312
|
var e = C.getLocalStorage();
|
|
3265
3313
|
if (e)
|
|
3266
3314
|
try {
|
|
3267
|
-
delete e[
|
|
3315
|
+
delete e[Ee(n)];
|
|
3268
3316
|
} catch {
|
|
3269
3317
|
}
|
|
3270
3318
|
}
|
|
@@ -3276,15 +3324,15 @@ function Gi() {
|
|
|
3276
3324
|
return this.strategy.isSupported();
|
|
3277
3325
|
}
|
|
3278
3326
|
connect(e, t) {
|
|
3279
|
-
var r = this.strategy,
|
|
3280
|
-
|
|
3327
|
+
var r = this.strategy, o, c = new Y(this.options.delay, function() {
|
|
3328
|
+
o = r.connect(e, t);
|
|
3281
3329
|
});
|
|
3282
3330
|
return {
|
|
3283
3331
|
abort: function() {
|
|
3284
|
-
c.ensureAborted(),
|
|
3332
|
+
c.ensureAborted(), o && o.abort();
|
|
3285
3333
|
},
|
|
3286
3334
|
forceMinPriority: function(l) {
|
|
3287
|
-
e = l,
|
|
3335
|
+
e = l, o && o.forceMinPriority(l);
|
|
3288
3336
|
}
|
|
3289
3337
|
};
|
|
3290
3338
|
}
|
|
@@ -3302,7 +3350,7 @@ function Gi() {
|
|
|
3302
3350
|
return r.connect(e, t);
|
|
3303
3351
|
}
|
|
3304
3352
|
}
|
|
3305
|
-
class
|
|
3353
|
+
class Mn {
|
|
3306
3354
|
constructor(e) {
|
|
3307
3355
|
this.strategy = e;
|
|
3308
3356
|
}
|
|
@@ -3310,8 +3358,8 @@ function Gi() {
|
|
|
3310
3358
|
return this.strategy.isSupported();
|
|
3311
3359
|
}
|
|
3312
3360
|
connect(e, t) {
|
|
3313
|
-
var r = this.strategy.connect(e, function(
|
|
3314
|
-
c && r.abort(), t(
|
|
3361
|
+
var r = this.strategy.connect(e, function(o, c) {
|
|
3362
|
+
c && r.abort(), t(o, c);
|
|
3315
3363
|
});
|
|
3316
3364
|
return r;
|
|
3317
3365
|
}
|
|
@@ -3321,11 +3369,11 @@ function Gi() {
|
|
|
3321
3369
|
return n.isSupported();
|
|
3322
3370
|
};
|
|
3323
3371
|
}
|
|
3324
|
-
var
|
|
3372
|
+
var jn = function(n, e, t) {
|
|
3325
3373
|
var r = {};
|
|
3326
|
-
function
|
|
3327
|
-
var ft = t(n,
|
|
3328
|
-
return r[
|
|
3374
|
+
function o(ut, Ui, Ni, Mi, ji) {
|
|
3375
|
+
var ft = t(n, ut, Ui, Ni, Mi, ji);
|
|
3376
|
+
return r[ut] = ft, ft;
|
|
3329
3377
|
}
|
|
3330
3378
|
var c = Object.assign({}, e, {
|
|
3331
3379
|
hostNonTLS: n.wsHost + ":" + n.wsPort,
|
|
@@ -3341,37 +3389,37 @@ function Gi() {
|
|
|
3341
3389
|
loop: !0,
|
|
3342
3390
|
timeout: 15e3,
|
|
3343
3391
|
timeoutLimit: 6e4
|
|
3344
|
-
},
|
|
3392
|
+
}, _ = new Qe({
|
|
3345
3393
|
minPingDelay: 1e4,
|
|
3346
3394
|
maxPingDelay: n.activityTimeout
|
|
3347
3395
|
}), k = new Qe({
|
|
3348
3396
|
lives: 2,
|
|
3349
3397
|
minPingDelay: 1e4,
|
|
3350
3398
|
maxPingDelay: n.activityTimeout
|
|
3351
|
-
}), I =
|
|
3399
|
+
}), I = o("ws", "ws", 3, c, _), ue = o("wss", "ws", 3, l, _), Pi = o("sockjs", "sockjs", 1, p), ot = o("xhr_streaming", "xhr_streaming", 1, p, k), Ri = o("xdr_streaming", "xdr_streaming", 1, p, k), at = o("xhr_polling", "xhr_polling", 1, p), Ii = o("xdr_polling", "xdr_polling", 1, p), ct = new Q([I], b), Oi = new Q([ue], b), qi = new Q([Pi], b), ht = new Q([
|
|
3352
3400
|
new re(se(ot), ot, Ri)
|
|
3353
3401
|
], b), lt = new Q([
|
|
3354
3402
|
new re(se(at), at, Ii)
|
|
3355
|
-
], b),
|
|
3356
|
-
new re(se(ht), new
|
|
3403
|
+
], b), dt = new Q([
|
|
3404
|
+
new re(se(ht), new xe([
|
|
3357
3405
|
ht,
|
|
3358
3406
|
new he(lt, { delay: 4e3 })
|
|
3359
3407
|
]), lt)
|
|
3360
|
-
], b), Ae = new re(se(
|
|
3361
|
-
return e.useTLS ? Le = new
|
|
3408
|
+
], b), Ae = new re(se(dt), dt, qi), Le;
|
|
3409
|
+
return e.useTLS ? Le = new xe([
|
|
3362
3410
|
ct,
|
|
3363
3411
|
new he(Ae, { delay: 2e3 })
|
|
3364
|
-
]) : Le = new
|
|
3412
|
+
]) : Le = new xe([
|
|
3365
3413
|
ct,
|
|
3366
3414
|
new he(Oi, { delay: 2e3 }),
|
|
3367
3415
|
new he(Ae, { delay: 5e3 })
|
|
3368
|
-
]), new qn(new
|
|
3416
|
+
]), new qn(new Mn(new re(se(I), Le, Ae)), r, {
|
|
3369
3417
|
ttl: 18e5,
|
|
3370
3418
|
timeline: e.timeline,
|
|
3371
3419
|
useTLS: e.useTLS
|
|
3372
3420
|
});
|
|
3373
3421
|
};
|
|
3374
|
-
const zn =
|
|
3422
|
+
const zn = jn;
|
|
3375
3423
|
function Hn() {
|
|
3376
3424
|
var n = this;
|
|
3377
3425
|
n.timeline.info(n.buildTimelineMessage({
|
|
@@ -3397,7 +3445,7 @@ function Gi() {
|
|
|
3397
3445
|
n.ontimeout = n.onerror = n.onprogress = n.onload = null, n.abort();
|
|
3398
3446
|
}
|
|
3399
3447
|
};
|
|
3400
|
-
const
|
|
3448
|
+
const Fn = Dn, Wn = 256 * 1024;
|
|
3401
3449
|
class Bn extends $ {
|
|
3402
3450
|
constructor(e, t, r) {
|
|
3403
3451
|
super(), this.hooks = e, this.method = t, this.url = r;
|
|
@@ -3426,14 +3474,14 @@ function Gi() {
|
|
|
3426
3474
|
return r !== -1 ? (this.position += r + 1, t.slice(0, r)) : null;
|
|
3427
3475
|
}
|
|
3428
3476
|
isBufferTooLong(e) {
|
|
3429
|
-
return this.position === e.length && e.length >
|
|
3477
|
+
return this.position === e.length && e.length > Wn;
|
|
3430
3478
|
}
|
|
3431
3479
|
}
|
|
3432
|
-
var
|
|
3480
|
+
var _e;
|
|
3433
3481
|
(function(n) {
|
|
3434
3482
|
n[n.CONNECTING = 0] = "CONNECTING", n[n.OPEN = 1] = "OPEN", n[n.CLOSED = 3] = "CLOSED";
|
|
3435
|
-
})(
|
|
3436
|
-
const Z =
|
|
3483
|
+
})(_e || (_e = {}));
|
|
3484
|
+
const Z = _e;
|
|
3437
3485
|
var $n = 1;
|
|
3438
3486
|
class Xn {
|
|
3439
3487
|
constructor(e, t) {
|
|
@@ -3478,8 +3526,8 @@ function Gi() {
|
|
|
3478
3526
|
break;
|
|
3479
3527
|
case "a":
|
|
3480
3528
|
t = JSON.parse(e.data.slice(1) || "[]");
|
|
3481
|
-
for (var
|
|
3482
|
-
this.onEvent(t[
|
|
3529
|
+
for (var o = 0; o < t.length; o++)
|
|
3530
|
+
this.onEvent(t[o]);
|
|
3483
3531
|
break;
|
|
3484
3532
|
case "m":
|
|
3485
3533
|
t = JSON.parse(e.data.slice(1) || "null"), this.onEvent(t);
|
|
@@ -3619,13 +3667,13 @@ function Gi() {
|
|
|
3619
3667
|
};
|
|
3620
3668
|
const nt = ri;
|
|
3621
3669
|
nt.createXDR = function(n, e) {
|
|
3622
|
-
return this.createRequest(
|
|
3670
|
+
return this.createRequest(Fn, n, e);
|
|
3623
3671
|
};
|
|
3624
3672
|
var si = {
|
|
3625
3673
|
nextAuthCallbackID: 1,
|
|
3626
3674
|
auth_callbacks: {},
|
|
3627
3675
|
ScriptReceivers: w,
|
|
3628
|
-
DependenciesReceivers:
|
|
3676
|
+
DependenciesReceivers: F,
|
|
3629
3677
|
getDefaultStrategy: zn,
|
|
3630
3678
|
Transports: mn,
|
|
3631
3679
|
transportConnectionInitializer: Hn,
|
|
@@ -3726,7 +3774,7 @@ function Gi() {
|
|
|
3726
3774
|
this.key = e, this.session = t, this.events = [], this.options = r || {}, this.sent = 0, this.uniqueID = 0;
|
|
3727
3775
|
}
|
|
3728
3776
|
log(e, t) {
|
|
3729
|
-
e <= this.options.level && (this.events.push(
|
|
3777
|
+
e <= this.options.level && (this.events.push(j({}, t, { timestamp: U.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
3730
3778
|
}
|
|
3731
3779
|
error(e) {
|
|
3732
3780
|
this.log(le.ERROR, e);
|
|
@@ -3741,7 +3789,7 @@ function Gi() {
|
|
|
3741
3789
|
return this.events.length === 0;
|
|
3742
3790
|
}
|
|
3743
3791
|
send(e, t) {
|
|
3744
|
-
var r =
|
|
3792
|
+
var r = j({
|
|
3745
3793
|
session: this.session,
|
|
3746
3794
|
bundle: this.sent + 1,
|
|
3747
3795
|
key: this.key,
|
|
@@ -3751,8 +3799,8 @@ function Gi() {
|
|
|
3751
3799
|
features: this.options.features,
|
|
3752
3800
|
timeline: this.events
|
|
3753
3801
|
}, this.options.params);
|
|
3754
|
-
return this.events = [], e(r, (
|
|
3755
|
-
|
|
3802
|
+
return this.events = [], e(r, (o, c) => {
|
|
3803
|
+
o || this.sent++, t && t(o, c);
|
|
3756
3804
|
}), !0;
|
|
3757
3805
|
}
|
|
3758
3806
|
generateUniqueID() {
|
|
@@ -3760,8 +3808,8 @@ function Gi() {
|
|
|
3760
3808
|
}
|
|
3761
3809
|
}
|
|
3762
3810
|
class ai {
|
|
3763
|
-
constructor(e, t, r,
|
|
3764
|
-
this.name = e, this.priority = t, this.transport = r, this.options =
|
|
3811
|
+
constructor(e, t, r, o) {
|
|
3812
|
+
this.name = e, this.priority = t, this.transport = r, this.options = o || {};
|
|
3765
3813
|
}
|
|
3766
3814
|
isSupported() {
|
|
3767
3815
|
return this.transport.isSupported({
|
|
@@ -3773,27 +3821,27 @@ function Gi() {
|
|
|
3773
3821
|
if (this.priority < e)
|
|
3774
3822
|
return it(new q(), t);
|
|
3775
3823
|
} else return it(new D(), t);
|
|
3776
|
-
var r = !1,
|
|
3777
|
-
|
|
3824
|
+
var r = !1, o = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), c = null, l = function() {
|
|
3825
|
+
o.unbind("initialized", l), o.connect();
|
|
3778
3826
|
}, p = function() {
|
|
3779
|
-
c = X.createHandshake(
|
|
3827
|
+
c = X.createHandshake(o, function(I) {
|
|
3780
3828
|
r = !0, k(), t(null, I);
|
|
3781
3829
|
});
|
|
3782
3830
|
}, b = function(I) {
|
|
3783
3831
|
k(), t(I);
|
|
3784
|
-
},
|
|
3832
|
+
}, _ = function() {
|
|
3785
3833
|
k();
|
|
3786
3834
|
var I;
|
|
3787
|
-
I = ae(
|
|
3835
|
+
I = ae(o), t(new M(I));
|
|
3788
3836
|
}, k = function() {
|
|
3789
|
-
|
|
3837
|
+
o.unbind("initialized", l), o.unbind("open", p), o.unbind("error", b), o.unbind("closed", _);
|
|
3790
3838
|
};
|
|
3791
|
-
return
|
|
3839
|
+
return o.bind("initialized", l), o.bind("open", p), o.bind("error", b), o.bind("closed", _), o.initialize(), {
|
|
3792
3840
|
abort: () => {
|
|
3793
|
-
r || (k(), c ? c.close() :
|
|
3841
|
+
r || (k(), c ? c.close() : o.close());
|
|
3794
3842
|
},
|
|
3795
3843
|
forceMinPriority: (I) => {
|
|
3796
|
-
r || this.priority < I && (c ? c.close() :
|
|
3844
|
+
r || this.priority < I && (c ? c.close() : o.close());
|
|
3797
3845
|
}
|
|
3798
3846
|
};
|
|
3799
3847
|
}
|
|
@@ -3809,12 +3857,12 @@ function Gi() {
|
|
|
3809
3857
|
};
|
|
3810
3858
|
}
|
|
3811
3859
|
const { Transports: ci } = C;
|
|
3812
|
-
var hi = function(n, e, t, r,
|
|
3860
|
+
var hi = function(n, e, t, r, o, c) {
|
|
3813
3861
|
var l = ci[t];
|
|
3814
3862
|
if (!l)
|
|
3815
3863
|
throw new J(t);
|
|
3816
3864
|
var p = (!n.enabledTransports || He(n.enabledTransports, e) !== -1) && (!n.disabledTransports || He(n.disabledTransports, e) === -1), b;
|
|
3817
|
-
return p ? (
|
|
3865
|
+
return p ? (o = Object.assign({ ignoreNullOrigin: n.ignoreNullOrigin }, o), b = new ai(e, r, c ? c.getAssistant(l) : l, o)) : b = li, b;
|
|
3818
3866
|
}, li = {
|
|
3819
3867
|
isSupported: function() {
|
|
3820
3868
|
return !1;
|
|
@@ -3832,29 +3880,29 @@ function Gi() {
|
|
|
3832
3880
|
};
|
|
3833
3881
|
}
|
|
3834
3882
|
};
|
|
3835
|
-
function
|
|
3883
|
+
function di(n) {
|
|
3836
3884
|
if (n == null)
|
|
3837
3885
|
throw "You must pass an options object";
|
|
3838
3886
|
if (n.cluster == null)
|
|
3839
3887
|
throw "Options object must provide a cluster";
|
|
3840
3888
|
"disableStats" in n && P.warn("The disableStats option is deprecated in favor of enableStats");
|
|
3841
3889
|
}
|
|
3842
|
-
const
|
|
3890
|
+
const ui = (n, e) => {
|
|
3843
3891
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
3844
3892
|
for (var r in e.params)
|
|
3845
3893
|
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e.params[r]);
|
|
3846
3894
|
if (e.paramsProvider != null) {
|
|
3847
|
-
let
|
|
3848
|
-
for (var r in
|
|
3849
|
-
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(
|
|
3895
|
+
let o = e.paramsProvider();
|
|
3896
|
+
for (var r in o)
|
|
3897
|
+
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(o[r]);
|
|
3850
3898
|
}
|
|
3851
3899
|
return t;
|
|
3852
3900
|
}, fi = (n) => {
|
|
3853
3901
|
if (typeof C.getAuthorizers()[n.transport] > "u")
|
|
3854
3902
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3855
3903
|
return (e, t) => {
|
|
3856
|
-
const r =
|
|
3857
|
-
C.getAuthorizers()[n.transport](C, r, n,
|
|
3904
|
+
const r = ui(e, n);
|
|
3905
|
+
C.getAuthorizers()[n.transport](C, r, n, u.UserAuthentication, t);
|
|
3858
3906
|
};
|
|
3859
3907
|
}, pi = (n, e) => {
|
|
3860
3908
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
@@ -3862,9 +3910,9 @@ function Gi() {
|
|
|
3862
3910
|
for (var r in e.params)
|
|
3863
3911
|
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e.params[r]);
|
|
3864
3912
|
if (e.paramsProvider != null) {
|
|
3865
|
-
let
|
|
3866
|
-
for (var r in
|
|
3867
|
-
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(
|
|
3913
|
+
let o = e.paramsProvider();
|
|
3914
|
+
for (var r in o)
|
|
3915
|
+
t += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(o[r]);
|
|
3868
3916
|
}
|
|
3869
3917
|
return t;
|
|
3870
3918
|
}, mi = (n) => {
|
|
@@ -3872,7 +3920,7 @@ function Gi() {
|
|
|
3872
3920
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3873
3921
|
return (e, t) => {
|
|
3874
3922
|
const r = pi(e, n);
|
|
3875
|
-
C.getAuthorizers()[n.transport](C, r, n,
|
|
3923
|
+
C.getAuthorizers()[n.transport](C, r, n, u.ChannelAuthorization, t);
|
|
3876
3924
|
};
|
|
3877
3925
|
}, gi = (n, e, t) => {
|
|
3878
3926
|
const r = {
|
|
@@ -3883,9 +3931,9 @@ function Gi() {
|
|
|
3883
3931
|
headers: e.headers
|
|
3884
3932
|
}
|
|
3885
3933
|
};
|
|
3886
|
-
return (
|
|
3887
|
-
const l = n.channel(
|
|
3888
|
-
t(l, r).authorize(
|
|
3934
|
+
return (o, c) => {
|
|
3935
|
+
const l = n.channel(o.channelName);
|
|
3936
|
+
t(l, r).authorize(o.socketId, c);
|
|
3889
3937
|
};
|
|
3890
3938
|
};
|
|
3891
3939
|
function rt(n, e) {
|
|
@@ -3906,7 +3954,7 @@ function Gi() {
|
|
|
3906
3954
|
useTLS: wi(n),
|
|
3907
3955
|
wsHost: yi(n),
|
|
3908
3956
|
userAuthenticator: Si(n),
|
|
3909
|
-
channelAuthorizer:
|
|
3957
|
+
channelAuthorizer: xi(n, e)
|
|
3910
3958
|
};
|
|
3911
3959
|
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;
|
|
3912
3960
|
}
|
|
@@ -3943,11 +3991,11 @@ function Gi() {
|
|
|
3943
3991
|
};
|
|
3944
3992
|
return t;
|
|
3945
3993
|
}
|
|
3946
|
-
function
|
|
3994
|
+
function xi(n, e) {
|
|
3947
3995
|
const t = Ti(n, e);
|
|
3948
3996
|
return st(t) ? t.customHandler : mi(t);
|
|
3949
3997
|
}
|
|
3950
|
-
class
|
|
3998
|
+
class Ei extends $ {
|
|
3951
3999
|
constructor(e) {
|
|
3952
4000
|
super(function(t, r) {
|
|
3953
4001
|
P.debug(`No callbacks on watchlist events for ${t}`);
|
|
@@ -3965,13 +4013,13 @@ function Gi() {
|
|
|
3965
4013
|
});
|
|
3966
4014
|
}
|
|
3967
4015
|
}
|
|
3968
|
-
function
|
|
4016
|
+
function _i() {
|
|
3969
4017
|
let n, e;
|
|
3970
|
-
return { promise: new Promise((r,
|
|
3971
|
-
n = r, e =
|
|
4018
|
+
return { promise: new Promise((r, o) => {
|
|
4019
|
+
n = r, e = o;
|
|
3972
4020
|
}), resolve: n, reject: e };
|
|
3973
4021
|
}
|
|
3974
|
-
const ki =
|
|
4022
|
+
const ki = _i;
|
|
3975
4023
|
class Ai extends $ {
|
|
3976
4024
|
constructor(e) {
|
|
3977
4025
|
super(function(t, r) {
|
|
@@ -3987,7 +4035,7 @@ function Gi() {
|
|
|
3987
4035
|
});
|
|
3988
4036
|
}, this.pusher = e, this.pusher.connection.bind("state_change", ({ previous: t, current: r }) => {
|
|
3989
4037
|
t !== "connected" && r === "connected" && this._signin(), t === "connected" && r !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
3990
|
-
}), this.watchlist = new
|
|
4038
|
+
}), this.watchlist = new Ei(e), this.pusher.connection.bind("message", (t) => {
|
|
3991
4039
|
var r = t.event;
|
|
3992
4040
|
r === "pusher:signin_success" && this._onSigninSuccess(t.data), this.serverToUserChannel && this.serverToUserChannel.name === t.channel && this.serverToUserChannel.handleEvent(t);
|
|
3993
4041
|
});
|
|
@@ -4047,7 +4095,7 @@ function Gi() {
|
|
|
4047
4095
|
}));
|
|
4048
4096
|
}
|
|
4049
4097
|
constructor(e, t) {
|
|
4050
|
-
Li(e),
|
|
4098
|
+
Li(e), di(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels = X.createChannels(), this.global_emitter = new $(), this.sessionID = C.randomInt(1e9), this.timeline = new oi(this.key, this.sessionID, {
|
|
4051
4099
|
cluster: this.config.cluster,
|
|
4052
4100
|
features: O.getClientFeatures(),
|
|
4053
4101
|
params: this.config.timelineParams || {},
|
|
@@ -4058,7 +4106,7 @@ function Gi() {
|
|
|
4058
4106
|
host: this.config.statsHost,
|
|
4059
4107
|
path: "/timeline/v2/" + C.TimelineTransport.name
|
|
4060
4108
|
}));
|
|
4061
|
-
var r = (
|
|
4109
|
+
var r = (o) => C.getDefaultStrategy(this.config, o, hi);
|
|
4062
4110
|
this.connection = X.createConnectionManager(this.key, {
|
|
4063
4111
|
getStrategy: r,
|
|
4064
4112
|
timeline: this.timeline,
|
|
@@ -4068,19 +4116,19 @@ function Gi() {
|
|
|
4068
4116
|
useTLS: !!this.config.useTLS
|
|
4069
4117
|
}), this.connection.bind("connected", () => {
|
|
4070
4118
|
this.subscribeAll(), this.timelineSender && this.timelineSender.send(this.connection.isUsingTLS());
|
|
4071
|
-
}), this.connection.bind("message", (
|
|
4072
|
-
var c =
|
|
4073
|
-
if (
|
|
4074
|
-
var p = this.channel(
|
|
4075
|
-
p && p.handleEvent(
|
|
4119
|
+
}), this.connection.bind("message", (o) => {
|
|
4120
|
+
var c = o.event, l = c.indexOf("pusher_internal:") === 0;
|
|
4121
|
+
if (o.channel) {
|
|
4122
|
+
var p = this.channel(o.channel);
|
|
4123
|
+
p && p.handleEvent(o);
|
|
4076
4124
|
}
|
|
4077
|
-
l || this.global_emitter.emit(
|
|
4125
|
+
l || this.global_emitter.emit(o.event, o.data);
|
|
4078
4126
|
}), this.connection.bind("connecting", () => {
|
|
4079
4127
|
this.channels.disconnect();
|
|
4080
4128
|
}), this.connection.bind("disconnected", () => {
|
|
4081
4129
|
this.channels.disconnect();
|
|
4082
|
-
}), this.connection.bind("error", (
|
|
4083
|
-
P.warn(
|
|
4130
|
+
}), this.connection.bind("error", (o) => {
|
|
4131
|
+
P.warn(o);
|
|
4084
4132
|
}), O.instances.push(this), this.timeline.info({ instances: O.instances.length }), this.user = new Ai(this), O.isReady && this.connect();
|
|
4085
4133
|
}
|
|
4086
4134
|
switchCluster(e) {
|
|
@@ -4096,7 +4144,7 @@ function Gi() {
|
|
|
4096
4144
|
connect() {
|
|
4097
4145
|
if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
|
|
4098
4146
|
var e = this.connection.isUsingTLS(), t = this.timelineSender;
|
|
4099
|
-
this.timelineSenderTimer = new
|
|
4147
|
+
this.timelineSenderTimer = new jt(6e4, function() {
|
|
4100
4148
|
t.send(e);
|
|
4101
4149
|
});
|
|
4102
4150
|
}
|
|
@@ -4143,7 +4191,7 @@ function Gi() {
|
|
|
4143
4191
|
}
|
|
4144
4192
|
}
|
|
4145
4193
|
O.instances = [], O.isReady = !1, O.logToConsole = !1, O.Runtime = C, O.ScriptReceivers = C.ScriptReceivers, O.DependenciesReceivers = C.DependenciesReceivers, O.auth_callbacks = C.auth_callbacks;
|
|
4146
|
-
const
|
|
4194
|
+
const de = O;
|
|
4147
4195
|
function Li(n) {
|
|
4148
4196
|
if (n == null)
|
|
4149
4197
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
@@ -4165,14 +4213,14 @@ function Gi() {
|
|
|
4165
4213
|
exports: {}
|
|
4166
4214
|
/******/
|
|
4167
4215
|
};
|
|
4168
|
-
return
|
|
4216
|
+
return s[m].call(y.exports, y, y.exports, h), y.exports;
|
|
4169
4217
|
}
|
|
4170
4218
|
h.d = (m, g) => {
|
|
4171
4219
|
for (var y in g)
|
|
4172
4220
|
h.o(g, y) && !h.o(m, y) && Object.defineProperty(m, y, { enumerable: !0, get: g[y] });
|
|
4173
4221
|
}, h.o = (m, g) => Object.prototype.hasOwnProperty.call(m, g);
|
|
4174
|
-
var
|
|
4175
|
-
return
|
|
4222
|
+
var d = h(721);
|
|
4223
|
+
return d;
|
|
4176
4224
|
})()
|
|
4177
4225
|
));
|
|
4178
4226
|
})(Pe)), Pe.exports;
|
|
@@ -4256,61 +4304,61 @@ function V(v) {
|
|
|
4256
4304
|
}
|
|
4257
4305
|
}
|
|
4258
4306
|
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>
|
|
4259
|
-
`, yt = '<svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>WhatsApp</title><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>', tr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.998 9.332A5.002 5.002 0 0 1 13.2 5.5H11a1 1 0 1 0 0 2h4.5a1 1 0 0 0 1-1V2a1 1 0 1 0-2 0v1.74A7.002 7.002 0 0 0 3 9.332a1 1 0 1 0 1.998 0ZM15.002 10.668A5.002 5.002 0 0 1 6.8 14.5H9a1 1 0 1 0 0-2H4.5a1 1 0 0 0-1 1V18a1 1 0 1 0 2 0v-1.74a7.002 7.002 0 0 0 11.5-5.592 1 1 0 1 0-1.998 0Z" clip-rule="evenodd" /></svg>',
|
|
4260
|
-
function
|
|
4307
|
+
`, yt = '<svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>WhatsApp</title><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>', tr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.998 9.332A5.002 5.002 0 0 1 13.2 5.5H11a1 1 0 1 0 0 2h4.5a1 1 0 0 0 1-1V2a1 1 0 1 0-2 0v1.74A7.002 7.002 0 0 0 3 9.332a1 1 0 1 0 1.998 0ZM15.002 10.668A5.002 5.002 0 0 1 6.8 14.5H9a1 1 0 1 0 0-2H4.5a1 1 0 0 0-1 1V18a1 1 0 1 0 2 0v-1.74a7.002 7.002 0 0 0 11.5-5.592 1 1 0 1 0-1.998 0Z" clip-rule="evenodd" /></svg>', nr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM7.22 6.22a.75.75 0 0 0-1.06 1.06L8.88 10l-2.72 2.72a.75.75 0 1 0 1.06 1.06L9.94 11.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L11 10l2.72-2.72a.75.75 0 0 0-1.06-1.06L9.94 8.94 7.22 6.22Z" clip-rule="evenodd" /></svg>', Me = "sendityAuthRequest", ir = "https://sendity.io/api", rr = ["mailto:verify@sendity.io"], sr = 600 * 1e3, or = 5e3, ar = 15e3, Ie = 2e3, pe = 220, At = 0;
|
|
4308
|
+
function je(v, i) {
|
|
4261
4309
|
return `sendity:auth-request:${encodeURIComponent(v)}:${encodeURIComponent(i)}`;
|
|
4262
4310
|
}
|
|
4263
|
-
function bt(v, i,
|
|
4264
|
-
v.removeItem(
|
|
4265
|
-
const h =
|
|
4266
|
-
if (!
|
|
4311
|
+
function bt(v, i, s, a = Date.now()) {
|
|
4312
|
+
v.removeItem(Me);
|
|
4313
|
+
const h = je(i, s), d = v.getItem(h);
|
|
4314
|
+
if (!d) return null;
|
|
4267
4315
|
try {
|
|
4268
|
-
const m = JSON.parse(
|
|
4316
|
+
const m = JSON.parse(d);
|
|
4269
4317
|
if (typeof m.id != "string" || typeof m.clientSecret != "string" || typeof m.createdAt != "number")
|
|
4270
4318
|
throw new Error("invalid stored auth request");
|
|
4271
|
-
return a - m.createdAt >=
|
|
4319
|
+
return a - m.createdAt >= sr ? (v.removeItem(h), null) : { id: m.id, clientSecret: m.clientSecret };
|
|
4272
4320
|
} catch {
|
|
4273
4321
|
return v.removeItem(h), null;
|
|
4274
4322
|
}
|
|
4275
4323
|
}
|
|
4276
|
-
function
|
|
4277
|
-
v.setItem(
|
|
4324
|
+
function cr(v, i, s, a, h = Date.now()) {
|
|
4325
|
+
v.setItem(je(i, s), JSON.stringify({ ...a, createdAt: h }));
|
|
4278
4326
|
}
|
|
4279
|
-
function wt(v, i,
|
|
4280
|
-
v.removeItem(
|
|
4327
|
+
function wt(v, i, s) {
|
|
4328
|
+
v.removeItem(je(i, s)), v.removeItem(Me);
|
|
4281
4329
|
}
|
|
4282
4330
|
function me() {
|
|
4283
|
-
return window.localStorage.removeItem(
|
|
4331
|
+
return window.localStorage.removeItem(Me), window.sessionStorage;
|
|
4284
4332
|
}
|
|
4285
|
-
function
|
|
4286
|
-
return v.filter((
|
|
4333
|
+
function hr(v, i = window.location.origin) {
|
|
4334
|
+
return v.filter((s) => lr(s, i));
|
|
4287
4335
|
}
|
|
4288
|
-
function
|
|
4336
|
+
function lr(v, i) {
|
|
4289
4337
|
try {
|
|
4290
|
-
const
|
|
4291
|
-
return ["http:", "https:", "mailto:", "whatsapp:"].includes(
|
|
4338
|
+
const s = new URL(v, i);
|
|
4339
|
+
return ["http:", "https:", "mailto:", "whatsapp:"].includes(s.protocol);
|
|
4292
4340
|
} catch {
|
|
4293
4341
|
return !1;
|
|
4294
4342
|
}
|
|
4295
4343
|
}
|
|
4296
|
-
function
|
|
4297
|
-
return v === "push" ? { start: !1, delayMs: 0 } : v === "polling" || !i || !
|
|
4344
|
+
function dr(v, i, s) {
|
|
4345
|
+
return v === "push" ? { start: !1, delayMs: 0 } : v === "polling" || !i || !s ? { start: !0, delayMs: 0 } : { start: !0, delayMs: At };
|
|
4298
4346
|
}
|
|
4299
4347
|
const ve = class ve extends HTMLElement {
|
|
4300
4348
|
constructor() {
|
|
4301
|
-
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = null, this.codeContainerEl = null, this.codeEl = null, this.promptEl = null, this.successEl = null, this.spinnerEl = null, this.verifiersEl = null, this.footerEl = null, this.footerBrandEl = null, this.footerStatusEl = null, this.footerMessageEl = null, this.footerTimerEl = null, this.footerObserver = null, this.footerWaitTimer = null, this.footerTransitionTimer = null, this.successTransitionTimer = null, this.timerInterval = null, this.currentConfig = null, this.destroyed = !1, this.lastCode = void 0, this.echo = null, this.authenticated = !1;
|
|
4349
|
+
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = null, this.rootEl = null, this.codeContainerEl = null, this.codeEl = null, this.promptEl = null, this.successEl = null, this.spinnerEl = null, this.verifiersEl = null, this.footerEl = null, this.footerBrandEl = null, this.footerStatusEl = null, this.footerMessageEl = null, this.footerTimerEl = null, this.footerIndicatorEl = null, this.footerObserver = null, this.authStartObserver = null, this.authFlowStarted = !1, this.footerWaitTimer = null, this.footerTransitionTimer = null, this.successTransitionTimer = null, this.timerInterval = null, this.currentConfig = null, this.destroyed = !1, this.lastCode = void 0, this.echo = null, this.authenticated = !1;
|
|
4302
4350
|
const i = this.attachShadow({ mode: "open" });
|
|
4303
4351
|
this.injectTailwind(i);
|
|
4304
|
-
const
|
|
4305
|
-
|
|
4306
|
-
const a =
|
|
4307
|
-
|
|
4352
|
+
const s = document.createElement("div");
|
|
4353
|
+
s.innerHTML = pt;
|
|
4354
|
+
const a = s.querySelector("template"), h = a ? a.content.cloneNode(!0) : document.createRange().createContextualFragment(pt), d = document.createElement("style");
|
|
4355
|
+
d.textContent = zi, i.appendChild(d), i.appendChild(h);
|
|
4308
4356
|
}
|
|
4309
4357
|
static get observedAttributes() {
|
|
4310
4358
|
return ["server-url", "public-key", "verify-urls", "lang", "transport", "hide-footer", "footer", "authenticated-event-delay-ms"];
|
|
4311
4359
|
}
|
|
4312
4360
|
connectedCallback() {
|
|
4313
|
-
this.codeContainerEl = this.shadowRoot?.querySelector(".code"), this.codeEl = this.shadowRoot?.querySelector(".formatted-code"), this.promptEl = this.shadowRoot?.querySelector(".prompt"), this.successEl = this.shadowRoot?.querySelector(".success"), this.spinnerEl = this.shadowRoot?.querySelector(".spinner"), this.verifiersEl = this.shadowRoot?.querySelector(".verifiers"), this.footerEl = this.shadowRoot?.querySelector(".sendity-footer"), this.footerBrandEl = this.shadowRoot?.querySelector(".footer-brand"), this.footerStatusEl = this.shadowRoot?.querySelector(".footer-status"), this.footerMessageEl = this.shadowRoot?.querySelector(".footer-message"), this.footerTimerEl = this.shadowRoot?.querySelector(".footer-timer");
|
|
4361
|
+
this.rootEl = this.shadowRoot?.querySelector(".sendity"), this.codeContainerEl = this.shadowRoot?.querySelector(".code"), this.codeEl = this.shadowRoot?.querySelector(".formatted-code"), this.promptEl = this.shadowRoot?.querySelector(".prompt"), this.successEl = this.shadowRoot?.querySelector(".success"), this.spinnerEl = this.shadowRoot?.querySelector(".spinner"), this.verifiersEl = this.shadowRoot?.querySelector(".verifiers"), this.footerEl = this.shadowRoot?.querySelector(".sendity-footer"), this.footerBrandEl = this.shadowRoot?.querySelector(".footer-brand"), this.footerStatusEl = this.shadowRoot?.querySelector(".footer-status"), this.footerMessageEl = this.shadowRoot?.querySelector(".footer-message"), this.footerTimerEl = this.shadowRoot?.querySelector(".footer-timer"), this.footerIndicatorEl = this.shadowRoot?.querySelector(".footer-spinner");
|
|
4314
4362
|
try {
|
|
4315
4363
|
this.currentConfig = this.resolveConfig();
|
|
4316
4364
|
} catch (i) {
|
|
@@ -4320,7 +4368,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4320
4368
|
this.configureFooter(), this.dispatchPublicEvent("sendity:ready", {
|
|
4321
4369
|
transport: this.currentConfig.transport,
|
|
4322
4370
|
channel: this.primaryChannel(this.currentConfig.verifyUrls)
|
|
4323
|
-
}), this.
|
|
4371
|
+
}), this.showPlaceholderCode(), this.renderVerifiers(this.currentConfig.verifyUrls), this.startWhenVisible();
|
|
4324
4372
|
}
|
|
4325
4373
|
disconnectedCallback() {
|
|
4326
4374
|
this.stop(), this.destroyed = !0;
|
|
@@ -4328,30 +4376,41 @@ const ve = class ve extends HTMLElement {
|
|
|
4328
4376
|
attributeChangedCallback() {
|
|
4329
4377
|
this.isConnected && (this.currentConfig = this.resolveConfig(), this.configureFooter(), this.renderVerifiers(this.currentConfig.verifyUrls));
|
|
4330
4378
|
}
|
|
4379
|
+
startWhenVisible() {
|
|
4380
|
+
if (!(this.authFlowStarted || this.destroyed)) {
|
|
4381
|
+
if (!("IntersectionObserver" in window)) {
|
|
4382
|
+
this.start();
|
|
4383
|
+
return;
|
|
4384
|
+
}
|
|
4385
|
+
this.authStartObserver?.disconnect(), this.authStartObserver = new IntersectionObserver((i) => {
|
|
4386
|
+
i.some((a) => a.isIntersecting && a.intersectionRatio > 0) && (this.authStartObserver?.disconnect(), this.authStartObserver = null, this.start());
|
|
4387
|
+
}), this.authStartObserver.observe(this);
|
|
4388
|
+
}
|
|
4389
|
+
}
|
|
4331
4390
|
start() {
|
|
4332
|
-
this.step().then((i) => {
|
|
4391
|
+
this.authFlowStarted || (this.authFlowStarted = !0, this.step().then((i) => {
|
|
4333
4392
|
this.authenticated || this.destroyed || this.configureRealtime(i);
|
|
4334
4393
|
}).catch((i) => {
|
|
4335
4394
|
this.handleInitialError(i);
|
|
4336
|
-
});
|
|
4395
|
+
}));
|
|
4337
4396
|
}
|
|
4338
4397
|
stop() {
|
|
4339
|
-
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;
|
|
4398
|
+
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;
|
|
4340
4399
|
}
|
|
4341
4400
|
// Inject Tailwind CSS into the Shadow DOM so Tailwind utility classes
|
|
4342
4401
|
// used in sendity.html work within the component. We cache the processed
|
|
4343
4402
|
// CSS text across instances to avoid redundant network requests and ensure
|
|
4344
4403
|
// the Tailwind layer is inserted before component CSS.
|
|
4345
4404
|
injectTailwind(i) {
|
|
4346
|
-
const
|
|
4347
|
-
|
|
4405
|
+
const s = document.createElement("style");
|
|
4406
|
+
s.setAttribute("data-sendity-tw", ""), i.appendChild(s);
|
|
4348
4407
|
const a = this.constructor;
|
|
4349
4408
|
if (a.tailwindCssText !== null) {
|
|
4350
4409
|
if (a.tailwindCssText)
|
|
4351
|
-
|
|
4410
|
+
s.textContent = a.tailwindCssText;
|
|
4352
4411
|
else {
|
|
4353
4412
|
const h = document.createElement("link");
|
|
4354
|
-
h.rel = "stylesheet", h.href = Re, i.insertBefore(h,
|
|
4413
|
+
h.rel = "stylesheet", h.href = Re, i.insertBefore(h, s);
|
|
4355
4414
|
}
|
|
4356
4415
|
return;
|
|
4357
4416
|
}
|
|
@@ -4362,10 +4421,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4362
4421
|
})), a.tailwindLoading.then(() => {
|
|
4363
4422
|
if (!this.destroyed && i)
|
|
4364
4423
|
if (a.tailwindCssText)
|
|
4365
|
-
|
|
4424
|
+
s.textContent = a.tailwindCssText;
|
|
4366
4425
|
else {
|
|
4367
4426
|
const h = document.createElement("link");
|
|
4368
|
-
h.rel = "stylesheet", h.href = Re, i.insertBefore(h,
|
|
4427
|
+
h.rel = "stylesheet", h.href = Re, i.insertBefore(h, s);
|
|
4369
4428
|
}
|
|
4370
4429
|
});
|
|
4371
4430
|
}
|
|
@@ -4375,7 +4434,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4375
4434
|
this.footerEl.hidden = !0, this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.footerObserver?.disconnect(), this.footerObserver = null;
|
|
4376
4435
|
return;
|
|
4377
4436
|
}
|
|
4378
|
-
this.footerEl.hidden = !1, this.footerEl.classList.remove("footer--waiting", "footer--transitioning", "footer--leaving"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.setAttribute("hidden", ""), this.observeFooterVisibility();
|
|
4437
|
+
this.footerEl.hidden = !1, this.footerEl.classList.remove("footer--waiting", "footer--transitioning", "footer--leaving", "footer--verified"), this.setFooterIndicatorWaiting(), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.setAttribute("hidden", ""), this.observeFooterVisibility();
|
|
4379
4438
|
}
|
|
4380
4439
|
}
|
|
4381
4440
|
isFooterHidden() {
|
|
@@ -4390,10 +4449,16 @@ const ve = class ve extends HTMLElement {
|
|
|
4390
4449
|
scheduleFooterWaitingState() {
|
|
4391
4450
|
this.footerWaitTimer !== null || this.isFooterHidden() || (this.footerWaitTimer = window.setTimeout(() => {
|
|
4392
4451
|
this.footerWaitTimer = null, this.showFooterWaitingState();
|
|
4393
|
-
},
|
|
4452
|
+
}, ar));
|
|
4453
|
+
}
|
|
4454
|
+
setFooterIndicatorWaiting() {
|
|
4455
|
+
this.footerIndicatorEl && (this.footerIndicatorEl.classList.remove("footer-indicator--error"), this.footerIndicatorEl.innerHTML = "", this.footerIndicatorEl.removeAttribute("hidden"));
|
|
4456
|
+
}
|
|
4457
|
+
setFooterIndicatorError() {
|
|
4458
|
+
this.footerIndicatorEl && (this.footerIndicatorEl.classList.add("footer-indicator--error"), this.footerIndicatorEl.innerHTML = nr, this.footerIndicatorEl.removeAttribute("hidden"));
|
|
4394
4459
|
}
|
|
4395
4460
|
showFooterWaitingState() {
|
|
4396
|
-
this.isFooterHidden() || (this.currentConfig && this.footerMessageEl && (this.footerMessageEl.textContent = this.waitingFooterMessage()), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4461
|
+
this.isFooterHidden() || (this.currentConfig && this.footerMessageEl && (this.footerMessageEl.textContent = this.waitingFooterMessage()), this.setFooterIndicatorWaiting(), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4397
4462
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4398
4463
|
}, pe), this.startCountdown());
|
|
4399
4464
|
}
|
|
@@ -4405,13 +4470,13 @@ const ve = class ve extends HTMLElement {
|
|
|
4405
4470
|
}
|
|
4406
4471
|
const i = () => {
|
|
4407
4472
|
if (!this.footerTimerEl || !this.activeAuthRequestExpiresAt) return;
|
|
4408
|
-
const
|
|
4409
|
-
if (Number.isNaN(
|
|
4473
|
+
const s = new Date(this.activeAuthRequestExpiresAt).getTime();
|
|
4474
|
+
if (Number.isNaN(s)) {
|
|
4410
4475
|
this.footerTimerEl.setAttribute("hidden", "");
|
|
4411
4476
|
return;
|
|
4412
4477
|
}
|
|
4413
|
-
const a = Math.max(0, Math.floor((
|
|
4414
|
-
this.footerTimerEl.textContent = `${h}:${
|
|
4478
|
+
const a = Math.max(0, Math.floor((s - Date.now()) / 1e3)), h = Math.floor(a / 60), d = String(a % 60).padStart(2, "0");
|
|
4479
|
+
this.footerTimerEl.textContent = `${h}:${d}`, this.footerTimerEl.classList.toggle("low", a > 0 && a <= 60), this.footerTimerEl.removeAttribute("hidden"), a <= 0 && this.timerInterval !== null && (clearInterval(this.timerInterval), this.timerInterval = null, this.showExpiredState());
|
|
4415
4480
|
};
|
|
4416
4481
|
i(), this.timerInterval = window.setInterval(i, 1e3);
|
|
4417
4482
|
}
|
|
@@ -4420,9 +4485,9 @@ const ve = class ve extends HTMLElement {
|
|
|
4420
4485
|
}
|
|
4421
4486
|
showExpiredState() {
|
|
4422
4487
|
if (!(this.authenticated || this.destroyed || !this.currentConfig)) {
|
|
4423
|
-
if (this.stopAuthTransports(), this.codeContainerEl?.classList.remove("code--active"), this.codeContainerEl?.classList.add("code--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.codeEl?.removeAttribute("hidden"), !this.isFooterHidden()) {
|
|
4488
|
+
if (this.stopAuthTransports(), this.rootEl?.classList.remove("sendity--verified"), this.rootEl?.classList.add("sendity--expired"), this.codeContainerEl?.classList.remove("code--active", "code--placeholder"), this.codeContainerEl?.classList.add("code--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.codeEl?.removeAttribute("hidden"), !this.isFooterHidden()) {
|
|
4424
4489
|
const i = V(this.currentConfig.lang);
|
|
4425
|
-
this.footerMessageEl && (this.footerMessageEl.textContent = i.ui.codeExpired), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTimerEl?.setAttribute("hidden", ""), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4490
|
+
this.footerMessageEl && (this.footerMessageEl.textContent = i.ui.codeExpired), this.setFooterIndicatorError(), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTimerEl?.setAttribute("hidden", ""), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4426
4491
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4427
4492
|
}, pe);
|
|
4428
4493
|
}
|
|
@@ -4433,23 +4498,23 @@ const ve = class ve extends HTMLElement {
|
|
|
4433
4498
|
if (!this.verifiersEl || !this.currentConfig) return;
|
|
4434
4499
|
const i = V(this.currentConfig.lang);
|
|
4435
4500
|
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden");
|
|
4436
|
-
const
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
console.warn("[sendity-auth] failed to request a new code",
|
|
4501
|
+
const s = document.createElement("button");
|
|
4502
|
+
s.type = "button", s.className = "chan error", s.addEventListener("click", () => {
|
|
4503
|
+
s.disabled = !0, this.requestNewAuthRequest().catch((d) => {
|
|
4504
|
+
console.warn("[sendity-auth] failed to request a new code", d), s.disabled = !1;
|
|
4440
4505
|
});
|
|
4441
4506
|
});
|
|
4442
4507
|
const a = document.createElement("span");
|
|
4443
|
-
a.className = "icon", a.setAttribute("aria-hidden", "true"), a.innerHTML = tr,
|
|
4508
|
+
a.className = "icon", a.setAttribute("aria-hidden", "true"), a.innerHTML = tr, s.appendChild(a);
|
|
4444
4509
|
const h = document.createElement("span");
|
|
4445
|
-
h.className = "label", h.textContent = i.ui.getNewCode,
|
|
4510
|
+
h.className = "label", h.textContent = i.ui.getNewCode, s.appendChild(h), this.verifiersEl.appendChild(s);
|
|
4446
4511
|
}
|
|
4447
4512
|
async requestNewAuthRequest() {
|
|
4448
4513
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4449
4514
|
const i = this.currentConfig;
|
|
4450
|
-
this.stopAuthTransports(), this.stopCountdown(), this.codeContainerEl?.classList.remove("code--expired");
|
|
4451
|
-
const
|
|
4452
|
-
this.renderVerifiers(i.verifyUrls), this.showFooterWaitingState(), this.configureRealtime(
|
|
4515
|
+
this.stopAuthTransports(), this.stopCountdown(), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.setFooterIndicatorWaiting(), this.codeContainerEl?.classList.remove("code--expired");
|
|
4516
|
+
const s = await this.createAuthRequest(i.serverUrl, i.publicKey, me());
|
|
4517
|
+
this.renderVerifiers(i.verifyUrls), this.showFooterWaitingState(), this.configureRealtime(s);
|
|
4453
4518
|
}
|
|
4454
4519
|
handleInitialError(i) {
|
|
4455
4520
|
console.error("[sendity-auth] Unable to initialize authentication", i), this.renderError("Unable to initialize authentication, see console for details"), this.dispatchEvent(
|
|
@@ -4464,31 +4529,31 @@ const ve = class ve extends HTMLElement {
|
|
|
4464
4529
|
const i = {
|
|
4465
4530
|
lang: navigator.language?.startsWith("de") ? "de" : navigator.language?.startsWith("fr") ? "fr" : "en",
|
|
4466
4531
|
transport: "auto"
|
|
4467
|
-
},
|
|
4532
|
+
}, s = (R) => this.getAttribute(R) ?? void 0, a = s("server-url")?.trim() || ir, h = s("public-key")?.trim();
|
|
4468
4533
|
if (!h)
|
|
4469
4534
|
throw new Error("Missing required sendity-auth attribute: public-key");
|
|
4470
|
-
let
|
|
4471
|
-
const m =
|
|
4535
|
+
let d = [...rr];
|
|
4536
|
+
const m = s("verify-urls");
|
|
4472
4537
|
if (m)
|
|
4473
4538
|
try {
|
|
4474
|
-
if (
|
|
4475
|
-
|
|
4539
|
+
if (d = JSON.parse(m), !Array.isArray(d)) throw new Error("verify-urls not array");
|
|
4540
|
+
d = d.map(String);
|
|
4476
4541
|
} catch {
|
|
4477
|
-
|
|
4542
|
+
d = m.split(",").map((R) => R.trim()).filter(Boolean);
|
|
4478
4543
|
}
|
|
4479
|
-
if (
|
|
4544
|
+
if (d = hr(d), d.length === 0)
|
|
4480
4545
|
throw new Error("Missing required sendity-auth attribute: verify-urls");
|
|
4481
|
-
let g =
|
|
4546
|
+
let g = s("lang") || i.lang;
|
|
4482
4547
|
g !== "en" && g !== "de" && g !== "fr" && (g = i.lang);
|
|
4483
|
-
const y =
|
|
4484
|
-
return { serverUrl: a, publicKey: h, verifyUrls:
|
|
4548
|
+
const y = s("transport"), E = y === "push" || y === "polling" ? y : i.transport, w = this.parseAuthenticatedEventDelayMs(s("authenticated-event-delay-ms"));
|
|
4549
|
+
return { serverUrl: a, publicKey: h, verifyUrls: d, lang: g, transport: E, authenticatedEventDelayMs: w };
|
|
4485
4550
|
}
|
|
4486
4551
|
parseAuthenticatedEventDelayMs(i) {
|
|
4487
4552
|
if (i === void 0 || i.trim() === "") return Ie;
|
|
4488
|
-
const
|
|
4489
|
-
return !Number.isFinite(
|
|
4553
|
+
const s = Number(i);
|
|
4554
|
+
return !Number.isFinite(s) || s < 0 ? Ie : Math.round(s);
|
|
4490
4555
|
}
|
|
4491
|
-
async createAuthRequest(i,
|
|
4556
|
+
async createAuthRequest(i, s, a) {
|
|
4492
4557
|
const h = await fetch(this.joinUrl(i, "/auth-requests"), {
|
|
4493
4558
|
method: "POST",
|
|
4494
4559
|
mode: "cors",
|
|
@@ -4496,31 +4561,31 @@ const ve = class ve extends HTMLElement {
|
|
|
4496
4561
|
"Content-Type": "application/json",
|
|
4497
4562
|
Accept: "application/json"
|
|
4498
4563
|
},
|
|
4499
|
-
body: JSON.stringify({ public_key:
|
|
4564
|
+
body: JSON.stringify({ public_key: s })
|
|
4500
4565
|
});
|
|
4501
4566
|
if (!h.ok) throw new Error(`Auth request creation failed: ${h.status}`);
|
|
4502
|
-
const
|
|
4503
|
-
if (!
|
|
4504
|
-
const m = this.extractClientSecret(
|
|
4567
|
+
const d = await h.json();
|
|
4568
|
+
if (!d.id) throw new Error("Missing id from server response");
|
|
4569
|
+
const m = this.extractClientSecret(d);
|
|
4505
4570
|
if (!m) throw new Error("Missing client secret from server response");
|
|
4506
|
-
return
|
|
4507
|
-
verificationId: String(
|
|
4508
|
-
code:
|
|
4571
|
+
return cr(a, i, s, { id: String(d.id), clientSecret: m }), this.activeAuthRequestId = String(d.id), this.activeAuthRequestSecret = m, this.updateActiveAuthRequestExpiry(d), this.updateCode(d.formattedCode ?? d.code), this.dispatchPublicEvent("sendity:challenge-created", {
|
|
4572
|
+
verificationId: String(d.id),
|
|
4573
|
+
code: d.formattedCode ?? d.code ?? "",
|
|
4509
4574
|
channel: this.primaryChannel(this.currentConfig?.verifyUrls ?? [])
|
|
4510
|
-
}),
|
|
4575
|
+
}), d;
|
|
4511
4576
|
}
|
|
4512
4577
|
async step() {
|
|
4513
4578
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4514
|
-
const { serverUrl: i, publicKey:
|
|
4515
|
-
if (!
|
|
4516
|
-
return await this.createAuthRequest(i,
|
|
4517
|
-
this.activeAuthRequestId =
|
|
4579
|
+
const { serverUrl: i, publicKey: s } = this.currentConfig, a = me(), h = bt(a, i, s), d = h?.id;
|
|
4580
|
+
if (!d)
|
|
4581
|
+
return await this.createAuthRequest(i, s, a);
|
|
4582
|
+
this.activeAuthRequestId = d, this.activeAuthRequestSecret = h.clientSecret;
|
|
4518
4583
|
const m = await fetch(
|
|
4519
|
-
this.authRequestStatusUrl(i,
|
|
4584
|
+
this.authRequestStatusUrl(i, d),
|
|
4520
4585
|
this.authRequestStatusInit(h.clientSecret)
|
|
4521
4586
|
);
|
|
4522
4587
|
if (m.status !== 200)
|
|
4523
|
-
return wt(a, i,
|
|
4588
|
+
return wt(a, i, s), await this.step();
|
|
4524
4589
|
const g = await m.json();
|
|
4525
4590
|
if (g.status === "verified")
|
|
4526
4591
|
return this.handleAuthenticated(g), g;
|
|
@@ -4532,17 +4597,17 @@ const ve = class ve extends HTMLElement {
|
|
|
4532
4597
|
}
|
|
4533
4598
|
configureRealtime(i) {
|
|
4534
4599
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4535
|
-
const { transport:
|
|
4536
|
-
let
|
|
4537
|
-
|
|
4538
|
-
const m =
|
|
4600
|
+
const { transport: s } = this.currentConfig, a = i?.broadcasting, h = !!(a?.key && a.channel && a.authEndpoint);
|
|
4601
|
+
let d = !1;
|
|
4602
|
+
s !== "polling" && h && a ? d = this.subscribeToBroadcasting(a) : s === "push" && console.warn("[sendity-auth] Push transport requested, but server response does not contain broadcasting metadata");
|
|
4603
|
+
const m = dr(s, h, d);
|
|
4539
4604
|
m.start && this.startPolling(m.delayMs);
|
|
4540
4605
|
}
|
|
4541
4606
|
subscribeToBroadcasting(i) {
|
|
4542
4607
|
if (!this.currentConfig || !i.key || !i.channel || !i.authEndpoint) return !1;
|
|
4543
4608
|
try {
|
|
4544
4609
|
window.Pusher = Ki;
|
|
4545
|
-
const
|
|
4610
|
+
const s = (i.scheme ?? "https") === "https", a = i.port ?? (s ? 443 : 80);
|
|
4546
4611
|
return this.echo = new Vi({
|
|
4547
4612
|
broadcaster: "reverb",
|
|
4548
4613
|
key: i.key,
|
|
@@ -4550,8 +4615,8 @@ const ve = class ve extends HTMLElement {
|
|
|
4550
4615
|
wsPort: a,
|
|
4551
4616
|
wssPort: a,
|
|
4552
4617
|
wsPath: i.wsPath ?? "/ws",
|
|
4553
|
-
forceTLS:
|
|
4554
|
-
encrypted:
|
|
4618
|
+
forceTLS: s,
|
|
4619
|
+
encrypted: s,
|
|
4555
4620
|
enabledTransports: ["ws", "wss"],
|
|
4556
4621
|
authEndpoint: this.joinUrl(this.currentConfig.serverUrl, i.authEndpoint),
|
|
4557
4622
|
auth: {
|
|
@@ -4565,20 +4630,20 @@ const ve = class ve extends HTMLElement {
|
|
|
4565
4630
|
}), this.echo.private(i.channel).listen(i.event ?? ".authenticated", (h) => {
|
|
4566
4631
|
this.handleAuthenticated(h);
|
|
4567
4632
|
}), !0;
|
|
4568
|
-
} catch (
|
|
4569
|
-
return console.warn("[sendity-auth] realtime subscription failed, falling back to polling if enabled",
|
|
4633
|
+
} catch (s) {
|
|
4634
|
+
return console.warn("[sendity-auth] realtime subscription failed, falling back to polling if enabled", s), this.currentConfig.transport === "auto" && this.startPolling(At), !1;
|
|
4570
4635
|
}
|
|
4571
4636
|
}
|
|
4572
4637
|
startPolling(i) {
|
|
4573
4638
|
if (this.pollTimer !== null || this.authenticated) return;
|
|
4574
|
-
const
|
|
4639
|
+
const s = () => {
|
|
4575
4640
|
this.pollTimer !== null || this.authenticated || this.destroyed || (this.pollTimer = window.setInterval(() => {
|
|
4576
4641
|
this.step().catch((a) => console.warn("[sendity-auth] poll failed", a));
|
|
4577
|
-
},
|
|
4642
|
+
}, or));
|
|
4578
4643
|
};
|
|
4579
4644
|
i > 0 ? this.fallbackPollTimer = window.setTimeout(() => {
|
|
4580
|
-
this.fallbackPollTimer = null,
|
|
4581
|
-
}, i) :
|
|
4645
|
+
this.fallbackPollTimer = null, s();
|
|
4646
|
+
}, i) : s();
|
|
4582
4647
|
}
|
|
4583
4648
|
handleAuthenticated(i) {
|
|
4584
4649
|
if (this.authenticated) return;
|
|
@@ -4589,34 +4654,34 @@ const ve = class ve extends HTMLElement {
|
|
|
4589
4654
|
return;
|
|
4590
4655
|
}
|
|
4591
4656
|
this.authenticated = !0, this.currentConfig && wt(me(), this.currentConfig.serverUrl, this.currentConfig.publicKey), this.stopAuthTransports(), this.showSuccess(i);
|
|
4592
|
-
const
|
|
4657
|
+
const s = this.toPublicAuthenticatedDetail(i), a = this.currentConfig?.authenticatedEventDelayMs ?? Ie;
|
|
4593
4658
|
this.authenticatedEventTimer = window.setTimeout(() => {
|
|
4594
|
-
this.authenticatedEventTimer = null, !this.destroyed && this.dispatchPublicEvent("sendity:authenticated",
|
|
4659
|
+
this.authenticatedEventTimer = null, !this.destroyed && this.dispatchPublicEvent("sendity:authenticated", s);
|
|
4595
4660
|
}, a);
|
|
4596
4661
|
}
|
|
4597
4662
|
stopAuthTransports() {
|
|
4598
4663
|
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;
|
|
4599
4664
|
}
|
|
4600
|
-
dispatchPublicEvent(i,
|
|
4601
|
-
this.dispatchEvent(new CustomEvent(i, { bubbles: !0, composed: !0, detail:
|
|
4665
|
+
dispatchPublicEvent(i, s) {
|
|
4666
|
+
this.dispatchEvent(new CustomEvent(i, { bubbles: !0, composed: !0, detail: s }));
|
|
4602
4667
|
}
|
|
4603
4668
|
toPublicAuthenticatedDetail(i) {
|
|
4604
|
-
const
|
|
4669
|
+
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;
|
|
4605
4670
|
return {
|
|
4606
|
-
sessionId:
|
|
4671
|
+
sessionId: s,
|
|
4607
4672
|
channel: a,
|
|
4608
4673
|
...i.identifier ? { address: i.identifier } : {},
|
|
4609
|
-
verificationId:
|
|
4674
|
+
verificationId: s,
|
|
4610
4675
|
signedResult: String(i.authorization ?? ""),
|
|
4611
4676
|
...h ? { expiresAt: String(h) } : {}
|
|
4612
4677
|
};
|
|
4613
4678
|
}
|
|
4614
4679
|
primaryChannel(i) {
|
|
4615
|
-
const
|
|
4616
|
-
return
|
|
4680
|
+
const s = i[0] ?? "";
|
|
4681
|
+
return s.startsWith("mailto:") ? "email" : s.startsWith("whatsapp:") || s.startsWith("whatsapp://") ? "whatsapp" : "unknown";
|
|
4617
4682
|
}
|
|
4618
|
-
authRequestStatusUrl(i,
|
|
4619
|
-
return new URL(this.joinUrl(i, `/auth-requests/${encodeURIComponent(
|
|
4683
|
+
authRequestStatusUrl(i, s) {
|
|
4684
|
+
return new URL(this.joinUrl(i, `/auth-requests/${encodeURIComponent(s)}`)).toString();
|
|
4620
4685
|
}
|
|
4621
4686
|
authRequestStatusInit(i) {
|
|
4622
4687
|
return {
|
|
@@ -4632,18 +4697,18 @@ const ve = class ve extends HTMLElement {
|
|
|
4632
4697
|
return String(i.client_secret ?? i.clientSecret ?? "");
|
|
4633
4698
|
}
|
|
4634
4699
|
updateActiveAuthRequestExpiry(i) {
|
|
4635
|
-
const
|
|
4636
|
-
|
|
4700
|
+
const s = i.expires_at ?? i.expiresAt;
|
|
4701
|
+
s && (this.activeAuthRequestExpiresAt = String(s));
|
|
4637
4702
|
}
|
|
4638
4703
|
waitingFooterMessage() {
|
|
4639
4704
|
if (!this.currentConfig) return "";
|
|
4640
|
-
const i = V(this.currentConfig.lang),
|
|
4641
|
-
return
|
|
4705
|
+
const i = V(this.currentConfig.lang), s = this.formatExpiryTime(this.activeAuthRequestExpiresAt, this.currentConfig.lang);
|
|
4706
|
+
return s ? i.ui.footerWaitingUntil.replace("(Time)", s) : i.ui.footerWaiting;
|
|
4642
4707
|
}
|
|
4643
|
-
formatExpiryTime(i,
|
|
4708
|
+
formatExpiryTime(i, s) {
|
|
4644
4709
|
if (!i) return null;
|
|
4645
4710
|
const a = new Date(i);
|
|
4646
|
-
return Number.isNaN(a.getTime()) ? null : new Intl.DateTimeFormat(this.localeForLang(
|
|
4711
|
+
return Number.isNaN(a.getTime()) ? null : new Intl.DateTimeFormat(this.localeForLang(s), { timeStyle: "short" }).format(a);
|
|
4647
4712
|
}
|
|
4648
4713
|
localeForLang(i) {
|
|
4649
4714
|
switch (i) {
|
|
@@ -4657,18 +4722,18 @@ const ve = class ve extends HTMLElement {
|
|
|
4657
4722
|
}
|
|
4658
4723
|
async fetchAuthorizationAfterAuthenticatedSignal() {
|
|
4659
4724
|
this.currentConfig || (this.currentConfig = this.resolveConfig());
|
|
4660
|
-
const i = bt(me(), this.currentConfig.serverUrl, this.currentConfig.publicKey),
|
|
4661
|
-
if (!
|
|
4725
|
+
const i = bt(me(), this.currentConfig.serverUrl, this.currentConfig.publicKey), s = this.activeAuthRequestId ?? i?.id, a = this.activeAuthRequestSecret ?? i?.clientSecret;
|
|
4726
|
+
if (!s || !a)
|
|
4662
4727
|
throw new Error("Cannot fetch authorization without an active auth request id and client secret");
|
|
4663
4728
|
const h = await fetch(
|
|
4664
|
-
this.authRequestStatusUrl(this.currentConfig.serverUrl,
|
|
4729
|
+
this.authRequestStatusUrl(this.currentConfig.serverUrl, s),
|
|
4665
4730
|
this.authRequestStatusInit(a)
|
|
4666
4731
|
);
|
|
4667
4732
|
if (!h.ok)
|
|
4668
4733
|
throw new Error(`Authorization fetch failed: ${h.status}`);
|
|
4669
|
-
const
|
|
4670
|
-
if (
|
|
4671
|
-
this.handleAuthenticated(
|
|
4734
|
+
const d = await h.json();
|
|
4735
|
+
if (d.status === "verified" && d.authorization) {
|
|
4736
|
+
this.handleAuthenticated(d);
|
|
4672
4737
|
return;
|
|
4673
4738
|
}
|
|
4674
4739
|
throw new Error("Verified auth request did not include authorization");
|
|
@@ -4677,33 +4742,37 @@ const ve = class ve extends HTMLElement {
|
|
|
4677
4742
|
if (!this.codeEl) return;
|
|
4678
4743
|
if (!!(i && String(i).trim().length > 0)) {
|
|
4679
4744
|
const a = String(i);
|
|
4680
|
-
this.lastCode = a, this.codeEl.textContent = a, this.codeContainerEl?.classList.remove("code--expired"), this.showCodeState();
|
|
4681
|
-
} else
|
|
4682
|
-
this.lastCode = void 0;
|
|
4683
|
-
const a = this.codeEl.getAttribute("data-placeholder") || "••••";
|
|
4684
|
-
this.codeEl.textContent = a, this.showLoading();
|
|
4685
|
-
}
|
|
4745
|
+
this.lastCode = a, this.codeEl.textContent = a, this.codeContainerEl?.classList.remove("code--expired", "code--placeholder"), this.showCodeState();
|
|
4746
|
+
} else
|
|
4747
|
+
this.lastCode = void 0, this.showPlaceholderCode();
|
|
4686
4748
|
this.currentConfig && this.renderVerifiers(this.currentConfig.verifyUrls);
|
|
4687
4749
|
}
|
|
4750
|
+
showPlaceholderCode() {
|
|
4751
|
+
this.codeEl && (this.lastCode = void 0, this.spinnerEl?.setAttribute("hidden", ""), this.codeEl.textContent = this.randomPlaceholderCode(), this.codeEl.removeAttribute("hidden"), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--exiting", "code--collapsed"), this.codeContainerEl?.classList.add("code--placeholder"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", ""));
|
|
4752
|
+
}
|
|
4753
|
+
randomPlaceholderCode() {
|
|
4754
|
+
const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", s = () => i[Math.floor(Math.random() * i.length)], a = () => `${s()}${s()}${s()}`;
|
|
4755
|
+
return `SDY-${a()}-${a()}`;
|
|
4756
|
+
}
|
|
4688
4757
|
renderError(i) {
|
|
4689
4758
|
this.codeEl && (this.codeEl.textContent = i), this.verifiersEl && (this.verifiersEl.innerHTML = "");
|
|
4690
4759
|
}
|
|
4691
4760
|
showLoading() {
|
|
4692
|
-
this.spinnerEl?.removeAttribute("hidden"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired"), this.codeEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", "");
|
|
4761
|
+
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", "");
|
|
4693
4762
|
}
|
|
4694
4763
|
showCodeState() {
|
|
4695
|
-
if (this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--verified"), this.codeContainerEl?.classList.remove("code--exiting", "code--collapsed"), this.codeContainerEl?.classList.add("code--active"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.verifiersEl?.classList.remove("verifiers--exiting"), this.verifiersEl?.removeAttribute("aria-hidden"), this.codeEl?.removeAttribute("hidden"), this.currentConfig && this.promptEl) {
|
|
4764
|
+
if (this.spinnerEl?.setAttribute("hidden", ""), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--verified", "code--placeholder"), this.codeContainerEl?.classList.remove("code--exiting", "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) {
|
|
4696
4765
|
const i = V(this.currentConfig.lang);
|
|
4697
4766
|
this.promptEl.textContent = i.ui.sendCodePrompt, this.promptEl.classList.remove("prompt--exiting"), this.promptEl.removeAttribute("aria-hidden"), this.promptEl.removeAttribute("hidden");
|
|
4698
4767
|
}
|
|
4699
4768
|
this.successEl?.setAttribute("hidden", "");
|
|
4700
4769
|
}
|
|
4701
4770
|
showSuccess(i) {
|
|
4702
|
-
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();
|
|
4703
|
-
const
|
|
4704
|
-
if (this.footerEl && (this.footerEl.hidden =
|
|
4771
|
+
this.rootEl?.classList.remove("sendity--expired"), this.rootEl?.classList.add("sendity--verified"), this.spinnerEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--active", "code--placeholder"), this.codeContainerEl?.classList.add("code--verified", "code--exiting"), this.promptEl?.classList.add("prompt--exiting"), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.stopCountdown();
|
|
4772
|
+
const s = this.isFooterHidden();
|
|
4773
|
+
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(() => {
|
|
4705
4774
|
this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl && (this.footerBrandEl.hidden = !0);
|
|
4706
|
-
}, pe))), this.footerStatusEl && (this.footerStatusEl.hidden =
|
|
4775
|
+
}, pe))), this.footerStatusEl && (this.footerStatusEl.hidden = s), this.footerMessageEl) {
|
|
4707
4776
|
const a = i.identifier && i.identifier.trim().length > 0 ? i.identifier.trim() : this.destinationAddressForChannel(i.channel ?? this.primaryChannel(this.currentConfig?.verifyUrls ?? []));
|
|
4708
4777
|
this.footerMessageEl.textContent = a ? `Verified ${a}` : "Verified";
|
|
4709
4778
|
}
|
|
@@ -4721,15 +4790,15 @@ const ve = class ve extends HTMLElement {
|
|
|
4721
4790
|
}, pe);
|
|
4722
4791
|
}
|
|
4723
4792
|
destinationAddressForChannel(i) {
|
|
4724
|
-
const
|
|
4793
|
+
const s = this.currentConfig?.verifyUrls ?? [], a = s.find((h) => this.channelClass(h) === i) ?? s[0];
|
|
4725
4794
|
if (!a) return null;
|
|
4726
4795
|
try {
|
|
4727
4796
|
const h = new URL(a, window.location.origin);
|
|
4728
4797
|
if (h.protocol === "mailto:")
|
|
4729
4798
|
return decodeURIComponent(h.pathname || h.href.replace(/^mailto:/, "").split("?")[0]) || null;
|
|
4730
4799
|
if (h.protocol === "whatsapp:" || h.protocol === "whatsapp://") {
|
|
4731
|
-
const
|
|
4732
|
-
return
|
|
4800
|
+
const d = h.searchParams.get("phone") || h.pathname.replace(/^\/+/, "");
|
|
4801
|
+
return d ? `+${d.replace(/^\+/, "")}` : null;
|
|
4733
4802
|
}
|
|
4734
4803
|
} catch {
|
|
4735
4804
|
if (a.startsWith("mailto:")) return a.replace(/^mailto:/, "").split("?")[0] || null;
|
|
@@ -4743,18 +4812,18 @@ const ve = class ve extends HTMLElement {
|
|
|
4743
4812
|
renderVerifiers(i) {
|
|
4744
4813
|
if (!this.verifiersEl) return;
|
|
4745
4814
|
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.toggle("is-two", i.length === 2);
|
|
4746
|
-
const
|
|
4815
|
+
const s = this.currentConfig;
|
|
4747
4816
|
i.forEach((a, h) => {
|
|
4748
4817
|
if (h > 0 && i.length === 2) {
|
|
4749
4818
|
const w = document.createElement("div");
|
|
4750
4819
|
w.className = "divider", w.setAttribute("aria-hidden", "true");
|
|
4751
4820
|
const R = document.createElement("span");
|
|
4752
|
-
R.textContent =
|
|
4821
|
+
R.textContent = s.lang === "de" ? "oder" : s.lang === "fr" ? "ou" : "or", w.appendChild(R), this.verifiersEl.appendChild(w);
|
|
4753
4822
|
}
|
|
4754
|
-
const
|
|
4755
|
-
|
|
4823
|
+
const d = document.createElement("div");
|
|
4824
|
+
d.className = "opt";
|
|
4756
4825
|
const m = document.createElement("a");
|
|
4757
|
-
m.className = "chan " + this.channelClass(a), m.href = this.buildLink(a,
|
|
4826
|
+
m.className = "chan " + this.channelClass(a), m.href = this.buildLink(a, s.lang), m.target = "_blank", m.rel = "noopener noreferrer", m.addEventListener("click", () => {
|
|
4758
4827
|
this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.showFooterWaitingState();
|
|
4759
4828
|
});
|
|
4760
4829
|
const g = this.iconForUrl(a);
|
|
@@ -4763,51 +4832,51 @@ const ve = class ve extends HTMLElement {
|
|
|
4763
4832
|
w.className = "icon", w.setAttribute("aria-hidden", "true"), w.innerHTML = g, m.appendChild(w);
|
|
4764
4833
|
}
|
|
4765
4834
|
const y = document.createElement("span");
|
|
4766
|
-
y.className = "label", y.textContent = this.channelLabel(a,
|
|
4767
|
-
const
|
|
4768
|
-
if (
|
|
4835
|
+
y.className = "label", y.textContent = this.channelLabel(a, s.lang), m.appendChild(y), d.appendChild(m);
|
|
4836
|
+
const E = this.destinationText(a, s.lang);
|
|
4837
|
+
if (E) {
|
|
4769
4838
|
const w = document.createElement("a");
|
|
4770
|
-
w.className = "dest", w.href = m.href, w.target = "_blank", w.rel = "noopener noreferrer", w.textContent =
|
|
4839
|
+
w.className = "dest", w.href = m.href, w.target = "_blank", w.rel = "noopener noreferrer", w.textContent = E, d.appendChild(w);
|
|
4771
4840
|
}
|
|
4772
|
-
this.verifiersEl.appendChild(
|
|
4841
|
+
this.verifiersEl.appendChild(d);
|
|
4773
4842
|
});
|
|
4774
4843
|
}
|
|
4775
4844
|
channelClass(i) {
|
|
4776
4845
|
try {
|
|
4777
|
-
const
|
|
4778
|
-
if (
|
|
4779
|
-
if (
|
|
4846
|
+
const s = new URL(i, window.location.origin);
|
|
4847
|
+
if (s.protocol === "mailto:") return "email";
|
|
4848
|
+
if (s.protocol === "whatsapp:" || s.protocol === "whatsapp://") return "whatsapp";
|
|
4780
4849
|
} catch {
|
|
4781
4850
|
if (i.startsWith("mailto:")) return "email";
|
|
4782
4851
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) return "whatsapp";
|
|
4783
4852
|
}
|
|
4784
4853
|
return "generic";
|
|
4785
4854
|
}
|
|
4786
|
-
channelLabel(i,
|
|
4787
|
-
const a = V(
|
|
4855
|
+
channelLabel(i, s) {
|
|
4856
|
+
const a = V(s), h = this.channelClass(i);
|
|
4788
4857
|
if (h === "email") return a.labels.email;
|
|
4789
4858
|
if (h === "whatsapp") return a.labels.whatsapp;
|
|
4790
4859
|
try {
|
|
4791
|
-
const
|
|
4792
|
-
return
|
|
4860
|
+
const d = new URL(i, window.location.origin);
|
|
4861
|
+
return d.protocol.startsWith("http") ? d.hostname : d.protocol.replace(":", "");
|
|
4793
4862
|
} catch {
|
|
4794
4863
|
return i;
|
|
4795
4864
|
}
|
|
4796
4865
|
}
|
|
4797
|
-
destinationText(i,
|
|
4798
|
-
const h = V(
|
|
4866
|
+
destinationText(i, s) {
|
|
4867
|
+
const h = V(s).ui.toPrefix ?? "to";
|
|
4799
4868
|
try {
|
|
4800
|
-
const
|
|
4801
|
-
if (
|
|
4802
|
-
const m = decodeURIComponent(
|
|
4869
|
+
const d = new URL(i, window.location.origin);
|
|
4870
|
+
if (d.protocol === "mailto:") {
|
|
4871
|
+
const m = decodeURIComponent(d.pathname || d.href.replace(/^mailto:/, "").split("?")[0]);
|
|
4803
4872
|
return m ? `${h} ${m}` : null;
|
|
4804
4873
|
}
|
|
4805
|
-
if (
|
|
4806
|
-
const m =
|
|
4874
|
+
if (d.protocol === "whatsapp:" || d.protocol === "whatsapp://") {
|
|
4875
|
+
const m = d.searchParams.get("phone") || d.pathname.replace(/^\/+/, "");
|
|
4807
4876
|
return m ? `${h} +${m.replace(/^\+/, "")}` : null;
|
|
4808
4877
|
}
|
|
4809
|
-
if (
|
|
4810
|
-
const m =
|
|
4878
|
+
if (d.protocol.startsWith("http") && (d.hostname === "wa.me" || d.hostname === "api.whatsapp.com")) {
|
|
4879
|
+
const m = d.pathname.replace(/^\/+/, "").replace(/[^0-9]/g, "");
|
|
4811
4880
|
return m ? `${h} +${m}` : null;
|
|
4812
4881
|
}
|
|
4813
4882
|
} catch {
|
|
@@ -4816,17 +4885,17 @@ const ve = class ve extends HTMLElement {
|
|
|
4816
4885
|
}
|
|
4817
4886
|
iconForUrl(i) {
|
|
4818
4887
|
try {
|
|
4819
|
-
const
|
|
4820
|
-
if (
|
|
4821
|
-
if (
|
|
4888
|
+
const s = new URL(i, window.location.origin);
|
|
4889
|
+
if (s.protocol === "mailto:") return vt;
|
|
4890
|
+
if (s.protocol === "whatsapp:" || s.protocol === "whatsapp://") return yt;
|
|
4822
4891
|
} catch {
|
|
4823
4892
|
if (i.startsWith("mailto:")) return vt;
|
|
4824
4893
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) return yt;
|
|
4825
4894
|
}
|
|
4826
4895
|
return null;
|
|
4827
4896
|
}
|
|
4828
|
-
labelForUrl(i,
|
|
4829
|
-
const a = V(
|
|
4897
|
+
labelForUrl(i, s) {
|
|
4898
|
+
const a = V(s);
|
|
4830
4899
|
try {
|
|
4831
4900
|
const h = new URL(i, window.location.origin);
|
|
4832
4901
|
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(":", "");
|
|
@@ -4834,38 +4903,38 @@ const ve = class ve extends HTMLElement {
|
|
|
4834
4903
|
return i.startsWith("mailto:") ? `${a.ui.by} ${a.labels.email}` : i.startsWith("whatsapp:") || i.startsWith("whatsapp://") ? `${a.ui.by} ${a.labels.whatsapp}` : i;
|
|
4835
4904
|
}
|
|
4836
4905
|
}
|
|
4837
|
-
buildLink(i,
|
|
4838
|
-
const a = this.lastCode, h = V(
|
|
4906
|
+
buildLink(i, s) {
|
|
4907
|
+
const a = this.lastCode, h = V(s), d = window.location.host;
|
|
4839
4908
|
if (!a) return i;
|
|
4840
4909
|
if (i.startsWith("mailto:")) {
|
|
4841
|
-
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g),
|
|
4842
|
-
y.set("subject",
|
|
4910
|
+
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), E = this.applyTemplate(h.templates.emailSubject, d, a), w = this.applyTemplate(h.templates.emailBody, d, a);
|
|
4911
|
+
y.set("subject", E), y.set("body", w);
|
|
4843
4912
|
const R = this.toQuery(y);
|
|
4844
4913
|
return `${m}?${R}`;
|
|
4845
4914
|
}
|
|
4846
4915
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) {
|
|
4847
|
-
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g),
|
|
4848
|
-
y.set("text",
|
|
4916
|
+
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), E = this.applyTemplate(h.templates.whatsappText, d, a);
|
|
4917
|
+
y.set("text", E);
|
|
4849
4918
|
const w = this.toQuery(y);
|
|
4850
4919
|
return `${m}?${w}`;
|
|
4851
4920
|
}
|
|
4852
4921
|
return i;
|
|
4853
4922
|
}
|
|
4854
|
-
applyTemplate(i,
|
|
4855
|
-
return i.replaceAll("(Host)",
|
|
4923
|
+
applyTemplate(i, s, a) {
|
|
4924
|
+
return i.replaceAll("(Host)", s).replaceAll("(Code)", a);
|
|
4856
4925
|
}
|
|
4857
4926
|
// Build query string without using URLSearchParams.toString() because it encodes
|
|
4858
4927
|
// spaces as '+', which breaks expectations for many mail clients handling mailto:
|
|
4859
4928
|
// We use encodeURIComponent so spaces become '%20' and follow RFC 3986 style.
|
|
4860
4929
|
toQuery(i) {
|
|
4861
|
-
const
|
|
4930
|
+
const s = [];
|
|
4862
4931
|
return i.forEach((a, h) => {
|
|
4863
|
-
const
|
|
4864
|
-
|
|
4865
|
-
}),
|
|
4932
|
+
const d = encodeURIComponent(h), m = encodeURIComponent(a);
|
|
4933
|
+
s.push(`${d}=${m}`);
|
|
4934
|
+
}), s.join("&");
|
|
4866
4935
|
}
|
|
4867
|
-
joinUrl(i,
|
|
4868
|
-
return i.endsWith("/") &&
|
|
4936
|
+
joinUrl(i, s) {
|
|
4937
|
+
return i.endsWith("/") && s.startsWith("/") ? i + s.slice(1) : !i.endsWith("/") && !s.startsWith("/") ? i + "/" + s : i + s;
|
|
4869
4938
|
}
|
|
4870
4939
|
};
|
|
4871
4940
|
ve.tailwindCssText = null, ve.tailwindLoading = null;
|