@talkjs/core 0.0.6 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/talkSession.cjs +1 -1
- package/dist/talkSession.d.ts +5 -5
- package/dist/talkSession.js +210 -203
- package/package.json +2 -1
package/dist/talkSession.js
CHANGED
|
@@ -90,23 +90,21 @@ function o() {
|
|
|
90
90
|
}
|
|
91
91
|
class u {
|
|
92
92
|
constructor(e2, t2, s2) {
|
|
93
|
-
this.layer = e2, this.states = t2, this.transitions = s2, this.
|
|
93
|
+
this.layer = e2, this.states = t2, this.transitions = s2, this._state = t2[0];
|
|
94
94
|
}
|
|
95
95
|
get state() {
|
|
96
96
|
return this._state;
|
|
97
97
|
}
|
|
98
|
-
transition(e2
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
101
|
-
if (!this.canTransition(e2
|
|
102
|
-
const
|
|
103
|
-
this._state =
|
|
98
|
+
transition(e2) {
|
|
99
|
+
const t2 = this.transitions[e2];
|
|
100
|
+
if (!t2) return;
|
|
101
|
+
if (!this.canTransition(e2)) return;
|
|
102
|
+
const s2 = this.state;
|
|
103
|
+
this._state = t2.to, t2.afterTransition({ from: s2, to: this.state });
|
|
104
104
|
}
|
|
105
|
-
canTransition(e2
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
const { from: n2, keyRequired: r2 } = s2;
|
|
109
|
-
return !(void 0 !== r2 && !t2) && (("UNLOCK" !== r2 || void 0 === this.key || t2 === this.key) && ("ANY" === n2 || n2.includes(this.state)));
|
|
105
|
+
canTransition(e2) {
|
|
106
|
+
const t2 = this.transitions[e2];
|
|
107
|
+
return !!t2 && ("ANY" === t2.from || t2.from.includes(this.state));
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
function c(e2) {
|
|
@@ -130,9 +128,9 @@ let p = null;
|
|
|
130
128
|
function f({ WebSocket: e2 }) {
|
|
131
129
|
p = e2;
|
|
132
130
|
}
|
|
133
|
-
class
|
|
131
|
+
class g {
|
|
134
132
|
constructor(e2, t2) {
|
|
135
|
-
this.realtimeUrl = e2, this.handlers = t2, this.socket = null, this.throttler = new
|
|
133
|
+
this.realtimeUrl = e2, this.handlers = t2, this.socket = null, this.throttler = new m(), this.stateMachine = new u("ReconnectingSocket", ["STOPPED", "WAITING_FOR_THROTTLER", "CONNECTING", "READY", "TERMINATED"], { queueAutoReconnect: { from: ["READY", "CONNECTING"], to: "WAITING_FOR_THROTTLER", afterTransition: ({ from: e3 }) => {
|
|
136
134
|
"READY" === e3 && this.handlers.onClose(), this.throttler.request(() => {
|
|
137
135
|
this.stateMachine.transition("connect");
|
|
138
136
|
});
|
|
@@ -183,7 +181,7 @@ class m {
|
|
|
183
181
|
this.stateMachine.transition("destroy");
|
|
184
182
|
}
|
|
185
183
|
}
|
|
186
|
-
let
|
|
184
|
+
let m = class {
|
|
187
185
|
constructor() {
|
|
188
186
|
this.initialDelayMs = 200 + 200 * Math.random(), this.exponentialFactor = 1.2, this.maxDelayMs = 1e4, this.currentDelayMs = this.initialDelayMs;
|
|
189
187
|
}
|
|
@@ -197,7 +195,7 @@ let g = class {
|
|
|
197
195
|
};
|
|
198
196
|
class v {
|
|
199
197
|
constructor(e2, t2) {
|
|
200
|
-
this.handlers = t2, this.socket = new
|
|
198
|
+
this.handlers = t2, this.socket = new g(e2, { onOpen: () => this.handlers.onOpen(), onClose: () => this.handlers.onClose(), onMessage: (e3) => this.onWebSocketMessage(e3) });
|
|
201
199
|
}
|
|
202
200
|
call(e2, t2, s2, n2) {
|
|
203
201
|
const r2 = `/${s2.map((e3) => encodeURIComponent(e3)).join("/")}`, i2 = JSON.stringify([e2, t2, r2, n2]);
|
|
@@ -247,7 +245,7 @@ class b {
|
|
|
247
245
|
void 0 !== this.timeout && (clearTimeout(this.timeout), this.timeout = void 0);
|
|
248
246
|
}
|
|
249
247
|
}
|
|
250
|
-
class
|
|
248
|
+
class w {
|
|
251
249
|
constructor() {
|
|
252
250
|
this.i = -1;
|
|
253
251
|
}
|
|
@@ -258,9 +256,9 @@ class y {
|
|
|
258
256
|
this.i = -1;
|
|
259
257
|
}
|
|
260
258
|
}
|
|
261
|
-
class
|
|
259
|
+
class y {
|
|
262
260
|
constructor(e2, t2) {
|
|
263
|
-
this.handlers = t2, this.seqCounter = new
|
|
261
|
+
this.handlers = t2, this.seqCounter = new w(), this.responseHandlers = {}, this.heartbeats = new A(this), this.socket = new v(e2, { onUpstreamRestarting: () => {
|
|
264
262
|
this.heartbeats.serverActive(), this.handlers.onUpstreamRestarting();
|
|
265
263
|
}, onOpen: () => {
|
|
266
264
|
this.heartbeats.clientActive(), this.heartbeats.serverActive(), this.handlers.onReady();
|
|
@@ -329,33 +327,36 @@ class A {
|
|
|
329
327
|
}
|
|
330
328
|
class C {
|
|
331
329
|
constructor(e2, t2, s2) {
|
|
332
|
-
this.authProvider = t2, this.handlers = s2, this.stateMachine = new u("AuthenticatedConnection", ["WAITING_FOR_WS", "
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
330
|
+
this.authProvider = t2, this.handlers = s2, this.stateMachine = new u("AuthenticatedConnection", ["WAITING_FOR_WS", "LOGGING_IN", "RENEWING_SESSION", "READY", "TERMINATED"], { logIn: { from: ["WAITING_FOR_WS"], to: "LOGGING_IN", afterTransition: () => __async(this, null, function* () {
|
|
331
|
+
yield this.renewSession();
|
|
332
|
+
}) }, logInFailed: { from: ["LOGGING_IN"], to: "LOGGING_IN", afterTransition: () => __async(this, null, function* () {
|
|
333
|
+
this.authProvider.refreshToken(), yield this.renewSession();
|
|
334
|
+
}) }, scheduledReauth: { from: ["READY"], to: "RENEWING_SESSION", afterTransition: () => __async(this, null, function* () {
|
|
335
|
+
yield this.renewSession();
|
|
336
|
+
}) }, scheduledReauthFailed: { from: ["RENEWING_SESSION"], to: "RENEWING_SESSION", afterTransition: () => __async(this, null, function* () {
|
|
337
|
+
this.authProvider.refreshToken(), yield this.renewSession();
|
|
338
|
+
}) }, authenticated: { from: ["LOGGING_IN", "RENEWING_SESSION"], to: "READY", afterTransition: ({ from: e3 }) => {
|
|
339
|
+
"LOGGING_IN" === e3 && this.handlers.onReady();
|
|
340
|
+
} }, authExpired: { from: ["READY", "RENEWING_SESSION"], to: "LOGGING_IN", afterTransition: () => __async(this, null, function* () {
|
|
341
|
+
this.handlers.onNotReady(), this.authProvider.refreshToken(), yield this.renewSession();
|
|
342
|
+
}) }, wsDisconnected: { from: ["READY", "LOGGING_IN", "RENEWING_SESSION"], to: "WAITING_FOR_WS", afterTransition: ({ from: e3 }) => {
|
|
343
|
+
"READY" !== e3 && "RENEWING_SESSION" !== e3 || this.handlers.onNotReady(), this.authProvider.clearScheduledRefresh();
|
|
343
344
|
} }, destroy: { from: "ANY", to: "TERMINATED", afterTransition: () => {
|
|
344
|
-
this.connection.destroy();
|
|
345
|
-
} } }), this.connection = new
|
|
346
|
-
this.
|
|
345
|
+
this.authProvider.clearScheduledRefresh(), this.connection.destroy();
|
|
346
|
+
} } }), this.connection = new y(e2, { onUpstreamRestarting: () => this.handlers.onUpstreamRestarting(), onReady: () => this.stateMachine.transition("logIn"), onNotReady: () => {
|
|
347
|
+
this.stateMachine.transition("wsDisconnected");
|
|
347
348
|
}, onAuthExpired: () => {
|
|
348
|
-
this.
|
|
349
|
+
this.stateMachine.transition("authExpired");
|
|
349
350
|
}, onPublish: (e3, t3) => {
|
|
350
351
|
this.handlers.onPublish(e3, t3);
|
|
351
|
-
} }), t2.onTokenChanged((
|
|
352
|
-
this.stateMachine.
|
|
352
|
+
} }), t2.onTokenChanged(() => {
|
|
353
|
+
"READY" === this.stateMachine.state && this.stateMachine.transition("scheduledReauth");
|
|
353
354
|
});
|
|
354
355
|
}
|
|
355
356
|
call(e2, t2, s2) {
|
|
356
357
|
const n2 = this.connection.call(e2, t2, s2);
|
|
357
358
|
return n2.then((e3) => {
|
|
358
|
-
e3.ok || "server" !== e3.where || 401 !== e3.value.status || "
|
|
359
|
+
e3.ok || "server" !== e3.where || 401 !== e3.value.status || "READY" !== this.stateMachine.state && "RENEWING_SESSION" !== this.stateMachine.state || this.stateMachine.transition("authExpired");
|
|
359
360
|
}), n2;
|
|
360
361
|
}
|
|
361
362
|
stopWs() {
|
|
@@ -367,16 +368,16 @@ class C {
|
|
|
367
368
|
destroy() {
|
|
368
369
|
this.stateMachine.transition("destroy");
|
|
369
370
|
}
|
|
370
|
-
renewSession(
|
|
371
|
+
renewSession() {
|
|
371
372
|
return __async(this, null, function* () {
|
|
372
|
-
const s2 = yield this.connection.call("POST", ["session", "renew"], { token: e2 });
|
|
373
|
+
const e2 = yield this.authProvider.getToken(), s2 = yield this.connection.call("POST", ["session", "renew"], { token: e2 });
|
|
373
374
|
if (!s2.ok && "client" === s2.where) return;
|
|
374
375
|
const n2 = s2.value;
|
|
375
376
|
if (n2.status, 200 === n2.status) {
|
|
376
377
|
const t2 = n2.data.expiresInSeconds;
|
|
377
|
-
return void (null !== t2 && t2 < 120 ? (console.
|
|
378
|
+
return void (null !== t2 && t2 < 120 ? (console.warn(`[TalkJS] Authenticated with a token that expires in ${t2}s. Treating it as already expired and refreshing. Newly generated tokens should last at least 10 minutes.`), "LOGGING_IN" === this.stateMachine.state ? this.stateMachine.transition("logInFailed") : "RENEWING_SESSION" === this.stateMachine.state && this.stateMachine.transition("scheduledReauthFailed")) : (this.authProvider.scheduleRefresh(t2), this.authProvider.emitTokenAccepted(e2), this.stateMachine.canTransition("authenticated") && this.stateMachine.transition("authenticated")));
|
|
378
379
|
}
|
|
379
|
-
if (401 === n2.status) return void this.stateMachine.transition("
|
|
380
|
+
if (401 === n2.status) return void ("LOGGING_IN" === this.stateMachine.state ? this.stateMachine.transition("logInFailed") : "RENEWING_SESSION" === this.stateMachine.state && this.stateMachine.transition("scheduledReauthFailed"));
|
|
380
381
|
if (400 === n2.status) return void this.authProvider.emitTokenRefreshFailed(t("Authentication", n2));
|
|
381
382
|
if (402 === n2.status) return void this.authProvider.emitTokenRefreshFailed(t("Authentication", n2));
|
|
382
383
|
const r2 = 5e3 * Math.random() + 5e3;
|
|
@@ -498,7 +499,7 @@ class k {
|
|
|
498
499
|
}
|
|
499
500
|
}
|
|
500
501
|
const x = "undefined" != typeof window ? (_a = window.queueMicrotask) != null ? _a : setTimeout : setTimeout;
|
|
501
|
-
class
|
|
502
|
+
class S {
|
|
502
503
|
constructor(e2, t2) {
|
|
503
504
|
this.clearPendingBatch = e2, this.sendCalls = t2, this.sent = false, x(() => this.send());
|
|
504
505
|
}
|
|
@@ -509,14 +510,14 @@ class T {
|
|
|
509
510
|
this.sent = true;
|
|
510
511
|
}
|
|
511
512
|
}
|
|
512
|
-
class
|
|
513
|
+
class T extends S {
|
|
513
514
|
constructor(e2, t2) {
|
|
514
515
|
super(t2, () => {
|
|
515
516
|
this.sendSubscribe(), this.sendGet();
|
|
516
517
|
}), this.connection = e2, this.getCalls = [], this.subscribeCalls = [];
|
|
517
518
|
}
|
|
518
519
|
canPush(e2, t2) {
|
|
519
|
-
return
|
|
520
|
+
return T.isCorrectBatchTypeFor(e2, t2);
|
|
520
521
|
}
|
|
521
522
|
static isCorrectBatchTypeFor(e2, t2) {
|
|
522
523
|
return s(t2, ["users", "*"]) && ("GET" === e2 || "SUBSCRIBE" === e2);
|
|
@@ -542,7 +543,7 @@ class S extends T {
|
|
|
542
543
|
this.connection.call("SUBSCRIBE", ["users"], { ids: e2 }).then((e3) => this.subscribeCalls.forEach((t2) => t2.deferred.resolve(e3)));
|
|
543
544
|
}
|
|
544
545
|
}
|
|
545
|
-
class D extends
|
|
546
|
+
class D extends S {
|
|
546
547
|
constructor(e2, t2, s2) {
|
|
547
548
|
super(s2, () => this.sendMutate()), this.conversationId = e2, this.connection = t2, this.calls = [];
|
|
548
549
|
}
|
|
@@ -589,7 +590,7 @@ class I {
|
|
|
589
590
|
return this.connection.isConnected();
|
|
590
591
|
}
|
|
591
592
|
createEmptyBatchFor(e2, t2) {
|
|
592
|
-
if (
|
|
593
|
+
if (T.isCorrectBatchTypeFor(e2, t2)) return new T(this.connection, () => this.pendingBatch = null);
|
|
593
594
|
if (D.isCorrectBatchTypeFor(e2, t2)) {
|
|
594
595
|
const e3 = t2[1];
|
|
595
596
|
return new D(e3, this.connection, () => this.pendingBatch = null);
|
|
@@ -649,7 +650,7 @@ class M {
|
|
|
649
650
|
function R(e2) {
|
|
650
651
|
return e2.map((e3) => encodeURIComponent(e3)).join();
|
|
651
652
|
}
|
|
652
|
-
class
|
|
653
|
+
class N {
|
|
653
654
|
constructor() {
|
|
654
655
|
this.paths = {};
|
|
655
656
|
}
|
|
@@ -669,9 +670,9 @@ class _ {
|
|
|
669
670
|
Object.values(this.paths).forEach((t2) => e2(t2));
|
|
670
671
|
}
|
|
671
672
|
}
|
|
672
|
-
class
|
|
673
|
+
class _ {
|
|
673
674
|
constructor(e2, t2, s2) {
|
|
674
|
-
this.handlers = s2, this.targetSubscriptions = new
|
|
675
|
+
this.handlers = s2, this.targetSubscriptions = new N(), this.connection = new B(e2, t2, { onUpstreamRestarting: () => this.handlers.onUpstreamRestarting(), onSubscriptionsLost: () => {
|
|
675
676
|
this.targetSubscriptions.forEach((e3) => {
|
|
676
677
|
this.resubscribe(e3);
|
|
677
678
|
}), this.handlers.onResubscribeSent();
|
|
@@ -705,10 +706,10 @@ class O {
|
|
|
705
706
|
return this.connection.isConnected();
|
|
706
707
|
}
|
|
707
708
|
}
|
|
708
|
-
function
|
|
709
|
+
function P(e2, t2) {
|
|
709
710
|
return void 0 === t2 ? e2 : t2;
|
|
710
711
|
}
|
|
711
|
-
function
|
|
712
|
+
function O(e2, t2) {
|
|
712
713
|
if (void 0 === t2) return e2;
|
|
713
714
|
if (null === t2) return {};
|
|
714
715
|
const s2 = __spreadValues({}, e2);
|
|
@@ -880,7 +881,7 @@ class H extends W {
|
|
|
880
881
|
this.mutate(e2, (s2) => {
|
|
881
882
|
const n2 = s2.value.snapshot;
|
|
882
883
|
if (null === n2) return console.warn("[TalkJS] Received a 'used edited' event for a user that we thought didn't exist."), s2;
|
|
883
|
-
return c({ snapshot: { id: n2.id, name:
|
|
884
|
+
return c({ snapshot: { id: n2.id, name: P(n2.name, t2.diff.name), custom: O(n2.custom, t2.diff.custom), locale: P(n2.locale, t2.diff.locale), photoUrl: P(n2.photoUrl, t2.diff.photoUrl), role: P(n2.role, t2.diff.role), welcomeMessage: P(n2.welcomeMessage, t2.diff.welcomeMessage) }, lastChanged: e2 });
|
|
884
885
|
});
|
|
885
886
|
}
|
|
886
887
|
getFromCache() {
|
|
@@ -892,7 +893,7 @@ class H extends W {
|
|
|
892
893
|
teardownNested(e2) {
|
|
893
894
|
}
|
|
894
895
|
}
|
|
895
|
-
const
|
|
896
|
+
const G = /\uFE0F/g, L = String.fromCharCode(8205);
|
|
896
897
|
function z(e2) {
|
|
897
898
|
if (":arslan:" === e2.text) return ":arslan:";
|
|
898
899
|
const t2 = function({ text: e3, kind: t3 }) {
|
|
@@ -902,7 +903,7 @@ function z(e2) {
|
|
|
902
903
|
let s3 = 0, n2 = 0, r2 = 0;
|
|
903
904
|
for (; r2 < e4.length; ) s3 = e4.charCodeAt(r2++), n2 ? (t4.push((65536 + (n2 - 55296 << 10) + (s3 - 56320)).toString(16)), n2 = 0) : 55296 <= s3 && s3 <= 56319 ? n2 = s3 : t4.push(s3.toString(16));
|
|
904
905
|
return t4.join("-");
|
|
905
|
-
}((s2 = e3).indexOf(
|
|
906
|
+
}((s2 = e3).indexOf(L) < 0 ? s2.replace(G, "") : s2) : (_a2 = Y[e3]) != null ? _a2 : function(e4) {
|
|
906
907
|
if (/;-?\)/.test(e4)) return "1f609";
|
|
907
908
|
if (e4 = e4.replace(/;/g, ":"), /:-o/i.test(e4)) return "1f631";
|
|
908
909
|
return e4 = e4.replace(/-/g, "").toLowerCase(), J[e4];
|
|
@@ -912,15 +913,15 @@ function z(e2) {
|
|
|
912
913
|
return t2 ? String.fromCodePoint(parseInt(t2, 16)) : e2.text;
|
|
913
914
|
}
|
|
914
915
|
const J = { ":)": "1f642", ":o": "1f62e", ":]": "1f60f", ":d": "1f600", xd: "1f61d", ":p": "1f61c", ":@": "1f621", ":[": "1f621", ":(": "1f626", ":'(": "1f62d", ":’(": "1f62d", ":*": "1f618", ":/": "1f614", ":s": "1f616", ":|": "1f633", ":$": "263a", ":x": "1f637", "<3": "2764", "</3": "1f494" }, Y = { ":thumbsup:": "1f44d", ":thumbsdown:": "1f44e", ":poop:": "1f4a9" };
|
|
915
|
-
var Q,
|
|
916
|
-
function
|
|
916
|
+
var Q, V = {};
|
|
917
|
+
function Z(e2, t2) {
|
|
917
918
|
const s2 = t2.lastIndex;
|
|
918
919
|
let n2;
|
|
919
920
|
const r2 = [];
|
|
920
921
|
for (; null !== (n2 = t2.exec(e2)); ) r2.push(n2);
|
|
921
922
|
return t2.lastIndex = s2, r2;
|
|
922
923
|
}
|
|
923
|
-
function
|
|
924
|
+
function K(e2) {
|
|
924
925
|
const t2 = e2.replace(/%2F/g, "/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/, "$1");
|
|
925
926
|
return decodeURIComponent(t2);
|
|
926
927
|
}
|
|
@@ -930,16 +931,16 @@ function X(e2, t2) {
|
|
|
930
931
|
}
|
|
931
932
|
}
|
|
932
933
|
!function() {
|
|
933
|
-
if (Q) return
|
|
934
|
+
if (Q) return V;
|
|
934
935
|
function e2(e3) {
|
|
935
936
|
return String.fromCharCode(parseInt(e3.slice(1), 16));
|
|
936
937
|
}
|
|
937
938
|
function t2(e3) {
|
|
938
939
|
return `%${`00${e3.charCodeAt(0).toString(16)}`.slice(-2)}`;
|
|
939
940
|
}
|
|
940
|
-
Q = 1, Object.defineProperty(
|
|
941
|
+
Q = 1, Object.defineProperty(V, "__esModule", { value: true }), V.encode = function(t3) {
|
|
941
942
|
return btoa(encodeURIComponent(t3).replace(/%[0-9A-F]{2}/g, e2));
|
|
942
|
-
},
|
|
943
|
+
}, V.decode = function(e3) {
|
|
943
944
|
return decodeURIComponent(Array.from(atob(e3), t2).join(""));
|
|
944
945
|
};
|
|
945
946
|
}(), ((e2) => {
|
|
@@ -1003,15 +1004,15 @@ function ie(e2, t2) {
|
|
|
1003
1004
|
}(t4);
|
|
1004
1005
|
return ae(e5, s3);
|
|
1005
1006
|
}(e4.children, t3);
|
|
1006
|
-
if ("file" === e4.type && "video" === e4.subtype) return `🎥 ${
|
|
1007
|
-
if ("file" === e4.type && "image" === e4.subtype) return `📷 ${
|
|
1008
|
-
if ("file" === e4.type && "audio" === e4.subtype) return `🎧 ${
|
|
1007
|
+
if ("file" === e4.type && "video" === e4.subtype) return `🎥 ${K(e4.url)}`;
|
|
1008
|
+
if ("file" === e4.type && "image" === e4.subtype) return `📷 ${K(e4.url)}`;
|
|
1009
|
+
if ("file" === e4.type && "audio" === e4.subtype) return `🎧 ${K(e4.url)}`;
|
|
1009
1010
|
if ("file" === e4.type && "voice" === e4.subtype) {
|
|
1010
1011
|
const t4 = e4.duration;
|
|
1011
1012
|
if (void 0 === t4) return "🎙️";
|
|
1012
1013
|
return `🎙️ (${Math.floor(t4 / 60)}:${Math.floor(t4 % 60).toString().padStart(2, "0")})`;
|
|
1013
1014
|
}
|
|
1014
|
-
if ("file" === e4.type) return e4.subtype, `📎 ${
|
|
1015
|
+
if ("file" === e4.type) return e4.subtype, `📎 ${K(e4.url)}`;
|
|
1015
1016
|
if ("location" === e4.type) return "📍";
|
|
1016
1017
|
return "";
|
|
1017
1018
|
}(e3, t2));
|
|
@@ -1097,7 +1098,7 @@ class oe extends $ {
|
|
|
1097
1098
|
messageEdited(e2, t2) {
|
|
1098
1099
|
this.mutate(e2, (s2) => {
|
|
1099
1100
|
if (null === s2.value.data) return s2;
|
|
1100
|
-
return c({ lastChanged: e2, sender: s2.value.sender, data: { id: s2.value.data.id, type: s2.value.data.type, createdAt: s2.value.data.createdAt, origin: s2.value.data.origin, referencedMessageId: s2.value.data.referencedMessageId, editedAt:
|
|
1101
|
+
return c({ lastChanged: e2, sender: s2.value.sender, data: { id: s2.value.data.id, type: s2.value.data.type, createdAt: s2.value.data.createdAt, origin: s2.value.data.origin, referencedMessageId: s2.value.data.referencedMessageId, editedAt: P(s2.value.data.editedAt, t2.diff.editedAt), custom: O(s2.value.data.custom, t2.diff.custom), content: P(s2.value.data.content, t2.diff.content) } });
|
|
1101
1102
|
});
|
|
1102
1103
|
}
|
|
1103
1104
|
messageDeleted(e2, t2) {
|
|
@@ -1165,7 +1166,7 @@ class ce extends W {
|
|
|
1165
1166
|
fetchInitial(e2) {
|
|
1166
1167
|
return __async(this, null, function* () {
|
|
1167
1168
|
const t2 = this.onlyUsedInternally ? 1 : 30, s2 = yield le({ realtimeClient: this.realtimeClient, conversationId: this.conversationId, count: t2 });
|
|
1168
|
-
return s2.ok ? null === s2.value.messages ? c({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null }) : he({ seq: e2, messages: s2.value.messages, cursor: s2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : s2;
|
|
1169
|
+
return s2.ok ? null === s2.value.messages ? c({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null }) : he({ seq: e2, messages: s2.value.messages, cursor: s2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : s2;
|
|
1169
1170
|
});
|
|
1170
1171
|
}
|
|
1171
1172
|
teardownNested(e2) {
|
|
@@ -1176,11 +1177,12 @@ class ce extends W {
|
|
|
1176
1177
|
}
|
|
1177
1178
|
loadNested(e2, t2) {
|
|
1178
1179
|
return __async(this, null, function* () {
|
|
1179
|
-
|
|
1180
|
+
var _a2, _b;
|
|
1181
|
+
if (null === t2.stores) return c({ snapshot: null, loadedAll: true, lastChanged: t2.lastChanged, lastMessageChanged: t2.lastMessageChanged });
|
|
1180
1182
|
const s2 = yield Promise.all(t2.inWindow.map((t3) => t3.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1181
1183
|
if (n2) return n2;
|
|
1182
|
-
const r2 = s2, i2 = r2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot), a2 = Math.max(t2.lastChanged, ...r2.map((e3) => e3.value.lastChanged));
|
|
1183
|
-
return c({ snapshot: i2, loadedAll: null === t2.windowEnd, lastChanged: a2 });
|
|
1184
|
+
const r2 = s2, i2 = r2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot), a2 = Math.max(t2.lastChanged, ...r2.map((e3) => e3.value.lastChanged)), o2 = (_a2 = r2[0]) == null ? void 0 : _a2.value, u2 = Math.max(t2.lastMessageChanged, (_b = o2 == null ? void 0 : o2.lastChanged) != null ? _b : -1);
|
|
1185
|
+
return c({ snapshot: i2, loadedAll: null === t2.windowEnd, lastChanged: a2, lastMessageChanged: u2 });
|
|
1184
1186
|
});
|
|
1185
1187
|
}
|
|
1186
1188
|
loadMore(e2) {
|
|
@@ -1211,7 +1213,8 @@ class ce extends W {
|
|
|
1211
1213
|
null === i2 ? a2 = null : i2 in n2 ? a2 = n2[i2] : (a2 = new oe(e2, this.conversationId, i2, this.realtimeClient), n2[i2] = a2);
|
|
1212
1214
|
const o2 = new ue(e2, t2.state.createdAt, r2, a2), u2 = [...s2.value.inWindow, o2];
|
|
1213
1215
|
u2.sort((e3, t3) => t3.createdAt - e3.createdAt);
|
|
1214
|
-
|
|
1216
|
+
const l2 = u2[0].messageId === t2.messageId ? e2 : s2.value.lastMessageChanged;
|
|
1217
|
+
return c({ lastChanged: e2, lastMessageChanged: l2, stores: n2, inWindow: u2, windowEnd: s2.value.windowEnd });
|
|
1215
1218
|
});
|
|
1216
1219
|
}
|
|
1217
1220
|
messageEdited(e2, t2) {
|
|
@@ -1230,17 +1233,21 @@ class ce extends W {
|
|
|
1230
1233
|
if (t2.newLastMessage && 0 === r2.length) {
|
|
1231
1234
|
const s3 = new oe(e2, this.conversationId, t2.newLastMessage, this.realtimeClient);
|
|
1232
1235
|
n2[s3.messageId] = s3;
|
|
1233
|
-
const
|
|
1236
|
+
const i3 = t2.newLastMessage.referencedMessageId;
|
|
1234
1237
|
let a2;
|
|
1235
|
-
null ===
|
|
1238
|
+
null === i3 ? a2 = null : i3 in n2 ? a2 = n2[i3] : (a2 = new oe(e2, this.conversationId, i3, this.realtimeClient), n2[i3] = a2);
|
|
1236
1239
|
const o2 = new ue(e2, t2.newLastMessage.createdAt, s3, a2);
|
|
1237
1240
|
r2.push(o2);
|
|
1238
1241
|
}
|
|
1239
|
-
|
|
1242
|
+
const i2 = void 0 !== t2.newLastMessage ? e2 : s2.value.lastMessageChanged;
|
|
1243
|
+
return c({ lastChanged: e2, lastMessageChanged: i2, stores: n2, inWindow: r2, windowEnd: s2.value.windowEnd });
|
|
1240
1244
|
});
|
|
1241
1245
|
}
|
|
1242
1246
|
conversationCleared(e2, t2) {
|
|
1243
|
-
this.mutate(e2, (t3) =>
|
|
1247
|
+
this.mutate(e2, (t3) => {
|
|
1248
|
+
var _a2;
|
|
1249
|
+
return 0 === ((_a2 = t3.value.inWindow) == null ? void 0 : _a2.length) && null === t3.value.windowEnd ? t3 : (de(t3.value), c({ lastChanged: e2, lastMessageChanged: e2, stores: {}, inWindow: [], windowEnd: null }));
|
|
1250
|
+
});
|
|
1244
1251
|
}
|
|
1245
1252
|
sideCreated(e2, t2) {
|
|
1246
1253
|
const s2 = this.fetchInitial(e2);
|
|
@@ -1249,7 +1256,7 @@ class ce extends W {
|
|
|
1249
1256
|
}), e3) : s2);
|
|
1250
1257
|
}
|
|
1251
1258
|
sideDeleted(e2, t2) {
|
|
1252
|
-
this.mutate(e2, (t3) => (de(t3.value), c({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null })));
|
|
1259
|
+
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (de(t3.value), c({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null })));
|
|
1253
1260
|
}
|
|
1254
1261
|
getMessageFromCache(e2) {
|
|
1255
1262
|
return __async(this, null, function* () {
|
|
@@ -1272,6 +1279,7 @@ function le(_0) {
|
|
|
1272
1279
|
});
|
|
1273
1280
|
}
|
|
1274
1281
|
function he({ seq: e2, prevState: t2, messages: s2, cursor: n2, conversationId: r2, realtimeClient: i2 }) {
|
|
1282
|
+
var _a2, _b, _c, _d;
|
|
1275
1283
|
const a2 = t2 ? __spreadValues({}, t2.stores) : {};
|
|
1276
1284
|
for (const t3 of s2) if (void 0 === a2[t3.id]) {
|
|
1277
1285
|
const s3 = new oe(e2, r2, t3, i2);
|
|
@@ -1286,8 +1294,10 @@ function he({ seq: e2, prevState: t2, messages: s2, cursor: n2, conversationId:
|
|
|
1286
1294
|
}
|
|
1287
1295
|
const o2 = t2 ? [...t2.inWindow] : [];
|
|
1288
1296
|
for (const t3 of s2) o2.push(new ue(e2, t3.createdAt, a2[t3.id], t3.referencedMessageId ? a2[t3.referencedMessageId] : null));
|
|
1289
|
-
|
|
1290
|
-
|
|
1297
|
+
o2.sort((e3, t3) => t3.createdAt - e3.createdAt);
|
|
1298
|
+
const u2 = (_b = (_a2 = t2 == null ? void 0 : t2.inWindow) == null ? void 0 : _a2[0]) == null ? void 0 : _b.messageId, l2 = (_c = o2 == null ? void 0 : o2[0]) == null ? void 0 : _c.messageId, h2 = u2 === l2 ? (_d = t2 == null ? void 0 : t2.lastMessageChanged) != null ? _d : e2 : e2;
|
|
1299
|
+
if (null === n2) return c({ lastChanged: e2, lastMessageChanged: h2, stores: a2, inWindow: o2, windowEnd: null });
|
|
1300
|
+
return c({ lastChanged: e2, lastMessageChanged: h2, stores: a2, inWindow: o2, windowEnd: { cursor: n2, oldestMessageTs: s2[s2.length - 1].createdAt } });
|
|
1291
1301
|
}
|
|
1292
1302
|
function de(e2) {
|
|
1293
1303
|
if (e2.stores) {
|
|
@@ -1326,7 +1336,7 @@ class pe extends W {
|
|
|
1326
1336
|
const s2 = yield t2.messageWindowStore.store.getDeep(e2);
|
|
1327
1337
|
if (!s2.ok) return s2;
|
|
1328
1338
|
const n2 = s2.value.snapshot, r2 = (_a2 = n2 == null ? void 0 : n2[0]) != null ? _a2 : null;
|
|
1329
|
-
return c({ lastChanged: Math.max(t2.lastChanged, s2.value.
|
|
1339
|
+
return c({ lastChanged: Math.max(t2.lastChanged, s2.value.lastMessageChanged), snapshot: __spreadProps(__spreadValues({}, t2.snapshot), { lastMessage: r2 }) });
|
|
1330
1340
|
});
|
|
1331
1341
|
}
|
|
1332
1342
|
participantEdited(e2, t2) {
|
|
@@ -1353,11 +1363,11 @@ class pe extends W {
|
|
|
1353
1363
|
}
|
|
1354
1364
|
function fe(e2, t2) {
|
|
1355
1365
|
const s2 = t2;
|
|
1356
|
-
return { id: e2.id, createdAt: e2.createdAt, subject:
|
|
1366
|
+
return { id: e2.id, createdAt: e2.createdAt, subject: P(e2.subject, s2.subject), photoUrl: P(e2.photoUrl, s2.photoUrl), welcomeMessages: P(e2.welcomeMessages, s2.welcomeMessages), custom: O(e2.custom, s2.custom), lastMessageAt: P(e2.lastMessageAt, s2.lastMessageAt), unreadMessageCount: P(e2.unreadMessageCount, s2.unreadMessageCount), isUnread: P(e2.isUnread, s2.isUnread), access: P(e2.access, s2.access), notify: P(e2.notify, s2.notify), readUntil: P(e2.readUntil, s2.readUntil), joinedAt: e2.joinedAt };
|
|
1357
1367
|
}
|
|
1358
|
-
class
|
|
1368
|
+
class ge {
|
|
1359
1369
|
constructor(e2, t2, s2) {
|
|
1360
|
-
this.realtimeClient = s2, this.userStores = {}, this.messageWindowStores = {}, this.conversationStores = {}, this.emitMutex = new j(), this.seqOffset = 0, this.seqInThisConnection = 0, this.refetchOnNextNetworkLoss = true, this.connection = new
|
|
1370
|
+
this.realtimeClient = s2, this.userStores = {}, this.messageWindowStores = {}, this.conversationStores = {}, this.emitMutex = new j(), this.seqOffset = 0, this.seqInThisConnection = 0, this.refetchOnNextNetworkLoss = true, this.connection = new _(e2, t2, { onUpstreamRestarting: () => {
|
|
1361
1371
|
this.refetchOnNextNetworkLoss = false;
|
|
1362
1372
|
}, onReady: () => {
|
|
1363
1373
|
this.refetchOnNextNetworkLoss = true;
|
|
@@ -1581,9 +1591,9 @@ class me {
|
|
|
1581
1591
|
return this.connection.isConnected();
|
|
1582
1592
|
}
|
|
1583
1593
|
}
|
|
1584
|
-
class
|
|
1594
|
+
class me {
|
|
1585
1595
|
constructor(e2, t2, s2) {
|
|
1586
|
-
this.userId = t2, this.alive = true, this.connection = new
|
|
1596
|
+
this.userId = t2, this.alive = true, this.connection = new ge(e2, s2, this), s2.onTokenRefreshFailed(() => {
|
|
1587
1597
|
this.destroy();
|
|
1588
1598
|
});
|
|
1589
1599
|
}
|
|
@@ -1667,7 +1677,7 @@ function be(e2, s2) {
|
|
|
1667
1677
|
if (s2.ok) return s2.value;
|
|
1668
1678
|
throw "SESSION_DESTROYED" === s2.value ? new Error(`${e2} failed because the session was destroyed`) : new Error(t((_a2 = s2.value.operation) != null ? _a2 : e2, s2.value));
|
|
1669
1679
|
}
|
|
1670
|
-
class
|
|
1680
|
+
class we {
|
|
1671
1681
|
constructor(e2, t2) {
|
|
1672
1682
|
this.id = e2, this._realtimeClient = t2;
|
|
1673
1683
|
}
|
|
@@ -1698,7 +1708,7 @@ class ye {
|
|
|
1698
1708
|
return this._realtimeClient.subscribe(["users", this.brandedId], e2);
|
|
1699
1709
|
}
|
|
1700
1710
|
}
|
|
1701
|
-
class
|
|
1711
|
+
class ye {
|
|
1702
1712
|
constructor(e2, t2, s2) {
|
|
1703
1713
|
this.userId = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
1704
1714
|
}
|
|
@@ -1800,7 +1810,7 @@ function Ee(e2, t2) {
|
|
|
1800
1810
|
const n2 = s2;
|
|
1801
1811
|
let r2 = 0;
|
|
1802
1812
|
const i2 = [];
|
|
1803
|
-
for (const a2 of
|
|
1813
|
+
for (const a2 of Z(s2, e2)) {
|
|
1804
1814
|
a2.index - r2 > 0 && i2.push(n2.substring(r2, a2.index));
|
|
1805
1815
|
const e3 = t2(a2);
|
|
1806
1816
|
Array.isArray(e3) ? i2.push(...e3) : i2.push(e3), r2 = a2.index + a2[0].length;
|
|
@@ -1810,18 +1820,18 @@ function Ee(e2, t2) {
|
|
|
1810
1820
|
}
|
|
1811
1821
|
const ke = "’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1812
1822
|
var xe = ((e2) => (e2[e2.italic = 1] = "italic", e2[e2.strikethrough = 2] = "strikethrough", e2[e2.bold = 4] = "bold", e2))(xe || {});
|
|
1813
|
-
const
|
|
1823
|
+
const Se = [0, 1, 2, 3, 4, 5, 6].map((e2) => {
|
|
1814
1824
|
const t2 = [];
|
|
1815
1825
|
return 1 & e2 || t2.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/), 2 & e2 || t2.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/), 4 & e2 || t2.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/), new RegExp(t2.map((e3) => e3.source).join("|"), "g");
|
|
1816
|
-
}),
|
|
1826
|
+
}), Te = { _: 1, "*": 4, "~": 2 };
|
|
1817
1827
|
function De(e2) {
|
|
1818
1828
|
return Ie(e2, 0);
|
|
1819
1829
|
}
|
|
1820
1830
|
function Ie(e2, t2 = 0) {
|
|
1821
|
-
const s2 =
|
|
1831
|
+
const s2 = Se[t2], n2 = s2 ? function(e3) {
|
|
1822
1832
|
const t3 = Fe.getOrCompute(e3, () => new RegExp(`(?:^|[\\s${ke}])(?:${e3.source})(?=[\\s${ke}]|$)`, "g")), s3 = Ee(t3, (e4) => {
|
|
1823
1833
|
const t4 = e4[0][1], s4 = e4[1] || e4[2] || e4[3] || e4[4] || e4[5] || e4[6];
|
|
1824
|
-
return [" ", { type: xe[
|
|
1834
|
+
return [" ", { type: xe[Te[t4]], children: [s4] }];
|
|
1825
1835
|
});
|
|
1826
1836
|
return (e4) => {
|
|
1827
1837
|
const [t4, ...n3] = s3(" " + e4);
|
|
@@ -1857,7 +1867,7 @@ function Me(e2, t2) {
|
|
|
1857
1867
|
function Re(e2) {
|
|
1858
1868
|
throw new Error("Unhandled case for value: '" + e2 + "'");
|
|
1859
1869
|
}
|
|
1860
|
-
var
|
|
1870
|
+
var Ne = function() {
|
|
1861
1871
|
function e2(e3) {
|
|
1862
1872
|
void 0 === e3 && (e3 = {}), this.tagName = "", this.attrs = {}, this.innerHTML = "", this.whitespaceRegex = /\s+/, this.tagName = e3.tagName || "", this.attrs = e3.attrs || {}, this.innerHTML = e3.innerHtml || e3.innerHTML || "";
|
|
1863
1873
|
}
|
|
@@ -1906,12 +1916,12 @@ var _e = function() {
|
|
|
1906
1916
|
return t2.join(" ");
|
|
1907
1917
|
}, e2;
|
|
1908
1918
|
}();
|
|
1909
|
-
var
|
|
1919
|
+
var _e = function() {
|
|
1910
1920
|
function e2(e3) {
|
|
1911
1921
|
void 0 === e3 && (e3 = {}), this.newWindow = false, this.truncate = {}, this.className = "", this.newWindow = e3.newWindow || false, this.truncate = e3.truncate || {}, this.className = e3.className || "";
|
|
1912
1922
|
}
|
|
1913
1923
|
return e2.prototype.build = function(e3) {
|
|
1914
|
-
return new
|
|
1924
|
+
return new Ne({ tagName: "a", attrs: this.createAttrs(e3), innerHtml: this.processAnchorText(e3.getAnchorText()) });
|
|
1915
1925
|
}, e2.prototype.createAttrs = function(e3) {
|
|
1916
1926
|
var t2 = { href: e3.getAnchorHref() }, s2 = this.createCssClass(e3);
|
|
1917
1927
|
return s2 && (t2.class = s2), this.newWindow && (t2.target = "_blank", t2.rel = "noopener noreferrer"), this.truncate && this.truncate.length && this.truncate.length < e3.getAnchorText().length && (t2.title = e3.getAnchorHref()), t2;
|
|
@@ -1981,7 +1991,7 @@ var Oe = function() {
|
|
|
1981
1991
|
}(e4, t3, s3);
|
|
1982
1992
|
}(e3, s2);
|
|
1983
1993
|
}, e2;
|
|
1984
|
-
}(),
|
|
1994
|
+
}(), Pe = function() {
|
|
1985
1995
|
function e2(e3) {
|
|
1986
1996
|
this.__jsduckDummyDocProp = null, this.matchedText = "", this.offset = 0, this.tagBuilder = e3.tagBuilder, this.matchedText = e3.matchedText, this.offset = e3.offset;
|
|
1987
1997
|
}
|
|
@@ -1996,18 +2006,18 @@ var Oe = function() {
|
|
|
1996
2006
|
}, e2.prototype.buildTag = function() {
|
|
1997
2007
|
return this.tagBuilder.build(this);
|
|
1998
2008
|
}, e2;
|
|
1999
|
-
}(),
|
|
2000
|
-
return
|
|
2009
|
+
}(), Oe = function(e2, t2) {
|
|
2010
|
+
return Oe = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e3, t3) {
|
|
2001
2011
|
e3.__proto__ = t3;
|
|
2002
2012
|
} || function(e3, t3) {
|
|
2003
2013
|
for (var s2 in t3) t3.hasOwnProperty(s2) && (e3[s2] = t3[s2]);
|
|
2004
|
-
},
|
|
2014
|
+
}, Oe(e2, t2);
|
|
2005
2015
|
};
|
|
2006
2016
|
function Ue(e2, t2) {
|
|
2007
2017
|
function s2() {
|
|
2008
2018
|
this.constructor = e2;
|
|
2009
2019
|
}
|
|
2010
|
-
|
|
2020
|
+
Oe(e2, t2), e2.prototype = null === t2 ? Object.create(t2) : (s2.prototype = t2.prototype, new s2());
|
|
2011
2021
|
}
|
|
2012
2022
|
var je, $e = function() {
|
|
2013
2023
|
return $e = Object.assign || function(e2) {
|
|
@@ -2028,7 +2038,7 @@ var je, $e = function() {
|
|
|
2028
2038
|
}, t2.prototype.getAnchorText = function() {
|
|
2029
2039
|
return this.email;
|
|
2030
2040
|
}, t2;
|
|
2031
|
-
}(
|
|
2041
|
+
}(Pe), qe = function(e2) {
|
|
2032
2042
|
function t2(t3) {
|
|
2033
2043
|
var s2 = e2.call(this, t3) || this;
|
|
2034
2044
|
return s2.serviceName = "", s2.hashtag = "", s2.serviceName = t3.serviceName, s2.hashtag = t3.hashtag, s2;
|
|
@@ -2054,7 +2064,7 @@ var je, $e = function() {
|
|
|
2054
2064
|
}, t2.prototype.getAnchorText = function() {
|
|
2055
2065
|
return "#" + this.hashtag;
|
|
2056
2066
|
}, t2;
|
|
2057
|
-
}(
|
|
2067
|
+
}(Pe), He = function(e2) {
|
|
2058
2068
|
function t2(t3) {
|
|
2059
2069
|
var s2 = e2.call(this, t3) || this;
|
|
2060
2070
|
return s2.serviceName = "twitter", s2.mention = "", s2.mention = t3.mention, s2.serviceName = t3.serviceName, s2;
|
|
@@ -2082,7 +2092,7 @@ var je, $e = function() {
|
|
|
2082
2092
|
var t3 = e2.prototype.getCssClassSuffixes.call(this), s2 = this.getServiceName();
|
|
2083
2093
|
return s2 && t3.push(s2), t3;
|
|
2084
2094
|
}, t2;
|
|
2085
|
-
}(
|
|
2095
|
+
}(Pe), Ge = function(e2) {
|
|
2086
2096
|
function t2(t3) {
|
|
2087
2097
|
var s2 = e2.call(this, t3) || this;
|
|
2088
2098
|
return s2.number = "", s2.plusSign = false, s2.number = t3.number, s2.plusSign = t3.plusSign, s2;
|
|
@@ -2098,7 +2108,7 @@ var je, $e = function() {
|
|
|
2098
2108
|
}, t2.prototype.getAnchorText = function() {
|
|
2099
2109
|
return this.matchedText;
|
|
2100
2110
|
}, t2;
|
|
2101
|
-
}(
|
|
2111
|
+
}(Pe), Le = function(e2) {
|
|
2102
2112
|
function t2(t3) {
|
|
2103
2113
|
var s2 = e2.call(this, t3) || this;
|
|
2104
2114
|
return s2.url = "", s2.urlMatchType = "scheme", s2.protocolUrlMatch = false, s2.protocolRelativeMatch = false, s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.schemePrefixRegex = /^(https?:\/\/)?/i, s2.wwwPrefixRegex = /^(https?:\/\/)?(www\.)?/i, s2.protocolRelativeRegex = /^\/\//, s2.protocolPrepended = false, s2.urlMatchType = t3.urlMatchType, s2.url = t3.url, s2.protocolUrlMatch = t3.protocolUrlMatch, s2.protocolRelativeMatch = t3.protocolRelativeMatch, s2.stripPrefix = t3.stripPrefix, s2.stripTrailingSlash = t3.stripTrailingSlash, s2.decodePercentEncoding = t3.decodePercentEncoding, s2;
|
|
@@ -2131,9 +2141,9 @@ var je, $e = function() {
|
|
|
2131
2141
|
return t3;
|
|
2132
2142
|
}
|
|
2133
2143
|
}, t2;
|
|
2134
|
-
}(
|
|
2144
|
+
}(Pe), ze = function(e2) {
|
|
2135
2145
|
this.__jsduckDummyDocProp = null, this.tagBuilder = e2.tagBuilder;
|
|
2136
|
-
}, Je = /[A-Za-z]/, Ye = /[\d]/, Qe = /[\D]/,
|
|
2146
|
+
}, Je = /[A-Za-z]/, Ye = /[\d]/, Qe = /[\D]/, Ve = /\s/, Ze = /['"]/, Ke = /[\x00-\x1F\x7F]/, Xe = /A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source, et = Xe + /\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source + /\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source, tt = /0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source, st = et + tt, nt = et + tt, rt = "(?:[" + tt + "]{1,3}\\.){3}[" + tt + "]{1,3}", it = "[" + nt + "](?:[" + nt + "\\-]{0,61}[" + nt + "])?", at = function(e2) {
|
|
2137
2147
|
return "(?=(" + it + "))\\" + e2;
|
|
2138
2148
|
}, ot = function(e2) {
|
|
2139
2149
|
return "(?:" + at(e2) + "(?:\\." + at(e2 + 1) + "){0,126}|" + rt + ")";
|
|
@@ -2156,10 +2166,10 @@ var je, $e = function() {
|
|
|
2156
2166
|
f2(h2);
|
|
2157
2167
|
break;
|
|
2158
2168
|
case 3:
|
|
2159
|
-
|
|
2169
|
+
g2(h2);
|
|
2160
2170
|
break;
|
|
2161
2171
|
case 4:
|
|
2162
|
-
|
|
2172
|
+
m2(h2);
|
|
2163
2173
|
break;
|
|
2164
2174
|
case 5:
|
|
2165
2175
|
v2(h2);
|
|
@@ -2168,7 +2178,7 @@ var je, $e = function() {
|
|
|
2168
2178
|
b2(h2);
|
|
2169
2179
|
break;
|
|
2170
2180
|
case 7:
|
|
2171
|
-
|
|
2181
|
+
w2(h2);
|
|
2172
2182
|
break;
|
|
2173
2183
|
default:
|
|
2174
2184
|
Re(c2);
|
|
@@ -2177,7 +2187,7 @@ var je, $e = function() {
|
|
|
2177
2187
|
}
|
|
2178
2188
|
return C2(), r2;
|
|
2179
2189
|
function d2(e4) {
|
|
2180
|
-
"m" === e4 ?
|
|
2190
|
+
"m" === e4 ? y2(1) : s2.test(e4) && y2();
|
|
2181
2191
|
}
|
|
2182
2192
|
function p2(e4, t4) {
|
|
2183
2193
|
":" === e4 ? s2.test(t4) ? (c2 = 2, l2 = new pt($e($e({}, l2), { hasMailtoPrefix: true }))) : A2() : o2[e4] === t4 || (s2.test(t4) ? c2 = 2 : "." === t4 ? c2 = 3 : "@" === t4 ? c2 = 4 : A2());
|
|
@@ -2185,10 +2195,10 @@ var je, $e = function() {
|
|
|
2185
2195
|
function f2(e4) {
|
|
2186
2196
|
"." === e4 ? c2 = 3 : "@" === e4 ? c2 = 4 : s2.test(e4) || A2();
|
|
2187
2197
|
}
|
|
2188
|
-
function
|
|
2198
|
+
function g2(e4) {
|
|
2189
2199
|
"." === e4 || "@" === e4 ? A2() : s2.test(e4) ? c2 = 2 : A2();
|
|
2190
2200
|
}
|
|
2191
|
-
function
|
|
2201
|
+
function m2(e4) {
|
|
2192
2202
|
ut.test(e4) ? c2 = 5 : A2();
|
|
2193
2203
|
}
|
|
2194
2204
|
function v2(e4) {
|
|
@@ -2197,10 +2207,10 @@ var je, $e = function() {
|
|
|
2197
2207
|
function b2(e4) {
|
|
2198
2208
|
"-" === e4 || "." === e4 ? C2() : ut.test(e4) ? c2 = 5 : C2();
|
|
2199
2209
|
}
|
|
2200
|
-
function
|
|
2210
|
+
function w2(e4) {
|
|
2201
2211
|
"." === e4 || "-" === e4 ? C2() : ut.test(e4) ? (c2 = 5, l2 = new pt($e($e({}, l2), { hasDomainDot: true }))) : C2();
|
|
2202
2212
|
}
|
|
2203
|
-
function
|
|
2213
|
+
function y2(e4) {
|
|
2204
2214
|
void 0 === e4 && (e4 = 2), c2 = e4, l2 = new pt({ idx: u2 });
|
|
2205
2215
|
}
|
|
2206
2216
|
function A2() {
|
|
@@ -2240,21 +2250,21 @@ var je, $e = function() {
|
|
|
2240
2250
|
}, e2.urlMatchDoesNotHaveAtLeastOneWordChar = function(e3, t2) {
|
|
2241
2251
|
return !(!e3 || !t2) && (!this.hasFullProtocolRegex.test(t2) && !this.hasWordCharAfterProtocolRegex.test(e3));
|
|
2242
2252
|
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" + Xe + "]"), e2.ipRegex = /[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/, e2;
|
|
2243
|
-
}(),
|
|
2253
|
+
}(), gt = (je = new RegExp("[/?#](?:[" + nt + "\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*[" + nt + "\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"), new RegExp(["(?:", "(", /(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source, ot(2), ")", "|", "(", "(//)?", /(?:www\.)/.source, ot(6), ")", "|", "(", "(//)?", ot(10) + "\\.", ct.source, "(?![-" + st + "])", ")", ")", "(?::[0-9]+)?", "(?:" + je.source + ")?"].join(""), "gi")), mt = new RegExp("[" + nt + "]"), vt = function(e2) {
|
|
2244
2254
|
function t2(t3) {
|
|
2245
2255
|
var s2 = e2.call(this, t3) || this;
|
|
2246
|
-
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex =
|
|
2256
|
+
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex = gt, s2.wordCharRegExp = mt, s2.stripPrefix = t3.stripPrefix, s2.stripTrailingSlash = t3.stripTrailingSlash, s2.decodePercentEncoding = t3.decodePercentEncoding, s2;
|
|
2247
2257
|
}
|
|
2248
2258
|
return Ue(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2249
2259
|
for (var t3, s2 = this.matcherRegex, n2 = this.stripPrefix, r2 = this.stripTrailingSlash, i2 = this.decodePercentEncoding, a2 = this.tagBuilder, o2 = [], u2 = function() {
|
|
2250
|
-
var s3 = t3[0], u3 = t3[1], l2 = t3[4], h2 = t3[5], d2 = t3[9], p2 = t3.index, f2 = h2 || d2,
|
|
2260
|
+
var s3 = t3[0], u3 = t3[1], l2 = t3[4], h2 = t3[5], d2 = t3[9], p2 = t3.index, f2 = h2 || d2, g2 = e3.charAt(p2 - 1);
|
|
2251
2261
|
if (!ft.isValid(s3, u3)) return "continue";
|
|
2252
|
-
if (p2 > 0 && "@" ===
|
|
2253
|
-
if (p2 > 0 && f2 && c2.wordCharRegExp.test(
|
|
2262
|
+
if (p2 > 0 && "@" === g2) return "continue";
|
|
2263
|
+
if (p2 > 0 && f2 && c2.wordCharRegExp.test(g2)) return "continue";
|
|
2254
2264
|
if (/\?$/.test(s3) && (s3 = s3.substr(0, s3.length - 1)), c2.matchHasUnbalancedClosingParen(s3)) s3 = s3.substr(0, s3.length - 1);
|
|
2255
2265
|
else {
|
|
2256
|
-
var
|
|
2257
|
-
|
|
2266
|
+
var m2 = c2.matchHasInvalidCharAfterTld(s3, u3);
|
|
2267
|
+
m2 > -1 && (s3 = s3.substr(0, m2));
|
|
2258
2268
|
}
|
|
2259
2269
|
var v2 = ["http://", "https://"].find(function(e4) {
|
|
2260
2270
|
return !!u3 && -1 !== u3.indexOf(e4);
|
|
@@ -2263,8 +2273,8 @@ var je, $e = function() {
|
|
|
2263
2273
|
var b2 = s3.indexOf(v2);
|
|
2264
2274
|
s3 = s3.substr(b2), u3 = u3.substr(b2), p2 += b2;
|
|
2265
2275
|
}
|
|
2266
|
-
var
|
|
2267
|
-
o2.push(new
|
|
2276
|
+
var w2 = u3 ? "scheme" : l2 ? "www" : "tld", y2 = !!u3;
|
|
2277
|
+
o2.push(new Le({ tagBuilder: a2, matchedText: s3, offset: p2, urlMatchType: w2, url: s3, protocolUrlMatch: y2, protocolRelativeMatch: !!f2, stripPrefix: n2, stripTrailingSlash: r2, decodePercentEncoding: i2 }));
|
|
2268
2278
|
}, c2 = this; null !== (t3 = s2.exec(e3)); ) u2();
|
|
2269
2279
|
return o2;
|
|
2270
2280
|
}, t2.prototype.matchHasUnbalancedClosingParen = function(e3) {
|
|
@@ -2287,10 +2297,10 @@ var je, $e = function() {
|
|
|
2287
2297
|
var n2 = new RegExp("^((.?//)?[-." + nt + "]*[-" + nt + "]\\.[-" + nt + "]+)").exec(e3);
|
|
2288
2298
|
return null === n2 ? -1 : (s2 += n2[1].length, e3 = e3.slice(n2[1].length), /^[^-.A-Za-z0-9:\/?#]/.test(e3) ? s2 : -1);
|
|
2289
2299
|
}, t2;
|
|
2290
|
-
}(ze), bt = new RegExp("#[_" + nt + "]{1,139}(?![_" + nt + "])", "g"),
|
|
2300
|
+
}(ze), bt = new RegExp("#[_" + nt + "]{1,139}(?![_" + nt + "])", "g"), wt = new RegExp("[^" + nt + "]"), yt = function(e2) {
|
|
2291
2301
|
function t2(t3) {
|
|
2292
2302
|
var s2 = e2.call(this, t3) || this;
|
|
2293
|
-
return s2.serviceName = "twitter", s2.matcherRegex = bt, s2.nonWordCharRegex =
|
|
2303
|
+
return s2.serviceName = "twitter", s2.matcherRegex = bt, s2.nonWordCharRegex = wt, s2.serviceName = t3.serviceName, s2;
|
|
2294
2304
|
}
|
|
2295
2305
|
return Ue(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2296
2306
|
for (var t3, s2 = this.matcherRegex, n2 = this.nonWordCharRegex, r2 = this.serviceName, i2 = this.tagBuilder, a2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
@@ -2310,16 +2320,16 @@ var je, $e = function() {
|
|
|
2310
2320
|
return Ue(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2311
2321
|
for (var t3, s2 = this.matcherRegex, n2 = this.tagBuilder, r2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
2312
2322
|
var i2 = t3[0], a2 = i2.replace(/[^0-9,;#]/g, ""), o2 = !(!t3[1] && !t3[2]), u2 = 0 == t3.index ? "" : e3.substr(t3.index - 1, 1), c2 = e3.substr(t3.index + i2.length, 1), l2 = !u2.match(/\d/) && !c2.match(/\d/);
|
|
2313
|
-
this.testMatch(t3[3]) && this.testMatch(i2) && l2 && r2.push(new
|
|
2323
|
+
this.testMatch(t3[3]) && this.testMatch(i2) && l2 && r2.push(new Ge({ tagBuilder: n2, matchedText: i2, offset: t3.index, number: a2, plusSign: o2 }));
|
|
2314
2324
|
}
|
|
2315
2325
|
return r2;
|
|
2316
2326
|
}, t2.prototype.testMatch = function(e3) {
|
|
2317
2327
|
return Qe.test(e3);
|
|
2318
2328
|
}, t2;
|
|
2319
|
-
}(ze), Et = new RegExp("@[_" + nt + "]{1,50}(?![_" + nt + "])", "g"), kt = new RegExp("@[_." + nt + "]{1,30}(?![_" + nt + "])", "g"), xt = new RegExp("@[-_." + nt + "]{1,50}(?![-_" + nt + "])", "g"),
|
|
2329
|
+
}(ze), Et = new RegExp("@[_" + nt + "]{1,50}(?![_" + nt + "])", "g"), kt = new RegExp("@[_." + nt + "]{1,30}(?![_" + nt + "])", "g"), xt = new RegExp("@[-_." + nt + "]{1,50}(?![-_" + nt + "])", "g"), St = new RegExp("[^" + nt + "]"), Tt = function(e2) {
|
|
2320
2330
|
function t2(t3) {
|
|
2321
2331
|
var s2 = e2.call(this, t3) || this;
|
|
2322
|
-
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter: Et, instagram: kt, soundcloud: xt }, s2.nonWordCharRegex =
|
|
2332
|
+
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter: Et, instagram: kt, soundcloud: xt }, s2.nonWordCharRegex = St, s2.serviceName = t3.serviceName, s2;
|
|
2323
2333
|
}
|
|
2324
2334
|
return Ue(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2325
2335
|
var t3, s2 = this.serviceName, n2 = this.matcherRegexes[this.serviceName], r2 = this.nonWordCharRegex, i2 = this.tagBuilder, a2 = [];
|
|
@@ -2339,10 +2349,10 @@ function Dt(e2, t2) {
|
|
|
2339
2349
|
var f2 = e2.charAt(c2);
|
|
2340
2350
|
switch (h2) {
|
|
2341
2351
|
case 0:
|
|
2342
|
-
|
|
2352
|
+
g2(f2);
|
|
2343
2353
|
break;
|
|
2344
2354
|
case 1:
|
|
2345
|
-
|
|
2355
|
+
m2(f2);
|
|
2346
2356
|
break;
|
|
2347
2357
|
case 2:
|
|
2348
2358
|
b2(f2);
|
|
@@ -2351,10 +2361,10 @@ function Dt(e2, t2) {
|
|
|
2351
2361
|
v2(f2);
|
|
2352
2362
|
break;
|
|
2353
2363
|
case 4:
|
|
2354
|
-
|
|
2364
|
+
w2(f2);
|
|
2355
2365
|
break;
|
|
2356
2366
|
case 5:
|
|
2357
|
-
|
|
2367
|
+
y2(f2);
|
|
2358
2368
|
break;
|
|
2359
2369
|
case 6:
|
|
2360
2370
|
A2(f2);
|
|
@@ -2372,10 +2382,10 @@ function Dt(e2, t2) {
|
|
|
2372
2382
|
x2(f2);
|
|
2373
2383
|
break;
|
|
2374
2384
|
case 11:
|
|
2375
|
-
|
|
2385
|
+
S2(f2);
|
|
2376
2386
|
break;
|
|
2377
2387
|
case 12:
|
|
2378
|
-
|
|
2388
|
+
T2(f2);
|
|
2379
2389
|
break;
|
|
2380
2390
|
case 13:
|
|
2381
2391
|
D2();
|
|
@@ -2396,39 +2406,39 @@ function Dt(e2, t2) {
|
|
|
2396
2406
|
R2(f2);
|
|
2397
2407
|
break;
|
|
2398
2408
|
case 19:
|
|
2399
|
-
|
|
2409
|
+
N2(f2);
|
|
2400
2410
|
break;
|
|
2401
2411
|
case 20:
|
|
2402
|
-
|
|
2412
|
+
_2(f2);
|
|
2403
2413
|
break;
|
|
2404
2414
|
default:
|
|
2405
2415
|
Re(h2);
|
|
2406
2416
|
}
|
|
2407
2417
|
c2++;
|
|
2408
2418
|
}
|
|
2409
|
-
function m2(e3) {
|
|
2410
|
-
"<" === e3 && P2();
|
|
2411
|
-
}
|
|
2412
2419
|
function g2(e3) {
|
|
2413
|
-
"
|
|
2420
|
+
"<" === e3 && O2();
|
|
2421
|
+
}
|
|
2422
|
+
function m2(e3) {
|
|
2423
|
+
"!" === e3 ? h2 = 13 : "/" === e3 ? (h2 = 2, p2 = new It($e($e({}, p2), { isClosing: true }))) : "<" === e3 ? O2() : Je.test(e3) ? (h2 = 3, p2 = new It($e($e({}, p2), { isOpening: true }))) : (h2 = 0, p2 = u2);
|
|
2414
2424
|
}
|
|
2415
2425
|
function v2(e3) {
|
|
2416
|
-
|
|
2426
|
+
Ve.test(e3) ? (p2 = new It($e($e({}, p2), { name: j2() })), h2 = 4) : "<" === e3 ? O2() : "/" === e3 ? (p2 = new It($e($e({}, p2), { name: j2() })), h2 = 12) : ">" === e3 ? (p2 = new It($e($e({}, p2), { name: j2() })), U2()) : Je.test(e3) || Ye.test(e3) || ":" === e3 || P2();
|
|
2417
2427
|
}
|
|
2418
2428
|
function b2(e3) {
|
|
2419
|
-
">" === e3 ?
|
|
2420
|
-
}
|
|
2421
|
-
function y2(e3) {
|
|
2422
|
-
Ke.test(e3) || ("/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? P2() : "=" === e3 || Ve.test(e3) || Ze.test(e3) ? N2() : h2 = 5);
|
|
2429
|
+
">" === e3 ? P2() : Je.test(e3) ? h2 = 3 : P2();
|
|
2423
2430
|
}
|
|
2424
2431
|
function w2(e3) {
|
|
2425
|
-
|
|
2432
|
+
Ve.test(e3) || ("/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? O2() : "=" === e3 || Ze.test(e3) || Ke.test(e3) ? P2() : h2 = 5);
|
|
2433
|
+
}
|
|
2434
|
+
function y2(e3) {
|
|
2435
|
+
Ve.test(e3) ? h2 = 6 : "/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? U2() : "<" === e3 ? O2() : Ze.test(e3) && P2();
|
|
2426
2436
|
}
|
|
2427
2437
|
function A2(e3) {
|
|
2428
|
-
|
|
2438
|
+
Ve.test(e3) || ("/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? U2() : "<" === e3 ? O2() : Ze.test(e3) ? P2() : h2 = 5);
|
|
2429
2439
|
}
|
|
2430
2440
|
function C2(e3) {
|
|
2431
|
-
|
|
2441
|
+
Ve.test(e3) || ('"' === e3 ? h2 = 8 : "'" === e3 ? h2 = 9 : /[>=`]/.test(e3) ? P2() : "<" === e3 ? O2() : h2 = 10);
|
|
2432
2442
|
}
|
|
2433
2443
|
function E2(e3) {
|
|
2434
2444
|
'"' === e3 && (h2 = 11);
|
|
@@ -2437,22 +2447,22 @@ function Dt(e2, t2) {
|
|
|
2437
2447
|
"'" === e3 && (h2 = 11);
|
|
2438
2448
|
}
|
|
2439
2449
|
function x2(e3) {
|
|
2440
|
-
|
|
2441
|
-
}
|
|
2442
|
-
function T2(e3) {
|
|
2443
|
-
Ke.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? P2() : (h2 = 4, c2--);
|
|
2450
|
+
Ve.test(e3) ? h2 = 4 : ">" === e3 ? U2() : "<" === e3 && O2();
|
|
2444
2451
|
}
|
|
2445
2452
|
function S2(e3) {
|
|
2453
|
+
Ve.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? O2() : (h2 = 4, c2--);
|
|
2454
|
+
}
|
|
2455
|
+
function T2(e3) {
|
|
2446
2456
|
">" === e3 ? (p2 = new It($e($e({}, p2), { isClosing: true })), U2()) : h2 = 4;
|
|
2447
2457
|
}
|
|
2448
2458
|
function D2(t3) {
|
|
2449
|
-
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new It($e($e({}, p2), { type: "comment" })), h2 = 14) : "DOCTYPE" === e2.substr(c2, 7).toUpperCase() ? (c2 += 7, p2 = new It($e($e({}, p2), { type: "doctype" })), h2 = 20) :
|
|
2459
|
+
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new It($e($e({}, p2), { type: "comment" })), h2 = 14) : "DOCTYPE" === e2.substr(c2, 7).toUpperCase() ? (c2 += 7, p2 = new It($e($e({}, p2), { type: "doctype" })), h2 = 20) : P2();
|
|
2450
2460
|
}
|
|
2451
2461
|
function I2(e3) {
|
|
2452
|
-
"-" === e3 ? h2 = 15 : ">" === e3 ?
|
|
2462
|
+
"-" === e3 ? h2 = 15 : ">" === e3 ? P2() : h2 = 16;
|
|
2453
2463
|
}
|
|
2454
2464
|
function F2(e3) {
|
|
2455
|
-
"-" === e3 ? h2 = 18 : ">" === e3 ?
|
|
2465
|
+
"-" === e3 ? h2 = 18 : ">" === e3 ? P2() : h2 = 16;
|
|
2456
2466
|
}
|
|
2457
2467
|
function B2(e3) {
|
|
2458
2468
|
"-" === e3 && (h2 = 17);
|
|
@@ -2463,21 +2473,21 @@ function Dt(e2, t2) {
|
|
|
2463
2473
|
function R2(e3) {
|
|
2464
2474
|
">" === e3 ? U2() : "!" === e3 ? h2 = 19 : "-" === e3 || (h2 = 16);
|
|
2465
2475
|
}
|
|
2466
|
-
function
|
|
2476
|
+
function N2(e3) {
|
|
2467
2477
|
"-" === e3 ? h2 = 17 : ">" === e3 ? U2() : h2 = 16;
|
|
2468
2478
|
}
|
|
2469
|
-
function
|
|
2470
|
-
">" === e3 ? U2() : "<" === e3 &&
|
|
2479
|
+
function _2(e3) {
|
|
2480
|
+
">" === e3 ? U2() : "<" === e3 && O2();
|
|
2471
2481
|
}
|
|
2472
|
-
function
|
|
2482
|
+
function P2() {
|
|
2473
2483
|
h2 = 0, p2 = u2;
|
|
2474
2484
|
}
|
|
2475
|
-
function
|
|
2485
|
+
function O2() {
|
|
2476
2486
|
h2 = 1, p2 = new It({ idx: c2 });
|
|
2477
2487
|
}
|
|
2478
2488
|
function U2() {
|
|
2479
2489
|
var t3 = e2.slice(d2, p2.idx);
|
|
2480
|
-
t3 && i2(t3, d2), "comment" === p2.type ? a2(p2.idx) : "doctype" === p2.type ? o2(p2.idx) : (p2.isOpening && n2(p2.name, p2.idx), p2.isClosing && r2(p2.name, p2.idx)),
|
|
2490
|
+
t3 && i2(t3, d2), "comment" === p2.type ? a2(p2.idx) : "doctype" === p2.type ? o2(p2.idx) : (p2.isOpening && n2(p2.name, p2.idx), p2.isClosing && r2(p2.name, p2.idx)), P2(), d2 = c2 + 1;
|
|
2481
2491
|
}
|
|
2482
2492
|
function j2() {
|
|
2483
2493
|
var t3 = p2.idx + (p2.isClosing ? 2 : 1);
|
|
@@ -2582,15 +2592,15 @@ var It = function(e2) {
|
|
|
2582
2592
|
return s2.push(e3.substring(n2)), s2.join("");
|
|
2583
2593
|
}, e2.prototype.createMatchReturnVal = function(e3) {
|
|
2584
2594
|
var t2;
|
|
2585
|
-
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof
|
|
2595
|
+
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof Ne ? t2.toAnchorString() : e3.buildTag().toAnchorString();
|
|
2586
2596
|
}, e2.prototype.getMatchers = function() {
|
|
2587
2597
|
if (this.matchers) return this.matchers;
|
|
2588
|
-
var e3 = this.getTagBuilder(), t2 = [new
|
|
2598
|
+
var e3 = this.getTagBuilder(), t2 = [new yt({ tagBuilder: e3, serviceName: this.hashtag }), new dt({ tagBuilder: e3 }), new Ct({ tagBuilder: e3 }), new Tt({ tagBuilder: e3, serviceName: this.mention }), new vt({ tagBuilder: e3, stripPrefix: this.stripPrefix, stripTrailingSlash: this.stripTrailingSlash, decodePercentEncoding: this.decodePercentEncoding })];
|
|
2589
2599
|
return this.matchers = t2;
|
|
2590
2600
|
}, e2.prototype.getTagBuilder = function() {
|
|
2591
2601
|
var e3 = this.tagBuilder;
|
|
2592
|
-
return e3 || (e3 = this.tagBuilder = new
|
|
2593
|
-
}, e2.version = "3.14.3", e2.AnchorTagBuilder =
|
|
2602
|
+
return e3 || (e3 = this.tagBuilder = new _e({ newWindow: this.newWindow, truncate: this.truncate, className: this.className })), e3;
|
|
2603
|
+
}, e2.version = "3.14.3", e2.AnchorTagBuilder = _e, e2.HtmlTag = Ne, e2.matcher = { Email: dt, Hashtag: yt, Matcher: ze, Mention: Tt, Phone: Ct, Url: vt }, e2.match = { Email: We, Hashtag: qe, Match: Pe, Mention: He, Phone: Ge, Url: Le }, e2;
|
|
2594
2604
|
}();
|
|
2595
2605
|
function Bt(e2, t2 = e2) {
|
|
2596
2606
|
return { type: "autolink", url: e2, text: t2 };
|
|
@@ -2602,20 +2612,20 @@ const Mt = Ee(/<!!mention:([^>\s]*?)\|(.*?)>/gm, ([e2, t2, s2]) => /* @__PURE__
|
|
|
2602
2612
|
return { type: "mention", id: e3, text: t3 };
|
|
2603
2613
|
}(decodeURIComponent(t2), s2)), Rt = Ee(/<!!customemoji:(.*?)>/gm, ([e2, t2]) => /* @__PURE__ */ function(e3) {
|
|
2604
2614
|
return { type: "customemoji", text: e3 };
|
|
2605
|
-
}(t2)),
|
|
2615
|
+
}(t2)), Nt = Ee(/<((?:https?|mailto):.*?)\|(.*?)>/gi, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3 = []) {
|
|
2606
2616
|
return { type: "link", url: e3, children: t3 };
|
|
2607
|
-
}(t2, [s2])),
|
|
2608
|
-
const { action: n2, params: r2 } =
|
|
2617
|
+
}(t2, [s2])), _t = Ee(/<actionlink:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
2618
|
+
const { action: n2, params: r2 } = Ot(t2);
|
|
2609
2619
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
2610
2620
|
return { type: "actionlink", action: e3, params: t3, children: s3 };
|
|
2611
2621
|
}(n2, r2, [s2]);
|
|
2612
|
-
}),
|
|
2613
|
-
const { action: n2, params: r2 } =
|
|
2622
|
+
}), Pt = Ee(/<actionbutton:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
2623
|
+
const { action: n2, params: r2 } = Ot(t2);
|
|
2614
2624
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
2615
2625
|
return { type: "actionbutton", action: e3, params: t3, children: s3 };
|
|
2616
2626
|
}(n2, r2, [s2]);
|
|
2617
2627
|
});
|
|
2618
|
-
function
|
|
2628
|
+
function Ot(e2) {
|
|
2619
2629
|
const t2 = e2.indexOf("?");
|
|
2620
2630
|
if (-1 === t2) return { action: e2, params: {} };
|
|
2621
2631
|
return { action: e2.slice(0, t2), params: Object.fromEntries(new URLSearchParams(e2.slice(t2))) };
|
|
@@ -2626,37 +2636,37 @@ const Ut = Ee(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g, ([e2]) => /* @__PURE__
|
|
|
2626
2636
|
const t2 = /(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;
|
|
2627
2637
|
let s2 = 0;
|
|
2628
2638
|
const n2 = [];
|
|
2629
|
-
for (const r2 of
|
|
2639
|
+
for (const r2 of Z(e2, t2)) {
|
|
2630
2640
|
const t3 = r2[0], i2 = r2[1], a2 = t3.startsWith(i2) ? r2.index : r2.index + 1;
|
|
2631
2641
|
a2 - s2 > 0 && n2.push(e2.substring(s2, a2));
|
|
2632
2642
|
const o2 = Bt("tel:" + i2.replace(/[^0-9+]/g, ""), i2);
|
|
2633
2643
|
n2.push(o2), s2 = a2 + i2.length;
|
|
2634
2644
|
}
|
|
2635
2645
|
return s2 < e2.length && n2.push(e2.substring(s2)), n2;
|
|
2636
|
-
}, Wt = (e2) =>
|
|
2646
|
+
}, Wt = (e2) => Nt(e2).flatMap((e3) => "string" == typeof e3 ? qt(e3) : ["<", ...qt(e3.url), ...qt("|" + e3.children[0] + ">")]), qt = (e2) => {
|
|
2637
2647
|
const t2 = Ft.parse(e2, { urls: true, email: true, phone: false, hashtag: false, mention: false }), s2 = [];
|
|
2638
2648
|
let n2 = 0;
|
|
2639
2649
|
for (const r2 of t2) {
|
|
2640
2650
|
const t3 = r2.getOffset(), i2 = r2.getMatchedText(), a2 = i2.length;
|
|
2641
2651
|
let o2 = i2;
|
|
2642
|
-
r2 instanceof We ? o2 = "mailto:" + r2.getEmail() : r2 instanceof
|
|
2652
|
+
r2 instanceof We ? o2 = "mailto:" + r2.getEmail() : r2 instanceof Le && (o2 = r2.getUrl()), t3 > n2 && s2.push(e2.substring(n2, t3)), s2.push(Bt(o2, i2)), n2 = t3 + a2;
|
|
2643
2653
|
}
|
|
2644
2654
|
return n2 < e2.length && s2.push(e2.substring(n2)), s2;
|
|
2645
2655
|
}, Ht = ["Codeblock", "Codespan", "FormattedLink", "Wikitext", "Autolink", "Actions", "Mention", "Mention", "BulletPoint", "CustomEmoji"];
|
|
2646
|
-
function
|
|
2656
|
+
function Gt(e2 = { except: [] }) {
|
|
2647
2657
|
var _a2;
|
|
2648
2658
|
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 : Ht.filter((t3) => !e2.only.includes(t3));
|
|
2649
|
-
return s2.includes("BulletPoint") || t2.multilineSteps.push(Ut, jt), s2.includes("Mention") || t2.singlelineSteps.push(Mt), s2.includes("CustomEmoji") || t2.singlelineSteps.push(Rt), s2.includes("Codespan") || t2.multilineSteps.push(Ee(/```([^]+?)```/g, ([e3, t3]) => ({ type: "codespan", text: t3 }))), s2.includes("FormattedLink") || t2.singlelineSteps.push(
|
|
2659
|
+
return s2.includes("BulletPoint") || t2.multilineSteps.push(Ut, jt), s2.includes("Mention") || t2.singlelineSteps.push(Mt), s2.includes("CustomEmoji") || t2.singlelineSteps.push(Rt), s2.includes("Codespan") || t2.multilineSteps.push(Ee(/```([^]+?)```/g, ([e3, t3]) => ({ type: "codespan", text: t3 }))), s2.includes("FormattedLink") || t2.singlelineSteps.push(Nt), s2.includes("Actions") || (t2.singlelineSteps.push(_t), t2.singlelineSteps.push(Pt)), s2.includes("Wikitext") || t2.singlelineSteps.push(De), s2.includes("Autolink") || t2.singlelineSteps.push(Wt, $t), t2;
|
|
2650
2660
|
}
|
|
2651
|
-
const
|
|
2661
|
+
const Lt = function(e2) {
|
|
2652
2662
|
const t2 = RegExp(`[^${e2}]+${e2}?|${e2}`, "g");
|
|
2653
2663
|
return (e3) => Array.from(e3.match(t2) || []);
|
|
2654
2664
|
}("\n");
|
|
2655
2665
|
function zt(e2, t2 = { except: [] }) {
|
|
2656
2666
|
let s2 = function(e3, t3) {
|
|
2657
2667
|
let s3 = [e3];
|
|
2658
|
-
return s3 = Jt(s3, t3.multilineSteps), s3 = Jt(s3, [
|
|
2659
|
-
}(e2,
|
|
2668
|
+
return s3 = Jt(s3, t3.multilineSteps), s3 = Jt(s3, [Lt]), s3 = Jt(s3, t3.singlelineSteps), s3 = Yt(s3), s3;
|
|
2669
|
+
}(e2, Gt(t2));
|
|
2660
2670
|
return s2 = Qt(s2, false), s2;
|
|
2661
2671
|
}
|
|
2662
2672
|
function Jt(e2, t2) {
|
|
@@ -2677,7 +2687,7 @@ function Qt(e2, t2) {
|
|
|
2677
2687
|
}
|
|
2678
2688
|
return n2.length > 0 && (s2.push(n2.join("")), n2 = []), s2;
|
|
2679
2689
|
}
|
|
2680
|
-
class
|
|
2690
|
+
class Vt {
|
|
2681
2691
|
constructor(e2, t2, s2) {
|
|
2682
2692
|
this.id = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
2683
2693
|
}
|
|
@@ -2698,7 +2708,7 @@ class Kt {
|
|
|
2698
2708
|
}
|
|
2699
2709
|
edit(t2) {
|
|
2700
2710
|
return __async(this, null, function* () {
|
|
2701
|
-
const s2 = { content:
|
|
2711
|
+
const s2 = { content: Zt(t2), custom: "string" == typeof t2 ? void 0 : t2.custom }, n2 = yield this._realtimeClient.call("PATCH", ["conversations", this.brandedConversationId, "messages", this.brandedId], s2);
|
|
2702
2712
|
e(`Edit message ${this.id} in conversation ${this.conversationId}`, n2);
|
|
2703
2713
|
});
|
|
2704
2714
|
}
|
|
@@ -2709,7 +2719,7 @@ class Kt {
|
|
|
2709
2719
|
});
|
|
2710
2720
|
}
|
|
2711
2721
|
}
|
|
2712
|
-
function
|
|
2722
|
+
function Zt(e2) {
|
|
2713
2723
|
if ("string" == typeof e2) {
|
|
2714
2724
|
return [{ type: "text", children: zt(e2) }];
|
|
2715
2725
|
}
|
|
@@ -2718,7 +2728,7 @@ function Vt(e2) {
|
|
|
2718
2728
|
}
|
|
2719
2729
|
if ("content" in e2 && e2.content) return e2.content;
|
|
2720
2730
|
}
|
|
2721
|
-
class
|
|
2731
|
+
class Kt {
|
|
2722
2732
|
constructor(e2, t2) {
|
|
2723
2733
|
this.id = e2, this._realtimeClient = t2;
|
|
2724
2734
|
}
|
|
@@ -2729,10 +2739,10 @@ class Zt {
|
|
|
2729
2739
|
return this._realtimeClient.userId;
|
|
2730
2740
|
}
|
|
2731
2741
|
participant(e2) {
|
|
2732
|
-
return new
|
|
2742
|
+
return new ye("string" == typeof e2 ? e2 : e2.id, this.id, this._realtimeClient);
|
|
2733
2743
|
}
|
|
2734
2744
|
message(e2) {
|
|
2735
|
-
return new
|
|
2745
|
+
return new Vt(e2, this.brandedId, this._realtimeClient);
|
|
2736
2746
|
}
|
|
2737
2747
|
get() {
|
|
2738
2748
|
return __async(this, null, function* () {
|
|
@@ -2782,7 +2792,7 @@ class Zt {
|
|
|
2782
2792
|
send(t2) {
|
|
2783
2793
|
return __async(this, null, function* () {
|
|
2784
2794
|
const s2 = { content: Xt(t2), referencedMessageId: es(t2), custom: "string" == typeof t2 ? void 0 : t2.custom, idempotencyKey: Ae((/* @__PURE__ */ new Date()).getTime()) }, n2 = yield this._realtimeClient.call("POST", ["conversations", this.brandedId, "messages"], s2), r2 = e("Send message to conversation " + this.id, n2);
|
|
2785
|
-
return new
|
|
2795
|
+
return new Vt("string" == typeof r2 ? r2 : r2.id, this.brandedId, this._realtimeClient);
|
|
2786
2796
|
});
|
|
2787
2797
|
}
|
|
2788
2798
|
subscribeMessages(e2) {
|
|
@@ -2821,7 +2831,7 @@ class ts {
|
|
|
2821
2831
|
function ss({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRetry: i2, authProvider: o2 }) {
|
|
2822
2832
|
var _a2;
|
|
2823
2833
|
(!r2 || r2 <= 0) && (r2 = 1);
|
|
2824
|
-
const u2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-04-
|
|
2834
|
+
const u2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-04-30T13:41:48.005Z" };
|
|
2825
2835
|
s2 instanceof FormData || (u2["Content-Type"] = (_a2 = n2 == null ? void 0 : n2.contentType) != null ? _a2 : "application/json");
|
|
2826
2836
|
return a(r2, () => __async(this, null, function* () {
|
|
2827
2837
|
if (o2) {
|
|
@@ -2874,7 +2884,7 @@ const cs = rs.startsWith("app.talkjs.com");
|
|
|
2874
2884
|
const ls = "undefined" == typeof window ? { log: (e2) => Promise.resolve(), setData: (e2) => {
|
|
2875
2885
|
} } : new class {
|
|
2876
2886
|
constructor(e2) {
|
|
2877
|
-
this._timeCreated = Date.now(), this._enabled = cs, this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2025-04-
|
|
2887
|
+
this._timeCreated = Date.now(), this._enabled = cs, this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2025-04-30T13:41:48.005Z" }, entry: "direct", environment: { age: Date.now() - this._timeCreated, dependencies: {}, originalUrl: window.location.href, referrer: document.referrer, userAgent: window.navigator.userAgent }, metadata: [], nav: [], network: [], url: window.location.href, stack: "", timestamp: (/* @__PURE__ */ new Date()).toISOString(), version: "dev-2025-04-30T13:41:48.005Z", throttled: 0 }, this._url = `https://capture.trackjs.com/capture?token=${e2}`, this._trackJSData.customer.token = e2;
|
|
2878
2888
|
}
|
|
2879
2889
|
setData({ appId: e2, meId: t2, sessionId: s2 }) {
|
|
2880
2890
|
this._trackJSData.customer.userId = e2, this._trackJSData.customer.sessionId = `${e2}/${t2}`, this._trackJSData.customer.correlationId = s2;
|
|
@@ -2944,9 +2954,6 @@ class ds {
|
|
|
2944
2954
|
} }), this.sessionExpiryWarningTimeoutId = void 0, i2 && (n2 || r2)) throw new Error("[TalkJS] If providing a signature for authentication, you must not provide a token or tokenFetcher.");
|
|
2945
2955
|
n2 ? this.fetchToken(() => n2) : (r2 || (this.usingBokens = true, this.tokenFetcher = () => this.sendBokenRequest(e2, i2)), this.refreshToken());
|
|
2946
2956
|
}
|
|
2947
|
-
get shouldMountFrontendWithSignature() {
|
|
2948
|
-
return this.usingBokens && this.requestInProgress;
|
|
2949
|
-
}
|
|
2950
2957
|
get canRefreshToken() {
|
|
2951
2958
|
return this.usingBokens || !!this.tokenFetcher;
|
|
2952
2959
|
}
|
|
@@ -3093,7 +3100,7 @@ function ps(e2) {
|
|
|
3093
3100
|
}
|
|
3094
3101
|
}
|
|
3095
3102
|
const fs = new ts("wss://realtime.talkjs.com/v1", "https://app.talkjs.com/api/v0", "https://api.talkjs.com/v1");
|
|
3096
|
-
class
|
|
3103
|
+
class gs {
|
|
3097
3104
|
constructor(e2) {
|
|
3098
3105
|
this.target = e2;
|
|
3099
3106
|
}
|
|
@@ -3101,7 +3108,7 @@ class ms {
|
|
|
3101
3108
|
return this.target;
|
|
3102
3109
|
}
|
|
3103
3110
|
}
|
|
3104
|
-
const
|
|
3111
|
+
const ms = new class {
|
|
3105
3112
|
constructor() {
|
|
3106
3113
|
this.registry = {};
|
|
3107
3114
|
}
|
|
@@ -3109,7 +3116,7 @@ const gs = new class {
|
|
|
3109
3116
|
var _a2;
|
|
3110
3117
|
const t2 = this.key(e2), s2 = (_a2 = this.registry[t2]) == null ? void 0 : _a2.deref();
|
|
3111
3118
|
if (s2) return s2;
|
|
3112
|
-
const n2 = new bs(e2), r2 = globalThis.WeakRef ? new WeakRef(n2) : new
|
|
3119
|
+
const n2 = new bs(e2), r2 = globalThis.WeakRef ? new WeakRef(n2) : new gs(n2);
|
|
3113
3120
|
return this.registry[t2] = r2, n2;
|
|
3114
3121
|
}
|
|
3115
3122
|
deregister(e2, t2) {
|
|
@@ -3121,7 +3128,7 @@ const gs = new class {
|
|
|
3121
3128
|
}
|
|
3122
3129
|
}();
|
|
3123
3130
|
function vs(e2) {
|
|
3124
|
-
return e2.forceCreateNew ? new bs(e2) :
|
|
3131
|
+
return e2.forceCreateNew ? new bs(e2) : ms.getOrCreate(e2);
|
|
3125
3132
|
}
|
|
3126
3133
|
class bs {
|
|
3127
3134
|
constructor(e2) {
|
|
@@ -3133,7 +3140,7 @@ class bs {
|
|
|
3133
3140
|
void 0 !== e3.tokenFetcher && t3("function" == typeof e3.tokenFetcher, "The `tokenFetcher` property of TalkSession#constructor must be a function.");
|
|
3134
3141
|
}(e2);
|
|
3135
3142
|
const { appId: t2, userId: s2, token: n2, tokenFetcher: r2, signature: i2 } = e2;
|
|
3136
|
-
this._appId = t2, this._apiUrls = e2.apiUrls ? new ts(e2.apiUrls.realtimeWsApiUrl, e2.apiUrls.internalHttpApiUrl, e2.apiUrls.restApiHttpUrl) : fs, this._authProvider = new ds(this._apiUrls, t2, s2, n2, r2, i2), this._realtimeClient = new
|
|
3143
|
+
this._appId = t2, this._apiUrls = e2.apiUrls ? new ts(e2.apiUrls.realtimeWsApiUrl, e2.apiUrls.internalHttpApiUrl, e2.apiUrls.restApiHttpUrl) : fs, this._authProvider = new ds(this._apiUrls, t2, s2, n2, r2, i2), this._realtimeClient = new me(this._apiUrls.getRealtimeWsUrl(t2, s2, "1.0.1", e2.clientBuild), s2, this._authProvider), this.currentUser = new we(this._realtimeClient.userId, this._realtimeClient), this._terminationReason = o(), this._terminationReason.promise.then((e3) => {
|
|
3137
3144
|
console.error(`[TalkSession] ${e3}`);
|
|
3138
3145
|
}), function(e3, t3, s3) {
|
|
3139
3146
|
return __async(this, null, function* () {
|
|
@@ -3158,34 +3165,34 @@ class bs {
|
|
|
3158
3165
|
}), { unsubscribe: () => t2.resolve("UNSUBSCRIBED") };
|
|
3159
3166
|
}
|
|
3160
3167
|
user(e2) {
|
|
3161
|
-
return new
|
|
3168
|
+
return new we(e2, this._realtimeClient);
|
|
3162
3169
|
}
|
|
3163
3170
|
conversation(e2) {
|
|
3164
|
-
return new
|
|
3171
|
+
return new Kt(e2, this._realtimeClient);
|
|
3165
3172
|
}
|
|
3166
3173
|
terminate(e2) {
|
|
3167
|
-
|
|
3174
|
+
ms.deregister(this._appId, this.currentUser.id), this._terminationReason.resolve(e2), this._realtimeClient.destroy();
|
|
3168
3175
|
}
|
|
3169
3176
|
_isConnected() {
|
|
3170
3177
|
return this._realtimeClient.isConnected();
|
|
3171
3178
|
}
|
|
3172
3179
|
uploadFile(e2, t2) {
|
|
3173
|
-
return
|
|
3180
|
+
return ws(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, t2);
|
|
3174
3181
|
}
|
|
3175
3182
|
uploadImage(e2, t2) {
|
|
3176
|
-
return
|
|
3183
|
+
return ws(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "image" }, t2));
|
|
3177
3184
|
}
|
|
3178
3185
|
uploadVideo(e2, t2) {
|
|
3179
|
-
return
|
|
3186
|
+
return ws(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "video" }, t2));
|
|
3180
3187
|
}
|
|
3181
3188
|
uploadAudio(e2, t2) {
|
|
3182
|
-
return
|
|
3189
|
+
return ws(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "audio" }, t2));
|
|
3183
3190
|
}
|
|
3184
3191
|
uploadVoice(e2, t2) {
|
|
3185
|
-
return
|
|
3192
|
+
return ws(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "voice" }, t2));
|
|
3186
3193
|
}
|
|
3187
3194
|
}
|
|
3188
|
-
function
|
|
3195
|
+
function ws(_0, _1, _2, _3) {
|
|
3189
3196
|
return __async(this, arguments, function* (e2, t2, s2, { subtype: n2, filename: r2, width: i2, height: a2, duration: o2 }) {
|
|
3190
3197
|
const u2 = new FormData();
|
|
3191
3198
|
return u2.set("file", s2, r2), void 0 !== n2 && u2.set("subtype", n2), void 0 !== i2 && u2.set("width", i2.toString()), void 0 !== a2 && u2.set("height", a2.toString()), void 0 !== o2 && u2.set("duration", o2.toString()), ss({ method: "POST", url: e2, data: u2, authProvider: t2 }).then((e3) => e3.json()).then((e3) => e3.attachmentToken).catch((e3) => __async(this, null, function* () {
|