@talkjs/core 1.1.0 → 1.2.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 +10 -0
- package/dist/talkSession.cjs +1 -1
- package/dist/talkSession.d.ts +116 -3
- package/dist/talkSession.js +835 -666
- package/package.json +1 -1
package/dist/talkSession.js
CHANGED
|
@@ -128,74 +128,58 @@ 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
|
-
this.realtimeUrl = e2, this.handlers = t2, this.socket = null, this.
|
|
134
|
-
|
|
135
|
-
|
|
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
|
+
const e3 = new (function() {
|
|
135
|
+
if (p) return p;
|
|
136
|
+
if (globalThis.WebSocket) return globalThis.WebSocket;
|
|
137
|
+
throw new Error("Missing WebSocket implementation");
|
|
138
|
+
}())(this.realtimeUrl + "&talkjs-time=" + Date.now());
|
|
139
|
+
this.socket = e3, e3.addEventListener("open", () => {
|
|
140
|
+
this.socket === e3 && this.stateMachine.transition("onOpen");
|
|
141
|
+
}), e3.addEventListener("close", () => {
|
|
142
|
+
this.socket === e3 && this.stateMachine.transition("onClose");
|
|
143
|
+
}), e3.addEventListener("message", (t3) => {
|
|
144
|
+
this.socket === e3 && this.handlers.onMessage(t3);
|
|
136
145
|
});
|
|
137
|
-
} },
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
} }, onOpen: { from: ["CONNECTING"], to: "READY", afterTransition: () => {
|
|
147
|
+
this.handlers.onOpen();
|
|
148
|
+
} }, onClose: { from: ["CONNECTING", "READY"], to: "DISCONNECTED", afterTransition: (_0) => __async(this, [_0], function* ({ from: e3 }) {
|
|
149
|
+
"READY" === e3 && this.handlers.onClose(), this.socket = null;
|
|
150
|
+
const t3 = r(1e4, 0.5);
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
"DISCONNECTED" === this.stateMachine.state && this.stateMachine.transition("startWs");
|
|
153
|
+
}, t3);
|
|
154
|
+
}) }, stopWs: { from: ["CONNECTING", "DISCONNECTED", "READY"], to: "STOPPED", afterTransition: ({ from: e3 }) => {
|
|
155
|
+
"READY" === e3 && this.handlers.onClose();
|
|
156
|
+
const t3 = this.socket;
|
|
157
|
+
this.socket = null, t3 == null ? void 0 : t3.close(1e3);
|
|
142
158
|
} }, destroy: { from: "ANY", to: "TERMINATED", afterTransition: () => {
|
|
143
|
-
|
|
144
|
-
|
|
159
|
+
const e3 = this.socket;
|
|
160
|
+
this.socket = null, e3 == null ? void 0 : e3.close(1e3);
|
|
145
161
|
} } });
|
|
146
162
|
}
|
|
147
163
|
stopWs() {
|
|
148
|
-
|
|
164
|
+
this.stateMachine.transition("stopWs");
|
|
149
165
|
}
|
|
150
166
|
startWs() {
|
|
151
|
-
this.stateMachine.
|
|
152
|
-
}
|
|
153
|
-
createWebSocket() {
|
|
154
|
-
var _a2;
|
|
155
|
-
(_a2 = this == null ? void 0 : this.socket) == null ? void 0 : _a2.close(1e3);
|
|
156
|
-
const e2 = new (function() {
|
|
157
|
-
if (p) return p;
|
|
158
|
-
if (globalThis.WebSocket) return globalThis.WebSocket;
|
|
159
|
-
throw new Error("Missing WebSocket implementation");
|
|
160
|
-
}())(this.realtimeUrl);
|
|
161
|
-
this.socket = e2;
|
|
162
|
-
const t2 = () => this.stateMachine.transition("ready");
|
|
163
|
-
e2.addEventListener("open", t2), e2.addEventListener("message", this.handlers.onMessage);
|
|
164
|
-
const s2 = () => {
|
|
165
|
-
e2.removeEventListener("open", t2), e2.removeEventListener("close", s2), e2.removeEventListener("message", this.handlers.onMessage), "TERMINATED" !== this.stateMachine.state && "STOPPED" !== this.stateMachine.state && this.stateMachine.transition("queueAutoReconnect");
|
|
166
|
-
};
|
|
167
|
-
e2.addEventListener("close", s2);
|
|
167
|
+
this.stateMachine.transition("startWs");
|
|
168
168
|
}
|
|
169
169
|
send(e2) {
|
|
170
170
|
return "READY" === this.stateMachine.state ? (this.socket.send(e2), c(void 0)) : l("SOCKET_NOT_READY");
|
|
171
171
|
}
|
|
172
172
|
terminate() {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.socket.close(1e3);
|
|
176
|
-
const e2 = new Event("close"), t2 = Object.assign(e2, { code: 1e3, reason: "", wasClean: true });
|
|
177
|
-
this.socket.dispatchEvent(t2);
|
|
178
|
-
} else this.socket.close(1e3);
|
|
173
|
+
const e2 = this.socket;
|
|
174
|
+
this.stateMachine.canTransition("onClose") && this.stateMachine.transition("onClose"), e2 && ("terminate" in e2 ? e2.terminate() : e2.close(1e3));
|
|
179
175
|
}
|
|
180
176
|
destroy() {
|
|
181
177
|
this.stateMachine.transition("destroy");
|
|
182
178
|
}
|
|
183
179
|
}
|
|
184
|
-
|
|
185
|
-
constructor() {
|
|
186
|
-
this.initialDelayMs = 200 + 200 * Math.random(), this.exponentialFactor = 1.2, this.maxDelayMs = 1e4, this.currentDelayMs = this.initialDelayMs;
|
|
187
|
-
}
|
|
188
|
-
request(e2) {
|
|
189
|
-
const t2 = r(this.currentDelayMs, 0.05);
|
|
190
|
-
n(this.currentDelayMs).then(() => e2()), this.currentDelayMs = Math.min(t2 * this.exponentialFactor, this.maxDelayMs);
|
|
191
|
-
}
|
|
192
|
-
resetDelay() {
|
|
193
|
-
this.currentDelayMs = this.initialDelayMs;
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
class v {
|
|
180
|
+
class g {
|
|
197
181
|
constructor(e2, t2) {
|
|
198
|
-
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) });
|
|
199
183
|
}
|
|
200
184
|
call(e2, t2, s2, n2) {
|
|
201
185
|
const r2 = `/${s2.map((e3) => encodeURIComponent(e3)).join("/")}`, i2 = JSON.stringify([e2, t2, r2, n2]);
|
|
@@ -232,7 +216,7 @@ class v {
|
|
|
232
216
|
else this.handlers.onAuthExpired();
|
|
233
217
|
}
|
|
234
218
|
}
|
|
235
|
-
class
|
|
219
|
+
class v {
|
|
236
220
|
constructor(e2) {
|
|
237
221
|
this.delayMs = e2, this.timeout = void 0;
|
|
238
222
|
}
|
|
@@ -245,7 +229,7 @@ class b {
|
|
|
245
229
|
void 0 !== this.timeout && (clearTimeout(this.timeout), this.timeout = void 0);
|
|
246
230
|
}
|
|
247
231
|
}
|
|
248
|
-
class
|
|
232
|
+
class b {
|
|
249
233
|
constructor() {
|
|
250
234
|
this.i = -1;
|
|
251
235
|
}
|
|
@@ -258,7 +242,7 @@ class y {
|
|
|
258
242
|
}
|
|
259
243
|
class w {
|
|
260
244
|
constructor(e2, t2) {
|
|
261
|
-
this.handlers = t2, this.seqCounter = new
|
|
245
|
+
this.handlers = t2, this.seqCounter = new b(), this.responseHandlers = {}, this.heartbeats = new y(this), this.socket = new g(e2, { onUpstreamRestarting: () => {
|
|
262
246
|
this.heartbeats.serverActive(), this.handlers.onUpstreamRestarting();
|
|
263
247
|
}, onOpen: () => {
|
|
264
248
|
this.heartbeats.clientActive(), this.heartbeats.serverActive(), this.handlers.onReady();
|
|
@@ -301,9 +285,9 @@ class w {
|
|
|
301
285
|
this.socket.terminate();
|
|
302
286
|
}
|
|
303
287
|
}
|
|
304
|
-
class
|
|
288
|
+
class y {
|
|
305
289
|
constructor(e2) {
|
|
306
|
-
this.connection = e2, this.clientInactivityTimer = new
|
|
290
|
+
this.connection = e2, this.clientInactivityTimer = new v(25e3), this.serverInactivityTimer = new v(1e4), this.serverTimeoutTimer = new v(5e3);
|
|
307
291
|
}
|
|
308
292
|
clientActive() {
|
|
309
293
|
this.clientInactivityTimer.schedule(() => {
|
|
@@ -325,7 +309,7 @@ class A {
|
|
|
325
309
|
});
|
|
326
310
|
}
|
|
327
311
|
}
|
|
328
|
-
class
|
|
312
|
+
class A {
|
|
329
313
|
constructor(e2, t2, s2) {
|
|
330
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* () {
|
|
331
315
|
yield this.renewSession();
|
|
@@ -388,7 +372,7 @@ class C {
|
|
|
388
372
|
});
|
|
389
373
|
}
|
|
390
374
|
}
|
|
391
|
-
class
|
|
375
|
+
class C {
|
|
392
376
|
constructor(e2, t2, s2) {
|
|
393
377
|
this.handlers = s2, this.stateMachine = new u("StopStartConnection", ["STOPPED", "WAITING_FOR_WS", "READY", "TERMINATED"], { unexpectedDisconnect: { from: ["READY"], to: "WAITING_FOR_WS", afterTransition: () => {
|
|
394
378
|
this.inactivityTimer.stop(), this.handlers.onNotReady();
|
|
@@ -402,7 +386,7 @@ class E {
|
|
|
402
386
|
}), this.handlers.onReady();
|
|
403
387
|
} }, destroy: { from: "ANY", to: "TERMINATED", afterTransition: () => {
|
|
404
388
|
this.inactivityTimer.stop(), this.connection.destroy();
|
|
405
|
-
} } }), this.pendingCalls = 0, this.activeSubscriptions = 0, this.inactivityTimer = new
|
|
389
|
+
} } }), this.pendingCalls = 0, this.activeSubscriptions = 0, this.inactivityTimer = new v(3e3), this.connection = new A(e2, t2, { onUpstreamRestarting: () => {
|
|
406
390
|
this.handlers.onUpstreamRestarting();
|
|
407
391
|
}, onReady: () => {
|
|
408
392
|
this.stateMachine.transition("ready");
|
|
@@ -434,7 +418,7 @@ class E {
|
|
|
434
418
|
return "READY" === this.stateMachine.state;
|
|
435
419
|
}
|
|
436
420
|
}
|
|
437
|
-
class
|
|
421
|
+
class E {
|
|
438
422
|
constructor(e2, t2, s2) {
|
|
439
423
|
this.handlers = s2, this.stateMachine = new u("QueuedConnection", ["NOT_READY", "PROCESSING_QUEUE", "READY", "TERMINATED"], { processQueue: { from: ["NOT_READY"], to: "PROCESSING_QUEUE", afterTransition: () => {
|
|
440
424
|
this.sendQueuedCalls();
|
|
@@ -449,7 +433,7 @@ class k {
|
|
|
449
433
|
e3 == null ? void 0 : e3.clientErr("SESSION_DESTROYED");
|
|
450
434
|
}
|
|
451
435
|
this.connection.destroy();
|
|
452
|
-
} } }), this.subscribeQueue = {}, this.callQueue = [], this.connection = new
|
|
436
|
+
} } }), this.subscribeQueue = {}, this.callQueue = [], this.connection = new C(e2, t2, { onUpstreamRestarting: () => {
|
|
453
437
|
this.handlers.onUpstreamRestarting();
|
|
454
438
|
}, onReady: () => {
|
|
455
439
|
this.stateMachine.transition("processQueue");
|
|
@@ -485,12 +469,14 @@ class k {
|
|
|
485
469
|
}
|
|
486
470
|
sendQueuedCalls() {
|
|
487
471
|
return __async(this, null, function* () {
|
|
472
|
+
let e2 = 0;
|
|
488
473
|
for (; "PROCESSING_QUEUE" === this.stateMachine.state; ) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
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)));
|
|
494
480
|
}
|
|
495
481
|
});
|
|
496
482
|
}
|
|
@@ -498,10 +484,10 @@ class k {
|
|
|
498
484
|
return "READY" === this.stateMachine.state || "PROCESSING_QUEUE" === this.stateMachine.state;
|
|
499
485
|
}
|
|
500
486
|
}
|
|
501
|
-
const
|
|
502
|
-
class
|
|
487
|
+
const k = "undefined" != typeof window ? (_a = window.queueMicrotask) != null ? _a : setTimeout : setTimeout;
|
|
488
|
+
class x {
|
|
503
489
|
constructor(e2, t2) {
|
|
504
|
-
this.clearPendingBatch = e2, this.sendCalls = t2, this.sent = false,
|
|
490
|
+
this.clearPendingBatch = e2, this.sendCalls = t2, this.sent = false, k(() => this.send());
|
|
505
491
|
}
|
|
506
492
|
send() {
|
|
507
493
|
this.sent || (this.sent = true, this.clearPendingBatch(), this.sendCalls());
|
|
@@ -510,7 +496,7 @@ class S {
|
|
|
510
496
|
this.sent = true;
|
|
511
497
|
}
|
|
512
498
|
}
|
|
513
|
-
class T extends
|
|
499
|
+
class T extends x {
|
|
514
500
|
constructor(e2, t2) {
|
|
515
501
|
super(t2, () => {
|
|
516
502
|
this.sendSubscribe(), this.sendGet();
|
|
@@ -543,12 +529,12 @@ class T extends S {
|
|
|
543
529
|
this.connection.call("SUBSCRIBE", ["users"], { ids: e2 }).then((e3) => this.subscribeCalls.forEach((t2) => t2.deferred.resolve(e3)));
|
|
544
530
|
}
|
|
545
531
|
}
|
|
546
|
-
class
|
|
532
|
+
class I extends x {
|
|
547
533
|
constructor(e2, t2, s2) {
|
|
548
534
|
super(s2, () => this.sendMutate()), this.conversationId = e2, this.connection = t2, this.calls = [];
|
|
549
535
|
}
|
|
550
536
|
canPush(e2, t2) {
|
|
551
|
-
return !!
|
|
537
|
+
return !!I.isCorrectBatchTypeFor(e2, t2) && t2[1] === this.conversationId;
|
|
552
538
|
}
|
|
553
539
|
static isCorrectBatchTypeFor(e2, t2) {
|
|
554
540
|
return s(t2, ["conversations", "*", "participants", "*"]) && ("PUT" === e2 || "POST" === e2 || "PATCH" === e2);
|
|
@@ -569,9 +555,9 @@ class D extends S {
|
|
|
569
555
|
});
|
|
570
556
|
}
|
|
571
557
|
}
|
|
572
|
-
class
|
|
558
|
+
class S {
|
|
573
559
|
constructor(e2, t2, s2) {
|
|
574
|
-
this.pendingBatch = null, this.connection = new
|
|
560
|
+
this.pendingBatch = null, this.connection = new E(e2, t2, s2);
|
|
575
561
|
}
|
|
576
562
|
call(e2, t2, s2) {
|
|
577
563
|
return __async(this, null, function* () {
|
|
@@ -591,17 +577,17 @@ class I {
|
|
|
591
577
|
}
|
|
592
578
|
createEmptyBatchFor(e2, t2) {
|
|
593
579
|
if (T.isCorrectBatchTypeFor(e2, t2)) return new T(this.connection, () => this.pendingBatch = null);
|
|
594
|
-
if (
|
|
580
|
+
if (I.isCorrectBatchTypeFor(e2, t2)) {
|
|
595
581
|
const e3 = t2[1];
|
|
596
|
-
return new
|
|
582
|
+
return new I(e3, this.connection, () => this.pendingBatch = null);
|
|
597
583
|
}
|
|
598
584
|
return null;
|
|
599
585
|
}
|
|
600
586
|
}
|
|
601
|
-
const
|
|
602
|
-
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 F {
|
|
603
589
|
constructor(e2, t2, s2) {
|
|
604
|
-
this.throttler = new M(), this.alive = true, this.connection = new
|
|
590
|
+
this.throttler = new M(), this.alive = true, this.connection = new S(e2, t2, s2);
|
|
605
591
|
}
|
|
606
592
|
call(e2, t2, s2) {
|
|
607
593
|
return __async(this, null, function* () {
|
|
@@ -610,7 +596,7 @@ class B {
|
|
|
610
596
|
const r2 = yield this.connection.call(e2, t2, s2);
|
|
611
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;
|
|
612
598
|
if (r2.ok || "client" !== r2.where) {
|
|
613
|
-
const e3 = r2.value, t3 = e3.status, s3 =
|
|
599
|
+
const e3 = r2.value, t3 = e3.status, s3 = D[t3];
|
|
614
600
|
if ("RESOLVE" === s3) return this.throttler.resetDelay(), r2;
|
|
615
601
|
if ("RETRY" === s3) continue;
|
|
616
602
|
if ("DELAY" === s3) {
|
|
@@ -647,21 +633,21 @@ class M {
|
|
|
647
633
|
this.currentDelayMs = this.initialDelayMs;
|
|
648
634
|
}
|
|
649
635
|
}
|
|
650
|
-
function
|
|
636
|
+
function B(e2) {
|
|
651
637
|
return e2.map((e3) => encodeURIComponent(e3)).join();
|
|
652
638
|
}
|
|
653
|
-
class
|
|
639
|
+
class R {
|
|
654
640
|
constructor() {
|
|
655
641
|
this.paths = {};
|
|
656
642
|
}
|
|
657
643
|
add(e2) {
|
|
658
|
-
this.paths[
|
|
644
|
+
this.paths[B(e2)] = e2;
|
|
659
645
|
}
|
|
660
646
|
delete(e2) {
|
|
661
|
-
delete this.paths[
|
|
647
|
+
delete this.paths[B(e2)];
|
|
662
648
|
}
|
|
663
649
|
has(e2) {
|
|
664
|
-
return Object.hasOwnProperty.call(this.paths,
|
|
650
|
+
return Object.hasOwnProperty.call(this.paths, B(e2));
|
|
665
651
|
}
|
|
666
652
|
clear() {
|
|
667
653
|
this.paths = {};
|
|
@@ -670,9 +656,9 @@ class N {
|
|
|
670
656
|
Object.values(this.paths).forEach((t2) => e2(t2));
|
|
671
657
|
}
|
|
672
658
|
}
|
|
673
|
-
class
|
|
659
|
+
class N {
|
|
674
660
|
constructor(e2, t2, s2) {
|
|
675
|
-
this.handlers = s2, this.targetSubscriptions = new
|
|
661
|
+
this.handlers = s2, this.targetSubscriptions = new R(), this.connection = new F(e2, t2, { onUpstreamRestarting: () => this.handlers.onUpstreamRestarting(), onSubscriptionsLost: () => {
|
|
676
662
|
this.targetSubscriptions.forEach((e3) => {
|
|
677
663
|
this.resubscribe(e3);
|
|
678
664
|
}), this.handlers.onResubscribeSent();
|
|
@@ -706,10 +692,10 @@ class _ {
|
|
|
706
692
|
return this.connection.isConnected();
|
|
707
693
|
}
|
|
708
694
|
}
|
|
709
|
-
function
|
|
695
|
+
function P(e2, t2) {
|
|
710
696
|
return void 0 === t2 ? e2 : t2;
|
|
711
697
|
}
|
|
712
|
-
function
|
|
698
|
+
function _(e2, t2) {
|
|
713
699
|
if (void 0 === t2) return e2;
|
|
714
700
|
if (null === t2) return {};
|
|
715
701
|
const s2 = __spreadValues({}, e2);
|
|
@@ -719,25 +705,25 @@ function P(e2, t2) {
|
|
|
719
705
|
}
|
|
720
706
|
return s2;
|
|
721
707
|
}
|
|
722
|
-
function
|
|
708
|
+
function O(e2, t2) {
|
|
723
709
|
if (e2 === t2) return true;
|
|
724
710
|
if (!e2 || !t2) return false;
|
|
725
711
|
if ("object" != typeof e2 || "object" != typeof t2) return false;
|
|
726
712
|
if (e2.constructor !== t2.constructor) return false;
|
|
727
713
|
if (Array.isArray(e2) && Array.isArray(t2)) {
|
|
728
714
|
if (e2.length !== t2.length) return false;
|
|
729
|
-
for (let s2 = 0; s2 < e2.length; s2++) if (!
|
|
715
|
+
for (let s2 = 0; s2 < e2.length; s2++) if (!O(e2[s2], t2[s2])) return false;
|
|
730
716
|
} else {
|
|
731
717
|
const s2 = Object.keys(e2);
|
|
732
718
|
if (s2.length !== Object.keys(t2).length) return false;
|
|
733
719
|
for (const n2 of s2) {
|
|
734
720
|
if (!Object.hasOwnProperty.call(t2, n2)) return false;
|
|
735
|
-
if (!
|
|
721
|
+
if (!O(e2[n2], t2[n2])) return false;
|
|
736
722
|
}
|
|
737
723
|
}
|
|
738
724
|
return true;
|
|
739
725
|
}
|
|
740
|
-
class
|
|
726
|
+
class U {
|
|
741
727
|
constructor() {
|
|
742
728
|
this.prev = Promise.resolve();
|
|
743
729
|
}
|
|
@@ -749,68 +735,117 @@ class j {
|
|
|
749
735
|
}
|
|
750
736
|
}
|
|
751
737
|
class $ {
|
|
738
|
+
constructor(e2) {
|
|
739
|
+
this.initialised = false, this.getPointer = void 0, this.pendingStates = [e2], e2.resultPromise.then(() => this.initialised = true);
|
|
740
|
+
}
|
|
741
|
+
get pendingPointer() {
|
|
742
|
+
if (0 !== this.pendingStates.length) return this.pendingStates[this.pendingStates.length - 1];
|
|
743
|
+
}
|
|
744
|
+
get mostRecentState() {
|
|
745
|
+
var _a2;
|
|
746
|
+
return (_a2 = this.pendingPointer) != null ? _a2 : this.getPointer;
|
|
747
|
+
}
|
|
748
|
+
canAppendState(e2) {
|
|
749
|
+
var _a2, _b;
|
|
750
|
+
const t2 = (_a2 = this.getPointer) == null ? void 0 : _a2.seq;
|
|
751
|
+
if (void 0 !== t2 && e2 <= t2) return false;
|
|
752
|
+
const s2 = (_b = this.pendingPointer) == null ? void 0 : _b.seq;
|
|
753
|
+
return !(void 0 !== s2 && e2 < s2);
|
|
754
|
+
}
|
|
755
|
+
set(e2) {
|
|
756
|
+
if (!this.canAppendState(e2.seq)) throw "Appending in the past";
|
|
757
|
+
this.pendingStates.push(e2);
|
|
758
|
+
}
|
|
759
|
+
mutate(e2, t2) {
|
|
760
|
+
if (!this.initialised) return;
|
|
761
|
+
if (!this.canAppendState(e2)) throw "Mutating in the past";
|
|
762
|
+
const s2 = this.mostRecentState.resultPromise.then((e3) => e3.ok ? t2(e3) : e3);
|
|
763
|
+
this.pendingStates.push({ seq: e2, resultPromise: s2 });
|
|
764
|
+
}
|
|
765
|
+
get(e2) {
|
|
766
|
+
if (void 0 !== this.getPointer && e2 < this.getPointer.seq) throw `Trying to load state ${e2} when we have previously loaded ${this.getPointer.seq}`;
|
|
767
|
+
for (; this.pendingStates.length > 0 && this.pendingStates[0].seq <= e2; ) this.getPointer = this.pendingStates.shift();
|
|
768
|
+
return this.getPointer;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
class j extends $ {
|
|
752
772
|
constructor(e2, t2) {
|
|
753
|
-
this.onTeardown = t2, this.
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
773
|
+
super(e2), this.onTeardown = t2, this._error = null, this._lastGoodState = Promise.resolve(void 0);
|
|
774
|
+
}
|
|
775
|
+
get error() {
|
|
776
|
+
return this._error;
|
|
777
|
+
}
|
|
778
|
+
get lastGoodState() {
|
|
779
|
+
return this._lastGoodState;
|
|
780
|
+
}
|
|
781
|
+
mutate(e2, t2) {
|
|
782
|
+
super.mutate(e2, t2), this.registerNewState(this.mostRecentState.resultPromise);
|
|
783
|
+
}
|
|
784
|
+
set(e2) {
|
|
785
|
+
super.set(e2), this.registerNewState(this.mostRecentState.resultPromise);
|
|
786
|
+
}
|
|
787
|
+
registerNewState(e2) {
|
|
761
788
|
const t2 = this.lastGoodState;
|
|
762
|
-
this.
|
|
789
|
+
this._lastGoodState = e2.then((e3) => e3.ok ? e3.value : t2), e2.then((e3) => {
|
|
763
790
|
e3.ok || this.setError(e3);
|
|
764
|
-
})
|
|
791
|
+
});
|
|
765
792
|
}
|
|
766
|
-
|
|
767
|
-
|
|
793
|
+
setError(e2) {
|
|
794
|
+
var _a2;
|
|
795
|
+
this._error || (this._error = e2, (_a2 = this.onTeardown) == null ? void 0 : _a2.call(this, e2), this.lastGoodState.then((e3) => {
|
|
796
|
+
void 0 !== e3 && this.teardownNested(e3);
|
|
797
|
+
}));
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
class W extends j {
|
|
801
|
+
constructor(e2) {
|
|
802
|
+
super({ seq: 0, resultPromise: new Promise((e3) => setTimeout(e3)).then(() => this.fetchInitial(0)) }, e2), this.getDeepMutex = new U(), this.lastDeep = void 0;
|
|
768
803
|
}
|
|
769
804
|
refetchInitial(e2) {
|
|
770
805
|
return __async(this, null, function* () {
|
|
771
|
-
const t2 = this.
|
|
772
|
-
if (void 0 === n2) return r2;
|
|
806
|
+
const t2 = this.mostRecentState.resultPromise, s2 = this.fetchInitial(e2), [n2, r2] = yield Promise.all([t2, s2]);
|
|
807
|
+
if (void 0 === n2 || !n2.ok) return r2;
|
|
773
808
|
if (!r2.ok) return r2;
|
|
774
|
-
return this.equal(n2, r2.value) ?
|
|
809
|
+
return this.equal(n2.value, r2.value) ? n2 : r2;
|
|
775
810
|
});
|
|
776
811
|
}
|
|
777
812
|
refetch(e2) {
|
|
778
|
-
if (this.error) return;
|
|
813
|
+
if (null !== this.error) return;
|
|
779
814
|
const t2 = { seq: e2, resultPromise: this.refetchInitial(e2) };
|
|
780
|
-
this.
|
|
815
|
+
this.set(t2);
|
|
781
816
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
817
|
+
changedBetween(e2, t2) {
|
|
818
|
+
return __async(this, null, function* () {
|
|
819
|
+
if (e2 >= t2) return false;
|
|
820
|
+
const s2 = this.get(t2), n2 = yield s2.resultPromise;
|
|
821
|
+
if (!n2.ok) return false;
|
|
822
|
+
if (n2.value.lastChanged > e2) return true;
|
|
823
|
+
return yield this.anyChildChanged(e2, t2, n2.value);
|
|
824
|
+
});
|
|
788
825
|
}
|
|
789
826
|
getDeep(e2) {
|
|
790
827
|
return __async(this, null, function* () {
|
|
791
828
|
return this.getDeepMutex.runExclusive(() => __async(this, null, function* () {
|
|
792
|
-
|
|
793
|
-
if (
|
|
794
|
-
|
|
795
|
-
if (
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
829
|
+
var _a2;
|
|
830
|
+
if (null !== this.error) return this.error;
|
|
831
|
+
const t2 = (_a2 = this.lastDeep) == null ? void 0 : _a2.seq;
|
|
832
|
+
if (e2 === t2) return this.lastDeep.deep;
|
|
833
|
+
if (void 0 !== t2) {
|
|
834
|
+
if (e2 < t2) throw `Trying to load seq ${e2} when we have previously loaded seq ${t2}`;
|
|
835
|
+
if (!(yield this.changedBetween(t2, e2))) return this.lastDeep.seq = e2, this.lastDeep.deep;
|
|
836
|
+
}
|
|
837
|
+
const s2 = this.get(e2).resultPromise, n2 = s2.then((t3) => t3.ok ? this.loadNested(e2, t3.value) : t3);
|
|
838
|
+
this.lastDeep = { seq: e2, shallow: s2, deep: n2 };
|
|
839
|
+
const r2 = yield n2;
|
|
840
|
+
return r2.ok || this.setError(r2), r2;
|
|
800
841
|
}));
|
|
801
842
|
});
|
|
802
843
|
}
|
|
803
|
-
setError(e2) {
|
|
804
|
-
var _a2;
|
|
805
|
-
this.error || (this.error = e2, (_a2 = this.onTeardown) == null ? void 0 : _a2.call(this, e2), this.lastGoodState.then((e3) => {
|
|
806
|
-
void 0 !== e3 && this.teardownNested(e3);
|
|
807
|
-
}));
|
|
808
|
-
}
|
|
809
844
|
}
|
|
810
|
-
class
|
|
811
|
-
constructor(e2, t2
|
|
812
|
-
super(
|
|
813
|
-
yield this.emit(
|
|
845
|
+
class q extends W {
|
|
846
|
+
constructor(e2, t2) {
|
|
847
|
+
super(t2), this.emitMutex = e2, this.unsubscribeTimer = new H(), this.referencedByOtherStores = 0, this.listeners = [], this.lastEmitSeq = void 0, this.lastEmitResult = void 0, e2.runExclusive(() => __async(this, null, function* () {
|
|
848
|
+
yield this.emit(0);
|
|
814
849
|
}));
|
|
815
850
|
}
|
|
816
851
|
registerInternalSubscription() {
|
|
@@ -833,19 +868,24 @@ class W extends $ {
|
|
|
833
868
|
this.setError(l("UNSUBSCRIBED"));
|
|
834
869
|
}, this.unsubscribeDebounceMs);
|
|
835
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
|
+
}
|
|
836
876
|
emit(e2) {
|
|
837
877
|
return __async(this, null, function* () {
|
|
838
878
|
var _a2;
|
|
879
|
+
if (this.onlyUsedInternally) return;
|
|
839
880
|
if (this.lastEmitSeq && this.lastEmitSeq >= e2) return;
|
|
840
881
|
if (false === ((_a2 = this.lastEmitResult) == null ? void 0 : _a2.ok)) return;
|
|
841
|
-
const t2 = this.lastEmitSeq;
|
|
842
882
|
this.lastEmitSeq = e2;
|
|
843
|
-
const
|
|
844
|
-
this.lastEmitResult
|
|
883
|
+
const t2 = yield this.getDeep(e2);
|
|
884
|
+
t2 !== this.lastEmitResult && (this.lastEmitResult = t2, this.listeners.forEach((e3) => e3(t2)));
|
|
845
885
|
});
|
|
846
886
|
}
|
|
847
887
|
}
|
|
848
|
-
class
|
|
888
|
+
class H {
|
|
849
889
|
constructor() {
|
|
850
890
|
this.timerId = void 0;
|
|
851
891
|
}
|
|
@@ -856,9 +896,9 @@ class q {
|
|
|
856
896
|
clearTimeout(this.timerId);
|
|
857
897
|
}
|
|
858
898
|
}
|
|
859
|
-
class
|
|
860
|
-
constructor(e2, t2, s2, n2
|
|
861
|
-
super(
|
|
899
|
+
class G extends q {
|
|
900
|
+
constructor(e2, t2, s2, n2) {
|
|
901
|
+
super(s2, n2), this.userId = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 1e4;
|
|
862
902
|
}
|
|
863
903
|
fetchInitial(e2) {
|
|
864
904
|
return __async(this, null, function* () {
|
|
@@ -867,7 +907,7 @@ class H extends W {
|
|
|
867
907
|
});
|
|
868
908
|
}
|
|
869
909
|
equal(e2, t2) {
|
|
870
|
-
return
|
|
910
|
+
return O(e2.snapshot, t2.snapshot);
|
|
871
911
|
}
|
|
872
912
|
loadNested(e2, t2) {
|
|
873
913
|
return __async(this, null, function* () {
|
|
@@ -875,52 +915,57 @@ class H extends W {
|
|
|
875
915
|
});
|
|
876
916
|
}
|
|
877
917
|
userCreated(e2, t2) {
|
|
878
|
-
this.mutate(e2, () => c({ snapshot: this.realtimeClient.createUserSnapshot(t2.state), lastChanged: e2 }));
|
|
918
|
+
this.mutate(e2, (s2) => null !== s2.value.snapshot ? s2 : c({ snapshot: this.realtimeClient.createUserSnapshot(t2.state), lastChanged: e2 }));
|
|
879
919
|
}
|
|
880
920
|
userEdited(e2, t2) {
|
|
881
921
|
this.mutate(e2, (s2) => {
|
|
882
922
|
const n2 = s2.value.snapshot;
|
|
883
923
|
if (null === n2) return console.warn("[TalkJS] Received a 'used edited' event for a user that we thought didn't exist."), s2;
|
|
884
|
-
return c({ snapshot: { id: n2.id, name:
|
|
924
|
+
return c({ snapshot: { id: n2.id, name: P(n2.name, t2.diff.name), custom: _(n2.custom, t2.diff.custom), locale: P(n2.locale, t2.diff.locale), photoUrl: P(n2.photoUrl, t2.diff.photoUrl), role: P(n2.role, t2.diff.role), welcomeMessage: P(n2.welcomeMessage, t2.diff.welcomeMessage) }, lastChanged: e2 });
|
|
885
925
|
});
|
|
886
926
|
}
|
|
887
927
|
getFromCache() {
|
|
888
928
|
return __async(this, null, function* () {
|
|
889
|
-
const e2 = yield this.
|
|
929
|
+
const e2 = yield this.mostRecentState.resultPromise;
|
|
890
930
|
return e2.ok ? null === e2.value.snapshot ? h({ status: 404, errorCode: "USER_NOT_FOUND", reasons: ["That user does not exist yet"] }) : c({ status: 200, data: { id: e2.value.snapshot.id, name: e2.value.snapshot.name, custom: e2.value.snapshot.custom, locale: e2.value.snapshot.locale, photoUrl: e2.value.snapshot.photoUrl, role: e2.value.snapshot.role, welcomeMessage: e2.value.snapshot.welcomeMessage } }) : l("NOT_IN_CACHE");
|
|
891
931
|
});
|
|
892
932
|
}
|
|
893
933
|
teardownNested(e2) {
|
|
894
934
|
}
|
|
935
|
+
anyChildChanged(e2, t2, s2) {
|
|
936
|
+
return __async(this, null, function* () {
|
|
937
|
+
return false;
|
|
938
|
+
});
|
|
939
|
+
}
|
|
895
940
|
}
|
|
896
|
-
var
|
|
897
|
-
function
|
|
941
|
+
var L, z = {};
|
|
942
|
+
function J(e2, t2) {
|
|
898
943
|
const s2 = t2.lastIndex;
|
|
899
944
|
let n2;
|
|
900
945
|
const r2 = [];
|
|
901
946
|
for (; null !== (n2 = t2.exec(e2)); ) r2.push(n2);
|
|
902
947
|
return t2.lastIndex = s2, r2;
|
|
903
948
|
}
|
|
904
|
-
function
|
|
949
|
+
function Y(e2) {
|
|
905
950
|
const t2 = e2.replace(/%2F/g, "/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/, "$1");
|
|
906
951
|
return decodeURIComponent(t2);
|
|
907
952
|
}
|
|
908
|
-
function
|
|
953
|
+
function Q(e2, t2) {
|
|
909
954
|
if (!e2() && !t2) {
|
|
910
955
|
t2 = e2.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/, "`$1`") + " was not true";
|
|
911
956
|
}
|
|
912
957
|
}
|
|
913
958
|
!function() {
|
|
914
|
-
if (
|
|
959
|
+
if (L) return z;
|
|
915
960
|
function e2(e3) {
|
|
916
961
|
return String.fromCharCode(parseInt(e3.slice(1), 16));
|
|
917
962
|
}
|
|
918
963
|
function t2(e3) {
|
|
919
964
|
return `%${`00${e3.charCodeAt(0).toString(16)}`.slice(-2)}`;
|
|
920
965
|
}
|
|
921
|
-
|
|
966
|
+
L = 1, Object.defineProperty(z, "__esModule", { value: true }), z.encode = function(t3) {
|
|
922
967
|
return btoa(encodeURIComponent(t3).replace(/%[0-9A-F]{2}/g, e2));
|
|
923
|
-
},
|
|
968
|
+
}, z.decode = function(e3) {
|
|
924
969
|
return decodeURIComponent(Array.from(atob(e3), t2).join(""));
|
|
925
970
|
};
|
|
926
971
|
}(), ((e2) => {
|
|
@@ -954,51 +999,51 @@ function Y(e2, t2) {
|
|
|
954
999
|
}, e2.falsy = function(e3) {
|
|
955
1000
|
}, e2.never = function(e3) {
|
|
956
1001
|
};
|
|
957
|
-
})(
|
|
958
|
-
const
|
|
959
|
-
function Z(e2) {
|
|
960
|
-
if (!V.test(e2)) return false;
|
|
961
|
-
return !K(e2).test("");
|
|
962
|
-
}
|
|
1002
|
+
})(Q || (Q = {}));
|
|
1003
|
+
const V = Q, Z = /^\/.*[^\\]\/[im]*$/;
|
|
963
1004
|
function K(e2) {
|
|
1005
|
+
if (!Z.test(e2)) return false;
|
|
1006
|
+
return !X(e2).test("");
|
|
1007
|
+
}
|
|
1008
|
+
function X(e2) {
|
|
964
1009
|
const t2 = e2.match(/^\/(.*[^\\])\/(.*)$/);
|
|
965
1010
|
if (!t2) throw new Error(`Expected ${e2} to be a (non-empty) regex`);
|
|
966
1011
|
let s2 = t2[2] || "";
|
|
967
1012
|
return s2 = s2.replace(/[^im]/g, "") + "g", new RegExp(t2[1], s2);
|
|
968
1013
|
}
|
|
969
|
-
class
|
|
1014
|
+
class ee {
|
|
970
1015
|
constructor({ mode: e2, allowedHostnames: t2, allowedPhoneNrs: s2, allowedMatches: n2, forbiddenMatches: r2, suppressLinks: i2, suppressEmailAddresses: a2, suppressPhoneNumbers: o2, replacement: u2 }) {
|
|
971
|
-
|
|
1016
|
+
V.oneOf(e2, ["all", "otherOnly", "off"]), this.mode = e2, this.suppressLinks = false !== i2, this.suppressEmailAddresses = false !== a2, this.suppressPhoneNumbers = false !== o2, this.allowedHostnames = t2 || [], this.allowedPhoneNrs = (s2 || []).filter((e3) => e3).map((e3) => e3.replace(/[^0-9]/g, "")), this.allowedMatches = (n2 || []).filter(K).map((e3) => X(e3)), this.forbiddenMatches = (r2 || []).filter(K).map((e3) => X(e3)), V(() => this.allowedMatches.every((e3) => e3.flags.includes("g")), "All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"), V(() => this.forbiddenMatches.every((e3) => e3.flags.includes("g")), "All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"), u2 = u2 == null ? void 0 : u2.trim(), this.replacement = u2 && u2.length > 0 ? u2 : void 0;
|
|
972
1017
|
}
|
|
973
1018
|
shouldSuppress({ isContentBySender: e2 }) {
|
|
974
1019
|
return "all" === this.mode || "otherOnly" === this.mode && !e2;
|
|
975
1020
|
}
|
|
976
1021
|
}
|
|
977
|
-
function
|
|
1022
|
+
function te(e2, t2) {
|
|
978
1023
|
const s2 = e2.map((e3) => function(e4, t3) {
|
|
979
1024
|
if ("text" === e4.type) return function(e5, t4) {
|
|
980
1025
|
const s3 = function(e6) {
|
|
981
1026
|
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l;
|
|
982
1027
|
let t5 = "";
|
|
983
|
-
return e6.t && (t5 = `(${e6.t("CONTACT_INFORMATION_HIDDEN")})`), { formattedLinks: (_a2 = e6.formattedLinks) != null ? _a2 : "plaintext", markup: (_b = e6.markup) != null ? _b : false, useFallbackMentions: (_c = e6.useFallbackMentions) != null ? _c : false, sameTabLinkRules: (_d = e6.sameTabLinkRules) != null ? _d : [], enableEmojiImageFallback: (_e2 = e6.enableEmojiImageFallback) != null ? _e2 : false, highlight: (_f = e6.highlight) != null ? _f : [], contactInfo: (_g = e6.contactInfo) != null ? _g : false, suppression: (_h = e6.suppression) != null ? _h : new
|
|
1028
|
+
return e6.t && (t5 = `(${e6.t("CONTACT_INFORMATION_HIDDEN")})`), { formattedLinks: (_a2 = e6.formattedLinks) != null ? _a2 : "plaintext", markup: (_b = e6.markup) != null ? _b : false, useFallbackMentions: (_c = e6.useFallbackMentions) != null ? _c : false, sameTabLinkRules: (_d = e6.sameTabLinkRules) != null ? _d : [], enableEmojiImageFallback: (_e2 = e6.enableEmojiImageFallback) != null ? _e2 : false, highlight: (_f = e6.highlight) != null ? _f : [], contactInfo: (_g = e6.contactInfo) != null ? _g : false, suppression: (_h = e6.suppression) != null ? _h : new ee({ mode: "off" }), contactInfoHiddenText: (_k = (_j = e6.contactInfoHiddenText) != null ? _j : (_i = e6.suppression) == null ? void 0 : _i.replacement) != null ? _k : t5, customEmojiUrls: (_l = e6.customEmojiUrls) != null ? _l : {} };
|
|
984
1029
|
}(t4);
|
|
985
|
-
return
|
|
1030
|
+
return se(e5, s3);
|
|
986
1031
|
}(e4.children, t3);
|
|
987
|
-
if ("file" === e4.type && "video" === e4.subtype) return `🎥 ${
|
|
988
|
-
if ("file" === e4.type && "image" === e4.subtype) return `📷 ${
|
|
989
|
-
if ("file" === e4.type && "audio" === e4.subtype) return `🎧 ${
|
|
1032
|
+
if ("file" === e4.type && "video" === e4.subtype) return `🎥 ${Y(e4.url)}`;
|
|
1033
|
+
if ("file" === e4.type && "image" === e4.subtype) return `📷 ${Y(e4.url)}`;
|
|
1034
|
+
if ("file" === e4.type && "audio" === e4.subtype) return `🎧 ${Y(e4.url)}`;
|
|
990
1035
|
if ("file" === e4.type && "voice" === e4.subtype) {
|
|
991
1036
|
const t4 = e4.duration;
|
|
992
1037
|
if (void 0 === t4) return "🎙️";
|
|
993
1038
|
return `🎙️ (${Math.floor(t4 / 60)}:${Math.floor(t4 % 60).toString().padStart(2, "0")})`;
|
|
994
1039
|
}
|
|
995
|
-
if ("file" === e4.type) return e4.subtype, `📎 ${
|
|
1040
|
+
if ("file" === e4.type) return e4.subtype, `📎 ${Y(e4.url)}`;
|
|
996
1041
|
if ("location" === e4.type) return "📍";
|
|
997
1042
|
return "";
|
|
998
1043
|
}(e3, t2));
|
|
999
1044
|
return s2.join("\n\n");
|
|
1000
1045
|
}
|
|
1001
|
-
function
|
|
1046
|
+
function se(e2, t2) {
|
|
1002
1047
|
return e2.flatMap((e3) => {
|
|
1003
1048
|
if ("string" == typeof e3) return e3;
|
|
1004
1049
|
switch (e3.type) {
|
|
@@ -1011,13 +1056,13 @@ function te(e2, t2) {
|
|
|
1011
1056
|
case "actionLink":
|
|
1012
1057
|
case "actionbutton":
|
|
1013
1058
|
case "actionButton":
|
|
1014
|
-
return
|
|
1059
|
+
return se(e3.children, t2);
|
|
1015
1060
|
case "bulletlist":
|
|
1016
1061
|
case "bulletList":
|
|
1017
|
-
return "\n" +
|
|
1062
|
+
return "\n" + se(e3.children, t2);
|
|
1018
1063
|
case "bulletpoint":
|
|
1019
1064
|
case "bulletPoint":
|
|
1020
|
-
return "- " +
|
|
1065
|
+
return "- " + se(e3.children, t2) + "\n";
|
|
1021
1066
|
case "autolink":
|
|
1022
1067
|
case "autoLink":
|
|
1023
1068
|
case "codeblock":
|
|
@@ -1035,9 +1080,9 @@ function te(e2, t2) {
|
|
|
1035
1080
|
}
|
|
1036
1081
|
}).join("");
|
|
1037
1082
|
}
|
|
1038
|
-
class
|
|
1039
|
-
constructor(e2, t2, s2
|
|
1040
|
-
super(
|
|
1083
|
+
class ne extends W {
|
|
1084
|
+
constructor(e2, t2, s2) {
|
|
1085
|
+
super(), this.conversationId = e2, this.message = t2, this.realtimeClient = s2;
|
|
1041
1086
|
}
|
|
1042
1087
|
get messageId() {
|
|
1043
1088
|
return "string" == typeof this.message ? this.message : this.message.id;
|
|
@@ -1051,42 +1096,49 @@ class se extends $ {
|
|
|
1051
1096
|
if (!e3.ok) return e3;
|
|
1052
1097
|
t2 = e3.value.data;
|
|
1053
1098
|
}
|
|
1054
|
-
return c({ lastChanged: e2, sender: null === t2.senderId ? null : this.realtimeClient.internalSubscribe(["users", t2.senderId]), data: { id: t2.id, type: t2.type, custom: t2.custom, createdAt: t2.createdAt, editedAt: t2.editedAt, referencedMessageId: t2.referencedMessageId, origin: t2.origin, plaintext:
|
|
1099
|
+
return c({ lastChanged: e2, sender: null === t2.senderId ? null : this.realtimeClient.internalSubscribe(["users", t2.senderId]), data: { id: t2.id, type: t2.type, custom: t2.custom, createdAt: t2.createdAt, editedAt: t2.editedAt, referencedMessageId: t2.referencedMessageId, origin: t2.origin, plaintext: te(t2.content, {}), content: t2.content } });
|
|
1055
1100
|
});
|
|
1056
1101
|
}
|
|
1057
1102
|
refetch(e2) {
|
|
1058
1103
|
throw "Do not call refetch on message data stores, it can return outdated data. Destroy and remake them instead";
|
|
1059
1104
|
}
|
|
1060
1105
|
equal(e2, t2) {
|
|
1061
|
-
return
|
|
1106
|
+
return O(e2.data, t2.data);
|
|
1062
1107
|
}
|
|
1063
1108
|
teardownNested(e2) {
|
|
1064
1109
|
var _a2;
|
|
1065
1110
|
(_a2 = e2.sender) == null ? void 0 : _a2.unsubscribe();
|
|
1066
1111
|
}
|
|
1112
|
+
anyChildChanged(e2, t2, s2) {
|
|
1113
|
+
return __async(this, null, function* () {
|
|
1114
|
+
var _a2;
|
|
1115
|
+
const n2 = (_a2 = s2.sender) == null ? void 0 : _a2.store;
|
|
1116
|
+
return true === (yield n2 == null ? void 0 : n2.changedBetween(e2, t2));
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1067
1119
|
loadNested(e2, t2) {
|
|
1068
1120
|
return __async(this, null, function* () {
|
|
1069
|
-
var _a2, _b, _c
|
|
1121
|
+
var _a2, _b, _c;
|
|
1070
1122
|
const s2 = yield (_b = (_a2 = t2.sender) == null ? void 0 : _a2.store) == null ? void 0 : _b.getDeep(e2);
|
|
1071
1123
|
if (false === (s2 == null ? void 0 : s2.ok)) return s2;
|
|
1072
|
-
if (null === t2.data) return c({
|
|
1124
|
+
if (null === t2.data) return c({ snapshot: null });
|
|
1073
1125
|
const n2 = s2 == null ? void 0 : s2.value;
|
|
1074
|
-
return c({
|
|
1126
|
+
return c({ snapshot: { sender: (_c = n2 == null ? void 0 : n2.snapshot) != null ? _c : null, id: t2.data.id, type: t2.data.type, custom: t2.data.custom, createdAt: t2.data.createdAt, editedAt: t2.data.editedAt, origin: t2.data.origin, plaintext: te(t2.data.content, {}), content: t2.data.content, referencedMessageId: t2.data.referencedMessageId } });
|
|
1075
1127
|
});
|
|
1076
1128
|
}
|
|
1077
1129
|
messageEdited(e2, t2) {
|
|
1078
1130
|
this.mutate(e2, (s2) => {
|
|
1079
1131
|
if (null === s2.value.data) return s2;
|
|
1080
|
-
return c({ lastChanged: e2, sender: s2.value.sender, data: { id: s2.value.data.id, type: s2.value.data.type, createdAt: s2.value.data.createdAt, origin: s2.value.data.origin, referencedMessageId: s2.value.data.referencedMessageId, editedAt:
|
|
1132
|
+
return c({ lastChanged: e2, sender: s2.value.sender, data: { id: s2.value.data.id, type: s2.value.data.type, createdAt: s2.value.data.createdAt, origin: s2.value.data.origin, referencedMessageId: s2.value.data.referencedMessageId, editedAt: P(s2.value.data.editedAt, t2.diff.editedAt), custom: _(s2.value.data.custom, t2.diff.custom), content: P(s2.value.data.content, t2.diff.content) } });
|
|
1081
1133
|
});
|
|
1082
1134
|
}
|
|
1083
1135
|
messageDeleted(e2, t2) {
|
|
1084
|
-
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);
|
|
1085
1137
|
}
|
|
1086
1138
|
getFromCache() {
|
|
1087
1139
|
return __async(this, null, function* () {
|
|
1088
1140
|
var _b;
|
|
1089
|
-
const e2 = yield this.
|
|
1141
|
+
const e2 = yield this.mostRecentState.resultPromise;
|
|
1090
1142
|
if (!e2.ok) return l("NOT_IN_CACHE");
|
|
1091
1143
|
if (null === e2.value.data) {
|
|
1092
1144
|
return h({ status: 404, errorCode: "MESSAGE_NOT_FOUND", reasons: ["No message with that ID exists"] });
|
|
@@ -1096,9 +1148,9 @@ class se extends $ {
|
|
|
1096
1148
|
});
|
|
1097
1149
|
}
|
|
1098
1150
|
}
|
|
1099
|
-
class
|
|
1100
|
-
constructor(e2, t2, s2
|
|
1101
|
-
super(
|
|
1151
|
+
class re extends W {
|
|
1152
|
+
constructor(e2, t2, s2) {
|
|
1153
|
+
super(), this.createdAt = e2, this.dataStore = t2, this.referencedDataStore = s2;
|
|
1102
1154
|
}
|
|
1103
1155
|
get messageId() {
|
|
1104
1156
|
return this.dataStore.messageId;
|
|
@@ -1116,26 +1168,32 @@ class ne extends $ {
|
|
|
1116
1168
|
}
|
|
1117
1169
|
teardownNested(e2) {
|
|
1118
1170
|
}
|
|
1171
|
+
anyChildChanged(_0, _1, _2) {
|
|
1172
|
+
return __async(this, arguments, function* (e2, t2, { dataStore: s2, referencedDataStore: n2 }) {
|
|
1173
|
+
if (true === (yield s2.changedBetween(e2, t2))) return true;
|
|
1174
|
+
return true === (yield n2 == null ? void 0 : n2.changedBetween(e2, t2));
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1119
1177
|
loadNested(e2, t2) {
|
|
1120
1178
|
return __async(this, null, function* () {
|
|
1121
|
-
var _a2, _b, _c
|
|
1179
|
+
var _a2, _b, _c;
|
|
1122
1180
|
const s2 = yield t2.dataStore.getDeep(e2);
|
|
1123
1181
|
if (!s2.ok) return s2;
|
|
1124
1182
|
const n2 = s2.value;
|
|
1125
|
-
if (null === n2.snapshot) return c({
|
|
1183
|
+
if (null === n2.snapshot) return c({ snapshot: null });
|
|
1126
1184
|
const r2 = yield (_a2 = t2.referencedDataStore) == null ? void 0 : _a2.getDeep(e2);
|
|
1127
1185
|
if (r2 && !r2.ok) return r2;
|
|
1128
1186
|
const i2 = (_b = r2 == null ? void 0 : r2.value) != null ? _b : null, a2 = (_c = i2 == null ? void 0 : i2.snapshot) != null ? _c : null;
|
|
1129
|
-
return c({
|
|
1187
|
+
return c({ snapshot: { id: n2.snapshot.id, type: n2.snapshot.type, sender: n2.snapshot.sender, custom: n2.snapshot.custom, createdAt: n2.snapshot.createdAt, editedAt: n2.snapshot.editedAt, referencedMessage: a2, origin: n2.snapshot.origin, plaintext: n2.snapshot.plaintext, content: n2.snapshot.content } });
|
|
1130
1188
|
});
|
|
1131
1189
|
}
|
|
1132
1190
|
}
|
|
1133
|
-
class
|
|
1134
|
-
constructor(e2, t2, s2, n2
|
|
1135
|
-
super(
|
|
1191
|
+
class ie extends q {
|
|
1192
|
+
constructor(e2, t2, s2, n2) {
|
|
1193
|
+
super(s2, n2), this.conversationId = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1136
1194
|
}
|
|
1137
1195
|
listen(e2) {
|
|
1138
|
-
return this.onlyUsedInternally && this.
|
|
1196
|
+
return this.onlyUsedInternally && this.mostRecentState.resultPromise.then((e3) => {
|
|
1139
1197
|
if (e3.ok && null !== e3.value.inWindow) {
|
|
1140
1198
|
const t2 = 30 - e3.value.inWindow.length;
|
|
1141
1199
|
t2 > 0 && this._loadMoreMessages(t2);
|
|
@@ -1144,24 +1202,46 @@ class re extends W {
|
|
|
1144
1202
|
}
|
|
1145
1203
|
fetchInitial(e2) {
|
|
1146
1204
|
return __async(this, null, function* () {
|
|
1147
|
-
const t2 = this.onlyUsedInternally ? 1 : 30, s2 = yield
|
|
1148
|
-
return s2.ok ? null === s2.value.messages ? c({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null }) :
|
|
1205
|
+
const t2 = this.onlyUsedInternally ? 1 : 30, s2 = yield ae({ realtimeClient: this.realtimeClient, conversationId: this.conversationId, count: t2 });
|
|
1206
|
+
return s2.ok ? null === s2.value.messages ? c({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null }) : oe({ seq: e2, messages: s2.value.messages, cursor: s2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : s2;
|
|
1149
1207
|
});
|
|
1150
1208
|
}
|
|
1151
1209
|
teardownNested(e2) {
|
|
1152
|
-
|
|
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
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
anyChildChanged(e2, t2, s2) {
|
|
1216
|
+
return __async(this, null, function* () {
|
|
1217
|
+
for (const n2 in s2.stores) {
|
|
1218
|
+
const r2 = s2.stores[n2];
|
|
1219
|
+
if (true === (yield r2 == null ? void 0 : r2.changedBetween(e2, t2))) return true;
|
|
1220
|
+
}
|
|
1221
|
+
return false;
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
lastMessageChangedBetween(e2, t2) {
|
|
1225
|
+
return __async(this, null, function* () {
|
|
1226
|
+
if (e2 >= t2) return false;
|
|
1227
|
+
const s2 = yield this.get(t2).resultPromise;
|
|
1228
|
+
if (!s2.ok) return false;
|
|
1229
|
+
if (s2.value.lastMessageChanged > e2) return true;
|
|
1230
|
+
if (null === s2.value.stores) return false;
|
|
1231
|
+
const n2 = s2.value.inWindow[0];
|
|
1232
|
+
if (void 0 === n2) return false;
|
|
1233
|
+
return true === (yield n2.changedBetween(e2, t2));
|
|
1234
|
+
});
|
|
1153
1235
|
}
|
|
1154
1236
|
equal(e2, t2) {
|
|
1155
|
-
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!
|
|
1237
|
+
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!O(Object.keys(e2.stores), Object.keys(t2.stores)) && (!!O(e2.inWindow.map((e3) => e3.messageId), t2.inWindow.map((e3) => e3.messageId)) && O(e2.windowEnd, t2.windowEnd)));
|
|
1156
1238
|
}
|
|
1157
1239
|
loadNested(e2, t2) {
|
|
1158
1240
|
return __async(this, null, function* () {
|
|
1159
|
-
|
|
1160
|
-
if (null === t2.stores) return c({ snapshot: null, loadedAll: true, lastChanged: t2.lastChanged, lastMessageChanged: t2.lastMessageChanged });
|
|
1241
|
+
if (null === t2.stores) return c({ snapshot: null, loadedAll: true });
|
|
1161
1242
|
const s2 = yield Promise.all(t2.inWindow.map((t3) => t3.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1162
1243
|
if (n2) return n2;
|
|
1163
|
-
|
|
1164
|
-
return c({ snapshot: i2, loadedAll: null === t2.windowEnd, lastChanged: a2, lastMessageChanged: u2 });
|
|
1244
|
+
return c({ snapshot: s2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot), loadedAll: null === t2.windowEnd });
|
|
1165
1245
|
});
|
|
1166
1246
|
}
|
|
1167
1247
|
loadMore(e2) {
|
|
@@ -1173,11 +1253,11 @@ class re extends W {
|
|
|
1173
1253
|
}
|
|
1174
1254
|
_loadMoreMessages(e2 = 30) {
|
|
1175
1255
|
return __async(this, null, function* () {
|
|
1176
|
-
const t2 = yield this.
|
|
1256
|
+
const t2 = yield this.mostRecentState.resultPromise;
|
|
1177
1257
|
if (!t2.ok) return;
|
|
1178
1258
|
if (null === t2.value.windowEnd) return;
|
|
1179
|
-
const s2 = t2.value.windowEnd.cursor, n2 = yield
|
|
1180
|
-
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) :
|
|
1259
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield ae({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient }), r2 = this.getLoadMoreSeq();
|
|
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));
|
|
1181
1261
|
});
|
|
1182
1262
|
}
|
|
1183
1263
|
messageCreated(e2, t2) {
|
|
@@ -1185,12 +1265,12 @@ class re extends W {
|
|
|
1185
1265
|
if (null === s2.value.stores) return console.warn("[TalkJS] Received a 'message.created' event for a nonexistent conversation."), s2;
|
|
1186
1266
|
if (s2.value.windowEnd && t2.state.createdAt < s2.value.windowEnd.oldestMessageTs) return s2;
|
|
1187
1267
|
if (Object.hasOwnProperty.call(s2.value.stores, t2.state.id)) return s2;
|
|
1188
|
-
const n2 = __spreadValues({}, s2.value.stores), r2 = new
|
|
1268
|
+
const n2 = __spreadValues({}, s2.value.stores), r2 = new ne(this.conversationId, t2.state, this.realtimeClient);
|
|
1189
1269
|
n2[t2.state.id] = r2;
|
|
1190
1270
|
const i2 = t2.state.referencedMessageId;
|
|
1191
1271
|
let a2;
|
|
1192
|
-
null === i2 ? a2 = null : i2 in n2 ? a2 = n2[i2] : (a2 = new
|
|
1193
|
-
const o2 = new
|
|
1272
|
+
null === i2 ? a2 = null : i2 in n2 ? a2 = n2[i2] : (a2 = new ne(this.conversationId, i2, this.realtimeClient), n2[i2] = a2);
|
|
1273
|
+
const o2 = new re(t2.state.createdAt, r2, a2), u2 = [...s2.value.inWindow, o2];
|
|
1194
1274
|
u2.sort((e3, t3) => t3.createdAt - e3.createdAt);
|
|
1195
1275
|
const l2 = u2[0].messageId === t2.messageId ? e2 : s2.value.lastMessageChanged;
|
|
1196
1276
|
return c({ lastChanged: e2, lastMessageChanged: l2, stores: n2, inWindow: u2, windowEnd: s2.value.windowEnd });
|
|
@@ -1210,13 +1290,13 @@ class re extends W {
|
|
|
1210
1290
|
delete n2[t2.messageId];
|
|
1211
1291
|
const r2 = s2.value.inWindow.filter((e3) => e3.messageId !== t2.messageId);
|
|
1212
1292
|
if (t2.newLastMessage && 0 === r2.length) {
|
|
1213
|
-
const
|
|
1214
|
-
n2[
|
|
1215
|
-
const
|
|
1216
|
-
let
|
|
1217
|
-
null ===
|
|
1218
|
-
const
|
|
1219
|
-
r2.push(
|
|
1293
|
+
const e3 = new ne(this.conversationId, t2.newLastMessage, this.realtimeClient);
|
|
1294
|
+
n2[e3.messageId] = e3;
|
|
1295
|
+
const s3 = t2.newLastMessage.referencedMessageId;
|
|
1296
|
+
let i3;
|
|
1297
|
+
null === s3 ? i3 = null : s3 in n2 ? i3 = n2[s3] : (i3 = new ne(this.conversationId, s3, this.realtimeClient), n2[s3] = i3);
|
|
1298
|
+
const a2 = new re(t2.newLastMessage.createdAt, e3, i3);
|
|
1299
|
+
r2.push(a2);
|
|
1220
1300
|
}
|
|
1221
1301
|
const i2 = void 0 !== t2.newLastMessage ? e2 : s2.value.lastMessageChanged;
|
|
1222
1302
|
return c({ lastChanged: e2, lastMessageChanged: i2, stores: n2, inWindow: r2, windowEnd: s2.value.windowEnd });
|
|
@@ -1225,21 +1305,21 @@ class re extends W {
|
|
|
1225
1305
|
conversationCleared(e2, t2) {
|
|
1226
1306
|
this.mutate(e2, (t3) => {
|
|
1227
1307
|
var _a2;
|
|
1228
|
-
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 }));
|
|
1229
1309
|
});
|
|
1230
1310
|
}
|
|
1231
1311
|
sideCreated(e2, t2) {
|
|
1232
1312
|
const s2 = this.fetchInitial(e2);
|
|
1233
1313
|
this.mutate(e2, (e3) => null !== e3.value.stores ? (s2.then((e4) => {
|
|
1234
|
-
e4.ok &&
|
|
1314
|
+
e4.ok && this.teardownNested(e4.value);
|
|
1235
1315
|
}), e3) : s2);
|
|
1236
1316
|
}
|
|
1237
1317
|
sideDeleted(e2, t2) {
|
|
1238
|
-
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 })));
|
|
1239
1319
|
}
|
|
1240
1320
|
getMessageFromCache(e2) {
|
|
1241
1321
|
return __async(this, null, function* () {
|
|
1242
|
-
const t2 = yield this.
|
|
1322
|
+
const t2 = yield this.mostRecentState.resultPromise;
|
|
1243
1323
|
if (!t2.ok) return l("NOT_IN_CACHE");
|
|
1244
1324
|
if (null === t2.value.stores) return l("NOT_IN_CACHE");
|
|
1245
1325
|
const s2 = t2.value.stores[e2];
|
|
@@ -1247,7 +1327,7 @@ class re extends W {
|
|
|
1247
1327
|
});
|
|
1248
1328
|
}
|
|
1249
1329
|
}
|
|
1250
|
-
function
|
|
1330
|
+
function ae(_0) {
|
|
1251
1331
|
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, conversationId: s2, count: n2 }) {
|
|
1252
1332
|
const r2 = { limit: n2, cursor: e2 }, i2 = yield t2.call("GET", ["me", "conversations", s2, "messages"], r2, { bypassCache: true });
|
|
1253
1333
|
if (i2.ok) {
|
|
@@ -1257,36 +1337,30 @@ function ie(_0) {
|
|
|
1257
1337
|
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({ messages: null, nextCursor: null });
|
|
1258
1338
|
});
|
|
1259
1339
|
}
|
|
1260
|
-
function
|
|
1340
|
+
function oe({ seq: e2, prevState: t2, messages: s2, cursor: n2, conversationId: r2, realtimeClient: i2 }) {
|
|
1261
1341
|
var _a2, _b, _c, _d;
|
|
1262
1342
|
const a2 = t2 ? __spreadValues({}, t2.stores) : {};
|
|
1263
|
-
for (const
|
|
1264
|
-
const
|
|
1265
|
-
a2[
|
|
1266
|
-
}
|
|
1267
|
-
for (const
|
|
1268
|
-
const
|
|
1269
|
-
if (
|
|
1270
|
-
const
|
|
1271
|
-
a2[
|
|
1343
|
+
for (const e3 of s2) if (void 0 === a2[e3.id]) {
|
|
1344
|
+
const t3 = new ne(r2, e3, i2);
|
|
1345
|
+
a2[t3.messageId] = t3;
|
|
1346
|
+
}
|
|
1347
|
+
for (const e3 of s2) {
|
|
1348
|
+
const t3 = e3.referencedMessageId;
|
|
1349
|
+
if (t3 && void 0 === a2[t3]) {
|
|
1350
|
+
const e4 = new ne(r2, t3, i2);
|
|
1351
|
+
a2[e4.messageId] = e4;
|
|
1272
1352
|
}
|
|
1273
1353
|
}
|
|
1274
1354
|
const o2 = t2 ? [...t2.inWindow] : [];
|
|
1275
|
-
for (const
|
|
1355
|
+
for (const e3 of s2) o2.push(new re(e3.createdAt, a2[e3.id], e3.referencedMessageId ? a2[e3.referencedMessageId] : null));
|
|
1276
1356
|
o2.sort((e3, t3) => t3.createdAt - e3.createdAt);
|
|
1277
1357
|
const u2 = (_b = (_a2 = t2 == null ? void 0 : t2.inWindow) == null ? void 0 : _a2[0]) == null ? void 0 : _b.messageId, l2 = (_c = o2 == null ? void 0 : o2[0]) == null ? void 0 : _c.messageId, h2 = u2 === l2 ? (_d = t2 == null ? void 0 : t2.lastMessageChanged) != null ? _d : e2 : e2;
|
|
1278
1358
|
if (null === n2) return c({ lastChanged: e2, lastMessageChanged: h2, stores: a2, inWindow: o2, windowEnd: null });
|
|
1279
1359
|
return c({ lastChanged: e2, lastMessageChanged: h2, stores: a2, inWindow: o2, windowEnd: { cursor: n2, oldestMessageTs: s2[s2.length - 1].createdAt } });
|
|
1280
1360
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
Object.values(e2.stores).forEach((e3) => e3.setError(t2)), e2.inWindow.forEach((e3) => e3.setError(t2));
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
class ue extends W {
|
|
1288
|
-
constructor(e2, t2, s2, n2, r2) {
|
|
1289
|
-
super(e2, t2, r2), this.conversationId = s2, this.realtimeClient = n2, this.unsubscribeDebounceMs = 5e3;
|
|
1361
|
+
class ue extends q {
|
|
1362
|
+
constructor(e2, t2, s2, n2) {
|
|
1363
|
+
super(s2, n2), this.conversationId = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 5e3;
|
|
1290
1364
|
}
|
|
1291
1365
|
fetchInitial(e2) {
|
|
1292
1366
|
return __async(this, null, function* () {
|
|
@@ -1305,17 +1379,22 @@ class ue extends W {
|
|
|
1305
1379
|
var _a2;
|
|
1306
1380
|
(_a2 = e2.messageWindowStore) == null ? void 0 : _a2.unsubscribe();
|
|
1307
1381
|
}
|
|
1382
|
+
anyChildChanged(e2, t2, s2) {
|
|
1383
|
+
return __async(this, null, function* () {
|
|
1384
|
+
return true === (yield s2.messageWindowStore.store.lastMessageChangedBetween(e2, t2));
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1308
1387
|
equal(e2, t2) {
|
|
1309
|
-
return
|
|
1388
|
+
return O(e2.snapshot, t2.snapshot);
|
|
1310
1389
|
}
|
|
1311
1390
|
loadNested(e2, t2) {
|
|
1312
1391
|
return __async(this, null, function* () {
|
|
1313
1392
|
var _a2;
|
|
1314
|
-
if (!t2.snapshot) return c({
|
|
1393
|
+
if (!t2.snapshot) return c({ snapshot: null, loadedAll: true });
|
|
1315
1394
|
const s2 = yield t2.messageWindowStore.store.getDeep(e2);
|
|
1316
1395
|
if (!s2.ok) return s2;
|
|
1317
1396
|
const n2 = s2.value.snapshot, r2 = (_a2 = n2 == null ? void 0 : n2[0]) != null ? _a2 : null;
|
|
1318
|
-
return c({
|
|
1397
|
+
return c({ snapshot: __spreadProps(__spreadValues({}, t2.snapshot), { lastMessage: r2 }) });
|
|
1319
1398
|
});
|
|
1320
1399
|
}
|
|
1321
1400
|
participantEdited(e2, t2) {
|
|
@@ -1335,14 +1414,14 @@ class ue extends W {
|
|
|
1335
1414
|
}
|
|
1336
1415
|
getFromCache() {
|
|
1337
1416
|
return __async(this, null, function* () {
|
|
1338
|
-
const e2 = yield this.
|
|
1417
|
+
const e2 = yield this.mostRecentState.resultPromise;
|
|
1339
1418
|
return e2.ok && e2.value.snapshot ? c({ status: 200, data: e2.value.snapshot }) : l("NOT_IN_CACHE");
|
|
1340
1419
|
});
|
|
1341
1420
|
}
|
|
1342
1421
|
}
|
|
1343
1422
|
function ce(e2, t2) {
|
|
1344
1423
|
const s2 = t2;
|
|
1345
|
-
return { id: e2.id, createdAt: e2.createdAt, subject:
|
|
1424
|
+
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 };
|
|
1346
1425
|
}
|
|
1347
1426
|
function le(e2, t2) {
|
|
1348
1427
|
for (let s2 in e2) Object.prototype.hasOwnProperty.call(e2, s2) && t2(e2[s2], s2);
|
|
@@ -1356,9 +1435,9 @@ function he(e2, t2) {
|
|
|
1356
1435
|
}), s2;
|
|
1357
1436
|
}(e2, ([e3, s2]) => [e3, t2(s2, e3)]);
|
|
1358
1437
|
}
|
|
1359
|
-
class de extends
|
|
1360
|
-
constructor(e2, t2, s2, n2
|
|
1361
|
-
super(
|
|
1438
|
+
class de extends q {
|
|
1439
|
+
constructor(e2, t2, s2, n2) {
|
|
1440
|
+
super(s2, n2), this.conversationId = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 1e4;
|
|
1362
1441
|
}
|
|
1363
1442
|
fetchInitial(e2) {
|
|
1364
1443
|
return __async(this, null, function* () {
|
|
@@ -1372,7 +1451,7 @@ class de extends W {
|
|
|
1372
1451
|
});
|
|
1373
1452
|
}
|
|
1374
1453
|
equal(e2, t2) {
|
|
1375
|
-
return
|
|
1454
|
+
return O(e2.data, t2.data);
|
|
1376
1455
|
}
|
|
1377
1456
|
loadNested(e2, t2) {
|
|
1378
1457
|
return __async(this, null, function* () {
|
|
@@ -1413,10 +1492,194 @@ class de extends W {
|
|
|
1413
1492
|
teardownNested(e2) {
|
|
1414
1493
|
e2.data && le(e2.userSubscriptions, (e3) => e3.unsubscribe());
|
|
1415
1494
|
}
|
|
1495
|
+
anyChildChanged(e2, t2, s2) {
|
|
1496
|
+
return __async(this, null, function* () {
|
|
1497
|
+
var _a2;
|
|
1498
|
+
if (null === s2.data) return false;
|
|
1499
|
+
for (const n2 in s2.userSubscriptions) {
|
|
1500
|
+
const r2 = s2.userSubscriptions[n2];
|
|
1501
|
+
if (true === (yield (_a2 = r2 == null ? void 0 : r2.store) == null ? void 0 : _a2.changedBetween(e2, t2))) return true;
|
|
1502
|
+
}
|
|
1503
|
+
return false;
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1416
1506
|
}
|
|
1417
|
-
class pe {
|
|
1507
|
+
class pe extends W {
|
|
1418
1508
|
constructor(e2, t2, s2) {
|
|
1419
|
-
|
|
1509
|
+
super(), this.conversationId = e2, this.participantData = t2, this.realtimeClient = s2;
|
|
1510
|
+
}
|
|
1511
|
+
fetchInitial(e2) {
|
|
1512
|
+
return __async(this, null, function* () {
|
|
1513
|
+
return c({ lastChanged: e2, user: this.realtimeClient.internalSubscribe(["users", this.participantData.id]), data: this.participantData });
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
refetch(e2) {
|
|
1517
|
+
throw "Do not call refetch on participant data stores, it can return outdated data. Destroy and remake them instead";
|
|
1518
|
+
}
|
|
1519
|
+
equal(e2, t2) {
|
|
1520
|
+
var _a2, _b, _c, _d;
|
|
1521
|
+
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);
|
|
1522
|
+
}
|
|
1523
|
+
teardownNested(e2) {
|
|
1524
|
+
var _a2;
|
|
1525
|
+
(_a2 = e2.user) == null ? void 0 : _a2.unsubscribe();
|
|
1526
|
+
}
|
|
1527
|
+
anyChildChanged(e2, t2, s2) {
|
|
1528
|
+
return __async(this, null, function* () {
|
|
1529
|
+
var _a2;
|
|
1530
|
+
const n2 = (_a2 = s2.user) == null ? void 0 : _a2.store;
|
|
1531
|
+
return true === (yield n2 == null ? void 0 : n2.changedBetween(e2, t2));
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
loadNested(e2, t2) {
|
|
1535
|
+
return __async(this, null, function* () {
|
|
1536
|
+
if (null === t2.data) return c({ snapshot: null });
|
|
1537
|
+
const s2 = yield t2.user.store.getDeep(e2);
|
|
1538
|
+
if (false === s2.ok) return s2;
|
|
1539
|
+
const n2 = s2.value.snapshot;
|
|
1540
|
+
return c({ snapshot: this.realtimeClient.createParticipantSnapshotPreloaded(t2.data, n2) });
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
participantEdited(e2, t2) {
|
|
1544
|
+
this.mutate(e2, (s2) => {
|
|
1545
|
+
if (null === s2.value.data) return s2;
|
|
1546
|
+
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 } });
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
participantDeleted(e2, t2) {
|
|
1550
|
+
this.mutate(e2, (t3) => null === t3.value.data ? t3 : (this.teardownNested(t3.value), c({ lastChanged: e2, user: null, data: null })));
|
|
1551
|
+
}
|
|
1552
|
+
getFromCache() {
|
|
1553
|
+
return __async(this, null, function* () {
|
|
1554
|
+
const e2 = yield this.mostRecentState.resultPromise;
|
|
1555
|
+
if (!e2.ok) return l("NOT_IN_CACHE");
|
|
1556
|
+
if (null === e2.value.data) {
|
|
1557
|
+
return h({ status: 404, errorCode: "PARTICIPANT_NOT_FOUND", reasons: ["No participant with that ID exists"] });
|
|
1558
|
+
}
|
|
1559
|
+
return c({ status: 200, data: e2.value.data });
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
class fe extends q {
|
|
1564
|
+
constructor(e2, t2, s2, n2) {
|
|
1565
|
+
super(s2, n2), this.conversationId = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1566
|
+
}
|
|
1567
|
+
fetchInitial(e2) {
|
|
1568
|
+
return __async(this, null, function* () {
|
|
1569
|
+
const t2 = yield me({ realtimeClient: this.realtimeClient, conversationId: this.conversationId, count: 10 });
|
|
1570
|
+
return t2.ok ? null === t2.value.participants ? c({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null }) : ge({ seq: e2, participants: t2.value.participants, cursor: t2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : t2;
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
teardownNested(e2) {
|
|
1574
|
+
if (e2.stores) {
|
|
1575
|
+
const t2 = l("TERMINATED");
|
|
1576
|
+
Object.values(e2.stores).forEach((e3) => e3.setError(t2));
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
anyChildChanged(e2, t2, s2) {
|
|
1580
|
+
return __async(this, null, function* () {
|
|
1581
|
+
for (const n2 in s2.stores) {
|
|
1582
|
+
const r2 = s2.stores[n2];
|
|
1583
|
+
if (true === (yield r2 == null ? void 0 : r2.changedBetween(e2, t2))) return true;
|
|
1584
|
+
}
|
|
1585
|
+
return false;
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
equal(e2, t2) {
|
|
1589
|
+
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));
|
|
1590
|
+
}
|
|
1591
|
+
loadNested(e2, t2) {
|
|
1592
|
+
return __async(this, null, function* () {
|
|
1593
|
+
if (null === t2.stores) return c({ snapshot: null, loadedAll: true });
|
|
1594
|
+
const s2 = yield Promise.all(Object.values(t2.stores).map((t3) => t3.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1595
|
+
if (n2) return n2;
|
|
1596
|
+
const r2 = s2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot);
|
|
1597
|
+
return r2.sort((e3, t3) => t3.joinedAt - e3.joinedAt), c({ snapshot: r2, loadedAll: null === t2.windowEnd });
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
loadMore(e2) {
|
|
1601
|
+
return __async(this, null, function* () {
|
|
1602
|
+
if (this.pendingLoadMore) return this.pendingLoadMore;
|
|
1603
|
+
const t2 = o();
|
|
1604
|
+
this.pendingLoadMore = t2.promise, yield this._loadMoreParticipants(e2), t2.resolve(), this.pendingLoadMore = void 0;
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
_loadMoreParticipants(e2 = 10) {
|
|
1608
|
+
return __async(this, null, function* () {
|
|
1609
|
+
const t2 = yield this.mostRecentState.resultPromise;
|
|
1610
|
+
if (!t2.ok) return;
|
|
1611
|
+
if (null === t2.value.windowEnd) return;
|
|
1612
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield me({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient }), r2 = this.getLoadMoreSeq();
|
|
1613
|
+
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) : ge({ 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));
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
participantCreated(e2, t2) {
|
|
1617
|
+
this.mutate(e2, (s2) => {
|
|
1618
|
+
if (null === s2.value.stores) return console.warn("[TalkJS] Received a 'participant.created' event for a nonexistent conversation."), s2;
|
|
1619
|
+
if (s2.value.windowEnd && t2.state.joinedAt < s2.value.windowEnd.oldestParticipantTs) return s2;
|
|
1620
|
+
if (Object.hasOwnProperty.call(s2.value.stores, t2.state.id)) return s2;
|
|
1621
|
+
const n2 = __spreadValues({}, s2.value.stores), r2 = new pe(this.conversationId, t2.state, this.realtimeClient);
|
|
1622
|
+
n2[t2.state.id] = r2;
|
|
1623
|
+
return c({ lastChanged: e2, stores: n2, windowEnd: s2.value.windowEnd });
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
participantEdited(e2, t2) {
|
|
1627
|
+
this.mutate(e2, (s2) => {
|
|
1628
|
+
var _a2;
|
|
1629
|
+
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);
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
participantDeleted(e2, t2) {
|
|
1633
|
+
this.mutate(e2, (s2) => {
|
|
1634
|
+
if (null === s2.value.stores) return console.warn("[TalkJS] Received a 'participant.deleted' event for a conversation that we thought didn't exist."), s2;
|
|
1635
|
+
const n2 = s2.value.stores[t2.userId];
|
|
1636
|
+
if (void 0 === n2) return s2;
|
|
1637
|
+
n2.participantDeleted(e2, t2);
|
|
1638
|
+
const r2 = __spreadValues({}, s2.value.stores);
|
|
1639
|
+
return delete r2[t2.userId], c({ lastChanged: e2, stores: r2, windowEnd: s2.value.windowEnd });
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
sideCreated(e2, t2) {
|
|
1643
|
+
const s2 = this.fetchInitial(e2);
|
|
1644
|
+
this.mutate(e2, (e3) => null !== e3.value.stores ? (s2.then((e4) => {
|
|
1645
|
+
e4.ok && this.teardownNested(e4.value);
|
|
1646
|
+
}), e3) : s2);
|
|
1647
|
+
}
|
|
1648
|
+
sideDeleted(e2, t2) {
|
|
1649
|
+
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (this.teardownNested(t3.value), c({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null })));
|
|
1650
|
+
}
|
|
1651
|
+
getParticipantFromCache(e2) {
|
|
1652
|
+
return __async(this, null, function* () {
|
|
1653
|
+
const t2 = yield this.mostRecentState.resultPromise;
|
|
1654
|
+
if (!t2.ok) return l("NOT_IN_CACHE");
|
|
1655
|
+
if (null === t2.value.stores) return l("NOT_IN_CACHE");
|
|
1656
|
+
const s2 = t2.value.stores[e2];
|
|
1657
|
+
return void 0 === s2 ? l("NOT_IN_CACHE") : s2.getFromCache();
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
function me(_0) {
|
|
1662
|
+
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, conversationId: s2, count: n2 }) {
|
|
1663
|
+
const r2 = { limit: n2, cursor: e2 }, i2 = yield t2.call("GET", ["me", "conversations", s2, "participants"], r2, { bypassCache: true });
|
|
1664
|
+
if (i2.ok) {
|
|
1665
|
+
const { data: e3, cursor: t3 } = i2.value.data;
|
|
1666
|
+
return c({ participants: e3, nextCursor: t3 });
|
|
1667
|
+
}
|
|
1668
|
+
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 });
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
function ge({ seq: e2, prevStores: t2, participants: s2, cursor: n2, conversationId: r2, realtimeClient: i2 }) {
|
|
1672
|
+
const a2 = t2 ? __spreadValues({}, t2) : {};
|
|
1673
|
+
for (const e3 of s2) if (void 0 === a2[e3.id]) {
|
|
1674
|
+
const t3 = new pe(r2, e3, i2);
|
|
1675
|
+
a2[e3.id] = t3;
|
|
1676
|
+
}
|
|
1677
|
+
if (null === n2) return c({ lastChanged: e2, stores: a2, windowEnd: null });
|
|
1678
|
+
return c({ lastChanged: e2, stores: a2, windowEnd: { cursor: n2, oldestParticipantTs: s2[s2.length - 1].joinedAt } });
|
|
1679
|
+
}
|
|
1680
|
+
class ve {
|
|
1681
|
+
constructor(e2, t2, s2) {
|
|
1682
|
+
this.realtimeClient = s2, this.storeMap = {}, this.emitMutex = new U(), this.seqOffset = 0, this.seqInThisConnection = 0, this.refetchOnNextNetworkLoss = true, this.connection = new N(e2, t2, { onUpstreamRestarting: () => {
|
|
1420
1683
|
this.refetchOnNextNetworkLoss = false;
|
|
1421
1684
|
}, onReady: () => {
|
|
1422
1685
|
this.refetchOnNextNetworkLoss = true;
|
|
@@ -1428,7 +1691,7 @@ class pe {
|
|
|
1428
1691
|
}
|
|
1429
1692
|
}, onResubscribeError: (e3, t3) => {
|
|
1430
1693
|
var _a2;
|
|
1431
|
-
(_a2 = this.
|
|
1694
|
+
(_a2 = this.storeMap[be(e3)]) == null ? void 0 : _a2.setError(t3);
|
|
1432
1695
|
}, onPublish: (e3, t3) => {
|
|
1433
1696
|
this.seqInThisConnection = e3;
|
|
1434
1697
|
const s3 = this.seq;
|
|
@@ -1440,119 +1703,70 @@ class pe {
|
|
|
1440
1703
|
return this.seqOffset + this.seqInThisConnection;
|
|
1441
1704
|
}
|
|
1442
1705
|
refetchAll(e2) {
|
|
1443
|
-
|
|
1444
|
-
for (const t2 of Object.values(this.messageWindowStores)) t2.refetch(e2);
|
|
1445
|
-
for (const t2 of Object.values(this.conversationStores)) t2.refetch(e2);
|
|
1446
|
-
for (const t2 of Object.values(this.typingStores)) t2.refetch(e2);
|
|
1706
|
+
Object.values(this.storeMap).forEach((t2) => t2.refetch(e2));
|
|
1447
1707
|
}
|
|
1448
1708
|
emitAll(e2) {
|
|
1449
1709
|
return this.emitMutex.runExclusive(() => __async(this, null, function* () {
|
|
1450
|
-
|
|
1710
|
+
const t2 = Object.values(this.storeMap).map((t3) => t3.emit(e2));
|
|
1711
|
+
yield Promise.all(t2);
|
|
1451
1712
|
}));
|
|
1452
1713
|
}
|
|
1453
1714
|
handlePublish(e2, t2) {
|
|
1715
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t2, _u;
|
|
1454
1716
|
switch (t2.type) {
|
|
1455
1717
|
case "user.created":
|
|
1456
|
-
return this.
|
|
1718
|
+
return void ((_a2 = this.storeMap[`/users/${t2.userId}`]) == null ? void 0 : _a2.userCreated(e2, t2));
|
|
1457
1719
|
case "user.edited":
|
|
1458
|
-
return this.
|
|
1720
|
+
return void ((_b = this.storeMap[`/users/${t2.userId}`]) == null ? void 0 : _b.userEdited(e2, t2));
|
|
1459
1721
|
case "side.created":
|
|
1460
|
-
return this.
|
|
1722
|
+
return (_c = this.storeMap[`/me/conversations/${t2.conversationId}`]) == null ? void 0 : _c.sideCreated(e2, t2), (_d = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _d.sideCreated(e2, t2), void ((_e2 = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _e2.sideCreated(e2, t2));
|
|
1461
1723
|
case "side.edited":
|
|
1462
|
-
return this.
|
|
1724
|
+
return void ((_f = this.storeMap[`/me/conversations/${t2.conversationId}`]) == null ? void 0 : _f.sideEdited(e2, t2));
|
|
1463
1725
|
case "side.deleted":
|
|
1464
|
-
return this.
|
|
1465
|
-
case "participant.edited":
|
|
1466
|
-
return this.handleParticipantEdited(e2, t2);
|
|
1726
|
+
return (_g = this.storeMap[`/me/conversations/${t2.conversationId}`]) == null ? void 0 : _g.sideDeleted(e2, t2), (_h = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _h.sideDeleted(e2, t2), (_i = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _i.sideDeleted(e2, t2), void ((_j = this.storeMap[`/me/conversations/${t2.conversationId}/typing`]) == null ? void 0 : _j.sideDeleted(e2, t2));
|
|
1467
1727
|
case "conversation.edited":
|
|
1468
|
-
return this.
|
|
1728
|
+
return void ((_k = this.storeMap[`/me/conversations/${t2.conversationId}`]) == null ? void 0 : _k.conversationEdited(e2, t2));
|
|
1469
1729
|
case "message.created":
|
|
1470
|
-
return this.
|
|
1730
|
+
return void ((_l = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _l.messageCreated(e2, t2));
|
|
1471
1731
|
case "message.edited":
|
|
1472
|
-
return this.
|
|
1732
|
+
return void ((_m = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _m.messageEdited(e2, t2));
|
|
1473
1733
|
case "message.deleted":
|
|
1474
|
-
return this.
|
|
1734
|
+
return void ((_n = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _n.messageDeleted(e2, t2));
|
|
1475
1735
|
case "typing.available":
|
|
1476
|
-
return this.
|
|
1736
|
+
return void ((_o = this.storeMap[`/me/conversations/${t2.conversationId}/typing`]) == null ? void 0 : _o.typingAvailable(e2, t2));
|
|
1477
1737
|
case "typing.changed":
|
|
1478
|
-
return this.
|
|
1738
|
+
return void ((_p = this.storeMap[`/me/conversations/${t2.conversationId}/typing`]) == null ? void 0 : _p.typingChanged(e2, t2));
|
|
1479
1739
|
case "conversation.cleared":
|
|
1480
|
-
return this.
|
|
1740
|
+
return void ((_q = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _q.conversationCleared(e2, t2));
|
|
1741
|
+
case "participant.edited":
|
|
1742
|
+
return (_r = this.storeMap[`/me/conversations/${t2.conversationId}`]) == null ? void 0 : _r.participantEdited(e2, t2), void ((_s = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _s.participantEdited(e2, t2));
|
|
1743
|
+
case "participant.created":
|
|
1744
|
+
return void ((_t2 = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _t2.participantCreated(e2, t2));
|
|
1745
|
+
case "participant.deleted":
|
|
1746
|
+
return void ((_u = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _u.participantDeleted(e2, t2));
|
|
1481
1747
|
}
|
|
1482
1748
|
}
|
|
1483
|
-
handleTypingAvailable(e2, t2) {
|
|
1484
|
-
const s2 = this.typingStores[t2.conversationId];
|
|
1485
|
-
s2 && s2.typingAvailable(e2, t2);
|
|
1486
|
-
}
|
|
1487
|
-
handleTypingChanged(e2, t2) {
|
|
1488
|
-
const s2 = this.typingStores[t2.conversationId];
|
|
1489
|
-
s2 && s2.typingChanged(e2, t2);
|
|
1490
|
-
}
|
|
1491
|
-
handleUserCreated(e2, t2) {
|
|
1492
|
-
const s2 = this.userStores[t2.userId];
|
|
1493
|
-
s2 && s2.userCreated(e2, t2);
|
|
1494
|
-
}
|
|
1495
|
-
handleUserEdited(e2, t2) {
|
|
1496
|
-
const s2 = this.userStores[t2.userId];
|
|
1497
|
-
s2 && s2.userEdited(e2, t2);
|
|
1498
|
-
}
|
|
1499
|
-
handleSideCreated(e2, t2) {
|
|
1500
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1501
|
-
s2 && s2.sideCreated(e2, t2);
|
|
1502
|
-
const n2 = this.conversationStores[t2.conversationId];
|
|
1503
|
-
n2 && n2.sideCreated(e2, t2);
|
|
1504
|
-
}
|
|
1505
|
-
handleSideEdited(e2, t2) {
|
|
1506
|
-
const s2 = this.conversationStores[t2.conversationId];
|
|
1507
|
-
s2 && s2.sideEdited(e2, t2);
|
|
1508
|
-
}
|
|
1509
|
-
handleParticipantEdited(e2, t2) {
|
|
1510
|
-
const s2 = this.conversationStores[t2.conversationId];
|
|
1511
|
-
s2 && s2.participantEdited(e2, t2);
|
|
1512
|
-
}
|
|
1513
|
-
handleConversationEdited(e2, t2) {
|
|
1514
|
-
const s2 = this.conversationStores[t2.conversationId];
|
|
1515
|
-
s2 && s2.conversationEdited(e2, t2);
|
|
1516
|
-
}
|
|
1517
|
-
handleSideDeleted(e2, t2) {
|
|
1518
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1519
|
-
s2 && s2.sideDeleted(e2, t2);
|
|
1520
|
-
const n2 = this.conversationStores[t2.conversationId];
|
|
1521
|
-
n2 && n2.sideDeleted(e2, t2);
|
|
1522
|
-
const r2 = this.typingStores[t2.conversationId];
|
|
1523
|
-
r2 && r2.sideDeleted(e2, t2);
|
|
1524
|
-
}
|
|
1525
|
-
handleMessageCreated(e2, t2) {
|
|
1526
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1527
|
-
s2 && s2.messageCreated(e2, t2);
|
|
1528
|
-
}
|
|
1529
|
-
handleMessageEdited(e2, t2) {
|
|
1530
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1531
|
-
s2 && s2.messageEdited(e2, t2);
|
|
1532
|
-
}
|
|
1533
|
-
handleMessageDeleted(e2, t2) {
|
|
1534
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1535
|
-
s2 && s2.messageDeleted(e2, t2);
|
|
1536
|
-
}
|
|
1537
|
-
handleConversationCleared(e2, t2) {
|
|
1538
|
-
const s2 = this.messageWindowStores[t2.conversationId];
|
|
1539
|
-
s2 && s2.conversationCleared(e2, t2);
|
|
1540
|
-
}
|
|
1541
1749
|
call(e2, t2, n2, r2) {
|
|
1542
1750
|
return __async(this, null, function* () {
|
|
1543
|
-
if (!r2.bypassCache) {
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1751
|
+
if (!r2.bypassCache && "GET" === e2) {
|
|
1752
|
+
const e3 = be(t2);
|
|
1753
|
+
if (e3 in this.storeMap) {
|
|
1754
|
+
const t3 = e3, s2 = this.storeMap[t3];
|
|
1755
|
+
if (s2 && "getFromCache" in s2) {
|
|
1547
1756
|
const e4 = yield s2.getFromCache();
|
|
1548
1757
|
if ("NOT_IN_CACHE" !== e4.value) return e4;
|
|
1549
1758
|
}
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1759
|
+
} else if (s(t2, ["me", "conversations", "*", "messages", "*"])) {
|
|
1760
|
+
const e4 = this.storeMap[`/me/conversations/${t2[2]}/messages`];
|
|
1761
|
+
if (e4) {
|
|
1762
|
+
const s2 = yield e4.getMessageFromCache(t2[4]);
|
|
1763
|
+
if ("NOT_IN_CACHE" !== s2.value) return s2;
|
|
1764
|
+
}
|
|
1765
|
+
} else if (s(t2, ["me", "conversations", "*", "participants", "*"])) {
|
|
1766
|
+
const e4 = this.storeMap[`/me/conversations/${t2[2]}/participants`];
|
|
1767
|
+
if (e4) {
|
|
1768
|
+
const s2 = yield e4.getParticipantFromCache(t2[4]);
|
|
1769
|
+
if ("NOT_IN_CACHE" !== s2.value) return s2;
|
|
1556
1770
|
}
|
|
1557
1771
|
}
|
|
1558
1772
|
}
|
|
@@ -1594,86 +1808,36 @@ class pe {
|
|
|
1594
1808
|
}, a2;
|
|
1595
1809
|
}
|
|
1596
1810
|
getOrCreateStore(e2) {
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
{
|
|
1614
|
-
this.connection.subscribe(["me", "conversations", t2]).then((t3) => {
|
|
1615
|
-
t3.ok || e3.setError(t3);
|
|
1616
|
-
});
|
|
1617
|
-
const e3 = new ue(this.seq, this.emitMutex, t2, this.realtimeClient, () => {
|
|
1618
|
-
delete this.conversationStores[t2], this.connection.unsubscribe(["me", "conversations", t2]);
|
|
1619
|
-
});
|
|
1620
|
-
return this.conversationStores[t2] = e3, e3;
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
if (s(e2, ["me", "conversations", "*", "messages"])) {
|
|
1624
|
-
const t2 = e2[2];
|
|
1625
|
-
if (Object.hasOwnProperty.call(this.messageWindowStores, t2)) return this.messageWindowStores[t2];
|
|
1626
|
-
{
|
|
1627
|
-
this.connection.subscribe(["me", "conversations", t2, "messages"]).then((t3) => {
|
|
1628
|
-
t3.ok || e3.setError(t3);
|
|
1629
|
-
});
|
|
1630
|
-
const e3 = new re(this.seq, this.emitMutex, t2, this.realtimeClient, () => {
|
|
1631
|
-
delete this.messageWindowStores[t2], this.connection.unsubscribe(["me", "conversations", t2, "messages"]);
|
|
1632
|
-
});
|
|
1633
|
-
return this.messageWindowStores[t2] = e3, e3;
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
if (s(e2, ["me", "conversations", "*", "typing"])) {
|
|
1637
|
-
const t2 = e2[2];
|
|
1638
|
-
if (Object.hasOwnProperty.call(this.typingStores, t2)) return this.typingStores[t2];
|
|
1639
|
-
{
|
|
1640
|
-
this.connection.subscribe(["me", "conversations", t2, "typing"]).then((t3) => {
|
|
1641
|
-
t3.ok || e3.setError(t3);
|
|
1642
|
-
});
|
|
1643
|
-
const e3 = new de(this.seq, t2, this.realtimeClient, this.emitMutex, () => {
|
|
1644
|
-
delete this.typingStores[t2], this.connection.unsubscribe(["me", "conversations", t2, "typing"]);
|
|
1645
|
-
});
|
|
1646
|
-
return this.typingStores[t2] = e3, e3;
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
throw new Error("Unrecognised subscribe path: " + e2);
|
|
1650
|
-
}
|
|
1651
|
-
getStoreIfExists(e2) {
|
|
1652
|
-
var _a2, _b, _c;
|
|
1653
|
-
if (s(e2, ["users", "*"])) {
|
|
1654
|
-
const t2 = e2[1];
|
|
1655
|
-
return (_a2 = this.userStores[t2]) != null ? _a2 : null;
|
|
1656
|
-
}
|
|
1657
|
-
if (s(e2, ["me", "conversations", "*", "messages"])) {
|
|
1658
|
-
const t2 = e2[2];
|
|
1659
|
-
return (_b = this.messageWindowStores[t2]) != null ? _b : null;
|
|
1660
|
-
}
|
|
1661
|
-
if (s(e2, ["me", "conversations", "*", "typing"])) {
|
|
1662
|
-
const t2 = e2[2];
|
|
1663
|
-
return (_c = this.typingStores[t2]) != null ? _c : null;
|
|
1664
|
-
}
|
|
1665
|
-
throw new Error("Unrecognised subscribe path: " + e2);
|
|
1811
|
+
const t2 = be(e2);
|
|
1812
|
+
if (t2 in this.storeMap) return this.storeMap[t2];
|
|
1813
|
+
this.connection.subscribe(e2).then((e3) => {
|
|
1814
|
+
e3.ok || n2.setError(e3);
|
|
1815
|
+
});
|
|
1816
|
+
const n2 = function(e3, t3, n3, r2) {
|
|
1817
|
+
if (s(e3, ["users", "*"])) return new G(e3[1], t3, n3, r2);
|
|
1818
|
+
if (s(e3, ["me", "conversations", "*"])) return new ue(e3[2], t3, n3, r2);
|
|
1819
|
+
if (s(e3, ["me", "conversations", "*", "messages"])) return new ie(e3[2], t3, n3, r2);
|
|
1820
|
+
if (s(e3, ["me", "conversations", "*", "participants"])) return new fe(e3[2], t3, n3, r2);
|
|
1821
|
+
if (s(e3, ["me", "conversations", "*", "typing"])) return new de(e3[2], t3, n3, r2);
|
|
1822
|
+
throw "Unreachable";
|
|
1823
|
+
}(e2, this.realtimeClient, this.emitMutex, () => {
|
|
1824
|
+
delete this.storeMap[t2], this.connection.unsubscribe(e2);
|
|
1825
|
+
});
|
|
1826
|
+
return this.storeMap[t2] = n2, n2;
|
|
1666
1827
|
}
|
|
1667
1828
|
destroy() {
|
|
1668
|
-
this.
|
|
1829
|
+
this.storeMap = {}, this.connection.destroy();
|
|
1669
1830
|
}
|
|
1670
1831
|
isConnected() {
|
|
1671
1832
|
return this.connection.isConnected();
|
|
1672
1833
|
}
|
|
1673
1834
|
}
|
|
1674
|
-
|
|
1835
|
+
function be(e2) {
|
|
1836
|
+
return `/${e2.join("/")}`;
|
|
1837
|
+
}
|
|
1838
|
+
class we {
|
|
1675
1839
|
constructor(e2, t2, s2) {
|
|
1676
|
-
this.userId = t2, this.alive = true, this.connection = new
|
|
1840
|
+
this.userId = t2, this.alive = true, this.connection = new ve(e2, s2, this), s2.onTokenRefreshFailed(() => {
|
|
1677
1841
|
this.destroy();
|
|
1678
1842
|
});
|
|
1679
1843
|
}
|
|
@@ -1698,20 +1862,20 @@ class fe {
|
|
|
1698
1862
|
listMessages(e2, t2) {
|
|
1699
1863
|
return __async(this, null, function* () {
|
|
1700
1864
|
const s2 = yield this.call("GET", ["me", "conversations", e2, "messages"], t2);
|
|
1701
|
-
if (!s2.ok) return
|
|
1865
|
+
if (!s2.ok) return ye(s2, "Listing messages in " + e2);
|
|
1702
1866
|
const n2 = s2.value.data.data, r2 = yield Promise.all(n2.map((t3) => this.createMessageSnapshot(t3, e2))), i2 = r2.find((e3) => !e3.ok);
|
|
1703
1867
|
if (void 0 !== i2 && !i2.ok) return i2;
|
|
1704
1868
|
return c(r2.map(({ value: e3 }) => e3));
|
|
1705
1869
|
});
|
|
1706
1870
|
}
|
|
1707
1871
|
createConversationSnapshotPreloaded(e2, t2) {
|
|
1708
|
-
return { id: e2.id, subject: e2.subject, photoUrl: e2.photoUrl, welcomeMessages: e2.welcomeMessages, custom: e2.custom, createdAt: e2.createdAt, joinedAt: e2.joinedAt, lastMessageAt: e2.lastMessageAt, unreadMessageCount: e2.unreadMessageCount, isUnread: e2.isUnread, access: e2.access, notify: e2.notify, lastMessage: t2, readUntil: e2.readUntil };
|
|
1872
|
+
return { id: e2.id, subject: e2.subject, photoUrl: e2.photoUrl, welcomeMessages: e2.welcomeMessages, custom: e2.custom, createdAt: e2.createdAt, joinedAt: e2.joinedAt, lastMessageAt: e2.lastMessageAt, unreadMessageCount: e2.unreadMessageCount, isUnread: e2.isUnread, access: e2.access, notify: e2.notify, lastMessage: t2, readUntil: e2.readUntil, everyoneReadUntil: e2.everyoneReadUntil };
|
|
1709
1873
|
}
|
|
1710
1874
|
createUserSnapshot(e2) {
|
|
1711
1875
|
return { id: e2.id, name: e2.name, custom: e2.custom, locale: e2.locale, photoUrl: e2.photoUrl, role: e2.role, welcomeMessage: e2.welcomeMessage };
|
|
1712
1876
|
}
|
|
1713
1877
|
createParticipantSnapshotPreloaded(e2, t2) {
|
|
1714
|
-
return
|
|
1878
|
+
return { user: t2, access: e2.access, notify: e2.notify, joinedAt: e2.joinedAt };
|
|
1715
1879
|
}
|
|
1716
1880
|
createMessageSnapshot(e2, t2) {
|
|
1717
1881
|
return __async(this, null, function* () {
|
|
@@ -1727,7 +1891,7 @@ class fe {
|
|
|
1727
1891
|
const s2 = yield this.call("GET", ["me", "conversations", e2, "messages", t2], {});
|
|
1728
1892
|
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return c(null);
|
|
1729
1893
|
if (!s2.ok && "server" === s2.where && 403 === s2.value.status && "NOT_A_PARTICIPANT" === s2.value.errorCode) return c(null);
|
|
1730
|
-
if (!s2.ok) return
|
|
1894
|
+
if (!s2.ok) return ye(s2, `Fetching referenced message ${t2} in conversation ${e2}`);
|
|
1731
1895
|
const n2 = s2.value.data, r2 = yield this.getUser(n2.senderId);
|
|
1732
1896
|
if (!r2.ok) return r2;
|
|
1733
1897
|
const i2 = r2.value;
|
|
@@ -1738,26 +1902,26 @@ class fe {
|
|
|
1738
1902
|
return __async(this, null, function* () {
|
|
1739
1903
|
const t2 = yield this.call("GET", ["users", e2], { includePrivateFields: false });
|
|
1740
1904
|
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return c(null);
|
|
1741
|
-
if (!t2.ok) return
|
|
1905
|
+
if (!t2.ok) return ye(t2, "Get user " + e2);
|
|
1742
1906
|
return c(this.createUserSnapshot(t2.value.data));
|
|
1743
1907
|
});
|
|
1744
1908
|
}
|
|
1745
1909
|
createMessageSnapshotPreloaded(e2, t2, s2) {
|
|
1746
|
-
return { id: e2.id, type: e2.type, sender: t2, referencedMessage: s2, custom: e2.custom, createdAt: e2.createdAt, editedAt: e2.editedAt, origin: e2.origin, content: e2.content, plaintext:
|
|
1910
|
+
return { id: e2.id, type: e2.type, sender: t2, referencedMessage: s2, custom: e2.custom, createdAt: e2.createdAt, editedAt: e2.editedAt, origin: e2.origin, content: e2.content, plaintext: te(e2.content, {}) };
|
|
1747
1911
|
}
|
|
1748
1912
|
createReferencedMessageSnapshotPreloaded(e2, t2) {
|
|
1749
|
-
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:
|
|
1913
|
+
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, {}) };
|
|
1750
1914
|
}
|
|
1751
1915
|
}
|
|
1752
|
-
function
|
|
1916
|
+
function ye(e2, t2) {
|
|
1753
1917
|
return "server" === e2.where ? h(__spreadProps(__spreadValues({}, e2.value), { operation: t2 })) : e2;
|
|
1754
1918
|
}
|
|
1755
|
-
function
|
|
1919
|
+
function Ae(e2, s2) {
|
|
1756
1920
|
var _a2;
|
|
1757
1921
|
if (s2.ok) return s2.value;
|
|
1758
1922
|
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));
|
|
1759
1923
|
}
|
|
1760
|
-
class
|
|
1924
|
+
class Ce {
|
|
1761
1925
|
constructor(e2, t2) {
|
|
1762
1926
|
this.id = e2, this._realtimeClient = t2;
|
|
1763
1927
|
}
|
|
@@ -1767,7 +1931,7 @@ class ve {
|
|
|
1767
1931
|
get() {
|
|
1768
1932
|
return __async(this, null, function* () {
|
|
1769
1933
|
const e2 = yield this._realtimeClient.getUser(this.brandedId);
|
|
1770
|
-
return
|
|
1934
|
+
return Ae("Get user " + this.id, e2);
|
|
1771
1935
|
});
|
|
1772
1936
|
}
|
|
1773
1937
|
set(t2) {
|
|
@@ -1788,7 +1952,7 @@ class ve {
|
|
|
1788
1952
|
return this._realtimeClient.subscribe(["users", this.brandedId], e2);
|
|
1789
1953
|
}
|
|
1790
1954
|
}
|
|
1791
|
-
class
|
|
1955
|
+
class Ee {
|
|
1792
1956
|
constructor(e2, t2, s2) {
|
|
1793
1957
|
this.userId = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
1794
1958
|
}
|
|
@@ -1832,7 +1996,7 @@ class be {
|
|
|
1832
1996
|
});
|
|
1833
1997
|
}
|
|
1834
1998
|
}
|
|
1835
|
-
function
|
|
1999
|
+
function ke(e2) {
|
|
1836
2000
|
const t2 = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
|
|
1837
2001
|
let s2 = 0;
|
|
1838
2002
|
const n2 = [], r2 = e2 === s2;
|
|
@@ -1850,7 +2014,7 @@ function ye(e2) {
|
|
|
1850
2014
|
if (20 != a2.length) throw new Error("Length should be 20.");
|
|
1851
2015
|
return a2;
|
|
1852
2016
|
}
|
|
1853
|
-
const
|
|
2017
|
+
const xe = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
1854
2018
|
return e3.reduce((e4, s3, n2) => e4.concat(t3(s3, n2)), []);
|
|
1855
2019
|
}(e2, (e3) => {
|
|
1856
2020
|
if ("string" == typeof e3) return t2(e3, s2);
|
|
@@ -1863,14 +2027,14 @@ const we = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
1863
2027
|
case "bulletList":
|
|
1864
2028
|
case "bulletpoint":
|
|
1865
2029
|
case "bulletPoint":
|
|
1866
|
-
return [{ type: e3.type, children:
|
|
2030
|
+
return [{ type: e3.type, children: xe(e3.children, t2, e3.type) }];
|
|
1867
2031
|
case "link":
|
|
1868
|
-
return [{ type: e3.type, url: e3.url, children:
|
|
2032
|
+
return [{ type: e3.type, url: e3.url, children: xe(e3.children, t2, e3.type) }];
|
|
1869
2033
|
case "actionlink":
|
|
1870
2034
|
case "actionLink":
|
|
1871
2035
|
case "actionbutton":
|
|
1872
2036
|
case "actionButton":
|
|
1873
|
-
return [{ type: e3.type, action: e3.action, params: e3.params, children:
|
|
2037
|
+
return [{ type: e3.type, action: e3.action, params: e3.params, children: xe(e3.children, t2, e3.type) }];
|
|
1874
2038
|
case "mention":
|
|
1875
2039
|
case "autolink":
|
|
1876
2040
|
case "autoLink":
|
|
@@ -1885,12 +2049,12 @@ const we = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
1885
2049
|
return [e3];
|
|
1886
2050
|
}
|
|
1887
2051
|
});
|
|
1888
|
-
function
|
|
2052
|
+
function Te(e2, t2) {
|
|
1889
2053
|
return (s2) => {
|
|
1890
2054
|
const n2 = s2;
|
|
1891
2055
|
let r2 = 0;
|
|
1892
2056
|
const i2 = [];
|
|
1893
|
-
for (const a2 of
|
|
2057
|
+
for (const a2 of J(s2, e2)) {
|
|
1894
2058
|
a2.index - r2 > 0 && i2.push(n2.substring(r2, a2.index));
|
|
1895
2059
|
const e3 = t2(a2);
|
|
1896
2060
|
Array.isArray(e3) ? i2.push(...e3) : i2.push(e3), r2 = a2.index + a2[0].length;
|
|
@@ -1898,29 +2062,29 @@ function Ae(e2, t2) {
|
|
|
1898
2062
|
return r2 < s2.length && i2.push(s2.substring(r2)), i2;
|
|
1899
2063
|
};
|
|
1900
2064
|
}
|
|
1901
|
-
const
|
|
1902
|
-
var
|
|
1903
|
-
const
|
|
2065
|
+
const Ie = "’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2066
|
+
var Se = ((e2) => (e2[e2.italic = 1] = "italic", e2[e2.strikethrough = 2] = "strikethrough", e2[e2.bold = 4] = "bold", e2))(Se || {});
|
|
2067
|
+
const De = [0, 1, 2, 3, 4, 5, 6].map((e2) => {
|
|
1904
2068
|
const t2 = [];
|
|
1905
2069
|
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");
|
|
1906
|
-
}),
|
|
1907
|
-
function
|
|
1908
|
-
return
|
|
2070
|
+
}), Fe = { _: 1, "*": 4, "~": 2 };
|
|
2071
|
+
function Me(e2) {
|
|
2072
|
+
return Be(e2, 0);
|
|
1909
2073
|
}
|
|
1910
|
-
function
|
|
1911
|
-
const s2 =
|
|
1912
|
-
const t3 =
|
|
2074
|
+
function Be(e2, t2 = 0) {
|
|
2075
|
+
const s2 = De[t2], n2 = s2 ? function(e3) {
|
|
2076
|
+
const t3 = Re.getOrCompute(e3, () => new RegExp(`(?:^|[\\s${Ie}])(?:${e3.source})(?=[\\s${Ie}]|$)`, "g")), s3 = Te(t3, (e4) => {
|
|
1913
2077
|
const t4 = e4[0][1], s4 = e4[1] || e4[2] || e4[3] || e4[4] || e4[5] || e4[6];
|
|
1914
|
-
return [" ", { type:
|
|
2078
|
+
return [" ", { type: Se[Fe[t4]], children: [s4] }];
|
|
1915
2079
|
});
|
|
1916
2080
|
return (e4) => {
|
|
1917
2081
|
const [t4, ...n3] = s3(" " + e4);
|
|
1918
2082
|
return t4.length > 1 && n3.unshift(t4.substring(1)), n3;
|
|
1919
2083
|
};
|
|
1920
2084
|
}(s2) : () => [e2];
|
|
1921
|
-
return
|
|
2085
|
+
return xe(n2(e2), (e3, s3) => "bold" === s3 || "italic" === s3 || "strikethrough" === s3 ? Be(e3, t2 | Se[s3]) : [e3]);
|
|
1922
2086
|
}
|
|
1923
|
-
const
|
|
2087
|
+
const Re = function() {
|
|
1924
2088
|
const e2 = function() {
|
|
1925
2089
|
try {
|
|
1926
2090
|
return /* @__PURE__ */ new WeakMap();
|
|
@@ -1936,18 +2100,18 @@ const De = function() {
|
|
|
1936
2100
|
return e2.set(t2, n2), n2;
|
|
1937
2101
|
} };
|
|
1938
2102
|
}();
|
|
1939
|
-
function
|
|
2103
|
+
function Ne(e2, t2) {
|
|
1940
2104
|
if (Array.prototype.indexOf) return e2.indexOf(t2);
|
|
1941
2105
|
for (var s2 = 0, n2 = e2.length; s2 < n2; s2++) if (e2[s2] === t2) return s2;
|
|
1942
2106
|
return -1;
|
|
1943
2107
|
}
|
|
1944
|
-
function
|
|
2108
|
+
function Pe(e2, t2) {
|
|
1945
2109
|
for (var s2 = e2.length - 1; s2 >= 0; s2--) true === t2(e2[s2]) && e2.splice(s2, 1);
|
|
1946
2110
|
}
|
|
1947
|
-
function
|
|
2111
|
+
function _e(e2) {
|
|
1948
2112
|
throw new Error("Unhandled case for value: '" + e2 + "'");
|
|
1949
2113
|
}
|
|
1950
|
-
var
|
|
2114
|
+
var Oe = function() {
|
|
1951
2115
|
function e2(e3) {
|
|
1952
2116
|
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 || "";
|
|
1953
2117
|
}
|
|
@@ -1966,11 +2130,11 @@ var Me = function() {
|
|
|
1966
2130
|
}, e2.prototype.setClass = function(e3) {
|
|
1967
2131
|
return this.setAttr("class", e3);
|
|
1968
2132
|
}, e2.prototype.addClass = function(e3) {
|
|
1969
|
-
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], i2 = e3.split(n2); t2 = i2.shift(); ) -1 ===
|
|
2133
|
+
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], i2 = e3.split(n2); t2 = i2.shift(); ) -1 === Ne(r2, t2) && r2.push(t2);
|
|
1970
2134
|
return this.getAttrs().class = r2.join(" "), this;
|
|
1971
2135
|
}, e2.prototype.removeClass = function(e3) {
|
|
1972
2136
|
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], i2 = e3.split(n2); r2.length && (t2 = i2.shift()); ) {
|
|
1973
|
-
var a2 =
|
|
2137
|
+
var a2 = Ne(r2, t2);
|
|
1974
2138
|
-1 !== a2 && r2.splice(a2, 1);
|
|
1975
2139
|
}
|
|
1976
2140
|
return this.getAttrs().class = r2.join(" "), this;
|
|
@@ -1996,12 +2160,12 @@ var Me = function() {
|
|
|
1996
2160
|
return t2.join(" ");
|
|
1997
2161
|
}, e2;
|
|
1998
2162
|
}();
|
|
1999
|
-
var
|
|
2163
|
+
var Ue = function() {
|
|
2000
2164
|
function e2(e3) {
|
|
2001
2165
|
void 0 === e3 && (e3 = {}), this.newWindow = false, this.truncate = {}, this.className = "", this.newWindow = e3.newWindow || false, this.truncate = e3.truncate || {}, this.className = e3.className || "";
|
|
2002
2166
|
}
|
|
2003
2167
|
return e2.prototype.build = function(e3) {
|
|
2004
|
-
return new
|
|
2168
|
+
return new Oe({ tagName: "a", attrs: this.createAttrs(e3), innerHtml: this.processAnchorText(e3.getAnchorText()) });
|
|
2005
2169
|
}, e2.prototype.createAttrs = function(e3) {
|
|
2006
2170
|
var t2 = { href: e3.getAnchorHref() }, s2 = this.createCssClass(e3);
|
|
2007
2171
|
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;
|
|
@@ -2071,7 +2235,7 @@ var Re = function() {
|
|
|
2071
2235
|
}(e4, t3, s3);
|
|
2072
2236
|
}(e3, s2);
|
|
2073
2237
|
}, e2;
|
|
2074
|
-
}(),
|
|
2238
|
+
}(), $e = function() {
|
|
2075
2239
|
function e2(e3) {
|
|
2076
2240
|
this.__jsduckDummyDocProp = null, this.matchedText = "", this.offset = 0, this.tagBuilder = e3.tagBuilder, this.matchedText = e3.matchedText, this.offset = e3.offset;
|
|
2077
2241
|
}
|
|
@@ -2086,30 +2250,30 @@ var Re = function() {
|
|
|
2086
2250
|
}, e2.prototype.buildTag = function() {
|
|
2087
2251
|
return this.tagBuilder.build(this);
|
|
2088
2252
|
}, e2;
|
|
2089
|
-
}(),
|
|
2090
|
-
return
|
|
2253
|
+
}(), je = function(e2, t2) {
|
|
2254
|
+
return je = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e3, t3) {
|
|
2091
2255
|
e3.__proto__ = t3;
|
|
2092
2256
|
} || function(e3, t3) {
|
|
2093
2257
|
for (var s2 in t3) t3.hasOwnProperty(s2) && (e3[s2] = t3[s2]);
|
|
2094
|
-
},
|
|
2258
|
+
}, je(e2, t2);
|
|
2095
2259
|
};
|
|
2096
|
-
function
|
|
2260
|
+
function We(e2, t2) {
|
|
2097
2261
|
function s2() {
|
|
2098
2262
|
this.constructor = e2;
|
|
2099
2263
|
}
|
|
2100
|
-
|
|
2264
|
+
je(e2, t2), e2.prototype = null === t2 ? Object.create(t2) : (s2.prototype = t2.prototype, new s2());
|
|
2101
2265
|
}
|
|
2102
|
-
var
|
|
2103
|
-
return
|
|
2266
|
+
var qe, He = function() {
|
|
2267
|
+
return He = Object.assign || function(e2) {
|
|
2104
2268
|
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]);
|
|
2105
2269
|
return e2;
|
|
2106
|
-
},
|
|
2107
|
-
},
|
|
2270
|
+
}, He.apply(this, arguments);
|
|
2271
|
+
}, Ge = function(e2) {
|
|
2108
2272
|
function t2(t3) {
|
|
2109
2273
|
var s2 = e2.call(this, t3) || this;
|
|
2110
2274
|
return s2.email = "", s2.email = t3.email, s2;
|
|
2111
2275
|
}
|
|
2112
|
-
return
|
|
2276
|
+
return We(t2, e2), t2.prototype.getType = function() {
|
|
2113
2277
|
return "email";
|
|
2114
2278
|
}, t2.prototype.getEmail = function() {
|
|
2115
2279
|
return this.email;
|
|
@@ -2118,12 +2282,12 @@ var Pe, Ue = function() {
|
|
|
2118
2282
|
}, t2.prototype.getAnchorText = function() {
|
|
2119
2283
|
return this.email;
|
|
2120
2284
|
}, t2;
|
|
2121
|
-
}(
|
|
2285
|
+
}($e), Le = function(e2) {
|
|
2122
2286
|
function t2(t3) {
|
|
2123
2287
|
var s2 = e2.call(this, t3) || this;
|
|
2124
2288
|
return s2.serviceName = "", s2.hashtag = "", s2.serviceName = t3.serviceName, s2.hashtag = t3.hashtag, s2;
|
|
2125
2289
|
}
|
|
2126
|
-
return
|
|
2290
|
+
return We(t2, e2), t2.prototype.getType = function() {
|
|
2127
2291
|
return "hashtag";
|
|
2128
2292
|
}, t2.prototype.getServiceName = function() {
|
|
2129
2293
|
return this.serviceName;
|
|
@@ -2144,12 +2308,12 @@ var Pe, Ue = function() {
|
|
|
2144
2308
|
}, t2.prototype.getAnchorText = function() {
|
|
2145
2309
|
return "#" + this.hashtag;
|
|
2146
2310
|
}, t2;
|
|
2147
|
-
}(
|
|
2311
|
+
}($e), ze = function(e2) {
|
|
2148
2312
|
function t2(t3) {
|
|
2149
2313
|
var s2 = e2.call(this, t3) || this;
|
|
2150
2314
|
return s2.serviceName = "twitter", s2.mention = "", s2.mention = t3.mention, s2.serviceName = t3.serviceName, s2;
|
|
2151
2315
|
}
|
|
2152
|
-
return
|
|
2316
|
+
return We(t2, e2), t2.prototype.getType = function() {
|
|
2153
2317
|
return "mention";
|
|
2154
2318
|
}, t2.prototype.getMention = function() {
|
|
2155
2319
|
return this.mention;
|
|
@@ -2172,12 +2336,12 @@ var Pe, Ue = function() {
|
|
|
2172
2336
|
var t3 = e2.prototype.getCssClassSuffixes.call(this), s2 = this.getServiceName();
|
|
2173
2337
|
return s2 && t3.push(s2), t3;
|
|
2174
2338
|
}, t2;
|
|
2175
|
-
}(
|
|
2339
|
+
}($e), Je = function(e2) {
|
|
2176
2340
|
function t2(t3) {
|
|
2177
2341
|
var s2 = e2.call(this, t3) || this;
|
|
2178
2342
|
return s2.number = "", s2.plusSign = false, s2.number = t3.number, s2.plusSign = t3.plusSign, s2;
|
|
2179
2343
|
}
|
|
2180
|
-
return
|
|
2344
|
+
return We(t2, e2), t2.prototype.getType = function() {
|
|
2181
2345
|
return "phone";
|
|
2182
2346
|
}, t2.prototype.getPhoneNumber = function() {
|
|
2183
2347
|
return this.number;
|
|
@@ -2188,12 +2352,12 @@ var Pe, Ue = function() {
|
|
|
2188
2352
|
}, t2.prototype.getAnchorText = function() {
|
|
2189
2353
|
return this.matchedText;
|
|
2190
2354
|
}, t2;
|
|
2191
|
-
}(
|
|
2355
|
+
}($e), Ye = function(e2) {
|
|
2192
2356
|
function t2(t3) {
|
|
2193
2357
|
var s2 = e2.call(this, t3) || this;
|
|
2194
2358
|
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;
|
|
2195
2359
|
}
|
|
2196
|
-
return
|
|
2360
|
+
return We(t2, e2), t2.prototype.getType = function() {
|
|
2197
2361
|
return "url";
|
|
2198
2362
|
}, t2.prototype.getUrlMatchType = function() {
|
|
2199
2363
|
return this.urlMatchType;
|
|
@@ -2221,19 +2385,19 @@ var Pe, Ue = function() {
|
|
|
2221
2385
|
return t3;
|
|
2222
2386
|
}
|
|
2223
2387
|
}, t2;
|
|
2224
|
-
}(
|
|
2388
|
+
}($e), Qe = function(e2) {
|
|
2225
2389
|
this.__jsduckDummyDocProp = null, this.tagBuilder = e2.tagBuilder;
|
|
2226
|
-
},
|
|
2227
|
-
return "(?=(" +
|
|
2228
|
-
},
|
|
2229
|
-
return "(?:" +
|
|
2230
|
-
}, at = new RegExp("[" + tt + "]"), ot = /(?: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|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/, ut = new RegExp("[" + tt + "!#$%&'*+/=?^_`{|}~-]"), ct = new RegExp("^" + ot.source + "$"), lt = function(e2) {
|
|
2390
|
+
}, Ve = /[A-Za-z]/, Ze = /[\d]/, Ke = /[\D]/, Xe = /\s/, et = /['"]/, tt = /[\x00-\x1F\x7F]/, st = /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, nt = st + /\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, rt = /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, it = nt + rt, at = nt + rt, ot = "(?:[" + rt + "]{1,3}\\.){3}[" + rt + "]{1,3}", ut = "[" + at + "](?:[" + at + "\\-]{0,61}[" + at + "])?", ct = function(e2) {
|
|
2391
|
+
return "(?=(" + ut + "))\\" + e2;
|
|
2392
|
+
}, lt = function(e2) {
|
|
2393
|
+
return "(?:" + ct(e2) + "(?:\\." + ct(e2 + 1) + "){0,126}|" + ot + ")";
|
|
2394
|
+
}, ht = new RegExp("[" + at + "]"), dt = /(?: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|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/, pt = new RegExp("[" + at + "!#$%&'*+/=?^_`{|}~-]"), ft = new RegExp("^" + dt.source + "$"), mt = function(e2) {
|
|
2231
2395
|
function t2() {
|
|
2232
2396
|
var t3 = null !== e2 && e2.apply(this, arguments) || this;
|
|
2233
|
-
return t3.localPartCharRegex =
|
|
2397
|
+
return t3.localPartCharRegex = pt, t3.strictTldRegex = ft, t3;
|
|
2234
2398
|
}
|
|
2235
|
-
return
|
|
2236
|
-
for (var t3 = this.tagBuilder, s2 = this.localPartCharRegex, n2 = this.strictTldRegex, r2 = [], i2 = e3.length, a2 = new
|
|
2399
|
+
return We(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2400
|
+
for (var t3 = this.tagBuilder, s2 = this.localPartCharRegex, n2 = this.strictTldRegex, r2 = [], i2 = e3.length, a2 = new gt(), o2 = { m: "a", a: "i", i: "l", l: "t", t: "o", o: ":" }, u2 = 0, c2 = 0, l2 = a2; u2 < i2; ) {
|
|
2237
2401
|
var h2 = e3.charAt(u2);
|
|
2238
2402
|
switch (c2) {
|
|
2239
2403
|
case 0:
|
|
@@ -2246,10 +2410,10 @@ var Pe, Ue = function() {
|
|
|
2246
2410
|
f2(h2);
|
|
2247
2411
|
break;
|
|
2248
2412
|
case 3:
|
|
2249
|
-
|
|
2413
|
+
m2(h2);
|
|
2250
2414
|
break;
|
|
2251
2415
|
case 4:
|
|
2252
|
-
|
|
2416
|
+
g2(h2);
|
|
2253
2417
|
break;
|
|
2254
2418
|
case 5:
|
|
2255
2419
|
v2(h2);
|
|
@@ -2258,40 +2422,40 @@ var Pe, Ue = function() {
|
|
|
2258
2422
|
b2(h2);
|
|
2259
2423
|
break;
|
|
2260
2424
|
case 7:
|
|
2261
|
-
|
|
2425
|
+
w2(h2);
|
|
2262
2426
|
break;
|
|
2263
2427
|
default:
|
|
2264
|
-
|
|
2428
|
+
_e(c2);
|
|
2265
2429
|
}
|
|
2266
2430
|
u2++;
|
|
2267
2431
|
}
|
|
2268
2432
|
return C2(), r2;
|
|
2269
2433
|
function d2(e4) {
|
|
2270
|
-
"m" === e4 ?
|
|
2434
|
+
"m" === e4 ? y2(1) : s2.test(e4) && y2();
|
|
2271
2435
|
}
|
|
2272
2436
|
function p2(e4, t4) {
|
|
2273
|
-
":" === e4 ? s2.test(t4) ? (c2 = 2, l2 = new
|
|
2437
|
+
":" === e4 ? s2.test(t4) ? (c2 = 2, l2 = new gt(He(He({}, l2), { hasMailtoPrefix: true }))) : A2() : o2[e4] === t4 || (s2.test(t4) ? c2 = 2 : "." === t4 ? c2 = 3 : "@" === t4 ? c2 = 4 : A2());
|
|
2274
2438
|
}
|
|
2275
2439
|
function f2(e4) {
|
|
2276
2440
|
"." === e4 ? c2 = 3 : "@" === e4 ? c2 = 4 : s2.test(e4) || A2();
|
|
2277
2441
|
}
|
|
2278
|
-
function
|
|
2442
|
+
function m2(e4) {
|
|
2279
2443
|
"." === e4 || "@" === e4 ? A2() : s2.test(e4) ? c2 = 2 : A2();
|
|
2280
2444
|
}
|
|
2281
|
-
function
|
|
2282
|
-
|
|
2445
|
+
function g2(e4) {
|
|
2446
|
+
ht.test(e4) ? c2 = 5 : A2();
|
|
2283
2447
|
}
|
|
2284
2448
|
function v2(e4) {
|
|
2285
|
-
"." === e4 ? c2 = 7 : "-" === e4 ? c2 = 6 :
|
|
2449
|
+
"." === e4 ? c2 = 7 : "-" === e4 ? c2 = 6 : ht.test(e4) || C2();
|
|
2286
2450
|
}
|
|
2287
2451
|
function b2(e4) {
|
|
2288
|
-
"-" === e4 || "." === e4 ? C2() :
|
|
2289
|
-
}
|
|
2290
|
-
function y2(e4) {
|
|
2291
|
-
"." === e4 || "-" === e4 ? C2() : at.test(e4) ? (c2 = 5, l2 = new ht(Ue(Ue({}, l2), { hasDomainDot: true }))) : C2();
|
|
2452
|
+
"-" === e4 || "." === e4 ? C2() : ht.test(e4) ? c2 = 5 : C2();
|
|
2292
2453
|
}
|
|
2293
2454
|
function w2(e4) {
|
|
2294
|
-
|
|
2455
|
+
"." === e4 || "-" === e4 ? C2() : ht.test(e4) ? (c2 = 5, l2 = new gt(He(He({}, l2), { hasDomainDot: true }))) : C2();
|
|
2456
|
+
}
|
|
2457
|
+
function y2(e4) {
|
|
2458
|
+
void 0 === e4 && (e4 = 2), c2 = e4, l2 = new gt({ idx: u2 });
|
|
2295
2459
|
}
|
|
2296
2460
|
function A2() {
|
|
2297
2461
|
c2 = 0, l2 = a2;
|
|
@@ -2304,14 +2468,14 @@ var Pe, Ue = function() {
|
|
|
2304
2468
|
(function(e4) {
|
|
2305
2469
|
var t4 = e4.split(".").pop() || "", s4 = t4.toLowerCase();
|
|
2306
2470
|
return n2.test(s4);
|
|
2307
|
-
})(i3) && r2.push(new
|
|
2471
|
+
})(i3) && r2.push(new Ge({ tagBuilder: t3, matchedText: s3, offset: l2.idx, email: i3 }));
|
|
2308
2472
|
}
|
|
2309
2473
|
A2();
|
|
2310
2474
|
}
|
|
2311
2475
|
}, t2;
|
|
2312
|
-
}(
|
|
2476
|
+
}(Qe), gt = function(e2) {
|
|
2313
2477
|
void 0 === e2 && (e2 = {}), this.idx = void 0 !== e2.idx ? e2.idx : -1, this.hasMailtoPrefix = !!e2.hasMailtoPrefix, this.hasDomainDot = !!e2.hasDomainDot;
|
|
2314
|
-
},
|
|
2478
|
+
}, vt = function() {
|
|
2315
2479
|
function e2() {
|
|
2316
2480
|
}
|
|
2317
2481
|
return e2.isValid = function(e3, t2) {
|
|
@@ -2329,22 +2493,22 @@ var Pe, Ue = function() {
|
|
|
2329
2493
|
return !(!e3 || t2 && this.hasFullProtocolRegex.test(t2) || -1 !== e3.indexOf("."));
|
|
2330
2494
|
}, e2.urlMatchDoesNotHaveAtLeastOneWordChar = function(e3, t2) {
|
|
2331
2495
|
return !(!e3 || !t2) && (!this.hasFullProtocolRegex.test(t2) && !this.hasWordCharAfterProtocolRegex.test(e3));
|
|
2332
|
-
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" +
|
|
2333
|
-
}(),
|
|
2496
|
+
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" + st + "]"), 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;
|
|
2497
|
+
}(), bt = (qe = new RegExp("[/?#](?:[" + at + "\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*[" + at + "\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"), new RegExp(["(?:", "(", /(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source, lt(2), ")", "|", "(", "(//)?", /(?:www\.)/.source, lt(6), ")", "|", "(", "(//)?", lt(10) + "\\.", dt.source, "(?![-" + it + "])", ")", ")", "(?::[0-9]+)?", "(?:" + qe.source + ")?"].join(""), "gi")), wt = new RegExp("[" + at + "]"), yt = function(e2) {
|
|
2334
2498
|
function t2(t3) {
|
|
2335
2499
|
var s2 = e2.call(this, t3) || this;
|
|
2336
|
-
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex =
|
|
2500
|
+
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex = bt, s2.wordCharRegExp = wt, s2.stripPrefix = t3.stripPrefix, s2.stripTrailingSlash = t3.stripTrailingSlash, s2.decodePercentEncoding = t3.decodePercentEncoding, s2;
|
|
2337
2501
|
}
|
|
2338
|
-
return
|
|
2502
|
+
return We(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2339
2503
|
for (var t3, s2 = this.matcherRegex, n2 = this.stripPrefix, r2 = this.stripTrailingSlash, i2 = this.decodePercentEncoding, a2 = this.tagBuilder, o2 = [], u2 = function() {
|
|
2340
|
-
var s3 = t3[0], u3 = t3[1], l2 = t3[4], h2 = t3[5], d2 = t3[9], p2 = t3.index, f2 = h2 || d2,
|
|
2341
|
-
if (!
|
|
2342
|
-
if (p2 > 0 && "@" ===
|
|
2343
|
-
if (p2 > 0 && f2 && c2.wordCharRegExp.test(
|
|
2504
|
+
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);
|
|
2505
|
+
if (!vt.isValid(s3, u3)) return "continue";
|
|
2506
|
+
if (p2 > 0 && "@" === m2) return "continue";
|
|
2507
|
+
if (p2 > 0 && f2 && c2.wordCharRegExp.test(m2)) return "continue";
|
|
2344
2508
|
if (/\?$/.test(s3) && (s3 = s3.substr(0, s3.length - 1)), c2.matchHasUnbalancedClosingParen(s3)) s3 = s3.substr(0, s3.length - 1);
|
|
2345
2509
|
else {
|
|
2346
|
-
var
|
|
2347
|
-
|
|
2510
|
+
var g2 = c2.matchHasInvalidCharAfterTld(s3, u3);
|
|
2511
|
+
g2 > -1 && (s3 = s3.substr(0, g2));
|
|
2348
2512
|
}
|
|
2349
2513
|
var v2 = ["http://", "https://"].find(function(e4) {
|
|
2350
2514
|
return !!u3 && -1 !== u3.indexOf(e4);
|
|
@@ -2353,8 +2517,8 @@ var Pe, Ue = function() {
|
|
|
2353
2517
|
var b2 = s3.indexOf(v2);
|
|
2354
2518
|
s3 = s3.substr(b2), u3 = u3.substr(b2), p2 += b2;
|
|
2355
2519
|
}
|
|
2356
|
-
var
|
|
2357
|
-
o2.push(new
|
|
2520
|
+
var w2 = u3 ? "scheme" : l2 ? "www" : "tld", y2 = !!u3;
|
|
2521
|
+
o2.push(new Ye({ tagBuilder: a2, matchedText: s3, offset: p2, urlMatchType: w2, url: s3, protocolUrlMatch: y2, protocolRelativeMatch: !!f2, stripPrefix: n2, stripTrailingSlash: r2, decodePercentEncoding: i2 }));
|
|
2358
2522
|
}, c2 = this; null !== (t3 = s2.exec(e3)); ) u2();
|
|
2359
2523
|
return o2;
|
|
2360
2524
|
}, t2.prototype.matchHasUnbalancedClosingParen = function(e3) {
|
|
@@ -2374,65 +2538,65 @@ var Pe, Ue = function() {
|
|
|
2374
2538
|
if (!e3) return -1;
|
|
2375
2539
|
var s2 = 0;
|
|
2376
2540
|
t3 && (s2 = e3.indexOf(":"), e3 = e3.slice(s2));
|
|
2377
|
-
var n2 = new RegExp("^((.?//)?[-." +
|
|
2541
|
+
var n2 = new RegExp("^((.?//)?[-." + at + "]*[-" + at + "]\\.[-" + at + "]+)").exec(e3);
|
|
2378
2542
|
return null === n2 ? -1 : (s2 += n2[1].length, e3 = e3.slice(n2[1].length), /^[^-.A-Za-z0-9:\/?#]/.test(e3) ? s2 : -1);
|
|
2379
2543
|
}, t2;
|
|
2380
|
-
}(
|
|
2544
|
+
}(Qe), At = new RegExp("#[_" + at + "]{1,139}(?![_" + at + "])", "g"), Ct = new RegExp("[^" + at + "]"), Et = function(e2) {
|
|
2381
2545
|
function t2(t3) {
|
|
2382
2546
|
var s2 = e2.call(this, t3) || this;
|
|
2383
|
-
return s2.serviceName = "twitter", s2.matcherRegex =
|
|
2547
|
+
return s2.serviceName = "twitter", s2.matcherRegex = At, s2.nonWordCharRegex = Ct, s2.serviceName = t3.serviceName, s2;
|
|
2384
2548
|
}
|
|
2385
|
-
return
|
|
2549
|
+
return We(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2386
2550
|
for (var t3, s2 = this.matcherRegex, n2 = this.nonWordCharRegex, r2 = this.serviceName, i2 = this.tagBuilder, a2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
2387
2551
|
var o2 = t3.index, u2 = e3.charAt(o2 - 1);
|
|
2388
2552
|
if (0 === o2 || n2.test(u2)) {
|
|
2389
2553
|
var c2 = t3[0], l2 = t3[0].slice(1);
|
|
2390
|
-
a2.push(new
|
|
2554
|
+
a2.push(new Le({ tagBuilder: i2, matchedText: c2, offset: o2, serviceName: r2, hashtag: l2 }));
|
|
2391
2555
|
}
|
|
2392
2556
|
}
|
|
2393
2557
|
return a2;
|
|
2394
2558
|
}, t2;
|
|
2395
|
-
}(
|
|
2559
|
+
}(Qe), kt = 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"), xt = function(e2) {
|
|
2396
2560
|
function t2() {
|
|
2397
2561
|
var t3 = null !== e2 && e2.apply(this, arguments) || this;
|
|
2398
|
-
return t3.matcherRegex =
|
|
2562
|
+
return t3.matcherRegex = kt, t3;
|
|
2399
2563
|
}
|
|
2400
|
-
return
|
|
2564
|
+
return We(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2401
2565
|
for (var t3, s2 = this.matcherRegex, n2 = this.tagBuilder, r2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
2402
2566
|
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/);
|
|
2403
|
-
this.testMatch(t3[3]) && this.testMatch(i2) && l2 && r2.push(new
|
|
2567
|
+
this.testMatch(t3[3]) && this.testMatch(i2) && l2 && r2.push(new Je({ tagBuilder: n2, matchedText: i2, offset: t3.index, number: a2, plusSign: o2 }));
|
|
2404
2568
|
}
|
|
2405
2569
|
return r2;
|
|
2406
2570
|
}, t2.prototype.testMatch = function(e3) {
|
|
2407
|
-
return
|
|
2571
|
+
return Ke.test(e3);
|
|
2408
2572
|
}, t2;
|
|
2409
|
-
}(
|
|
2573
|
+
}(Qe), Tt = new RegExp("@[_" + at + "]{1,50}(?![_" + at + "])", "g"), It = new RegExp("@[_." + at + "]{1,30}(?![_" + at + "])", "g"), St = new RegExp("@[-_." + at + "]{1,50}(?![-_" + at + "])", "g"), Dt = new RegExp("[^" + at + "]"), Ft = function(e2) {
|
|
2410
2574
|
function t2(t3) {
|
|
2411
2575
|
var s2 = e2.call(this, t3) || this;
|
|
2412
|
-
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter:
|
|
2576
|
+
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter: Tt, instagram: It, soundcloud: St }, s2.nonWordCharRegex = Dt, s2.serviceName = t3.serviceName, s2;
|
|
2413
2577
|
}
|
|
2414
|
-
return
|
|
2578
|
+
return We(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2415
2579
|
var t3, s2 = this.serviceName, n2 = this.matcherRegexes[this.serviceName], r2 = this.nonWordCharRegex, i2 = this.tagBuilder, a2 = [];
|
|
2416
2580
|
if (!n2) return a2;
|
|
2417
2581
|
for (; null !== (t3 = n2.exec(e3)); ) {
|
|
2418
2582
|
var o2 = t3.index, u2 = e3.charAt(o2 - 1);
|
|
2419
2583
|
if (0 === o2 || r2.test(u2)) {
|
|
2420
2584
|
var c2 = t3[0].replace(/\.+$/g, ""), l2 = c2.slice(1);
|
|
2421
|
-
a2.push(new
|
|
2585
|
+
a2.push(new ze({ tagBuilder: i2, matchedText: c2, offset: o2, serviceName: s2, mention: l2 }));
|
|
2422
2586
|
}
|
|
2423
2587
|
}
|
|
2424
2588
|
return a2;
|
|
2425
2589
|
}, t2;
|
|
2426
|
-
}(
|
|
2427
|
-
function
|
|
2428
|
-
for (var s2, n2 = t2.onOpenTag, r2 = t2.onCloseTag, i2 = t2.onText, a2 = t2.onComment, o2 = t2.onDoctype, u2 = new
|
|
2590
|
+
}(Qe);
|
|
2591
|
+
function Mt(e2, t2) {
|
|
2592
|
+
for (var s2, n2 = t2.onOpenTag, r2 = t2.onCloseTag, i2 = t2.onText, a2 = t2.onComment, o2 = t2.onDoctype, u2 = new Bt(), c2 = 0, l2 = e2.length, h2 = 0, d2 = 0, p2 = u2; c2 < l2; ) {
|
|
2429
2593
|
var f2 = e2.charAt(c2);
|
|
2430
2594
|
switch (h2) {
|
|
2431
2595
|
case 0:
|
|
2432
|
-
|
|
2596
|
+
m2(f2);
|
|
2433
2597
|
break;
|
|
2434
2598
|
case 1:
|
|
2435
|
-
|
|
2599
|
+
g2(f2);
|
|
2436
2600
|
break;
|
|
2437
2601
|
case 2:
|
|
2438
2602
|
b2(f2);
|
|
@@ -2441,10 +2605,10 @@ function St(e2, t2) {
|
|
|
2441
2605
|
v2(f2);
|
|
2442
2606
|
break;
|
|
2443
2607
|
case 4:
|
|
2444
|
-
|
|
2608
|
+
w2(f2);
|
|
2445
2609
|
break;
|
|
2446
2610
|
case 5:
|
|
2447
|
-
|
|
2611
|
+
y2(f2);
|
|
2448
2612
|
break;
|
|
2449
2613
|
case 6:
|
|
2450
2614
|
A2(f2);
|
|
@@ -2462,25 +2626,25 @@ function St(e2, t2) {
|
|
|
2462
2626
|
x2(f2);
|
|
2463
2627
|
break;
|
|
2464
2628
|
case 11:
|
|
2465
|
-
|
|
2629
|
+
T2(f2);
|
|
2466
2630
|
break;
|
|
2467
2631
|
case 12:
|
|
2468
|
-
|
|
2632
|
+
I2(f2);
|
|
2469
2633
|
break;
|
|
2470
2634
|
case 13:
|
|
2471
|
-
|
|
2635
|
+
S2();
|
|
2472
2636
|
break;
|
|
2473
2637
|
case 14:
|
|
2474
|
-
|
|
2638
|
+
D2(f2);
|
|
2475
2639
|
break;
|
|
2476
2640
|
case 15:
|
|
2477
2641
|
F2(f2);
|
|
2478
2642
|
break;
|
|
2479
2643
|
case 16:
|
|
2480
|
-
|
|
2644
|
+
M2(f2);
|
|
2481
2645
|
break;
|
|
2482
2646
|
case 17:
|
|
2483
|
-
|
|
2647
|
+
B2(f2);
|
|
2484
2648
|
break;
|
|
2485
2649
|
case 18:
|
|
2486
2650
|
R2(f2);
|
|
@@ -2489,36 +2653,36 @@ function St(e2, t2) {
|
|
|
2489
2653
|
N2(f2);
|
|
2490
2654
|
break;
|
|
2491
2655
|
case 20:
|
|
2492
|
-
|
|
2656
|
+
P2(f2);
|
|
2493
2657
|
break;
|
|
2494
2658
|
default:
|
|
2495
|
-
|
|
2659
|
+
_e(h2);
|
|
2496
2660
|
}
|
|
2497
2661
|
c2++;
|
|
2498
2662
|
}
|
|
2499
|
-
function g2(e3) {
|
|
2500
|
-
"<" === e3 && P2();
|
|
2501
|
-
}
|
|
2502
2663
|
function m2(e3) {
|
|
2503
|
-
"
|
|
2664
|
+
"<" === e3 && O2();
|
|
2665
|
+
}
|
|
2666
|
+
function g2(e3) {
|
|
2667
|
+
"!" === e3 ? h2 = 13 : "/" === e3 ? (h2 = 2, p2 = new Bt(He(He({}, p2), { isClosing: true }))) : "<" === e3 ? O2() : Ve.test(e3) ? (h2 = 3, p2 = new Bt(He(He({}, p2), { isOpening: true }))) : (h2 = 0, p2 = u2);
|
|
2504
2668
|
}
|
|
2505
2669
|
function v2(e3) {
|
|
2506
|
-
|
|
2670
|
+
Xe.test(e3) ? (p2 = new Bt(He(He({}, p2), { name: $2() })), h2 = 4) : "<" === e3 ? O2() : "/" === e3 ? (p2 = new Bt(He(He({}, p2), { name: $2() })), h2 = 12) : ">" === e3 ? (p2 = new Bt(He(He({}, p2), { name: $2() })), U2()) : Ve.test(e3) || Ze.test(e3) || ":" === e3 || _2();
|
|
2507
2671
|
}
|
|
2508
2672
|
function b2(e3) {
|
|
2509
|
-
">" === e3 ?
|
|
2510
|
-
}
|
|
2511
|
-
function y2(e3) {
|
|
2512
|
-
Ye.test(e3) || ("/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? P2() : "=" === e3 || Qe.test(e3) || Ve.test(e3) ? O2() : h2 = 5);
|
|
2673
|
+
">" === e3 ? _2() : Ve.test(e3) ? h2 = 3 : _2();
|
|
2513
2674
|
}
|
|
2514
2675
|
function w2(e3) {
|
|
2515
|
-
|
|
2676
|
+
Xe.test(e3) || ("/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? O2() : "=" === e3 || et.test(e3) || tt.test(e3) ? _2() : h2 = 5);
|
|
2677
|
+
}
|
|
2678
|
+
function y2(e3) {
|
|
2679
|
+
Xe.test(e3) ? h2 = 6 : "/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? U2() : "<" === e3 ? O2() : et.test(e3) && _2();
|
|
2516
2680
|
}
|
|
2517
2681
|
function A2(e3) {
|
|
2518
|
-
|
|
2682
|
+
Xe.test(e3) || ("/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? U2() : "<" === e3 ? O2() : et.test(e3) ? _2() : h2 = 5);
|
|
2519
2683
|
}
|
|
2520
2684
|
function C2(e3) {
|
|
2521
|
-
|
|
2685
|
+
Xe.test(e3) || ('"' === e3 ? h2 = 8 : "'" === e3 ? h2 = 9 : /[>=`]/.test(e3) ? _2() : "<" === e3 ? O2() : h2 = 10);
|
|
2522
2686
|
}
|
|
2523
2687
|
function E2(e3) {
|
|
2524
2688
|
'"' === e3 && (h2 = 11);
|
|
@@ -2527,27 +2691,27 @@ function St(e2, t2) {
|
|
|
2527
2691
|
"'" === e3 && (h2 = 11);
|
|
2528
2692
|
}
|
|
2529
2693
|
function x2(e3) {
|
|
2530
|
-
|
|
2531
|
-
}
|
|
2532
|
-
function S2(e3) {
|
|
2533
|
-
Ye.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? P2() : (h2 = 4, c2--);
|
|
2694
|
+
Xe.test(e3) ? h2 = 4 : ">" === e3 ? U2() : "<" === e3 && O2();
|
|
2534
2695
|
}
|
|
2535
2696
|
function T2(e3) {
|
|
2536
|
-
"
|
|
2537
|
-
}
|
|
2538
|
-
function D2(t3) {
|
|
2539
|
-
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new Tt(Ue(Ue({}, p2), { type: "comment" })), h2 = 14) : "DOCTYPE" === e2.substr(c2, 7).toUpperCase() ? (c2 += 7, p2 = new Tt(Ue(Ue({}, p2), { type: "doctype" })), h2 = 20) : O2();
|
|
2697
|
+
Xe.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? O2() : (h2 = 4, c2--);
|
|
2540
2698
|
}
|
|
2541
2699
|
function I2(e3) {
|
|
2542
|
-
"
|
|
2700
|
+
">" === e3 ? (p2 = new Bt(He(He({}, p2), { isClosing: true })), U2()) : h2 = 4;
|
|
2701
|
+
}
|
|
2702
|
+
function S2(t3) {
|
|
2703
|
+
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new Bt(He(He({}, p2), { type: "comment" })), h2 = 14) : "DOCTYPE" === e2.substr(c2, 7).toUpperCase() ? (c2 += 7, p2 = new Bt(He(He({}, p2), { type: "doctype" })), h2 = 20) : _2();
|
|
2704
|
+
}
|
|
2705
|
+
function D2(e3) {
|
|
2706
|
+
"-" === e3 ? h2 = 15 : ">" === e3 ? _2() : h2 = 16;
|
|
2543
2707
|
}
|
|
2544
2708
|
function F2(e3) {
|
|
2545
|
-
"-" === e3 ? h2 = 18 : ">" === e3 ?
|
|
2709
|
+
"-" === e3 ? h2 = 18 : ">" === e3 ? _2() : h2 = 16;
|
|
2546
2710
|
}
|
|
2547
|
-
function
|
|
2711
|
+
function M2(e3) {
|
|
2548
2712
|
"-" === e3 && (h2 = 17);
|
|
2549
2713
|
}
|
|
2550
|
-
function
|
|
2714
|
+
function B2(e3) {
|
|
2551
2715
|
h2 = "-" === e3 ? 18 : 16;
|
|
2552
2716
|
}
|
|
2553
2717
|
function R2(e3) {
|
|
@@ -2556,28 +2720,28 @@ function St(e2, t2) {
|
|
|
2556
2720
|
function N2(e3) {
|
|
2557
2721
|
"-" === e3 ? h2 = 17 : ">" === e3 ? U2() : h2 = 16;
|
|
2558
2722
|
}
|
|
2559
|
-
function
|
|
2560
|
-
">" === e3 ? U2() : "<" === e3 &&
|
|
2723
|
+
function P2(e3) {
|
|
2724
|
+
">" === e3 ? U2() : "<" === e3 && O2();
|
|
2561
2725
|
}
|
|
2562
|
-
function
|
|
2726
|
+
function _2() {
|
|
2563
2727
|
h2 = 0, p2 = u2;
|
|
2564
2728
|
}
|
|
2565
|
-
function
|
|
2566
|
-
h2 = 1, p2 = new
|
|
2729
|
+
function O2() {
|
|
2730
|
+
h2 = 1, p2 = new Bt({ idx: c2 });
|
|
2567
2731
|
}
|
|
2568
2732
|
function U2() {
|
|
2569
2733
|
var t3 = e2.slice(d2, p2.idx);
|
|
2570
|
-
t3 && i2(t3, d2), "comment" === p2.type ? a2(p2.idx) : "doctype" === p2.type ? o2(p2.idx) : (p2.isOpening && n2(p2.name, p2.idx), p2.isClosing && r2(p2.name, p2.idx)),
|
|
2734
|
+
t3 && i2(t3, d2), "comment" === p2.type ? a2(p2.idx) : "doctype" === p2.type ? o2(p2.idx) : (p2.isOpening && n2(p2.name, p2.idx), p2.isClosing && r2(p2.name, p2.idx)), _2(), d2 = c2 + 1;
|
|
2571
2735
|
}
|
|
2572
|
-
function
|
|
2736
|
+
function $2() {
|
|
2573
2737
|
var t3 = p2.idx + (p2.isClosing ? 2 : 1);
|
|
2574
2738
|
return e2.slice(t3, c2).toLowerCase();
|
|
2575
2739
|
}
|
|
2576
2740
|
d2 < c2 && (s2 = e2.slice(d2, c2), i2(s2, d2), d2 = c2 + 1);
|
|
2577
2741
|
}
|
|
2578
|
-
var
|
|
2742
|
+
var Bt = function(e2) {
|
|
2579
2743
|
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;
|
|
2580
|
-
},
|
|
2744
|
+
}, Rt = function() {
|
|
2581
2745
|
function e2(t2) {
|
|
2582
2746
|
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;
|
|
2583
2747
|
var s2 = this.mention;
|
|
@@ -2601,7 +2765,7 @@ var Tt = function(e2) {
|
|
|
2601
2765
|
}(e3 || {}, { length: Number.POSITIVE_INFINITY, location: "end" });
|
|
2602
2766
|
}, e2.prototype.parse = function(e3) {
|
|
2603
2767
|
var t2 = this, s2 = ["a", "style", "script"], n2 = 0, r2 = [];
|
|
2604
|
-
return
|
|
2768
|
+
return Mt(e3, { onOpenTag: function(e4) {
|
|
2605
2769
|
s2.indexOf(e4) >= 0 && n2++;
|
|
2606
2770
|
}, onText: function(e4, s3) {
|
|
2607
2771
|
if (0 === n2) {
|
|
@@ -2640,19 +2804,19 @@ var Tt = function(e2) {
|
|
|
2640
2804
|
}
|
|
2641
2805
|
return e3;
|
|
2642
2806
|
}, e2.prototype.removeUnwantedMatches = function(e3) {
|
|
2643
|
-
return this.hashtag ||
|
|
2807
|
+
return this.hashtag || Pe(e3, function(e4) {
|
|
2644
2808
|
return "hashtag" === e4.getType();
|
|
2645
|
-
}), this.email ||
|
|
2809
|
+
}), this.email || Pe(e3, function(e4) {
|
|
2646
2810
|
return "email" === e4.getType();
|
|
2647
|
-
}), this.phone ||
|
|
2811
|
+
}), this.phone || Pe(e3, function(e4) {
|
|
2648
2812
|
return "phone" === e4.getType();
|
|
2649
|
-
}), this.mention ||
|
|
2813
|
+
}), this.mention || Pe(e3, function(e4) {
|
|
2650
2814
|
return "mention" === e4.getType();
|
|
2651
|
-
}), this.urls.schemeMatches ||
|
|
2815
|
+
}), this.urls.schemeMatches || Pe(e3, function(e4) {
|
|
2652
2816
|
return "url" === e4.getType() && "scheme" === e4.getUrlMatchType();
|
|
2653
|
-
}), this.urls.wwwMatches ||
|
|
2817
|
+
}), this.urls.wwwMatches || Pe(e3, function(e4) {
|
|
2654
2818
|
return "url" === e4.getType() && "www" === e4.getUrlMatchType();
|
|
2655
|
-
}), this.urls.tldMatches ||
|
|
2819
|
+
}), this.urls.tldMatches || Pe(e3, function(e4) {
|
|
2656
2820
|
return "url" === e4.getType() && "tld" === e4.getUrlMatchType();
|
|
2657
2821
|
}), e3;
|
|
2658
2822
|
}, e2.prototype.parseText = function(e3, t2) {
|
|
@@ -2672,99 +2836,99 @@ var Tt = function(e2) {
|
|
|
2672
2836
|
return s2.push(e3.substring(n2)), s2.join("");
|
|
2673
2837
|
}, e2.prototype.createMatchReturnVal = function(e3) {
|
|
2674
2838
|
var t2;
|
|
2675
|
-
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof
|
|
2839
|
+
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof Oe ? t2.toAnchorString() : e3.buildTag().toAnchorString();
|
|
2676
2840
|
}, e2.prototype.getMatchers = function() {
|
|
2677
2841
|
if (this.matchers) return this.matchers;
|
|
2678
|
-
var e3 = this.getTagBuilder(), t2 = [new
|
|
2842
|
+
var e3 = this.getTagBuilder(), t2 = [new Et({ tagBuilder: e3, serviceName: this.hashtag }), new mt({ tagBuilder: e3 }), new xt({ tagBuilder: e3 }), new Ft({ tagBuilder: e3, serviceName: this.mention }), new yt({ tagBuilder: e3, stripPrefix: this.stripPrefix, stripTrailingSlash: this.stripTrailingSlash, decodePercentEncoding: this.decodePercentEncoding })];
|
|
2679
2843
|
return this.matchers = t2;
|
|
2680
2844
|
}, e2.prototype.getTagBuilder = function() {
|
|
2681
2845
|
var e3 = this.tagBuilder;
|
|
2682
|
-
return e3 || (e3 = this.tagBuilder = new
|
|
2683
|
-
}, e2.version = "3.14.3", e2.AnchorTagBuilder =
|
|
2846
|
+
return e3 || (e3 = this.tagBuilder = new Ue({ newWindow: this.newWindow, truncate: this.truncate, className: this.className })), e3;
|
|
2847
|
+
}, e2.version = "3.14.3", e2.AnchorTagBuilder = Ue, e2.HtmlTag = Oe, e2.matcher = { Email: mt, Hashtag: Et, Matcher: Qe, Mention: Ft, Phone: xt, Url: yt }, e2.match = { Email: Ge, Hashtag: Le, Match: $e, Mention: ze, Phone: Je, Url: Ye }, e2;
|
|
2684
2848
|
}();
|
|
2685
|
-
function
|
|
2849
|
+
function Nt(e2, t2 = e2) {
|
|
2686
2850
|
return { type: "autolink", url: e2, text: t2 };
|
|
2687
2851
|
}
|
|
2688
|
-
const
|
|
2852
|
+
const Pt = Te(/<!!mention:([^>\s]*?)\|(.*?)>/gm, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3) {
|
|
2689
2853
|
return { type: "mention", id: e3, text: t3 };
|
|
2690
|
-
}(decodeURIComponent(t2), s2)),
|
|
2854
|
+
}(decodeURIComponent(t2), s2)), _t = Te(/<!!customemoji:(.*?)>/gm, ([e2, t2]) => /* @__PURE__ */ function(e3) {
|
|
2691
2855
|
return { type: "customemoji", text: e3 };
|
|
2692
|
-
}(t2)),
|
|
2856
|
+
}(t2)), Ot = Te(/<((?:https?|mailto):.*?)\|(.*?)>/gi, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3 = []) {
|
|
2693
2857
|
return { type: "link", url: e3, children: t3 };
|
|
2694
|
-
}(t2, [s2])),
|
|
2695
|
-
const { action: n2, params: r2 } =
|
|
2858
|
+
}(t2, [s2])), Ut = Te(/<actionlink:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
2859
|
+
const { action: n2, params: r2 } = jt(t2);
|
|
2696
2860
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
2697
2861
|
return { type: "actionlink", action: e3, params: t3, children: s3 };
|
|
2698
2862
|
}(n2, r2, [s2]);
|
|
2699
|
-
}),
|
|
2700
|
-
const { action: n2, params: r2 } =
|
|
2863
|
+
}), $t = Te(/<actionbutton:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
2864
|
+
const { action: n2, params: r2 } = jt(t2);
|
|
2701
2865
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
2702
2866
|
return { type: "actionbutton", action: e3, params: t3, children: s3 };
|
|
2703
2867
|
}(n2, r2, [s2]);
|
|
2704
2868
|
});
|
|
2705
|
-
function
|
|
2869
|
+
function jt(e2) {
|
|
2706
2870
|
const t2 = e2.indexOf("?");
|
|
2707
2871
|
if (-1 === t2) return { action: e2, params: {} };
|
|
2708
2872
|
return { action: e2.slice(0, t2), params: Object.fromEntries(new URLSearchParams(e2.slice(t2))) };
|
|
2709
2873
|
}
|
|
2710
|
-
const
|
|
2874
|
+
const Wt = Te(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g, ([e2]) => /* @__PURE__ */ function(e3 = []) {
|
|
2711
2875
|
return { type: "bulletlist", children: e3 };
|
|
2712
|
-
}([e2.startsWith("\n") ? e2.slice(1) : e2])),
|
|
2876
|
+
}([e2.startsWith("\n") ? e2.slice(1) : e2])), qt = Te(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm, ([e2, t2]) => ({ type: "bulletpoint", children: [t2] })), Ht = (e2) => {
|
|
2713
2877
|
const t2 = /(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;
|
|
2714
2878
|
let s2 = 0;
|
|
2715
2879
|
const n2 = [];
|
|
2716
|
-
for (const r2 of
|
|
2880
|
+
for (const r2 of J(e2, t2)) {
|
|
2717
2881
|
const t3 = r2[0], i2 = r2[1], a2 = t3.startsWith(i2) ? r2.index : r2.index + 1;
|
|
2718
2882
|
a2 - s2 > 0 && n2.push(e2.substring(s2, a2));
|
|
2719
|
-
const o2 =
|
|
2883
|
+
const o2 = Nt("tel:" + i2.replace(/[^0-9+]/g, ""), i2);
|
|
2720
2884
|
n2.push(o2), s2 = a2 + i2.length;
|
|
2721
2885
|
}
|
|
2722
2886
|
return s2 < e2.length && n2.push(e2.substring(s2)), n2;
|
|
2723
|
-
},
|
|
2724
|
-
const t2 =
|
|
2887
|
+
}, Gt = (e2) => Ot(e2).flatMap((e3) => "string" == typeof e3 ? Lt(e3) : ["<", ...Lt(e3.url), ...Lt("|" + e3.children[0] + ">")]), Lt = (e2) => {
|
|
2888
|
+
const t2 = Rt.parse(e2, { urls: true, email: true, phone: false, hashtag: false, mention: false }), s2 = [];
|
|
2725
2889
|
let n2 = 0;
|
|
2726
2890
|
for (const r2 of t2) {
|
|
2727
2891
|
const t3 = r2.getOffset(), i2 = r2.getMatchedText(), a2 = i2.length;
|
|
2728
2892
|
let o2 = i2;
|
|
2729
|
-
r2 instanceof
|
|
2893
|
+
r2 instanceof Ge ? o2 = "mailto:" + r2.getEmail() : r2 instanceof Ye && (o2 = r2.getUrl()), t3 > n2 && s2.push(e2.substring(n2, t3)), s2.push(Nt(o2, i2)), n2 = t3 + a2;
|
|
2730
2894
|
}
|
|
2731
2895
|
return n2 < e2.length && s2.push(e2.substring(n2)), s2;
|
|
2732
|
-
},
|
|
2733
|
-
function
|
|
2896
|
+
}, zt = ["Codeblock", "Codespan", "FormattedLink", "Wikitext", "Autolink", "Actions", "Mention", "Mention", "BulletPoint", "CustomEmoji"];
|
|
2897
|
+
function Jt(e2 = { except: [] }) {
|
|
2734
2898
|
var _a2;
|
|
2735
|
-
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 :
|
|
2736
|
-
return s2.includes("BulletPoint") || t2.multilineSteps.push(
|
|
2899
|
+
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 : zt.filter((t3) => !e2.only.includes(t3));
|
|
2900
|
+
return s2.includes("BulletPoint") || t2.multilineSteps.push(Wt, qt), s2.includes("Mention") || t2.singlelineSteps.push(Pt), s2.includes("CustomEmoji") || t2.singlelineSteps.push(_t), s2.includes("Codespan") || t2.multilineSteps.push(Te(/```([^]+?)```/g, ([e3, t3]) => ({ type: "codespan", text: t3 }))), s2.includes("FormattedLink") || t2.singlelineSteps.push(Ot), s2.includes("Actions") || (t2.singlelineSteps.push(Ut), t2.singlelineSteps.push($t)), s2.includes("Wikitext") || t2.singlelineSteps.push(Me), s2.includes("Autolink") || t2.singlelineSteps.push(Gt, Ht), t2;
|
|
2737
2901
|
}
|
|
2738
|
-
const
|
|
2902
|
+
const Yt = function(e2) {
|
|
2739
2903
|
const t2 = RegExp(`[^${e2}]+${e2}?|${e2}`, "g");
|
|
2740
2904
|
return (e3) => Array.from(e3.match(t2) || []);
|
|
2741
2905
|
}("\n");
|
|
2742
|
-
function
|
|
2906
|
+
function Qt(e2, t2 = { except: [] }) {
|
|
2743
2907
|
let s2 = function(e3, t3) {
|
|
2744
2908
|
let s3 = [e3];
|
|
2745
|
-
return s3 =
|
|
2746
|
-
}(e2,
|
|
2747
|
-
return s2 =
|
|
2909
|
+
return s3 = Vt(s3, t3.multilineSteps), s3 = Vt(s3, [Yt]), s3 = Vt(s3, t3.singlelineSteps), s3 = Zt(s3), s3;
|
|
2910
|
+
}(e2, Jt(t2));
|
|
2911
|
+
return s2 = Kt(s2, false), s2;
|
|
2748
2912
|
}
|
|
2749
|
-
function
|
|
2750
|
-
return t2.reduce((e3, t3) =>
|
|
2913
|
+
function Vt(e2, t2) {
|
|
2914
|
+
return t2.reduce((e3, t3) => xe(e3, t3), e2);
|
|
2751
2915
|
}
|
|
2752
|
-
function
|
|
2916
|
+
function Zt(e2) {
|
|
2753
2917
|
const t2 = [];
|
|
2754
2918
|
let s2 = -1;
|
|
2755
|
-
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:
|
|
2919
|
+
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: Zt(n2.children) }) : n2;
|
|
2756
2920
|
return t2;
|
|
2757
2921
|
}
|
|
2758
|
-
function
|
|
2922
|
+
function Kt(e2, t2) {
|
|
2759
2923
|
const s2 = [];
|
|
2760
2924
|
let n2 = [];
|
|
2761
2925
|
for (let r2 = 0; r2 < e2.length; r2++) {
|
|
2762
2926
|
const i2 = e2[r2];
|
|
2763
|
-
"string" == typeof i2 ? n2.push(i2) : "children" in i2 ? (n2.length > 0 && (s2.push(n2.join("")), n2 = []), i2.children =
|
|
2927
|
+
"string" == typeof i2 ? n2.push(i2) : "children" in i2 ? (n2.length > 0 && (s2.push(n2.join("")), n2 = []), i2.children = Kt(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));
|
|
2764
2928
|
}
|
|
2765
2929
|
return n2.length > 0 && (s2.push(n2.join("")), n2 = []), s2;
|
|
2766
2930
|
}
|
|
2767
|
-
class
|
|
2931
|
+
class Xt {
|
|
2768
2932
|
constructor(e2, t2, s2) {
|
|
2769
2933
|
this.id = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
2770
2934
|
}
|
|
@@ -2780,12 +2944,12 @@ class Yt {
|
|
|
2780
2944
|
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return null;
|
|
2781
2945
|
if (!t2.ok && "server" === t2.where && 403 === t2.value.status && "NOT_A_PARTICIPANT" === t2.value.errorCode) return null;
|
|
2782
2946
|
const s2 = e("Get message " + this.id, t2), n2 = yield this._realtimeClient.createMessageSnapshot(s2, this.brandedConversationId);
|
|
2783
|
-
return
|
|
2947
|
+
return Ae("Get message " + this.id, n2);
|
|
2784
2948
|
});
|
|
2785
2949
|
}
|
|
2786
2950
|
edit(t2) {
|
|
2787
2951
|
return __async(this, null, function* () {
|
|
2788
|
-
const s2 = { content:
|
|
2952
|
+
const s2 = { content: es(t2), custom: "string" == typeof t2 ? void 0 : t2.custom }, n2 = yield this._realtimeClient.call("PATCH", ["conversations", this.brandedConversationId, "messages", this.brandedId], s2);
|
|
2789
2953
|
e(`Edit message ${this.id} in conversation ${this.conversationId}`, n2);
|
|
2790
2954
|
});
|
|
2791
2955
|
}
|
|
@@ -2796,16 +2960,16 @@ class Yt {
|
|
|
2796
2960
|
});
|
|
2797
2961
|
}
|
|
2798
2962
|
}
|
|
2799
|
-
function
|
|
2963
|
+
function es(e2) {
|
|
2800
2964
|
if ("string" == typeof e2) {
|
|
2801
|
-
return [{ type: "text", children:
|
|
2965
|
+
return [{ type: "text", children: Qt(e2) }];
|
|
2802
2966
|
}
|
|
2803
2967
|
if ("text" in e2 && e2.text) {
|
|
2804
|
-
return [{ type: "text", children:
|
|
2968
|
+
return [{ type: "text", children: Qt(e2.text) }];
|
|
2805
2969
|
}
|
|
2806
2970
|
if ("content" in e2 && e2.content) return e2.content;
|
|
2807
2971
|
}
|
|
2808
|
-
class
|
|
2972
|
+
class ts {
|
|
2809
2973
|
constructor(e2, t2) {
|
|
2810
2974
|
this.id = e2, this._realtimeClient = t2, this.uselessObjForTypeCheck = { subject: null, photoUrl: null, welcomeMessages: null, custom: null, access: null, notify: null };
|
|
2811
2975
|
}
|
|
@@ -2816,16 +2980,16 @@ class Vt {
|
|
|
2816
2980
|
return this._realtimeClient.userId;
|
|
2817
2981
|
}
|
|
2818
2982
|
participant(e2) {
|
|
2819
|
-
return new
|
|
2983
|
+
return new Ee("string" == typeof e2 ? e2 : e2.id, this.id, this._realtimeClient);
|
|
2820
2984
|
}
|
|
2821
2985
|
message(e2) {
|
|
2822
|
-
return new
|
|
2986
|
+
return new Xt(e2, this.brandedId, this._realtimeClient);
|
|
2823
2987
|
}
|
|
2824
2988
|
get() {
|
|
2825
2989
|
return __async(this, null, function* () {
|
|
2826
2990
|
const t2 = this._realtimeClient.listMessages(this.brandedId, { limit: 1 }), s2 = yield this._realtimeClient.call("GET", ["me", "conversations", this.brandedId], {});
|
|
2827
2991
|
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return null;
|
|
2828
|
-
const n2 = e("Get conversation " + this.id, s2), r2 =
|
|
2992
|
+
const n2 = e("Get conversation " + this.id, s2), r2 = Ae("Get last message in conversation " + this.id, yield t2), i2 = 0 === r2.length ? null : r2[0];
|
|
2829
2993
|
return this._realtimeClient.createConversationSnapshotPreloaded(n2, i2);
|
|
2830
2994
|
});
|
|
2831
2995
|
}
|
|
@@ -2868,13 +3032,16 @@ class Vt {
|
|
|
2868
3032
|
}
|
|
2869
3033
|
send(t2) {
|
|
2870
3034
|
return __async(this, null, function* () {
|
|
2871
|
-
const s2 = { content:
|
|
2872
|
-
return new
|
|
3035
|
+
const s2 = { content: ss(t2), referencedMessageId: ns(t2), custom: "string" == typeof t2 ? void 0 : t2.custom, idempotencyKey: ke((/* @__PURE__ */ new Date()).getTime()) }, n2 = yield this._realtimeClient.call("POST", ["conversations", this.brandedId, "messages"], s2), r2 = e("Send message to conversation " + this.id, n2);
|
|
3036
|
+
return new Xt(r2.id, this.brandedId, this._realtimeClient);
|
|
2873
3037
|
});
|
|
2874
3038
|
}
|
|
2875
3039
|
subscribeMessages(e2) {
|
|
2876
3040
|
return this._realtimeClient.subscribe(["me", "conversations", this.brandedId, "messages"], e2);
|
|
2877
3041
|
}
|
|
3042
|
+
subscribeParticipants(e2) {
|
|
3043
|
+
return this._realtimeClient.subscribe(["me", "conversations", this.brandedId, "participants"], e2);
|
|
3044
|
+
}
|
|
2878
3045
|
subscribe(e2) {
|
|
2879
3046
|
return this._realtimeClient.subscribe(["me", "conversations", this.brandedId], e2);
|
|
2880
3047
|
}
|
|
@@ -2888,36 +3055,36 @@ class Vt {
|
|
|
2888
3055
|
});
|
|
2889
3056
|
}
|
|
2890
3057
|
}
|
|
2891
|
-
function
|
|
3058
|
+
function ss(e2) {
|
|
2892
3059
|
if ("string" == typeof e2) {
|
|
2893
|
-
return [{ type: "text", children:
|
|
3060
|
+
return [{ type: "text", children: Qt(e2) }];
|
|
2894
3061
|
}
|
|
2895
3062
|
if ("text" in e2) {
|
|
2896
|
-
return [{ type: "text", children:
|
|
3063
|
+
return [{ type: "text", children: Qt(e2.text) }];
|
|
2897
3064
|
}
|
|
2898
3065
|
return e2.content;
|
|
2899
3066
|
}
|
|
2900
|
-
function
|
|
3067
|
+
function ns(e2) {
|
|
2901
3068
|
if ("string" == typeof e2) return;
|
|
2902
3069
|
const t2 = e2.referencedMessage;
|
|
2903
3070
|
return void 0 !== t2 ? "string" == typeof t2 ? t2 : t2.id : void 0;
|
|
2904
3071
|
}
|
|
2905
|
-
class
|
|
3072
|
+
class rs {
|
|
2906
3073
|
constructor(e2, t2, s2) {
|
|
2907
3074
|
this.realtimeWsApiUrl = e2, this.internalHttpApiUrl = t2, this.restApiHttpUrl = s2;
|
|
2908
3075
|
}
|
|
2909
3076
|
getBokensUrl(e2, t2, s2) {
|
|
2910
3077
|
return this.internalHttpApiUrl + `/${e2}/bokens/${encodeURIComponent(t2)}?signature=${encodeURIComponent(s2 != null ? s2 : "")}`;
|
|
2911
3078
|
}
|
|
2912
|
-
getRealtimeWsUrl(e2, t2, s2, n2) {
|
|
2913
|
-
const
|
|
2914
|
-
return this.realtimeWsApiUrl + `/${e2}/realtime/${
|
|
3079
|
+
getRealtimeWsUrl(e2, t2, s2, n2, r2) {
|
|
3080
|
+
const i2 = encodeURIComponent(t2);
|
|
3081
|
+
return this.realtimeWsApiUrl + `/${e2}/realtime/${i2}?talkjs-client-build=${r2 != null ? r2 : "standalone"}&talkjs-core=${s2}&talkjs-client-id=${n2}`;
|
|
2915
3082
|
}
|
|
2916
3083
|
}
|
|
2917
|
-
function
|
|
3084
|
+
function is({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRetry: i2, authProvider: o2 }) {
|
|
2918
3085
|
var _a2;
|
|
2919
3086
|
(!r2 || r2 <= 0) && (r2 = 1);
|
|
2920
|
-
const u2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-
|
|
3087
|
+
const u2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-06-11T10:14:55.116Z" };
|
|
2921
3088
|
s2 instanceof FormData || (u2["Content-Type"] = (_a2 = n2 == null ? void 0 : n2.contentType) != null ? _a2 : "application/json");
|
|
2922
3089
|
return a(r2, () => __async(this, null, function* () {
|
|
2923
3090
|
if (o2) {
|
|
@@ -2929,19 +3096,19 @@ function es({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRe
|
|
|
2929
3096
|
throw e3;
|
|
2930
3097
|
});
|
|
2931
3098
|
}), { initialDelay: 0.2, log: void 0, shouldRetry: (s3) => __async(this, null, function* () {
|
|
2932
|
-
return o2 && 401 === s3.status ? (
|
|
3099
|
+
return o2 && 401 === s3.status ? (ps.log(`401 error from ${e2} ${t2}, ${yield o2.getToken()}`), o2.refreshToken(), true) : i2 ? i2(s3) : !("status" in s3 && s3.status >= 400 && s3.status < 500);
|
|
2933
3100
|
}) }).catch((s3) => {
|
|
2934
3101
|
if (Math.random() < 0.1 && !t2.toString().startsWith("https://capture.trackjs.com")) {
|
|
2935
3102
|
const n3 = `Network Error for ${e2} ${t2}`;
|
|
2936
3103
|
if ("undefined" != typeof window) if (s3 instanceof Response) {
|
|
2937
|
-
s3.clone().text().then((e3) =>
|
|
2938
|
-
} else
|
|
3104
|
+
s3.clone().text().then((e3) => ps.log(`${n3} ${s3.status} ${e3} (10% logged)`));
|
|
3105
|
+
} else ps.log(`${n3} ${s3} (10% logged)`);
|
|
2939
3106
|
console.error("[TalkJS]", n3);
|
|
2940
3107
|
}
|
|
2941
3108
|
throw s3;
|
|
2942
3109
|
});
|
|
2943
3110
|
}
|
|
2944
|
-
const { cdnHost:
|
|
3111
|
+
const { cdnHost: as, appHost: os, restHost: us, realtimeHost: cs, appProtocol: ls, appWsProtocol: hs } = function() {
|
|
2945
3112
|
if ("undefined" == typeof window) return { cdnHost: "test-hostname", appHost: "test-hostname", appProtocol: "http:", appWsProtocol: "ws:" };
|
|
2946
3113
|
const e2 = function() {
|
|
2947
3114
|
if (document.currentScript) return document.currentScript.src;
|
|
@@ -2966,11 +3133,11 @@ const { cdnHost: ts, appHost: ss, restHost: ns, realtimeHost: rs, appProtocol: i
|
|
|
2966
3133
|
}(n2), a2 = t2.protocol;
|
|
2967
3134
|
return { cdnHost: s2, appHost: n2, restHost: r2, realtimeHost: i2, appProtocol: a2, appWsProtocol: "https:" === a2 ? "wss:" : "ws:" };
|
|
2968
3135
|
}();
|
|
2969
|
-
const
|
|
2970
|
-
const
|
|
3136
|
+
const ds = os.startsWith("app.talkjs.com");
|
|
3137
|
+
const ps = "undefined" == typeof window ? { log: (e2) => Promise.resolve(), setData: (e2) => {
|
|
2971
3138
|
} } : new class {
|
|
2972
3139
|
constructor(e2) {
|
|
2973
|
-
this._timeCreated = Date.now(), this._enabled =
|
|
3140
|
+
this._timeCreated = Date.now(), this._enabled = ds, this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2025-06-11T10:14:55.116Z" }, 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-11T10:14:55.116Z", throttled: 0 }, this._url = `https://capture.trackjs.com/capture?token=${e2}`, this._trackJSData.customer.token = e2;
|
|
2974
3141
|
}
|
|
2975
3142
|
setData({ appId: e2, meId: t2, sessionId: s2 }) {
|
|
2976
3143
|
this._trackJSData.customer.userId = e2, this._trackJSData.customer.sessionId = `${e2}/${t2}`, this._trackJSData.customer.correlationId = s2;
|
|
@@ -2980,14 +3147,14 @@ const us = "undefined" == typeof window ? { log: (e2) => Promise.resolve(), setD
|
|
|
2980
3147
|
try {
|
|
2981
3148
|
if (!this._enabled) return Promise.resolve();
|
|
2982
3149
|
const t2 = __spreadProps(__spreadValues({}, this._trackJSData), { message: e2 });
|
|
2983
|
-
yield
|
|
3150
|
+
yield is({ method: "POST", url: this._url, data: JSON.stringify(t2), options: { contentType: "text/plain" } });
|
|
2984
3151
|
} catch (e3) {
|
|
2985
3152
|
console.error("[TalkJS] Failed when sending an error report. Error: ", e3);
|
|
2986
3153
|
}
|
|
2987
3154
|
});
|
|
2988
3155
|
}
|
|
2989
3156
|
}("970cd0be0fb74630b75c8451051299dc");
|
|
2990
|
-
class
|
|
3157
|
+
class fs {
|
|
2991
3158
|
constructor(e2, t2 = {}) {
|
|
2992
3159
|
this._onSubscription = t2, this._handlers = {};
|
|
2993
3160
|
for (const t3 in e2) Object.hasOwnProperty.call(e2, t3) && (this._handlers[t3] = []);
|
|
@@ -3032,9 +3199,9 @@ class cs {
|
|
|
3032
3199
|
return this.on(e2, t2), { unsubscribe: () => this.off(e2, t2) };
|
|
3033
3200
|
}
|
|
3034
3201
|
}
|
|
3035
|
-
class
|
|
3202
|
+
class ms {
|
|
3036
3203
|
constructor(e2, t2, s2, n2, r2, i2) {
|
|
3037
|
-
if (this.appId = t2, this.userId = s2, this.tokenFetcher = r2, this.usingBokens = false, this.requestInProgress = false, this.eventEmitter = new
|
|
3204
|
+
if (this.appId = t2, this.userId = s2, this.tokenFetcher = r2, this.usingBokens = false, this.requestInProgress = false, this.eventEmitter = new fs({ tokenChanged(e3) {
|
|
3038
3205
|
}, tokenRefreshFailed(e3) {
|
|
3039
3206
|
}, tokenAccepted(e3) {
|
|
3040
3207
|
} }), 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.");
|
|
@@ -3126,7 +3293,7 @@ class ls {
|
|
|
3126
3293
|
const e3 = function(e4) {
|
|
3127
3294
|
const t3 = e4.split(".");
|
|
3128
3295
|
if (3 !== t3.length) throw "Token does not contain exactly two `.`. Check that you generated your JWT correctly. It should be `<header>.<payload>.<signature>`.";
|
|
3129
|
-
return { header:
|
|
3296
|
+
return { header: gs(t3[0]), payload: gs(t3[1]) };
|
|
3130
3297
|
}(s2);
|
|
3131
3298
|
n2 = e3.header, r2 = e3.payload;
|
|
3132
3299
|
} catch (e3) {
|
|
@@ -3140,7 +3307,7 @@ class ls {
|
|
|
3140
3307
|
const e3 = this.checkJwtPayload(r2);
|
|
3141
3308
|
t2.push(...e3);
|
|
3142
3309
|
}
|
|
3143
|
-
if (t2.length) if (this.usingBokens)
|
|
3310
|
+
if (t2.length) if (this.usingBokens) ps.log(`JWT Errors detected by AuthProvider when using bokens: ${t2.join("\n")}`);
|
|
3144
3311
|
else {
|
|
3145
3312
|
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.");
|
|
3146
3313
|
const s3 = t2.length > 1;
|
|
@@ -3169,7 +3336,7 @@ class ls {
|
|
|
3169
3336
|
sendBokenRequest(e2, t2) {
|
|
3170
3337
|
return __async(this, null, function* () {
|
|
3171
3338
|
let s2 = 0;
|
|
3172
|
-
const n2 = e2.getBokensUrl(this.appId, this.userId, t2), r2 = yield
|
|
3339
|
+
const n2 = e2.getBokensUrl(this.appId, this.userId, t2), r2 = yield is({ method: "GET", url: n2, attempts: 1e4, shouldRetry: (e3) => {
|
|
3173
3340
|
if (e3 instanceof Error) return true;
|
|
3174
3341
|
if (401 === e3.status) throw "Check that you provided a valid signature.";
|
|
3175
3342
|
if (404 === e3.status) throw "Check that you specified the correct App ID.";
|
|
@@ -3182,7 +3349,7 @@ class ls {
|
|
|
3182
3349
|
});
|
|
3183
3350
|
}
|
|
3184
3351
|
}
|
|
3185
|
-
function
|
|
3352
|
+
function gs(e2) {
|
|
3186
3353
|
try {
|
|
3187
3354
|
const t2 = e2.replace(/-/g, "+").replace(/_/g, "/"), s2 = decodeURIComponent(atob(t2).split("").map((e3) => "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2)).join(""));
|
|
3188
3355
|
return JSON.parse(s2);
|
|
@@ -3190,8 +3357,8 @@ function hs(e2) {
|
|
|
3190
3357
|
throw `Could not base64-decode and JSON-parse token section: ${e2}. Check that you base-64 encoded the section correctly.`;
|
|
3191
3358
|
}
|
|
3192
3359
|
}
|
|
3193
|
-
const
|
|
3194
|
-
class
|
|
3360
|
+
const vs = new rs("wss://realtime.talkjs.com/v1", "https://app.talkjs.com/api/v0", "https://api.talkjs.com/v1");
|
|
3361
|
+
class bs {
|
|
3195
3362
|
constructor(e2) {
|
|
3196
3363
|
this.target = e2;
|
|
3197
3364
|
}
|
|
@@ -3199,7 +3366,7 @@ class ps {
|
|
|
3199
3366
|
return this.target;
|
|
3200
3367
|
}
|
|
3201
3368
|
}
|
|
3202
|
-
const
|
|
3369
|
+
const ws = new class {
|
|
3203
3370
|
constructor() {
|
|
3204
3371
|
this.registry = {};
|
|
3205
3372
|
}
|
|
@@ -3207,7 +3374,7 @@ const fs = new class {
|
|
|
3207
3374
|
var _a2;
|
|
3208
3375
|
const t2 = this.key(e2), s2 = (_a2 = this.registry[t2]) == null ? void 0 : _a2.deref();
|
|
3209
3376
|
if (s2) return s2;
|
|
3210
|
-
const n2 = new
|
|
3377
|
+
const n2 = new As(e2), r2 = globalThis.WeakRef ? new WeakRef(n2) : new bs(n2);
|
|
3211
3378
|
return this.registry[t2] = r2, n2;
|
|
3212
3379
|
}
|
|
3213
3380
|
deregister(e2, t2) {
|
|
@@ -3218,10 +3385,10 @@ const fs = new class {
|
|
|
3218
3385
|
return `${e2}:${t2}`;
|
|
3219
3386
|
}
|
|
3220
3387
|
}();
|
|
3221
|
-
function
|
|
3222
|
-
return e2.forceCreateNew ? new
|
|
3388
|
+
function ys(e2) {
|
|
3389
|
+
return e2.forceCreateNew ? new As(e2) : ws.getOrCreate(e2);
|
|
3223
3390
|
}
|
|
3224
|
-
class
|
|
3391
|
+
class As {
|
|
3225
3392
|
constructor(e2) {
|
|
3226
3393
|
!function(e3) {
|
|
3227
3394
|
function t3(e4, t4) {
|
|
@@ -3231,11 +3398,13 @@ class ms {
|
|
|
3231
3398
|
void 0 !== e3.tokenFetcher && t3("function" == typeof e3.tokenFetcher, "The `tokenFetcher` property of TalkSession#constructor must be a function.");
|
|
3232
3399
|
}(e2);
|
|
3233
3400
|
const { appId: t2, userId: s2, token: n2, tokenFetcher: r2, signature: i2 } = e2;
|
|
3234
|
-
this._appId = t2, this._apiUrls = e2.apiUrls ? new
|
|
3401
|
+
this._appId = t2, this._apiUrls = e2.apiUrls ? new rs(e2.apiUrls.realtimeWsApiUrl, e2.apiUrls.internalHttpApiUrl, e2.apiUrls.restApiHttpUrl) : vs, this._authProvider = new ms(this._apiUrls, t2, s2, n2, r2, i2);
|
|
3402
|
+
const a2 = Math.random().toString().split(".")[1];
|
|
3403
|
+
this._realtimeClient = new we(this._apiUrls.getRealtimeWsUrl(t2, s2, "1.1.1", a2, e2.clientBuild), s2, this._authProvider), this.currentUser = new Ce(this._realtimeClient.userId, this._realtimeClient), this._terminationReason = o(), this._terminationReason.promise.then((e3) => {
|
|
3235
3404
|
console.error(`[TalkSession] ${e3}`);
|
|
3236
3405
|
}), function(e3, t3, s3) {
|
|
3237
3406
|
return __async(this, null, function* () {
|
|
3238
|
-
return
|
|
3407
|
+
return is({ 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) => {
|
|
3239
3408
|
if ("string" != typeof e4 && "status" in e4) {
|
|
3240
3409
|
const t4 = e4;
|
|
3241
3410
|
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);
|
|
@@ -3256,37 +3425,37 @@ class ms {
|
|
|
3256
3425
|
}), { unsubscribe: () => t2.resolve("UNSUBSCRIBED") };
|
|
3257
3426
|
}
|
|
3258
3427
|
user(e2) {
|
|
3259
|
-
return new
|
|
3428
|
+
return new Ce(e2, this._realtimeClient);
|
|
3260
3429
|
}
|
|
3261
3430
|
conversation(e2) {
|
|
3262
|
-
return new
|
|
3431
|
+
return new ts(e2, this._realtimeClient);
|
|
3263
3432
|
}
|
|
3264
3433
|
terminate(e2) {
|
|
3265
|
-
|
|
3434
|
+
ws.deregister(this._appId, this.currentUser.id), this._terminationReason.resolve(e2), this._realtimeClient.destroy();
|
|
3266
3435
|
}
|
|
3267
3436
|
_isConnected() {
|
|
3268
3437
|
return this._realtimeClient.isConnected();
|
|
3269
3438
|
}
|
|
3270
3439
|
uploadFile(e2, t2) {
|
|
3271
|
-
return
|
|
3440
|
+
return Cs(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, t2);
|
|
3272
3441
|
}
|
|
3273
3442
|
uploadImage(e2, t2) {
|
|
3274
|
-
return
|
|
3443
|
+
return Cs(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "image" }, t2));
|
|
3275
3444
|
}
|
|
3276
3445
|
uploadVideo(e2, t2) {
|
|
3277
|
-
return
|
|
3446
|
+
return Cs(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "video" }, t2));
|
|
3278
3447
|
}
|
|
3279
3448
|
uploadAudio(e2, t2) {
|
|
3280
|
-
return
|
|
3449
|
+
return Cs(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "audio" }, t2));
|
|
3281
3450
|
}
|
|
3282
3451
|
uploadVoice(e2, t2) {
|
|
3283
|
-
return
|
|
3452
|
+
return Cs(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "voice" }, t2));
|
|
3284
3453
|
}
|
|
3285
3454
|
}
|
|
3286
|
-
function
|
|
3455
|
+
function Cs(_0, _1, _2, _3) {
|
|
3287
3456
|
return __async(this, arguments, function* (e2, t2, s2, { subtype: n2, filename: r2, width: i2, height: a2, duration: o2 }) {
|
|
3288
3457
|
const u2 = new FormData();
|
|
3289
|
-
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()),
|
|
3458
|
+
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()), is({ method: "POST", url: e2, data: u2, authProvider: t2 }).then((e3) => e3.json()).then((e3) => e3.attachmentToken).catch((e3) => __async(this, null, function* () {
|
|
3290
3459
|
if (e3 instanceof Response) {
|
|
3291
3460
|
const t3 = yield e3.json(), s3 = `Unexpected response when uploading file, status code ${e3.status} ${t3.errorCode}, ${t3.reasons}`;
|
|
3292
3461
|
throw new Error(s3);
|
|
@@ -3296,7 +3465,7 @@ function vs(_0, _1, _2, _3) {
|
|
|
3296
3465
|
});
|
|
3297
3466
|
}
|
|
3298
3467
|
export {
|
|
3299
|
-
|
|
3468
|
+
ys as getTalkSession,
|
|
3300
3469
|
f as registerPolyfills
|
|
3301
3470
|
};
|
|
3302
3471
|
//# sourceMappingURL=talkSession.js.map
|