@gamention/pulse-elements 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pulse-elements.cjs +12 -12
- package/dist/pulse-elements.js +717 -705
- package/package.json +2 -2
package/dist/pulse-elements.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
6
|
let vt = class extends Event {
|
|
7
|
-
constructor(e, t, i,
|
|
8
|
-
super("context-request", { bubbles: !0, composed: !0 }), this.context = e, this.contextTarget = t, this.callback = i, this.subscribe =
|
|
7
|
+
constructor(e, t, i, s) {
|
|
8
|
+
super("context-request", { bubbles: !0, composed: !0 }), this.context = e, this.contextTarget = t, this.callback = i, this.subscribe = s ?? !1;
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
@@ -19,13 +19,13 @@ let vt = class extends Event {
|
|
|
19
19
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
20
20
|
*/
|
|
21
21
|
let We = class {
|
|
22
|
-
constructor(e, t, i,
|
|
22
|
+
constructor(e, t, i, s) {
|
|
23
23
|
if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (o, r) => {
|
|
24
24
|
this.unsubscribe && (this.unsubscribe !== r && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = o, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(o, r)), this.unsubscribe = r;
|
|
25
25
|
}, this.host = e, t.context !== void 0) {
|
|
26
26
|
const o = t;
|
|
27
27
|
this.context = o.context, this.callback = o.callback, this.subscribe = o.subscribe ?? !1;
|
|
28
|
-
} else this.context = t, this.callback = i, this.subscribe =
|
|
28
|
+
} else this.context = t, this.callback = i, this.subscribe = s ?? !1;
|
|
29
29
|
this.host.addController(this);
|
|
30
30
|
}
|
|
31
31
|
hostConnected() {
|
|
@@ -64,8 +64,8 @@ let At = class {
|
|
|
64
64
|
this.subscriptions.has(e) || this.subscriptions.set(e, { disposer: () => {
|
|
65
65
|
this.subscriptions.delete(e);
|
|
66
66
|
}, consumerHost: t });
|
|
67
|
-
const { disposer:
|
|
68
|
-
e(this.value,
|
|
67
|
+
const { disposer: s } = this.subscriptions.get(e);
|
|
68
|
+
e(this.value, s);
|
|
69
69
|
}
|
|
70
70
|
clearCallbacks() {
|
|
71
71
|
this.subscriptions.clear();
|
|
@@ -82,7 +82,7 @@ let It = class extends Event {
|
|
|
82
82
|
}
|
|
83
83
|
}, Xe = class extends At {
|
|
84
84
|
constructor(e, t, i) {
|
|
85
|
-
var
|
|
85
|
+
var s, o;
|
|
86
86
|
super(t.context !== void 0 ? t.initialValue : i), this.onContextRequest = (r) => {
|
|
87
87
|
if (r.context !== this.context) return;
|
|
88
88
|
const l = r.contextTarget ?? r.composedPath()[0];
|
|
@@ -92,7 +92,7 @@ let It = class extends Event {
|
|
|
92
92
|
const l = /* @__PURE__ */ new Set();
|
|
93
93
|
for (const [a, { consumerHost: c }] of this.subscriptions) l.has(a) || (l.add(a), c.dispatchEvent(new vt(this.context, c, a, !0)));
|
|
94
94
|
r.stopPropagation();
|
|
95
|
-
}, this.host = e, t.context !== void 0 ? this.context = t.context : this.context = t, this.attachListeners(), (o = (
|
|
95
|
+
}, this.host = e, t.context !== void 0 ? this.context = t.context : this.context = t, this.attachListeners(), (o = (s = this.host).addController) == null || o.call(s, this);
|
|
96
96
|
}
|
|
97
97
|
attachListeners() {
|
|
98
98
|
this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
|
|
@@ -106,23 +106,23 @@ let It = class extends Event {
|
|
|
106
106
|
* Copyright 2017 Google LLC
|
|
107
107
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
108
108
|
*/
|
|
109
|
-
function Mt({ context:
|
|
109
|
+
function Mt({ context: n }) {
|
|
110
110
|
return (e, t) => {
|
|
111
111
|
const i = /* @__PURE__ */ new WeakMap();
|
|
112
112
|
if (typeof t == "object") return { get() {
|
|
113
113
|
return e.get.call(this);
|
|
114
|
-
}, set(
|
|
115
|
-
return i.get(this).setValue(
|
|
116
|
-
}, init(
|
|
117
|
-
return i.set(this, new Xe(this, { context:
|
|
114
|
+
}, set(s) {
|
|
115
|
+
return i.get(this).setValue(s), e.set.call(this, s);
|
|
116
|
+
}, init(s) {
|
|
117
|
+
return i.set(this, new Xe(this, { context: n, initialValue: s })), s;
|
|
118
118
|
} };
|
|
119
119
|
{
|
|
120
120
|
e.constructor.addInitializer(((r) => {
|
|
121
|
-
i.set(r, new Xe(r, { context:
|
|
121
|
+
i.set(r, new Xe(r, { context: n }));
|
|
122
122
|
}));
|
|
123
|
-
const
|
|
123
|
+
const s = Object.getOwnPropertyDescriptor(e, t);
|
|
124
124
|
let o;
|
|
125
|
-
if (
|
|
125
|
+
if (s === void 0) {
|
|
126
126
|
const r = /* @__PURE__ */ new WeakMap();
|
|
127
127
|
o = { get() {
|
|
128
128
|
return r.get(this);
|
|
@@ -130,8 +130,8 @@ function Mt({ context: s }) {
|
|
|
130
130
|
i.get(this).setValue(l), r.set(this, l);
|
|
131
131
|
}, configurable: !0, enumerable: !0 };
|
|
132
132
|
} else {
|
|
133
|
-
const r =
|
|
134
|
-
o = { ...
|
|
133
|
+
const r = s.set;
|
|
134
|
+
o = { ...s, set(l) {
|
|
135
135
|
i.get(this).setValue(l), r == null || r.call(this, l);
|
|
136
136
|
} };
|
|
137
137
|
}
|
|
@@ -144,20 +144,20 @@ function Mt({ context: s }) {
|
|
|
144
144
|
* Copyright 2022 Google LLC
|
|
145
145
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
146
146
|
*/
|
|
147
|
-
function pe({ context:
|
|
147
|
+
function pe({ context: n, subscribe: e }) {
|
|
148
148
|
return (t, i) => {
|
|
149
149
|
typeof i == "object" ? i.addInitializer((function() {
|
|
150
|
-
new We(this, { context:
|
|
151
|
-
t.set.call(this,
|
|
150
|
+
new We(this, { context: n, callback: (s) => {
|
|
151
|
+
t.set.call(this, s);
|
|
152
152
|
}, subscribe: e });
|
|
153
|
-
})) : t.constructor.addInitializer(((
|
|
154
|
-
new We(
|
|
155
|
-
|
|
153
|
+
})) : t.constructor.addInitializer(((s) => {
|
|
154
|
+
new We(s, { context: n, callback: (o) => {
|
|
155
|
+
s[i] = o;
|
|
156
156
|
}, subscribe: e });
|
|
157
157
|
}));
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
var Ot = Object.defineProperty, Rt = (
|
|
160
|
+
var Ot = Object.defineProperty, Rt = (n, e, t) => e in n ? Ot(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, x = (n, e, t) => Rt(n, typeof e != "symbol" ? e + "" : e, t);
|
|
161
161
|
const Lt = "ws://localhost:4567";
|
|
162
162
|
let je = class {
|
|
163
163
|
constructor() {
|
|
@@ -174,7 +174,7 @@ let je = class {
|
|
|
174
174
|
}
|
|
175
175
|
emit(e, t) {
|
|
176
176
|
var i;
|
|
177
|
-
(i = this.handlers.get(e)) == null || i.forEach((
|
|
177
|
+
(i = this.handlers.get(e)) == null || i.forEach((s) => s(t));
|
|
178
178
|
}
|
|
179
179
|
removeAll() {
|
|
180
180
|
this.handlers.clear();
|
|
@@ -216,13 +216,23 @@ let je = class {
|
|
|
216
216
|
this.reconnectTimer = null, this.connect();
|
|
217
217
|
}, e);
|
|
218
218
|
}
|
|
219
|
-
},
|
|
219
|
+
}, Ut = class extends je {
|
|
220
220
|
constructor() {
|
|
221
221
|
super(...arguments), x(this, "baseUrl", ""), x(this, "_user", null), x(this, "_users", /* @__PURE__ */ new Map()), x(this, "_presence", /* @__PURE__ */ new Map()), x(this, "_threads", /* @__PURE__ */ new Map()), x(this, "_reactions", /* @__PURE__ */ new Map()), x(this, "_notifications", []), x(this, "_activityLogs", []), x(this, "_typing", /* @__PURE__ */ new Map()), x(this, "_viewports", /* @__PURE__ */ new Map()), x(this, "_selections", /* @__PURE__ */ new Map());
|
|
222
222
|
}
|
|
223
223
|
get user() {
|
|
224
224
|
return this._user;
|
|
225
225
|
}
|
|
226
|
+
/** Optimistically remove a comment from local state (before server round-trip). */
|
|
227
|
+
removeComment(e) {
|
|
228
|
+
for (const [t, i] of this._threads) {
|
|
229
|
+
const s = i.comments.findIndex((o) => o.id === e);
|
|
230
|
+
if (s !== -1) {
|
|
231
|
+
i.comments.splice(s, 1), i.comments.length === 0 && this._threads.delete(t), this.emit("threads", this.threads);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
226
236
|
get presence() {
|
|
227
237
|
return [...this._presence.values()];
|
|
228
238
|
}
|
|
@@ -247,10 +257,10 @@ let je = class {
|
|
|
247
257
|
getTypingUsers(e) {
|
|
248
258
|
const t = this._typing.get(e);
|
|
249
259
|
if (!t) return [];
|
|
250
|
-
const i = Date.now(),
|
|
260
|
+
const i = Date.now(), s = [];
|
|
251
261
|
for (const [o, r] of t)
|
|
252
|
-
i - r < 3e3 &&
|
|
253
|
-
return
|
|
262
|
+
i - r < 3e3 && s.push(o);
|
|
263
|
+
return s;
|
|
254
264
|
}
|
|
255
265
|
get viewports() {
|
|
256
266
|
return this._viewports;
|
|
@@ -329,7 +339,7 @@ let je = class {
|
|
|
329
339
|
case "comment:edited": {
|
|
330
340
|
const t = this._threads.get(e.threadId);
|
|
331
341
|
if (t) {
|
|
332
|
-
const i = t.comments.findIndex((
|
|
342
|
+
const i = t.comments.findIndex((s) => s.id === e.comment.id);
|
|
333
343
|
i !== -1 && (t.comments[i] = this.resolveComment(e.comment)), this.emit("threads", this.threads);
|
|
334
344
|
}
|
|
335
345
|
break;
|
|
@@ -358,7 +368,7 @@ let je = class {
|
|
|
358
368
|
case "reaction:removed": {
|
|
359
369
|
const t = this._reactions.get(e.targetId);
|
|
360
370
|
if (t) {
|
|
361
|
-
const i = t.filter((
|
|
371
|
+
const i = t.filter((s) => s.id !== e.reactionId);
|
|
362
372
|
this._reactions.set(e.targetId, i), this.emit("reactions", {
|
|
363
373
|
targetId: e.targetId,
|
|
364
374
|
reactions: i
|
|
@@ -419,12 +429,12 @@ let je = class {
|
|
|
419
429
|
}, xt = class extends je {
|
|
420
430
|
constructor(e) {
|
|
421
431
|
var t;
|
|
422
|
-
super(), x(this, "state"), x(this, "connection"), x(this, "config"), x(this, "heartbeatTimer", null), x(this, "lastCursorSend", 0), x(this, "pendingCursor", null), x(this, "cursorTimer", null), this.config = e, this.state = new
|
|
432
|
+
super(), x(this, "state"), x(this, "connection"), x(this, "config"), x(this, "heartbeatTimer", null), x(this, "lastCursorSend", 0), x(this, "pendingCursor", null), x(this, "cursorTimer", null), this.config = e, this.state = new Ut(), this.state.baseUrl = (e.endpoint ?? "").replace(/^ws(s?):/, "http$1:").replace(/\/$/, "");
|
|
423
433
|
const i = ((t = e.endpoint) == null ? void 0 : t.replace(/^http/, "ws")) ?? void 0;
|
|
424
|
-
this.connection = new jt(i), this.connection.on("message", (
|
|
425
|
-
this.state.handleMessage(
|
|
426
|
-
}), this.connection.on("state", (
|
|
427
|
-
this.emit("connection",
|
|
434
|
+
this.connection = new jt(i), this.connection.on("message", (s) => {
|
|
435
|
+
this.state.handleMessage(s), this.emit(s.type, s);
|
|
436
|
+
}), this.connection.on("state", (s) => {
|
|
437
|
+
this.emit("connection", s), s === "connected" ? (this.authenticate(), this.startHeartbeat()) : s === "disconnected" && this.stopHeartbeat();
|
|
428
438
|
});
|
|
429
439
|
}
|
|
430
440
|
/** Current WebSocket connection state. */
|
|
@@ -482,15 +492,15 @@ let je = class {
|
|
|
482
492
|
attachmentIds: t.attachmentIds
|
|
483
493
|
}), i;
|
|
484
494
|
}
|
|
485
|
-
reply(e, t, i = [],
|
|
495
|
+
reply(e, t, i = [], s) {
|
|
486
496
|
const o = crypto.randomUUID();
|
|
487
|
-
return this.send({ type: "comment:create", threadId: e, id: o, body: t, mentions: i, attachmentIds:
|
|
497
|
+
return this.send({ type: "comment:create", threadId: e, id: o, body: t, mentions: i, attachmentIds: s }), o;
|
|
488
498
|
}
|
|
489
499
|
editComment(e, t, i = []) {
|
|
490
500
|
this.send({ type: "comment:edit", commentId: e, body: t, mentions: i });
|
|
491
501
|
}
|
|
492
502
|
deleteComment(e) {
|
|
493
|
-
this.send({ type: "comment:delete", commentId: e });
|
|
503
|
+
this.state.removeComment(e), this.send({ type: "comment:delete", commentId: e });
|
|
494
504
|
}
|
|
495
505
|
resolveThread(e, t = !0) {
|
|
496
506
|
this.send({ type: "thread:resolve", threadId: e, resolved: t });
|
|
@@ -540,7 +550,7 @@ let je = class {
|
|
|
540
550
|
async uploadFile(e) {
|
|
541
551
|
const t = (this.config.endpoint ?? window.location.origin).replace(/^ws(s?):/, "http$1:"), i = new FormData();
|
|
542
552
|
i.append("file", e);
|
|
543
|
-
const
|
|
553
|
+
const s = await fetch(`${t}/api/v1/upload`, {
|
|
544
554
|
method: "POST",
|
|
545
555
|
headers: {
|
|
546
556
|
"X-Pulse-Key": this.config.apiKey,
|
|
@@ -548,11 +558,11 @@ let je = class {
|
|
|
548
558
|
},
|
|
549
559
|
body: i
|
|
550
560
|
});
|
|
551
|
-
if (!
|
|
552
|
-
const r = await
|
|
561
|
+
if (!s.ok) {
|
|
562
|
+
const r = await s.json().catch(() => ({ error: "Upload failed" }));
|
|
553
563
|
throw new Error(r.error ?? "Upload failed");
|
|
554
564
|
}
|
|
555
|
-
const o = await
|
|
565
|
+
const o = await s.json();
|
|
556
566
|
return o.url && !o.url.startsWith("http") && (o.url = `${t}${o.url}`), o.thumbnailUrl && !o.thumbnailUrl.startsWith("http") && (o.thumbnailUrl = `${t}${o.thumbnailUrl}`), o;
|
|
557
567
|
}
|
|
558
568
|
// ── Presence control ──
|
|
@@ -565,16 +575,16 @@ let je = class {
|
|
|
565
575
|
* Copyright 2019 Google LLC
|
|
566
576
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
567
577
|
*/
|
|
568
|
-
const ve = globalThis,
|
|
578
|
+
const ve = globalThis, Ue = ve.ShadowRoot && (ve.ShadyCSS === void 0 || ve.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ze = Symbol(), Ye = /* @__PURE__ */ new WeakMap();
|
|
569
579
|
let yt = class {
|
|
570
580
|
constructor(e, t, i) {
|
|
571
|
-
if (this._$cssResult$ = !0, i !==
|
|
581
|
+
if (this._$cssResult$ = !0, i !== ze) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
572
582
|
this.cssText = e, this.t = t;
|
|
573
583
|
}
|
|
574
584
|
get styleSheet() {
|
|
575
585
|
let e = this.o;
|
|
576
586
|
const t = this.t;
|
|
577
|
-
if (
|
|
587
|
+
if (Ue && e === void 0) {
|
|
578
588
|
const i = t !== void 0 && t.length === 1;
|
|
579
589
|
i && (e = Ye.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && Ye.set(t, e));
|
|
580
590
|
}
|
|
@@ -584,59 +594,59 @@ let yt = class {
|
|
|
584
594
|
return this.cssText;
|
|
585
595
|
}
|
|
586
596
|
};
|
|
587
|
-
const
|
|
588
|
-
const t =
|
|
597
|
+
const zt = (n) => new yt(typeof n == "string" ? n : n + "", void 0, ze), A = (n, ...e) => {
|
|
598
|
+
const t = n.length === 1 ? n[0] : e.reduce((i, s, o) => i + ((r) => {
|
|
589
599
|
if (r._$cssResult$ === !0) return r.cssText;
|
|
590
600
|
if (typeof r == "number") return r;
|
|
591
601
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + r + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
592
|
-
})(
|
|
593
|
-
return new yt(t,
|
|
594
|
-
}, Dt = (
|
|
595
|
-
if (
|
|
602
|
+
})(s) + n[o + 1], n[0]);
|
|
603
|
+
return new yt(t, n, ze);
|
|
604
|
+
}, Dt = (n, e) => {
|
|
605
|
+
if (Ue) n.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
|
596
606
|
else for (const t of e) {
|
|
597
|
-
const i = document.createElement("style"),
|
|
598
|
-
|
|
607
|
+
const i = document.createElement("style"), s = ve.litNonce;
|
|
608
|
+
s !== void 0 && i.setAttribute("nonce", s), i.textContent = t.cssText, n.appendChild(i);
|
|
599
609
|
}
|
|
600
|
-
}, Ke =
|
|
610
|
+
}, Ke = Ue ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((e) => {
|
|
601
611
|
let t = "";
|
|
602
612
|
for (const i of e.cssRules) t += i.cssText;
|
|
603
|
-
return
|
|
604
|
-
})(
|
|
613
|
+
return zt(t);
|
|
614
|
+
})(n) : n;
|
|
605
615
|
/**
|
|
606
616
|
* @license
|
|
607
617
|
* Copyright 2017 Google LLC
|
|
608
618
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
609
619
|
*/
|
|
610
|
-
const { is: Ht, defineProperty: Nt, getOwnPropertyDescriptor: Bt, getOwnPropertyNames: Ft, getOwnPropertySymbols: Vt, getPrototypeOf: qt } = Object,
|
|
620
|
+
const { is: Ht, defineProperty: Nt, getOwnPropertyDescriptor: Bt, getOwnPropertyNames: Ft, getOwnPropertySymbols: Vt, getPrototypeOf: qt } = Object, z = globalThis, Ge = z.trustedTypes, Wt = Ge ? Ge.emptyScript : "", Te = z.reactiveElementPolyfillSupport, ie = (n, e) => n, we = { toAttribute(n, e) {
|
|
611
621
|
switch (e) {
|
|
612
622
|
case Boolean:
|
|
613
|
-
|
|
623
|
+
n = n ? Wt : null;
|
|
614
624
|
break;
|
|
615
625
|
case Object:
|
|
616
626
|
case Array:
|
|
617
|
-
|
|
627
|
+
n = n == null ? n : JSON.stringify(n);
|
|
618
628
|
}
|
|
619
|
-
return
|
|
620
|
-
}, fromAttribute(
|
|
621
|
-
let t =
|
|
629
|
+
return n;
|
|
630
|
+
}, fromAttribute(n, e) {
|
|
631
|
+
let t = n;
|
|
622
632
|
switch (e) {
|
|
623
633
|
case Boolean:
|
|
624
|
-
t =
|
|
634
|
+
t = n !== null;
|
|
625
635
|
break;
|
|
626
636
|
case Number:
|
|
627
|
-
t =
|
|
637
|
+
t = n === null ? null : Number(n);
|
|
628
638
|
break;
|
|
629
639
|
case Object:
|
|
630
640
|
case Array:
|
|
631
641
|
try {
|
|
632
|
-
t = JSON.parse(
|
|
642
|
+
t = JSON.parse(n);
|
|
633
643
|
} catch {
|
|
634
644
|
t = null;
|
|
635
645
|
}
|
|
636
646
|
}
|
|
637
647
|
return t;
|
|
638
|
-
} }, De = (
|
|
639
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
648
|
+
} }, De = (n, e) => !Ht(n, e), Ze = { attribute: !0, type: String, converter: we, reflect: !1, useDefault: !1, hasChanged: De };
|
|
649
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), z.litPropertyMetadata ?? (z.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
640
650
|
let Y = class extends HTMLElement {
|
|
641
651
|
static addInitializer(e) {
|
|
642
652
|
this._$Ei(), (this.l ?? (this.l = [])).push(e);
|
|
@@ -646,18 +656,18 @@ let Y = class extends HTMLElement {
|
|
|
646
656
|
}
|
|
647
657
|
static createProperty(e, t = Ze) {
|
|
648
658
|
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
649
|
-
const i = Symbol(),
|
|
650
|
-
|
|
659
|
+
const i = Symbol(), s = this.getPropertyDescriptor(e, i, t);
|
|
660
|
+
s !== void 0 && Nt(this.prototype, e, s);
|
|
651
661
|
}
|
|
652
662
|
}
|
|
653
663
|
static getPropertyDescriptor(e, t, i) {
|
|
654
|
-
const { get:
|
|
664
|
+
const { get: s, set: o } = Bt(this.prototype, e) ?? { get() {
|
|
655
665
|
return this[t];
|
|
656
666
|
}, set(r) {
|
|
657
667
|
this[t] = r;
|
|
658
668
|
} };
|
|
659
|
-
return { get:
|
|
660
|
-
const l =
|
|
669
|
+
return { get: s, set(r) {
|
|
670
|
+
const l = s == null ? void 0 : s.call(this);
|
|
661
671
|
o == null || o.call(this, r), this.requestUpdate(e, l, i);
|
|
662
672
|
}, configurable: !0, enumerable: !0 };
|
|
663
673
|
}
|
|
@@ -673,17 +683,17 @@ let Y = class extends HTMLElement {
|
|
|
673
683
|
if (this.hasOwnProperty(ie("finalized"))) return;
|
|
674
684
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(ie("properties"))) {
|
|
675
685
|
const t = this.properties, i = [...Ft(t), ...Vt(t)];
|
|
676
|
-
for (const
|
|
686
|
+
for (const s of i) this.createProperty(s, t[s]);
|
|
677
687
|
}
|
|
678
688
|
const e = this[Symbol.metadata];
|
|
679
689
|
if (e !== null) {
|
|
680
690
|
const t = litPropertyMetadata.get(e);
|
|
681
|
-
if (t !== void 0) for (const [i,
|
|
691
|
+
if (t !== void 0) for (const [i, s] of t) this.elementProperties.set(i, s);
|
|
682
692
|
}
|
|
683
693
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
684
694
|
for (const [t, i] of this.elementProperties) {
|
|
685
|
-
const
|
|
686
|
-
|
|
695
|
+
const s = this._$Eu(t, i);
|
|
696
|
+
s !== void 0 && this._$Eh.set(s, t);
|
|
687
697
|
}
|
|
688
698
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
689
699
|
}
|
|
@@ -691,7 +701,7 @@ let Y = class extends HTMLElement {
|
|
|
691
701
|
const t = [];
|
|
692
702
|
if (Array.isArray(e)) {
|
|
693
703
|
const i = new Set(e.flat(1 / 0).reverse());
|
|
694
|
-
for (const
|
|
704
|
+
for (const s of i) t.unshift(Ke(s));
|
|
695
705
|
} else e !== void 0 && t.push(Ke(e));
|
|
696
706
|
return t;
|
|
697
707
|
}
|
|
@@ -744,33 +754,33 @@ let Y = class extends HTMLElement {
|
|
|
744
754
|
}
|
|
745
755
|
_$ET(e, t) {
|
|
746
756
|
var o;
|
|
747
|
-
const i = this.constructor.elementProperties.get(e),
|
|
748
|
-
if (
|
|
757
|
+
const i = this.constructor.elementProperties.get(e), s = this.constructor._$Eu(e, i);
|
|
758
|
+
if (s !== void 0 && i.reflect === !0) {
|
|
749
759
|
const r = (((o = i.converter) == null ? void 0 : o.toAttribute) !== void 0 ? i.converter : we).toAttribute(t, i.type);
|
|
750
|
-
this._$Em = e, r == null ? this.removeAttribute(
|
|
760
|
+
this._$Em = e, r == null ? this.removeAttribute(s) : this.setAttribute(s, r), this._$Em = null;
|
|
751
761
|
}
|
|
752
762
|
}
|
|
753
763
|
_$AK(e, t) {
|
|
754
764
|
var o, r;
|
|
755
|
-
const i = this.constructor,
|
|
756
|
-
if (
|
|
757
|
-
const l = i.getPropertyOptions(
|
|
758
|
-
this._$Em =
|
|
765
|
+
const i = this.constructor, s = i._$Eh.get(e);
|
|
766
|
+
if (s !== void 0 && this._$Em !== s) {
|
|
767
|
+
const l = i.getPropertyOptions(s), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((o = l.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? l.converter : we;
|
|
768
|
+
this._$Em = s;
|
|
759
769
|
const c = a.fromAttribute(t, l.type);
|
|
760
|
-
this[
|
|
770
|
+
this[s] = c ?? ((r = this._$Ej) == null ? void 0 : r.get(s)) ?? c, this._$Em = null;
|
|
761
771
|
}
|
|
762
772
|
}
|
|
763
|
-
requestUpdate(e, t, i,
|
|
773
|
+
requestUpdate(e, t, i, s = !1, o) {
|
|
764
774
|
var r;
|
|
765
775
|
if (e !== void 0) {
|
|
766
776
|
const l = this.constructor;
|
|
767
|
-
if (
|
|
777
|
+
if (s === !1 && (o = this[e]), i ?? (i = l.getPropertyOptions(e)), !((i.hasChanged ?? De)(o, t) || i.useDefault && i.reflect && o === ((r = this._$Ej) == null ? void 0 : r.get(e)) && !this.hasAttribute(l._$Eu(e, i)))) return;
|
|
768
778
|
this.C(e, t, i);
|
|
769
779
|
}
|
|
770
780
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
771
781
|
}
|
|
772
|
-
C(e, t, { useDefault: i, reflect:
|
|
773
|
-
i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, r ?? t ?? this[e]), o !== !0 || r !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)),
|
|
782
|
+
C(e, t, { useDefault: i, reflect: s, wrapped: o }, r) {
|
|
783
|
+
i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, r ?? t ?? this[e]), o !== !0 || r !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), s === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
|
|
774
784
|
}
|
|
775
785
|
async _$EP() {
|
|
776
786
|
this.isUpdatePending = !0;
|
|
@@ -793,8 +803,8 @@ let Y = class extends HTMLElement {
|
|
|
793
803
|
for (const [o, r] of this._$Ep) this[o] = r;
|
|
794
804
|
this._$Ep = void 0;
|
|
795
805
|
}
|
|
796
|
-
const
|
|
797
|
-
if (
|
|
806
|
+
const s = this.constructor.elementProperties;
|
|
807
|
+
if (s.size > 0) for (const [o, r] of s) {
|
|
798
808
|
const { wrapped: l } = r, a = this[o];
|
|
799
809
|
l !== !0 || this._$AL.has(o) || a === void 0 || this.C(o, void 0, r, a);
|
|
800
810
|
}
|
|
@@ -802,12 +812,12 @@ let Y = class extends HTMLElement {
|
|
|
802
812
|
let e = !1;
|
|
803
813
|
const t = this._$AL;
|
|
804
814
|
try {
|
|
805
|
-
e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((
|
|
815
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((s) => {
|
|
806
816
|
var o;
|
|
807
|
-
return (o =
|
|
817
|
+
return (o = s.hostUpdate) == null ? void 0 : o.call(s);
|
|
808
818
|
}), this.update(t)) : this._$EM();
|
|
809
|
-
} catch (
|
|
810
|
-
throw e = !1, this._$EM(),
|
|
819
|
+
} catch (s) {
|
|
820
|
+
throw e = !1, this._$EM(), s;
|
|
811
821
|
}
|
|
812
822
|
e && this._$AE(t);
|
|
813
823
|
}
|
|
@@ -816,8 +826,8 @@ let Y = class extends HTMLElement {
|
|
|
816
826
|
_$AE(e) {
|
|
817
827
|
var t;
|
|
818
828
|
(t = this._$EO) == null || t.forEach((i) => {
|
|
819
|
-
var
|
|
820
|
-
return (
|
|
829
|
+
var s;
|
|
830
|
+
return (s = i.hostUpdated) == null ? void 0 : s.call(i);
|
|
821
831
|
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
822
832
|
}
|
|
823
833
|
_$EM() {
|
|
@@ -840,34 +850,34 @@ let Y = class extends HTMLElement {
|
|
|
840
850
|
firstUpdated(e) {
|
|
841
851
|
}
|
|
842
852
|
};
|
|
843
|
-
Y.elementStyles = [], Y.shadowRootOptions = { mode: "open" }, Y[ie("elementProperties")] = /* @__PURE__ */ new Map(), Y[ie("finalized")] = /* @__PURE__ */ new Map(), Te == null || Te({ ReactiveElement: Y }), (
|
|
853
|
+
Y.elementStyles = [], Y.shadowRootOptions = { mode: "open" }, Y[ie("elementProperties")] = /* @__PURE__ */ new Map(), Y[ie("finalized")] = /* @__PURE__ */ new Map(), Te == null || Te({ ReactiveElement: Y }), (z.reactiveElementVersions ?? (z.reactiveElementVersions = [])).push("2.1.2");
|
|
844
854
|
/**
|
|
845
855
|
* @license
|
|
846
856
|
* Copyright 2017 Google LLC
|
|
847
857
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
848
858
|
*/
|
|
849
|
-
const se = globalThis, Je = (
|
|
859
|
+
const se = globalThis, Je = (n) => n, $e = se.trustedTypes, Qe = $e ? $e.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, wt = "$lit$", U = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + U, Xt = `<${$t}>`, F = document, oe = () => F.createComment(""), re = (n) => n === null || typeof n != "object" && typeof n != "function", He = Array.isArray, Yt = (n) => He(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", Se = `[
|
|
850
860
|
\f\r]`, te = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, et = /-->/g, tt = />/g, H = RegExp(`>|${Se}(?:([^\\s"'>=/]+)(${Se}*=${Se}*(?:[^
|
|
851
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, st = /"/g, kt = /^(?:script|style|textarea|title)$/i, Et = (
|
|
852
|
-
function Ct(
|
|
853
|
-
if (!He(
|
|
861
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, st = /"/g, kt = /^(?:script|style|textarea|title)$/i, Et = (n) => (e, ...t) => ({ _$litType$: n, strings: e, values: t }), h = Et(1), Kt = Et(2), V = Symbol.for("lit-noChange"), f = Symbol.for("lit-nothing"), nt = /* @__PURE__ */ new WeakMap(), N = F.createTreeWalker(F, 129);
|
|
862
|
+
function Ct(n, e) {
|
|
863
|
+
if (!He(n) || !n.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
854
864
|
return Qe !== void 0 ? Qe.createHTML(e) : e;
|
|
855
865
|
}
|
|
856
|
-
const Gt = (
|
|
857
|
-
const t =
|
|
858
|
-
let
|
|
866
|
+
const Gt = (n, e) => {
|
|
867
|
+
const t = n.length - 1, i = [];
|
|
868
|
+
let s, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = te;
|
|
859
869
|
for (let l = 0; l < t; l++) {
|
|
860
|
-
const a =
|
|
870
|
+
const a = n[l];
|
|
861
871
|
let c, p, d = -1, u = 0;
|
|
862
|
-
for (; u < a.length && (r.lastIndex = u, p = r.exec(a), p !== null); ) u = r.lastIndex, r === te ? p[1] === "!--" ? r = et : p[1] !== void 0 ? r = tt : p[2] !== void 0 ? (kt.test(p[2]) && (
|
|
863
|
-
const m = r === H &&
|
|
864
|
-
o += r === te ? a + Xt : d >= 0 ? (i.push(c), a.slice(0, d) + wt + a.slice(d) +
|
|
872
|
+
for (; u < a.length && (r.lastIndex = u, p = r.exec(a), p !== null); ) u = r.lastIndex, r === te ? p[1] === "!--" ? r = et : p[1] !== void 0 ? r = tt : p[2] !== void 0 ? (kt.test(p[2]) && (s = RegExp("</" + p[2], "g")), r = H) : p[3] !== void 0 && (r = H) : r === H ? p[0] === ">" ? (r = s ?? te, d = -1) : p[1] === void 0 ? d = -2 : (d = r.lastIndex - p[2].length, c = p[1], r = p[3] === void 0 ? H : p[3] === '"' ? st : it) : r === st || r === it ? r = H : r === et || r === tt ? r = te : (r = H, s = void 0);
|
|
873
|
+
const m = r === H && n[l + 1].startsWith("/>") ? " " : "";
|
|
874
|
+
o += r === te ? a + Xt : d >= 0 ? (i.push(c), a.slice(0, d) + wt + a.slice(d) + U + m) : a + U + (d === -2 ? l : m);
|
|
865
875
|
}
|
|
866
|
-
return [Ct(
|
|
876
|
+
return [Ct(n, o + (n[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
|
|
867
877
|
};
|
|
868
878
|
class ae {
|
|
869
879
|
constructor({ strings: e, _$litType$: t }, i) {
|
|
870
|
-
let
|
|
880
|
+
let s;
|
|
871
881
|
this.parts = [];
|
|
872
882
|
let o = 0, r = 0;
|
|
873
883
|
const l = e.length - 1, a = this.parts, [c, p] = Gt(e, t);
|
|
@@ -875,24 +885,24 @@ class ae {
|
|
|
875
885
|
const d = this.el.content.firstChild;
|
|
876
886
|
d.replaceWith(...d.childNodes);
|
|
877
887
|
}
|
|
878
|
-
for (; (
|
|
879
|
-
if (
|
|
880
|
-
if (
|
|
881
|
-
const u = p[r++], m =
|
|
882
|
-
a.push({ type: 1, index: o, name: b[2], strings: m, ctor: b[1] === "." ? Jt : b[1] === "?" ? Qt : b[1] === "@" ? ei : Ee }),
|
|
883
|
-
} else d.startsWith(
|
|
884
|
-
if (kt.test(
|
|
885
|
-
const d =
|
|
888
|
+
for (; (s = N.nextNode()) !== null && a.length < l; ) {
|
|
889
|
+
if (s.nodeType === 1) {
|
|
890
|
+
if (s.hasAttributes()) for (const d of s.getAttributeNames()) if (d.endsWith(wt)) {
|
|
891
|
+
const u = p[r++], m = s.getAttribute(d).split(U), b = /([.?@])?(.*)/.exec(u);
|
|
892
|
+
a.push({ type: 1, index: o, name: b[2], strings: m, ctor: b[1] === "." ? Jt : b[1] === "?" ? Qt : b[1] === "@" ? ei : Ee }), s.removeAttribute(d);
|
|
893
|
+
} else d.startsWith(U) && (a.push({ type: 6, index: o }), s.removeAttribute(d));
|
|
894
|
+
if (kt.test(s.tagName)) {
|
|
895
|
+
const d = s.textContent.split(U), u = d.length - 1;
|
|
886
896
|
if (u > 0) {
|
|
887
|
-
|
|
888
|
-
for (let m = 0; m < u; m++)
|
|
889
|
-
|
|
897
|
+
s.textContent = $e ? $e.emptyScript : "";
|
|
898
|
+
for (let m = 0; m < u; m++) s.append(d[m], oe()), N.nextNode(), a.push({ type: 2, index: ++o });
|
|
899
|
+
s.append(d[u], oe());
|
|
890
900
|
}
|
|
891
901
|
}
|
|
892
|
-
} else if (
|
|
902
|
+
} else if (s.nodeType === 8) if (s.data === $t) a.push({ type: 2, index: o });
|
|
893
903
|
else {
|
|
894
904
|
let d = -1;
|
|
895
|
-
for (; (d =
|
|
905
|
+
for (; (d = s.data.indexOf(U, d + 1)) !== -1; ) a.push({ type: 7, index: o }), d += U.length - 1;
|
|
896
906
|
}
|
|
897
907
|
o++;
|
|
898
908
|
}
|
|
@@ -902,12 +912,12 @@ class ae {
|
|
|
902
912
|
return i.innerHTML = e, i;
|
|
903
913
|
}
|
|
904
914
|
}
|
|
905
|
-
function K(
|
|
915
|
+
function K(n, e, t = n, i) {
|
|
906
916
|
var r, l;
|
|
907
917
|
if (e === V) return e;
|
|
908
|
-
let
|
|
918
|
+
let s = i !== void 0 ? (r = t._$Co) == null ? void 0 : r[i] : t._$Cl;
|
|
909
919
|
const o = re(e) ? void 0 : e._$litDirective$;
|
|
910
|
-
return (
|
|
920
|
+
return (s == null ? void 0 : s.constructor) !== o && ((l = s == null ? void 0 : s._$AO) == null || l.call(s, !1), o === void 0 ? s = void 0 : (s = new o(n), s._$AT(n, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = s : t._$Cl = s), s !== void 0 && (e = K(n, s._$AS(n, e.values), s, i)), e;
|
|
911
921
|
}
|
|
912
922
|
class Zt {
|
|
913
923
|
constructor(e, t) {
|
|
@@ -920,8 +930,8 @@ class Zt {
|
|
|
920
930
|
return this._$AM._$AU;
|
|
921
931
|
}
|
|
922
932
|
u(e) {
|
|
923
|
-
const { el: { content: t }, parts: i } = this._$AD,
|
|
924
|
-
N.currentNode =
|
|
933
|
+
const { el: { content: t }, parts: i } = this._$AD, s = ((e == null ? void 0 : e.creationScope) ?? F).importNode(t, !0);
|
|
934
|
+
N.currentNode = s;
|
|
925
935
|
let o = N.nextNode(), r = 0, l = 0, a = i[0];
|
|
926
936
|
for (; a !== void 0; ) {
|
|
927
937
|
if (r === a.index) {
|
|
@@ -930,7 +940,7 @@ class Zt {
|
|
|
930
940
|
}
|
|
931
941
|
r !== (a == null ? void 0 : a.index) && (o = N.nextNode(), r++);
|
|
932
942
|
}
|
|
933
|
-
return N.currentNode = F,
|
|
943
|
+
return N.currentNode = F, s;
|
|
934
944
|
}
|
|
935
945
|
p(e) {
|
|
936
946
|
let t = 0;
|
|
@@ -942,8 +952,8 @@ class ue {
|
|
|
942
952
|
var e;
|
|
943
953
|
return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
|
|
944
954
|
}
|
|
945
|
-
constructor(e, t, i,
|
|
946
|
-
this.type = 2, this._$AH = f, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options =
|
|
955
|
+
constructor(e, t, i, s) {
|
|
956
|
+
this.type = 2, this._$AH = f, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
|
|
947
957
|
}
|
|
948
958
|
get parentNode() {
|
|
949
959
|
let e = this._$AA.parentNode;
|
|
@@ -970,10 +980,10 @@ class ue {
|
|
|
970
980
|
}
|
|
971
981
|
$(e) {
|
|
972
982
|
var o;
|
|
973
|
-
const { values: t, _$litType$: i } = e,
|
|
974
|
-
if (((o = this._$AH) == null ? void 0 : o._$AD) ===
|
|
983
|
+
const { values: t, _$litType$: i } = e, s = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = ae.createElement(Ct(i.h, i.h[0]), this.options)), i);
|
|
984
|
+
if (((o = this._$AH) == null ? void 0 : o._$AD) === s) this._$AH.p(t);
|
|
975
985
|
else {
|
|
976
|
-
const r = new Zt(
|
|
986
|
+
const r = new Zt(s, this), l = r.u(this.options);
|
|
977
987
|
r.p(t), this.T(l), this._$AH = r;
|
|
978
988
|
}
|
|
979
989
|
}
|
|
@@ -984,15 +994,15 @@ class ue {
|
|
|
984
994
|
k(e) {
|
|
985
995
|
He(this._$AH) || (this._$AH = [], this._$AR());
|
|
986
996
|
const t = this._$AH;
|
|
987
|
-
let i,
|
|
988
|
-
for (const o of e)
|
|
989
|
-
|
|
997
|
+
let i, s = 0;
|
|
998
|
+
for (const o of e) s === t.length ? t.push(i = new ue(this.O(oe()), this.O(oe()), this, this.options)) : i = t[s], i._$AI(o), s++;
|
|
999
|
+
s < t.length && (this._$AR(i && i._$AB.nextSibling, s), t.length = s);
|
|
990
1000
|
}
|
|
991
1001
|
_$AR(e = this._$AA.nextSibling, t) {
|
|
992
1002
|
var i;
|
|
993
1003
|
for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, t); e !== this._$AB; ) {
|
|
994
|
-
const
|
|
995
|
-
Je(e).remove(), e =
|
|
1004
|
+
const s = Je(e).nextSibling;
|
|
1005
|
+
Je(e).remove(), e = s;
|
|
996
1006
|
}
|
|
997
1007
|
}
|
|
998
1008
|
setConnected(e) {
|
|
@@ -1007,10 +1017,10 @@ class Ee {
|
|
|
1007
1017
|
get _$AU() {
|
|
1008
1018
|
return this._$AM._$AU;
|
|
1009
1019
|
}
|
|
1010
|
-
constructor(e, t, i,
|
|
1011
|
-
this.type = 1, this._$AH = f, this._$AN = void 0, this.element = e, this.name = t, this._$AM =
|
|
1020
|
+
constructor(e, t, i, s, o) {
|
|
1021
|
+
this.type = 1, this._$AH = f, this._$AN = void 0, this.element = e, this.name = t, this._$AM = s, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = f;
|
|
1012
1022
|
}
|
|
1013
|
-
_$AI(e, t = this, i,
|
|
1023
|
+
_$AI(e, t = this, i, s) {
|
|
1014
1024
|
const o = this.strings;
|
|
1015
1025
|
let r = !1;
|
|
1016
1026
|
if (o === void 0) e = K(this, e, t, 0), r = !re(e) || e !== this._$AH && e !== V, r && (this._$AH = e);
|
|
@@ -1019,7 +1029,7 @@ class Ee {
|
|
|
1019
1029
|
let a, c;
|
|
1020
1030
|
for (e = o[0], a = 0; a < o.length - 1; a++) c = K(this, l[i + a], t, a), c === V && (c = this._$AH[a]), r || (r = !re(c) || c !== this._$AH[a]), c === f ? e = f : e !== f && (e += (c ?? "") + o[a + 1]), this._$AH[a] = c;
|
|
1021
1031
|
}
|
|
1022
|
-
r && !
|
|
1032
|
+
r && !s && this.j(e);
|
|
1023
1033
|
}
|
|
1024
1034
|
j(e) {
|
|
1025
1035
|
e === f ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
@@ -1042,13 +1052,13 @@ class Qt extends Ee {
|
|
|
1042
1052
|
}
|
|
1043
1053
|
}
|
|
1044
1054
|
class ei extends Ee {
|
|
1045
|
-
constructor(e, t, i,
|
|
1046
|
-
super(e, t, i,
|
|
1055
|
+
constructor(e, t, i, s, o) {
|
|
1056
|
+
super(e, t, i, s, o), this.type = 5;
|
|
1047
1057
|
}
|
|
1048
1058
|
_$AI(e, t = this) {
|
|
1049
1059
|
if ((e = K(this, e, t, 0) ?? f) === V) return;
|
|
1050
|
-
const i = this._$AH,
|
|
1051
|
-
|
|
1060
|
+
const i = this._$AH, s = e === f && i !== f || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, o = e !== f && (i === f || s);
|
|
1061
|
+
s && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
1052
1062
|
}
|
|
1053
1063
|
handleEvent(e) {
|
|
1054
1064
|
var t;
|
|
@@ -1068,14 +1078,14 @@ class ti {
|
|
|
1068
1078
|
}
|
|
1069
1079
|
const Pe = se.litHtmlPolyfillSupport;
|
|
1070
1080
|
Pe == null || Pe(ae, ue), (se.litHtmlVersions ?? (se.litHtmlVersions = [])).push("3.3.2");
|
|
1071
|
-
const ii = (
|
|
1081
|
+
const ii = (n, e, t) => {
|
|
1072
1082
|
const i = (t == null ? void 0 : t.renderBefore) ?? e;
|
|
1073
|
-
let
|
|
1074
|
-
if (
|
|
1083
|
+
let s = i._$litPart$;
|
|
1084
|
+
if (s === void 0) {
|
|
1075
1085
|
const o = (t == null ? void 0 : t.renderBefore) ?? null;
|
|
1076
|
-
i._$litPart$ =
|
|
1086
|
+
i._$litPart$ = s = new ue(e.insertBefore(oe(), o), o, void 0, t ?? {});
|
|
1077
1087
|
}
|
|
1078
|
-
return
|
|
1088
|
+
return s._$AI(n), s;
|
|
1079
1089
|
};
|
|
1080
1090
|
/**
|
|
1081
1091
|
* @license
|
|
@@ -1118,56 +1128,56 @@ Ae == null || Ae({ LitElement: T });
|
|
|
1118
1128
|
* Copyright 2017 Google LLC
|
|
1119
1129
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1120
1130
|
*/
|
|
1121
|
-
const R = (
|
|
1131
|
+
const R = (n) => (e, t) => {
|
|
1122
1132
|
t !== void 0 ? t.addInitializer(() => {
|
|
1123
|
-
customElements.define(
|
|
1124
|
-
}) : customElements.define(
|
|
1133
|
+
customElements.define(n, e);
|
|
1134
|
+
}) : customElements.define(n, e);
|
|
1125
1135
|
};
|
|
1126
1136
|
/**
|
|
1127
1137
|
* @license
|
|
1128
1138
|
* Copyright 2017 Google LLC
|
|
1129
1139
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1130
1140
|
*/
|
|
1131
|
-
const si = { attribute: !0, type: String, converter: we, reflect: !1, hasChanged: De }, ni = (
|
|
1132
|
-
const { kind: i, metadata:
|
|
1133
|
-
let o = globalThis.litPropertyMetadata.get(
|
|
1134
|
-
if (o === void 0 && globalThis.litPropertyMetadata.set(
|
|
1141
|
+
const si = { attribute: !0, type: String, converter: we, reflect: !1, hasChanged: De }, ni = (n = si, e, t) => {
|
|
1142
|
+
const { kind: i, metadata: s } = t;
|
|
1143
|
+
let o = globalThis.litPropertyMetadata.get(s);
|
|
1144
|
+
if (o === void 0 && globalThis.litPropertyMetadata.set(s, o = /* @__PURE__ */ new Map()), i === "setter" && ((n = Object.create(n)).wrapped = !0), o.set(t.name, n), i === "accessor") {
|
|
1135
1145
|
const { name: r } = t;
|
|
1136
1146
|
return { set(l) {
|
|
1137
1147
|
const a = e.get.call(this);
|
|
1138
|
-
e.set.call(this, l), this.requestUpdate(r, a,
|
|
1148
|
+
e.set.call(this, l), this.requestUpdate(r, a, n, !0, l);
|
|
1139
1149
|
}, init(l) {
|
|
1140
|
-
return l !== void 0 && this.C(r, void 0,
|
|
1150
|
+
return l !== void 0 && this.C(r, void 0, n, l), l;
|
|
1141
1151
|
} };
|
|
1142
1152
|
}
|
|
1143
1153
|
if (i === "setter") {
|
|
1144
1154
|
const { name: r } = t;
|
|
1145
1155
|
return function(l) {
|
|
1146
1156
|
const a = this[r];
|
|
1147
|
-
e.call(this, l), this.requestUpdate(r, a,
|
|
1157
|
+
e.call(this, l), this.requestUpdate(r, a, n, !0, l);
|
|
1148
1158
|
};
|
|
1149
1159
|
}
|
|
1150
1160
|
throw Error("Unsupported decorator location: " + i);
|
|
1151
1161
|
};
|
|
1152
|
-
function g(
|
|
1153
|
-
return (e, t) => typeof t == "object" ? ni(
|
|
1154
|
-
const r =
|
|
1155
|
-
return
|
|
1156
|
-
})(
|
|
1162
|
+
function g(n) {
|
|
1163
|
+
return (e, t) => typeof t == "object" ? ni(n, e, t) : ((i, s, o) => {
|
|
1164
|
+
const r = s.hasOwnProperty(o);
|
|
1165
|
+
return s.constructor.createProperty(o, i), r ? Object.getOwnPropertyDescriptor(s, o) : void 0;
|
|
1166
|
+
})(n, e, t);
|
|
1157
1167
|
}
|
|
1158
1168
|
/**
|
|
1159
1169
|
* @license
|
|
1160
1170
|
* Copyright 2017 Google LLC
|
|
1161
1171
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1162
1172
|
*/
|
|
1163
|
-
function v(
|
|
1164
|
-
return g({ ...
|
|
1173
|
+
function v(n) {
|
|
1174
|
+
return g({ ...n, state: !0, attribute: !1 });
|
|
1165
1175
|
}
|
|
1166
1176
|
const Z = "pulse-client";
|
|
1167
|
-
var oi = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, J = (
|
|
1168
|
-
for (var
|
|
1169
|
-
(r =
|
|
1170
|
-
return i &&
|
|
1177
|
+
var oi = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, J = (n, e, t, i) => {
|
|
1178
|
+
for (var s = i > 1 ? void 0 : i ? ri(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
1179
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
1180
|
+
return i && s && oi(e, t, s), s;
|
|
1171
1181
|
};
|
|
1172
1182
|
let q = class extends T {
|
|
1173
1183
|
constructor() {
|
|
@@ -1175,17 +1185,17 @@ let q = class extends T {
|
|
|
1175
1185
|
}
|
|
1176
1186
|
connectedCallback() {
|
|
1177
1187
|
super.connectedCallback();
|
|
1178
|
-
const
|
|
1188
|
+
const n = {
|
|
1179
1189
|
apiKey: this.apiKey,
|
|
1180
1190
|
token: this.token,
|
|
1181
1191
|
room: this.room,
|
|
1182
1192
|
endpoint: this.endpoint
|
|
1183
1193
|
};
|
|
1184
|
-
this.client = new xt(
|
|
1194
|
+
this.client = new xt(n), this.client.connect();
|
|
1185
1195
|
}
|
|
1186
1196
|
disconnectedCallback() {
|
|
1187
|
-
var
|
|
1188
|
-
super.disconnectedCallback(), (
|
|
1197
|
+
var n;
|
|
1198
|
+
super.disconnectedCallback(), (n = this.client) == null || n.disconnect();
|
|
1189
1199
|
}
|
|
1190
1200
|
render() {
|
|
1191
1201
|
return h`<slot></slot>`;
|
|
@@ -1209,10 +1219,10 @@ J([
|
|
|
1209
1219
|
q = J([
|
|
1210
1220
|
R("pulse-provider")
|
|
1211
1221
|
], q);
|
|
1212
|
-
var ai = Object.defineProperty, li = Object.getOwnPropertyDescriptor, Ce = (
|
|
1213
|
-
for (var
|
|
1214
|
-
(r =
|
|
1215
|
-
return i &&
|
|
1222
|
+
var ai = Object.defineProperty, li = Object.getOwnPropertyDescriptor, Ce = (n, e, t, i) => {
|
|
1223
|
+
for (var s = i > 1 ? void 0 : i ? li(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
1224
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
1225
|
+
return i && s && ai(e, t, s), s;
|
|
1216
1226
|
};
|
|
1217
1227
|
let G = class extends T {
|
|
1218
1228
|
constructor() {
|
|
@@ -1222,27 +1232,27 @@ let G = class extends T {
|
|
|
1222
1232
|
super.connectedCallback(), this.setupListener();
|
|
1223
1233
|
}
|
|
1224
1234
|
disconnectedCallback() {
|
|
1225
|
-
var
|
|
1226
|
-
super.disconnectedCallback(), (
|
|
1235
|
+
var n;
|
|
1236
|
+
super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
|
|
1227
1237
|
}
|
|
1228
|
-
updated(
|
|
1238
|
+
updated(n) {
|
|
1229
1239
|
var e;
|
|
1230
|
-
|
|
1240
|
+
n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
|
|
1231
1241
|
}
|
|
1232
1242
|
setupListener() {
|
|
1233
|
-
this.client && (this.users = this.client.state.presence, this.unsub = this.client.state.on("presence", (
|
|
1234
|
-
this.users =
|
|
1243
|
+
this.client && (this.users = this.client.state.presence, this.unsub = this.client.state.on("presence", (n) => {
|
|
1244
|
+
this.users = n;
|
|
1235
1245
|
}));
|
|
1236
1246
|
}
|
|
1237
|
-
getInitials(
|
|
1238
|
-
return
|
|
1247
|
+
getInitials(n) {
|
|
1248
|
+
return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
1239
1249
|
}
|
|
1240
1250
|
render() {
|
|
1241
|
-
const
|
|
1251
|
+
const n = this.users.slice(0, this.maxVisible), e = this.users.length - this.maxVisible;
|
|
1242
1252
|
return h`
|
|
1243
1253
|
<div class="avatars">
|
|
1244
1254
|
${e > 0 ? h`<div class="overflow">+${e}</div>` : null}
|
|
1245
|
-
${
|
|
1255
|
+
${n.map(
|
|
1246
1256
|
(t) => h`
|
|
1247
1257
|
<div
|
|
1248
1258
|
class="avatar"
|
|
@@ -1375,20 +1385,20 @@ Ce([
|
|
|
1375
1385
|
G = Ce([
|
|
1376
1386
|
R("pulse-presence")
|
|
1377
1387
|
], G);
|
|
1378
|
-
var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, Ne = (
|
|
1379
|
-
for (var
|
|
1380
|
-
(r =
|
|
1381
|
-
return i &&
|
|
1388
|
+
var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, Ne = (n, e, t, i) => {
|
|
1389
|
+
for (var s = i > 1 ? void 0 : i ? di(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
1390
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
1391
|
+
return i && s && ci(e, t, s), s;
|
|
1382
1392
|
};
|
|
1383
1393
|
let le = class extends T {
|
|
1384
1394
|
constructor() {
|
|
1385
|
-
super(...arguments), this.cursors = /* @__PURE__ */ new Map(), this.unsubs = [], this.handleLocalCursor = (
|
|
1395
|
+
super(...arguments), this.cursors = /* @__PURE__ */ new Map(), this.unsubs = [], this.handleLocalCursor = (n) => {
|
|
1386
1396
|
var e;
|
|
1387
1397
|
(e = this.client) == null || e.moveCursor({
|
|
1388
|
-
x:
|
|
1389
|
-
y:
|
|
1390
|
-
pageX:
|
|
1391
|
-
pageY:
|
|
1398
|
+
x: n.clientX,
|
|
1399
|
+
y: n.clientY,
|
|
1400
|
+
pageX: n.pageX,
|
|
1401
|
+
pageY: n.pageY
|
|
1392
1402
|
});
|
|
1393
1403
|
};
|
|
1394
1404
|
}
|
|
@@ -1396,25 +1406,25 @@ let le = class extends T {
|
|
|
1396
1406
|
super.connectedCallback(), this.setupListeners();
|
|
1397
1407
|
}
|
|
1398
1408
|
disconnectedCallback() {
|
|
1399
|
-
super.disconnectedCallback(), this.unsubs.forEach((
|
|
1409
|
+
super.disconnectedCallback(), this.unsubs.forEach((n) => n()), this.unsubs = [], document.removeEventListener("mousemove", this.handleLocalCursor);
|
|
1400
1410
|
}
|
|
1401
|
-
updated(
|
|
1402
|
-
|
|
1411
|
+
updated(n) {
|
|
1412
|
+
n.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
|
|
1403
1413
|
}
|
|
1404
1414
|
setupListeners() {
|
|
1405
1415
|
this.client && (this.unsubs.push(
|
|
1406
1416
|
this.client.state.on(
|
|
1407
1417
|
"cursor",
|
|
1408
|
-
({ userId:
|
|
1409
|
-
const t = this.cursors.get(
|
|
1418
|
+
({ userId: n, position: e }) => {
|
|
1419
|
+
const t = this.cursors.get(n);
|
|
1410
1420
|
if (t)
|
|
1411
1421
|
t.position = e;
|
|
1412
1422
|
else {
|
|
1413
1423
|
const i = this.client.state.presence.find(
|
|
1414
|
-
(
|
|
1424
|
+
(s) => s.user.id === n
|
|
1415
1425
|
);
|
|
1416
|
-
i && this.cursors.set(
|
|
1417
|
-
userId:
|
|
1426
|
+
i && this.cursors.set(n, {
|
|
1427
|
+
userId: n,
|
|
1418
1428
|
name: i.user.name,
|
|
1419
1429
|
color: i.user.color,
|
|
1420
1430
|
position: e
|
|
@@ -1424,8 +1434,8 @@ let le = class extends T {
|
|
|
1424
1434
|
}
|
|
1425
1435
|
)
|
|
1426
1436
|
), this.unsubs.push(
|
|
1427
|
-
this.client.state.on("presence", (
|
|
1428
|
-
const e = new Set(
|
|
1437
|
+
this.client.state.on("presence", (n) => {
|
|
1438
|
+
const e = new Set(n.map((t) => t.user.id));
|
|
1429
1439
|
for (const t of this.cursors.keys())
|
|
1430
1440
|
e.has(t) || this.cursors.delete(t);
|
|
1431
1441
|
this.requestUpdate();
|
|
@@ -1433,9 +1443,9 @@ let le = class extends T {
|
|
|
1433
1443
|
), document.addEventListener("mousemove", this.handleLocalCursor));
|
|
1434
1444
|
}
|
|
1435
1445
|
render() {
|
|
1436
|
-
const
|
|
1446
|
+
const n = [...this.cursors.values()];
|
|
1437
1447
|
return h`
|
|
1438
|
-
${
|
|
1448
|
+
${n.map(
|
|
1439
1449
|
(e) => h`
|
|
1440
1450
|
<div
|
|
1441
1451
|
class="cursor"
|
|
@@ -1504,10 +1514,10 @@ Ne([
|
|
|
1504
1514
|
le = Ne([
|
|
1505
1515
|
R("pulse-cursors")
|
|
1506
1516
|
], le);
|
|
1507
|
-
var hi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fe = (
|
|
1508
|
-
for (var
|
|
1509
|
-
(r =
|
|
1510
|
-
return i &&
|
|
1517
|
+
var hi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fe = (n, e, t, i) => {
|
|
1518
|
+
for (var s = i > 1 ? void 0 : i ? pi(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
1519
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
1520
|
+
return i && s && hi(e, t, s), s;
|
|
1511
1521
|
};
|
|
1512
1522
|
let W = class extends T {
|
|
1513
1523
|
constructor() {
|
|
@@ -1517,52 +1527,52 @@ let W = class extends T {
|
|
|
1517
1527
|
super.connectedCallback(), this.setupListener();
|
|
1518
1528
|
}
|
|
1519
1529
|
disconnectedCallback() {
|
|
1520
|
-
var
|
|
1521
|
-
super.disconnectedCallback(), (
|
|
1530
|
+
var n;
|
|
1531
|
+
super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
|
|
1522
1532
|
}
|
|
1523
|
-
updated(
|
|
1533
|
+
updated(n) {
|
|
1524
1534
|
var e;
|
|
1525
|
-
|
|
1535
|
+
n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
|
|
1526
1536
|
}
|
|
1527
1537
|
setupListener() {
|
|
1528
|
-
this.client && (this.threads = this.client.state.threads, this.unsub = this.client.state.on("threads", (
|
|
1529
|
-
this.threads = [...
|
|
1538
|
+
this.client && (this.threads = this.client.state.threads, this.unsub = this.client.state.on("threads", (n) => {
|
|
1539
|
+
this.threads = [...n];
|
|
1530
1540
|
}));
|
|
1531
1541
|
}
|
|
1532
|
-
parseMentions(
|
|
1533
|
-
return
|
|
1542
|
+
parseMentions(n) {
|
|
1543
|
+
return n.split(/(@\w+)/g).map(
|
|
1534
1544
|
(t) => t.startsWith("@") ? h`<span class="mention">${t}</span>` : t
|
|
1535
1545
|
);
|
|
1536
1546
|
}
|
|
1537
|
-
getInitials(
|
|
1538
|
-
return
|
|
1547
|
+
getInitials(n) {
|
|
1548
|
+
return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
1539
1549
|
}
|
|
1540
|
-
getUserForComment(
|
|
1550
|
+
getUserForComment(n) {
|
|
1541
1551
|
var e;
|
|
1542
|
-
return (e = this.client.state.presence.find((t) => t.user.id ===
|
|
1552
|
+
return (e = this.client.state.presence.find((t) => t.user.id === n)) == null ? void 0 : e.user;
|
|
1543
1553
|
}
|
|
1544
|
-
handleNewThread(
|
|
1545
|
-
|
|
1546
|
-
const t =
|
|
1554
|
+
handleNewThread(n) {
|
|
1555
|
+
n.preventDefault();
|
|
1556
|
+
const t = n.target.querySelector("textarea"), i = t.value.trim();
|
|
1547
1557
|
if (!i) return;
|
|
1548
|
-
const
|
|
1549
|
-
this.client.createThread(i, { mentions:
|
|
1558
|
+
const s = [...i.matchAll(/@(\w+)/g)].map((o) => o[1]);
|
|
1559
|
+
this.client.createThread(i, { mentions: s }), t.value = "";
|
|
1550
1560
|
}
|
|
1551
|
-
handleReply(
|
|
1561
|
+
handleReply(n, e) {
|
|
1552
1562
|
e.preventDefault();
|
|
1553
|
-
const i = e.target.querySelector("input"),
|
|
1554
|
-
if (!
|
|
1555
|
-
const o = [...
|
|
1556
|
-
this.client.reply(
|
|
1563
|
+
const i = e.target.querySelector("input"), s = i.value.trim();
|
|
1564
|
+
if (!s) return;
|
|
1565
|
+
const o = [...s.matchAll(/@(\w+)/g)].map((r) => r[1]);
|
|
1566
|
+
this.client.reply(n, s, o), i.value = "", this.replyingTo = null;
|
|
1557
1567
|
}
|
|
1558
1568
|
render() {
|
|
1559
|
-
const
|
|
1569
|
+
const n = this.showResolved ? this.threads : this.threads.filter((e) => !e.resolved);
|
|
1560
1570
|
return h`
|
|
1561
1571
|
<div class="threads">
|
|
1562
|
-
${
|
|
1572
|
+
${n.length === 0 ? h`<div class="empty">
|
|
1563
1573
|
<div class="empty-icon">💬</div>
|
|
1564
1574
|
No comments yet.<br>Start a conversation below.
|
|
1565
|
-
</div>` :
|
|
1575
|
+
</div>` : n.map((e) => this.renderThread(e))}
|
|
1566
1576
|
</div>
|
|
1567
1577
|
<div class="new-thread">
|
|
1568
1578
|
<form @submit=${this.handleNewThread}>
|
|
@@ -1572,10 +1582,10 @@ let W = class extends T {
|
|
|
1572
1582
|
</div>
|
|
1573
1583
|
`;
|
|
1574
1584
|
}
|
|
1575
|
-
renderThread(
|
|
1585
|
+
renderThread(n) {
|
|
1576
1586
|
return h`
|
|
1577
|
-
<div class="thread ${
|
|
1578
|
-
${
|
|
1587
|
+
<div class="thread ${n.resolved ? "resolved" : ""}">
|
|
1588
|
+
${n.comments.map((e, t) => {
|
|
1579
1589
|
const i = this.getUserForComment(e.userId);
|
|
1580
1590
|
return h`
|
|
1581
1591
|
${t > 0 ? h`<div class="divider"></div>` : f}
|
|
@@ -1600,18 +1610,18 @@ let W = class extends T {
|
|
|
1600
1610
|
})}
|
|
1601
1611
|
<div class="thread-actions">
|
|
1602
1612
|
<button
|
|
1603
|
-
@click=${() => this.replyingTo = this.replyingTo ===
|
|
1613
|
+
@click=${() => this.replyingTo = this.replyingTo === n.id ? null : n.id}
|
|
1604
1614
|
>
|
|
1605
1615
|
Reply
|
|
1606
1616
|
</button>
|
|
1607
1617
|
<button
|
|
1608
|
-
@click=${() => this.client.resolveThread(
|
|
1618
|
+
@click=${() => this.client.resolveThread(n.id, !n.resolved)}
|
|
1609
1619
|
>
|
|
1610
|
-
${
|
|
1620
|
+
${n.resolved ? "Reopen" : "Resolve"}
|
|
1611
1621
|
</button>
|
|
1612
1622
|
</div>
|
|
1613
|
-
${this.replyingTo ===
|
|
1614
|
-
<form class="reply-form" @submit=${(e) => this.handleReply(
|
|
1623
|
+
${this.replyingTo === n.id ? h`
|
|
1624
|
+
<form class="reply-form" @submit=${(e) => this.handleReply(n.id, e)}>
|
|
1615
1625
|
<input type="text" placeholder="Write a reply..." />
|
|
1616
1626
|
<button type="submit">Send</button>
|
|
1617
1627
|
</form>
|
|
@@ -1619,11 +1629,11 @@ let W = class extends T {
|
|
|
1619
1629
|
</div>
|
|
1620
1630
|
`;
|
|
1621
1631
|
}
|
|
1622
|
-
formatTime(
|
|
1623
|
-
const e = new Date(
|
|
1624
|
-
if (
|
|
1625
|
-
if (
|
|
1626
|
-
const o = Math.floor(
|
|
1632
|
+
formatTime(n) {
|
|
1633
|
+
const e = new Date(n), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(i / 6e4);
|
|
1634
|
+
if (s < 1) return "just now";
|
|
1635
|
+
if (s < 60) return `${s}m ago`;
|
|
1636
|
+
const o = Math.floor(s / 60);
|
|
1627
1637
|
return o < 24 ? `${o}h ago` : e.toLocaleDateString();
|
|
1628
1638
|
}
|
|
1629
1639
|
};
|
|
@@ -1855,10 +1865,10 @@ fe([
|
|
|
1855
1865
|
W = fe([
|
|
1856
1866
|
R("pulse-comments")
|
|
1857
1867
|
], W);
|
|
1858
|
-
var ui = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, Be = (
|
|
1859
|
-
for (var
|
|
1860
|
-
(r =
|
|
1861
|
-
return i &&
|
|
1868
|
+
var ui = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, Be = (n, e, t, i) => {
|
|
1869
|
+
for (var s = i > 1 ? void 0 : i ? fi(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
1870
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
1871
|
+
return i && s && ui(e, t, s), s;
|
|
1862
1872
|
};
|
|
1863
1873
|
const mi = {
|
|
1864
1874
|
"comment:created": "left a comment",
|
|
@@ -1881,52 +1891,52 @@ let ce = class extends T {
|
|
|
1881
1891
|
super.connectedCallback(), this.setupListener();
|
|
1882
1892
|
}
|
|
1883
1893
|
disconnectedCallback() {
|
|
1884
|
-
var
|
|
1885
|
-
super.disconnectedCallback(), (
|
|
1894
|
+
var n;
|
|
1895
|
+
super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
|
|
1886
1896
|
}
|
|
1887
|
-
updated(
|
|
1897
|
+
updated(n) {
|
|
1888
1898
|
var e;
|
|
1889
|
-
|
|
1899
|
+
n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
|
|
1890
1900
|
}
|
|
1891
1901
|
setupListener() {
|
|
1892
1902
|
this.client && (this.notifications = this.client.state.notifications, this.unsub = this.client.state.on(
|
|
1893
1903
|
"notifications",
|
|
1894
|
-
(
|
|
1895
|
-
this.notifications = [...
|
|
1904
|
+
(n) => {
|
|
1905
|
+
this.notifications = [...n];
|
|
1896
1906
|
}
|
|
1897
1907
|
));
|
|
1898
1908
|
}
|
|
1899
|
-
handleClick(
|
|
1900
|
-
|
|
1909
|
+
handleClick(n) {
|
|
1910
|
+
n.read || this.client.markRead(n.id), this.dispatchEvent(
|
|
1901
1911
|
new CustomEvent("pulse-notification-click", {
|
|
1902
|
-
detail:
|
|
1912
|
+
detail: n,
|
|
1903
1913
|
bubbles: !0,
|
|
1904
1914
|
composed: !0
|
|
1905
1915
|
})
|
|
1906
1916
|
);
|
|
1907
1917
|
}
|
|
1908
|
-
getActorName(
|
|
1918
|
+
getActorName(n) {
|
|
1909
1919
|
const e = this.client.state.presence.find(
|
|
1910
|
-
(t) => t.user.id ===
|
|
1920
|
+
(t) => t.user.id === n
|
|
1911
1921
|
);
|
|
1912
1922
|
return (e == null ? void 0 : e.user.name) ?? "Someone";
|
|
1913
1923
|
}
|
|
1914
|
-
formatTime(
|
|
1915
|
-
const e = new Date(
|
|
1916
|
-
if (
|
|
1917
|
-
if (
|
|
1918
|
-
const o = Math.floor(
|
|
1924
|
+
formatTime(n) {
|
|
1925
|
+
const e = new Date(n), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(i / 6e4);
|
|
1926
|
+
if (s < 1) return "just now";
|
|
1927
|
+
if (s < 60) return `${s}m ago`;
|
|
1928
|
+
const o = Math.floor(s / 60);
|
|
1919
1929
|
return o < 24 ? `${o}h ago` : e.toLocaleDateString();
|
|
1920
1930
|
}
|
|
1921
1931
|
render() {
|
|
1922
|
-
const
|
|
1932
|
+
const n = this.notifications.filter((e) => !e.read).length;
|
|
1923
1933
|
return h`
|
|
1924
1934
|
<div class="header">
|
|
1925
1935
|
<span class="title">
|
|
1926
1936
|
Notifications
|
|
1927
|
-
${
|
|
1937
|
+
${n > 0 ? h`<span class="badge">${n}</span>` : f}
|
|
1928
1938
|
</span>
|
|
1929
|
-
${
|
|
1939
|
+
${n > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
|
|
1930
1940
|
Mark all read
|
|
1931
1941
|
</button>` : f}
|
|
1932
1942
|
</div>
|
|
@@ -2107,10 +2117,10 @@ Be([
|
|
|
2107
2117
|
ce = Be([
|
|
2108
2118
|
R("pulse-notifications")
|
|
2109
2119
|
], ce);
|
|
2110
|
-
var bi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Q = (
|
|
2111
|
-
for (var
|
|
2112
|
-
(r =
|
|
2113
|
-
return i &&
|
|
2120
|
+
var bi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Q = (n, e, t, i) => {
|
|
2121
|
+
for (var s = i > 1 ? void 0 : i ? vi(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
2122
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
2123
|
+
return i && s && bi(e, t, s), s;
|
|
2114
2124
|
};
|
|
2115
2125
|
const xi = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
|
|
2116
2126
|
let D = class extends T {
|
|
@@ -2121,40 +2131,40 @@ let D = class extends T {
|
|
|
2121
2131
|
super.connectedCallback(), this.setupListener();
|
|
2122
2132
|
}
|
|
2123
2133
|
disconnectedCallback() {
|
|
2124
|
-
var
|
|
2125
|
-
super.disconnectedCallback(), (
|
|
2134
|
+
var n;
|
|
2135
|
+
super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
|
|
2126
2136
|
}
|
|
2127
|
-
updated(
|
|
2137
|
+
updated(n) {
|
|
2128
2138
|
var e;
|
|
2129
|
-
|
|
2139
|
+
n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
|
|
2130
2140
|
}
|
|
2131
2141
|
setupListener() {
|
|
2132
|
-
this.client && (this.reactions = this.client.state.getReactions(this.targetId), this.unsub = this.client.state.on("reactions", (
|
|
2133
|
-
|
|
2142
|
+
this.client && (this.reactions = this.client.state.getReactions(this.targetId), this.unsub = this.client.state.on("reactions", (n) => {
|
|
2143
|
+
n.targetId === this.targetId && (this.reactions = [...n.reactions]);
|
|
2134
2144
|
}));
|
|
2135
2145
|
}
|
|
2136
2146
|
groupReactions() {
|
|
2137
2147
|
var t, i;
|
|
2138
|
-
const
|
|
2139
|
-
for (const
|
|
2140
|
-
const o =
|
|
2141
|
-
o.count++,
|
|
2148
|
+
const n = /* @__PURE__ */ new Map(), e = (i = (t = this.client) == null ? void 0 : t.state.user) == null ? void 0 : i.id;
|
|
2149
|
+
for (const s of this.reactions) {
|
|
2150
|
+
const o = n.get(s.emoji) ?? { count: 0, userReactionId: null };
|
|
2151
|
+
o.count++, s.userId === e && (o.userReactionId = s.id), n.set(s.emoji, o);
|
|
2142
2152
|
}
|
|
2143
|
-
return [...
|
|
2144
|
-
emoji:
|
|
2153
|
+
return [...n.entries()].map(([s, o]) => ({
|
|
2154
|
+
emoji: s,
|
|
2145
2155
|
...o
|
|
2146
2156
|
}));
|
|
2147
2157
|
}
|
|
2148
|
-
toggleReaction(
|
|
2149
|
-
|
|
2158
|
+
toggleReaction(n) {
|
|
2159
|
+
n.userReactionId ? this.client.removeReaction(n.userReactionId) : this.client.addReaction(this.targetId, this.targetType, n.emoji);
|
|
2150
2160
|
}
|
|
2151
|
-
addEmoji(
|
|
2152
|
-
this.client.addReaction(this.targetId, this.targetType,
|
|
2161
|
+
addEmoji(n) {
|
|
2162
|
+
this.client.addReaction(this.targetId, this.targetType, n), this.showPicker = !1;
|
|
2153
2163
|
}
|
|
2154
2164
|
render() {
|
|
2155
|
-
const
|
|
2165
|
+
const n = this.groupReactions();
|
|
2156
2166
|
return h`
|
|
2157
|
-
${
|
|
2167
|
+
${n.map(
|
|
2158
2168
|
(e) => h`
|
|
2159
2169
|
<button
|
|
2160
2170
|
class="reaction ${e.userReactionId ? "active" : ""}"
|
|
@@ -2323,7 +2333,7 @@ D = Q([
|
|
|
2323
2333
|
* Copyright 2017 Google LLC
|
|
2324
2334
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2325
2335
|
*/
|
|
2326
|
-
const yi = { CHILD: 2 }, wi = (
|
|
2336
|
+
const yi = { CHILD: 2 }, wi = (n) => (...e) => ({ _$litDirective$: n, values: e });
|
|
2327
2337
|
class $i {
|
|
2328
2338
|
constructor(e) {
|
|
2329
2339
|
}
|
|
@@ -2547,13 +2557,13 @@ const Ri = [
|
|
|
2547
2557
|
}
|
|
2548
2558
|
]
|
|
2549
2559
|
];
|
|
2550
|
-
function Li(
|
|
2551
|
-
return
|
|
2552
|
-
const i = Object.entries(t).filter(([,
|
|
2560
|
+
function Li(n) {
|
|
2561
|
+
return n.map(([e, t]) => {
|
|
2562
|
+
const i = Object.entries(t).filter(([, s]) => s != null).map(([s, o]) => `${s}="${o}"`).join(" ");
|
|
2553
2563
|
return `<${e} ${i}/>`;
|
|
2554
2564
|
}).join("");
|
|
2555
2565
|
}
|
|
2556
|
-
function k(
|
|
2566
|
+
function k(n, e = 18) {
|
|
2557
2567
|
return Kt`<svg
|
|
2558
2568
|
xmlns="http://www.w3.org/2000/svg"
|
|
2559
2569
|
width="${e}"
|
|
@@ -2564,7 +2574,7 @@ function k(s, e = 18) {
|
|
|
2564
2574
|
stroke-width="2"
|
|
2565
2575
|
stroke-linecap="round"
|
|
2566
2576
|
stroke-linejoin="round"
|
|
2567
|
-
>${ki(Li(
|
|
2577
|
+
>${ki(Li(n))}</svg>`;
|
|
2568
2578
|
}
|
|
2569
2579
|
const ee = A`
|
|
2570
2580
|
* {
|
|
@@ -2665,10 +2675,10 @@ const ee = A`
|
|
|
2665
2675
|
background: transparent;
|
|
2666
2676
|
}
|
|
2667
2677
|
`;
|
|
2668
|
-
var ji = Object.defineProperty,
|
|
2669
|
-
for (var
|
|
2670
|
-
(r =
|
|
2671
|
-
return i &&
|
|
2678
|
+
var ji = Object.defineProperty, Ui = Object.getOwnPropertyDescriptor, Fe = (n, e, t, i) => {
|
|
2679
|
+
for (var s = i > 1 ? void 0 : i ? Ui(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
2680
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
2681
|
+
return i && s && ji(e, t, s), s;
|
|
2672
2682
|
};
|
|
2673
2683
|
let X = class extends T {
|
|
2674
2684
|
constructor() {
|
|
@@ -2678,36 +2688,36 @@ let X = class extends T {
|
|
|
2678
2688
|
super.connectedCallback(), this.setupListeners();
|
|
2679
2689
|
}
|
|
2680
2690
|
disconnectedCallback() {
|
|
2681
|
-
super.disconnectedCallback(), this.unsubs.forEach((
|
|
2691
|
+
super.disconnectedCallback(), this.unsubs.forEach((n) => n()), this.unsubs = [];
|
|
2682
2692
|
}
|
|
2683
|
-
updated(
|
|
2684
|
-
|
|
2693
|
+
updated(n) {
|
|
2694
|
+
n.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
|
|
2685
2695
|
}
|
|
2686
2696
|
setupListeners() {
|
|
2687
2697
|
if (!this.client) return;
|
|
2688
|
-
const
|
|
2689
|
-
|
|
2698
|
+
const n = this.client.state.activityLogs;
|
|
2699
|
+
n.length > 0 && (this.items = n.map((e) => this.logToItem(e)), this.counter = this.items.length), this.unsubs.push(
|
|
2690
2700
|
this.client.state.on("activity-logs", (e) => {
|
|
2691
2701
|
this.items = e.map((t) => this.logToItem(t));
|
|
2692
2702
|
})
|
|
2693
2703
|
);
|
|
2694
2704
|
}
|
|
2695
|
-
logToItem(
|
|
2705
|
+
logToItem(n) {
|
|
2696
2706
|
return {
|
|
2697
|
-
id:
|
|
2698
|
-
type:
|
|
2699
|
-
userId:
|
|
2700
|
-
description:
|
|
2701
|
-
timestamp: new Date(
|
|
2702
|
-
color: X.TYPE_COLORS[
|
|
2707
|
+
id: n.id,
|
|
2708
|
+
type: n.type,
|
|
2709
|
+
userId: n.userId,
|
|
2710
|
+
description: n.description,
|
|
2711
|
+
timestamp: new Date(n.createdAt).getTime(),
|
|
2712
|
+
color: X.TYPE_COLORS[n.type] ?? "#94a3b8"
|
|
2703
2713
|
};
|
|
2704
2714
|
}
|
|
2705
|
-
getUserName(
|
|
2715
|
+
getUserName(n) {
|
|
2706
2716
|
var e;
|
|
2707
|
-
return ((e = this.client.state.getUser(
|
|
2717
|
+
return ((e = this.client.state.getUser(n)) == null ? void 0 : e.name) ?? "Someone";
|
|
2708
2718
|
}
|
|
2709
|
-
formatRelativeTime(
|
|
2710
|
-
const e = Math.floor((Date.now() -
|
|
2719
|
+
formatRelativeTime(n) {
|
|
2720
|
+
const e = Math.floor((Date.now() - n) / 1e3);
|
|
2711
2721
|
return e < 5 ? "just now" : e < 60 ? `${e}s ago` : e < 3600 ? `${Math.floor(e / 60)}m ago` : `${Math.floor(e / 3600)}h ago`;
|
|
2712
2722
|
}
|
|
2713
2723
|
fireClose() {
|
|
@@ -2727,21 +2737,21 @@ let X = class extends T {
|
|
|
2727
2737
|
|
|
2728
2738
|
<div class="panel-body pw-scrollable">
|
|
2729
2739
|
${this.items.length === 0 ? h`<div class="empty">No activity yet</div>` : this.items.map(
|
|
2730
|
-
(
|
|
2740
|
+
(n) => h`
|
|
2731
2741
|
<div class="activity-item">
|
|
2732
2742
|
<div
|
|
2733
2743
|
class="activity-dot"
|
|
2734
|
-
style="background:${
|
|
2744
|
+
style="background:${n.color}"
|
|
2735
2745
|
></div>
|
|
2736
2746
|
<div class="activity-content">
|
|
2737
2747
|
<div class="activity-text">
|
|
2738
|
-
${
|
|
2739
|
-
>${this.getUserName(
|
|
2748
|
+
${n.userId ? h`<span class="activity-user"
|
|
2749
|
+
>${this.getUserName(n.userId)}</span
|
|
2740
2750
|
>
|
|
2741
|
-
${
|
|
2751
|
+
${n.description}` : n.description}
|
|
2742
2752
|
</div>
|
|
2743
2753
|
<div class="activity-time">
|
|
2744
|
-
${this.formatRelativeTime(
|
|
2754
|
+
${this.formatRelativeTime(n.timestamp)}
|
|
2745
2755
|
</div>
|
|
2746
2756
|
</div>
|
|
2747
2757
|
</div>
|
|
@@ -2890,9 +2900,9 @@ Fe([
|
|
|
2890
2900
|
X = Fe([
|
|
2891
2901
|
R("pulse-widget-activity-panel")
|
|
2892
2902
|
], X);
|
|
2893
|
-
const
|
|
2894
|
-
function lt(
|
|
2895
|
-
const e = Math.max(0, Math.floor(
|
|
2903
|
+
const zi = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", ot = "#6366f1", rt = "#e2e8f0", Di = "#f8fafc", Hi = "#e2e8f0", at = "#64748b", xe = 28, Ni = Array.from({ length: xe }, (n, e) => 0.2 + Math.abs(Math.sin(e * 12.9898 + 78.233) * 43758.5453) % 1 * 0.8);
|
|
2904
|
+
function lt(n) {
|
|
2905
|
+
const e = Math.max(0, Math.floor(n)), t = Math.floor(e / 60), i = e % 60;
|
|
2896
2906
|
return `${t}:${i.toString().padStart(2, "0")}`;
|
|
2897
2907
|
}
|
|
2898
2908
|
class Oe {
|
|
@@ -2905,7 +2915,7 @@ class Oe {
|
|
|
2905
2915
|
* element once metadata has loaded.
|
|
2906
2916
|
*/
|
|
2907
2917
|
static render(e, t) {
|
|
2908
|
-
let i = !1,
|
|
2918
|
+
let i = !1, s = t != null ? t / 1e3 : 0, o = 0;
|
|
2909
2919
|
const r = document.createElement("audio");
|
|
2910
2920
|
r.preload = "metadata", r.src = e;
|
|
2911
2921
|
const l = document.createElement("div");
|
|
@@ -2919,7 +2929,7 @@ class Oe {
|
|
|
2919
2929
|
background: Di,
|
|
2920
2930
|
borderRadius: "12px",
|
|
2921
2931
|
border: `1px solid ${Hi}`,
|
|
2922
|
-
fontFamily:
|
|
2932
|
+
fontFamily: zi,
|
|
2923
2933
|
fontSize: "11px",
|
|
2924
2934
|
color: at,
|
|
2925
2935
|
userSelect: "none",
|
|
@@ -2997,22 +3007,22 @@ class Oe {
|
|
|
2997
3007
|
lineHeight: "1"
|
|
2998
3008
|
});
|
|
2999
3009
|
function C() {
|
|
3000
|
-
const $ = lt(o), P = lt(
|
|
3010
|
+
const $ = lt(o), P = lt(s);
|
|
3001
3011
|
I.textContent = `${$} / ${P}`;
|
|
3002
3012
|
}
|
|
3003
3013
|
C(), u.appendChild(m), u.appendChild(I), l.appendChild(a), l.appendChild(u);
|
|
3004
3014
|
function w() {
|
|
3005
|
-
const $ =
|
|
3015
|
+
const $ = s > 0 ? o / s : 0, P = Math.floor($ * xe);
|
|
3006
3016
|
for (let y = 0; y < xe; y++)
|
|
3007
3017
|
b[y].style.background = y <= P ? ot : rt;
|
|
3008
3018
|
}
|
|
3009
3019
|
return m.addEventListener("click", ($) => {
|
|
3010
|
-
if (
|
|
3020
|
+
if (s <= 0) return;
|
|
3011
3021
|
const P = m.getBoundingClientRect(), y = Math.min(
|
|
3012
3022
|
1,
|
|
3013
3023
|
Math.max(0, ($.clientX - P.left) / P.width)
|
|
3014
3024
|
);
|
|
3015
|
-
r.currentTime = y *
|
|
3025
|
+
r.currentTime = y * s, o = r.currentTime, w(), C();
|
|
3016
3026
|
}), a.addEventListener("click", () => {
|
|
3017
3027
|
i ? r.pause() : r.play().catch(() => {
|
|
3018
3028
|
});
|
|
@@ -3025,9 +3035,9 @@ class Oe {
|
|
|
3025
3035
|
}), r.addEventListener("timeupdate", () => {
|
|
3026
3036
|
o = r.currentTime, w(), C();
|
|
3027
3037
|
}), r.addEventListener("loadedmetadata", () => {
|
|
3028
|
-
r.duration && isFinite(r.duration) && (
|
|
3038
|
+
r.duration && isFinite(r.duration) && (s = r.duration, C());
|
|
3029
3039
|
}), r.addEventListener("durationchange", () => {
|
|
3030
|
-
r.duration && isFinite(r.duration) && (
|
|
3040
|
+
r.duration && isFinite(r.duration) && (s = r.duration, C());
|
|
3031
3041
|
}), l;
|
|
3032
3042
|
}
|
|
3033
3043
|
}
|
|
@@ -3045,8 +3055,8 @@ class Re {
|
|
|
3045
3055
|
this.destroy(), this.stream = await navigator.mediaDevices.getUserMedia({ audio: !0 }), this.audioCtx = new AudioContext();
|
|
3046
3056
|
const t = this.audioCtx.createMediaStreamSource(this.stream);
|
|
3047
3057
|
this.analyser = this.audioCtx.createAnalyser(), this.analyser.fftSize = 64, t.connect(this.analyser);
|
|
3048
|
-
const i = this.detectMimeType(),
|
|
3049
|
-
i && (
|
|
3058
|
+
const i = this.detectMimeType(), s = {};
|
|
3059
|
+
i && (s.mimeType = i), this.recorder = new MediaRecorder(this.stream, s);
|
|
3050
3060
|
const o = [];
|
|
3051
3061
|
this.recorder.ondataavailable = (l) => {
|
|
3052
3062
|
l.data.size > 0 && o.push(l.data);
|
|
@@ -3158,9 +3168,9 @@ class Re {
|
|
|
3158
3168
|
if (!this.canvas || !this.analyser) return;
|
|
3159
3169
|
const e = this.canvas.getContext("2d");
|
|
3160
3170
|
if (!e) return;
|
|
3161
|
-
const t = this.canvas.width, i = this.canvas.height,
|
|
3171
|
+
const t = this.canvas.width, i = this.canvas.height, s = this.analyser.frequencyBinCount, o = new Uint8Array(s);
|
|
3162
3172
|
this.analyser.getByteFrequencyData(o), e.clearRect(0, 0, t, i);
|
|
3163
|
-
const r =
|
|
3173
|
+
const r = s, l = Math.max(2, t / r * 0.7), a = (t - l * r) / (r - 1 || 1);
|
|
3164
3174
|
for (let c = 0; c < r; c++) {
|
|
3165
3175
|
const p = o[c] / 255, d = Math.max(2, p * i * 0.85), u = c * (l + a), m = (i - d) / 2, b = 0.4 + p * 0.6;
|
|
3166
3176
|
e.fillStyle = `rgba(99, 102, 241, ${b})`, e.beginPath(), e.roundRect(u, m, l, d, 1), e.fill();
|
|
@@ -3168,8 +3178,8 @@ class Re {
|
|
|
3168
3178
|
}
|
|
3169
3179
|
updateTimer() {
|
|
3170
3180
|
if (!this.timerEl) return;
|
|
3171
|
-
const e = Date.now() - this.startTime, t = Math.floor(e / 1e3), i = Math.floor(t / 60),
|
|
3172
|
-
this.timerEl.textContent = `${String(i).padStart(2, "0")}:${String(
|
|
3181
|
+
const e = Date.now() - this.startTime, t = Math.floor(e / 1e3), i = Math.floor(t / 60), s = t % 60;
|
|
3182
|
+
this.timerEl.textContent = `${String(i).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
|
|
3173
3183
|
}
|
|
3174
3184
|
cleanupResources() {
|
|
3175
3185
|
if (this.animFrame !== null && (cancelAnimationFrame(this.animFrame), this.animFrame = null), this.maxTimer !== null && (clearTimeout(this.maxTimer), this.maxTimer = null), this.audioCtx && (this.audioCtx.close().catch(() => {
|
|
@@ -3203,7 +3213,7 @@ class Tt {
|
|
|
3203
3213
|
* @param posterUrl - Optional poster/thumbnail image URL
|
|
3204
3214
|
*/
|
|
3205
3215
|
static render(e, t) {
|
|
3206
|
-
let i = !1,
|
|
3216
|
+
let i = !1, s = !0;
|
|
3207
3217
|
const o = document.createElement("div");
|
|
3208
3218
|
Object.assign(o.style, {
|
|
3209
3219
|
position: "relative",
|
|
@@ -3261,13 +3271,13 @@ class Tt {
|
|
|
3261
3271
|
l.style.opacity = i ? "0" : "1";
|
|
3262
3272
|
}
|
|
3263
3273
|
function p() {
|
|
3264
|
-
a.style.display = i ? "flex" : "none", a.innerHTML =
|
|
3274
|
+
a.style.display = i ? "flex" : "none", a.innerHTML = s ? dt : Vi;
|
|
3265
3275
|
}
|
|
3266
3276
|
return o.addEventListener("click", (d) => {
|
|
3267
|
-
d.stopPropagation(), i ?
|
|
3277
|
+
d.stopPropagation(), i ? s ? (r.muted = !1, s = !1) : (r.pause(), i = !1, s = !0, r.muted = !0) : (r.muted = !0, s = !0, r.play().catch(() => {
|
|
3268
3278
|
}), i = !0), c(), p();
|
|
3269
3279
|
}), r.addEventListener("pause", () => {
|
|
3270
|
-
i && (i = !1,
|
|
3280
|
+
i && (i = !1, s = !0, r.muted = !0, c(), p());
|
|
3271
3281
|
}), o;
|
|
3272
3282
|
}
|
|
3273
3283
|
}
|
|
@@ -3378,41 +3388,41 @@ const ht = 60, qi = `
|
|
|
3378
3388
|
color: #0f172a;
|
|
3379
3389
|
}
|
|
3380
3390
|
`;
|
|
3381
|
-
function pt(
|
|
3382
|
-
return
|
|
3391
|
+
function pt(n) {
|
|
3392
|
+
return n.toString().padStart(2, "0");
|
|
3383
3393
|
}
|
|
3384
|
-
function Wi(
|
|
3385
|
-
const e = Math.floor(
|
|
3394
|
+
function Wi(n) {
|
|
3395
|
+
const e = Math.floor(n / 60), t = n % 60;
|
|
3386
3396
|
return `${pt(e)}:${pt(t)}`;
|
|
3387
3397
|
}
|
|
3388
3398
|
function Xi() {
|
|
3389
|
-
const
|
|
3399
|
+
const n = [
|
|
3390
3400
|
"video/webm;codecs=vp9,opus",
|
|
3391
3401
|
"video/webm;codecs=vp8,opus",
|
|
3392
3402
|
"video/webm",
|
|
3393
3403
|
"video/mp4"
|
|
3394
3404
|
];
|
|
3395
|
-
for (const e of
|
|
3405
|
+
for (const e of n)
|
|
3396
3406
|
if (MediaRecorder.isTypeSupported(e)) return e;
|
|
3397
3407
|
return "";
|
|
3398
3408
|
}
|
|
3399
|
-
function Yi(
|
|
3409
|
+
function Yi(n) {
|
|
3400
3410
|
return new Promise((e, t) => {
|
|
3401
|
-
const i = URL.createObjectURL(
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
}),
|
|
3411
|
+
const i = URL.createObjectURL(n), s = document.createElement("video");
|
|
3412
|
+
s.muted = !0, s.playsInline = !0, s.preload = "auto", s.src = i, s.addEventListener("loadeddata", () => {
|
|
3413
|
+
s.currentTime = 0.01;
|
|
3414
|
+
}), s.addEventListener("seeked", () => {
|
|
3405
3415
|
const o = document.createElement("canvas");
|
|
3406
|
-
o.width =
|
|
3416
|
+
o.width = s.videoWidth || 240, o.height = s.videoHeight || 240, o.getContext("2d").drawImage(s, 0, 0, o.width, o.height), URL.revokeObjectURL(i), o.toBlob(
|
|
3407
3417
|
(l) => {
|
|
3408
3418
|
l ? e(l) : t(new Error("Failed to generate poster frame"));
|
|
3409
3419
|
},
|
|
3410
3420
|
"image/jpeg",
|
|
3411
3421
|
0.85
|
|
3412
3422
|
);
|
|
3413
|
-
}),
|
|
3423
|
+
}), s.addEventListener("error", () => {
|
|
3414
3424
|
URL.revokeObjectURL(i), t(new Error("Failed to load video for poster generation"));
|
|
3415
|
-
}),
|
|
3425
|
+
}), s.load();
|
|
3416
3426
|
});
|
|
3417
3427
|
}
|
|
3418
3428
|
class Le {
|
|
@@ -3432,9 +3442,9 @@ class Le {
|
|
|
3432
3442
|
}
|
|
3433
3443
|
this.stream = t, this.container = e, this.recording = !0, this.elapsed = 0, this.chunks = [], this.buildUI(e), this.videoEl && (this.videoEl.srcObject = t, this.videoEl.play().catch(() => {
|
|
3434
3444
|
}));
|
|
3435
|
-
const i = Xi(),
|
|
3436
|
-
i && (
|
|
3437
|
-
const o = new MediaRecorder(t,
|
|
3445
|
+
const i = Xi(), s = {};
|
|
3446
|
+
i && (s.mimeType = i);
|
|
3447
|
+
const o = new MediaRecorder(t, s);
|
|
3438
3448
|
return this.mediaRecorder = o, o.ondataavailable = (r) => {
|
|
3439
3449
|
r.data.size > 0 && this.chunks.push(r.data);
|
|
3440
3450
|
}, o.onstop = () => {
|
|
@@ -3462,8 +3472,8 @@ class Le {
|
|
|
3462
3472
|
t.className = "vr-circle-wrapper";
|
|
3463
3473
|
const i = document.createElement("div");
|
|
3464
3474
|
i.className = "vr-ring", t.appendChild(i);
|
|
3465
|
-
const
|
|
3466
|
-
|
|
3475
|
+
const s = document.createElement("div");
|
|
3476
|
+
s.className = "vr-video-circle", this.videoEl = document.createElement("video"), this.videoEl.muted = !0, this.videoEl.playsInline = !0, this.videoEl.setAttribute("playsinline", ""), s.appendChild(this.videoEl), t.appendChild(s), this.root.appendChild(t), this.timerEl = document.createElement("span"), this.timerEl.className = "vr-timer", this.timerEl.textContent = "00:00", this.root.appendChild(this.timerEl);
|
|
3467
3477
|
const o = document.createElement("div");
|
|
3468
3478
|
o.className = "vr-actions";
|
|
3469
3479
|
const r = document.createElement("button");
|
|
@@ -3477,8 +3487,8 @@ class Le {
|
|
|
3477
3487
|
this.timerEl.textContent = Wi(this.elapsed), e <= 10 ? this.timerEl.classList.add("vr-countdown") : this.timerEl.classList.remove("vr-countdown");
|
|
3478
3488
|
}
|
|
3479
3489
|
async handleRecordingComplete() {
|
|
3480
|
-
var
|
|
3481
|
-
const e = ((
|
|
3490
|
+
var s, o;
|
|
3491
|
+
const e = ((s = this.mediaRecorder) == null ? void 0 : s.mimeType) || "video/webm", t = new Blob(this.chunks, { type: e });
|
|
3482
3492
|
let i;
|
|
3483
3493
|
try {
|
|
3484
3494
|
i = await Yi(t);
|
|
@@ -3553,17 +3563,17 @@ const _ = class _ {
|
|
|
3553
3563
|
}), i.addEventListener("click", (r) => {
|
|
3554
3564
|
r.stopPropagation(), _.close();
|
|
3555
3565
|
});
|
|
3556
|
-
const
|
|
3557
|
-
|
|
3566
|
+
const s = document.createElement("img");
|
|
3567
|
+
s.src = e, s.alt = "Lightbox image", Object.assign(s.style, {
|
|
3558
3568
|
maxWidth: "90vw",
|
|
3559
3569
|
maxHeight: "90vh",
|
|
3560
3570
|
borderRadius: "8px",
|
|
3561
3571
|
objectFit: "contain",
|
|
3562
3572
|
cursor: "default",
|
|
3563
3573
|
userSelect: "none"
|
|
3564
|
-
}),
|
|
3574
|
+
}), s.addEventListener("click", (r) => {
|
|
3565
3575
|
r.stopPropagation();
|
|
3566
|
-
}), t.appendChild(i), t.appendChild(
|
|
3576
|
+
}), t.appendChild(i), t.appendChild(s), t.addEventListener("click", () => {
|
|
3567
3577
|
_.close();
|
|
3568
3578
|
});
|
|
3569
3579
|
const o = (r) => {
|
|
@@ -3597,7 +3607,7 @@ class ne {
|
|
|
3597
3607
|
this.input.accept = e, this.input.value = "";
|
|
3598
3608
|
const i = () => {
|
|
3599
3609
|
o(), t(null);
|
|
3600
|
-
},
|
|
3610
|
+
}, s = async () => {
|
|
3601
3611
|
var l;
|
|
3602
3612
|
o();
|
|
3603
3613
|
const r = (l = this.input.files) == null ? void 0 : l[0];
|
|
@@ -3615,9 +3625,9 @@ class ne {
|
|
|
3615
3625
|
this.uploading = !1;
|
|
3616
3626
|
}
|
|
3617
3627
|
}, o = () => {
|
|
3618
|
-
this.input.removeEventListener("change",
|
|
3628
|
+
this.input.removeEventListener("change", s), this.input.removeEventListener("cancel", i);
|
|
3619
3629
|
};
|
|
3620
|
-
this.input.addEventListener("change",
|
|
3630
|
+
this.input.addEventListener("change", s, { once: !0 }), this.input.addEventListener("cancel", i, { once: !0 }), this.input.click();
|
|
3621
3631
|
});
|
|
3622
3632
|
}
|
|
3623
3633
|
/**
|
|
@@ -3659,15 +3669,15 @@ class Ji {
|
|
|
3659
3669
|
}, this.handlePopoverEscape = (i) => {
|
|
3660
3670
|
i.key === "Escape" && this.closePopover();
|
|
3661
3671
|
}, this.handlePopoverOutsideClick = (i) => {
|
|
3662
|
-
var
|
|
3672
|
+
var s, o;
|
|
3663
3673
|
if (this.popover && !this.popover.contains(i.target)) {
|
|
3664
|
-
if ((
|
|
3674
|
+
if ((s = this.container) != null && s.contains(i.target) || (o = this.pickerEl) != null && o.contains(i.target)) return;
|
|
3665
3675
|
this.closePopover();
|
|
3666
3676
|
}
|
|
3667
3677
|
}, this.handleOverlayClick = (i) => {
|
|
3668
3678
|
this.form && (this.form.remove(), this.form = null);
|
|
3669
|
-
const
|
|
3670
|
-
x: i.clientX /
|
|
3679
|
+
const s = window.innerWidth, o = window.innerHeight, r = {
|
|
3680
|
+
x: i.clientX / s,
|
|
3671
3681
|
y: i.clientY / o,
|
|
3672
3682
|
scrollX: window.scrollX,
|
|
3673
3683
|
scrollY: window.scrollY
|
|
@@ -3737,8 +3747,8 @@ class Ji {
|
|
|
3737
3747
|
this.container && (this.container.style.display = e ? "" : "none");
|
|
3738
3748
|
}
|
|
3739
3749
|
destroy() {
|
|
3740
|
-
var e, t, i,
|
|
3741
|
-
this.exitPinMode(), this.closePopover(), this.removePickerEl(), (e = this.unsub) == null || e.call(this), (t = this.threadUnsub) == null || t.call(this), (i = this.reactionUnsub) == null || i.call(this), (
|
|
3750
|
+
var e, t, i, s, o, r;
|
|
3751
|
+
this.exitPinMode(), this.closePopover(), this.removePickerEl(), (e = this.unsub) == null || e.call(this), (t = this.threadUnsub) == null || t.call(this), (i = this.reactionUnsub) == null || i.call(this), (s = this.typingUnsub2) == null || s.call(this), window.removeEventListener("scroll", this.handleReposition, !0), window.removeEventListener("resize", this.handleReposition), (o = this.mutationObserver) == null || o.disconnect(), this.mutationObserver = null, this.repositionDebounce && (clearTimeout(this.repositionDebounce), this.repositionDebounce = null), (r = this.container) == null || r.remove(), this.container = null, this.pinEls.clear();
|
|
3742
3752
|
}
|
|
3743
3753
|
closePopover() {
|
|
3744
3754
|
var e;
|
|
@@ -3755,8 +3765,8 @@ class Ji {
|
|
|
3755
3765
|
t.unshift(`#${i.id}`);
|
|
3756
3766
|
break;
|
|
3757
3767
|
}
|
|
3758
|
-
const
|
|
3759
|
-
let r = o.length > 0 ? `${
|
|
3768
|
+
const s = i.tagName.toLowerCase(), o = [...i.classList].filter((a) => !a.startsWith("pulse-")).slice(0, 2);
|
|
3769
|
+
let r = o.length > 0 ? `${s}.${o.join(".")}` : s;
|
|
3760
3770
|
const l = i.parentElement;
|
|
3761
3771
|
if (l) {
|
|
3762
3772
|
const a = [...l.children].filter((c) => c.tagName === i.tagName);
|
|
@@ -3771,13 +3781,13 @@ class Ji {
|
|
|
3771
3781
|
}
|
|
3772
3782
|
showPinForm(e, t, i) {
|
|
3773
3783
|
this.form = document.createElement("div");
|
|
3774
|
-
const
|
|
3784
|
+
const s = Math.min(280, window.innerWidth - 32), o = 120;
|
|
3775
3785
|
let r = e + 16, l = t - 10;
|
|
3776
|
-
r +
|
|
3786
|
+
r + s > window.innerWidth - 16 && (r = e - s - 16), l + o > window.innerHeight - 16 && (l = window.innerHeight - o - 16), l < 16 && (l = 16), Object.assign(this.form.style, {
|
|
3777
3787
|
position: "fixed",
|
|
3778
3788
|
left: `${r}px`,
|
|
3779
3789
|
top: `${l}px`,
|
|
3780
|
-
width: `${
|
|
3790
|
+
width: `${s}px`,
|
|
3781
3791
|
zIndex: "10001",
|
|
3782
3792
|
background: "#fff",
|
|
3783
3793
|
borderRadius: "12px",
|
|
@@ -3864,13 +3874,13 @@ class Ji {
|
|
|
3864
3874
|
// ── Inline thread popover (shown when a pin dot is clicked) ──
|
|
3865
3875
|
showThreadPopover(e, t) {
|
|
3866
3876
|
this.closePopover(), this.popover = document.createElement("div"), this.popover.dataset.threadId = e.id;
|
|
3867
|
-
const i = window.innerWidth <= 480,
|
|
3877
|
+
const i = window.innerWidth <= 480, s = i ? window.innerWidth : 300, o = t.getBoundingClientRect();
|
|
3868
3878
|
let r, l;
|
|
3869
|
-
i ? (r = 0, l = window.innerHeight * 0.4) : (r = o.right + 10, l = o.top - 8, r +
|
|
3879
|
+
i ? (r = 0, l = window.innerHeight * 0.4) : (r = o.right + 10, l = o.top - 8, r + s > window.innerWidth - 16 && (r = o.left - s - 10), l < 16 && (l = 16)), Object.assign(this.popover.style, {
|
|
3870
3880
|
position: "fixed",
|
|
3871
3881
|
left: `${r}px`,
|
|
3872
3882
|
top: `${l}px`,
|
|
3873
|
-
width: i ? "100vw" : `${
|
|
3883
|
+
width: i ? "100vw" : `${s}px`,
|
|
3874
3884
|
maxHeight: i ? "60vh" : "360px",
|
|
3875
3885
|
zIndex: "10001",
|
|
3876
3886
|
background: "#fff",
|
|
@@ -3981,10 +3991,10 @@ class Ji {
|
|
|
3981
3991
|
this.client.deleteComment(a.dataset.commentId);
|
|
3982
3992
|
});
|
|
3983
3993
|
});
|
|
3984
|
-
const
|
|
3994
|
+
const s = t.querySelector(".edit-save"), o = t.querySelector(".edit-cancel"), r = t.querySelector(
|
|
3985
3995
|
".edit-textarea"
|
|
3986
3996
|
);
|
|
3987
|
-
|
|
3997
|
+
s && r && s.addEventListener("click", () => {
|
|
3988
3998
|
const a = r.value.trim();
|
|
3989
3999
|
if (!a) return;
|
|
3990
4000
|
const c = [...a.matchAll(/@(\w+)/g)].map((p) => p[1]);
|
|
@@ -4033,7 +4043,7 @@ class Ji {
|
|
|
4033
4043
|
padding: "8px 14px 12px",
|
|
4034
4044
|
borderTop: "1px solid #f1f5f9"
|
|
4035
4045
|
});
|
|
4036
|
-
const i = "border:none;background:none;cursor:pointer;color:#94a3b8;padding:6px;border-radius:6px;display:flex;align-items:center;justify-content:center;min-width:32px;min-height:32px;transition:all 0.15s;",
|
|
4046
|
+
const i = "border:none;background:none;cursor:pointer;color:#94a3b8;padding:6px;border-radius:6px;display:flex;align-items:center;justify-content:center;min-width:32px;min-height:32px;transition:all 0.15s;", s = 'width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
|
|
4037
4047
|
t.innerHTML = `
|
|
4038
4048
|
<div style="display:flex;align-items:center;gap:4px;margin-bottom:6px;">
|
|
4039
4049
|
<input type="text" placeholder="Reply..."
|
|
@@ -4042,13 +4052,13 @@ class Ji {
|
|
|
4042
4052
|
</div>
|
|
4043
4053
|
<div style="display:flex;align-items:center;gap:2px;">
|
|
4044
4054
|
<button class="reply-attach-img" title="Attach image" style="${i}" onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'" onmouseout="this.style.color='#94a3b8';this.style.background='none'">
|
|
4045
|
-
<svg ${
|
|
4055
|
+
<svg ${s}><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>
|
|
4046
4056
|
</button>
|
|
4047
4057
|
<button class="reply-attach-mic" title="Record audio" style="${i}" onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'" onmouseout="this.style.color='#94a3b8';this.style.background='none'">
|
|
4048
|
-
<svg ${
|
|
4058
|
+
<svg ${s}><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>
|
|
4049
4059
|
</button>
|
|
4050
4060
|
<button class="reply-attach-video" title="Record video" style="${i}" onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'" onmouseout="this.style.color='#94a3b8';this.style.background='none'">
|
|
4051
|
-
<svg ${
|
|
4061
|
+
<svg ${s}><path d="m22 8-6 4 6 4V8Z"/><rect width="14" height="12" x="2" y="6" rx="2" ry="2"/></svg>
|
|
4052
4062
|
</button>
|
|
4053
4063
|
<div class="reply-attachments-preview" style="flex:1;display:flex;gap:4px;flex-wrap:wrap;margin-left:4px;"></div>
|
|
4054
4064
|
</div>
|
|
@@ -4112,7 +4122,7 @@ class Ji {
|
|
|
4112
4122
|
zIndex: "10002",
|
|
4113
4123
|
fontFamily: be
|
|
4114
4124
|
});
|
|
4115
|
-
for (const
|
|
4125
|
+
for (const s of Ki) {
|
|
4116
4126
|
const o = document.createElement("button");
|
|
4117
4127
|
Object.assign(o.style, {
|
|
4118
4128
|
border: "none",
|
|
@@ -4122,29 +4132,29 @@ class Ji {
|
|
|
4122
4132
|
padding: "4px",
|
|
4123
4133
|
borderRadius: "4px",
|
|
4124
4134
|
lineHeight: "1"
|
|
4125
|
-
}), o.textContent =
|
|
4135
|
+
}), o.textContent = s, o.addEventListener("click", (r) => {
|
|
4126
4136
|
r.stopPropagation();
|
|
4127
4137
|
const a = this.client.state.getReactions(t).find(
|
|
4128
4138
|
(c) => {
|
|
4129
4139
|
var p;
|
|
4130
|
-
return c.emoji ===
|
|
4140
|
+
return c.emoji === s && c.userId === ((p = this.client.state.user) == null ? void 0 : p.id);
|
|
4131
4141
|
}
|
|
4132
4142
|
);
|
|
4133
|
-
a ? this.client.removeReaction(a.id) : this.client.addReaction(t, "comment",
|
|
4143
|
+
a ? this.client.removeReaction(a.id) : this.client.addReaction(t, "comment", s), this.popoverPickerOpen = null, this.removePickerEl();
|
|
4134
4144
|
}), this.pickerEl.appendChild(o);
|
|
4135
4145
|
}
|
|
4136
4146
|
document.body.appendChild(this.pickerEl);
|
|
4137
4147
|
}
|
|
4138
4148
|
buildReactionPillsHtml(e) {
|
|
4139
4149
|
var a;
|
|
4140
|
-
const t = this.client.state.getReactions(e), i = (a = this.client.state.user) == null ? void 0 : a.id,
|
|
4150
|
+
const t = this.client.state.getReactions(e), i = (a = this.client.state.user) == null ? void 0 : a.id, s = /* @__PURE__ */ new Map();
|
|
4141
4151
|
for (const c of t) {
|
|
4142
|
-
const p =
|
|
4143
|
-
p.count++, c.userId === i && (p.ownId = c.id),
|
|
4152
|
+
const p = s.get(c.emoji) ?? { count: 0, ownId: null };
|
|
4153
|
+
p.count++, c.userId === i && (p.ownId = c.id), s.set(c.emoji, p);
|
|
4144
4154
|
}
|
|
4145
4155
|
const o = "display:inline-flex;align-items:center;gap:3px;padding:2px 8px;border-radius:12px;border:1px solid #e2e8f0;background:#fff;font-size:12px;cursor:pointer;transition:all 0.15s;line-height:1.4;", r = o + "background:#eef2ff;border-color:#6366f1;";
|
|
4146
4156
|
let l = '<div style="margin-left:29px;display:flex;gap:4px;flex-wrap:wrap;margin-top:4px;">';
|
|
4147
|
-
for (const [c, { count: p, ownId: d }] of
|
|
4157
|
+
for (const [c, { count: p, ownId: d }] of s) {
|
|
4148
4158
|
const u = d ? r : o;
|
|
4149
4159
|
l += `<button data-reaction-emoji="${c}" data-reaction-target="${e}" ${d ? `data-reaction-id="${d}"` : ""} style="${u}">
|
|
4150
4160
|
<span>${c}</span><span style="font-size:11px;font-weight:600;color:#64748b;">${p}</span>
|
|
@@ -4163,20 +4173,20 @@ class Ji {
|
|
|
4163
4173
|
fontStyle: "italic",
|
|
4164
4174
|
minHeight: "16px"
|
|
4165
4175
|
});
|
|
4166
|
-
const
|
|
4167
|
-
|
|
4176
|
+
const s = this.popover.lastElementChild;
|
|
4177
|
+
s && this.popover.insertBefore(t, s);
|
|
4168
4178
|
}
|
|
4169
|
-
const i = this.client.state.getTypingUsers(e).filter((
|
|
4179
|
+
const i = this.client.state.getTypingUsers(e).filter((s) => {
|
|
4170
4180
|
var o;
|
|
4171
|
-
return
|
|
4172
|
-
}).map((
|
|
4173
|
-
const o = this.client.state.presence.find((r) => r.user.id ===
|
|
4181
|
+
return s !== ((o = this.client.state.user) == null ? void 0 : o.id);
|
|
4182
|
+
}).map((s) => {
|
|
4183
|
+
const o = this.client.state.presence.find((r) => r.user.id === s);
|
|
4174
4184
|
return (o == null ? void 0 : o.user.name) ?? "Someone";
|
|
4175
4185
|
});
|
|
4176
4186
|
i.length === 0 ? t.textContent = "" : i.length === 1 ? t.textContent = `${i[0]} is typing...` : t.textContent = `${i.join(", ")} are typing...`;
|
|
4177
4187
|
}
|
|
4178
4188
|
formatTime(e) {
|
|
4179
|
-
const t = new Date(e),
|
|
4189
|
+
const t = new Date(e), s = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), o = Math.floor(s / 6e4);
|
|
4180
4190
|
if (o < 1) return "now";
|
|
4181
4191
|
if (o < 60) return `${o}m`;
|
|
4182
4192
|
const r = Math.floor(o / 60);
|
|
@@ -4205,9 +4215,9 @@ class Ji {
|
|
|
4205
4215
|
renderPins() {
|
|
4206
4216
|
if (!this.container) return;
|
|
4207
4217
|
const e = this.threads.filter((i) => i.position && !i.resolved), t = new Set(e.map((i) => i.id));
|
|
4208
|
-
for (const [i,
|
|
4209
|
-
t.has(i) || (
|
|
4210
|
-
e.forEach((i,
|
|
4218
|
+
for (const [i, s] of this.pinEls)
|
|
4219
|
+
t.has(i) || (s.remove(), this.pinEls.delete(i));
|
|
4220
|
+
e.forEach((i, s) => {
|
|
4211
4221
|
const o = i.position;
|
|
4212
4222
|
let r = this.pinEls.get(i.id);
|
|
4213
4223
|
r || (r = document.createElement("div"), Object.assign(r.style, {
|
|
@@ -4241,16 +4251,16 @@ class Ji {
|
|
|
4241
4251
|
}
|
|
4242
4252
|
const a = this.threads.find((c) => c.id === i.id);
|
|
4243
4253
|
a && this.showThreadPopover(a, r);
|
|
4244
|
-
}), this.container.appendChild(r), this.pinEls.set(i.id, r)), r.textContent = `${
|
|
4254
|
+
}), this.container.appendChild(r), this.pinEls.set(i.id, r)), r.textContent = `${s + 1}`;
|
|
4245
4255
|
const l = this.resolvePosition(o);
|
|
4246
4256
|
r.style.left = `${l.x}px`, r.style.top = `${l.y}px`;
|
|
4247
4257
|
});
|
|
4248
4258
|
}
|
|
4249
4259
|
}
|
|
4250
|
-
var Qi = Object.defineProperty, es = Object.getOwnPropertyDescriptor, j = (
|
|
4251
|
-
for (var
|
|
4252
|
-
(r =
|
|
4253
|
-
return i &&
|
|
4260
|
+
var Qi = Object.defineProperty, es = Object.getOwnPropertyDescriptor, j = (n, e, t, i) => {
|
|
4261
|
+
for (var s = i > 1 ? void 0 : i ? es(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
4262
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
4263
|
+
return i && s && Qi(e, t, s), s;
|
|
4254
4264
|
};
|
|
4255
4265
|
const ts = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
|
|
4256
4266
|
let O = class extends T {
|
|
@@ -4267,28 +4277,28 @@ let O = class extends T {
|
|
|
4267
4277
|
disconnectedCallback() {
|
|
4268
4278
|
super.disconnectedCallback(), this.teardownListeners();
|
|
4269
4279
|
}
|
|
4270
|
-
willUpdate(
|
|
4280
|
+
willUpdate(n) {
|
|
4271
4281
|
this.client && !this.unsub && this.ensureListener();
|
|
4272
4282
|
}
|
|
4273
|
-
updated(
|
|
4283
|
+
updated(n) {
|
|
4274
4284
|
var e, t;
|
|
4275
4285
|
(e = this.shadowRoot) == null || e.querySelectorAll(".audio-player-host").forEach((i) => {
|
|
4276
4286
|
if (i.children.length > 0) return;
|
|
4277
|
-
const
|
|
4278
|
-
if (
|
|
4287
|
+
const s = i.dataset.url;
|
|
4288
|
+
if (s) {
|
|
4279
4289
|
const o = i.dataset.duration ? parseInt(i.dataset.duration) : void 0;
|
|
4280
|
-
i.appendChild(Oe.render(
|
|
4290
|
+
i.appendChild(Oe.render(s, o));
|
|
4281
4291
|
}
|
|
4282
4292
|
}), (t = this.shadowRoot) == null || t.querySelectorAll(".video-player-host").forEach((i) => {
|
|
4283
4293
|
if (i.children.length > 0) return;
|
|
4284
|
-
const
|
|
4285
|
-
|
|
4294
|
+
const s = i.dataset.url;
|
|
4295
|
+
s && i.appendChild(Tt.render(s, i.dataset.poster || void 0));
|
|
4286
4296
|
});
|
|
4287
4297
|
}
|
|
4288
4298
|
teardownListeners() {
|
|
4289
|
-
var
|
|
4290
|
-
(
|
|
4291
|
-
for (const
|
|
4299
|
+
var n, e, t, i;
|
|
4300
|
+
(n = this.unsub) == null || n.call(this), this.unsub = void 0, (e = this.authUnsub) == null || e.call(this), this.authUnsub = void 0, (t = this.reactionUnsub) == null || t.call(this), this.reactionUnsub = void 0, (i = this.typingUnsub) == null || i.call(this), this.typingUnsub = void 0;
|
|
4301
|
+
for (const s of this.typingTimers.values()) clearTimeout(s);
|
|
4292
4302
|
this.typingTimers.clear();
|
|
4293
4303
|
}
|
|
4294
4304
|
ensureListener() {
|
|
@@ -4297,123 +4307,125 @@ let O = class extends T {
|
|
|
4297
4307
|
setupListener() {
|
|
4298
4308
|
this.client && (this.unsub = this.client.state.on("threads", () => {
|
|
4299
4309
|
this.threadsVersion++;
|
|
4310
|
+
}), this.authUnsub = this.client.state.on("auth", () => {
|
|
4311
|
+
this.threadsVersion++;
|
|
4300
4312
|
}), this.reactionUnsub = this.client.state.on("reactions", () => {
|
|
4301
4313
|
this.reactionsVersion++;
|
|
4302
4314
|
}), this.typingUnsub = this.client.state.on(
|
|
4303
4315
|
"typing",
|
|
4304
|
-
({ threadId:
|
|
4305
|
-
this.refreshTyping(
|
|
4316
|
+
({ threadId: n }) => {
|
|
4317
|
+
this.refreshTyping(n);
|
|
4306
4318
|
}
|
|
4307
4319
|
));
|
|
4308
4320
|
}
|
|
4309
|
-
refreshTyping(
|
|
4310
|
-
const t = this.client.state.getTypingUsers(
|
|
4321
|
+
refreshTyping(n) {
|
|
4322
|
+
const t = this.client.state.getTypingUsers(n).filter((s) => {
|
|
4311
4323
|
var o;
|
|
4312
|
-
return
|
|
4313
|
-
}).map((
|
|
4314
|
-
const o = this.client.state.presence.find((r) => r.user.id ===
|
|
4324
|
+
return s !== ((o = this.client.state.user) == null ? void 0 : o.id);
|
|
4325
|
+
}).map((s) => {
|
|
4326
|
+
const o = this.client.state.presence.find((r) => r.user.id === s);
|
|
4315
4327
|
return (o == null ? void 0 : o.user.name) ?? "Someone";
|
|
4316
4328
|
}), i = new Map(this.typingByThread);
|
|
4317
|
-
i.set(
|
|
4318
|
-
|
|
4329
|
+
i.set(n, t), this.typingByThread = i, this.typingTimers.has(n) && clearTimeout(this.typingTimers.get(n)), this.typingTimers.set(
|
|
4330
|
+
n,
|
|
4319
4331
|
setTimeout(() => {
|
|
4320
|
-
this.refreshTyping(
|
|
4332
|
+
this.refreshTyping(n);
|
|
4321
4333
|
}, 3500)
|
|
4322
4334
|
);
|
|
4323
4335
|
}
|
|
4324
|
-
handleTypingInput(
|
|
4325
|
-
const e = Date.now(), t = this.lastTypingSend.get(
|
|
4326
|
-
e - t >= 2e3 && (this.client.sendTyping(
|
|
4336
|
+
handleTypingInput(n) {
|
|
4337
|
+
const e = Date.now(), t = this.lastTypingSend.get(n) ?? 0;
|
|
4338
|
+
e - t >= 2e3 && (this.client.sendTyping(n), this.lastTypingSend.set(n, e));
|
|
4327
4339
|
}
|
|
4328
|
-
toggleReaction(
|
|
4340
|
+
toggleReaction(n, e) {
|
|
4329
4341
|
var o;
|
|
4330
|
-
const t = this.client.state.getReactions(
|
|
4342
|
+
const t = this.client.state.getReactions(n), i = (o = this.client.state.user) == null ? void 0 : o.id, s = t.find(
|
|
4331
4343
|
(r) => r.emoji === e && r.userId === i
|
|
4332
4344
|
);
|
|
4333
|
-
|
|
4345
|
+
s ? this.client.removeReaction(s.id) : this.client.addReaction(n, "comment", e), this.pickerOpenForComment = null;
|
|
4334
4346
|
}
|
|
4335
4347
|
fireClose() {
|
|
4336
4348
|
this.dispatchEvent(
|
|
4337
4349
|
new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
|
|
4338
4350
|
);
|
|
4339
4351
|
}
|
|
4340
|
-
scrollToThread(
|
|
4352
|
+
scrollToThread(n) {
|
|
4341
4353
|
this.updateComplete.then(() => {
|
|
4342
4354
|
var t;
|
|
4343
4355
|
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(
|
|
4344
|
-
`[data-thread-id="${
|
|
4356
|
+
`[data-thread-id="${n}"]`
|
|
4345
4357
|
);
|
|
4346
4358
|
e == null || e.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
4347
4359
|
});
|
|
4348
4360
|
}
|
|
4349
|
-
parseMentions(
|
|
4350
|
-
return
|
|
4361
|
+
parseMentions(n) {
|
|
4362
|
+
return n.split(/(@\w+)/g).map(
|
|
4351
4363
|
(t) => t.startsWith("@") ? h`<span class="mention">${t}</span>` : t
|
|
4352
4364
|
);
|
|
4353
4365
|
}
|
|
4354
|
-
getInitials(
|
|
4355
|
-
return
|
|
4366
|
+
getInitials(n) {
|
|
4367
|
+
return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
4356
4368
|
}
|
|
4357
|
-
getUserForComment(
|
|
4358
|
-
return this.client.state.getUser(
|
|
4369
|
+
getUserForComment(n) {
|
|
4370
|
+
return this.client.state.getUser(n);
|
|
4359
4371
|
}
|
|
4360
|
-
formatTime(
|
|
4361
|
-
const e = new Date(
|
|
4362
|
-
if (
|
|
4363
|
-
if (
|
|
4364
|
-
const o = Math.floor(
|
|
4372
|
+
formatTime(n) {
|
|
4373
|
+
const e = new Date(n), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(i / 6e4);
|
|
4374
|
+
if (s < 1) return "now";
|
|
4375
|
+
if (s < 60) return `${s}m`;
|
|
4376
|
+
const o = Math.floor(s / 60);
|
|
4365
4377
|
return o < 24 ? `${o}h` : e.toLocaleDateString();
|
|
4366
4378
|
}
|
|
4367
4379
|
async handleAttachImage() {
|
|
4368
4380
|
this.upload || (this.upload = new ne(this.client));
|
|
4369
|
-
const
|
|
4370
|
-
|
|
4381
|
+
const n = await this.upload.pickFile("image/*");
|
|
4382
|
+
n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
|
|
4371
4383
|
}
|
|
4372
|
-
async handleRecordAudio(
|
|
4384
|
+
async handleRecordAudio(n) {
|
|
4373
4385
|
var i;
|
|
4374
4386
|
this.upload || (this.upload = new ne(this.client)), this.audioRecorder || (this.audioRecorder = new Re());
|
|
4375
|
-
const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${
|
|
4387
|
+
const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${n}"]`), t = await this.audioRecorder.startRecording(e ?? document.body);
|
|
4376
4388
|
if (t) {
|
|
4377
|
-
const
|
|
4378
|
-
|
|
4389
|
+
const s = await this.upload.uploadBlob(t, "audio.webm");
|
|
4390
|
+
s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
|
|
4379
4391
|
}
|
|
4380
4392
|
}
|
|
4381
|
-
async handleRecordVideo(
|
|
4393
|
+
async handleRecordVideo(n) {
|
|
4382
4394
|
var i;
|
|
4383
4395
|
this.upload || (this.upload = new ne(this.client)), this.videoRecorder || (this.videoRecorder = new Le());
|
|
4384
|
-
const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${
|
|
4396
|
+
const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${n}"]`), t = await this.videoRecorder.startRecording(e ?? document.body);
|
|
4385
4397
|
if (t) {
|
|
4386
|
-
const
|
|
4387
|
-
|
|
4398
|
+
const s = await this.upload.uploadBlob(t.blob, "video.webm");
|
|
4399
|
+
s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
|
|
4388
4400
|
}
|
|
4389
4401
|
}
|
|
4390
|
-
handleReply(
|
|
4402
|
+
handleReply(n, e) {
|
|
4391
4403
|
e.preventDefault();
|
|
4392
|
-
const i = e.target.querySelector("input"),
|
|
4393
|
-
if (!
|
|
4394
|
-
const o = [...(
|
|
4395
|
-
this.client.reply(
|
|
4404
|
+
const i = e.target.querySelector("input"), s = i.value.trim();
|
|
4405
|
+
if (!s && this.replyAttachmentIds.length === 0) return;
|
|
4406
|
+
const o = [...(s || "").matchAll(/@(\w+)/g)].map((r) => r[1]);
|
|
4407
|
+
this.client.reply(n, s, o, this.replyAttachmentIds.length > 0 ? [...this.replyAttachmentIds] : void 0), i.value = "", this.replyAttachmentIds = [], this.replyingTo = null;
|
|
4396
4408
|
}
|
|
4397
|
-
isOwnComment(
|
|
4409
|
+
isOwnComment(n) {
|
|
4398
4410
|
var e, t;
|
|
4399
|
-
return ((t = (e = this.client) == null ? void 0 : e.state.user) == null ? void 0 : t.id) ===
|
|
4411
|
+
return ((t = (e = this.client) == null ? void 0 : e.state.user) == null ? void 0 : t.id) === n.userId;
|
|
4400
4412
|
}
|
|
4401
|
-
startEdit(
|
|
4402
|
-
this.editingCommentId =
|
|
4413
|
+
startEdit(n) {
|
|
4414
|
+
this.editingCommentId = n.id, this.editBody = n.body;
|
|
4403
4415
|
}
|
|
4404
4416
|
cancelEdit() {
|
|
4405
4417
|
this.editingCommentId = null, this.editBody = "";
|
|
4406
4418
|
}
|
|
4407
|
-
saveEdit(
|
|
4419
|
+
saveEdit(n) {
|
|
4408
4420
|
const e = this.editBody.trim();
|
|
4409
4421
|
if (!e) return;
|
|
4410
4422
|
const t = [...e.matchAll(/@(\w+)/g)].map((i) => i[1]);
|
|
4411
|
-
this.client.editComment(
|
|
4423
|
+
this.client.editComment(n, e, t), this.editingCommentId = null, this.editBody = "";
|
|
4412
4424
|
}
|
|
4413
|
-
deleteComment(
|
|
4414
|
-
this.client.deleteComment(
|
|
4425
|
+
deleteComment(n) {
|
|
4426
|
+
this.client.deleteComment(n);
|
|
4415
4427
|
}
|
|
4416
|
-
renderEditForm(
|
|
4428
|
+
renderEditForm(n) {
|
|
4417
4429
|
return h`
|
|
4418
4430
|
<div class="edit-form">
|
|
4419
4431
|
<textarea
|
|
@@ -4423,16 +4435,16 @@ let O = class extends T {
|
|
|
4423
4435
|
}}
|
|
4424
4436
|
></textarea>
|
|
4425
4437
|
<div class="edit-actions">
|
|
4426
|
-
<button class="pw-btn pw-btn-primary" @click=${() => this.saveEdit(
|
|
4438
|
+
<button class="pw-btn pw-btn-primary" @click=${() => this.saveEdit(n.id)}>Save</button>
|
|
4427
4439
|
<button class="pw-btn" @click=${this.cancelEdit}>Cancel</button>
|
|
4428
4440
|
</div>
|
|
4429
4441
|
</div>
|
|
4430
4442
|
`;
|
|
4431
4443
|
}
|
|
4432
|
-
renderReactions(
|
|
4433
|
-
var
|
|
4444
|
+
renderReactions(n) {
|
|
4445
|
+
var s;
|
|
4434
4446
|
this.reactionsVersion;
|
|
4435
|
-
const e = this.client.state.getReactions(
|
|
4447
|
+
const e = this.client.state.getReactions(n.id), t = (s = this.client.state.user) == null ? void 0 : s.id, i = /* @__PURE__ */ new Map();
|
|
4436
4448
|
for (const o of e)
|
|
4437
4449
|
i.has(o.emoji) || i.set(o.emoji, []), i.get(o.emoji).push(o);
|
|
4438
4450
|
return h`
|
|
@@ -4443,7 +4455,7 @@ let O = class extends T {
|
|
|
4443
4455
|
return h`
|
|
4444
4456
|
<button
|
|
4445
4457
|
class="reaction-pill ${l ? "own" : ""}"
|
|
4446
|
-
@click=${() => this.toggleReaction(
|
|
4458
|
+
@click=${() => this.toggleReaction(n.id, o)}
|
|
4447
4459
|
>
|
|
4448
4460
|
<span>${o}</span>
|
|
4449
4461
|
<span class="count">${r.length}</span>
|
|
@@ -4454,17 +4466,17 @@ let O = class extends T {
|
|
|
4454
4466
|
<button
|
|
4455
4467
|
class="reaction-add-btn"
|
|
4456
4468
|
@click=${() => {
|
|
4457
|
-
this.pickerOpenForComment = this.pickerOpenForComment ===
|
|
4469
|
+
this.pickerOpenForComment = this.pickerOpenForComment === n.id ? null : n.id;
|
|
4458
4470
|
}}
|
|
4459
4471
|
title="Add reaction"
|
|
4460
4472
|
>
|
|
4461
4473
|
+
|
|
4462
|
-
${this.pickerOpenForComment ===
|
|
4474
|
+
${this.pickerOpenForComment === n.id ? h`
|
|
4463
4475
|
<div class="emoji-picker">
|
|
4464
4476
|
${ts.map(
|
|
4465
4477
|
(o) => h`
|
|
4466
4478
|
<button @click=${(r) => {
|
|
4467
|
-
r.stopPropagation(), this.toggleReaction(
|
|
4479
|
+
r.stopPropagation(), this.toggleReaction(n.id, o);
|
|
4468
4480
|
}}>${o}</button>
|
|
4469
4481
|
`
|
|
4470
4482
|
)}
|
|
@@ -4474,21 +4486,21 @@ let O = class extends T {
|
|
|
4474
4486
|
</div>
|
|
4475
4487
|
`;
|
|
4476
4488
|
}
|
|
4477
|
-
renderTypingIndicator(
|
|
4478
|
-
const e = this.typingByThread.get(
|
|
4489
|
+
renderTypingIndicator(n) {
|
|
4490
|
+
const e = this.typingByThread.get(n) ?? [];
|
|
4479
4491
|
if (e.length === 0) return f;
|
|
4480
4492
|
const t = e.length === 1 ? `${e[0]} is typing...` : `${e.join(", ")} are typing...`;
|
|
4481
4493
|
return h`<div class="typing-indicator">${t}</div>`;
|
|
4482
4494
|
}
|
|
4483
4495
|
sortedThreads() {
|
|
4484
|
-
return [...this.threads].sort((
|
|
4485
|
-
if (
|
|
4486
|
-
const t =
|
|
4496
|
+
return [...this.threads].sort((n, e) => {
|
|
4497
|
+
if (n.resolved !== e.resolved) return n.resolved ? 1 : -1;
|
|
4498
|
+
const t = n.comments.length ? new Date(n.comments[n.comments.length - 1].createdAt).getTime() : 0;
|
|
4487
4499
|
return (e.comments.length ? new Date(e.comments[e.comments.length - 1].createdAt).getTime() : 0) - t;
|
|
4488
4500
|
});
|
|
4489
4501
|
}
|
|
4490
4502
|
render() {
|
|
4491
|
-
const
|
|
4503
|
+
const n = this.sortedThreads();
|
|
4492
4504
|
return h`
|
|
4493
4505
|
<div class="panel">
|
|
4494
4506
|
<div class="panel-header">
|
|
@@ -4502,10 +4514,10 @@ let O = class extends T {
|
|
|
4502
4514
|
</div>
|
|
4503
4515
|
|
|
4504
4516
|
<div class="panel-body pw-scrollable">
|
|
4505
|
-
${
|
|
4517
|
+
${n.length === 0 ? h`<div class="empty">
|
|
4506
4518
|
<div class="empty-icon">💬</div>
|
|
4507
4519
|
No comments yet
|
|
4508
|
-
</div>` :
|
|
4520
|
+
</div>` : n.map((e) => this.renderThread(e))}
|
|
4509
4521
|
</div>
|
|
4510
4522
|
|
|
4511
4523
|
<div class="pin-hint">
|
|
@@ -4514,9 +4526,9 @@ let O = class extends T {
|
|
|
4514
4526
|
</div>
|
|
4515
4527
|
`;
|
|
4516
4528
|
}
|
|
4517
|
-
renderAttachments(
|
|
4518
|
-
return !
|
|
4519
|
-
${
|
|
4529
|
+
renderAttachments(n) {
|
|
4530
|
+
return !n || n.length === 0 ? f : h`
|
|
4531
|
+
${n.map((e) => {
|
|
4520
4532
|
if (e.type === "image") {
|
|
4521
4533
|
const t = e.thumbnailUrl || e.url;
|
|
4522
4534
|
return h`
|
|
@@ -4542,37 +4554,37 @@ let O = class extends T {
|
|
|
4542
4554
|
})}
|
|
4543
4555
|
`;
|
|
4544
4556
|
}
|
|
4545
|
-
renderAudioPlayer(
|
|
4546
|
-
const e = document.createElement("div"), t = Oe.render(
|
|
4547
|
-
return e.appendChild(t), h`<div class="audio-player-host" data-url=${
|
|
4557
|
+
renderAudioPlayer(n) {
|
|
4558
|
+
const e = document.createElement("div"), t = Oe.render(n.url, n.durationMs);
|
|
4559
|
+
return e.appendChild(t), h`<div class="audio-player-host" data-url=${n.url} data-duration=${n.durationMs ?? ""}></div>`;
|
|
4548
4560
|
}
|
|
4549
|
-
renderVideoPlayer(
|
|
4550
|
-
return h`<div class="video-player-host" data-url=${
|
|
4561
|
+
renderVideoPlayer(n) {
|
|
4562
|
+
return h`<div class="video-player-host" data-url=${n.url} data-poster=${n.thumbnailUrl ?? ""}></div>`;
|
|
4551
4563
|
}
|
|
4552
|
-
renderThread(
|
|
4553
|
-
const e = this.highlightThreadId ===
|
|
4564
|
+
renderThread(n) {
|
|
4565
|
+
const e = this.highlightThreadId === n.id;
|
|
4554
4566
|
return h`
|
|
4555
4567
|
<div
|
|
4556
|
-
class="thread ${
|
|
4557
|
-
data-thread-id=${
|
|
4568
|
+
class="thread ${n.resolved ? "resolved" : ""} ${e ? "highlighted" : ""}"
|
|
4569
|
+
data-thread-id=${n.id}
|
|
4558
4570
|
>
|
|
4559
|
-
${
|
|
4571
|
+
${n.position ? h`<div class="pin-badge">
|
|
4560
4572
|
${k(_t, 12)}
|
|
4561
4573
|
Pinned
|
|
4562
4574
|
</div>` : f}
|
|
4563
|
-
${
|
|
4564
|
-
const
|
|
4575
|
+
${n.comments.map((t, i) => {
|
|
4576
|
+
const s = this.getUserForComment(t.userId), o = this.isOwnComment(t), r = this.editingCommentId === t.id;
|
|
4565
4577
|
return h`
|
|
4566
4578
|
${i > 0 ? h`<div class="comment-divider"></div>` : f}
|
|
4567
4579
|
<div class="comment">
|
|
4568
4580
|
<div class="comment-header">
|
|
4569
4581
|
<div
|
|
4570
4582
|
class="comment-avatar"
|
|
4571
|
-
style="background:${(
|
|
4583
|
+
style="background:${(s == null ? void 0 : s.color) ?? "#94a3b8"}"
|
|
4572
4584
|
>
|
|
4573
|
-
${
|
|
4585
|
+
${s ? this.getInitials(s.name) : "?"}
|
|
4574
4586
|
</div>
|
|
4575
|
-
<span class="comment-author">${(
|
|
4587
|
+
<span class="comment-author">${(s == null ? void 0 : s.name) ?? "Unknown"}</span>
|
|
4576
4588
|
<span class="comment-time">${this.formatTime(t.createdAt)}</span>
|
|
4577
4589
|
${t.editedAt ? h`<span class="edited-badge">(edited)</span>` : f}
|
|
4578
4590
|
</div>
|
|
@@ -4591,29 +4603,29 @@ let O = class extends T {
|
|
|
4591
4603
|
|
|
4592
4604
|
<div class="thread-actions">
|
|
4593
4605
|
<button
|
|
4594
|
-
@click=${() => this.replyingTo = this.replyingTo ===
|
|
4606
|
+
@click=${() => this.replyingTo = this.replyingTo === n.id ? null : n.id}
|
|
4595
4607
|
>
|
|
4596
4608
|
Reply
|
|
4597
4609
|
</button>
|
|
4598
4610
|
<button
|
|
4599
|
-
@click=${() => this.client.resolveThread(
|
|
4611
|
+
@click=${() => this.client.resolveThread(n.id, !n.resolved)}
|
|
4600
4612
|
>
|
|
4601
|
-
${
|
|
4613
|
+
${n.resolved ? "Reopen" : "Resolve"}
|
|
4602
4614
|
</button>
|
|
4603
4615
|
</div>
|
|
4604
4616
|
|
|
4605
|
-
${this.renderTypingIndicator(
|
|
4617
|
+
${this.renderTypingIndicator(n.id)}
|
|
4606
4618
|
|
|
4607
|
-
${this.replyingTo ===
|
|
4619
|
+
${this.replyingTo === n.id ? h`
|
|
4608
4620
|
<form
|
|
4609
4621
|
class="reply-form"
|
|
4610
|
-
@submit=${(t) => this.handleReply(
|
|
4622
|
+
@submit=${(t) => this.handleReply(n.id, t)}
|
|
4611
4623
|
>
|
|
4612
4624
|
<div class="reply-input-row">
|
|
4613
4625
|
<input
|
|
4614
4626
|
type="text"
|
|
4615
4627
|
placeholder="Reply..."
|
|
4616
|
-
@input=${() => this.handleTypingInput(
|
|
4628
|
+
@input=${() => this.handleTypingInput(n.id)}
|
|
4617
4629
|
/>
|
|
4618
4630
|
<button class="pw-btn pw-btn-primary" type="submit">Send</button>
|
|
4619
4631
|
</div>
|
|
@@ -4628,13 +4640,13 @@ let O = class extends T {
|
|
|
4628
4640
|
type="button"
|
|
4629
4641
|
class="reply-media-btn"
|
|
4630
4642
|
title="Record audio"
|
|
4631
|
-
@click=${() => this.handleRecordAudio(
|
|
4643
|
+
@click=${() => this.handleRecordAudio(n.id)}
|
|
4632
4644
|
>${k(Ti, 16)}</button>
|
|
4633
4645
|
<button
|
|
4634
4646
|
type="button"
|
|
4635
4647
|
class="reply-media-btn"
|
|
4636
4648
|
title="Record video"
|
|
4637
|
-
@click=${() => this.handleRecordVideo(
|
|
4649
|
+
@click=${() => this.handleRecordVideo(n.id)}
|
|
4638
4650
|
>${k(Oi, 16)}</button>
|
|
4639
4651
|
<div class="reply-preview">
|
|
4640
4652
|
${this.replyAttachmentIds.map(
|
|
@@ -5201,10 +5213,10 @@ j([
|
|
|
5201
5213
|
O = j([
|
|
5202
5214
|
R("pulse-widget-comments-panel")
|
|
5203
5215
|
], O);
|
|
5204
|
-
var is = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, Ve = (
|
|
5205
|
-
for (var
|
|
5206
|
-
(r =
|
|
5207
|
-
return i &&
|
|
5216
|
+
var is = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, Ve = (n, e, t, i) => {
|
|
5217
|
+
for (var s = i > 1 ? void 0 : i ? ss(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
5218
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
5219
|
+
return i && s && is(e, t, s), s;
|
|
5208
5220
|
};
|
|
5209
5221
|
const ns = {
|
|
5210
5222
|
"comment:created": "left a comment",
|
|
@@ -5227,18 +5239,18 @@ let de = class extends T {
|
|
|
5227
5239
|
super.connectedCallback(), this.setupListener();
|
|
5228
5240
|
}
|
|
5229
5241
|
disconnectedCallback() {
|
|
5230
|
-
var
|
|
5231
|
-
super.disconnectedCallback(), (
|
|
5242
|
+
var n;
|
|
5243
|
+
super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
|
|
5232
5244
|
}
|
|
5233
|
-
updated(
|
|
5245
|
+
updated(n) {
|
|
5234
5246
|
var e;
|
|
5235
|
-
|
|
5247
|
+
n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
|
|
5236
5248
|
}
|
|
5237
5249
|
setupListener() {
|
|
5238
5250
|
this.client && (this.notifications = this.client.state.notifications, this.unsub = this.client.state.on(
|
|
5239
5251
|
"notifications",
|
|
5240
|
-
(
|
|
5241
|
-
this.notifications = [...
|
|
5252
|
+
(n) => {
|
|
5253
|
+
this.notifications = [...n];
|
|
5242
5254
|
}
|
|
5243
5255
|
));
|
|
5244
5256
|
}
|
|
@@ -5247,31 +5259,31 @@ let de = class extends T {
|
|
|
5247
5259
|
new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
|
|
5248
5260
|
);
|
|
5249
5261
|
}
|
|
5250
|
-
handleClick(
|
|
5251
|
-
|
|
5262
|
+
handleClick(n) {
|
|
5263
|
+
n.read || this.client.markRead(n.id);
|
|
5252
5264
|
}
|
|
5253
|
-
getActorName(
|
|
5265
|
+
getActorName(n) {
|
|
5254
5266
|
var e;
|
|
5255
|
-
return ((e = this.client.state.getUser(
|
|
5267
|
+
return ((e = this.client.state.getUser(n)) == null ? void 0 : e.name) ?? "Someone";
|
|
5256
5268
|
}
|
|
5257
|
-
formatTime(
|
|
5258
|
-
const e = new Date(
|
|
5259
|
-
if (
|
|
5260
|
-
if (
|
|
5261
|
-
const o = Math.floor(
|
|
5269
|
+
formatTime(n) {
|
|
5270
|
+
const e = new Date(n), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(i / 6e4);
|
|
5271
|
+
if (s < 1) return "now";
|
|
5272
|
+
if (s < 60) return `${s}m`;
|
|
5273
|
+
const o = Math.floor(s / 60);
|
|
5262
5274
|
return o < 24 ? `${o}h` : e.toLocaleDateString();
|
|
5263
5275
|
}
|
|
5264
5276
|
render() {
|
|
5265
|
-
const
|
|
5277
|
+
const n = this.notifications.filter((e) => !e.read).length;
|
|
5266
5278
|
return h`
|
|
5267
5279
|
<div class="panel">
|
|
5268
5280
|
<div class="panel-header">
|
|
5269
5281
|
<span class="panel-title">
|
|
5270
5282
|
Notifications
|
|
5271
|
-
${
|
|
5283
|
+
${n > 0 ? h`<span class="unread-badge">${n}</span>` : f}
|
|
5272
5284
|
</span>
|
|
5273
5285
|
<div style="display:flex;align-items:center;gap:4px;">
|
|
5274
|
-
${
|
|
5286
|
+
${n > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
|
|
5275
5287
|
Mark all read
|
|
5276
5288
|
</button>` : f}
|
|
5277
5289
|
<button class="close-btn" @click=${this.fireClose} title="Close">
|
|
@@ -5543,13 +5555,13 @@ class as {
|
|
|
5543
5555
|
if (i)
|
|
5544
5556
|
i.position = t;
|
|
5545
5557
|
else {
|
|
5546
|
-
const
|
|
5558
|
+
const s = this.client.state.presence.find(
|
|
5547
5559
|
(o) => o.user.id === e
|
|
5548
5560
|
);
|
|
5549
|
-
|
|
5561
|
+
s && this.cursors.set(e, {
|
|
5550
5562
|
userId: e,
|
|
5551
|
-
name:
|
|
5552
|
-
color:
|
|
5563
|
+
name: s.user.name,
|
|
5564
|
+
color: s.user.color,
|
|
5553
5565
|
position: t
|
|
5554
5566
|
});
|
|
5555
5567
|
}
|
|
@@ -5559,17 +5571,17 @@ class as {
|
|
|
5559
5571
|
), this.unsubs.push(
|
|
5560
5572
|
this.client.state.on("presence", (e) => {
|
|
5561
5573
|
var i;
|
|
5562
|
-
const t = new Set(e.map((
|
|
5563
|
-
for (const
|
|
5564
|
-
t.has(
|
|
5574
|
+
const t = new Set(e.map((s) => s.user.id));
|
|
5575
|
+
for (const s of this.cursors.keys())
|
|
5576
|
+
t.has(s) || (this.cursors.delete(s), (i = this.cursorEls.get(s)) == null || i.remove(), this.cursorEls.delete(s), this.cursorLastSeen.delete(s));
|
|
5565
5577
|
})
|
|
5566
5578
|
), this.setSending(!0), this.staleTimer = setInterval(() => {
|
|
5567
5579
|
const e = Date.now();
|
|
5568
5580
|
for (const [t, i] of this.cursorLastSeen)
|
|
5569
5581
|
if (e - i > rs) {
|
|
5570
5582
|
this.cursors.delete(t);
|
|
5571
|
-
const
|
|
5572
|
-
|
|
5583
|
+
const s = this.cursorEls.get(t);
|
|
5584
|
+
s && s.remove(), this.cursorEls.delete(t), this.cursorLastSeen.delete(t);
|
|
5573
5585
|
}
|
|
5574
5586
|
}, 1e3));
|
|
5575
5587
|
}
|
|
@@ -5593,7 +5605,7 @@ class as {
|
|
|
5593
5605
|
if (!this.container) return;
|
|
5594
5606
|
const i = this.client.state.presence.find(
|
|
5595
5607
|
(r) => r.user.id === e
|
|
5596
|
-
),
|
|
5608
|
+
), s = (i == null ? void 0 : i.user.color) ?? "#6366f1", o = document.createElement("div");
|
|
5597
5609
|
Object.assign(o.style, {
|
|
5598
5610
|
position: "absolute",
|
|
5599
5611
|
left: `${t.x}px`,
|
|
@@ -5601,7 +5613,7 @@ class as {
|
|
|
5601
5613
|
width: "0px",
|
|
5602
5614
|
height: "0px",
|
|
5603
5615
|
borderRadius: "50%",
|
|
5604
|
-
border: `3px solid ${
|
|
5616
|
+
border: `3px solid ${s}`,
|
|
5605
5617
|
transform: "translate(-50%, -50%)",
|
|
5606
5618
|
pointerEvents: "none",
|
|
5607
5619
|
opacity: "1",
|
|
@@ -5612,8 +5624,8 @@ class as {
|
|
|
5612
5624
|
}
|
|
5613
5625
|
showEmojiDrop(e, t, i) {
|
|
5614
5626
|
if (!this.container) return;
|
|
5615
|
-
const
|
|
5616
|
-
Object.assign(
|
|
5627
|
+
const s = document.createElement("div");
|
|
5628
|
+
Object.assign(s.style, {
|
|
5617
5629
|
position: "absolute",
|
|
5618
5630
|
left: `${i.x}px`,
|
|
5619
5631
|
top: `${i.y}px`,
|
|
@@ -5623,9 +5635,9 @@ class as {
|
|
|
5623
5635
|
transform: "translate(-50%, 0)",
|
|
5624
5636
|
zIndex: "10",
|
|
5625
5637
|
lineHeight: "1"
|
|
5626
|
-
}),
|
|
5627
|
-
|
|
5628
|
-
}), setTimeout(() =>
|
|
5638
|
+
}), s.textContent = t, this.container.appendChild(s), requestAnimationFrame(() => {
|
|
5639
|
+
s.style.transform = "translate(-50%, -80px)", s.style.opacity = "0";
|
|
5640
|
+
}), setTimeout(() => s.remove(), 2e3);
|
|
5629
5641
|
}
|
|
5630
5642
|
destroy() {
|
|
5631
5643
|
this.disable();
|
|
@@ -5642,9 +5654,9 @@ class as {
|
|
|
5642
5654
|
willChange: "transform",
|
|
5643
5655
|
pointerEvents: "none"
|
|
5644
5656
|
});
|
|
5645
|
-
const
|
|
5657
|
+
const s = t.color || "#e74c3c";
|
|
5646
5658
|
i.innerHTML = `
|
|
5647
|
-
<svg width="24" height="24" viewBox="0 0 16 16" fill="${
|
|
5659
|
+
<svg width="24" height="24" viewBox="0 0 16 16" fill="${s}" style="filter:drop-shadow(0 2px 4px rgba(0,0,0,0.4))">
|
|
5648
5660
|
<path d="M0 0l6.5 16L8 9l7-2.5z" stroke="#fff" stroke-width="1"/>
|
|
5649
5661
|
</svg>
|
|
5650
5662
|
<span style="
|
|
@@ -5653,7 +5665,7 @@ class as {
|
|
|
5653
5665
|
font-size:12px;font-weight:700;
|
|
5654
5666
|
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
|
5655
5667
|
color:#fff;white-space:nowrap;
|
|
5656
|
-
background:${
|
|
5668
|
+
background:${s};
|
|
5657
5669
|
box-shadow:0 2px 10px rgba(0,0,0,0.25);
|
|
5658
5670
|
letter-spacing:0.01em;
|
|
5659
5671
|
">${t.name}</span>
|
|
@@ -5667,26 +5679,26 @@ class ls {
|
|
|
5667
5679
|
this.container = null, this.unsubs = [], this.enabled = !1, this.drawMode = !1, this.currentPoints = [], this.currentPath = null, this.lastPoint = null, this.fadeTimers = /* @__PURE__ */ new Map(), this.handlePointerDown = (t) => {
|
|
5668
5680
|
var l, a, c;
|
|
5669
5681
|
t.preventDefault(), (a = (l = t.target) == null ? void 0 : l.setPointerCapture) == null || a.call(l, t.pointerId), this.currentPoints = [{ x: t.clientX, y: t.clientY }], this.lastPoint = { x: t.clientX, y: t.clientY };
|
|
5670
|
-
const i = this.client.state.user,
|
|
5682
|
+
const i = this.client.state.user, s = (i == null ? void 0 : i.color) ?? "#6366f1", r = 2 + (t.pressure > 0 ? t.pressure : 0.5) * 4;
|
|
5671
5683
|
this.currentPath = document.createElementNS(
|
|
5672
5684
|
"http://www.w3.org/2000/svg",
|
|
5673
5685
|
"polyline"
|
|
5674
|
-
), this.currentPath.setAttribute("fill", "none"), this.currentPath.setAttribute("stroke",
|
|
5686
|
+
), this.currentPath.setAttribute("fill", "none"), this.currentPath.setAttribute("stroke", s), this.currentPath.setAttribute("stroke-width", String(r)), this.currentPath.setAttribute("stroke-linecap", "round"), this.currentPath.setAttribute("stroke-linejoin", "round"), this.currentPath.setAttribute(
|
|
5675
5687
|
"points",
|
|
5676
5688
|
`${t.clientX},${t.clientY}`
|
|
5677
5689
|
), (c = this.container) == null || c.appendChild(this.currentPath), document.addEventListener("pointermove", this.handlePointerMove), document.addEventListener("pointerup", this.handlePointerUp);
|
|
5678
5690
|
}, this.handlePointerMove = (t) => {
|
|
5679
5691
|
if (!this.currentPath || !this.lastPoint) return;
|
|
5680
|
-
const i = t.clientX - this.lastPoint.x,
|
|
5681
|
-
if (i * i +
|
|
5692
|
+
const i = t.clientX - this.lastPoint.x, s = t.clientY - this.lastPoint.y;
|
|
5693
|
+
if (i * i + s * s < 4) return;
|
|
5682
5694
|
this.currentPoints.push({ x: t.clientX, y: t.clientY }), this.lastPoint = { x: t.clientX, y: t.clientY };
|
|
5683
5695
|
const o = this.currentPoints.map((r) => `${r.x},${r.y}`).join(" ");
|
|
5684
5696
|
this.currentPath.setAttribute("points", o);
|
|
5685
5697
|
}, this.handlePointerUp = () => {
|
|
5686
5698
|
var t;
|
|
5687
5699
|
if (document.removeEventListener("pointermove", this.handlePointerMove), document.removeEventListener("pointerup", this.handlePointerUp), this.currentPoints.length > 1) {
|
|
5688
|
-
const i = this.client.state.user,
|
|
5689
|
-
this.client.drawStroke(this.currentPoints,
|
|
5700
|
+
const i = this.client.state.user, s = (i == null ? void 0 : i.color) ?? "#6366f1";
|
|
5701
|
+
this.client.drawStroke(this.currentPoints, s, 3), this.currentPath && this.scheduleFade(this.currentPath);
|
|
5690
5702
|
} else
|
|
5691
5703
|
(t = this.currentPath) == null || t.remove();
|
|
5692
5704
|
this.currentPoints = [], this.currentPath = null, this.lastPoint = null;
|
|
@@ -5700,8 +5712,8 @@ class ls {
|
|
|
5700
5712
|
"style",
|
|
5701
5713
|
"position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:9989;"
|
|
5702
5714
|
), document.body.appendChild(this.container), this.unsubs.push(
|
|
5703
|
-
this.client.state.on("draw-stroke", ({ userId: e, points: t, color: i, width:
|
|
5704
|
-
this.renderStroke(t, i,
|
|
5715
|
+
this.client.state.on("draw-stroke", ({ userId: e, points: t, color: i, width: s }) => {
|
|
5716
|
+
this.renderStroke(t, i, s);
|
|
5705
5717
|
})
|
|
5706
5718
|
), this.unsubs.push(
|
|
5707
5719
|
this.client.state.on("draw-clear", ({ userId: e }) => {
|
|
@@ -5727,14 +5739,14 @@ class ls {
|
|
|
5727
5739
|
}
|
|
5728
5740
|
renderStroke(e, t, i) {
|
|
5729
5741
|
if (!this.container || e.length < 2) return;
|
|
5730
|
-
const
|
|
5742
|
+
const s = document.createElementNS(
|
|
5731
5743
|
"http://www.w3.org/2000/svg",
|
|
5732
5744
|
"polyline"
|
|
5733
5745
|
);
|
|
5734
|
-
|
|
5746
|
+
s.setAttribute("fill", "none"), s.setAttribute("stroke", t), s.setAttribute("stroke-width", String(i)), s.setAttribute("stroke-linecap", "round"), s.setAttribute("stroke-linejoin", "round"), s.setAttribute(
|
|
5735
5747
|
"points",
|
|
5736
5748
|
e.map((o) => `${o.x},${o.y}`).join(" ")
|
|
5737
|
-
),
|
|
5749
|
+
), s.style.willChange = "opacity", this.container.appendChild(s), this.scheduleFade(s);
|
|
5738
5750
|
}
|
|
5739
5751
|
scheduleFade(e) {
|
|
5740
5752
|
const t = setTimeout(() => {
|
|
@@ -5745,48 +5757,48 @@ class ls {
|
|
|
5745
5757
|
this.fadeTimers.set(e, t);
|
|
5746
5758
|
}
|
|
5747
5759
|
}
|
|
5748
|
-
function cs(
|
|
5749
|
-
if (!
|
|
5750
|
-
const e =
|
|
5751
|
-
return !
|
|
5752
|
-
startSelector:
|
|
5760
|
+
function cs(n) {
|
|
5761
|
+
if (!n.rangeCount || n.isCollapsed) return null;
|
|
5762
|
+
const e = n.getRangeAt(0), t = e.startContainer, i = e.endContainer, s = ft(t), o = ft(i);
|
|
5763
|
+
return !s || !o ? null : {
|
|
5764
|
+
startSelector: s,
|
|
5753
5765
|
startOffset: e.startOffset,
|
|
5754
5766
|
endSelector: o,
|
|
5755
5767
|
endOffset: e.endOffset
|
|
5756
5768
|
};
|
|
5757
5769
|
}
|
|
5758
|
-
function ds(
|
|
5770
|
+
function ds(n) {
|
|
5759
5771
|
var e, t;
|
|
5760
5772
|
try {
|
|
5761
|
-
const i = gt(
|
|
5762
|
-
if (!i || !
|
|
5763
|
-
const o = document.createRange(), r = i.nodeType === Node.TEXT_NODE ? ((e = i.textContent) == null ? void 0 : e.length) ?? 0 : i.childNodes.length, l =
|
|
5764
|
-
return o.setStart(i, Math.min(
|
|
5773
|
+
const i = gt(n.startSelector), s = gt(n.endSelector);
|
|
5774
|
+
if (!i || !s) return null;
|
|
5775
|
+
const o = document.createRange(), r = i.nodeType === Node.TEXT_NODE ? ((e = i.textContent) == null ? void 0 : e.length) ?? 0 : i.childNodes.length, l = s.nodeType === Node.TEXT_NODE ? ((t = s.textContent) == null ? void 0 : t.length) ?? 0 : s.childNodes.length;
|
|
5776
|
+
return o.setStart(i, Math.min(n.startOffset, r)), o.setEnd(s, Math.min(n.endOffset, l)), o;
|
|
5765
5777
|
} catch {
|
|
5766
5778
|
return null;
|
|
5767
5779
|
}
|
|
5768
5780
|
}
|
|
5769
|
-
function ft(
|
|
5770
|
-
if (
|
|
5771
|
-
const e =
|
|
5781
|
+
function ft(n) {
|
|
5782
|
+
if (n.nodeType === Node.TEXT_NODE) {
|
|
5783
|
+
const e = n.parentElement;
|
|
5772
5784
|
if (!e) return null;
|
|
5773
5785
|
const t = mt(e);
|
|
5774
5786
|
if (!t) return null;
|
|
5775
|
-
const i = Array.from(e.childNodes).indexOf(
|
|
5787
|
+
const i = Array.from(e.childNodes).indexOf(n);
|
|
5776
5788
|
return `${t}::text(${i})`;
|
|
5777
5789
|
}
|
|
5778
|
-
return
|
|
5790
|
+
return n.nodeType === Node.ELEMENT_NODE ? mt(n) : null;
|
|
5779
5791
|
}
|
|
5780
|
-
function mt(
|
|
5781
|
-
if (!
|
|
5782
|
-
if (
|
|
5783
|
-
if (
|
|
5792
|
+
function mt(n) {
|
|
5793
|
+
if (!n || n === document.documentElement) return "html";
|
|
5794
|
+
if (n === document.body) return "body";
|
|
5795
|
+
if (n.id) return `#${CSS.escape(n.id)}`;
|
|
5784
5796
|
const e = [];
|
|
5785
|
-
let t =
|
|
5797
|
+
let t = n, i = 0;
|
|
5786
5798
|
for (; t && t !== document.body && i < 10; ) {
|
|
5787
|
-
const
|
|
5788
|
-
if (!
|
|
5789
|
-
const o = t.tagName.toLowerCase(), r = t.tagName, l = Array.from(
|
|
5799
|
+
const s = t.parentElement;
|
|
5800
|
+
if (!s) break;
|
|
5801
|
+
const o = t.tagName.toLowerCase(), r = t.tagName, l = Array.from(s.children).filter(
|
|
5790
5802
|
(a) => a.tagName === r
|
|
5791
5803
|
);
|
|
5792
5804
|
if (l.length === 1)
|
|
@@ -5795,27 +5807,27 @@ function mt(s) {
|
|
|
5795
5807
|
const a = l.indexOf(t) + 1;
|
|
5796
5808
|
e.unshift(`${o}:nth-of-type(${a})`);
|
|
5797
5809
|
}
|
|
5798
|
-
if (
|
|
5799
|
-
e.unshift(`#${CSS.escape(
|
|
5810
|
+
if (s.id) {
|
|
5811
|
+
e.unshift(`#${CSS.escape(s.id)}`);
|
|
5800
5812
|
break;
|
|
5801
5813
|
}
|
|
5802
|
-
t =
|
|
5814
|
+
t = s, i++;
|
|
5803
5815
|
}
|
|
5804
5816
|
return e.length > 0 ? e.join(" > ") : null;
|
|
5805
5817
|
}
|
|
5806
|
-
function gt(
|
|
5807
|
-
const e =
|
|
5818
|
+
function gt(n) {
|
|
5819
|
+
const e = n.match(/^(.+)::text\((\d+)\)$/);
|
|
5808
5820
|
if (e) {
|
|
5809
5821
|
const t = e[1], i = parseInt(e[2], 10);
|
|
5810
5822
|
try {
|
|
5811
|
-
const
|
|
5812
|
-
return
|
|
5823
|
+
const s = document.querySelector(t);
|
|
5824
|
+
return s ? s.childNodes[i] ?? null : null;
|
|
5813
5825
|
} catch {
|
|
5814
5826
|
return null;
|
|
5815
5827
|
}
|
|
5816
5828
|
}
|
|
5817
5829
|
try {
|
|
5818
|
-
return document.querySelector(
|
|
5830
|
+
return document.querySelector(n);
|
|
5819
5831
|
} catch {
|
|
5820
5832
|
return null;
|
|
5821
5833
|
}
|
|
@@ -5864,13 +5876,13 @@ class hs {
|
|
|
5864
5876
|
if (!this.container) return;
|
|
5865
5877
|
const i = (l = this.client.state.user) == null ? void 0 : l.id;
|
|
5866
5878
|
if (e === i || (this.clearSelection(e), !t)) return;
|
|
5867
|
-
const
|
|
5868
|
-
if (!
|
|
5879
|
+
const s = ds(t);
|
|
5880
|
+
if (!s) return;
|
|
5869
5881
|
const o = this.client.state.presence.find(
|
|
5870
5882
|
(a) => a.user.id === e
|
|
5871
5883
|
), r = (o == null ? void 0 : o.user.color) ?? "#6366f1";
|
|
5872
5884
|
try {
|
|
5873
|
-
const a =
|
|
5885
|
+
const a = s.getClientRects(), c = [];
|
|
5874
5886
|
for (let p = 0; p < a.length; p++) {
|
|
5875
5887
|
const d = a[p], u = document.createElement("div");
|
|
5876
5888
|
Object.assign(u.style, {
|
|
@@ -5903,10 +5915,10 @@ class hs {
|
|
|
5903
5915
|
}
|
|
5904
5916
|
}
|
|
5905
5917
|
}
|
|
5906
|
-
var ps = Object.defineProperty, us = Object.getOwnPropertyDescriptor, qe = (
|
|
5907
|
-
for (var
|
|
5908
|
-
(r =
|
|
5909
|
-
return i &&
|
|
5918
|
+
var ps = Object.defineProperty, us = Object.getOwnPropertyDescriptor, qe = (n, e, t, i) => {
|
|
5919
|
+
for (var s = i > 1 ? void 0 : i ? us(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
5920
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
5921
|
+
return i && s && ps(e, t, s), s;
|
|
5910
5922
|
};
|
|
5911
5923
|
let he = class extends T {
|
|
5912
5924
|
constructor() {
|
|
@@ -5917,8 +5929,8 @@ let he = class extends T {
|
|
|
5917
5929
|
new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
|
|
5918
5930
|
);
|
|
5919
5931
|
}
|
|
5920
|
-
toggle(
|
|
5921
|
-
const e = { ...this.settings, [
|
|
5932
|
+
toggle(n) {
|
|
5933
|
+
const e = { ...this.settings, [n]: !this.settings[n] };
|
|
5922
5934
|
this.dispatchEvent(
|
|
5923
5935
|
new CustomEvent("settings-change", {
|
|
5924
5936
|
detail: e,
|
|
@@ -5927,10 +5939,10 @@ let he = class extends T {
|
|
|
5927
5939
|
})
|
|
5928
5940
|
);
|
|
5929
5941
|
}
|
|
5930
|
-
renderToggle(
|
|
5942
|
+
renderToggle(n, e) {
|
|
5931
5943
|
return h`
|
|
5932
5944
|
<div class="setting-row">
|
|
5933
|
-
<span class="setting-label">${
|
|
5945
|
+
<span class="setting-label">${n}</span>
|
|
5934
5946
|
<label class="toggle">
|
|
5935
5947
|
<input
|
|
5936
5948
|
type="checkbox"
|
|
@@ -5943,7 +5955,7 @@ let he = class extends T {
|
|
|
5943
5955
|
`;
|
|
5944
5956
|
}
|
|
5945
5957
|
render() {
|
|
5946
|
-
const
|
|
5958
|
+
const n = !this.settings.enabled;
|
|
5947
5959
|
return h`
|
|
5948
5960
|
<div class="panel">
|
|
5949
5961
|
<div class="panel-header">
|
|
@@ -5968,7 +5980,7 @@ let he = class extends T {
|
|
|
5968
5980
|
</label>
|
|
5969
5981
|
</div>
|
|
5970
5982
|
|
|
5971
|
-
<div class="panel-body pw-scrollable ${
|
|
5983
|
+
<div class="panel-body pw-scrollable ${n ? "settings-disabled" : ""}">
|
|
5972
5984
|
<div class="section-label">Cursors</div>
|
|
5973
5985
|
${this.renderToggle("Show my cursor to others", "showMyCursor")}
|
|
5974
5986
|
${this.renderToggle("Show others' cursors", "showOthersCursors")}
|
|
@@ -6190,21 +6202,21 @@ const ye = {
|
|
|
6190
6202
|
showSelections: !0,
|
|
6191
6203
|
showDrawings: !0
|
|
6192
6204
|
}, St = "pulse:settings:";
|
|
6193
|
-
function fs(
|
|
6205
|
+
function fs(n) {
|
|
6194
6206
|
try {
|
|
6195
|
-
const e = localStorage.getItem(`${St}${
|
|
6207
|
+
const e = localStorage.getItem(`${St}${n}`);
|
|
6196
6208
|
return e ? { ...ye, ...JSON.parse(e) } : { ...ye };
|
|
6197
6209
|
} catch {
|
|
6198
6210
|
return { ...ye };
|
|
6199
6211
|
}
|
|
6200
6212
|
}
|
|
6201
|
-
function ms(
|
|
6202
|
-
localStorage.setItem(`${St}${
|
|
6213
|
+
function ms(n, e) {
|
|
6214
|
+
localStorage.setItem(`${St}${n}`, JSON.stringify(e));
|
|
6203
6215
|
}
|
|
6204
|
-
var gs = Object.defineProperty, bs = Object.getOwnPropertyDescriptor, L = (
|
|
6205
|
-
for (var
|
|
6206
|
-
(r =
|
|
6207
|
-
return i &&
|
|
6216
|
+
var gs = Object.defineProperty, bs = Object.getOwnPropertyDescriptor, L = (n, e, t, i) => {
|
|
6217
|
+
for (var s = i > 1 ? void 0 : i ? bs(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
6218
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
6219
|
+
return i && s && gs(e, t, s), s;
|
|
6208
6220
|
};
|
|
6209
6221
|
let M = class extends T {
|
|
6210
6222
|
constructor() {
|
|
@@ -6214,36 +6226,36 @@ let M = class extends T {
|
|
|
6214
6226
|
super.connectedCallback(), this.setupPresence();
|
|
6215
6227
|
}
|
|
6216
6228
|
disconnectedCallback() {
|
|
6217
|
-
var
|
|
6218
|
-
super.disconnectedCallback(), (
|
|
6229
|
+
var n, e;
|
|
6230
|
+
super.disconnectedCallback(), (n = this.unsub) == null || n.call(this), (e = this.notifUnsub) == null || e.call(this);
|
|
6219
6231
|
}
|
|
6220
|
-
updated(
|
|
6232
|
+
updated(n) {
|
|
6221
6233
|
var e, t;
|
|
6222
|
-
|
|
6234
|
+
n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), (t = this.notifUnsub) == null || t.call(this), this.setupPresence());
|
|
6223
6235
|
}
|
|
6224
6236
|
setupPresence() {
|
|
6225
|
-
this.client && (this.users = this.client.state.presence, this.unreadCount = this.client.state.unreadCount, this.unsub = this.client.state.on("presence", (
|
|
6226
|
-
this.users =
|
|
6237
|
+
this.client && (this.users = this.client.state.presence, this.unreadCount = this.client.state.unreadCount, this.unsub = this.client.state.on("presence", (n) => {
|
|
6238
|
+
this.users = n;
|
|
6227
6239
|
}), this.notifUnsub = this.client.state.on("notifications", () => {
|
|
6228
6240
|
this.unreadCount = this.client.state.unreadCount;
|
|
6229
6241
|
}));
|
|
6230
6242
|
}
|
|
6231
|
-
getInitials(
|
|
6232
|
-
return
|
|
6243
|
+
getInitials(n) {
|
|
6244
|
+
return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
6233
6245
|
}
|
|
6234
|
-
fire(
|
|
6246
|
+
fire(n) {
|
|
6235
6247
|
this.dispatchEvent(
|
|
6236
6248
|
new CustomEvent("toolbar-action", {
|
|
6237
|
-
detail:
|
|
6249
|
+
detail: n,
|
|
6238
6250
|
bubbles: !0,
|
|
6239
6251
|
composed: !0
|
|
6240
6252
|
})
|
|
6241
6253
|
);
|
|
6242
6254
|
}
|
|
6243
|
-
fireFollow(
|
|
6255
|
+
fireFollow(n) {
|
|
6244
6256
|
this.dispatchEvent(
|
|
6245
6257
|
new CustomEvent("toolbar-follow", {
|
|
6246
|
-
detail:
|
|
6258
|
+
detail: n,
|
|
6247
6259
|
bubbles: !0,
|
|
6248
6260
|
composed: !0
|
|
6249
6261
|
})
|
|
@@ -6255,16 +6267,16 @@ let M = class extends T {
|
|
|
6255
6267
|
);
|
|
6256
6268
|
}
|
|
6257
6269
|
render() {
|
|
6258
|
-
const
|
|
6270
|
+
const n = this.display === "inline";
|
|
6259
6271
|
if (this.collapsed)
|
|
6260
6272
|
return h`
|
|
6261
|
-
<div class="toolbar collapsed ${
|
|
6262
|
-
<span class="fab-icon">${k(Ri,
|
|
6273
|
+
<div class="toolbar collapsed ${n ? "inline" : ""}" @click=${this.fireToggle}>
|
|
6274
|
+
<span class="fab-icon">${k(Ri, n ? 18 : 24)}</span>
|
|
6263
6275
|
</div>
|
|
6264
6276
|
`;
|
|
6265
6277
|
const e = this.users.slice(0, 3), t = this.users.length - 3;
|
|
6266
6278
|
return h`
|
|
6267
|
-
<div class="toolbar ${
|
|
6279
|
+
<div class="toolbar ${n ? "inline" : ""}"
|
|
6268
6280
|
<!-- Presence avatars -->
|
|
6269
6281
|
${this.users.length > 0 ? h`
|
|
6270
6282
|
<div class="presence">
|
|
@@ -6652,9 +6664,9 @@ class vs {
|
|
|
6652
6664
|
this.pillEls.clear();
|
|
6653
6665
|
return;
|
|
6654
6666
|
}
|
|
6655
|
-
const e = window.scrollY, t = window.innerHeight, i = document.documentElement.scrollHeight,
|
|
6667
|
+
const e = window.scrollY, t = window.innerHeight, i = document.documentElement.scrollHeight, s = (r = this.client.state.user) == null ? void 0 : r.id, o = /* @__PURE__ */ new Set();
|
|
6656
6668
|
for (const [l, a] of this.client.state.viewports) {
|
|
6657
|
-
if (l ===
|
|
6669
|
+
if (l === s) continue;
|
|
6658
6670
|
const c = a.scrollY, p = a.scrollY + a.viewportHeight, d = e, u = e + t;
|
|
6659
6671
|
if (c >= d && p <= u) {
|
|
6660
6672
|
const $ = this.pillEls.get(l);
|
|
@@ -6692,17 +6704,17 @@ class vs {
|
|
|
6692
6704
|
return e.split(" ").map((t) => t[0]).join("").toUpperCase().slice(0, 2);
|
|
6693
6705
|
}
|
|
6694
6706
|
}
|
|
6695
|
-
var xs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, S = (
|
|
6696
|
-
for (var
|
|
6697
|
-
(r =
|
|
6698
|
-
return i &&
|
|
6707
|
+
var xs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, S = (n, e, t, i) => {
|
|
6708
|
+
for (var s = i > 1 ? void 0 : i ? ys(e, t) : e, o = n.length - 1, r; o >= 0; o--)
|
|
6709
|
+
(r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
|
|
6710
|
+
return i && s && xs(e, t, s), s;
|
|
6699
6711
|
};
|
|
6700
6712
|
let E = class extends T {
|
|
6701
6713
|
constructor() {
|
|
6702
6714
|
super(...arguments), this.apiKey = "", this.token = "", this.room = "", this.position = "bottom-right", this.display = "floating", this.collapsed = !0, this.activePanel = null, this.pinModeActive = !1, this.highlightThreadId = null, this.settings = { ...ye }, this.followingUserId = null, this.drawModeActive = !1, this.connectionState = "disconnected", this.showConnectedFlash = !1, this.unsubs = [], this.clientConfigKey = "", this._isFollowScrolling = !1, this._viewportThrottleTimer = null, this._selectionThrottleTimer = null, this._connectedFlashTimer = null, this._wasDisconnected = !1, this.handleScroll = () => {
|
|
6703
6715
|
!this.settings.enabled || !this.client || this._isFollowScrolling || (this.followingUserId && (this.followingUserId = null), !this._viewportThrottleTimer && (this._viewportThrottleTimer = setTimeout(() => {
|
|
6704
|
-
var
|
|
6705
|
-
this._viewportThrottleTimer = null, (
|
|
6716
|
+
var n;
|
|
6717
|
+
this._viewportThrottleTimer = null, (n = this.client) == null || n.updateViewport({
|
|
6706
6718
|
scrollX: window.scrollX,
|
|
6707
6719
|
scrollY: window.scrollY,
|
|
6708
6720
|
viewportWidth: window.innerWidth,
|
|
@@ -6715,25 +6727,25 @@ let E = class extends T {
|
|
|
6715
6727
|
!this.settings.enabled || !this.settings.showSelections || !this.client || this._selectionThrottleTimer || (this._selectionThrottleTimer = setTimeout(() => {
|
|
6716
6728
|
var t, i;
|
|
6717
6729
|
this._selectionThrottleTimer = null;
|
|
6718
|
-
const
|
|
6719
|
-
if (!
|
|
6730
|
+
const n = window.getSelection();
|
|
6731
|
+
if (!n || n.isCollapsed) {
|
|
6720
6732
|
(t = this.client) == null || t.updateSelection(null);
|
|
6721
6733
|
return;
|
|
6722
6734
|
}
|
|
6723
|
-
const e = cs(
|
|
6735
|
+
const e = cs(n);
|
|
6724
6736
|
(i = this.client) == null || i.updateSelection(e);
|
|
6725
6737
|
}, 500));
|
|
6726
|
-
}, this.handleDocumentClick = (
|
|
6738
|
+
}, this.handleDocumentClick = (n) => {
|
|
6727
6739
|
var e;
|
|
6728
|
-
this.settings.enabled && this.settings.showMyClicks && (this.contains(
|
|
6729
|
-
x:
|
|
6730
|
-
y:
|
|
6731
|
-
pageX:
|
|
6732
|
-
pageY:
|
|
6740
|
+
this.settings.enabled && this.settings.showMyClicks && (this.contains(n.target) || (e = this.client) == null || e.performClick({
|
|
6741
|
+
x: n.clientX,
|
|
6742
|
+
y: n.clientY,
|
|
6743
|
+
pageX: n.pageX,
|
|
6744
|
+
pageY: n.pageY
|
|
6733
6745
|
}));
|
|
6734
|
-
}, this.handleKeydown = (
|
|
6746
|
+
}, this.handleKeydown = (n) => {
|
|
6735
6747
|
var e, t;
|
|
6736
|
-
|
|
6748
|
+
n.key === "Escape" && (this.drawModeActive ? ((e = this.drawingOverlay) == null || e.disableDrawMode(), this.drawModeActive = !1) : this.followingUserId ? this.followingUserId = null : this.pinModeActive ? ((t = this.commentPins) == null || t.exitPinMode(), this.pinModeActive = !1) : this.activePanel && (this.activePanel = null, this.highlightThreadId = null));
|
|
6737
6749
|
};
|
|
6738
6750
|
}
|
|
6739
6751
|
connectedCallback() {
|
|
@@ -6746,13 +6758,13 @@ let E = class extends T {
|
|
|
6746
6758
|
return `${this.apiKey}\0${this.token}\0${this.room}\0${this.endpoint ?? ""}`;
|
|
6747
6759
|
}
|
|
6748
6760
|
initClient() {
|
|
6749
|
-
const
|
|
6761
|
+
const n = {
|
|
6750
6762
|
apiKey: this.apiKey,
|
|
6751
6763
|
token: this.token,
|
|
6752
6764
|
room: this.room,
|
|
6753
6765
|
endpoint: this.endpoint
|
|
6754
6766
|
};
|
|
6755
|
-
this.client = new xt(
|
|
6767
|
+
this.client = new xt(n), this.clientConfigKey = this.getConfigKey(), this.cursorOverlay = new as(this.client), this.commentPins = new Ji(this.client, {
|
|
6756
6768
|
onPinModeExit: () => {
|
|
6757
6769
|
this.pinModeActive = !1;
|
|
6758
6770
|
}
|
|
@@ -6786,15 +6798,15 @@ let E = class extends T {
|
|
|
6786
6798
|
), window.addEventListener("scroll", this.handleScroll), document.addEventListener("selectionchange", this.handleSelectionChange), this.client.connect();
|
|
6787
6799
|
}
|
|
6788
6800
|
teardownClient() {
|
|
6789
|
-
var
|
|
6790
|
-
this.unsubs.forEach((r) => r()), this.unsubs = [], window.removeEventListener("scroll", this.handleScroll), document.removeEventListener("selectionchange", this.handleSelectionChange), this._viewportThrottleTimer && (clearTimeout(this._viewportThrottleTimer), this._viewportThrottleTimer = null), this._selectionThrottleTimer && (clearTimeout(this._selectionThrottleTimer), this._selectionThrottleTimer = null), (
|
|
6801
|
+
var n, e, t, i, s, o;
|
|
6802
|
+
this.unsubs.forEach((r) => r()), this.unsubs = [], window.removeEventListener("scroll", this.handleScroll), document.removeEventListener("selectionchange", this.handleSelectionChange), this._viewportThrottleTimer && (clearTimeout(this._viewportThrottleTimer), this._viewportThrottleTimer = null), this._selectionThrottleTimer && (clearTimeout(this._selectionThrottleTimer), this._selectionThrottleTimer = null), (n = this.cursorOverlay) == null || n.destroy(), (e = this.commentPins) == null || e.destroy(), (t = this.viewportOverlay) == null || t.destroy(), (i = this.selectionOverlay) == null || i.destroy(), (s = this.drawingOverlay) == null || s.destroy(), (o = this.client) == null || o.disconnect(), this.client = void 0, this.cursorOverlay = void 0, this.commentPins = void 0, this.viewportOverlay = void 0, this.selectionOverlay = void 0, this.drawingOverlay = void 0, this.clientConfigKey = "", this.followingUserId = null, this.drawModeActive = !1, this.connectionState = "disconnected", this.showConnectedFlash = !1, this._wasDisconnected = !1, this._connectedFlashTimer && (clearTimeout(this._connectedFlashTimer), this._connectedFlashTimer = null);
|
|
6791
6803
|
}
|
|
6792
6804
|
handlePanelClose() {
|
|
6793
6805
|
this.activePanel = null, this.highlightThreadId = null;
|
|
6794
6806
|
}
|
|
6795
|
-
handleToolbarAction(
|
|
6796
|
-
var t, i,
|
|
6797
|
-
const e =
|
|
6807
|
+
handleToolbarAction(n) {
|
|
6808
|
+
var t, i, s, o;
|
|
6809
|
+
const e = n.detail;
|
|
6798
6810
|
if (!(!this.settings.enabled && e !== "settings"))
|
|
6799
6811
|
switch (e) {
|
|
6800
6812
|
case "comments":
|
|
@@ -6813,32 +6825,32 @@ let E = class extends T {
|
|
|
6813
6825
|
this.pinModeActive = !this.pinModeActive, this.pinModeActive ? (t = this.commentPins) == null || t.enterPinMode() : (i = this.commentPins) == null || i.exitPinMode();
|
|
6814
6826
|
break;
|
|
6815
6827
|
case "draw-mode":
|
|
6816
|
-
this.drawModeActive = !this.drawModeActive, this.drawModeActive ? (
|
|
6828
|
+
this.drawModeActive = !this.drawModeActive, this.drawModeActive ? (s = this.drawingOverlay) == null || s.enableDrawMode() : (o = this.drawingOverlay) == null || o.disableDrawMode();
|
|
6817
6829
|
break;
|
|
6818
6830
|
}
|
|
6819
6831
|
}
|
|
6820
|
-
handleFollow(
|
|
6821
|
-
const e =
|
|
6832
|
+
handleFollow(n) {
|
|
6833
|
+
const e = n.detail;
|
|
6822
6834
|
this.followingUserId === e ? this.followingUserId = null : this.followingUserId = e;
|
|
6823
6835
|
}
|
|
6824
|
-
handleSettingsChange(
|
|
6825
|
-
const e =
|
|
6836
|
+
handleSettingsChange(n) {
|
|
6837
|
+
const e = n.detail;
|
|
6826
6838
|
this.settings = e, ms(this.room, e), this.applySettings(e);
|
|
6827
6839
|
}
|
|
6828
|
-
applySettings(
|
|
6829
|
-
var e, t, i,
|
|
6830
|
-
if (!
|
|
6831
|
-
(e = this.cursorOverlay) == null || e.disable(), (t = this.viewportOverlay) == null || t.disable(), (i = this.selectionOverlay) == null || i.disable(), (
|
|
6840
|
+
applySettings(n) {
|
|
6841
|
+
var e, t, i, s, o, r, l, a, c, p, d, u, m, b, I, C, w;
|
|
6842
|
+
if (!n.enabled) {
|
|
6843
|
+
(e = this.cursorOverlay) == null || e.disable(), (t = this.viewportOverlay) == null || t.disable(), (i = this.selectionOverlay) == null || i.disable(), (s = this.drawingOverlay) == null || s.disable(), this.drawModeActive && ((o = this.drawingOverlay) == null || o.disableDrawMode(), this.drawModeActive = !1), (r = this.client) == null || r.setAppearOffline(!0), (l = this.commentPins) == null || l.setVisible(!1), this.followingUserId = null, this.pinModeActive && ((a = this.commentPins) == null || a.exitPinMode(), this.pinModeActive = !1), this.activePanel = this.activePanel === "settings" ? "settings" : null, this.highlightThreadId = null;
|
|
6832
6844
|
return;
|
|
6833
6845
|
}
|
|
6834
|
-
this.applyCursorSettings(
|
|
6846
|
+
this.applyCursorSettings(n), (c = this.client) == null || c.setAppearOffline(n.appearOffline), (p = this.commentPins) == null || p.setVisible(n.showCommentPins), n.showViewportIndicators ? (d = this.viewportOverlay) == null || d.enable() : (u = this.viewportOverlay) == null || u.disable(), n.showSelections ? (m = this.selectionOverlay) == null || m.enable() : (b = this.selectionOverlay) == null || b.disable(), n.showDrawings ? (I = this.drawingOverlay) == null || I.enable() : ((C = this.drawingOverlay) == null || C.disable(), this.drawModeActive && ((w = this.drawingOverlay) == null || w.disableDrawMode(), this.drawModeActive = !1));
|
|
6835
6847
|
}
|
|
6836
|
-
applyCursorSettings(
|
|
6848
|
+
applyCursorSettings(n) {
|
|
6837
6849
|
if (!this.cursorOverlay) return;
|
|
6838
|
-
|
|
6850
|
+
n.showMyCursor || n.showOthersCursors ? (this.cursorOverlay.enable(), this.cursorOverlay.setSending(n.showMyCursor), this.cursorOverlay.setReceiving(n.showOthersCursors)) : this.cursorOverlay.disable();
|
|
6839
6851
|
}
|
|
6840
|
-
updated(
|
|
6841
|
-
(
|
|
6852
|
+
updated(n) {
|
|
6853
|
+
(n.has("room") || n.has("token") || n.has("apiKey") || n.has("endpoint")) && this.apiKey && this.token && this.room && this.getConfigKey() !== this.clientConfigKey && (this.teardownClient(), this.initClient(), this.activePanel = null, this.highlightThreadId = null, this.pinModeActive = !1), (n.has("activePanel") || n.has("collapsed")) && requestAnimationFrame(() => this.positionPopups());
|
|
6842
6854
|
}
|
|
6843
6855
|
/**
|
|
6844
6856
|
* Smart-position all fixed popups (toolbar popover + panel) relative to
|
|
@@ -6846,12 +6858,12 @@ let E = class extends T {
|
|
|
6846
6858
|
*/
|
|
6847
6859
|
positionPopups() {
|
|
6848
6860
|
var b, I, C, w;
|
|
6849
|
-
const
|
|
6861
|
+
const n = this.display === "inline", e = (b = this.shadowRoot) == null ? void 0 : b.querySelector(".inline-trigger"), t = (I = this.shadowRoot) == null ? void 0 : I.querySelector("pulse-widget-toolbar"), i = n ? e : t;
|
|
6850
6862
|
if (!i) return;
|
|
6851
|
-
const
|
|
6863
|
+
const s = i.getBoundingClientRect(), o = window.innerWidth, r = window.innerHeight, l = 8, a = (C = this.shadowRoot) == null ? void 0 : C.querySelector(".toolbar-popover");
|
|
6852
6864
|
if (a) {
|
|
6853
6865
|
Object.assign(a.style, { top: "auto", left: "auto" });
|
|
6854
|
-
const $ = a.getBoundingClientRect(), P = this.computePosition(
|
|
6866
|
+
const $ = a.getBoundingClientRect(), P = this.computePosition(s, $, o, r, l);
|
|
6855
6867
|
a.style.top = `${P.top}px`, a.style.left = `${P.left}px`;
|
|
6856
6868
|
}
|
|
6857
6869
|
const c = (w = this.shadowRoot) == null ? void 0 : w.querySelector(".panel-container");
|
|
@@ -6862,21 +6874,21 @@ let E = class extends T {
|
|
|
6862
6874
|
const d = p.getBoundingClientRect(), u = c.getBoundingClientRect(), m = this.computePosition(d, u, o, r, l);
|
|
6863
6875
|
c.style.top = `${m.top}px`, c.style.left = `${m.left}px`;
|
|
6864
6876
|
}
|
|
6865
|
-
computePosition(
|
|
6866
|
-
const o =
|
|
6877
|
+
computePosition(n, e, t, i, s) {
|
|
6878
|
+
const o = n.top, r = i - n.bottom;
|
|
6867
6879
|
let l;
|
|
6868
|
-
o >= e.height +
|
|
6880
|
+
o >= e.height + s ? l = n.top - e.height - s : r >= e.height + s ? l = n.bottom + s : l = o >= r ? Math.max(s, n.top - e.height - s) : n.bottom + s;
|
|
6869
6881
|
let a;
|
|
6870
|
-
const c =
|
|
6871
|
-
return c >=
|
|
6882
|
+
const c = n.right - e.width;
|
|
6883
|
+
return c >= s ? a = c : n.left + e.width + s <= t ? a = n.left : a = Math.max(s, Math.min(t - e.width - s, n.left)), l = Math.max(s, Math.min(i - e.height - s, l)), a = Math.max(s, Math.min(t - e.width - s, a)), { top: l, left: a };
|
|
6872
6884
|
}
|
|
6873
6885
|
getFollowUserName() {
|
|
6874
6886
|
var e;
|
|
6875
6887
|
if (!this.followingUserId) return "";
|
|
6876
|
-
const
|
|
6888
|
+
const n = (e = this.client) == null ? void 0 : e.state.presence.find(
|
|
6877
6889
|
(t) => t.user.id === this.followingUserId
|
|
6878
6890
|
);
|
|
6879
|
-
return (
|
|
6891
|
+
return (n == null ? void 0 : n.user.name) ?? "user";
|
|
6880
6892
|
}
|
|
6881
6893
|
renderConnectionBanner() {
|
|
6882
6894
|
return this.showConnectedFlash ? h`<div class="connection-banner connected">
|
|
@@ -6891,8 +6903,8 @@ let E = class extends T {
|
|
|
6891
6903
|
this.collapsed = !this.collapsed, this.collapsed && (this.activePanel = null, this.highlightThreadId = null);
|
|
6892
6904
|
}
|
|
6893
6905
|
render() {
|
|
6894
|
-
const
|
|
6895
|
-
if (
|
|
6906
|
+
const n = this.display === "inline";
|
|
6907
|
+
if (n && this.collapsed)
|
|
6896
6908
|
return h`
|
|
6897
6909
|
<div class="widget-root">
|
|
6898
6910
|
<div class="inline-trigger" @click=${this.handleToolbarToggle}>
|
|
@@ -6924,7 +6936,7 @@ let E = class extends T {
|
|
|
6924
6936
|
this.followingUserId = null;
|
|
6925
6937
|
}}>Stop</button>
|
|
6926
6938
|
</div>` : f;
|
|
6927
|
-
return
|
|
6939
|
+
return n ? h`
|
|
6928
6940
|
${t}
|
|
6929
6941
|
<div class="widget-root">
|
|
6930
6942
|
<div class="inline-trigger" @click=${this.handleToolbarToggle}>
|