@gamention/pulse-elements 0.1.10 → 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.
@@ -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, n) {
8
- super("context-request", { bubbles: !0, composed: !0 }), this.context = e, this.contextTarget = t, this.callback = i, this.subscribe = n ?? !1;
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, n) {
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 = n ?? !1;
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: n } = this.subscriptions.get(e);
68
- e(this.value, n);
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 n, o;
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 = (n = this.host).addController) == null || o.call(n, this);
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: s }) {
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(n) {
115
- return i.get(this).setValue(n), e.set.call(this, n);
116
- }, init(n) {
117
- return i.set(this, new Xe(this, { context: s, initialValue: n })), n;
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: s }));
121
+ i.set(r, new Xe(r, { context: n }));
122
122
  }));
123
- const n = Object.getOwnPropertyDescriptor(e, t);
123
+ const s = Object.getOwnPropertyDescriptor(e, t);
124
124
  let o;
125
- if (n === void 0) {
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 = n.set;
134
- o = { ...n, set(l) {
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,24 +144,24 @@ function Mt({ context: s }) {
144
144
  * Copyright 2022 Google LLC
145
145
  * SPDX-License-Identifier: BSD-3-Clause
146
146
  */
147
- function pe({ context: s, subscribe: e }) {
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: s, callback: (n) => {
151
- t.set.call(this, n);
150
+ new We(this, { context: n, callback: (s) => {
151
+ t.set.call(this, s);
152
152
  }, subscribe: e });
153
- })) : t.constructor.addInitializer(((n) => {
154
- new We(n, { context: s, callback: (o) => {
155
- n[i] = o;
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 = (s, e, t) => e in s ? Ot(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, y = (s, e, t) => Rt(s, typeof e != "symbol" ? e + "" : e, t);
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() {
164
- y(this, "handlers", /* @__PURE__ */ new Map());
164
+ x(this, "handlers", /* @__PURE__ */ new Map());
165
165
  }
166
166
  on(e, t) {
167
167
  this.handlers.has(e) || this.handlers.set(e, /* @__PURE__ */ new Set());
@@ -174,14 +174,14 @@ let je = class {
174
174
  }
175
175
  emit(e, t) {
176
176
  var i;
177
- (i = this.handlers.get(e)) == null || i.forEach((n) => n(t));
177
+ (i = this.handlers.get(e)) == null || i.forEach((s) => s(t));
178
178
  }
179
179
  removeAll() {
180
180
  this.handlers.clear();
181
181
  }
182
182
  }, jt = class extends je {
183
183
  constructor(e) {
184
- super(), y(this, "ws", null), y(this, "endpoint"), y(this, "reconnectAttempt", 0), y(this, "reconnectTimer", null), y(this, "_state", "disconnected"), this.endpoint = e ?? Lt;
184
+ super(), x(this, "ws", null), x(this, "endpoint"), x(this, "reconnectAttempt", 0), x(this, "reconnectTimer", null), x(this, "_state", "disconnected"), this.endpoint = e ?? Lt;
185
185
  }
186
186
  get state() {
187
187
  return this._state;
@@ -216,13 +216,23 @@ let je = class {
216
216
  this.reconnectTimer = null, this.connect();
217
217
  }, e);
218
218
  }
219
- }, zt = class extends je {
219
+ }, Ut = class extends je {
220
220
  constructor() {
221
- super(...arguments), y(this, "_user", null), y(this, "_users", /* @__PURE__ */ new Map()), y(this, "_presence", /* @__PURE__ */ new Map()), y(this, "_threads", /* @__PURE__ */ new Map()), y(this, "_reactions", /* @__PURE__ */ new Map()), y(this, "_notifications", []), y(this, "_activityLogs", []), y(this, "_typing", /* @__PURE__ */ new Map()), y(this, "_viewports", /* @__PURE__ */ new Map()), y(this, "_selections", /* @__PURE__ */ new Map());
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(), n = [];
260
+ const i = Date.now(), s = [];
251
261
  for (const [o, r] of t)
252
- i - r < 3e3 && n.push(o);
253
- return n;
262
+ i - r < 3e3 && s.push(o);
263
+ return s;
254
264
  }
255
265
  get viewports() {
256
266
  return this._viewports;
@@ -261,6 +271,26 @@ let je = class {
261
271
  get selections() {
262
272
  return this._selections;
263
273
  }
274
+ /** Resolve a relative URL to absolute using baseUrl. */
275
+ resolveUrl(e) {
276
+ return !this.baseUrl || !e || e.startsWith("http://") || e.startsWith("https://") ? e : `${this.baseUrl}${e}`;
277
+ }
278
+ resolveAttachments(e) {
279
+ return e.map((t) => ({
280
+ ...t,
281
+ url: this.resolveUrl(t.url),
282
+ thumbnailUrl: t.thumbnailUrl ? this.resolveUrl(t.thumbnailUrl) : void 0
283
+ }));
284
+ }
285
+ resolveComment(e) {
286
+ return !e.attachments || e.attachments.length === 0 ? e : { ...e, attachments: this.resolveAttachments(e.attachments) };
287
+ }
288
+ resolveThread(e) {
289
+ return {
290
+ ...e,
291
+ comments: e.comments.map((t) => this.resolveComment(t))
292
+ };
293
+ }
264
294
  handleMessage(e) {
265
295
  switch (e.type) {
266
296
  case "auth:ok":
@@ -270,7 +300,7 @@ let je = class {
270
300
  for (const t of e.presence)
271
301
  this._presence.set(t.user.id, t), this._users.set(t.user.id, t.user);
272
302
  this._users.set(e.user.id, e.user), this._threads.clear();
273
- for (const t of e.threads) this._threads.set(t.id, t);
303
+ for (const t of e.threads) this._threads.set(t.id, this.resolveThread(t));
274
304
  this._notifications = e.notifications, this._reactions.clear();
275
305
  for (const t of e.reactions) {
276
306
  const i = this._reactions.get(t.targetId) ?? [];
@@ -299,18 +329,18 @@ let je = class {
299
329
  this.emit("click", { userId: e.userId, position: e.position });
300
330
  break;
301
331
  case "thread:created":
302
- this._threads.set(e.thread.id, e.thread), this.emit("threads", this.threads);
332
+ this._threads.set(e.thread.id, this.resolveThread(e.thread)), this.emit("threads", this.threads);
303
333
  break;
304
334
  case "comment:created": {
305
335
  const t = this._threads.get(e.threadId);
306
- t && (t.comments.push(e.comment), t.updatedAt = e.comment.createdAt, this.emit("threads", this.threads));
336
+ t && (t.comments.push(this.resolveComment(e.comment)), t.updatedAt = e.comment.createdAt, this.emit("threads", this.threads));
307
337
  break;
308
338
  }
309
339
  case "comment:edited": {
310
340
  const t = this._threads.get(e.threadId);
311
341
  if (t) {
312
- const i = t.comments.findIndex((n) => n.id === e.comment.id);
313
- i !== -1 && (t.comments[i] = e.comment), this.emit("threads", this.threads);
342
+ const i = t.comments.findIndex((s) => s.id === e.comment.id);
343
+ i !== -1 && (t.comments[i] = this.resolveComment(e.comment)), this.emit("threads", this.threads);
314
344
  }
315
345
  break;
316
346
  }
@@ -338,7 +368,7 @@ let je = class {
338
368
  case "reaction:removed": {
339
369
  const t = this._reactions.get(e.targetId);
340
370
  if (t) {
341
- const i = t.filter((n) => n.id !== e.reactionId);
371
+ const i = t.filter((s) => s.id !== e.reactionId);
342
372
  this._reactions.set(e.targetId, i), this.emit("reactions", {
343
373
  targetId: e.targetId,
344
374
  reactions: i
@@ -399,12 +429,12 @@ let je = class {
399
429
  }, xt = class extends je {
400
430
  constructor(e) {
401
431
  var t;
402
- super(), y(this, "state"), y(this, "connection"), y(this, "config"), y(this, "heartbeatTimer", null), y(this, "lastCursorSend", 0), y(this, "pendingCursor", null), y(this, "cursorTimer", null), this.config = e, this.state = new zt();
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(/\/$/, "");
403
433
  const i = ((t = e.endpoint) == null ? void 0 : t.replace(/^http/, "ws")) ?? void 0;
404
- this.connection = new jt(i), this.connection.on("message", (n) => {
405
- this.state.handleMessage(n), this.emit(n.type, n);
406
- }), this.connection.on("state", (n) => {
407
- this.emit("connection", n), n === "connected" ? (this.authenticate(), this.startHeartbeat()) : n === "disconnected" && this.stopHeartbeat();
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();
408
438
  });
409
439
  }
410
440
  /** Current WebSocket connection state. */
@@ -462,15 +492,15 @@ let je = class {
462
492
  attachmentIds: t.attachmentIds
463
493
  }), i;
464
494
  }
465
- reply(e, t, i = [], n) {
495
+ reply(e, t, i = [], s) {
466
496
  const o = crypto.randomUUID();
467
- return this.send({ type: "comment:create", threadId: e, id: o, body: t, mentions: i, attachmentIds: n }), o;
497
+ return this.send({ type: "comment:create", threadId: e, id: o, body: t, mentions: i, attachmentIds: s }), o;
468
498
  }
469
499
  editComment(e, t, i = []) {
470
500
  this.send({ type: "comment:edit", commentId: e, body: t, mentions: i });
471
501
  }
472
502
  deleteComment(e) {
473
- this.send({ type: "comment:delete", commentId: e });
503
+ this.state.removeComment(e), this.send({ type: "comment:delete", commentId: e });
474
504
  }
475
505
  resolveThread(e, t = !0) {
476
506
  this.send({ type: "thread:resolve", threadId: e, resolved: t });
@@ -520,7 +550,7 @@ let je = class {
520
550
  async uploadFile(e) {
521
551
  const t = (this.config.endpoint ?? window.location.origin).replace(/^ws(s?):/, "http$1:"), i = new FormData();
522
552
  i.append("file", e);
523
- const n = await fetch(`${t}/api/v1/upload`, {
553
+ const s = await fetch(`${t}/api/v1/upload`, {
524
554
  method: "POST",
525
555
  headers: {
526
556
  "X-Pulse-Key": this.config.apiKey,
@@ -528,11 +558,12 @@ let je = class {
528
558
  },
529
559
  body: i
530
560
  });
531
- if (!n.ok) {
532
- const o = await n.json().catch(() => ({ error: "Upload failed" }));
533
- throw new Error(o.error ?? "Upload failed");
561
+ if (!s.ok) {
562
+ const r = await s.json().catch(() => ({ error: "Upload failed" }));
563
+ throw new Error(r.error ?? "Upload failed");
534
564
  }
535
- return n.json();
565
+ const o = await s.json();
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;
536
567
  }
537
568
  // ── Presence control ──
538
569
  setAppearOffline(e) {
@@ -544,16 +575,16 @@ let je = class {
544
575
  * Copyright 2019 Google LLC
545
576
  * SPDX-License-Identifier: BSD-3-Clause
546
577
  */
547
- const ve = globalThis, ze = ve.ShadowRoot && (ve.ShadyCSS === void 0 || ve.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ue = Symbol(), Ye = /* @__PURE__ */ new WeakMap();
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();
548
579
  let yt = class {
549
580
  constructor(e, t, i) {
550
- if (this._$cssResult$ = !0, i !== Ue) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
581
+ if (this._$cssResult$ = !0, i !== ze) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
551
582
  this.cssText = e, this.t = t;
552
583
  }
553
584
  get styleSheet() {
554
585
  let e = this.o;
555
586
  const t = this.t;
556
- if (ze && e === void 0) {
587
+ if (Ue && e === void 0) {
557
588
  const i = t !== void 0 && t.length === 1;
558
589
  i && (e = Ye.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && Ye.set(t, e));
559
590
  }
@@ -563,59 +594,59 @@ let yt = class {
563
594
  return this.cssText;
564
595
  }
565
596
  };
566
- const Ut = (s) => new yt(typeof s == "string" ? s : s + "", void 0, Ue), I = (s, ...e) => {
567
- const t = s.length === 1 ? s[0] : e.reduce((i, n, o) => i + ((r) => {
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) => {
568
599
  if (r._$cssResult$ === !0) return r.cssText;
569
600
  if (typeof r == "number") return r;
570
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.");
571
- })(n) + s[o + 1], s[0]);
572
- return new yt(t, s, Ue);
573
- }, Dt = (s, e) => {
574
- if (ze) s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
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);
575
606
  else for (const t of e) {
576
- const i = document.createElement("style"), n = ve.litNonce;
577
- n !== void 0 && i.setAttribute("nonce", n), i.textContent = t.cssText, s.appendChild(i);
607
+ const i = document.createElement("style"), s = ve.litNonce;
608
+ s !== void 0 && i.setAttribute("nonce", s), i.textContent = t.cssText, n.appendChild(i);
578
609
  }
579
- }, Ke = ze ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((e) => {
610
+ }, Ke = Ue ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((e) => {
580
611
  let t = "";
581
612
  for (const i of e.cssRules) t += i.cssText;
582
- return Ut(t);
583
- })(s) : s;
613
+ return zt(t);
614
+ })(n) : n;
584
615
  /**
585
616
  * @license
586
617
  * Copyright 2017 Google LLC
587
618
  * SPDX-License-Identifier: BSD-3-Clause
588
619
  */
589
- const { is: Ht, defineProperty: Bt, getOwnPropertyDescriptor: Nt, getOwnPropertyNames: Ft, getOwnPropertySymbols: qt, getPrototypeOf: Vt } = Object, U = globalThis, Ge = U.trustedTypes, Wt = Ge ? Ge.emptyScript : "", Te = U.reactiveElementPolyfillSupport, ie = (s, e) => s, we = { toAttribute(s, e) {
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) {
590
621
  switch (e) {
591
622
  case Boolean:
592
- s = s ? Wt : null;
623
+ n = n ? Wt : null;
593
624
  break;
594
625
  case Object:
595
626
  case Array:
596
- s = s == null ? s : JSON.stringify(s);
627
+ n = n == null ? n : JSON.stringify(n);
597
628
  }
598
- return s;
599
- }, fromAttribute(s, e) {
600
- let t = s;
629
+ return n;
630
+ }, fromAttribute(n, e) {
631
+ let t = n;
601
632
  switch (e) {
602
633
  case Boolean:
603
- t = s !== null;
634
+ t = n !== null;
604
635
  break;
605
636
  case Number:
606
- t = s === null ? null : Number(s);
637
+ t = n === null ? null : Number(n);
607
638
  break;
608
639
  case Object:
609
640
  case Array:
610
641
  try {
611
- t = JSON.parse(s);
642
+ t = JSON.parse(n);
612
643
  } catch {
613
644
  t = null;
614
645
  }
615
646
  }
616
647
  return t;
617
- } }, De = (s, e) => !Ht(s, e), Ze = { attribute: !0, type: String, converter: we, reflect: !1, useDefault: !1, hasChanged: De };
618
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), U.litPropertyMetadata ?? (U.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
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());
619
650
  let Y = class extends HTMLElement {
620
651
  static addInitializer(e) {
621
652
  this._$Ei(), (this.l ?? (this.l = [])).push(e);
@@ -625,18 +656,18 @@ let Y = class extends HTMLElement {
625
656
  }
626
657
  static createProperty(e, t = Ze) {
627
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) {
628
- const i = Symbol(), n = this.getPropertyDescriptor(e, i, t);
629
- n !== void 0 && Bt(this.prototype, e, n);
659
+ const i = Symbol(), s = this.getPropertyDescriptor(e, i, t);
660
+ s !== void 0 && Nt(this.prototype, e, s);
630
661
  }
631
662
  }
632
663
  static getPropertyDescriptor(e, t, i) {
633
- const { get: n, set: o } = Nt(this.prototype, e) ?? { get() {
664
+ const { get: s, set: o } = Bt(this.prototype, e) ?? { get() {
634
665
  return this[t];
635
666
  }, set(r) {
636
667
  this[t] = r;
637
668
  } };
638
- return { get: n, set(r) {
639
- const l = n == null ? void 0 : n.call(this);
669
+ return { get: s, set(r) {
670
+ const l = s == null ? void 0 : s.call(this);
640
671
  o == null || o.call(this, r), this.requestUpdate(e, l, i);
641
672
  }, configurable: !0, enumerable: !0 };
642
673
  }
@@ -645,24 +676,24 @@ let Y = class extends HTMLElement {
645
676
  }
646
677
  static _$Ei() {
647
678
  if (this.hasOwnProperty(ie("elementProperties"))) return;
648
- const e = Vt(this);
679
+ const e = qt(this);
649
680
  e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
650
681
  }
651
682
  static finalize() {
652
683
  if (this.hasOwnProperty(ie("finalized"))) return;
653
684
  if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(ie("properties"))) {
654
- const t = this.properties, i = [...Ft(t), ...qt(t)];
655
- for (const n of i) this.createProperty(n, t[n]);
685
+ const t = this.properties, i = [...Ft(t), ...Vt(t)];
686
+ for (const s of i) this.createProperty(s, t[s]);
656
687
  }
657
688
  const e = this[Symbol.metadata];
658
689
  if (e !== null) {
659
690
  const t = litPropertyMetadata.get(e);
660
- if (t !== void 0) for (const [i, n] of t) this.elementProperties.set(i, n);
691
+ if (t !== void 0) for (const [i, s] of t) this.elementProperties.set(i, s);
661
692
  }
662
693
  this._$Eh = /* @__PURE__ */ new Map();
663
694
  for (const [t, i] of this.elementProperties) {
664
- const n = this._$Eu(t, i);
665
- n !== void 0 && this._$Eh.set(n, t);
695
+ const s = this._$Eu(t, i);
696
+ s !== void 0 && this._$Eh.set(s, t);
666
697
  }
667
698
  this.elementStyles = this.finalizeStyles(this.styles);
668
699
  }
@@ -670,7 +701,7 @@ let Y = class extends HTMLElement {
670
701
  const t = [];
671
702
  if (Array.isArray(e)) {
672
703
  const i = new Set(e.flat(1 / 0).reverse());
673
- for (const n of i) t.unshift(Ke(n));
704
+ for (const s of i) t.unshift(Ke(s));
674
705
  } else e !== void 0 && t.push(Ke(e));
675
706
  return t;
676
707
  }
@@ -723,33 +754,33 @@ let Y = class extends HTMLElement {
723
754
  }
724
755
  _$ET(e, t) {
725
756
  var o;
726
- const i = this.constructor.elementProperties.get(e), n = this.constructor._$Eu(e, i);
727
- if (n !== void 0 && i.reflect === !0) {
757
+ const i = this.constructor.elementProperties.get(e), s = this.constructor._$Eu(e, i);
758
+ if (s !== void 0 && i.reflect === !0) {
728
759
  const r = (((o = i.converter) == null ? void 0 : o.toAttribute) !== void 0 ? i.converter : we).toAttribute(t, i.type);
729
- this._$Em = e, r == null ? this.removeAttribute(n) : this.setAttribute(n, r), this._$Em = null;
760
+ this._$Em = e, r == null ? this.removeAttribute(s) : this.setAttribute(s, r), this._$Em = null;
730
761
  }
731
762
  }
732
763
  _$AK(e, t) {
733
764
  var o, r;
734
- const i = this.constructor, n = i._$Eh.get(e);
735
- if (n !== void 0 && this._$Em !== n) {
736
- const l = i.getPropertyOptions(n), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((o = l.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? l.converter : we;
737
- this._$Em = n;
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;
738
769
  const c = a.fromAttribute(t, l.type);
739
- this[n] = c ?? ((r = this._$Ej) == null ? void 0 : r.get(n)) ?? c, this._$Em = null;
770
+ this[s] = c ?? ((r = this._$Ej) == null ? void 0 : r.get(s)) ?? c, this._$Em = null;
740
771
  }
741
772
  }
742
- requestUpdate(e, t, i, n = !1, o) {
773
+ requestUpdate(e, t, i, s = !1, o) {
743
774
  var r;
744
775
  if (e !== void 0) {
745
776
  const l = this.constructor;
746
- if (n === !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;
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;
747
778
  this.C(e, t, i);
748
779
  }
749
780
  this.isUpdatePending === !1 && (this._$ES = this._$EP());
750
781
  }
751
- C(e, t, { useDefault: i, reflect: n, wrapped: o }, r) {
752
- 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)), n === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
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));
753
784
  }
754
785
  async _$EP() {
755
786
  this.isUpdatePending = !0;
@@ -772,8 +803,8 @@ let Y = class extends HTMLElement {
772
803
  for (const [o, r] of this._$Ep) this[o] = r;
773
804
  this._$Ep = void 0;
774
805
  }
775
- const n = this.constructor.elementProperties;
776
- if (n.size > 0) for (const [o, r] of n) {
806
+ const s = this.constructor.elementProperties;
807
+ if (s.size > 0) for (const [o, r] of s) {
777
808
  const { wrapped: l } = r, a = this[o];
778
809
  l !== !0 || this._$AL.has(o) || a === void 0 || this.C(o, void 0, r, a);
779
810
  }
@@ -781,12 +812,12 @@ let Y = class extends HTMLElement {
781
812
  let e = !1;
782
813
  const t = this._$AL;
783
814
  try {
784
- e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((n) => {
815
+ e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((s) => {
785
816
  var o;
786
- return (o = n.hostUpdate) == null ? void 0 : o.call(n);
817
+ return (o = s.hostUpdate) == null ? void 0 : o.call(s);
787
818
  }), this.update(t)) : this._$EM();
788
- } catch (n) {
789
- throw e = !1, this._$EM(), n;
819
+ } catch (s) {
820
+ throw e = !1, this._$EM(), s;
790
821
  }
791
822
  e && this._$AE(t);
792
823
  }
@@ -795,8 +826,8 @@ let Y = class extends HTMLElement {
795
826
  _$AE(e) {
796
827
  var t;
797
828
  (t = this._$EO) == null || t.forEach((i) => {
798
- var n;
799
- return (n = i.hostUpdated) == null ? void 0 : n.call(i);
829
+ var s;
830
+ return (s = i.hostUpdated) == null ? void 0 : s.call(i);
800
831
  }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
801
832
  }
802
833
  _$EM() {
@@ -819,59 +850,59 @@ let Y = class extends HTMLElement {
819
850
  firstUpdated(e) {
820
851
  }
821
852
  };
822
- Y.elementStyles = [], Y.shadowRootOptions = { mode: "open" }, Y[ie("elementProperties")] = /* @__PURE__ */ new Map(), Y[ie("finalized")] = /* @__PURE__ */ new Map(), Te == null || Te({ ReactiveElement: Y }), (U.reactiveElementVersions ?? (U.reactiveElementVersions = [])).push("2.1.2");
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");
823
854
  /**
824
855
  * @license
825
856
  * Copyright 2017 Google LLC
826
857
  * SPDX-License-Identifier: BSD-3-Clause
827
858
  */
828
- const se = globalThis, Je = (s) => s, $e = se.trustedTypes, Qe = $e ? $e.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, wt = "$lit$", z = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + z, Xt = `<${$t}>`, F = document, oe = () => F.createComment(""), re = (s) => s === null || typeof s != "object" && typeof s != "function", He = Array.isArray, Yt = (s) => He(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", Se = `[
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 = `[
829
860
  \f\r]`, te = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, et = /-->/g, tt = />/g, H = RegExp(`>|${Se}(?:([^\\s"'>=/]+)(${Se}*=${Se}*(?:[^
830
- \f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, st = /"/g, kt = /^(?:script|style|textarea|title)$/i, Et = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), h = Et(1), Kt = Et(2), q = Symbol.for("lit-noChange"), m = Symbol.for("lit-nothing"), nt = /* @__PURE__ */ new WeakMap(), B = F.createTreeWalker(F, 129);
831
- function Ct(s, e) {
832
- if (!He(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
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");
833
864
  return Qe !== void 0 ? Qe.createHTML(e) : e;
834
865
  }
835
- const Gt = (s, e) => {
836
- const t = s.length - 1, i = [];
837
- let n, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = te;
866
+ const Gt = (n, e) => {
867
+ const t = n.length - 1, i = [];
868
+ let s, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = te;
838
869
  for (let l = 0; l < t; l++) {
839
- const a = s[l];
870
+ const a = n[l];
840
871
  let c, p, d = -1, u = 0;
841
- 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]) && (n = RegExp("</" + p[2], "g")), r = H) : p[3] !== void 0 && (r = H) : r === H ? p[0] === ">" ? (r = n ?? 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, n = void 0);
842
- const f = r === H && s[l + 1].startsWith("/>") ? " " : "";
843
- o += r === te ? a + Xt : d >= 0 ? (i.push(c), a.slice(0, d) + wt + a.slice(d) + z + f) : a + z + (d === -2 ? l : f);
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);
844
875
  }
845
- return [Ct(s, o + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
876
+ return [Ct(n, o + (n[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
846
877
  };
847
878
  class ae {
848
879
  constructor({ strings: e, _$litType$: t }, i) {
849
- let n;
880
+ let s;
850
881
  this.parts = [];
851
882
  let o = 0, r = 0;
852
883
  const l = e.length - 1, a = this.parts, [c, p] = Gt(e, t);
853
- if (this.el = ae.createElement(c, i), B.currentNode = this.el.content, t === 2 || t === 3) {
884
+ if (this.el = ae.createElement(c, i), N.currentNode = this.el.content, t === 2 || t === 3) {
854
885
  const d = this.el.content.firstChild;
855
886
  d.replaceWith(...d.childNodes);
856
887
  }
857
- for (; (n = B.nextNode()) !== null && a.length < l; ) {
858
- if (n.nodeType === 1) {
859
- if (n.hasAttributes()) for (const d of n.getAttributeNames()) if (d.endsWith(wt)) {
860
- const u = p[r++], f = n.getAttribute(d).split(z), b = /([.?@])?(.*)/.exec(u);
861
- a.push({ type: 1, index: o, name: b[2], strings: f, ctor: b[1] === "." ? Jt : b[1] === "?" ? Qt : b[1] === "@" ? ei : Ee }), n.removeAttribute(d);
862
- } else d.startsWith(z) && (a.push({ type: 6, index: o }), n.removeAttribute(d));
863
- if (kt.test(n.tagName)) {
864
- const d = n.textContent.split(z), u = d.length - 1;
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;
865
896
  if (u > 0) {
866
- n.textContent = $e ? $e.emptyScript : "";
867
- for (let f = 0; f < u; f++) n.append(d[f], oe()), B.nextNode(), a.push({ type: 2, index: ++o });
868
- n.append(d[u], oe());
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());
869
900
  }
870
901
  }
871
- } else if (n.nodeType === 8) if (n.data === $t) a.push({ type: 2, index: o });
902
+ } else if (s.nodeType === 8) if (s.data === $t) a.push({ type: 2, index: o });
872
903
  else {
873
904
  let d = -1;
874
- for (; (d = n.data.indexOf(z, d + 1)) !== -1; ) a.push({ type: 7, index: o }), d += z.length - 1;
905
+ for (; (d = s.data.indexOf(U, d + 1)) !== -1; ) a.push({ type: 7, index: o }), d += U.length - 1;
875
906
  }
876
907
  o++;
877
908
  }
@@ -881,12 +912,12 @@ class ae {
881
912
  return i.innerHTML = e, i;
882
913
  }
883
914
  }
884
- function K(s, e, t = s, i) {
915
+ function K(n, e, t = n, i) {
885
916
  var r, l;
886
- if (e === q) return e;
887
- let n = i !== void 0 ? (r = t._$Co) == null ? void 0 : r[i] : t._$Cl;
917
+ if (e === V) return e;
918
+ let s = i !== void 0 ? (r = t._$Co) == null ? void 0 : r[i] : t._$Cl;
888
919
  const o = re(e) ? void 0 : e._$litDirective$;
889
- return (n == null ? void 0 : n.constructor) !== o && ((l = n == null ? void 0 : n._$AO) == null || l.call(n, !1), o === void 0 ? n = void 0 : (n = new o(s), n._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = n : t._$Cl = n), n !== void 0 && (e = K(s, n._$AS(s, e.values), n, i)), e;
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;
890
921
  }
891
922
  class Zt {
892
923
  constructor(e, t) {
@@ -899,17 +930,17 @@ class Zt {
899
930
  return this._$AM._$AU;
900
931
  }
901
932
  u(e) {
902
- const { el: { content: t }, parts: i } = this._$AD, n = ((e == null ? void 0 : e.creationScope) ?? F).importNode(t, !0);
903
- B.currentNode = n;
904
- let o = B.nextNode(), r = 0, l = 0, a = i[0];
933
+ const { el: { content: t }, parts: i } = this._$AD, s = ((e == null ? void 0 : e.creationScope) ?? F).importNode(t, !0);
934
+ N.currentNode = s;
935
+ let o = N.nextNode(), r = 0, l = 0, a = i[0];
905
936
  for (; a !== void 0; ) {
906
937
  if (r === a.index) {
907
938
  let c;
908
939
  a.type === 2 ? c = new ue(o, o.nextSibling, this, e) : a.type === 1 ? c = new a.ctor(o, a.name, a.strings, this, e) : a.type === 6 && (c = new ti(o, this, e)), this._$AV.push(c), a = i[++l];
909
940
  }
910
- r !== (a == null ? void 0 : a.index) && (o = B.nextNode(), r++);
941
+ r !== (a == null ? void 0 : a.index) && (o = N.nextNode(), r++);
911
942
  }
912
- return B.currentNode = F, n;
943
+ return N.currentNode = F, s;
913
944
  }
914
945
  p(e) {
915
946
  let t = 0;
@@ -921,8 +952,8 @@ class ue {
921
952
  var e;
922
953
  return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
923
954
  }
924
- constructor(e, t, i, n) {
925
- this.type = 2, this._$AH = m, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = n, this._$Cv = (n == null ? void 0 : n.isConnected) ?? !0;
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;
926
957
  }
927
958
  get parentNode() {
928
959
  let e = this._$AA.parentNode;
@@ -936,7 +967,7 @@ class ue {
936
967
  return this._$AB;
937
968
  }
938
969
  _$AI(e, t = this) {
939
- e = K(this, e, t), re(e) ? e === m || e == null || e === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : e !== this._$AH && e !== q && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Yt(e) ? this.k(e) : this._(e);
970
+ e = K(this, e, t), re(e) ? e === f || e == null || e === "" ? (this._$AH !== f && this._$AR(), this._$AH = f) : e !== this._$AH && e !== V && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Yt(e) ? this.k(e) : this._(e);
940
971
  }
941
972
  O(e) {
942
973
  return this._$AA.parentNode.insertBefore(e, this._$AB);
@@ -945,14 +976,14 @@ class ue {
945
976
  this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
946
977
  }
947
978
  _(e) {
948
- this._$AH !== m && re(this._$AH) ? this._$AA.nextSibling.data = e : this.T(F.createTextNode(e)), this._$AH = e;
979
+ this._$AH !== f && re(this._$AH) ? this._$AA.nextSibling.data = e : this.T(F.createTextNode(e)), this._$AH = e;
949
980
  }
950
981
  $(e) {
951
982
  var o;
952
- const { values: t, _$litType$: i } = e, n = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = ae.createElement(Ct(i.h, i.h[0]), this.options)), i);
953
- if (((o = this._$AH) == null ? void 0 : o._$AD) === n) this._$AH.p(t);
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);
954
985
  else {
955
- const r = new Zt(n, this), l = r.u(this.options);
986
+ const r = new Zt(s, this), l = r.u(this.options);
956
987
  r.p(t), this.T(l), this._$AH = r;
957
988
  }
958
989
  }
@@ -963,15 +994,15 @@ class ue {
963
994
  k(e) {
964
995
  He(this._$AH) || (this._$AH = [], this._$AR());
965
996
  const t = this._$AH;
966
- let i, n = 0;
967
- for (const o of e) n === t.length ? t.push(i = new ue(this.O(oe()), this.O(oe()), this, this.options)) : i = t[n], i._$AI(o), n++;
968
- n < t.length && (this._$AR(i && i._$AB.nextSibling, n), t.length = n);
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);
969
1000
  }
970
1001
  _$AR(e = this._$AA.nextSibling, t) {
971
1002
  var i;
972
1003
  for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, t); e !== this._$AB; ) {
973
- const n = Je(e).nextSibling;
974
- Je(e).remove(), e = n;
1004
+ const s = Je(e).nextSibling;
1005
+ Je(e).remove(), e = s;
975
1006
  }
976
1007
  }
977
1008
  setConnected(e) {
@@ -986,22 +1017,22 @@ class Ee {
986
1017
  get _$AU() {
987
1018
  return this._$AM._$AU;
988
1019
  }
989
- constructor(e, t, i, n, o) {
990
- this.type = 1, this._$AH = m, this._$AN = void 0, this.element = e, this.name = t, this._$AM = n, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = m;
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;
991
1022
  }
992
- _$AI(e, t = this, i, n) {
1023
+ _$AI(e, t = this, i, s) {
993
1024
  const o = this.strings;
994
1025
  let r = !1;
995
- if (o === void 0) e = K(this, e, t, 0), r = !re(e) || e !== this._$AH && e !== q, r && (this._$AH = e);
1026
+ if (o === void 0) e = K(this, e, t, 0), r = !re(e) || e !== this._$AH && e !== V, r && (this._$AH = e);
996
1027
  else {
997
1028
  const l = e;
998
1029
  let a, c;
999
- for (e = o[0], a = 0; a < o.length - 1; a++) c = K(this, l[i + a], t, a), c === q && (c = this._$AH[a]), r || (r = !re(c) || c !== this._$AH[a]), c === m ? e = m : e !== m && (e += (c ?? "") + o[a + 1]), this._$AH[a] = c;
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;
1000
1031
  }
1001
- r && !n && this.j(e);
1032
+ r && !s && this.j(e);
1002
1033
  }
1003
1034
  j(e) {
1004
- e === m ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
1035
+ e === f ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
1005
1036
  }
1006
1037
  }
1007
1038
  class Jt extends Ee {
@@ -1009,7 +1040,7 @@ class Jt extends Ee {
1009
1040
  super(...arguments), this.type = 3;
1010
1041
  }
1011
1042
  j(e) {
1012
- this.element[this.name] = e === m ? void 0 : e;
1043
+ this.element[this.name] = e === f ? void 0 : e;
1013
1044
  }
1014
1045
  }
1015
1046
  class Qt extends Ee {
@@ -1017,17 +1048,17 @@ class Qt extends Ee {
1017
1048
  super(...arguments), this.type = 4;
1018
1049
  }
1019
1050
  j(e) {
1020
- this.element.toggleAttribute(this.name, !!e && e !== m);
1051
+ this.element.toggleAttribute(this.name, !!e && e !== f);
1021
1052
  }
1022
1053
  }
1023
1054
  class ei extends Ee {
1024
- constructor(e, t, i, n, o) {
1025
- super(e, t, i, n, o), this.type = 5;
1055
+ constructor(e, t, i, s, o) {
1056
+ super(e, t, i, s, o), this.type = 5;
1026
1057
  }
1027
1058
  _$AI(e, t = this) {
1028
- if ((e = K(this, e, t, 0) ?? m) === q) return;
1029
- const i = this._$AH, n = e === m && i !== m || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, o = e !== m && (i === m || n);
1030
- n && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
1059
+ if ((e = K(this, e, t, 0) ?? f) === V) return;
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;
1031
1062
  }
1032
1063
  handleEvent(e) {
1033
1064
  var t;
@@ -1047,22 +1078,22 @@ class ti {
1047
1078
  }
1048
1079
  const Pe = se.litHtmlPolyfillSupport;
1049
1080
  Pe == null || Pe(ae, ue), (se.litHtmlVersions ?? (se.litHtmlVersions = [])).push("3.3.2");
1050
- const ii = (s, e, t) => {
1081
+ const ii = (n, e, t) => {
1051
1082
  const i = (t == null ? void 0 : t.renderBefore) ?? e;
1052
- let n = i._$litPart$;
1053
- if (n === void 0) {
1083
+ let s = i._$litPart$;
1084
+ if (s === void 0) {
1054
1085
  const o = (t == null ? void 0 : t.renderBefore) ?? null;
1055
- i._$litPart$ = n = new ue(e.insertBefore(oe(), o), o, void 0, t ?? {});
1086
+ i._$litPart$ = s = new ue(e.insertBefore(oe(), o), o, void 0, t ?? {});
1056
1087
  }
1057
- return n._$AI(s), n;
1088
+ return s._$AI(n), s;
1058
1089
  };
1059
1090
  /**
1060
1091
  * @license
1061
1092
  * Copyright 2017 Google LLC
1062
1093
  * SPDX-License-Identifier: BSD-3-Clause
1063
1094
  */
1064
- const N = globalThis;
1065
- let S = class extends Y {
1095
+ const B = globalThis;
1096
+ let T = class extends Y {
1066
1097
  constructor() {
1067
1098
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
1068
1099
  }
@@ -1084,87 +1115,87 @@ let S = class extends Y {
1084
1115
  super.disconnectedCallback(), (e = this._$Do) == null || e.setConnected(!1);
1085
1116
  }
1086
1117
  render() {
1087
- return q;
1118
+ return V;
1088
1119
  }
1089
1120
  };
1090
1121
  var bt;
1091
- S._$litElement$ = !0, S.finalized = !0, (bt = N.litElementHydrateSupport) == null || bt.call(N, { LitElement: S });
1092
- const Ae = N.litElementPolyfillSupport;
1093
- Ae == null || Ae({ LitElement: S });
1094
- (N.litElementVersions ?? (N.litElementVersions = [])).push("4.2.2");
1122
+ T._$litElement$ = !0, T.finalized = !0, (bt = B.litElementHydrateSupport) == null || bt.call(B, { LitElement: T });
1123
+ const Ae = B.litElementPolyfillSupport;
1124
+ Ae == null || Ae({ LitElement: T });
1125
+ (B.litElementVersions ?? (B.litElementVersions = [])).push("4.2.2");
1095
1126
  /**
1096
1127
  * @license
1097
1128
  * Copyright 2017 Google LLC
1098
1129
  * SPDX-License-Identifier: BSD-3-Clause
1099
1130
  */
1100
- const R = (s) => (e, t) => {
1131
+ const R = (n) => (e, t) => {
1101
1132
  t !== void 0 ? t.addInitializer(() => {
1102
- customElements.define(s, e);
1103
- }) : customElements.define(s, e);
1133
+ customElements.define(n, e);
1134
+ }) : customElements.define(n, e);
1104
1135
  };
1105
1136
  /**
1106
1137
  * @license
1107
1138
  * Copyright 2017 Google LLC
1108
1139
  * SPDX-License-Identifier: BSD-3-Clause
1109
1140
  */
1110
- const si = { attribute: !0, type: String, converter: we, reflect: !1, hasChanged: De }, ni = (s = si, e, t) => {
1111
- const { kind: i, metadata: n } = t;
1112
- let o = globalThis.litPropertyMetadata.get(n);
1113
- if (o === void 0 && globalThis.litPropertyMetadata.set(n, o = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), o.set(t.name, s), i === "accessor") {
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") {
1114
1145
  const { name: r } = t;
1115
1146
  return { set(l) {
1116
1147
  const a = e.get.call(this);
1117
- e.set.call(this, l), this.requestUpdate(r, a, s, !0, l);
1148
+ e.set.call(this, l), this.requestUpdate(r, a, n, !0, l);
1118
1149
  }, init(l) {
1119
- return l !== void 0 && this.C(r, void 0, s, l), l;
1150
+ return l !== void 0 && this.C(r, void 0, n, l), l;
1120
1151
  } };
1121
1152
  }
1122
1153
  if (i === "setter") {
1123
1154
  const { name: r } = t;
1124
1155
  return function(l) {
1125
1156
  const a = this[r];
1126
- e.call(this, l), this.requestUpdate(r, a, s, !0, l);
1157
+ e.call(this, l), this.requestUpdate(r, a, n, !0, l);
1127
1158
  };
1128
1159
  }
1129
1160
  throw Error("Unsupported decorator location: " + i);
1130
1161
  };
1131
- function g(s) {
1132
- return (e, t) => typeof t == "object" ? ni(s, e, t) : ((i, n, o) => {
1133
- const r = n.hasOwnProperty(o);
1134
- return n.constructor.createProperty(o, i), r ? Object.getOwnPropertyDescriptor(n, o) : void 0;
1135
- })(s, e, t);
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);
1136
1167
  }
1137
1168
  /**
1138
1169
  * @license
1139
1170
  * Copyright 2017 Google LLC
1140
1171
  * SPDX-License-Identifier: BSD-3-Clause
1141
1172
  */
1142
- function v(s) {
1143
- return g({ ...s, state: !0, attribute: !1 });
1173
+ function v(n) {
1174
+ return g({ ...n, state: !0, attribute: !1 });
1144
1175
  }
1145
1176
  const Z = "pulse-client";
1146
- var oi = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, J = (s, e, t, i) => {
1147
- for (var n = i > 1 ? void 0 : i ? ri(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1148
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1149
- return i && n && oi(e, t, n), n;
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;
1150
1181
  };
1151
- let V = class extends S {
1182
+ let q = class extends T {
1152
1183
  constructor() {
1153
1184
  super(...arguments), this.apiKey = "", this.token = "", this.room = "";
1154
1185
  }
1155
1186
  connectedCallback() {
1156
1187
  super.connectedCallback();
1157
- const s = {
1188
+ const n = {
1158
1189
  apiKey: this.apiKey,
1159
1190
  token: this.token,
1160
1191
  room: this.room,
1161
1192
  endpoint: this.endpoint
1162
1193
  };
1163
- this.client = new xt(s), this.client.connect();
1194
+ this.client = new xt(n), this.client.connect();
1164
1195
  }
1165
1196
  disconnectedCallback() {
1166
- var s;
1167
- super.disconnectedCallback(), (s = this.client) == null || s.disconnect();
1197
+ var n;
1198
+ super.disconnectedCallback(), (n = this.client) == null || n.disconnect();
1168
1199
  }
1169
1200
  render() {
1170
1201
  return h`<slot></slot>`;
@@ -1172,28 +1203,28 @@ let V = class extends S {
1172
1203
  };
1173
1204
  J([
1174
1205
  g({ attribute: "api-key" })
1175
- ], V.prototype, "apiKey", 2);
1206
+ ], q.prototype, "apiKey", 2);
1176
1207
  J([
1177
1208
  g()
1178
- ], V.prototype, "token", 2);
1209
+ ], q.prototype, "token", 2);
1179
1210
  J([
1180
1211
  g()
1181
- ], V.prototype, "room", 2);
1212
+ ], q.prototype, "room", 2);
1182
1213
  J([
1183
1214
  g()
1184
- ], V.prototype, "endpoint", 2);
1215
+ ], q.prototype, "endpoint", 2);
1185
1216
  J([
1186
1217
  Mt({ context: Z })
1187
- ], V.prototype, "client", 2);
1188
- V = J([
1218
+ ], q.prototype, "client", 2);
1219
+ q = J([
1189
1220
  R("pulse-provider")
1190
- ], V);
1191
- var ai = Object.defineProperty, li = Object.getOwnPropertyDescriptor, Ce = (s, e, t, i) => {
1192
- for (var n = i > 1 ? void 0 : i ? li(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1193
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1194
- return i && n && ai(e, t, n), n;
1221
+ ], q);
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;
1195
1226
  };
1196
- let G = class extends S {
1227
+ let G = class extends T {
1197
1228
  constructor() {
1198
1229
  super(...arguments), this.maxVisible = 5, this.users = [];
1199
1230
  }
@@ -1201,27 +1232,27 @@ let G = class extends S {
1201
1232
  super.connectedCallback(), this.setupListener();
1202
1233
  }
1203
1234
  disconnectedCallback() {
1204
- var s;
1205
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
1235
+ var n;
1236
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
1206
1237
  }
1207
- updated(s) {
1238
+ updated(n) {
1208
1239
  var e;
1209
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1240
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1210
1241
  }
1211
1242
  setupListener() {
1212
- this.client && (this.users = this.client.state.presence, this.unsub = this.client.state.on("presence", (s) => {
1213
- this.users = s;
1243
+ this.client && (this.users = this.client.state.presence, this.unsub = this.client.state.on("presence", (n) => {
1244
+ this.users = n;
1214
1245
  }));
1215
1246
  }
1216
- getInitials(s) {
1217
- return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1247
+ getInitials(n) {
1248
+ return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1218
1249
  }
1219
1250
  render() {
1220
- const s = this.users.slice(0, this.maxVisible), e = this.users.length - this.maxVisible;
1251
+ const n = this.users.slice(0, this.maxVisible), e = this.users.length - this.maxVisible;
1221
1252
  return h`
1222
1253
  <div class="avatars">
1223
1254
  ${e > 0 ? h`<div class="overflow">+${e}</div>` : null}
1224
- ${s.map(
1255
+ ${n.map(
1225
1256
  (t) => h`
1226
1257
  <div
1227
1258
  class="avatar"
@@ -1237,7 +1268,7 @@ let G = class extends S {
1237
1268
  `;
1238
1269
  }
1239
1270
  };
1240
- G.styles = I`
1271
+ G.styles = A`
1241
1272
  :host {
1242
1273
  display: inline-flex;
1243
1274
  align-items: center;
@@ -1354,20 +1385,20 @@ Ce([
1354
1385
  G = Ce([
1355
1386
  R("pulse-presence")
1356
1387
  ], G);
1357
- var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, Be = (s, e, t, i) => {
1358
- for (var n = i > 1 ? void 0 : i ? di(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1359
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1360
- return i && n && ci(e, t, n), n;
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;
1361
1392
  };
1362
- let le = class extends S {
1393
+ let le = class extends T {
1363
1394
  constructor() {
1364
- super(...arguments), this.cursors = /* @__PURE__ */ new Map(), this.unsubs = [], this.handleLocalCursor = (s) => {
1395
+ super(...arguments), this.cursors = /* @__PURE__ */ new Map(), this.unsubs = [], this.handleLocalCursor = (n) => {
1365
1396
  var e;
1366
1397
  (e = this.client) == null || e.moveCursor({
1367
- x: s.clientX,
1368
- y: s.clientY,
1369
- pageX: s.pageX,
1370
- pageY: s.pageY
1398
+ x: n.clientX,
1399
+ y: n.clientY,
1400
+ pageX: n.pageX,
1401
+ pageY: n.pageY
1371
1402
  });
1372
1403
  };
1373
1404
  }
@@ -1375,25 +1406,25 @@ let le = class extends S {
1375
1406
  super.connectedCallback(), this.setupListeners();
1376
1407
  }
1377
1408
  disconnectedCallback() {
1378
- super.disconnectedCallback(), this.unsubs.forEach((s) => s()), this.unsubs = [], document.removeEventListener("mousemove", this.handleLocalCursor);
1409
+ super.disconnectedCallback(), this.unsubs.forEach((n) => n()), this.unsubs = [], document.removeEventListener("mousemove", this.handleLocalCursor);
1379
1410
  }
1380
- updated(s) {
1381
- s.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
1411
+ updated(n) {
1412
+ n.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
1382
1413
  }
1383
1414
  setupListeners() {
1384
1415
  this.client && (this.unsubs.push(
1385
1416
  this.client.state.on(
1386
1417
  "cursor",
1387
- ({ userId: s, position: e }) => {
1388
- const t = this.cursors.get(s);
1418
+ ({ userId: n, position: e }) => {
1419
+ const t = this.cursors.get(n);
1389
1420
  if (t)
1390
1421
  t.position = e;
1391
1422
  else {
1392
1423
  const i = this.client.state.presence.find(
1393
- (n) => n.user.id === s
1424
+ (s) => s.user.id === n
1394
1425
  );
1395
- i && this.cursors.set(s, {
1396
- userId: s,
1426
+ i && this.cursors.set(n, {
1427
+ userId: n,
1397
1428
  name: i.user.name,
1398
1429
  color: i.user.color,
1399
1430
  position: e
@@ -1403,8 +1434,8 @@ let le = class extends S {
1403
1434
  }
1404
1435
  )
1405
1436
  ), this.unsubs.push(
1406
- this.client.state.on("presence", (s) => {
1407
- const e = new Set(s.map((t) => t.user.id));
1437
+ this.client.state.on("presence", (n) => {
1438
+ const e = new Set(n.map((t) => t.user.id));
1408
1439
  for (const t of this.cursors.keys())
1409
1440
  e.has(t) || this.cursors.delete(t);
1410
1441
  this.requestUpdate();
@@ -1412,9 +1443,9 @@ let le = class extends S {
1412
1443
  ), document.addEventListener("mousemove", this.handleLocalCursor));
1413
1444
  }
1414
1445
  render() {
1415
- const s = [...this.cursors.values()];
1446
+ const n = [...this.cursors.values()];
1416
1447
  return h`
1417
- ${s.map(
1448
+ ${n.map(
1418
1449
  (e) => h`
1419
1450
  <div
1420
1451
  class="cursor"
@@ -1436,7 +1467,7 @@ let le = class extends S {
1436
1467
  `;
1437
1468
  }
1438
1469
  };
1439
- le.styles = I`
1470
+ le.styles = A`
1440
1471
  :host {
1441
1472
  position: fixed;
1442
1473
  top: 0;
@@ -1473,22 +1504,22 @@ le.styles = I`
1473
1504
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
1474
1505
  }
1475
1506
  `;
1476
- Be([
1507
+ Ne([
1477
1508
  pe({ context: Z, subscribe: !0 }),
1478
1509
  g({ attribute: !1 })
1479
1510
  ], le.prototype, "client", 2);
1480
- Be([
1511
+ Ne([
1481
1512
  v()
1482
1513
  ], le.prototype, "cursors", 2);
1483
- le = Be([
1514
+ le = Ne([
1484
1515
  R("pulse-cursors")
1485
1516
  ], le);
1486
- var hi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fe = (s, e, t, i) => {
1487
- for (var n = i > 1 ? void 0 : i ? pi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1488
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1489
- return i && n && hi(e, t, n), n;
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;
1490
1521
  };
1491
- let W = class extends S {
1522
+ let W = class extends T {
1492
1523
  constructor() {
1493
1524
  super(...arguments), this.showResolved = !1, this.threads = [], this.replyingTo = null;
1494
1525
  }
@@ -1496,52 +1527,52 @@ let W = class extends S {
1496
1527
  super.connectedCallback(), this.setupListener();
1497
1528
  }
1498
1529
  disconnectedCallback() {
1499
- var s;
1500
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
1530
+ var n;
1531
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
1501
1532
  }
1502
- updated(s) {
1533
+ updated(n) {
1503
1534
  var e;
1504
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1535
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1505
1536
  }
1506
1537
  setupListener() {
1507
- this.client && (this.threads = this.client.state.threads, this.unsub = this.client.state.on("threads", (s) => {
1508
- this.threads = [...s];
1538
+ this.client && (this.threads = this.client.state.threads, this.unsub = this.client.state.on("threads", (n) => {
1539
+ this.threads = [...n];
1509
1540
  }));
1510
1541
  }
1511
- parseMentions(s) {
1512
- return s.split(/(@\w+)/g).map(
1542
+ parseMentions(n) {
1543
+ return n.split(/(@\w+)/g).map(
1513
1544
  (t) => t.startsWith("@") ? h`<span class="mention">${t}</span>` : t
1514
1545
  );
1515
1546
  }
1516
- getInitials(s) {
1517
- return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1547
+ getInitials(n) {
1548
+ return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1518
1549
  }
1519
- getUserForComment(s) {
1550
+ getUserForComment(n) {
1520
1551
  var e;
1521
- return (e = this.client.state.presence.find((t) => t.user.id === s)) == null ? void 0 : e.user;
1552
+ return (e = this.client.state.presence.find((t) => t.user.id === n)) == null ? void 0 : e.user;
1522
1553
  }
1523
- handleNewThread(s) {
1524
- s.preventDefault();
1525
- const t = s.target.querySelector("textarea"), i = t.value.trim();
1554
+ handleNewThread(n) {
1555
+ n.preventDefault();
1556
+ const t = n.target.querySelector("textarea"), i = t.value.trim();
1526
1557
  if (!i) return;
1527
- const n = [...i.matchAll(/@(\w+)/g)].map((o) => o[1]);
1528
- this.client.createThread(i, { mentions: n }), t.value = "";
1558
+ const s = [...i.matchAll(/@(\w+)/g)].map((o) => o[1]);
1559
+ this.client.createThread(i, { mentions: s }), t.value = "";
1529
1560
  }
1530
- handleReply(s, e) {
1561
+ handleReply(n, e) {
1531
1562
  e.preventDefault();
1532
- const i = e.target.querySelector("input"), n = i.value.trim();
1533
- if (!n) return;
1534
- const o = [...n.matchAll(/@(\w+)/g)].map((r) => r[1]);
1535
- this.client.reply(s, n, o), i.value = "", this.replyingTo = null;
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;
1536
1567
  }
1537
1568
  render() {
1538
- const s = this.showResolved ? this.threads : this.threads.filter((e) => !e.resolved);
1569
+ const n = this.showResolved ? this.threads : this.threads.filter((e) => !e.resolved);
1539
1570
  return h`
1540
1571
  <div class="threads">
1541
- ${s.length === 0 ? h`<div class="empty">
1572
+ ${n.length === 0 ? h`<div class="empty">
1542
1573
  <div class="empty-icon">&#128172;</div>
1543
1574
  No comments yet.<br>Start a conversation below.
1544
- </div>` : s.map((e) => this.renderThread(e))}
1575
+ </div>` : n.map((e) => this.renderThread(e))}
1545
1576
  </div>
1546
1577
  <div class="new-thread">
1547
1578
  <form @submit=${this.handleNewThread}>
@@ -1551,13 +1582,13 @@ let W = class extends S {
1551
1582
  </div>
1552
1583
  `;
1553
1584
  }
1554
- renderThread(s) {
1585
+ renderThread(n) {
1555
1586
  return h`
1556
- <div class="thread ${s.resolved ? "resolved" : ""}">
1557
- ${s.comments.map((e, t) => {
1587
+ <div class="thread ${n.resolved ? "resolved" : ""}">
1588
+ ${n.comments.map((e, t) => {
1558
1589
  const i = this.getUserForComment(e.userId);
1559
1590
  return h`
1560
- ${t > 0 ? h`<div class="divider"></div>` : m}
1591
+ ${t > 0 ? h`<div class="divider"></div>` : f}
1561
1592
  <div class="comment">
1562
1593
  <div class="comment-header">
1563
1594
  <div
@@ -1579,34 +1610,34 @@ let W = class extends S {
1579
1610
  })}
1580
1611
  <div class="thread-actions">
1581
1612
  <button
1582
- @click=${() => this.replyingTo = this.replyingTo === s.id ? null : s.id}
1613
+ @click=${() => this.replyingTo = this.replyingTo === n.id ? null : n.id}
1583
1614
  >
1584
1615
  Reply
1585
1616
  </button>
1586
1617
  <button
1587
- @click=${() => this.client.resolveThread(s.id, !s.resolved)}
1618
+ @click=${() => this.client.resolveThread(n.id, !n.resolved)}
1588
1619
  >
1589
- ${s.resolved ? "Reopen" : "Resolve"}
1620
+ ${n.resolved ? "Reopen" : "Resolve"}
1590
1621
  </button>
1591
1622
  </div>
1592
- ${this.replyingTo === s.id ? h`
1593
- <form class="reply-form" @submit=${(e) => this.handleReply(s.id, e)}>
1623
+ ${this.replyingTo === n.id ? h`
1624
+ <form class="reply-form" @submit=${(e) => this.handleReply(n.id, e)}>
1594
1625
  <input type="text" placeholder="Write a reply..." />
1595
1626
  <button type="submit">Send</button>
1596
1627
  </form>
1597
- ` : m}
1628
+ ` : f}
1598
1629
  </div>
1599
1630
  `;
1600
1631
  }
1601
- formatTime(s) {
1602
- const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
1603
- if (n < 1) return "just now";
1604
- if (n < 60) return `${n}m ago`;
1605
- const o = Math.floor(n / 60);
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);
1606
1637
  return o < 24 ? `${o}h ago` : e.toLocaleDateString();
1607
1638
  }
1608
1639
  };
1609
- W.styles = I`
1640
+ W.styles = A`
1610
1641
  :host {
1611
1642
  display: block;
1612
1643
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -1834,10 +1865,10 @@ fe([
1834
1865
  W = fe([
1835
1866
  R("pulse-comments")
1836
1867
  ], W);
1837
- var ui = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, Ne = (s, e, t, i) => {
1838
- for (var n = i > 1 ? void 0 : i ? fi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1839
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1840
- return i && n && ui(e, t, n), n;
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;
1841
1872
  };
1842
1873
  const mi = {
1843
1874
  "comment:created": "left a comment",
@@ -1852,7 +1883,7 @@ const mi = {
1852
1883
  "thread:resolved": "✅",
1853
1884
  "reaction:added": "🎉"
1854
1885
  };
1855
- let ce = class extends S {
1886
+ let ce = class extends T {
1856
1887
  constructor() {
1857
1888
  super(...arguments), this.notifications = [];
1858
1889
  }
@@ -1860,54 +1891,54 @@ let ce = class extends S {
1860
1891
  super.connectedCallback(), this.setupListener();
1861
1892
  }
1862
1893
  disconnectedCallback() {
1863
- var s;
1864
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
1894
+ var n;
1895
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
1865
1896
  }
1866
- updated(s) {
1897
+ updated(n) {
1867
1898
  var e;
1868
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1899
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1869
1900
  }
1870
1901
  setupListener() {
1871
1902
  this.client && (this.notifications = this.client.state.notifications, this.unsub = this.client.state.on(
1872
1903
  "notifications",
1873
- (s) => {
1874
- this.notifications = [...s];
1904
+ (n) => {
1905
+ this.notifications = [...n];
1875
1906
  }
1876
1907
  ));
1877
1908
  }
1878
- handleClick(s) {
1879
- s.read || this.client.markRead(s.id), this.dispatchEvent(
1909
+ handleClick(n) {
1910
+ n.read || this.client.markRead(n.id), this.dispatchEvent(
1880
1911
  new CustomEvent("pulse-notification-click", {
1881
- detail: s,
1912
+ detail: n,
1882
1913
  bubbles: !0,
1883
1914
  composed: !0
1884
1915
  })
1885
1916
  );
1886
1917
  }
1887
- getActorName(s) {
1918
+ getActorName(n) {
1888
1919
  const e = this.client.state.presence.find(
1889
- (t) => t.user.id === s
1920
+ (t) => t.user.id === n
1890
1921
  );
1891
1922
  return (e == null ? void 0 : e.user.name) ?? "Someone";
1892
1923
  }
1893
- formatTime(s) {
1894
- const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
1895
- if (n < 1) return "just now";
1896
- if (n < 60) return `${n}m ago`;
1897
- const o = Math.floor(n / 60);
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);
1898
1929
  return o < 24 ? `${o}h ago` : e.toLocaleDateString();
1899
1930
  }
1900
1931
  render() {
1901
- const s = this.notifications.filter((e) => !e.read).length;
1932
+ const n = this.notifications.filter((e) => !e.read).length;
1902
1933
  return h`
1903
1934
  <div class="header">
1904
1935
  <span class="title">
1905
1936
  Notifications
1906
- ${s > 0 ? h`<span class="badge">${s}</span>` : m}
1937
+ ${n > 0 ? h`<span class="badge">${n}</span>` : f}
1907
1938
  </span>
1908
- ${s > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
1939
+ ${n > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
1909
1940
  Mark all read
1910
- </button>` : m}
1941
+ </button>` : f}
1911
1942
  </div>
1912
1943
  <div class="list">
1913
1944
  ${this.notifications.length === 0 ? h`<div class="empty">
@@ -1935,7 +1966,7 @@ let ce = class extends S {
1935
1966
  `;
1936
1967
  }
1937
1968
  };
1938
- ce.styles = I`
1969
+ ce.styles = A`
1939
1970
  :host {
1940
1971
  display: block;
1941
1972
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -2076,23 +2107,23 @@ ce.styles = I`
2076
2107
  opacity: 0.4;
2077
2108
  }
2078
2109
  `;
2079
- Ne([
2110
+ Be([
2080
2111
  pe({ context: Z, subscribe: !0 }),
2081
2112
  g({ attribute: !1 })
2082
2113
  ], ce.prototype, "client", 2);
2083
- Ne([
2114
+ Be([
2084
2115
  v()
2085
2116
  ], ce.prototype, "notifications", 2);
2086
- ce = Ne([
2117
+ ce = Be([
2087
2118
  R("pulse-notifications")
2088
2119
  ], ce);
2089
- var bi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Q = (s, e, t, i) => {
2090
- for (var n = i > 1 ? void 0 : i ? vi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
2091
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
2092
- return i && n && bi(e, t, n), n;
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;
2093
2124
  };
2094
2125
  const xi = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
2095
- let D = class extends S {
2126
+ let D = class extends T {
2096
2127
  constructor() {
2097
2128
  super(...arguments), this.targetId = "", this.targetType = "comment", this.reactions = [], this.showPicker = !1;
2098
2129
  }
@@ -2100,40 +2131,40 @@ let D = class extends S {
2100
2131
  super.connectedCallback(), this.setupListener();
2101
2132
  }
2102
2133
  disconnectedCallback() {
2103
- var s;
2104
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
2134
+ var n;
2135
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
2105
2136
  }
2106
- updated(s) {
2137
+ updated(n) {
2107
2138
  var e;
2108
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
2139
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
2109
2140
  }
2110
2141
  setupListener() {
2111
- this.client && (this.reactions = this.client.state.getReactions(this.targetId), this.unsub = this.client.state.on("reactions", (s) => {
2112
- s.targetId === this.targetId && (this.reactions = [...s.reactions]);
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]);
2113
2144
  }));
2114
2145
  }
2115
2146
  groupReactions() {
2116
2147
  var t, i;
2117
- const s = /* @__PURE__ */ new Map(), e = (i = (t = this.client) == null ? void 0 : t.state.user) == null ? void 0 : i.id;
2118
- for (const n of this.reactions) {
2119
- const o = s.get(n.emoji) ?? { count: 0, userReactionId: null };
2120
- o.count++, n.userId === e && (o.userReactionId = n.id), s.set(n.emoji, o);
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);
2121
2152
  }
2122
- return [...s.entries()].map(([n, o]) => ({
2123
- emoji: n,
2153
+ return [...n.entries()].map(([s, o]) => ({
2154
+ emoji: s,
2124
2155
  ...o
2125
2156
  }));
2126
2157
  }
2127
- toggleReaction(s) {
2128
- s.userReactionId ? this.client.removeReaction(s.userReactionId) : this.client.addReaction(this.targetId, this.targetType, s.emoji);
2158
+ toggleReaction(n) {
2159
+ n.userReactionId ? this.client.removeReaction(n.userReactionId) : this.client.addReaction(this.targetId, this.targetType, n.emoji);
2129
2160
  }
2130
- addEmoji(s) {
2131
- this.client.addReaction(this.targetId, this.targetType, s), this.showPicker = !1;
2161
+ addEmoji(n) {
2162
+ this.client.addReaction(this.targetId, this.targetType, n), this.showPicker = !1;
2132
2163
  }
2133
2164
  render() {
2134
- const s = this.groupReactions();
2165
+ const n = this.groupReactions();
2135
2166
  return h`
2136
- ${s.map(
2167
+ ${n.map(
2137
2168
  (e) => h`
2138
2169
  <button
2139
2170
  class="reaction ${e.userReactionId ? "active" : ""}"
@@ -2161,12 +2192,12 @@ let D = class extends S {
2161
2192
  `
2162
2193
  )}
2163
2194
  </div>
2164
- ` : m}
2195
+ ` : f}
2165
2196
  </div>
2166
2197
  `;
2167
2198
  }
2168
2199
  };
2169
- D.styles = I`
2200
+ D.styles = A`
2170
2201
  :host {
2171
2202
  display: inline-flex;
2172
2203
  align-items: center;
@@ -2302,7 +2333,7 @@ D = Q([
2302
2333
  * Copyright 2017 Google LLC
2303
2334
  * SPDX-License-Identifier: BSD-3-Clause
2304
2335
  */
2305
- const yi = { CHILD: 2 }, wi = (s) => (...e) => ({ _$litDirective$: s, values: e });
2336
+ const yi = { CHILD: 2 }, wi = (n) => (...e) => ({ _$litDirective$: n, values: e });
2306
2337
  class $i {
2307
2338
  constructor(e) {
2308
2339
  }
@@ -2326,11 +2357,11 @@ class $i {
2326
2357
  */
2327
2358
  class Ie extends $i {
2328
2359
  constructor(e) {
2329
- if (super(e), this.it = m, e.type !== yi.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
2360
+ if (super(e), this.it = f, e.type !== yi.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
2330
2361
  }
2331
2362
  render(e) {
2332
- if (e === m || e == null) return this._t = void 0, this.it = e;
2333
- if (e === q) return e;
2363
+ if (e === f || e == null) return this._t = void 0, this.it = e;
2364
+ if (e === V) return e;
2334
2365
  if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
2335
2366
  if (e === this.it) return this._t;
2336
2367
  this.it = e;
@@ -2526,13 +2557,13 @@ const Ri = [
2526
2557
  }
2527
2558
  ]
2528
2559
  ];
2529
- function Li(s) {
2530
- return s.map(([e, t]) => {
2531
- const i = Object.entries(t).filter(([, n]) => n != null).map(([n, o]) => `${n}="${o}"`).join(" ");
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(" ");
2532
2563
  return `<${e} ${i}/>`;
2533
2564
  }).join("");
2534
2565
  }
2535
- function E(s, e = 18) {
2566
+ function k(n, e = 18) {
2536
2567
  return Kt`<svg
2537
2568
  xmlns="http://www.w3.org/2000/svg"
2538
2569
  width="${e}"
@@ -2543,9 +2574,9 @@ function E(s, e = 18) {
2543
2574
  stroke-width="2"
2544
2575
  stroke-linecap="round"
2545
2576
  stroke-linejoin="round"
2546
- >${ki(Li(s))}</svg>`;
2577
+ >${ki(Li(n))}</svg>`;
2547
2578
  }
2548
- const ee = I`
2579
+ const ee = A`
2549
2580
  * {
2550
2581
  box-sizing: border-box;
2551
2582
  margin: 0;
@@ -2588,7 +2619,7 @@ const ee = I`
2588
2619
  --pw-shadow: var(--pulse-shadow);
2589
2620
  --pw-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
2590
2621
  }
2591
- `, ge = I`
2622
+ `, ge = A`
2592
2623
  .pw-btn {
2593
2624
  display: inline-flex;
2594
2625
  align-items: center;
@@ -2632,7 +2663,7 @@ const ee = I`
2632
2663
  width: 18px;
2633
2664
  height: 18px;
2634
2665
  }
2635
- `, _e = I`
2666
+ `, _e = A`
2636
2667
  .pw-scrollable::-webkit-scrollbar {
2637
2668
  width: 4px;
2638
2669
  }
@@ -2644,12 +2675,12 @@ const ee = I`
2644
2675
  background: transparent;
2645
2676
  }
2646
2677
  `;
2647
- var ji = Object.defineProperty, zi = Object.getOwnPropertyDescriptor, Fe = (s, e, t, i) => {
2648
- for (var n = i > 1 ? void 0 : i ? zi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
2649
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
2650
- return i && n && ji(e, t, n), n;
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;
2651
2682
  };
2652
- let X = class extends S {
2683
+ let X = class extends T {
2653
2684
  constructor() {
2654
2685
  super(...arguments), this.items = [], this.unsubs = [], this.counter = 0;
2655
2686
  }
@@ -2657,36 +2688,36 @@ let X = class extends S {
2657
2688
  super.connectedCallback(), this.setupListeners();
2658
2689
  }
2659
2690
  disconnectedCallback() {
2660
- super.disconnectedCallback(), this.unsubs.forEach((s) => s()), this.unsubs = [];
2691
+ super.disconnectedCallback(), this.unsubs.forEach((n) => n()), this.unsubs = [];
2661
2692
  }
2662
- updated(s) {
2663
- s.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
2693
+ updated(n) {
2694
+ n.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
2664
2695
  }
2665
2696
  setupListeners() {
2666
2697
  if (!this.client) return;
2667
- const s = this.client.state.activityLogs;
2668
- s.length > 0 && (this.items = s.map((e) => this.logToItem(e)), this.counter = this.items.length), this.unsubs.push(
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(
2669
2700
  this.client.state.on("activity-logs", (e) => {
2670
2701
  this.items = e.map((t) => this.logToItem(t));
2671
2702
  })
2672
2703
  );
2673
2704
  }
2674
- logToItem(s) {
2705
+ logToItem(n) {
2675
2706
  return {
2676
- id: s.id,
2677
- type: s.type,
2678
- userId: s.userId,
2679
- description: s.description,
2680
- timestamp: new Date(s.createdAt).getTime(),
2681
- color: X.TYPE_COLORS[s.type] ?? "#94a3b8"
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"
2682
2713
  };
2683
2714
  }
2684
- getUserName(s) {
2715
+ getUserName(n) {
2685
2716
  var e;
2686
- return ((e = this.client.state.getUser(s)) == null ? void 0 : e.name) ?? "Someone";
2717
+ return ((e = this.client.state.getUser(n)) == null ? void 0 : e.name) ?? "Someone";
2687
2718
  }
2688
- formatRelativeTime(s) {
2689
- const e = Math.floor((Date.now() - s) / 1e3);
2719
+ formatRelativeTime(n) {
2720
+ const e = Math.floor((Date.now() - n) / 1e3);
2690
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`;
2691
2722
  }
2692
2723
  fireClose() {
@@ -2700,27 +2731,27 @@ let X = class extends S {
2700
2731
  <div class="panel-header">
2701
2732
  <span class="panel-title">Activity</span>
2702
2733
  <button class="close-btn" @click=${this.fireClose} title="Close">
2703
- ${E(me, 16)}
2734
+ ${k(me, 16)}
2704
2735
  </button>
2705
2736
  </div>
2706
2737
 
2707
2738
  <div class="panel-body pw-scrollable">
2708
2739
  ${this.items.length === 0 ? h`<div class="empty">No activity yet</div>` : this.items.map(
2709
- (s) => h`
2740
+ (n) => h`
2710
2741
  <div class="activity-item">
2711
2742
  <div
2712
2743
  class="activity-dot"
2713
- style="background:${s.color}"
2744
+ style="background:${n.color}"
2714
2745
  ></div>
2715
2746
  <div class="activity-content">
2716
2747
  <div class="activity-text">
2717
- ${s.userId ? h`<span class="activity-user"
2718
- >${this.getUserName(s.userId)}</span
2748
+ ${n.userId ? h`<span class="activity-user"
2749
+ >${this.getUserName(n.userId)}</span
2719
2750
  >
2720
- ${s.description}` : s.description}
2751
+ ${n.description}` : n.description}
2721
2752
  </div>
2722
2753
  <div class="activity-time">
2723
- ${this.formatRelativeTime(s.timestamp)}
2754
+ ${this.formatRelativeTime(n.timestamp)}
2724
2755
  </div>
2725
2756
  </div>
2726
2757
  </div>
@@ -2735,7 +2766,7 @@ X.styles = [
2735
2766
  ee,
2736
2767
  ge,
2737
2768
  _e,
2738
- I`
2769
+ A`
2739
2770
  :host {
2740
2771
  display: block;
2741
2772
  }
@@ -2869,9 +2900,9 @@ Fe([
2869
2900
  X = Fe([
2870
2901
  R("pulse-widget-activity-panel")
2871
2902
  ], X);
2872
- const Ui = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", ot = "#6366f1", rt = "#e2e8f0", Di = "#f8fafc", Hi = "#e2e8f0", at = "#64748b", xe = 28, Bi = Array.from({ length: xe }, (s, e) => 0.2 + Math.abs(Math.sin(e * 12.9898 + 78.233) * 43758.5453) % 1 * 0.8);
2873
- function lt(s) {
2874
- const e = Math.max(0, Math.floor(s)), t = Math.floor(e / 60), i = e % 60;
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;
2875
2906
  return `${t}:${i.toString().padStart(2, "0")}`;
2876
2907
  }
2877
2908
  class Oe {
@@ -2884,7 +2915,7 @@ class Oe {
2884
2915
  * element once metadata has loaded.
2885
2916
  */
2886
2917
  static render(e, t) {
2887
- let i = !1, n = t != null ? t / 1e3 : 0, o = 0;
2918
+ let i = !1, s = t != null ? t / 1e3 : 0, o = 0;
2888
2919
  const r = document.createElement("audio");
2889
2920
  r.preload = "metadata", r.src = e;
2890
2921
  const l = document.createElement("div");
@@ -2898,7 +2929,7 @@ class Oe {
2898
2929
  background: Di,
2899
2930
  borderRadius: "12px",
2900
2931
  border: `1px solid ${Hi}`,
2901
- fontFamily: Ui,
2932
+ fontFamily: zi,
2902
2933
  fontSize: "11px",
2903
2934
  color: at,
2904
2935
  userSelect: "none",
@@ -2948,8 +2979,8 @@ class Oe {
2948
2979
  overflow: "hidden",
2949
2980
  minWidth: "0"
2950
2981
  });
2951
- const f = document.createElement("div");
2952
- Object.assign(f.style, {
2982
+ const m = document.createElement("div");
2983
+ Object.assign(m.style, {
2953
2984
  display: "flex",
2954
2985
  alignItems: "center",
2955
2986
  gap: "1.5px",
@@ -2957,41 +2988,41 @@ class Oe {
2957
2988
  cursor: "pointer"
2958
2989
  });
2959
2990
  const b = [];
2960
- for (let k = 0; k < xe; k++) {
2961
- const A = document.createElement("div"), w = Math.round(Bi[k] * 20);
2962
- Object.assign(A.style, {
2991
+ for (let $ = 0; $ < xe; $++) {
2992
+ const P = document.createElement("div"), y = Math.round(Ni[$] * 20);
2993
+ Object.assign(P.style, {
2963
2994
  flex: "1",
2964
- height: `${Math.max(3, w)}px`,
2995
+ height: `${Math.max(3, y)}px`,
2965
2996
  borderRadius: "1px",
2966
2997
  background: rt,
2967
2998
  transition: "background 0.1s ease",
2968
2999
  minWidth: "0"
2969
- }), b.push(A), f.appendChild(A);
3000
+ }), b.push(P), m.appendChild(P);
2970
3001
  }
2971
- const x = document.createElement("div");
2972
- Object.assign(x.style, {
3002
+ const I = document.createElement("div");
3003
+ Object.assign(I.style, {
2973
3004
  fontSize: "10px",
2974
3005
  color: at,
2975
3006
  whiteSpace: "nowrap",
2976
3007
  lineHeight: "1"
2977
3008
  });
2978
- function _() {
2979
- const k = lt(o), A = lt(n);
2980
- x.textContent = `${k} / ${A}`;
2981
- }
2982
- _(), u.appendChild(f), u.appendChild(x), l.appendChild(a), l.appendChild(u);
2983
- function $() {
2984
- const k = n > 0 ? o / n : 0, A = Math.floor(k * xe);
2985
- for (let w = 0; w < xe; w++)
2986
- b[w].style.background = w <= A ? ot : rt;
2987
- }
2988
- return f.addEventListener("click", (k) => {
2989
- if (n <= 0) return;
2990
- const A = f.getBoundingClientRect(), w = Math.min(
3009
+ function C() {
3010
+ const $ = lt(o), P = lt(s);
3011
+ I.textContent = `${$} / ${P}`;
3012
+ }
3013
+ C(), u.appendChild(m), u.appendChild(I), l.appendChild(a), l.appendChild(u);
3014
+ function w() {
3015
+ const $ = s > 0 ? o / s : 0, P = Math.floor($ * xe);
3016
+ for (let y = 0; y < xe; y++)
3017
+ b[y].style.background = y <= P ? ot : rt;
3018
+ }
3019
+ return m.addEventListener("click", ($) => {
3020
+ if (s <= 0) return;
3021
+ const P = m.getBoundingClientRect(), y = Math.min(
2991
3022
  1,
2992
- Math.max(0, (k.clientX - A.left) / A.width)
3023
+ Math.max(0, ($.clientX - P.left) / P.width)
2993
3024
  );
2994
- r.currentTime = w * n, o = r.currentTime, $(), _();
3025
+ r.currentTime = y * s, o = r.currentTime, w(), C();
2995
3026
  }), a.addEventListener("click", () => {
2996
3027
  i ? r.pause() : r.play().catch(() => {
2997
3028
  });
@@ -3000,13 +3031,13 @@ class Oe {
3000
3031
  }), r.addEventListener("pause", () => {
3001
3032
  i = !1, p();
3002
3033
  }), r.addEventListener("ended", () => {
3003
- i = !1, p(), o = 0, $(), _();
3034
+ i = !1, p(), o = 0, w(), C();
3004
3035
  }), r.addEventListener("timeupdate", () => {
3005
- o = r.currentTime, $(), _();
3036
+ o = r.currentTime, w(), C();
3006
3037
  }), r.addEventListener("loadedmetadata", () => {
3007
- r.duration && isFinite(r.duration) && (n = r.duration, _());
3038
+ r.duration && isFinite(r.duration) && (s = r.duration, C());
3008
3039
  }), r.addEventListener("durationchange", () => {
3009
- r.duration && isFinite(r.duration) && (n = r.duration, _());
3040
+ r.duration && isFinite(r.duration) && (s = r.duration, C());
3010
3041
  }), l;
3011
3042
  }
3012
3043
  }
@@ -3024,8 +3055,8 @@ class Re {
3024
3055
  this.destroy(), this.stream = await navigator.mediaDevices.getUserMedia({ audio: !0 }), this.audioCtx = new AudioContext();
3025
3056
  const t = this.audioCtx.createMediaStreamSource(this.stream);
3026
3057
  this.analyser = this.audioCtx.createAnalyser(), this.analyser.fftSize = 64, t.connect(this.analyser);
3027
- const i = this.detectMimeType(), n = {};
3028
- i && (n.mimeType = i), this.recorder = new MediaRecorder(this.stream, n);
3058
+ const i = this.detectMimeType(), s = {};
3059
+ i && (s.mimeType = i), this.recorder = new MediaRecorder(this.stream, s);
3029
3060
  const o = [];
3030
3061
  this.recorder.ondataavailable = (l) => {
3031
3062
  l.data.size > 0 && o.push(l.data);
@@ -3137,18 +3168,18 @@ class Re {
3137
3168
  if (!this.canvas || !this.analyser) return;
3138
3169
  const e = this.canvas.getContext("2d");
3139
3170
  if (!e) return;
3140
- const t = this.canvas.width, i = this.canvas.height, n = this.analyser.frequencyBinCount, o = new Uint8Array(n);
3171
+ const t = this.canvas.width, i = this.canvas.height, s = this.analyser.frequencyBinCount, o = new Uint8Array(s);
3141
3172
  this.analyser.getByteFrequencyData(o), e.clearRect(0, 0, t, i);
3142
- const r = n, l = Math.max(2, t / r * 0.7), a = (t - l * r) / (r - 1 || 1);
3173
+ const r = s, l = Math.max(2, t / r * 0.7), a = (t - l * r) / (r - 1 || 1);
3143
3174
  for (let c = 0; c < r; c++) {
3144
- const p = o[c] / 255, d = Math.max(2, p * i * 0.85), u = c * (l + a), f = (i - d) / 2, b = 0.4 + p * 0.6;
3145
- e.fillStyle = `rgba(99, 102, 241, ${b})`, e.beginPath(), e.roundRect(u, f, l, d, 1), e.fill();
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;
3176
+ e.fillStyle = `rgba(99, 102, 241, ${b})`, e.beginPath(), e.roundRect(u, m, l, d, 1), e.fill();
3146
3177
  }
3147
3178
  }
3148
3179
  updateTimer() {
3149
3180
  if (!this.timerEl) return;
3150
- const e = Date.now() - this.startTime, t = Math.floor(e / 1e3), i = Math.floor(t / 60), n = t % 60;
3151
- this.timerEl.textContent = `${String(i).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
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")}`;
3152
3183
  }
3153
3184
  cleanupResources() {
3154
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(() => {
@@ -3160,7 +3191,7 @@ class Re {
3160
3191
  this.recorder = null, this.container && (this.container.remove(), this.container = null), this.canvas = null, this.timerEl = null;
3161
3192
  }
3162
3193
  }
3163
- const ct = 80, Ni = "#e2e8f0", Fi = `
3194
+ const ct = 80, Bi = "#e2e8f0", Fi = `
3164
3195
  <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
3165
3196
  <circle cx="14" cy="14" r="14" fill="rgba(0,0,0,0.35)"/>
3166
3197
  <polygon points="11,8 22,14 11,20" fill="rgba(255,255,255,0.9)"/>
@@ -3169,7 +3200,7 @@ const ct = 80, Ni = "#e2e8f0", Fi = `
3169
3200
  <polygon points="11,5 6,9 2,9 2,15 6,15 11,19"/>
3170
3201
  <line x1="23" y1="9" x2="17" y2="15"/>
3171
3202
  <line x1="17" y1="9" x2="23" y2="15"/>
3172
- </svg>`, qi = `
3203
+ </svg>`, Vi = `
3173
3204
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="rgba(255,255,255,0.9)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">
3174
3205
  <polygon points="11,5 6,9 2,9 2,15 6,15 11,19"/>
3175
3206
  <path d="M19.07 4.93a10 10 0 0 1 0 14.14"/>
@@ -3182,7 +3213,7 @@ class Tt {
3182
3213
  * @param posterUrl - Optional poster/thumbnail image URL
3183
3214
  */
3184
3215
  static render(e, t) {
3185
- let i = !1, n = !0;
3216
+ let i = !1, s = !0;
3186
3217
  const o = document.createElement("div");
3187
3218
  Object.assign(o.style, {
3188
3219
  position: "relative",
@@ -3190,7 +3221,7 @@ class Tt {
3190
3221
  width: `${ct}px`,
3191
3222
  height: `${ct}px`,
3192
3223
  borderRadius: "50%",
3193
- border: `2px solid ${Ni}`,
3224
+ border: `2px solid ${Bi}`,
3194
3225
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
3195
3226
  overflow: "hidden",
3196
3227
  cursor: "pointer",
@@ -3240,17 +3271,17 @@ class Tt {
3240
3271
  l.style.opacity = i ? "0" : "1";
3241
3272
  }
3242
3273
  function p() {
3243
- a.style.display = i ? "flex" : "none", a.innerHTML = n ? dt : qi;
3274
+ a.style.display = i ? "flex" : "none", a.innerHTML = s ? dt : Vi;
3244
3275
  }
3245
3276
  return o.addEventListener("click", (d) => {
3246
- d.stopPropagation(), i ? n ? (r.muted = !1, n = !1) : (r.pause(), i = !1, n = !0, r.muted = !0) : (r.muted = !0, n = !0, r.play().catch(() => {
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(() => {
3247
3278
  }), i = !0), c(), p();
3248
3279
  }), r.addEventListener("pause", () => {
3249
- i && (i = !1, n = !0, r.muted = !0, c(), p());
3280
+ i && (i = !1, s = !0, r.muted = !0, c(), p());
3250
3281
  }), o;
3251
3282
  }
3252
3283
  }
3253
- const ht = 60, Vi = `
3284
+ const ht = 60, qi = `
3254
3285
  .vr-overlay {
3255
3286
  display: flex;
3256
3287
  flex-direction: column;
@@ -3357,41 +3388,41 @@ const ht = 60, Vi = `
3357
3388
  color: #0f172a;
3358
3389
  }
3359
3390
  `;
3360
- function pt(s) {
3361
- return s.toString().padStart(2, "0");
3391
+ function pt(n) {
3392
+ return n.toString().padStart(2, "0");
3362
3393
  }
3363
- function Wi(s) {
3364
- const e = Math.floor(s / 60), t = s % 60;
3394
+ function Wi(n) {
3395
+ const e = Math.floor(n / 60), t = n % 60;
3365
3396
  return `${pt(e)}:${pt(t)}`;
3366
3397
  }
3367
3398
  function Xi() {
3368
- const s = [
3399
+ const n = [
3369
3400
  "video/webm;codecs=vp9,opus",
3370
3401
  "video/webm;codecs=vp8,opus",
3371
3402
  "video/webm",
3372
3403
  "video/mp4"
3373
3404
  ];
3374
- for (const e of s)
3405
+ for (const e of n)
3375
3406
  if (MediaRecorder.isTypeSupported(e)) return e;
3376
3407
  return "";
3377
3408
  }
3378
- function Yi(s) {
3409
+ function Yi(n) {
3379
3410
  return new Promise((e, t) => {
3380
- const i = URL.createObjectURL(s), n = document.createElement("video");
3381
- n.muted = !0, n.playsInline = !0, n.preload = "auto", n.src = i, n.addEventListener("loadeddata", () => {
3382
- n.currentTime = 0.01;
3383
- }), n.addEventListener("seeked", () => {
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", () => {
3384
3415
  const o = document.createElement("canvas");
3385
- o.width = n.videoWidth || 240, o.height = n.videoHeight || 240, o.getContext("2d").drawImage(n, 0, 0, o.width, o.height), URL.revokeObjectURL(i), o.toBlob(
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(
3386
3417
  (l) => {
3387
3418
  l ? e(l) : t(new Error("Failed to generate poster frame"));
3388
3419
  },
3389
3420
  "image/jpeg",
3390
3421
  0.85
3391
3422
  );
3392
- }), n.addEventListener("error", () => {
3423
+ }), s.addEventListener("error", () => {
3393
3424
  URL.revokeObjectURL(i), t(new Error("Failed to load video for poster generation"));
3394
- }), n.load();
3425
+ }), s.load();
3395
3426
  });
3396
3427
  }
3397
3428
  class Le {
@@ -3411,9 +3442,9 @@ class Le {
3411
3442
  }
3412
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(() => {
3413
3444
  }));
3414
- const i = Xi(), n = {};
3415
- i && (n.mimeType = i);
3416
- const o = new MediaRecorder(t, n);
3445
+ const i = Xi(), s = {};
3446
+ i && (s.mimeType = i);
3447
+ const o = new MediaRecorder(t, s);
3417
3448
  return this.mediaRecorder = o, o.ondataavailable = (r) => {
3418
3449
  r.data.size > 0 && this.chunks.push(r.data);
3419
3450
  }, o.onstop = () => {
@@ -3436,13 +3467,13 @@ class Le {
3436
3467
  }
3437
3468
  // ── Private ──
3438
3469
  buildUI(e) {
3439
- this.styleEl = document.createElement("style"), this.styleEl.textContent = Vi, document.head.appendChild(this.styleEl), this.root = document.createElement("div"), this.root.className = "vr-overlay";
3470
+ this.styleEl = document.createElement("style"), this.styleEl.textContent = qi, document.head.appendChild(this.styleEl), this.root = document.createElement("div"), this.root.className = "vr-overlay";
3440
3471
  const t = document.createElement("div");
3441
3472
  t.className = "vr-circle-wrapper";
3442
3473
  const i = document.createElement("div");
3443
3474
  i.className = "vr-ring", t.appendChild(i);
3444
- const n = document.createElement("div");
3445
- n.className = "vr-video-circle", this.videoEl = document.createElement("video"), this.videoEl.muted = !0, this.videoEl.playsInline = !0, this.videoEl.setAttribute("playsinline", ""), n.appendChild(this.videoEl), t.appendChild(n), this.root.appendChild(t), this.timerEl = document.createElement("span"), this.timerEl.className = "vr-timer", this.timerEl.textContent = "00:00", this.root.appendChild(this.timerEl);
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);
3446
3477
  const o = document.createElement("div");
3447
3478
  o.className = "vr-actions";
3448
3479
  const r = document.createElement("button");
@@ -3456,8 +3487,8 @@ class Le {
3456
3487
  this.timerEl.textContent = Wi(this.elapsed), e <= 10 ? this.timerEl.classList.add("vr-countdown") : this.timerEl.classList.remove("vr-countdown");
3457
3488
  }
3458
3489
  async handleRecordingComplete() {
3459
- var n, o;
3460
- const e = ((n = this.mediaRecorder) == null ? void 0 : n.mimeType) || "video/webm", t = new Blob(this.chunks, { type: 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 });
3461
3492
  let i;
3462
3493
  try {
3463
3494
  i = await Yi(t);
@@ -3483,10 +3514,10 @@ class Le {
3483
3514
  this.videoEl && (this.videoEl.srcObject = null, this.videoEl = null), this.root && this.root.parentElement && this.root.parentElement.removeChild(this.root), this.root = null, this.styleEl && this.styleEl.parentElement && this.styleEl.parentElement.removeChild(this.styleEl), this.styleEl = null, this.chunks = [], this.elapsed = 0;
3484
3515
  }
3485
3516
  }
3486
- const T = class T {
3517
+ const _ = class _ {
3487
3518
  /** Opens a fullscreen lightbox overlay showing the image. */
3488
3519
  static open(e) {
3489
- T.close();
3520
+ _.close();
3490
3521
  const t = document.createElement("div");
3491
3522
  t.id = "pulse-widget-lightbox", Object.assign(t.style, {
3492
3523
  position: "fixed",
@@ -3530,39 +3561,39 @@ const T = class T {
3530
3561
  }), i.addEventListener("mouseleave", () => {
3531
3562
  i.style.background = "rgba(255,255,255,0.15)";
3532
3563
  }), i.addEventListener("click", (r) => {
3533
- r.stopPropagation(), T.close();
3564
+ r.stopPropagation(), _.close();
3534
3565
  });
3535
- const n = document.createElement("img");
3536
- n.src = e, n.alt = "Lightbox image", Object.assign(n.style, {
3566
+ const s = document.createElement("img");
3567
+ s.src = e, s.alt = "Lightbox image", Object.assign(s.style, {
3537
3568
  maxWidth: "90vw",
3538
3569
  maxHeight: "90vh",
3539
3570
  borderRadius: "8px",
3540
3571
  objectFit: "contain",
3541
3572
  cursor: "default",
3542
3573
  userSelect: "none"
3543
- }), n.addEventListener("click", (r) => {
3574
+ }), s.addEventListener("click", (r) => {
3544
3575
  r.stopPropagation();
3545
- }), t.appendChild(i), t.appendChild(n), t.addEventListener("click", () => {
3546
- T.close();
3576
+ }), t.appendChild(i), t.appendChild(s), t.addEventListener("click", () => {
3577
+ _.close();
3547
3578
  });
3548
3579
  const o = (r) => {
3549
- r.key === "Escape" && T.close();
3580
+ r.key === "Escape" && _.close();
3550
3581
  };
3551
- document.addEventListener("keydown", o), T.overlay = t, T.onKeyDown = o, document.body.appendChild(t), requestAnimationFrame(() => {
3582
+ document.addEventListener("keydown", o), _.overlay = t, _.onKeyDown = o, document.body.appendChild(t), requestAnimationFrame(() => {
3552
3583
  t.style.opacity = "1";
3553
3584
  });
3554
3585
  }
3555
3586
  /** Closes the lightbox if open. */
3556
3587
  static close() {
3557
- if (!T.overlay) return;
3558
- const e = T.overlay;
3559
- T.onKeyDown && (document.removeEventListener("keydown", T.onKeyDown), T.onKeyDown = null), e.style.opacity = "0", e.addEventListener("transitionend", () => {
3588
+ if (!_.overlay) return;
3589
+ const e = _.overlay;
3590
+ _.onKeyDown && (document.removeEventListener("keydown", _.onKeyDown), _.onKeyDown = null), e.style.opacity = "0", e.addEventListener("transitionend", () => {
3560
3591
  e.remove();
3561
- }), T.overlay = null;
3592
+ }), _.overlay = null;
3562
3593
  }
3563
3594
  };
3564
- T.overlay = null, T.onKeyDown = null;
3565
- let ke = T;
3595
+ _.overlay = null, _.onKeyDown = null;
3596
+ let ke = _;
3566
3597
  class ne {
3567
3598
  constructor(e) {
3568
3599
  this.uploading = !1, this.client = e, this.input = document.createElement("input"), this.input.type = "file", this.input.style.display = "none", document.body.appendChild(this.input);
@@ -3576,7 +3607,7 @@ class ne {
3576
3607
  this.input.accept = e, this.input.value = "";
3577
3608
  const i = () => {
3578
3609
  o(), t(null);
3579
- }, n = async () => {
3610
+ }, s = async () => {
3580
3611
  var l;
3581
3612
  o();
3582
3613
  const r = (l = this.input.files) == null ? void 0 : l[0];
@@ -3594,9 +3625,9 @@ class ne {
3594
3625
  this.uploading = !1;
3595
3626
  }
3596
3627
  }, o = () => {
3597
- this.input.removeEventListener("change", n), this.input.removeEventListener("cancel", i);
3628
+ this.input.removeEventListener("change", s), this.input.removeEventListener("cancel", i);
3598
3629
  };
3599
- this.input.addEventListener("change", n, { once: !0 }), this.input.addEventListener("cancel", i, { once: !0 }), this.input.click();
3630
+ this.input.addEventListener("change", s, { once: !0 }), this.input.addEventListener("cancel", i, { once: !0 }), this.input.click();
3600
3631
  });
3601
3632
  }
3602
3633
  /**
@@ -3638,15 +3669,15 @@ class Ji {
3638
3669
  }, this.handlePopoverEscape = (i) => {
3639
3670
  i.key === "Escape" && this.closePopover();
3640
3671
  }, this.handlePopoverOutsideClick = (i) => {
3641
- var n, o;
3672
+ var s, o;
3642
3673
  if (this.popover && !this.popover.contains(i.target)) {
3643
- if ((n = this.container) != null && n.contains(i.target) || (o = this.pickerEl) != null && o.contains(i.target)) return;
3674
+ if ((s = this.container) != null && s.contains(i.target) || (o = this.pickerEl) != null && o.contains(i.target)) return;
3644
3675
  this.closePopover();
3645
3676
  }
3646
3677
  }, this.handleOverlayClick = (i) => {
3647
3678
  this.form && (this.form.remove(), this.form = null);
3648
- const n = window.innerWidth, o = window.innerHeight, r = {
3649
- x: i.clientX / n,
3679
+ const s = window.innerWidth, o = window.innerHeight, r = {
3680
+ x: i.clientX / s,
3650
3681
  y: i.clientY / o,
3651
3682
  scrollX: window.scrollX,
3652
3683
  scrollY: window.scrollY
@@ -3716,8 +3747,8 @@ class Ji {
3716
3747
  this.container && (this.container.style.display = e ? "" : "none");
3717
3748
  }
3718
3749
  destroy() {
3719
- var e, t, i, n, o, r;
3720
- 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), (n = this.typingUnsub2) == null || n.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();
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();
3721
3752
  }
3722
3753
  closePopover() {
3723
3754
  var e;
@@ -3734,8 +3765,8 @@ class Ji {
3734
3765
  t.unshift(`#${i.id}`);
3735
3766
  break;
3736
3767
  }
3737
- const n = i.tagName.toLowerCase(), o = [...i.classList].filter((a) => !a.startsWith("pulse-")).slice(0, 2);
3738
- let r = o.length > 0 ? `${n}.${o.join(".")}` : n;
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;
3739
3770
  const l = i.parentElement;
3740
3771
  if (l) {
3741
3772
  const a = [...l.children].filter((c) => c.tagName === i.tagName);
@@ -3750,13 +3781,13 @@ class Ji {
3750
3781
  }
3751
3782
  showPinForm(e, t, i) {
3752
3783
  this.form = document.createElement("div");
3753
- const n = Math.min(280, window.innerWidth - 32), o = 120;
3784
+ const s = Math.min(280, window.innerWidth - 32), o = 120;
3754
3785
  let r = e + 16, l = t - 10;
3755
- r + n > window.innerWidth - 16 && (r = e - n - 16), l + o > window.innerHeight - 16 && (l = window.innerHeight - o - 16), l < 16 && (l = 16), Object.assign(this.form.style, {
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, {
3756
3787
  position: "fixed",
3757
3788
  left: `${r}px`,
3758
3789
  top: `${l}px`,
3759
- width: `${n}px`,
3790
+ width: `${s}px`,
3760
3791
  zIndex: "10001",
3761
3792
  background: "#fff",
3762
3793
  borderRadius: "12px",
@@ -3790,11 +3821,6 @@ class Ji {
3790
3821
  </button>
3791
3822
  </div>
3792
3823
  <div style="display:flex;gap:6px;">
3793
- <button class="pin-cancel" style="
3794
- padding:6px 14px;border:1px solid #e2e8f0;border-radius:6px;
3795
- font-size:12px;font-weight:500;cursor:pointer;background:#fff;
3796
- font-family:inherit;color:#64748b;
3797
- ">Cancel</button>
3798
3824
  <button class="pin-submit" style="
3799
3825
  padding:6px 14px;background:#6366f1;color:#fff;border:none;
3800
3826
  border-radius:6px;font-size:12px;font-weight:600;cursor:pointer;
@@ -3804,57 +3830,57 @@ class Ji {
3804
3830
  </div>
3805
3831
  <div class="pin-attachments-preview" style="margin-top:6px;"></div>
3806
3832
  `;
3807
- const a = this.form.querySelector("textarea"), c = this.form.querySelector(".pulse-close-btn"), p = this.form.querySelector(".pin-cancel"), d = this.form.querySelector(".pin-submit");
3808
- c.addEventListener("click", () => this.exitPinMode()), p.addEventListener("click", () => this.exitPinMode()), this.pendingAttachmentIds = [], this.upload || (this.upload = new ne(this.client));
3809
- const u = this.form.querySelector(".pin-attachments-preview");
3833
+ const a = this.form.querySelector("textarea"), c = this.form.querySelector(".pulse-close-btn"), p = this.form.querySelector(".pin-submit");
3834
+ c.addEventListener("click", () => this.exitPinMode()), this.pendingAttachmentIds = [], this.upload || (this.upload = new ne(this.client));
3835
+ const d = this.form.querySelector(".pin-attachments-preview");
3810
3836
  this.form.querySelector(".attach-img").addEventListener("click", async () => {
3811
- const f = await this.upload.pickFile("image/*");
3812
- if (f) {
3813
- this.pendingAttachmentIds.push(f.id);
3814
- const b = document.createElement("img");
3815
- b.src = f.thumbnailUrl || f.url, Object.assign(b.style, { width: "48px", height: "48px", borderRadius: "6px", objectFit: "cover", border: "1px solid #e2e8f0" }), u.appendChild(b);
3837
+ const u = await this.upload.pickFile("image/*");
3838
+ if (u) {
3839
+ this.pendingAttachmentIds.push(u.id);
3840
+ const m = document.createElement("img");
3841
+ m.src = u.thumbnailUrl || u.url, Object.assign(m.style, { width: "48px", height: "48px", borderRadius: "6px", objectFit: "cover", border: "1px solid #e2e8f0" }), d.appendChild(m);
3816
3842
  }
3817
3843
  }), this.form.querySelector(".attach-mic").addEventListener("click", async () => {
3818
3844
  this.audioRecorder || (this.audioRecorder = new Re());
3819
- const f = await this.audioRecorder.startRecording(u);
3820
- if (f) {
3821
- const b = await this.upload.uploadBlob(f, "audio.webm");
3822
- if (b) {
3823
- this.pendingAttachmentIds.push(b.id);
3824
- const x = document.createElement("span");
3825
- Object.assign(x.style, { display: "inline-block", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b" }), x.textContent = "🎤 Audio attached", u.appendChild(x);
3845
+ const u = await this.audioRecorder.startRecording(d);
3846
+ if (u) {
3847
+ const m = await this.upload.uploadBlob(u, "audio.webm");
3848
+ if (m) {
3849
+ this.pendingAttachmentIds.push(m.id);
3850
+ const b = document.createElement("span");
3851
+ Object.assign(b.style, { display: "inline-block", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b" }), b.textContent = "🎤 Audio attached", d.appendChild(b);
3826
3852
  }
3827
3853
  }
3828
3854
  }), this.form.querySelector(".attach-video").addEventListener("click", async () => {
3829
3855
  this.videoRecorder || (this.videoRecorder = new Le());
3830
- const f = await this.videoRecorder.startRecording(u);
3831
- if (f) {
3832
- const b = await this.upload.uploadBlob(f.blob, "video.webm");
3833
- if (b) {
3834
- this.pendingAttachmentIds.push(b.id);
3835
- const x = document.createElement("span");
3836
- Object.assign(x.style, { display: "inline-block", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b" }), x.textContent = "🎥 Video attached", u.appendChild(x);
3856
+ const u = await this.videoRecorder.startRecording(d);
3857
+ if (u) {
3858
+ const m = await this.upload.uploadBlob(u.blob, "video.webm");
3859
+ if (m) {
3860
+ this.pendingAttachmentIds.push(m.id);
3861
+ const b = document.createElement("span");
3862
+ Object.assign(b.style, { display: "inline-block", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b" }), b.textContent = "🎥 Video attached", d.appendChild(b);
3837
3863
  }
3838
3864
  }
3839
- }), d.addEventListener("click", () => {
3840
- const f = a.value.trim();
3841
- if (!f && this.pendingAttachmentIds.length === 0) return;
3842
- const b = [...(f || "").matchAll(/@(\w+)/g)].map((x) => x[1]);
3843
- this.client.createThread(f || "(attachment)", { position: i, mentions: b, attachmentIds: this.pendingAttachmentIds.length > 0 ? [...this.pendingAttachmentIds] : void 0 }), this.pendingAttachmentIds = [], this.exitPinMode();
3844
- }), a.addEventListener("keydown", (f) => {
3845
- f.key === "Escape" && this.exitPinMode(), f.stopPropagation();
3865
+ }), p.addEventListener("click", () => {
3866
+ const u = a.value.trim();
3867
+ if (!u && this.pendingAttachmentIds.length === 0) return;
3868
+ const m = [...(u || "").matchAll(/@(\w+)/g)].map((b) => b[1]);
3869
+ this.client.createThread(u, { position: i, mentions: m, attachmentIds: this.pendingAttachmentIds.length > 0 ? [...this.pendingAttachmentIds] : void 0 }), this.pendingAttachmentIds = [], this.exitPinMode();
3870
+ }), a.addEventListener("keydown", (u) => {
3871
+ u.key === "Escape" && this.exitPinMode(), u.stopPropagation();
3846
3872
  }), document.body.appendChild(this.form), requestAnimationFrame(() => a.focus());
3847
3873
  }
3848
3874
  // ── Inline thread popover (shown when a pin dot is clicked) ──
3849
3875
  showThreadPopover(e, t) {
3850
3876
  this.closePopover(), this.popover = document.createElement("div"), this.popover.dataset.threadId = e.id;
3851
- const i = window.innerWidth <= 480, n = i ? window.innerWidth : 300, o = t.getBoundingClientRect();
3877
+ const i = window.innerWidth <= 480, s = i ? window.innerWidth : 300, o = t.getBoundingClientRect();
3852
3878
  let r, l;
3853
- i ? (r = 0, l = window.innerHeight * 0.4) : (r = o.right + 10, l = o.top - 8, r + n > window.innerWidth - 16 && (r = o.left - n - 10), l < 16 && (l = 16)), Object.assign(this.popover.style, {
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, {
3854
3880
  position: "fixed",
3855
3881
  left: `${r}px`,
3856
3882
  top: `${l}px`,
3857
- width: i ? "100vw" : `${n}px`,
3883
+ width: i ? "100vw" : `${s}px`,
3858
3884
  maxHeight: i ? "60vh" : "360px",
3859
3885
  zIndex: "10001",
3860
3886
  background: "#fff",
@@ -3906,7 +3932,7 @@ class Ji {
3906
3932
  }
3907
3933
  const i = (l = this.client.state.user) == null ? void 0 : l.id;
3908
3934
  t.innerHTML = e.comments.map((a) => {
3909
- const c = this.client.state.getUser(a.userId), p = c ? c.name.split(" ").map((w) => w[0]).join("").toUpperCase().slice(0, 2) : "?", d = (c == null ? void 0 : c.color) ?? "#94a3b8", u = this.escapeHtml((c == null ? void 0 : c.name) ?? "Unknown"), f = this.formatTime(a.createdAt), b = i === a.userId, x = a.editedAt ? '<span style="font-size:10px;color:#94a3b8;font-style:italic;">(edited)</span>' : "";
3935
+ const c = this.client.state.getUser(a.userId), p = c ? c.name.split(" ").map((y) => y[0]).join("").toUpperCase().slice(0, 2) : "?", d = (c == null ? void 0 : c.color) ?? "#94a3b8", u = this.escapeHtml((c == null ? void 0 : c.name) ?? "Unknown"), m = this.formatTime(a.createdAt), b = i === a.userId, I = a.editedAt ? '<span style="font-size:10px;color:#94a3b8;font-style:italic;">(edited)</span>' : "";
3910
3936
  if (this.editingPopoverCommentId === a.id)
3911
3937
  return `
3912
3938
  <div style="margin-bottom:10px;" data-comment-id="${a.id}">
@@ -3923,37 +3949,37 @@ class Ji {
3923
3949
  </div>
3924
3950
  </div>
3925
3951
  `;
3926
- const _ = a.body.replace(
3952
+ const C = a.body && a.body !== "(attachment)" ? a.body.replace(
3927
3953
  /@(\w+)/g,
3928
3954
  '<span style="color:#6366f1;font-weight:600;background:#eef2ff;padding:0 3px;border-radius:3px;">@$1</span>'
3929
- ), $ = (a.attachments ?? []).map((w) => {
3930
- if (w.type === "image") {
3931
- const Pt = w.thumbnailUrl || w.url;
3932
- return `<div class="popover-attachment-img" data-full-url="${this.escapeHtml(w.url)}" style="margin:4px 0 4px 29px;cursor:pointer;">
3933
- <img src="${this.escapeHtml(Pt)}" alt="${this.escapeHtml(w.filename)}" style="max-width:180px;max-height:120px;border-radius:8px;border:1px solid #e2e8f0;display:block;" />
3955
+ ) : "", w = (a.attachments ?? []).map((y) => {
3956
+ if (y.type === "image") {
3957
+ const Pt = y.thumbnailUrl || y.url;
3958
+ return `<div class="popover-attachment-img" data-full-url="${this.escapeHtml(y.url)}" style="margin:4px 0 4px 29px;cursor:pointer;">
3959
+ <img src="${this.escapeHtml(Pt)}" alt="${this.escapeHtml(y.filename)}" style="max-width:180px;max-height:120px;border-radius:8px;border:1px solid #e2e8f0;display:block;" />
3934
3960
  </div>`;
3935
3961
  }
3936
- return w.type === "audio" ? `<div class="popover-attachment-audio" data-url="${this.escapeHtml(w.url)}" data-duration="${w.durationMs ?? ""}" style="margin:4px 0 4px 29px;"></div>` : w.type === "video" ? `<div class="popover-attachment-video" data-url="${this.escapeHtml(w.url)}" data-poster="${this.escapeHtml(w.thumbnailUrl ?? "")}" style="margin:4px 0 4px 29px;"></div>` : "";
3937
- }).join(""), k = b ? `<div class="popover-comment-actions" style="display:flex;gap:2px;margin-top:2px;margin-left:29px;">
3962
+ return y.type === "audio" ? `<div class="popover-attachment-audio" data-url="${this.escapeHtml(y.url)}" data-duration="${y.durationMs ?? ""}" style="margin:4px 0 4px 29px;"></div>` : y.type === "video" ? `<div class="popover-attachment-video" data-url="${this.escapeHtml(y.url)}" data-poster="${this.escapeHtml(y.thumbnailUrl ?? "")}" style="margin:4px 0 4px 29px;"></div>` : "";
3963
+ }).join(""), $ = b ? `<div class="popover-comment-actions" style="display:flex;gap:2px;margin-top:2px;margin-left:29px;">
3938
3964
  <button class="edit-btn" data-comment-id="${a.id}" style="border:none;background:none;cursor:pointer;color:#94a3b8;padding:3px;border-radius:4px;display:flex;align-items:center;transition:all 0.15s;" title="Edit"
3939
3965
  onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'"
3940
3966
  onmouseout="this.style.color='#94a3b8';this.style.background='none'">${Gi}</button>
3941
3967
  <button class="delete-btn" data-comment-id="${a.id}" style="border:none;background:none;cursor:pointer;color:#94a3b8;padding:3px;border-radius:4px;display:flex;align-items:center;transition:all 0.15s;" title="Delete"
3942
3968
  onmouseover="this.style.color='#ef4444';this.style.background='#fef2f2'"
3943
3969
  onmouseout="this.style.color='#94a3b8';this.style.background='none'">${Zi}</button>
3944
- </div>` : "", A = this.buildReactionPillsHtml(a.id);
3970
+ </div>` : "", P = this.buildReactionPillsHtml(a.id);
3945
3971
  return `
3946
3972
  <div class="popover-comment" style="margin-bottom:10px;" data-comment-id="${a.id}">
3947
3973
  <div style="display:flex;align-items:center;gap:7px;margin-bottom:2px;">
3948
3974
  <div style="width:22px;height:22px;border-radius:50%;background:${d};color:#fff;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;flex-shrink:0;">${p}</div>
3949
3975
  <span style="font-size:12px;font-weight:600;color:#0f172a;">${u}</span>
3950
- <span style="font-size:10px;color:#94a3b8;">${f}</span>
3951
- ${x}
3976
+ <span style="font-size:10px;color:#94a3b8;">${m}</span>
3977
+ ${I}
3952
3978
  </div>
3953
- <div style="font-size:13px;color:#334155;line-height:1.45;margin-left:29px;word-wrap:break-word;">${_}</div>
3979
+ ${C ? `<div style="font-size:13px;color:#334155;line-height:1.45;margin-left:29px;word-wrap:break-word;">${C}</div>` : ""}
3980
+ ${w}
3954
3981
  ${$}
3955
- ${k}
3956
- ${A}
3982
+ ${P}
3957
3983
  </div>
3958
3984
  `;
3959
3985
  }).join(""), t.querySelectorAll(".edit-btn").forEach((a) => {
@@ -3965,10 +3991,10 @@ class Ji {
3965
3991
  this.client.deleteComment(a.dataset.commentId);
3966
3992
  });
3967
3993
  });
3968
- const n = t.querySelector(".edit-save"), o = t.querySelector(".edit-cancel"), r = t.querySelector(
3994
+ const s = t.querySelector(".edit-save"), o = t.querySelector(".edit-cancel"), r = t.querySelector(
3969
3995
  ".edit-textarea"
3970
3996
  );
3971
- n && r && n.addEventListener("click", () => {
3997
+ s && r && s.addEventListener("click", () => {
3972
3998
  const a = r.value.trim();
3973
3999
  if (!a) return;
3974
4000
  const c = [...a.matchAll(/@(\w+)/g)].map((p) => p[1]);
@@ -4017,7 +4043,7 @@ class Ji {
4017
4043
  padding: "8px 14px 12px",
4018
4044
  borderTop: "1px solid #f1f5f9"
4019
4045
  });
4020
- 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;", n = 'width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
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"';
4021
4047
  t.innerHTML = `
4022
4048
  <div style="display:flex;align-items:center;gap:4px;margin-bottom:6px;">
4023
4049
  <input type="text" placeholder="Reply..."
@@ -4026,13 +4052,13 @@ class Ji {
4026
4052
  </div>
4027
4053
  <div style="display:flex;align-items:center;gap:2px;">
4028
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'">
4029
- <svg ${n}><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>
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>
4030
4056
  </button>
4031
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'">
4032
- <svg ${n}><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>
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>
4033
4059
  </button>
4034
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'">
4035
- <svg ${n}><path d="m22 8-6 4 6 4V8Z"/><rect width="14" height="12" x="2" y="6" rx="2" ry="2"/></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>
4036
4062
  </button>
4037
4063
  <div class="reply-attachments-preview" style="flex:1;display:flex;gap:4px;flex-wrap:wrap;margin-left:4px;"></div>
4038
4064
  </div>
@@ -4064,8 +4090,8 @@ class Ji {
4064
4090
  const p = () => {
4065
4091
  const d = o.value.trim();
4066
4092
  if (!d && a.length === 0) return;
4067
- const u = [...(d || "").matchAll(/@(\w+)/g)].map((f) => f[1]);
4068
- this.client.reply(e.id, d || "(attachment)", u, a.length > 0 ? [...a] : void 0), o.value = "", a.length = 0, l.innerHTML = "";
4093
+ const u = [...(d || "").matchAll(/@(\w+)/g)].map((m) => m[1]);
4094
+ this.client.reply(e.id, d, u, a.length > 0 ? [...a] : void 0), o.value = "", a.length = 0, l.innerHTML = "";
4069
4095
  };
4070
4096
  r.addEventListener("click", p), o.addEventListener("input", () => {
4071
4097
  const d = Date.now(), u = this.lastTypingSendPins.get(e.id) ?? 0;
@@ -4096,7 +4122,7 @@ class Ji {
4096
4122
  zIndex: "10002",
4097
4123
  fontFamily: be
4098
4124
  });
4099
- for (const n of Ki) {
4125
+ for (const s of Ki) {
4100
4126
  const o = document.createElement("button");
4101
4127
  Object.assign(o.style, {
4102
4128
  border: "none",
@@ -4106,29 +4132,29 @@ class Ji {
4106
4132
  padding: "4px",
4107
4133
  borderRadius: "4px",
4108
4134
  lineHeight: "1"
4109
- }), o.textContent = n, o.addEventListener("click", (r) => {
4135
+ }), o.textContent = s, o.addEventListener("click", (r) => {
4110
4136
  r.stopPropagation();
4111
4137
  const a = this.client.state.getReactions(t).find(
4112
4138
  (c) => {
4113
4139
  var p;
4114
- return c.emoji === n && c.userId === ((p = this.client.state.user) == null ? void 0 : p.id);
4140
+ return c.emoji === s && c.userId === ((p = this.client.state.user) == null ? void 0 : p.id);
4115
4141
  }
4116
4142
  );
4117
- a ? this.client.removeReaction(a.id) : this.client.addReaction(t, "comment", n), this.popoverPickerOpen = null, this.removePickerEl();
4143
+ a ? this.client.removeReaction(a.id) : this.client.addReaction(t, "comment", s), this.popoverPickerOpen = null, this.removePickerEl();
4118
4144
  }), this.pickerEl.appendChild(o);
4119
4145
  }
4120
4146
  document.body.appendChild(this.pickerEl);
4121
4147
  }
4122
4148
  buildReactionPillsHtml(e) {
4123
4149
  var a;
4124
- const t = this.client.state.getReactions(e), i = (a = this.client.state.user) == null ? void 0 : a.id, n = /* @__PURE__ */ new Map();
4150
+ const t = this.client.state.getReactions(e), i = (a = this.client.state.user) == null ? void 0 : a.id, s = /* @__PURE__ */ new Map();
4125
4151
  for (const c of t) {
4126
- const p = n.get(c.emoji) ?? { count: 0, ownId: null };
4127
- p.count++, c.userId === i && (p.ownId = c.id), n.set(c.emoji, p);
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);
4128
4154
  }
4129
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;";
4130
4156
  let l = '<div style="margin-left:29px;display:flex;gap:4px;flex-wrap:wrap;margin-top:4px;">';
4131
- for (const [c, { count: p, ownId: d }] of n) {
4157
+ for (const [c, { count: p, ownId: d }] of s) {
4132
4158
  const u = d ? r : o;
4133
4159
  l += `<button data-reaction-emoji="${c}" data-reaction-target="${e}" ${d ? `data-reaction-id="${d}"` : ""} style="${u}">
4134
4160
  <span>${c}</span><span style="font-size:11px;font-weight:600;color:#64748b;">${p}</span>
@@ -4147,20 +4173,20 @@ class Ji {
4147
4173
  fontStyle: "italic",
4148
4174
  minHeight: "16px"
4149
4175
  });
4150
- const n = this.popover.lastElementChild;
4151
- n && this.popover.insertBefore(t, n);
4176
+ const s = this.popover.lastElementChild;
4177
+ s && this.popover.insertBefore(t, s);
4152
4178
  }
4153
- const i = this.client.state.getTypingUsers(e).filter((n) => {
4179
+ const i = this.client.state.getTypingUsers(e).filter((s) => {
4154
4180
  var o;
4155
- return n !== ((o = this.client.state.user) == null ? void 0 : o.id);
4156
- }).map((n) => {
4157
- const o = this.client.state.presence.find((r) => r.user.id === n);
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);
4158
4184
  return (o == null ? void 0 : o.user.name) ?? "Someone";
4159
4185
  });
4160
4186
  i.length === 0 ? t.textContent = "" : i.length === 1 ? t.textContent = `${i[0]} is typing...` : t.textContent = `${i.join(", ")} are typing...`;
4161
4187
  }
4162
4188
  formatTime(e) {
4163
- const t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), o = Math.floor(n / 6e4);
4189
+ const t = new Date(e), s = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), o = Math.floor(s / 6e4);
4164
4190
  if (o < 1) return "now";
4165
4191
  if (o < 60) return `${o}m`;
4166
4192
  const r = Math.floor(o / 60);
@@ -4189,9 +4215,9 @@ class Ji {
4189
4215
  renderPins() {
4190
4216
  if (!this.container) return;
4191
4217
  const e = this.threads.filter((i) => i.position && !i.resolved), t = new Set(e.map((i) => i.id));
4192
- for (const [i, n] of this.pinEls)
4193
- t.has(i) || (n.remove(), this.pinEls.delete(i));
4194
- e.forEach((i, n) => {
4218
+ for (const [i, s] of this.pinEls)
4219
+ t.has(i) || (s.remove(), this.pinEls.delete(i));
4220
+ e.forEach((i, s) => {
4195
4221
  const o = i.position;
4196
4222
  let r = this.pinEls.get(i.id);
4197
4223
  r || (r = document.createElement("div"), Object.assign(r.style, {
@@ -4225,19 +4251,19 @@ class Ji {
4225
4251
  }
4226
4252
  const a = this.threads.find((c) => c.id === i.id);
4227
4253
  a && this.showThreadPopover(a, r);
4228
- }), this.container.appendChild(r), this.pinEls.set(i.id, r)), r.textContent = `${n + 1}`;
4254
+ }), this.container.appendChild(r), this.pinEls.set(i.id, r)), r.textContent = `${s + 1}`;
4229
4255
  const l = this.resolvePosition(o);
4230
4256
  r.style.left = `${l.x}px`, r.style.top = `${l.y}px`;
4231
4257
  });
4232
4258
  }
4233
4259
  }
4234
- var Qi = Object.defineProperty, es = Object.getOwnPropertyDescriptor, j = (s, e, t, i) => {
4235
- for (var n = i > 1 ? void 0 : i ? es(e, t) : e, o = s.length - 1, r; o >= 0; o--)
4236
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
4237
- return i && n && Qi(e, t, n), n;
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;
4238
4264
  };
4239
4265
  const ts = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
4240
- let O = class extends S {
4266
+ let O = class extends T {
4241
4267
  constructor() {
4242
4268
  super(...arguments), this.highlightThreadId = null, this.threadsVersion = 0, this.replyingTo = null, this.editingCommentId = null, this.editBody = "", this.pickerOpenForComment = null, this.typingByThread = /* @__PURE__ */ new Map(), this.reactionsVersion = 0, this.typingTimers = /* @__PURE__ */ new Map(), this.lastTypingSend = /* @__PURE__ */ new Map(), this.replyAttachmentIds = [];
4243
4269
  }
@@ -4251,28 +4277,28 @@ let O = class extends S {
4251
4277
  disconnectedCallback() {
4252
4278
  super.disconnectedCallback(), this.teardownListeners();
4253
4279
  }
4254
- willUpdate(s) {
4280
+ willUpdate(n) {
4255
4281
  this.client && !this.unsub && this.ensureListener();
4256
4282
  }
4257
- updated(s) {
4283
+ updated(n) {
4258
4284
  var e, t;
4259
4285
  (e = this.shadowRoot) == null || e.querySelectorAll(".audio-player-host").forEach((i) => {
4260
4286
  if (i.children.length > 0) return;
4261
- const n = i.dataset.url;
4262
- if (n) {
4287
+ const s = i.dataset.url;
4288
+ if (s) {
4263
4289
  const o = i.dataset.duration ? parseInt(i.dataset.duration) : void 0;
4264
- i.appendChild(Oe.render(n, o));
4290
+ i.appendChild(Oe.render(s, o));
4265
4291
  }
4266
4292
  }), (t = this.shadowRoot) == null || t.querySelectorAll(".video-player-host").forEach((i) => {
4267
4293
  if (i.children.length > 0) return;
4268
- const n = i.dataset.url;
4269
- n && i.appendChild(Tt.render(n, i.dataset.poster || void 0));
4294
+ const s = i.dataset.url;
4295
+ s && i.appendChild(Tt.render(s, i.dataset.poster || void 0));
4270
4296
  });
4271
4297
  }
4272
4298
  teardownListeners() {
4273
- var s, e, t;
4274
- (s = this.unsub) == null || s.call(this), this.unsub = void 0, (e = this.reactionUnsub) == null || e.call(this), this.reactionUnsub = void 0, (t = this.typingUnsub) == null || t.call(this), this.typingUnsub = void 0;
4275
- for (const i of this.typingTimers.values()) clearTimeout(i);
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);
4276
4302
  this.typingTimers.clear();
4277
4303
  }
4278
4304
  ensureListener() {
@@ -4281,123 +4307,125 @@ let O = class extends S {
4281
4307
  setupListener() {
4282
4308
  this.client && (this.unsub = this.client.state.on("threads", () => {
4283
4309
  this.threadsVersion++;
4310
+ }), this.authUnsub = this.client.state.on("auth", () => {
4311
+ this.threadsVersion++;
4284
4312
  }), this.reactionUnsub = this.client.state.on("reactions", () => {
4285
4313
  this.reactionsVersion++;
4286
4314
  }), this.typingUnsub = this.client.state.on(
4287
4315
  "typing",
4288
- ({ threadId: s }) => {
4289
- this.refreshTyping(s);
4316
+ ({ threadId: n }) => {
4317
+ this.refreshTyping(n);
4290
4318
  }
4291
4319
  ));
4292
4320
  }
4293
- refreshTyping(s) {
4294
- const t = this.client.state.getTypingUsers(s).filter((n) => {
4321
+ refreshTyping(n) {
4322
+ const t = this.client.state.getTypingUsers(n).filter((s) => {
4295
4323
  var o;
4296
- return n !== ((o = this.client.state.user) == null ? void 0 : o.id);
4297
- }).map((n) => {
4298
- const o = this.client.state.presence.find((r) => r.user.id === n);
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);
4299
4327
  return (o == null ? void 0 : o.user.name) ?? "Someone";
4300
4328
  }), i = new Map(this.typingByThread);
4301
- i.set(s, t), this.typingByThread = i, this.typingTimers.has(s) && clearTimeout(this.typingTimers.get(s)), this.typingTimers.set(
4302
- s,
4329
+ i.set(n, t), this.typingByThread = i, this.typingTimers.has(n) && clearTimeout(this.typingTimers.get(n)), this.typingTimers.set(
4330
+ n,
4303
4331
  setTimeout(() => {
4304
- this.refreshTyping(s);
4332
+ this.refreshTyping(n);
4305
4333
  }, 3500)
4306
4334
  );
4307
4335
  }
4308
- handleTypingInput(s) {
4309
- const e = Date.now(), t = this.lastTypingSend.get(s) ?? 0;
4310
- e - t >= 2e3 && (this.client.sendTyping(s), this.lastTypingSend.set(s, e));
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));
4311
4339
  }
4312
- toggleReaction(s, e) {
4340
+ toggleReaction(n, e) {
4313
4341
  var o;
4314
- const t = this.client.state.getReactions(s), i = (o = this.client.state.user) == null ? void 0 : o.id, n = t.find(
4342
+ const t = this.client.state.getReactions(n), i = (o = this.client.state.user) == null ? void 0 : o.id, s = t.find(
4315
4343
  (r) => r.emoji === e && r.userId === i
4316
4344
  );
4317
- n ? this.client.removeReaction(n.id) : this.client.addReaction(s, "comment", e), this.pickerOpenForComment = null;
4345
+ s ? this.client.removeReaction(s.id) : this.client.addReaction(n, "comment", e), this.pickerOpenForComment = null;
4318
4346
  }
4319
4347
  fireClose() {
4320
4348
  this.dispatchEvent(
4321
4349
  new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
4322
4350
  );
4323
4351
  }
4324
- scrollToThread(s) {
4352
+ scrollToThread(n) {
4325
4353
  this.updateComplete.then(() => {
4326
4354
  var t;
4327
4355
  const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(
4328
- `[data-thread-id="${s}"]`
4356
+ `[data-thread-id="${n}"]`
4329
4357
  );
4330
4358
  e == null || e.scrollIntoView({ behavior: "smooth", block: "center" });
4331
4359
  });
4332
4360
  }
4333
- parseMentions(s) {
4334
- return s.split(/(@\w+)/g).map(
4361
+ parseMentions(n) {
4362
+ return n.split(/(@\w+)/g).map(
4335
4363
  (t) => t.startsWith("@") ? h`<span class="mention">${t}</span>` : t
4336
4364
  );
4337
4365
  }
4338
- getInitials(s) {
4339
- return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
4366
+ getInitials(n) {
4367
+ return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
4340
4368
  }
4341
- getUserForComment(s) {
4342
- return this.client.state.getUser(s);
4369
+ getUserForComment(n) {
4370
+ return this.client.state.getUser(n);
4343
4371
  }
4344
- formatTime(s) {
4345
- const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
4346
- if (n < 1) return "now";
4347
- if (n < 60) return `${n}m`;
4348
- const o = Math.floor(n / 60);
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);
4349
4377
  return o < 24 ? `${o}h` : e.toLocaleDateString();
4350
4378
  }
4351
4379
  async handleAttachImage() {
4352
4380
  this.upload || (this.upload = new ne(this.client));
4353
- const s = await this.upload.pickFile("image/*");
4354
- s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
4381
+ const n = await this.upload.pickFile("image/*");
4382
+ n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
4355
4383
  }
4356
- async handleRecordAudio(s) {
4384
+ async handleRecordAudio(n) {
4357
4385
  var i;
4358
4386
  this.upload || (this.upload = new ne(this.client)), this.audioRecorder || (this.audioRecorder = new Re());
4359
- const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${s}"]`), t = await this.audioRecorder.startRecording(e ?? document.body);
4387
+ const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${n}"]`), t = await this.audioRecorder.startRecording(e ?? document.body);
4360
4388
  if (t) {
4361
- const n = await this.upload.uploadBlob(t, "audio.webm");
4362
- n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
4389
+ const s = await this.upload.uploadBlob(t, "audio.webm");
4390
+ s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
4363
4391
  }
4364
4392
  }
4365
- async handleRecordVideo(s) {
4393
+ async handleRecordVideo(n) {
4366
4394
  var i;
4367
4395
  this.upload || (this.upload = new ne(this.client)), this.videoRecorder || (this.videoRecorder = new Le());
4368
- const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${s}"]`), t = await this.videoRecorder.startRecording(e ?? document.body);
4396
+ const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${n}"]`), t = await this.videoRecorder.startRecording(e ?? document.body);
4369
4397
  if (t) {
4370
- const n = await this.upload.uploadBlob(t.blob, "video.webm");
4371
- n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
4398
+ const s = await this.upload.uploadBlob(t.blob, "video.webm");
4399
+ s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
4372
4400
  }
4373
4401
  }
4374
- handleReply(s, e) {
4402
+ handleReply(n, e) {
4375
4403
  e.preventDefault();
4376
- const i = e.target.querySelector("input"), n = i.value.trim();
4377
- if (!n && this.replyAttachmentIds.length === 0) return;
4378
- const o = [...(n || "").matchAll(/@(\w+)/g)].map((r) => r[1]);
4379
- this.client.reply(s, n || "(attachment)", o, this.replyAttachmentIds.length > 0 ? [...this.replyAttachmentIds] : void 0), i.value = "", this.replyAttachmentIds = [], this.replyingTo = null;
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;
4380
4408
  }
4381
- isOwnComment(s) {
4409
+ isOwnComment(n) {
4382
4410
  var e, t;
4383
- return ((t = (e = this.client) == null ? void 0 : e.state.user) == null ? void 0 : t.id) === s.userId;
4411
+ return ((t = (e = this.client) == null ? void 0 : e.state.user) == null ? void 0 : t.id) === n.userId;
4384
4412
  }
4385
- startEdit(s) {
4386
- this.editingCommentId = s.id, this.editBody = s.body;
4413
+ startEdit(n) {
4414
+ this.editingCommentId = n.id, this.editBody = n.body;
4387
4415
  }
4388
4416
  cancelEdit() {
4389
4417
  this.editingCommentId = null, this.editBody = "";
4390
4418
  }
4391
- saveEdit(s) {
4419
+ saveEdit(n) {
4392
4420
  const e = this.editBody.trim();
4393
4421
  if (!e) return;
4394
4422
  const t = [...e.matchAll(/@(\w+)/g)].map((i) => i[1]);
4395
- this.client.editComment(s, e, t), this.editingCommentId = null, this.editBody = "";
4423
+ this.client.editComment(n, e, t), this.editingCommentId = null, this.editBody = "";
4396
4424
  }
4397
- deleteComment(s) {
4398
- this.client.deleteComment(s);
4425
+ deleteComment(n) {
4426
+ this.client.deleteComment(n);
4399
4427
  }
4400
- renderEditForm(s) {
4428
+ renderEditForm(n) {
4401
4429
  return h`
4402
4430
  <div class="edit-form">
4403
4431
  <textarea
@@ -4407,16 +4435,16 @@ let O = class extends S {
4407
4435
  }}
4408
4436
  ></textarea>
4409
4437
  <div class="edit-actions">
4410
- <button class="pw-btn pw-btn-primary" @click=${() => this.saveEdit(s.id)}>Save</button>
4438
+ <button class="pw-btn pw-btn-primary" @click=${() => this.saveEdit(n.id)}>Save</button>
4411
4439
  <button class="pw-btn" @click=${this.cancelEdit}>Cancel</button>
4412
4440
  </div>
4413
4441
  </div>
4414
4442
  `;
4415
4443
  }
4416
- renderReactions(s) {
4417
- var n;
4444
+ renderReactions(n) {
4445
+ var s;
4418
4446
  this.reactionsVersion;
4419
- const e = this.client.state.getReactions(s.id), t = (n = this.client.state.user) == null ? void 0 : n.id, i = /* @__PURE__ */ new Map();
4447
+ const e = this.client.state.getReactions(n.id), t = (s = this.client.state.user) == null ? void 0 : s.id, i = /* @__PURE__ */ new Map();
4420
4448
  for (const o of e)
4421
4449
  i.has(o.emoji) || i.set(o.emoji, []), i.get(o.emoji).push(o);
4422
4450
  return h`
@@ -4427,7 +4455,7 @@ let O = class extends S {
4427
4455
  return h`
4428
4456
  <button
4429
4457
  class="reaction-pill ${l ? "own" : ""}"
4430
- @click=${() => this.toggleReaction(s.id, o)}
4458
+ @click=${() => this.toggleReaction(n.id, o)}
4431
4459
  >
4432
4460
  <span>${o}</span>
4433
4461
  <span class="count">${r.length}</span>
@@ -4438,41 +4466,41 @@ let O = class extends S {
4438
4466
  <button
4439
4467
  class="reaction-add-btn"
4440
4468
  @click=${() => {
4441
- this.pickerOpenForComment = this.pickerOpenForComment === s.id ? null : s.id;
4469
+ this.pickerOpenForComment = this.pickerOpenForComment === n.id ? null : n.id;
4442
4470
  }}
4443
4471
  title="Add reaction"
4444
4472
  >
4445
4473
  +
4446
- ${this.pickerOpenForComment === s.id ? h`
4474
+ ${this.pickerOpenForComment === n.id ? h`
4447
4475
  <div class="emoji-picker">
4448
4476
  ${ts.map(
4449
4477
  (o) => h`
4450
4478
  <button @click=${(r) => {
4451
- r.stopPropagation(), this.toggleReaction(s.id, o);
4479
+ r.stopPropagation(), this.toggleReaction(n.id, o);
4452
4480
  }}>${o}</button>
4453
4481
  `
4454
4482
  )}
4455
4483
  </div>
4456
- ` : m}
4484
+ ` : f}
4457
4485
  </button>
4458
4486
  </div>
4459
4487
  `;
4460
4488
  }
4461
- renderTypingIndicator(s) {
4462
- const e = this.typingByThread.get(s) ?? [];
4463
- if (e.length === 0) return m;
4489
+ renderTypingIndicator(n) {
4490
+ const e = this.typingByThread.get(n) ?? [];
4491
+ if (e.length === 0) return f;
4464
4492
  const t = e.length === 1 ? `${e[0]} is typing...` : `${e.join(", ")} are typing...`;
4465
4493
  return h`<div class="typing-indicator">${t}</div>`;
4466
4494
  }
4467
4495
  sortedThreads() {
4468
- return [...this.threads].sort((s, e) => {
4469
- if (s.resolved !== e.resolved) return s.resolved ? 1 : -1;
4470
- const t = s.comments.length ? new Date(s.comments[s.comments.length - 1].createdAt).getTime() : 0;
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;
4471
4499
  return (e.comments.length ? new Date(e.comments[e.comments.length - 1].createdAt).getTime() : 0) - t;
4472
4500
  });
4473
4501
  }
4474
4502
  render() {
4475
- const s = this.sortedThreads();
4503
+ const n = this.sortedThreads();
4476
4504
  return h`
4477
4505
  <div class="panel">
4478
4506
  <div class="panel-header">
@@ -4481,15 +4509,15 @@ let O = class extends S {
4481
4509
  <span class="thread-count">${this.threads.length}</span>
4482
4510
  </span>
4483
4511
  <button class="close-btn" @click=${this.fireClose} title="Close">
4484
- ${E(me, 16)}
4512
+ ${k(me, 16)}
4485
4513
  </button>
4486
4514
  </div>
4487
4515
 
4488
4516
  <div class="panel-body pw-scrollable">
4489
- ${s.length === 0 ? h`<div class="empty">
4517
+ ${n.length === 0 ? h`<div class="empty">
4490
4518
  <div class="empty-icon">&#128172;</div>
4491
4519
  No comments yet
4492
- </div>` : s.map((e) => this.renderThread(e))}
4520
+ </div>` : n.map((e) => this.renderThread(e))}
4493
4521
  </div>
4494
4522
 
4495
4523
  <div class="pin-hint">
@@ -4498,9 +4526,9 @@ let O = class extends S {
4498
4526
  </div>
4499
4527
  `;
4500
4528
  }
4501
- renderAttachments(s) {
4502
- return !s || s.length === 0 ? m : h`
4503
- ${s.map((e) => {
4529
+ renderAttachments(n) {
4530
+ return !n || n.length === 0 ? f : h`
4531
+ ${n.map((e) => {
4504
4532
  if (e.type === "image") {
4505
4533
  const t = e.thumbnailUrl || e.url;
4506
4534
  return h`
@@ -4522,52 +4550,52 @@ let O = class extends S {
4522
4550
  <div class="comment-attachment-media" id="video-${e.id}">
4523
4551
  ${this.renderVideoPlayer(e)}
4524
4552
  </div>
4525
- ` : m;
4553
+ ` : f;
4526
4554
  })}
4527
4555
  `;
4528
4556
  }
4529
- renderAudioPlayer(s) {
4530
- const e = document.createElement("div"), t = Oe.render(s.url, s.durationMs);
4531
- return e.appendChild(t), h`<div class="audio-player-host" data-url=${s.url} data-duration=${s.durationMs ?? ""}></div>`;
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>`;
4532
4560
  }
4533
- renderVideoPlayer(s) {
4534
- return h`<div class="video-player-host" data-url=${s.url} data-poster=${s.thumbnailUrl ?? ""}></div>`;
4561
+ renderVideoPlayer(n) {
4562
+ return h`<div class="video-player-host" data-url=${n.url} data-poster=${n.thumbnailUrl ?? ""}></div>`;
4535
4563
  }
4536
- renderThread(s) {
4537
- const e = this.highlightThreadId === s.id;
4564
+ renderThread(n) {
4565
+ const e = this.highlightThreadId === n.id;
4538
4566
  return h`
4539
4567
  <div
4540
- class="thread ${s.resolved ? "resolved" : ""} ${e ? "highlighted" : ""}"
4541
- data-thread-id=${s.id}
4568
+ class="thread ${n.resolved ? "resolved" : ""} ${e ? "highlighted" : ""}"
4569
+ data-thread-id=${n.id}
4542
4570
  >
4543
- ${s.position ? h`<div class="pin-badge">
4544
- ${E(_t, 12)}
4571
+ ${n.position ? h`<div class="pin-badge">
4572
+ ${k(_t, 12)}
4545
4573
  Pinned
4546
- </div>` : m}
4547
- ${s.comments.map((t, i) => {
4548
- const n = this.getUserForComment(t.userId), o = this.isOwnComment(t), r = this.editingCommentId === t.id;
4574
+ </div>` : f}
4575
+ ${n.comments.map((t, i) => {
4576
+ const s = this.getUserForComment(t.userId), o = this.isOwnComment(t), r = this.editingCommentId === t.id;
4549
4577
  return h`
4550
- ${i > 0 ? h`<div class="comment-divider"></div>` : m}
4578
+ ${i > 0 ? h`<div class="comment-divider"></div>` : f}
4551
4579
  <div class="comment">
4552
4580
  <div class="comment-header">
4553
4581
  <div
4554
4582
  class="comment-avatar"
4555
- style="background:${(n == null ? void 0 : n.color) ?? "#94a3b8"}"
4583
+ style="background:${(s == null ? void 0 : s.color) ?? "#94a3b8"}"
4556
4584
  >
4557
- ${n ? this.getInitials(n.name) : "?"}
4585
+ ${s ? this.getInitials(s.name) : "?"}
4558
4586
  </div>
4559
- <span class="comment-author">${(n == null ? void 0 : n.name) ?? "Unknown"}</span>
4587
+ <span class="comment-author">${(s == null ? void 0 : s.name) ?? "Unknown"}</span>
4560
4588
  <span class="comment-time">${this.formatTime(t.createdAt)}</span>
4561
- ${t.editedAt ? h`<span class="edited-badge">(edited)</span>` : m}
4589
+ ${t.editedAt ? h`<span class="edited-badge">(edited)</span>` : f}
4562
4590
  </div>
4563
4591
  ${r ? this.renderEditForm(t) : h`
4564
- <div class="comment-body">${this.parseMentions(t.body)}</div>
4592
+ ${t.body && t.body !== "(attachment)" ? h`<div class="comment-body">${this.parseMentions(t.body)}</div>` : f}
4565
4593
  ${this.renderAttachments(t.attachments ?? [])}
4566
4594
  `}
4567
4595
  ${o && !r ? h`<div class="comment-actions">
4568
- <button @click=${() => this.startEdit(t)} title="Edit">${E(Ai, 14)}</button>
4569
- <button class="danger" @click=${() => this.deleteComment(t.id)} title="Delete">${E(Mi, 14)}</button>
4570
- </div>` : m}
4596
+ <button @click=${() => this.startEdit(t)} title="Edit">${k(Ai, 14)}</button>
4597
+ <button class="danger" @click=${() => this.deleteComment(t.id)} title="Delete">${k(Mi, 14)}</button>
4598
+ </div>` : f}
4571
4599
  ${this.renderReactions(t)}
4572
4600
  </div>
4573
4601
  `;
@@ -4575,29 +4603,29 @@ let O = class extends S {
4575
4603
 
4576
4604
  <div class="thread-actions">
4577
4605
  <button
4578
- @click=${() => this.replyingTo = this.replyingTo === s.id ? null : s.id}
4606
+ @click=${() => this.replyingTo = this.replyingTo === n.id ? null : n.id}
4579
4607
  >
4580
4608
  Reply
4581
4609
  </button>
4582
4610
  <button
4583
- @click=${() => this.client.resolveThread(s.id, !s.resolved)}
4611
+ @click=${() => this.client.resolveThread(n.id, !n.resolved)}
4584
4612
  >
4585
- ${s.resolved ? "Reopen" : "Resolve"}
4613
+ ${n.resolved ? "Reopen" : "Resolve"}
4586
4614
  </button>
4587
4615
  </div>
4588
4616
 
4589
- ${this.renderTypingIndicator(s.id)}
4617
+ ${this.renderTypingIndicator(n.id)}
4590
4618
 
4591
- ${this.replyingTo === s.id ? h`
4619
+ ${this.replyingTo === n.id ? h`
4592
4620
  <form
4593
4621
  class="reply-form"
4594
- @submit=${(t) => this.handleReply(s.id, t)}
4622
+ @submit=${(t) => this.handleReply(n.id, t)}
4595
4623
  >
4596
4624
  <div class="reply-input-row">
4597
4625
  <input
4598
4626
  type="text"
4599
4627
  placeholder="Reply..."
4600
- @input=${() => this.handleTypingInput(s.id)}
4628
+ @input=${() => this.handleTypingInput(n.id)}
4601
4629
  />
4602
4630
  <button class="pw-btn pw-btn-primary" type="submit">Send</button>
4603
4631
  </div>
@@ -4607,19 +4635,19 @@ let O = class extends S {
4607
4635
  class="reply-media-btn"
4608
4636
  title="Attach image"
4609
4637
  @click=${() => this.handleAttachImage()}
4610
- >${E(Si, 16)}</button>
4638
+ >${k(Si, 16)}</button>
4611
4639
  <button
4612
4640
  type="button"
4613
4641
  class="reply-media-btn"
4614
4642
  title="Record audio"
4615
- @click=${() => this.handleRecordAudio(s.id)}
4616
- >${E(Ti, 16)}</button>
4643
+ @click=${() => this.handleRecordAudio(n.id)}
4644
+ >${k(Ti, 16)}</button>
4617
4645
  <button
4618
4646
  type="button"
4619
4647
  class="reply-media-btn"
4620
4648
  title="Record video"
4621
- @click=${() => this.handleRecordVideo(s.id)}
4622
- >${E(Oi, 16)}</button>
4649
+ @click=${() => this.handleRecordVideo(n.id)}
4650
+ >${k(Oi, 16)}</button>
4623
4651
  <div class="reply-preview">
4624
4652
  ${this.replyAttachmentIds.map(
4625
4653
  (t, i) => h`<span class="reply-preview-badge">Attached #${i + 1}</span>`
@@ -4627,7 +4655,7 @@ let O = class extends S {
4627
4655
  </div>
4628
4656
  </div>
4629
4657
  </form>
4630
- ` : m}
4658
+ ` : f}
4631
4659
  </div>
4632
4660
  `;
4633
4661
  }
@@ -4636,7 +4664,7 @@ O.styles = [
4636
4664
  ee,
4637
4665
  ge,
4638
4666
  _e,
4639
- I`
4667
+ A`
4640
4668
  :host {
4641
4669
  display: block;
4642
4670
  }
@@ -5185,10 +5213,10 @@ j([
5185
5213
  O = j([
5186
5214
  R("pulse-widget-comments-panel")
5187
5215
  ], O);
5188
- var is = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, qe = (s, e, t, i) => {
5189
- for (var n = i > 1 ? void 0 : i ? ss(e, t) : e, o = s.length - 1, r; o >= 0; o--)
5190
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
5191
- return i && n && is(e, t, n), n;
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;
5192
5220
  };
5193
5221
  const ns = {
5194
5222
  "comment:created": "left a comment",
@@ -5203,7 +5231,7 @@ const ns = {
5203
5231
  "thread:resolved": "✅",
5204
5232
  "reaction:added": "🎉"
5205
5233
  };
5206
- let de = class extends S {
5234
+ let de = class extends T {
5207
5235
  constructor() {
5208
5236
  super(...arguments), this.notifications = [];
5209
5237
  }
@@ -5211,18 +5239,18 @@ let de = class extends S {
5211
5239
  super.connectedCallback(), this.setupListener();
5212
5240
  }
5213
5241
  disconnectedCallback() {
5214
- var s;
5215
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
5242
+ var n;
5243
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
5216
5244
  }
5217
- updated(s) {
5245
+ updated(n) {
5218
5246
  var e;
5219
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
5247
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
5220
5248
  }
5221
5249
  setupListener() {
5222
5250
  this.client && (this.notifications = this.client.state.notifications, this.unsub = this.client.state.on(
5223
5251
  "notifications",
5224
- (s) => {
5225
- this.notifications = [...s];
5252
+ (n) => {
5253
+ this.notifications = [...n];
5226
5254
  }
5227
5255
  ));
5228
5256
  }
@@ -5231,35 +5259,35 @@ let de = class extends S {
5231
5259
  new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
5232
5260
  );
5233
5261
  }
5234
- handleClick(s) {
5235
- s.read || this.client.markRead(s.id);
5262
+ handleClick(n) {
5263
+ n.read || this.client.markRead(n.id);
5236
5264
  }
5237
- getActorName(s) {
5265
+ getActorName(n) {
5238
5266
  var e;
5239
- return ((e = this.client.state.getUser(s)) == null ? void 0 : e.name) ?? "Someone";
5267
+ return ((e = this.client.state.getUser(n)) == null ? void 0 : e.name) ?? "Someone";
5240
5268
  }
5241
- formatTime(s) {
5242
- const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
5243
- if (n < 1) return "now";
5244
- if (n < 60) return `${n}m`;
5245
- const o = Math.floor(n / 60);
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);
5246
5274
  return o < 24 ? `${o}h` : e.toLocaleDateString();
5247
5275
  }
5248
5276
  render() {
5249
- const s = this.notifications.filter((e) => !e.read).length;
5277
+ const n = this.notifications.filter((e) => !e.read).length;
5250
5278
  return h`
5251
5279
  <div class="panel">
5252
5280
  <div class="panel-header">
5253
5281
  <span class="panel-title">
5254
5282
  Notifications
5255
- ${s > 0 ? h`<span class="unread-badge">${s}</span>` : m}
5283
+ ${n > 0 ? h`<span class="unread-badge">${n}</span>` : f}
5256
5284
  </span>
5257
5285
  <div style="display:flex;align-items:center;gap:4px;">
5258
- ${s > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
5286
+ ${n > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
5259
5287
  Mark all read
5260
- </button>` : m}
5288
+ </button>` : f}
5261
5289
  <button class="close-btn" @click=${this.fireClose} title="Close">
5262
- ${E(me, 16)}
5290
+ ${k(me, 16)}
5263
5291
  </button>
5264
5292
  </div>
5265
5293
  </div>
@@ -5295,7 +5323,7 @@ de.styles = [
5295
5323
  ee,
5296
5324
  ge,
5297
5325
  _e,
5298
- I`
5326
+ A`
5299
5327
  :host {
5300
5328
  display: block;
5301
5329
  }
@@ -5488,13 +5516,13 @@ de.styles = [
5488
5516
  }
5489
5517
  `
5490
5518
  ];
5491
- qe([
5519
+ Ve([
5492
5520
  g({ attribute: !1 })
5493
5521
  ], de.prototype, "client", 2);
5494
- qe([
5522
+ Ve([
5495
5523
  v()
5496
5524
  ], de.prototype, "notifications", 2);
5497
- de = qe([
5525
+ de = Ve([
5498
5526
  R("pulse-widget-notifications-panel")
5499
5527
  ], de);
5500
5528
  const rs = 3e3;
@@ -5527,13 +5555,13 @@ class as {
5527
5555
  if (i)
5528
5556
  i.position = t;
5529
5557
  else {
5530
- const n = this.client.state.presence.find(
5558
+ const s = this.client.state.presence.find(
5531
5559
  (o) => o.user.id === e
5532
5560
  );
5533
- n && this.cursors.set(e, {
5561
+ s && this.cursors.set(e, {
5534
5562
  userId: e,
5535
- name: n.user.name,
5536
- color: n.user.color,
5563
+ name: s.user.name,
5564
+ color: s.user.color,
5537
5565
  position: t
5538
5566
  });
5539
5567
  }
@@ -5543,17 +5571,17 @@ class as {
5543
5571
  ), this.unsubs.push(
5544
5572
  this.client.state.on("presence", (e) => {
5545
5573
  var i;
5546
- const t = new Set(e.map((n) => n.user.id));
5547
- for (const n of this.cursors.keys())
5548
- t.has(n) || (this.cursors.delete(n), (i = this.cursorEls.get(n)) == null || i.remove(), this.cursorEls.delete(n), this.cursorLastSeen.delete(n));
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));
5549
5577
  })
5550
5578
  ), this.setSending(!0), this.staleTimer = setInterval(() => {
5551
5579
  const e = Date.now();
5552
5580
  for (const [t, i] of this.cursorLastSeen)
5553
5581
  if (e - i > rs) {
5554
5582
  this.cursors.delete(t);
5555
- const n = this.cursorEls.get(t);
5556
- n && n.remove(), this.cursorEls.delete(t), this.cursorLastSeen.delete(t);
5583
+ const s = this.cursorEls.get(t);
5584
+ s && s.remove(), this.cursorEls.delete(t), this.cursorLastSeen.delete(t);
5557
5585
  }
5558
5586
  }, 1e3));
5559
5587
  }
@@ -5577,7 +5605,7 @@ class as {
5577
5605
  if (!this.container) return;
5578
5606
  const i = this.client.state.presence.find(
5579
5607
  (r) => r.user.id === e
5580
- ), n = (i == null ? void 0 : i.user.color) ?? "#6366f1", o = document.createElement("div");
5608
+ ), s = (i == null ? void 0 : i.user.color) ?? "#6366f1", o = document.createElement("div");
5581
5609
  Object.assign(o.style, {
5582
5610
  position: "absolute",
5583
5611
  left: `${t.x}px`,
@@ -5585,7 +5613,7 @@ class as {
5585
5613
  width: "0px",
5586
5614
  height: "0px",
5587
5615
  borderRadius: "50%",
5588
- border: `3px solid ${n}`,
5616
+ border: `3px solid ${s}`,
5589
5617
  transform: "translate(-50%, -50%)",
5590
5618
  pointerEvents: "none",
5591
5619
  opacity: "1",
@@ -5596,8 +5624,8 @@ class as {
5596
5624
  }
5597
5625
  showEmojiDrop(e, t, i) {
5598
5626
  if (!this.container) return;
5599
- const n = document.createElement("div");
5600
- Object.assign(n.style, {
5627
+ const s = document.createElement("div");
5628
+ Object.assign(s.style, {
5601
5629
  position: "absolute",
5602
5630
  left: `${i.x}px`,
5603
5631
  top: `${i.y}px`,
@@ -5607,9 +5635,9 @@ class as {
5607
5635
  transform: "translate(-50%, 0)",
5608
5636
  zIndex: "10",
5609
5637
  lineHeight: "1"
5610
- }), n.textContent = t, this.container.appendChild(n), requestAnimationFrame(() => {
5611
- n.style.transform = "translate(-50%, -80px)", n.style.opacity = "0";
5612
- }), setTimeout(() => n.remove(), 2e3);
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);
5613
5641
  }
5614
5642
  destroy() {
5615
5643
  this.disable();
@@ -5626,9 +5654,9 @@ class as {
5626
5654
  willChange: "transform",
5627
5655
  pointerEvents: "none"
5628
5656
  });
5629
- const n = t.color || "#e74c3c";
5657
+ const s = t.color || "#e74c3c";
5630
5658
  i.innerHTML = `
5631
- <svg width="24" height="24" viewBox="0 0 16 16" fill="${n}" style="filter:drop-shadow(0 2px 4px rgba(0,0,0,0.4))">
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))">
5632
5660
  <path d="M0 0l6.5 16L8 9l7-2.5z" stroke="#fff" stroke-width="1"/>
5633
5661
  </svg>
5634
5662
  <span style="
@@ -5637,7 +5665,7 @@ class as {
5637
5665
  font-size:12px;font-weight:700;
5638
5666
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
5639
5667
  color:#fff;white-space:nowrap;
5640
- background:${n};
5668
+ background:${s};
5641
5669
  box-shadow:0 2px 10px rgba(0,0,0,0.25);
5642
5670
  letter-spacing:0.01em;
5643
5671
  ">${t.name}</span>
@@ -5651,26 +5679,26 @@ class ls {
5651
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) => {
5652
5680
  var l, a, c;
5653
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 };
5654
- const i = this.client.state.user, n = (i == null ? void 0 : i.color) ?? "#6366f1", r = 2 + (t.pressure > 0 ? t.pressure : 0.5) * 4;
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;
5655
5683
  this.currentPath = document.createElementNS(
5656
5684
  "http://www.w3.org/2000/svg",
5657
5685
  "polyline"
5658
- ), this.currentPath.setAttribute("fill", "none"), this.currentPath.setAttribute("stroke", n), this.currentPath.setAttribute("stroke-width", String(r)), this.currentPath.setAttribute("stroke-linecap", "round"), this.currentPath.setAttribute("stroke-linejoin", "round"), this.currentPath.setAttribute(
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(
5659
5687
  "points",
5660
5688
  `${t.clientX},${t.clientY}`
5661
5689
  ), (c = this.container) == null || c.appendChild(this.currentPath), document.addEventListener("pointermove", this.handlePointerMove), document.addEventListener("pointerup", this.handlePointerUp);
5662
5690
  }, this.handlePointerMove = (t) => {
5663
5691
  if (!this.currentPath || !this.lastPoint) return;
5664
- const i = t.clientX - this.lastPoint.x, n = t.clientY - this.lastPoint.y;
5665
- if (i * i + n * n < 4) return;
5692
+ const i = t.clientX - this.lastPoint.x, s = t.clientY - this.lastPoint.y;
5693
+ if (i * i + s * s < 4) return;
5666
5694
  this.currentPoints.push({ x: t.clientX, y: t.clientY }), this.lastPoint = { x: t.clientX, y: t.clientY };
5667
5695
  const o = this.currentPoints.map((r) => `${r.x},${r.y}`).join(" ");
5668
5696
  this.currentPath.setAttribute("points", o);
5669
5697
  }, this.handlePointerUp = () => {
5670
5698
  var t;
5671
5699
  if (document.removeEventListener("pointermove", this.handlePointerMove), document.removeEventListener("pointerup", this.handlePointerUp), this.currentPoints.length > 1) {
5672
- const i = this.client.state.user, n = (i == null ? void 0 : i.color) ?? "#6366f1";
5673
- this.client.drawStroke(this.currentPoints, n, 3), this.currentPath && this.scheduleFade(this.currentPath);
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);
5674
5702
  } else
5675
5703
  (t = this.currentPath) == null || t.remove();
5676
5704
  this.currentPoints = [], this.currentPath = null, this.lastPoint = null;
@@ -5684,8 +5712,8 @@ class ls {
5684
5712
  "style",
5685
5713
  "position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:9989;"
5686
5714
  ), document.body.appendChild(this.container), this.unsubs.push(
5687
- this.client.state.on("draw-stroke", ({ userId: e, points: t, color: i, width: n }) => {
5688
- this.renderStroke(t, i, n);
5715
+ this.client.state.on("draw-stroke", ({ userId: e, points: t, color: i, width: s }) => {
5716
+ this.renderStroke(t, i, s);
5689
5717
  })
5690
5718
  ), this.unsubs.push(
5691
5719
  this.client.state.on("draw-clear", ({ userId: e }) => {
@@ -5711,14 +5739,14 @@ class ls {
5711
5739
  }
5712
5740
  renderStroke(e, t, i) {
5713
5741
  if (!this.container || e.length < 2) return;
5714
- const n = document.createElementNS(
5742
+ const s = document.createElementNS(
5715
5743
  "http://www.w3.org/2000/svg",
5716
5744
  "polyline"
5717
5745
  );
5718
- n.setAttribute("fill", "none"), n.setAttribute("stroke", t), n.setAttribute("stroke-width", String(i)), n.setAttribute("stroke-linecap", "round"), n.setAttribute("stroke-linejoin", "round"), n.setAttribute(
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(
5719
5747
  "points",
5720
5748
  e.map((o) => `${o.x},${o.y}`).join(" ")
5721
- ), n.style.willChange = "opacity", this.container.appendChild(n), this.scheduleFade(n);
5749
+ ), s.style.willChange = "opacity", this.container.appendChild(s), this.scheduleFade(s);
5722
5750
  }
5723
5751
  scheduleFade(e) {
5724
5752
  const t = setTimeout(() => {
@@ -5729,48 +5757,48 @@ class ls {
5729
5757
  this.fadeTimers.set(e, t);
5730
5758
  }
5731
5759
  }
5732
- function cs(s) {
5733
- if (!s.rangeCount || s.isCollapsed) return null;
5734
- const e = s.getRangeAt(0), t = e.startContainer, i = e.endContainer, n = ft(t), o = ft(i);
5735
- return !n || !o ? null : {
5736
- startSelector: n,
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,
5737
5765
  startOffset: e.startOffset,
5738
5766
  endSelector: o,
5739
5767
  endOffset: e.endOffset
5740
5768
  };
5741
5769
  }
5742
- function ds(s) {
5770
+ function ds(n) {
5743
5771
  var e, t;
5744
5772
  try {
5745
- const i = gt(s.startSelector), n = gt(s.endSelector);
5746
- if (!i || !n) return null;
5747
- const o = document.createRange(), r = i.nodeType === Node.TEXT_NODE ? ((e = i.textContent) == null ? void 0 : e.length) ?? 0 : i.childNodes.length, l = n.nodeType === Node.TEXT_NODE ? ((t = n.textContent) == null ? void 0 : t.length) ?? 0 : n.childNodes.length;
5748
- return o.setStart(i, Math.min(s.startOffset, r)), o.setEnd(n, Math.min(s.endOffset, l)), o;
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;
5749
5777
  } catch {
5750
5778
  return null;
5751
5779
  }
5752
5780
  }
5753
- function ft(s) {
5754
- if (s.nodeType === Node.TEXT_NODE) {
5755
- const e = s.parentElement;
5781
+ function ft(n) {
5782
+ if (n.nodeType === Node.TEXT_NODE) {
5783
+ const e = n.parentElement;
5756
5784
  if (!e) return null;
5757
5785
  const t = mt(e);
5758
5786
  if (!t) return null;
5759
- const i = Array.from(e.childNodes).indexOf(s);
5787
+ const i = Array.from(e.childNodes).indexOf(n);
5760
5788
  return `${t}::text(${i})`;
5761
5789
  }
5762
- return s.nodeType === Node.ELEMENT_NODE ? mt(s) : null;
5790
+ return n.nodeType === Node.ELEMENT_NODE ? mt(n) : null;
5763
5791
  }
5764
- function mt(s) {
5765
- if (!s || s === document.documentElement) return "html";
5766
- if (s === document.body) return "body";
5767
- if (s.id) return `#${CSS.escape(s.id)}`;
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)}`;
5768
5796
  const e = [];
5769
- let t = s, i = 0;
5797
+ let t = n, i = 0;
5770
5798
  for (; t && t !== document.body && i < 10; ) {
5771
- const n = t.parentElement;
5772
- if (!n) break;
5773
- const o = t.tagName.toLowerCase(), r = t.tagName, l = Array.from(n.children).filter(
5799
+ const s = t.parentElement;
5800
+ if (!s) break;
5801
+ const o = t.tagName.toLowerCase(), r = t.tagName, l = Array.from(s.children).filter(
5774
5802
  (a) => a.tagName === r
5775
5803
  );
5776
5804
  if (l.length === 1)
@@ -5779,27 +5807,27 @@ function mt(s) {
5779
5807
  const a = l.indexOf(t) + 1;
5780
5808
  e.unshift(`${o}:nth-of-type(${a})`);
5781
5809
  }
5782
- if (n.id) {
5783
- e.unshift(`#${CSS.escape(n.id)}`);
5810
+ if (s.id) {
5811
+ e.unshift(`#${CSS.escape(s.id)}`);
5784
5812
  break;
5785
5813
  }
5786
- t = n, i++;
5814
+ t = s, i++;
5787
5815
  }
5788
5816
  return e.length > 0 ? e.join(" > ") : null;
5789
5817
  }
5790
- function gt(s) {
5791
- const e = s.match(/^(.+)::text\((\d+)\)$/);
5818
+ function gt(n) {
5819
+ const e = n.match(/^(.+)::text\((\d+)\)$/);
5792
5820
  if (e) {
5793
5821
  const t = e[1], i = parseInt(e[2], 10);
5794
5822
  try {
5795
- const n = document.querySelector(t);
5796
- return n ? n.childNodes[i] ?? null : null;
5823
+ const s = document.querySelector(t);
5824
+ return s ? s.childNodes[i] ?? null : null;
5797
5825
  } catch {
5798
5826
  return null;
5799
5827
  }
5800
5828
  }
5801
5829
  try {
5802
- return document.querySelector(s);
5830
+ return document.querySelector(n);
5803
5831
  } catch {
5804
5832
  return null;
5805
5833
  }
@@ -5848,13 +5876,13 @@ class hs {
5848
5876
  if (!this.container) return;
5849
5877
  const i = (l = this.client.state.user) == null ? void 0 : l.id;
5850
5878
  if (e === i || (this.clearSelection(e), !t)) return;
5851
- const n = ds(t);
5852
- if (!n) return;
5879
+ const s = ds(t);
5880
+ if (!s) return;
5853
5881
  const o = this.client.state.presence.find(
5854
5882
  (a) => a.user.id === e
5855
5883
  ), r = (o == null ? void 0 : o.user.color) ?? "#6366f1";
5856
5884
  try {
5857
- const a = n.getClientRects(), c = [];
5885
+ const a = s.getClientRects(), c = [];
5858
5886
  for (let p = 0; p < a.length; p++) {
5859
5887
  const d = a[p], u = document.createElement("div");
5860
5888
  Object.assign(u.style, {
@@ -5887,12 +5915,12 @@ class hs {
5887
5915
  }
5888
5916
  }
5889
5917
  }
5890
- var ps = Object.defineProperty, us = Object.getOwnPropertyDescriptor, Ve = (s, e, t, i) => {
5891
- for (var n = i > 1 ? void 0 : i ? us(e, t) : e, o = s.length - 1, r; o >= 0; o--)
5892
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
5893
- return i && n && ps(e, t, n), n;
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;
5894
5922
  };
5895
- let he = class extends S {
5923
+ let he = class extends T {
5896
5924
  constructor() {
5897
5925
  super(...arguments), this.roomId = "";
5898
5926
  }
@@ -5901,8 +5929,8 @@ let he = class extends S {
5901
5929
  new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
5902
5930
  );
5903
5931
  }
5904
- toggle(s) {
5905
- const e = { ...this.settings, [s]: !this.settings[s] };
5932
+ toggle(n) {
5933
+ const e = { ...this.settings, [n]: !this.settings[n] };
5906
5934
  this.dispatchEvent(
5907
5935
  new CustomEvent("settings-change", {
5908
5936
  detail: e,
@@ -5911,10 +5939,10 @@ let he = class extends S {
5911
5939
  })
5912
5940
  );
5913
5941
  }
5914
- renderToggle(s, e) {
5942
+ renderToggle(n, e) {
5915
5943
  return h`
5916
5944
  <div class="setting-row">
5917
- <span class="setting-label">${s}</span>
5945
+ <span class="setting-label">${n}</span>
5918
5946
  <label class="toggle">
5919
5947
  <input
5920
5948
  type="checkbox"
@@ -5927,13 +5955,13 @@ let he = class extends S {
5927
5955
  `;
5928
5956
  }
5929
5957
  render() {
5930
- const s = !this.settings.enabled;
5958
+ const n = !this.settings.enabled;
5931
5959
  return h`
5932
5960
  <div class="panel">
5933
5961
  <div class="panel-header">
5934
5962
  <span class="panel-title">Settings</span>
5935
5963
  <button class="close-btn" @click=${this.fireClose} title="Close">
5936
- ${E(me, 16)}
5964
+ ${k(me, 16)}
5937
5965
  </button>
5938
5966
  </div>
5939
5967
 
@@ -5952,7 +5980,7 @@ let he = class extends S {
5952
5980
  </label>
5953
5981
  </div>
5954
5982
 
5955
- <div class="panel-body pw-scrollable ${s ? "settings-disabled" : ""}">
5983
+ <div class="panel-body pw-scrollable ${n ? "settings-disabled" : ""}">
5956
5984
  <div class="section-label">Cursors</div>
5957
5985
  ${this.renderToggle("Show my cursor to others", "showMyCursor")}
5958
5986
  ${this.renderToggle("Show others' cursors", "showOthersCursors")}
@@ -5982,7 +6010,7 @@ he.styles = [
5982
6010
  ee,
5983
6011
  ge,
5984
6012
  _e,
5985
- I`
6013
+ A`
5986
6014
  :host {
5987
6015
  display: block;
5988
6016
  }
@@ -6153,13 +6181,13 @@ he.styles = [
6153
6181
  }
6154
6182
  `
6155
6183
  ];
6156
- Ve([
6184
+ qe([
6157
6185
  g({ attribute: !1 })
6158
6186
  ], he.prototype, "settings", 2);
6159
- Ve([
6187
+ qe([
6160
6188
  g()
6161
6189
  ], he.prototype, "roomId", 2);
6162
- he = Ve([
6190
+ he = qe([
6163
6191
  R("pulse-widget-settings-panel")
6164
6192
  ], he);
6165
6193
  const ye = {
@@ -6174,23 +6202,23 @@ const ye = {
6174
6202
  showSelections: !0,
6175
6203
  showDrawings: !0
6176
6204
  }, St = "pulse:settings:";
6177
- function fs(s) {
6205
+ function fs(n) {
6178
6206
  try {
6179
- const e = localStorage.getItem(`${St}${s}`);
6207
+ const e = localStorage.getItem(`${St}${n}`);
6180
6208
  return e ? { ...ye, ...JSON.parse(e) } : { ...ye };
6181
6209
  } catch {
6182
6210
  return { ...ye };
6183
6211
  }
6184
6212
  }
6185
- function ms(s, e) {
6186
- localStorage.setItem(`${St}${s}`, JSON.stringify(e));
6213
+ function ms(n, e) {
6214
+ localStorage.setItem(`${St}${n}`, JSON.stringify(e));
6187
6215
  }
6188
- var gs = Object.defineProperty, bs = Object.getOwnPropertyDescriptor, L = (s, e, t, i) => {
6189
- for (var n = i > 1 ? void 0 : i ? bs(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6190
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6191
- return i && n && gs(e, t, n), n;
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;
6192
6220
  };
6193
- let M = class extends S {
6221
+ let M = class extends T {
6194
6222
  constructor() {
6195
6223
  super(...arguments), this.collapsed = !1, this.activePanel = null, this.pinModeActive = !1, this.featuresDisabled = !1, this.drawModeActive = !1, this.followingUserId = null, this.display = "floating", this.users = [], this.unreadCount = 0;
6196
6224
  }
@@ -6198,36 +6226,36 @@ let M = class extends S {
6198
6226
  super.connectedCallback(), this.setupPresence();
6199
6227
  }
6200
6228
  disconnectedCallback() {
6201
- var s, e;
6202
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this), (e = this.notifUnsub) == null || e.call(this);
6229
+ var n, e;
6230
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this), (e = this.notifUnsub) == null || e.call(this);
6203
6231
  }
6204
- updated(s) {
6232
+ updated(n) {
6205
6233
  var e, t;
6206
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), (t = this.notifUnsub) == null || t.call(this), this.setupPresence());
6234
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), (t = this.notifUnsub) == null || t.call(this), this.setupPresence());
6207
6235
  }
6208
6236
  setupPresence() {
6209
- this.client && (this.users = this.client.state.presence, this.unreadCount = this.client.state.unreadCount, this.unsub = this.client.state.on("presence", (s) => {
6210
- this.users = s;
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;
6211
6239
  }), this.notifUnsub = this.client.state.on("notifications", () => {
6212
6240
  this.unreadCount = this.client.state.unreadCount;
6213
6241
  }));
6214
6242
  }
6215
- getInitials(s) {
6216
- return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
6243
+ getInitials(n) {
6244
+ return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
6217
6245
  }
6218
- fire(s) {
6246
+ fire(n) {
6219
6247
  this.dispatchEvent(
6220
6248
  new CustomEvent("toolbar-action", {
6221
- detail: s,
6249
+ detail: n,
6222
6250
  bubbles: !0,
6223
6251
  composed: !0
6224
6252
  })
6225
6253
  );
6226
6254
  }
6227
- fireFollow(s) {
6255
+ fireFollow(n) {
6228
6256
  this.dispatchEvent(
6229
6257
  new CustomEvent("toolbar-follow", {
6230
- detail: s,
6258
+ detail: n,
6231
6259
  bubbles: !0,
6232
6260
  composed: !0
6233
6261
  })
@@ -6239,20 +6267,20 @@ let M = class extends S {
6239
6267
  );
6240
6268
  }
6241
6269
  render() {
6242
- const s = this.display === "inline";
6270
+ const n = this.display === "inline";
6243
6271
  if (this.collapsed)
6244
6272
  return h`
6245
- <div class="toolbar collapsed ${s ? "inline" : ""}" @click=${this.fireToggle}>
6246
- <span class="fab-icon">${E(Ri, s ? 18 : 24)}</span>
6273
+ <div class="toolbar collapsed ${n ? "inline" : ""}" @click=${this.fireToggle}>
6274
+ <span class="fab-icon">${k(Ri, n ? 18 : 24)}</span>
6247
6275
  </div>
6248
6276
  `;
6249
6277
  const e = this.users.slice(0, 3), t = this.users.length - 3;
6250
6278
  return h`
6251
- <div class="toolbar ${s ? "inline" : ""}"
6279
+ <div class="toolbar ${n ? "inline" : ""}"
6252
6280
  <!-- Presence avatars -->
6253
6281
  ${this.users.length > 0 ? h`
6254
6282
  <div class="presence">
6255
- ${t > 0 ? h`<div class="presence-overflow">+${t}</div>` : m}
6283
+ ${t > 0 ? h`<div class="presence-overflow">+${t}</div>` : f}
6256
6284
  ${e.map(
6257
6285
  (i) => h`
6258
6286
  <div
@@ -6263,13 +6291,13 @@ let M = class extends S {
6263
6291
  >
6264
6292
  ${i.user.avatar ? h`<img src="${i.user.avatar}" alt="${i.user.name}" />` : this.getInitials(i.user.name)}
6265
6293
  <span class="presence-tooltip">${i.user.name}</span>
6266
- ${i.deviceType && i.deviceType !== "desktop" ? h`<span class="device-icon">${i.deviceType === "mobile" ? "📱" : "📲"}</span>` : m}
6294
+ ${i.deviceType && i.deviceType !== "desktop" ? h`<span class="device-icon">${i.deviceType === "mobile" ? "📱" : "📲"}</span>` : f}
6267
6295
  </div>
6268
6296
  `
6269
6297
  )}
6270
6298
  </div>
6271
6299
  <div class="separator"></div>
6272
- ` : m}
6300
+ ` : f}
6273
6301
 
6274
6302
  <!-- Pin comment (primary) -->
6275
6303
  <button
@@ -6279,7 +6307,7 @@ let M = class extends S {
6279
6307
  ?disabled=${this.featuresDisabled}
6280
6308
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6281
6309
  >
6282
- ${E(_t)}
6310
+ ${k(_t)}
6283
6311
  </button>
6284
6312
 
6285
6313
  <!-- View comments -->
@@ -6290,7 +6318,7 @@ let M = class extends S {
6290
6318
  ?disabled=${this.featuresDisabled}
6291
6319
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6292
6320
  >
6293
- ${E(_i)}
6321
+ ${k(_i)}
6294
6322
  </button>
6295
6323
 
6296
6324
  <!-- Activity feed -->
@@ -6301,7 +6329,7 @@ let M = class extends S {
6301
6329
  ?disabled=${this.featuresDisabled}
6302
6330
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6303
6331
  >
6304
- ${E(Ci)}
6332
+ ${k(Ci)}
6305
6333
  </button>
6306
6334
 
6307
6335
  <!-- Draw mode -->
@@ -6312,7 +6340,7 @@ let M = class extends S {
6312
6340
  ?disabled=${this.featuresDisabled}
6313
6341
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6314
6342
  >
6315
- ${E(Pi)}
6343
+ ${k(Pi)}
6316
6344
  </button>
6317
6345
 
6318
6346
  <!-- Notifications -->
@@ -6323,8 +6351,8 @@ let M = class extends S {
6323
6351
  ?disabled=${this.featuresDisabled}
6324
6352
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : "position:relative"}"
6325
6353
  >
6326
- ${E(Ei)}
6327
- ${this.unreadCount > 0 ? h`<span class="badge">${this.unreadCount > 9 ? "9+" : this.unreadCount}</span>` : m}
6354
+ ${k(Ei)}
6355
+ ${this.unreadCount > 0 ? h`<span class="badge">${this.unreadCount > 9 ? "9+" : this.unreadCount}</span>` : f}
6328
6356
  </button>
6329
6357
 
6330
6358
  <!-- Settings -->
@@ -6333,7 +6361,7 @@ let M = class extends S {
6333
6361
  @click=${() => this.fire("settings")}
6334
6362
  title="Settings"
6335
6363
  >
6336
- ${E(Ii)}
6364
+ ${k(Ii)}
6337
6365
  </button>
6338
6366
 
6339
6367
  <div class="separator"></div>
@@ -6344,7 +6372,7 @@ let M = class extends S {
6344
6372
  @click=${this.fireToggle}
6345
6373
  title="Collapse"
6346
6374
  >
6347
- ${E(me, 14)}
6375
+ ${k(me, 14)}
6348
6376
  </button>
6349
6377
  </div>
6350
6378
  `;
@@ -6353,7 +6381,7 @@ let M = class extends S {
6353
6381
  M.styles = [
6354
6382
  ee,
6355
6383
  ge,
6356
- I`
6384
+ A`
6357
6385
  :host {
6358
6386
  display: block;
6359
6387
  }
@@ -6636,26 +6664,26 @@ class vs {
6636
6664
  this.pillEls.clear();
6637
6665
  return;
6638
6666
  }
6639
- const e = window.scrollY, t = window.innerHeight, i = document.documentElement.scrollHeight, n = (r = this.client.state.user) == null ? void 0 : r.id, o = /* @__PURE__ */ new Set();
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();
6640
6668
  for (const [l, a] of this.client.state.viewports) {
6641
- if (l === n) continue;
6669
+ if (l === s) continue;
6642
6670
  const c = a.scrollY, p = a.scrollY + a.viewportHeight, d = e, u = e + t;
6643
6671
  if (c >= d && p <= u) {
6644
- const k = this.pillEls.get(l);
6645
- k && (k.style.display = "none");
6672
+ const $ = this.pillEls.get(l);
6673
+ $ && ($.style.display = "none");
6646
6674
  continue;
6647
6675
  }
6648
6676
  o.add(l);
6649
- const f = this.client.state.presence.find(
6650
- (k) => k.user.id === l
6677
+ const m = this.client.state.presence.find(
6678
+ ($) => $.user.id === l
6651
6679
  );
6652
- if (!f) continue;
6653
- const b = a.scrollY + a.viewportHeight / 2, x = i > 0 ? b / i : 0, _ = Math.max(
6680
+ if (!m) continue;
6681
+ const b = a.scrollY + a.viewportHeight / 2, I = i > 0 ? b / i : 0, C = Math.max(
6654
6682
  8,
6655
- Math.min(t - 28, x * t)
6683
+ Math.min(t - 28, I * t)
6656
6684
  );
6657
- let $ = this.pillEls.get(l);
6658
- $ || ($ = document.createElement("div"), Object.assign($.style, {
6685
+ let w = this.pillEls.get(l);
6686
+ w || (w = document.createElement("div"), Object.assign(w.style, {
6659
6687
  position: "absolute",
6660
6688
  right: "8px",
6661
6689
  padding: "2px 6px",
@@ -6667,7 +6695,7 @@ class vs {
6667
6695
  whiteSpace: "nowrap",
6668
6696
  pointerEvents: "none",
6669
6697
  transition: "top 0.3s ease"
6670
- }), this.container.appendChild($), this.pillEls.set(l, $)), $.style.display = "", $.style.background = f.user.color, $.style.top = `${_}px`, $.textContent = this.getInitials(f.user.name);
6698
+ }), this.container.appendChild(w), this.pillEls.set(l, w)), w.style.display = "", w.style.background = m.user.color, w.style.top = `${C}px`, w.textContent = this.getInitials(m.user.name);
6671
6699
  }
6672
6700
  for (const [l, a] of this.pillEls)
6673
6701
  !o.has(l) && !this.client.state.viewports.has(l) && (a.remove(), this.pillEls.delete(l));
@@ -6676,17 +6704,17 @@ class vs {
6676
6704
  return e.split(" ").map((t) => t[0]).join("").toUpperCase().slice(0, 2);
6677
6705
  }
6678
6706
  }
6679
- var xs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, P = (s, e, t, i) => {
6680
- for (var n = i > 1 ? void 0 : i ? ys(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6681
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6682
- return i && n && xs(e, t, n), n;
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;
6683
6711
  };
6684
- let C = class extends S {
6712
+ let E = class extends T {
6685
6713
  constructor() {
6686
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 = () => {
6687
6715
  !this.settings.enabled || !this.client || this._isFollowScrolling || (this.followingUserId && (this.followingUserId = null), !this._viewportThrottleTimer && (this._viewportThrottleTimer = setTimeout(() => {
6688
- var s;
6689
- this._viewportThrottleTimer = null, (s = this.client) == null || s.updateViewport({
6716
+ var n;
6717
+ this._viewportThrottleTimer = null, (n = this.client) == null || n.updateViewport({
6690
6718
  scrollX: window.scrollX,
6691
6719
  scrollY: window.scrollY,
6692
6720
  viewportWidth: window.innerWidth,
@@ -6699,25 +6727,25 @@ let C = class extends S {
6699
6727
  !this.settings.enabled || !this.settings.showSelections || !this.client || this._selectionThrottleTimer || (this._selectionThrottleTimer = setTimeout(() => {
6700
6728
  var t, i;
6701
6729
  this._selectionThrottleTimer = null;
6702
- const s = window.getSelection();
6703
- if (!s || s.isCollapsed) {
6730
+ const n = window.getSelection();
6731
+ if (!n || n.isCollapsed) {
6704
6732
  (t = this.client) == null || t.updateSelection(null);
6705
6733
  return;
6706
6734
  }
6707
- const e = cs(s);
6735
+ const e = cs(n);
6708
6736
  (i = this.client) == null || i.updateSelection(e);
6709
6737
  }, 500));
6710
- }, this.handleDocumentClick = (s) => {
6738
+ }, this.handleDocumentClick = (n) => {
6711
6739
  var e;
6712
- this.settings.enabled && this.settings.showMyClicks && (this.contains(s.target) || (e = this.client) == null || e.performClick({
6713
- x: s.clientX,
6714
- y: s.clientY,
6715
- pageX: s.pageX,
6716
- pageY: s.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
6717
6745
  }));
6718
- }, this.handleKeydown = (s) => {
6746
+ }, this.handleKeydown = (n) => {
6719
6747
  var e, t;
6720
- s.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));
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));
6721
6749
  };
6722
6750
  }
6723
6751
  connectedCallback() {
@@ -6730,13 +6758,13 @@ let C = class extends S {
6730
6758
  return `${this.apiKey}\0${this.token}\0${this.room}\0${this.endpoint ?? ""}`;
6731
6759
  }
6732
6760
  initClient() {
6733
- const s = {
6761
+ const n = {
6734
6762
  apiKey: this.apiKey,
6735
6763
  token: this.token,
6736
6764
  room: this.room,
6737
6765
  endpoint: this.endpoint
6738
6766
  };
6739
- this.client = new xt(s), this.clientConfigKey = this.getConfigKey(), this.cursorOverlay = new as(this.client), this.commentPins = new Ji(this.client, {
6767
+ this.client = new xt(n), this.clientConfigKey = this.getConfigKey(), this.cursorOverlay = new as(this.client), this.commentPins = new Ji(this.client, {
6740
6768
  onPinModeExit: () => {
6741
6769
  this.pinModeActive = !1;
6742
6770
  }
@@ -6770,15 +6798,15 @@ let C = class extends S {
6770
6798
  ), window.addEventListener("scroll", this.handleScroll), document.addEventListener("selectionchange", this.handleSelectionChange), this.client.connect();
6771
6799
  }
6772
6800
  teardownClient() {
6773
- var s, e, t, i, n, o;
6774
- 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), (s = this.cursorOverlay) == null || s.destroy(), (e = this.commentPins) == null || e.destroy(), (t = this.viewportOverlay) == null || t.destroy(), (i = this.selectionOverlay) == null || i.destroy(), (n = this.drawingOverlay) == null || n.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);
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);
6775
6803
  }
6776
6804
  handlePanelClose() {
6777
6805
  this.activePanel = null, this.highlightThreadId = null;
6778
6806
  }
6779
- handleToolbarAction(s) {
6780
- var t, i, n, o;
6781
- const e = s.detail;
6807
+ handleToolbarAction(n) {
6808
+ var t, i, s, o;
6809
+ const e = n.detail;
6782
6810
  if (!(!this.settings.enabled && e !== "settings"))
6783
6811
  switch (e) {
6784
6812
  case "comments":
@@ -6797,70 +6825,70 @@ let C = class extends S {
6797
6825
  this.pinModeActive = !this.pinModeActive, this.pinModeActive ? (t = this.commentPins) == null || t.enterPinMode() : (i = this.commentPins) == null || i.exitPinMode();
6798
6826
  break;
6799
6827
  case "draw-mode":
6800
- this.drawModeActive = !this.drawModeActive, this.drawModeActive ? (n = this.drawingOverlay) == null || n.enableDrawMode() : (o = this.drawingOverlay) == null || o.disableDrawMode();
6828
+ this.drawModeActive = !this.drawModeActive, this.drawModeActive ? (s = this.drawingOverlay) == null || s.enableDrawMode() : (o = this.drawingOverlay) == null || o.disableDrawMode();
6801
6829
  break;
6802
6830
  }
6803
6831
  }
6804
- handleFollow(s) {
6805
- const e = s.detail;
6832
+ handleFollow(n) {
6833
+ const e = n.detail;
6806
6834
  this.followingUserId === e ? this.followingUserId = null : this.followingUserId = e;
6807
6835
  }
6808
- handleSettingsChange(s) {
6809
- const e = s.detail;
6836
+ handleSettingsChange(n) {
6837
+ const e = n.detail;
6810
6838
  this.settings = e, ms(this.room, e), this.applySettings(e);
6811
6839
  }
6812
- applySettings(s) {
6813
- var e, t, i, n, o, r, l, a, c, p, d, u, f, b, x, _, $;
6814
- if (!s.enabled) {
6815
- (e = this.cursorOverlay) == null || e.disable(), (t = this.viewportOverlay) == null || t.disable(), (i = this.selectionOverlay) == null || i.disable(), (n = this.drawingOverlay) == null || n.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;
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;
6816
6844
  return;
6817
6845
  }
6818
- this.applyCursorSettings(s), (c = this.client) == null || c.setAppearOffline(s.appearOffline), (p = this.commentPins) == null || p.setVisible(s.showCommentPins), s.showViewportIndicators ? (d = this.viewportOverlay) == null || d.enable() : (u = this.viewportOverlay) == null || u.disable(), s.showSelections ? (f = this.selectionOverlay) == null || f.enable() : (b = this.selectionOverlay) == null || b.disable(), s.showDrawings ? (x = this.drawingOverlay) == null || x.enable() : ((_ = this.drawingOverlay) == null || _.disable(), this.drawModeActive && (($ = this.drawingOverlay) == null || $.disableDrawMode(), this.drawModeActive = !1));
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));
6819
6847
  }
6820
- applyCursorSettings(s) {
6848
+ applyCursorSettings(n) {
6821
6849
  if (!this.cursorOverlay) return;
6822
- s.showMyCursor || s.showOthersCursors ? (this.cursorOverlay.enable(), this.cursorOverlay.setSending(s.showMyCursor), this.cursorOverlay.setReceiving(s.showOthersCursors)) : this.cursorOverlay.disable();
6850
+ n.showMyCursor || n.showOthersCursors ? (this.cursorOverlay.enable(), this.cursorOverlay.setSending(n.showMyCursor), this.cursorOverlay.setReceiving(n.showOthersCursors)) : this.cursorOverlay.disable();
6823
6851
  }
6824
- updated(s) {
6825
- (s.has("room") || s.has("token") || s.has("apiKey") || s.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), (s.has("activePanel") || s.has("collapsed")) && requestAnimationFrame(() => this.positionPopups());
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());
6826
6854
  }
6827
6855
  /**
6828
6856
  * Smart-position all fixed popups (toolbar popover + panel) relative to
6829
6857
  * the trigger element, flipping vertically/horizontally as needed.
6830
6858
  */
6831
6859
  positionPopups() {
6832
- var b, x, _, $;
6833
- const s = this.display === "inline", e = (b = this.shadowRoot) == null ? void 0 : b.querySelector(".inline-trigger"), t = (x = this.shadowRoot) == null ? void 0 : x.querySelector("pulse-widget-toolbar"), i = s ? e : t;
6860
+ var b, I, C, w;
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;
6834
6862
  if (!i) return;
6835
- const n = i.getBoundingClientRect(), o = window.innerWidth, r = window.innerHeight, l = 8, a = (_ = this.shadowRoot) == null ? void 0 : _.querySelector(".toolbar-popover");
6863
+ const s = i.getBoundingClientRect(), o = window.innerWidth, r = window.innerHeight, l = 8, a = (C = this.shadowRoot) == null ? void 0 : C.querySelector(".toolbar-popover");
6836
6864
  if (a) {
6837
6865
  Object.assign(a.style, { top: "auto", left: "auto" });
6838
- const k = a.getBoundingClientRect(), A = this.computePosition(n, k, o, r, l);
6839
- a.style.top = `${A.top}px`, a.style.left = `${A.left}px`;
6866
+ const $ = a.getBoundingClientRect(), P = this.computePosition(s, $, o, r, l);
6867
+ a.style.top = `${P.top}px`, a.style.left = `${P.left}px`;
6840
6868
  }
6841
- const c = ($ = this.shadowRoot) == null ? void 0 : $.querySelector(".panel-container");
6869
+ const c = (w = this.shadowRoot) == null ? void 0 : w.querySelector(".panel-container");
6842
6870
  if (!c) return;
6843
6871
  Object.assign(c.style, { top: "auto", left: "auto" });
6844
6872
  const p = a ?? t;
6845
6873
  if (!p) return;
6846
- const d = p.getBoundingClientRect(), u = c.getBoundingClientRect(), f = this.computePosition(d, u, o, r, l);
6847
- c.style.top = `${f.top}px`, c.style.left = `${f.left}px`;
6874
+ const d = p.getBoundingClientRect(), u = c.getBoundingClientRect(), m = this.computePosition(d, u, o, r, l);
6875
+ c.style.top = `${m.top}px`, c.style.left = `${m.left}px`;
6848
6876
  }
6849
- computePosition(s, e, t, i, n) {
6850
- const o = s.top, r = i - s.bottom;
6877
+ computePosition(n, e, t, i, s) {
6878
+ const o = n.top, r = i - n.bottom;
6851
6879
  let l;
6852
- o >= e.height + n ? l = s.top - e.height - n : r >= e.height + n ? l = s.bottom + n : l = o >= r ? Math.max(n, s.top - e.height - n) : s.bottom + n;
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;
6853
6881
  let a;
6854
- const c = s.right - e.width;
6855
- return c >= n ? a = c : s.left + e.width + n <= t ? a = s.left : a = Math.max(n, Math.min(t - e.width - n, s.left)), l = Math.max(n, Math.min(i - e.height - n, l)), a = Math.max(n, Math.min(t - e.width - n, a)), { top: l, left: a };
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 };
6856
6884
  }
6857
6885
  getFollowUserName() {
6858
6886
  var e;
6859
6887
  if (!this.followingUserId) return "";
6860
- const s = (e = this.client) == null ? void 0 : e.state.presence.find(
6888
+ const n = (e = this.client) == null ? void 0 : e.state.presence.find(
6861
6889
  (t) => t.user.id === this.followingUserId
6862
6890
  );
6863
- return (s == null ? void 0 : s.user.name) ?? "user";
6891
+ return (n == null ? void 0 : n.user.name) ?? "user";
6864
6892
  }
6865
6893
  renderConnectionBanner() {
6866
6894
  return this.showConnectedFlash ? h`<div class="connection-banner connected">
@@ -6869,14 +6897,14 @@ let C = class extends S {
6869
6897
  <span class="connection-dot"></span>Reconnecting...
6870
6898
  </div>` : this.connectionState === "disconnected" && this.client ? h`<div class="connection-banner disconnected">
6871
6899
  <span class="connection-dot"></span>Disconnected
6872
- </div>` : m;
6900
+ </div>` : f;
6873
6901
  }
6874
6902
  handleToolbarToggle() {
6875
6903
  this.collapsed = !this.collapsed, this.collapsed && (this.activePanel = null, this.highlightThreadId = null);
6876
6904
  }
6877
6905
  render() {
6878
- const s = this.display === "inline";
6879
- if (s && this.collapsed)
6906
+ const n = this.display === "inline";
6907
+ if (n && this.collapsed)
6880
6908
  return h`
6881
6909
  <div class="widget-root">
6882
6910
  <div class="inline-trigger" @click=${this.handleToolbarToggle}>
@@ -6889,26 +6917,26 @@ let C = class extends S {
6889
6917
  ${this.activePanel === "comments" ? h`<pulse-widget-comments-panel
6890
6918
  .client=${this.client}
6891
6919
  .highlightThreadId=${this.highlightThreadId}
6892
- ></pulse-widget-comments-panel>` : m}
6920
+ ></pulse-widget-comments-panel>` : f}
6893
6921
  ${this.activePanel === "settings" ? h`<pulse-widget-settings-panel
6894
6922
  .settings=${this.settings}
6895
6923
  .roomId=${this.room}
6896
6924
  @settings-change=${this.handleSettingsChange}
6897
- ></pulse-widget-settings-panel>` : m}
6925
+ ></pulse-widget-settings-panel>` : f}
6898
6926
  ${this.activePanel === "notifications" ? h`<pulse-widget-notifications-panel
6899
6927
  .client=${this.client}
6900
- ></pulse-widget-notifications-panel>` : m}
6928
+ ></pulse-widget-notifications-panel>` : f}
6901
6929
  ${this.activePanel === "activity" ? h`<pulse-widget-activity-panel
6902
6930
  .client=${this.client}
6903
- ></pulse-widget-activity-panel>` : m}
6931
+ ></pulse-widget-activity-panel>` : f}
6904
6932
  </div>
6905
- ` : m, t = this.followingUserId ? h`<div class="follow-banner">
6933
+ ` : f, t = this.followingUserId ? h`<div class="follow-banner">
6906
6934
  Following ${this.getFollowUserName()}
6907
6935
  <button @click=${() => {
6908
6936
  this.followingUserId = null;
6909
6937
  }}>Stop</button>
6910
- </div>` : m;
6911
- return s ? h`
6938
+ </div>` : f;
6939
+ return n ? h`
6912
6940
  ${t}
6913
6941
  <div class="widget-root">
6914
6942
  <div class="inline-trigger" @click=${this.handleToolbarToggle}>
@@ -6954,9 +6982,9 @@ let C = class extends S {
6954
6982
  `;
6955
6983
  }
6956
6984
  };
6957
- C.styles = [
6985
+ E.styles = [
6958
6986
  ee,
6959
- I`
6987
+ A`
6960
6988
  :host {
6961
6989
  display: block;
6962
6990
  }
@@ -7132,60 +7160,60 @@ C.styles = [
7132
7160
  }
7133
7161
  `
7134
7162
  ];
7135
- P([
7163
+ S([
7136
7164
  g({ attribute: "api-key" })
7137
- ], C.prototype, "apiKey", 2);
7138
- P([
7165
+ ], E.prototype, "apiKey", 2);
7166
+ S([
7139
7167
  g()
7140
- ], C.prototype, "token", 2);
7141
- P([
7168
+ ], E.prototype, "token", 2);
7169
+ S([
7142
7170
  g()
7143
- ], C.prototype, "room", 2);
7144
- P([
7171
+ ], E.prototype, "room", 2);
7172
+ S([
7145
7173
  g()
7146
- ], C.prototype, "endpoint", 2);
7147
- P([
7174
+ ], E.prototype, "endpoint", 2);
7175
+ S([
7148
7176
  g({ reflect: !0 })
7149
- ], C.prototype, "position", 2);
7150
- P([
7177
+ ], E.prototype, "position", 2);
7178
+ S([
7151
7179
  g({ reflect: !0 })
7152
- ], C.prototype, "display", 2);
7153
- P([
7180
+ ], E.prototype, "display", 2);
7181
+ S([
7154
7182
  v()
7155
- ], C.prototype, "collapsed", 2);
7156
- P([
7183
+ ], E.prototype, "collapsed", 2);
7184
+ S([
7157
7185
  v()
7158
- ], C.prototype, "activePanel", 2);
7159
- P([
7186
+ ], E.prototype, "activePanel", 2);
7187
+ S([
7160
7188
  v()
7161
- ], C.prototype, "pinModeActive", 2);
7162
- P([
7189
+ ], E.prototype, "pinModeActive", 2);
7190
+ S([
7163
7191
  v()
7164
- ], C.prototype, "highlightThreadId", 2);
7165
- P([
7192
+ ], E.prototype, "highlightThreadId", 2);
7193
+ S([
7166
7194
  v()
7167
- ], C.prototype, "settings", 2);
7168
- P([
7195
+ ], E.prototype, "settings", 2);
7196
+ S([
7169
7197
  v()
7170
- ], C.prototype, "followingUserId", 2);
7171
- P([
7198
+ ], E.prototype, "followingUserId", 2);
7199
+ S([
7172
7200
  v()
7173
- ], C.prototype, "drawModeActive", 2);
7174
- P([
7201
+ ], E.prototype, "drawModeActive", 2);
7202
+ S([
7175
7203
  v()
7176
- ], C.prototype, "connectionState", 2);
7177
- P([
7204
+ ], E.prototype, "connectionState", 2);
7205
+ S([
7178
7206
  v()
7179
- ], C.prototype, "showConnectedFlash", 2);
7180
- C = P([
7207
+ ], E.prototype, "showConnectedFlash", 2);
7208
+ E = S([
7181
7209
  R("pulse-widget")
7182
- ], C);
7210
+ ], E);
7183
7211
  export {
7184
7212
  W as PulseComments,
7185
7213
  le as PulseCursors,
7186
7214
  ce as PulseNotifications,
7187
7215
  G as PulsePresence,
7188
- V as PulseProvider,
7216
+ q as PulseProvider,
7189
7217
  D as PulseReactions,
7190
- C as PulseWidget
7218
+ E as PulseWidget
7191
7219
  };