@talkjs/core 1.1.1 → 1.3.0
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 +15 -5
- package/dist/talkSession.cjs +1 -1
- package/dist/talkSession.d.ts +201 -2
- package/dist/talkSession.js +771 -518
- package/package.json +1 -1
package/dist/talkSession.js
CHANGED
|
@@ -128,7 +128,7 @@ let p = null;
|
|
|
128
128
|
function f({ WebSocket: e2 }) {
|
|
129
129
|
p = e2;
|
|
130
130
|
}
|
|
131
|
-
class
|
|
131
|
+
class m {
|
|
132
132
|
constructor(e2, t2) {
|
|
133
133
|
this.realtimeUrl = e2, this.handlers = t2, this.socket = null, this.stateMachine = new u("ReconnectingSocket", ["STOPPED", "CONNECTING", "READY", "DISCONNECTED", "TERMINATED"], { startWs: { from: ["STOPPED", "DISCONNECTED"], to: "CONNECTING", afterTransition: () => {
|
|
134
134
|
const e3 = new (function() {
|
|
@@ -177,9 +177,9 @@ class g {
|
|
|
177
177
|
this.stateMachine.transition("destroy");
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
class
|
|
180
|
+
class g {
|
|
181
181
|
constructor(e2, t2) {
|
|
182
|
-
this.handlers = t2, this.socket = new
|
|
182
|
+
this.handlers = t2, this.socket = new m(e2, { onOpen: () => this.handlers.onOpen(), onClose: () => this.handlers.onClose(), onMessage: (e3) => this.onWebSocketMessage(e3) });
|
|
183
183
|
}
|
|
184
184
|
call(e2, t2, s2, n2) {
|
|
185
185
|
const r2 = `/${s2.map((e3) => encodeURIComponent(e3)).join("/")}`, i2 = JSON.stringify([e2, t2, r2, n2]);
|
|
@@ -229,7 +229,7 @@ class v {
|
|
|
229
229
|
void 0 !== this.timeout && (clearTimeout(this.timeout), this.timeout = void 0);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
class
|
|
232
|
+
class w {
|
|
233
233
|
constructor() {
|
|
234
234
|
this.i = -1;
|
|
235
235
|
}
|
|
@@ -240,9 +240,9 @@ class b {
|
|
|
240
240
|
this.i = -1;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
class
|
|
243
|
+
class b {
|
|
244
244
|
constructor(e2, t2) {
|
|
245
|
-
this.handlers = t2, this.seqCounter = new
|
|
245
|
+
this.handlers = t2, this.seqCounter = new w(), this.responseHandlers = {}, this.heartbeats = new y(this), this.socket = new g(e2, { onUpstreamRestarting: () => {
|
|
246
246
|
this.heartbeats.serverActive(), this.handlers.onUpstreamRestarting();
|
|
247
247
|
}, onOpen: () => {
|
|
248
248
|
this.heartbeats.clientActive(), this.heartbeats.serverActive(), this.handlers.onReady();
|
|
@@ -285,7 +285,7 @@ class y {
|
|
|
285
285
|
this.socket.terminate();
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
class
|
|
288
|
+
class y {
|
|
289
289
|
constructor(e2) {
|
|
290
290
|
this.connection = e2, this.clientInactivityTimer = new v(25e3), this.serverInactivityTimer = new v(1e4), this.serverTimeoutTimer = new v(5e3);
|
|
291
291
|
}
|
|
@@ -309,7 +309,7 @@ class w {
|
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
class
|
|
312
|
+
class C {
|
|
313
313
|
constructor(e2, t2, s2) {
|
|
314
314
|
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* () {
|
|
315
315
|
yield this.renewSession();
|
|
@@ -327,7 +327,7 @@ class A {
|
|
|
327
327
|
"READY" !== e3 && "RENEWING_SESSION" !== e3 || this.handlers.onNotReady(), this.authProvider.clearScheduledRefresh();
|
|
328
328
|
} }, destroy: { from: "ANY", to: "TERMINATED", afterTransition: () => {
|
|
329
329
|
this.authProvider.clearScheduledRefresh(), this.connection.destroy();
|
|
330
|
-
} } }), this.connection = new
|
|
330
|
+
} } }), this.connection = new b(e2, { onUpstreamRestarting: () => this.handlers.onUpstreamRestarting(), onReady: () => this.stateMachine.transition("logIn"), onNotReady: () => {
|
|
331
331
|
this.stateMachine.transition("wsDisconnected");
|
|
332
332
|
}, onAuthExpired: () => {
|
|
333
333
|
this.stateMachine.transition("authExpired");
|
|
@@ -372,7 +372,7 @@ class A {
|
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
class
|
|
375
|
+
class A {
|
|
376
376
|
constructor(e2, t2, s2) {
|
|
377
377
|
this.handlers = s2, this.stateMachine = new u("StopStartConnection", ["STOPPED", "WAITING_FOR_WS", "READY", "TERMINATED"], { unexpectedDisconnect: { from: ["READY"], to: "WAITING_FOR_WS", afterTransition: () => {
|
|
378
378
|
this.inactivityTimer.stop(), this.handlers.onNotReady();
|
|
@@ -386,7 +386,7 @@ class C {
|
|
|
386
386
|
}), this.handlers.onReady();
|
|
387
387
|
} }, destroy: { from: "ANY", to: "TERMINATED", afterTransition: () => {
|
|
388
388
|
this.inactivityTimer.stop(), this.connection.destroy();
|
|
389
|
-
} } }), this.pendingCalls = 0, this.activeSubscriptions = 0, this.inactivityTimer = new v(3e3), this.connection = new
|
|
389
|
+
} } }), this.pendingCalls = 0, this.activeSubscriptions = 0, this.inactivityTimer = new v(3e3), this.connection = new C(e2, t2, { onUpstreamRestarting: () => {
|
|
390
390
|
this.handlers.onUpstreamRestarting();
|
|
391
391
|
}, onReady: () => {
|
|
392
392
|
this.stateMachine.transition("ready");
|
|
@@ -433,7 +433,7 @@ class E {
|
|
|
433
433
|
e3 == null ? void 0 : e3.clientErr("SESSION_DESTROYED");
|
|
434
434
|
}
|
|
435
435
|
this.connection.destroy();
|
|
436
|
-
} } }), this.subscribeQueue = {}, this.callQueue = [], this.connection = new
|
|
436
|
+
} } }), this.subscribeQueue = {}, this.callQueue = [], this.connection = new A(e2, t2, { onUpstreamRestarting: () => {
|
|
437
437
|
this.handlers.onUpstreamRestarting();
|
|
438
438
|
}, onReady: () => {
|
|
439
439
|
this.stateMachine.transition("processQueue");
|
|
@@ -469,12 +469,14 @@ class E {
|
|
|
469
469
|
}
|
|
470
470
|
sendQueuedCalls() {
|
|
471
471
|
return __async(this, null, function* () {
|
|
472
|
+
let e2 = 0;
|
|
472
473
|
for (; "PROCESSING_QUEUE" === this.stateMachine.state; ) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
474
|
+
e2++;
|
|
475
|
+
const t2 = this.dequeue();
|
|
476
|
+
if (!t2) return void this.stateMachine.transition("ready");
|
|
477
|
+
this.connection.call(t2.method, t2.path, t2.data).then((e3) => {
|
|
478
|
+
t2.deferred.resolve(e3);
|
|
479
|
+
}), e2 > 50 && (yield new Promise((e3) => setTimeout(e3, 100)));
|
|
478
480
|
}
|
|
479
481
|
});
|
|
480
482
|
}
|
|
@@ -494,14 +496,14 @@ class x {
|
|
|
494
496
|
this.sent = true;
|
|
495
497
|
}
|
|
496
498
|
}
|
|
497
|
-
class
|
|
499
|
+
class T extends x {
|
|
498
500
|
constructor(e2, t2) {
|
|
499
501
|
super(t2, () => {
|
|
500
502
|
this.sendSubscribe(), this.sendGet();
|
|
501
503
|
}), this.connection = e2, this.getCalls = [], this.subscribeCalls = [];
|
|
502
504
|
}
|
|
503
505
|
canPush(e2, t2) {
|
|
504
|
-
return
|
|
506
|
+
return T.isCorrectBatchTypeFor(e2, t2);
|
|
505
507
|
}
|
|
506
508
|
static isCorrectBatchTypeFor(e2, t2) {
|
|
507
509
|
return s(t2, ["users", "*"]) && ("GET" === e2 || "SUBSCRIBE" === e2);
|
|
@@ -527,12 +529,12 @@ class S extends x {
|
|
|
527
529
|
this.connection.call("SUBSCRIBE", ["users"], { ids: e2 }).then((e3) => this.subscribeCalls.forEach((t2) => t2.deferred.resolve(e3)));
|
|
528
530
|
}
|
|
529
531
|
}
|
|
530
|
-
class
|
|
532
|
+
class S extends x {
|
|
531
533
|
constructor(e2, t2, s2) {
|
|
532
534
|
super(s2, () => this.sendMutate()), this.conversationId = e2, this.connection = t2, this.calls = [];
|
|
533
535
|
}
|
|
534
536
|
canPush(e2, t2) {
|
|
535
|
-
return !!
|
|
537
|
+
return !!S.isCorrectBatchTypeFor(e2, t2) && t2[1] === this.conversationId;
|
|
536
538
|
}
|
|
537
539
|
static isCorrectBatchTypeFor(e2, t2) {
|
|
538
540
|
return s(t2, ["conversations", "*", "participants", "*"]) && ("PUT" === e2 || "POST" === e2 || "PATCH" === e2);
|
|
@@ -553,7 +555,7 @@ class T extends x {
|
|
|
553
555
|
});
|
|
554
556
|
}
|
|
555
557
|
}
|
|
556
|
-
class
|
|
558
|
+
class I {
|
|
557
559
|
constructor(e2, t2, s2) {
|
|
558
560
|
this.pendingBatch = null, this.connection = new E(e2, t2, s2);
|
|
559
561
|
}
|
|
@@ -574,18 +576,18 @@ class D {
|
|
|
574
576
|
return this.connection.isConnected();
|
|
575
577
|
}
|
|
576
578
|
createEmptyBatchFor(e2, t2) {
|
|
577
|
-
if (
|
|
578
|
-
if (
|
|
579
|
+
if (T.isCorrectBatchTypeFor(e2, t2)) return new T(this.connection, () => this.pendingBatch = null);
|
|
580
|
+
if (S.isCorrectBatchTypeFor(e2, t2)) {
|
|
579
581
|
const e3 = t2[1];
|
|
580
|
-
return new
|
|
582
|
+
return new S(e3, this.connection, () => this.pendingBatch = null);
|
|
581
583
|
}
|
|
582
584
|
return null;
|
|
583
585
|
}
|
|
584
586
|
}
|
|
585
|
-
const
|
|
586
|
-
class
|
|
587
|
+
const D = { 200: "RESOLVE", 400: "RESOLVE", 401: "RETRY", 402: "RESOLVE", 403: "RESOLVE", 404: "RESOLVE", 405: "RESOLVE", 409: "RESOLVE", 429: "DELAY", 500: "DELAY" };
|
|
588
|
+
class M {
|
|
587
589
|
constructor(e2, t2, s2) {
|
|
588
|
-
this.throttler = new
|
|
590
|
+
this.throttler = new F(), this.alive = true, this.connection = new I(e2, t2, s2);
|
|
589
591
|
}
|
|
590
592
|
call(e2, t2, s2) {
|
|
591
593
|
return __async(this, null, function* () {
|
|
@@ -594,7 +596,7 @@ class F {
|
|
|
594
596
|
const r2 = yield this.connection.call(e2, t2, s2);
|
|
595
597
|
if ((r2.ok || "client" !== r2.where || "SOCKET_NOT_READY" !== r2.value) && (r2.ok || "server" !== r2.where || 500 !== r2.value.status) || n2++, 10 === n2) return r2;
|
|
596
598
|
if (r2.ok || "client" !== r2.where) {
|
|
597
|
-
const e3 = r2.value, t3 = e3.status, s3 =
|
|
599
|
+
const e3 = r2.value, t3 = e3.status, s3 = D[t3];
|
|
598
600
|
if ("RESOLVE" === s3) return this.throttler.resetDelay(), r2;
|
|
599
601
|
if ("RETRY" === s3) continue;
|
|
600
602
|
if ("DELAY" === s3) {
|
|
@@ -616,7 +618,7 @@ class F {
|
|
|
616
618
|
return this.connection.isConnected();
|
|
617
619
|
}
|
|
618
620
|
}
|
|
619
|
-
class
|
|
621
|
+
class F {
|
|
620
622
|
constructor() {
|
|
621
623
|
this.initialDelayMs = 200, this.exponentialFactor = 1.2, this.maxDelayMs = 3e4, this.currentDelayMs = this.initialDelayMs, this.lastCall = 0;
|
|
622
624
|
}
|
|
@@ -631,7 +633,7 @@ class B {
|
|
|
631
633
|
this.currentDelayMs = this.initialDelayMs;
|
|
632
634
|
}
|
|
633
635
|
}
|
|
634
|
-
function
|
|
636
|
+
function B(e2) {
|
|
635
637
|
return e2.map((e3) => encodeURIComponent(e3)).join();
|
|
636
638
|
}
|
|
637
639
|
class R {
|
|
@@ -639,13 +641,13 @@ class R {
|
|
|
639
641
|
this.paths = {};
|
|
640
642
|
}
|
|
641
643
|
add(e2) {
|
|
642
|
-
this.paths[
|
|
644
|
+
this.paths[B(e2)] = e2;
|
|
643
645
|
}
|
|
644
646
|
delete(e2) {
|
|
645
|
-
delete this.paths[
|
|
647
|
+
delete this.paths[B(e2)];
|
|
646
648
|
}
|
|
647
649
|
has(e2) {
|
|
648
|
-
return Object.hasOwnProperty.call(this.paths,
|
|
650
|
+
return Object.hasOwnProperty.call(this.paths, B(e2));
|
|
649
651
|
}
|
|
650
652
|
clear() {
|
|
651
653
|
this.paths = {};
|
|
@@ -656,7 +658,7 @@ class R {
|
|
|
656
658
|
}
|
|
657
659
|
class N {
|
|
658
660
|
constructor(e2, t2, s2) {
|
|
659
|
-
this.handlers = s2, this.targetSubscriptions = new R(), this.connection = new
|
|
661
|
+
this.handlers = s2, this.targetSubscriptions = new R(), this.connection = new M(e2, t2, { onUpstreamRestarting: () => this.handlers.onUpstreamRestarting(), onSubscriptionsLost: () => {
|
|
660
662
|
this.targetSubscriptions.forEach((e3) => {
|
|
661
663
|
this.resubscribe(e3);
|
|
662
664
|
}), this.handlers.onResubscribeSent();
|
|
@@ -866,6 +868,11 @@ class q extends W {
|
|
|
866
868
|
this.setError(l("UNSUBSCRIBED"));
|
|
867
869
|
}, this.unsubscribeDebounceMs);
|
|
868
870
|
}
|
|
871
|
+
getLoadMoreSeq() {
|
|
872
|
+
var _a2;
|
|
873
|
+
const e2 = (_a2 = this.lastEmitSeq) != null ? _a2 : 0, t2 = this.mostRecentState.seq;
|
|
874
|
+
return Math.max(e2, t2) + 1e-6;
|
|
875
|
+
}
|
|
869
876
|
emit(e2) {
|
|
870
877
|
return __async(this, null, function* () {
|
|
871
878
|
var _a2;
|
|
@@ -1126,7 +1133,7 @@ class ne extends W {
|
|
|
1126
1133
|
});
|
|
1127
1134
|
}
|
|
1128
1135
|
messageDeleted(e2, t2) {
|
|
1129
|
-
this.mutate(e2, (s2) => null === s2.value.data ? s2 : this.messageId === t2.messageId ? c({ lastChanged: e2, sender: null, data: null }) : s2.value.data.referencedMessageId === t2.messageId ? 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: null, editedAt: s2.value.data.editedAt, custom: s2.value.data.custom, content: s2.value.data.content } }) : s2);
|
|
1136
|
+
this.mutate(e2, (s2) => null === s2.value.data ? s2 : this.messageId === t2.messageId ? (this.teardownNested(s2.value), c({ lastChanged: e2, sender: null, data: null })) : s2.value.data.referencedMessageId === t2.messageId ? 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: null, editedAt: s2.value.data.editedAt, custom: s2.value.data.custom, content: s2.value.data.content } }) : s2);
|
|
1130
1137
|
}
|
|
1131
1138
|
getFromCache() {
|
|
1132
1139
|
return __async(this, null, function* () {
|
|
@@ -1183,7 +1190,7 @@ class re extends W {
|
|
|
1183
1190
|
}
|
|
1184
1191
|
class ie extends q {
|
|
1185
1192
|
constructor(e2, t2, s2, n2) {
|
|
1186
|
-
super(
|
|
1193
|
+
super(s2, n2), this.conversationId = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1187
1194
|
}
|
|
1188
1195
|
listen(e2) {
|
|
1189
1196
|
return this.onlyUsedInternally && this.mostRecentState.resultPromise.then((e3) => {
|
|
@@ -1200,7 +1207,10 @@ class ie extends q {
|
|
|
1200
1207
|
});
|
|
1201
1208
|
}
|
|
1202
1209
|
teardownNested(e2) {
|
|
1203
|
-
|
|
1210
|
+
if (e2.stores) {
|
|
1211
|
+
const t2 = l("TERMINATED");
|
|
1212
|
+
Object.values(e2.stores).forEach((e3) => e3.setError(t2)), e2.inWindow.forEach((e3) => e3.setError(t2));
|
|
1213
|
+
}
|
|
1204
1214
|
}
|
|
1205
1215
|
anyChildChanged(e2, t2, s2) {
|
|
1206
1216
|
return __async(this, null, function* () {
|
|
@@ -1246,7 +1256,7 @@ class ie extends q {
|
|
|
1246
1256
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1247
1257
|
if (!t2.ok) return;
|
|
1248
1258
|
if (null === t2.value.windowEnd) return;
|
|
1249
|
-
const s2 = t2.value.windowEnd.cursor, n2 = yield ae({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient }), r2 = this.
|
|
1259
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield ae({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient }), r2 = this.getLoadMoreSeq();
|
|
1250
1260
|
this.mutate(r2, (e3) => null === e3.value.windowEnd || s2 !== e3.value.windowEnd.cursor ? e3 : n2.ok ? null === n2.value.messages ? (console.warn("[TalkJS] When loading more messages, the conversation no longer existed. We should have been told about this."), e3) : oe({ seq: r2, prevState: e3.value, messages: n2.value.messages, cursor: n2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : n2), yield this.emitMutex.runExclusive(() => this.emit(r2));
|
|
1251
1261
|
});
|
|
1252
1262
|
}
|
|
@@ -1295,17 +1305,17 @@ class ie extends q {
|
|
|
1295
1305
|
conversationCleared(e2, t2) {
|
|
1296
1306
|
this.mutate(e2, (t3) => {
|
|
1297
1307
|
var _a2;
|
|
1298
|
-
return 0 === ((_a2 = t3.value.inWindow) == null ? void 0 : _a2.length) && null === t3.value.windowEnd ? t3 : (
|
|
1308
|
+
return 0 === ((_a2 = t3.value.inWindow) == null ? void 0 : _a2.length) && null === t3.value.windowEnd ? t3 : (this.teardownNested(t3.value), c({ lastChanged: e2, lastMessageChanged: e2, stores: {}, inWindow: [], windowEnd: null }));
|
|
1299
1309
|
});
|
|
1300
1310
|
}
|
|
1301
1311
|
sideCreated(e2, t2) {
|
|
1302
1312
|
const s2 = this.fetchInitial(e2);
|
|
1303
1313
|
this.mutate(e2, (e3) => null !== e3.value.stores ? (s2.then((e4) => {
|
|
1304
|
-
e4.ok &&
|
|
1314
|
+
e4.ok && this.teardownNested(e4.value);
|
|
1305
1315
|
}), e3) : s2);
|
|
1306
1316
|
}
|
|
1307
1317
|
sideDeleted(e2, t2) {
|
|
1308
|
-
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (
|
|
1318
|
+
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (this.teardownNested(t3.value), c({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null })));
|
|
1309
1319
|
}
|
|
1310
1320
|
getMessageFromCache(e2) {
|
|
1311
1321
|
return __async(this, null, function* () {
|
|
@@ -1348,90 +1358,50 @@ function oe({ seq: e2, prevState: t2, messages: s2, cursor: n2, conversationId:
|
|
|
1348
1358
|
if (null === n2) return c({ lastChanged: e2, lastMessageChanged: h2, stores: a2, inWindow: o2, windowEnd: null });
|
|
1349
1359
|
return c({ lastChanged: e2, lastMessageChanged: h2, stores: a2, inWindow: o2, windowEnd: { cursor: n2, oldestMessageTs: s2[s2.length - 1].createdAt } });
|
|
1350
1360
|
}
|
|
1351
|
-
|
|
1352
|
-
if (e2.stores) {
|
|
1353
|
-
const t2 = l("TERMINATED");
|
|
1354
|
-
Object.values(e2.stores).forEach((e3) => e3.setError(t2)), e2.inWindow.forEach((e3) => e3.setError(t2));
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
class ce extends q {
|
|
1361
|
+
class ue extends q {
|
|
1358
1362
|
constructor(e2, t2, s2, n2) {
|
|
1359
|
-
super(
|
|
1363
|
+
super(s2, n2), this.convDataStore = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 0;
|
|
1360
1364
|
}
|
|
1361
1365
|
fetchInitial(e2) {
|
|
1362
1366
|
return __async(this, null, function* () {
|
|
1363
|
-
|
|
1364
|
-
let n2;
|
|
1365
|
-
if (s2.ok) n2 = s2.value.data;
|
|
1366
|
-
else if ("server" === s2.where && 404 === s2.value.status) n2 = null;
|
|
1367
|
-
else {
|
|
1368
|
-
if ("server" !== s2.where || 403 !== s2.value.status || "NOT_A_PARTICIPANT" !== s2.value.errorCode) return t2.unsubscribe(), s2;
|
|
1369
|
-
n2 = null;
|
|
1370
|
-
}
|
|
1371
|
-
return c({ lastChanged: e2, snapshot: n2, messageWindowStore: t2 });
|
|
1367
|
+
return c({ lastChanged: e2, store: this.convDataStore });
|
|
1372
1368
|
});
|
|
1373
1369
|
}
|
|
1374
1370
|
teardownNested(e2) {
|
|
1375
|
-
|
|
1376
|
-
(_a2 = e2.messageWindowStore) == null ? void 0 : _a2.unsubscribe();
|
|
1371
|
+
e2.store.unsubscribe();
|
|
1377
1372
|
}
|
|
1378
1373
|
anyChildChanged(e2, t2, s2) {
|
|
1379
1374
|
return __async(this, null, function* () {
|
|
1380
|
-
return
|
|
1375
|
+
return s2.store.store.changedBetween(e2, t2);
|
|
1381
1376
|
});
|
|
1382
1377
|
}
|
|
1383
1378
|
equal(e2, t2) {
|
|
1384
|
-
return
|
|
1379
|
+
return true;
|
|
1385
1380
|
}
|
|
1386
1381
|
loadNested(e2, t2) {
|
|
1387
1382
|
return __async(this, null, function* () {
|
|
1388
|
-
|
|
1389
|
-
if (!t2.snapshot) return c({ snapshot: null, loadedAll: true });
|
|
1390
|
-
const s2 = yield t2.messageWindowStore.store.getDeep(e2);
|
|
1391
|
-
if (!s2.ok) return s2;
|
|
1392
|
-
const n2 = s2.value.snapshot, r2 = (_a2 = n2 == null ? void 0 : n2[0]) != null ? _a2 : null;
|
|
1393
|
-
return c({ snapshot: __spreadProps(__spreadValues({}, t2.snapshot), { lastMessage: r2 }) });
|
|
1383
|
+
return t2.store.store.getDeep(e2);
|
|
1394
1384
|
});
|
|
1395
1385
|
}
|
|
1396
|
-
participantEdited(e2, t2) {
|
|
1397
|
-
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'participant.edited' event for a conversation that we thought didn't exist."), s2) : c({ lastChanged: e2, snapshot: le(s2.value.snapshot, t2.diff), messageWindowStore: s2.value.messageWindowStore }));
|
|
1398
|
-
}
|
|
1399
|
-
conversationEdited(e2, t2) {
|
|
1400
|
-
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'conversation.edited' event for a conversation that we thought didn't exist."), s2) : c({ lastChanged: e2, snapshot: le(s2.value.snapshot, t2.diff), messageWindowStore: s2.value.messageWindowStore }));
|
|
1401
|
-
}
|
|
1402
|
-
sideEdited(e2, t2) {
|
|
1403
|
-
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'side.edited' event for a conversation that we thought didn't exist."), s2) : c({ lastChanged: e2, snapshot: le(s2.value.snapshot, t2.diff), messageWindowStore: s2.value.messageWindowStore }));
|
|
1404
|
-
}
|
|
1405
|
-
sideCreated(e2, t2) {
|
|
1406
|
-
this.mutate(e2, (s2) => s2.value.snapshot ? s2 : c({ lastChanged: e2, snapshot: t2.state, messageWindowStore: s2.value.messageWindowStore }));
|
|
1407
|
-
}
|
|
1408
|
-
sideDeleted(e2, t2) {
|
|
1409
|
-
this.mutate(e2, (t3) => null === t3.value.snapshot ? t3 : c({ lastChanged: e2, snapshot: null, messageWindowStore: t3.value.messageWindowStore }));
|
|
1410
|
-
}
|
|
1411
1386
|
getFromCache() {
|
|
1412
1387
|
return __async(this, null, function* () {
|
|
1413
|
-
|
|
1414
|
-
return e2.ok && e2.value.snapshot ? c({ status: 200, data: e2.value.snapshot }) : l("NOT_IN_CACHE");
|
|
1388
|
+
return this.convDataStore.store.getFromCache();
|
|
1415
1389
|
});
|
|
1416
1390
|
}
|
|
1417
1391
|
}
|
|
1418
|
-
function
|
|
1419
|
-
const s2 = t2;
|
|
1420
|
-
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: _(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), everyoneReadUntil: P(e2.everyoneReadUntil, s2.everyoneReadUntil), joinedAt: e2.joinedAt };
|
|
1421
|
-
}
|
|
1422
|
-
function he(e2, t2) {
|
|
1392
|
+
function ce(e2, t2) {
|
|
1423
1393
|
for (let s2 in e2) Object.prototype.hasOwnProperty.call(e2, s2) && t2(e2[s2], s2);
|
|
1424
1394
|
}
|
|
1425
|
-
function
|
|
1395
|
+
function le(e2, t2) {
|
|
1426
1396
|
return function(e3, t3) {
|
|
1427
1397
|
let s2 = {}, n2 = 0;
|
|
1428
|
-
return
|
|
1398
|
+
return ce(e3, (e4, r2) => {
|
|
1429
1399
|
const [i2, a2] = t3([r2, e4], n2++);
|
|
1430
1400
|
s2[i2] = a2;
|
|
1431
1401
|
}), s2;
|
|
1432
1402
|
}(e2, ([e3, s2]) => [e3, t2(s2, e3)]);
|
|
1433
1403
|
}
|
|
1434
|
-
class
|
|
1404
|
+
class he extends q {
|
|
1435
1405
|
constructor(e2, t2, s2, n2) {
|
|
1436
1406
|
super(s2, n2), this.conversationId = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 1e4;
|
|
1437
1407
|
}
|
|
@@ -1443,7 +1413,7 @@ class pe extends q {
|
|
|
1443
1413
|
if (!t2.ok) return t2;
|
|
1444
1414
|
const s2 = t2.value.data;
|
|
1445
1415
|
if (s2.many) return c({ data: { usersTyping: null, many: true }, userSubscriptions: {}, lastChanged: e2 });
|
|
1446
|
-
return c({ data: s2, userSubscriptions:
|
|
1416
|
+
return c({ data: s2, userSubscriptions: le(s2.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3])), lastChanged: e2 });
|
|
1447
1417
|
});
|
|
1448
1418
|
}
|
|
1449
1419
|
equal(e2, t2) {
|
|
@@ -1460,7 +1430,7 @@ class pe extends q {
|
|
|
1460
1430
|
});
|
|
1461
1431
|
}
|
|
1462
1432
|
typingAvailable(e2, t2) {
|
|
1463
|
-
this.mutate(e2, () => c({ data: t2.state, userSubscriptions: t2.state.many ? {} :
|
|
1433
|
+
this.mutate(e2, () => c({ data: t2.state, userSubscriptions: t2.state.many ? {} : le(t2.state.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3])), lastChanged: e2 }));
|
|
1464
1434
|
}
|
|
1465
1435
|
typingChanged(e2, t2) {
|
|
1466
1436
|
this.mutate(e2, (s2) => {
|
|
@@ -1468,7 +1438,7 @@ class pe extends q {
|
|
|
1468
1438
|
if (void 0 === t2.diff.many) {
|
|
1469
1439
|
if (true === s2.value.data.many) return s2;
|
|
1470
1440
|
const n2 = __spreadValues({}, s2.value.data.usersTyping), r2 = __spreadValues({}, s2.value.userSubscriptions);
|
|
1471
|
-
return
|
|
1441
|
+
return ce(t2.diff.usersTyping, (e3, t3) => {
|
|
1472
1442
|
var _a2;
|
|
1473
1443
|
"number" == typeof e3 ? (n2[t3] = e3, r2[t3] = this.realtimeClient.internalSubscribe(["users", t3])) : null === e3 && (delete n2[t3], (_a2 = r2[t3]) == null ? void 0 : _a2.unsubscribe(), delete r2[t3]);
|
|
1474
1444
|
}), c({ data: { usersTyping: n2, many: false }, userSubscriptions: r2, lastChanged: e2 });
|
|
@@ -1476,7 +1446,7 @@ class pe extends q {
|
|
|
1476
1446
|
if (true === t2.diff.many) return s2.value.data.many ? s2 : c({ data: { usersTyping: null, many: true }, userSubscriptions: {}, lastChanged: e2 });
|
|
1477
1447
|
if (false === t2.diff.many) {
|
|
1478
1448
|
if (false === s2.value.data.many) return s2;
|
|
1479
|
-
const n2 =
|
|
1449
|
+
const n2 = le(t2.diff.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3]));
|
|
1480
1450
|
return c({ data: t2.diff, userSubscriptions: n2, lastChanged: e2 });
|
|
1481
1451
|
}
|
|
1482
1452
|
throw t2.diff, "Unreachable";
|
|
@@ -1486,7 +1456,7 @@ class pe extends q {
|
|
|
1486
1456
|
this.mutate(e2, (t3) => null === t3.value.data ? t3 : c({ data: null, lastChanged: e2 }));
|
|
1487
1457
|
}
|
|
1488
1458
|
teardownNested(e2) {
|
|
1489
|
-
e2.data &&
|
|
1459
|
+
e2.data && ce(e2.userSubscriptions, (e3) => e3.unsubscribe());
|
|
1490
1460
|
}
|
|
1491
1461
|
anyChildChanged(e2, t2, s2) {
|
|
1492
1462
|
return __async(this, null, function* () {
|
|
@@ -1500,9 +1470,366 @@ class pe extends q {
|
|
|
1500
1470
|
});
|
|
1501
1471
|
}
|
|
1502
1472
|
}
|
|
1503
|
-
class
|
|
1473
|
+
class de extends W {
|
|
1474
|
+
constructor(e2, t2, s2) {
|
|
1475
|
+
super(), this.conversationId = e2, this.participantData = t2, this.realtimeClient = s2;
|
|
1476
|
+
}
|
|
1477
|
+
fetchInitial(e2) {
|
|
1478
|
+
return __async(this, null, function* () {
|
|
1479
|
+
return c({ lastChanged: e2, user: this.realtimeClient.internalSubscribe(["users", this.participantData.id]), data: this.participantData });
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
refetch(e2) {
|
|
1483
|
+
throw "Do not call refetch on participant data stores, it can return outdated data. Destroy and remake them instead";
|
|
1484
|
+
}
|
|
1485
|
+
equal(e2, t2) {
|
|
1486
|
+
var _a2, _b, _c, _d;
|
|
1487
|
+
return ((_b = (_a2 = e2.user) == null ? void 0 : _a2.store) == null ? void 0 : _b.userId) === ((_d = (_c = t2.user) == null ? void 0 : _c.store) == null ? void 0 : _d.userId) && O(e2.data, t2.data);
|
|
1488
|
+
}
|
|
1489
|
+
teardownNested(e2) {
|
|
1490
|
+
var _a2;
|
|
1491
|
+
(_a2 = e2.user) == null ? void 0 : _a2.unsubscribe();
|
|
1492
|
+
}
|
|
1493
|
+
anyChildChanged(e2, t2, s2) {
|
|
1494
|
+
return __async(this, null, function* () {
|
|
1495
|
+
var _a2;
|
|
1496
|
+
const n2 = (_a2 = s2.user) == null ? void 0 : _a2.store;
|
|
1497
|
+
return true === (yield n2 == null ? void 0 : n2.changedBetween(e2, t2));
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
loadNested(e2, t2) {
|
|
1501
|
+
return __async(this, null, function* () {
|
|
1502
|
+
if (null === t2.data) return c({ snapshot: null });
|
|
1503
|
+
const s2 = yield t2.user.store.getDeep(e2);
|
|
1504
|
+
if (false === s2.ok) return s2;
|
|
1505
|
+
const n2 = s2.value.snapshot;
|
|
1506
|
+
return c({ snapshot: this.realtimeClient.createParticipantSnapshotPreloaded(t2.data, n2) });
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
participantEdited(e2, t2) {
|
|
1510
|
+
this.mutate(e2, (s2) => {
|
|
1511
|
+
if (null === s2.value.data) return s2;
|
|
1512
|
+
return c({ lastChanged: e2, user: s2.value.user, data: { id: s2.value.data.id, access: P(s2.value.data.access, t2.diff.access), notify: P(s2.value.data.notify, t2.diff.notify), joinedAt: s2.value.data.joinedAt } });
|
|
1513
|
+
});
|
|
1514
|
+
}
|
|
1515
|
+
participantDeleted(e2, t2) {
|
|
1516
|
+
this.mutate(e2, (t3) => null === t3.value.data ? t3 : (this.teardownNested(t3.value), c({ lastChanged: e2, user: null, data: null })));
|
|
1517
|
+
}
|
|
1518
|
+
getFromCache() {
|
|
1519
|
+
return __async(this, null, function* () {
|
|
1520
|
+
const e2 = yield this.mostRecentState.resultPromise;
|
|
1521
|
+
if (!e2.ok) return l("NOT_IN_CACHE");
|
|
1522
|
+
if (null === e2.value.data) {
|
|
1523
|
+
return h({ status: 404, errorCode: "PARTICIPANT_NOT_FOUND", reasons: ["No participant with that ID exists"] });
|
|
1524
|
+
}
|
|
1525
|
+
return c({ status: 200, data: e2.value.data });
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
class pe extends q {
|
|
1530
|
+
constructor(e2, t2, s2, n2) {
|
|
1531
|
+
super(s2, n2), this.conversationId = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1532
|
+
}
|
|
1533
|
+
fetchInitial(e2) {
|
|
1534
|
+
return __async(this, null, function* () {
|
|
1535
|
+
const t2 = yield fe({ realtimeClient: this.realtimeClient, conversationId: this.conversationId, count: 10 });
|
|
1536
|
+
return t2.ok ? null === t2.value.participants ? c({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null }) : me({ seq: e2, participants: t2.value.participants, cursor: t2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : t2;
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
teardownNested(e2) {
|
|
1540
|
+
if (e2.stores) {
|
|
1541
|
+
const t2 = l("TERMINATED");
|
|
1542
|
+
Object.values(e2.stores).forEach((e3) => e3.setError(t2));
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
anyChildChanged(e2, t2, s2) {
|
|
1546
|
+
return __async(this, null, function* () {
|
|
1547
|
+
for (const n2 in s2.stores) {
|
|
1548
|
+
const r2 = s2.stores[n2];
|
|
1549
|
+
if (true === (yield r2 == null ? void 0 : r2.changedBetween(e2, t2))) return true;
|
|
1550
|
+
}
|
|
1551
|
+
return false;
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
equal(e2, t2) {
|
|
1555
|
+
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!O(Object.keys(e2.stores), Object.keys(t2.stores)) && O(e2.windowEnd, t2.windowEnd));
|
|
1556
|
+
}
|
|
1557
|
+
loadNested(e2, t2) {
|
|
1558
|
+
return __async(this, null, function* () {
|
|
1559
|
+
if (null === t2.stores) return c({ snapshot: null, loadedAll: true });
|
|
1560
|
+
const s2 = yield Promise.all(Object.values(t2.stores).map((t3) => t3.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1561
|
+
if (n2) return n2;
|
|
1562
|
+
const r2 = s2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot);
|
|
1563
|
+
return r2.sort((e3, t3) => t3.joinedAt - e3.joinedAt), c({ snapshot: r2, loadedAll: null === t2.windowEnd });
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
loadMore(e2) {
|
|
1567
|
+
return __async(this, null, function* () {
|
|
1568
|
+
if (this.pendingLoadMore) return this.pendingLoadMore;
|
|
1569
|
+
const t2 = o();
|
|
1570
|
+
this.pendingLoadMore = t2.promise, yield this._loadMoreParticipants(e2), t2.resolve(), this.pendingLoadMore = void 0;
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
_loadMoreParticipants(e2 = 10) {
|
|
1574
|
+
return __async(this, null, function* () {
|
|
1575
|
+
const t2 = yield this.mostRecentState.resultPromise;
|
|
1576
|
+
if (!t2.ok) return;
|
|
1577
|
+
if (null === t2.value.windowEnd) return;
|
|
1578
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield fe({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient }), r2 = this.getLoadMoreSeq();
|
|
1579
|
+
this.mutate(r2, (e3) => null === e3.value.windowEnd || s2 !== e3.value.windowEnd.cursor ? e3 : n2.ok ? null === n2.value.participants ? (console.warn("[TalkJS] When loading more participants, the conversation no longer existed. We should have been told about this."), e3) : me({ seq: r2, prevStores: e3.value.stores, participants: n2.value.participants, cursor: n2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : n2), yield this.emitMutex.runExclusive(() => this.emit(r2));
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
participantCreated(e2, t2) {
|
|
1583
|
+
this.mutate(e2, (s2) => {
|
|
1584
|
+
if (null === s2.value.stores) return console.warn("[TalkJS] Received a 'participant.created' event for a nonexistent conversation."), s2;
|
|
1585
|
+
if (s2.value.windowEnd && t2.state.joinedAt < s2.value.windowEnd.oldestParticipantTs) return s2;
|
|
1586
|
+
if (Object.hasOwnProperty.call(s2.value.stores, t2.state.id)) return s2;
|
|
1587
|
+
const n2 = __spreadValues({}, s2.value.stores), r2 = new de(this.conversationId, t2.state, this.realtimeClient);
|
|
1588
|
+
n2[t2.state.id] = r2;
|
|
1589
|
+
return c({ lastChanged: e2, stores: n2, windowEnd: s2.value.windowEnd });
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
participantEdited(e2, t2) {
|
|
1593
|
+
this.mutate(e2, (s2) => {
|
|
1594
|
+
var _a2;
|
|
1595
|
+
return null === s2.value.stores ? (console.warn("[TalkJS] Received a 'participant.edited' event for a nonexistent conversation."), s2) : ((_a2 = s2.value.stores[t2.userId]) == null ? void 0 : _a2.participantEdited(e2, t2), s2);
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
participantDeleted(e2, t2) {
|
|
1599
|
+
this.mutate(e2, (s2) => {
|
|
1600
|
+
if (null === s2.value.stores) return console.warn("[TalkJS] Received a 'participant.deleted' event for a conversation that we thought didn't exist."), s2;
|
|
1601
|
+
const n2 = s2.value.stores[t2.userId];
|
|
1602
|
+
if (void 0 === n2) return s2;
|
|
1603
|
+
n2.participantDeleted(e2, t2);
|
|
1604
|
+
const r2 = __spreadValues({}, s2.value.stores);
|
|
1605
|
+
return delete r2[t2.userId], c({ lastChanged: e2, stores: r2, windowEnd: s2.value.windowEnd });
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
sideCreated(e2, t2) {
|
|
1609
|
+
const s2 = this.fetchInitial(e2);
|
|
1610
|
+
this.mutate(e2, (e3) => null !== e3.value.stores ? (s2.then((e4) => {
|
|
1611
|
+
e4.ok && this.teardownNested(e4.value);
|
|
1612
|
+
}), e3) : s2);
|
|
1613
|
+
}
|
|
1614
|
+
sideDeleted(e2, t2) {
|
|
1615
|
+
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (this.teardownNested(t3.value), c({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null })));
|
|
1616
|
+
}
|
|
1617
|
+
getParticipantFromCache(e2) {
|
|
1618
|
+
return __async(this, null, function* () {
|
|
1619
|
+
const t2 = yield this.mostRecentState.resultPromise;
|
|
1620
|
+
if (!t2.ok) return l("NOT_IN_CACHE");
|
|
1621
|
+
if (null === t2.value.stores) return l("NOT_IN_CACHE");
|
|
1622
|
+
const s2 = t2.value.stores[e2];
|
|
1623
|
+
return void 0 === s2 ? l("NOT_IN_CACHE") : s2.getFromCache();
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
function fe(_0) {
|
|
1628
|
+
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, conversationId: s2, count: n2 }) {
|
|
1629
|
+
const r2 = { limit: n2, cursor: e2 }, i2 = yield t2.call("GET", ["me", "conversations", s2, "participants"], r2, { bypassCache: true });
|
|
1630
|
+
if (i2.ok) {
|
|
1631
|
+
const { data: e3, cursor: t3 } = i2.value.data;
|
|
1632
|
+
return c({ participants: e3, nextCursor: t3 });
|
|
1633
|
+
}
|
|
1634
|
+
return (i2.ok || "server" !== i2.where || 404 !== i2.value.status) && (i2.ok || "server" !== i2.where || 403 !== i2.value.status || "NOT_A_PARTICIPANT" !== i2.value.errorCode) ? i2 : c({ participants: null, nextCursor: null });
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
function me({ seq: e2, prevStores: t2, participants: s2, cursor: n2, conversationId: r2, realtimeClient: i2 }) {
|
|
1638
|
+
const a2 = t2 ? __spreadValues({}, t2) : {};
|
|
1639
|
+
for (const e3 of s2) if (void 0 === a2[e3.id]) {
|
|
1640
|
+
const t3 = new de(r2, e3, i2);
|
|
1641
|
+
a2[e3.id] = t3;
|
|
1642
|
+
}
|
|
1643
|
+
if (null === n2) return c({ lastChanged: e2, stores: a2, windowEnd: null });
|
|
1644
|
+
return c({ lastChanged: e2, stores: a2, windowEnd: { cursor: n2, oldestParticipantTs: s2[s2.length - 1].joinedAt } });
|
|
1645
|
+
}
|
|
1646
|
+
class ge extends q {
|
|
1647
|
+
constructor(e2, t2, s2, n2) {
|
|
1648
|
+
super(s2, n2), this.getConvDataStore = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1649
|
+
}
|
|
1650
|
+
fetchInitial(e2) {
|
|
1651
|
+
return __async(this, null, function* () {
|
|
1652
|
+
const t2 = yield ve({ realtimeClient: this.realtimeClient, count: 20 });
|
|
1653
|
+
return t2.ok ? null === t2.value.conversations ? c({ lastChanged: e2, stores: null, windowEnd: null }) : we({ seq: e2, conversations: t2.value.conversations, cursor: t2.value.nextCursor, getConvDataStore: this.getConvDataStore }) : t2;
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
teardownNested(e2) {
|
|
1657
|
+
null !== e2.stores && Object.values(e2.stores).forEach((e3) => e3.unsubscribe());
|
|
1658
|
+
}
|
|
1659
|
+
anyChildChanged(e2, t2, s2) {
|
|
1660
|
+
return __async(this, null, function* () {
|
|
1661
|
+
var _a2;
|
|
1662
|
+
for (const n2 in s2.stores) {
|
|
1663
|
+
const r2 = s2.stores[n2];
|
|
1664
|
+
if (true === (yield (_a2 = r2 == null ? void 0 : r2.store) == null ? void 0 : _a2.changedBetween(e2, t2))) return true;
|
|
1665
|
+
}
|
|
1666
|
+
return false;
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
equal(e2, t2) {
|
|
1670
|
+
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!O(Object.keys(e2.stores), Object.keys(t2.stores)) && O(e2.windowEnd, t2.windowEnd));
|
|
1671
|
+
}
|
|
1672
|
+
loadNested(e2, t2) {
|
|
1673
|
+
return __async(this, null, function* () {
|
|
1674
|
+
if (null === t2.stores) return c({ snapshot: [], loadedAll: true });
|
|
1675
|
+
const s2 = yield Promise.all(Object.values(t2.stores).map((t3) => t3.store.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1676
|
+
if (n2) return n2;
|
|
1677
|
+
const r2 = s2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot);
|
|
1678
|
+
return r2.sort((e3, t3) => {
|
|
1679
|
+
var _a2, _b, _c, _d;
|
|
1680
|
+
const s3 = (_b = (_a2 = e3.lastMessage) == null ? void 0 : _a2.createdAt) != null ? _b : e3.joinedAt;
|
|
1681
|
+
return ((_d = (_c = t3.lastMessage) == null ? void 0 : _c.createdAt) != null ? _d : t3.joinedAt) - s3;
|
|
1682
|
+
}), c({ snapshot: r2, loadedAll: null === t2.windowEnd });
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
loadMore(e2) {
|
|
1686
|
+
return __async(this, null, function* () {
|
|
1687
|
+
if (this.pendingLoadMore) return this.pendingLoadMore;
|
|
1688
|
+
const t2 = o();
|
|
1689
|
+
this.pendingLoadMore = t2.promise, yield this._loadMoreConversations(e2), t2.resolve(), this.pendingLoadMore = void 0;
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
_loadMoreConversations(e2 = 20) {
|
|
1693
|
+
return __async(this, null, function* () {
|
|
1694
|
+
const t2 = yield this.mostRecentState.resultPromise;
|
|
1695
|
+
if (!t2.ok) return;
|
|
1696
|
+
if (null === t2.value.windowEnd) return;
|
|
1697
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield ve({ count: e2, cursor: s2, realtimeClient: this.realtimeClient }), r2 = this.getLoadMoreSeq();
|
|
1698
|
+
this.mutate(r2, (e3) => null === e3.value.windowEnd || s2 !== e3.value.windowEnd.cursor ? e3 : n2.ok ? null === n2.value.conversations ? (console.warn("[TalkJS] When loading more conversations, the user stopped existing, which should be impossible."), e3) : we({ seq: r2, prevStores: e3.value.stores, conversations: n2.value.conversations, cursor: n2.value.nextCursor, getConvDataStore: this.getConvDataStore }) : n2), yield this.emitMutex.runExclusive(() => this.emit(r2));
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
getConvFromCache(e2) {
|
|
1702
|
+
return __async(this, null, function* () {
|
|
1703
|
+
const t2 = yield this.mostRecentState.resultPromise;
|
|
1704
|
+
if (!t2.ok) return l("NOT_IN_CACHE");
|
|
1705
|
+
if (null === t2.value.stores) return h({ status: 404, errorCode: "USER_NOT_FOUND", reasons: ["No user with that ID exists"] });
|
|
1706
|
+
const s2 = t2.value.stores[e2];
|
|
1707
|
+
return void 0 === s2 ? l("NOT_IN_CACHE") : s2.store.getFromCache();
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
userCreated(e2, t2) {
|
|
1711
|
+
this.mutate(e2, (e3) => null !== e3.value.stores ? e3 : c({ lastChanged: e3.value.lastChanged, stores: {}, windowEnd: null }));
|
|
1712
|
+
}
|
|
1713
|
+
sideCreated(e2, t2) {
|
|
1714
|
+
const s2 = this.getConvDataStore(t2.state);
|
|
1715
|
+
this.mutate(e2, (n2) => Object.hasOwnProperty.call(n2.value.stores, t2.conversationId) ? (s2.unsubscribe(), n2) : c({ lastChanged: e2, stores: __spreadProps(__spreadValues({}, n2.value.stores), { [t2.conversationId]: s2 }), windowEnd: n2.value.windowEnd }));
|
|
1716
|
+
}
|
|
1717
|
+
sideDeleted(e2, t2) {
|
|
1718
|
+
this.mutate(e2, (s2) => {
|
|
1719
|
+
var _a2;
|
|
1720
|
+
if (!Object.hasOwnProperty.call(s2.value.stores, t2.conversationId)) return s2;
|
|
1721
|
+
const n2 = __spreadValues({}, s2.value.stores);
|
|
1722
|
+
return (_a2 = n2[t2.conversationId]) == null ? void 0 : _a2.unsubscribe(), delete n2[t2.conversationId], c({ lastChanged: e2, stores: n2, windowEnd: s2.value.windowEnd });
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
sideEdited(e2, t2) {
|
|
1726
|
+
const s2 = t2.diff.lastMessageAt;
|
|
1727
|
+
void 0 !== s2 && this.mutate(e2, (n2) => {
|
|
1728
|
+
var _a2;
|
|
1729
|
+
if (null === n2.value.stores) return console.warn("[TalkJS] Received a 'side.edited' event when we thought your user didn't exist."), n2;
|
|
1730
|
+
if (null === n2.value.windowEnd) return n2;
|
|
1731
|
+
const r2 = Object.hasOwnProperty.call(n2.value.stores, t2.conversationId);
|
|
1732
|
+
if (r2 && s2 < n2.value.windowEnd.oldestMessageTs) {
|
|
1733
|
+
const s3 = __spreadValues({}, n2.value.stores);
|
|
1734
|
+
return (_a2 = s3[t2.conversationId]) == null ? void 0 : _a2.unsubscribe(), delete s3[t2.conversationId], c({ lastChanged: e2, stores: s3, windowEnd: n2.value.windowEnd });
|
|
1735
|
+
}
|
|
1736
|
+
if (!r2 && s2 >= n2.value.windowEnd.oldestMessageTs) {
|
|
1737
|
+
const s3 = this.getConvDataStore(t2.conversationId);
|
|
1738
|
+
return c({ lastChanged: e2, stores: __spreadProps(__spreadValues({}, n2.value.stores), { [t2.conversationId]: s3 }), windowEnd: n2.value.windowEnd });
|
|
1739
|
+
}
|
|
1740
|
+
return n2;
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
function ve(_0) {
|
|
1745
|
+
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, count: s2 }) {
|
|
1746
|
+
const n2 = { limit: s2, cursor: e2 }, r2 = yield t2.call("GET", ["me", "conversations"], n2, { bypassCache: true });
|
|
1747
|
+
if (r2.ok) {
|
|
1748
|
+
const { data: e3, cursor: t3 } = r2.value.data;
|
|
1749
|
+
return c({ conversations: e3, nextCursor: t3 });
|
|
1750
|
+
}
|
|
1751
|
+
return r2.ok || "server" !== r2.where || 404 !== r2.value.status || "USER_NOT_FOUND" !== r2.value.errorCode ? r2 : c({ conversations: null, nextCursor: null });
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
function we({ seq: e2, prevStores: t2, conversations: s2, cursor: n2, getConvDataStore: r2 }) {
|
|
1755
|
+
const i2 = t2 ? __spreadValues({}, t2) : {};
|
|
1756
|
+
for (const e3 of s2) void 0 === i2[e3.id] && (i2[e3.id] = r2(e3));
|
|
1757
|
+
if (null === n2) return c({ lastChanged: e2, stores: i2, windowEnd: null });
|
|
1758
|
+
return c({ lastChanged: e2, stores: i2, windowEnd: { cursor: n2, oldestMessageTs: Math.min(...s2.map((e3) => e3.lastMessageAt)) } });
|
|
1759
|
+
}
|
|
1760
|
+
class be extends q {
|
|
1761
|
+
constructor(e2, t2, s2, n2) {
|
|
1762
|
+
super(s2, n2), this.conversation = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 5e3;
|
|
1763
|
+
}
|
|
1764
|
+
get conversationId() {
|
|
1765
|
+
return "string" == typeof this.conversation ? this.conversation : this.conversation.id;
|
|
1766
|
+
}
|
|
1767
|
+
fetchInitial(e2) {
|
|
1768
|
+
return __async(this, null, function* () {
|
|
1769
|
+
const t2 = this.realtimeClient.internalSubscribe(["me", "conversations", this.conversationId, "messages"]);
|
|
1770
|
+
if ("object" == typeof this.conversation) return c({ lastChanged: e2, snapshot: this.conversation, messageWindowStore: t2 });
|
|
1771
|
+
const s2 = yield this.realtimeClient.call("GET", ["me", "conversations", this.conversationId], {}, { bypassCache: true });
|
|
1772
|
+
let n2;
|
|
1773
|
+
if (s2.ok) n2 = s2.value.data;
|
|
1774
|
+
else if ("server" === s2.where && 404 === s2.value.status) n2 = null;
|
|
1775
|
+
else {
|
|
1776
|
+
if ("server" !== s2.where || 403 !== s2.value.status || "NOT_A_PARTICIPANT" !== s2.value.errorCode) return t2.unsubscribe(), s2;
|
|
1777
|
+
n2 = null;
|
|
1778
|
+
}
|
|
1779
|
+
return c({ lastChanged: e2, snapshot: n2, messageWindowStore: t2 });
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
teardownNested(e2) {
|
|
1783
|
+
var _a2;
|
|
1784
|
+
(_a2 = e2.messageWindowStore) == null ? void 0 : _a2.unsubscribe();
|
|
1785
|
+
}
|
|
1786
|
+
anyChildChanged(e2, t2, s2) {
|
|
1787
|
+
return __async(this, null, function* () {
|
|
1788
|
+
return true === (yield s2.messageWindowStore.store.lastMessageChangedBetween(e2, t2));
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
equal(e2, t2) {
|
|
1792
|
+
return O(e2.snapshot, t2.snapshot);
|
|
1793
|
+
}
|
|
1794
|
+
loadNested(e2, t2) {
|
|
1795
|
+
return __async(this, null, function* () {
|
|
1796
|
+
var _a2;
|
|
1797
|
+
if (!t2.snapshot) return c({ snapshot: null, loadedAll: true });
|
|
1798
|
+
const s2 = yield t2.messageWindowStore.store.getDeep(e2);
|
|
1799
|
+
if (!s2.ok) return s2;
|
|
1800
|
+
const n2 = s2.value.snapshot, r2 = (_a2 = n2 == null ? void 0 : n2[0]) != null ? _a2 : null;
|
|
1801
|
+
return c({ snapshot: __spreadProps(__spreadValues({}, t2.snapshot), { lastMessage: r2 }) });
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
participantEdited(e2, t2) {
|
|
1805
|
+
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'participant.edited' event for a conversation that we thought didn't exist."), s2) : c({ lastChanged: e2, snapshot: ye(s2.value.snapshot, t2.diff), messageWindowStore: s2.value.messageWindowStore }));
|
|
1806
|
+
}
|
|
1807
|
+
conversationEdited(e2, t2) {
|
|
1808
|
+
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'conversation.edited' event for a conversation that we thought didn't exist."), s2) : c({ lastChanged: e2, snapshot: ye(s2.value.snapshot, t2.diff), messageWindowStore: s2.value.messageWindowStore }));
|
|
1809
|
+
}
|
|
1810
|
+
sideEdited(e2, t2) {
|
|
1811
|
+
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'side.edited' event for a conversation that we thought didn't exist."), s2) : c({ lastChanged: e2, snapshot: ye(s2.value.snapshot, t2.diff), messageWindowStore: s2.value.messageWindowStore }));
|
|
1812
|
+
}
|
|
1813
|
+
sideCreated(e2, t2) {
|
|
1814
|
+
this.mutate(e2, (s2) => s2.value.snapshot ? s2 : c({ lastChanged: e2, snapshot: t2.state, messageWindowStore: s2.value.messageWindowStore }));
|
|
1815
|
+
}
|
|
1816
|
+
sideDeleted(e2, t2) {
|
|
1817
|
+
this.mutate(e2, (t3) => null === t3.value.snapshot ? t3 : c({ lastChanged: e2, snapshot: null, messageWindowStore: t3.value.messageWindowStore }));
|
|
1818
|
+
}
|
|
1819
|
+
getFromCache() {
|
|
1820
|
+
return __async(this, null, function* () {
|
|
1821
|
+
const e2 = yield this.mostRecentState.resultPromise;
|
|
1822
|
+
return e2.ok && e2.value.snapshot ? c({ status: 200, data: e2.value.snapshot }) : l("NOT_IN_CACHE");
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
function ye(e2, t2) {
|
|
1827
|
+
const s2 = t2;
|
|
1828
|
+
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: _(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), everyoneReadUntil: P(e2.everyoneReadUntil, s2.everyoneReadUntil), joinedAt: e2.joinedAt };
|
|
1829
|
+
}
|
|
1830
|
+
class Ce {
|
|
1504
1831
|
constructor(e2, t2, s2) {
|
|
1505
|
-
this.realtimeClient = s2, this.
|
|
1832
|
+
this.realtimeClient = s2, this.convDataStores = {}, this.storeMap = {}, this.emitMutex = new U(), this.seqOffset = 0, this.seqInThisConnection = 0, this.refetchOnNextNetworkLoss = true, this.connection = new N(e2, t2, { onUpstreamRestarting: () => {
|
|
1506
1833
|
this.refetchOnNextNetworkLoss = false;
|
|
1507
1834
|
}, onReady: () => {
|
|
1508
1835
|
this.refetchOnNextNetworkLoss = true;
|
|
@@ -1514,7 +1841,7 @@ class fe {
|
|
|
1514
1841
|
}
|
|
1515
1842
|
}, onResubscribeError: (e3, t3) => {
|
|
1516
1843
|
var _a2;
|
|
1517
|
-
(_a2 = this.
|
|
1844
|
+
(_a2 = this.storeMap[Ae(e3)]) == null ? void 0 : _a2.setError(t3);
|
|
1518
1845
|
}, onPublish: (e3, t3) => {
|
|
1519
1846
|
this.seqInThisConnection = e3;
|
|
1520
1847
|
const s3 = this.seq;
|
|
@@ -1526,119 +1853,76 @@ class fe {
|
|
|
1526
1853
|
return this.seqOffset + this.seqInThisConnection;
|
|
1527
1854
|
}
|
|
1528
1855
|
refetchAll(e2) {
|
|
1529
|
-
|
|
1530
|
-
for (const t2 of Object.values(this.messageWindowStores)) t2.refetch(e2);
|
|
1531
|
-
for (const t2 of Object.values(this.conversationStores)) t2.refetch(e2);
|
|
1532
|
-
for (const t2 of Object.values(this.typingStores)) t2.refetch(e2);
|
|
1856
|
+
Object.values(this.storeMap).forEach((t2) => t2 == null ? void 0 : t2.refetch(e2));
|
|
1533
1857
|
}
|
|
1534
1858
|
emitAll(e2) {
|
|
1535
1859
|
return this.emitMutex.runExclusive(() => __async(this, null, function* () {
|
|
1536
|
-
|
|
1860
|
+
const t2 = Object.values(this.storeMap).map((t3) => t3 == null ? void 0 : t3.emit(e2));
|
|
1861
|
+
yield Promise.all(t2);
|
|
1537
1862
|
}));
|
|
1538
1863
|
}
|
|
1539
1864
|
handlePublish(e2, t2) {
|
|
1865
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t2, _u, _v, _w, _x, _y;
|
|
1540
1866
|
switch (t2.type) {
|
|
1541
1867
|
case "user.created":
|
|
1542
|
-
return this.
|
|
1868
|
+
return (_a2 = this.storeMap[`/users/${t2.userId}`]) == null ? void 0 : _a2.userCreated(e2, t2), void ((_b = this.storeMap["/me/conversations"]) == null ? void 0 : _b.userCreated(e2, t2));
|
|
1543
1869
|
case "user.edited":
|
|
1544
|
-
return this.
|
|
1870
|
+
return void ((_c = this.storeMap[`/users/${t2.userId}`]) == null ? void 0 : _c.userEdited(e2, t2));
|
|
1545
1871
|
case "side.created":
|
|
1546
|
-
return this.
|
|
1872
|
+
return (_d = this.convDataStores[t2.conversationId]) == null ? void 0 : _d.sideCreated(e2, t2), (_e2 = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _e2.sideCreated(e2, t2), (_f = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _f.sideCreated(e2, t2), void ((_g = this.storeMap["/me/conversations"]) == null ? void 0 : _g.sideCreated(e2, t2));
|
|
1547
1873
|
case "side.edited":
|
|
1548
|
-
return this.
|
|
1874
|
+
return (_h = this.convDataStores[t2.conversationId]) == null ? void 0 : _h.sideEdited(e2, t2), void ((_i = this.storeMap["/me/conversations"]) == null ? void 0 : _i.sideEdited(e2, t2));
|
|
1549
1875
|
case "side.deleted":
|
|
1550
|
-
return this.
|
|
1551
|
-
case "participant.edited":
|
|
1552
|
-
return this.handleParticipantEdited(e2, t2);
|
|
1876
|
+
return (_j = this.convDataStores[t2.conversationId]) == null ? void 0 : _j.sideDeleted(e2, t2), (_k = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _k.sideDeleted(e2, t2), (_l = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _l.sideDeleted(e2, t2), (_m = this.storeMap[`/me/conversations/${t2.conversationId}/typing`]) == null ? void 0 : _m.sideDeleted(e2, t2), void ((_n = this.storeMap["/me/conversations"]) == null ? void 0 : _n.sideDeleted(e2, t2));
|
|
1553
1877
|
case "conversation.edited":
|
|
1554
|
-
return this.
|
|
1878
|
+
return void ((_o = this.convDataStores[t2.conversationId]) == null ? void 0 : _o.conversationEdited(e2, t2));
|
|
1555
1879
|
case "message.created":
|
|
1556
|
-
return this.
|
|
1880
|
+
return void ((_p = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _p.messageCreated(e2, t2));
|
|
1557
1881
|
case "message.edited":
|
|
1558
|
-
return this.
|
|
1882
|
+
return void ((_q = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _q.messageEdited(e2, t2));
|
|
1559
1883
|
case "message.deleted":
|
|
1560
|
-
return this.
|
|
1884
|
+
return void ((_r = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _r.messageDeleted(e2, t2));
|
|
1561
1885
|
case "typing.available":
|
|
1562
|
-
return this.
|
|
1886
|
+
return void ((_s = this.storeMap[`/me/conversations/${t2.conversationId}/typing`]) == null ? void 0 : _s.typingAvailable(e2, t2));
|
|
1563
1887
|
case "typing.changed":
|
|
1564
|
-
return this.
|
|
1888
|
+
return void ((_t2 = this.storeMap[`/me/conversations/${t2.conversationId}/typing`]) == null ? void 0 : _t2.typingChanged(e2, t2));
|
|
1565
1889
|
case "conversation.cleared":
|
|
1566
|
-
return this.
|
|
1890
|
+
return void ((_u = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _u.conversationCleared(e2, t2));
|
|
1891
|
+
case "participant.edited":
|
|
1892
|
+
return (_v = this.convDataStores[t2.conversationId]) == null ? void 0 : _v.participantEdited(e2, t2), void ((_w = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _w.participantEdited(e2, t2));
|
|
1893
|
+
case "participant.created":
|
|
1894
|
+
return void ((_x = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _x.participantCreated(e2, t2));
|
|
1895
|
+
case "participant.deleted":
|
|
1896
|
+
return void ((_y = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _y.participantDeleted(e2, t2));
|
|
1567
1897
|
}
|
|
1568
1898
|
}
|
|
1569
|
-
handleTypingAvailable(e2, t2) {
|
|
1570
|
-
const s2 = this.typingStores[t2.conversationId];
|
|
1571
|
-
s2 && s2.typingAvailable(e2, t2);
|
|
1572
|
-
}
|
|
1573
|
-
handleTypingChanged(e2, t2) {
|
|
1574
|
-
const s2 = this.typingStores[t2.conversationId];
|
|
1575
|
-
s2 && s2.typingChanged(e2, t2);
|
|
1576
|
-
}
|
|
1577
|
-
handleUserCreated(e2, t2) {
|
|
1578
|
-
const s2 = this.userStores[t2.userId];
|
|
1579
|
-
s2 && s2.userCreated(e2, t2);
|
|
1580
|
-
}
|
|
1581
|
-
handleUserEdited(e2, t2) {
|
|
1582
|
-
const s2 = this.userStores[t2.userId];
|
|
1583
|
-
s2 && s2.userEdited(e2, t2);
|
|
1584
|
-
}
|
|
1585
|
-
handleSideCreated(e2, t2) {
|
|
1586
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1587
|
-
s2 && s2.sideCreated(e2, t2);
|
|
1588
|
-
const n2 = this.conversationStores[t2.conversationId];
|
|
1589
|
-
n2 && n2.sideCreated(e2, t2);
|
|
1590
|
-
}
|
|
1591
|
-
handleSideEdited(e2, t2) {
|
|
1592
|
-
const s2 = this.conversationStores[t2.conversationId];
|
|
1593
|
-
s2 && s2.sideEdited(e2, t2);
|
|
1594
|
-
}
|
|
1595
|
-
handleParticipantEdited(e2, t2) {
|
|
1596
|
-
const s2 = this.conversationStores[t2.conversationId];
|
|
1597
|
-
s2 && s2.participantEdited(e2, t2);
|
|
1598
|
-
}
|
|
1599
|
-
handleConversationEdited(e2, t2) {
|
|
1600
|
-
const s2 = this.conversationStores[t2.conversationId];
|
|
1601
|
-
s2 && s2.conversationEdited(e2, t2);
|
|
1602
|
-
}
|
|
1603
|
-
handleSideDeleted(e2, t2) {
|
|
1604
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1605
|
-
s2 && s2.sideDeleted(e2, t2);
|
|
1606
|
-
const n2 = this.conversationStores[t2.conversationId];
|
|
1607
|
-
n2 && n2.sideDeleted(e2, t2);
|
|
1608
|
-
const r2 = this.typingStores[t2.conversationId];
|
|
1609
|
-
r2 && r2.sideDeleted(e2, t2);
|
|
1610
|
-
}
|
|
1611
|
-
handleMessageCreated(e2, t2) {
|
|
1612
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1613
|
-
s2 && s2.messageCreated(e2, t2);
|
|
1614
|
-
}
|
|
1615
|
-
handleMessageEdited(e2, t2) {
|
|
1616
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1617
|
-
s2 && s2.messageEdited(e2, t2);
|
|
1618
|
-
}
|
|
1619
|
-
handleMessageDeleted(e2, t2) {
|
|
1620
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1621
|
-
s2 && s2.messageDeleted(e2, t2);
|
|
1622
|
-
}
|
|
1623
|
-
handleConversationCleared(e2, t2) {
|
|
1624
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1625
|
-
s2 && s2.conversationCleared(e2, t2);
|
|
1626
|
-
}
|
|
1627
1899
|
call(e2, t2, n2, r2) {
|
|
1628
1900
|
return __async(this, null, function* () {
|
|
1629
|
-
if (!r2.bypassCache) {
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1901
|
+
if (!r2.bypassCache && "GET" === e2) {
|
|
1902
|
+
const e3 = Ae(t2);
|
|
1903
|
+
if (e3 in this.storeMap) {
|
|
1904
|
+
const t3 = e3, s2 = this.storeMap[t3];
|
|
1905
|
+
if (s2 && "getFromCache" in s2) {
|
|
1633
1906
|
const e4 = yield s2.getFromCache();
|
|
1634
1907
|
if ("NOT_IN_CACHE" !== e4.value) return e4;
|
|
1635
1908
|
}
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1909
|
+
} else if (s(t2, ["me", "conversations", "*", "messages", "*"])) {
|
|
1910
|
+
const e4 = this.storeMap[`/me/conversations/${t2[2]}/messages`];
|
|
1911
|
+
if (e4) {
|
|
1912
|
+
const s2 = yield e4.getMessageFromCache(t2[4]);
|
|
1913
|
+
if ("NOT_IN_CACHE" !== s2.value) return s2;
|
|
1914
|
+
}
|
|
1915
|
+
} else if (s(t2, ["me", "conversations", "*", "participants", "*"])) {
|
|
1916
|
+
const e4 = this.storeMap[`/me/conversations/${t2[2]}/participants`];
|
|
1917
|
+
if (e4) {
|
|
1918
|
+
const s2 = yield e4.getParticipantFromCache(t2[4]);
|
|
1919
|
+
if ("NOT_IN_CACHE" !== s2.value) return s2;
|
|
1920
|
+
}
|
|
1921
|
+
} else if (s(t2, ["me", "conversations", "*"])) {
|
|
1922
|
+
const e4 = this.storeMap["/me/conversations"];
|
|
1923
|
+
if (e4) {
|
|
1924
|
+
const s2 = yield e4.getConvFromCache(t2[2]);
|
|
1925
|
+
if ("NOT_IN_CACHE" !== s2.value) return s2;
|
|
1642
1926
|
}
|
|
1643
1927
|
}
|
|
1644
1928
|
}
|
|
@@ -1680,86 +1964,49 @@ class fe {
|
|
|
1680
1964
|
}, a2;
|
|
1681
1965
|
}
|
|
1682
1966
|
getOrCreateStore(e2) {
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
});
|
|
1693
|
-
return this.userStores[t2] = e3, e3;
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
if (s(e2, ["me", "conversations", "*"])) {
|
|
1697
|
-
const t2 = e2[2];
|
|
1698
|
-
if (Object.hasOwnProperty.call(this.conversationStores, t2)) return this.conversationStores[t2];
|
|
1699
|
-
{
|
|
1700
|
-
this.connection.subscribe(["me", "conversations", t2]).then((t3) => {
|
|
1701
|
-
t3.ok || e3.setError(t3);
|
|
1702
|
-
});
|
|
1703
|
-
const e3 = new ce(this.emitMutex, t2, this.realtimeClient, () => {
|
|
1704
|
-
delete this.conversationStores[t2], this.connection.unsubscribe(["me", "conversations", t2]);
|
|
1705
|
-
});
|
|
1706
|
-
return this.conversationStores[t2] = e3, e3;
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
if (s(e2, ["me", "conversations", "*", "messages"])) {
|
|
1710
|
-
const t2 = e2[2];
|
|
1711
|
-
if (Object.hasOwnProperty.call(this.messageWindowStores, t2)) return this.messageWindowStores[t2];
|
|
1712
|
-
{
|
|
1713
|
-
this.connection.subscribe(["me", "conversations", t2, "messages"]).then((t3) => {
|
|
1714
|
-
t3.ok || e3.setError(t3);
|
|
1715
|
-
});
|
|
1716
|
-
const e3 = new ie(this.emitMutex, t2, this.realtimeClient, () => {
|
|
1717
|
-
delete this.messageWindowStores[t2], this.connection.unsubscribe(["me", "conversations", t2, "messages"]);
|
|
1718
|
-
});
|
|
1719
|
-
return this.messageWindowStores[t2] = e3, e3;
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
if (s(e2, ["me", "conversations", "*", "typing"])) {
|
|
1723
|
-
const t2 = e2[2];
|
|
1724
|
-
if (Object.hasOwnProperty.call(this.typingStores, t2)) return this.typingStores[t2];
|
|
1725
|
-
{
|
|
1726
|
-
this.connection.subscribe(["me", "conversations", t2, "typing"]).then((t3) => {
|
|
1727
|
-
t3.ok || e3.setError(t3);
|
|
1728
|
-
});
|
|
1729
|
-
const e3 = new pe(t2, this.realtimeClient, this.emitMutex, () => {
|
|
1730
|
-
delete this.typingStores[t2], this.connection.unsubscribe(["me", "conversations", t2, "typing"]);
|
|
1731
|
-
});
|
|
1732
|
-
return this.typingStores[t2] = e3, e3;
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
throw new Error("Unrecognised subscribe path: " + e2);
|
|
1736
|
-
}
|
|
1737
|
-
getStoreIfExists(e2) {
|
|
1738
|
-
var _a2, _b, _c;
|
|
1739
|
-
if (s(e2, ["users", "*"])) {
|
|
1740
|
-
const t2 = e2[1];
|
|
1741
|
-
return (_a2 = this.userStores[t2]) != null ? _a2 : null;
|
|
1742
|
-
}
|
|
1743
|
-
if (s(e2, ["me", "conversations", "*", "messages"])) {
|
|
1744
|
-
const t2 = e2[2];
|
|
1745
|
-
return (_b = this.messageWindowStores[t2]) != null ? _b : null;
|
|
1746
|
-
}
|
|
1747
|
-
if (s(e2, ["me", "conversations", "*", "typing"])) {
|
|
1748
|
-
const t2 = e2[2];
|
|
1749
|
-
return (_c = this.typingStores[t2]) != null ? _c : null;
|
|
1750
|
-
}
|
|
1751
|
-
throw new Error("Unrecognised subscribe path: " + e2);
|
|
1967
|
+
const t2 = Ae(e2);
|
|
1968
|
+
if (t2 in this.storeMap) return this.storeMap[t2];
|
|
1969
|
+
this.connection.subscribe(e2).then((e3) => {
|
|
1970
|
+
e3.ok || s2.setError(e3);
|
|
1971
|
+
});
|
|
1972
|
+
const s2 = this.instantiateStore(e2, () => {
|
|
1973
|
+
delete this.storeMap[t2], this.connection.unsubscribe(e2);
|
|
1974
|
+
});
|
|
1975
|
+
return this.storeMap[t2] = s2, s2;
|
|
1752
1976
|
}
|
|
1753
1977
|
destroy() {
|
|
1754
|
-
this.
|
|
1978
|
+
this.storeMap = {}, this.convDataStores = {}, this.connection.destroy();
|
|
1755
1979
|
}
|
|
1756
1980
|
isConnected() {
|
|
1757
1981
|
return this.connection.isConnected();
|
|
1758
1982
|
}
|
|
1983
|
+
instantiateStore(e2, t2) {
|
|
1984
|
+
if (s(e2, ["users", "*"])) return new G(e2[1], this.realtimeClient, this.emitMutex, t2);
|
|
1985
|
+
if (s(e2, ["me", "conversations", "*"])) return new ue(this.subscribeConvData(e2[2]), this.realtimeClient, this.emitMutex, t2);
|
|
1986
|
+
if (s(e2, ["me", "conversations", "*", "messages"])) return new ie(e2[2], this.realtimeClient, this.emitMutex, t2);
|
|
1987
|
+
if (s(e2, ["me", "conversations", "*", "participants"])) return new pe(e2[2], this.realtimeClient, this.emitMutex, t2);
|
|
1988
|
+
if (s(e2, ["me", "conversations", "*", "typing"])) return new he(e2[2], this.realtimeClient, this.emitMutex, t2);
|
|
1989
|
+
if (s(e2, ["me", "conversations"])) return new ge((e3) => this.subscribeConvData(e3), this.realtimeClient, this.emitMutex, t2);
|
|
1990
|
+
throw "Unreachable";
|
|
1991
|
+
}
|
|
1992
|
+
subscribeConvData(e2) {
|
|
1993
|
+
const t2 = "string" == typeof e2 ? e2 : e2.id;
|
|
1994
|
+
if (Object.hasOwnProperty.call(this.convDataStores, t2)) {
|
|
1995
|
+
const e3 = this.convDataStores[t2];
|
|
1996
|
+
return { store: e3, unsubscribe: e3.registerInternalSubscription() };
|
|
1997
|
+
}
|
|
1998
|
+
const s2 = new be(e2, this.realtimeClient, this.emitMutex, () => {
|
|
1999
|
+
delete this.convDataStores[t2];
|
|
2000
|
+
});
|
|
2001
|
+
return this.convDataStores[t2] = s2, { store: s2, unsubscribe: s2.registerInternalSubscription() };
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
function Ae(e2) {
|
|
2005
|
+
return `/${e2.join("/")}`;
|
|
1759
2006
|
}
|
|
1760
|
-
class
|
|
2007
|
+
class Ee {
|
|
1761
2008
|
constructor(e2, t2, s2) {
|
|
1762
|
-
this.userId = t2, this.alive = true, this.connection = new
|
|
2009
|
+
this.userId = t2, this.alive = true, this.connection = new Ce(e2, s2, this), s2.onTokenRefreshFailed(() => {
|
|
1763
2010
|
this.destroy();
|
|
1764
2011
|
});
|
|
1765
2012
|
}
|
|
@@ -1784,7 +2031,7 @@ class ge {
|
|
|
1784
2031
|
listMessages(e2, t2) {
|
|
1785
2032
|
return __async(this, null, function* () {
|
|
1786
2033
|
const s2 = yield this.call("GET", ["me", "conversations", e2, "messages"], t2);
|
|
1787
|
-
if (!s2.ok) return
|
|
2034
|
+
if (!s2.ok) return ke(s2, "Listing messages in " + e2);
|
|
1788
2035
|
const n2 = s2.value.data.data, r2 = yield Promise.all(n2.map((t3) => this.createMessageSnapshot(t3, e2))), i2 = r2.find((e3) => !e3.ok);
|
|
1789
2036
|
if (void 0 !== i2 && !i2.ok) return i2;
|
|
1790
2037
|
return c(r2.map(({ value: e3 }) => e3));
|
|
@@ -1797,7 +2044,7 @@ class ge {
|
|
|
1797
2044
|
return { id: e2.id, name: e2.name, custom: e2.custom, locale: e2.locale, photoUrl: e2.photoUrl, role: e2.role, welcomeMessage: e2.welcomeMessage };
|
|
1798
2045
|
}
|
|
1799
2046
|
createParticipantSnapshotPreloaded(e2, t2) {
|
|
1800
|
-
return
|
|
2047
|
+
return { user: t2, access: e2.access, notify: e2.notify, joinedAt: e2.joinedAt };
|
|
1801
2048
|
}
|
|
1802
2049
|
createMessageSnapshot(e2, t2) {
|
|
1803
2050
|
return __async(this, null, function* () {
|
|
@@ -1813,7 +2060,7 @@ class ge {
|
|
|
1813
2060
|
const s2 = yield this.call("GET", ["me", "conversations", e2, "messages", t2], {});
|
|
1814
2061
|
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return c(null);
|
|
1815
2062
|
if (!s2.ok && "server" === s2.where && 403 === s2.value.status && "NOT_A_PARTICIPANT" === s2.value.errorCode) return c(null);
|
|
1816
|
-
if (!s2.ok) return
|
|
2063
|
+
if (!s2.ok) return ke(s2, `Fetching referenced message ${t2} in conversation ${e2}`);
|
|
1817
2064
|
const n2 = s2.value.data, r2 = yield this.getUser(n2.senderId);
|
|
1818
2065
|
if (!r2.ok) return r2;
|
|
1819
2066
|
const i2 = r2.value;
|
|
@@ -1824,7 +2071,7 @@ class ge {
|
|
|
1824
2071
|
return __async(this, null, function* () {
|
|
1825
2072
|
const t2 = yield this.call("GET", ["users", e2], { includePrivateFields: false });
|
|
1826
2073
|
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return c(null);
|
|
1827
|
-
if (!t2.ok) return
|
|
2074
|
+
if (!t2.ok) return ke(t2, "Get user " + e2);
|
|
1828
2075
|
return c(this.createUserSnapshot(t2.value.data));
|
|
1829
2076
|
});
|
|
1830
2077
|
}
|
|
@@ -1835,15 +2082,15 @@ class ge {
|
|
|
1835
2082
|
return { id: e2.id, type: e2.type, sender: t2, referencedMessageId: e2.referencedMessageId, custom: e2.custom, createdAt: e2.createdAt, editedAt: e2.editedAt, origin: e2.origin, content: e2.content, plaintext: te(e2.content, {}) };
|
|
1836
2083
|
}
|
|
1837
2084
|
}
|
|
1838
|
-
function
|
|
2085
|
+
function ke(e2, t2) {
|
|
1839
2086
|
return "server" === e2.where ? h(__spreadProps(__spreadValues({}, e2.value), { operation: t2 })) : e2;
|
|
1840
2087
|
}
|
|
1841
|
-
function
|
|
2088
|
+
function xe(e2, s2) {
|
|
1842
2089
|
var _a2;
|
|
1843
2090
|
if (s2.ok) return s2.value;
|
|
1844
2091
|
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));
|
|
1845
2092
|
}
|
|
1846
|
-
class
|
|
2093
|
+
class Te {
|
|
1847
2094
|
constructor(e2, t2) {
|
|
1848
2095
|
this.id = e2, this._realtimeClient = t2;
|
|
1849
2096
|
}
|
|
@@ -1853,7 +2100,7 @@ class be {
|
|
|
1853
2100
|
get() {
|
|
1854
2101
|
return __async(this, null, function* () {
|
|
1855
2102
|
const e2 = yield this._realtimeClient.getUser(this.brandedId);
|
|
1856
|
-
return
|
|
2103
|
+
return xe("Get user " + this.id, e2);
|
|
1857
2104
|
});
|
|
1858
2105
|
}
|
|
1859
2106
|
set(t2) {
|
|
@@ -1874,7 +2121,7 @@ class be {
|
|
|
1874
2121
|
return this._realtimeClient.subscribe(["users", this.brandedId], e2);
|
|
1875
2122
|
}
|
|
1876
2123
|
}
|
|
1877
|
-
class
|
|
2124
|
+
class Se {
|
|
1878
2125
|
constructor(e2, t2, s2) {
|
|
1879
2126
|
this.userId = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
1880
2127
|
}
|
|
@@ -1918,7 +2165,7 @@ class ye {
|
|
|
1918
2165
|
});
|
|
1919
2166
|
}
|
|
1920
2167
|
}
|
|
1921
|
-
function
|
|
2168
|
+
function Ie(e2) {
|
|
1922
2169
|
const t2 = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
|
|
1923
2170
|
let s2 = 0;
|
|
1924
2171
|
const n2 = [], r2 = e2 === s2;
|
|
@@ -1936,7 +2183,7 @@ function we(e2) {
|
|
|
1936
2183
|
if (20 != a2.length) throw new Error("Length should be 20.");
|
|
1937
2184
|
return a2;
|
|
1938
2185
|
}
|
|
1939
|
-
const
|
|
2186
|
+
const De = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
1940
2187
|
return e3.reduce((e4, s3, n2) => e4.concat(t3(s3, n2)), []);
|
|
1941
2188
|
}(e2, (e3) => {
|
|
1942
2189
|
if ("string" == typeof e3) return t2(e3, s2);
|
|
@@ -1949,14 +2196,14 @@ const Ae = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
1949
2196
|
case "bulletList":
|
|
1950
2197
|
case "bulletpoint":
|
|
1951
2198
|
case "bulletPoint":
|
|
1952
|
-
return [{ type: e3.type, children:
|
|
2199
|
+
return [{ type: e3.type, children: De(e3.children, t2, e3.type) }];
|
|
1953
2200
|
case "link":
|
|
1954
|
-
return [{ type: e3.type, url: e3.url, children:
|
|
2201
|
+
return [{ type: e3.type, url: e3.url, children: De(e3.children, t2, e3.type) }];
|
|
1955
2202
|
case "actionlink":
|
|
1956
2203
|
case "actionLink":
|
|
1957
2204
|
case "actionbutton":
|
|
1958
2205
|
case "actionButton":
|
|
1959
|
-
return [{ type: e3.type, action: e3.action, params: e3.params, children:
|
|
2206
|
+
return [{ type: e3.type, action: e3.action, params: e3.params, children: De(e3.children, t2, e3.type) }];
|
|
1960
2207
|
case "mention":
|
|
1961
2208
|
case "autolink":
|
|
1962
2209
|
case "autoLink":
|
|
@@ -1971,7 +2218,7 @@ const Ae = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
1971
2218
|
return [e3];
|
|
1972
2219
|
}
|
|
1973
2220
|
});
|
|
1974
|
-
function
|
|
2221
|
+
function Me(e2, t2) {
|
|
1975
2222
|
return (s2) => {
|
|
1976
2223
|
const n2 = s2;
|
|
1977
2224
|
let r2 = 0;
|
|
@@ -1984,29 +2231,29 @@ function Ce(e2, t2) {
|
|
|
1984
2231
|
return r2 < s2.length && i2.push(s2.substring(r2)), i2;
|
|
1985
2232
|
};
|
|
1986
2233
|
}
|
|
1987
|
-
const
|
|
1988
|
-
var
|
|
1989
|
-
const
|
|
2234
|
+
const Fe = "’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2235
|
+
var Be = ((e2) => (e2[e2.italic = 1] = "italic", e2[e2.strikethrough = 2] = "strikethrough", e2[e2.bold = 4] = "bold", e2))(Be || {});
|
|
2236
|
+
const Re = [0, 1, 2, 3, 4, 5, 6].map((e2) => {
|
|
1990
2237
|
const t2 = [];
|
|
1991
2238
|
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");
|
|
1992
|
-
}),
|
|
1993
|
-
function
|
|
1994
|
-
return
|
|
2239
|
+
}), Ne = { _: 1, "*": 4, "~": 2 };
|
|
2240
|
+
function Pe(e2) {
|
|
2241
|
+
return _e(e2, 0);
|
|
1995
2242
|
}
|
|
1996
|
-
function
|
|
1997
|
-
const s2 =
|
|
1998
|
-
const t3 =
|
|
2243
|
+
function _e(e2, t2 = 0) {
|
|
2244
|
+
const s2 = Re[t2], n2 = s2 ? function(e3) {
|
|
2245
|
+
const t3 = Oe.getOrCompute(e3, () => new RegExp(`(?:^|[\\s${Fe}])(?:${e3.source})(?=[\\s${Fe}]|$)`, "g")), s3 = Me(t3, (e4) => {
|
|
1999
2246
|
const t4 = e4[0][1], s4 = e4[1] || e4[2] || e4[3] || e4[4] || e4[5] || e4[6];
|
|
2000
|
-
return [" ", { type:
|
|
2247
|
+
return [" ", { type: Be[Ne[t4]], children: [s4] }];
|
|
2001
2248
|
});
|
|
2002
2249
|
return (e4) => {
|
|
2003
2250
|
const [t4, ...n3] = s3(" " + e4);
|
|
2004
2251
|
return t4.length > 1 && n3.unshift(t4.substring(1)), n3;
|
|
2005
2252
|
};
|
|
2006
2253
|
}(s2) : () => [e2];
|
|
2007
|
-
return
|
|
2254
|
+
return De(n2(e2), (e3, s3) => "bold" === s3 || "italic" === s3 || "strikethrough" === s3 ? _e(e3, t2 | Be[s3]) : [e3]);
|
|
2008
2255
|
}
|
|
2009
|
-
const
|
|
2256
|
+
const Oe = function() {
|
|
2010
2257
|
const e2 = function() {
|
|
2011
2258
|
try {
|
|
2012
2259
|
return /* @__PURE__ */ new WeakMap();
|
|
@@ -2022,18 +2269,18 @@ const Ie = function() {
|
|
|
2022
2269
|
return e2.set(t2, n2), n2;
|
|
2023
2270
|
} };
|
|
2024
2271
|
}();
|
|
2025
|
-
function
|
|
2272
|
+
function Ue(e2, t2) {
|
|
2026
2273
|
if (Array.prototype.indexOf) return e2.indexOf(t2);
|
|
2027
2274
|
for (var s2 = 0, n2 = e2.length; s2 < n2; s2++) if (e2[s2] === t2) return s2;
|
|
2028
2275
|
return -1;
|
|
2029
2276
|
}
|
|
2030
|
-
function
|
|
2277
|
+
function je(e2, t2) {
|
|
2031
2278
|
for (var s2 = e2.length - 1; s2 >= 0; s2--) true === t2(e2[s2]) && e2.splice(s2, 1);
|
|
2032
2279
|
}
|
|
2033
|
-
function
|
|
2280
|
+
function $e(e2) {
|
|
2034
2281
|
throw new Error("Unhandled case for value: '" + e2 + "'");
|
|
2035
2282
|
}
|
|
2036
|
-
var
|
|
2283
|
+
var We = function() {
|
|
2037
2284
|
function e2(e3) {
|
|
2038
2285
|
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 || "";
|
|
2039
2286
|
}
|
|
@@ -2052,11 +2299,11 @@ var Re = function() {
|
|
|
2052
2299
|
}, e2.prototype.setClass = function(e3) {
|
|
2053
2300
|
return this.setAttr("class", e3);
|
|
2054
2301
|
}, e2.prototype.addClass = function(e3) {
|
|
2055
|
-
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], i2 = e3.split(n2); t2 = i2.shift(); ) -1 ===
|
|
2302
|
+
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], i2 = e3.split(n2); t2 = i2.shift(); ) -1 === Ue(r2, t2) && r2.push(t2);
|
|
2056
2303
|
return this.getAttrs().class = r2.join(" "), this;
|
|
2057
2304
|
}, e2.prototype.removeClass = function(e3) {
|
|
2058
2305
|
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], i2 = e3.split(n2); r2.length && (t2 = i2.shift()); ) {
|
|
2059
|
-
var a2 =
|
|
2306
|
+
var a2 = Ue(r2, t2);
|
|
2060
2307
|
-1 !== a2 && r2.splice(a2, 1);
|
|
2061
2308
|
}
|
|
2062
2309
|
return this.getAttrs().class = r2.join(" "), this;
|
|
@@ -2082,12 +2329,12 @@ var Re = function() {
|
|
|
2082
2329
|
return t2.join(" ");
|
|
2083
2330
|
}, e2;
|
|
2084
2331
|
}();
|
|
2085
|
-
var
|
|
2332
|
+
var qe = function() {
|
|
2086
2333
|
function e2(e3) {
|
|
2087
2334
|
void 0 === e3 && (e3 = {}), this.newWindow = false, this.truncate = {}, this.className = "", this.newWindow = e3.newWindow || false, this.truncate = e3.truncate || {}, this.className = e3.className || "";
|
|
2088
2335
|
}
|
|
2089
2336
|
return e2.prototype.build = function(e3) {
|
|
2090
|
-
return new
|
|
2337
|
+
return new We({ tagName: "a", attrs: this.createAttrs(e3), innerHtml: this.processAnchorText(e3.getAnchorText()) });
|
|
2091
2338
|
}, e2.prototype.createAttrs = function(e3) {
|
|
2092
2339
|
var t2 = { href: e3.getAnchorHref() }, s2 = this.createCssClass(e3);
|
|
2093
2340
|
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;
|
|
@@ -2157,7 +2404,7 @@ var Ne = function() {
|
|
|
2157
2404
|
}(e4, t3, s3);
|
|
2158
2405
|
}(e3, s2);
|
|
2159
2406
|
}, e2;
|
|
2160
|
-
}(),
|
|
2407
|
+
}(), He = function() {
|
|
2161
2408
|
function e2(e3) {
|
|
2162
2409
|
this.__jsduckDummyDocProp = null, this.matchedText = "", this.offset = 0, this.tagBuilder = e3.tagBuilder, this.matchedText = e3.matchedText, this.offset = e3.offset;
|
|
2163
2410
|
}
|
|
@@ -2172,30 +2419,30 @@ var Ne = function() {
|
|
|
2172
2419
|
}, e2.prototype.buildTag = function() {
|
|
2173
2420
|
return this.tagBuilder.build(this);
|
|
2174
2421
|
}, e2;
|
|
2175
|
-
}(),
|
|
2176
|
-
return
|
|
2422
|
+
}(), Ge = function(e2, t2) {
|
|
2423
|
+
return Ge = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e3, t3) {
|
|
2177
2424
|
e3.__proto__ = t3;
|
|
2178
2425
|
} || function(e3, t3) {
|
|
2179
2426
|
for (var s2 in t3) t3.hasOwnProperty(s2) && (e3[s2] = t3[s2]);
|
|
2180
|
-
},
|
|
2427
|
+
}, Ge(e2, t2);
|
|
2181
2428
|
};
|
|
2182
|
-
function
|
|
2429
|
+
function Le(e2, t2) {
|
|
2183
2430
|
function s2() {
|
|
2184
2431
|
this.constructor = e2;
|
|
2185
2432
|
}
|
|
2186
|
-
|
|
2433
|
+
Ge(e2, t2), e2.prototype = null === t2 ? Object.create(t2) : (s2.prototype = t2.prototype, new s2());
|
|
2187
2434
|
}
|
|
2188
|
-
var
|
|
2189
|
-
return
|
|
2435
|
+
var ze, Je = function() {
|
|
2436
|
+
return Je = Object.assign || function(e2) {
|
|
2190
2437
|
for (var t2, s2 = 1, n2 = arguments.length; s2 < n2; s2++) for (var r2 in t2 = arguments[s2]) Object.prototype.hasOwnProperty.call(t2, r2) && (e2[r2] = t2[r2]);
|
|
2191
2438
|
return e2;
|
|
2192
|
-
},
|
|
2193
|
-
},
|
|
2439
|
+
}, Je.apply(this, arguments);
|
|
2440
|
+
}, Ye = function(e2) {
|
|
2194
2441
|
function t2(t3) {
|
|
2195
2442
|
var s2 = e2.call(this, t3) || this;
|
|
2196
2443
|
return s2.email = "", s2.email = t3.email, s2;
|
|
2197
2444
|
}
|
|
2198
|
-
return
|
|
2445
|
+
return Le(t2, e2), t2.prototype.getType = function() {
|
|
2199
2446
|
return "email";
|
|
2200
2447
|
}, t2.prototype.getEmail = function() {
|
|
2201
2448
|
return this.email;
|
|
@@ -2204,12 +2451,12 @@ var Ue, je = function() {
|
|
|
2204
2451
|
}, t2.prototype.getAnchorText = function() {
|
|
2205
2452
|
return this.email;
|
|
2206
2453
|
}, t2;
|
|
2207
|
-
}(
|
|
2454
|
+
}(He), Qe = function(e2) {
|
|
2208
2455
|
function t2(t3) {
|
|
2209
2456
|
var s2 = e2.call(this, t3) || this;
|
|
2210
2457
|
return s2.serviceName = "", s2.hashtag = "", s2.serviceName = t3.serviceName, s2.hashtag = t3.hashtag, s2;
|
|
2211
2458
|
}
|
|
2212
|
-
return
|
|
2459
|
+
return Le(t2, e2), t2.prototype.getType = function() {
|
|
2213
2460
|
return "hashtag";
|
|
2214
2461
|
}, t2.prototype.getServiceName = function() {
|
|
2215
2462
|
return this.serviceName;
|
|
@@ -2230,12 +2477,12 @@ var Ue, je = function() {
|
|
|
2230
2477
|
}, t2.prototype.getAnchorText = function() {
|
|
2231
2478
|
return "#" + this.hashtag;
|
|
2232
2479
|
}, t2;
|
|
2233
|
-
}(
|
|
2480
|
+
}(He), Ve = function(e2) {
|
|
2234
2481
|
function t2(t3) {
|
|
2235
2482
|
var s2 = e2.call(this, t3) || this;
|
|
2236
2483
|
return s2.serviceName = "twitter", s2.mention = "", s2.mention = t3.mention, s2.serviceName = t3.serviceName, s2;
|
|
2237
2484
|
}
|
|
2238
|
-
return
|
|
2485
|
+
return Le(t2, e2), t2.prototype.getType = function() {
|
|
2239
2486
|
return "mention";
|
|
2240
2487
|
}, t2.prototype.getMention = function() {
|
|
2241
2488
|
return this.mention;
|
|
@@ -2258,12 +2505,12 @@ var Ue, je = function() {
|
|
|
2258
2505
|
var t3 = e2.prototype.getCssClassSuffixes.call(this), s2 = this.getServiceName();
|
|
2259
2506
|
return s2 && t3.push(s2), t3;
|
|
2260
2507
|
}, t2;
|
|
2261
|
-
}(
|
|
2508
|
+
}(He), Ze = function(e2) {
|
|
2262
2509
|
function t2(t3) {
|
|
2263
2510
|
var s2 = e2.call(this, t3) || this;
|
|
2264
2511
|
return s2.number = "", s2.plusSign = false, s2.number = t3.number, s2.plusSign = t3.plusSign, s2;
|
|
2265
2512
|
}
|
|
2266
|
-
return
|
|
2513
|
+
return Le(t2, e2), t2.prototype.getType = function() {
|
|
2267
2514
|
return "phone";
|
|
2268
2515
|
}, t2.prototype.getPhoneNumber = function() {
|
|
2269
2516
|
return this.number;
|
|
@@ -2274,12 +2521,12 @@ var Ue, je = function() {
|
|
|
2274
2521
|
}, t2.prototype.getAnchorText = function() {
|
|
2275
2522
|
return this.matchedText;
|
|
2276
2523
|
}, t2;
|
|
2277
|
-
}(
|
|
2524
|
+
}(He), Ke = function(e2) {
|
|
2278
2525
|
function t2(t3) {
|
|
2279
2526
|
var s2 = e2.call(this, t3) || this;
|
|
2280
2527
|
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;
|
|
2281
2528
|
}
|
|
2282
|
-
return
|
|
2529
|
+
return Le(t2, e2), t2.prototype.getType = function() {
|
|
2283
2530
|
return "url";
|
|
2284
2531
|
}, t2.prototype.getUrlMatchType = function() {
|
|
2285
2532
|
return this.urlMatchType;
|
|
@@ -2307,19 +2554,19 @@ var Ue, je = function() {
|
|
|
2307
2554
|
return t3;
|
|
2308
2555
|
}
|
|
2309
2556
|
}, t2;
|
|
2310
|
-
}(
|
|
2557
|
+
}(He), Xe = function(e2) {
|
|
2311
2558
|
this.__jsduckDummyDocProp = null, this.tagBuilder = e2.tagBuilder;
|
|
2312
|
-
},
|
|
2313
|
-
return "(?=(" +
|
|
2314
|
-
},
|
|
2315
|
-
return "(?:" +
|
|
2316
|
-
}, ot = new RegExp("[" + st + "]"), ut = /(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/, ct = new RegExp("[" + st + "!#$%&'*+/=?^_`{|}~-]"), lt = new RegExp("^" + ut.source + "$"), ht = function(e2) {
|
|
2559
|
+
}, et = /[A-Za-z]/, tt = /[\d]/, st = /[\D]/, nt = /\s/, rt = /['"]/, it = /[\x00-\x1F\x7F]/, at = /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, ot = at + /\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, ut = /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, ct = ot + ut, lt = ot + ut, ht = "(?:[" + ut + "]{1,3}\\.){3}[" + ut + "]{1,3}", dt = "[" + lt + "](?:[" + lt + "\\-]{0,61}[" + lt + "])?", pt = function(e2) {
|
|
2560
|
+
return "(?=(" + dt + "))\\" + e2;
|
|
2561
|
+
}, ft = function(e2) {
|
|
2562
|
+
return "(?:" + pt(e2) + "(?:\\." + pt(e2 + 1) + "){0,126}|" + ht + ")";
|
|
2563
|
+
}, mt = new RegExp("[" + lt + "]"), gt = /(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/, vt = new RegExp("[" + lt + "!#$%&'*+/=?^_`{|}~-]"), wt = new RegExp("^" + gt.source + "$"), bt = function(e2) {
|
|
2317
2564
|
function t2() {
|
|
2318
2565
|
var t3 = null !== e2 && e2.apply(this, arguments) || this;
|
|
2319
|
-
return t3.localPartCharRegex =
|
|
2566
|
+
return t3.localPartCharRegex = vt, t3.strictTldRegex = wt, t3;
|
|
2320
2567
|
}
|
|
2321
|
-
return
|
|
2322
|
-
for (var t3 = this.tagBuilder, s2 = this.localPartCharRegex, n2 = this.strictTldRegex, r2 = [], i2 = e3.length, a2 = new
|
|
2568
|
+
return Le(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2569
|
+
for (var t3 = this.tagBuilder, s2 = this.localPartCharRegex, n2 = this.strictTldRegex, r2 = [], i2 = e3.length, a2 = new yt(), o2 = { m: "a", a: "i", i: "l", l: "t", t: "o", o: ":" }, u2 = 0, c2 = 0, l2 = a2; u2 < i2; ) {
|
|
2323
2570
|
var h2 = e3.charAt(u2);
|
|
2324
2571
|
switch (c2) {
|
|
2325
2572
|
case 0:
|
|
@@ -2332,57 +2579,57 @@ var Ue, je = function() {
|
|
|
2332
2579
|
f2(h2);
|
|
2333
2580
|
break;
|
|
2334
2581
|
case 3:
|
|
2335
|
-
|
|
2582
|
+
m2(h2);
|
|
2336
2583
|
break;
|
|
2337
2584
|
case 4:
|
|
2338
|
-
|
|
2585
|
+
g2(h2);
|
|
2339
2586
|
break;
|
|
2340
2587
|
case 5:
|
|
2341
2588
|
v2(h2);
|
|
2342
2589
|
break;
|
|
2343
2590
|
case 6:
|
|
2344
|
-
|
|
2591
|
+
w2(h2);
|
|
2345
2592
|
break;
|
|
2346
2593
|
case 7:
|
|
2347
|
-
|
|
2594
|
+
b2(h2);
|
|
2348
2595
|
break;
|
|
2349
2596
|
default:
|
|
2350
|
-
|
|
2597
|
+
$e(c2);
|
|
2351
2598
|
}
|
|
2352
2599
|
u2++;
|
|
2353
2600
|
}
|
|
2354
|
-
return
|
|
2601
|
+
return A2(), r2;
|
|
2355
2602
|
function d2(e4) {
|
|
2356
|
-
"m" === e4 ?
|
|
2603
|
+
"m" === e4 ? y2(1) : s2.test(e4) && y2();
|
|
2357
2604
|
}
|
|
2358
2605
|
function p2(e4, t4) {
|
|
2359
|
-
":" === e4 ? s2.test(t4) ? (c2 = 2, l2 = new
|
|
2606
|
+
":" === e4 ? s2.test(t4) ? (c2 = 2, l2 = new yt(Je(Je({}, l2), { hasMailtoPrefix: true }))) : C2() : o2[e4] === t4 || (s2.test(t4) ? c2 = 2 : "." === t4 ? c2 = 3 : "@" === t4 ? c2 = 4 : C2());
|
|
2360
2607
|
}
|
|
2361
2608
|
function f2(e4) {
|
|
2362
|
-
"." === e4 ? c2 = 3 : "@" === e4 ? c2 = 4 : s2.test(e4) ||
|
|
2363
|
-
}
|
|
2364
|
-
function g2(e4) {
|
|
2365
|
-
"." === e4 || "@" === e4 ? A2() : s2.test(e4) ? c2 = 2 : A2();
|
|
2609
|
+
"." === e4 ? c2 = 3 : "@" === e4 ? c2 = 4 : s2.test(e4) || C2();
|
|
2366
2610
|
}
|
|
2367
2611
|
function m2(e4) {
|
|
2368
|
-
|
|
2612
|
+
"." === e4 || "@" === e4 ? C2() : s2.test(e4) ? c2 = 2 : C2();
|
|
2613
|
+
}
|
|
2614
|
+
function g2(e4) {
|
|
2615
|
+
mt.test(e4) ? c2 = 5 : C2();
|
|
2369
2616
|
}
|
|
2370
2617
|
function v2(e4) {
|
|
2371
|
-
"." === e4 ? c2 = 7 : "-" === e4 ? c2 = 6 :
|
|
2618
|
+
"." === e4 ? c2 = 7 : "-" === e4 ? c2 = 6 : mt.test(e4) || A2();
|
|
2619
|
+
}
|
|
2620
|
+
function w2(e4) {
|
|
2621
|
+
"-" === e4 || "." === e4 ? A2() : mt.test(e4) ? c2 = 5 : A2();
|
|
2372
2622
|
}
|
|
2373
2623
|
function b2(e4) {
|
|
2374
|
-
"
|
|
2624
|
+
"." === e4 || "-" === e4 ? A2() : mt.test(e4) ? (c2 = 5, l2 = new yt(Je(Je({}, l2), { hasDomainDot: true }))) : A2();
|
|
2375
2625
|
}
|
|
2376
2626
|
function y2(e4) {
|
|
2377
|
-
|
|
2627
|
+
void 0 === e4 && (e4 = 2), c2 = e4, l2 = new yt({ idx: u2 });
|
|
2378
2628
|
}
|
|
2379
|
-
function
|
|
2380
|
-
void 0 === e4 && (e4 = 2), c2 = e4, l2 = new dt({ idx: u2 });
|
|
2381
|
-
}
|
|
2382
|
-
function A2() {
|
|
2629
|
+
function C2() {
|
|
2383
2630
|
c2 = 0, l2 = a2;
|
|
2384
2631
|
}
|
|
2385
|
-
function
|
|
2632
|
+
function A2() {
|
|
2386
2633
|
if (l2.hasDomainDot) {
|
|
2387
2634
|
var s3 = e3.slice(l2.idx, u2);
|
|
2388
2635
|
/[-.]$/.test(s3) && (s3 = s3.slice(0, -1));
|
|
@@ -2390,14 +2637,14 @@ var Ue, je = function() {
|
|
|
2390
2637
|
(function(e4) {
|
|
2391
2638
|
var t4 = e4.split(".").pop() || "", s4 = t4.toLowerCase();
|
|
2392
2639
|
return n2.test(s4);
|
|
2393
|
-
})(i3) && r2.push(new
|
|
2640
|
+
})(i3) && r2.push(new Ye({ tagBuilder: t3, matchedText: s3, offset: l2.idx, email: i3 }));
|
|
2394
2641
|
}
|
|
2395
|
-
|
|
2642
|
+
C2();
|
|
2396
2643
|
}
|
|
2397
2644
|
}, t2;
|
|
2398
|
-
}(
|
|
2645
|
+
}(Xe), yt = function(e2) {
|
|
2399
2646
|
void 0 === e2 && (e2 = {}), this.idx = void 0 !== e2.idx ? e2.idx : -1, this.hasMailtoPrefix = !!e2.hasMailtoPrefix, this.hasDomainDot = !!e2.hasDomainDot;
|
|
2400
|
-
},
|
|
2647
|
+
}, Ct = function() {
|
|
2401
2648
|
function e2() {
|
|
2402
2649
|
}
|
|
2403
2650
|
return e2.isValid = function(e3, t2) {
|
|
@@ -2415,32 +2662,32 @@ var Ue, je = function() {
|
|
|
2415
2662
|
return !(!e3 || t2 && this.hasFullProtocolRegex.test(t2) || -1 !== e3.indexOf("."));
|
|
2416
2663
|
}, e2.urlMatchDoesNotHaveAtLeastOneWordChar = function(e3, t2) {
|
|
2417
2664
|
return !(!e3 || !t2) && (!this.hasFullProtocolRegex.test(t2) && !this.hasWordCharAfterProtocolRegex.test(e3));
|
|
2418
|
-
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" +
|
|
2419
|
-
}(),
|
|
2665
|
+
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" + at + "]"), 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;
|
|
2666
|
+
}(), At = (ze = new RegExp("[/?#](?:[" + lt + "\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*[" + lt + "\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"), new RegExp(["(?:", "(", /(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source, ft(2), ")", "|", "(", "(//)?", /(?:www\.)/.source, ft(6), ")", "|", "(", "(//)?", ft(10) + "\\.", gt.source, "(?![-" + ct + "])", ")", ")", "(?::[0-9]+)?", "(?:" + ze.source + ")?"].join(""), "gi")), Et = new RegExp("[" + lt + "]"), kt = function(e2) {
|
|
2420
2667
|
function t2(t3) {
|
|
2421
2668
|
var s2 = e2.call(this, t3) || this;
|
|
2422
|
-
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex =
|
|
2669
|
+
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex = At, s2.wordCharRegExp = Et, s2.stripPrefix = t3.stripPrefix, s2.stripTrailingSlash = t3.stripTrailingSlash, s2.decodePercentEncoding = t3.decodePercentEncoding, s2;
|
|
2423
2670
|
}
|
|
2424
|
-
return
|
|
2671
|
+
return Le(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2425
2672
|
for (var t3, s2 = this.matcherRegex, n2 = this.stripPrefix, r2 = this.stripTrailingSlash, i2 = this.decodePercentEncoding, a2 = this.tagBuilder, o2 = [], u2 = function() {
|
|
2426
|
-
var s3 = t3[0], u3 = t3[1], l2 = t3[4], h2 = t3[5], d2 = t3[9], p2 = t3.index, f2 = h2 || d2,
|
|
2427
|
-
if (!
|
|
2428
|
-
if (p2 > 0 && "@" ===
|
|
2429
|
-
if (p2 > 0 && f2 && c2.wordCharRegExp.test(
|
|
2673
|
+
var s3 = t3[0], u3 = t3[1], l2 = t3[4], h2 = t3[5], d2 = t3[9], p2 = t3.index, f2 = h2 || d2, m2 = e3.charAt(p2 - 1);
|
|
2674
|
+
if (!Ct.isValid(s3, u3)) return "continue";
|
|
2675
|
+
if (p2 > 0 && "@" === m2) return "continue";
|
|
2676
|
+
if (p2 > 0 && f2 && c2.wordCharRegExp.test(m2)) return "continue";
|
|
2430
2677
|
if (/\?$/.test(s3) && (s3 = s3.substr(0, s3.length - 1)), c2.matchHasUnbalancedClosingParen(s3)) s3 = s3.substr(0, s3.length - 1);
|
|
2431
2678
|
else {
|
|
2432
|
-
var
|
|
2433
|
-
|
|
2679
|
+
var g2 = c2.matchHasInvalidCharAfterTld(s3, u3);
|
|
2680
|
+
g2 > -1 && (s3 = s3.substr(0, g2));
|
|
2434
2681
|
}
|
|
2435
2682
|
var v2 = ["http://", "https://"].find(function(e4) {
|
|
2436
2683
|
return !!u3 && -1 !== u3.indexOf(e4);
|
|
2437
2684
|
});
|
|
2438
2685
|
if (v2) {
|
|
2439
|
-
var
|
|
2440
|
-
s3 = s3.substr(
|
|
2686
|
+
var w2 = s3.indexOf(v2);
|
|
2687
|
+
s3 = s3.substr(w2), u3 = u3.substr(w2), p2 += w2;
|
|
2441
2688
|
}
|
|
2442
|
-
var
|
|
2443
|
-
o2.push(new
|
|
2689
|
+
var b2 = u3 ? "scheme" : l2 ? "www" : "tld", y2 = !!u3;
|
|
2690
|
+
o2.push(new Ke({ tagBuilder: a2, matchedText: s3, offset: p2, urlMatchType: b2, url: s3, protocolUrlMatch: y2, protocolRelativeMatch: !!f2, stripPrefix: n2, stripTrailingSlash: r2, decodePercentEncoding: i2 }));
|
|
2444
2691
|
}, c2 = this; null !== (t3 = s2.exec(e3)); ) u2();
|
|
2445
2692
|
return o2;
|
|
2446
2693
|
}, t2.prototype.matchHasUnbalancedClosingParen = function(e3) {
|
|
@@ -2460,83 +2707,83 @@ var Ue, je = function() {
|
|
|
2460
2707
|
if (!e3) return -1;
|
|
2461
2708
|
var s2 = 0;
|
|
2462
2709
|
t3 && (s2 = e3.indexOf(":"), e3 = e3.slice(s2));
|
|
2463
|
-
var n2 = new RegExp("^((.?//)?[-." +
|
|
2710
|
+
var n2 = new RegExp("^((.?//)?[-." + lt + "]*[-" + lt + "]\\.[-" + lt + "]+)").exec(e3);
|
|
2464
2711
|
return null === n2 ? -1 : (s2 += n2[1].length, e3 = e3.slice(n2[1].length), /^[^-.A-Za-z0-9:\/?#]/.test(e3) ? s2 : -1);
|
|
2465
2712
|
}, t2;
|
|
2466
|
-
}(
|
|
2713
|
+
}(Xe), xt = new RegExp("#[_" + lt + "]{1,139}(?![_" + lt + "])", "g"), Tt = new RegExp("[^" + lt + "]"), St = function(e2) {
|
|
2467
2714
|
function t2(t3) {
|
|
2468
2715
|
var s2 = e2.call(this, t3) || this;
|
|
2469
|
-
return s2.serviceName = "twitter", s2.matcherRegex =
|
|
2716
|
+
return s2.serviceName = "twitter", s2.matcherRegex = xt, s2.nonWordCharRegex = Tt, s2.serviceName = t3.serviceName, s2;
|
|
2470
2717
|
}
|
|
2471
|
-
return
|
|
2718
|
+
return Le(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2472
2719
|
for (var t3, s2 = this.matcherRegex, n2 = this.nonWordCharRegex, r2 = this.serviceName, i2 = this.tagBuilder, a2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
2473
2720
|
var o2 = t3.index, u2 = e3.charAt(o2 - 1);
|
|
2474
2721
|
if (0 === o2 || n2.test(u2)) {
|
|
2475
2722
|
var c2 = t3[0], l2 = t3[0].slice(1);
|
|
2476
|
-
a2.push(new
|
|
2723
|
+
a2.push(new Qe({ tagBuilder: i2, matchedText: c2, offset: o2, serviceName: r2, hashtag: l2 }));
|
|
2477
2724
|
}
|
|
2478
2725
|
}
|
|
2479
2726
|
return a2;
|
|
2480
2727
|
}, t2;
|
|
2481
|
-
}(
|
|
2728
|
+
}(Xe), It = new RegExp(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source + "|" + /(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source, "g"), Dt = function(e2) {
|
|
2482
2729
|
function t2() {
|
|
2483
2730
|
var t3 = null !== e2 && e2.apply(this, arguments) || this;
|
|
2484
|
-
return t3.matcherRegex =
|
|
2731
|
+
return t3.matcherRegex = It, t3;
|
|
2485
2732
|
}
|
|
2486
|
-
return
|
|
2733
|
+
return Le(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2487
2734
|
for (var t3, s2 = this.matcherRegex, n2 = this.tagBuilder, r2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
2488
2735
|
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/);
|
|
2489
|
-
this.testMatch(t3[3]) && this.testMatch(i2) && l2 && r2.push(new
|
|
2736
|
+
this.testMatch(t3[3]) && this.testMatch(i2) && l2 && r2.push(new Ze({ tagBuilder: n2, matchedText: i2, offset: t3.index, number: a2, plusSign: o2 }));
|
|
2490
2737
|
}
|
|
2491
2738
|
return r2;
|
|
2492
2739
|
}, t2.prototype.testMatch = function(e3) {
|
|
2493
|
-
return
|
|
2740
|
+
return st.test(e3);
|
|
2494
2741
|
}, t2;
|
|
2495
|
-
}(
|
|
2742
|
+
}(Xe), Mt = new RegExp("@[_" + lt + "]{1,50}(?![_" + lt + "])", "g"), Ft = new RegExp("@[_." + lt + "]{1,30}(?![_" + lt + "])", "g"), Bt = new RegExp("@[-_." + lt + "]{1,50}(?![-_" + lt + "])", "g"), Rt = new RegExp("[^" + lt + "]"), Nt = function(e2) {
|
|
2496
2743
|
function t2(t3) {
|
|
2497
2744
|
var s2 = e2.call(this, t3) || this;
|
|
2498
|
-
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter:
|
|
2745
|
+
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter: Mt, instagram: Ft, soundcloud: Bt }, s2.nonWordCharRegex = Rt, s2.serviceName = t3.serviceName, s2;
|
|
2499
2746
|
}
|
|
2500
|
-
return
|
|
2747
|
+
return Le(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2501
2748
|
var t3, s2 = this.serviceName, n2 = this.matcherRegexes[this.serviceName], r2 = this.nonWordCharRegex, i2 = this.tagBuilder, a2 = [];
|
|
2502
2749
|
if (!n2) return a2;
|
|
2503
2750
|
for (; null !== (t3 = n2.exec(e3)); ) {
|
|
2504
2751
|
var o2 = t3.index, u2 = e3.charAt(o2 - 1);
|
|
2505
2752
|
if (0 === o2 || r2.test(u2)) {
|
|
2506
2753
|
var c2 = t3[0].replace(/\.+$/g, ""), l2 = c2.slice(1);
|
|
2507
|
-
a2.push(new
|
|
2754
|
+
a2.push(new Ve({ tagBuilder: i2, matchedText: c2, offset: o2, serviceName: s2, mention: l2 }));
|
|
2508
2755
|
}
|
|
2509
2756
|
}
|
|
2510
2757
|
return a2;
|
|
2511
2758
|
}, t2;
|
|
2512
|
-
}(
|
|
2513
|
-
function
|
|
2514
|
-
for (var s2, n2 = t2.onOpenTag, r2 = t2.onCloseTag, i2 = t2.onText, a2 = t2.onComment, o2 = t2.onDoctype, u2 = new
|
|
2759
|
+
}(Xe);
|
|
2760
|
+
function Pt(e2, t2) {
|
|
2761
|
+
for (var s2, n2 = t2.onOpenTag, r2 = t2.onCloseTag, i2 = t2.onText, a2 = t2.onComment, o2 = t2.onDoctype, u2 = new _t(), c2 = 0, l2 = e2.length, h2 = 0, d2 = 0, p2 = u2; c2 < l2; ) {
|
|
2515
2762
|
var f2 = e2.charAt(c2);
|
|
2516
2763
|
switch (h2) {
|
|
2517
2764
|
case 0:
|
|
2518
|
-
|
|
2765
|
+
m2(f2);
|
|
2519
2766
|
break;
|
|
2520
2767
|
case 1:
|
|
2521
|
-
|
|
2768
|
+
g2(f2);
|
|
2522
2769
|
break;
|
|
2523
2770
|
case 2:
|
|
2524
|
-
|
|
2771
|
+
w2(f2);
|
|
2525
2772
|
break;
|
|
2526
2773
|
case 3:
|
|
2527
2774
|
v2(f2);
|
|
2528
2775
|
break;
|
|
2529
2776
|
case 4:
|
|
2530
|
-
|
|
2777
|
+
b2(f2);
|
|
2531
2778
|
break;
|
|
2532
2779
|
case 5:
|
|
2533
|
-
|
|
2780
|
+
y2(f2);
|
|
2534
2781
|
break;
|
|
2535
2782
|
case 6:
|
|
2536
|
-
|
|
2783
|
+
C2(f2);
|
|
2537
2784
|
break;
|
|
2538
2785
|
case 7:
|
|
2539
|
-
|
|
2786
|
+
A2(f2);
|
|
2540
2787
|
break;
|
|
2541
2788
|
case 8:
|
|
2542
2789
|
E2(f2);
|
|
@@ -2548,25 +2795,25 @@ function Tt(e2, t2) {
|
|
|
2548
2795
|
x2(f2);
|
|
2549
2796
|
break;
|
|
2550
2797
|
case 11:
|
|
2551
|
-
|
|
2798
|
+
T2(f2);
|
|
2552
2799
|
break;
|
|
2553
2800
|
case 12:
|
|
2554
|
-
|
|
2801
|
+
S2(f2);
|
|
2555
2802
|
break;
|
|
2556
2803
|
case 13:
|
|
2557
|
-
|
|
2804
|
+
I2();
|
|
2558
2805
|
break;
|
|
2559
2806
|
case 14:
|
|
2560
|
-
|
|
2807
|
+
D2(f2);
|
|
2561
2808
|
break;
|
|
2562
2809
|
case 15:
|
|
2563
|
-
|
|
2810
|
+
M2(f2);
|
|
2564
2811
|
break;
|
|
2565
2812
|
case 16:
|
|
2566
|
-
|
|
2813
|
+
F2(f2);
|
|
2567
2814
|
break;
|
|
2568
2815
|
case 17:
|
|
2569
|
-
|
|
2816
|
+
B2(f2);
|
|
2570
2817
|
break;
|
|
2571
2818
|
case 18:
|
|
2572
2819
|
R2(f2);
|
|
@@ -2578,33 +2825,33 @@ function Tt(e2, t2) {
|
|
|
2578
2825
|
P2(f2);
|
|
2579
2826
|
break;
|
|
2580
2827
|
default:
|
|
2581
|
-
|
|
2828
|
+
$e(h2);
|
|
2582
2829
|
}
|
|
2583
2830
|
c2++;
|
|
2584
2831
|
}
|
|
2585
|
-
function
|
|
2832
|
+
function m2(e3) {
|
|
2586
2833
|
"<" === e3 && O2();
|
|
2587
2834
|
}
|
|
2588
|
-
function
|
|
2589
|
-
"!" === e3 ? h2 = 13 : "/" === e3 ? (h2 = 2, p2 = new
|
|
2835
|
+
function g2(e3) {
|
|
2836
|
+
"!" === e3 ? h2 = 13 : "/" === e3 ? (h2 = 2, p2 = new _t(Je(Je({}, p2), { isClosing: true }))) : "<" === e3 ? O2() : et.test(e3) ? (h2 = 3, p2 = new _t(Je(Je({}, p2), { isOpening: true }))) : (h2 = 0, p2 = u2);
|
|
2590
2837
|
}
|
|
2591
2838
|
function v2(e3) {
|
|
2592
|
-
|
|
2839
|
+
nt.test(e3) ? (p2 = new _t(Je(Je({}, p2), { name: j2() })), h2 = 4) : "<" === e3 ? O2() : "/" === e3 ? (p2 = new _t(Je(Je({}, p2), { name: j2() })), h2 = 12) : ">" === e3 ? (p2 = new _t(Je(Je({}, p2), { name: j2() })), U2()) : et.test(e3) || tt.test(e3) || ":" === e3 || _2();
|
|
2840
|
+
}
|
|
2841
|
+
function w2(e3) {
|
|
2842
|
+
">" === e3 ? _2() : et.test(e3) ? h2 = 3 : _2();
|
|
2593
2843
|
}
|
|
2594
2844
|
function b2(e3) {
|
|
2595
|
-
">" === e3 ?
|
|
2845
|
+
nt.test(e3) || ("/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? O2() : "=" === e3 || rt.test(e3) || it.test(e3) ? _2() : h2 = 5);
|
|
2596
2846
|
}
|
|
2597
2847
|
function y2(e3) {
|
|
2598
|
-
|
|
2848
|
+
nt.test(e3) ? h2 = 6 : "/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? U2() : "<" === e3 ? O2() : rt.test(e3) && _2();
|
|
2599
2849
|
}
|
|
2600
|
-
function
|
|
2601
|
-
|
|
2850
|
+
function C2(e3) {
|
|
2851
|
+
nt.test(e3) || ("/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? U2() : "<" === e3 ? O2() : rt.test(e3) ? _2() : h2 = 5);
|
|
2602
2852
|
}
|
|
2603
2853
|
function A2(e3) {
|
|
2604
|
-
|
|
2605
|
-
}
|
|
2606
|
-
function C2(e3) {
|
|
2607
|
-
Qe.test(e3) || ('"' === e3 ? h2 = 8 : "'" === e3 ? h2 = 9 : /[>=`]/.test(e3) ? _2() : "<" === e3 ? O2() : h2 = 10);
|
|
2854
|
+
nt.test(e3) || ('"' === e3 ? h2 = 8 : "'" === e3 ? h2 = 9 : /[>=`]/.test(e3) ? _2() : "<" === e3 ? O2() : h2 = 10);
|
|
2608
2855
|
}
|
|
2609
2856
|
function E2(e3) {
|
|
2610
2857
|
'"' === e3 && (h2 = 11);
|
|
@@ -2613,27 +2860,27 @@ function Tt(e2, t2) {
|
|
|
2613
2860
|
"'" === e3 && (h2 = 11);
|
|
2614
2861
|
}
|
|
2615
2862
|
function x2(e3) {
|
|
2616
|
-
|
|
2617
|
-
}
|
|
2618
|
-
function S2(e3) {
|
|
2619
|
-
Qe.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? O2() : (h2 = 4, c2--);
|
|
2863
|
+
nt.test(e3) ? h2 = 4 : ">" === e3 ? U2() : "<" === e3 && O2();
|
|
2620
2864
|
}
|
|
2621
2865
|
function T2(e3) {
|
|
2622
|
-
"
|
|
2866
|
+
nt.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? O2() : (h2 = 4, c2--);
|
|
2867
|
+
}
|
|
2868
|
+
function S2(e3) {
|
|
2869
|
+
">" === e3 ? (p2 = new _t(Je(Je({}, p2), { isClosing: true })), U2()) : h2 = 4;
|
|
2623
2870
|
}
|
|
2624
|
-
function
|
|
2625
|
-
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new
|
|
2871
|
+
function I2(t3) {
|
|
2872
|
+
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new _t(Je(Je({}, p2), { type: "comment" })), h2 = 14) : "DOCTYPE" === e2.substr(c2, 7).toUpperCase() ? (c2 += 7, p2 = new _t(Je(Je({}, p2), { type: "doctype" })), h2 = 20) : _2();
|
|
2626
2873
|
}
|
|
2627
|
-
function
|
|
2874
|
+
function D2(e3) {
|
|
2628
2875
|
"-" === e3 ? h2 = 15 : ">" === e3 ? _2() : h2 = 16;
|
|
2629
2876
|
}
|
|
2630
|
-
function
|
|
2877
|
+
function M2(e3) {
|
|
2631
2878
|
"-" === e3 ? h2 = 18 : ">" === e3 ? _2() : h2 = 16;
|
|
2632
2879
|
}
|
|
2633
|
-
function
|
|
2880
|
+
function F2(e3) {
|
|
2634
2881
|
"-" === e3 && (h2 = 17);
|
|
2635
2882
|
}
|
|
2636
|
-
function
|
|
2883
|
+
function B2(e3) {
|
|
2637
2884
|
h2 = "-" === e3 ? 18 : 16;
|
|
2638
2885
|
}
|
|
2639
2886
|
function R2(e3) {
|
|
@@ -2649,7 +2896,7 @@ function Tt(e2, t2) {
|
|
|
2649
2896
|
h2 = 0, p2 = u2;
|
|
2650
2897
|
}
|
|
2651
2898
|
function O2() {
|
|
2652
|
-
h2 = 1, p2 = new
|
|
2899
|
+
h2 = 1, p2 = new _t({ idx: c2 });
|
|
2653
2900
|
}
|
|
2654
2901
|
function U2() {
|
|
2655
2902
|
var t3 = e2.slice(d2, p2.idx);
|
|
@@ -2661,9 +2908,9 @@ function Tt(e2, t2) {
|
|
|
2661
2908
|
}
|
|
2662
2909
|
d2 < c2 && (s2 = e2.slice(d2, c2), i2(s2, d2), d2 = c2 + 1);
|
|
2663
2910
|
}
|
|
2664
|
-
var
|
|
2911
|
+
var _t = function(e2) {
|
|
2665
2912
|
void 0 === e2 && (e2 = {}), this.idx = void 0 !== e2.idx ? e2.idx : -1, this.type = e2.type || "tag", this.name = e2.name || "", this.isOpening = !!e2.isOpening, this.isClosing = !!e2.isClosing;
|
|
2666
|
-
},
|
|
2913
|
+
}, Ot = function() {
|
|
2667
2914
|
function e2(t2) {
|
|
2668
2915
|
void 0 === t2 && (t2 = {}), this.version = e2.version, this.urls = {}, this.email = true, this.phone = true, this.hashtag = false, this.mention = false, this.newWindow = true, this.stripPrefix = { scheme: true, www: true }, this.stripTrailingSlash = true, this.decodePercentEncoding = true, this.truncate = { length: 0, location: "end" }, this.className = "", this.replaceFn = null, this.context = void 0, this.sanitizeHtml = false, this.matchers = null, this.tagBuilder = null, this.urls = this.normalizeUrlsCfg(t2.urls), this.email = "boolean" == typeof t2.email ? t2.email : this.email, this.phone = "boolean" == typeof t2.phone ? t2.phone : this.phone, this.hashtag = t2.hashtag || this.hashtag, this.mention = t2.mention || this.mention, this.newWindow = "boolean" == typeof t2.newWindow ? t2.newWindow : this.newWindow, this.stripPrefix = this.normalizeStripPrefixCfg(t2.stripPrefix), this.stripTrailingSlash = "boolean" == typeof t2.stripTrailingSlash ? t2.stripTrailingSlash : this.stripTrailingSlash, this.decodePercentEncoding = "boolean" == typeof t2.decodePercentEncoding ? t2.decodePercentEncoding : this.decodePercentEncoding, this.sanitizeHtml = t2.sanitizeHtml || false;
|
|
2669
2916
|
var s2 = this.mention;
|
|
@@ -2687,7 +2934,7 @@ var Dt = function(e2) {
|
|
|
2687
2934
|
}(e3 || {}, { length: Number.POSITIVE_INFINITY, location: "end" });
|
|
2688
2935
|
}, e2.prototype.parse = function(e3) {
|
|
2689
2936
|
var t2 = this, s2 = ["a", "style", "script"], n2 = 0, r2 = [];
|
|
2690
|
-
return
|
|
2937
|
+
return Pt(e3, { onOpenTag: function(e4) {
|
|
2691
2938
|
s2.indexOf(e4) >= 0 && n2++;
|
|
2692
2939
|
}, onText: function(e4, s3) {
|
|
2693
2940
|
if (0 === n2) {
|
|
@@ -2726,19 +2973,19 @@ var Dt = function(e2) {
|
|
|
2726
2973
|
}
|
|
2727
2974
|
return e3;
|
|
2728
2975
|
}, e2.prototype.removeUnwantedMatches = function(e3) {
|
|
2729
|
-
return this.hashtag ||
|
|
2976
|
+
return this.hashtag || je(e3, function(e4) {
|
|
2730
2977
|
return "hashtag" === e4.getType();
|
|
2731
|
-
}), this.email ||
|
|
2978
|
+
}), this.email || je(e3, function(e4) {
|
|
2732
2979
|
return "email" === e4.getType();
|
|
2733
|
-
}), this.phone ||
|
|
2980
|
+
}), this.phone || je(e3, function(e4) {
|
|
2734
2981
|
return "phone" === e4.getType();
|
|
2735
|
-
}), this.mention ||
|
|
2982
|
+
}), this.mention || je(e3, function(e4) {
|
|
2736
2983
|
return "mention" === e4.getType();
|
|
2737
|
-
}), this.urls.schemeMatches ||
|
|
2984
|
+
}), this.urls.schemeMatches || je(e3, function(e4) {
|
|
2738
2985
|
return "url" === e4.getType() && "scheme" === e4.getUrlMatchType();
|
|
2739
|
-
}), this.urls.wwwMatches ||
|
|
2986
|
+
}), this.urls.wwwMatches || je(e3, function(e4) {
|
|
2740
2987
|
return "url" === e4.getType() && "www" === e4.getUrlMatchType();
|
|
2741
|
-
}), this.urls.tldMatches ||
|
|
2988
|
+
}), this.urls.tldMatches || je(e3, function(e4) {
|
|
2742
2989
|
return "url" === e4.getType() && "tld" === e4.getUrlMatchType();
|
|
2743
2990
|
}), e3;
|
|
2744
2991
|
}, e2.prototype.parseText = function(e3, t2) {
|
|
@@ -2758,99 +3005,99 @@ var Dt = function(e2) {
|
|
|
2758
3005
|
return s2.push(e3.substring(n2)), s2.join("");
|
|
2759
3006
|
}, e2.prototype.createMatchReturnVal = function(e3) {
|
|
2760
3007
|
var t2;
|
|
2761
|
-
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof
|
|
3008
|
+
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof We ? t2.toAnchorString() : e3.buildTag().toAnchorString();
|
|
2762
3009
|
}, e2.prototype.getMatchers = function() {
|
|
2763
3010
|
if (this.matchers) return this.matchers;
|
|
2764
|
-
var e3 = this.getTagBuilder(), t2 = [new
|
|
3011
|
+
var e3 = this.getTagBuilder(), t2 = [new St({ tagBuilder: e3, serviceName: this.hashtag }), new bt({ tagBuilder: e3 }), new Dt({ tagBuilder: e3 }), new Nt({ tagBuilder: e3, serviceName: this.mention }), new kt({ tagBuilder: e3, stripPrefix: this.stripPrefix, stripTrailingSlash: this.stripTrailingSlash, decodePercentEncoding: this.decodePercentEncoding })];
|
|
2765
3012
|
return this.matchers = t2;
|
|
2766
3013
|
}, e2.prototype.getTagBuilder = function() {
|
|
2767
3014
|
var e3 = this.tagBuilder;
|
|
2768
|
-
return e3 || (e3 = this.tagBuilder = new
|
|
2769
|
-
}, e2.version = "3.14.3", e2.AnchorTagBuilder =
|
|
3015
|
+
return e3 || (e3 = this.tagBuilder = new qe({ newWindow: this.newWindow, truncate: this.truncate, className: this.className })), e3;
|
|
3016
|
+
}, e2.version = "3.14.3", e2.AnchorTagBuilder = qe, e2.HtmlTag = We, e2.matcher = { Email: bt, Hashtag: St, Matcher: Xe, Mention: Nt, Phone: Dt, Url: kt }, e2.match = { Email: Ye, Hashtag: Qe, Match: He, Mention: Ve, Phone: Ze, Url: Ke }, e2;
|
|
2770
3017
|
}();
|
|
2771
|
-
function
|
|
3018
|
+
function Ut(e2, t2 = e2) {
|
|
2772
3019
|
return { type: "autolink", url: e2, text: t2 };
|
|
2773
3020
|
}
|
|
2774
|
-
const
|
|
3021
|
+
const jt = Me(/<!!mention:([^>\s]*?)\|(.*?)>/gm, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3) {
|
|
2775
3022
|
return { type: "mention", id: e3, text: t3 };
|
|
2776
|
-
}(decodeURIComponent(t2), s2)),
|
|
3023
|
+
}(decodeURIComponent(t2), s2)), $t = Me(/<!!customemoji:(.*?)>/gm, ([e2, t2]) => /* @__PURE__ */ function(e3) {
|
|
2777
3024
|
return { type: "customemoji", text: e3 };
|
|
2778
|
-
}(t2)),
|
|
3025
|
+
}(t2)), Wt = Me(/<((?:https?|mailto):.*?)\|(.*?)>/gi, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3 = []) {
|
|
2779
3026
|
return { type: "link", url: e3, children: t3 };
|
|
2780
|
-
}(t2, [s2])),
|
|
2781
|
-
const { action: n2, params: r2 } =
|
|
3027
|
+
}(t2, [s2])), qt = Me(/<actionlink:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
3028
|
+
const { action: n2, params: r2 } = Gt(t2);
|
|
2782
3029
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
2783
3030
|
return { type: "actionlink", action: e3, params: t3, children: s3 };
|
|
2784
3031
|
}(n2, r2, [s2]);
|
|
2785
|
-
}),
|
|
2786
|
-
const { action: n2, params: r2 } =
|
|
3032
|
+
}), Ht = Me(/<actionbutton:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
3033
|
+
const { action: n2, params: r2 } = Gt(t2);
|
|
2787
3034
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
2788
3035
|
return { type: "actionbutton", action: e3, params: t3, children: s3 };
|
|
2789
3036
|
}(n2, r2, [s2]);
|
|
2790
3037
|
});
|
|
2791
|
-
function
|
|
3038
|
+
function Gt(e2) {
|
|
2792
3039
|
const t2 = e2.indexOf("?");
|
|
2793
3040
|
if (-1 === t2) return { action: e2, params: {} };
|
|
2794
3041
|
return { action: e2.slice(0, t2), params: Object.fromEntries(new URLSearchParams(e2.slice(t2))) };
|
|
2795
3042
|
}
|
|
2796
|
-
const
|
|
3043
|
+
const Lt = Me(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g, ([e2]) => /* @__PURE__ */ function(e3 = []) {
|
|
2797
3044
|
return { type: "bulletlist", children: e3 };
|
|
2798
|
-
}([e2.startsWith("\n") ? e2.slice(1) : e2])),
|
|
3045
|
+
}([e2.startsWith("\n") ? e2.slice(1) : e2])), zt = Me(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm, ([e2, t2]) => ({ type: "bulletpoint", children: [t2] })), Jt = (e2) => {
|
|
2799
3046
|
const t2 = /(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;
|
|
2800
3047
|
let s2 = 0;
|
|
2801
3048
|
const n2 = [];
|
|
2802
3049
|
for (const r2 of J(e2, t2)) {
|
|
2803
3050
|
const t3 = r2[0], i2 = r2[1], a2 = t3.startsWith(i2) ? r2.index : r2.index + 1;
|
|
2804
3051
|
a2 - s2 > 0 && n2.push(e2.substring(s2, a2));
|
|
2805
|
-
const o2 =
|
|
3052
|
+
const o2 = Ut("tel:" + i2.replace(/[^0-9+]/g, ""), i2);
|
|
2806
3053
|
n2.push(o2), s2 = a2 + i2.length;
|
|
2807
3054
|
}
|
|
2808
3055
|
return s2 < e2.length && n2.push(e2.substring(s2)), n2;
|
|
2809
|
-
},
|
|
2810
|
-
const t2 =
|
|
3056
|
+
}, Yt = (e2) => Wt(e2).flatMap((e3) => "string" == typeof e3 ? Qt(e3) : ["<", ...Qt(e3.url), ...Qt("|" + e3.children[0] + ">")]), Qt = (e2) => {
|
|
3057
|
+
const t2 = Ot.parse(e2, { urls: true, email: true, phone: false, hashtag: false, mention: false }), s2 = [];
|
|
2811
3058
|
let n2 = 0;
|
|
2812
3059
|
for (const r2 of t2) {
|
|
2813
3060
|
const t3 = r2.getOffset(), i2 = r2.getMatchedText(), a2 = i2.length;
|
|
2814
3061
|
let o2 = i2;
|
|
2815
|
-
r2 instanceof
|
|
3062
|
+
r2 instanceof Ye ? o2 = "mailto:" + r2.getEmail() : r2 instanceof Ke && (o2 = r2.getUrl()), t3 > n2 && s2.push(e2.substring(n2, t3)), s2.push(Ut(o2, i2)), n2 = t3 + a2;
|
|
2816
3063
|
}
|
|
2817
3064
|
return n2 < e2.length && s2.push(e2.substring(n2)), s2;
|
|
2818
|
-
},
|
|
2819
|
-
function
|
|
3065
|
+
}, Vt = ["Codeblock", "Codespan", "FormattedLink", "Wikitext", "Autolink", "Actions", "Mention", "Mention", "BulletPoint", "CustomEmoji"];
|
|
3066
|
+
function Zt(e2 = { except: [] }) {
|
|
2820
3067
|
var _a2;
|
|
2821
|
-
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 :
|
|
2822
|
-
return s2.includes("BulletPoint") || t2.multilineSteps.push(
|
|
3068
|
+
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 : Vt.filter((t3) => !e2.only.includes(t3));
|
|
3069
|
+
return s2.includes("BulletPoint") || t2.multilineSteps.push(Lt, zt), s2.includes("Mention") || t2.singlelineSteps.push(jt), s2.includes("CustomEmoji") || t2.singlelineSteps.push($t), s2.includes("Codespan") || t2.multilineSteps.push(Me(/```([^]+?)```/g, ([e3, t3]) => ({ type: "codespan", text: t3 }))), s2.includes("FormattedLink") || t2.singlelineSteps.push(Wt), s2.includes("Actions") || (t2.singlelineSteps.push(qt), t2.singlelineSteps.push(Ht)), s2.includes("Wikitext") || t2.singlelineSteps.push(Pe), s2.includes("Autolink") || t2.singlelineSteps.push(Yt, Jt), t2;
|
|
2823
3070
|
}
|
|
2824
|
-
const
|
|
3071
|
+
const Kt = function(e2) {
|
|
2825
3072
|
const t2 = RegExp(`[^${e2}]+${e2}?|${e2}`, "g");
|
|
2826
3073
|
return (e3) => Array.from(e3.match(t2) || []);
|
|
2827
3074
|
}("\n");
|
|
2828
|
-
function
|
|
3075
|
+
function Xt(e2, t2 = { except: [] }) {
|
|
2829
3076
|
let s2 = function(e3, t3) {
|
|
2830
3077
|
let s3 = [e3];
|
|
2831
|
-
return s3 =
|
|
2832
|
-
}(e2,
|
|
2833
|
-
return s2 =
|
|
3078
|
+
return s3 = es(s3, t3.multilineSteps), s3 = es(s3, [Kt]), s3 = es(s3, t3.singlelineSteps), s3 = ts(s3), s3;
|
|
3079
|
+
}(e2, Zt(t2));
|
|
3080
|
+
return s2 = ss(s2, false), s2;
|
|
2834
3081
|
}
|
|
2835
|
-
function
|
|
2836
|
-
return t2.reduce((e3, t3) =>
|
|
3082
|
+
function es(e2, t2) {
|
|
3083
|
+
return t2.reduce((e3, t3) => De(e3, t3), e2);
|
|
2837
3084
|
}
|
|
2838
|
-
function
|
|
3085
|
+
function ts(e2) {
|
|
2839
3086
|
const t2 = [];
|
|
2840
3087
|
let s2 = -1;
|
|
2841
|
-
for (const n2 of e2) "string" == typeof n2 ? "string" == typeof t2[s2] ? t2[s2] += n2 : t2[++s2] = n2 : t2[++s2] = "children" in n2 ? __spreadProps(__spreadValues({}, n2), { children:
|
|
3088
|
+
for (const n2 of e2) "string" == typeof n2 ? "string" == typeof t2[s2] ? t2[s2] += n2 : t2[++s2] = n2 : t2[++s2] = "children" in n2 ? __spreadProps(__spreadValues({}, n2), { children: ts(n2.children) }) : n2;
|
|
2842
3089
|
return t2;
|
|
2843
3090
|
}
|
|
2844
|
-
function
|
|
3091
|
+
function ss(e2, t2) {
|
|
2845
3092
|
const s2 = [];
|
|
2846
3093
|
let n2 = [];
|
|
2847
3094
|
for (let r2 = 0; r2 < e2.length; r2++) {
|
|
2848
3095
|
const i2 = e2[r2];
|
|
2849
|
-
"string" == typeof i2 ? n2.push(i2) : "children" in i2 ? (n2.length > 0 && (s2.push(n2.join("")), n2 = []), i2.children =
|
|
3096
|
+
"string" == typeof i2 ? n2.push(i2) : "children" in i2 ? (n2.length > 0 && (s2.push(n2.join("")), n2 = []), i2.children = ss(i2.children, t2 || "link" === i2.type || "actionbutton" === i2.type || "actionlink" === i2.type), s2.push(i2)) : "autolink" === i2.type && t2 ? n2.push(i2.text) : (n2.length > 0 && (s2.push(n2.join("")), n2 = []), s2.push(i2));
|
|
2850
3097
|
}
|
|
2851
3098
|
return n2.length > 0 && (s2.push(n2.join("")), n2 = []), s2;
|
|
2852
3099
|
}
|
|
2853
|
-
class
|
|
3100
|
+
class ns {
|
|
2854
3101
|
constructor(e2, t2, s2) {
|
|
2855
3102
|
this.id = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
2856
3103
|
}
|
|
@@ -2866,12 +3113,12 @@ class Qt {
|
|
|
2866
3113
|
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return null;
|
|
2867
3114
|
if (!t2.ok && "server" === t2.where && 403 === t2.value.status && "NOT_A_PARTICIPANT" === t2.value.errorCode) return null;
|
|
2868
3115
|
const s2 = e("Get message " + this.id, t2), n2 = yield this._realtimeClient.createMessageSnapshot(s2, this.brandedConversationId);
|
|
2869
|
-
return
|
|
3116
|
+
return xe("Get message " + this.id, n2);
|
|
2870
3117
|
});
|
|
2871
3118
|
}
|
|
2872
3119
|
edit(t2) {
|
|
2873
3120
|
return __async(this, null, function* () {
|
|
2874
|
-
const s2 = { content:
|
|
3121
|
+
const s2 = { content: rs(t2), custom: "string" == typeof t2 ? void 0 : t2.custom }, n2 = yield this._realtimeClient.call("PATCH", ["conversations", this.brandedConversationId, "messages", this.brandedId], s2);
|
|
2875
3122
|
e(`Edit message ${this.id} in conversation ${this.conversationId}`, n2);
|
|
2876
3123
|
});
|
|
2877
3124
|
}
|
|
@@ -2882,16 +3129,16 @@ class Qt {
|
|
|
2882
3129
|
});
|
|
2883
3130
|
}
|
|
2884
3131
|
}
|
|
2885
|
-
function
|
|
3132
|
+
function rs(e2) {
|
|
2886
3133
|
if ("string" == typeof e2) {
|
|
2887
|
-
return [{ type: "text", children:
|
|
3134
|
+
return [{ type: "text", children: Xt(e2) }];
|
|
2888
3135
|
}
|
|
2889
3136
|
if ("text" in e2 && e2.text) {
|
|
2890
|
-
return [{ type: "text", children:
|
|
3137
|
+
return [{ type: "text", children: Xt(e2.text) }];
|
|
2891
3138
|
}
|
|
2892
3139
|
if ("content" in e2 && e2.content) return e2.content;
|
|
2893
3140
|
}
|
|
2894
|
-
class
|
|
3141
|
+
class is {
|
|
2895
3142
|
constructor(e2, t2) {
|
|
2896
3143
|
this.id = e2, this._realtimeClient = t2, this.uselessObjForTypeCheck = { subject: null, photoUrl: null, welcomeMessages: null, custom: null, access: null, notify: null };
|
|
2897
3144
|
}
|
|
@@ -2902,16 +3149,16 @@ class Zt {
|
|
|
2902
3149
|
return this._realtimeClient.userId;
|
|
2903
3150
|
}
|
|
2904
3151
|
participant(e2) {
|
|
2905
|
-
return new
|
|
3152
|
+
return new Se("string" == typeof e2 ? e2 : e2.id, this.id, this._realtimeClient);
|
|
2906
3153
|
}
|
|
2907
3154
|
message(e2) {
|
|
2908
|
-
return new
|
|
3155
|
+
return new ns(e2, this.brandedId, this._realtimeClient);
|
|
2909
3156
|
}
|
|
2910
3157
|
get() {
|
|
2911
3158
|
return __async(this, null, function* () {
|
|
2912
3159
|
const t2 = this._realtimeClient.listMessages(this.brandedId, { limit: 1 }), s2 = yield this._realtimeClient.call("GET", ["me", "conversations", this.brandedId], {});
|
|
2913
3160
|
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return null;
|
|
2914
|
-
const n2 = e("Get conversation " + this.id, s2), r2 =
|
|
3161
|
+
const n2 = e("Get conversation " + this.id, s2), r2 = xe("Get last message in conversation " + this.id, yield t2), i2 = 0 === r2.length ? null : r2[0];
|
|
2915
3162
|
return this._realtimeClient.createConversationSnapshotPreloaded(n2, i2);
|
|
2916
3163
|
});
|
|
2917
3164
|
}
|
|
@@ -2954,13 +3201,16 @@ class Zt {
|
|
|
2954
3201
|
}
|
|
2955
3202
|
send(t2) {
|
|
2956
3203
|
return __async(this, null, function* () {
|
|
2957
|
-
const s2 = { content:
|
|
2958
|
-
return new
|
|
3204
|
+
const s2 = { content: as(t2), referencedMessageId: os(t2), custom: "string" == typeof t2 ? void 0 : t2.custom, idempotencyKey: Ie((/* @__PURE__ */ new Date()).getTime()) }, n2 = yield this._realtimeClient.call("POST", ["conversations", this.brandedId, "messages"], s2), r2 = e("Send message to conversation " + this.id, n2);
|
|
3205
|
+
return new ns(r2.id, this.brandedId, this._realtimeClient);
|
|
2959
3206
|
});
|
|
2960
3207
|
}
|
|
2961
3208
|
subscribeMessages(e2) {
|
|
2962
3209
|
return this._realtimeClient.subscribe(["me", "conversations", this.brandedId, "messages"], e2);
|
|
2963
3210
|
}
|
|
3211
|
+
subscribeParticipants(e2) {
|
|
3212
|
+
return this._realtimeClient.subscribe(["me", "conversations", this.brandedId, "participants"], e2);
|
|
3213
|
+
}
|
|
2964
3214
|
subscribe(e2) {
|
|
2965
3215
|
return this._realtimeClient.subscribe(["me", "conversations", this.brandedId], e2);
|
|
2966
3216
|
}
|
|
@@ -2974,21 +3224,21 @@ class Zt {
|
|
|
2974
3224
|
});
|
|
2975
3225
|
}
|
|
2976
3226
|
}
|
|
2977
|
-
function
|
|
3227
|
+
function as(e2) {
|
|
2978
3228
|
if ("string" == typeof e2) {
|
|
2979
|
-
return [{ type: "text", children:
|
|
3229
|
+
return [{ type: "text", children: Xt(e2) }];
|
|
2980
3230
|
}
|
|
2981
3231
|
if ("text" in e2) {
|
|
2982
|
-
return [{ type: "text", children:
|
|
3232
|
+
return [{ type: "text", children: Xt(e2.text) }];
|
|
2983
3233
|
}
|
|
2984
3234
|
return e2.content;
|
|
2985
3235
|
}
|
|
2986
|
-
function
|
|
3236
|
+
function os(e2) {
|
|
2987
3237
|
if ("string" == typeof e2) return;
|
|
2988
3238
|
const t2 = e2.referencedMessage;
|
|
2989
3239
|
return void 0 !== t2 ? "string" == typeof t2 ? t2 : t2.id : void 0;
|
|
2990
3240
|
}
|
|
2991
|
-
class
|
|
3241
|
+
class us {
|
|
2992
3242
|
constructor(e2, t2, s2) {
|
|
2993
3243
|
this.realtimeWsApiUrl = e2, this.internalHttpApiUrl = t2, this.restApiHttpUrl = s2;
|
|
2994
3244
|
}
|
|
@@ -3000,10 +3250,10 @@ class es {
|
|
|
3000
3250
|
return this.realtimeWsApiUrl + `/${e2}/realtime/${i2}?talkjs-client-build=${r2 != null ? r2 : "standalone"}&talkjs-core=${s2}&talkjs-client-id=${n2}`;
|
|
3001
3251
|
}
|
|
3002
3252
|
}
|
|
3003
|
-
function
|
|
3253
|
+
function cs({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRetry: i2, authProvider: o2 }) {
|
|
3004
3254
|
var _a2;
|
|
3005
3255
|
(!r2 || r2 <= 0) && (r2 = 1);
|
|
3006
|
-
const u2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-06-
|
|
3256
|
+
const u2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-06-17T08:01:14.864Z" };
|
|
3007
3257
|
s2 instanceof FormData || (u2["Content-Type"] = (_a2 = n2 == null ? void 0 : n2.contentType) != null ? _a2 : "application/json");
|
|
3008
3258
|
return a(r2, () => __async(this, null, function* () {
|
|
3009
3259
|
if (o2) {
|
|
@@ -3015,19 +3265,19 @@ function ts({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRe
|
|
|
3015
3265
|
throw e3;
|
|
3016
3266
|
});
|
|
3017
3267
|
}), { initialDelay: 0.2, log: void 0, shouldRetry: (s3) => __async(this, null, function* () {
|
|
3018
|
-
return o2 && 401 === s3.status ? (
|
|
3268
|
+
return o2 && 401 === s3.status ? (vs.log(`401 error from ${e2} ${t2}, ${yield o2.getToken()}`), o2.refreshToken(), true) : i2 ? i2(s3) : !("status" in s3 && s3.status >= 400 && s3.status < 500);
|
|
3019
3269
|
}) }).catch((s3) => {
|
|
3020
3270
|
if (Math.random() < 0.1 && !t2.toString().startsWith("https://capture.trackjs.com")) {
|
|
3021
3271
|
const n3 = `Network Error for ${e2} ${t2}`;
|
|
3022
3272
|
if ("undefined" != typeof window) if (s3 instanceof Response) {
|
|
3023
|
-
s3.clone().text().then((e3) =>
|
|
3024
|
-
} else
|
|
3273
|
+
s3.clone().text().then((e3) => vs.log(`${n3} ${s3.status} ${e3} (10% logged)`));
|
|
3274
|
+
} else vs.log(`${n3} ${s3} (10% logged)`);
|
|
3025
3275
|
console.error("[TalkJS]", n3);
|
|
3026
3276
|
}
|
|
3027
3277
|
throw s3;
|
|
3028
3278
|
});
|
|
3029
3279
|
}
|
|
3030
|
-
const { cdnHost:
|
|
3280
|
+
const { cdnHost: ls, appHost: hs, restHost: ds, realtimeHost: ps, appProtocol: fs, appWsProtocol: ms } = function() {
|
|
3031
3281
|
if ("undefined" == typeof window) return { cdnHost: "test-hostname", appHost: "test-hostname", appProtocol: "http:", appWsProtocol: "ws:" };
|
|
3032
3282
|
const e2 = function() {
|
|
3033
3283
|
if (document.currentScript) return document.currentScript.src;
|
|
@@ -3052,11 +3302,11 @@ const { cdnHost: ss, appHost: ns, restHost: rs, realtimeHost: is, appProtocol: a
|
|
|
3052
3302
|
}(n2), a2 = t2.protocol;
|
|
3053
3303
|
return { cdnHost: s2, appHost: n2, restHost: r2, realtimeHost: i2, appProtocol: a2, appWsProtocol: "https:" === a2 ? "wss:" : "ws:" };
|
|
3054
3304
|
}();
|
|
3055
|
-
const
|
|
3056
|
-
const
|
|
3305
|
+
const gs = hs.startsWith("app.talkjs.com");
|
|
3306
|
+
const vs = "undefined" == typeof window ? { log: (e2) => Promise.resolve(), setData: (e2) => {
|
|
3057
3307
|
} } : new class {
|
|
3058
3308
|
constructor(e2) {
|
|
3059
|
-
this._timeCreated = Date.now(), this._enabled =
|
|
3309
|
+
this._timeCreated = Date.now(), this._enabled = gs, this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2025-06-17T08:01:14.864Z" }, 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-06-17T08:01:14.864Z", throttled: 0 }, this._url = `https://capture.trackjs.com/capture?token=${e2}`, this._trackJSData.customer.token = e2;
|
|
3060
3310
|
}
|
|
3061
3311
|
setData({ appId: e2, meId: t2, sessionId: s2 }) {
|
|
3062
3312
|
this._trackJSData.customer.userId = e2, this._trackJSData.customer.sessionId = `${e2}/${t2}`, this._trackJSData.customer.correlationId = s2;
|
|
@@ -3066,14 +3316,14 @@ const cs = "undefined" == typeof window ? { log: (e2) => Promise.resolve(), setD
|
|
|
3066
3316
|
try {
|
|
3067
3317
|
if (!this._enabled) return Promise.resolve();
|
|
3068
3318
|
const t2 = __spreadProps(__spreadValues({}, this._trackJSData), { message: e2 });
|
|
3069
|
-
yield
|
|
3319
|
+
yield cs({ method: "POST", url: this._url, data: JSON.stringify(t2), options: { contentType: "text/plain" } });
|
|
3070
3320
|
} catch (e3) {
|
|
3071
3321
|
console.error("[TalkJS] Failed when sending an error report. Error: ", e3);
|
|
3072
3322
|
}
|
|
3073
3323
|
});
|
|
3074
3324
|
}
|
|
3075
3325
|
}("970cd0be0fb74630b75c8451051299dc");
|
|
3076
|
-
class
|
|
3326
|
+
class ws {
|
|
3077
3327
|
constructor(e2, t2 = {}) {
|
|
3078
3328
|
this._onSubscription = t2, this._handlers = {};
|
|
3079
3329
|
for (const t3 in e2) Object.hasOwnProperty.call(e2, t3) && (this._handlers[t3] = []);
|
|
@@ -3118,9 +3368,9 @@ class ls {
|
|
|
3118
3368
|
return this.on(e2, t2), { unsubscribe: () => this.off(e2, t2) };
|
|
3119
3369
|
}
|
|
3120
3370
|
}
|
|
3121
|
-
class
|
|
3371
|
+
class bs {
|
|
3122
3372
|
constructor(e2, t2, s2, n2, r2, i2) {
|
|
3123
|
-
if (this.appId = t2, this.userId = s2, this.tokenFetcher = r2, this.usingBokens = false, this.requestInProgress = false, this.eventEmitter = new
|
|
3373
|
+
if (this.appId = t2, this.userId = s2, this.tokenFetcher = r2, this.usingBokens = false, this.requestInProgress = false, this.eventEmitter = new ws({ tokenChanged(e3) {
|
|
3124
3374
|
}, tokenRefreshFailed(e3) {
|
|
3125
3375
|
}, tokenAccepted(e3) {
|
|
3126
3376
|
} }), 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.");
|
|
@@ -3212,7 +3462,7 @@ class hs {
|
|
|
3212
3462
|
const e3 = function(e4) {
|
|
3213
3463
|
const t3 = e4.split(".");
|
|
3214
3464
|
if (3 !== t3.length) throw "Token does not contain exactly two `.`. Check that you generated your JWT correctly. It should be `<header>.<payload>.<signature>`.";
|
|
3215
|
-
return { header:
|
|
3465
|
+
return { header: ys(t3[0]), payload: ys(t3[1]) };
|
|
3216
3466
|
}(s2);
|
|
3217
3467
|
n2 = e3.header, r2 = e3.payload;
|
|
3218
3468
|
} catch (e3) {
|
|
@@ -3226,7 +3476,7 @@ class hs {
|
|
|
3226
3476
|
const e3 = this.checkJwtPayload(r2);
|
|
3227
3477
|
t2.push(...e3);
|
|
3228
3478
|
}
|
|
3229
|
-
if (t2.length) if (this.usingBokens)
|
|
3479
|
+
if (t2.length) if (this.usingBokens) vs.log(`JWT Errors detected by AuthProvider when using bokens: ${t2.join("\n")}`);
|
|
3230
3480
|
else {
|
|
3231
3481
|
console.warn("[TalkJS] Authentication token appears to be generated incorrectly. Will still attempt to authenticate, but TalkJS may not work as expected. See below for a description of any problems and how to fix them.");
|
|
3232
3482
|
const s3 = t2.length > 1;
|
|
@@ -3255,7 +3505,7 @@ class hs {
|
|
|
3255
3505
|
sendBokenRequest(e2, t2) {
|
|
3256
3506
|
return __async(this, null, function* () {
|
|
3257
3507
|
let s2 = 0;
|
|
3258
|
-
const n2 = e2.getBokensUrl(this.appId, this.userId, t2), r2 = yield
|
|
3508
|
+
const n2 = e2.getBokensUrl(this.appId, this.userId, t2), r2 = yield cs({ method: "GET", url: n2, attempts: 1e4, shouldRetry: (e3) => {
|
|
3259
3509
|
if (e3 instanceof Error) return true;
|
|
3260
3510
|
if (401 === e3.status) throw "Check that you provided a valid signature.";
|
|
3261
3511
|
if (404 === e3.status) throw "Check that you specified the correct App ID.";
|
|
@@ -3268,7 +3518,7 @@ class hs {
|
|
|
3268
3518
|
});
|
|
3269
3519
|
}
|
|
3270
3520
|
}
|
|
3271
|
-
function
|
|
3521
|
+
function ys(e2) {
|
|
3272
3522
|
try {
|
|
3273
3523
|
const t2 = e2.replace(/-/g, "+").replace(/_/g, "/"), s2 = decodeURIComponent(atob(t2).split("").map((e3) => "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2)).join(""));
|
|
3274
3524
|
return JSON.parse(s2);
|
|
@@ -3276,8 +3526,8 @@ function ds(e2) {
|
|
|
3276
3526
|
throw `Could not base64-decode and JSON-parse token section: ${e2}. Check that you base-64 encoded the section correctly.`;
|
|
3277
3527
|
}
|
|
3278
3528
|
}
|
|
3279
|
-
const
|
|
3280
|
-
class
|
|
3529
|
+
const Cs = new us("wss://realtime.talkjs.com/v1", "https://app.talkjs.com/api/v0", "https://api.talkjs.com/v1");
|
|
3530
|
+
class As {
|
|
3281
3531
|
constructor(e2) {
|
|
3282
3532
|
this.target = e2;
|
|
3283
3533
|
}
|
|
@@ -3285,7 +3535,7 @@ class fs {
|
|
|
3285
3535
|
return this.target;
|
|
3286
3536
|
}
|
|
3287
3537
|
}
|
|
3288
|
-
const
|
|
3538
|
+
const Es = new class {
|
|
3289
3539
|
constructor() {
|
|
3290
3540
|
this.registry = {};
|
|
3291
3541
|
}
|
|
@@ -3293,7 +3543,7 @@ const gs = new class {
|
|
|
3293
3543
|
var _a2;
|
|
3294
3544
|
const t2 = this.key(e2), s2 = (_a2 = this.registry[t2]) == null ? void 0 : _a2.deref();
|
|
3295
3545
|
if (s2) return s2;
|
|
3296
|
-
const n2 = new
|
|
3546
|
+
const n2 = new xs(e2), r2 = globalThis.WeakRef ? new WeakRef(n2) : new As(n2);
|
|
3297
3547
|
return this.registry[t2] = r2, n2;
|
|
3298
3548
|
}
|
|
3299
3549
|
deregister(e2, t2) {
|
|
@@ -3304,10 +3554,10 @@ const gs = new class {
|
|
|
3304
3554
|
return `${e2}:${t2}`;
|
|
3305
3555
|
}
|
|
3306
3556
|
}();
|
|
3307
|
-
function
|
|
3308
|
-
return e2.forceCreateNew ? new
|
|
3557
|
+
function ks(e2) {
|
|
3558
|
+
return e2.forceCreateNew ? new xs(e2) : Es.getOrCreate(e2);
|
|
3309
3559
|
}
|
|
3310
|
-
class
|
|
3560
|
+
class xs {
|
|
3311
3561
|
constructor(e2) {
|
|
3312
3562
|
!function(e3) {
|
|
3313
3563
|
function t3(e4, t4) {
|
|
@@ -3317,13 +3567,13 @@ class vs {
|
|
|
3317
3567
|
void 0 !== e3.tokenFetcher && t3("function" == typeof e3.tokenFetcher, "The `tokenFetcher` property of TalkSession#constructor must be a function.");
|
|
3318
3568
|
}(e2);
|
|
3319
3569
|
const { appId: t2, userId: s2, token: n2, tokenFetcher: r2, signature: i2 } = e2;
|
|
3320
|
-
this._appId = t2, this._apiUrls = e2.apiUrls ? new
|
|
3570
|
+
this._appId = t2, this._apiUrls = e2.apiUrls ? new us(e2.apiUrls.realtimeWsApiUrl, e2.apiUrls.internalHttpApiUrl, e2.apiUrls.restApiHttpUrl) : Cs, this._authProvider = new bs(this._apiUrls, t2, s2, n2, r2, i2);
|
|
3321
3571
|
const a2 = Math.random().toString().split(".")[1];
|
|
3322
|
-
this._realtimeClient = new
|
|
3572
|
+
this._realtimeClient = new Ee(this._apiUrls.getRealtimeWsUrl(t2, s2, "1.2.0", a2, e2.clientBuild), s2, this._authProvider), this.currentUser = new Te(this._realtimeClient.userId, this._realtimeClient), this._terminationReason = o(), this._terminationReason.promise.then((e3) => {
|
|
3323
3573
|
console.error(`[TalkSession] ${e3}`);
|
|
3324
3574
|
}), function(e3, t3, s3) {
|
|
3325
3575
|
return __async(this, null, function* () {
|
|
3326
|
-
return
|
|
3576
|
+
return cs({ method: "GET", url: `${t3}/${e3}/app`, authProvider: s3 }).then((e4) => 200 === e4.status || 404 !== e4.status && (console.warn(`[TalkJS] Received unexpected ${e4.status} status code when validating app ID. Assuming that the app ID is valid.`), true)).catch((e4) => {
|
|
3327
3577
|
if ("string" != typeof e4 && "status" in e4) {
|
|
3328
3578
|
const t4 = e4;
|
|
3329
3579
|
return 200 === t4.status || 404 !== t4.status && (console.warn(`[TalkJS] Received unexpected ${t4.status} status code when validating app ID. Assuming that the app ID is valid.`), true);
|
|
@@ -3344,37 +3594,40 @@ class vs {
|
|
|
3344
3594
|
}), { unsubscribe: () => t2.resolve("UNSUBSCRIBED") };
|
|
3345
3595
|
}
|
|
3346
3596
|
user(e2) {
|
|
3347
|
-
return new
|
|
3597
|
+
return new Te(e2, this._realtimeClient);
|
|
3348
3598
|
}
|
|
3349
3599
|
conversation(e2) {
|
|
3350
|
-
return new
|
|
3600
|
+
return new is(e2, this._realtimeClient);
|
|
3601
|
+
}
|
|
3602
|
+
subscribeConversations(e2) {
|
|
3603
|
+
return this._realtimeClient.subscribe(["me", "conversations"], e2);
|
|
3351
3604
|
}
|
|
3352
3605
|
terminate(e2) {
|
|
3353
|
-
|
|
3606
|
+
Es.deregister(this._appId, this.currentUser.id), this._terminationReason.resolve(e2), this._realtimeClient.destroy();
|
|
3354
3607
|
}
|
|
3355
3608
|
_isConnected() {
|
|
3356
3609
|
return this._realtimeClient.isConnected();
|
|
3357
3610
|
}
|
|
3358
3611
|
uploadFile(e2, t2) {
|
|
3359
|
-
return
|
|
3612
|
+
return Ts(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, t2);
|
|
3360
3613
|
}
|
|
3361
3614
|
uploadImage(e2, t2) {
|
|
3362
|
-
return
|
|
3615
|
+
return Ts(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "image" }, t2));
|
|
3363
3616
|
}
|
|
3364
3617
|
uploadVideo(e2, t2) {
|
|
3365
|
-
return
|
|
3618
|
+
return Ts(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "video" }, t2));
|
|
3366
3619
|
}
|
|
3367
3620
|
uploadAudio(e2, t2) {
|
|
3368
|
-
return
|
|
3621
|
+
return Ts(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "audio" }, t2));
|
|
3369
3622
|
}
|
|
3370
3623
|
uploadVoice(e2, t2) {
|
|
3371
|
-
return
|
|
3624
|
+
return Ts(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "voice" }, t2));
|
|
3372
3625
|
}
|
|
3373
3626
|
}
|
|
3374
|
-
function
|
|
3627
|
+
function Ts(_0, _1, _2, _3) {
|
|
3375
3628
|
return __async(this, arguments, function* (e2, t2, s2, { subtype: n2, filename: r2, width: i2, height: a2, duration: o2 }) {
|
|
3376
3629
|
const u2 = new FormData();
|
|
3377
|
-
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()),
|
|
3630
|
+
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()), cs({ method: "POST", url: e2, data: u2, authProvider: t2 }).then((e3) => e3.json()).then((e3) => e3.attachmentToken).catch((e3) => __async(this, null, function* () {
|
|
3378
3631
|
if (e3 instanceof Response) {
|
|
3379
3632
|
const t3 = yield e3.json(), s3 = `Unexpected response when uploading file, status code ${e3.status} ${t3.errorCode}, ${t3.reasons}`;
|
|
3380
3633
|
throw new Error(s3);
|
|
@@ -3384,7 +3637,7 @@ function bs(_0, _1, _2, _3) {
|
|
|
3384
3637
|
});
|
|
3385
3638
|
}
|
|
3386
3639
|
export {
|
|
3387
|
-
|
|
3640
|
+
ks as getTalkSession,
|
|
3388
3641
|
f as registerPolyfills
|
|
3389
3642
|
};
|
|
3390
3643
|
//# sourceMappingURL=talkSession.js.map
|