@talkjs/core 1.6.3 → 1.8.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 +12 -0
- package/dist/talkSession.cjs +1 -1
- package/dist/talkSession.d.ts +293 -0
- package/dist/talkSession.js +1649 -1188
- package/package.json +3 -2
package/dist/talkSession.js
CHANGED
|
@@ -69,17 +69,17 @@ function s(e2, t2) {
|
|
|
69
69
|
return e2 * (1 - t2 + 2 * Math.random() * t2);
|
|
70
70
|
}
|
|
71
71
|
const n = () => true;
|
|
72
|
-
function
|
|
73
|
-
return __async(this, arguments, function* (e2,
|
|
74
|
-
return
|
|
72
|
+
function a(_0, _1, _2) {
|
|
73
|
+
return __async(this, arguments, function* (e2, r2, { initialDelay: i2, maxDelay: o2, log: c2, shouldRetry: l2 = n }) {
|
|
74
|
+
return r2().catch((n2) => __async(null, null, function* () {
|
|
75
75
|
if (0 === e2) throw n2;
|
|
76
|
-
if (!(yield
|
|
77
|
-
const
|
|
78
|
-
return t(
|
|
76
|
+
if (!(yield l2(n2))) throw n2;
|
|
77
|
+
const h2 = 1e3 * i2 * 1.2, u2 = s(o2 ? Math.min(1e3 * o2, h2) : h2, 0.05);
|
|
78
|
+
return t(u2).then(() => a(e2 - 1, r2, { initialDelay: u2 / 1e3, maxDelay: o2, log: c2, shouldRetry: l2 }));
|
|
79
79
|
}));
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function r() {
|
|
83
83
|
const e2 = {}, t2 = new Promise(function(t3, s2) {
|
|
84
84
|
e2.resolve = t3, e2.reject = s2;
|
|
85
85
|
});
|
|
@@ -107,42 +107,45 @@ class i {
|
|
|
107
107
|
function o(e2) {
|
|
108
108
|
return { ok: true, value: e2 };
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function c(e2) {
|
|
111
111
|
return { ok: false, where: "client", value: e2 };
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function l(e2) {
|
|
114
114
|
return { ok: false, where: "server", value: e2 };
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function h() {
|
|
117
117
|
const e2 = {}, t2 = new Promise((t3) => {
|
|
118
|
-
e2.ok = (e3) => __async(
|
|
118
|
+
e2.ok = (e3) => __async(null, null, function* () {
|
|
119
119
|
return t3(o(e3));
|
|
120
|
-
}), e2.clientErr = (e3) => t3(
|
|
120
|
+
}), e2.clientErr = (e3) => t3(c(e3)), e2.serverErr = (e3) => t3(l(e3)), e2.resolve = (e3) => t3(e3);
|
|
121
121
|
});
|
|
122
122
|
return e2.promise = t2, e2;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function u(e2) {
|
|
125
|
+
return e2.filter((e3) => e3.ok).map((e3) => e3.value);
|
|
126
|
+
}
|
|
127
|
+
function d(e2, t2) {
|
|
125
128
|
if (t2.ok) return t2.value.data;
|
|
126
129
|
if ("SESSION_DESTROYED" === t2.value) throw new Error(`${e2} failed because the session was destroyed`);
|
|
127
|
-
if ("server" === t2.where) throw new Error(
|
|
130
|
+
if ("server" === t2.where) throw new Error(p(e2, t2.value));
|
|
128
131
|
throw "unreachable";
|
|
129
132
|
}
|
|
130
|
-
function
|
|
133
|
+
function p(e2, t2) {
|
|
131
134
|
let s2;
|
|
132
135
|
return s2 = Array.isArray(t2.reasons) ? t2.reasons.join() : JSON.stringify(t2.reasons), `${e2} failed, got status ${t2.status} ${t2.errorCode}, reasons: ${s2}`;
|
|
133
136
|
}
|
|
134
|
-
let
|
|
137
|
+
let m = null;
|
|
135
138
|
function f({ WebSocket: e2 }) {
|
|
136
|
-
|
|
139
|
+
m = e2;
|
|
137
140
|
}
|
|
138
|
-
class
|
|
141
|
+
class g {
|
|
139
142
|
constructor(e2, t2) {
|
|
140
143
|
this.realtimeUrl = e2, this.handlers = t2, this.socket = null, this.stateMachine = new i("ReconnectingSocket", ["STOPPED", "CONNECTING", "READY", "DISCONNECTED", "TERMINATED"], { startWs: { from: ["STOPPED", "DISCONNECTED"], to: "CONNECTING", afterTransition: () => {
|
|
141
|
-
const e3 = new (function() {
|
|
142
|
-
if (
|
|
144
|
+
const e3 = new ((function() {
|
|
145
|
+
if (m) return m;
|
|
143
146
|
if (globalThis.WebSocket) return globalThis.WebSocket;
|
|
144
147
|
throw new Error("Missing WebSocket implementation");
|
|
145
|
-
}())(this.realtimeUrl + "&talkjs-time=" + Date.now());
|
|
148
|
+
})())(this.realtimeUrl + "&talkjs-time=" + Date.now());
|
|
146
149
|
this.socket = e3, e3.addEventListener("open", () => {
|
|
147
150
|
this.socket === e3 && this.stateMachine.transition("onOpen");
|
|
148
151
|
}), e3.addEventListener("close", () => {
|
|
@@ -174,7 +177,7 @@ class m {
|
|
|
174
177
|
this.stateMachine.transition("startWs");
|
|
175
178
|
}
|
|
176
179
|
send(e2) {
|
|
177
|
-
return "READY" === this.stateMachine.state ? (this.socket.send(e2), o(void 0)) :
|
|
180
|
+
return "READY" === this.stateMachine.state ? (this.socket.send(e2), o(void 0)) : c("SOCKET_NOT_READY");
|
|
178
181
|
}
|
|
179
182
|
terminate() {
|
|
180
183
|
const e2 = this.socket;
|
|
@@ -184,9 +187,9 @@ class m {
|
|
|
184
187
|
this.stateMachine.transition("destroy");
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
|
-
class
|
|
190
|
+
class v {
|
|
188
191
|
constructor(e2, t2) {
|
|
189
|
-
this.handlers = t2, this.socket = new
|
|
192
|
+
this.handlers = t2, this.socket = new g(e2, { onOpen: () => this.handlers.onOpen(), onClose: () => this.handlers.onClose(), onMessage: (e3) => this.onWebSocketMessage(e3) });
|
|
190
193
|
}
|
|
191
194
|
call(e2, t2) {
|
|
192
195
|
const s2 = `/${t2.path.map((e3) => encodeURIComponent(e3)).join("/")}`, n2 = JSON.stringify([e2, t2.method, s2, t2.data, t2.headers]);
|
|
@@ -210,10 +213,10 @@ class g {
|
|
|
210
213
|
if ("PUBLISH" === t2[1]) {
|
|
211
214
|
const e3 = t2[0], s2 = JSON.stringify([e3, "ACK"]);
|
|
212
215
|
this.socket.send(s2);
|
|
213
|
-
const n2 = t2.slice(2),
|
|
216
|
+
const n2 = t2.slice(2), a2 = [];
|
|
214
217
|
n2.forEach((e4) => {
|
|
215
|
-
"session.expired" === e4.type ? this.handlers.onAuthExpired() : "upstream.restarting" === e4.type ? this.handlers.onUpstreamRestarting() :
|
|
216
|
-
}),
|
|
218
|
+
"session.expired" === e4.type ? this.handlers.onAuthExpired() : "upstream.restarting" === e4.type ? this.handlers.onUpstreamRestarting() : a2.push(e4);
|
|
219
|
+
}), a2.length > 0 && this.handlers.onPublish(e3, a2);
|
|
217
220
|
} else {
|
|
218
221
|
const e3 = t2[0], s2 = t2[1], n2 = t2[2];
|
|
219
222
|
this.handlers.onResponse(e3, s2, n2);
|
|
@@ -222,7 +225,7 @@ class g {
|
|
|
222
225
|
}
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
|
-
class
|
|
228
|
+
class b {
|
|
226
229
|
constructor(e2) {
|
|
227
230
|
this.delayMs = e2, this.timeout = void 0;
|
|
228
231
|
}
|
|
@@ -235,8 +238,8 @@ class v {
|
|
|
235
238
|
void 0 !== this.timeout && (clearTimeout(this.timeout), this.timeout = void 0);
|
|
236
239
|
}
|
|
237
240
|
}
|
|
238
|
-
const
|
|
239
|
-
class
|
|
241
|
+
const y = "undefined" != typeof window ? (_a = window.queueMicrotask) != null ? _a : setTimeout : setTimeout;
|
|
242
|
+
class w {
|
|
240
243
|
constructor() {
|
|
241
244
|
this.i = -1;
|
|
242
245
|
}
|
|
@@ -247,9 +250,9 @@ class b {
|
|
|
247
250
|
this.i = -1;
|
|
248
251
|
}
|
|
249
252
|
}
|
|
250
|
-
class
|
|
253
|
+
class k {
|
|
251
254
|
constructor(e2, t2) {
|
|
252
|
-
this.handlers = t2, this.seqCounter = new
|
|
255
|
+
this.handlers = t2, this.seqCounter = new w(), this.responseHandlers = {}, this.heartbeats = new C(this), this.socket = new v(e2, { onUpstreamRestarting: () => {
|
|
253
256
|
this.heartbeats.serverActive(), this.handlers.onUpstreamRestarting();
|
|
254
257
|
}, onOpen: () => {
|
|
255
258
|
this.heartbeats.clientActive(), this.heartbeats.serverActive(), this.handlers.onReady();
|
|
@@ -267,14 +270,14 @@ class y {
|
|
|
267
270
|
}
|
|
268
271
|
sync() {
|
|
269
272
|
return __async(this, null, function* () {
|
|
270
|
-
yield new Promise((e3) =>
|
|
273
|
+
yield new Promise((e3) => y(() => e3()));
|
|
271
274
|
const e2 = Object.values(this.responseHandlers).map((e3) => e3.promise.catch(() => {
|
|
272
275
|
}));
|
|
273
276
|
return Promise.all(e2);
|
|
274
277
|
});
|
|
275
278
|
}
|
|
276
279
|
call(e2) {
|
|
277
|
-
const t2 = this.seqCounter.next(), s2 =
|
|
280
|
+
const t2 = this.seqCounter.next(), s2 = h();
|
|
278
281
|
this.responseHandlers[t2] = s2;
|
|
279
282
|
const n2 = this.socket.call(t2, e2);
|
|
280
283
|
return n2.ok || (s2.resolve(n2), delete this.responseHandlers[t2]), this.heartbeats.clientActive(), s2.promise;
|
|
@@ -302,7 +305,7 @@ class y {
|
|
|
302
305
|
}
|
|
303
306
|
class C {
|
|
304
307
|
constructor(e2) {
|
|
305
|
-
this.connection = e2, this.clientInactivityTimer = new
|
|
308
|
+
this.connection = e2, this.clientInactivityTimer = new b(25e3), this.serverInactivityTimer = new b(1e4), this.serverTimeoutTimer = new b(5e3);
|
|
306
309
|
}
|
|
307
310
|
clientActive() {
|
|
308
311
|
this.clientInactivityTimer.schedule(() => {
|
|
@@ -324,7 +327,7 @@ class C {
|
|
|
324
327
|
});
|
|
325
328
|
}
|
|
326
329
|
}
|
|
327
|
-
class
|
|
330
|
+
class T {
|
|
328
331
|
constructor(e2, t2, s2) {
|
|
329
332
|
this.authProvider = t2, this.handlers = s2, this.stateMachine = new i("AuthenticatedConnection", ["WAITING_FOR_WS", "LOGGING_IN", "RENEWING_SESSION", "READY", "TERMINATED"], { logIn: { from: ["WAITING_FOR_WS"], to: "LOGGING_IN", afterTransition: () => __async(this, null, function* () {
|
|
330
333
|
yield this.renewSession();
|
|
@@ -342,7 +345,7 @@ class A {
|
|
|
342
345
|
"READY" !== e3 && "RENEWING_SESSION" !== e3 || this.handlers.onNotReady(), this.authProvider.clearScheduledRefresh();
|
|
343
346
|
} }, destroy: { from: "ANY", to: "TERMINATED", afterTransition: () => {
|
|
344
347
|
this.authProvider.clearScheduledRefresh(), this.connection.destroy();
|
|
345
|
-
} } }), this.connection = new
|
|
348
|
+
} } }), this.connection = new k(e2, { onUpstreamRestarting: () => this.handlers.onUpstreamRestarting(), onReady: () => this.stateMachine.transition("logIn"), onNotReady: () => {
|
|
346
349
|
this.stateMachine.transition("wsDisconnected");
|
|
347
350
|
}, onAuthExpired: () => {
|
|
348
351
|
this.stateMachine.transition("authExpired");
|
|
@@ -386,8 +389,8 @@ class A {
|
|
|
386
389
|
return void (null !== t3 && t3 < 120 ? (console.warn(`[TalkJS] Authenticated with a token that expires in ${t3}s. Treating it as already expired and refreshing. Newly generated tokens should last at least 10 minutes.`), "LOGGING_IN" === this.stateMachine.state ? this.stateMachine.transition("logInFailed") : "RENEWING_SESSION" === this.stateMachine.state && this.stateMachine.transition("scheduledReauthFailed")) : (this.authProvider.scheduleRefresh(t3), this.authProvider.emitTokenAccepted(e2), this.stateMachine.canTransition("authenticated") && this.stateMachine.transition("authenticated")));
|
|
387
390
|
}
|
|
388
391
|
if (401 === s2.status) return void ("LOGGING_IN" === this.stateMachine.state ? this.stateMachine.transition("logInFailed") : "RENEWING_SESSION" === this.stateMachine.state && this.stateMachine.transition("scheduledReauthFailed"));
|
|
389
|
-
if (400 === s2.status) return void this.authProvider.emitTokenRefreshFailed(
|
|
390
|
-
if (402 === s2.status) return void this.authProvider.emitTokenRefreshFailed(
|
|
392
|
+
if (400 === s2.status) return void this.authProvider.emitTokenRefreshFailed(p("Authentication", s2));
|
|
393
|
+
if (402 === s2.status) return void this.authProvider.emitTokenRefreshFailed(p("Authentication", s2));
|
|
391
394
|
const n2 = 5e3 * Math.random() + 5e3;
|
|
392
395
|
setTimeout(() => {
|
|
393
396
|
this.call({ method: "POST", path: ["session", "renew"], data: { token: e2 }, headers: {} }).catch(() => {
|
|
@@ -396,7 +399,7 @@ class A {
|
|
|
396
399
|
});
|
|
397
400
|
}
|
|
398
401
|
}
|
|
399
|
-
class
|
|
402
|
+
class I {
|
|
400
403
|
constructor(e2, t2, s2) {
|
|
401
404
|
this.handlers = s2, this.stateMachine = new i("StopStartConnection", ["STOPPED", "WAITING_FOR_WS", "READY", "TERMINATED"], { unexpectedDisconnect: { from: ["READY"], to: "WAITING_FOR_WS", afterTransition: () => {
|
|
402
405
|
this.inactivityTimer.stop(), this.handlers.onNotReady();
|
|
@@ -410,7 +413,7 @@ class E {
|
|
|
410
413
|
}), this.handlers.onReady();
|
|
411
414
|
} }, destroy: { from: "ANY", to: "TERMINATED", afterTransition: () => {
|
|
412
415
|
this.inactivityTimer.stop(), this.connection.destroy();
|
|
413
|
-
} } }), this.pendingCalls = 0, this.activeSubscriptions = 0, this.inactivityTimer = new
|
|
416
|
+
} } }), this.pendingCalls = 0, this.activeSubscriptions = 0, this.inactivityTimer = new b(3e3), this.connection = new T(e2, t2, { onUpstreamRestarting: () => {
|
|
414
417
|
this.handlers.onUpstreamRestarting();
|
|
415
418
|
}, onReady: () => {
|
|
416
419
|
this.stateMachine.transition("ready");
|
|
@@ -449,7 +452,7 @@ class E {
|
|
|
449
452
|
logTrace(e2, t2, s2) {
|
|
450
453
|
}
|
|
451
454
|
}
|
|
452
|
-
class
|
|
455
|
+
class S {
|
|
453
456
|
constructor(e2, t2, s2) {
|
|
454
457
|
this.handlers = s2, this.stateMachine = new i("QueuedConnection", ["NOT_READY", "PROCESSING_QUEUE", "READY", "TERMINATED"], { processQueue: { from: ["NOT_READY"], to: "PROCESSING_QUEUE", afterTransition: () => {
|
|
455
458
|
this.sendQueuedCalls();
|
|
@@ -464,7 +467,7 @@ class k {
|
|
|
464
467
|
e3 == null ? void 0 : e3.clientErr("SESSION_DESTROYED");
|
|
465
468
|
}
|
|
466
469
|
this.connection.destroy();
|
|
467
|
-
} } }), this.subscribeQueue = {}, this.callQueue = [], this.connection = new
|
|
470
|
+
} } }), this.subscribeQueue = {}, this.callQueue = [], this.connection = new I(e2, t2, { onUpstreamRestarting: () => {
|
|
468
471
|
this.handlers.onUpstreamRestarting();
|
|
469
472
|
}, onReady: () => {
|
|
470
473
|
this.stateMachine.transition("processQueue");
|
|
@@ -486,11 +489,11 @@ class k {
|
|
|
486
489
|
const t2 = e2.path.join("/"), s2 = this.subscribeQueue[t2];
|
|
487
490
|
if (s2 && s2.params.method === e2.method) return s2.deferred.promise;
|
|
488
491
|
s2 && s2.params.method !== e2.method && (s2.deferred.ok({ status: 200, data: {} }), delete this.subscribeQueue[t2]);
|
|
489
|
-
const n2 = { deferred:
|
|
492
|
+
const n2 = { deferred: h(), params: e2 };
|
|
490
493
|
return this.subscribeQueue[t2] = n2, n2.deferred.promise;
|
|
491
494
|
}
|
|
492
495
|
_call(e2) {
|
|
493
|
-
const t2 = { deferred:
|
|
496
|
+
const t2 = { deferred: h(), params: e2 };
|
|
494
497
|
return this.callQueue.push(t2), t2.deferred.promise;
|
|
495
498
|
}
|
|
496
499
|
dequeue() {
|
|
@@ -523,19 +526,19 @@ class k {
|
|
|
523
526
|
function x(e2) {
|
|
524
527
|
return Object.freeze(e2);
|
|
525
528
|
}
|
|
526
|
-
function
|
|
527
|
-
return x(e2.map((e3) => function(e4) {
|
|
529
|
+
function E(e2) {
|
|
530
|
+
return x(e2.map((e3) => (function(e4) {
|
|
528
531
|
switch (e4.type) {
|
|
529
532
|
case "text":
|
|
530
|
-
return Object.freeze({ type: "text", children:
|
|
533
|
+
return Object.freeze({ type: "text", children: M(e4.children) });
|
|
531
534
|
case "file":
|
|
532
535
|
case "location":
|
|
533
536
|
return Object.freeze(e4);
|
|
534
537
|
}
|
|
535
|
-
}(e3)));
|
|
538
|
+
})(e3)));
|
|
536
539
|
}
|
|
537
|
-
function
|
|
538
|
-
return x(e2.map((e3) => function(e4) {
|
|
540
|
+
function M(e2) {
|
|
541
|
+
return x(e2.map((e3) => (function(e4) {
|
|
539
542
|
if ("string" == typeof e4) return e4;
|
|
540
543
|
switch (e4.type) {
|
|
541
544
|
case "bold":
|
|
@@ -546,22 +549,22 @@ function I(e2) {
|
|
|
546
549
|
case "link":
|
|
547
550
|
case "actionLink":
|
|
548
551
|
case "actionButton":
|
|
549
|
-
return Object.freeze(__spreadProps(__spreadValues({}, e4), { children:
|
|
552
|
+
return Object.freeze(__spreadProps(__spreadValues({}, e4), { children: M(e4.children) }));
|
|
550
553
|
case "mention":
|
|
551
554
|
case "autoLink":
|
|
552
555
|
case "codeSpan":
|
|
553
556
|
case "customEmoji":
|
|
554
557
|
return Object.freeze(e4);
|
|
555
558
|
}
|
|
556
|
-
}(e3)));
|
|
559
|
+
})(e3)));
|
|
557
560
|
}
|
|
558
|
-
function
|
|
561
|
+
function A(e2, t2) {
|
|
559
562
|
return void 0 === t2 ? e2 : t2;
|
|
560
563
|
}
|
|
561
|
-
function
|
|
564
|
+
function N(e2, t2) {
|
|
562
565
|
return void 0 === t2 ? e2 : x(t2);
|
|
563
566
|
}
|
|
564
|
-
function
|
|
567
|
+
function R(e2, t2) {
|
|
565
568
|
if (void 0 === t2) return e2;
|
|
566
569
|
if (null === t2) return x({});
|
|
567
570
|
const s2 = __spreadValues({}, e2);
|
|
@@ -571,28 +574,28 @@ function M(e2, t2) {
|
|
|
571
574
|
}
|
|
572
575
|
return x(s2);
|
|
573
576
|
}
|
|
574
|
-
function
|
|
577
|
+
function D(e2, t2) {
|
|
575
578
|
if (e2 === t2) return true;
|
|
576
579
|
if (!e2 || !t2) return false;
|
|
577
580
|
if ("object" != typeof e2 || "object" != typeof t2) return false;
|
|
578
581
|
if (e2.constructor !== t2.constructor) return false;
|
|
579
582
|
if (Array.isArray(e2) && Array.isArray(t2)) {
|
|
580
583
|
if (e2.length !== t2.length) return false;
|
|
581
|
-
for (let s2 = 0; s2 < e2.length; s2++) if (!
|
|
584
|
+
for (let s2 = 0; s2 < e2.length; s2++) if (!D(e2[s2], t2[s2])) return false;
|
|
582
585
|
} else {
|
|
583
586
|
const s2 = Object.keys(e2);
|
|
584
587
|
if (s2.length !== Object.keys(t2).length) return false;
|
|
585
588
|
for (const n2 of s2) {
|
|
586
589
|
if (!Object.hasOwnProperty.call(t2, n2)) return false;
|
|
587
|
-
if (!
|
|
590
|
+
if (!D(e2[n2], t2[n2])) return false;
|
|
588
591
|
}
|
|
589
592
|
}
|
|
590
593
|
return true;
|
|
591
594
|
}
|
|
592
|
-
const
|
|
593
|
-
class
|
|
595
|
+
const _ = "undefined" != typeof window ? (_b = window.queueMicrotask) != null ? _b : setTimeout : setTimeout;
|
|
596
|
+
class O {
|
|
594
597
|
constructor(e2, t2, s2) {
|
|
595
|
-
this.headers = e2, this.clearPendingBatch = t2, this.sendCalls = s2, this.sent = false,
|
|
598
|
+
this.headers = e2, this.clearPendingBatch = t2, this.sendCalls = s2, this.sent = false, _(() => this.send());
|
|
596
599
|
}
|
|
597
600
|
send() {
|
|
598
601
|
this.sent || (this.sent = true, this.clearPendingBatch(), this.sendCalls());
|
|
@@ -601,21 +604,21 @@ class R {
|
|
|
601
604
|
this.sent = true;
|
|
602
605
|
}
|
|
603
606
|
}
|
|
604
|
-
class
|
|
607
|
+
class P extends O {
|
|
605
608
|
constructor(e2, t2, s2) {
|
|
606
609
|
super(t2, s2, () => {
|
|
607
610
|
this.sendSubscribe(), this.sendGet();
|
|
608
611
|
}), this.connection = e2, this.getCalls = [], this.subscribeCalls = [];
|
|
609
612
|
}
|
|
610
613
|
canPush(e2) {
|
|
611
|
-
return
|
|
614
|
+
return P.isCorrectBatchTypeFor(e2) && D(this.headers, e2.headers);
|
|
612
615
|
}
|
|
613
616
|
static isCorrectBatchTypeFor(t2) {
|
|
614
617
|
const s2 = e(t2.path, ["users", "*"]), n2 = "GET" === t2.method || "SUBSCRIBE" === t2.method;
|
|
615
618
|
return s2 && n2;
|
|
616
619
|
}
|
|
617
620
|
push(e2) {
|
|
618
|
-
const t2 = e2.path[1], s2 =
|
|
621
|
+
const t2 = e2.path[1], s2 = h();
|
|
619
622
|
return "GET" === e2.method ? this.getCalls.push({ userId: t2, deferred: s2 }) : this.subscribeCalls.push({ userId: t2, deferred: s2 }), 1e3 !== this.getCalls.length && 1e3 !== this.subscribeCalls.length || this.send(), s2.promise;
|
|
620
623
|
}
|
|
621
624
|
sendGet() {
|
|
@@ -635,12 +638,12 @@ class N extends R {
|
|
|
635
638
|
this.connection.call({ method: "SUBSCRIBE", path: ["users"], data: { ids: e2 }, headers: this.headers }).then((e3) => this.subscribeCalls.forEach((t2) => t2.deferred.resolve(e3)));
|
|
636
639
|
}
|
|
637
640
|
}
|
|
638
|
-
class
|
|
641
|
+
class j extends O {
|
|
639
642
|
constructor(e2, t2, s2, n2) {
|
|
640
643
|
super(s2, n2, () => this.sendMutate()), this.conversationId = e2, this.connection = t2, this.calls = [];
|
|
641
644
|
}
|
|
642
645
|
canPush(e2) {
|
|
643
|
-
return !(!
|
|
646
|
+
return !(!j.isCorrectBatchTypeFor(e2) || e2.path[1] !== this.conversationId || !D(this.headers, e2.headers));
|
|
644
647
|
}
|
|
645
648
|
static isCorrectBatchTypeFor(t2) {
|
|
646
649
|
if (e(t2.path, ["conversations", "*", "participants", "*"])) {
|
|
@@ -649,7 +652,7 @@ class _ extends R {
|
|
|
649
652
|
return false;
|
|
650
653
|
}
|
|
651
654
|
push(e2) {
|
|
652
|
-
const t2 = e2.path[3], s2 =
|
|
655
|
+
const t2 = e2.path[3], s2 = h();
|
|
653
656
|
return this.calls.push({ action: { id: t2, method: e2.method, params: e2.data }, deferred: s2 }), 100 === this.calls.length && this.send(), s2.promise;
|
|
654
657
|
}
|
|
655
658
|
sendMutate() {
|
|
@@ -664,9 +667,9 @@ class _ extends R {
|
|
|
664
667
|
});
|
|
665
668
|
}
|
|
666
669
|
}
|
|
667
|
-
class
|
|
670
|
+
class $ {
|
|
668
671
|
constructor(e2, t2, s2) {
|
|
669
|
-
this.pendingBatch = null, this.connection = new
|
|
672
|
+
this.pendingBatch = null, this.connection = new S(e2, t2, s2);
|
|
670
673
|
}
|
|
671
674
|
sync() {
|
|
672
675
|
return __async(this, null, function* () {
|
|
@@ -691,18 +694,18 @@ class O {
|
|
|
691
694
|
}
|
|
692
695
|
createEmptyBatchFor(e2) {
|
|
693
696
|
var _a2, _b2;
|
|
694
|
-
if (
|
|
695
|
-
if (
|
|
697
|
+
if (P.isCorrectBatchTypeFor(e2)) return new P(this.connection, (_a2 = e2.headers) != null ? _a2 : {}, () => this.pendingBatch = null);
|
|
698
|
+
if (j.isCorrectBatchTypeFor(e2)) {
|
|
696
699
|
const t2 = e2.path[1];
|
|
697
|
-
return new
|
|
700
|
+
return new j(t2, this.connection, (_b2 = e2.headers) != null ? _b2 : {}, () => this.pendingBatch = null);
|
|
698
701
|
}
|
|
699
702
|
return null;
|
|
700
703
|
}
|
|
701
704
|
}
|
|
702
|
-
const
|
|
703
|
-
class
|
|
705
|
+
const U = { 200: "RESOLVE", 400: "RESOLVE", 401: "RETRY", 402: "RESOLVE", 403: "RESOLVE", 404: "RESOLVE", 405: "RESOLVE", 409: "RESOLVE", 429: "DELAY", 500: "DELAY" };
|
|
706
|
+
class W {
|
|
704
707
|
constructor(e2, t2, s2) {
|
|
705
|
-
this.throttler = new
|
|
708
|
+
this.throttler = new q(), this.alive = true, this.connection = new $(e2, t2, s2);
|
|
706
709
|
}
|
|
707
710
|
sync() {
|
|
708
711
|
return __async(this, null, function* () {
|
|
@@ -716,7 +719,7 @@ class $ {
|
|
|
716
719
|
const s2 = yield this.connection.call(e2);
|
|
717
720
|
if ((s2.ok || "client" !== s2.where || "SOCKET_NOT_READY" !== s2.value) && (s2.ok || "server" !== s2.where || 500 !== s2.value.status) || t2++, 10 === t2) return s2;
|
|
718
721
|
if (s2.ok || "client" !== s2.where) {
|
|
719
|
-
const e3 = s2.value, t3 = e3.status, n2 =
|
|
722
|
+
const e3 = s2.value, t3 = e3.status, n2 = U[t3];
|
|
720
723
|
if ("RESOLVE" === n2) return this.throttler.resetDelay(), s2;
|
|
721
724
|
if ("RETRY" === n2) continue;
|
|
722
725
|
if ("DELAY" === n2) {
|
|
@@ -725,10 +728,10 @@ class $ {
|
|
|
725
728
|
}
|
|
726
729
|
return console.warn("[TalkJS] Unexpected status code", t3), e3;
|
|
727
730
|
}
|
|
728
|
-
if ("SESSION_DESTROYED" === s2.value) return
|
|
731
|
+
if ("SESSION_DESTROYED" === s2.value) return c("SESSION_DESTROYED");
|
|
729
732
|
"WEBSOCKET_DISCONNECTED" !== s2.value && ("SOCKET_NOT_READY" !== s2.value ? s2.value : yield this.throttler.wait());
|
|
730
733
|
}
|
|
731
|
-
return
|
|
734
|
+
return c("SESSION_DESTROYED");
|
|
732
735
|
});
|
|
733
736
|
}
|
|
734
737
|
destroy() {
|
|
@@ -738,7 +741,7 @@ class $ {
|
|
|
738
741
|
return this.connection.isConnected();
|
|
739
742
|
}
|
|
740
743
|
}
|
|
741
|
-
class
|
|
744
|
+
class q {
|
|
742
745
|
constructor() {
|
|
743
746
|
this.initialDelayMs = 200, this.exponentialFactor = 1.2, this.maxDelayMs = 3e4, this.currentDelayMs = this.initialDelayMs, this.lastCall = 0;
|
|
744
747
|
}
|
|
@@ -746,28 +749,28 @@ class j {
|
|
|
746
749
|
return this.currentDelayMs;
|
|
747
750
|
}
|
|
748
751
|
wait() {
|
|
749
|
-
const e2 = (/* @__PURE__ */ new Date()).getTime(), n2 = s(this.currentDelayMs, 0.05),
|
|
750
|
-
return this.lastCall = e2 +
|
|
752
|
+
const e2 = (/* @__PURE__ */ new Date()).getTime(), n2 = s(this.currentDelayMs, 0.05), a2 = this.lastCall + n2, r2 = Math.max(0, a2 - e2);
|
|
753
|
+
return this.lastCall = e2 + r2, this.currentDelayMs = Math.min(n2 * this.exponentialFactor, this.maxDelayMs), t(r2);
|
|
751
754
|
}
|
|
752
755
|
resetDelay() {
|
|
753
756
|
this.currentDelayMs = this.initialDelayMs;
|
|
754
757
|
}
|
|
755
758
|
}
|
|
756
|
-
function
|
|
759
|
+
function B(e2) {
|
|
757
760
|
return e2.map((e3) => encodeURIComponent(e3)).join();
|
|
758
761
|
}
|
|
759
|
-
class
|
|
762
|
+
class L {
|
|
760
763
|
constructor() {
|
|
761
764
|
this.paths = {};
|
|
762
765
|
}
|
|
763
766
|
add(e2) {
|
|
764
|
-
this.paths[
|
|
767
|
+
this.paths[B(e2)] = e2;
|
|
765
768
|
}
|
|
766
769
|
delete(e2) {
|
|
767
|
-
delete this.paths[
|
|
770
|
+
delete this.paths[B(e2)];
|
|
768
771
|
}
|
|
769
772
|
has(e2) {
|
|
770
|
-
return Object.hasOwnProperty.call(this.paths,
|
|
773
|
+
return Object.hasOwnProperty.call(this.paths, B(e2));
|
|
771
774
|
}
|
|
772
775
|
clear() {
|
|
773
776
|
this.paths = {};
|
|
@@ -776,9 +779,9 @@ class W {
|
|
|
776
779
|
Object.values(this.paths).forEach((t2) => e2(t2));
|
|
777
780
|
}
|
|
778
781
|
}
|
|
779
|
-
class
|
|
782
|
+
class G {
|
|
780
783
|
constructor(e2, t2, s2) {
|
|
781
|
-
this.handlers = s2, this.targetSubscriptions = new
|
|
784
|
+
this.handlers = s2, this.targetSubscriptions = new L(), this.connection = new W(e2, t2, { onUpstreamRestarting: () => this.handlers.onUpstreamRestarting(), onSubscriptionsLost: () => {
|
|
782
785
|
this.targetSubscriptions.forEach((e3) => {
|
|
783
786
|
this.resubscribe(e3);
|
|
784
787
|
}), this.handlers.onResubscribeSent();
|
|
@@ -817,7 +820,7 @@ class q {
|
|
|
817
820
|
return this.connection.isConnected();
|
|
818
821
|
}
|
|
819
822
|
}
|
|
820
|
-
class
|
|
823
|
+
class F {
|
|
821
824
|
constructor() {
|
|
822
825
|
this.prev = Promise.resolve();
|
|
823
826
|
}
|
|
@@ -834,7 +837,7 @@ class H {
|
|
|
834
837
|
});
|
|
835
838
|
}
|
|
836
839
|
}
|
|
837
|
-
class
|
|
840
|
+
class H {
|
|
838
841
|
constructor(e2) {
|
|
839
842
|
this.initialised = false, this.getPointer = void 0, this.pendingStates = [e2], e2.resultPromise.then(() => this.initialised = true);
|
|
840
843
|
}
|
|
@@ -867,7 +870,7 @@ class L {
|
|
|
867
870
|
return this.getPointer;
|
|
868
871
|
}
|
|
869
872
|
}
|
|
870
|
-
class
|
|
873
|
+
class J extends H {
|
|
871
874
|
constructor(e2, t2) {
|
|
872
875
|
super(e2), this.onTeardown = t2, this._error = null, this._lastGoodState = Promise.resolve(void 0), this.registerNewState(e2.resultPromise);
|
|
873
876
|
}
|
|
@@ -896,17 +899,17 @@ class G extends L {
|
|
|
896
899
|
}));
|
|
897
900
|
}
|
|
898
901
|
}
|
|
899
|
-
class z extends
|
|
902
|
+
class z extends J {
|
|
900
903
|
constructor(e2, t2) {
|
|
901
904
|
const s2 = new Promise((e3) => setTimeout(e3)).then(() => this.fetchInitial(e2));
|
|
902
|
-
super({ seq: e2, resultPromise: s2 }, t2.onTeardown), this.initialSeq = e2, this.getDeepMutex = new
|
|
905
|
+
super({ seq: e2, resultPromise: s2 }, t2.onTeardown), this.initialSeq = e2, this.getDeepMutex = new F(), this.lastDeep = void 0;
|
|
903
906
|
}
|
|
904
907
|
refetchInitial(e2) {
|
|
905
908
|
return __async(this, null, function* () {
|
|
906
|
-
const t2 = this.mostRecentState.resultPromise, s2 = this.fetchInitial(e2), [n2,
|
|
907
|
-
if (void 0 === n2 || !n2.ok) return
|
|
908
|
-
if (!
|
|
909
|
-
return this.equal(n2.value,
|
|
909
|
+
const t2 = this.mostRecentState.resultPromise, s2 = this.fetchInitial(e2), [n2, a2] = yield Promise.all([t2, s2]);
|
|
910
|
+
if (void 0 === n2 || !n2.ok) return a2;
|
|
911
|
+
if (!a2.ok) return a2;
|
|
912
|
+
return this.equal(n2.value, a2.value) ? n2 : a2;
|
|
910
913
|
});
|
|
911
914
|
}
|
|
912
915
|
refetch(e2) {
|
|
@@ -936,15 +939,15 @@ class z extends G {
|
|
|
936
939
|
}
|
|
937
940
|
const s2 = this.get(e2).resultPromise, n2 = s2.then((t3) => t3.ok ? this.loadNested(e2, t3.value) : t3);
|
|
938
941
|
this.lastDeep = { seq: e2, shallow: s2, deep: n2 };
|
|
939
|
-
const
|
|
940
|
-
return
|
|
942
|
+
const a2 = yield n2;
|
|
943
|
+
return a2.ok || this.setError(a2), a2;
|
|
941
944
|
}));
|
|
942
945
|
});
|
|
943
946
|
}
|
|
944
947
|
}
|
|
945
|
-
class
|
|
948
|
+
class Y extends z {
|
|
946
949
|
constructor(e2, t2, s2) {
|
|
947
|
-
super(e2, s2), this.emitMutex = t2, this.externallyIdleTimer = new
|
|
950
|
+
super(e2, s2), this.emitMutex = t2, this.externallyIdleTimer = new Q(), this.externallyIdle = true, this.internallyIdleTimer = new Q(), this.internallyIdle = true, this.referencedByOtherStores = 0, this.listeners = [], this.lastEmitSeq = void 0, this.lastEmitResult = void 0, t2.runExclusive(() => __async(this, null, function* () {
|
|
948
951
|
yield this.emit(e2);
|
|
949
952
|
}));
|
|
950
953
|
}
|
|
@@ -970,7 +973,7 @@ class J extends z {
|
|
|
970
973
|
};
|
|
971
974
|
}
|
|
972
975
|
tryFullyUnsubscribe() {
|
|
973
|
-
this.externallyIdle && this.internallyIdle && this.setError(
|
|
976
|
+
this.externallyIdle && this.internallyIdle && this.setError(c("UNSUBSCRIBED"));
|
|
974
977
|
}
|
|
975
978
|
emit(e2) {
|
|
976
979
|
return __async(this, null, function* () {
|
|
@@ -983,7 +986,7 @@ class J extends z {
|
|
|
983
986
|
});
|
|
984
987
|
}
|
|
985
988
|
}
|
|
986
|
-
class
|
|
989
|
+
class Q {
|
|
987
990
|
constructor() {
|
|
988
991
|
this.timerId = void 0;
|
|
989
992
|
}
|
|
@@ -994,33 +997,33 @@ class Y {
|
|
|
994
997
|
clearTimeout(this.timerId);
|
|
995
998
|
}
|
|
996
999
|
}
|
|
997
|
-
var
|
|
998
|
-
!function() {
|
|
999
|
-
if (
|
|
1000
|
+
var V, K = {};
|
|
1001
|
+
!(function() {
|
|
1002
|
+
if (V) return K;
|
|
1000
1003
|
function e2(e3) {
|
|
1001
1004
|
return String.fromCharCode(parseInt(e3.slice(1), 16));
|
|
1002
1005
|
}
|
|
1003
1006
|
function t2(e3) {
|
|
1004
1007
|
return `%${`00${e3.charCodeAt(0).toString(16)}`.slice(-2)}`;
|
|
1005
1008
|
}
|
|
1006
|
-
|
|
1009
|
+
V = 1, Object.defineProperty(K, "__esModule", { value: true }), K.encode = function(t3) {
|
|
1007
1010
|
return btoa(encodeURIComponent(t3).replace(/%[0-9A-F]{2}/g, e2));
|
|
1008
|
-
},
|
|
1011
|
+
}, K.decode = function(e3) {
|
|
1009
1012
|
return decodeURIComponent(Array.from(atob(e3), t2).join(""));
|
|
1010
1013
|
};
|
|
1011
|
-
}();
|
|
1014
|
+
})();
|
|
1012
1015
|
function Z(e2, t2) {
|
|
1013
1016
|
const s2 = t2.lastIndex;
|
|
1014
1017
|
let n2;
|
|
1015
|
-
const
|
|
1016
|
-
for (; null !== (n2 = t2.exec(e2)); )
|
|
1017
|
-
return t2.lastIndex = s2,
|
|
1018
|
+
const a2 = [];
|
|
1019
|
+
for (; null !== (n2 = t2.exec(e2)); ) a2.push(n2), "" === n2[0] && (t2.lastIndex += 1);
|
|
1020
|
+
return t2.lastIndex = s2, a2;
|
|
1018
1021
|
}
|
|
1019
|
-
function
|
|
1022
|
+
function X(e2) {
|
|
1020
1023
|
const t2 = e2.replace(/%2F/g, "/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/, "$1");
|
|
1021
1024
|
return decodeURIComponent(t2);
|
|
1022
1025
|
}
|
|
1023
|
-
function
|
|
1026
|
+
function ee(e2, t2) {
|
|
1024
1027
|
if (!e2() && !t2) {
|
|
1025
1028
|
t2 = e2.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/, "`$1`") + " was not true";
|
|
1026
1029
|
}
|
|
@@ -1056,55 +1059,55 @@ function X(e2, t2) {
|
|
|
1056
1059
|
}, e2.falsy = function(e3) {
|
|
1057
1060
|
}, e2.never = function(e3) {
|
|
1058
1061
|
};
|
|
1059
|
-
})(
|
|
1060
|
-
const
|
|
1061
|
-
function se(e2) {
|
|
1062
|
-
if (!te.test(e2)) return false;
|
|
1063
|
-
return !ne(e2).test("");
|
|
1064
|
-
}
|
|
1062
|
+
})(ee || (ee = {}));
|
|
1063
|
+
const te = ee, se = /^\/.*[^\\]\/[im]*$/;
|
|
1065
1064
|
function ne(e2) {
|
|
1065
|
+
if (!se.test(e2)) return false;
|
|
1066
|
+
return !ae(e2).test("");
|
|
1067
|
+
}
|
|
1068
|
+
function ae(e2) {
|
|
1066
1069
|
const t2 = e2.match(/^\/(.*[^\\])\/(.*)$/);
|
|
1067
1070
|
if (!t2) throw new Error(`Expected ${e2} to be a (non-empty) regex`);
|
|
1068
1071
|
let s2 = t2[2] || "";
|
|
1069
1072
|
return s2 = s2.replace(/[^im]/g, "") + "g", new RegExp(t2[1], s2);
|
|
1070
1073
|
}
|
|
1071
1074
|
class re {
|
|
1072
|
-
constructor({ mode: e2, allowedHostnames: t2, allowedPhoneNrs: s2, allowedMatches: n2, forbiddenMatches:
|
|
1073
|
-
if (
|
|
1074
|
-
const e3 =
|
|
1075
|
+
constructor({ mode: e2, allowedHostnames: t2, allowedPhoneNrs: s2, allowedMatches: n2, forbiddenMatches: a2, forbiddenWords: r2, suppressLinks: i2, suppressEmailAddresses: o2, suppressPhoneNumbers: c2, replacement: l2 }) {
|
|
1076
|
+
if (te.oneOf(e2, ["all", "otherOnly", "off"]), this.mode = e2, this.suppressLinks = false !== i2, this.suppressEmailAddresses = false !== o2, this.suppressPhoneNumbers = false !== c2, this.allowedHostnames = t2 || [], this.allowedPhoneNrs = (s2 || []).filter((e3) => e3).map((e3) => e3.replace(/[^0-9]/g, "")), this.allowedMatches = (n2 || []).filter(ne).map((e3) => ae(e3)), this.forbiddenMatches = (a2 || []).filter(ne).map((e3) => ae(e3)), r2) {
|
|
1077
|
+
const e3 = r2.split("\n").map((e4) => e4.trim().toLowerCase()).filter((e4) => e4.length > 0 && !e4.startsWith("#")).map((e4) => e4.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"));
|
|
1075
1078
|
e3.length && this.forbiddenMatches.push(new RegExp(`\\b(${e3.join("|")})\\b`, "gi"));
|
|
1076
1079
|
}
|
|
1077
|
-
|
|
1080
|
+
te(() => this.allowedMatches.every((e3) => e3.flags.includes("g")), "All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"), te(() => this.forbiddenMatches.every((e3) => e3.flags.includes("g")), "All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"), l2 = l2 == null ? void 0 : l2.trim(), this.replacement = l2 && l2.length > 0 ? l2 : void 0;
|
|
1078
1081
|
}
|
|
1079
1082
|
shouldSuppress({ isContentBySender: e2 }) {
|
|
1080
1083
|
return "all" === this.mode || "otherOnly" === this.mode && !e2;
|
|
1081
1084
|
}
|
|
1082
1085
|
}
|
|
1083
|
-
function
|
|
1084
|
-
const s2 = e2.map((e3) => function(e4, t3) {
|
|
1085
|
-
if ("text" === e4.type) return function(e5, t4) {
|
|
1086
|
-
const s3 = function(e6) {
|
|
1086
|
+
function ie(e2, t2) {
|
|
1087
|
+
const s2 = e2.map((e3) => (function(e4, t3) {
|
|
1088
|
+
if ("text" === e4.type) return (function(e5, t4) {
|
|
1089
|
+
const s3 = (function(e6) {
|
|
1087
1090
|
var _a2, _b2, _c, _d, _e3, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1088
1091
|
let t5 = "";
|
|
1089
1092
|
return e6.t && (t5 = `(${e6.t("CONTACT_INFORMATION_HIDDEN")})`), { formattedLinks: (_a2 = e6.formattedLinks) != null ? _a2 : "plaintext", markup: (_b2 = e6.markup) != null ? _b2 : false, useFallbackMentions: (_c = e6.useFallbackMentions) != null ? _c : false, sameTabLinkRules: (_d = e6.sameTabLinkRules) != null ? _d : [], enableEmojiImageFallback: (_e3 = e6.enableEmojiImageFallback) != null ? _e3 : false, highlight: (_f = e6.highlight) != null ? _f : [], contactInfo: (_g = e6.contactInfo) != null ? _g : false, suppression: (_h = e6.suppression) != null ? _h : new re({ 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 : {}, enableActions: (_m = e6.enableActions) != null ? _m : true };
|
|
1090
|
-
}(t4);
|
|
1091
|
-
return
|
|
1092
|
-
}(e4.children, t3);
|
|
1093
|
-
if ("file" === e4.type && "video" === e4.subtype) return `🎥 ${
|
|
1094
|
-
if ("file" === e4.type && "image" === e4.subtype) return `📷 ${
|
|
1095
|
-
if ("file" === e4.type && "audio" === e4.subtype) return `🎧 ${
|
|
1093
|
+
})(t4);
|
|
1094
|
+
return oe(e5, s3);
|
|
1095
|
+
})(e4.children, t3);
|
|
1096
|
+
if ("file" === e4.type && "video" === e4.subtype) return `🎥 ${X(e4.url)}`;
|
|
1097
|
+
if ("file" === e4.type && "image" === e4.subtype) return `📷 ${X(e4.url)}`;
|
|
1098
|
+
if ("file" === e4.type && "audio" === e4.subtype) return `🎧 ${X(e4.url)}`;
|
|
1096
1099
|
if ("file" === e4.type && "voice" === e4.subtype) {
|
|
1097
1100
|
const t4 = e4.duration;
|
|
1098
1101
|
if (void 0 === t4) return "🎙️";
|
|
1099
1102
|
return `🎙️ (${Math.floor(t4 / 60)}:${Math.floor(t4 % 60).toString().padStart(2, "0")})`;
|
|
1100
1103
|
}
|
|
1101
|
-
if ("file" === e4.type) return e4.subtype, `📎 ${
|
|
1104
|
+
if ("file" === e4.type) return e4.subtype, `📎 ${X(e4.url)}`;
|
|
1102
1105
|
if ("location" === e4.type) return "📍";
|
|
1103
1106
|
return "";
|
|
1104
|
-
}(e3, t2));
|
|
1107
|
+
})(e3, t2));
|
|
1105
1108
|
return s2.join("\n\n");
|
|
1106
1109
|
}
|
|
1107
|
-
function
|
|
1110
|
+
function oe(e2, t2) {
|
|
1108
1111
|
return e2.flatMap((e3) => {
|
|
1109
1112
|
if ("string" == typeof e3) return e3;
|
|
1110
1113
|
switch (e3.type) {
|
|
@@ -1117,13 +1120,13 @@ function ie(e2, t2) {
|
|
|
1117
1120
|
case "actionLink":
|
|
1118
1121
|
case "actionbutton":
|
|
1119
1122
|
case "actionButton":
|
|
1120
|
-
return
|
|
1123
|
+
return oe(e3.children, t2);
|
|
1121
1124
|
case "bulletlist":
|
|
1122
1125
|
case "bulletList":
|
|
1123
|
-
return "\n" +
|
|
1126
|
+
return "\n" + oe(e3.children, t2);
|
|
1124
1127
|
case "bulletpoint":
|
|
1125
1128
|
case "bulletPoint":
|
|
1126
|
-
return "- " +
|
|
1129
|
+
return "- " + oe(e3.children, t2) + "\n";
|
|
1127
1130
|
case "autolink":
|
|
1128
1131
|
case "autoLink":
|
|
1129
1132
|
case "codeblock":
|
|
@@ -1141,28 +1144,28 @@ function ie(e2, t2) {
|
|
|
1141
1144
|
}
|
|
1142
1145
|
}).join("");
|
|
1143
1146
|
}
|
|
1144
|
-
function
|
|
1147
|
+
function ce(e2) {
|
|
1145
1148
|
return x({ id: e2.id, name: e2.name, custom: x(e2.custom), locale: e2.locale, photoUrl: e2.photoUrl, role: e2.role, welcomeMessage: e2.welcomeMessage });
|
|
1146
1149
|
}
|
|
1147
|
-
function
|
|
1150
|
+
function le(e2, t2) {
|
|
1148
1151
|
return x({ user: t2, access: e2.access, notify: e2.notify, joinedAt: e2.joinedAt });
|
|
1149
1152
|
}
|
|
1150
|
-
function
|
|
1153
|
+
function he(e2) {
|
|
1151
1154
|
const t2 = Object.entries(e2).map(([e3, t3]) => x({ emoji: e3, count: t3.count, currentUserReacted: t3.currentUserReacted }));
|
|
1152
1155
|
return t2.sort((e3, t3) => e3.emoji.localeCompare(t3.emoji)), x(t2);
|
|
1153
1156
|
}
|
|
1154
|
-
class
|
|
1155
|
-
constructor(e2, t2, s2, n2,
|
|
1156
|
-
super(e2, n2,
|
|
1157
|
+
class ue extends Y {
|
|
1158
|
+
constructor(e2, t2, s2, n2, a2) {
|
|
1159
|
+
super(e2, n2, a2), this.userId = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 3e4;
|
|
1157
1160
|
}
|
|
1158
1161
|
fetchInitial(e2) {
|
|
1159
1162
|
return __async(this, null, function* () {
|
|
1160
1163
|
const t2 = yield this.realtimeClient.call({ method: "GET", path: ["users", this.userId], data: { includePrivateFields: false }, flags: { bypassCache: true } });
|
|
1161
|
-
return t2.ok ? o({ snapshot:
|
|
1164
|
+
return t2.ok ? o({ snapshot: ce(t2.value.data), lastChanged: e2 }) : "server" === t2.where && 404 === t2.value.status ? o({ snapshot: null, lastChanged: e2 }) : t2;
|
|
1162
1165
|
});
|
|
1163
1166
|
}
|
|
1164
1167
|
equal(e2, t2) {
|
|
1165
|
-
return
|
|
1168
|
+
return D(e2.snapshot, t2.snapshot);
|
|
1166
1169
|
}
|
|
1167
1170
|
loadNested(e2, t2) {
|
|
1168
1171
|
return __async(this, null, function* () {
|
|
@@ -1170,19 +1173,19 @@ class le extends J {
|
|
|
1170
1173
|
});
|
|
1171
1174
|
}
|
|
1172
1175
|
userCreated(e2, t2) {
|
|
1173
|
-
this.mutate(e2, (s2) => null !== s2.value.snapshot ? s2 : o({ snapshot:
|
|
1176
|
+
this.mutate(e2, (s2) => null !== s2.value.snapshot ? s2 : o({ snapshot: ce(t2.state), lastChanged: e2 }));
|
|
1174
1177
|
}
|
|
1175
1178
|
userEdited(e2, t2) {
|
|
1176
1179
|
this.mutate(e2, (s2) => {
|
|
1177
1180
|
const n2 = s2.value.snapshot;
|
|
1178
1181
|
if (null === n2) return console.warn("[TalkJS] Received a 'used edited' event for a user that we thought didn't exist."), s2;
|
|
1179
|
-
return o({ snapshot: { id: n2.id, name:
|
|
1182
|
+
return o({ snapshot: { id: n2.id, name: A(n2.name, t2.diff.name), custom: R(n2.custom, t2.diff.custom), locale: A(n2.locale, t2.diff.locale), photoUrl: A(n2.photoUrl, t2.diff.photoUrl), role: A(n2.role, t2.diff.role), welcomeMessage: A(n2.welcomeMessage, t2.diff.welcomeMessage) }, lastChanged: e2 });
|
|
1180
1183
|
});
|
|
1181
1184
|
}
|
|
1182
1185
|
getFromCache() {
|
|
1183
1186
|
return __async(this, null, function* () {
|
|
1184
1187
|
const e2 = yield this.mostRecentState.resultPromise;
|
|
1185
|
-
return e2.ok ? null === e2.value.snapshot ?
|
|
1188
|
+
return e2.ok ? null === e2.value.snapshot ? l({ status: 404, errorCode: "USER_NOT_FOUND", reasons: ["That user does not exist yet"] }) : o({ 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 } }) : c("NOT_IN_CACHE");
|
|
1186
1189
|
});
|
|
1187
1190
|
}
|
|
1188
1191
|
teardownNested(e2) {
|
|
@@ -1193,7 +1196,7 @@ class le extends J {
|
|
|
1193
1196
|
});
|
|
1194
1197
|
}
|
|
1195
1198
|
}
|
|
1196
|
-
class
|
|
1199
|
+
class de extends z {
|
|
1197
1200
|
constructor(e2, t2, s2, n2) {
|
|
1198
1201
|
super(e2, {}), this.conversationId = t2, this.message = s2, this.realtimeClient = n2;
|
|
1199
1202
|
}
|
|
@@ -1209,14 +1212,14 @@ class he extends z {
|
|
|
1209
1212
|
if (!e3.ok) return e3;
|
|
1210
1213
|
t2 = e3.value.data;
|
|
1211
1214
|
}
|
|
1212
|
-
return o({ lastChanged: e2, sender: null === t2.senderId ? null : this.realtimeClient.internalSubscribe(["users", t2.senderId]), data: { id: t2.id, type: t2.type, custom: x(t2.custom), createdAt: t2.createdAt, editedAt: t2.editedAt, referencedMessageId: t2.referencedMessageId, origin: t2.origin, plaintext:
|
|
1215
|
+
return o({ lastChanged: e2, sender: null === t2.senderId ? null : this.realtimeClient.internalSubscribe(["users", t2.senderId]), data: { id: t2.id, type: t2.type, custom: x(t2.custom), createdAt: t2.createdAt, editedAt: t2.editedAt, referencedMessageId: t2.referencedMessageId, origin: t2.origin, plaintext: ie(t2.content, {}), content: E(t2.content), reactions: he(t2.reactions) } });
|
|
1213
1216
|
});
|
|
1214
1217
|
}
|
|
1215
1218
|
refetch(e2) {
|
|
1216
1219
|
throw "Do not call refetch on message data stores, it can return outdated data. Destroy and remake them instead";
|
|
1217
1220
|
}
|
|
1218
1221
|
equal(e2, t2) {
|
|
1219
|
-
return
|
|
1222
|
+
return D(e2.data, t2.data);
|
|
1220
1223
|
}
|
|
1221
1224
|
teardownNested(e2) {
|
|
1222
1225
|
var _a2;
|
|
@@ -1242,10 +1245,10 @@ class he extends z {
|
|
|
1242
1245
|
messageEdited(e2, t2) {
|
|
1243
1246
|
this.mutate(e2, (s2) => {
|
|
1244
1247
|
if (null === s2.value.data) return s2;
|
|
1245
|
-
const n2 = s2.value.data.content,
|
|
1246
|
-
var
|
|
1247
|
-
const
|
|
1248
|
-
return o({ 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:
|
|
1248
|
+
const n2 = s2.value.data.content, a2 = (r2 = n2, void 0 === (i2 = t2.diff.content) ? r2 : E(i2));
|
|
1249
|
+
var r2, i2;
|
|
1250
|
+
const c2 = n2 === a2 ? s2.value.data.plaintext : ie(a2, {});
|
|
1251
|
+
return o({ 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: A(s2.value.data.editedAt, t2.diff.editedAt), custom: R(s2.value.data.custom, t2.diff.custom), plaintext: c2, content: a2, reactions: pe(s2.value.data.reactions, t2.diff.reactions) } });
|
|
1249
1252
|
});
|
|
1250
1253
|
}
|
|
1251
1254
|
messageDeleted(e2, t2) {
|
|
@@ -1255,9 +1258,9 @@ class he extends z {
|
|
|
1255
1258
|
return __async(this, null, function* () {
|
|
1256
1259
|
var _b2;
|
|
1257
1260
|
const e2 = yield this.mostRecentState.resultPromise;
|
|
1258
|
-
if (!e2.ok) return
|
|
1261
|
+
if (!e2.ok) return c("NOT_IN_CACHE");
|
|
1259
1262
|
if (null === e2.value.data) {
|
|
1260
|
-
return
|
|
1263
|
+
return l({ status: 404, errorCode: "MESSAGE_NOT_FOUND", reasons: ["No message with that ID exists"] });
|
|
1261
1264
|
}
|
|
1262
1265
|
const _a2 = e2.value, { sender: t2 } = _a2, s2 = __objRest(_a2, ["sender"]), n2 = {};
|
|
1263
1266
|
return s2.data.reactions.forEach((e3) => {
|
|
@@ -1266,19 +1269,19 @@ class he extends z {
|
|
|
1266
1269
|
});
|
|
1267
1270
|
}
|
|
1268
1271
|
}
|
|
1269
|
-
function
|
|
1272
|
+
function pe(e2, t2) {
|
|
1270
1273
|
if (void 0 === t2) return e2;
|
|
1271
1274
|
const s2 = e2.map((e3) => {
|
|
1272
1275
|
const s3 = t2[e3.emoji];
|
|
1273
|
-
return void 0 === s3 ? e3 : x(null === s3 ? __spreadProps(__spreadValues({}, e3), { count: 0 }) : { emoji: e3.emoji, count:
|
|
1276
|
+
return void 0 === s3 ? e3 : x(null === s3 ? __spreadProps(__spreadValues({}, e3), { count: 0 }) : { emoji: e3.emoji, count: A(e3.count, s3.count), currentUserReacted: A(e3.currentUserReacted, s3.currentUserReacted) });
|
|
1274
1277
|
}).filter((e3) => e3.count > 0), n2 = new Set(s2.map((e3) => e3.emoji));
|
|
1275
1278
|
for (const e3 in t2) {
|
|
1276
|
-
const
|
|
1277
|
-
|
|
1279
|
+
const a2 = t2[e3];
|
|
1280
|
+
a2 && !n2.has(e3) && s2.push(x({ emoji: e3, count: a2.count, currentUserReacted: a2.currentUserReacted }));
|
|
1278
1281
|
}
|
|
1279
1282
|
return s2.sort((e3, t3) => e3.emoji.localeCompare(t3.emoji)), x(s2);
|
|
1280
1283
|
}
|
|
1281
|
-
class
|
|
1284
|
+
class me extends z {
|
|
1282
1285
|
constructor(e2, t2, s2, n2) {
|
|
1283
1286
|
super(e2, {}), this.createdAt = t2, this.dataStore = s2, this.referencedDataStore = n2;
|
|
1284
1287
|
}
|
|
@@ -1311,16 +1314,16 @@ class pe extends z {
|
|
|
1311
1314
|
if (!s2.ok) return s2;
|
|
1312
1315
|
const n2 = s2.value;
|
|
1313
1316
|
if (null === n2.snapshot) return o({ snapshot: null });
|
|
1314
|
-
const
|
|
1315
|
-
if (
|
|
1316
|
-
const
|
|
1317
|
+
const a2 = yield (_a2 = t2.referencedDataStore) == null ? void 0 : _a2.getDeep(e2);
|
|
1318
|
+
if (a2 && !a2.ok) return a2;
|
|
1319
|
+
const r2 = (_b2 = a2 == null ? void 0 : a2.value) != null ? _b2 : null, i2 = (_c = r2 == null ? void 0 : r2.snapshot) != null ? _c : null;
|
|
1317
1320
|
return o({ snapshot: x({ id: n2.snapshot.id, type: n2.snapshot.type, sender: n2.snapshot.sender, custom: x(n2.snapshot.custom), createdAt: n2.snapshot.createdAt, editedAt: n2.snapshot.editedAt, referencedMessage: i2, origin: n2.snapshot.origin, plaintext: n2.snapshot.plaintext, content: n2.snapshot.content, reactions: n2.snapshot.reactions }) });
|
|
1318
1321
|
});
|
|
1319
1322
|
}
|
|
1320
1323
|
}
|
|
1321
|
-
class fe extends
|
|
1322
|
-
constructor(e2, t2, s2, n2,
|
|
1323
|
-
super(e2, n2,
|
|
1324
|
+
class fe extends Y {
|
|
1325
|
+
constructor(e2, t2, s2, n2, a2) {
|
|
1326
|
+
super(e2, n2, a2), this.conversationId = t2, this.realtimeClient = s2, this.handlers = a2, this.unsubscribeDebounceMs = 1e4, this.pendingLoadMore = void 0;
|
|
1324
1327
|
}
|
|
1325
1328
|
listen(e2) {
|
|
1326
1329
|
return this.onlyUsedInternally && this.mostRecentState.resultPromise.then((e3) => {
|
|
@@ -1332,21 +1335,21 @@ class fe extends J {
|
|
|
1332
1335
|
}
|
|
1333
1336
|
fetchInitial(e2) {
|
|
1334
1337
|
return __async(this, null, function* () {
|
|
1335
|
-
const t2 = this.onlyUsedInternally ? 1 : 30, s2 = yield
|
|
1336
|
-
return s2.ok ? null === s2.value.messages ? o({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null }) :
|
|
1338
|
+
const t2 = this.onlyUsedInternally ? 1 : 30, s2 = yield ge({ realtimeClient: this.realtimeClient, conversationId: this.conversationId, count: t2 });
|
|
1339
|
+
return s2.ok ? null === s2.value.messages ? o({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null }) : ve({ seq: e2, messages: s2.value.messages, cursor: s2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : s2;
|
|
1337
1340
|
});
|
|
1338
1341
|
}
|
|
1339
1342
|
teardownNested(e2) {
|
|
1340
1343
|
if (e2.stores) {
|
|
1341
|
-
const t2 =
|
|
1344
|
+
const t2 = c("TERMINATED");
|
|
1342
1345
|
Object.values(e2.stores).forEach((e3) => e3.setError(t2)), e2.inWindow.forEach((e3) => e3.setError(t2));
|
|
1343
1346
|
}
|
|
1344
1347
|
}
|
|
1345
1348
|
anyChildChanged(e2, t2, s2) {
|
|
1346
1349
|
return __async(this, null, function* () {
|
|
1347
1350
|
for (const n2 in s2.stores) {
|
|
1348
|
-
const
|
|
1349
|
-
if (true === (yield
|
|
1351
|
+
const a2 = s2.stores[n2];
|
|
1352
|
+
if (true === (yield a2 == null ? void 0 : a2.changedBetween(e2, t2))) return true;
|
|
1350
1353
|
}
|
|
1351
1354
|
return false;
|
|
1352
1355
|
});
|
|
@@ -1364,7 +1367,7 @@ class fe extends J {
|
|
|
1364
1367
|
});
|
|
1365
1368
|
}
|
|
1366
1369
|
equal(e2, t2) {
|
|
1367
|
-
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!
|
|
1370
|
+
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!D(Object.keys(e2.stores), Object.keys(t2.stores)) && (!!D(e2.inWindow.map((e3) => e3.messageId), t2.inWindow.map((e3) => e3.messageId)) && D(e2.windowEnd, t2.windowEnd)));
|
|
1368
1371
|
}
|
|
1369
1372
|
loadNested(e2, t2) {
|
|
1370
1373
|
return __async(this, null, function* () {
|
|
@@ -1377,7 +1380,7 @@ class fe extends J {
|
|
|
1377
1380
|
loadMore(e2) {
|
|
1378
1381
|
return __async(this, null, function* () {
|
|
1379
1382
|
if (this.pendingLoadMore) return this.pendingLoadMore;
|
|
1380
|
-
const t2 =
|
|
1383
|
+
const t2 = r();
|
|
1381
1384
|
this.pendingLoadMore = t2.promise, yield this._loadMoreMessages(e2), t2.resolve(), this.pendingLoadMore = void 0;
|
|
1382
1385
|
});
|
|
1383
1386
|
}
|
|
@@ -1386,27 +1389,27 @@ class fe extends J {
|
|
|
1386
1389
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1387
1390
|
if (!t2.ok) return;
|
|
1388
1391
|
if (null === t2.value.windowEnd) return;
|
|
1389
|
-
const s2 = t2.value.windowEnd.cursor, n2 = yield
|
|
1392
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield ge({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient });
|
|
1390
1393
|
yield this.handlers.onLoadedMore({ type: "virtual.messages.loadedmore", conversationId: this.conversationId, data: n2 });
|
|
1391
1394
|
});
|
|
1392
1395
|
}
|
|
1393
1396
|
loadedMore(e2, t2) {
|
|
1394
|
-
this.mutate(e2, (s2) => null === s2.value.windowEnd ? s2 : t2.data.ok ? null === t2.data.value.messages ? (console.warn("[TalkJS] When loading more messages, the conversation no longer existed. We should have been told about this."), s2) :
|
|
1397
|
+
this.mutate(e2, (s2) => null === s2.value.windowEnd ? s2 : t2.data.ok ? null === t2.data.value.messages ? (console.warn("[TalkJS] When loading more messages, the conversation no longer existed. We should have been told about this."), s2) : ve({ seq: e2, prevState: s2.value, messages: t2.data.value.messages, cursor: t2.data.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : t2.data);
|
|
1395
1398
|
}
|
|
1396
1399
|
messageCreated(e2, t2) {
|
|
1397
1400
|
this.mutate(e2, (s2) => {
|
|
1398
1401
|
if (null === s2.value.stores) return console.warn("[TalkJS] Received a 'message.created' event for a nonexistent conversation."), s2;
|
|
1399
1402
|
if (s2.value.windowEnd && t2.state.createdAt < s2.value.windowEnd.oldestMessageTs) return s2;
|
|
1400
1403
|
if (Object.hasOwnProperty.call(s2.value.stores, t2.state.id)) return s2;
|
|
1401
|
-
const n2 = __spreadValues({}, s2.value.stores),
|
|
1402
|
-
n2[t2.state.id] =
|
|
1403
|
-
const
|
|
1404
|
+
const n2 = __spreadValues({}, s2.value.stores), a2 = new de(e2, this.conversationId, t2.state, this.realtimeClient);
|
|
1405
|
+
n2[t2.state.id] = a2;
|
|
1406
|
+
const r2 = t2.state.referencedMessageId;
|
|
1404
1407
|
let i2;
|
|
1405
|
-
null ===
|
|
1406
|
-
const
|
|
1407
|
-
|
|
1408
|
-
const
|
|
1409
|
-
return o({ lastChanged: e2, lastMessageChanged:
|
|
1408
|
+
null === r2 ? i2 = null : r2 in n2 ? i2 = n2[r2] : (i2 = new de(e2, this.conversationId, r2, this.realtimeClient), n2[r2] = i2);
|
|
1409
|
+
const c2 = new me(e2, t2.state.createdAt, a2, i2), l2 = [...s2.value.inWindow, c2];
|
|
1410
|
+
l2.sort((e3, t3) => t3.createdAt - e3.createdAt);
|
|
1411
|
+
const h2 = l2[0].messageId === t2.messageId ? e2 : s2.value.lastMessageChanged;
|
|
1412
|
+
return o({ lastChanged: e2, lastMessageChanged: h2, stores: n2, inWindow: l2, windowEnd: s2.value.windowEnd });
|
|
1410
1413
|
});
|
|
1411
1414
|
}
|
|
1412
1415
|
messageEdited(e2, t2) {
|
|
@@ -1421,18 +1424,18 @@ class fe extends J {
|
|
|
1421
1424
|
if (Object.values(s2.value.stores).forEach((s3) => s3.messageDeleted(e2, t2)), void 0 === s2.value.stores[t2.messageId]) return s2;
|
|
1422
1425
|
const n2 = __spreadValues({}, s2.value.stores);
|
|
1423
1426
|
delete n2[t2.messageId];
|
|
1424
|
-
const
|
|
1425
|
-
if (t2.newLastMessage && 0 ===
|
|
1426
|
-
const s3 = new
|
|
1427
|
+
const a2 = s2.value.inWindow.filter((e3) => e3.messageId !== t2.messageId);
|
|
1428
|
+
if (t2.newLastMessage && 0 === a2.length) {
|
|
1429
|
+
const s3 = new de(e2, this.conversationId, t2.newLastMessage, this.realtimeClient);
|
|
1427
1430
|
n2[s3.messageId] = s3;
|
|
1428
|
-
const
|
|
1431
|
+
const r3 = t2.newLastMessage.referencedMessageId;
|
|
1429
1432
|
let i2;
|
|
1430
|
-
null ===
|
|
1431
|
-
const o2 = new
|
|
1432
|
-
|
|
1433
|
+
null === r3 ? i2 = null : r3 in n2 ? i2 = n2[r3] : (i2 = new de(e2, this.conversationId, r3, this.realtimeClient), n2[r3] = i2);
|
|
1434
|
+
const o2 = new me(e2, t2.newLastMessage.createdAt, s3, i2);
|
|
1435
|
+
a2.push(o2);
|
|
1433
1436
|
}
|
|
1434
|
-
const
|
|
1435
|
-
return o({ lastChanged: e2, lastMessageChanged:
|
|
1437
|
+
const r2 = void 0 !== t2.newLastMessage ? e2 : s2.value.lastMessageChanged;
|
|
1438
|
+
return o({ lastChanged: e2, lastMessageChanged: r2, stores: n2, inWindow: a2, windowEnd: s2.value.windowEnd });
|
|
1436
1439
|
});
|
|
1437
1440
|
}
|
|
1438
1441
|
conversationCleared(e2, t2) {
|
|
@@ -1453,47 +1456,47 @@ class fe extends J {
|
|
|
1453
1456
|
getMessageFromCache(e2) {
|
|
1454
1457
|
return __async(this, null, function* () {
|
|
1455
1458
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1456
|
-
if (!t2.ok) return
|
|
1457
|
-
if (null === t2.value.stores) return
|
|
1459
|
+
if (!t2.ok) return c("NOT_IN_CACHE");
|
|
1460
|
+
if (null === t2.value.stores) return c("NOT_IN_CACHE");
|
|
1458
1461
|
const s2 = t2.value.stores[e2];
|
|
1459
|
-
return void 0 === s2 ?
|
|
1462
|
+
return void 0 === s2 ? c("NOT_IN_CACHE") : s2.getFromCache();
|
|
1460
1463
|
});
|
|
1461
1464
|
}
|
|
1462
1465
|
}
|
|
1463
|
-
function
|
|
1466
|
+
function ge(_0) {
|
|
1464
1467
|
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, conversationId: s2, count: n2 }) {
|
|
1465
|
-
const
|
|
1466
|
-
if (
|
|
1467
|
-
const { data: e3, cursor: t3 } =
|
|
1468
|
+
const a2 = { limit: n2, cursor: e2 }, r2 = yield t2.call({ method: "GET", path: ["me", "conversations", s2, "messages"], data: a2, flags: { bypassCache: true } });
|
|
1469
|
+
if (r2.ok) {
|
|
1470
|
+
const { data: e3, cursor: t3 } = r2.value.data;
|
|
1468
1471
|
return o({ messages: e3, nextCursor: t3 });
|
|
1469
1472
|
}
|
|
1470
|
-
return (
|
|
1473
|
+
return (r2.ok || "server" !== r2.where || 404 !== r2.value.status) && (r2.ok || "server" !== r2.where || 403 !== r2.value.status || "NOT_A_PARTICIPANT" !== r2.value.errorCode) ? r2 : o({ messages: null, nextCursor: null });
|
|
1471
1474
|
});
|
|
1472
1475
|
}
|
|
1473
|
-
function
|
|
1476
|
+
function ve({ seq: e2, prevState: t2, messages: s2, cursor: n2, conversationId: a2, realtimeClient: r2 }) {
|
|
1474
1477
|
var _a2, _b2, _c, _d;
|
|
1475
1478
|
const i2 = t2 ? __spreadValues({}, t2.stores) : {};
|
|
1476
1479
|
for (const t3 of s2) if (void 0 === i2[t3.id]) {
|
|
1477
|
-
const s3 = new
|
|
1480
|
+
const s3 = new de(e2, a2, t3, r2);
|
|
1478
1481
|
i2[s3.messageId] = s3;
|
|
1479
1482
|
}
|
|
1480
1483
|
for (const t3 of s2) {
|
|
1481
1484
|
const s3 = t3.referencedMessageId;
|
|
1482
1485
|
if (s3 && void 0 === i2[s3]) {
|
|
1483
|
-
const t4 = new
|
|
1486
|
+
const t4 = new de(e2, a2, s3, r2);
|
|
1484
1487
|
i2[t4.messageId] = t4;
|
|
1485
1488
|
}
|
|
1486
1489
|
}
|
|
1487
|
-
const
|
|
1488
|
-
for (const t3 of s2)
|
|
1489
|
-
|
|
1490
|
-
const
|
|
1491
|
-
if (null === n2) return o({ lastChanged: e2, lastMessageChanged:
|
|
1492
|
-
return o({ lastChanged: e2, lastMessageChanged:
|
|
1490
|
+
const c2 = t2 ? [...t2.inWindow] : [];
|
|
1491
|
+
for (const t3 of s2) c2.push(new me(e2, t3.createdAt, i2[t3.id], t3.referencedMessageId ? i2[t3.referencedMessageId] : null));
|
|
1492
|
+
c2.sort((e3, t3) => t3.createdAt - e3.createdAt);
|
|
1493
|
+
const l2 = (_b2 = (_a2 = t2 == null ? void 0 : t2.inWindow) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.messageId, h2 = (_c = c2 == null ? void 0 : c2[0]) == null ? void 0 : _c.messageId, u2 = l2 === h2 ? (_d = t2 == null ? void 0 : t2.lastMessageChanged) != null ? _d : e2 : e2;
|
|
1494
|
+
if (null === n2) return o({ lastChanged: e2, lastMessageChanged: u2, stores: i2, inWindow: c2, windowEnd: null });
|
|
1495
|
+
return o({ lastChanged: e2, lastMessageChanged: u2, stores: i2, inWindow: c2, windowEnd: { cursor: n2, oldestMessageTs: s2[s2.length - 1].createdAt } });
|
|
1493
1496
|
}
|
|
1494
|
-
class
|
|
1495
|
-
constructor(e2, t2, s2, n2,
|
|
1496
|
-
super(e2, n2,
|
|
1497
|
+
class be extends Y {
|
|
1498
|
+
constructor(e2, t2, s2, n2, a2) {
|
|
1499
|
+
super(e2, n2, a2), this.convData = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 3e4;
|
|
1497
1500
|
}
|
|
1498
1501
|
fetchInitial(e2) {
|
|
1499
1502
|
return __async(this, null, function* () {
|
|
@@ -1522,21 +1525,21 @@ class ve extends J {
|
|
|
1522
1525
|
});
|
|
1523
1526
|
}
|
|
1524
1527
|
}
|
|
1525
|
-
function
|
|
1528
|
+
function ye(e2, t2) {
|
|
1526
1529
|
for (let s2 in e2) Object.prototype.hasOwnProperty.call(e2, s2) && t2(e2[s2], s2);
|
|
1527
1530
|
}
|
|
1528
|
-
function
|
|
1529
|
-
return function(e3, t3) {
|
|
1531
|
+
function we(e2, t2) {
|
|
1532
|
+
return (function(e3, t3) {
|
|
1530
1533
|
let s2 = {}, n2 = 0;
|
|
1531
|
-
return
|
|
1532
|
-
const [
|
|
1533
|
-
s2[
|
|
1534
|
+
return ye(e3, (e4, a2) => {
|
|
1535
|
+
const [r2, i2] = t3([a2, e4], n2++);
|
|
1536
|
+
s2[r2] = i2;
|
|
1534
1537
|
}), s2;
|
|
1535
|
-
}(e2, ([e3, s2]) => [e3, t2(s2, e3)]);
|
|
1538
|
+
})(e2, ([e3, s2]) => [e3, t2(s2, e3)]);
|
|
1536
1539
|
}
|
|
1537
|
-
class
|
|
1538
|
-
constructor(e2, t2, s2, n2,
|
|
1539
|
-
super(e2, n2,
|
|
1540
|
+
class ke extends Y {
|
|
1541
|
+
constructor(e2, t2, s2, n2, a2) {
|
|
1542
|
+
super(e2, n2, a2), this.conversationId = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 1e4;
|
|
1540
1543
|
}
|
|
1541
1544
|
fetchInitial(e2) {
|
|
1542
1545
|
return __async(this, null, function* () {
|
|
@@ -1546,40 +1549,40 @@ class ye extends J {
|
|
|
1546
1549
|
if (!t2.ok) return t2;
|
|
1547
1550
|
const s2 = t2.value.data;
|
|
1548
1551
|
if (s2.many) return o({ data: { usersTyping: null, many: true }, userSubscriptions: {}, lastChanged: e2 });
|
|
1549
|
-
return o({ data: s2, userSubscriptions:
|
|
1552
|
+
return o({ data: s2, userSubscriptions: we(s2.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3])), lastChanged: e2 });
|
|
1550
1553
|
});
|
|
1551
1554
|
}
|
|
1552
1555
|
equal(e2, t2) {
|
|
1553
|
-
return
|
|
1556
|
+
return D(e2.data, t2.data);
|
|
1554
1557
|
}
|
|
1555
1558
|
loadNested(e2, t2) {
|
|
1556
1559
|
return __async(this, null, function* () {
|
|
1557
1560
|
if (null === t2.data) return o({ snapshot: null, lastChanged: t2.lastChanged });
|
|
1558
1561
|
if (t2.data.many) return o({ snapshot: x({ many: true }), lastChanged: t2.lastChanged });
|
|
1559
|
-
const s2 = Object.entries(t2.data.usersTyping).sort(([e3, t3], [s3, n3]) => t3 - n3).map(([e3, t3]) => e3).map((s3) => t2.userSubscriptions[s3].store.getDeep(e2)), n2 = yield Promise.all(s2),
|
|
1560
|
-
if (
|
|
1561
|
-
const
|
|
1562
|
-
return o({ snapshot: x({ users: x(i2), many: false }), lastChanged:
|
|
1562
|
+
const s2 = Object.entries(t2.data.usersTyping).sort(([e3, t3], [s3, n3]) => t3 - n3).map(([e3, t3]) => e3).map((s3) => t2.userSubscriptions[s3].store.getDeep(e2)), n2 = yield Promise.all(s2), a2 = n2.find((e3) => !e3.ok);
|
|
1563
|
+
if (a2) return a2;
|
|
1564
|
+
const r2 = n2.map((e3) => e3.value), i2 = r2.map((e3) => e3.snapshot), c2 = r2.map((e3) => e3.lastChanged), l2 = Math.max(t2.lastChanged, ...c2);
|
|
1565
|
+
return o({ snapshot: x({ users: x(i2), many: false }), lastChanged: l2 });
|
|
1563
1566
|
});
|
|
1564
1567
|
}
|
|
1565
1568
|
typingAvailable(e2, t2) {
|
|
1566
|
-
this.mutate(e2, () => o({ data: t2.state, userSubscriptions: t2.state.many ? {} :
|
|
1569
|
+
this.mutate(e2, () => o({ data: t2.state, userSubscriptions: t2.state.many ? {} : we(t2.state.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3])), lastChanged: e2 }));
|
|
1567
1570
|
}
|
|
1568
1571
|
typingChanged(e2, t2) {
|
|
1569
1572
|
this.mutate(e2, (s2) => {
|
|
1570
1573
|
if (null === s2.value.data) return s2;
|
|
1571
1574
|
if (void 0 === t2.diff.many) {
|
|
1572
1575
|
if (true === s2.value.data.many) return s2;
|
|
1573
|
-
const n2 = __spreadValues({}, s2.value.data.usersTyping),
|
|
1574
|
-
return
|
|
1576
|
+
const n2 = __spreadValues({}, s2.value.data.usersTyping), a2 = __spreadValues({}, s2.value.userSubscriptions);
|
|
1577
|
+
return ye(t2.diff.usersTyping, (e3, t3) => {
|
|
1575
1578
|
var _a2;
|
|
1576
|
-
"number" == typeof e3 ? (n2[t3] = e3,
|
|
1577
|
-
}), o({ data: { usersTyping: n2, many: false }, userSubscriptions:
|
|
1579
|
+
"number" == typeof e3 ? (n2[t3] = e3, a2[t3] = this.realtimeClient.internalSubscribe(["users", t3])) : null === e3 && (delete n2[t3], (_a2 = a2[t3]) == null ? void 0 : _a2.unsubscribe(), delete a2[t3]);
|
|
1580
|
+
}), o({ data: { usersTyping: n2, many: false }, userSubscriptions: a2, lastChanged: e2 });
|
|
1578
1581
|
}
|
|
1579
1582
|
if (true === t2.diff.many) return s2.value.data.many ? s2 : o({ data: { usersTyping: null, many: true }, userSubscriptions: {}, lastChanged: e2 });
|
|
1580
1583
|
if (false === t2.diff.many) {
|
|
1581
1584
|
if (false === s2.value.data.many) return s2;
|
|
1582
|
-
const n2 =
|
|
1585
|
+
const n2 = we(t2.diff.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3]));
|
|
1583
1586
|
return o({ data: t2.diff, userSubscriptions: n2, lastChanged: e2 });
|
|
1584
1587
|
}
|
|
1585
1588
|
throw t2.diff, "Unreachable";
|
|
@@ -1589,27 +1592,33 @@ class ye extends J {
|
|
|
1589
1592
|
this.mutate(e2, (t3) => null === t3.value.data ? t3 : o({ data: null, lastChanged: e2 }));
|
|
1590
1593
|
}
|
|
1591
1594
|
teardownNested(e2) {
|
|
1592
|
-
e2.data &&
|
|
1595
|
+
e2.data && ye(e2.userSubscriptions, (e3) => e3.unsubscribe());
|
|
1593
1596
|
}
|
|
1594
1597
|
anyChildChanged(e2, t2, s2) {
|
|
1595
1598
|
return __async(this, null, function* () {
|
|
1596
1599
|
var _a2;
|
|
1597
1600
|
if (null === s2.data) return false;
|
|
1598
1601
|
for (const n2 in s2.userSubscriptions) {
|
|
1599
|
-
const
|
|
1600
|
-
if (true === (yield (_a2 =
|
|
1602
|
+
const a2 = s2.userSubscriptions[n2];
|
|
1603
|
+
if (true === (yield (_a2 = a2 == null ? void 0 : a2.store) == null ? void 0 : _a2.changedBetween(e2, t2))) return true;
|
|
1601
1604
|
}
|
|
1602
1605
|
return false;
|
|
1603
1606
|
});
|
|
1604
1607
|
}
|
|
1605
1608
|
}
|
|
1606
|
-
class Ce extends
|
|
1607
|
-
constructor(e2, t2, s2, n2) {
|
|
1608
|
-
super(e2,
|
|
1609
|
+
class Ce extends Y {
|
|
1610
|
+
constructor(e2, t2, s2, n2, a2, r2) {
|
|
1611
|
+
super(e2, a2, r2), this.conversationId = t2, this.participant = s2, this.realtimeClient = n2, this.unsubscribeDebounceMs = 0;
|
|
1612
|
+
}
|
|
1613
|
+
get userId() {
|
|
1614
|
+
return "string" == typeof this.participant ? this.participant : this.participant.id;
|
|
1609
1615
|
}
|
|
1610
1616
|
fetchInitial(e2) {
|
|
1611
1617
|
return __async(this, null, function* () {
|
|
1612
|
-
|
|
1618
|
+
const t2 = this.realtimeClient.internalSubscribe(["users", this.userId]);
|
|
1619
|
+
if ("object" == typeof this.participant) return o({ lastChanged: e2, user: t2, data: this.participant });
|
|
1620
|
+
const s2 = yield Te(this.conversationId, this.userId, this.realtimeClient);
|
|
1621
|
+
return s2.ok ? o({ lastChanged: e2, user: t2, data: s2.value }) : (t2.unsubscribe(), s2);
|
|
1613
1622
|
});
|
|
1614
1623
|
}
|
|
1615
1624
|
refetch(e2) {
|
|
@@ -1617,15 +1626,15 @@ class Ce extends z {
|
|
|
1617
1626
|
}
|
|
1618
1627
|
equal(e2, t2) {
|
|
1619
1628
|
var _a2, _b2, _c, _d;
|
|
1620
|
-
return ((_b2 = (_a2 = e2.user) == null ? void 0 : _a2.store) == null ? void 0 : _b2.userId) === ((_d = (_c = t2.user) == null ? void 0 : _c.store) == null ? void 0 : _d.userId) &&
|
|
1629
|
+
return ((_b2 = (_a2 = e2.user) == null ? void 0 : _a2.store) == null ? void 0 : _b2.userId) === ((_d = (_c = t2.user) == null ? void 0 : _c.store) == null ? void 0 : _d.userId) && D(e2.data, t2.data);
|
|
1621
1630
|
}
|
|
1622
1631
|
teardownNested(e2) {
|
|
1623
|
-
|
|
1624
|
-
(_a2 = e2.user) == null ? void 0 : _a2.unsubscribe();
|
|
1632
|
+
e2.user.unsubscribe();
|
|
1625
1633
|
}
|
|
1626
1634
|
anyChildChanged(e2, t2, s2) {
|
|
1627
1635
|
return __async(this, null, function* () {
|
|
1628
1636
|
var _a2;
|
|
1637
|
+
if (null === s2.data) return false;
|
|
1629
1638
|
const n2 = (_a2 = s2.user) == null ? void 0 : _a2.store;
|
|
1630
1639
|
return true === (yield n2 == null ? void 0 : n2.changedBetween(e2, t2));
|
|
1631
1640
|
});
|
|
@@ -1636,70 +1645,91 @@ class Ce extends z {
|
|
|
1636
1645
|
const s2 = yield t2.user.store.getDeep(e2);
|
|
1637
1646
|
if (false === s2.ok) return s2;
|
|
1638
1647
|
const n2 = s2.value.snapshot;
|
|
1639
|
-
return o({ snapshot:
|
|
1648
|
+
return o({ snapshot: le(t2.data, n2) });
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
participantCreated(e2, t2) {
|
|
1652
|
+
this.mutate(e2, (s2) => {
|
|
1653
|
+
if (null !== s2.value.data) return s2;
|
|
1654
|
+
return o({ lastChanged: e2, user: s2.value.user, data: t2.state });
|
|
1640
1655
|
});
|
|
1641
1656
|
}
|
|
1642
1657
|
participantEdited(e2, t2) {
|
|
1643
1658
|
this.mutate(e2, (s2) => {
|
|
1644
1659
|
if (null === s2.value.data) return s2;
|
|
1645
|
-
return o({ lastChanged: e2, user: s2.value.user, data: { id: s2.value.data.id, access:
|
|
1660
|
+
return o({ lastChanged: e2, user: s2.value.user, data: { id: s2.value.data.id, access: A(s2.value.data.access, t2.diff.access), notify: A(s2.value.data.notify, t2.diff.notify), joinedAt: s2.value.data.joinedAt } });
|
|
1646
1661
|
});
|
|
1647
1662
|
}
|
|
1648
1663
|
participantDeleted(e2, t2) {
|
|
1649
|
-
this.mutate(e2, (t3) => null === t3.value.data ? t3 :
|
|
1664
|
+
this.mutate(e2, (t3) => null === t3.value.data ? t3 : o({ lastChanged: e2, user: t3.value.user, data: null }));
|
|
1665
|
+
}
|
|
1666
|
+
sideCreated(e2, t2) {
|
|
1667
|
+
const s2 = Te(this.conversationId, this.userId, this.realtimeClient);
|
|
1668
|
+
this.mutate(e2, (t3) => __async(this, null, function* () {
|
|
1669
|
+
if (null !== t3.value.data) return t3;
|
|
1670
|
+
const n2 = yield s2;
|
|
1671
|
+
return n2.ok ? o({ lastChanged: e2, user: t3.value.user, data: n2.value }) : (this.teardownNested(t3.value), n2);
|
|
1672
|
+
}));
|
|
1673
|
+
}
|
|
1674
|
+
sideDeleted(e2, t2) {
|
|
1675
|
+
this.mutate(e2, (t3) => null === t3.value.data ? t3 : o({ lastChanged: e2, user: t3.value.user, data: null }));
|
|
1650
1676
|
}
|
|
1651
1677
|
getFromCache() {
|
|
1652
1678
|
return __async(this, null, function* () {
|
|
1653
1679
|
const e2 = yield this.mostRecentState.resultPromise;
|
|
1654
|
-
if (!e2.ok) return
|
|
1680
|
+
if (!e2.ok) return c("NOT_IN_CACHE");
|
|
1655
1681
|
if (null === e2.value.data) {
|
|
1656
|
-
return
|
|
1682
|
+
return l({ status: 404, errorCode: "PARTICIPANT_NOT_FOUND", reasons: ["No participant with that ID exists"] });
|
|
1657
1683
|
}
|
|
1658
1684
|
return o({ status: 200, data: e2.value.data });
|
|
1659
1685
|
});
|
|
1660
1686
|
}
|
|
1661
1687
|
}
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1688
|
+
function Te(e2, t2, s2) {
|
|
1689
|
+
return __async(this, null, function* () {
|
|
1690
|
+
const n2 = yield s2.call({ method: "GET", path: ["me", "conversations", e2, "participants", t2], data: {}, flags: { bypassCache: true } });
|
|
1691
|
+
return n2.ok ? o(n2.value.data) : "server" === n2.where && 404 === n2.value.status || "server" === n2.where && 403 === n2.value.status && "NOT_A_PARTICIPANT" === n2.value.errorCode ? o(null) : n2;
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1694
|
+
class Ie extends Y {
|
|
1695
|
+
constructor(e2, t2, s2, n2, a2, r2) {
|
|
1696
|
+
super(e2, a2, r2), this.getParticipantDataStore = t2, this.conversationId = s2, this.realtimeClient = n2, this.handlers = r2, this.unsubscribeDebounceMs = 3e4, this.pendingLoadMore = void 0;
|
|
1665
1697
|
}
|
|
1666
1698
|
fetchInitial(e2) {
|
|
1667
1699
|
return __async(this, null, function* () {
|
|
1668
|
-
const t2 = yield
|
|
1669
|
-
return t2.ok ? null === t2.value.participants ? o({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null }) :
|
|
1700
|
+
const t2 = yield Se({ realtimeClient: this.realtimeClient, conversationId: this.conversationId, count: 10 });
|
|
1701
|
+
return t2.ok ? null === t2.value.participants ? o({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null }) : xe({ seq: e2, participants: t2.value.participants, cursor: t2.value.nextCursor, getParticipantDataStore: this.getParticipantDataStore }) : t2;
|
|
1670
1702
|
});
|
|
1671
1703
|
}
|
|
1672
1704
|
teardownNested(e2) {
|
|
1673
|
-
|
|
1674
|
-
const t2 = u("TERMINATED");
|
|
1675
|
-
Object.values(e2.stores).forEach((e3) => e3.setError(t2));
|
|
1676
|
-
}
|
|
1705
|
+
null !== e2.stores && Object.values(e2.stores).forEach((e3) => e3.unsubscribe());
|
|
1677
1706
|
}
|
|
1678
1707
|
anyChildChanged(e2, t2, s2) {
|
|
1679
1708
|
return __async(this, null, function* () {
|
|
1709
|
+
var _a2;
|
|
1680
1710
|
for (const n2 in s2.stores) {
|
|
1681
|
-
const
|
|
1682
|
-
if (true === (yield
|
|
1711
|
+
const a2 = s2.stores[n2];
|
|
1712
|
+
if (true === (yield (_a2 = a2 == null ? void 0 : a2.store) == null ? void 0 : _a2.changedBetween(e2, t2))) return true;
|
|
1683
1713
|
}
|
|
1684
1714
|
return false;
|
|
1685
1715
|
});
|
|
1686
1716
|
}
|
|
1687
1717
|
equal(e2, t2) {
|
|
1688
|
-
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!
|
|
1718
|
+
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!D(Object.keys(e2.stores), Object.keys(t2.stores)) && D(e2.windowEnd, t2.windowEnd));
|
|
1689
1719
|
}
|
|
1690
1720
|
loadNested(e2, t2) {
|
|
1691
1721
|
return __async(this, null, function* () {
|
|
1692
1722
|
if (null === t2.stores) return o({ snapshot: null, loadedAll: true });
|
|
1693
|
-
const s2 = yield Promise.all(Object.values(t2.stores).map((t3) => t3.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1723
|
+
const s2 = yield Promise.all(Object.values(t2.stores).map((t3) => t3.store.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1694
1724
|
if (n2) return n2;
|
|
1695
|
-
const
|
|
1696
|
-
return
|
|
1725
|
+
const a2 = s2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot);
|
|
1726
|
+
return a2.sort((e3, t3) => t3.joinedAt - e3.joinedAt), o({ snapshot: x(a2), loadedAll: null === t2.windowEnd });
|
|
1697
1727
|
});
|
|
1698
1728
|
}
|
|
1699
1729
|
loadMore(e2) {
|
|
1700
1730
|
return __async(this, null, function* () {
|
|
1701
1731
|
if (this.pendingLoadMore) return this.pendingLoadMore;
|
|
1702
|
-
const t2 =
|
|
1732
|
+
const t2 = r();
|
|
1703
1733
|
this.pendingLoadMore = t2.promise, yield this._loadMoreParticipants(e2), t2.resolve(), this.pendingLoadMore = void 0;
|
|
1704
1734
|
});
|
|
1705
1735
|
}
|
|
@@ -1708,37 +1738,26 @@ class Ae extends J {
|
|
|
1708
1738
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1709
1739
|
if (!t2.ok) return;
|
|
1710
1740
|
if (null === t2.value.windowEnd) return;
|
|
1711
|
-
const s2 = t2.value.windowEnd.cursor, n2 = yield
|
|
1741
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield Se({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient });
|
|
1712
1742
|
yield this.handlers.onLoadedMore({ type: "virtual.participants.loadedmore", conversationId: this.conversationId, data: n2 });
|
|
1713
1743
|
});
|
|
1714
1744
|
}
|
|
1715
1745
|
loadedMore(e2, t2) {
|
|
1716
|
-
this.mutate(e2, (s2) => null === s2.value.windowEnd ? s2 : t2.data.ok ? null === t2.data.value.participants ? (console.warn("[TalkJS] When loading more participants, the conversation no longer existed. We should have been told about this."), s2) :
|
|
1746
|
+
this.mutate(e2, (s2) => null === s2.value.windowEnd ? s2 : t2.data.ok ? null === t2.data.value.participants ? (console.warn("[TalkJS] When loading more participants, the conversation no longer existed. We should have been told about this."), s2) : xe({ seq: e2, prevStores: s2.value.stores, participants: t2.data.value.participants, cursor: t2.data.value.nextCursor, getParticipantDataStore: this.getParticipantDataStore }) : t2.data);
|
|
1717
1747
|
}
|
|
1718
1748
|
participantCreated(e2, t2) {
|
|
1719
|
-
this.
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
const n2 = __spreadValues({}, s2.value.stores), r2 = new Ce(e2, this.conversationId, t2.state, this.realtimeClient);
|
|
1724
|
-
n2[t2.state.id] = r2;
|
|
1725
|
-
return o({ lastChanged: e2, stores: n2, windowEnd: s2.value.windowEnd });
|
|
1726
|
-
});
|
|
1727
|
-
}
|
|
1728
|
-
participantEdited(e2, t2) {
|
|
1729
|
-
this.mutate(e2, (s2) => {
|
|
1730
|
-
var _a2;
|
|
1731
|
-
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);
|
|
1749
|
+
const s2 = this.getParticipantDataStore(t2.state);
|
|
1750
|
+
this.mutate(e2, (n2) => {
|
|
1751
|
+
let a2 = n2.value.stores;
|
|
1752
|
+
return null === a2 && (console.warn("[TalkJS] Received a 'participant.created' event when we thought the conversation didn't exist."), a2 = {}), Object.hasOwnProperty.call(a2, t2.userId) ? (s2.unsubscribe(), n2) : o({ lastChanged: e2, stores: __spreadProps(__spreadValues({}, a2), { [t2.userId]: s2 }), windowEnd: n2.value.windowEnd });
|
|
1732
1753
|
});
|
|
1733
1754
|
}
|
|
1734
1755
|
participantDeleted(e2, t2) {
|
|
1735
1756
|
this.mutate(e2, (s2) => {
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
n2.
|
|
1740
|
-
const r2 = __spreadValues({}, s2.value.stores);
|
|
1741
|
-
return delete r2[t2.userId], o({ lastChanged: e2, stores: r2, windowEnd: s2.value.windowEnd });
|
|
1757
|
+
var _a2;
|
|
1758
|
+
if (!Object.hasOwnProperty.call(s2.value.stores, t2.conversationId)) return s2;
|
|
1759
|
+
const n2 = __spreadValues({}, s2.value.stores);
|
|
1760
|
+
return (_a2 = n2[t2.userId]) == null ? void 0 : _a2.unsubscribe(), delete n2[t2.userId], o({ lastChanged: e2, stores: n2, windowEnd: s2.value.windowEnd });
|
|
1742
1761
|
});
|
|
1743
1762
|
}
|
|
1744
1763
|
sideCreated(e2, t2) {
|
|
@@ -1750,43 +1769,31 @@ class Ae extends J {
|
|
|
1750
1769
|
sideDeleted(e2, t2) {
|
|
1751
1770
|
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (this.teardownNested(t3.value), o({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null })));
|
|
1752
1771
|
}
|
|
1753
|
-
getParticipantFromCache(e2) {
|
|
1754
|
-
return __async(this, null, function* () {
|
|
1755
|
-
const t2 = yield this.mostRecentState.resultPromise;
|
|
1756
|
-
if (!t2.ok) return u("NOT_IN_CACHE");
|
|
1757
|
-
if (null === t2.value.stores) return u("NOT_IN_CACHE");
|
|
1758
|
-
const s2 = t2.value.stores[e2];
|
|
1759
|
-
return void 0 === s2 ? u("NOT_IN_CACHE") : s2.getFromCache();
|
|
1760
|
-
});
|
|
1761
|
-
}
|
|
1762
1772
|
}
|
|
1763
|
-
function
|
|
1773
|
+
function Se(_0) {
|
|
1764
1774
|
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, conversationId: s2, count: n2 }) {
|
|
1765
|
-
const
|
|
1766
|
-
if (
|
|
1767
|
-
const { data: e3, cursor: t3 } =
|
|
1775
|
+
const a2 = { limit: n2, cursor: e2 }, r2 = yield t2.call({ method: "GET", path: ["me", "conversations", s2, "participants"], data: a2, flags: { bypassCache: true } });
|
|
1776
|
+
if (r2.ok) {
|
|
1777
|
+
const { data: e3, cursor: t3 } = r2.value.data;
|
|
1768
1778
|
return o({ participants: e3, nextCursor: t3 });
|
|
1769
1779
|
}
|
|
1770
|
-
return (
|
|
1780
|
+
return (r2.ok || "server" !== r2.where || 404 !== r2.value.status) && (r2.ok || "server" !== r2.where || 403 !== r2.value.status || "NOT_A_PARTICIPANT" !== r2.value.errorCode) ? r2 : o({ participants: null, nextCursor: null });
|
|
1771
1781
|
});
|
|
1772
1782
|
}
|
|
1773
|
-
function
|
|
1774
|
-
const
|
|
1775
|
-
for (const
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
}
|
|
1779
|
-
if (null === n2) return o({ lastChanged: e2, stores: i2, windowEnd: null });
|
|
1780
|
-
return o({ lastChanged: e2, stores: i2, windowEnd: { cursor: n2, oldestParticipantTs: s2[s2.length - 1].joinedAt } });
|
|
1783
|
+
function xe({ seq: e2, prevStores: t2, participants: s2, cursor: n2, getParticipantDataStore: a2 }) {
|
|
1784
|
+
const r2 = t2 ? __spreadValues({}, t2) : {};
|
|
1785
|
+
for (const e3 of s2) void 0 === r2[e3.id] && (r2[e3.id] = a2(e3));
|
|
1786
|
+
if (null === n2) return o({ lastChanged: e2, stores: r2, windowEnd: null });
|
|
1787
|
+
return o({ lastChanged: e2, stores: r2, windowEnd: { cursor: n2, oldestParticipantTs: s2[s2.length - 1].joinedAt } });
|
|
1781
1788
|
}
|
|
1782
|
-
class
|
|
1783
|
-
constructor(e2, t2, s2, n2,
|
|
1784
|
-
super(e2, n2,
|
|
1789
|
+
class Ee extends Y {
|
|
1790
|
+
constructor(e2, t2, s2, n2, a2) {
|
|
1791
|
+
super(e2, n2, a2), this.getConvDataStore = t2, this.realtimeClient = s2, this.handlers = a2, this.unsubscribeDebounceMs = 1e4, this.pendingLoadMore = void 0;
|
|
1785
1792
|
}
|
|
1786
1793
|
fetchInitial(e2) {
|
|
1787
1794
|
return __async(this, null, function* () {
|
|
1788
|
-
const t2 = yield
|
|
1789
|
-
return t2.ok ? null === t2.value.conversations ? o({ lastChanged: e2, stores: null, windowEnd: null }) :
|
|
1795
|
+
const t2 = yield Me({ realtimeClient: this.realtimeClient, count: 20 });
|
|
1796
|
+
return t2.ok ? null === t2.value.conversations ? o({ lastChanged: e2, stores: null, windowEnd: null }) : Ae({ seq: e2, conversations: t2.value.conversations, cursor: t2.value.nextCursor, getConvDataStore: this.getConvDataStore }) : t2;
|
|
1790
1797
|
});
|
|
1791
1798
|
}
|
|
1792
1799
|
teardownNested(e2) {
|
|
@@ -1796,32 +1803,32 @@ class xe extends J {
|
|
|
1796
1803
|
return __async(this, null, function* () {
|
|
1797
1804
|
var _a2;
|
|
1798
1805
|
for (const n2 in s2.stores) {
|
|
1799
|
-
const
|
|
1800
|
-
if (true === (yield (_a2 =
|
|
1806
|
+
const a2 = s2.stores[n2];
|
|
1807
|
+
if (true === (yield (_a2 = a2 == null ? void 0 : a2.store) == null ? void 0 : _a2.changedBetween(e2, t2))) return true;
|
|
1801
1808
|
}
|
|
1802
1809
|
return false;
|
|
1803
1810
|
});
|
|
1804
1811
|
}
|
|
1805
1812
|
equal(e2, t2) {
|
|
1806
|
-
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!
|
|
1813
|
+
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!D(Object.keys(e2.stores), Object.keys(t2.stores)) && D(e2.windowEnd, t2.windowEnd));
|
|
1807
1814
|
}
|
|
1808
1815
|
loadNested(e2, t2) {
|
|
1809
1816
|
return __async(this, null, function* () {
|
|
1810
1817
|
if (null === t2.stores) return o({ snapshot: x([]), loadedAll: true });
|
|
1811
1818
|
const s2 = yield Promise.all(Object.values(t2.stores).map((t3) => t3.store.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1812
1819
|
if (n2) return n2;
|
|
1813
|
-
const
|
|
1814
|
-
return
|
|
1820
|
+
const a2 = s2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot);
|
|
1821
|
+
return a2.sort((e3, t3) => {
|
|
1815
1822
|
var _a2, _b2, _c, _d;
|
|
1816
1823
|
const s3 = (_b2 = (_a2 = e3.lastMessage) == null ? void 0 : _a2.createdAt) != null ? _b2 : e3.joinedAt;
|
|
1817
1824
|
return ((_d = (_c = t3.lastMessage) == null ? void 0 : _c.createdAt) != null ? _d : t3.joinedAt) - s3;
|
|
1818
|
-
}), o({ snapshot: x(
|
|
1825
|
+
}), o({ snapshot: x(a2), loadedAll: null === t2.windowEnd });
|
|
1819
1826
|
});
|
|
1820
1827
|
}
|
|
1821
1828
|
loadMore(e2) {
|
|
1822
1829
|
return __async(this, null, function* () {
|
|
1823
1830
|
if (this.pendingLoadMore) return this.pendingLoadMore;
|
|
1824
|
-
const t2 =
|
|
1831
|
+
const t2 = r();
|
|
1825
1832
|
this.pendingLoadMore = t2.promise, yield this._loadMoreConversations(e2), t2.resolve(), this.pendingLoadMore = void 0;
|
|
1826
1833
|
});
|
|
1827
1834
|
}
|
|
@@ -1830,21 +1837,12 @@ class xe extends J {
|
|
|
1830
1837
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1831
1838
|
if (!t2.ok) return;
|
|
1832
1839
|
if (null === t2.value.windowEnd) return;
|
|
1833
|
-
const s2 = t2.value.windowEnd.cursor, n2 = yield
|
|
1840
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield Me({ count: e2, cursor: s2, realtimeClient: this.realtimeClient });
|
|
1834
1841
|
yield this.handlers.onLoadedMore({ type: "virtual.conversations.loadedmore", data: n2 });
|
|
1835
1842
|
});
|
|
1836
1843
|
}
|
|
1837
|
-
getConvFromCache(e2) {
|
|
1838
|
-
return __async(this, null, function* () {
|
|
1839
|
-
const t2 = yield this.mostRecentState.resultPromise;
|
|
1840
|
-
if (!t2.ok) return u("NOT_IN_CACHE");
|
|
1841
|
-
if (null === t2.value.stores) return c({ status: 404, errorCode: "USER_NOT_FOUND", reasons: ["No user with that ID exists"] });
|
|
1842
|
-
const s2 = t2.value.stores[e2];
|
|
1843
|
-
return void 0 === s2 ? u("NOT_IN_CACHE") : s2.store.getFromCache();
|
|
1844
|
-
});
|
|
1845
|
-
}
|
|
1846
1844
|
loadedMore(e2, t2) {
|
|
1847
|
-
this.mutate(e2, (s2) => null === s2.value.windowEnd ? s2 : t2.data.ok ? null === t2.data.value.conversations ? (console.warn("[TalkJS] When loading more conversations, the user stopped existing, which should be impossible."), s2) :
|
|
1845
|
+
this.mutate(e2, (s2) => null === s2.value.windowEnd ? s2 : t2.data.ok ? null === t2.data.value.conversations ? (console.warn("[TalkJS] When loading more conversations, the user stopped existing, which should be impossible."), s2) : Ae({ seq: e2, prevStores: s2.value.stores, conversations: t2.data.value.conversations, cursor: t2.data.value.nextCursor, getConvDataStore: this.getConvDataStore }) : t2.data);
|
|
1848
1846
|
}
|
|
1849
1847
|
userCreated(e2, t2) {
|
|
1850
1848
|
this.mutate(e2, (e3) => null !== e3.value.stores ? e3 : o({ lastChanged: e3.value.lastChanged, stores: {}, windowEnd: null }));
|
|
@@ -1852,8 +1850,8 @@ class xe extends J {
|
|
|
1852
1850
|
sideCreated(e2, t2) {
|
|
1853
1851
|
const s2 = this.getConvDataStore(t2.state);
|
|
1854
1852
|
this.mutate(e2, (n2) => {
|
|
1855
|
-
let
|
|
1856
|
-
return null ===
|
|
1853
|
+
let a2 = n2.value.stores;
|
|
1854
|
+
return null === a2 && (console.warn("[TalkJS] Received a 'side.created' event when we thought your user didn't exist."), a2 = {}), Object.hasOwnProperty.call(a2, t2.conversationId) ? (s2.unsubscribe(), n2) : o({ lastChanged: e2, stores: __spreadProps(__spreadValues({}, a2), { [t2.conversationId]: s2 }), windowEnd: n2.value.windowEnd });
|
|
1857
1855
|
});
|
|
1858
1856
|
}
|
|
1859
1857
|
sideDeleted(e2, t2) {
|
|
@@ -1870,12 +1868,12 @@ class xe extends J {
|
|
|
1870
1868
|
var _a2;
|
|
1871
1869
|
if (null === n2.value.stores) return console.warn("[TalkJS] Received a 'side.edited' event when we thought your user didn't exist."), n2;
|
|
1872
1870
|
if (null === n2.value.windowEnd) return n2;
|
|
1873
|
-
const
|
|
1874
|
-
if (
|
|
1871
|
+
const a2 = Object.hasOwnProperty.call(n2.value.stores, t2.conversationId);
|
|
1872
|
+
if (a2 && s2 < n2.value.windowEnd.oldestMessageTs) {
|
|
1875
1873
|
const s3 = __spreadValues({}, n2.value.stores);
|
|
1876
1874
|
return (_a2 = s3[t2.conversationId]) == null ? void 0 : _a2.unsubscribe(), delete s3[t2.conversationId], o({ lastChanged: e2, stores: s3, windowEnd: n2.value.windowEnd });
|
|
1877
1875
|
}
|
|
1878
|
-
if (!
|
|
1876
|
+
if (!a2 && s2 >= n2.value.windowEnd.oldestMessageTs) {
|
|
1879
1877
|
const s3 = this.getConvDataStore(t2.conversationId);
|
|
1880
1878
|
return o({ lastChanged: e2, stores: __spreadProps(__spreadValues({}, n2.value.stores), { [t2.conversationId]: s3 }), windowEnd: n2.value.windowEnd });
|
|
1881
1879
|
}
|
|
@@ -1883,25 +1881,25 @@ class xe extends J {
|
|
|
1883
1881
|
});
|
|
1884
1882
|
}
|
|
1885
1883
|
}
|
|
1886
|
-
function
|
|
1884
|
+
function Me(_0) {
|
|
1887
1885
|
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, count: s2 }) {
|
|
1888
|
-
const n2 = { limit: s2, cursor: e2 },
|
|
1889
|
-
if (
|
|
1890
|
-
const { data: e3, cursor: t3 } =
|
|
1886
|
+
const n2 = { limit: s2, cursor: e2 }, a2 = yield t2.call({ method: "GET", path: ["me", "conversations"], data: n2, flags: { bypassCache: true } });
|
|
1887
|
+
if (a2.ok) {
|
|
1888
|
+
const { data: e3, cursor: t3 } = a2.value.data;
|
|
1891
1889
|
return o({ conversations: e3, nextCursor: t3 });
|
|
1892
1890
|
}
|
|
1893
|
-
return
|
|
1891
|
+
return a2.ok || "server" !== a2.where || 404 !== a2.value.status || "USER_NOT_FOUND" !== a2.value.errorCode ? a2 : o({ conversations: null, nextCursor: null });
|
|
1894
1892
|
});
|
|
1895
1893
|
}
|
|
1896
|
-
function
|
|
1897
|
-
const
|
|
1898
|
-
for (const e3 of s2) void 0 ===
|
|
1899
|
-
if (null === n2) return o({ lastChanged: e2, stores:
|
|
1900
|
-
return o({ lastChanged: e2, stores:
|
|
1894
|
+
function Ae({ seq: e2, prevStores: t2, conversations: s2, cursor: n2, getConvDataStore: a2 }) {
|
|
1895
|
+
const r2 = t2 ? __spreadValues({}, t2) : {};
|
|
1896
|
+
for (const e3 of s2) void 0 === r2[e3.id] && (r2[e3.id] = a2(e3));
|
|
1897
|
+
if (null === n2) return o({ lastChanged: e2, stores: r2, windowEnd: null });
|
|
1898
|
+
return o({ lastChanged: e2, stores: r2, windowEnd: { cursor: n2, oldestMessageTs: Math.min(...s2.map((e3) => e3.lastMessageAt)) } });
|
|
1901
1899
|
}
|
|
1902
|
-
class
|
|
1903
|
-
constructor(e2, t2, s2, n2,
|
|
1904
|
-
super(e2, n2,
|
|
1900
|
+
class Ne extends Y {
|
|
1901
|
+
constructor(e2, t2, s2, n2, a2) {
|
|
1902
|
+
super(e2, n2, a2), this.conversation = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 0;
|
|
1905
1903
|
}
|
|
1906
1904
|
get conversationId() {
|
|
1907
1905
|
return "string" == typeof this.conversation ? this.conversation : this.conversation.id;
|
|
@@ -1931,7 +1929,7 @@ class De extends J {
|
|
|
1931
1929
|
});
|
|
1932
1930
|
}
|
|
1933
1931
|
equal(e2, t2) {
|
|
1934
|
-
return
|
|
1932
|
+
return D(e2.snapshot, t2.snapshot);
|
|
1935
1933
|
}
|
|
1936
1934
|
loadNested(e2, t2) {
|
|
1937
1935
|
return __async(this, null, function* () {
|
|
@@ -1939,18 +1937,18 @@ class De extends J {
|
|
|
1939
1937
|
if (!t2.snapshot) return o({ snapshot: null, loadedAll: true });
|
|
1940
1938
|
const s2 = yield t2.messageWindow.store.getDeep(e2);
|
|
1941
1939
|
if (!s2.ok) return s2;
|
|
1942
|
-
const n2 = s2.value.snapshot,
|
|
1943
|
-
return o({ snapshot: x(__spreadProps(__spreadValues({}, t2.snapshot), { custom: x(t2.snapshot.custom), welcomeMessages: x(t2.snapshot.welcomeMessages), lastMessage:
|
|
1940
|
+
const n2 = s2.value.snapshot, a2 = (_a2 = n2 == null ? void 0 : n2[0]) != null ? _a2 : null;
|
|
1941
|
+
return o({ snapshot: x(__spreadProps(__spreadValues({}, t2.snapshot), { custom: x(t2.snapshot.custom), welcomeMessages: x(t2.snapshot.welcomeMessages), lastMessage: a2 })) });
|
|
1944
1942
|
});
|
|
1945
1943
|
}
|
|
1946
1944
|
participantEdited(e2, t2) {
|
|
1947
|
-
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'participant.edited' event for a conversation that we thought didn't exist."), s2) : o({ lastChanged: e2, snapshot:
|
|
1945
|
+
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'participant.edited' event for a conversation that we thought didn't exist."), s2) : o({ lastChanged: e2, snapshot: Re(s2.value.snapshot, t2.diff), messageWindow: s2.value.messageWindow }));
|
|
1948
1946
|
}
|
|
1949
1947
|
conversationEdited(e2, t2) {
|
|
1950
|
-
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'conversation.edited' event for a conversation that we thought didn't exist."), s2) : o({ lastChanged: e2, snapshot:
|
|
1948
|
+
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'conversation.edited' event for a conversation that we thought didn't exist."), s2) : o({ lastChanged: e2, snapshot: Re(s2.value.snapshot, t2.diff), messageWindow: s2.value.messageWindow }));
|
|
1951
1949
|
}
|
|
1952
1950
|
sideEdited(e2, t2) {
|
|
1953
|
-
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'side.edited' event for a conversation that we thought didn't exist."), s2) : o({ lastChanged: e2, snapshot:
|
|
1951
|
+
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'side.edited' event for a conversation that we thought didn't exist."), s2) : o({ lastChanged: e2, snapshot: Re(s2.value.snapshot, t2.diff), messageWindow: s2.value.messageWindow }));
|
|
1954
1952
|
}
|
|
1955
1953
|
sideCreated(e2, t2) {
|
|
1956
1954
|
this.mutate(e2, (s2) => s2.value.snapshot ? s2 : o({ lastChanged: e2, snapshot: t2.state, messageWindow: s2.value.messageWindow }));
|
|
@@ -1961,17 +1959,17 @@ class De extends J {
|
|
|
1961
1959
|
getFromCache() {
|
|
1962
1960
|
return __async(this, null, function* () {
|
|
1963
1961
|
const e2 = yield this.mostRecentState.resultPromise;
|
|
1964
|
-
return e2.ok && e2.value.snapshot ? o({ status: 200, data: e2.value.snapshot }) :
|
|
1962
|
+
return e2.ok && e2.value.snapshot ? o({ status: 200, data: e2.value.snapshot }) : c("NOT_IN_CACHE");
|
|
1965
1963
|
});
|
|
1966
1964
|
}
|
|
1967
1965
|
}
|
|
1968
|
-
function
|
|
1966
|
+
function Re(e2, t2) {
|
|
1969
1967
|
const s2 = t2;
|
|
1970
|
-
return { id: e2.id, createdAt: e2.createdAt, subject:
|
|
1968
|
+
return { id: e2.id, createdAt: e2.createdAt, subject: A(e2.subject, s2.subject), photoUrl: A(e2.photoUrl, s2.photoUrl), welcomeMessages: N(e2.welcomeMessages, s2.welcomeMessages), custom: R(e2.custom, s2.custom), lastMessageAt: A(e2.lastMessageAt, s2.lastMessageAt), unreadMessageCount: A(e2.unreadMessageCount, s2.unreadMessageCount), isUnread: A(e2.isUnread, s2.isUnread), access: A(e2.access, s2.access), notify: A(e2.notify, s2.notify), readUntil: A(e2.readUntil, s2.readUntil), everyoneReadUntil: A(e2.everyoneReadUntil, s2.everyoneReadUntil), joinedAt: e2.joinedAt };
|
|
1971
1969
|
}
|
|
1972
|
-
class
|
|
1973
|
-
constructor(e2, t2, s2, n2,
|
|
1974
|
-
super(e2, n2,
|
|
1970
|
+
class De extends Y {
|
|
1971
|
+
constructor(e2, t2, s2, n2, a2) {
|
|
1972
|
+
super(e2, n2, a2), this.userId = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 3e4;
|
|
1975
1973
|
}
|
|
1976
1974
|
fetchInitial(e2) {
|
|
1977
1975
|
return __async(this, null, function* () {
|
|
@@ -1980,7 +1978,7 @@ class Me extends J {
|
|
|
1980
1978
|
});
|
|
1981
1979
|
}
|
|
1982
1980
|
equal(e2, t2) {
|
|
1983
|
-
return
|
|
1981
|
+
return D(e2.data, t2.data);
|
|
1984
1982
|
}
|
|
1985
1983
|
teardownNested(e2) {
|
|
1986
1984
|
e2.user.unsubscribe();
|
|
@@ -2010,18 +2008,44 @@ class Me extends J {
|
|
|
2010
2008
|
getFromCache() {
|
|
2011
2009
|
return __async(this, null, function* () {
|
|
2012
2010
|
const e2 = yield this.mostRecentState.resultPromise;
|
|
2013
|
-
if (!e2.ok) return
|
|
2011
|
+
if (!e2.ok) return c("NOT_IN_CACHE");
|
|
2014
2012
|
if (null === e2.value.data) {
|
|
2015
|
-
return
|
|
2013
|
+
return l({ status: 404, errorCode: "USER_NOT_FOUND", reasons: ["No user with that ID exists"] });
|
|
2016
2014
|
}
|
|
2017
2015
|
const _a2 = e2.value, { user: t2 } = _a2, s2 = __objRest(_a2, ["user"]);
|
|
2018
2016
|
return o({ status: 200, data: __spreadValues({}, s2.data) });
|
|
2019
2017
|
});
|
|
2020
2018
|
}
|
|
2021
2019
|
}
|
|
2022
|
-
class
|
|
2020
|
+
class _e extends Y {
|
|
2021
|
+
constructor(e2, t2, s2, n2, a2) {
|
|
2022
|
+
super(e2, n2, a2), this.participantData = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 3e4;
|
|
2023
|
+
}
|
|
2024
|
+
fetchInitial(e2) {
|
|
2025
|
+
return __async(this, null, function* () {
|
|
2026
|
+
return o({ lastChanged: e2, participantData: this.participantData });
|
|
2027
|
+
});
|
|
2028
|
+
}
|
|
2029
|
+
teardownNested(e2) {
|
|
2030
|
+
e2.participantData.unsubscribe();
|
|
2031
|
+
}
|
|
2032
|
+
anyChildChanged(e2, t2, s2) {
|
|
2033
|
+
return __async(this, null, function* () {
|
|
2034
|
+
return s2.participantData.store.changedBetween(e2, t2);
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
equal(e2, t2) {
|
|
2038
|
+
return true;
|
|
2039
|
+
}
|
|
2040
|
+
loadNested(e2, t2) {
|
|
2041
|
+
return __async(this, null, function* () {
|
|
2042
|
+
return t2.participantData.store.getDeep(e2);
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
class Oe {
|
|
2023
2047
|
constructor(e2, t2, s2) {
|
|
2024
|
-
this.realtimeClient = s2, this.convDataStores = {}, this.storeMap = {}, this.emitMutex = new
|
|
2048
|
+
this.realtimeClient = s2, this.convDataStores = {}, this.participantDataStores = {}, this.storeMap = {}, this.emitMutex = new F(), this.virtualSeqOffset = 0, this.realPublishSeq = 0, this.refetchOnNextNetworkLoss = true, this.connection = new G(e2, t2, { onUpstreamRestarting: () => {
|
|
2025
2049
|
this.refetchOnNextNetworkLoss = false;
|
|
2026
2050
|
}, onReady: () => {
|
|
2027
2051
|
this.refetchOnNextNetworkLoss = true;
|
|
@@ -2033,7 +2057,7 @@ class Fe {
|
|
|
2033
2057
|
}
|
|
2034
2058
|
}, onResubscribeError: (e3, t3) => {
|
|
2035
2059
|
var _a2;
|
|
2036
|
-
(_a2 = this.storeMap[
|
|
2060
|
+
(_a2 = this.storeMap[Pe(e3)]) == null ? void 0 : _a2.setError(t3);
|
|
2037
2061
|
}, onPublish: (e3, t3) => {
|
|
2038
2062
|
this.realPublishSeq = e3;
|
|
2039
2063
|
const s3 = this.virtualSeq;
|
|
@@ -2059,52 +2083,53 @@ class Fe {
|
|
|
2059
2083
|
}));
|
|
2060
2084
|
}
|
|
2061
2085
|
handlePublish(e2, t2) {
|
|
2062
|
-
var _a2, _b2, _c, _d, _e3, _f, _g, _h, _i, _j, _k, _l, _m,
|
|
2086
|
+
var _a2, _b2, _c, _d, _e3, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s2, _t3, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K;
|
|
2063
2087
|
switch (t2.type) {
|
|
2064
2088
|
case "user.created":
|
|
2065
2089
|
return (_a2 = this.storeMap[`/users/${t2.userId}`]) == null ? void 0 : _a2.userCreated(e2, t2), (_b2 = this.storeMap["/me/conversations"]) == null ? void 0 : _b2.userCreated(e2, t2), void ((_c = this.storeMap[`/users/${t2.userId}/online`]) == null ? void 0 : _c.userCreated(e2, t2));
|
|
2066
2090
|
case "user.edited":
|
|
2067
2091
|
return void ((_d = this.storeMap[`/users/${t2.userId}`]) == null ? void 0 : _d.userEdited(e2, t2));
|
|
2068
2092
|
case "side.created":
|
|
2069
|
-
return (_e3 = this.convDataStores[t2.conversationId]) == null ? void 0 : _e3.sideCreated(e2, t2), (_f = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 :
|
|
2093
|
+
return (_e3 = this.convDataStores[t2.conversationId]) == null ? void 0 : _e3.sideCreated(e2, t2), Object.values((_f = this.participantDataStores[t2.conversationId]) != null ? _f : {}).forEach((s2) => s2.sideCreated(e2, t2)), (_g = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _g.sideCreated(e2, t2), (_h = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _h.sideCreated(e2, t2), void ((_i = this.storeMap["/me/conversations"]) == null ? void 0 : _i.sideCreated(e2, t2));
|
|
2070
2094
|
case "side.edited":
|
|
2071
|
-
return (
|
|
2095
|
+
return (_j = this.convDataStores[t2.conversationId]) == null ? void 0 : _j.sideEdited(e2, t2), void ((_k = this.storeMap["/me/conversations"]) == null ? void 0 : _k.sideEdited(e2, t2));
|
|
2072
2096
|
case "side.deleted":
|
|
2073
|
-
return (
|
|
2097
|
+
return (_l = this.convDataStores[t2.conversationId]) == null ? void 0 : _l.sideDeleted(e2, t2), Object.values((_m = this.participantDataStores[t2.conversationId]) != null ? _m : {}).forEach((s2) => s2.sideDeleted(e2, t2)), (_n2 = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _n2.sideDeleted(e2, t2), (_o = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _o.sideDeleted(e2, t2), (_p = this.storeMap[`/me/conversations/${t2.conversationId}/typing`]) == null ? void 0 : _p.sideDeleted(e2, t2), void ((_q = this.storeMap["/me/conversations"]) == null ? void 0 : _q.sideDeleted(e2, t2));
|
|
2074
2098
|
case "conversation.edited":
|
|
2075
|
-
return void ((
|
|
2099
|
+
return void ((_r = this.convDataStores[t2.conversationId]) == null ? void 0 : _r.conversationEdited(e2, t2));
|
|
2076
2100
|
case "message.created":
|
|
2077
|
-
return void ((
|
|
2101
|
+
return void ((_s2 = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _s2.messageCreated(e2, t2));
|
|
2078
2102
|
case "message.edited":
|
|
2079
|
-
return void ((
|
|
2103
|
+
return void ((_t3 = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _t3.messageEdited(e2, t2));
|
|
2080
2104
|
case "message.deleted":
|
|
2081
|
-
return void ((
|
|
2105
|
+
return void ((_u = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _u.messageDeleted(e2, t2));
|
|
2082
2106
|
case "typing.available":
|
|
2083
|
-
return void ((
|
|
2107
|
+
return void ((_v = this.storeMap[`/me/conversations/${t2.conversationId}/typing`]) == null ? void 0 : _v.typingAvailable(e2, t2));
|
|
2084
2108
|
case "typing.changed":
|
|
2085
|
-
return void ((
|
|
2109
|
+
return void ((_w = this.storeMap[`/me/conversations/${t2.conversationId}/typing`]) == null ? void 0 : _w.typingChanged(e2, t2));
|
|
2086
2110
|
case "conversation.cleared":
|
|
2087
|
-
return void ((
|
|
2111
|
+
return void ((_x = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _x.conversationCleared(e2, t2));
|
|
2088
2112
|
case "participant.edited":
|
|
2089
|
-
return (
|
|
2113
|
+
return (_y = this.convDataStores[t2.conversationId]) == null ? void 0 : _y.participantEdited(e2, t2), void ((_A = (_z = this.participantDataStores[t2.conversationId]) == null ? void 0 : _z[t2.userId]) == null ? void 0 : _A.participantEdited(e2, t2));
|
|
2090
2114
|
case "participant.created":
|
|
2091
|
-
return void ((
|
|
2115
|
+
return (_C = (_B = this.participantDataStores[t2.conversationId]) == null ? void 0 : _B[t2.userId]) == null ? void 0 : _C.participantCreated(e2, t2), void ((_D = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _D.participantCreated(e2, t2));
|
|
2092
2116
|
case "participant.deleted":
|
|
2093
|
-
return void ((
|
|
2117
|
+
return (_F = (_E = this.participantDataStores[t2.conversationId]) == null ? void 0 : _E[t2.userId]) == null ? void 0 : _F.participantDeleted(e2, t2), void ((_G = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _G.participantDeleted(e2, t2));
|
|
2094
2118
|
case "user.online.changed":
|
|
2095
|
-
return void ((
|
|
2119
|
+
return void ((_H = this.storeMap[`/users/${t2.userId}/online`]) == null ? void 0 : _H.userOnlineChanged(e2, t2));
|
|
2096
2120
|
case "virtual.conversations.loadedmore":
|
|
2097
|
-
return void ((
|
|
2121
|
+
return void ((_I = this.storeMap["/me/conversations"]) == null ? void 0 : _I.loadedMore(e2, t2));
|
|
2098
2122
|
case "virtual.messages.loadedmore":
|
|
2099
|
-
return void ((
|
|
2123
|
+
return void ((_J = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _J.loadedMore(e2, t2));
|
|
2100
2124
|
case "virtual.participants.loadedmore":
|
|
2101
|
-
return void ((
|
|
2125
|
+
return void ((_K = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _K.loadedMore(e2, t2));
|
|
2102
2126
|
}
|
|
2103
2127
|
}
|
|
2104
2128
|
call(_0) {
|
|
2105
|
-
return __async(this, arguments, function* ({ method: t2, path: s2, data: n2, headers:
|
|
2106
|
-
|
|
2107
|
-
|
|
2129
|
+
return __async(this, arguments, function* ({ method: t2, path: s2, data: n2, headers: a2, flags: r2 }) {
|
|
2130
|
+
var _a2;
|
|
2131
|
+
if (true !== (r2 == null ? void 0 : r2.bypassCache) && "GET" === t2) {
|
|
2132
|
+
const t3 = Pe(s2);
|
|
2108
2133
|
if (t3 in this.storeMap) {
|
|
2109
2134
|
const e2 = t3, s3 = this.storeMap[e2];
|
|
2110
2135
|
if (s3 && "getFromCache" in s3) {
|
|
@@ -2120,44 +2145,44 @@ class Fe {
|
|
|
2120
2145
|
if ("NOT_IN_CACHE" !== t4.value) return t4;
|
|
2121
2146
|
}
|
|
2122
2147
|
} else if (e(s2, ["me", "conversations", "*", "participants", "*"])) {
|
|
2123
|
-
const e2 = this.
|
|
2148
|
+
const e2 = (_a2 = this.participantDataStores[s2[2]]) == null ? void 0 : _a2[s2[4]];
|
|
2124
2149
|
if (e2) {
|
|
2125
2150
|
yield this.sync();
|
|
2126
|
-
const t4 = yield e2.
|
|
2151
|
+
const t4 = yield e2.getFromCache();
|
|
2127
2152
|
if ("NOT_IN_CACHE" !== t4.value) return t4;
|
|
2128
2153
|
}
|
|
2129
2154
|
} else if (e(s2, ["me", "conversations", "*"])) {
|
|
2130
|
-
const e2 = this.
|
|
2155
|
+
const e2 = this.convDataStores[s2[2]];
|
|
2131
2156
|
if (e2) {
|
|
2132
2157
|
yield this.sync();
|
|
2133
|
-
const t4 = yield e2.
|
|
2158
|
+
const t4 = yield e2.getFromCache();
|
|
2134
2159
|
if ("NOT_IN_CACHE" !== t4.value) return t4;
|
|
2135
2160
|
}
|
|
2136
2161
|
}
|
|
2137
2162
|
}
|
|
2138
|
-
return this.connection.call({ method: t2, path: s2, data: n2, headers:
|
|
2163
|
+
return this.connection.call({ method: t2, path: s2, data: n2, headers: a2 != null ? a2 : {} });
|
|
2139
2164
|
});
|
|
2140
2165
|
}
|
|
2141
2166
|
subscribe(e2, t2) {
|
|
2142
|
-
const s2 = this.getOrCreateStore(e2), n2 =
|
|
2167
|
+
const s2 = this.getOrCreateStore(e2), n2 = r(), a2 = r();
|
|
2143
2168
|
n2.promise.catch(() => {
|
|
2144
|
-
}),
|
|
2169
|
+
}), a2.promise.catch(() => {
|
|
2145
2170
|
});
|
|
2146
|
-
const i2 = { state: { type: "pending", latestSnapshot: void 0 }, connected: n2.promise, terminated:
|
|
2171
|
+
const i2 = { state: { type: "pending", latestSnapshot: void 0 }, connected: n2.promise, terminated: a2.promise, loadMore: (e3) => __async(this, null, function* () {
|
|
2147
2172
|
"loadMore" in s2 && (yield s2.loadMore(e3));
|
|
2148
2173
|
}), unsubscribe: () => {
|
|
2149
2174
|
} }, o2 = s2.listen((s3) => {
|
|
2150
2175
|
if (s3.ok) {
|
|
2151
|
-
const e3 = !("loadedAll" in s3.value) || s3.value.loadedAll,
|
|
2152
|
-
i2.state =
|
|
2176
|
+
const e3 = !("loadedAll" in s3.value) || s3.value.loadedAll, a3 = { type: "active", latestSnapshot: s3.value.snapshot, loadedAll: e3 };
|
|
2177
|
+
i2.state = a3, t2 == null ? void 0 : t2(s3.value.snapshot, e3), n2.resolve(a3);
|
|
2153
2178
|
} else if ("pending" === i2.state.type || "active" === i2.state.type) {
|
|
2154
2179
|
if ("server" === s3.where) {
|
|
2155
|
-
const t3 = { type: "error", error: new Error(
|
|
2156
|
-
return i2.state = t3,
|
|
2180
|
+
const t3 = { type: "error", error: new Error(p(`Subscribe to ${e2.join("/")}`, s3.value)) };
|
|
2181
|
+
return i2.state = t3, a2.resolve(t3), void n2.reject("Subscription encountered an error during initial connection");
|
|
2157
2182
|
}
|
|
2158
2183
|
if ("SESSION_DESTROYED" === s3.value) {
|
|
2159
2184
|
const e3 = { type: "error", error: new Error("Session was destroyed causing all subscriptions to be terminated") };
|
|
2160
|
-
return i2.state = e3,
|
|
2185
|
+
return i2.state = e3, a2.resolve(e3), void n2.reject("Subscription encountered an error during initial connection");
|
|
2161
2186
|
}
|
|
2162
2187
|
if ("UNSUBSCRIBED" === s3.value) return;
|
|
2163
2188
|
if ("TERMINATED" === s3.value) return;
|
|
@@ -2168,7 +2193,7 @@ class Fe {
|
|
|
2168
2193
|
if ("pending" === i2.state.type || "active" === i2.state.type) {
|
|
2169
2194
|
o2();
|
|
2170
2195
|
const e3 = { type: "unsubscribed" };
|
|
2171
|
-
i2.state = e3,
|
|
2196
|
+
i2.state = e3, a2.resolve(e3), n2.reject("Subscription was unsubscribed before connecting");
|
|
2172
2197
|
}
|
|
2173
2198
|
}, i2;
|
|
2174
2199
|
}
|
|
@@ -2180,7 +2205,7 @@ class Fe {
|
|
|
2180
2205
|
});
|
|
2181
2206
|
}
|
|
2182
2207
|
getOrCreateStore(e2) {
|
|
2183
|
-
const t2 =
|
|
2208
|
+
const t2 = Pe(e2);
|
|
2184
2209
|
if (t2 in this.storeMap) return this.storeMap[t2];
|
|
2185
2210
|
this.connection.subscribe(e2).then((e3) => {
|
|
2186
2211
|
e3.ok || s2.setError(e3);
|
|
@@ -2191,19 +2216,20 @@ class Fe {
|
|
|
2191
2216
|
return this.storeMap[t2] = s2, s2;
|
|
2192
2217
|
}
|
|
2193
2218
|
destroy() {
|
|
2194
|
-
this.storeMap = {}, this.convDataStores = {}, this.connection.destroy();
|
|
2219
|
+
this.storeMap = {}, this.convDataStores = {}, this.participantDataStores = {}, this.connection.destroy();
|
|
2195
2220
|
}
|
|
2196
2221
|
isConnected() {
|
|
2197
2222
|
return this.connection.isConnected();
|
|
2198
2223
|
}
|
|
2199
2224
|
instantiateStore(t2, s2) {
|
|
2200
|
-
if (e(t2, ["users", "*"])) return new
|
|
2201
|
-
if (e(t2, ["me", "conversations", "*"])) return new
|
|
2225
|
+
if (e(t2, ["users", "*"])) return new ue(this.virtualSeq, t2[1], this.realtimeClient, this.emitMutex, { onTeardown: s2 });
|
|
2226
|
+
if (e(t2, ["me", "conversations", "*"])) return new be(this.virtualSeq, this.subscribeConvData(t2[2]), this.realtimeClient, this.emitMutex, { onTeardown: s2 });
|
|
2202
2227
|
if (e(t2, ["me", "conversations", "*", "messages"])) return new fe(this.virtualSeq, t2[2], this.realtimeClient, this.emitMutex, { onTeardown: s2, onLoadedMore: (e2) => this.onVirtualPublish(e2) });
|
|
2203
|
-
if (e(t2, ["me", "conversations", "*", "participants"])) return new
|
|
2204
|
-
if (e(t2, ["me", "conversations", "*", "
|
|
2205
|
-
if (e(t2, ["me", "conversations"])) return new
|
|
2206
|
-
if (e(t2, ["
|
|
2228
|
+
if (e(t2, ["me", "conversations", "*", "participants"])) return new Ie(this.virtualSeq, (e2) => this.subscribeParticipantData(t2[2], e2), t2[2], this.realtimeClient, this.emitMutex, { onTeardown: s2, onLoadedMore: (e2) => this.onVirtualPublish(e2) });
|
|
2229
|
+
if (e(t2, ["me", "conversations", "*", "participants", "*"])) return new _e(this.virtualSeq, this.subscribeParticipantData(t2[2], t2[4]), this.realtimeClient, this.emitMutex, { onTeardown: s2 });
|
|
2230
|
+
if (e(t2, ["me", "conversations", "*", "typing"])) return new ke(this.virtualSeq, t2[2], this.realtimeClient, this.emitMutex, { onTeardown: s2 });
|
|
2231
|
+
if (e(t2, ["me", "conversations"])) return new Ee(this.virtualSeq, (e2) => this.subscribeConvData(e2), this.realtimeClient, this.emitMutex, { onTeardown: s2, onLoadedMore: (e2) => this.onVirtualPublish(e2) });
|
|
2232
|
+
if (e(t2, ["users", "*", "online"])) return new De(this.virtualSeq, t2[1], this.realtimeClient, this.emitMutex, { onTeardown: s2 });
|
|
2207
2233
|
throw "Unreachable";
|
|
2208
2234
|
}
|
|
2209
2235
|
subscribeConvData(e2) {
|
|
@@ -2212,16 +2238,25 @@ class Fe {
|
|
|
2212
2238
|
const e3 = this.convDataStores[t2];
|
|
2213
2239
|
return { store: e3, unsubscribe: e3.registerInternalSubscription() };
|
|
2214
2240
|
}
|
|
2215
|
-
const s2 = new
|
|
2241
|
+
const s2 = new Ne(this.virtualSeq, e2, this.realtimeClient, this.emitMutex, { onTeardown: () => {
|
|
2216
2242
|
delete this.convDataStores[t2];
|
|
2217
2243
|
} });
|
|
2218
2244
|
return this.convDataStores[t2] = s2, { store: s2, unsubscribe: s2.registerInternalSubscription() };
|
|
2219
2245
|
}
|
|
2246
|
+
subscribeParticipantData(e2, t2) {
|
|
2247
|
+
var _a2, _b2;
|
|
2248
|
+
const s2 = "string" == typeof t2 ? t2 : t2.id, n2 = (_a2 = this.participantDataStores[e2]) == null ? void 0 : _a2[s2];
|
|
2249
|
+
if (n2) return { store: n2, unsubscribe: n2.registerInternalSubscription() };
|
|
2250
|
+
const a2 = (_b2 = this.participantDataStores[e2]) != null ? _b2 : {}, r2 = new Ce(this.virtualSeq, e2, t2, this.realtimeClient, this.emitMutex, { onTeardown: () => {
|
|
2251
|
+
delete a2[s2], 0 === Object.keys(a2).length && delete this.participantDataStores[e2];
|
|
2252
|
+
} });
|
|
2253
|
+
return a2[s2] = r2, this.participantDataStores[e2] = a2, { store: r2, unsubscribe: r2.registerInternalSubscription() };
|
|
2254
|
+
}
|
|
2220
2255
|
}
|
|
2221
|
-
function
|
|
2256
|
+
function Pe(e2) {
|
|
2222
2257
|
return `/${e2.join("/")}`;
|
|
2223
2258
|
}
|
|
2224
|
-
class
|
|
2259
|
+
class je {
|
|
2225
2260
|
constructor(e2, t2) {
|
|
2226
2261
|
this.id = e2, this._realtimeClient = t2;
|
|
2227
2262
|
}
|
|
@@ -2231,21 +2266,21 @@ class Re {
|
|
|
2231
2266
|
get() {
|
|
2232
2267
|
return __async(this, null, function* () {
|
|
2233
2268
|
const e2 = yield this._realtimeClient.getUser(this.brandedId);
|
|
2234
|
-
return
|
|
2269
|
+
return ta("Get user " + this.id, e2);
|
|
2235
2270
|
});
|
|
2236
2271
|
}
|
|
2237
2272
|
set(e2) {
|
|
2238
2273
|
return __async(this, null, function* () {
|
|
2239
2274
|
null === e2.role && (e2.role = "default");
|
|
2240
2275
|
const t2 = "string" == typeof e2.email ? [e2.email] : e2.email, s2 = "string" == typeof e2.phone ? [e2.phone] : e2.phone, n2 = yield this._realtimeClient.call({ method: "PUT", path: ["users", this.brandedId], data: __spreadProps(__spreadValues({}, e2), { email: t2, phone: s2 }) });
|
|
2241
|
-
|
|
2276
|
+
d("Set user " + this.id, n2);
|
|
2242
2277
|
});
|
|
2243
2278
|
}
|
|
2244
2279
|
createIfNotExists(e2) {
|
|
2245
2280
|
return __async(this, null, function* () {
|
|
2246
2281
|
void 0 === e2.role && (e2.role = "default");
|
|
2247
2282
|
const t2 = "string" == typeof e2.email ? [e2.email] : e2.email, s2 = "string" == typeof e2.phone ? [e2.phone] : e2.phone, n2 = yield this._realtimeClient.call({ method: "POST", path: ["users", this.brandedId], data: __spreadProps(__spreadValues({}, e2), { email: t2, phone: s2 }) });
|
|
2248
|
-
(n2.ok || "server" !== n2.where || 409 != n2.value.status) &&
|
|
2283
|
+
(n2.ok || "server" !== n2.where || 409 != n2.value.status) && d(`Create user ${this.id} if not exists`, n2);
|
|
2249
2284
|
});
|
|
2250
2285
|
}
|
|
2251
2286
|
subscribe(e2) {
|
|
@@ -2255,7 +2290,7 @@ class Re {
|
|
|
2255
2290
|
return this._realtimeClient.subscribe(["users", this.brandedId, "online"], e2);
|
|
2256
2291
|
}
|
|
2257
2292
|
}
|
|
2258
|
-
class
|
|
2293
|
+
class $e {
|
|
2259
2294
|
constructor(e2, t2, s2) {
|
|
2260
2295
|
this.userId = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
2261
2296
|
}
|
|
@@ -2270,44 +2305,47 @@ class Ne {
|
|
|
2270
2305
|
const e2 = yield this._realtimeClient.call({ method: "GET", path: ["me", "conversations", this.brandedConversationId, "participants", this.brandedUserId], data: {} }), t2 = yield this._realtimeClient.call({ method: "GET", path: ["users", this.brandedUserId], data: { includePrivateFields: false } }), [s2, n2] = yield Promise.all([e2, t2]);
|
|
2271
2306
|
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return null;
|
|
2272
2307
|
if (!n2.ok && "server" === n2.where && 404 === n2.value.status) return null;
|
|
2273
|
-
return
|
|
2308
|
+
return le(d(`Get participant ${this.userId} in conversation ${this.conversationId}`, s2), ce(d(`Get user ${this.userId}`, n2)));
|
|
2274
2309
|
});
|
|
2275
2310
|
}
|
|
2276
2311
|
set() {
|
|
2277
2312
|
return __async(this, arguments, function* (e2 = {}) {
|
|
2278
2313
|
const t2 = yield this._realtimeClient.call({ method: "PUT", path: ["conversations", this.brandedConversationId, "participants", this.brandedUserId], data: e2 });
|
|
2279
|
-
|
|
2314
|
+
d(`Set participant ${this.userId} in conversation ${this.conversationId}`, t2);
|
|
2280
2315
|
});
|
|
2281
2316
|
}
|
|
2282
2317
|
edit() {
|
|
2283
2318
|
return __async(this, arguments, function* (e2 = {}) {
|
|
2284
2319
|
const t2 = yield this._realtimeClient.call({ method: "PATCH", path: ["conversations", this.brandedConversationId, "participants", this.brandedUserId], data: e2 });
|
|
2285
|
-
|
|
2320
|
+
d(`Edit participant ${this.userId} in conversation ${this.conversationId}`, t2);
|
|
2286
2321
|
});
|
|
2287
2322
|
}
|
|
2288
2323
|
createIfNotExists() {
|
|
2289
2324
|
return __async(this, arguments, function* (e2 = {}) {
|
|
2290
2325
|
const t2 = yield this._realtimeClient.call({ method: "POST", path: ["conversations", this.brandedConversationId, "participants", this.brandedUserId], data: e2 });
|
|
2291
|
-
(t2.ok || "server" !== t2.where || 409 !== t2.value.status) &&
|
|
2326
|
+
(t2.ok || "server" !== t2.where || 409 !== t2.value.status) && d(`Add participant ${this.userId} to conversation ${this.conversationId}`, t2);
|
|
2292
2327
|
});
|
|
2293
2328
|
}
|
|
2294
2329
|
delete() {
|
|
2295
2330
|
return __async(this, null, function* () {
|
|
2296
2331
|
const e2 = yield this._realtimeClient.call({ method: "DELETE", path: ["conversations", this.brandedConversationId, "participants", this.brandedUserId], data: {} });
|
|
2297
|
-
(e2.ok || "server" !== e2.where || 404 !== e2.value.status) &&
|
|
2332
|
+
(e2.ok || "server" !== e2.where || 404 !== e2.value.status) && d(`Remove participant ${this.userId} from conversation ${this.conversationId}`, e2);
|
|
2298
2333
|
});
|
|
2299
2334
|
}
|
|
2335
|
+
subscribe(e2) {
|
|
2336
|
+
return this._realtimeClient.subscribe(["me", "conversations", this.brandedConversationId, "participants", this.brandedUserId], e2);
|
|
2337
|
+
}
|
|
2300
2338
|
}
|
|
2301
|
-
function
|
|
2339
|
+
function Ue(e2) {
|
|
2302
2340
|
const t2 = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
|
|
2303
2341
|
let s2 = 0;
|
|
2304
|
-
const n2 = [],
|
|
2342
|
+
const n2 = [], a2 = e2 === s2;
|
|
2305
2343
|
s2 = e2;
|
|
2306
|
-
const
|
|
2307
|
-
for (let s3 = 7; s3 >= 0; s3--)
|
|
2344
|
+
const r2 = new Array(8);
|
|
2345
|
+
for (let s3 = 7; s3 >= 0; s3--) r2[s3] = t2.charAt(e2 % 64), e2 = Math.floor(e2 / 64);
|
|
2308
2346
|
if (0 !== e2) throw new Error("We should have converted the entire timestamp.");
|
|
2309
|
-
let i2 =
|
|
2310
|
-
if (
|
|
2347
|
+
let i2 = r2.join("");
|
|
2348
|
+
if (a2) {
|
|
2311
2349
|
let e3;
|
|
2312
2350
|
for (e3 = 11; e3 >= 0 && 63 === n2[e3]; e3--) n2[e3] = 0;
|
|
2313
2351
|
n2[e3]++;
|
|
@@ -2316,9 +2354,9 @@ function _e(e2) {
|
|
|
2316
2354
|
if (20 != i2.length) throw new Error("Length should be 20.");
|
|
2317
2355
|
return i2;
|
|
2318
2356
|
}
|
|
2319
|
-
const
|
|
2357
|
+
const We = (e2, t2, s2 = void 0) => (function(e3, t3) {
|
|
2320
2358
|
return e3.reduce((e4, s3, n2) => e4.concat(t3(s3, n2)), []);
|
|
2321
|
-
}(e2, (e3) => {
|
|
2359
|
+
})(e2, (e3) => {
|
|
2322
2360
|
if ("string" == typeof e3) return t2(e3, s2);
|
|
2323
2361
|
switch (e3.type) {
|
|
2324
2362
|
case "bold":
|
|
@@ -2329,14 +2367,14 @@ const Oe = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
2329
2367
|
case "bulletList":
|
|
2330
2368
|
case "bulletpoint":
|
|
2331
2369
|
case "bulletPoint":
|
|
2332
|
-
return [{ type: e3.type, children:
|
|
2370
|
+
return [{ type: e3.type, children: We(e3.children, t2, e3.type) }];
|
|
2333
2371
|
case "link":
|
|
2334
|
-
return [{ type: e3.type, url: e3.url, children:
|
|
2372
|
+
return [{ type: e3.type, url: e3.url, children: We(e3.children, t2, e3.type) }];
|
|
2335
2373
|
case "actionlink":
|
|
2336
2374
|
case "actionLink":
|
|
2337
2375
|
case "actionbutton":
|
|
2338
2376
|
case "actionButton":
|
|
2339
|
-
return [{ type: e3.type, action: e3.action, params: e3.params, children:
|
|
2377
|
+
return [{ type: e3.type, action: e3.action, params: e3.params, children: We(e3.children, t2, e3.type) }];
|
|
2340
2378
|
case "mention":
|
|
2341
2379
|
case "autolink":
|
|
2342
2380
|
case "autoLink":
|
|
@@ -2351,43 +2389,43 @@ const Oe = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
2351
2389
|
return [e3];
|
|
2352
2390
|
}
|
|
2353
2391
|
});
|
|
2354
|
-
function
|
|
2392
|
+
function qe(e2, t2) {
|
|
2355
2393
|
return (s2) => {
|
|
2356
2394
|
const n2 = s2;
|
|
2357
|
-
let
|
|
2358
|
-
const
|
|
2395
|
+
let a2 = 0;
|
|
2396
|
+
const r2 = [];
|
|
2359
2397
|
for (const i2 of Z(s2, e2)) {
|
|
2360
|
-
i2.index -
|
|
2398
|
+
i2.index - a2 > 0 && r2.push(n2.substring(a2, i2.index));
|
|
2361
2399
|
const e3 = t2(i2);
|
|
2362
|
-
Array.isArray(e3) ?
|
|
2400
|
+
Array.isArray(e3) ? r2.push(...e3) : r2.push(e3), a2 = i2.index + i2[0].length;
|
|
2363
2401
|
}
|
|
2364
|
-
return
|
|
2402
|
+
return a2 < s2.length && r2.push(s2.substring(a2)), r2;
|
|
2365
2403
|
};
|
|
2366
2404
|
}
|
|
2367
|
-
const
|
|
2368
|
-
var
|
|
2369
|
-
const
|
|
2405
|
+
const Be = "’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2406
|
+
var Le = ((e2) => (e2[e2.italic = 1] = "italic", e2[e2.strikethrough = 2] = "strikethrough", e2[e2.bold = 4] = "bold", e2))(Le || {});
|
|
2407
|
+
const Ge = [0, 1, 2, 3, 4, 5, 6].map((e2) => {
|
|
2370
2408
|
const t2 = [];
|
|
2371
2409
|
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");
|
|
2372
|
-
}),
|
|
2373
|
-
function
|
|
2374
|
-
return
|
|
2410
|
+
}), Fe = { _: 1, "*": 4, "~": 2 };
|
|
2411
|
+
function He(e2) {
|
|
2412
|
+
return Je(e2, 0);
|
|
2375
2413
|
}
|
|
2376
|
-
function
|
|
2377
|
-
const s2 =
|
|
2378
|
-
const t3 =
|
|
2414
|
+
function Je(e2, t2 = 0) {
|
|
2415
|
+
const s2 = Ge[t2], n2 = s2 ? (function(e3) {
|
|
2416
|
+
const t3 = ze.getOrCompute(e3, () => new RegExp(`(?:^|[\\s${Be}])(?:${e3.source})(?=[\\s${Be}]|$)`, "g")), s3 = qe(t3, (e4) => {
|
|
2379
2417
|
const t4 = e4[0][1], s4 = e4[1] || e4[2] || e4[3] || e4[4] || e4[5] || e4[6];
|
|
2380
|
-
return [" ", { type:
|
|
2418
|
+
return [" ", { type: Le[Fe[t4]], children: [s4] }];
|
|
2381
2419
|
});
|
|
2382
2420
|
return (e4) => {
|
|
2383
2421
|
const [t4, ...n3] = s3(" " + e4);
|
|
2384
2422
|
return t4.length > 1 && n3.unshift(t4.substring(1)), n3;
|
|
2385
2423
|
};
|
|
2386
|
-
}(s2) : () => [e2];
|
|
2387
|
-
return
|
|
2424
|
+
})(s2) : () => [e2];
|
|
2425
|
+
return We(n2(e2), (e3, s3) => "bold" === s3 || "italic" === s3 || "strikethrough" === s3 ? Je(e3, t2 | Le[s3]) : [e3]);
|
|
2388
2426
|
}
|
|
2389
|
-
const
|
|
2390
|
-
const e2 = function() {
|
|
2427
|
+
const ze = (function() {
|
|
2428
|
+
const e2 = (function() {
|
|
2391
2429
|
try {
|
|
2392
2430
|
return /* @__PURE__ */ new WeakMap();
|
|
2393
2431
|
} catch (e3) {
|
|
@@ -2395,32 +2433,52 @@ const Le = function() {
|
|
|
2395
2433
|
}, set: () => t2 };
|
|
2396
2434
|
return t2;
|
|
2397
2435
|
}
|
|
2398
|
-
}();
|
|
2436
|
+
})();
|
|
2399
2437
|
return { getOrCompute(t2, s2) {
|
|
2400
2438
|
if (e2.has(t2)) return e2.get(t2);
|
|
2401
2439
|
const n2 = s2();
|
|
2402
2440
|
return e2.set(t2, n2), n2;
|
|
2403
2441
|
} };
|
|
2404
|
-
}();
|
|
2405
|
-
function
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2442
|
+
})();
|
|
2443
|
+
var Ye = function(e2, t2) {
|
|
2444
|
+
return Ye = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e3, t3) {
|
|
2445
|
+
e3.__proto__ = t3;
|
|
2446
|
+
} || function(e3, t3) {
|
|
2447
|
+
for (var s2 in t3) Object.prototype.hasOwnProperty.call(t3, s2) && (e3[s2] = t3[s2]);
|
|
2448
|
+
}, Ye(e2, t2);
|
|
2449
|
+
};
|
|
2450
|
+
function Qe(e2, t2) {
|
|
2451
|
+
if ("function" != typeof t2 && null !== t2) throw new TypeError("Class extends value " + String(t2) + " is not a constructor or null");
|
|
2452
|
+
function s2() {
|
|
2453
|
+
this.constructor = e2;
|
|
2454
|
+
}
|
|
2455
|
+
Ye(e2, t2), e2.prototype = null === t2 ? Object.create(t2) : (s2.prototype = t2.prototype, new s2());
|
|
2456
|
+
}
|
|
2457
|
+
var Ve = function() {
|
|
2458
|
+
return Ve = Object.assign || function(e2) {
|
|
2459
|
+
for (var t2, s2 = 1, n2 = arguments.length; s2 < n2; s2++) for (var a2 in t2 = arguments[s2]) Object.prototype.hasOwnProperty.call(t2, a2) && (e2[a2] = t2[a2]);
|
|
2460
|
+
return e2;
|
|
2461
|
+
}, Ve.apply(this, arguments);
|
|
2462
|
+
};
|
|
2463
|
+
"function" == typeof SuppressedError && SuppressedError;
|
|
2464
|
+
var Ke = Object.prototype.hasOwnProperty;
|
|
2465
|
+
function Ze(e2) {
|
|
2466
|
+
return "boolean" == typeof e2;
|
|
2409
2467
|
}
|
|
2410
|
-
function
|
|
2468
|
+
function Xe(e2, t2) {
|
|
2411
2469
|
for (var s2 = e2.length - 1; s2 >= 0; s2--) true === t2(e2[s2]) && e2.splice(s2, 1);
|
|
2412
2470
|
}
|
|
2413
|
-
function
|
|
2414
|
-
throw new Error("Unhandled case for value: '"
|
|
2471
|
+
function et(e2) {
|
|
2472
|
+
throw new Error("Unhandled case for value: '".concat(e2, "'"));
|
|
2415
2473
|
}
|
|
2416
|
-
var
|
|
2474
|
+
var tt = /\s+/, st = (function() {
|
|
2417
2475
|
function e2(e3) {
|
|
2418
|
-
void 0 === e3 && (e3 = {}), this.tagName = "", this.attrs = {}, this.innerHTML = "", this.
|
|
2476
|
+
void 0 === e3 && (e3 = {}), this.tagName = "", this.attrs = {}, this.innerHTML = "", this.tagName = e3.tagName || "", this.attrs = e3.attrs || {}, this.innerHTML = e3.innerHtml || e3.innerHTML || "";
|
|
2419
2477
|
}
|
|
2420
2478
|
return e2.prototype.setTagName = function(e3) {
|
|
2421
2479
|
return this.tagName = e3, this;
|
|
2422
2480
|
}, e2.prototype.getTagName = function() {
|
|
2423
|
-
return this.tagName
|
|
2481
|
+
return this.tagName;
|
|
2424
2482
|
}, e2.prototype.setAttr = function(e3, t2) {
|
|
2425
2483
|
return this.getAttrs()[e3] = t2, this;
|
|
2426
2484
|
}, e2.prototype.getAttr = function(e3) {
|
|
@@ -2428,18 +2486,18 @@ var Ye = function() {
|
|
|
2428
2486
|
}, e2.prototype.setAttrs = function(e3) {
|
|
2429
2487
|
return Object.assign(this.getAttrs(), e3), this;
|
|
2430
2488
|
}, e2.prototype.getAttrs = function() {
|
|
2431
|
-
return this.attrs
|
|
2489
|
+
return this.attrs;
|
|
2432
2490
|
}, e2.prototype.setClass = function(e3) {
|
|
2433
2491
|
return this.setAttr("class", e3);
|
|
2434
2492
|
}, e2.prototype.addClass = function(e3) {
|
|
2435
|
-
for (var t2, s2 = this.getClass(), n2 =
|
|
2436
|
-
return this.getAttrs().class =
|
|
2493
|
+
for (var t2, s2 = this.getClass(), n2 = s2 ? s2.split(tt) : [], a2 = e3.split(tt); t2 = a2.shift(); ) -1 === n2.indexOf(t2) && n2.push(t2);
|
|
2494
|
+
return this.getAttrs().class = n2.join(" "), this;
|
|
2437
2495
|
}, e2.prototype.removeClass = function(e3) {
|
|
2438
|
-
for (var t2, s2 = this.getClass(), n2 =
|
|
2439
|
-
var
|
|
2440
|
-
-1 !==
|
|
2496
|
+
for (var t2, s2 = this.getClass(), n2 = s2 ? s2.split(tt) : [], a2 = e3.split(tt); n2.length && (t2 = a2.shift()); ) {
|
|
2497
|
+
var r2 = n2.indexOf(t2);
|
|
2498
|
+
-1 !== r2 && n2.splice(r2, 1);
|
|
2441
2499
|
}
|
|
2442
|
-
return this.getAttrs().class =
|
|
2500
|
+
return this.getAttrs().class = n2.join(" "), this;
|
|
2443
2501
|
}, e2.prototype.getClass = function() {
|
|
2444
2502
|
return this.getAttrs().class || "";
|
|
2445
2503
|
}, e2.prototype.hasClass = function(e3) {
|
|
@@ -2456,25 +2514,32 @@ var Ye = function() {
|
|
|
2456
2514
|
var e3 = this.getTagName(), t2 = this.buildAttrsStr();
|
|
2457
2515
|
return ["<", e3, t2 = t2 ? " " + t2 : "", ">", this.getInnerHtml(), "</", e3, ">"].join("");
|
|
2458
2516
|
}, e2.prototype.buildAttrsStr = function() {
|
|
2459
|
-
if (!this.attrs) return "";
|
|
2460
2517
|
var e3 = this.getAttrs(), t2 = [];
|
|
2461
|
-
for (var s2 in e3)
|
|
2518
|
+
for (var s2 in e3) Ke.call(e3, s2) && t2.push(s2 + '="' + e3[s2] + '"');
|
|
2462
2519
|
return t2.join(" ");
|
|
2463
2520
|
}, e2;
|
|
2464
|
-
}();
|
|
2465
|
-
|
|
2521
|
+
})();
|
|
2522
|
+
function nt(e2) {
|
|
2523
|
+
var t2 = "";
|
|
2524
|
+
return e2.scheme && e2.host && (t2 += e2.scheme + "://"), e2.host && (t2 += e2.host), e2.path && (t2 += "/" + e2.path), e2.query && (t2 += "?" + e2.query), e2.fragment && (t2 += "#" + e2.fragment), t2;
|
|
2525
|
+
}
|
|
2526
|
+
function at(e2, t2, s2) {
|
|
2527
|
+
var n2 = t2 / 2, a2 = Math.ceil(n2), r2 = -1 * Math.floor(n2), i2 = "";
|
|
2528
|
+
return r2 < 0 && (i2 = e2.substr(r2)), e2.substr(0, a2) + s2 + i2;
|
|
2529
|
+
}
|
|
2530
|
+
var rt = (function() {
|
|
2466
2531
|
function e2(e3) {
|
|
2467
2532
|
void 0 === e3 && (e3 = {}), this.newWindow = false, this.truncate = {}, this.className = "", this.newWindow = e3.newWindow || false, this.truncate = e3.truncate || {}, this.className = e3.className || "";
|
|
2468
2533
|
}
|
|
2469
2534
|
return e2.prototype.build = function(e3) {
|
|
2470
|
-
return new
|
|
2535
|
+
return new st({ tagName: "a", attrs: this.createAttrs(e3), innerHtml: this.processAnchorText(e3.getAnchorText()) });
|
|
2471
2536
|
}, e2.prototype.createAttrs = function(e3) {
|
|
2472
2537
|
var t2 = { href: e3.getAnchorHref() }, s2 = this.createCssClass(e3);
|
|
2473
|
-
return s2 && (t2.class = s2), this.newWindow && (t2.target = "_blank", t2.rel = "noopener noreferrer"), this.truncate
|
|
2538
|
+
return s2 && (t2.class = s2), this.newWindow && (t2.target = "_blank", t2.rel = "noopener noreferrer"), this.truncate.length && this.truncate.length < e3.getAnchorText().length && (t2.title = e3.getAnchorHref()), t2;
|
|
2474
2539
|
}, e2.prototype.createCssClass = function(e3) {
|
|
2475
2540
|
var t2 = this.className;
|
|
2476
2541
|
if (t2) {
|
|
2477
|
-
for (var s2 = [t2], n2 = e3.getCssClassSuffixes(),
|
|
2542
|
+
for (var s2 = [t2], n2 = e3.getCssClassSuffixes(), a2 = 0, r2 = n2.length; a2 < r2; a2++) s2.push(t2 + "-" + n2[a2]);
|
|
2478
2543
|
return s2.join(" ");
|
|
2479
2544
|
}
|
|
2480
2545
|
return "";
|
|
@@ -2482,64 +2547,56 @@ var Qe = function() {
|
|
|
2482
2547
|
return e3 = this.doTruncate(e3);
|
|
2483
2548
|
}, e2.prototype.doTruncate = function(e3) {
|
|
2484
2549
|
var t2 = this.truncate;
|
|
2485
|
-
if (!t2
|
|
2550
|
+
if (!t2.length) return e3;
|
|
2486
2551
|
var s2 = t2.length, n2 = t2.location;
|
|
2487
|
-
return "smart" === n2 ? function(e4, t3, s3) {
|
|
2488
|
-
var n3,
|
|
2489
|
-
null == s3 ? (s3 = "…",
|
|
2490
|
-
var a2 = function(e5) {
|
|
2491
|
-
var t4 = "";
|
|
2492
|
-
return e5.scheme && e5.host && (t4 += e5.scheme + "://"), e5.host && (t4 += e5.host), e5.path && (t4 += "/" + e5.path), e5.query && (t4 += "?" + e5.query), e5.fragment && (t4 += "#" + e5.fragment), t4;
|
|
2493
|
-
}, i2 = function(e5, t4) {
|
|
2494
|
-
var n4 = t4 / 2, r3 = Math.ceil(n4), a3 = -1 * Math.floor(n4), i3 = "";
|
|
2495
|
-
return a3 < 0 && (i3 = e5.substr(a3)), e5.substr(0, r3) + s3 + i3;
|
|
2496
|
-
};
|
|
2497
|
-
if (e4.length <= t3) return e4;
|
|
2498
|
-
var o2 = t3 - r2, u2 = function(e5) {
|
|
2552
|
+
return "smart" === n2 ? (function(e4, t3, s3) {
|
|
2553
|
+
var n3, a2;
|
|
2554
|
+
if (null == s3 ? (s3 = "…", a2 = 3, n3 = 8) : (a2 = s3.length, n3 = s3.length), e4.length <= t3) return e4;
|
|
2555
|
+
var r2 = t3 - a2, i2 = (function(e5) {
|
|
2499
2556
|
var t4 = {}, s4 = e5, n4 = s4.match(/^([a-z]+):\/\//i);
|
|
2500
|
-
return n4 && (t4.scheme = n4[1], s4 = s4.
|
|
2501
|
-
}(e4);
|
|
2502
|
-
if (
|
|
2503
|
-
var
|
|
2504
|
-
|
|
2557
|
+
return n4 && (t4.scheme = n4[1], s4 = s4.slice(n4[0].length)), (n4 = s4.match(/^(.*?)(?=(\?|#|\/|$))/i)) && (t4.host = n4[1], s4 = s4.slice(n4[0].length)), (n4 = s4.match(/^\/(.*?)(?=(\?|#|$))/i)) && (t4.path = n4[1], s4 = s4.slice(n4[0].length)), (n4 = s4.match(/^\?(.*?)(?=(#|$))/i)) && (t4.query = n4[1], s4 = s4.slice(n4[0].length)), (n4 = s4.match(/^#(.*?)$/i)) && (t4.fragment = n4[1]), t4;
|
|
2558
|
+
})(e4);
|
|
2559
|
+
if (i2.query) {
|
|
2560
|
+
var o2 = i2.query.match(/^(.*?)(?=(\?|#))(.*?)$/i);
|
|
2561
|
+
o2 && (i2.query = i2.query.substr(0, o2[1].length), e4 = nt(i2));
|
|
2505
2562
|
}
|
|
2506
2563
|
if (e4.length <= t3) return e4;
|
|
2507
|
-
if (
|
|
2564
|
+
if (i2.host && (i2.host = i2.host.replace(/^www\./, ""), e4 = nt(i2)), e4.length <= t3) return e4;
|
|
2565
|
+
var c2 = "";
|
|
2566
|
+
if (i2.host && (c2 += i2.host), c2.length >= r2) return i2.host.length === t3 ? (i2.host.substr(0, t3 - a2) + s3).substr(0, r2 + n3) : at(c2, r2, s3).substr(0, r2 + n3);
|
|
2508
2567
|
var l2 = "";
|
|
2509
|
-
if (
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
if ((l2 + h2).length >= o2) return (l2 + h2).length == t3 ? (l2 + h2).substr(0, t3) : (l2 + i2(h2, o2 - l2.length)).substr(0, o2 + n3);
|
|
2513
|
-
l2 += h2;
|
|
2568
|
+
if (i2.path && (l2 += "/" + i2.path), i2.query && (l2 += "?" + i2.query), l2) {
|
|
2569
|
+
if ((c2 + l2).length >= r2) return (c2 + l2).length == t3 ? (c2 + l2).substr(0, t3) : (c2 + at(l2, r2 - c2.length, s3)).substr(0, r2 + n3);
|
|
2570
|
+
c2 += l2;
|
|
2514
2571
|
}
|
|
2515
|
-
if (
|
|
2516
|
-
var
|
|
2517
|
-
if ((
|
|
2518
|
-
|
|
2572
|
+
if (i2.fragment) {
|
|
2573
|
+
var h2 = "#" + i2.fragment;
|
|
2574
|
+
if ((c2 + h2).length >= r2) return (c2 + h2).length == t3 ? (c2 + h2).substr(0, t3) : (c2 + at(h2, r2 - c2.length, s3)).substr(0, r2 + n3);
|
|
2575
|
+
c2 += h2;
|
|
2519
2576
|
}
|
|
2520
|
-
if (
|
|
2521
|
-
var
|
|
2522
|
-
if ((
|
|
2577
|
+
if (i2.scheme && i2.host) {
|
|
2578
|
+
var u2 = i2.scheme + "://";
|
|
2579
|
+
if ((c2 + u2).length < r2) return (u2 + c2).substr(0, t3);
|
|
2523
2580
|
}
|
|
2524
|
-
if (
|
|
2525
|
-
var
|
|
2526
|
-
return
|
|
2527
|
-
}(e3, s2) : "middle" === n2 ? function(e4, t3, s3) {
|
|
2581
|
+
if (c2.length <= t3) return c2;
|
|
2582
|
+
var d2 = "";
|
|
2583
|
+
return r2 > 0 && (d2 = c2.substr(-1 * Math.floor(r2 / 2))), (c2.substr(0, Math.ceil(r2 / 2)) + s3 + d2).substr(0, r2 + n3);
|
|
2584
|
+
})(e3, s2) : "middle" === n2 ? (function(e4, t3, s3) {
|
|
2528
2585
|
if (e4.length <= t3) return e4;
|
|
2529
|
-
var n3,
|
|
2530
|
-
null == s3 ? (s3 = "…", n3 = 8,
|
|
2531
|
-
var
|
|
2532
|
-
return
|
|
2533
|
-
}(e3, s2) : function(e4, t3, s3) {
|
|
2534
|
-
return function(e5, t4, s4) {
|
|
2586
|
+
var n3, a2;
|
|
2587
|
+
null == s3 ? (s3 = "…", n3 = 8, a2 = 3) : (n3 = s3.length, a2 = s3.length);
|
|
2588
|
+
var r2 = t3 - a2, i2 = "";
|
|
2589
|
+
return r2 > 0 && (i2 = e4.substr(-1 * Math.floor(r2 / 2))), (e4.substr(0, Math.ceil(r2 / 2)) + s3 + i2).substr(0, r2 + n3);
|
|
2590
|
+
})(e3, s2) : (function(e4, t3, s3) {
|
|
2591
|
+
return (function(e5, t4, s4) {
|
|
2535
2592
|
var n3;
|
|
2536
2593
|
return e5.length > t4 && (null == s4 ? (s4 = "…", n3 = 3) : n3 = s4.length, e5 = e5.substring(0, t4 - n3) + s4), e5;
|
|
2537
|
-
}(e4, t3, s3);
|
|
2538
|
-
}(e3, s2);
|
|
2594
|
+
})(e4, t3, s3);
|
|
2595
|
+
})(e3, s2);
|
|
2539
2596
|
}, e2;
|
|
2540
|
-
}(),
|
|
2597
|
+
})(), it = (function() {
|
|
2541
2598
|
function e2(e3) {
|
|
2542
|
-
this.
|
|
2599
|
+
this._ = null, this.matchedText = "", this.offset = 0, this.tagBuilder = e3.tagBuilder, this.matchedText = e3.matchedText, this.offset = e3.offset;
|
|
2543
2600
|
}
|
|
2544
2601
|
return e2.prototype.getMatchedText = function() {
|
|
2545
2602
|
return this.matchedText;
|
|
@@ -2548,34 +2605,98 @@ var Qe = function() {
|
|
|
2548
2605
|
}, e2.prototype.getOffset = function() {
|
|
2549
2606
|
return this.offset;
|
|
2550
2607
|
}, e2.prototype.getCssClassSuffixes = function() {
|
|
2551
|
-
return [this.
|
|
2608
|
+
return [this.type];
|
|
2552
2609
|
}, e2.prototype.buildTag = function() {
|
|
2553
2610
|
return this.tagBuilder.build(this);
|
|
2554
2611
|
}, e2;
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
}
|
|
2562
|
-
function
|
|
2563
|
-
|
|
2564
|
-
|
|
2612
|
+
})();
|
|
2613
|
+
function ot(e2) {
|
|
2614
|
+
return e2 >= 65 && e2 <= 90 || e2 >= 97 && e2 <= 122;
|
|
2615
|
+
}
|
|
2616
|
+
function ct(e2) {
|
|
2617
|
+
return e2 >= 48 && e2 <= 57;
|
|
2618
|
+
}
|
|
2619
|
+
function lt(e2) {
|
|
2620
|
+
return 34 == e2 || 39 == e2;
|
|
2621
|
+
}
|
|
2622
|
+
function ht(e2) {
|
|
2623
|
+
return e2 < 8232 ? e2 < 160 ? e2 >= 9 && e2 <= 13 || 32 == e2 : e2 < 5760 ? 160 == e2 : 5760 == e2 || e2 >= 8192 && e2 <= 8202 : e2 < 8287 ? e2 >= 8232 && e2 <= 8233 || 8239 == e2 : e2 < 12288 ? 8287 == e2 : 12288 == e2 || 65279 == e2;
|
|
2624
|
+
}
|
|
2625
|
+
function ut(e2) {
|
|
2626
|
+
return e2 < 4800 ? e2 < 2949 ? e2 < 2451 ? e2 < 1425 ? e2 < 768 ? e2 < 192 ? e2 < 169 ? e2 < 65 ? e2 >= 48 && e2 <= 57 : e2 >= 65 && e2 <= 90 || e2 >= 97 && e2 <= 122 : e2 < 181 ? e2 >= 169 && e2 <= 170 || 174 == e2 : 181 == e2 || 186 == e2 : e2 < 710 ? e2 < 216 ? e2 >= 192 && e2 <= 214 : e2 >= 216 && e2 <= 246 || e2 >= 248 && e2 <= 705 : e2 < 748 ? e2 >= 710 && e2 <= 721 || e2 >= 736 && e2 <= 740 : 748 == e2 || 750 == e2 : e2 < 910 ? e2 < 895 ? e2 < 886 ? e2 >= 768 && e2 <= 884 : e2 >= 886 && e2 <= 887 || e2 >= 890 && e2 <= 893 : e2 < 904 ? 895 == e2 || 902 == e2 : e2 >= 904 && e2 <= 906 || 908 == e2 : e2 < 1155 ? e2 < 931 ? e2 >= 910 && e2 <= 929 : e2 >= 931 && e2 <= 1013 || e2 >= 1015 && e2 <= 1153 : e2 < 1369 ? e2 >= 1155 && e2 <= 1327 || e2 >= 1329 && e2 <= 1366 : 1369 == e2 || e2 >= 1377 && e2 <= 1415 : e2 < 1808 ? e2 < 1552 ? e2 < 1476 ? e2 < 1471 ? e2 >= 1425 && e2 <= 1469 : 1471 == e2 || e2 >= 1473 && e2 <= 1474 : e2 < 1488 ? e2 >= 1476 && e2 <= 1477 || 1479 == e2 : e2 >= 1488 && e2 <= 1514 || e2 >= 1520 && e2 <= 1522 : e2 < 1749 ? e2 < 1568 ? e2 >= 1552 && e2 <= 1562 : e2 >= 1568 && e2 <= 1641 || e2 >= 1646 && e2 <= 1747 : e2 < 1770 ? e2 >= 1749 && e2 <= 1756 || e2 >= 1759 && e2 <= 1768 : e2 >= 1770 && e2 <= 1788 || 1791 == e2 : e2 < 2230 ? e2 < 2042 ? e2 < 1869 ? e2 >= 1808 && e2 <= 1866 : e2 >= 1869 && e2 <= 1969 || e2 >= 1984 && e2 <= 2037 : e2 < 2112 ? 2042 == e2 || e2 >= 2048 && e2 <= 2093 : e2 >= 2112 && e2 <= 2139 || e2 >= 2208 && e2 <= 2228 : e2 < 2406 ? e2 < 2260 ? e2 >= 2230 && e2 <= 2237 : e2 >= 2260 && e2 <= 2273 || e2 >= 2275 && e2 <= 2403 : e2 < 2437 ? e2 >= 2406 && e2 <= 2415 || e2 >= 2417 && e2 <= 2435 : e2 >= 2437 && e2 <= 2444 || e2 >= 2447 && e2 <= 2448 : e2 < 2693 ? e2 < 2579 ? e2 < 2519 ? e2 < 2486 ? e2 < 2474 ? e2 >= 2451 && e2 <= 2472 : e2 >= 2474 && e2 <= 2480 || 2482 == e2 : e2 < 2503 ? e2 >= 2486 && e2 <= 2489 || e2 >= 2492 && e2 <= 2500 : e2 >= 2503 && e2 <= 2504 || e2 >= 2507 && e2 <= 2510 : e2 < 2534 ? e2 < 2524 ? 2519 == e2 : e2 >= 2524 && e2 <= 2525 || e2 >= 2527 && e2 <= 2531 : e2 < 2565 ? e2 >= 2534 && e2 <= 2545 || e2 >= 2561 && e2 <= 2563 : e2 >= 2565 && e2 <= 2570 || e2 >= 2575 && e2 <= 2576 : e2 < 2631 ? e2 < 2613 ? e2 < 2602 ? e2 >= 2579 && e2 <= 2600 : e2 >= 2602 && e2 <= 2608 || e2 >= 2610 && e2 <= 2611 : e2 < 2620 ? e2 >= 2613 && e2 <= 2614 || e2 >= 2616 && e2 <= 2617 : 2620 == e2 || e2 >= 2622 && e2 <= 2626 : e2 < 2649 ? e2 < 2635 ? e2 >= 2631 && e2 <= 2632 : e2 >= 2635 && e2 <= 2637 || 2641 == e2 : e2 < 2662 ? e2 >= 2649 && e2 <= 2652 || 2654 == e2 : e2 >= 2662 && e2 <= 2677 || e2 >= 2689 && e2 <= 2691 : e2 < 2821 ? e2 < 2759 ? e2 < 2730 ? e2 < 2703 ? e2 >= 2693 && e2 <= 2701 : e2 >= 2703 && e2 <= 2705 || e2 >= 2707 && e2 <= 2728 : e2 < 2741 ? e2 >= 2730 && e2 <= 2736 || e2 >= 2738 && e2 <= 2739 : e2 >= 2741 && e2 <= 2745 || e2 >= 2748 && e2 <= 2757 : e2 < 2784 ? e2 < 2763 ? e2 >= 2759 && e2 <= 2761 : e2 >= 2763 && e2 <= 2765 || 2768 == e2 : e2 < 2809 ? e2 >= 2784 && e2 <= 2787 || e2 >= 2790 && e2 <= 2799 : 2809 == e2 || e2 >= 2817 && e2 <= 2819 : e2 < 2887 ? e2 < 2858 ? e2 < 2831 ? e2 >= 2821 && e2 <= 2828 : e2 >= 2831 && e2 <= 2832 || e2 >= 2835 && e2 <= 2856 : e2 < 2869 ? e2 >= 2858 && e2 <= 2864 || e2 >= 2866 && e2 <= 2867 : e2 >= 2869 && e2 <= 2873 || e2 >= 2876 && e2 <= 2884 : e2 < 2911 ? e2 < 2902 ? e2 >= 2887 && e2 <= 2888 || e2 >= 2891 && e2 <= 2893 : e2 >= 2902 && e2 <= 2903 || e2 >= 2908 && e2 <= 2909 : e2 < 2929 ? e2 >= 2911 && e2 <= 2915 || e2 >= 2918 && e2 <= 2927 : 2929 == e2 || e2 >= 2946 && e2 <= 2947 : e2 < 3517 ? e2 < 3205 ? e2 < 3046 ? e2 < 2984 ? e2 < 2969 ? e2 < 2958 ? e2 >= 2949 && e2 <= 2954 : e2 >= 2958 && e2 <= 2960 || e2 >= 2962 && e2 <= 2965 : e2 < 2974 ? e2 >= 2969 && e2 <= 2970 || 2972 == e2 : e2 >= 2974 && e2 <= 2975 || e2 >= 2979 && e2 <= 2980 : e2 < 3014 ? e2 < 2990 ? e2 >= 2984 && e2 <= 2986 : e2 >= 2990 && e2 <= 3001 || e2 >= 3006 && e2 <= 3010 : e2 < 3024 ? e2 >= 3014 && e2 <= 3016 || e2 >= 3018 && e2 <= 3021 : 3024 == e2 || 3031 == e2 : e2 < 3142 ? e2 < 3086 ? e2 < 3072 ? e2 >= 3046 && e2 <= 3055 : e2 >= 3072 && e2 <= 3075 || e2 >= 3077 && e2 <= 3084 : e2 < 3114 ? e2 >= 3086 && e2 <= 3088 || e2 >= 3090 && e2 <= 3112 : e2 >= 3114 && e2 <= 3129 || e2 >= 3133 && e2 <= 3140 : e2 < 3160 ? e2 < 3146 ? e2 >= 3142 && e2 <= 3144 : e2 >= 3146 && e2 <= 3149 || e2 >= 3157 && e2 <= 3158 : e2 < 3174 ? e2 >= 3160 && e2 <= 3162 || e2 >= 3168 && e2 <= 3171 : e2 >= 3174 && e2 <= 3183 || e2 >= 3200 && e2 <= 3203 : e2 < 3333 ? e2 < 3274 ? e2 < 3242 ? e2 < 3214 ? e2 >= 3205 && e2 <= 3212 : e2 >= 3214 && e2 <= 3216 || e2 >= 3218 && e2 <= 3240 : e2 < 3260 ? e2 >= 3242 && e2 <= 3251 || e2 >= 3253 && e2 <= 3257 : e2 >= 3260 && e2 <= 3268 || e2 >= 3270 && e2 <= 3272 : e2 < 3296 ? e2 < 3285 ? e2 >= 3274 && e2 <= 3277 : e2 >= 3285 && e2 <= 3286 || 3294 == e2 : e2 < 3313 ? e2 >= 3296 && e2 <= 3299 || e2 >= 3302 && e2 <= 3311 : e2 >= 3313 && e2 <= 3314 || e2 >= 3329 && e2 <= 3331 : e2 < 3423 ? e2 < 3389 ? e2 < 3342 ? e2 >= 3333 && e2 <= 3340 : e2 >= 3342 && e2 <= 3344 || e2 >= 3346 && e2 <= 3386 : e2 < 3402 ? e2 >= 3389 && e2 <= 3396 || e2 >= 3398 && e2 <= 3400 : e2 >= 3402 && e2 <= 3406 || e2 >= 3412 && e2 <= 3415 : e2 < 3458 ? e2 < 3430 ? e2 >= 3423 && e2 <= 3427 : e2 >= 3430 && e2 <= 3439 || e2 >= 3450 && e2 <= 3455 : e2 < 3482 ? e2 >= 3458 && e2 <= 3459 || e2 >= 3461 && e2 <= 3478 : e2 >= 3482 && e2 <= 3505 || e2 >= 3507 && e2 <= 3515 : e2 < 3804 ? e2 < 3722 ? e2 < 3570 ? e2 < 3535 ? e2 < 3520 ? 3517 == e2 : e2 >= 3520 && e2 <= 3526 || 3530 == e2 : e2 < 3544 ? e2 >= 3535 && e2 <= 3540 || 3542 == e2 : e2 >= 3544 && e2 <= 3551 || e2 >= 3558 && e2 <= 3567 : e2 < 3664 ? e2 < 3585 ? e2 >= 3570 && e2 <= 3571 : e2 >= 3585 && e2 <= 3642 || e2 >= 3648 && e2 <= 3662 : e2 < 3716 ? e2 >= 3664 && e2 <= 3673 || e2 >= 3713 && e2 <= 3714 : 3716 == e2 || e2 >= 3719 && e2 <= 3720 : e2 < 3754 ? e2 < 3737 ? e2 < 3725 ? 3722 == e2 : 3725 == e2 || e2 >= 3732 && e2 <= 3735 : e2 < 3749 ? e2 >= 3737 && e2 <= 3743 || e2 >= 3745 && e2 <= 3747 : 3749 == e2 || 3751 == e2 : e2 < 3776 ? e2 < 3757 ? e2 >= 3754 && e2 <= 3755 : e2 >= 3757 && e2 <= 3769 || e2 >= 3771 && e2 <= 3773 : e2 < 3784 ? e2 >= 3776 && e2 <= 3780 || 3782 == e2 : e2 >= 3784 && e2 <= 3789 || e2 >= 3792 && e2 <= 3801 : e2 < 4176 ? e2 < 3902 ? e2 < 3872 ? e2 < 3840 ? e2 >= 3804 && e2 <= 3807 : 3840 == e2 || e2 >= 3864 && e2 <= 3865 : e2 < 3895 ? e2 >= 3872 && e2 <= 3881 || 3893 == e2 : 3895 == e2 || 3897 == e2 : e2 < 3974 ? e2 < 3913 ? e2 >= 3902 && e2 <= 3911 : e2 >= 3913 && e2 <= 3948 || e2 >= 3953 && e2 <= 3972 : e2 < 4038 ? e2 >= 3974 && e2 <= 3991 || e2 >= 3993 && e2 <= 4028 : 4038 == e2 || e2 >= 4096 && e2 <= 4169 : e2 < 4688 ? e2 < 4301 ? e2 < 4256 ? e2 >= 4176 && e2 <= 4253 : e2 >= 4256 && e2 <= 4293 || 4295 == e2 : e2 < 4348 ? 4301 == e2 || e2 >= 4304 && e2 <= 4346 : e2 >= 4348 && e2 <= 4680 || e2 >= 4682 && e2 <= 4685 : e2 < 4746 ? e2 < 4698 ? e2 >= 4688 && e2 <= 4694 || 4696 == e2 : e2 >= 4698 && e2 <= 4701 || e2 >= 4704 && e2 <= 4744 : e2 < 4786 ? e2 >= 4746 && e2 <= 4749 || e2 >= 4752 && e2 <= 4784 : e2 >= 4786 && e2 <= 4789 || e2 >= 4792 && e2 <= 4798 : e2 < 11035 ? e2 < 7416 ? e2 < 6176 ? e2 < 5873 ? e2 < 4992 ? e2 < 4824 ? e2 < 4802 ? 4800 == e2 : e2 >= 4802 && e2 <= 4805 || e2 >= 4808 && e2 <= 4822 : e2 < 4888 ? e2 >= 4824 && e2 <= 4880 || e2 >= 4882 && e2 <= 4885 : e2 >= 4888 && e2 <= 4954 || e2 >= 4957 && e2 <= 4959 : e2 < 5121 ? e2 < 5024 ? e2 >= 4992 && e2 <= 5007 : e2 >= 5024 && e2 <= 5109 || e2 >= 5112 && e2 <= 5117 : e2 < 5761 ? e2 >= 5121 && e2 <= 5740 || e2 >= 5743 && e2 <= 5759 : e2 >= 5761 && e2 <= 5786 || e2 >= 5792 && e2 <= 5866 : e2 < 6002 ? e2 < 5920 ? e2 < 5888 ? e2 >= 5873 && e2 <= 5880 : e2 >= 5888 && e2 <= 5900 || e2 >= 5902 && e2 <= 5908 : e2 < 5984 ? e2 >= 5920 && e2 <= 5940 || e2 >= 5952 && e2 <= 5971 : e2 >= 5984 && e2 <= 5996 || e2 >= 5998 && e2 <= 6e3 : e2 < 6108 ? e2 < 6016 ? e2 >= 6002 && e2 <= 6003 : e2 >= 6016 && e2 <= 6099 || 6103 == e2 : e2 < 6155 ? e2 >= 6108 && e2 <= 6109 || e2 >= 6112 && e2 <= 6121 : e2 >= 6155 && e2 <= 6157 || e2 >= 6160 && e2 <= 6169 : e2 < 6783 ? e2 < 6512 ? e2 < 6400 ? e2 < 6272 ? e2 >= 6176 && e2 <= 6263 : e2 >= 6272 && e2 <= 6314 || e2 >= 6320 && e2 <= 6389 : e2 < 6448 ? e2 >= 6400 && e2 <= 6430 || e2 >= 6432 && e2 <= 6443 : e2 >= 6448 && e2 <= 6459 || e2 >= 6470 && e2 <= 6509 : e2 < 6608 ? e2 < 6528 ? e2 >= 6512 && e2 <= 6516 : e2 >= 6528 && e2 <= 6571 || e2 >= 6576 && e2 <= 6601 : e2 < 6688 ? e2 >= 6608 && e2 <= 6617 || e2 >= 6656 && e2 <= 6683 : e2 >= 6688 && e2 <= 6750 || e2 >= 6752 && e2 <= 6780 : e2 < 7040 ? e2 < 6832 ? e2 < 6800 ? e2 >= 6783 && e2 <= 6793 : e2 >= 6800 && e2 <= 6809 || 6823 == e2 : e2 < 6992 ? e2 >= 6832 && e2 <= 6846 || e2 >= 6912 && e2 <= 6987 : e2 >= 6992 && e2 <= 7001 || e2 >= 7019 && e2 <= 7027 : e2 < 7245 ? e2 < 7168 ? e2 >= 7040 && e2 <= 7155 : e2 >= 7168 && e2 <= 7223 || e2 >= 7232 && e2 <= 7241 : e2 < 7376 ? e2 >= 7245 && e2 <= 7293 || e2 >= 7296 && e2 <= 7304 : e2 >= 7376 && e2 <= 7378 || e2 >= 7380 && e2 <= 7414 : e2 < 8450 ? e2 < 8130 ? e2 < 8025 ? e2 < 7960 ? e2 < 7424 ? e2 >= 7416 && e2 <= 7417 : e2 >= 7424 && e2 <= 7669 || e2 >= 7675 && e2 <= 7957 : e2 < 8008 ? e2 >= 7960 && e2 <= 7965 || e2 >= 7968 && e2 <= 8005 : e2 >= 8008 && e2 <= 8013 || e2 >= 8016 && e2 <= 8023 : e2 < 8031 ? e2 < 8027 ? 8025 == e2 : 8027 == e2 || 8029 == e2 : e2 < 8118 ? e2 >= 8031 && e2 <= 8061 || e2 >= 8064 && e2 <= 8116 : e2 >= 8118 && e2 <= 8124 || 8126 == e2 : e2 < 8205 ? e2 < 8150 ? e2 < 8134 ? e2 >= 8130 && e2 <= 8132 : e2 >= 8134 && e2 <= 8140 || e2 >= 8144 && e2 <= 8147 : e2 < 8178 ? e2 >= 8150 && e2 <= 8155 || e2 >= 8160 && e2 <= 8172 : e2 >= 8178 && e2 <= 8180 || e2 >= 8182 && e2 <= 8188 : e2 < 8305 ? e2 < 8252 ? 8205 == e2 : 8252 == e2 || 8265 == e2 : e2 < 8336 ? 8305 == e2 || 8319 == e2 : e2 >= 8336 && e2 <= 8348 || e2 >= 8400 && e2 <= 8432 : e2 < 8579 ? e2 < 8486 ? e2 < 8469 ? e2 < 8455 ? 8450 == e2 : 8455 == e2 || e2 >= 8458 && e2 <= 8467 : e2 < 8482 ? 8469 == e2 || e2 >= 8473 && e2 <= 8477 : 8482 == e2 || 8484 == e2 : e2 < 8495 ? e2 < 8488 ? 8486 == e2 : 8488 == e2 || e2 >= 8490 && e2 <= 8493 : e2 < 8517 ? e2 >= 8495 && e2 <= 8505 || e2 >= 8508 && e2 <= 8511 : e2 >= 8517 && e2 <= 8521 || 8526 == e2 : e2 < 9410 ? e2 < 9e3 ? e2 < 8592 ? e2 >= 8579 && e2 <= 8580 : e2 >= 8592 && e2 <= 8703 || e2 >= 8986 && e2 <= 8987 : e2 < 9193 ? 9e3 == e2 || 9167 == e2 : e2 >= 9193 && e2 <= 9203 || e2 >= 9208 && e2 <= 9210 : e2 < 9723 ? e2 < 9654 ? 9410 == e2 || e2 >= 9642 && e2 <= 9643 : 9654 == e2 || 9664 == e2 : e2 < 10548 ? e2 >= 9723 && e2 <= 9726 || e2 >= 9728 && e2 <= 10175 : e2 >= 10548 && e2 <= 10549 || e2 >= 11013 && e2 <= 11015 : e2 < 43259 ? e2 < 12445 ? e2 < 11688 ? e2 < 11520 ? e2 < 11264 ? e2 < 11088 ? e2 >= 11035 && e2 <= 11036 : 11088 == e2 || 11093 == e2 : e2 < 11360 ? e2 >= 11264 && e2 <= 11310 || e2 >= 11312 && e2 <= 11358 : e2 >= 11360 && e2 <= 11492 || e2 >= 11499 && e2 <= 11507 : e2 < 11568 ? e2 < 11559 ? e2 >= 11520 && e2 <= 11557 : 11559 == e2 || 11565 == e2 : e2 < 11647 ? e2 >= 11568 && e2 <= 11623 || 11631 == e2 : e2 >= 11647 && e2 <= 11670 || e2 >= 11680 && e2 <= 11686 : e2 < 11744 ? e2 < 11712 ? e2 < 11696 ? e2 >= 11688 && e2 <= 11694 : e2 >= 11696 && e2 <= 11702 || e2 >= 11704 && e2 <= 11710 : e2 < 11728 ? e2 >= 11712 && e2 <= 11718 || e2 >= 11720 && e2 <= 11726 : e2 >= 11728 && e2 <= 11734 || e2 >= 11736 && e2 <= 11742 : e2 < 12330 ? e2 < 11823 ? e2 >= 11744 && e2 <= 11775 : 11823 == e2 || e2 >= 12293 && e2 <= 12294 : e2 < 12353 ? e2 >= 12330 && e2 <= 12341 || e2 >= 12347 && e2 <= 12349 : e2 >= 12353 && e2 <= 12438 || e2 >= 12441 && e2 <= 12442 : e2 < 42512 ? e2 < 12951 ? e2 < 12549 ? e2 < 12449 ? e2 >= 12445 && e2 <= 12447 : e2 >= 12449 && e2 <= 12538 || e2 >= 12540 && e2 <= 12543 : e2 < 12704 ? e2 >= 12549 && e2 <= 12589 || e2 >= 12593 && e2 <= 12686 : e2 >= 12704 && e2 <= 12730 || e2 >= 12784 && e2 <= 12799 : e2 < 19968 ? e2 < 12953 ? 12951 == e2 : 12953 == e2 || e2 >= 13312 && e2 <= 19893 : e2 < 42192 ? e2 >= 19968 && e2 <= 40917 || e2 >= 40960 && e2 <= 42124 : e2 >= 42192 && e2 <= 42237 || e2 >= 42240 && e2 <= 42508 : e2 < 42891 ? e2 < 42623 ? e2 < 42560 ? e2 >= 42512 && e2 <= 42539 : e2 >= 42560 && e2 <= 42610 || e2 >= 42612 && e2 <= 42621 : e2 < 42775 ? e2 >= 42623 && e2 <= 42725 || e2 >= 42736 && e2 <= 42737 : e2 >= 42775 && e2 <= 42783 || e2 >= 42786 && e2 <= 42888 : e2 < 43072 ? e2 < 42928 ? e2 >= 42891 && e2 <= 42926 : e2 >= 42928 && e2 <= 42935 || e2 >= 42999 && e2 <= 43047 : e2 < 43216 ? e2 >= 43072 && e2 <= 43123 || e2 >= 43136 && e2 <= 43205 : e2 >= 43216 && e2 <= 43225 || e2 >= 43232 && e2 <= 43255 : e2 < 55243 ? e2 < 43744 ? e2 < 43488 ? e2 < 43312 ? e2 < 43261 ? 43259 == e2 : 43261 == e2 || e2 >= 43264 && e2 <= 43309 : e2 < 43392 ? e2 >= 43312 && e2 <= 43347 || e2 >= 43360 && e2 <= 43388 : e2 >= 43392 && e2 <= 43456 || e2 >= 43471 && e2 <= 43481 : e2 < 43600 ? e2 < 43520 ? e2 >= 43488 && e2 <= 43518 : e2 >= 43520 && e2 <= 43574 || e2 >= 43584 && e2 <= 43597 : e2 < 43642 ? e2 >= 43600 && e2 <= 43609 || e2 >= 43616 && e2 <= 43638 : e2 >= 43642 && e2 <= 43714 || e2 >= 43739 && e2 <= 43741 : e2 < 43824 ? e2 < 43785 ? e2 < 43762 ? e2 >= 43744 && e2 <= 43759 : e2 >= 43762 && e2 <= 43766 || e2 >= 43777 && e2 <= 43782 : e2 < 43808 ? e2 >= 43785 && e2 <= 43790 || e2 >= 43793 && e2 <= 43798 : e2 >= 43808 && e2 <= 43814 || e2 >= 43816 && e2 <= 43822 : e2 < 44012 ? e2 < 43868 ? e2 >= 43824 && e2 <= 43866 : e2 >= 43868 && e2 <= 43877 || e2 >= 43888 && e2 <= 44010 : e2 < 44032 ? e2 >= 44012 && e2 <= 44013 || e2 >= 44016 && e2 <= 44025 : e2 >= 44032 && e2 <= 55203 || e2 >= 55216 && e2 <= 55238 : e2 < 64848 ? e2 < 64298 ? e2 < 64112 ? e2 < 55296 ? e2 >= 55243 && e2 <= 55291 : e2 >= 55296 && e2 <= 57343 || e2 >= 63744 && e2 <= 64109 : e2 < 64275 ? e2 >= 64112 && e2 <= 64217 || e2 >= 64256 && e2 <= 64262 : e2 >= 64275 && e2 <= 64279 || e2 >= 64285 && e2 <= 64296 : e2 < 64320 ? e2 < 64312 ? e2 >= 64298 && e2 <= 64310 : e2 >= 64312 && e2 <= 64316 || 64318 == e2 : e2 < 64326 ? e2 >= 64320 && e2 <= 64321 || e2 >= 64323 && e2 <= 64324 : e2 >= 64326 && e2 <= 64433 || e2 >= 64467 && e2 <= 64829 : e2 < 65296 ? e2 < 65024 ? e2 < 64914 ? e2 >= 64848 && e2 <= 64911 : e2 >= 64914 && e2 <= 64967 || e2 >= 65008 && e2 <= 65019 : e2 < 65136 ? e2 >= 65024 && e2 <= 65039 || e2 >= 65056 && e2 <= 65071 : e2 >= 65136 && e2 <= 65140 || e2 >= 65142 && e2 <= 65276 : e2 < 65474 ? e2 < 65345 ? e2 >= 65296 && e2 <= 65305 || e2 >= 65313 && e2 <= 65338 : e2 >= 65345 && e2 <= 65370 || e2 >= 65382 && e2 <= 65470 : e2 < 65490 ? e2 >= 65474 && e2 <= 65479 || e2 >= 65482 && e2 <= 65487 : e2 >= 65490 && e2 <= 65495 || e2 >= 65498 && e2 <= 65500;
|
|
2627
|
+
}
|
|
2628
|
+
function dt(e2) {
|
|
2629
|
+
return e2 < 58 ? e2 < 44 ? 33 == e2 : 44 == e2 || 46 == e2 : e2 < 63 ? e2 >= 58 && e2 <= 59 : 63 == e2 || 94 == e2;
|
|
2630
|
+
}
|
|
2631
|
+
function pt(e2) {
|
|
2632
|
+
return e2 < 91 ? 40 == e2 : 91 == e2 || 123 == e2;
|
|
2633
|
+
}
|
|
2634
|
+
function mt(e2) {
|
|
2635
|
+
return e2 < 93 ? 41 == e2 : 93 == e2 || 125 == e2;
|
|
2636
|
+
}
|
|
2637
|
+
var ft = /^(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|travelersinsurance|vermögensberatung|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbah1a3hjkrd|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--mgbcpq6gpa1a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbc0a9azcg|xn--nqv7fs00ema|americanfamily|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq480n2rg|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|wolterskluwer|xn--cckwcxetd|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--4dbrk0ce|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|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|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--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--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|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|nextdirect|properties|protection|prudential|realestate|republican|restaurant|schaeffler|tatamotors|technology|university|vlaanderen|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--q7ce6a|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|pramerica|richardli|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--qxa6a|xn--tckwe|xn--vhquv|yodobashi|موريتانيا|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|builders|business|capetown|catering|catholic|cipriani|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|banamex|bauhaus|bestbuy|booking|brother|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|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|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|yamaxun|youtube|zuerich|католик|البحرين|الجزائر|العليان|پاکستان|كاثوليك|இந்தியா|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|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|kindle|kosher|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|nagoya|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|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|walter|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|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|loans|locus|lotte|lotto|mango|media|miami|money|movie|music|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|ישראל|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|aero|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|dvag|erni|fage|fail|fans|farm|fast|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|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kids|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|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|read|reit|rent|rest|rich|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|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|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|ceo|cfa|cfd|com|cpa|crs|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|gay|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|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|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|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|scb|sew|sex|sfr|ski|sky|soy|spa|srl|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|ss|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|ελ|ευ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|广东|微博|慈善|手机|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)$/, gt = /https?:\/\//i, vt = new RegExp("^" + gt.source, "i"), bt = /^(javascript|vbscript):/i, yt = /^[A-Za-z][-.+A-Za-z0-9]*:(\/\/)?([^:/]*)/, wt = /^(?:\/\/)?([^/#?:]+)/, kt = ot;
|
|
2638
|
+
function Ct(e2) {
|
|
2639
|
+
return ot(e2) || ct(e2) || 43 === e2 || 45 === e2 || 46 === e2;
|
|
2640
|
+
}
|
|
2641
|
+
var Tt = ut;
|
|
2642
|
+
function It(e2) {
|
|
2643
|
+
return 95 === e2 || Tt(e2);
|
|
2644
|
+
}
|
|
2645
|
+
function St(e2) {
|
|
2646
|
+
return ut(e2) || ((t2 = e2) < 91 ? t2 < 47 ? t2 >= 35 && t2 <= 43 || 45 == t2 : t2 < 61 ? 47 == t2 : 61 == t2 || 64 == t2 : t2 < 95 ? 91 == t2 || 93 == t2 : t2 < 123 ? 95 == t2 : t2 >= 123 && t2 <= 126 || 10003 == t2) || dt(e2);
|
|
2647
|
+
var t2;
|
|
2648
|
+
}
|
|
2649
|
+
function xt(e2) {
|
|
2650
|
+
return 47 === e2 || 63 === e2 || 35 === e2;
|
|
2651
|
+
}
|
|
2652
|
+
function Et(e2) {
|
|
2653
|
+
return ft.test(e2.toLowerCase());
|
|
2654
|
+
}
|
|
2655
|
+
var Mt = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, At = /[:/?#]/;
|
|
2656
|
+
var Nt = /^(https?:\/\/)?(?:www\.)?/i, Rt = /^\/\//, Dt = (function(e2) {
|
|
2657
|
+
function t2(t3) {
|
|
2658
|
+
var s2 = e2.call(this, t3) || this;
|
|
2659
|
+
return s2.type = "url", s2.url = "", s2.urlMatchType = "scheme", s2.protocolRelativeMatch = false, s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.protocolPrepended = false, s2.urlMatchType = t3.urlMatchType, s2.url = t3.url, s2.protocolRelativeMatch = t3.protocolRelativeMatch, s2.stripPrefix = t3.stripPrefix, s2.stripTrailingSlash = t3.stripTrailingSlash, s2.decodePercentEncoding = t3.decodePercentEncoding, s2;
|
|
2565
2660
|
}
|
|
2566
|
-
|
|
2661
|
+
return Qe(t2, e2), t2.prototype.getType = function() {
|
|
2662
|
+
return "url";
|
|
2663
|
+
}, t2.prototype.getUrlMatchType = function() {
|
|
2664
|
+
return this.urlMatchType;
|
|
2665
|
+
}, t2.prototype.getUrl = function() {
|
|
2666
|
+
var e3 = this.url;
|
|
2667
|
+
return this.protocolRelativeMatch || "scheme" === this.urlMatchType || this.protocolPrepended || (e3 = this.url = "http://" + e3, this.protocolPrepended = true), e3;
|
|
2668
|
+
}, t2.prototype.getAnchorHref = function() {
|
|
2669
|
+
return this.getUrl().replace(/&/g, "&");
|
|
2670
|
+
}, t2.prototype.getAnchorText = function() {
|
|
2671
|
+
var e3 = this.getMatchedText();
|
|
2672
|
+
return this.protocolRelativeMatch && (e3 = e3.replace(Rt, "")), this.stripPrefix.scheme && (e3 = e3.replace(vt, "")), this.stripPrefix.www && (e3 = (function(e4) {
|
|
2673
|
+
return e4.includes("www.") ? e4.replace(Nt, "$1") : e4;
|
|
2674
|
+
})(e3)), this.stripTrailingSlash && (e3 = (function(e4) {
|
|
2675
|
+
"/" === e4.charAt(e4.length - 1) && (e4 = e4.slice(0, -1));
|
|
2676
|
+
return e4;
|
|
2677
|
+
})(e3)), this.decodePercentEncoding && (e3 = (function(e4) {
|
|
2678
|
+
var t3 = e4.replace(/%(?:22|26|27|3C|3E)/gi, function(e5) {
|
|
2679
|
+
return "%22" === e5 ? """ : "%26" === e5 ? "&" : "%27" === e5 ? "'" : "%3C" === e5 || "%3c" === e5 ? "<" : ">";
|
|
2680
|
+
});
|
|
2681
|
+
if (t3.includes("%")) try {
|
|
2682
|
+
return decodeURIComponent(t3);
|
|
2683
|
+
} catch (e5) {
|
|
2684
|
+
}
|
|
2685
|
+
return t3;
|
|
2686
|
+
})(e3)), e3;
|
|
2687
|
+
}, t2;
|
|
2688
|
+
})(it);
|
|
2689
|
+
var _t = /^mailto:/i, Ot = ut;
|
|
2690
|
+
function Pt(e2) {
|
|
2691
|
+
return Ot(e2) || ((t2 = e2) < 47 ? t2 < 42 ? 33 == t2 || t2 >= 35 && t2 <= 39 : t2 >= 42 && t2 <= 43 || 45 == t2 : t2 < 63 ? 47 == t2 || 61 == t2 : t2 < 94 ? 63 == t2 : t2 >= 94 && t2 <= 96 || t2 >= 123 && t2 <= 126);
|
|
2692
|
+
var t2;
|
|
2567
2693
|
}
|
|
2568
|
-
var
|
|
2569
|
-
return et = Object.assign || function(e2) {
|
|
2570
|
-
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]);
|
|
2571
|
-
return e2;
|
|
2572
|
-
}, et.apply(this, arguments);
|
|
2573
|
-
}, tt = function(e2) {
|
|
2694
|
+
var jt = (function(e2) {
|
|
2574
2695
|
function t2(t3) {
|
|
2575
2696
|
var s2 = e2.call(this, t3) || this;
|
|
2576
|
-
return s2.email = "", s2.email = t3.email, s2;
|
|
2697
|
+
return s2.type = "email", s2.email = "", s2.email = t3.email, s2;
|
|
2577
2698
|
}
|
|
2578
|
-
return
|
|
2699
|
+
return Qe(t2, e2), t2.prototype.getType = function() {
|
|
2579
2700
|
return "email";
|
|
2580
2701
|
}, t2.prototype.getEmail = function() {
|
|
2581
2702
|
return this.email;
|
|
@@ -2584,12 +2705,16 @@ var Xe, et = function() {
|
|
|
2584
2705
|
}, t2.prototype.getAnchorText = function() {
|
|
2585
2706
|
return this.email;
|
|
2586
2707
|
}, t2;
|
|
2587
|
-
}
|
|
2708
|
+
})(it);
|
|
2709
|
+
function $t(e2) {
|
|
2710
|
+
return 95 === e2 || ut(e2);
|
|
2711
|
+
}
|
|
2712
|
+
var Ut = ["twitter", "facebook", "instagram", "tiktok", "youtube"], Wt = (function(e2) {
|
|
2588
2713
|
function t2(t3) {
|
|
2589
2714
|
var s2 = e2.call(this, t3) || this;
|
|
2590
|
-
return s2.serviceName = "", s2.hashtag = "", s2.serviceName = t3.serviceName, s2.hashtag = t3.hashtag, s2;
|
|
2715
|
+
return s2.type = "hashtag", s2.serviceName = "twitter", s2.hashtag = "", s2.serviceName = t3.serviceName, s2.hashtag = t3.hashtag, s2;
|
|
2591
2716
|
}
|
|
2592
|
-
return
|
|
2717
|
+
return Qe(t2, e2), t2.prototype.getType = function() {
|
|
2593
2718
|
return "hashtag";
|
|
2594
2719
|
}, t2.prototype.getServiceName = function() {
|
|
2595
2720
|
return this.serviceName;
|
|
@@ -2604,18 +2729,29 @@ var Xe, et = function() {
|
|
|
2604
2729
|
return "https://www.facebook.com/hashtag/" + t3;
|
|
2605
2730
|
case "instagram":
|
|
2606
2731
|
return "https://instagram.com/explore/tags/" + t3;
|
|
2732
|
+
case "tiktok":
|
|
2733
|
+
return "https://www.tiktok.com/tag/" + t3;
|
|
2734
|
+
case "youtube":
|
|
2735
|
+
return "https://youtube.com/hashtag/" + t3;
|
|
2607
2736
|
default:
|
|
2608
|
-
|
|
2737
|
+
et(e3);
|
|
2609
2738
|
}
|
|
2610
2739
|
}, t2.prototype.getAnchorText = function() {
|
|
2611
2740
|
return "#" + this.hashtag;
|
|
2741
|
+
}, t2.prototype.getCssClassSuffixes = function() {
|
|
2742
|
+
var t3 = e2.prototype.getCssClassSuffixes.call(this), s2 = this.getServiceName();
|
|
2743
|
+
return s2 && t3.push(s2), t3;
|
|
2612
2744
|
}, t2;
|
|
2613
|
-
}(
|
|
2745
|
+
})(it), qt = { twitter: /^@\w{1,15}$/, instagram: /^@[_\w]{1,30}$/, soundcloud: /^@[-a-z0-9_]{3,25}$/, tiktok: /^@[.\w]{1,23}[\w]$/, youtube: /^@[-.·\w]{3,30}$/ };
|
|
2746
|
+
function Bt(e2) {
|
|
2747
|
+
return 45 === e2 || 46 === e2 || 95 === e2 || ot(e2) || ct(e2);
|
|
2748
|
+
}
|
|
2749
|
+
var Lt = ["twitter", "instagram", "soundcloud", "tiktok", "youtube"], Gt = (function(e2) {
|
|
2614
2750
|
function t2(t3) {
|
|
2615
2751
|
var s2 = e2.call(this, t3) || this;
|
|
2616
|
-
return s2.serviceName = "twitter", s2.mention = "", s2.mention = t3.mention, s2.serviceName = t3.serviceName, s2;
|
|
2752
|
+
return s2.type = "mention", s2.serviceName = "twitter", s2.mention = "", s2.mention = t3.mention, s2.serviceName = t3.serviceName, s2;
|
|
2617
2753
|
}
|
|
2618
|
-
return
|
|
2754
|
+
return Qe(t2, e2), t2.prototype.getType = function() {
|
|
2619
2755
|
return "mention";
|
|
2620
2756
|
}, t2.prototype.getMention = function() {
|
|
2621
2757
|
return this.mention;
|
|
@@ -2629,8 +2765,12 @@ var Xe, et = function() {
|
|
|
2629
2765
|
return "https://instagram.com/" + this.mention;
|
|
2630
2766
|
case "soundcloud":
|
|
2631
2767
|
return "https://soundcloud.com/" + this.mention;
|
|
2768
|
+
case "tiktok":
|
|
2769
|
+
return "https://www.tiktok.com/@" + this.mention;
|
|
2770
|
+
case "youtube":
|
|
2771
|
+
return "https://youtube.com/@" + this.mention;
|
|
2632
2772
|
default:
|
|
2633
|
-
|
|
2773
|
+
et(this.serviceName);
|
|
2634
2774
|
}
|
|
2635
2775
|
}, t2.prototype.getAnchorText = function() {
|
|
2636
2776
|
return "@" + this.mention;
|
|
@@ -2638,12 +2778,19 @@ var Xe, et = function() {
|
|
|
2638
2778
|
var t3 = e2.prototype.getCssClassSuffixes.call(this), s2 = this.getServiceName();
|
|
2639
2779
|
return s2 && t3.push(s2), t3;
|
|
2640
2780
|
}, t2;
|
|
2641
|
-
}(
|
|
2781
|
+
})(it), Ft = /[-. ()]/, Ht = new RegExp("^".concat(/(?:(?:(?:(\+)?\d{1,3}[-. ]?)?\(?\d{3}\)?[-. ]?\d{3}[-. ]?\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)[-. ]?(?:\d[-. ]?){6,12}\d+))([,;]+[0-9]+#?)*/.source, "|").concat(/(0([1-9]-?[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, "$"));
|
|
2782
|
+
function Jt(e2) {
|
|
2783
|
+
return 45 === e2 || 46 === e2 || 32 === e2;
|
|
2784
|
+
}
|
|
2785
|
+
function zt(e2) {
|
|
2786
|
+
return 44 === e2 || 59 === e2;
|
|
2787
|
+
}
|
|
2788
|
+
var Yt = (function(e2) {
|
|
2642
2789
|
function t2(t3) {
|
|
2643
2790
|
var s2 = e2.call(this, t3) || this;
|
|
2644
|
-
return s2.number = "", s2.plusSign = false, s2.number = t3.number, s2.plusSign = t3.plusSign, s2;
|
|
2791
|
+
return s2.type = "phone", s2.number = "", s2.plusSign = false, s2.number = t3.number, s2.plusSign = t3.plusSign, s2;
|
|
2645
2792
|
}
|
|
2646
|
-
return
|
|
2793
|
+
return Qe(t2, e2), t2.prototype.getType = function() {
|
|
2647
2794
|
return "phone";
|
|
2648
2795
|
}, t2.prototype.getPhoneNumber = function() {
|
|
2649
2796
|
return this.number;
|
|
@@ -2654,591 +2801,782 @@ var Xe, et = function() {
|
|
|
2654
2801
|
}, t2.prototype.getAnchorText = function() {
|
|
2655
2802
|
return this.matchedText;
|
|
2656
2803
|
}, t2;
|
|
2657
|
-
}(
|
|
2658
|
-
function t2
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
},
|
|
2670
|
-
return this.
|
|
2671
|
-
},
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
return e3
|
|
2678
|
-
},
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
}(Ve), it = function(e2) {
|
|
2691
|
-
this.__jsduckDummyDocProp = null, this.tagBuilder = e2.tagBuilder;
|
|
2692
|
-
}, ot = /[A-Za-z]/, ut = /[\d]/, ct = /[\D]/, lt = /\s/, ht = /['"]/, dt = /[\x00-\x1F\x7F]/, pt = /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, ft = pt + /\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, mt = /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, gt = ft + mt, vt = ft + mt, wt = "(?:[" + mt + "]{1,3}\\.){3}[" + mt + "]{1,3}", bt = "[" + vt + "](?:[" + vt + "\\-]{0,61}[" + vt + "])?", yt = function(e2) {
|
|
2693
|
-
return "(?=(" + bt + "))\\" + e2;
|
|
2694
|
-
}, Ct = function(e2) {
|
|
2695
|
-
return "(?:" + yt(e2) + "(?:\\." + yt(e2 + 1) + "){0,126}|" + wt + ")";
|
|
2696
|
-
}, At = new RegExp("[" + vt + "]"), Et = /(?: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|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/, kt = new RegExp("[" + vt + "!#$%&'*+/=?^_`{|}~-]"), xt = new RegExp("^" + Et.source + "$"), Tt = function(e2) {
|
|
2697
|
-
function t2() {
|
|
2698
|
-
var t3 = null !== e2 && e2.apply(this, arguments) || this;
|
|
2699
|
-
return t3.localPartCharRegex = kt, t3.strictTldRegex = xt, t3;
|
|
2700
|
-
}
|
|
2701
|
-
return Ke(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2702
|
-
for (var t3 = this.tagBuilder, s2 = this.localPartCharRegex, n2 = this.strictTldRegex, r2 = [], a2 = e3.length, i2 = new It(), o2 = { m: "a", a: "i", i: "l", l: "t", t: "o", o: ":" }, u2 = 0, c2 = 0, l2 = i2; u2 < a2; ) {
|
|
2703
|
-
var h2 = e3.charAt(u2);
|
|
2704
|
-
switch (c2) {
|
|
2705
|
-
case 0:
|
|
2706
|
-
d2(h2);
|
|
2707
|
-
break;
|
|
2708
|
-
case 1:
|
|
2709
|
-
p2(e3.charAt(u2 - 1), h2);
|
|
2710
|
-
break;
|
|
2711
|
-
case 2:
|
|
2712
|
-
f2(h2);
|
|
2713
|
-
break;
|
|
2714
|
-
case 3:
|
|
2715
|
-
m2(h2);
|
|
2716
|
-
break;
|
|
2717
|
-
case 4:
|
|
2718
|
-
g2(h2);
|
|
2719
|
-
break;
|
|
2720
|
-
case 5:
|
|
2721
|
-
v2(h2);
|
|
2722
|
-
break;
|
|
2723
|
-
case 6:
|
|
2724
|
-
w2(h2);
|
|
2725
|
-
break;
|
|
2726
|
-
case 7:
|
|
2727
|
-
b2(h2);
|
|
2728
|
-
break;
|
|
2729
|
-
default:
|
|
2730
|
-
Je(c2);
|
|
2731
|
-
}
|
|
2732
|
-
u2++;
|
|
2733
|
-
}
|
|
2734
|
-
return A2(), r2;
|
|
2735
|
-
function d2(e4) {
|
|
2736
|
-
"m" === e4 ? y2(1) : s2.test(e4) && y2();
|
|
2737
|
-
}
|
|
2738
|
-
function p2(e4, t4) {
|
|
2739
|
-
":" === e4 ? s2.test(t4) ? (c2 = 2, l2 = new It(et(et({}, l2), { hasMailtoPrefix: true }))) : C2() : o2[e4] === t4 || (s2.test(t4) ? c2 = 2 : "." === t4 ? c2 = 3 : "@" === t4 ? c2 = 4 : C2());
|
|
2740
|
-
}
|
|
2741
|
-
function f2(e4) {
|
|
2742
|
-
"." === e4 ? c2 = 3 : "@" === e4 ? c2 = 4 : s2.test(e4) || C2();
|
|
2743
|
-
}
|
|
2744
|
-
function m2(e4) {
|
|
2745
|
-
"." === e4 || "@" === e4 ? C2() : s2.test(e4) ? c2 = 2 : C2();
|
|
2746
|
-
}
|
|
2747
|
-
function g2(e4) {
|
|
2748
|
-
At.test(e4) ? c2 = 5 : C2();
|
|
2749
|
-
}
|
|
2750
|
-
function v2(e4) {
|
|
2751
|
-
"." === e4 ? c2 = 7 : "-" === e4 ? c2 = 6 : At.test(e4) || A2();
|
|
2752
|
-
}
|
|
2753
|
-
function w2(e4) {
|
|
2754
|
-
"-" === e4 || "." === e4 ? A2() : At.test(e4) ? c2 = 5 : A2();
|
|
2755
|
-
}
|
|
2756
|
-
function b2(e4) {
|
|
2757
|
-
"." === e4 || "-" === e4 ? A2() : At.test(e4) ? (c2 = 5, l2 = new It(et(et({}, l2), { hasDomainDot: true }))) : A2();
|
|
2758
|
-
}
|
|
2759
|
-
function y2(e4) {
|
|
2760
|
-
void 0 === e4 && (e4 = 2), c2 = e4, l2 = new It({ idx: u2 });
|
|
2761
|
-
}
|
|
2762
|
-
function C2() {
|
|
2763
|
-
c2 = 0, l2 = i2;
|
|
2764
|
-
}
|
|
2765
|
-
function A2() {
|
|
2766
|
-
if (l2.hasDomainDot) {
|
|
2767
|
-
var s3 = e3.slice(l2.idx, u2);
|
|
2768
|
-
/[-.]$/.test(s3) && (s3 = s3.slice(0, -1));
|
|
2769
|
-
var a3 = l2.hasMailtoPrefix ? s3.slice(7) : s3;
|
|
2770
|
-
(function(e4) {
|
|
2771
|
-
var t4 = e4.split(".").pop() || "", s4 = t4.toLowerCase();
|
|
2772
|
-
return n2.test(s4);
|
|
2773
|
-
})(a3) && r2.push(new tt({ tagBuilder: t3, matchedText: s3, offset: l2.idx, email: a3 }));
|
|
2774
|
-
}
|
|
2775
|
-
C2();
|
|
2776
|
-
}
|
|
2777
|
-
}, t2;
|
|
2778
|
-
}(it), It = function(e2) {
|
|
2779
|
-
void 0 === e2 && (e2 = {}), this.idx = void 0 !== e2.idx ? e2.idx : -1, this.hasMailtoPrefix = !!e2.hasMailtoPrefix, this.hasDomainDot = !!e2.hasDomainDot;
|
|
2780
|
-
}, Dt = function() {
|
|
2781
|
-
function e2() {
|
|
2782
|
-
}
|
|
2783
|
-
return e2.isValid = function(e3, t2) {
|
|
2784
|
-
return !(t2 && !this.isValidUriScheme(t2) || this.urlMatchDoesNotHaveProtocolOrDot(e3, t2) || this.urlMatchDoesNotHaveAtLeastOneWordChar(e3, t2) && !this.isValidIpAddress(e3) || this.containsMultipleDots(e3));
|
|
2785
|
-
}, e2.isValidIpAddress = function(e3) {
|
|
2786
|
-
var t2 = new RegExp(this.hasFullProtocolRegex.source + this.ipRegex.source);
|
|
2787
|
-
return null !== e3.match(t2);
|
|
2788
|
-
}, e2.containsMultipleDots = function(e3) {
|
|
2789
|
-
var t2 = e3;
|
|
2790
|
-
return this.hasFullProtocolRegex.test(e3) && (t2 = e3.split("://")[1]), t2.split("/")[0].indexOf("..") > -1;
|
|
2791
|
-
}, e2.isValidUriScheme = function(e3) {
|
|
2792
|
-
var t2 = e3.match(this.uriSchemeRegex), s2 = t2 && t2[0].toLowerCase();
|
|
2793
|
-
return "javascript:" !== s2 && "vbscript:" !== s2;
|
|
2794
|
-
}, e2.urlMatchDoesNotHaveProtocolOrDot = function(e3, t2) {
|
|
2795
|
-
return !(!e3 || t2 && this.hasFullProtocolRegex.test(t2) || -1 !== e3.indexOf("."));
|
|
2796
|
-
}, e2.urlMatchDoesNotHaveAtLeastOneWordChar = function(e3, t2) {
|
|
2797
|
-
return !(!e3 || !t2) && (!this.hasFullProtocolRegex.test(t2) && !this.hasWordCharAfterProtocolRegex.test(e3));
|
|
2798
|
-
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" + pt + "]"), 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;
|
|
2799
|
-
}(), St = (Xe = new RegExp("[/?#](?:[" + vt + "\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*[" + vt + "\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"), new RegExp(["(?:", "(", /(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source, Ct(2), ")", "|", "(", "(//)?", /(?:www\.)/.source, Ct(6), ")", "|", "(", "(//)?", Ct(10) + "\\.", Et.source, "(?![-" + gt + "])", ")", ")", "(?::[0-9]+)?", "(?:" + Xe.source + ")?"].join(""), "gi")), Mt = new RegExp("[" + vt + "]"), Ft = function(e2) {
|
|
2800
|
-
function t2(t3) {
|
|
2801
|
-
var s2 = e2.call(this, t3) || this;
|
|
2802
|
-
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex = St, s2.wordCharRegExp = Mt, s2.stripPrefix = t3.stripPrefix, s2.stripTrailingSlash = t3.stripTrailingSlash, s2.decodePercentEncoding = t3.decodePercentEncoding, s2;
|
|
2803
|
-
}
|
|
2804
|
-
return Ke(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2805
|
-
for (var t3, s2 = this.matcherRegex, n2 = this.stripPrefix, r2 = this.stripTrailingSlash, a2 = this.decodePercentEncoding, i2 = this.tagBuilder, o2 = [], u2 = function() {
|
|
2806
|
-
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);
|
|
2807
|
-
if (!Dt.isValid(s3, u3)) return "continue";
|
|
2808
|
-
if (p2 > 0 && "@" === m2) return "continue";
|
|
2809
|
-
if (p2 > 0 && f2 && c2.wordCharRegExp.test(m2)) return "continue";
|
|
2810
|
-
if (/\?$/.test(s3) && (s3 = s3.substr(0, s3.length - 1)), c2.matchHasUnbalancedClosingParen(s3)) s3 = s3.substr(0, s3.length - 1);
|
|
2811
|
-
else {
|
|
2812
|
-
var g2 = c2.matchHasInvalidCharAfterTld(s3, u3);
|
|
2813
|
-
g2 > -1 && (s3 = s3.substr(0, g2));
|
|
2814
|
-
}
|
|
2815
|
-
var v2 = ["http://", "https://"].find(function(e4) {
|
|
2816
|
-
return !!u3 && -1 !== u3.indexOf(e4);
|
|
2817
|
-
});
|
|
2818
|
-
if (v2) {
|
|
2819
|
-
var w2 = s3.indexOf(v2);
|
|
2820
|
-
s3 = s3.substr(w2), u3 = u3.substr(w2), p2 += w2;
|
|
2821
|
-
}
|
|
2822
|
-
var b2 = u3 ? "scheme" : l2 ? "www" : "tld", y2 = !!u3;
|
|
2823
|
-
o2.push(new at({ tagBuilder: i2, matchedText: s3, offset: p2, urlMatchType: b2, url: s3, protocolUrlMatch: y2, protocolRelativeMatch: !!f2, stripPrefix: n2, stripTrailingSlash: r2, decodePercentEncoding: a2 }));
|
|
2824
|
-
}, c2 = this; null !== (t3 = s2.exec(e3)); ) u2();
|
|
2825
|
-
return o2;
|
|
2826
|
-
}, t2.prototype.matchHasUnbalancedClosingParen = function(e3) {
|
|
2827
|
-
var t3, s2 = e3.charAt(e3.length - 1);
|
|
2828
|
-
if (")" === s2) t3 = "(";
|
|
2829
|
-
else if ("]" === s2) t3 = "[";
|
|
2830
|
-
else {
|
|
2831
|
-
if ("}" !== s2) return false;
|
|
2832
|
-
t3 = "{";
|
|
2833
|
-
}
|
|
2834
|
-
for (var n2 = 0, r2 = 0, a2 = e3.length - 1; r2 < a2; r2++) {
|
|
2835
|
-
var i2 = e3.charAt(r2);
|
|
2836
|
-
i2 === t3 ? n2++ : i2 === s2 && (n2 = Math.max(n2 - 1, 0));
|
|
2804
|
+
})(it), Qt = (function() {
|
|
2805
|
+
function e2(e3, t2) {
|
|
2806
|
+
this.charIdx = 0, this.matches = [], this._stateMachines = [], this.schemeUrlMachinesCount = 0, this.text = e3, this.tagBuilder = t2.tagBuilder, this.stripPrefix = t2.stripPrefix, this.stripTrailingSlash = t2.stripTrailingSlash, this.decodePercentEncoding = t2.decodePercentEncoding, this.hashtagServiceName = t2.hashtagServiceName, this.mentionServiceName = t2.mentionServiceName;
|
|
2807
|
+
}
|
|
2808
|
+
return Object.defineProperty(e2.prototype, "stateMachines", { get: function() {
|
|
2809
|
+
return this._stateMachines;
|
|
2810
|
+
}, enumerable: false, configurable: true }), e2.prototype.addMachine = function(e3) {
|
|
2811
|
+
this._stateMachines.push(e3), Hs(e3) && this.schemeUrlMachinesCount++;
|
|
2812
|
+
}, e2.prototype.removeMachine = function(e3) {
|
|
2813
|
+
this._stateMachines = this._stateMachines.filter(function(t2) {
|
|
2814
|
+
return t2 !== e3;
|
|
2815
|
+
}), Hs(e3) && this.schemeUrlMachinesCount--;
|
|
2816
|
+
}, e2.prototype.hasSchemeUrlMachine = function() {
|
|
2817
|
+
return this.schemeUrlMachinesCount > 0;
|
|
2818
|
+
}, e2;
|
|
2819
|
+
})();
|
|
2820
|
+
function Vt(e2, t2, s2) {
|
|
2821
|
+
var n2 = e2.charIdx;
|
|
2822
|
+
if (35 === s2) e2.addMachine({ type: 2, startIdx: n2, state: 28, acceptStateReached: false });
|
|
2823
|
+
else if (64 === s2) e2.addMachine(/* @__PURE__ */ (function(e3, t3) {
|
|
2824
|
+
return { type: 3, startIdx: e3, state: t3, acceptStateReached: false };
|
|
2825
|
+
})(n2, 30));
|
|
2826
|
+
else if (47 === s2) e2.addMachine(Gs(n2, 11));
|
|
2827
|
+
else if (43 === s2) e2.addMachine(Fs(n2, 37));
|
|
2828
|
+
else if (40 === s2) e2.addMachine(Fs(n2, 32));
|
|
2829
|
+
else {
|
|
2830
|
+
if (ct(s2) && (e2.addMachine(Fs(n2, 38)), e2.addMachine(/* @__PURE__ */ (function(e3, t3) {
|
|
2831
|
+
return { type: 0, startIdx: e3, state: t3, acceptStateReached: false, matchType: 2, octetsEncountered: 1 };
|
|
2832
|
+
})(n2, 13))), Ot(s2)) {
|
|
2833
|
+
var a2 = "m" === t2.toLowerCase() ? 15 : 22;
|
|
2834
|
+
e2.addMachine(/* @__PURE__ */ (function(e3, t3) {
|
|
2835
|
+
return { type: 1, startIdx: e3, state: t3, acceptStateReached: false };
|
|
2836
|
+
})(n2, a2));
|
|
2837
2837
|
}
|
|
2838
|
-
|
|
2839
|
-
}
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2838
|
+
kt(s2) && e2.addMachine(Ls(n2, 0)), ut(s2) && e2.addMachine(Gs(n2, 5));
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
function Kt(e2, t2, s2) {
|
|
2842
|
+
58 === s2 ? t2.state = 2 : 45 === s2 ? t2.state = 1 : Ct(s2) || e2.removeMachine(t2);
|
|
2843
|
+
}
|
|
2844
|
+
function Zt(e2, t2, s2) {
|
|
2845
|
+
var n2 = e2.charIdx;
|
|
2846
|
+
45 === s2 || (47 === s2 ? (e2.removeMachine(t2), e2.addMachine(Gs(n2, 11))) : Ct(s2) ? t2.state = 0 : e2.removeMachine(t2));
|
|
2847
|
+
}
|
|
2848
|
+
function Xt(e2, t2, s2) {
|
|
2849
|
+
var n2 = e2.charIdx;
|
|
2850
|
+
47 === s2 ? t2.state = 3 : 46 === s2 ? e2.removeMachine(t2) : Tt(s2) ? (t2.state = 5, kt(s2) && e2.addMachine(Ls(n2, 0))) : e2.removeMachine(t2);
|
|
2851
|
+
}
|
|
2852
|
+
function es(e2, t2, s2) {
|
|
2853
|
+
47 === s2 ? t2.state = 4 : St(s2) ? (t2.state = 10, t2.acceptStateReached = true) : Ws(e2, t2);
|
|
2854
|
+
}
|
|
2855
|
+
function ts(e2, t2, s2, n2) {
|
|
2856
|
+
47 === n2 ? (t2.state = 10, t2.acceptStateReached = true) : Tt(n2) ? (t2.state = 5, t2.acceptStateReached = true) : e2.removeMachine(t2);
|
|
2857
|
+
}
|
|
2858
|
+
function ss(e2, t2, s2) {
|
|
2859
|
+
47 === s2 ? t2.state = 12 : e2.removeMachine(t2);
|
|
2860
|
+
}
|
|
2861
|
+
function ns(e2, t2, s2) {
|
|
2862
|
+
Tt(s2) ? t2.state = 5 : e2.removeMachine(t2);
|
|
2863
|
+
}
|
|
2864
|
+
function as(e2, t2, s2) {
|
|
2865
|
+
46 === s2 ? t2.state = 7 : 45 === s2 ? t2.state = 6 : 58 === s2 ? t2.state = 8 : xt(s2) ? t2.state = 10 : It(s2) || Ws(e2, t2);
|
|
2866
|
+
}
|
|
2867
|
+
function rs(e2, t2, s2, n2) {
|
|
2868
|
+
45 === n2 || (46 === n2 ? Ws(e2, t2) : Tt(n2) ? t2.state = 5 : Ws(e2, t2));
|
|
2869
|
+
}
|
|
2870
|
+
function is(e2, t2, s2, n2) {
|
|
2871
|
+
46 === n2 ? Ws(e2, t2) : Tt(n2) ? (t2.state = 5, t2.acceptStateReached = true) : Ws(e2, t2);
|
|
2872
|
+
}
|
|
2873
|
+
function os(e2, t2, s2) {
|
|
2874
|
+
46 === s2 ? t2.state = 14 : 58 === s2 ? t2.state = 8 : ct(s2) || (xt(s2) ? t2.state = 10 : ut(s2) ? e2.removeMachine(t2) : Ws(e2, t2));
|
|
2875
|
+
}
|
|
2876
|
+
function cs(e2, t2, s2) {
|
|
2877
|
+
ct(s2) ? (t2.octetsEncountered++, 4 === t2.octetsEncountered && (t2.acceptStateReached = true), t2.state = 13) : Ws(e2, t2);
|
|
2878
|
+
}
|
|
2879
|
+
function ls(e2, t2, s2) {
|
|
2880
|
+
ct(s2) ? t2.state = 9 : Ws(e2, t2);
|
|
2881
|
+
}
|
|
2882
|
+
function hs(e2, t2, s2) {
|
|
2883
|
+
ct(s2) || (xt(s2) ? t2.state = 10 : Ws(e2, t2));
|
|
2884
|
+
}
|
|
2885
|
+
function us(e2, t2, s2) {
|
|
2886
|
+
St(s2) || Ws(e2, t2);
|
|
2887
|
+
}
|
|
2888
|
+
function ds(e2, t2, s2, n2) {
|
|
2889
|
+
"a" === s2.toLowerCase() ? t2.state = 16 : ys(e2, t2, n2);
|
|
2890
|
+
}
|
|
2891
|
+
function ps(e2, t2, s2, n2) {
|
|
2892
|
+
"i" === s2.toLowerCase() ? t2.state = 17 : ys(e2, t2, n2);
|
|
2893
|
+
}
|
|
2894
|
+
function ms(e2, t2, s2, n2) {
|
|
2895
|
+
"l" === s2.toLowerCase() ? t2.state = 18 : ys(e2, t2, n2);
|
|
2896
|
+
}
|
|
2897
|
+
function fs(e2, t2, s2, n2) {
|
|
2898
|
+
"t" === s2.toLowerCase() ? t2.state = 19 : ys(e2, t2, n2);
|
|
2899
|
+
}
|
|
2900
|
+
function gs(e2, t2, s2, n2) {
|
|
2901
|
+
"o" === s2.toLowerCase() ? t2.state = 20 : ys(e2, t2, n2);
|
|
2902
|
+
}
|
|
2903
|
+
function vs(e2, t2, s2) {
|
|
2904
|
+
58 === s2 ? t2.state = 21 : ys(e2, t2, s2);
|
|
2905
|
+
}
|
|
2906
|
+
function bs(e2, t2, s2) {
|
|
2907
|
+
Pt(s2) ? t2.state = 22 : e2.removeMachine(t2);
|
|
2908
|
+
}
|
|
2909
|
+
function ys(e2, t2, s2) {
|
|
2910
|
+
46 === s2 ? t2.state = 23 : 64 === s2 ? t2.state = 24 : Pt(s2) ? t2.state = 22 : e2.removeMachine(t2);
|
|
2911
|
+
}
|
|
2912
|
+
function ws(e2, t2, s2) {
|
|
2913
|
+
46 === s2 || 64 === s2 ? e2.removeMachine(t2) : Pt(s2) ? t2.state = 22 : e2.removeMachine(t2);
|
|
2914
|
+
}
|
|
2915
|
+
function ks(e2, t2, s2) {
|
|
2916
|
+
Tt(s2) ? t2.state = 25 : e2.removeMachine(t2);
|
|
2917
|
+
}
|
|
2918
|
+
function Cs(e2, t2, s2) {
|
|
2919
|
+
46 === s2 ? t2.state = 27 : 45 === s2 ? t2.state = 26 : It(s2) || Ws(e2, t2);
|
|
2920
|
+
}
|
|
2921
|
+
function Ts(e2, t2, s2) {
|
|
2922
|
+
45 === s2 || 46 === s2 ? Ws(e2, t2) : It(s2) ? t2.state = 25 : Ws(e2, t2);
|
|
2923
|
+
}
|
|
2924
|
+
function Is(e2, t2, s2) {
|
|
2925
|
+
46 === s2 || 45 === s2 ? Ws(e2, t2) : Tt(s2) ? (t2.state = 25, t2.acceptStateReached = true) : Ws(e2, t2);
|
|
2926
|
+
}
|
|
2927
|
+
function Ss(e2, t2, s2) {
|
|
2928
|
+
$t(s2) ? (t2.state = 29, t2.acceptStateReached = true) : e2.removeMachine(t2);
|
|
2929
|
+
}
|
|
2930
|
+
function xs(e2, t2, s2) {
|
|
2931
|
+
$t(s2) || Ws(e2, t2);
|
|
2932
|
+
}
|
|
2933
|
+
function Es(e2, t2, s2) {
|
|
2934
|
+
Bt(s2) ? (t2.state = 31, t2.acceptStateReached = true) : e2.removeMachine(t2);
|
|
2935
|
+
}
|
|
2936
|
+
function Ms(e2, t2, s2) {
|
|
2937
|
+
Bt(s2) || (ut(s2) ? e2.removeMachine(t2) : Ws(e2, t2));
|
|
2938
|
+
}
|
|
2939
|
+
function As(e2, t2, s2, n2) {
|
|
2940
|
+
ct(n2) ? t2.state = 38 : (e2.removeMachine(t2), Vt(e2, s2, n2));
|
|
2941
|
+
}
|
|
2942
|
+
function Ns(e2, t2, s2, n2) {
|
|
2943
|
+
ct(n2) ? t2.state = 33 : e2.removeMachine(t2), Vt(e2, s2, n2);
|
|
2944
|
+
}
|
|
2945
|
+
function Rs(e2, t2, s2) {
|
|
2946
|
+
ct(s2) ? t2.state = 34 : e2.removeMachine(t2);
|
|
2947
|
+
}
|
|
2948
|
+
function Ds(e2, t2, s2) {
|
|
2949
|
+
ct(s2) ? t2.state = 35 : e2.removeMachine(t2);
|
|
2950
|
+
}
|
|
2951
|
+
function _s(e2, t2, s2) {
|
|
2952
|
+
41 === s2 ? t2.state = 36 : e2.removeMachine(t2);
|
|
2953
|
+
}
|
|
2954
|
+
function Os(e2, t2, s2, n2) {
|
|
2955
|
+
ct(n2) ? t2.state = 38 : Jt(n2) ? t2.state = 39 : e2.removeMachine(t2);
|
|
2956
|
+
}
|
|
2957
|
+
function Ps(e2, t2, s2, n2) {
|
|
2958
|
+
var a2 = e2.charIdx;
|
|
2959
|
+
t2.acceptStateReached = true, zt(n2) ? t2.state = 40 : 35 === n2 ? t2.state = 41 : ct(n2) || (40 === n2 ? t2.state = 32 : Jt(n2) ? t2.state = 39 : (Ws(e2, t2), kt(n2) && e2.addMachine(Ls(a2, 0))));
|
|
2960
|
+
}
|
|
2961
|
+
function js(e2, t2, s2, n2) {
|
|
2962
|
+
ct(n2) ? t2.state = 38 : 40 === n2 ? t2.state = 32 : (Ws(e2, t2), Vt(e2, s2, n2));
|
|
2963
|
+
}
|
|
2964
|
+
function $s(e2, t2, s2) {
|
|
2965
|
+
zt(s2) || (35 === s2 ? t2.state = 41 : ct(s2) ? t2.state = 38 : Ws(e2, t2));
|
|
2966
|
+
}
|
|
2967
|
+
function Us(e2, t2, s2) {
|
|
2968
|
+
zt(s2) ? t2.state = 40 : ct(s2) ? e2.removeMachine(t2) : Ws(e2, t2);
|
|
2969
|
+
}
|
|
2970
|
+
function Ws(e2, t2) {
|
|
2971
|
+
var s2 = e2.matches, n2 = e2.text, a2 = e2.charIdx, r2 = e2.tagBuilder, i2 = e2.stripPrefix, o2 = e2.stripTrailingSlash, c2 = e2.decodePercentEncoding, l2 = e2.hashtagServiceName, h2 = e2.mentionServiceName;
|
|
2972
|
+
if (e2.removeMachine(t2), t2.acceptStateReached) {
|
|
2973
|
+
var u2, d2, p2 = t2.startIdx, m2 = n2.slice(t2.startIdx, a2);
|
|
2974
|
+
switch (m2 = (function(e3) {
|
|
2975
|
+
for (var t3 = { "(": 0, "{": 0, "[": 0 }, s3 = 0; s3 < e3.length; s3++) {
|
|
2976
|
+
var n3 = e3.charAt(s3);
|
|
2977
|
+
pt(r3 = e3.charCodeAt(s3)) ? t3[n3]++ : mt(r3) && t3[Bs[n3]]--;
|
|
2857
2978
|
}
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
}
|
|
2871
|
-
return r2;
|
|
2872
|
-
}, t2.prototype.testMatch = function(e3) {
|
|
2873
|
-
return ct.test(e3);
|
|
2874
|
-
}, t2;
|
|
2875
|
-
}(it), Pt = new RegExp("@[_" + vt + "]{1,50}(?![_" + vt + "])", "g"), $t = new RegExp("@[_." + vt + "]{1,30}(?![_" + vt + "])", "g"), jt = new RegExp("@[-_." + vt + "]{1,50}(?![-_" + vt + "])", "g"), Ut = new RegExp("[^" + vt + "]"), Wt = function(e2) {
|
|
2876
|
-
function t2(t3) {
|
|
2877
|
-
var s2 = e2.call(this, t3) || this;
|
|
2878
|
-
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter: Pt, instagram: $t, soundcloud: jt }, s2.nonWordCharRegex = Ut, s2.serviceName = t3.serviceName, s2;
|
|
2879
|
-
}
|
|
2880
|
-
return Ke(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2881
|
-
var t3, s2 = this.serviceName, n2 = this.matcherRegexes[this.serviceName], r2 = this.nonWordCharRegex, a2 = this.tagBuilder, i2 = [];
|
|
2882
|
-
if (!n2) return i2;
|
|
2883
|
-
for (; null !== (t3 = n2.exec(e3)); ) {
|
|
2884
|
-
var o2 = t3.index, u2 = e3.charAt(o2 - 1);
|
|
2885
|
-
if (0 === o2 || r2.test(u2)) {
|
|
2886
|
-
var c2 = t3[0].replace(/\.+$/g, ""), l2 = c2.slice(1);
|
|
2887
|
-
i2.push(new nt({ tagBuilder: a2, matchedText: c2, offset: o2, serviceName: s2, mention: l2 }));
|
|
2979
|
+
var a3 = e3.length - 1;
|
|
2980
|
+
for (; a3 >= 0; ) {
|
|
2981
|
+
var r3;
|
|
2982
|
+
n3 = e3.charAt(a3);
|
|
2983
|
+
if (mt(r3 = e3.charCodeAt(a3))) {
|
|
2984
|
+
var i3 = Bs[n3];
|
|
2985
|
+
if (!(t3[i3] < 0)) break;
|
|
2986
|
+
t3[i3]++, a3--;
|
|
2987
|
+
} else {
|
|
2988
|
+
if (!dt(r3)) break;
|
|
2989
|
+
a3--;
|
|
2990
|
+
}
|
|
2888
2991
|
}
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
}, t2;
|
|
2892
|
-
}(it);
|
|
2893
|
-
function qt(e2, t2) {
|
|
2894
|
-
for (var s2, n2 = t2.onOpenTag, r2 = t2.onCloseTag, a2 = t2.onText, i2 = t2.onComment, o2 = t2.onDoctype, u2 = new Ht(), c2 = 0, l2 = e2.length, h2 = 0, d2 = 0, p2 = u2; c2 < l2; ) {
|
|
2895
|
-
var f2 = e2.charAt(c2);
|
|
2896
|
-
switch (h2) {
|
|
2992
|
+
return e3.slice(0, a3 + 1);
|
|
2993
|
+
})(m2), t2.type) {
|
|
2897
2994
|
case 0:
|
|
2898
|
-
|
|
2995
|
+
if (64 === n2.charCodeAt(t2.startIdx - 1)) return;
|
|
2996
|
+
switch (t2.matchType) {
|
|
2997
|
+
case 0:
|
|
2998
|
+
var f2 = gt.exec(m2);
|
|
2999
|
+
if (f2 && (p2 += f2.index, m2 = m2.slice(f2.index)), !(function(e3) {
|
|
3000
|
+
if (bt.test(e3)) return false;
|
|
3001
|
+
var t3 = e3.match(yt);
|
|
3002
|
+
if (!t3) return false;
|
|
3003
|
+
var s3 = !!t3[1], n3 = t3[2];
|
|
3004
|
+
return !!s3 || !(-1 === n3.indexOf(".") || !/[A-Za-z]/.test(n3));
|
|
3005
|
+
})(m2)) return;
|
|
3006
|
+
break;
|
|
3007
|
+
case 1:
|
|
3008
|
+
if (!(function(e3) {
|
|
3009
|
+
var t3 = e3.match(wt);
|
|
3010
|
+
if (!t3) return false;
|
|
3011
|
+
var s3 = t3[0].split(".");
|
|
3012
|
+
return !(s3.length < 2 || !Et(s3[s3.length - 1]));
|
|
3013
|
+
})(m2)) return;
|
|
3014
|
+
break;
|
|
3015
|
+
case 2:
|
|
3016
|
+
if (d2 = m2.split(At, 1)[0], !Mt.test(d2)) return;
|
|
3017
|
+
break;
|
|
3018
|
+
default:
|
|
3019
|
+
et(t2);
|
|
3020
|
+
}
|
|
3021
|
+
s2.push(new Dt({ tagBuilder: r2, matchedText: m2, offset: p2, urlMatchType: qs(t2.matchType), url: m2, protocolRelativeMatch: "//" === m2.slice(0, 2), stripPrefix: i2, stripTrailingSlash: o2, decodePercentEncoding: c2 }));
|
|
2899
3022
|
break;
|
|
2900
3023
|
case 1:
|
|
2901
|
-
|
|
3024
|
+
Et(m2.split(".").pop()) && s2.push(new jt({ tagBuilder: r2, matchedText: m2, offset: p2, email: m2.replace(_t, "") }));
|
|
2902
3025
|
break;
|
|
2903
3026
|
case 2:
|
|
2904
|
-
|
|
3027
|
+
m2.length <= 140 && s2.push(new Wt({ tagBuilder: r2, matchedText: m2, offset: p2, serviceName: l2, hashtag: m2.slice(1) }));
|
|
2905
3028
|
break;
|
|
2906
3029
|
case 3:
|
|
2907
|
-
|
|
3030
|
+
(function(e3, t3) {
|
|
3031
|
+
return qt[t3].test(e3);
|
|
3032
|
+
})(m2, h2) && s2.push(new Gt({ tagBuilder: r2, matchedText: m2, offset: p2, serviceName: h2, mention: m2.slice(1) }));
|
|
2908
3033
|
break;
|
|
2909
3034
|
case 4:
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
break;
|
|
2915
|
-
case 6:
|
|
2916
|
-
C2(f2);
|
|
2917
|
-
break;
|
|
2918
|
-
case 7:
|
|
2919
|
-
A2(f2);
|
|
2920
|
-
break;
|
|
2921
|
-
case 8:
|
|
2922
|
-
E2(f2);
|
|
2923
|
-
break;
|
|
2924
|
-
case 9:
|
|
2925
|
-
k2(f2);
|
|
2926
|
-
break;
|
|
2927
|
-
case 10:
|
|
2928
|
-
x2(f2);
|
|
2929
|
-
break;
|
|
2930
|
-
case 11:
|
|
2931
|
-
T2(f2);
|
|
2932
|
-
break;
|
|
2933
|
-
case 12:
|
|
2934
|
-
I2(f2);
|
|
2935
|
-
break;
|
|
2936
|
-
case 13:
|
|
2937
|
-
D2();
|
|
2938
|
-
break;
|
|
2939
|
-
case 14:
|
|
2940
|
-
S2(f2);
|
|
2941
|
-
break;
|
|
2942
|
-
case 15:
|
|
2943
|
-
M2(f2);
|
|
2944
|
-
break;
|
|
2945
|
-
case 16:
|
|
2946
|
-
F2(f2);
|
|
2947
|
-
break;
|
|
2948
|
-
case 17:
|
|
2949
|
-
B2(f2);
|
|
2950
|
-
break;
|
|
2951
|
-
case 18:
|
|
2952
|
-
R2(f2);
|
|
2953
|
-
break;
|
|
2954
|
-
case 19:
|
|
2955
|
-
N2(f2);
|
|
2956
|
-
break;
|
|
2957
|
-
case 20:
|
|
2958
|
-
_2(f2);
|
|
3035
|
+
if (m2 = m2.replace(/ +$/g, ""), ("+" === (u2 = m2).charAt(0) || Ft.test(u2)) && Ht.test(u2)) {
|
|
3036
|
+
var g2 = m2.replace(/[^0-9,;#]/g, "");
|
|
3037
|
+
s2.push(new Yt({ tagBuilder: r2, matchedText: m2, offset: p2, number: g2, plusSign: "+" === m2.charAt(0) }));
|
|
3038
|
+
}
|
|
2959
3039
|
break;
|
|
2960
3040
|
default:
|
|
2961
|
-
|
|
3041
|
+
et(t2);
|
|
2962
3042
|
}
|
|
2963
|
-
c2++;
|
|
2964
|
-
}
|
|
2965
|
-
function m2(e3) {
|
|
2966
|
-
"<" === e3 && P2();
|
|
2967
3043
|
}
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
}
|
|
2980
|
-
function y2(e3) {
|
|
2981
|
-
lt.test(e3) ? h2 = 6 : "/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? $2() : "<" === e3 ? P2() : ht.test(e3) && O2();
|
|
2982
|
-
}
|
|
2983
|
-
function C2(e3) {
|
|
2984
|
-
lt.test(e3) || ("/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? $2() : "<" === e3 ? P2() : ht.test(e3) ? O2() : h2 = 5);
|
|
2985
|
-
}
|
|
2986
|
-
function A2(e3) {
|
|
2987
|
-
lt.test(e3) || ('"' === e3 ? h2 = 8 : "'" === e3 ? h2 = 9 : /[>=`]/.test(e3) ? O2() : "<" === e3 ? P2() : h2 = 10);
|
|
2988
|
-
}
|
|
2989
|
-
function E2(e3) {
|
|
2990
|
-
'"' === e3 && (h2 = 11);
|
|
2991
|
-
}
|
|
2992
|
-
function k2(e3) {
|
|
2993
|
-
"'" === e3 && (h2 = 11);
|
|
2994
|
-
}
|
|
2995
|
-
function x2(e3) {
|
|
2996
|
-
lt.test(e3) ? h2 = 4 : ">" === e3 ? $2() : "<" === e3 && P2();
|
|
2997
|
-
}
|
|
2998
|
-
function T2(e3) {
|
|
2999
|
-
lt.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? $2() : "<" === e3 ? P2() : (h2 = 4, c2--);
|
|
3000
|
-
}
|
|
3001
|
-
function I2(e3) {
|
|
3002
|
-
">" === e3 ? (p2 = new Ht(et(et({}, p2), { isClosing: true })), $2()) : h2 = 4;
|
|
3003
|
-
}
|
|
3004
|
-
function D2(t3) {
|
|
3005
|
-
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new Ht(et(et({}, p2), { type: "comment" })), h2 = 14) : "DOCTYPE" === e2.substr(c2, 7).toUpperCase() ? (c2 += 7, p2 = new Ht(et(et({}, p2), { type: "doctype" })), h2 = 20) : O2();
|
|
3006
|
-
}
|
|
3007
|
-
function S2(e3) {
|
|
3008
|
-
"-" === e3 ? h2 = 15 : ">" === e3 ? O2() : h2 = 16;
|
|
3009
|
-
}
|
|
3010
|
-
function M2(e3) {
|
|
3011
|
-
"-" === e3 ? h2 = 18 : ">" === e3 ? O2() : h2 = 16;
|
|
3012
|
-
}
|
|
3013
|
-
function F2(e3) {
|
|
3014
|
-
"-" === e3 && (h2 = 17);
|
|
3015
|
-
}
|
|
3016
|
-
function B2(e3) {
|
|
3017
|
-
h2 = "-" === e3 ? 18 : 16;
|
|
3018
|
-
}
|
|
3019
|
-
function R2(e3) {
|
|
3020
|
-
">" === e3 ? $2() : "!" === e3 ? h2 = 19 : "-" === e3 || (h2 = 16);
|
|
3021
|
-
}
|
|
3022
|
-
function N2(e3) {
|
|
3023
|
-
"-" === e3 ? h2 = 17 : ">" === e3 ? $2() : h2 = 16;
|
|
3024
|
-
}
|
|
3025
|
-
function _2(e3) {
|
|
3026
|
-
">" === e3 ? $2() : "<" === e3 && P2();
|
|
3027
|
-
}
|
|
3028
|
-
function O2() {
|
|
3029
|
-
h2 = 0, p2 = u2;
|
|
3030
|
-
}
|
|
3031
|
-
function P2() {
|
|
3032
|
-
h2 = 1, p2 = new Ht({ idx: c2 });
|
|
3033
|
-
}
|
|
3034
|
-
function $2() {
|
|
3035
|
-
var t3 = e2.slice(d2, p2.idx);
|
|
3036
|
-
t3 && a2(t3, d2), "comment" === p2.type ? i2(p2.idx) : "doctype" === p2.type ? o2(p2.idx) : (p2.isOpening && n2(p2.name, p2.idx), p2.isClosing && r2(p2.name, p2.idx)), O2(), d2 = c2 + 1;
|
|
3037
|
-
}
|
|
3038
|
-
function j2() {
|
|
3039
|
-
var t3 = p2.idx + (p2.isClosing ? 2 : 1);
|
|
3040
|
-
return e2.slice(t3, c2).toLowerCase();
|
|
3044
|
+
}
|
|
3045
|
+
function qs(e2) {
|
|
3046
|
+
switch (e2) {
|
|
3047
|
+
case 0:
|
|
3048
|
+
return "scheme";
|
|
3049
|
+
case 1:
|
|
3050
|
+
return "tld";
|
|
3051
|
+
case 2:
|
|
3052
|
+
return "ipV4";
|
|
3053
|
+
default:
|
|
3054
|
+
et(e2);
|
|
3041
3055
|
}
|
|
3042
|
-
d2 < c2 && (s2 = e2.slice(d2, c2), a2(s2, d2), d2 = c2 + 1);
|
|
3043
3056
|
}
|
|
3044
|
-
var
|
|
3057
|
+
var Bs = { ")": "(", "}": "{", "]": "[" };
|
|
3058
|
+
function Ls(e2, t2) {
|
|
3059
|
+
return { type: 0, startIdx: e2, state: t2, acceptStateReached: false, matchType: 0 };
|
|
3060
|
+
}
|
|
3061
|
+
function Gs(e2, t2) {
|
|
3062
|
+
return { type: 0, startIdx: e2, state: t2, acceptStateReached: false, matchType: 1 };
|
|
3063
|
+
}
|
|
3064
|
+
function Fs(e2, t2) {
|
|
3065
|
+
return { type: 4, startIdx: e2, state: t2, acceptStateReached: false };
|
|
3066
|
+
}
|
|
3067
|
+
function Hs(e2) {
|
|
3068
|
+
return 0 === e2.type && 0 === e2.matchType;
|
|
3069
|
+
}
|
|
3070
|
+
var Js = function(e2) {
|
|
3045
3071
|
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;
|
|
3046
|
-
},
|
|
3072
|
+
}, zs = new Js(), Ys = function(e2, t2) {
|
|
3073
|
+
this.charIdx = 0, this.state = 0, this.currentDataIdx = 0, this.currentTag = zs, this.html = e2, this.callbacks = t2;
|
|
3074
|
+
};
|
|
3075
|
+
function Qs(e2, t2) {
|
|
3076
|
+
"<" === t2 && bn(e2);
|
|
3077
|
+
}
|
|
3078
|
+
function Vs(e2, t2, s2) {
|
|
3079
|
+
"!" === t2 ? e2.state = 13 : "/" === t2 ? (e2.state = 2, e2.currentTag = new Js(Ve(Ve({}, e2.currentTag), { isClosing: true }))) : "<" === t2 ? bn(e2) : ot(s2) ? (e2.state = 3, e2.currentTag = new Js(Ve(Ve({}, e2.currentTag), { isOpening: true }))) : (e2.state = 0, e2.currentTag = zs);
|
|
3080
|
+
}
|
|
3081
|
+
function Ks(e2, t2, s2) {
|
|
3082
|
+
ht(s2) ? (e2.currentTag = new Js(Ve(Ve({}, e2.currentTag), { name: wn(e2) })), e2.state = 4) : "<" === t2 ? bn(e2) : "/" === t2 ? (e2.currentTag = new Js(Ve(Ve({}, e2.currentTag), { name: wn(e2) })), e2.state = 12) : ">" === t2 ? (e2.currentTag = new Js(Ve(Ve({}, e2.currentTag), { name: wn(e2) })), yn(e2)) : ot(s2) || ct(s2) || ":" === t2 || vn(e2);
|
|
3083
|
+
}
|
|
3084
|
+
function Zs(e2, t2, s2) {
|
|
3085
|
+
">" === t2 ? vn(e2) : ot(s2) ? e2.state = 3 : vn(e2);
|
|
3086
|
+
}
|
|
3087
|
+
function Xs(e2, t2, s2) {
|
|
3088
|
+
var n2;
|
|
3089
|
+
ht(s2) || ("/" === t2 ? e2.state = 12 : ">" === t2 ? yn(e2) : "<" === t2 ? bn(e2) : "=" === t2 || lt(s2) || ((n2 = s2) >= 0 && n2 <= 31 || 127 == n2) ? vn(e2) : e2.state = 5);
|
|
3090
|
+
}
|
|
3091
|
+
function en(e2, t2, s2) {
|
|
3092
|
+
ht(s2) ? e2.state = 6 : "/" === t2 ? e2.state = 12 : "=" === t2 ? e2.state = 7 : ">" === t2 ? yn(e2) : "<" === t2 ? bn(e2) : lt(s2) && vn(e2);
|
|
3093
|
+
}
|
|
3094
|
+
function tn(e2, t2, s2) {
|
|
3095
|
+
ht(s2) || ("/" === t2 ? e2.state = 12 : "=" === t2 ? e2.state = 7 : ">" === t2 ? yn(e2) : "<" === t2 ? bn(e2) : lt(s2) ? vn(e2) : e2.state = 5);
|
|
3096
|
+
}
|
|
3097
|
+
function sn(e2, t2, s2) {
|
|
3098
|
+
ht(s2) || ('"' === t2 ? e2.state = 8 : "'" === t2 ? e2.state = 9 : /[>=`]/.test(t2) ? vn(e2) : "<" === t2 ? bn(e2) : e2.state = 10);
|
|
3099
|
+
}
|
|
3100
|
+
function nn(e2, t2) {
|
|
3101
|
+
'"' === t2 && (e2.state = 11);
|
|
3102
|
+
}
|
|
3103
|
+
function an(e2, t2) {
|
|
3104
|
+
"'" === t2 && (e2.state = 11);
|
|
3105
|
+
}
|
|
3106
|
+
function rn(e2, t2, s2) {
|
|
3107
|
+
ht(s2) ? e2.state = 4 : ">" === t2 ? yn(e2) : "<" === t2 && bn(e2);
|
|
3108
|
+
}
|
|
3109
|
+
function on(e2, t2, s2) {
|
|
3110
|
+
ht(s2) ? e2.state = 4 : "/" === t2 ? e2.state = 12 : ">" === t2 ? yn(e2) : "<" === t2 ? bn(e2) : (e2.state = 4, (function(e3) {
|
|
3111
|
+
e3.charIdx--;
|
|
3112
|
+
})(e2));
|
|
3113
|
+
}
|
|
3114
|
+
function cn(e2, t2) {
|
|
3115
|
+
">" === t2 ? (e2.currentTag = new Js(Ve(Ve({}, e2.currentTag), { isClosing: true })), yn(e2)) : vn(e2);
|
|
3116
|
+
}
|
|
3117
|
+
function ln(e2) {
|
|
3118
|
+
var t2 = e2.html, s2 = e2.charIdx;
|
|
3119
|
+
"--" === t2.slice(s2, s2 + 2) ? (e2.charIdx++, e2.currentTag = new Js(Ve(Ve({}, e2.currentTag), { type: "comment" })), e2.state = 14) : "DOCTYPE" === t2.slice(s2, s2 + 7).toUpperCase() ? (e2.charIdx += 6, e2.currentTag = new Js(Ve(Ve({}, e2.currentTag), { type: "doctype" })), e2.state = 20) : vn(e2);
|
|
3120
|
+
}
|
|
3121
|
+
function hn(e2, t2) {
|
|
3122
|
+
"-" === t2 ? e2.state = 15 : ">" === t2 ? vn(e2) : e2.state = 16;
|
|
3123
|
+
}
|
|
3124
|
+
function un(e2, t2) {
|
|
3125
|
+
"-" === t2 ? e2.state = 18 : ">" === t2 ? vn(e2) : e2.state = 16;
|
|
3126
|
+
}
|
|
3127
|
+
function dn(e2, t2) {
|
|
3128
|
+
"-" === t2 && (e2.state = 17);
|
|
3129
|
+
}
|
|
3130
|
+
function pn(e2, t2) {
|
|
3131
|
+
e2.state = "-" === t2 ? 18 : 16;
|
|
3132
|
+
}
|
|
3133
|
+
function mn(e2, t2) {
|
|
3134
|
+
">" === t2 ? yn(e2) : "!" === t2 ? e2.state = 19 : "-" === t2 || (e2.state = 16);
|
|
3135
|
+
}
|
|
3136
|
+
function fn(e2, t2) {
|
|
3137
|
+
"-" === t2 ? e2.state = 17 : ">" === t2 ? yn(e2) : e2.state = 16;
|
|
3138
|
+
}
|
|
3139
|
+
function gn(e2, t2) {
|
|
3140
|
+
">" === t2 ? yn(e2) : "<" === t2 && bn(e2);
|
|
3141
|
+
}
|
|
3142
|
+
function vn(e2) {
|
|
3143
|
+
e2.state = 0, e2.currentTag = zs;
|
|
3144
|
+
}
|
|
3145
|
+
function bn(e2) {
|
|
3146
|
+
e2.state = 1, e2.currentTag = new Js({ idx: e2.charIdx });
|
|
3147
|
+
}
|
|
3148
|
+
function yn(e2) {
|
|
3149
|
+
var t2 = e2.html.slice(e2.currentDataIdx, e2.currentTag.idx);
|
|
3150
|
+
t2 && e2.callbacks.onText(t2, e2.currentDataIdx);
|
|
3151
|
+
var s2 = e2.currentTag;
|
|
3152
|
+
"comment" === s2.type ? e2.callbacks.onComment(s2.idx) : "doctype" === s2.type ? e2.callbacks.onDoctype(s2.idx) : (s2.isOpening && e2.callbacks.onOpenTag(s2.name, s2.idx), s2.isClosing && e2.callbacks.onCloseTag(s2.name, s2.idx)), vn(e2), e2.currentDataIdx = e2.charIdx + 1;
|
|
3153
|
+
}
|
|
3154
|
+
function wn(e2) {
|
|
3155
|
+
var t2 = e2.currentTag.idx + (e2.currentTag.isClosing ? 2 : 1);
|
|
3156
|
+
return e2.html.slice(t2, e2.charIdx).toLowerCase();
|
|
3157
|
+
}
|
|
3158
|
+
var kn = (function() {
|
|
3047
3159
|
function e2(t2) {
|
|
3048
|
-
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.
|
|
3160
|
+
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.tagBuilder = null, this.urls = (function(e3) {
|
|
3161
|
+
null == e3 && (e3 = true);
|
|
3162
|
+
return Ze(e3) ? { schemeMatches: e3, tldMatches: e3, ipV4Matches: e3 } : { schemeMatches: !Ze(e3.schemeMatches) || e3.schemeMatches, tldMatches: !Ze(e3.tldMatches) || e3.tldMatches, ipV4Matches: !Ze(e3.ipV4Matches) || e3.ipV4Matches };
|
|
3163
|
+
})(t2.urls), this.email = Ze(t2.email) ? t2.email : this.email, this.phone = Ze(t2.phone) ? t2.phone : this.phone, this.hashtag = t2.hashtag || this.hashtag, this.mention = t2.mention || this.mention, this.newWindow = Ze(t2.newWindow) ? t2.newWindow : this.newWindow, this.stripPrefix = (function(e3) {
|
|
3164
|
+
null == e3 && (e3 = true);
|
|
3165
|
+
return Ze(e3) ? { scheme: e3, www: e3 } : { scheme: !Ze(e3.scheme) || e3.scheme, www: !Ze(e3.www) || e3.www };
|
|
3166
|
+
})(t2.stripPrefix), this.stripTrailingSlash = Ze(t2.stripTrailingSlash) ? t2.stripTrailingSlash : this.stripTrailingSlash, this.decodePercentEncoding = Ze(t2.decodePercentEncoding) ? t2.decodePercentEncoding : this.decodePercentEncoding, this.sanitizeHtml = t2.sanitizeHtml || false;
|
|
3049
3167
|
var s2 = this.mention;
|
|
3050
|
-
if (false !== s2 &&
|
|
3051
|
-
var n2 = this.hashtag;
|
|
3052
|
-
if (false !==
|
|
3053
|
-
this.truncate =
|
|
3168
|
+
if (false !== s2 && -1 === Lt.indexOf(s2)) throw new Error("invalid `mention` cfg '".concat(s2, "' - see docs"));
|
|
3169
|
+
var n2, a2 = this.hashtag;
|
|
3170
|
+
if (false !== a2 && -1 === Ut.indexOf(a2)) throw new Error("invalid `hashtag` cfg '".concat(a2, "' - see docs"));
|
|
3171
|
+
this.truncate = "number" == typeof (n2 = t2.truncate) ? { length: n2, location: "end" } : Ve({ length: Number.POSITIVE_INFINITY, location: "end" }, n2), this.className = t2.className || this.className, this.replaceFn = t2.replaceFn || this.replaceFn, this.context = t2.context || this;
|
|
3054
3172
|
}
|
|
3055
3173
|
return e2.link = function(t2, s2) {
|
|
3056
3174
|
return new e2(s2).link(t2);
|
|
3057
3175
|
}, e2.parse = function(t2, s2) {
|
|
3058
3176
|
return new e2(s2).parse(t2);
|
|
3059
|
-
}, e2.prototype.normalizeUrlsCfg = function(e3) {
|
|
3060
|
-
return null == e3 && (e3 = true), "boolean" == typeof e3 ? { schemeMatches: e3, wwwMatches: e3, tldMatches: e3 } : { schemeMatches: "boolean" != typeof e3.schemeMatches || e3.schemeMatches, wwwMatches: "boolean" != typeof e3.wwwMatches || e3.wwwMatches, tldMatches: "boolean" != typeof e3.tldMatches || e3.tldMatches };
|
|
3061
|
-
}, e2.prototype.normalizeStripPrefixCfg = function(e3) {
|
|
3062
|
-
return null == e3 && (e3 = true), "boolean" == typeof e3 ? { scheme: e3, www: e3 } : { scheme: "boolean" != typeof e3.scheme || e3.scheme, www: "boolean" != typeof e3.www || e3.www };
|
|
3063
|
-
}, e2.prototype.normalizeTruncateCfg = function(e3) {
|
|
3064
|
-
return "number" == typeof e3 ? { length: e3, location: "end" } : function(e4, t2) {
|
|
3065
|
-
for (var s2 in t2) t2.hasOwnProperty(s2) && void 0 === e4[s2] && (e4[s2] = t2[s2]);
|
|
3066
|
-
return e4;
|
|
3067
|
-
}(e3 || {}, { length: Number.POSITIVE_INFINITY, location: "end" });
|
|
3068
3177
|
}, e2.prototype.parse = function(e3) {
|
|
3069
|
-
var t2 = this, s2 = ["a", "style", "script"], n2 = 0,
|
|
3070
|
-
return
|
|
3178
|
+
var t2 = this, s2 = ["a", "style", "script"], n2 = 0, a2 = [];
|
|
3179
|
+
return (function(e4, t3) {
|
|
3180
|
+
for (var s3 = new Ys(e4, t3), n3 = e4.length; s3.charIdx < n3; ) {
|
|
3181
|
+
var a3 = e4.charAt(s3.charIdx), r2 = e4.charCodeAt(s3.charIdx);
|
|
3182
|
+
switch (s3.state) {
|
|
3183
|
+
case 0:
|
|
3184
|
+
Qs(s3, a3);
|
|
3185
|
+
break;
|
|
3186
|
+
case 1:
|
|
3187
|
+
Vs(s3, a3, r2);
|
|
3188
|
+
break;
|
|
3189
|
+
case 2:
|
|
3190
|
+
Zs(s3, a3, r2);
|
|
3191
|
+
break;
|
|
3192
|
+
case 3:
|
|
3193
|
+
Ks(s3, a3, r2);
|
|
3194
|
+
break;
|
|
3195
|
+
case 4:
|
|
3196
|
+
Xs(s3, a3, r2);
|
|
3197
|
+
break;
|
|
3198
|
+
case 5:
|
|
3199
|
+
en(s3, a3, r2);
|
|
3200
|
+
break;
|
|
3201
|
+
case 6:
|
|
3202
|
+
tn(s3, a3, r2);
|
|
3203
|
+
break;
|
|
3204
|
+
case 7:
|
|
3205
|
+
sn(s3, a3, r2);
|
|
3206
|
+
break;
|
|
3207
|
+
case 8:
|
|
3208
|
+
nn(s3, a3);
|
|
3209
|
+
break;
|
|
3210
|
+
case 9:
|
|
3211
|
+
an(s3, a3);
|
|
3212
|
+
break;
|
|
3213
|
+
case 10:
|
|
3214
|
+
rn(s3, a3, r2);
|
|
3215
|
+
break;
|
|
3216
|
+
case 11:
|
|
3217
|
+
on(s3, a3, r2);
|
|
3218
|
+
break;
|
|
3219
|
+
case 12:
|
|
3220
|
+
cn(s3, a3);
|
|
3221
|
+
break;
|
|
3222
|
+
case 13:
|
|
3223
|
+
ln(s3);
|
|
3224
|
+
break;
|
|
3225
|
+
case 14:
|
|
3226
|
+
hn(s3, a3);
|
|
3227
|
+
break;
|
|
3228
|
+
case 15:
|
|
3229
|
+
un(s3, a3);
|
|
3230
|
+
break;
|
|
3231
|
+
case 16:
|
|
3232
|
+
dn(s3, a3);
|
|
3233
|
+
break;
|
|
3234
|
+
case 17:
|
|
3235
|
+
pn(s3, a3);
|
|
3236
|
+
break;
|
|
3237
|
+
case 18:
|
|
3238
|
+
mn(s3, a3);
|
|
3239
|
+
break;
|
|
3240
|
+
case 19:
|
|
3241
|
+
fn(s3, a3);
|
|
3242
|
+
break;
|
|
3243
|
+
case 20:
|
|
3244
|
+
gn(s3, a3);
|
|
3245
|
+
break;
|
|
3246
|
+
default:
|
|
3247
|
+
et(s3.state);
|
|
3248
|
+
}
|
|
3249
|
+
s3.charIdx++;
|
|
3250
|
+
}
|
|
3251
|
+
s3.currentDataIdx < s3.charIdx && (function(e5) {
|
|
3252
|
+
var t4 = e5.html.slice(e5.currentDataIdx, e5.charIdx);
|
|
3253
|
+
e5.callbacks.onText(t4, e5.currentDataIdx), e5.currentDataIdx = e5.charIdx + 1;
|
|
3254
|
+
})(s3);
|
|
3255
|
+
})(e3, { onOpenTag: function(e4) {
|
|
3071
3256
|
s2.indexOf(e4) >= 0 && n2++;
|
|
3072
3257
|
}, onText: function(e4, s3) {
|
|
3073
3258
|
if (0 === n2) {
|
|
3074
|
-
var
|
|
3075
|
-
|
|
3076
|
-
for (var s4, n3 = [], r3 = 0; s4 = t3.exec(e5); ) n3.push(e5.substring(r3, s4.index)), n3.push(s4[0]), r3 = s4.index + s4[0].length;
|
|
3077
|
-
return n3.push(e5.substring(r3)), n3;
|
|
3078
|
-
}(e4, /( | |<|<|>|>|"|"|')/gi), i2 = s3;
|
|
3079
|
-
a2.forEach(function(e5, s4) {
|
|
3259
|
+
var r2 = e4.split(/( | |<|<|>|>|"|"|')/gi), i2 = s3;
|
|
3260
|
+
r2.forEach(function(e5, s4) {
|
|
3080
3261
|
if (s4 % 2 == 0) {
|
|
3081
3262
|
var n3 = t2.parseText(e5, i2);
|
|
3082
|
-
|
|
3263
|
+
a2.push.apply(a2, (function(e6, t3, s5) {
|
|
3264
|
+
if (s5 || 2 === arguments.length) for (var n4, a3 = 0, r3 = t3.length; a3 < r3; a3++) !n4 && a3 in t3 || (n4 || (n4 = Array.prototype.slice.call(t3, 0, a3)), n4[a3] = t3[a3]);
|
|
3265
|
+
return e6.concat(n4 || Array.prototype.slice.call(t3));
|
|
3266
|
+
})([], (function(e6, t3) {
|
|
3267
|
+
var s5 = "function" == typeof Symbol && e6[Symbol.iterator];
|
|
3268
|
+
if (!s5) return e6;
|
|
3269
|
+
var n4, a3, r3 = s5.call(e6), i3 = [];
|
|
3270
|
+
try {
|
|
3271
|
+
for (; (void 0 === t3 || t3-- > 0) && !(n4 = r3.next()).done; ) i3.push(n4.value);
|
|
3272
|
+
} catch (e7) {
|
|
3273
|
+
a3 = { error: e7 };
|
|
3274
|
+
} finally {
|
|
3275
|
+
try {
|
|
3276
|
+
n4 && !n4.done && (s5 = r3.return) && s5.call(r3);
|
|
3277
|
+
} finally {
|
|
3278
|
+
if (a3) throw a3.error;
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
return i3;
|
|
3282
|
+
})(n3), false));
|
|
3083
3283
|
}
|
|
3084
3284
|
i2 += e5.length;
|
|
3085
3285
|
});
|
|
3086
3286
|
}
|
|
3087
3287
|
}, onCloseTag: function(e4) {
|
|
3088
3288
|
s2.indexOf(e4) >= 0 && (n2 = Math.max(n2 - 1, 0));
|
|
3089
|
-
}, onComment: function(
|
|
3090
|
-
}, onDoctype: function(
|
|
3091
|
-
} }),
|
|
3289
|
+
}, onComment: function() {
|
|
3290
|
+
}, onDoctype: function() {
|
|
3291
|
+
} }), a2 = this.compactMatches(a2), a2 = this.removeUnwantedMatches(a2);
|
|
3092
3292
|
}, e2.prototype.compactMatches = function(e3) {
|
|
3093
|
-
e3.sort(
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
var i2 = e3[t2 + 1].getMatchedText().length > r2 ? t2 : t2 + 1;
|
|
3101
|
-
e3.splice(i2, 1);
|
|
3102
|
-
continue;
|
|
3103
|
-
}
|
|
3104
|
-
e3[t2 + 1].getOffset() < a2 && e3.splice(t2 + 1, 1);
|
|
3105
|
-
}
|
|
3293
|
+
e3.sort(Cn);
|
|
3294
|
+
for (var t2 = 0; t2 < e3.length - 1; ) {
|
|
3295
|
+
var s2 = e3[t2], n2 = s2.getOffset(), a2 = s2.getMatchedText().length;
|
|
3296
|
+
if (t2 + 1 < e3.length && e3[t2 + 1].getOffset() === n2) {
|
|
3297
|
+
var r2 = e3[t2 + 1].getMatchedText().length > a2 ? t2 : t2 + 1;
|
|
3298
|
+
e3.splice(r2, 1);
|
|
3299
|
+
} else t2++;
|
|
3106
3300
|
}
|
|
3107
3301
|
return e3;
|
|
3108
3302
|
}, e2.prototype.removeUnwantedMatches = function(e3) {
|
|
3109
|
-
return this.hashtag ||
|
|
3303
|
+
return this.hashtag || Xe(e3, function(e4) {
|
|
3110
3304
|
return "hashtag" === e4.getType();
|
|
3111
|
-
}), this.email ||
|
|
3305
|
+
}), this.email || Xe(e3, function(e4) {
|
|
3112
3306
|
return "email" === e4.getType();
|
|
3113
|
-
}), this.phone ||
|
|
3307
|
+
}), this.phone || Xe(e3, function(e4) {
|
|
3114
3308
|
return "phone" === e4.getType();
|
|
3115
|
-
}), this.mention ||
|
|
3309
|
+
}), this.mention || Xe(e3, function(e4) {
|
|
3116
3310
|
return "mention" === e4.getType();
|
|
3117
|
-
}), this.urls.schemeMatches ||
|
|
3311
|
+
}), this.urls.schemeMatches || Xe(e3, function(e4) {
|
|
3118
3312
|
return "url" === e4.getType() && "scheme" === e4.getUrlMatchType();
|
|
3119
|
-
}), this.urls.
|
|
3120
|
-
return "url" === e4.getType() && "www" === e4.getUrlMatchType();
|
|
3121
|
-
}), this.urls.tldMatches || ze(e3, function(e4) {
|
|
3313
|
+
}), this.urls.tldMatches || Xe(e3, function(e4) {
|
|
3122
3314
|
return "url" === e4.getType() && "tld" === e4.getUrlMatchType();
|
|
3315
|
+
}), this.urls.ipV4Matches || Xe(e3, function(e4) {
|
|
3316
|
+
return "url" === e4.getType() && "ipV4" === e4.getUrlMatchType();
|
|
3123
3317
|
}), e3;
|
|
3124
3318
|
}, e2.prototype.parseText = function(e3, t2) {
|
|
3125
|
-
|
|
3126
|
-
for (var s2 =
|
|
3127
|
-
for (var
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3319
|
+
t2 = t2 || 0;
|
|
3320
|
+
for (var s2 = (function(e4, t3) {
|
|
3321
|
+
for (var s3 = new Qt(e4, t3); s3.charIdx < s3.text.length; s3.charIdx++) {
|
|
3322
|
+
var n3 = e4.charAt(s3.charIdx), a3 = e4.charCodeAt(s3.charIdx);
|
|
3323
|
+
if (0 === s3.stateMachines.length) Vt(s3, n3, a3);
|
|
3324
|
+
else {
|
|
3325
|
+
for (var r2 = s3.stateMachines.length - 1; r2 >= 0; r2--) {
|
|
3326
|
+
var i2 = s3.stateMachines[r2];
|
|
3327
|
+
switch (i2.state) {
|
|
3328
|
+
case 11:
|
|
3329
|
+
ss(s3, i2, a3);
|
|
3330
|
+
break;
|
|
3331
|
+
case 12:
|
|
3332
|
+
ns(s3, i2, a3);
|
|
3333
|
+
break;
|
|
3334
|
+
case 0:
|
|
3335
|
+
Kt(s3, i2, a3);
|
|
3336
|
+
break;
|
|
3337
|
+
case 1:
|
|
3338
|
+
Zt(s3, i2, a3);
|
|
3339
|
+
break;
|
|
3340
|
+
case 2:
|
|
3341
|
+
Xt(s3, i2, a3);
|
|
3342
|
+
break;
|
|
3343
|
+
case 3:
|
|
3344
|
+
es(s3, i2, a3);
|
|
3345
|
+
break;
|
|
3346
|
+
case 4:
|
|
3347
|
+
ts(s3, i2, 0, a3);
|
|
3348
|
+
break;
|
|
3349
|
+
case 5:
|
|
3350
|
+
as(s3, i2, a3);
|
|
3351
|
+
break;
|
|
3352
|
+
case 6:
|
|
3353
|
+
rs(s3, i2, 0, a3);
|
|
3354
|
+
break;
|
|
3355
|
+
case 7:
|
|
3356
|
+
is(s3, i2, 0, a3);
|
|
3357
|
+
break;
|
|
3358
|
+
case 13:
|
|
3359
|
+
os(s3, i2, a3);
|
|
3360
|
+
break;
|
|
3361
|
+
case 14:
|
|
3362
|
+
cs(s3, i2, a3);
|
|
3363
|
+
break;
|
|
3364
|
+
case 8:
|
|
3365
|
+
ls(s3, i2, a3);
|
|
3366
|
+
break;
|
|
3367
|
+
case 9:
|
|
3368
|
+
hs(s3, i2, a3);
|
|
3369
|
+
break;
|
|
3370
|
+
case 10:
|
|
3371
|
+
us(s3, i2, a3);
|
|
3372
|
+
break;
|
|
3373
|
+
case 15:
|
|
3374
|
+
ds(s3, i2, n3, a3);
|
|
3375
|
+
break;
|
|
3376
|
+
case 16:
|
|
3377
|
+
ps(s3, i2, n3, a3);
|
|
3378
|
+
break;
|
|
3379
|
+
case 17:
|
|
3380
|
+
ms(s3, i2, n3, a3);
|
|
3381
|
+
break;
|
|
3382
|
+
case 18:
|
|
3383
|
+
fs(s3, i2, n3, a3);
|
|
3384
|
+
break;
|
|
3385
|
+
case 19:
|
|
3386
|
+
gs(s3, i2, n3, a3);
|
|
3387
|
+
break;
|
|
3388
|
+
case 20:
|
|
3389
|
+
vs(s3, i2, a3);
|
|
3390
|
+
break;
|
|
3391
|
+
case 21:
|
|
3392
|
+
bs(s3, i2, a3);
|
|
3393
|
+
break;
|
|
3394
|
+
case 22:
|
|
3395
|
+
ys(s3, i2, a3);
|
|
3396
|
+
break;
|
|
3397
|
+
case 23:
|
|
3398
|
+
ws(s3, i2, a3);
|
|
3399
|
+
break;
|
|
3400
|
+
case 24:
|
|
3401
|
+
ks(s3, i2, a3);
|
|
3402
|
+
break;
|
|
3403
|
+
case 25:
|
|
3404
|
+
Cs(s3, i2, a3);
|
|
3405
|
+
break;
|
|
3406
|
+
case 26:
|
|
3407
|
+
Ts(s3, i2, a3);
|
|
3408
|
+
break;
|
|
3409
|
+
case 27:
|
|
3410
|
+
Is(s3, i2, a3);
|
|
3411
|
+
break;
|
|
3412
|
+
case 28:
|
|
3413
|
+
Ss(s3, i2, a3);
|
|
3414
|
+
break;
|
|
3415
|
+
case 29:
|
|
3416
|
+
xs(s3, i2, a3);
|
|
3417
|
+
break;
|
|
3418
|
+
case 30:
|
|
3419
|
+
Es(s3, i2, a3);
|
|
3420
|
+
break;
|
|
3421
|
+
case 31:
|
|
3422
|
+
Ms(s3, i2, a3);
|
|
3423
|
+
break;
|
|
3424
|
+
case 32:
|
|
3425
|
+
Ns(s3, i2, n3, a3);
|
|
3426
|
+
break;
|
|
3427
|
+
case 33:
|
|
3428
|
+
Rs(s3, i2, a3);
|
|
3429
|
+
break;
|
|
3430
|
+
case 34:
|
|
3431
|
+
Ds(s3, i2, a3);
|
|
3432
|
+
break;
|
|
3433
|
+
case 35:
|
|
3434
|
+
_s(s3, i2, a3);
|
|
3435
|
+
break;
|
|
3436
|
+
case 36:
|
|
3437
|
+
Os(s3, i2, 0, a3);
|
|
3438
|
+
break;
|
|
3439
|
+
case 37:
|
|
3440
|
+
As(s3, i2, n3, a3);
|
|
3441
|
+
break;
|
|
3442
|
+
case 38:
|
|
3443
|
+
Ps(s3, i2, 0, a3);
|
|
3444
|
+
break;
|
|
3445
|
+
case 39:
|
|
3446
|
+
js(s3, i2, n3, a3);
|
|
3447
|
+
break;
|
|
3448
|
+
case 40:
|
|
3449
|
+
$s(s3, i2, a3);
|
|
3450
|
+
break;
|
|
3451
|
+
case 41:
|
|
3452
|
+
Us(s3, i2, a3);
|
|
3453
|
+
break;
|
|
3454
|
+
default:
|
|
3455
|
+
et(i2.state);
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
if (!s3.hasSchemeUrlMachine() && s3.charIdx > 0 && kt(a3)) {
|
|
3459
|
+
var o2 = s3.text.charCodeAt(s3.charIdx - 1);
|
|
3460
|
+
kt(o2) || s3.addMachine(Ls(s3.charIdx, 0));
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
for (var c2 = s3.stateMachines.length - 1; c2 >= 0; c2--) s3.stateMachines.forEach(function(e5) {
|
|
3465
|
+
return Ws(s3, e5);
|
|
3466
|
+
});
|
|
3467
|
+
return s3.matches;
|
|
3468
|
+
})(e3, { tagBuilder: this.getTagBuilder(), stripPrefix: this.stripPrefix, stripTrailingSlash: this.stripTrailingSlash, decodePercentEncoding: this.decodePercentEncoding, hashtagServiceName: this.hashtag, mentionServiceName: this.mention || "twitter" }), n2 = 0, a2 = s2.length; n2 < a2; n2++) s2[n2].setOffset(t2 + s2[n2].getOffset());
|
|
3469
|
+
return s2;
|
|
3131
3470
|
}, e2.prototype.link = function(e3) {
|
|
3132
3471
|
if (!e3) return "";
|
|
3133
3472
|
this.sanitizeHtml && (e3 = e3.replace(/</g, "<").replace(/>/g, ">"));
|
|
3134
|
-
for (var t2 = this.parse(e3), s2 =
|
|
3135
|
-
var i2 = t2[
|
|
3473
|
+
for (var t2 = this.parse(e3), s2 = new Array(2 * t2.length + 1), n2 = 0, a2 = 0, r2 = t2.length; a2 < r2; a2++) {
|
|
3474
|
+
var i2 = t2[a2];
|
|
3136
3475
|
s2.push(e3.substring(n2, i2.getOffset())), s2.push(this.createMatchReturnVal(i2)), n2 = i2.getOffset() + i2.getMatchedText().length;
|
|
3137
3476
|
}
|
|
3138
3477
|
return s2.push(e3.substring(n2)), s2.join("");
|
|
3139
3478
|
}, e2.prototype.createMatchReturnVal = function(e3) {
|
|
3140
3479
|
var t2;
|
|
3141
|
-
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof
|
|
3142
|
-
}, e2.prototype.getMatchers = function() {
|
|
3143
|
-
if (this.matchers) return this.matchers;
|
|
3144
|
-
var e3 = this.getTagBuilder(), t2 = [new Nt({ tagBuilder: e3, serviceName: this.hashtag }), new Tt({ tagBuilder: e3 }), new Ot({ tagBuilder: e3 }), new Wt({ tagBuilder: e3, serviceName: this.mention }), new Ft({ tagBuilder: e3, stripPrefix: this.stripPrefix, stripTrailingSlash: this.stripTrailingSlash, decodePercentEncoding: this.decodePercentEncoding })];
|
|
3145
|
-
return this.matchers = t2;
|
|
3480
|
+
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof st ? t2.toAnchorString() : e3.buildTag().toAnchorString();
|
|
3146
3481
|
}, e2.prototype.getTagBuilder = function() {
|
|
3147
3482
|
var e3 = this.tagBuilder;
|
|
3148
|
-
return e3 || (e3 = this.tagBuilder = new
|
|
3149
|
-
}, e2.version = "
|
|
3150
|
-
}();
|
|
3151
|
-
function
|
|
3483
|
+
return e3 || (e3 = this.tagBuilder = new rt({ newWindow: this.newWindow, truncate: this.truncate, className: this.className })), e3;
|
|
3484
|
+
}, e2.version = "4.1.5", e2;
|
|
3485
|
+
})();
|
|
3486
|
+
function Cn(e2, t2) {
|
|
3487
|
+
return e2.getOffset() - t2.getOffset();
|
|
3488
|
+
}
|
|
3489
|
+
function Tn(e2, t2 = e2) {
|
|
3152
3490
|
return { type: "autolink", url: e2, text: t2 };
|
|
3153
3491
|
}
|
|
3154
|
-
const
|
|
3492
|
+
const In = qe(/<!!mention:([^>\s]*?)\|(.*?)>/gm, ([e2, t2, s2]) => /* @__PURE__ */ (function(e3, t3) {
|
|
3155
3493
|
return { type: "mention", id: e3, text: t3 };
|
|
3156
|
-
}(decodeURIComponent(t2), s2)),
|
|
3494
|
+
})(decodeURIComponent(t2), s2)), Sn = qe(/<!!customemoji:(.*?)>/gm, ([e2, t2]) => /* @__PURE__ */ (function(e3) {
|
|
3157
3495
|
return { type: "customemoji", text: e3 };
|
|
3158
|
-
}(t2)),
|
|
3496
|
+
})(t2)), xn = qe(/<((?:https?|mailto):.*?)\|(.*?)>/gi, ([e2, t2, s2]) => /* @__PURE__ */ (function(e3, t3 = []) {
|
|
3159
3497
|
return { type: "link", url: e3, children: t3 };
|
|
3160
|
-
}(t2, [s2])),
|
|
3161
|
-
const { action: n2, params:
|
|
3162
|
-
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
3498
|
+
})(t2, [s2])), En = qe(/<actionlink:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
3499
|
+
const { action: n2, params: a2 } = An(t2);
|
|
3500
|
+
return /* @__PURE__ */ (function(e3, t3, s3 = []) {
|
|
3163
3501
|
return { type: "actionlink", action: e3, params: t3, children: s3 };
|
|
3164
|
-
}(n2,
|
|
3165
|
-
}),
|
|
3166
|
-
const { action: n2, params:
|
|
3167
|
-
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
3502
|
+
})(n2, a2, [s2]);
|
|
3503
|
+
}), Mn = qe(/<actionbutton:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
3504
|
+
const { action: n2, params: a2 } = An(t2);
|
|
3505
|
+
return /* @__PURE__ */ (function(e3, t3, s3 = []) {
|
|
3168
3506
|
return { type: "actionbutton", action: e3, params: t3, children: s3 };
|
|
3169
|
-
}(n2,
|
|
3507
|
+
})(n2, a2, [s2]);
|
|
3170
3508
|
});
|
|
3171
|
-
function
|
|
3509
|
+
function An(e2) {
|
|
3172
3510
|
const t2 = e2.indexOf("?");
|
|
3173
3511
|
if (-1 === t2) return { action: e2, params: {} };
|
|
3174
3512
|
return { action: e2.slice(0, t2), params: Object.fromEntries(new URLSearchParams(e2.slice(t2))) };
|
|
3175
3513
|
}
|
|
3176
|
-
const
|
|
3514
|
+
const Nn = qe(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g, ([e2]) => /* @__PURE__ */ (function(e3 = []) {
|
|
3177
3515
|
return { type: "bulletlist", children: e3 };
|
|
3178
|
-
}([e2.startsWith("\n") ? e2.slice(1) : e2])),
|
|
3516
|
+
})([e2.startsWith("\n") ? e2.slice(1) : e2])), Rn = qe(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm, ([e2, t2]) => ({ type: "bulletpoint", children: [t2] })), Dn = (e2) => {
|
|
3179
3517
|
const t2 = /(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;
|
|
3180
3518
|
let s2 = 0;
|
|
3181
3519
|
const n2 = [];
|
|
3182
|
-
for (const
|
|
3183
|
-
const t3 =
|
|
3520
|
+
for (const a2 of Z(e2, t2)) {
|
|
3521
|
+
const t3 = a2[0], r2 = a2[1], i2 = t3.startsWith(r2) ? a2.index : a2.index + 1;
|
|
3184
3522
|
i2 - s2 > 0 && n2.push(e2.substring(s2, i2));
|
|
3185
|
-
const o2 =
|
|
3186
|
-
n2.push(o2), s2 = i2 +
|
|
3523
|
+
const o2 = Tn("tel:" + r2.replace(/[^0-9+]/g, ""), r2);
|
|
3524
|
+
n2.push(o2), s2 = i2 + r2.length;
|
|
3187
3525
|
}
|
|
3188
3526
|
return s2 < e2.length && n2.push(e2.substring(s2)), n2;
|
|
3189
|
-
},
|
|
3190
|
-
const t2 =
|
|
3527
|
+
}, _n = (e2) => xn(e2).flatMap((e3) => "string" == typeof e3 ? On(e3) : ["<", ...On(e3.url), ...On("|" + e3.children[0] + ">")]), On = (e2) => {
|
|
3528
|
+
const t2 = kn.parse(e2, { urls: true, email: true, phone: false, hashtag: false, mention: false }), s2 = [];
|
|
3191
3529
|
let n2 = 0;
|
|
3192
|
-
for (const
|
|
3193
|
-
const t3 =
|
|
3194
|
-
let o2 =
|
|
3195
|
-
|
|
3530
|
+
for (const a2 of t2) {
|
|
3531
|
+
const t3 = a2.getOffset(), r2 = a2.getMatchedText(), i2 = r2.length;
|
|
3532
|
+
let o2 = r2;
|
|
3533
|
+
a2 instanceof jt ? o2 = "mailto:" + a2.getEmail() : a2 instanceof Dt && (o2 = a2.getUrl()), t3 > n2 && s2.push(e2.substring(n2, t3)), s2.push(Tn(o2, r2)), n2 = t3 + i2;
|
|
3196
3534
|
}
|
|
3197
3535
|
return n2 < e2.length && s2.push(e2.substring(n2)), s2;
|
|
3198
|
-
},
|
|
3199
|
-
function
|
|
3536
|
+
}, Pn = ["Codeblock", "Codespan", "FormattedLink", "Wikitext", "Autolink", "Actions", "Mention", "Mention", "BulletPoint", "CustomEmoji"];
|
|
3537
|
+
function jn(e2 = { except: [] }) {
|
|
3200
3538
|
var _a2;
|
|
3201
|
-
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 :
|
|
3202
|
-
return s2.includes("BulletPoint") || t2.multilineSteps.push(
|
|
3539
|
+
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 : Pn.filter((t3) => !e2.only.includes(t3));
|
|
3540
|
+
return s2.includes("BulletPoint") || t2.multilineSteps.push(Nn, Rn), s2.includes("Mention") || t2.singlelineSteps.push(In), s2.includes("CustomEmoji") || t2.singlelineSteps.push(Sn), s2.includes("Codespan") || t2.multilineSteps.push(qe(/```([^]+?)```/g, ([e3, t3]) => ({ type: "codespan", text: t3.replace(/<!!mention:.*?\|([^>]*)>/gim, "@$1").replace(/<!!customemoji:(.*?)>/gim, "$1") }))), s2.includes("FormattedLink") || t2.singlelineSteps.push(xn), s2.includes("Actions") || (t2.singlelineSteps.push(En), t2.singlelineSteps.push(Mn)), s2.includes("Wikitext") || t2.singlelineSteps.push(He), s2.includes("Autolink") || t2.singlelineSteps.push(_n, Dn), t2;
|
|
3203
3541
|
}
|
|
3204
|
-
const
|
|
3542
|
+
const $n = (function(e2) {
|
|
3205
3543
|
const t2 = RegExp(`[^${e2}]+${e2}?|${e2}`, "g");
|
|
3206
3544
|
return (e3) => Array.from(e3.match(t2) || []);
|
|
3207
|
-
}("\n");
|
|
3208
|
-
function
|
|
3209
|
-
let s2 = function(e3, t3) {
|
|
3545
|
+
})("\n");
|
|
3546
|
+
function Un(e2, t2 = { except: [] }) {
|
|
3547
|
+
let s2 = (function(e3, t3) {
|
|
3210
3548
|
let s3 = [e3];
|
|
3211
|
-
return s3 =
|
|
3212
|
-
}(e2,
|
|
3213
|
-
return s2 =
|
|
3549
|
+
return s3 = qn(s3, t3.multilineSteps), s3 = qn(s3, [$n]), s3 = qn(s3, t3.singlelineSteps), s3 = Bn(s3), s3;
|
|
3550
|
+
})(e2, jn(t2));
|
|
3551
|
+
return s2 = Ln(s2, false), s2;
|
|
3214
3552
|
}
|
|
3215
|
-
function
|
|
3216
|
-
return
|
|
3553
|
+
function Wn(e2) {
|
|
3554
|
+
return Un(e2, { except: ["FormattedLink", "Actions"] });
|
|
3217
3555
|
}
|
|
3218
|
-
function
|
|
3219
|
-
return t2.reduce((e3, t3) =>
|
|
3556
|
+
function qn(e2, t2) {
|
|
3557
|
+
return t2.reduce((e3, t3) => We(e3, t3), e2);
|
|
3220
3558
|
}
|
|
3221
|
-
function
|
|
3559
|
+
function Bn(e2) {
|
|
3222
3560
|
const t2 = [];
|
|
3223
3561
|
let s2 = -1;
|
|
3224
|
-
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:
|
|
3562
|
+
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: Bn(n2.children) }) : n2;
|
|
3225
3563
|
return t2;
|
|
3226
3564
|
}
|
|
3227
|
-
function
|
|
3565
|
+
function Ln(e2, t2) {
|
|
3228
3566
|
const s2 = [];
|
|
3229
3567
|
let n2 = [];
|
|
3230
|
-
for (let
|
|
3231
|
-
const
|
|
3232
|
-
if ("string" == typeof
|
|
3233
|
-
else if ("children" in
|
|
3568
|
+
for (let a2 = 0; a2 < e2.length; a2++) {
|
|
3569
|
+
const r2 = e2[a2];
|
|
3570
|
+
if ("string" == typeof r2) n2.push(r2);
|
|
3571
|
+
else if ("children" in r2) {
|
|
3234
3572
|
n2.length > 0 && (s2.push(n2.join("")), n2 = []);
|
|
3235
|
-
const e3 =
|
|
3236
|
-
s2.push(__spreadProps(__spreadValues({},
|
|
3237
|
-
} else "autolink" ===
|
|
3573
|
+
const e3 = Ln(r2.children, t2 || "link" === r2.type || "actionbutton" === r2.type || "actionlink" === r2.type);
|
|
3574
|
+
s2.push(__spreadProps(__spreadValues({}, r2), { children: e3 }));
|
|
3575
|
+
} else "autolink" === r2.type && t2 ? n2.push(r2.text) : (n2.length > 0 && (s2.push(n2.join("")), n2 = []), s2.push(r2));
|
|
3238
3576
|
}
|
|
3239
3577
|
return n2.length > 0 && (s2.push(n2.join("")), n2 = []), s2;
|
|
3240
3578
|
}
|
|
3241
|
-
class
|
|
3579
|
+
class Gn {
|
|
3242
3580
|
constructor(e2, t2, s2, n2) {
|
|
3243
3581
|
this.emoji = e2, this.messageId = t2, this.conversationId = s2, this._realtimeClient = n2;
|
|
3244
3582
|
}
|
|
@@ -3251,17 +3589,17 @@ class hs {
|
|
|
3251
3589
|
add() {
|
|
3252
3590
|
return __async(this, null, function* () {
|
|
3253
3591
|
const e2 = yield this._realtimeClient.call({ method: "PUT", path: ["conversations", this.brandedConversationId, "messages", this.brandedMessageId, "reactions", this.emoji, this._realtimeClient.userId], data: {} });
|
|
3254
|
-
|
|
3592
|
+
d(`Add ${this.emoji} reaction on message ${this.messageId} in conversation ${this.conversationId}`, e2);
|
|
3255
3593
|
});
|
|
3256
3594
|
}
|
|
3257
3595
|
remove() {
|
|
3258
3596
|
return __async(this, null, function* () {
|
|
3259
3597
|
const e2 = yield this._realtimeClient.call({ method: "DELETE", path: ["conversations", this.brandedConversationId, "messages", this.brandedMessageId, "reactions", this.emoji, this._realtimeClient.userId], data: {} });
|
|
3260
|
-
(e2.ok || "server" !== e2.where || 404 !== e2.value.status) &&
|
|
3598
|
+
(e2.ok || "server" !== e2.where || 404 !== e2.value.status) && d(`Remove ${this.emoji} reaction from message ${this.messageId} in conversation ${this.conversationId}`, e2);
|
|
3261
3599
|
});
|
|
3262
3600
|
}
|
|
3263
3601
|
}
|
|
3264
|
-
class
|
|
3602
|
+
class Fn {
|
|
3265
3603
|
constructor(e2, t2, s2) {
|
|
3266
3604
|
this.id = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
3267
3605
|
}
|
|
@@ -3281,33 +3619,33 @@ class ds {
|
|
|
3281
3619
|
const e2 = yield this._realtimeClient.call({ method: "GET", path: ["me", "conversations", this.brandedConversationId, "messages", this.brandedId], data: {} });
|
|
3282
3620
|
if (!e2.ok && "server" === e2.where && 404 === e2.value.status) return null;
|
|
3283
3621
|
if (!e2.ok && "server" === e2.where && 403 === e2.value.status && "NOT_A_PARTICIPANT" === e2.value.errorCode) return null;
|
|
3284
|
-
const t2 =
|
|
3285
|
-
return
|
|
3622
|
+
const t2 = d("Get message " + this.id, e2), s2 = yield this._realtimeClient.hydrateMessageData(t2, this.brandedConversationId);
|
|
3623
|
+
return ta("Get message " + this.id, s2);
|
|
3286
3624
|
});
|
|
3287
3625
|
}
|
|
3288
3626
|
edit(e2) {
|
|
3289
3627
|
return __async(this, null, function* () {
|
|
3290
|
-
const t2 = { content:
|
|
3291
|
-
|
|
3628
|
+
const t2 = { content: Hn(e2), custom: "string" == typeof e2 ? void 0 : e2.custom }, s2 = yield this._realtimeClient.call({ method: "PATCH", path: ["conversations", this.brandedConversationId, "messages", this.brandedId], data: t2 });
|
|
3629
|
+
d(`Edit message ${this.id} in conversation ${this.conversationId}`, s2);
|
|
3292
3630
|
});
|
|
3293
3631
|
}
|
|
3294
3632
|
delete() {
|
|
3295
3633
|
return __async(this, null, function* () {
|
|
3296
3634
|
const e2 = yield this._realtimeClient.call({ method: "DELETE", path: ["conversations", this.brandedConversationId, "messages", this.brandedId], data: {} });
|
|
3297
|
-
(e2.ok || "server" !== e2.where || 404 !== e2.value.status) &&
|
|
3635
|
+
(e2.ok || "server" !== e2.where || 404 !== e2.value.status) && d(`Delete message ${this.id} in conversation ${this.conversationId}`, e2);
|
|
3298
3636
|
});
|
|
3299
3637
|
}
|
|
3300
3638
|
}
|
|
3301
|
-
function
|
|
3639
|
+
function Hn(e2) {
|
|
3302
3640
|
if ("string" == typeof e2) {
|
|
3303
|
-
return [{ type: "text", children:
|
|
3641
|
+
return [{ type: "text", children: Un(e2) }];
|
|
3304
3642
|
}
|
|
3305
3643
|
if ("text" in e2 && e2.text) {
|
|
3306
|
-
return [{ type: "text", children:
|
|
3644
|
+
return [{ type: "text", children: Un(e2.text) }];
|
|
3307
3645
|
}
|
|
3308
3646
|
if ("content" in e2 && e2.content) return e2.content;
|
|
3309
3647
|
}
|
|
3310
|
-
class
|
|
3648
|
+
class Jn {
|
|
3311
3649
|
constructor(e2, t2) {
|
|
3312
3650
|
this.id = e2, this._realtimeClient = t2, this.uselessObjForTypeCheck = { subject: null, photoUrl: null, welcomeMessages: null, custom: null, access: null, notify: null };
|
|
3313
3651
|
}
|
|
@@ -3346,43 +3684,43 @@ class fs {
|
|
|
3346
3684
|
set(e2) {
|
|
3347
3685
|
return __async(this, null, function* () {
|
|
3348
3686
|
const t2 = this._realtimeClient.call({ method: "PUT", path: ["conversations", this.brandedId], data: e2 }), s2 = this._realtimeClient.call({ method: "PUT", path: ["conversations", this.brandedId, "participants", this.brandedUserId], data: e2 }), n2 = yield t2;
|
|
3349
|
-
!n2.ok && "server" === n2.where && 403 === n2.value.status && "UNAUTHORIZED_TO_EDIT" === n2.value.errorCode && function(e3) {
|
|
3687
|
+
!n2.ok && "server" === n2.where && 403 === n2.value.status && "UNAUTHORIZED_TO_EDIT" === n2.value.errorCode && (function(e3) {
|
|
3350
3688
|
if (void 0 !== e3.subject) return false;
|
|
3351
3689
|
if (void 0 !== e3.photoUrl) return false;
|
|
3352
3690
|
if (void 0 !== e3.welcomeMessages) return false;
|
|
3353
3691
|
if (null === e3.custom) return false;
|
|
3354
3692
|
if (void 0 !== e3.custom && Object.values(e3.custom).some((e4) => void 0 !== e4)) return false;
|
|
3355
3693
|
return true;
|
|
3356
|
-
}(e2) ||
|
|
3357
|
-
const
|
|
3358
|
-
!
|
|
3694
|
+
})(e2) || d("Set conversation " + this.id, n2);
|
|
3695
|
+
const a2 = yield s2;
|
|
3696
|
+
!a2.ok && "server" === a2.where && 403 === a2.value.status && "UNAUTHORIZED_TO_EDIT_PARTICIPANT" === a2.value.errorCode && (function(e3) {
|
|
3359
3697
|
return void 0 === e3.access && void 0 === e3.notify;
|
|
3360
|
-
}(e2) ||
|
|
3698
|
+
})(e2) || d("Set your participation in conversation " + this.id, a2);
|
|
3361
3699
|
});
|
|
3362
3700
|
}
|
|
3363
3701
|
createIfNotExists() {
|
|
3364
3702
|
return __async(this, arguments, function* (e2 = {}) {
|
|
3365
3703
|
const t2 = this._realtimeClient.call({ method: "POST", path: ["conversations", this.brandedId], data: e2 }), s2 = this._realtimeClient.call({ method: "POST", path: ["conversations", this.brandedId, "participants", this.brandedUserId], data: e2 }), n2 = yield t2;
|
|
3366
|
-
(n2.ok || "server" !== n2.where || 409 !== n2.value.status) &&
|
|
3367
|
-
const
|
|
3368
|
-
(
|
|
3704
|
+
(n2.ok || "server" !== n2.where || 409 !== n2.value.status) && d("Create conversation " + this.id, yield t2);
|
|
3705
|
+
const a2 = yield s2;
|
|
3706
|
+
(a2.ok || "server" !== a2.where || 409 !== a2.value.status) && d("Join conversation " + this.id, yield s2);
|
|
3369
3707
|
});
|
|
3370
3708
|
}
|
|
3371
3709
|
markAsRead() {
|
|
3372
3710
|
return __async(this, null, function* () {
|
|
3373
3711
|
const e2 = yield this._realtimeClient.call({ method: "POST", path: ["me", "conversations", this.brandedId, "read"], data: {} });
|
|
3374
|
-
|
|
3712
|
+
d(`Mark ${this.id} as read`, e2);
|
|
3375
3713
|
});
|
|
3376
3714
|
}
|
|
3377
3715
|
markAsUnread() {
|
|
3378
3716
|
return __async(this, null, function* () {
|
|
3379
3717
|
const e2 = yield this._realtimeClient.call({ method: "POST", path: ["me", "conversations", this.brandedId, "unread"], data: {} });
|
|
3380
|
-
|
|
3718
|
+
d(`Mark ${this.id} as unread`, e2);
|
|
3381
3719
|
});
|
|
3382
3720
|
}
|
|
3383
3721
|
send(e2) {
|
|
3384
3722
|
return __async(this, null, function* () {
|
|
3385
|
-
const t2 = { content:
|
|
3723
|
+
const t2 = { content: zn(e2), referencedMessageId: Yn(e2), custom: "string" == typeof e2 ? void 0 : e2.custom, idempotencyKey: Ue((/* @__PURE__ */ new Date()).getTime()) }, s2 = yield this._realtimeClient.call({ method: "POST", path: ["conversations", this.brandedId, "messages"], data: t2 }), n2 = d("Send message to conversation " + this.id, s2);
|
|
3386
3724
|
return this._realtimeClient.refs.message(this.brandedId, n2.id);
|
|
3387
3725
|
});
|
|
3388
3726
|
}
|
|
@@ -3401,32 +3739,32 @@ class fs {
|
|
|
3401
3739
|
markAsTyping() {
|
|
3402
3740
|
return __async(this, null, function* () {
|
|
3403
3741
|
const e2 = yield this._realtimeClient.call({ method: "POST", path: ["me", "conversations", this.brandedId, "typing"], data: {} });
|
|
3404
|
-
|
|
3742
|
+
d(`Set user as typing in ${this.id}`, e2);
|
|
3405
3743
|
});
|
|
3406
3744
|
}
|
|
3407
3745
|
}
|
|
3408
|
-
function
|
|
3746
|
+
function zn(e2) {
|
|
3409
3747
|
if ("string" == typeof e2) {
|
|
3410
|
-
return [{ type: "text", children:
|
|
3748
|
+
return [{ type: "text", children: Wn(e2) }];
|
|
3411
3749
|
}
|
|
3412
3750
|
if ("text" in e2) {
|
|
3413
|
-
return [{ type: "text", children:
|
|
3751
|
+
return [{ type: "text", children: Wn(e2.text) }];
|
|
3414
3752
|
}
|
|
3415
3753
|
return e2.content;
|
|
3416
3754
|
}
|
|
3417
|
-
function
|
|
3755
|
+
function Yn(e2) {
|
|
3418
3756
|
if ("string" == typeof e2) return;
|
|
3419
3757
|
const t2 = e2.referencedMessage;
|
|
3420
3758
|
return void 0 !== t2 ? "string" == typeof t2 ? t2 : t2.id : void 0;
|
|
3421
3759
|
}
|
|
3422
|
-
const
|
|
3760
|
+
const Qn = "undefined" != typeof WeakRef ? WeakRef : class {
|
|
3423
3761
|
constructor(e2) {
|
|
3424
3762
|
this.value = e2;
|
|
3425
3763
|
}
|
|
3426
3764
|
deref() {
|
|
3427
3765
|
return this.value;
|
|
3428
3766
|
}
|
|
3429
|
-
},
|
|
3767
|
+
}, Vn = globalThis.FinalizationRegistry, Kn = void 0 !== Vn ? Vn : class {
|
|
3430
3768
|
constructor(e2) {
|
|
3431
3769
|
}
|
|
3432
3770
|
register(e2, t2, s2) {
|
|
@@ -3434,9 +3772,9 @@ const vs = "undefined" != typeof WeakRef ? WeakRef : class {
|
|
|
3434
3772
|
unregister(e2) {
|
|
3435
3773
|
}
|
|
3436
3774
|
};
|
|
3437
|
-
class
|
|
3775
|
+
class Zn {
|
|
3438
3776
|
constructor(e2) {
|
|
3439
|
-
this.client = e2, this.users = /* @__PURE__ */ new Map(), this.conversations = /* @__PURE__ */ new Map(), this.participants = /* @__PURE__ */ new Map(), this.messages = /* @__PURE__ */ new Map(), this.reactions = /* @__PURE__ */ new Map(), this.registry = new
|
|
3777
|
+
this.client = e2, this.users = /* @__PURE__ */ new Map(), this.conversations = /* @__PURE__ */ new Map(), this.participants = /* @__PURE__ */ new Map(), this.messages = /* @__PURE__ */ new Map(), this.reactions = /* @__PURE__ */ new Map(), this.registry = new Kn(({ map: e3, key: t2 }) => {
|
|
3440
3778
|
e3.delete(t2);
|
|
3441
3779
|
});
|
|
3442
3780
|
}
|
|
@@ -3444,47 +3782,47 @@ class ys {
|
|
|
3444
3782
|
var _a2;
|
|
3445
3783
|
const t2 = (_a2 = this.users.get(e2)) == null ? void 0 : _a2.deref();
|
|
3446
3784
|
if (t2) return t2;
|
|
3447
|
-
const s2 = x(new
|
|
3448
|
-
return this.users.set(e2, new
|
|
3785
|
+
const s2 = x(new je(e2, this.client));
|
|
3786
|
+
return this.users.set(e2, new Qn(s2)), this.registry.register(s2, { map: this.users, key: e2 }), s2;
|
|
3449
3787
|
}
|
|
3450
3788
|
conversation(e2) {
|
|
3451
3789
|
var _a2;
|
|
3452
3790
|
const t2 = (_a2 = this.conversations.get(e2)) == null ? void 0 : _a2.deref();
|
|
3453
3791
|
if (t2) return t2;
|
|
3454
|
-
const s2 = x(new
|
|
3455
|
-
return this.conversations.set(e2, new
|
|
3792
|
+
const s2 = x(new Jn(e2, this.client));
|
|
3793
|
+
return this.conversations.set(e2, new Qn(s2)), this.registry.register(s2, { map: this.conversations, key: e2 }), s2;
|
|
3456
3794
|
}
|
|
3457
3795
|
participant(e2, t2) {
|
|
3458
3796
|
var _a2;
|
|
3459
3797
|
const s2 = `[${e2}][${t2}]`, n2 = (_a2 = this.participants.get(s2)) == null ? void 0 : _a2.deref();
|
|
3460
3798
|
if (n2) return n2;
|
|
3461
|
-
const
|
|
3462
|
-
return this.participants.set(s2, new
|
|
3799
|
+
const a2 = x(new $e(t2, e2, this.client));
|
|
3800
|
+
return this.participants.set(s2, new Qn(a2)), this.registry.register(a2, { map: this.participants, key: s2 }), a2;
|
|
3463
3801
|
}
|
|
3464
3802
|
message(e2, t2) {
|
|
3465
3803
|
var _a2;
|
|
3466
3804
|
const s2 = `[${e2}][${t2}]`, n2 = (_a2 = this.messages.get(s2)) == null ? void 0 : _a2.deref();
|
|
3467
3805
|
if (n2) return n2;
|
|
3468
|
-
const
|
|
3469
|
-
return this.messages.set(s2, new
|
|
3806
|
+
const a2 = x(new Fn(t2, e2, this.client));
|
|
3807
|
+
return this.messages.set(s2, new Qn(a2)), this.registry.register(a2, { map: this.messages, key: s2 }), a2;
|
|
3470
3808
|
}
|
|
3471
3809
|
reaction(e2, t2, s2) {
|
|
3472
3810
|
var _a2;
|
|
3473
|
-
const n2 = `[${e2}][${t2}][${s2}]`,
|
|
3474
|
-
if (
|
|
3475
|
-
const
|
|
3476
|
-
return this.reactions.set(n2, new
|
|
3811
|
+
const n2 = `[${e2}][${t2}][${s2}]`, a2 = (_a2 = this.reactions.get(n2)) == null ? void 0 : _a2.deref();
|
|
3812
|
+
if (a2) return a2;
|
|
3813
|
+
const r2 = x(new Gn(s2, t2, e2, this.client));
|
|
3814
|
+
return this.reactions.set(n2, new Qn(r2)), this.registry.register(r2, { map: this.reactions, key: n2 }), r2;
|
|
3477
3815
|
}
|
|
3478
3816
|
}
|
|
3479
|
-
class
|
|
3817
|
+
class Xn {
|
|
3480
3818
|
constructor(e2, t2, s2) {
|
|
3481
|
-
this.userId = t2, this.refs = new
|
|
3819
|
+
this.userId = t2, this.refs = new Zn(this), this.alive = true, this.connection = new Oe(e2, s2, this), s2.onTokenRefreshFailed(() => {
|
|
3482
3820
|
this.destroy();
|
|
3483
3821
|
});
|
|
3484
3822
|
}
|
|
3485
3823
|
call(e2) {
|
|
3486
3824
|
return __async(this, null, function* () {
|
|
3487
|
-
return this.alive ? this.connection.call(e2) :
|
|
3825
|
+
return this.alive ? this.connection.call(e2) : c("SESSION_DESTROYED");
|
|
3488
3826
|
});
|
|
3489
3827
|
}
|
|
3490
3828
|
subscribe(e2, t2) {
|
|
@@ -3507,61 +3845,80 @@ class Cs {
|
|
|
3507
3845
|
}
|
|
3508
3846
|
hydrateMessageData(e2, t2) {
|
|
3509
3847
|
return __async(this, null, function* () {
|
|
3510
|
-
const s2 = null === e2.senderId ? Promise.resolve(o(null)) : this.getUser(e2.senderId), n2 = null === e2.referencedMessageId ? Promise.resolve(o(null)) : this.getReferencedMessage(t2, e2.referencedMessageId),
|
|
3511
|
-
if (!r2.ok) return r2;
|
|
3512
|
-
const a2 = yield n2;
|
|
3848
|
+
const s2 = null === e2.senderId ? Promise.resolve(o(null)) : this.getUser(e2.senderId), n2 = null === e2.referencedMessageId ? Promise.resolve(o(null)) : this.getReferencedMessage(t2, e2.referencedMessageId), a2 = yield s2;
|
|
3513
3849
|
if (!a2.ok) return a2;
|
|
3514
|
-
const
|
|
3515
|
-
|
|
3516
|
-
|
|
3850
|
+
const r2 = yield n2;
|
|
3851
|
+
if (!r2.ok) return r2;
|
|
3852
|
+
const i2 = (function(e3, t3, s3) {
|
|
3853
|
+
return x({ id: e3.id, type: e3.type, sender: t3, referencedMessage: s3, custom: x(e3.custom), createdAt: e3.createdAt, editedAt: e3.editedAt, origin: e3.origin, content: e3.content, reactions: he(e3.reactions), plaintext: ie(e3.content, {}) });
|
|
3854
|
+
})(e2, a2.value, r2.value);
|
|
3855
|
+
return o(i2);
|
|
3856
|
+
});
|
|
3857
|
+
}
|
|
3858
|
+
hydrateConvData(e2, t2) {
|
|
3859
|
+
return __async(this, null, function* () {
|
|
3860
|
+
const s2 = this.listMessages(e2.id, { limit: 1 }, t2), n2 = yield this.call({ method: "GET", path: ["me", "conversations", e2.id], data: {}, headers: t2 });
|
|
3861
|
+
if (!n2.ok && "server" === n2.where && 404 === n2.value.status) return o(null);
|
|
3862
|
+
const a2 = d("Get conversation " + e2.id, n2), r2 = ta("Get last message in conversation " + e2.id, yield s2), i2 = (function(e3, t3) {
|
|
3863
|
+
return x({ id: e3.id, subject: e3.subject, photoUrl: e3.photoUrl, welcomeMessages: x(e3.welcomeMessages), custom: x(e3.custom), createdAt: e3.createdAt, joinedAt: e3.joinedAt, lastMessageAt: e3.lastMessageAt, unreadMessageCount: e3.unreadMessageCount, isUnread: e3.isUnread, access: e3.access, notify: e3.notify, lastMessage: t3, readUntil: e3.readUntil, everyoneReadUntil: e3.everyoneReadUntil });
|
|
3864
|
+
})(a2, 0 === r2.length ? null : r2[0]);
|
|
3517
3865
|
return o(i2);
|
|
3518
3866
|
});
|
|
3519
3867
|
}
|
|
3868
|
+
listMessages(e2, t2, s2) {
|
|
3869
|
+
return __async(this, null, function* () {
|
|
3870
|
+
const n2 = yield this.call({ method: "GET", path: ["me", "conversations", e2, "messages"], data: t2, headers: s2 });
|
|
3871
|
+
if (!n2.ok) return ea(n2, "Listing messages in " + e2);
|
|
3872
|
+
const a2 = n2.value.data.data, r2 = yield Promise.all(a2.map((t3) => this.hydrateMessageData(t3, e2))), i2 = r2.find((e3) => !e3.ok);
|
|
3873
|
+
if (void 0 !== i2 && !i2.ok) return i2;
|
|
3874
|
+
return o(r2.map(({ value: e3 }) => e3));
|
|
3875
|
+
});
|
|
3876
|
+
}
|
|
3520
3877
|
getReferencedMessage(e2, t2) {
|
|
3521
3878
|
return __async(this, null, function* () {
|
|
3522
3879
|
const s2 = yield this.call({ method: "GET", path: ["me", "conversations", e2, "messages", t2], data: {} });
|
|
3523
3880
|
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return o(null);
|
|
3524
3881
|
if (!s2.ok && "server" === s2.where && 403 === s2.value.status && "NOT_A_PARTICIPANT" === s2.value.errorCode) return o(null);
|
|
3525
|
-
if (!s2.ok) return
|
|
3526
|
-
const n2 = s2.value.data,
|
|
3527
|
-
if (!
|
|
3528
|
-
const
|
|
3529
|
-
return x({ id: e3.id, type: e3.type, sender: t3, referencedMessageId: e3.referencedMessageId, custom: x(e3.custom), createdAt: e3.createdAt, editedAt: e3.editedAt, origin: e3.origin, content: e3.content, reactions:
|
|
3530
|
-
}(n2,
|
|
3531
|
-
return o(
|
|
3882
|
+
if (!s2.ok) return ea(s2, `Fetching referenced message ${t2} in conversation ${e2}`);
|
|
3883
|
+
const n2 = s2.value.data, a2 = yield this.getUser(n2.senderId);
|
|
3884
|
+
if (!a2.ok) return a2;
|
|
3885
|
+
const r2 = (function(e3, t3) {
|
|
3886
|
+
return x({ id: e3.id, type: e3.type, sender: t3, referencedMessageId: e3.referencedMessageId, custom: x(e3.custom), createdAt: e3.createdAt, editedAt: e3.editedAt, origin: e3.origin, content: e3.content, reactions: he(e3.reactions), plaintext: ie(e3.content, {}) });
|
|
3887
|
+
})(n2, a2.value);
|
|
3888
|
+
return o(r2);
|
|
3532
3889
|
});
|
|
3533
3890
|
}
|
|
3534
3891
|
getUser(e2) {
|
|
3535
3892
|
return __async(this, null, function* () {
|
|
3536
3893
|
const t2 = yield this.call({ method: "GET", path: ["users", e2], data: { includePrivateFields: false } });
|
|
3537
3894
|
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return o(null);
|
|
3538
|
-
if (!t2.ok) return
|
|
3539
|
-
return o(
|
|
3895
|
+
if (!t2.ok) return ea(t2, "Get user " + e2);
|
|
3896
|
+
return o(ce(t2.value.data));
|
|
3540
3897
|
});
|
|
3541
3898
|
}
|
|
3542
3899
|
}
|
|
3543
|
-
function
|
|
3544
|
-
return "server" === e2.where ?
|
|
3900
|
+
function ea(e2, t2) {
|
|
3901
|
+
return "server" === e2.where ? l(__spreadProps(__spreadValues({}, e2.value), { operation: t2 })) : e2;
|
|
3545
3902
|
}
|
|
3546
|
-
function
|
|
3903
|
+
function ta(e2, t2) {
|
|
3547
3904
|
var _a2;
|
|
3548
3905
|
if (t2.ok) return t2.value;
|
|
3549
|
-
throw "SESSION_DESTROYED" === t2.value ? new Error(`${e2} failed because the session was destroyed`) : new Error(
|
|
3906
|
+
throw "SESSION_DESTROYED" === t2.value ? new Error(`${e2} failed because the session was destroyed`) : new Error(p((_a2 = t2.value.operation) != null ? _a2 : e2, t2.value));
|
|
3550
3907
|
}
|
|
3551
|
-
class
|
|
3908
|
+
class sa {
|
|
3552
3909
|
constructor(e2, t2, s2) {
|
|
3553
3910
|
this.realtimeWsApiUrl = e2, this.internalHttpApiUrl = t2, this.restApiHttpUrl = s2;
|
|
3554
3911
|
}
|
|
3555
3912
|
getBokensUrl(e2, t2, s2) {
|
|
3556
3913
|
return this.internalHttpApiUrl + `/${e2}/bokens/${encodeURIComponent(t2)}?signature=${encodeURIComponent(s2 != null ? s2 : "")}`;
|
|
3557
3914
|
}
|
|
3558
|
-
getRealtimeWsUrl(e2, t2, s2, n2,
|
|
3559
|
-
const
|
|
3560
|
-
return this.realtimeWsApiUrl + `/${e2}/realtime/${
|
|
3915
|
+
getRealtimeWsUrl(e2, t2, s2, n2, a2) {
|
|
3916
|
+
const r2 = encodeURIComponent(t2);
|
|
3917
|
+
return this.realtimeWsApiUrl + `/${e2}/realtime/${r2}?talkjs-client-build=${a2 != null ? a2 : "standalone"}&talkjs-core=${s2}&talkjs-client-id=${n2}`;
|
|
3561
3918
|
}
|
|
3562
3919
|
static fromHost(e2) {
|
|
3563
3920
|
var _a2;
|
|
3564
|
-
const t2 = new
|
|
3921
|
+
const t2 = new sa("wss://realtime.talkjs.com/v1", "https://app.talkjs.com/api/v0", "https://api.talkjs.com/v1");
|
|
3565
3922
|
if (!e2) return t2;
|
|
3566
3923
|
if ("@currentHost" === e2) {
|
|
3567
3924
|
if ("undefined" == typeof location) throw new Error("You can only use @currentHost in a browser.");
|
|
@@ -3571,46 +3928,46 @@ class ks {
|
|
|
3571
3928
|
const s2 = e2.match(/^(?:\w+-)?([^.]+)\.talkjs\.com$/);
|
|
3572
3929
|
if (s2) {
|
|
3573
3930
|
const e3 = s2[1];
|
|
3574
|
-
return ["app", "cdn", "api", "realtime"].includes(e3) ? t2 : new
|
|
3931
|
+
return ["app", "cdn", "api", "realtime"].includes(e3) ? t2 : new sa(`wss://realtime-${e3}.talkjs.com/v1`, `https://app-${e3}.talkjs.com/api/v0`, `https://api-${e3}.talkjs.com/v1`);
|
|
3575
3932
|
}
|
|
3576
3933
|
return t2;
|
|
3577
3934
|
}
|
|
3578
|
-
return e2.includes("localhost") || e2.includes("localtest.me") || /^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(e2) ? new
|
|
3935
|
+
return e2.includes("localhost") || e2.includes("localtest.me") || /^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(e2) ? new sa(`ws://${e2}/public_api/v1`, `http://${e2}/api/v0`, `http://${e2}/public_api/v1`) : new sa(`wss://${e2}/public_api/v1`, `https://${e2}/api/v0`, `https://${e2}/public_api/v1`);
|
|
3579
3936
|
}
|
|
3580
3937
|
}
|
|
3581
|
-
function
|
|
3938
|
+
function na({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRetry: i2, authProvider: o2, errorTracker: c2, abortSignal: l2 }) {
|
|
3582
3939
|
var _a2;
|
|
3583
|
-
(!
|
|
3584
|
-
const
|
|
3585
|
-
s2 instanceof FormData || (
|
|
3586
|
-
return
|
|
3940
|
+
(!r2 || r2 <= 0) && (r2 = 1);
|
|
3941
|
+
const h2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2026-01-30T10:38:13.969Z" };
|
|
3942
|
+
s2 instanceof FormData || (h2["Content-Type"] = (_a2 = n2 == null ? void 0 : n2.contentType) != null ? _a2 : "application/json");
|
|
3943
|
+
return a(r2, () => __async(null, null, function* () {
|
|
3587
3944
|
if (o2) {
|
|
3588
3945
|
const e3 = yield o2.getToken();
|
|
3589
|
-
|
|
3946
|
+
h2.Authorization = `Bearer ${e3}`;
|
|
3590
3947
|
}
|
|
3591
|
-
return fetch(t2, { method: e2, headers:
|
|
3948
|
+
return fetch(t2, { method: e2, headers: h2, body: s2, signal: l2 }).then((e3) => {
|
|
3592
3949
|
if (e3.ok) return e3;
|
|
3593
3950
|
throw e3;
|
|
3594
3951
|
});
|
|
3595
|
-
}), { initialDelay: 0.2, log: void 0, shouldRetry: (s3) => __async(
|
|
3596
|
-
return o2 && 401 === s3.status ? (
|
|
3952
|
+
}), { initialDelay: 0.2, log: void 0, shouldRetry: (s3) => __async(null, null, function* () {
|
|
3953
|
+
return o2 && 401 === s3.status ? (c2 == null ? void 0 : c2.log(`401 error from ${e2} ${t2}, ${yield o2.getToken()}`), o2.invalidateAndRefresh(), true) : i2 ? i2(s3) : !("object" == typeof s3 && "status" in s3 && s3.status >= 400 && s3.status < 500);
|
|
3597
3954
|
}) }).catch((s3) => {
|
|
3598
3955
|
if (Math.random() < 0.1 && !t2.toString().startsWith("https://capture.trackjs.com")) {
|
|
3599
3956
|
const n3 = `Network Error for ${e2} ${t2}`;
|
|
3600
3957
|
if ("undefined" != typeof window) if (s3 instanceof Response) {
|
|
3601
|
-
s3.clone().text().then((e3) =>
|
|
3602
|
-
} else
|
|
3958
|
+
s3.clone().text().then((e3) => c2 == null ? void 0 : c2.log(`${n3} ${s3.status} ${e3} (10% logged)`));
|
|
3959
|
+
} else c2 == null ? void 0 : c2.log(`${n3} ${s3} (10% logged)`);
|
|
3603
3960
|
console.error("[TalkJS]", n3);
|
|
3604
3961
|
}
|
|
3605
3962
|
throw s3;
|
|
3606
3963
|
});
|
|
3607
3964
|
}
|
|
3608
|
-
class
|
|
3965
|
+
class aa {
|
|
3609
3966
|
constructor(e2) {
|
|
3610
3967
|
__privateAdd(this, _e2);
|
|
3611
3968
|
__privateAdd(this, _t2);
|
|
3612
3969
|
var _a2, _b2, _c, _d;
|
|
3613
|
-
this._timeCreated = Date.now(), __privateSet(this, _e2, (_b2 = (_a2 = globalThis.document) == null ? void 0 : _a2.referrer) != null ? _b2 : ""), __privateSet(this, _t2, ((_d = (_c = globalThis.location) == null ? void 0 : _c.href) != null ? _d : globalThis.HermesInternal) ? "React Native Hermes" : ""), this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2026-01-
|
|
3970
|
+
this._timeCreated = Date.now(), __privateSet(this, _e2, (_b2 = (_a2 = globalThis.document) == null ? void 0 : _a2.referrer) != null ? _b2 : ""), __privateSet(this, _t2, ((_d = (_c = globalThis.location) == null ? void 0 : _c.href) != null ? _d : globalThis.HermesInternal) ? "React Native Hermes" : ""), this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2026-01-30T10:38:13.969Z" }, entry: "direct", environment: { age: Date.now() - this._timeCreated, dependencies: {}, originalUrl: __privateGet(this, _t2), referrer: __privateGet(this, _e2), userAgent: window.navigator.userAgent }, metadata: [], nav: [], network: [], url: __privateGet(this, _t2), stack: "", timestamp: (/* @__PURE__ */ new Date()).toISOString(), version: "dev-2026-01-30T10:38:13.969Z", throttled: 0 }, this._url = `https://capture.trackjs.com/capture?token=${e2}`, this._trackJSData.customer.token = e2;
|
|
3614
3971
|
}
|
|
3615
3972
|
setData({ appId: e2, meId: t2, sessionId: s2 }) {
|
|
3616
3973
|
this._trackJSData.customer.userId = e2, this._trackJSData.customer.sessionId = `${e2}/${t2}`, this._trackJSData.customer.correlationId = s2;
|
|
@@ -3620,7 +3977,7 @@ class Ts {
|
|
|
3620
3977
|
try {
|
|
3621
3978
|
0;
|
|
3622
3979
|
const t2 = __spreadProps(__spreadValues({}, this._trackJSData), { message: e2 });
|
|
3623
|
-
yield
|
|
3980
|
+
yield na({ method: "POST", url: this._url, data: JSON.stringify(t2), options: { contentType: "text/plain" } });
|
|
3624
3981
|
} catch (e3) {
|
|
3625
3982
|
console.error("[TalkJS] Failed when sending an error report. Error: ", e3);
|
|
3626
3983
|
}
|
|
@@ -3629,9 +3986,9 @@ class Ts {
|
|
|
3629
3986
|
}
|
|
3630
3987
|
_e2 = new WeakMap();
|
|
3631
3988
|
_t2 = new WeakMap();
|
|
3632
|
-
const
|
|
3989
|
+
const ra = { log: (e2) => Promise.resolve(), setData: (e2) => {
|
|
3633
3990
|
} };
|
|
3634
|
-
class
|
|
3991
|
+
class ia {
|
|
3635
3992
|
constructor(e2, t2 = {}) {
|
|
3636
3993
|
this._onSubscription = t2, this._handlers = {};
|
|
3637
3994
|
for (const t3 in e2) Object.hasOwnProperty.call(e2, t3) && (this._handlers[t3] = []);
|
|
@@ -3676,7 +4033,7 @@ class Ds {
|
|
|
3676
4033
|
return this.on(e2, t2), { unsubscribe: () => this.off(e2, t2) };
|
|
3677
4034
|
}
|
|
3678
4035
|
}
|
|
3679
|
-
class
|
|
4036
|
+
class oa {
|
|
3680
4037
|
constructor(e2) {
|
|
3681
4038
|
this.handlers = e2, this.tokenResult = null, this.pendingToken = null;
|
|
3682
4039
|
}
|
|
@@ -3684,7 +4041,7 @@ class Ss {
|
|
|
3684
4041
|
return __async(this, null, function* () {
|
|
3685
4042
|
if (this.tokenResult) return this.tokenResult;
|
|
3686
4043
|
if (this.pendingToken) return this.pendingToken.promise;
|
|
3687
|
-
const e2 =
|
|
4044
|
+
const e2 = r();
|
|
3688
4045
|
return this.pendingToken = e2, this.handlers.onNeedToken(), e2.promise;
|
|
3689
4046
|
});
|
|
3690
4047
|
}
|
|
@@ -3692,29 +4049,29 @@ class Ss {
|
|
|
3692
4049
|
this.pendingToken && (this.pendingToken.resolve(e2), this.pendingToken = null), this.tokenResult = e2, this.handlers.onChange(e2);
|
|
3693
4050
|
}
|
|
3694
4051
|
refreshToken() {
|
|
3695
|
-
this.pendingToken || (this.pendingToken =
|
|
4052
|
+
this.pendingToken || (this.pendingToken = r(), this.handlers.onNeedToken());
|
|
3696
4053
|
}
|
|
3697
4054
|
invalidateAndRefresh() {
|
|
3698
4055
|
this.tokenResult = null, this.refreshToken();
|
|
3699
4056
|
}
|
|
3700
4057
|
}
|
|
3701
|
-
class
|
|
4058
|
+
class ca {
|
|
3702
4059
|
constructor(e2, t2, s2, n2) {
|
|
3703
|
-
this.apiUrls = e2, this.appId = t2, this.userId = s2, this.signature = n2, this.inner = new
|
|
4060
|
+
this.apiUrls = e2, this.appId = t2, this.userId = s2, this.signature = n2, this.inner = new oa({ onChange: (e3) => {
|
|
3704
4061
|
e3.ok ? this.eventEmitter.emit("tokenChanged", e3.value) : this.emitTokenRefreshFailed(e3.value);
|
|
3705
4062
|
}, onNeedToken: () => __async(this, null, function* () {
|
|
3706
|
-
if (this._usingBokens && !this.signature && !this._calledBokens && (yield new Promise((e3) => setTimeout(e3, 1))), this._usingBokens) yield this.sendBokenRequest().then((e3) => this.inner.setTokenResult(o(e3))).catch((e3) => this.inner.setTokenResult(
|
|
4063
|
+
if (this._usingBokens && !this.signature && !this._calledBokens && (yield new Promise((e3) => setTimeout(e3, 1))), this._usingBokens) yield this.sendBokenRequest().then((e3) => this.inner.setTokenResult(o(e3))).catch((e3) => this.inner.setTokenResult(l(e3)));
|
|
3707
4064
|
else if (this.onNeedToken) this.onNeedToken();
|
|
3708
4065
|
else {
|
|
3709
|
-
const e3 =
|
|
4066
|
+
const e3 = c("Cannot refresh token, no `onNeedToken` provided.");
|
|
3710
4067
|
this.inner.setTokenResult(e3);
|
|
3711
4068
|
}
|
|
3712
|
-
}) }), this._usingBokens = true, this._calledBokens = false, this.onNeedToken = void 0, this.eventEmitter = new
|
|
4069
|
+
}) }), this._usingBokens = true, this._calledBokens = false, this.onNeedToken = void 0, this.eventEmitter = new ia({ tokenChanged(e3) {
|
|
3713
4070
|
}, tokenRefreshFailed(e3) {
|
|
3714
4071
|
}, tokenAccepted(e3) {
|
|
3715
4072
|
} }), this.sessionExpiryWarningTimeoutId = void 0;
|
|
3716
|
-
const
|
|
3717
|
-
this.errorTracker =
|
|
4073
|
+
const a2 = "undefined" != typeof window && e2.restApiHttpUrl.includes("api.talkjs.com");
|
|
4074
|
+
this.errorTracker = a2 ? new aa("970cd0be0fb74630b75c8451051299dc") : ra;
|
|
3718
4075
|
}
|
|
3719
4076
|
get usingBokens() {
|
|
3720
4077
|
return this._usingBokens;
|
|
@@ -3733,7 +4090,7 @@ class Ms {
|
|
|
3733
4090
|
this.checkCanSetAuth(), setTimeout(() => this.checkJwt(e2), 200), this._usingBokens = false, this.inner.setTokenResult(o(e2));
|
|
3734
4091
|
}
|
|
3735
4092
|
setTokenError(e2) {
|
|
3736
|
-
this._usingBokens = false, this.inner.setTokenResult(
|
|
4093
|
+
this._usingBokens = false, this.inner.setTokenResult(c(e2));
|
|
3737
4094
|
}
|
|
3738
4095
|
refreshToken() {
|
|
3739
4096
|
this.inner.refreshToken();
|
|
@@ -3778,20 +4135,20 @@ class Ms {
|
|
|
3778
4135
|
}, n2);
|
|
3779
4136
|
}
|
|
3780
4137
|
checkJwt(e2) {
|
|
3781
|
-
!function(e3) {
|
|
4138
|
+
!(function(e3) {
|
|
3782
4139
|
if ("string" == typeof e3 || e3 instanceof String) return;
|
|
3783
4140
|
if (void 0 === e3) throw "Token was undefined";
|
|
3784
4141
|
throw "Token must be a string, got: " + e3;
|
|
3785
|
-
}(e2);
|
|
4142
|
+
})(e2);
|
|
3786
4143
|
const t2 = [];
|
|
3787
|
-
let s2, n2,
|
|
4144
|
+
let s2, n2, a2;
|
|
3788
4145
|
if ("string" == typeof e2 ? s2 = e2 : t2.push(`Token type is ${typeof e2} instead of a string.`), s2) try {
|
|
3789
|
-
const e3 = function(e4) {
|
|
4146
|
+
const e3 = (function(e4) {
|
|
3790
4147
|
const t3 = e4.split(".");
|
|
3791
4148
|
if (3 !== t3.length) throw "Token does not contain exactly two `.`. Check that you generated your JWT correctly. It should be `<header>.<payload>.<signature>`.";
|
|
3792
|
-
return { header:
|
|
3793
|
-
}(s2);
|
|
3794
|
-
n2 = e3.header,
|
|
4149
|
+
return { header: la(t3[0]), payload: la(t3[1]) };
|
|
4150
|
+
})(s2);
|
|
4151
|
+
n2 = e3.header, a2 = e3.payload;
|
|
3795
4152
|
} catch (e3) {
|
|
3796
4153
|
t2.push(e3);
|
|
3797
4154
|
}
|
|
@@ -3799,8 +4156,8 @@ class Ms {
|
|
|
3799
4156
|
const e3 = this.checkJwtHeader(n2);
|
|
3800
4157
|
t2.push(...e3);
|
|
3801
4158
|
}
|
|
3802
|
-
if (
|
|
3803
|
-
const e3 = this.checkJwtPayload(
|
|
4159
|
+
if (a2) {
|
|
4160
|
+
const e3 = this.checkJwtPayload(a2);
|
|
3804
4161
|
t2.push(...e3);
|
|
3805
4162
|
}
|
|
3806
4163
|
if (t2.length) if (this.usingBokens) this.errorTracker.log(`JWT Errors detected by AuthProvider when using bokens: ${t2.join("\n")}`);
|
|
@@ -3822,18 +4179,18 @@ class Ms {
|
|
|
3822
4179
|
void 0 === s2 ? t2.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was missing.`) : "string" != typeof s2 ? t2.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was ${typeof s2} instead of a string. Make sure you wrap the value in "".`) : s2 !== this.appId && t2.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was set to "${s2}" instead.`);
|
|
3823
4180
|
const n2 = e2.sub;
|
|
3824
4181
|
void 0 === n2 ? t2.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was missing.`) : "string" != typeof n2 ? t2.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was ${typeof n2} instead of a string. Make sure you wrap the value in "".`) : n2 !== this.userId && t2.push(`Token payload must contain a \`sub\` claim set to your userId ID (${this.userId}), but \`sub\` was set to "${n2}" instead.`);
|
|
3825
|
-
const
|
|
3826
|
-
void 0 ===
|
|
3827
|
-
const
|
|
3828
|
-
void 0 ===
|
|
4182
|
+
const a2 = e2.tokenType;
|
|
4183
|
+
void 0 === a2 ? t2.push('Token payload must contain a `"tokenType": "user"` claim, but no `tokenType` was specified.') : "string" != typeof a2 ? t2.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was ${typeof a2} instead of a string. Make sure you wrap the value in "".`) : "user" !== a2 && t2.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was set to "${a2}" instead.`);
|
|
4184
|
+
const r2 = e2.exp;
|
|
4185
|
+
void 0 === r2 || ("number" != typeof r2 ? t2.push(`Token payload contains an \`exp\` claim, but \`exp\` was ${typeof a2} instead of a number. If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01. Don't wrap the value in "".`) : r2 < 1e9 ? t2.push(`Token payload contains an \`exp\` claim, but \`exp\` is very small (${r2}, representing ${new Date(1e3 * r2).toLocaleDateString()}). If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01.`) : r2 > 1e11 ? t2.push(`Token payload contains an \`exp\` claim, but \`exp\` is very small (${r2}, representing ${new Date(1e3 * r2).toLocaleDateString()}). If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01. Double-check that you are using seconds and not milliseconds or nanoseconds.`) : r2 < (/* @__PURE__ */ new Date()).getTime() / 1e3 && t2.push(`Token payload contains an \`exp\` claim, but \`exp\` (${r2}, representing ${new Date(1e3 * r2).toLocaleDateString()}) appears to be in the past, meaning the token will be rejected. This error can also happen if your device's clock is set incorrectly, in which case the token will still work.`));
|
|
3829
4186
|
const i2 = e2.nbf;
|
|
3830
|
-
return void 0 === i2 || ("number" != typeof i2 ? t2.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` was ${typeof
|
|
4187
|
+
return void 0 === i2 || ("number" != typeof i2 ? t2.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` was ${typeof a2} instead of a number. If set, \`nbf\` should be the date when the JWT becomes valid, as a number of seconds since 1970-01-01.`) : i2 > 1e11 && t2.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` is very large (${i2}, representing ${new Date(1e3 * i2).toLocaleDateString()}). If set, \`nbf\` should be the date when the JWT becomes valid, as a number of seconds since 1970-01-01. Double-check that you are using seconds and not milliseconds or nanoseconds.`)), t2;
|
|
3831
4188
|
}
|
|
3832
4189
|
sendBokenRequest() {
|
|
3833
4190
|
return __async(this, null, function* () {
|
|
3834
4191
|
this._calledBokens = true;
|
|
3835
4192
|
let e2 = 0;
|
|
3836
|
-
const t2 = this.apiUrls.getBokensUrl(this.appId, this.userId, this.signature), s2 = yield
|
|
4193
|
+
const t2 = this.apiUrls.getBokensUrl(this.appId, this.userId, this.signature), s2 = yield na({ method: "GET", url: t2, attempts: 1e4, shouldRetry: (t3) => {
|
|
3837
4194
|
if (t3 instanceof Error) return true;
|
|
3838
4195
|
if (401 === t3.status) throw "Check that you provided a valid signature.";
|
|
3839
4196
|
if (404 === t3.status) throw "Check that you specified the correct App ID.";
|
|
@@ -3846,7 +4203,7 @@ class Ms {
|
|
|
3846
4203
|
});
|
|
3847
4204
|
}
|
|
3848
4205
|
}
|
|
3849
|
-
function
|
|
4206
|
+
function la(e2) {
|
|
3850
4207
|
try {
|
|
3851
4208
|
const t2 = e2.replace(/-/g, "+").replace(/_/g, "/"), s2 = decodeURIComponent(atob(t2).split("").map((e3) => "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2)).join(""));
|
|
3852
4209
|
return JSON.parse(s2);
|
|
@@ -3854,14 +4211,14 @@ function Fs(e2) {
|
|
|
3854
4211
|
throw `Could not base64-decode and JSON-parse token section: ${e2}. Check that you base-64 encoded the section correctly.`;
|
|
3855
4212
|
}
|
|
3856
4213
|
}
|
|
3857
|
-
const
|
|
4214
|
+
const ha = new class {
|
|
3858
4215
|
constructor() {
|
|
3859
4216
|
this.registry = {};
|
|
3860
4217
|
}
|
|
3861
4218
|
getOrCreate(e2) {
|
|
3862
4219
|
const t2 = this.key(e2), s2 = this.registry[t2];
|
|
3863
4220
|
if (s2) return s2;
|
|
3864
|
-
const n2 = new
|
|
4221
|
+
const n2 = new da(e2);
|
|
3865
4222
|
return this.registry[t2] = n2, n2;
|
|
3866
4223
|
}
|
|
3867
4224
|
deregister(e2, t2) {
|
|
@@ -3872,34 +4229,34 @@ const Bs = new class {
|
|
|
3872
4229
|
return `${e2}:${t2}`;
|
|
3873
4230
|
}
|
|
3874
4231
|
}();
|
|
3875
|
-
function
|
|
4232
|
+
function ua(e2) {
|
|
3876
4233
|
if (!e2) throw new Error("[TalkJS] Must provide an options object to `getTalkSession`");
|
|
3877
|
-
return e2.forceCreateNew ? new
|
|
4234
|
+
return e2.forceCreateNew ? new da(e2) : ha.getOrCreate(e2);
|
|
3878
4235
|
}
|
|
3879
|
-
class
|
|
4236
|
+
class da {
|
|
3880
4237
|
constructor(e2) {
|
|
3881
|
-
this._onNeedToken = void 0, function(e3) {
|
|
4238
|
+
this._onNeedToken = void 0, (function(e3) {
|
|
3882
4239
|
function t3(e4, t4) {
|
|
3883
4240
|
if (!e4) throw new Error("[TalkJS] TalkSession: " + t4);
|
|
3884
4241
|
}
|
|
3885
4242
|
t3(e3 && "object" == typeof e3, "Expected an object argument in `getTalkSession`."), t3(e3.appId && "string" == typeof e3.appId, "The `appId` property of the `getTalkSession` options is required and it must be a non-empty string."), t3("string" == typeof e3.userId, "The `userId` property of the `getTalkSession` options is required and it must be a string."), void 0 !== e3.token && t3(e3.token && "string" == typeof e3.token, "The `token` property of the `getTalkSession` options must be a non-empty string.");
|
|
3886
4243
|
void 0 !== e3.tokenFetcher && t3("function" == typeof e3.tokenFetcher, "The `tokenFetcher` property of the `getTalkSession` options must be a function.");
|
|
3887
|
-
}(e2);
|
|
3888
|
-
const { appId: t2, userId: s2, token: n2, tokenFetcher:
|
|
3889
|
-
this._appId = t2, this._apiUrls = e2.apiUrls ? new
|
|
4244
|
+
})(e2);
|
|
4245
|
+
const { appId: t2, userId: s2, token: n2, tokenFetcher: a2, signature: i2 } = e2;
|
|
4246
|
+
this._appId = t2, this._apiUrls = e2.apiUrls ? new sa(e2.apiUrls.realtimeWsApiUrl, e2.apiUrls.internalHttpApiUrl, e2.apiUrls.restApiHttpUrl) : sa.fromHost(e2.host), this._authProvider = new ca(this._apiUrls, t2, s2, i2), n2 && this._authProvider.setToken(n2), a2 && this._authProvider.setOnNeedToken(() => __async(this, null, function* () {
|
|
3890
4247
|
try {
|
|
3891
|
-
const e3 = yield
|
|
4248
|
+
const e3 = yield a2();
|
|
3892
4249
|
this._authProvider.setToken(e3);
|
|
3893
4250
|
} catch (e3) {
|
|
3894
4251
|
this._authProvider.setTokenError(`${e3}`);
|
|
3895
4252
|
}
|
|
3896
4253
|
}));
|
|
3897
4254
|
const o2 = Math.random().toString().split(".")[1];
|
|
3898
|
-
this._realtimeClient = new
|
|
4255
|
+
this._realtimeClient = new Xn(this._apiUrls.getRealtimeWsUrl(t2, s2, "1.7.0", o2, e2.clientBuild), s2, this._authProvider), this.currentUser = this.user(s2), this._terminationReason = r(), this._terminationReason.promise.then((e3) => {
|
|
3899
4256
|
console.error(`[TalkJS] ${e3}`);
|
|
3900
|
-
}), function(e3, t3) {
|
|
4257
|
+
}), (function(e3, t3) {
|
|
3901
4258
|
return __async(this, null, function* () {
|
|
3902
|
-
return
|
|
4259
|
+
return na({ method: "GET", url: `${t3}/${e3}` }).then((e4) => __async(null, null, function* () {
|
|
3903
4260
|
return 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);
|
|
3904
4261
|
})).catch((e4) => {
|
|
3905
4262
|
if ("string" != typeof e4 && "status" in e4) {
|
|
@@ -3909,7 +4266,7 @@ class Ns {
|
|
|
3909
4266
|
return console.warn("[TalkJS] Encountered network issues when validating app ID. Assuming that the app ID is valid."), true;
|
|
3910
4267
|
});
|
|
3911
4268
|
});
|
|
3912
|
-
}(this._appId, this._apiUrls.internalHttpApiUrl).then((e3) => {
|
|
4269
|
+
})(this._appId, this._apiUrls.internalHttpApiUrl).then((e3) => {
|
|
3913
4270
|
e3 || this.terminate(new Error(`The app ID ${this._appId} does not exist. Make sure you are using the correct app ID as found on the TalkJS dashboard. App IDs are case-sensitive.`));
|
|
3914
4271
|
}), this._authProvider.onTokenRefreshFailed((e3) => {
|
|
3915
4272
|
this.terminate(new Error(`Could not authenticate, cannot recover automatically: ${e3}`));
|
|
@@ -3931,7 +4288,7 @@ class Ns {
|
|
|
3931
4288
|
});
|
|
3932
4289
|
}
|
|
3933
4290
|
onError(e2) {
|
|
3934
|
-
const t2 =
|
|
4291
|
+
const t2 = r();
|
|
3935
4292
|
return Promise.race([t2.promise, this._terminationReason.promise]).then((t3) => {
|
|
3936
4293
|
"UNSUBSCRIBED" !== t3 && e2(t3);
|
|
3937
4294
|
}), { unsubscribe: () => t2.resolve("UNSUBSCRIBED") };
|
|
@@ -3949,32 +4306,49 @@ class Ns {
|
|
|
3949
4306
|
subscribeConversations(e2) {
|
|
3950
4307
|
return this._realtimeClient.subscribe(["me", "conversations"], e2);
|
|
3951
4308
|
}
|
|
4309
|
+
searchMessages(e2) {
|
|
4310
|
+
let t2;
|
|
4311
|
+
return { setQuery: (s2) => t2 && t2.searchString === s2 ? t2.currentState : (t2 && t2.cancel(), s2 && "" !== s2 ? (t2 = new ma(e2, s2, `${this._apiUrls.restApiHttpUrl}/${this._appId}/me/messages/search`, (e3) => __async(this, null, function* () {
|
|
4312
|
+
const [t3, s3] = yield Promise.all([this.conversation(e3.conversationId).get(), this._realtimeClient.hydrateMessageData(e3, e3.conversationId)]);
|
|
4313
|
+
return null === t3 ? c("Message belongs to nonexistent conversation") : s3.ok ? o({ conversation: t3, message: s3.value }) : s3;
|
|
4314
|
+
}), this._authProvider), t2.loadMore(3)) : (t2 = void 0, e2 == null ? void 0 : e2([], "loadedAll"), Promise.resolve({ results: [], loadedAll: true }))), loadMore: (e3) => t2 ? t2.loadMore(e3 != null ? e3 : 10) : Promise.resolve({ results: [], loadedAll: true }) };
|
|
4315
|
+
}
|
|
4316
|
+
searchConversations(e2) {
|
|
4317
|
+
let t2;
|
|
4318
|
+
return { setQuery: (s2) => t2 && t2.searchString === s2 ? t2.currentState : (t2 && t2.cancel(), s2 && "" !== s2 ? (t2 = new ma(e2, s2, `${this._apiUrls.restApiHttpUrl}/${this._appId}/me/conversations/search`, (e3) => __async(this, null, function* () {
|
|
4319
|
+
const t3 = yield this._realtimeClient.hydrateConvData(e3);
|
|
4320
|
+
if (!t3.ok) return t3;
|
|
4321
|
+
const s3 = t3.value;
|
|
4322
|
+
return null === s3 ? l({ status: 404, errorCode: "CONVERSATION_NOT_FOUND", reasons: ["No conversation with that ID was found"] }) : o(s3);
|
|
4323
|
+
}), this._authProvider), t2.loadMore(3)) : (t2 = void 0, e2 == null ? void 0 : e2([], "loadedAll"), Promise.resolve({ results: [], loadedAll: true }))), loadMore: (e3) => t2 ? t2.loadMore(e3 != null ? e3 : 10) : Promise.resolve({ results: [], loadedAll: true }) };
|
|
4324
|
+
}
|
|
3952
4325
|
terminate(e2) {
|
|
3953
|
-
|
|
4326
|
+
ha.deregister(this._appId, this.currentUser.id), this._terminationReason.resolve(e2), this._realtimeClient.destroy();
|
|
3954
4327
|
}
|
|
3955
4328
|
_isConnected() {
|
|
3956
4329
|
return this._realtimeClient.isConnected();
|
|
3957
4330
|
}
|
|
3958
4331
|
uploadFile(e2, t2) {
|
|
3959
|
-
return
|
|
4332
|
+
return pa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, this._realtimeClient, e2, t2);
|
|
3960
4333
|
}
|
|
3961
4334
|
uploadImage(e2, t2) {
|
|
3962
|
-
return
|
|
4335
|
+
return pa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, this._realtimeClient, e2, __spreadValues({ subtype: "image" }, t2));
|
|
3963
4336
|
}
|
|
3964
4337
|
uploadVideo(e2, t2) {
|
|
3965
|
-
return
|
|
4338
|
+
return pa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, this._realtimeClient, e2, __spreadValues({ subtype: "video" }, t2));
|
|
3966
4339
|
}
|
|
3967
4340
|
uploadAudio(e2, t2) {
|
|
3968
|
-
return
|
|
4341
|
+
return pa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, this._realtimeClient, e2, __spreadValues({ subtype: "audio" }, t2));
|
|
3969
4342
|
}
|
|
3970
4343
|
uploadVoice(e2, t2) {
|
|
3971
|
-
return
|
|
4344
|
+
return pa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, this._realtimeClient, e2, __spreadValues({ subtype: "voice" }, t2));
|
|
3972
4345
|
}
|
|
3973
4346
|
}
|
|
3974
|
-
function
|
|
3975
|
-
return __async(this, arguments, function* (e2, t2, s2, { subtype:
|
|
3976
|
-
|
|
3977
|
-
|
|
4347
|
+
function pa(_0, _1, _2, _3, _4) {
|
|
4348
|
+
return __async(this, arguments, function* (e2, t2, s2, n2, { subtype: a2, filename: r2, width: i2, height: o2, duration: c2 }) {
|
|
4349
|
+
d("Upload file", yield s2.call({ method: "POST", path: ["files", "validate"], data: { filename: r2, filesize: n2.size } }));
|
|
4350
|
+
const l2 = new FormData();
|
|
4351
|
+
return l2.set("file", n2, r2), void 0 !== a2 && l2.set("subtype", a2), void 0 !== i2 && l2.set("width", i2.toString()), void 0 !== o2 && l2.set("height", o2.toString()), void 0 !== c2 && l2.set("duration", c2.toString()), na({ method: "POST", url: e2, data: l2, authProvider: t2, errorTracker: t2.errorTracker }).then((e3) => e3.json()).then((e3) => e3.fileToken).catch((e3) => __async(null, null, function* () {
|
|
3978
4352
|
if (e3 instanceof Response) {
|
|
3979
4353
|
const t3 = yield e3.json(), s3 = `Unexpected response when uploading file, status code ${e3.status} ${t3.errorCode}, ${t3.reasons}`;
|
|
3980
4354
|
throw new Error(s3);
|
|
@@ -3983,8 +4357,95 @@ function _s(_0, _1, _2, _3) {
|
|
|
3983
4357
|
}));
|
|
3984
4358
|
});
|
|
3985
4359
|
}
|
|
4360
|
+
class ma {
|
|
4361
|
+
constructor(e2, t2, s2, n2, a2) {
|
|
4362
|
+
this.onResults = e2, this.searchString = t2, this.baseUrl = s2, this.hydrateData = n2, this.authProvider = a2, this.error = void 0, this.lastCompletedQueryState = { results: [], loadedAll: false }, this.currentCursor = void 0, this.cancelQuery = () => {
|
|
4363
|
+
}, e2 == null ? void 0 : e2([], "searching");
|
|
4364
|
+
}
|
|
4365
|
+
get currentState() {
|
|
4366
|
+
return this.loadingDeferred ? this.loadingDeferred.promise : Promise.resolve(this.lastCompletedQueryState);
|
|
4367
|
+
}
|
|
4368
|
+
cancel() {
|
|
4369
|
+
this.cancelQuery();
|
|
4370
|
+
}
|
|
4371
|
+
buildUrl(e2) {
|
|
4372
|
+
const t2 = new URL(this.baseUrl);
|
|
4373
|
+
return void 0 === this.currentCursor && t2.searchParams.append("searchString", encodeURIComponent(this.searchString)), void 0 !== this.currentCursor && t2.searchParams.append("cursor", this.currentCursor), t2.searchParams.append("limit", e2.toString()), t2.toString();
|
|
4374
|
+
}
|
|
4375
|
+
loadMore(e2) {
|
|
4376
|
+
return __async(this, null, function* () {
|
|
4377
|
+
var _a2, _b2;
|
|
4378
|
+
if (this.error) throw this.error;
|
|
4379
|
+
if (this.loadingDeferred) return this.loadingDeferred.promise;
|
|
4380
|
+
if (this.lastCompletedQueryState.loadedAll) return Promise.resolve(this.lastCompletedQueryState);
|
|
4381
|
+
this.loadingDeferred = r(), this.loadingDeferred.promise.catch(() => {
|
|
4382
|
+
});
|
|
4383
|
+
const t2 = new AbortController();
|
|
4384
|
+
this.cancelQuery = () => {
|
|
4385
|
+
t2.abort();
|
|
4386
|
+
};
|
|
4387
|
+
const s2 = this.buildUrl(e2), n2 = [], a2 = yield this._performSearch(s2, t2, (e3) => {
|
|
4388
|
+
const t3 = this.hydrateData(e3);
|
|
4389
|
+
n2.push(t3), void 0 !== this.onResults && Promise.all(n2).then((e4) => {
|
|
4390
|
+
const t4 = u(e4), s3 = x([...this.lastCompletedQueryState.results, ...t4]);
|
|
4391
|
+
this.onResults(s3, "searching");
|
|
4392
|
+
});
|
|
4393
|
+
}), i2 = a2.ok ? a2.value : void 0;
|
|
4394
|
+
if (yield Promise.all(n2).then((e3) => {
|
|
4395
|
+
var _a3;
|
|
4396
|
+
const t3 = u(e3), s3 = x([...this.lastCompletedQueryState.results, ...t3]), n3 = void 0 === i2;
|
|
4397
|
+
this.lastCompletedQueryState = x({ results: s3, loadedAll: n3 }), this.currentCursor = i2;
|
|
4398
|
+
const a3 = n3 ? "loadedAll" : "canLoadMore";
|
|
4399
|
+
(_a3 = this.onResults) == null ? void 0 : _a3.call(this, s3, a3);
|
|
4400
|
+
}), a2.ok) return (_a2 = this.loadingDeferred) == null ? void 0 : _a2.resolve(this.lastCompletedQueryState), this.loadingDeferred = void 0, this.lastCompletedQueryState;
|
|
4401
|
+
throw (_b2 = this.loadingDeferred) == null ? void 0 : _b2.reject(a2.value), this.loadingDeferred = void 0, this.error = a2.value, a2.value;
|
|
4402
|
+
});
|
|
4403
|
+
}
|
|
4404
|
+
_performSearch(e2, t2, s2) {
|
|
4405
|
+
return __async(this, null, function* () {
|
|
4406
|
+
let n2;
|
|
4407
|
+
return na({ method: "GET", url: e2, authProvider: this.authProvider, errorTracker: this.authProvider.errorTracker, abortSignal: t2.signal }).then((e3) => __async(this, null, function* () {
|
|
4408
|
+
if (!e3.body) return l("Search response was missing body");
|
|
4409
|
+
const t3 = e3.body.getReader(), a2 = new TextDecoder();
|
|
4410
|
+
let r2 = "", i2 = true;
|
|
4411
|
+
const c2 = (e4, t4) => {
|
|
4412
|
+
if (i2) i2 = false;
|
|
4413
|
+
else try {
|
|
4414
|
+
if (e4.startsWith("]")) {
|
|
4415
|
+
const t5 = `{"data":[${e4}`, s4 = JSON.parse(t5);
|
|
4416
|
+
return void (n2 = s4.cursor);
|
|
4417
|
+
}
|
|
4418
|
+
let s3 = e4;
|
|
4419
|
+
s3.startsWith(",") && (s3 = s3.slice(1)), t4(JSON.parse(s3));
|
|
4420
|
+
} catch (e5) {
|
|
4421
|
+
console.warn("[TalkJS] Error during search, received unexpected data, ignoring. Some search results may be missing.");
|
|
4422
|
+
}
|
|
4423
|
+
};
|
|
4424
|
+
for (; ; ) {
|
|
4425
|
+
const { done: e4, value: n3 } = yield t3.read();
|
|
4426
|
+
if (e4) break;
|
|
4427
|
+
r2 += a2.decode(n3, { stream: true });
|
|
4428
|
+
const i3 = r2.split("\n");
|
|
4429
|
+
r2 = i3.pop() || "";
|
|
4430
|
+
for (const e5 of i3) c2(e5, s2);
|
|
4431
|
+
}
|
|
4432
|
+
r2 += a2.decode();
|
|
4433
|
+
const h2 = r2.split("\n");
|
|
4434
|
+
for (const e4 of h2) c2(e4, s2);
|
|
4435
|
+
return o(n2);
|
|
4436
|
+
})).catch((e3) => __async(this, null, function* () {
|
|
4437
|
+
if (e3 instanceof DOMException && "AbortError" === e3.name) return o(void 0);
|
|
4438
|
+
if (e3 instanceof Response) {
|
|
4439
|
+
const t3 = yield e3.clone().json();
|
|
4440
|
+
return l(p("Search", { status: e3.status, errorCode: t3.errorCode, reasons: t3.reasons }));
|
|
4441
|
+
}
|
|
4442
|
+
return l(e3);
|
|
4443
|
+
}));
|
|
4444
|
+
});
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
3986
4447
|
export {
|
|
3987
|
-
|
|
4448
|
+
ua as getTalkSession,
|
|
3988
4449
|
f as registerPolyfills
|
|
3989
4450
|
};
|
|
3990
4451
|
//# sourceMappingURL=talkSession.js.map
|