@gamention/pulse-elements 0.1.12 → 0.1.13

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, s) {
8
- super("context-request", { bubbles: !0, composed: !0 }), this.context = e, this.contextTarget = t, this.callback = i, this.subscribe = s ?? !1;
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;
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, s) {
22
+ constructor(e, t, i, n) {
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 = s ?? !1;
28
+ } else this.context = t, this.callback = i, this.subscribe = n ?? !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: s } = this.subscriptions.get(e);
68
- e(this.value, s);
67
+ const { disposer: n } = this.subscriptions.get(e);
68
+ e(this.value, n);
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 s, o;
85
+ var n, 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 = (s = this.host).addController) == null || o.call(s, this);
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);
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: n }) {
109
+ function Mt({ context: s }) {
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(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;
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;
118
118
  } };
119
119
  {
120
120
  e.constructor.addInitializer(((r) => {
121
- i.set(r, new Xe(r, { context: n }));
121
+ i.set(r, new Xe(r, { context: s }));
122
122
  }));
123
- const s = Object.getOwnPropertyDescriptor(e, t);
123
+ const n = Object.getOwnPropertyDescriptor(e, t);
124
124
  let o;
125
- if (s === void 0) {
125
+ if (n === 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: n }) {
130
130
  i.get(this).setValue(l), r.set(this, l);
131
131
  }, configurable: !0, enumerable: !0 };
132
132
  } else {
133
- const r = s.set;
134
- o = { ...s, set(l) {
133
+ const r = n.set;
134
+ o = { ...n, 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: n }) {
144
144
  * Copyright 2022 Google LLC
145
145
  * SPDX-License-Identifier: BSD-3-Clause
146
146
  */
147
- function pe({ context: n, subscribe: e }) {
147
+ function pe({ context: s, subscribe: e }) {
148
148
  return (t, i) => {
149
149
  typeof i == "object" ? i.addInitializer((function() {
150
- new We(this, { context: n, callback: (s) => {
151
- t.set.call(this, s);
150
+ new We(this, { context: s, callback: (n) => {
151
+ t.set.call(this, n);
152
152
  }, subscribe: e });
153
- })) : t.constructor.addInitializer(((s) => {
154
- new We(s, { context: n, callback: (o) => {
155
- s[i] = o;
153
+ })) : t.constructor.addInitializer(((n) => {
154
+ new We(n, { context: s, callback: (o) => {
155
+ n[i] = o;
156
156
  }, subscribe: e });
157
157
  }));
158
158
  };
159
159
  }
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);
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, w = (s, e, t) => Rt(s, typeof e != "symbol" ? e + "" : e, t);
161
161
  const Lt = "ws://localhost:4567";
162
162
  let je = class {
163
163
  constructor() {
164
- x(this, "handlers", /* @__PURE__ */ new Map());
164
+ w(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((s) => s(t));
177
+ (i = this.handlers.get(e)) == null || i.forEach((n) => n(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(), x(this, "ws", null), x(this, "endpoint"), x(this, "reconnectAttempt", 0), x(this, "reconnectTimer", null), x(this, "_state", "disconnected"), this.endpoint = e ?? Lt;
184
+ super(), w(this, "ws", null), w(this, "endpoint"), w(this, "reconnectAttempt", 0), w(this, "reconnectTimer", null), w(this, "_state", "disconnected"), this.endpoint = e ?? Lt;
185
185
  }
186
186
  get state() {
187
187
  return this._state;
@@ -216,9 +216,9 @@ let je = class {
216
216
  this.reconnectTimer = null, this.connect();
217
217
  }, e);
218
218
  }
219
- }, Ut = class extends je {
219
+ }, zt = class extends je {
220
220
  constructor() {
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());
221
+ super(...arguments), w(this, "baseUrl", ""), w(this, "_user", null), w(this, "_users", /* @__PURE__ */ new Map()), w(this, "_presence", /* @__PURE__ */ new Map()), w(this, "_threads", /* @__PURE__ */ new Map()), w(this, "_reactions", /* @__PURE__ */ new Map()), w(this, "_notifications", []), w(this, "_activityLogs", []), w(this, "_typing", /* @__PURE__ */ new Map()), w(this, "_viewports", /* @__PURE__ */ new Map()), w(this, "_selections", /* @__PURE__ */ new Map());
222
222
  }
223
223
  get user() {
224
224
  return this._user;
@@ -226,9 +226,9 @@ let je = class {
226
226
  /** Optimistically remove a comment from local state (before server round-trip). */
227
227
  removeComment(e) {
228
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);
229
+ const n = i.comments.findIndex((o) => o.id === e);
230
+ if (n !== -1) {
231
+ i.comments.splice(n, 1), i.comments.length === 0 && this._threads.delete(t), this.emit("threads", this.threads);
232
232
  return;
233
233
  }
234
234
  }
@@ -257,10 +257,10 @@ let je = class {
257
257
  getTypingUsers(e) {
258
258
  const t = this._typing.get(e);
259
259
  if (!t) return [];
260
- const i = Date.now(), s = [];
260
+ const i = Date.now(), n = [];
261
261
  for (const [o, r] of t)
262
- i - r < 3e3 && s.push(o);
263
- return s;
262
+ i - r < 3e3 && n.push(o);
263
+ return n;
264
264
  }
265
265
  get viewports() {
266
266
  return this._viewports;
@@ -339,7 +339,7 @@ let je = class {
339
339
  case "comment:edited": {
340
340
  const t = this._threads.get(e.threadId);
341
341
  if (t) {
342
- const i = t.comments.findIndex((s) => s.id === e.comment.id);
342
+ const i = t.comments.findIndex((n) => n.id === e.comment.id);
343
343
  i !== -1 && (t.comments[i] = this.resolveComment(e.comment)), this.emit("threads", this.threads);
344
344
  }
345
345
  break;
@@ -368,7 +368,7 @@ let je = class {
368
368
  case "reaction:removed": {
369
369
  const t = this._reactions.get(e.targetId);
370
370
  if (t) {
371
- const i = t.filter((s) => s.id !== e.reactionId);
371
+ const i = t.filter((n) => n.id !== e.reactionId);
372
372
  this._reactions.set(e.targetId, i), this.emit("reactions", {
373
373
  targetId: e.targetId,
374
374
  reactions: i
@@ -429,12 +429,12 @@ let je = class {
429
429
  }, xt = class extends je {
430
430
  constructor(e) {
431
431
  var t;
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(/\/$/, "");
432
+ super(), w(this, "state"), w(this, "connection"), w(this, "config"), w(this, "heartbeatTimer", null), w(this, "lastCursorSend", 0), w(this, "pendingCursor", null), w(this, "cursorTimer", null), this.config = e, this.state = new zt(), this.state.baseUrl = (e.endpoint ?? "").replace(/^ws(s?):/, "http$1:").replace(/\/$/, "");
433
433
  const i = ((t = e.endpoint) == null ? void 0 : t.replace(/^http/, "ws")) ?? void 0;
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();
434
+ this.connection = new jt(i), this.connection.on("message", (n) => {
435
+ this.state.handleMessage(n), this.emit(n.type, n);
436
+ }), this.connection.on("state", (n) => {
437
+ this.emit("connection", n), n === "connected" ? (this.authenticate(), this.startHeartbeat()) : n === "disconnected" && this.stopHeartbeat();
438
438
  });
439
439
  }
440
440
  /** Current WebSocket connection state. */
@@ -492,9 +492,9 @@ let je = class {
492
492
  attachmentIds: t.attachmentIds
493
493
  }), i;
494
494
  }
495
- reply(e, t, i = [], s) {
495
+ reply(e, t, i = [], n) {
496
496
  const o = crypto.randomUUID();
497
- return this.send({ type: "comment:create", threadId: e, id: o, body: t, mentions: i, attachmentIds: s }), o;
497
+ return this.send({ type: "comment:create", threadId: e, id: o, body: t, mentions: i, attachmentIds: n }), o;
498
498
  }
499
499
  editComment(e, t, i = []) {
500
500
  this.send({ type: "comment:edit", commentId: e, body: t, mentions: i });
@@ -550,7 +550,7 @@ let je = class {
550
550
  async uploadFile(e) {
551
551
  const t = (this.config.endpoint ?? window.location.origin).replace(/^ws(s?):/, "http$1:"), i = new FormData();
552
552
  i.append("file", e);
553
- const s = await fetch(`${t}/api/v1/upload`, {
553
+ const n = await fetch(`${t}/api/v1/upload`, {
554
554
  method: "POST",
555
555
  headers: {
556
556
  "X-Pulse-Key": this.config.apiKey,
@@ -558,11 +558,11 @@ let je = class {
558
558
  },
559
559
  body: i
560
560
  });
561
- if (!s.ok) {
562
- const r = await s.json().catch(() => ({ error: "Upload failed" }));
561
+ if (!n.ok) {
562
+ const r = await n.json().catch(() => ({ error: "Upload failed" }));
563
563
  throw new Error(r.error ?? "Upload failed");
564
564
  }
565
- const o = await s.json();
565
+ const o = await n.json();
566
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;
567
567
  }
568
568
  // ── Presence control ──
@@ -575,16 +575,16 @@ let je = class {
575
575
  * Copyright 2019 Google LLC
576
576
  * SPDX-License-Identifier: BSD-3-Clause
577
577
  */
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();
578
+ 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();
579
579
  let yt = class {
580
580
  constructor(e, t, i) {
581
- if (this._$cssResult$ = !0, i !== ze) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
581
+ if (this._$cssResult$ = !0, i !== Ue) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
582
582
  this.cssText = e, this.t = t;
583
583
  }
584
584
  get styleSheet() {
585
585
  let e = this.o;
586
586
  const t = this.t;
587
- if (Ue && e === void 0) {
587
+ if (ze && e === void 0) {
588
588
  const i = t !== void 0 && t.length === 1;
589
589
  i && (e = Ye.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && Ye.set(t, e));
590
590
  }
@@ -594,59 +594,59 @@ let yt = class {
594
594
  return this.cssText;
595
595
  }
596
596
  };
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) => {
597
+ const Ut = (s) => new yt(typeof s == "string" ? s : s + "", void 0, Ue), I = (s, ...e) => {
598
+ const t = s.length === 1 ? s[0] : e.reduce((i, n, o) => i + ((r) => {
599
599
  if (r._$cssResult$ === !0) return r.cssText;
600
600
  if (typeof r == "number") return r;
601
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.");
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);
602
+ })(n) + s[o + 1], s[0]);
603
+ return new yt(t, s, Ue);
604
+ }, Dt = (s, e) => {
605
+ if (ze) s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
606
606
  else for (const t of e) {
607
- const i = document.createElement("style"), s = ve.litNonce;
608
- s !== void 0 && i.setAttribute("nonce", s), i.textContent = t.cssText, n.appendChild(i);
607
+ const i = document.createElement("style"), n = ve.litNonce;
608
+ n !== void 0 && i.setAttribute("nonce", n), i.textContent = t.cssText, s.appendChild(i);
609
609
  }
610
- }, Ke = Ue ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((e) => {
610
+ }, Ke = ze ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((e) => {
611
611
  let t = "";
612
612
  for (const i of e.cssRules) t += i.cssText;
613
- return zt(t);
614
- })(n) : n;
613
+ return Ut(t);
614
+ })(s) : s;
615
615
  /**
616
616
  * @license
617
617
  * Copyright 2017 Google LLC
618
618
  * SPDX-License-Identifier: BSD-3-Clause
619
619
  */
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) {
620
+ const { is: Ht, defineProperty: Bt, getOwnPropertyDescriptor: Nt, getOwnPropertyNames: Ft, getOwnPropertySymbols: Vt, getPrototypeOf: qt } = Object, U = globalThis, Ge = U.trustedTypes, Wt = Ge ? Ge.emptyScript : "", Te = U.reactiveElementPolyfillSupport, ie = (s, e) => s, we = { toAttribute(s, e) {
621
621
  switch (e) {
622
622
  case Boolean:
623
- n = n ? Wt : null;
623
+ s = s ? Wt : null;
624
624
  break;
625
625
  case Object:
626
626
  case Array:
627
- n = n == null ? n : JSON.stringify(n);
627
+ s = s == null ? s : JSON.stringify(s);
628
628
  }
629
- return n;
630
- }, fromAttribute(n, e) {
631
- let t = n;
629
+ return s;
630
+ }, fromAttribute(s, e) {
631
+ let t = s;
632
632
  switch (e) {
633
633
  case Boolean:
634
- t = n !== null;
634
+ t = s !== null;
635
635
  break;
636
636
  case Number:
637
- t = n === null ? null : Number(n);
637
+ t = s === null ? null : Number(s);
638
638
  break;
639
639
  case Object:
640
640
  case Array:
641
641
  try {
642
- t = JSON.parse(n);
642
+ t = JSON.parse(s);
643
643
  } catch {
644
644
  t = null;
645
645
  }
646
646
  }
647
647
  return t;
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());
648
+ } }, De = (s, e) => !Ht(s, e), Ze = { attribute: !0, type: String, converter: we, reflect: !1, useDefault: !1, hasChanged: De };
649
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), U.litPropertyMetadata ?? (U.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
650
650
  let Y = class extends HTMLElement {
651
651
  static addInitializer(e) {
652
652
  this._$Ei(), (this.l ?? (this.l = [])).push(e);
@@ -656,18 +656,18 @@ let Y = class extends HTMLElement {
656
656
  }
657
657
  static createProperty(e, t = Ze) {
658
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) {
659
- const i = Symbol(), s = this.getPropertyDescriptor(e, i, t);
660
- s !== void 0 && Nt(this.prototype, e, s);
659
+ const i = Symbol(), n = this.getPropertyDescriptor(e, i, t);
660
+ n !== void 0 && Bt(this.prototype, e, n);
661
661
  }
662
662
  }
663
663
  static getPropertyDescriptor(e, t, i) {
664
- const { get: s, set: o } = Bt(this.prototype, e) ?? { get() {
664
+ const { get: n, set: o } = Nt(this.prototype, e) ?? { get() {
665
665
  return this[t];
666
666
  }, set(r) {
667
667
  this[t] = r;
668
668
  } };
669
- return { get: s, set(r) {
670
- const l = s == null ? void 0 : s.call(this);
669
+ return { get: n, set(r) {
670
+ const l = n == null ? void 0 : n.call(this);
671
671
  o == null || o.call(this, r), this.requestUpdate(e, l, i);
672
672
  }, configurable: !0, enumerable: !0 };
673
673
  }
@@ -683,17 +683,17 @@ let Y = class extends HTMLElement {
683
683
  if (this.hasOwnProperty(ie("finalized"))) return;
684
684
  if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(ie("properties"))) {
685
685
  const t = this.properties, i = [...Ft(t), ...Vt(t)];
686
- for (const s of i) this.createProperty(s, t[s]);
686
+ for (const n of i) this.createProperty(n, t[n]);
687
687
  }
688
688
  const e = this[Symbol.metadata];
689
689
  if (e !== null) {
690
690
  const t = litPropertyMetadata.get(e);
691
- if (t !== void 0) for (const [i, s] of t) this.elementProperties.set(i, s);
691
+ if (t !== void 0) for (const [i, n] of t) this.elementProperties.set(i, n);
692
692
  }
693
693
  this._$Eh = /* @__PURE__ */ new Map();
694
694
  for (const [t, i] of this.elementProperties) {
695
- const s = this._$Eu(t, i);
696
- s !== void 0 && this._$Eh.set(s, t);
695
+ const n = this._$Eu(t, i);
696
+ n !== void 0 && this._$Eh.set(n, t);
697
697
  }
698
698
  this.elementStyles = this.finalizeStyles(this.styles);
699
699
  }
@@ -701,7 +701,7 @@ let Y = class extends HTMLElement {
701
701
  const t = [];
702
702
  if (Array.isArray(e)) {
703
703
  const i = new Set(e.flat(1 / 0).reverse());
704
- for (const s of i) t.unshift(Ke(s));
704
+ for (const n of i) t.unshift(Ke(n));
705
705
  } else e !== void 0 && t.push(Ke(e));
706
706
  return t;
707
707
  }
@@ -754,33 +754,33 @@ let Y = class extends HTMLElement {
754
754
  }
755
755
  _$ET(e, t) {
756
756
  var o;
757
- const i = this.constructor.elementProperties.get(e), s = this.constructor._$Eu(e, i);
758
- if (s !== void 0 && i.reflect === !0) {
757
+ const i = this.constructor.elementProperties.get(e), n = this.constructor._$Eu(e, i);
758
+ if (n !== void 0 && i.reflect === !0) {
759
759
  const r = (((o = i.converter) == null ? void 0 : o.toAttribute) !== void 0 ? i.converter : we).toAttribute(t, i.type);
760
- this._$Em = e, r == null ? this.removeAttribute(s) : this.setAttribute(s, r), this._$Em = null;
760
+ this._$Em = e, r == null ? this.removeAttribute(n) : this.setAttribute(n, r), this._$Em = null;
761
761
  }
762
762
  }
763
763
  _$AK(e, t) {
764
764
  var o, r;
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;
765
+ const i = this.constructor, n = i._$Eh.get(e);
766
+ if (n !== void 0 && this._$Em !== n) {
767
+ 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;
768
+ this._$Em = n;
769
769
  const c = a.fromAttribute(t, l.type);
770
- this[s] = c ?? ((r = this._$Ej) == null ? void 0 : r.get(s)) ?? c, this._$Em = null;
770
+ this[n] = c ?? ((r = this._$Ej) == null ? void 0 : r.get(n)) ?? c, this._$Em = null;
771
771
  }
772
772
  }
773
- requestUpdate(e, t, i, s = !1, o) {
773
+ requestUpdate(e, t, i, n = !1, o) {
774
774
  var r;
775
775
  if (e !== void 0) {
776
776
  const l = this.constructor;
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;
777
+ 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;
778
778
  this.C(e, t, i);
779
779
  }
780
780
  this.isUpdatePending === !1 && (this._$ES = this._$EP());
781
781
  }
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));
782
+ C(e, t, { useDefault: i, reflect: n, 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)), n === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
784
784
  }
785
785
  async _$EP() {
786
786
  this.isUpdatePending = !0;
@@ -803,8 +803,8 @@ let Y = class extends HTMLElement {
803
803
  for (const [o, r] of this._$Ep) this[o] = r;
804
804
  this._$Ep = void 0;
805
805
  }
806
- const s = this.constructor.elementProperties;
807
- if (s.size > 0) for (const [o, r] of s) {
806
+ const n = this.constructor.elementProperties;
807
+ if (n.size > 0) for (const [o, r] of n) {
808
808
  const { wrapped: l } = r, a = this[o];
809
809
  l !== !0 || this._$AL.has(o) || a === void 0 || this.C(o, void 0, r, a);
810
810
  }
@@ -812,12 +812,12 @@ let Y = class extends HTMLElement {
812
812
  let e = !1;
813
813
  const t = this._$AL;
814
814
  try {
815
- e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((s) => {
815
+ e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((n) => {
816
816
  var o;
817
- return (o = s.hostUpdate) == null ? void 0 : o.call(s);
817
+ return (o = n.hostUpdate) == null ? void 0 : o.call(n);
818
818
  }), this.update(t)) : this._$EM();
819
- } catch (s) {
820
- throw e = !1, this._$EM(), s;
819
+ } catch (n) {
820
+ throw e = !1, this._$EM(), n;
821
821
  }
822
822
  e && this._$AE(t);
823
823
  }
@@ -826,8 +826,8 @@ let Y = class extends HTMLElement {
826
826
  _$AE(e) {
827
827
  var t;
828
828
  (t = this._$EO) == null || t.forEach((i) => {
829
- var s;
830
- return (s = i.hostUpdated) == null ? void 0 : s.call(i);
829
+ var n;
830
+ return (n = i.hostUpdated) == null ? void 0 : n.call(i);
831
831
  }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
832
832
  }
833
833
  _$EM() {
@@ -850,59 +850,59 @@ let Y = class extends HTMLElement {
850
850
  firstUpdated(e) {
851
851
  }
852
852
  };
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");
853
+ 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");
854
854
  /**
855
855
  * @license
856
856
  * Copyright 2017 Google LLC
857
857
  * SPDX-License-Identifier: BSD-3-Clause
858
858
  */
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 = `[
859
+ 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 = `[
860
860
  \f\r]`, te = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, et = /-->/g, tt = />/g, H = RegExp(`>|${Se}(?:([^\\s"'>=/]+)(${Se}*=${Se}*(?:[^
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");
861
+ \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), V = Symbol.for("lit-noChange"), m = Symbol.for("lit-nothing"), nt = /* @__PURE__ */ new WeakMap(), B = F.createTreeWalker(F, 129);
862
+ function Ct(s, e) {
863
+ if (!He(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
864
864
  return Qe !== void 0 ? Qe.createHTML(e) : e;
865
865
  }
866
- const Gt = (n, e) => {
867
- const t = n.length - 1, i = [];
868
- let s, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = te;
866
+ const Gt = (s, e) => {
867
+ const t = s.length - 1, i = [];
868
+ let n, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = te;
869
869
  for (let l = 0; l < t; l++) {
870
- const a = n[l];
871
- let c, p, d = -1, u = 0;
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);
870
+ const a = s[l];
871
+ let c, p, d = -1, f = 0;
872
+ for (; f < a.length && (r.lastIndex = f, p = r.exec(a), p !== null); ) f = 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);
873
+ const u = r === H && s[l + 1].startsWith("/>") ? " " : "";
874
+ o += r === te ? a + Xt : d >= 0 ? (i.push(c), a.slice(0, d) + wt + a.slice(d) + z + u) : a + z + (d === -2 ? l : u);
875
875
  }
876
- return [Ct(n, o + (n[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
876
+ return [Ct(s, o + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
877
877
  };
878
878
  class ae {
879
879
  constructor({ strings: e, _$litType$: t }, i) {
880
- let s;
880
+ let n;
881
881
  this.parts = [];
882
882
  let o = 0, r = 0;
883
883
  const l = e.length - 1, a = this.parts, [c, p] = Gt(e, t);
884
- if (this.el = ae.createElement(c, i), N.currentNode = this.el.content, t === 2 || t === 3) {
884
+ if (this.el = ae.createElement(c, i), B.currentNode = this.el.content, t === 2 || t === 3) {
885
885
  const d = this.el.content.firstChild;
886
886
  d.replaceWith(...d.childNodes);
887
887
  }
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;
896
- if (u > 0) {
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());
888
+ for (; (n = B.nextNode()) !== null && a.length < l; ) {
889
+ if (n.nodeType === 1) {
890
+ if (n.hasAttributes()) for (const d of n.getAttributeNames()) if (d.endsWith(wt)) {
891
+ const f = p[r++], u = n.getAttribute(d).split(z), g = /([.?@])?(.*)/.exec(f);
892
+ a.push({ type: 1, index: o, name: g[2], strings: u, ctor: g[1] === "." ? Jt : g[1] === "?" ? Qt : g[1] === "@" ? ei : Ee }), n.removeAttribute(d);
893
+ } else d.startsWith(z) && (a.push({ type: 6, index: o }), n.removeAttribute(d));
894
+ if (kt.test(n.tagName)) {
895
+ const d = n.textContent.split(z), f = d.length - 1;
896
+ if (f > 0) {
897
+ n.textContent = $e ? $e.emptyScript : "";
898
+ for (let u = 0; u < f; u++) n.append(d[u], oe()), B.nextNode(), a.push({ type: 2, index: ++o });
899
+ n.append(d[f], oe());
900
900
  }
901
901
  }
902
- } else if (s.nodeType === 8) if (s.data === $t) a.push({ type: 2, index: o });
902
+ } else if (n.nodeType === 8) if (n.data === $t) a.push({ type: 2, index: o });
903
903
  else {
904
904
  let d = -1;
905
- for (; (d = s.data.indexOf(U, d + 1)) !== -1; ) a.push({ type: 7, index: o }), d += U.length - 1;
905
+ for (; (d = n.data.indexOf(z, d + 1)) !== -1; ) a.push({ type: 7, index: o }), d += z.length - 1;
906
906
  }
907
907
  o++;
908
908
  }
@@ -912,12 +912,12 @@ class ae {
912
912
  return i.innerHTML = e, i;
913
913
  }
914
914
  }
915
- function K(n, e, t = n, i) {
915
+ function K(s, e, t = s, i) {
916
916
  var r, l;
917
917
  if (e === V) return e;
918
- let s = i !== void 0 ? (r = t._$Co) == null ? void 0 : r[i] : t._$Cl;
918
+ let n = i !== void 0 ? (r = t._$Co) == null ? void 0 : r[i] : t._$Cl;
919
919
  const o = re(e) ? void 0 : e._$litDirective$;
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;
920
+ 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;
921
921
  }
922
922
  class Zt {
923
923
  constructor(e, t) {
@@ -930,17 +930,17 @@ class Zt {
930
930
  return this._$AM._$AU;
931
931
  }
932
932
  u(e) {
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];
933
+ const { el: { content: t }, parts: i } = this._$AD, n = ((e == null ? void 0 : e.creationScope) ?? F).importNode(t, !0);
934
+ B.currentNode = n;
935
+ let o = B.nextNode(), r = 0, l = 0, a = i[0];
936
936
  for (; a !== void 0; ) {
937
937
  if (r === a.index) {
938
938
  let c;
939
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];
940
940
  }
941
- r !== (a == null ? void 0 : a.index) && (o = N.nextNode(), r++);
941
+ r !== (a == null ? void 0 : a.index) && (o = B.nextNode(), r++);
942
942
  }
943
- return N.currentNode = F, s;
943
+ return B.currentNode = F, n;
944
944
  }
945
945
  p(e) {
946
946
  let t = 0;
@@ -952,8 +952,8 @@ class ue {
952
952
  var e;
953
953
  return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
954
954
  }
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;
955
+ constructor(e, t, i, n) {
956
+ 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;
957
957
  }
958
958
  get parentNode() {
959
959
  let e = this._$AA.parentNode;
@@ -967,7 +967,7 @@ class ue {
967
967
  return this._$AB;
968
968
  }
969
969
  _$AI(e, t = this) {
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);
970
+ e = K(this, e, t), re(e) ? e === m || e == null || e === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : 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);
971
971
  }
972
972
  O(e) {
973
973
  return this._$AA.parentNode.insertBefore(e, this._$AB);
@@ -976,14 +976,14 @@ class ue {
976
976
  this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
977
977
  }
978
978
  _(e) {
979
- this._$AH !== f && re(this._$AH) ? this._$AA.nextSibling.data = e : this.T(F.createTextNode(e)), this._$AH = e;
979
+ this._$AH !== m && re(this._$AH) ? this._$AA.nextSibling.data = e : this.T(F.createTextNode(e)), this._$AH = e;
980
980
  }
981
981
  $(e) {
982
982
  var o;
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);
983
+ 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);
984
+ if (((o = this._$AH) == null ? void 0 : o._$AD) === n) this._$AH.p(t);
985
985
  else {
986
- const r = new Zt(s, this), l = r.u(this.options);
986
+ const r = new Zt(n, this), l = r.u(this.options);
987
987
  r.p(t), this.T(l), this._$AH = r;
988
988
  }
989
989
  }
@@ -994,15 +994,15 @@ class ue {
994
994
  k(e) {
995
995
  He(this._$AH) || (this._$AH = [], this._$AR());
996
996
  const t = this._$AH;
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);
997
+ let i, n = 0;
998
+ 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++;
999
+ n < t.length && (this._$AR(i && i._$AB.nextSibling, n), t.length = n);
1000
1000
  }
1001
1001
  _$AR(e = this._$AA.nextSibling, t) {
1002
1002
  var i;
1003
1003
  for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, t); e !== this._$AB; ) {
1004
- const s = Je(e).nextSibling;
1005
- Je(e).remove(), e = s;
1004
+ const n = Je(e).nextSibling;
1005
+ Je(e).remove(), e = n;
1006
1006
  }
1007
1007
  }
1008
1008
  setConnected(e) {
@@ -1017,22 +1017,22 @@ class Ee {
1017
1017
  get _$AU() {
1018
1018
  return this._$AM._$AU;
1019
1019
  }
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;
1020
+ constructor(e, t, i, n, o) {
1021
+ 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;
1022
1022
  }
1023
- _$AI(e, t = this, i, s) {
1023
+ _$AI(e, t = this, i, n) {
1024
1024
  const o = this.strings;
1025
1025
  let r = !1;
1026
1026
  if (o === void 0) e = K(this, e, t, 0), r = !re(e) || e !== this._$AH && e !== V, r && (this._$AH = e);
1027
1027
  else {
1028
1028
  const l = e;
1029
1029
  let 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;
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 === m ? e = m : e !== m && (e += (c ?? "") + o[a + 1]), this._$AH[a] = c;
1031
1031
  }
1032
- r && !s && this.j(e);
1032
+ r && !n && this.j(e);
1033
1033
  }
1034
1034
  j(e) {
1035
- e === f ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
1035
+ e === m ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
1036
1036
  }
1037
1037
  }
1038
1038
  class Jt extends Ee {
@@ -1040,7 +1040,7 @@ class Jt extends Ee {
1040
1040
  super(...arguments), this.type = 3;
1041
1041
  }
1042
1042
  j(e) {
1043
- this.element[this.name] = e === f ? void 0 : e;
1043
+ this.element[this.name] = e === m ? void 0 : e;
1044
1044
  }
1045
1045
  }
1046
1046
  class Qt extends Ee {
@@ -1048,17 +1048,17 @@ class Qt extends Ee {
1048
1048
  super(...arguments), this.type = 4;
1049
1049
  }
1050
1050
  j(e) {
1051
- this.element.toggleAttribute(this.name, !!e && e !== f);
1051
+ this.element.toggleAttribute(this.name, !!e && e !== m);
1052
1052
  }
1053
1053
  }
1054
1054
  class ei extends Ee {
1055
- constructor(e, t, i, s, o) {
1056
- super(e, t, i, s, o), this.type = 5;
1055
+ constructor(e, t, i, n, o) {
1056
+ super(e, t, i, n, o), this.type = 5;
1057
1057
  }
1058
1058
  _$AI(e, t = this) {
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;
1059
+ if ((e = K(this, e, t, 0) ?? m) === V) return;
1060
+ 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);
1061
+ n && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
1062
1062
  }
1063
1063
  handleEvent(e) {
1064
1064
  var t;
@@ -1078,22 +1078,22 @@ class ti {
1078
1078
  }
1079
1079
  const Pe = se.litHtmlPolyfillSupport;
1080
1080
  Pe == null || Pe(ae, ue), (se.litHtmlVersions ?? (se.litHtmlVersions = [])).push("3.3.2");
1081
- const ii = (n, e, t) => {
1081
+ const ii = (s, e, t) => {
1082
1082
  const i = (t == null ? void 0 : t.renderBefore) ?? e;
1083
- let s = i._$litPart$;
1084
- if (s === void 0) {
1083
+ let n = i._$litPart$;
1084
+ if (n === void 0) {
1085
1085
  const o = (t == null ? void 0 : t.renderBefore) ?? null;
1086
- i._$litPart$ = s = new ue(e.insertBefore(oe(), o), o, void 0, t ?? {});
1086
+ i._$litPart$ = n = new ue(e.insertBefore(oe(), o), o, void 0, t ?? {});
1087
1087
  }
1088
- return s._$AI(n), s;
1088
+ return n._$AI(s), n;
1089
1089
  };
1090
1090
  /**
1091
1091
  * @license
1092
1092
  * Copyright 2017 Google LLC
1093
1093
  * SPDX-License-Identifier: BSD-3-Clause
1094
1094
  */
1095
- const B = globalThis;
1096
- let T = class extends Y {
1095
+ const N = globalThis;
1096
+ let S = class extends Y {
1097
1097
  constructor() {
1098
1098
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
1099
1099
  }
@@ -1119,99 +1119,99 @@ let T = class extends Y {
1119
1119
  }
1120
1120
  };
1121
1121
  var bt;
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");
1122
+ S._$litElement$ = !0, S.finalized = !0, (bt = N.litElementHydrateSupport) == null || bt.call(N, { LitElement: S });
1123
+ const Ae = N.litElementPolyfillSupport;
1124
+ Ae == null || Ae({ LitElement: S });
1125
+ (N.litElementVersions ?? (N.litElementVersions = [])).push("4.2.2");
1126
1126
  /**
1127
1127
  * @license
1128
1128
  * Copyright 2017 Google LLC
1129
1129
  * SPDX-License-Identifier: BSD-3-Clause
1130
1130
  */
1131
- const R = (n) => (e, t) => {
1131
+ const R = (s) => (e, t) => {
1132
1132
  t !== void 0 ? t.addInitializer(() => {
1133
- customElements.define(n, e);
1134
- }) : customElements.define(n, e);
1133
+ customElements.define(s, e);
1134
+ }) : customElements.define(s, e);
1135
1135
  };
1136
1136
  /**
1137
1137
  * @license
1138
1138
  * Copyright 2017 Google LLC
1139
1139
  * SPDX-License-Identifier: BSD-3-Clause
1140
1140
  */
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") {
1141
+ const si = { attribute: !0, type: String, converter: we, reflect: !1, hasChanged: De }, ni = (s = si, e, t) => {
1142
+ const { kind: i, metadata: n } = t;
1143
+ let o = globalThis.litPropertyMetadata.get(n);
1144
+ 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") {
1145
1145
  const { name: r } = t;
1146
1146
  return { set(l) {
1147
1147
  const a = e.get.call(this);
1148
- e.set.call(this, l), this.requestUpdate(r, a, n, !0, l);
1148
+ e.set.call(this, l), this.requestUpdate(r, a, s, !0, l);
1149
1149
  }, init(l) {
1150
- return l !== void 0 && this.C(r, void 0, n, l), l;
1150
+ return l !== void 0 && this.C(r, void 0, s, l), l;
1151
1151
  } };
1152
1152
  }
1153
1153
  if (i === "setter") {
1154
1154
  const { name: r } = t;
1155
1155
  return function(l) {
1156
1156
  const a = this[r];
1157
- e.call(this, l), this.requestUpdate(r, a, n, !0, l);
1157
+ e.call(this, l), this.requestUpdate(r, a, s, !0, l);
1158
1158
  };
1159
1159
  }
1160
1160
  throw Error("Unsupported decorator location: " + i);
1161
1161
  };
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);
1162
+ function b(s) {
1163
+ return (e, t) => typeof t == "object" ? ni(s, e, t) : ((i, n, o) => {
1164
+ const r = n.hasOwnProperty(o);
1165
+ return n.constructor.createProperty(o, i), r ? Object.getOwnPropertyDescriptor(n, o) : void 0;
1166
+ })(s, e, t);
1167
1167
  }
1168
1168
  /**
1169
1169
  * @license
1170
1170
  * Copyright 2017 Google LLC
1171
1171
  * SPDX-License-Identifier: BSD-3-Clause
1172
1172
  */
1173
- function v(n) {
1174
- return g({ ...n, state: !0, attribute: !1 });
1173
+ function x(s) {
1174
+ return b({ ...s, state: !0, attribute: !1 });
1175
1175
  }
1176
1176
  const Z = "pulse-client";
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;
1177
+ var oi = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, J = (s, e, t, i) => {
1178
+ for (var n = i > 1 ? void 0 : i ? ri(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1179
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1180
+ return i && n && oi(e, t, n), n;
1181
1181
  };
1182
- let q = class extends T {
1182
+ let q = class extends S {
1183
1183
  constructor() {
1184
1184
  super(...arguments), this.apiKey = "", this.token = "", this.room = "";
1185
1185
  }
1186
1186
  connectedCallback() {
1187
1187
  super.connectedCallback();
1188
- const n = {
1188
+ const s = {
1189
1189
  apiKey: this.apiKey,
1190
1190
  token: this.token,
1191
1191
  room: this.room,
1192
1192
  endpoint: this.endpoint
1193
1193
  };
1194
- this.client = new xt(n), this.client.connect();
1194
+ this.client = new xt(s), this.client.connect();
1195
1195
  }
1196
1196
  disconnectedCallback() {
1197
- var n;
1198
- super.disconnectedCallback(), (n = this.client) == null || n.disconnect();
1197
+ var s;
1198
+ super.disconnectedCallback(), (s = this.client) == null || s.disconnect();
1199
1199
  }
1200
1200
  render() {
1201
1201
  return h`<slot></slot>`;
1202
1202
  }
1203
1203
  };
1204
1204
  J([
1205
- g({ attribute: "api-key" })
1205
+ b({ attribute: "api-key" })
1206
1206
  ], q.prototype, "apiKey", 2);
1207
1207
  J([
1208
- g()
1208
+ b()
1209
1209
  ], q.prototype, "token", 2);
1210
1210
  J([
1211
- g()
1211
+ b()
1212
1212
  ], q.prototype, "room", 2);
1213
1213
  J([
1214
- g()
1214
+ b()
1215
1215
  ], q.prototype, "endpoint", 2);
1216
1216
  J([
1217
1217
  Mt({ context: Z })
@@ -1219,12 +1219,12 @@ J([
1219
1219
  q = J([
1220
1220
  R("pulse-provider")
1221
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;
1222
+ var ai = Object.defineProperty, li = Object.getOwnPropertyDescriptor, Ce = (s, e, t, i) => {
1223
+ for (var n = i > 1 ? void 0 : i ? li(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1224
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1225
+ return i && n && ai(e, t, n), n;
1226
1226
  };
1227
- let G = class extends T {
1227
+ let G = class extends S {
1228
1228
  constructor() {
1229
1229
  super(...arguments), this.maxVisible = 5, this.users = [];
1230
1230
  }
@@ -1232,27 +1232,27 @@ let G = class extends T {
1232
1232
  super.connectedCallback(), this.setupListener();
1233
1233
  }
1234
1234
  disconnectedCallback() {
1235
- var n;
1236
- super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
1235
+ var s;
1236
+ super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
1237
1237
  }
1238
- updated(n) {
1238
+ updated(s) {
1239
1239
  var e;
1240
- n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1240
+ s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1241
1241
  }
1242
1242
  setupListener() {
1243
- this.client && (this.users = this.client.state.presence, this.unsub = this.client.state.on("presence", (n) => {
1244
- this.users = n;
1243
+ this.client && (this.users = this.client.state.presence, this.unsub = this.client.state.on("presence", (s) => {
1244
+ this.users = s;
1245
1245
  }));
1246
1246
  }
1247
- getInitials(n) {
1248
- return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1247
+ getInitials(s) {
1248
+ return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1249
1249
  }
1250
1250
  render() {
1251
- const n = this.users.slice(0, this.maxVisible), e = this.users.length - this.maxVisible;
1251
+ const s = this.users.slice(0, this.maxVisible), e = this.users.length - this.maxVisible;
1252
1252
  return h`
1253
1253
  <div class="avatars">
1254
1254
  ${e > 0 ? h`<div class="overflow">+${e}</div>` : null}
1255
- ${n.map(
1255
+ ${s.map(
1256
1256
  (t) => h`
1257
1257
  <div
1258
1258
  class="avatar"
@@ -1268,7 +1268,7 @@ let G = class extends T {
1268
1268
  `;
1269
1269
  }
1270
1270
  };
1271
- G.styles = A`
1271
+ G.styles = I`
1272
1272
  :host {
1273
1273
  display: inline-flex;
1274
1274
  align-items: center;
@@ -1374,31 +1374,31 @@ G.styles = A`
1374
1374
  `;
1375
1375
  Ce([
1376
1376
  pe({ context: Z, subscribe: !0 }),
1377
- g({ attribute: !1 })
1377
+ b({ attribute: !1 })
1378
1378
  ], G.prototype, "client", 2);
1379
1379
  Ce([
1380
- g({ type: Number, attribute: "max-visible" })
1380
+ b({ type: Number, attribute: "max-visible" })
1381
1381
  ], G.prototype, "maxVisible", 2);
1382
1382
  Ce([
1383
- v()
1383
+ x()
1384
1384
  ], G.prototype, "users", 2);
1385
1385
  G = Ce([
1386
1386
  R("pulse-presence")
1387
1387
  ], G);
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;
1388
+ var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, Be = (s, e, t, i) => {
1389
+ for (var n = i > 1 ? void 0 : i ? di(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1390
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1391
+ return i && n && ci(e, t, n), n;
1392
1392
  };
1393
- let le = class extends T {
1393
+ let le = class extends S {
1394
1394
  constructor() {
1395
- super(...arguments), this.cursors = /* @__PURE__ */ new Map(), this.unsubs = [], this.handleLocalCursor = (n) => {
1395
+ super(...arguments), this.cursors = /* @__PURE__ */ new Map(), this.unsubs = [], this.handleLocalCursor = (s) => {
1396
1396
  var e;
1397
1397
  (e = this.client) == null || e.moveCursor({
1398
- x: n.clientX,
1399
- y: n.clientY,
1400
- pageX: n.pageX,
1401
- pageY: n.pageY
1398
+ x: s.clientX,
1399
+ y: s.clientY,
1400
+ pageX: s.pageX,
1401
+ pageY: s.pageY
1402
1402
  });
1403
1403
  };
1404
1404
  }
@@ -1406,25 +1406,25 @@ let le = class extends T {
1406
1406
  super.connectedCallback(), this.setupListeners();
1407
1407
  }
1408
1408
  disconnectedCallback() {
1409
- super.disconnectedCallback(), this.unsubs.forEach((n) => n()), this.unsubs = [], document.removeEventListener("mousemove", this.handleLocalCursor);
1409
+ super.disconnectedCallback(), this.unsubs.forEach((s) => s()), this.unsubs = [], document.removeEventListener("mousemove", this.handleLocalCursor);
1410
1410
  }
1411
- updated(n) {
1412
- n.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
1411
+ updated(s) {
1412
+ s.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
1413
1413
  }
1414
1414
  setupListeners() {
1415
1415
  this.client && (this.unsubs.push(
1416
1416
  this.client.state.on(
1417
1417
  "cursor",
1418
- ({ userId: n, position: e }) => {
1419
- const t = this.cursors.get(n);
1418
+ ({ userId: s, position: e }) => {
1419
+ const t = this.cursors.get(s);
1420
1420
  if (t)
1421
1421
  t.position = e;
1422
1422
  else {
1423
1423
  const i = this.client.state.presence.find(
1424
- (s) => s.user.id === n
1424
+ (n) => n.user.id === s
1425
1425
  );
1426
- i && this.cursors.set(n, {
1427
- userId: n,
1426
+ i && this.cursors.set(s, {
1427
+ userId: s,
1428
1428
  name: i.user.name,
1429
1429
  color: i.user.color,
1430
1430
  position: e
@@ -1434,8 +1434,8 @@ let le = class extends T {
1434
1434
  }
1435
1435
  )
1436
1436
  ), this.unsubs.push(
1437
- this.client.state.on("presence", (n) => {
1438
- const e = new Set(n.map((t) => t.user.id));
1437
+ this.client.state.on("presence", (s) => {
1438
+ const e = new Set(s.map((t) => t.user.id));
1439
1439
  for (const t of this.cursors.keys())
1440
1440
  e.has(t) || this.cursors.delete(t);
1441
1441
  this.requestUpdate();
@@ -1443,9 +1443,9 @@ let le = class extends T {
1443
1443
  ), document.addEventListener("mousemove", this.handleLocalCursor));
1444
1444
  }
1445
1445
  render() {
1446
- const n = [...this.cursors.values()];
1446
+ const s = [...this.cursors.values()];
1447
1447
  return h`
1448
- ${n.map(
1448
+ ${s.map(
1449
1449
  (e) => h`
1450
1450
  <div
1451
1451
  class="cursor"
@@ -1467,7 +1467,7 @@ let le = class extends T {
1467
1467
  `;
1468
1468
  }
1469
1469
  };
1470
- le.styles = A`
1470
+ le.styles = I`
1471
1471
  :host {
1472
1472
  position: fixed;
1473
1473
  top: 0;
@@ -1504,22 +1504,22 @@ le.styles = A`
1504
1504
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
1505
1505
  }
1506
1506
  `;
1507
- Ne([
1507
+ Be([
1508
1508
  pe({ context: Z, subscribe: !0 }),
1509
- g({ attribute: !1 })
1509
+ b({ attribute: !1 })
1510
1510
  ], le.prototype, "client", 2);
1511
- Ne([
1512
- v()
1511
+ Be([
1512
+ x()
1513
1513
  ], le.prototype, "cursors", 2);
1514
- le = Ne([
1514
+ le = Be([
1515
1515
  R("pulse-cursors")
1516
1516
  ], le);
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;
1517
+ var hi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fe = (s, e, t, i) => {
1518
+ for (var n = i > 1 ? void 0 : i ? pi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1519
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1520
+ return i && n && hi(e, t, n), n;
1521
1521
  };
1522
- let W = class extends T {
1522
+ let W = class extends S {
1523
1523
  constructor() {
1524
1524
  super(...arguments), this.showResolved = !1, this.threads = [], this.replyingTo = null;
1525
1525
  }
@@ -1527,52 +1527,52 @@ let W = class extends T {
1527
1527
  super.connectedCallback(), this.setupListener();
1528
1528
  }
1529
1529
  disconnectedCallback() {
1530
- var n;
1531
- super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
1530
+ var s;
1531
+ super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
1532
1532
  }
1533
- updated(n) {
1533
+ updated(s) {
1534
1534
  var e;
1535
- n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1535
+ s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1536
1536
  }
1537
1537
  setupListener() {
1538
- this.client && (this.threads = this.client.state.threads, this.unsub = this.client.state.on("threads", (n) => {
1539
- this.threads = [...n];
1538
+ this.client && (this.threads = this.client.state.threads, this.unsub = this.client.state.on("threads", (s) => {
1539
+ this.threads = [...s];
1540
1540
  }));
1541
1541
  }
1542
- parseMentions(n) {
1543
- return n.split(/(@\w+)/g).map(
1542
+ parseMentions(s) {
1543
+ return s.split(/(@\w+)/g).map(
1544
1544
  (t) => t.startsWith("@") ? h`<span class="mention">${t}</span>` : t
1545
1545
  );
1546
1546
  }
1547
- getInitials(n) {
1548
- return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1547
+ getInitials(s) {
1548
+ return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1549
1549
  }
1550
- getUserForComment(n) {
1550
+ getUserForComment(s) {
1551
1551
  var e;
1552
- return (e = this.client.state.presence.find((t) => t.user.id === n)) == null ? void 0 : e.user;
1552
+ return (e = this.client.state.presence.find((t) => t.user.id === s)) == null ? void 0 : e.user;
1553
1553
  }
1554
- handleNewThread(n) {
1555
- n.preventDefault();
1556
- const t = n.target.querySelector("textarea"), i = t.value.trim();
1554
+ handleNewThread(s) {
1555
+ s.preventDefault();
1556
+ const t = s.target.querySelector("textarea"), i = t.value.trim();
1557
1557
  if (!i) return;
1558
- const s = [...i.matchAll(/@(\w+)/g)].map((o) => o[1]);
1559
- this.client.createThread(i, { mentions: s }), t.value = "";
1558
+ const n = [...i.matchAll(/@(\w+)/g)].map((o) => o[1]);
1559
+ this.client.createThread(i, { mentions: n }), t.value = "";
1560
1560
  }
1561
- handleReply(n, e) {
1561
+ handleReply(s, e) {
1562
1562
  e.preventDefault();
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;
1563
+ const i = e.target.querySelector("input"), n = i.value.trim();
1564
+ if (!n) return;
1565
+ const o = [...n.matchAll(/@(\w+)/g)].map((r) => r[1]);
1566
+ this.client.reply(s, n, o), i.value = "", this.replyingTo = null;
1567
1567
  }
1568
1568
  render() {
1569
- const n = this.showResolved ? this.threads : this.threads.filter((e) => !e.resolved);
1569
+ const s = this.showResolved ? this.threads : this.threads.filter((e) => !e.resolved);
1570
1570
  return h`
1571
1571
  <div class="threads">
1572
- ${n.length === 0 ? h`<div class="empty">
1572
+ ${s.length === 0 ? h`<div class="empty">
1573
1573
  <div class="empty-icon">&#128172;</div>
1574
1574
  No comments yet.<br>Start a conversation below.
1575
- </div>` : n.map((e) => this.renderThread(e))}
1575
+ </div>` : s.map((e) => this.renderThread(e))}
1576
1576
  </div>
1577
1577
  <div class="new-thread">
1578
1578
  <form @submit=${this.handleNewThread}>
@@ -1582,13 +1582,13 @@ let W = class extends T {
1582
1582
  </div>
1583
1583
  `;
1584
1584
  }
1585
- renderThread(n) {
1585
+ renderThread(s) {
1586
1586
  return h`
1587
- <div class="thread ${n.resolved ? "resolved" : ""}">
1588
- ${n.comments.map((e, t) => {
1587
+ <div class="thread ${s.resolved ? "resolved" : ""}">
1588
+ ${s.comments.map((e, t) => {
1589
1589
  const i = this.getUserForComment(e.userId);
1590
1590
  return h`
1591
- ${t > 0 ? h`<div class="divider"></div>` : f}
1591
+ ${t > 0 ? h`<div class="divider"></div>` : m}
1592
1592
  <div class="comment">
1593
1593
  <div class="comment-header">
1594
1594
  <div
@@ -1610,34 +1610,34 @@ let W = class extends T {
1610
1610
  })}
1611
1611
  <div class="thread-actions">
1612
1612
  <button
1613
- @click=${() => this.replyingTo = this.replyingTo === n.id ? null : n.id}
1613
+ @click=${() => this.replyingTo = this.replyingTo === s.id ? null : s.id}
1614
1614
  >
1615
1615
  Reply
1616
1616
  </button>
1617
1617
  <button
1618
- @click=${() => this.client.resolveThread(n.id, !n.resolved)}
1618
+ @click=${() => this.client.resolveThread(s.id, !s.resolved)}
1619
1619
  >
1620
- ${n.resolved ? "Reopen" : "Resolve"}
1620
+ ${s.resolved ? "Reopen" : "Resolve"}
1621
1621
  </button>
1622
1622
  </div>
1623
- ${this.replyingTo === n.id ? h`
1624
- <form class="reply-form" @submit=${(e) => this.handleReply(n.id, e)}>
1623
+ ${this.replyingTo === s.id ? h`
1624
+ <form class="reply-form" @submit=${(e) => this.handleReply(s.id, e)}>
1625
1625
  <input type="text" placeholder="Write a reply..." />
1626
1626
  <button type="submit">Send</button>
1627
1627
  </form>
1628
- ` : f}
1628
+ ` : m}
1629
1629
  </div>
1630
1630
  `;
1631
1631
  }
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);
1632
+ formatTime(s) {
1633
+ const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
1634
+ if (n < 1) return "just now";
1635
+ if (n < 60) return `${n}m ago`;
1636
+ const o = Math.floor(n / 60);
1637
1637
  return o < 24 ? `${o}h ago` : e.toLocaleDateString();
1638
1638
  }
1639
1639
  };
1640
- W.styles = A`
1640
+ W.styles = I`
1641
1641
  :host {
1642
1642
  display: block;
1643
1643
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -1851,24 +1851,24 @@ W.styles = A`
1851
1851
  `;
1852
1852
  fe([
1853
1853
  pe({ context: Z, subscribe: !0 }),
1854
- g({ attribute: !1 })
1854
+ b({ attribute: !1 })
1855
1855
  ], W.prototype, "client", 2);
1856
1856
  fe([
1857
- g({ type: Boolean, attribute: "show-resolved" })
1857
+ b({ type: Boolean, attribute: "show-resolved" })
1858
1858
  ], W.prototype, "showResolved", 2);
1859
1859
  fe([
1860
- v()
1860
+ x()
1861
1861
  ], W.prototype, "threads", 2);
1862
1862
  fe([
1863
- v()
1863
+ x()
1864
1864
  ], W.prototype, "replyingTo", 2);
1865
1865
  W = fe([
1866
1866
  R("pulse-comments")
1867
1867
  ], W);
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;
1868
+ var ui = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, Ne = (s, e, t, i) => {
1869
+ for (var n = i > 1 ? void 0 : i ? fi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1870
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1871
+ return i && n && ui(e, t, n), n;
1872
1872
  };
1873
1873
  const mi = {
1874
1874
  "comment:created": "left a comment",
@@ -1883,7 +1883,7 @@ const mi = {
1883
1883
  "thread:resolved": "✅",
1884
1884
  "reaction:added": "🎉"
1885
1885
  };
1886
- let ce = class extends T {
1886
+ let ce = class extends S {
1887
1887
  constructor() {
1888
1888
  super(...arguments), this.notifications = [];
1889
1889
  }
@@ -1891,54 +1891,54 @@ let ce = class extends T {
1891
1891
  super.connectedCallback(), this.setupListener();
1892
1892
  }
1893
1893
  disconnectedCallback() {
1894
- var n;
1895
- super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
1894
+ var s;
1895
+ super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
1896
1896
  }
1897
- updated(n) {
1897
+ updated(s) {
1898
1898
  var e;
1899
- n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1899
+ s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1900
1900
  }
1901
1901
  setupListener() {
1902
1902
  this.client && (this.notifications = this.client.state.notifications, this.unsub = this.client.state.on(
1903
1903
  "notifications",
1904
- (n) => {
1905
- this.notifications = [...n];
1904
+ (s) => {
1905
+ this.notifications = [...s];
1906
1906
  }
1907
1907
  ));
1908
1908
  }
1909
- handleClick(n) {
1910
- n.read || this.client.markRead(n.id), this.dispatchEvent(
1909
+ handleClick(s) {
1910
+ s.read || this.client.markRead(s.id), this.dispatchEvent(
1911
1911
  new CustomEvent("pulse-notification-click", {
1912
- detail: n,
1912
+ detail: s,
1913
1913
  bubbles: !0,
1914
1914
  composed: !0
1915
1915
  })
1916
1916
  );
1917
1917
  }
1918
- getActorName(n) {
1918
+ getActorName(s) {
1919
1919
  const e = this.client.state.presence.find(
1920
- (t) => t.user.id === n
1920
+ (t) => t.user.id === s
1921
1921
  );
1922
1922
  return (e == null ? void 0 : e.user.name) ?? "Someone";
1923
1923
  }
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);
1924
+ formatTime(s) {
1925
+ const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
1926
+ if (n < 1) return "just now";
1927
+ if (n < 60) return `${n}m ago`;
1928
+ const o = Math.floor(n / 60);
1929
1929
  return o < 24 ? `${o}h ago` : e.toLocaleDateString();
1930
1930
  }
1931
1931
  render() {
1932
- const n = this.notifications.filter((e) => !e.read).length;
1932
+ const s = this.notifications.filter((e) => !e.read).length;
1933
1933
  return h`
1934
1934
  <div class="header">
1935
1935
  <span class="title">
1936
1936
  Notifications
1937
- ${n > 0 ? h`<span class="badge">${n}</span>` : f}
1937
+ ${s > 0 ? h`<span class="badge">${s}</span>` : m}
1938
1938
  </span>
1939
- ${n > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
1939
+ ${s > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
1940
1940
  Mark all read
1941
- </button>` : f}
1941
+ </button>` : m}
1942
1942
  </div>
1943
1943
  <div class="list">
1944
1944
  ${this.notifications.length === 0 ? h`<div class="empty">
@@ -1966,7 +1966,7 @@ let ce = class extends T {
1966
1966
  `;
1967
1967
  }
1968
1968
  };
1969
- ce.styles = A`
1969
+ ce.styles = I`
1970
1970
  :host {
1971
1971
  display: block;
1972
1972
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -2107,23 +2107,23 @@ ce.styles = A`
2107
2107
  opacity: 0.4;
2108
2108
  }
2109
2109
  `;
2110
- Be([
2110
+ Ne([
2111
2111
  pe({ context: Z, subscribe: !0 }),
2112
- g({ attribute: !1 })
2112
+ b({ attribute: !1 })
2113
2113
  ], ce.prototype, "client", 2);
2114
- Be([
2115
- v()
2114
+ Ne([
2115
+ x()
2116
2116
  ], ce.prototype, "notifications", 2);
2117
- ce = Be([
2117
+ ce = Ne([
2118
2118
  R("pulse-notifications")
2119
2119
  ], ce);
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;
2120
+ var bi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Q = (s, e, t, i) => {
2121
+ for (var n = i > 1 ? void 0 : i ? vi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
2122
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
2123
+ return i && n && bi(e, t, n), n;
2124
2124
  };
2125
2125
  const xi = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
2126
- let D = class extends T {
2126
+ let D = class extends S {
2127
2127
  constructor() {
2128
2128
  super(...arguments), this.targetId = "", this.targetType = "comment", this.reactions = [], this.showPicker = !1;
2129
2129
  }
@@ -2131,40 +2131,40 @@ let D = class extends T {
2131
2131
  super.connectedCallback(), this.setupListener();
2132
2132
  }
2133
2133
  disconnectedCallback() {
2134
- var n;
2135
- super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
2134
+ var s;
2135
+ super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
2136
2136
  }
2137
- updated(n) {
2137
+ updated(s) {
2138
2138
  var e;
2139
- n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
2139
+ s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
2140
2140
  }
2141
2141
  setupListener() {
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]);
2142
+ this.client && (this.reactions = this.client.state.getReactions(this.targetId), this.unsub = this.client.state.on("reactions", (s) => {
2143
+ s.targetId === this.targetId && (this.reactions = [...s.reactions]);
2144
2144
  }));
2145
2145
  }
2146
2146
  groupReactions() {
2147
2147
  var t, i;
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);
2148
+ const s = /* @__PURE__ */ new Map(), e = (i = (t = this.client) == null ? void 0 : t.state.user) == null ? void 0 : i.id;
2149
+ for (const n of this.reactions) {
2150
+ const o = s.get(n.emoji) ?? { count: 0, userReactionId: null };
2151
+ o.count++, n.userId === e && (o.userReactionId = n.id), s.set(n.emoji, o);
2152
2152
  }
2153
- return [...n.entries()].map(([s, o]) => ({
2154
- emoji: s,
2153
+ return [...s.entries()].map(([n, o]) => ({
2154
+ emoji: n,
2155
2155
  ...o
2156
2156
  }));
2157
2157
  }
2158
- toggleReaction(n) {
2159
- n.userReactionId ? this.client.removeReaction(n.userReactionId) : this.client.addReaction(this.targetId, this.targetType, n.emoji);
2158
+ toggleReaction(s) {
2159
+ s.userReactionId ? this.client.removeReaction(s.userReactionId) : this.client.addReaction(this.targetId, this.targetType, s.emoji);
2160
2160
  }
2161
- addEmoji(n) {
2162
- this.client.addReaction(this.targetId, this.targetType, n), this.showPicker = !1;
2161
+ addEmoji(s) {
2162
+ this.client.addReaction(this.targetId, this.targetType, s), this.showPicker = !1;
2163
2163
  }
2164
2164
  render() {
2165
- const n = this.groupReactions();
2165
+ const s = this.groupReactions();
2166
2166
  return h`
2167
- ${n.map(
2167
+ ${s.map(
2168
2168
  (e) => h`
2169
2169
  <button
2170
2170
  class="reaction ${e.userReactionId ? "active" : ""}"
@@ -2192,12 +2192,12 @@ let D = class extends T {
2192
2192
  `
2193
2193
  )}
2194
2194
  </div>
2195
- ` : f}
2195
+ ` : m}
2196
2196
  </div>
2197
2197
  `;
2198
2198
  }
2199
2199
  };
2200
- D.styles = A`
2200
+ D.styles = I`
2201
2201
  :host {
2202
2202
  display: inline-flex;
2203
2203
  align-items: center;
@@ -2311,19 +2311,19 @@ D.styles = A`
2311
2311
  `;
2312
2312
  Q([
2313
2313
  pe({ context: Z, subscribe: !0 }),
2314
- g({ attribute: !1 })
2314
+ b({ attribute: !1 })
2315
2315
  ], D.prototype, "client", 2);
2316
2316
  Q([
2317
- g({ attribute: "target-id" })
2317
+ b({ attribute: "target-id" })
2318
2318
  ], D.prototype, "targetId", 2);
2319
2319
  Q([
2320
- g({ attribute: "target-type" })
2320
+ b({ attribute: "target-type" })
2321
2321
  ], D.prototype, "targetType", 2);
2322
2322
  Q([
2323
- v()
2323
+ x()
2324
2324
  ], D.prototype, "reactions", 2);
2325
2325
  Q([
2326
- v()
2326
+ x()
2327
2327
  ], D.prototype, "showPicker", 2);
2328
2328
  D = Q([
2329
2329
  R("pulse-reactions")
@@ -2333,7 +2333,7 @@ D = Q([
2333
2333
  * Copyright 2017 Google LLC
2334
2334
  * SPDX-License-Identifier: BSD-3-Clause
2335
2335
  */
2336
- const yi = { CHILD: 2 }, wi = (n) => (...e) => ({ _$litDirective$: n, values: e });
2336
+ const yi = { CHILD: 2 }, wi = (s) => (...e) => ({ _$litDirective$: s, values: e });
2337
2337
  class $i {
2338
2338
  constructor(e) {
2339
2339
  }
@@ -2357,10 +2357,10 @@ class $i {
2357
2357
  */
2358
2358
  class Ie extends $i {
2359
2359
  constructor(e) {
2360
- if (super(e), this.it = f, e.type !== yi.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
2360
+ if (super(e), this.it = m, e.type !== yi.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
2361
2361
  }
2362
2362
  render(e) {
2363
- if (e === f || e == null) return this._t = void 0, this.it = e;
2363
+ if (e === m || e == null) return this._t = void 0, this.it = e;
2364
2364
  if (e === V) return e;
2365
2365
  if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
2366
2366
  if (e === this.it) return this._t;
@@ -2557,13 +2557,13 @@ const Ri = [
2557
2557
  }
2558
2558
  ]
2559
2559
  ];
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(" ");
2560
+ function Li(s) {
2561
+ return s.map(([e, t]) => {
2562
+ const i = Object.entries(t).filter(([, n]) => n != null).map(([n, o]) => `${n}="${o}"`).join(" ");
2563
2563
  return `<${e} ${i}/>`;
2564
2564
  }).join("");
2565
2565
  }
2566
- function k(n, e = 18) {
2566
+ function C(s, e = 18) {
2567
2567
  return Kt`<svg
2568
2568
  xmlns="http://www.w3.org/2000/svg"
2569
2569
  width="${e}"
@@ -2574,9 +2574,9 @@ function k(n, e = 18) {
2574
2574
  stroke-width="2"
2575
2575
  stroke-linecap="round"
2576
2576
  stroke-linejoin="round"
2577
- >${ki(Li(n))}</svg>`;
2577
+ >${ki(Li(s))}</svg>`;
2578
2578
  }
2579
- const ee = A`
2579
+ const ee = I`
2580
2580
  * {
2581
2581
  box-sizing: border-box;
2582
2582
  margin: 0;
@@ -2619,7 +2619,7 @@ const ee = A`
2619
2619
  --pw-shadow: var(--pulse-shadow);
2620
2620
  --pw-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
2621
2621
  }
2622
- `, ge = A`
2622
+ `, ge = I`
2623
2623
  .pw-btn {
2624
2624
  display: inline-flex;
2625
2625
  align-items: center;
@@ -2663,7 +2663,7 @@ const ee = A`
2663
2663
  width: 18px;
2664
2664
  height: 18px;
2665
2665
  }
2666
- `, _e = A`
2666
+ `, _e = I`
2667
2667
  .pw-scrollable::-webkit-scrollbar {
2668
2668
  width: 4px;
2669
2669
  }
@@ -2675,12 +2675,12 @@ const ee = A`
2675
2675
  background: transparent;
2676
2676
  }
2677
2677
  `;
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;
2678
+ var ji = Object.defineProperty, zi = Object.getOwnPropertyDescriptor, Fe = (s, e, t, i) => {
2679
+ for (var n = i > 1 ? void 0 : i ? zi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
2680
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
2681
+ return i && n && ji(e, t, n), n;
2682
2682
  };
2683
- let X = class extends T {
2683
+ let X = class extends S {
2684
2684
  constructor() {
2685
2685
  super(...arguments), this.items = [], this.unsubs = [], this.counter = 0;
2686
2686
  }
@@ -2688,36 +2688,36 @@ let X = class extends T {
2688
2688
  super.connectedCallback(), this.setupListeners();
2689
2689
  }
2690
2690
  disconnectedCallback() {
2691
- super.disconnectedCallback(), this.unsubs.forEach((n) => n()), this.unsubs = [];
2691
+ super.disconnectedCallback(), this.unsubs.forEach((s) => s()), this.unsubs = [];
2692
2692
  }
2693
- updated(n) {
2694
- n.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
2693
+ updated(s) {
2694
+ s.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
2695
2695
  }
2696
2696
  setupListeners() {
2697
2697
  if (!this.client) return;
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(
2698
+ const s = this.client.state.activityLogs;
2699
+ s.length > 0 && (this.items = s.map((e) => this.logToItem(e)), this.counter = this.items.length), this.unsubs.push(
2700
2700
  this.client.state.on("activity-logs", (e) => {
2701
2701
  this.items = e.map((t) => this.logToItem(t));
2702
2702
  })
2703
2703
  );
2704
2704
  }
2705
- logToItem(n) {
2705
+ logToItem(s) {
2706
2706
  return {
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"
2707
+ id: s.id,
2708
+ type: s.type,
2709
+ userId: s.userId,
2710
+ description: s.description,
2711
+ timestamp: new Date(s.createdAt).getTime(),
2712
+ color: X.TYPE_COLORS[s.type] ?? "#94a3b8"
2713
2713
  };
2714
2714
  }
2715
- getUserName(n) {
2715
+ getUserName(s) {
2716
2716
  var e;
2717
- return ((e = this.client.state.getUser(n)) == null ? void 0 : e.name) ?? "Someone";
2717
+ return ((e = this.client.state.getUser(s)) == null ? void 0 : e.name) ?? "Someone";
2718
2718
  }
2719
- formatRelativeTime(n) {
2720
- const e = Math.floor((Date.now() - n) / 1e3);
2719
+ formatRelativeTime(s) {
2720
+ const e = Math.floor((Date.now() - s) / 1e3);
2721
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`;
2722
2722
  }
2723
2723
  fireClose() {
@@ -2731,27 +2731,27 @@ let X = class extends T {
2731
2731
  <div class="panel-header">
2732
2732
  <span class="panel-title">Activity</span>
2733
2733
  <button class="close-btn" @click=${this.fireClose} title="Close">
2734
- ${k(me, 16)}
2734
+ ${C(me, 16)}
2735
2735
  </button>
2736
2736
  </div>
2737
2737
 
2738
2738
  <div class="panel-body pw-scrollable">
2739
2739
  ${this.items.length === 0 ? h`<div class="empty">No activity yet</div>` : this.items.map(
2740
- (n) => h`
2740
+ (s) => h`
2741
2741
  <div class="activity-item">
2742
2742
  <div
2743
2743
  class="activity-dot"
2744
- style="background:${n.color}"
2744
+ style="background:${s.color}"
2745
2745
  ></div>
2746
2746
  <div class="activity-content">
2747
2747
  <div class="activity-text">
2748
- ${n.userId ? h`<span class="activity-user"
2749
- >${this.getUserName(n.userId)}</span
2748
+ ${s.userId ? h`<span class="activity-user"
2749
+ >${this.getUserName(s.userId)}</span
2750
2750
  >
2751
- ${n.description}` : n.description}
2751
+ ${s.description}` : s.description}
2752
2752
  </div>
2753
2753
  <div class="activity-time">
2754
- ${this.formatRelativeTime(n.timestamp)}
2754
+ ${this.formatRelativeTime(s.timestamp)}
2755
2755
  </div>
2756
2756
  </div>
2757
2757
  </div>
@@ -2766,7 +2766,7 @@ X.styles = [
2766
2766
  ee,
2767
2767
  ge,
2768
2768
  _e,
2769
- A`
2769
+ I`
2770
2770
  :host {
2771
2771
  display: block;
2772
2772
  }
@@ -2892,17 +2892,17 @@ X.TYPE_COLORS = {
2892
2892
  resolve: "#22c55e"
2893
2893
  };
2894
2894
  Fe([
2895
- g({ attribute: !1 })
2895
+ b({ attribute: !1 })
2896
2896
  ], X.prototype, "client", 2);
2897
2897
  Fe([
2898
- v()
2898
+ x()
2899
2899
  ], X.prototype, "items", 2);
2900
2900
  X = Fe([
2901
2901
  R("pulse-widget-activity-panel")
2902
2902
  ], X);
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;
2903
+ 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);
2904
+ function lt(s) {
2905
+ const e = Math.max(0, Math.floor(s)), t = Math.floor(e / 60), i = e % 60;
2906
2906
  return `${t}:${i.toString().padStart(2, "0")}`;
2907
2907
  }
2908
2908
  class Oe {
@@ -2915,7 +2915,7 @@ class Oe {
2915
2915
  * element once metadata has loaded.
2916
2916
  */
2917
2917
  static render(e, t) {
2918
- let i = !1, s = t != null ? t / 1e3 : 0, o = 0;
2918
+ let i = !1, n = t != null ? t / 1e3 : 0, o = 0;
2919
2919
  const r = document.createElement("audio");
2920
2920
  r.preload = "metadata", r.src = e;
2921
2921
  const l = document.createElement("div");
@@ -2929,7 +2929,7 @@ class Oe {
2929
2929
  background: Di,
2930
2930
  borderRadius: "12px",
2931
2931
  border: `1px solid ${Hi}`,
2932
- fontFamily: zi,
2932
+ fontFamily: Ui,
2933
2933
  fontSize: "11px",
2934
2934
  color: at,
2935
2935
  userSelect: "none",
@@ -2970,8 +2970,8 @@ class Oe {
2970
2970
  </svg>`;
2971
2971
  }
2972
2972
  p(), a.appendChild(c);
2973
- const u = document.createElement("div");
2974
- Object.assign(u.style, {
2973
+ const f = document.createElement("div");
2974
+ Object.assign(f.style, {
2975
2975
  flex: "1",
2976
2976
  display: "flex",
2977
2977
  flexDirection: "column",
@@ -2979,50 +2979,50 @@ class Oe {
2979
2979
  overflow: "hidden",
2980
2980
  minWidth: "0"
2981
2981
  });
2982
- const m = document.createElement("div");
2983
- Object.assign(m.style, {
2982
+ const u = document.createElement("div");
2983
+ Object.assign(u.style, {
2984
2984
  display: "flex",
2985
2985
  alignItems: "center",
2986
2986
  gap: "1.5px",
2987
2987
  height: "22px",
2988
2988
  cursor: "pointer"
2989
2989
  });
2990
- const b = [];
2991
- for (let $ = 0; $ < xe; $++) {
2992
- const P = document.createElement("div"), y = Math.round(Ni[$] * 20);
2993
- Object.assign(P.style, {
2990
+ const g = [];
2991
+ for (let E = 0; E < xe; E++) {
2992
+ const A = document.createElement("div"), k = Math.round(Bi[E] * 20);
2993
+ Object.assign(A.style, {
2994
2994
  flex: "1",
2995
- height: `${Math.max(3, y)}px`,
2995
+ height: `${Math.max(3, k)}px`,
2996
2996
  borderRadius: "1px",
2997
2997
  background: rt,
2998
2998
  transition: "background 0.1s ease",
2999
2999
  minWidth: "0"
3000
- }), b.push(P), m.appendChild(P);
3000
+ }), g.push(A), u.appendChild(A);
3001
3001
  }
3002
- const I = document.createElement("div");
3003
- Object.assign(I.style, {
3002
+ const v = document.createElement("div");
3003
+ Object.assign(v.style, {
3004
3004
  fontSize: "10px",
3005
3005
  color: at,
3006
3006
  whiteSpace: "nowrap",
3007
3007
  lineHeight: "1"
3008
3008
  });
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(
3009
+ function $() {
3010
+ const E = lt(o), A = lt(n);
3011
+ v.textContent = `${E} / ${A}`;
3012
+ }
3013
+ $(), f.appendChild(u), f.appendChild(v), l.appendChild(a), l.appendChild(f);
3014
+ function y() {
3015
+ const E = n > 0 ? o / n : 0, A = Math.floor(E * xe);
3016
+ for (let k = 0; k < xe; k++)
3017
+ g[k].style.background = k <= A ? ot : rt;
3018
+ }
3019
+ return u.addEventListener("click", (E) => {
3020
+ if (n <= 0) return;
3021
+ const A = u.getBoundingClientRect(), k = Math.min(
3022
3022
  1,
3023
- Math.max(0, ($.clientX - P.left) / P.width)
3023
+ Math.max(0, (E.clientX - A.left) / A.width)
3024
3024
  );
3025
- r.currentTime = y * s, o = r.currentTime, w(), C();
3025
+ r.currentTime = k * n, o = r.currentTime, y(), $();
3026
3026
  }), a.addEventListener("click", () => {
3027
3027
  i ? r.pause() : r.play().catch(() => {
3028
3028
  });
@@ -3031,13 +3031,13 @@ class Oe {
3031
3031
  }), r.addEventListener("pause", () => {
3032
3032
  i = !1, p();
3033
3033
  }), r.addEventListener("ended", () => {
3034
- i = !1, p(), o = 0, w(), C();
3034
+ i = !1, p(), o = 0, y(), $();
3035
3035
  }), r.addEventListener("timeupdate", () => {
3036
- o = r.currentTime, w(), C();
3036
+ o = r.currentTime, y(), $();
3037
3037
  }), r.addEventListener("loadedmetadata", () => {
3038
- r.duration && isFinite(r.duration) && (s = r.duration, C());
3038
+ r.duration && isFinite(r.duration) && (n = r.duration, $());
3039
3039
  }), r.addEventListener("durationchange", () => {
3040
- r.duration && isFinite(r.duration) && (s = r.duration, C());
3040
+ r.duration && isFinite(r.duration) && (n = r.duration, $());
3041
3041
  }), l;
3042
3042
  }
3043
3043
  }
@@ -3055,8 +3055,8 @@ class Re {
3055
3055
  this.destroy(), this.stream = await navigator.mediaDevices.getUserMedia({ audio: !0 }), this.audioCtx = new AudioContext();
3056
3056
  const t = this.audioCtx.createMediaStreamSource(this.stream);
3057
3057
  this.analyser = this.audioCtx.createAnalyser(), this.analyser.fftSize = 64, t.connect(this.analyser);
3058
- const i = this.detectMimeType(), s = {};
3059
- i && (s.mimeType = i), this.recorder = new MediaRecorder(this.stream, s);
3058
+ const i = this.detectMimeType(), n = {};
3059
+ i && (n.mimeType = i), this.recorder = new MediaRecorder(this.stream, n);
3060
3060
  const o = [];
3061
3061
  this.recorder.ondataavailable = (l) => {
3062
3062
  l.data.size > 0 && o.push(l.data);
@@ -3168,18 +3168,18 @@ class Re {
3168
3168
  if (!this.canvas || !this.analyser) return;
3169
3169
  const e = this.canvas.getContext("2d");
3170
3170
  if (!e) return;
3171
- const t = this.canvas.width, i = this.canvas.height, s = this.analyser.frequencyBinCount, o = new Uint8Array(s);
3171
+ const t = this.canvas.width, i = this.canvas.height, n = this.analyser.frequencyBinCount, o = new Uint8Array(n);
3172
3172
  this.analyser.getByteFrequencyData(o), e.clearRect(0, 0, t, i);
3173
- const r = s, l = Math.max(2, t / r * 0.7), a = (t - l * r) / (r - 1 || 1);
3173
+ const r = n, l = Math.max(2, t / r * 0.7), a = (t - l * r) / (r - 1 || 1);
3174
3174
  for (let c = 0; c < r; c++) {
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();
3175
+ const p = o[c] / 255, d = Math.max(2, p * i * 0.85), f = c * (l + a), u = (i - d) / 2, g = 0.4 + p * 0.6;
3176
+ e.fillStyle = `rgba(99, 102, 241, ${g})`, e.beginPath(), e.roundRect(f, u, l, d, 1), e.fill();
3177
3177
  }
3178
3178
  }
3179
3179
  updateTimer() {
3180
3180
  if (!this.timerEl) return;
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")}`;
3181
+ const e = Date.now() - this.startTime, t = Math.floor(e / 1e3), i = Math.floor(t / 60), n = t % 60;
3182
+ this.timerEl.textContent = `${String(i).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
3183
3183
  }
3184
3184
  cleanupResources() {
3185
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(() => {
@@ -3191,7 +3191,7 @@ class Re {
3191
3191
  this.recorder = null, this.container && (this.container.remove(), this.container = null), this.canvas = null, this.timerEl = null;
3192
3192
  }
3193
3193
  }
3194
- const ct = 80, Bi = "#e2e8f0", Fi = `
3194
+ const ct = 80, Ni = "#e2e8f0", Fi = `
3195
3195
  <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
3196
3196
  <circle cx="14" cy="14" r="14" fill="rgba(0,0,0,0.35)"/>
3197
3197
  <polygon points="11,8 22,14 11,20" fill="rgba(255,255,255,0.9)"/>
@@ -3213,7 +3213,7 @@ class Tt {
3213
3213
  * @param posterUrl - Optional poster/thumbnail image URL
3214
3214
  */
3215
3215
  static render(e, t) {
3216
- let i = !1, s = !0;
3216
+ let i = !1, n = !0;
3217
3217
  const o = document.createElement("div");
3218
3218
  Object.assign(o.style, {
3219
3219
  position: "relative",
@@ -3221,7 +3221,7 @@ class Tt {
3221
3221
  width: `${ct}px`,
3222
3222
  height: `${ct}px`,
3223
3223
  borderRadius: "50%",
3224
- border: `2px solid ${Bi}`,
3224
+ border: `2px solid ${Ni}`,
3225
3225
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
3226
3226
  overflow: "hidden",
3227
3227
  cursor: "pointer",
@@ -3271,13 +3271,13 @@ class Tt {
3271
3271
  l.style.opacity = i ? "0" : "1";
3272
3272
  }
3273
3273
  function p() {
3274
- a.style.display = i ? "flex" : "none", a.innerHTML = s ? dt : Vi;
3274
+ a.style.display = i ? "flex" : "none", a.innerHTML = n ? dt : Vi;
3275
3275
  }
3276
3276
  return o.addEventListener("click", (d) => {
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(() => {
3277
+ 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(() => {
3278
3278
  }), i = !0), c(), p();
3279
3279
  }), r.addEventListener("pause", () => {
3280
- i && (i = !1, s = !0, r.muted = !0, c(), p());
3280
+ i && (i = !1, n = !0, r.muted = !0, c(), p());
3281
3281
  }), o;
3282
3282
  }
3283
3283
  }
@@ -3388,41 +3388,41 @@ const ht = 60, qi = `
3388
3388
  color: #0f172a;
3389
3389
  }
3390
3390
  `;
3391
- function pt(n) {
3392
- return n.toString().padStart(2, "0");
3391
+ function pt(s) {
3392
+ return s.toString().padStart(2, "0");
3393
3393
  }
3394
- function Wi(n) {
3395
- const e = Math.floor(n / 60), t = n % 60;
3394
+ function Wi(s) {
3395
+ const e = Math.floor(s / 60), t = s % 60;
3396
3396
  return `${pt(e)}:${pt(t)}`;
3397
3397
  }
3398
3398
  function Xi() {
3399
- const n = [
3399
+ const s = [
3400
3400
  "video/webm;codecs=vp9,opus",
3401
3401
  "video/webm;codecs=vp8,opus",
3402
3402
  "video/webm",
3403
3403
  "video/mp4"
3404
3404
  ];
3405
- for (const e of n)
3405
+ for (const e of s)
3406
3406
  if (MediaRecorder.isTypeSupported(e)) return e;
3407
3407
  return "";
3408
3408
  }
3409
- function Yi(n) {
3409
+ function Yi(s) {
3410
3410
  return new Promise((e, t) => {
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", () => {
3411
+ const i = URL.createObjectURL(s), n = document.createElement("video");
3412
+ n.muted = !0, n.playsInline = !0, n.preload = "auto", n.src = i, n.addEventListener("loadeddata", () => {
3413
+ n.currentTime = 0.01;
3414
+ }), n.addEventListener("seeked", () => {
3415
3415
  const o = document.createElement("canvas");
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(
3416
+ 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(
3417
3417
  (l) => {
3418
3418
  l ? e(l) : t(new Error("Failed to generate poster frame"));
3419
3419
  },
3420
3420
  "image/jpeg",
3421
3421
  0.85
3422
3422
  );
3423
- }), s.addEventListener("error", () => {
3423
+ }), n.addEventListener("error", () => {
3424
3424
  URL.revokeObjectURL(i), t(new Error("Failed to load video for poster generation"));
3425
- }), s.load();
3425
+ }), n.load();
3426
3426
  });
3427
3427
  }
3428
3428
  class Le {
@@ -3442,9 +3442,9 @@ class Le {
3442
3442
  }
3443
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(() => {
3444
3444
  }));
3445
- const i = Xi(), s = {};
3446
- i && (s.mimeType = i);
3447
- const o = new MediaRecorder(t, s);
3445
+ const i = Xi(), n = {};
3446
+ i && (n.mimeType = i);
3447
+ const o = new MediaRecorder(t, n);
3448
3448
  return this.mediaRecorder = o, o.ondataavailable = (r) => {
3449
3449
  r.data.size > 0 && this.chunks.push(r.data);
3450
3450
  }, o.onstop = () => {
@@ -3472,8 +3472,8 @@ class Le {
3472
3472
  t.className = "vr-circle-wrapper";
3473
3473
  const i = document.createElement("div");
3474
3474
  i.className = "vr-ring", t.appendChild(i);
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);
3475
+ const n = document.createElement("div");
3476
+ 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);
3477
3477
  const o = document.createElement("div");
3478
3478
  o.className = "vr-actions";
3479
3479
  const r = document.createElement("button");
@@ -3487,8 +3487,8 @@ class Le {
3487
3487
  this.timerEl.textContent = Wi(this.elapsed), e <= 10 ? this.timerEl.classList.add("vr-countdown") : this.timerEl.classList.remove("vr-countdown");
3488
3488
  }
3489
3489
  async handleRecordingComplete() {
3490
- var s, o;
3491
- const e = ((s = this.mediaRecorder) == null ? void 0 : s.mimeType) || "video/webm", t = new Blob(this.chunks, { type: e });
3490
+ var n, o;
3491
+ const e = ((n = this.mediaRecorder) == null ? void 0 : n.mimeType) || "video/webm", t = new Blob(this.chunks, { type: e });
3492
3492
  let i;
3493
3493
  try {
3494
3494
  i = await Yi(t);
@@ -3514,10 +3514,10 @@ class Le {
3514
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;
3515
3515
  }
3516
3516
  }
3517
- const _ = class _ {
3517
+ const T = class T {
3518
3518
  /** Opens a fullscreen lightbox overlay showing the image. */
3519
3519
  static open(e) {
3520
- _.close();
3520
+ T.close();
3521
3521
  const t = document.createElement("div");
3522
3522
  t.id = "pulse-widget-lightbox", Object.assign(t.style, {
3523
3523
  position: "fixed",
@@ -3561,39 +3561,39 @@ const _ = class _ {
3561
3561
  }), i.addEventListener("mouseleave", () => {
3562
3562
  i.style.background = "rgba(255,255,255,0.15)";
3563
3563
  }), i.addEventListener("click", (r) => {
3564
- r.stopPropagation(), _.close();
3564
+ r.stopPropagation(), T.close();
3565
3565
  });
3566
- const s = document.createElement("img");
3567
- s.src = e, s.alt = "Lightbox image", Object.assign(s.style, {
3566
+ const n = document.createElement("img");
3567
+ n.src = e, n.alt = "Lightbox image", Object.assign(n.style, {
3568
3568
  maxWidth: "90vw",
3569
3569
  maxHeight: "90vh",
3570
3570
  borderRadius: "8px",
3571
3571
  objectFit: "contain",
3572
3572
  cursor: "default",
3573
3573
  userSelect: "none"
3574
- }), s.addEventListener("click", (r) => {
3574
+ }), n.addEventListener("click", (r) => {
3575
3575
  r.stopPropagation();
3576
- }), t.appendChild(i), t.appendChild(s), t.addEventListener("click", () => {
3577
- _.close();
3576
+ }), t.appendChild(i), t.appendChild(n), t.addEventListener("click", () => {
3577
+ T.close();
3578
3578
  });
3579
3579
  const o = (r) => {
3580
- r.key === "Escape" && _.close();
3580
+ r.key === "Escape" && T.close();
3581
3581
  };
3582
- document.addEventListener("keydown", o), _.overlay = t, _.onKeyDown = o, document.body.appendChild(t), requestAnimationFrame(() => {
3582
+ document.addEventListener("keydown", o), T.overlay = t, T.onKeyDown = o, document.body.appendChild(t), requestAnimationFrame(() => {
3583
3583
  t.style.opacity = "1";
3584
3584
  });
3585
3585
  }
3586
3586
  /** Closes the lightbox if open. */
3587
3587
  static close() {
3588
- if (!_.overlay) return;
3589
- const e = _.overlay;
3590
- _.onKeyDown && (document.removeEventListener("keydown", _.onKeyDown), _.onKeyDown = null), e.style.opacity = "0", e.addEventListener("transitionend", () => {
3588
+ if (!T.overlay) return;
3589
+ const e = T.overlay;
3590
+ T.onKeyDown && (document.removeEventListener("keydown", T.onKeyDown), T.onKeyDown = null), e.style.opacity = "0", e.addEventListener("transitionend", () => {
3591
3591
  e.remove();
3592
- }), _.overlay = null;
3592
+ }), T.overlay = null;
3593
3593
  }
3594
3594
  };
3595
- _.overlay = null, _.onKeyDown = null;
3596
- let ke = _;
3595
+ T.overlay = null, T.onKeyDown = null;
3596
+ let ke = T;
3597
3597
  class ne {
3598
3598
  constructor(e) {
3599
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);
@@ -3607,7 +3607,7 @@ class ne {
3607
3607
  this.input.accept = e, this.input.value = "";
3608
3608
  const i = () => {
3609
3609
  o(), t(null);
3610
- }, s = async () => {
3610
+ }, n = async () => {
3611
3611
  var l;
3612
3612
  o();
3613
3613
  const r = (l = this.input.files) == null ? void 0 : l[0];
@@ -3625,9 +3625,9 @@ class ne {
3625
3625
  this.uploading = !1;
3626
3626
  }
3627
3627
  }, o = () => {
3628
- this.input.removeEventListener("change", s), this.input.removeEventListener("cancel", i);
3628
+ this.input.removeEventListener("change", n), this.input.removeEventListener("cancel", i);
3629
3629
  };
3630
- this.input.addEventListener("change", s, { once: !0 }), this.input.addEventListener("cancel", i, { once: !0 }), this.input.click();
3630
+ this.input.addEventListener("change", n, { once: !0 }), this.input.addEventListener("cancel", i, { once: !0 }), this.input.click();
3631
3631
  });
3632
3632
  }
3633
3633
  /**
@@ -3669,15 +3669,15 @@ class Ji {
3669
3669
  }, this.handlePopoverEscape = (i) => {
3670
3670
  i.key === "Escape" && this.closePopover();
3671
3671
  }, this.handlePopoverOutsideClick = (i) => {
3672
- var s, o;
3672
+ var n, o;
3673
3673
  if (this.popover && !this.popover.contains(i.target)) {
3674
- if ((s = this.container) != null && s.contains(i.target) || (o = this.pickerEl) != null && o.contains(i.target)) return;
3674
+ if ((n = this.container) != null && n.contains(i.target) || (o = this.pickerEl) != null && o.contains(i.target)) return;
3675
3675
  this.closePopover();
3676
3676
  }
3677
3677
  }, this.handleOverlayClick = (i) => {
3678
3678
  this.form && (this.form.remove(), this.form = null);
3679
- const s = window.innerWidth, o = window.innerHeight, r = {
3680
- x: i.clientX / s,
3679
+ const n = window.innerWidth, o = window.innerHeight, r = {
3680
+ x: i.clientX / n,
3681
3681
  y: i.clientY / o,
3682
3682
  scrollX: window.scrollX,
3683
3683
  scrollY: window.scrollY
@@ -3747,8 +3747,8 @@ class Ji {
3747
3747
  this.container && (this.container.style.display = e ? "" : "none");
3748
3748
  }
3749
3749
  destroy() {
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();
3750
+ var e, t, i, n, 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), (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();
3752
3752
  }
3753
3753
  closePopover() {
3754
3754
  var e;
@@ -3765,8 +3765,8 @@ class Ji {
3765
3765
  t.unshift(`#${i.id}`);
3766
3766
  break;
3767
3767
  }
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;
3768
+ const n = i.tagName.toLowerCase(), o = [...i.classList].filter((a) => !a.startsWith("pulse-")).slice(0, 2);
3769
+ let r = o.length > 0 ? `${n}.${o.join(".")}` : n;
3770
3770
  const l = i.parentElement;
3771
3771
  if (l) {
3772
3772
  const a = [...l.children].filter((c) => c.tagName === i.tagName);
@@ -3781,13 +3781,13 @@ class Ji {
3781
3781
  }
3782
3782
  showPinForm(e, t, i) {
3783
3783
  this.form = document.createElement("div");
3784
- const s = Math.min(280, window.innerWidth - 32), o = 120;
3784
+ const n = Math.min(280, window.innerWidth - 32), o = 120;
3785
3785
  let r = e + 16, l = t - 10;
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, {
3786
+ 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, {
3787
3787
  position: "fixed",
3788
3788
  left: `${r}px`,
3789
3789
  top: `${l}px`,
3790
- width: `${s}px`,
3790
+ width: `${n}px`,
3791
3791
  zIndex: "10001",
3792
3792
  background: "#fff",
3793
3793
  borderRadius: "12px",
@@ -3828,45 +3828,71 @@ class Ji {
3828
3828
  ">Pin Comment</button>
3829
3829
  </div>
3830
3830
  </div>
3831
- <div class="pin-attachments-preview" style="margin-top:6px;"></div>
3831
+ <div class="pin-attachments-preview" style="margin-top:6px;display:flex;flex-wrap:wrap;gap:6px;"></div>
3832
3832
  `;
3833
3833
  const a = this.form.querySelector("textarea"), c = this.form.querySelector(".pulse-close-btn"), p = this.form.querySelector(".pin-submit");
3834
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");
3835
+ const d = this.form.querySelector(".pin-attachments-preview"), f = (u, g) => {
3836
+ const v = document.createElement("div");
3837
+ Object.assign(v.style, { position: "relative", display: "inline-block" }), v.appendChild(g);
3838
+ const $ = document.createElement("button");
3839
+ $.innerHTML = "×", Object.assign($.style, {
3840
+ position: "absolute",
3841
+ top: "-4px",
3842
+ right: "-4px",
3843
+ width: "16px",
3844
+ height: "16px",
3845
+ borderRadius: "50%",
3846
+ background: "#ef4444",
3847
+ color: "#fff",
3848
+ border: "none",
3849
+ fontSize: "11px",
3850
+ lineHeight: "1",
3851
+ cursor: "pointer",
3852
+ display: "flex",
3853
+ alignItems: "center",
3854
+ justifyContent: "center",
3855
+ padding: "0",
3856
+ fontWeight: "700"
3857
+ }), $.addEventListener("click", () => {
3858
+ const y = this.pendingAttachmentIds.indexOf(u);
3859
+ y !== -1 && this.pendingAttachmentIds.splice(y, 1), v.remove();
3860
+ }), v.appendChild($), d.appendChild(v);
3861
+ };
3836
3862
  this.form.querySelector(".attach-img").addEventListener("click", async () => {
3837
3863
  const u = await this.upload.pickFile("image/*");
3838
3864
  if (u) {
3839
3865
  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);
3866
+ const g = document.createElement("img");
3867
+ g.src = u.thumbnailUrl || u.url, Object.assign(g.style, { width: "48px", height: "48px", borderRadius: "6px", objectFit: "cover", border: "1px solid #e2e8f0", display: "block" }), f(u.id, g);
3842
3868
  }
3843
3869
  }), this.form.querySelector(".attach-mic").addEventListener("click", async () => {
3844
3870
  this.audioRecorder || (this.audioRecorder = new Re());
3845
3871
  const u = await this.audioRecorder.startRecording(d);
3846
3872
  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);
3873
+ const g = await this.upload.uploadBlob(u, "audio.webm");
3874
+ if (g) {
3875
+ this.pendingAttachmentIds.push(g.id);
3876
+ const v = document.createElement("span");
3877
+ Object.assign(v.style, { display: "flex", alignItems: "center", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b", height: "48px", boxSizing: "border-box" }), v.textContent = "🎤 Audio", f(g.id, v);
3852
3878
  }
3853
3879
  }
3854
3880
  }), this.form.querySelector(".attach-video").addEventListener("click", async () => {
3855
3881
  this.videoRecorder || (this.videoRecorder = new Le());
3856
3882
  const u = await this.videoRecorder.startRecording(d);
3857
3883
  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);
3884
+ const g = await this.upload.uploadBlob(u.blob, "video.webm");
3885
+ if (g) {
3886
+ this.pendingAttachmentIds.push(g.id);
3887
+ const v = document.createElement("span");
3888
+ Object.assign(v.style, { display: "flex", alignItems: "center", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b", height: "48px", boxSizing: "border-box" }), v.textContent = "🎥 Video", f(g.id, v);
3863
3889
  }
3864
3890
  }
3865
3891
  }), p.addEventListener("click", () => {
3866
3892
  const u = a.value.trim();
3867
3893
  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();
3894
+ const g = [...(u || "").matchAll(/@(\w+)/g)].map((v) => v[1]);
3895
+ this.client.createThread(u, { position: i, mentions: g, attachmentIds: this.pendingAttachmentIds.length > 0 ? [...this.pendingAttachmentIds] : void 0 }), this.pendingAttachmentIds = [], this.exitPinMode();
3870
3896
  }), a.addEventListener("keydown", (u) => {
3871
3897
  u.key === "Escape" && this.exitPinMode(), u.stopPropagation();
3872
3898
  }), document.body.appendChild(this.form), requestAnimationFrame(() => a.focus());
@@ -3874,13 +3900,13 @@ class Ji {
3874
3900
  // ── Inline thread popover (shown when a pin dot is clicked) ──
3875
3901
  showThreadPopover(e, t) {
3876
3902
  this.closePopover(), this.popover = document.createElement("div"), this.popover.dataset.threadId = e.id;
3877
- const i = window.innerWidth <= 480, s = i ? window.innerWidth : 300, o = t.getBoundingClientRect();
3903
+ const i = window.innerWidth <= 480, n = i ? window.innerWidth : 300, o = t.getBoundingClientRect();
3878
3904
  let r, l;
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, {
3905
+ 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, {
3880
3906
  position: "fixed",
3881
3907
  left: `${r}px`,
3882
3908
  top: `${l}px`,
3883
- width: i ? "100vw" : `${s}px`,
3909
+ width: i ? "100vw" : `${n}px`,
3884
3910
  maxHeight: i ? "60vh" : "360px",
3885
3911
  zIndex: "10001",
3886
3912
  background: "#fff",
@@ -3932,13 +3958,13 @@ class Ji {
3932
3958
  }
3933
3959
  const i = (l = this.client.state.user) == null ? void 0 : l.id;
3934
3960
  t.innerHTML = e.comments.map((a) => {
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>' : "";
3961
+ const c = this.client.state.getUser(a.userId), p = c ? c.name.split(" ").map((k) => k[0]).join("").toUpperCase().slice(0, 2) : "?", d = (c == null ? void 0 : c.color) ?? "#94a3b8", f = this.escapeHtml((c == null ? void 0 : c.name) ?? "Unknown"), u = this.formatTime(a.createdAt), g = i === a.userId, v = a.editedAt ? '<span style="font-size:10px;color:#94a3b8;font-style:italic;">(edited)</span>' : "";
3936
3962
  if (this.editingPopoverCommentId === a.id)
3937
3963
  return `
3938
3964
  <div style="margin-bottom:10px;" data-comment-id="${a.id}">
3939
3965
  <div style="display:flex;align-items:center;gap:7px;margin-bottom:4px;">
3940
3966
  <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>
3941
- <span style="font-size:12px;font-weight:600;color:#0f172a;">${u}</span>
3967
+ <span style="font-size:12px;font-weight:600;color:#0f172a;">${f}</span>
3942
3968
  </div>
3943
3969
  <div style="margin-left:29px;">
3944
3970
  <textarea class="edit-textarea" style="width:100%;padding:6px 10px;border:1.5px solid #e2e8f0;border-radius:6px;font-size:12px;font-family:inherit;outline:none;resize:vertical;min-height:48px;color:#0f172a;box-sizing:border-box;">${this.escapeHtml(a.body)}</textarea>
@@ -3949,37 +3975,37 @@ class Ji {
3949
3975
  </div>
3950
3976
  </div>
3951
3977
  `;
3952
- const C = a.body && a.body !== "(attachment)" ? a.body.replace(
3978
+ const $ = a.body && a.body !== "(attachment)" ? a.body.replace(
3953
3979
  /@(\w+)/g,
3954
3980
  '<span style="color:#6366f1;font-weight:600;background:#eef2ff;padding:0 3px;border-radius:3px;">@$1</span>'
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;" />
3981
+ ) : "", y = (a.attachments ?? []).map((k) => {
3982
+ if (k.type === "image") {
3983
+ const Pt = k.thumbnailUrl || k.url;
3984
+ return `<div class="popover-attachment-img" data-full-url="${this.escapeHtml(k.url)}" style="margin:4px 0 4px 29px;cursor:pointer;">
3985
+ <img src="${this.escapeHtml(Pt)}" alt="${this.escapeHtml(k.filename)}" style="max-width:180px;max-height:120px;border-radius:8px;border:1px solid #e2e8f0;display:block;" />
3960
3986
  </div>`;
3961
3987
  }
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;">
3988
+ return k.type === "audio" ? `<div class="popover-attachment-audio" data-url="${this.escapeHtml(k.url)}" data-duration="${k.durationMs ?? ""}" style="margin:4px 0 4px 29px;"></div>` : k.type === "video" ? `<div class="popover-attachment-video" data-url="${this.escapeHtml(k.url)}" data-poster="${this.escapeHtml(k.thumbnailUrl ?? "")}" style="margin:4px 0 4px 29px;"></div>` : "";
3989
+ }).join(""), E = g ? `<div class="popover-comment-actions" style="display:flex;gap:2px;margin-top:2px;margin-left:29px;">
3964
3990
  <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"
3965
3991
  onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'"
3966
3992
  onmouseout="this.style.color='#94a3b8';this.style.background='none'">${Gi}</button>
3967
3993
  <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"
3968
3994
  onmouseover="this.style.color='#ef4444';this.style.background='#fef2f2'"
3969
3995
  onmouseout="this.style.color='#94a3b8';this.style.background='none'">${Zi}</button>
3970
- </div>` : "", P = this.buildReactionPillsHtml(a.id);
3996
+ </div>` : "", A = this.buildReactionPillsHtml(a.id);
3971
3997
  return `
3972
3998
  <div class="popover-comment" style="margin-bottom:10px;" data-comment-id="${a.id}">
3973
3999
  <div style="display:flex;align-items:center;gap:7px;margin-bottom:2px;">
3974
4000
  <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>
3975
- <span style="font-size:12px;font-weight:600;color:#0f172a;">${u}</span>
3976
- <span style="font-size:10px;color:#94a3b8;">${m}</span>
3977
- ${I}
4001
+ <span style="font-size:12px;font-weight:600;color:#0f172a;">${f}</span>
4002
+ <span style="font-size:10px;color:#94a3b8;">${u}</span>
4003
+ ${v}
3978
4004
  </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}
3981
- ${$}
3982
- ${P}
4005
+ ${$ ? `<div style="font-size:13px;color:#334155;line-height:1.45;margin-left:29px;word-wrap:break-word;">${$}</div>` : ""}
4006
+ ${y}
4007
+ ${E}
4008
+ ${A}
3983
4009
  </div>
3984
4010
  `;
3985
4011
  }).join(""), t.querySelectorAll(".edit-btn").forEach((a) => {
@@ -3991,10 +4017,10 @@ class Ji {
3991
4017
  this.client.deleteComment(a.dataset.commentId);
3992
4018
  });
3993
4019
  });
3994
- const s = t.querySelector(".edit-save"), o = t.querySelector(".edit-cancel"), r = t.querySelector(
4020
+ const n = t.querySelector(".edit-save"), o = t.querySelector(".edit-cancel"), r = t.querySelector(
3995
4021
  ".edit-textarea"
3996
4022
  );
3997
- s && r && s.addEventListener("click", () => {
4023
+ n && r && n.addEventListener("click", () => {
3998
4024
  const a = r.value.trim();
3999
4025
  if (!a) return;
4000
4026
  const c = [...a.matchAll(/@(\w+)/g)].map((p) => p[1]);
@@ -4008,8 +4034,8 @@ class Ji {
4008
4034
  }), t.querySelectorAll("[data-reaction-emoji]").forEach((a) => {
4009
4035
  a.addEventListener("click", (c) => {
4010
4036
  c.stopPropagation();
4011
- const p = a.dataset.reactionEmoji, d = a.dataset.reactionTarget, u = a.dataset.reactionId;
4012
- u ? this.client.removeReaction(u) : this.client.addReaction(d, "comment", p);
4037
+ const p = a.dataset.reactionEmoji, d = a.dataset.reactionTarget, f = a.dataset.reactionId;
4038
+ f ? this.client.removeReaction(f) : this.client.addReaction(d, "comment", p);
4013
4039
  });
4014
4040
  }), t.querySelectorAll(".popover-reaction-add").forEach((a) => {
4015
4041
  a.addEventListener("click", (c) => {
@@ -4043,7 +4069,7 @@ class Ji {
4043
4069
  padding: "8px 14px 12px",
4044
4070
  borderTop: "1px solid #f1f5f9"
4045
4071
  });
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"';
4072
+ 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"';
4047
4073
  t.innerHTML = `
4048
4074
  <div style="display:flex;align-items:center;gap:4px;margin-bottom:6px;">
4049
4075
  <input type="text" placeholder="Reply..."
@@ -4052,50 +4078,73 @@ class Ji {
4052
4078
  </div>
4053
4079
  <div style="display:flex;align-items:center;gap:2px;">
4054
4080
  <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'">
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>
4081
+ <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>
4056
4082
  </button>
4057
4083
  <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'">
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>
4084
+ <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>
4059
4085
  </button>
4060
4086
  <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'">
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>
4087
+ <svg ${n}><path d="m22 8-6 4 6 4V8Z"/><rect width="14" height="12" x="2" y="6" rx="2" ry="2"/></svg>
4062
4088
  </button>
4063
4089
  <div class="reply-attachments-preview" style="flex:1;display:flex;gap:4px;flex-wrap:wrap;margin-left:4px;"></div>
4064
4090
  </div>
4065
4091
  `;
4066
4092
  const o = t.querySelector("input"), r = t.querySelector(".reply-send"), l = t.querySelector(".reply-attachments-preview");
4067
4093
  this.upload || (this.upload = new ne(this.client));
4068
- const a = [], c = (d) => {
4094
+ const a = [], c = (d, f) => {
4069
4095
  const u = document.createElement("span");
4070
- Object.assign(u.style, { display: "inline-block", padding: "2px 8px", borderRadius: "4px", background: "#f1f5f9", fontSize: "10px", color: "#64748b" }), u.textContent = d, l.appendChild(u);
4096
+ Object.assign(u.style, { position: "relative", display: "inline-flex", alignItems: "center", padding: "2px 18px 2px 8px", borderRadius: "4px", background: "#f1f5f9", fontSize: "10px", color: "#64748b" }), u.textContent = f;
4097
+ const g = document.createElement("button");
4098
+ g.innerHTML = "×", Object.assign(g.style, {
4099
+ position: "absolute",
4100
+ top: "-3px",
4101
+ right: "-3px",
4102
+ width: "14px",
4103
+ height: "14px",
4104
+ borderRadius: "50%",
4105
+ background: "#ef4444",
4106
+ color: "#fff",
4107
+ border: "none",
4108
+ fontSize: "10px",
4109
+ lineHeight: "1",
4110
+ cursor: "pointer",
4111
+ display: "flex",
4112
+ alignItems: "center",
4113
+ justifyContent: "center",
4114
+ padding: "0",
4115
+ fontWeight: "700"
4116
+ }), g.addEventListener("click", () => {
4117
+ const v = a.indexOf(d);
4118
+ v !== -1 && a.splice(v, 1), u.remove();
4119
+ }), u.appendChild(g), l.appendChild(u);
4071
4120
  };
4072
4121
  t.querySelector(".reply-attach-img").addEventListener("click", async () => {
4073
4122
  const d = await this.upload.pickFile("image/*");
4074
- d && (a.push(d.id), c("📎 Image"));
4123
+ d && (a.push(d.id), c(d.id, "📎 Image"));
4075
4124
  }), t.querySelector(".reply-attach-mic").addEventListener("click", async () => {
4076
4125
  this.audioRecorder || (this.audioRecorder = new Re());
4077
4126
  const d = await this.audioRecorder.startRecording(t);
4078
4127
  if (d) {
4079
- const u = await this.upload.uploadBlob(d, "audio.webm");
4080
- u && (a.push(u.id), c("🎤 Audio"));
4128
+ const f = await this.upload.uploadBlob(d, "audio.webm");
4129
+ f && (a.push(f.id), c(f.id, "🎤 Audio"));
4081
4130
  }
4082
4131
  }), t.querySelector(".reply-attach-video").addEventListener("click", async () => {
4083
4132
  this.videoRecorder || (this.videoRecorder = new Le());
4084
4133
  const d = await this.videoRecorder.startRecording(t);
4085
4134
  if (d) {
4086
- const u = await this.upload.uploadBlob(d.blob, "video.webm");
4087
- u && (a.push(u.id), c("🎥 Video"));
4135
+ const f = await this.upload.uploadBlob(d.blob, "video.webm");
4136
+ f && (a.push(f.id), c(f.id, "🎥 Video"));
4088
4137
  }
4089
4138
  });
4090
4139
  const p = () => {
4091
4140
  const d = o.value.trim();
4092
4141
  if (!d && a.length === 0) return;
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 = "";
4142
+ const f = [...(d || "").matchAll(/@(\w+)/g)].map((u) => u[1]);
4143
+ this.client.reply(e.id, d, f, a.length > 0 ? [...a] : void 0), o.value = "", a.length = 0, l.innerHTML = "";
4095
4144
  };
4096
4145
  r.addEventListener("click", p), o.addEventListener("input", () => {
4097
- const d = Date.now(), u = this.lastTypingSendPins.get(e.id) ?? 0;
4098
- d - u >= 2e3 && (this.client.sendTyping(e.id), this.lastTypingSendPins.set(e.id, d));
4146
+ const d = Date.now(), f = this.lastTypingSendPins.get(e.id) ?? 0;
4147
+ d - f >= 2e3 && (this.client.sendTyping(e.id), this.lastTypingSendPins.set(e.id, d));
4099
4148
  }), o.addEventListener("keydown", (d) => {
4100
4149
  d.key === "Enter" && (d.preventDefault(), p()), d.key === "Escape" && this.closePopover(), d.stopPropagation();
4101
4150
  }), this.popover.appendChild(t);
@@ -4122,7 +4171,7 @@ class Ji {
4122
4171
  zIndex: "10002",
4123
4172
  fontFamily: be
4124
4173
  });
4125
- for (const s of Ki) {
4174
+ for (const n of Ki) {
4126
4175
  const o = document.createElement("button");
4127
4176
  Object.assign(o.style, {
4128
4177
  border: "none",
@@ -4132,31 +4181,31 @@ class Ji {
4132
4181
  padding: "4px",
4133
4182
  borderRadius: "4px",
4134
4183
  lineHeight: "1"
4135
- }), o.textContent = s, o.addEventListener("click", (r) => {
4184
+ }), o.textContent = n, o.addEventListener("click", (r) => {
4136
4185
  r.stopPropagation();
4137
4186
  const a = this.client.state.getReactions(t).find(
4138
4187
  (c) => {
4139
4188
  var p;
4140
- return c.emoji === s && c.userId === ((p = this.client.state.user) == null ? void 0 : p.id);
4189
+ return c.emoji === n && c.userId === ((p = this.client.state.user) == null ? void 0 : p.id);
4141
4190
  }
4142
4191
  );
4143
- a ? this.client.removeReaction(a.id) : this.client.addReaction(t, "comment", s), this.popoverPickerOpen = null, this.removePickerEl();
4192
+ a ? this.client.removeReaction(a.id) : this.client.addReaction(t, "comment", n), this.popoverPickerOpen = null, this.removePickerEl();
4144
4193
  }), this.pickerEl.appendChild(o);
4145
4194
  }
4146
4195
  document.body.appendChild(this.pickerEl);
4147
4196
  }
4148
4197
  buildReactionPillsHtml(e) {
4149
4198
  var a;
4150
- const t = this.client.state.getReactions(e), i = (a = this.client.state.user) == null ? void 0 : a.id, s = /* @__PURE__ */ new Map();
4199
+ const t = this.client.state.getReactions(e), i = (a = this.client.state.user) == null ? void 0 : a.id, n = /* @__PURE__ */ new Map();
4151
4200
  for (const c of t) {
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);
4201
+ const p = n.get(c.emoji) ?? { count: 0, ownId: null };
4202
+ p.count++, c.userId === i && (p.ownId = c.id), n.set(c.emoji, p);
4154
4203
  }
4155
4204
  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;";
4156
4205
  let l = '<div style="margin-left:29px;display:flex;gap:4px;flex-wrap:wrap;margin-top:4px;">';
4157
- for (const [c, { count: p, ownId: d }] of s) {
4158
- const u = d ? r : o;
4159
- l += `<button data-reaction-emoji="${c}" data-reaction-target="${e}" ${d ? `data-reaction-id="${d}"` : ""} style="${u}">
4206
+ for (const [c, { count: p, ownId: d }] of n) {
4207
+ const f = d ? r : o;
4208
+ l += `<button data-reaction-emoji="${c}" data-reaction-target="${e}" ${d ? `data-reaction-id="${d}"` : ""} style="${f}">
4160
4209
  <span>${c}</span><span style="font-size:11px;font-weight:600;color:#64748b;">${p}</span>
4161
4210
  </button>`;
4162
4211
  }
@@ -4173,20 +4222,20 @@ class Ji {
4173
4222
  fontStyle: "italic",
4174
4223
  minHeight: "16px"
4175
4224
  });
4176
- const s = this.popover.lastElementChild;
4177
- s && this.popover.insertBefore(t, s);
4225
+ const n = this.popover.lastElementChild;
4226
+ n && this.popover.insertBefore(t, n);
4178
4227
  }
4179
- const i = this.client.state.getTypingUsers(e).filter((s) => {
4228
+ const i = this.client.state.getTypingUsers(e).filter((n) => {
4180
4229
  var o;
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);
4230
+ return n !== ((o = this.client.state.user) == null ? void 0 : o.id);
4231
+ }).map((n) => {
4232
+ const o = this.client.state.presence.find((r) => r.user.id === n);
4184
4233
  return (o == null ? void 0 : o.user.name) ?? "Someone";
4185
4234
  });
4186
4235
  i.length === 0 ? t.textContent = "" : i.length === 1 ? t.textContent = `${i[0]} is typing...` : t.textContent = `${i.join(", ")} are typing...`;
4187
4236
  }
4188
4237
  formatTime(e) {
4189
- const t = new Date(e), s = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), o = Math.floor(s / 6e4);
4238
+ const t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), o = Math.floor(n / 6e4);
4190
4239
  if (o < 1) return "now";
4191
4240
  if (o < 60) return `${o}m`;
4192
4241
  const r = Math.floor(o / 60);
@@ -4215,9 +4264,9 @@ class Ji {
4215
4264
  renderPins() {
4216
4265
  if (!this.container) return;
4217
4266
  const e = this.threads.filter((i) => i.position && !i.resolved), t = new Set(e.map((i) => i.id));
4218
- for (const [i, s] of this.pinEls)
4219
- t.has(i) || (s.remove(), this.pinEls.delete(i));
4220
- e.forEach((i, s) => {
4267
+ for (const [i, n] of this.pinEls)
4268
+ t.has(i) || (n.remove(), this.pinEls.delete(i));
4269
+ e.forEach((i, n) => {
4221
4270
  const o = i.position;
4222
4271
  let r = this.pinEls.get(i.id);
4223
4272
  r || (r = document.createElement("div"), Object.assign(r.style, {
@@ -4251,19 +4300,19 @@ class Ji {
4251
4300
  }
4252
4301
  const a = this.threads.find((c) => c.id === i.id);
4253
4302
  a && this.showThreadPopover(a, r);
4254
- }), this.container.appendChild(r), this.pinEls.set(i.id, r)), r.textContent = `${s + 1}`;
4303
+ }), this.container.appendChild(r), this.pinEls.set(i.id, r)), r.textContent = `${n + 1}`;
4255
4304
  const l = this.resolvePosition(o);
4256
4305
  r.style.left = `${l.x}px`, r.style.top = `${l.y}px`;
4257
4306
  });
4258
4307
  }
4259
4308
  }
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;
4309
+ var Qi = Object.defineProperty, es = Object.getOwnPropertyDescriptor, j = (s, e, t, i) => {
4310
+ for (var n = i > 1 ? void 0 : i ? es(e, t) : e, o = s.length - 1, r; o >= 0; o--)
4311
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
4312
+ return i && n && Qi(e, t, n), n;
4264
4313
  };
4265
4314
  const ts = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
4266
- let O = class extends T {
4315
+ let O = class extends S {
4267
4316
  constructor() {
4268
4317
  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 = [];
4269
4318
  }
@@ -4277,28 +4326,28 @@ let O = class extends T {
4277
4326
  disconnectedCallback() {
4278
4327
  super.disconnectedCallback(), this.teardownListeners();
4279
4328
  }
4280
- willUpdate(n) {
4329
+ willUpdate(s) {
4281
4330
  this.client && !this.unsub && this.ensureListener();
4282
4331
  }
4283
- updated(n) {
4332
+ updated(s) {
4284
4333
  var e, t;
4285
4334
  (e = this.shadowRoot) == null || e.querySelectorAll(".audio-player-host").forEach((i) => {
4286
4335
  if (i.children.length > 0) return;
4287
- const s = i.dataset.url;
4288
- if (s) {
4336
+ const n = i.dataset.url;
4337
+ if (n) {
4289
4338
  const o = i.dataset.duration ? parseInt(i.dataset.duration) : void 0;
4290
- i.appendChild(Oe.render(s, o));
4339
+ i.appendChild(Oe.render(n, o));
4291
4340
  }
4292
4341
  }), (t = this.shadowRoot) == null || t.querySelectorAll(".video-player-host").forEach((i) => {
4293
4342
  if (i.children.length > 0) return;
4294
- const s = i.dataset.url;
4295
- s && i.appendChild(Tt.render(s, i.dataset.poster || void 0));
4343
+ const n = i.dataset.url;
4344
+ n && i.appendChild(Tt.render(n, i.dataset.poster || void 0));
4296
4345
  });
4297
4346
  }
4298
4347
  teardownListeners() {
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);
4348
+ var s, e, t, i;
4349
+ (s = this.unsub) == null || s.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;
4350
+ for (const n of this.typingTimers.values()) clearTimeout(n);
4302
4351
  this.typingTimers.clear();
4303
4352
  }
4304
4353
  ensureListener() {
@@ -4313,119 +4362,122 @@ let O = class extends T {
4313
4362
  this.reactionsVersion++;
4314
4363
  }), this.typingUnsub = this.client.state.on(
4315
4364
  "typing",
4316
- ({ threadId: n }) => {
4317
- this.refreshTyping(n);
4365
+ ({ threadId: s }) => {
4366
+ this.refreshTyping(s);
4318
4367
  }
4319
4368
  ));
4320
4369
  }
4321
- refreshTyping(n) {
4322
- const t = this.client.state.getTypingUsers(n).filter((s) => {
4370
+ refreshTyping(s) {
4371
+ const t = this.client.state.getTypingUsers(s).filter((n) => {
4323
4372
  var o;
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);
4373
+ return n !== ((o = this.client.state.user) == null ? void 0 : o.id);
4374
+ }).map((n) => {
4375
+ const o = this.client.state.presence.find((r) => r.user.id === n);
4327
4376
  return (o == null ? void 0 : o.user.name) ?? "Someone";
4328
4377
  }), i = new Map(this.typingByThread);
4329
- i.set(n, t), this.typingByThread = i, this.typingTimers.has(n) && clearTimeout(this.typingTimers.get(n)), this.typingTimers.set(
4330
- n,
4378
+ i.set(s, t), this.typingByThread = i, this.typingTimers.has(s) && clearTimeout(this.typingTimers.get(s)), this.typingTimers.set(
4379
+ s,
4331
4380
  setTimeout(() => {
4332
- this.refreshTyping(n);
4381
+ this.refreshTyping(s);
4333
4382
  }, 3500)
4334
4383
  );
4335
4384
  }
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));
4385
+ handleTypingInput(s) {
4386
+ const e = Date.now(), t = this.lastTypingSend.get(s) ?? 0;
4387
+ e - t >= 2e3 && (this.client.sendTyping(s), this.lastTypingSend.set(s, e));
4339
4388
  }
4340
- toggleReaction(n, e) {
4389
+ toggleReaction(s, e) {
4341
4390
  var o;
4342
- const t = this.client.state.getReactions(n), i = (o = this.client.state.user) == null ? void 0 : o.id, s = t.find(
4391
+ const t = this.client.state.getReactions(s), i = (o = this.client.state.user) == null ? void 0 : o.id, n = t.find(
4343
4392
  (r) => r.emoji === e && r.userId === i
4344
4393
  );
4345
- s ? this.client.removeReaction(s.id) : this.client.addReaction(n, "comment", e), this.pickerOpenForComment = null;
4394
+ n ? this.client.removeReaction(n.id) : this.client.addReaction(s, "comment", e), this.pickerOpenForComment = null;
4346
4395
  }
4347
4396
  fireClose() {
4348
4397
  this.dispatchEvent(
4349
4398
  new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
4350
4399
  );
4351
4400
  }
4352
- scrollToThread(n) {
4401
+ scrollToThread(s) {
4353
4402
  this.updateComplete.then(() => {
4354
4403
  var t;
4355
4404
  const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(
4356
- `[data-thread-id="${n}"]`
4405
+ `[data-thread-id="${s}"]`
4357
4406
  );
4358
4407
  e == null || e.scrollIntoView({ behavior: "smooth", block: "center" });
4359
4408
  });
4360
4409
  }
4361
- parseMentions(n) {
4362
- return n.split(/(@\w+)/g).map(
4410
+ parseMentions(s) {
4411
+ return s.split(/(@\w+)/g).map(
4363
4412
  (t) => t.startsWith("@") ? h`<span class="mention">${t}</span>` : t
4364
4413
  );
4365
4414
  }
4366
- getInitials(n) {
4367
- return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
4415
+ getInitials(s) {
4416
+ return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
4368
4417
  }
4369
- getUserForComment(n) {
4370
- return this.client.state.getUser(n);
4418
+ getUserForComment(s) {
4419
+ return this.client.state.getUser(s);
4371
4420
  }
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);
4421
+ formatTime(s) {
4422
+ const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
4423
+ if (n < 1) return "now";
4424
+ if (n < 60) return `${n}m`;
4425
+ const o = Math.floor(n / 60);
4377
4426
  return o < 24 ? `${o}h` : e.toLocaleDateString();
4378
4427
  }
4379
4428
  async handleAttachImage() {
4380
4429
  this.upload || (this.upload = new ne(this.client));
4381
- const n = await this.upload.pickFile("image/*");
4382
- n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
4430
+ const s = await this.upload.pickFile("image/*");
4431
+ s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
4383
4432
  }
4384
- async handleRecordAudio(n) {
4433
+ async handleRecordAudio(s) {
4385
4434
  var i;
4386
4435
  this.upload || (this.upload = new ne(this.client)), this.audioRecorder || (this.audioRecorder = new Re());
4387
- const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${n}"]`), t = await this.audioRecorder.startRecording(e ?? document.body);
4436
+ const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${s}"]`), t = await this.audioRecorder.startRecording(e ?? document.body);
4388
4437
  if (t) {
4389
- const s = await this.upload.uploadBlob(t, "audio.webm");
4390
- s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
4438
+ const n = await this.upload.uploadBlob(t, "audio.webm");
4439
+ n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
4391
4440
  }
4392
4441
  }
4393
- async handleRecordVideo(n) {
4442
+ async handleRecordVideo(s) {
4394
4443
  var i;
4395
4444
  this.upload || (this.upload = new ne(this.client)), this.videoRecorder || (this.videoRecorder = new Le());
4396
- const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${n}"]`), t = await this.videoRecorder.startRecording(e ?? document.body);
4445
+ const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${s}"]`), t = await this.videoRecorder.startRecording(e ?? document.body);
4397
4446
  if (t) {
4398
- const s = await this.upload.uploadBlob(t.blob, "video.webm");
4399
- s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
4447
+ const n = await this.upload.uploadBlob(t.blob, "video.webm");
4448
+ n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
4400
4449
  }
4401
4450
  }
4402
- handleReply(n, e) {
4451
+ removeReplyAttachment(s) {
4452
+ this.replyAttachmentIds = this.replyAttachmentIds.filter((e) => e !== s), this.requestUpdate();
4453
+ }
4454
+ handleReply(s, e) {
4403
4455
  e.preventDefault();
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;
4456
+ const i = e.target.querySelector("input"), n = i.value.trim();
4457
+ if (!n && this.replyAttachmentIds.length === 0) return;
4458
+ const o = [...(n || "").matchAll(/@(\w+)/g)].map((r) => r[1]);
4459
+ this.client.reply(s, n, o, this.replyAttachmentIds.length > 0 ? [...this.replyAttachmentIds] : void 0), i.value = "", this.replyAttachmentIds = [], this.replyingTo = null;
4408
4460
  }
4409
- isOwnComment(n) {
4461
+ isOwnComment(s) {
4410
4462
  var e, t;
4411
- return ((t = (e = this.client) == null ? void 0 : e.state.user) == null ? void 0 : t.id) === n.userId;
4463
+ return ((t = (e = this.client) == null ? void 0 : e.state.user) == null ? void 0 : t.id) === s.userId;
4412
4464
  }
4413
- startEdit(n) {
4414
- this.editingCommentId = n.id, this.editBody = n.body;
4465
+ startEdit(s) {
4466
+ this.editingCommentId = s.id, this.editBody = s.body;
4415
4467
  }
4416
4468
  cancelEdit() {
4417
4469
  this.editingCommentId = null, this.editBody = "";
4418
4470
  }
4419
- saveEdit(n) {
4471
+ saveEdit(s) {
4420
4472
  const e = this.editBody.trim();
4421
4473
  if (!e) return;
4422
4474
  const t = [...e.matchAll(/@(\w+)/g)].map((i) => i[1]);
4423
- this.client.editComment(n, e, t), this.editingCommentId = null, this.editBody = "";
4475
+ this.client.editComment(s, e, t), this.editingCommentId = null, this.editBody = "";
4424
4476
  }
4425
- deleteComment(n) {
4426
- this.client.deleteComment(n);
4477
+ deleteComment(s) {
4478
+ this.client.deleteComment(s);
4427
4479
  }
4428
- renderEditForm(n) {
4480
+ renderEditForm(s) {
4429
4481
  return h`
4430
4482
  <div class="edit-form">
4431
4483
  <textarea
@@ -4435,16 +4487,16 @@ let O = class extends T {
4435
4487
  }}
4436
4488
  ></textarea>
4437
4489
  <div class="edit-actions">
4438
- <button class="pw-btn pw-btn-primary" @click=${() => this.saveEdit(n.id)}>Save</button>
4490
+ <button class="pw-btn pw-btn-primary" @click=${() => this.saveEdit(s.id)}>Save</button>
4439
4491
  <button class="pw-btn" @click=${this.cancelEdit}>Cancel</button>
4440
4492
  </div>
4441
4493
  </div>
4442
4494
  `;
4443
4495
  }
4444
- renderReactions(n) {
4445
- var s;
4496
+ renderReactions(s) {
4497
+ var n;
4446
4498
  this.reactionsVersion;
4447
- const e = this.client.state.getReactions(n.id), t = (s = this.client.state.user) == null ? void 0 : s.id, i = /* @__PURE__ */ new Map();
4499
+ const e = this.client.state.getReactions(s.id), t = (n = this.client.state.user) == null ? void 0 : n.id, i = /* @__PURE__ */ new Map();
4448
4500
  for (const o of e)
4449
4501
  i.has(o.emoji) || i.set(o.emoji, []), i.get(o.emoji).push(o);
4450
4502
  return h`
@@ -4455,7 +4507,7 @@ let O = class extends T {
4455
4507
  return h`
4456
4508
  <button
4457
4509
  class="reaction-pill ${l ? "own" : ""}"
4458
- @click=${() => this.toggleReaction(n.id, o)}
4510
+ @click=${() => this.toggleReaction(s.id, o)}
4459
4511
  >
4460
4512
  <span>${o}</span>
4461
4513
  <span class="count">${r.length}</span>
@@ -4466,41 +4518,41 @@ let O = class extends T {
4466
4518
  <button
4467
4519
  class="reaction-add-btn"
4468
4520
  @click=${() => {
4469
- this.pickerOpenForComment = this.pickerOpenForComment === n.id ? null : n.id;
4521
+ this.pickerOpenForComment = this.pickerOpenForComment === s.id ? null : s.id;
4470
4522
  }}
4471
4523
  title="Add reaction"
4472
4524
  >
4473
4525
  +
4474
- ${this.pickerOpenForComment === n.id ? h`
4526
+ ${this.pickerOpenForComment === s.id ? h`
4475
4527
  <div class="emoji-picker">
4476
4528
  ${ts.map(
4477
4529
  (o) => h`
4478
4530
  <button @click=${(r) => {
4479
- r.stopPropagation(), this.toggleReaction(n.id, o);
4531
+ r.stopPropagation(), this.toggleReaction(s.id, o);
4480
4532
  }}>${o}</button>
4481
4533
  `
4482
4534
  )}
4483
4535
  </div>
4484
- ` : f}
4536
+ ` : m}
4485
4537
  </button>
4486
4538
  </div>
4487
4539
  `;
4488
4540
  }
4489
- renderTypingIndicator(n) {
4490
- const e = this.typingByThread.get(n) ?? [];
4491
- if (e.length === 0) return f;
4541
+ renderTypingIndicator(s) {
4542
+ const e = this.typingByThread.get(s) ?? [];
4543
+ if (e.length === 0) return m;
4492
4544
  const t = e.length === 1 ? `${e[0]} is typing...` : `${e.join(", ")} are typing...`;
4493
4545
  return h`<div class="typing-indicator">${t}</div>`;
4494
4546
  }
4495
4547
  sortedThreads() {
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;
4548
+ return [...this.threads].sort((s, e) => {
4549
+ if (s.resolved !== e.resolved) return s.resolved ? 1 : -1;
4550
+ const t = s.comments.length ? new Date(s.comments[s.comments.length - 1].createdAt).getTime() : 0;
4499
4551
  return (e.comments.length ? new Date(e.comments[e.comments.length - 1].createdAt).getTime() : 0) - t;
4500
4552
  });
4501
4553
  }
4502
4554
  render() {
4503
- const n = this.sortedThreads();
4555
+ const s = this.sortedThreads();
4504
4556
  return h`
4505
4557
  <div class="panel">
4506
4558
  <div class="panel-header">
@@ -4509,15 +4561,15 @@ let O = class extends T {
4509
4561
  <span class="thread-count">${this.threads.length}</span>
4510
4562
  </span>
4511
4563
  <button class="close-btn" @click=${this.fireClose} title="Close">
4512
- ${k(me, 16)}
4564
+ ${C(me, 16)}
4513
4565
  </button>
4514
4566
  </div>
4515
4567
 
4516
4568
  <div class="panel-body pw-scrollable">
4517
- ${n.length === 0 ? h`<div class="empty">
4569
+ ${s.length === 0 ? h`<div class="empty">
4518
4570
  <div class="empty-icon">&#128172;</div>
4519
4571
  No comments yet
4520
- </div>` : n.map((e) => this.renderThread(e))}
4572
+ </div>` : s.map((e) => this.renderThread(e))}
4521
4573
  </div>
4522
4574
 
4523
4575
  <div class="pin-hint">
@@ -4526,9 +4578,9 @@ let O = class extends T {
4526
4578
  </div>
4527
4579
  `;
4528
4580
  }
4529
- renderAttachments(n) {
4530
- return !n || n.length === 0 ? f : h`
4531
- ${n.map((e) => {
4581
+ renderAttachments(s) {
4582
+ return !s || s.length === 0 ? m : h`
4583
+ ${s.map((e) => {
4532
4584
  if (e.type === "image") {
4533
4585
  const t = e.thumbnailUrl || e.url;
4534
4586
  return h`
@@ -4550,52 +4602,52 @@ let O = class extends T {
4550
4602
  <div class="comment-attachment-media" id="video-${e.id}">
4551
4603
  ${this.renderVideoPlayer(e)}
4552
4604
  </div>
4553
- ` : f;
4605
+ ` : m;
4554
4606
  })}
4555
4607
  `;
4556
4608
  }
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>`;
4609
+ renderAudioPlayer(s) {
4610
+ const e = document.createElement("div"), t = Oe.render(s.url, s.durationMs);
4611
+ return e.appendChild(t), h`<div class="audio-player-host" data-url=${s.url} data-duration=${s.durationMs ?? ""}></div>`;
4560
4612
  }
4561
- renderVideoPlayer(n) {
4562
- return h`<div class="video-player-host" data-url=${n.url} data-poster=${n.thumbnailUrl ?? ""}></div>`;
4613
+ renderVideoPlayer(s) {
4614
+ return h`<div class="video-player-host" data-url=${s.url} data-poster=${s.thumbnailUrl ?? ""}></div>`;
4563
4615
  }
4564
- renderThread(n) {
4565
- const e = this.highlightThreadId === n.id;
4616
+ renderThread(s) {
4617
+ const e = this.highlightThreadId === s.id;
4566
4618
  return h`
4567
4619
  <div
4568
- class="thread ${n.resolved ? "resolved" : ""} ${e ? "highlighted" : ""}"
4569
- data-thread-id=${n.id}
4620
+ class="thread ${s.resolved ? "resolved" : ""} ${e ? "highlighted" : ""}"
4621
+ data-thread-id=${s.id}
4570
4622
  >
4571
- ${n.position ? h`<div class="pin-badge">
4572
- ${k(_t, 12)}
4623
+ ${s.position ? h`<div class="pin-badge">
4624
+ ${C(_t, 12)}
4573
4625
  Pinned
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;
4626
+ </div>` : m}
4627
+ ${s.comments.map((t, i) => {
4628
+ const n = this.getUserForComment(t.userId), o = this.isOwnComment(t), r = this.editingCommentId === t.id;
4577
4629
  return h`
4578
- ${i > 0 ? h`<div class="comment-divider"></div>` : f}
4630
+ ${i > 0 ? h`<div class="comment-divider"></div>` : m}
4579
4631
  <div class="comment">
4580
4632
  <div class="comment-header">
4581
4633
  <div
4582
4634
  class="comment-avatar"
4583
- style="background:${(s == null ? void 0 : s.color) ?? "#94a3b8"}"
4635
+ style="background:${(n == null ? void 0 : n.color) ?? "#94a3b8"}"
4584
4636
  >
4585
- ${s ? this.getInitials(s.name) : "?"}
4637
+ ${n ? this.getInitials(n.name) : "?"}
4586
4638
  </div>
4587
- <span class="comment-author">${(s == null ? void 0 : s.name) ?? "Unknown"}</span>
4639
+ <span class="comment-author">${(n == null ? void 0 : n.name) ?? "Unknown"}</span>
4588
4640
  <span class="comment-time">${this.formatTime(t.createdAt)}</span>
4589
- ${t.editedAt ? h`<span class="edited-badge">(edited)</span>` : f}
4641
+ ${t.editedAt ? h`<span class="edited-badge">(edited)</span>` : m}
4590
4642
  </div>
4591
4643
  ${r ? this.renderEditForm(t) : h`
4592
- ${t.body && t.body !== "(attachment)" ? h`<div class="comment-body">${this.parseMentions(t.body)}</div>` : f}
4644
+ ${t.body && t.body !== "(attachment)" ? h`<div class="comment-body">${this.parseMentions(t.body)}</div>` : m}
4593
4645
  ${this.renderAttachments(t.attachments ?? [])}
4594
4646
  `}
4595
4647
  ${o && !r ? h`<div class="comment-actions">
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}
4648
+ <button @click=${() => this.startEdit(t)} title="Edit">${C(Ai, 14)}</button>
4649
+ <button class="danger" @click=${() => this.deleteComment(t.id)} title="Delete">${C(Mi, 14)}</button>
4650
+ </div>` : m}
4599
4651
  ${this.renderReactions(t)}
4600
4652
  </div>
4601
4653
  `;
@@ -4603,29 +4655,29 @@ let O = class extends T {
4603
4655
 
4604
4656
  <div class="thread-actions">
4605
4657
  <button
4606
- @click=${() => this.replyingTo = this.replyingTo === n.id ? null : n.id}
4658
+ @click=${() => this.replyingTo = this.replyingTo === s.id ? null : s.id}
4607
4659
  >
4608
4660
  Reply
4609
4661
  </button>
4610
4662
  <button
4611
- @click=${() => this.client.resolveThread(n.id, !n.resolved)}
4663
+ @click=${() => this.client.resolveThread(s.id, !s.resolved)}
4612
4664
  >
4613
- ${n.resolved ? "Reopen" : "Resolve"}
4665
+ ${s.resolved ? "Reopen" : "Resolve"}
4614
4666
  </button>
4615
4667
  </div>
4616
4668
 
4617
- ${this.renderTypingIndicator(n.id)}
4669
+ ${this.renderTypingIndicator(s.id)}
4618
4670
 
4619
- ${this.replyingTo === n.id ? h`
4671
+ ${this.replyingTo === s.id ? h`
4620
4672
  <form
4621
4673
  class="reply-form"
4622
- @submit=${(t) => this.handleReply(n.id, t)}
4674
+ @submit=${(t) => this.handleReply(s.id, t)}
4623
4675
  >
4624
4676
  <div class="reply-input-row">
4625
4677
  <input
4626
4678
  type="text"
4627
4679
  placeholder="Reply..."
4628
- @input=${() => this.handleTypingInput(n.id)}
4680
+ @input=${() => this.handleTypingInput(s.id)}
4629
4681
  />
4630
4682
  <button class="pw-btn pw-btn-primary" type="submit">Send</button>
4631
4683
  </div>
@@ -4635,27 +4687,34 @@ let O = class extends T {
4635
4687
  class="reply-media-btn"
4636
4688
  title="Attach image"
4637
4689
  @click=${() => this.handleAttachImage()}
4638
- >${k(Si, 16)}</button>
4690
+ >${C(Si, 16)}</button>
4639
4691
  <button
4640
4692
  type="button"
4641
4693
  class="reply-media-btn"
4642
4694
  title="Record audio"
4643
- @click=${() => this.handleRecordAudio(n.id)}
4644
- >${k(Ti, 16)}</button>
4695
+ @click=${() => this.handleRecordAudio(s.id)}
4696
+ >${C(Ti, 16)}</button>
4645
4697
  <button
4646
4698
  type="button"
4647
4699
  class="reply-media-btn"
4648
4700
  title="Record video"
4649
- @click=${() => this.handleRecordVideo(n.id)}
4650
- >${k(Oi, 16)}</button>
4701
+ @click=${() => this.handleRecordVideo(s.id)}
4702
+ >${C(Oi, 16)}</button>
4651
4703
  <div class="reply-preview">
4652
4704
  ${this.replyAttachmentIds.map(
4653
- (t, i) => h`<span class="reply-preview-badge">Attached #${i + 1}</span>`
4705
+ (t, i) => h`<span class="reply-preview-badge">
4706
+ Attached #${i + 1}
4707
+ <button
4708
+ type="button"
4709
+ class="reply-preview-remove"
4710
+ @click=${() => this.removeReplyAttachment(t)}
4711
+ >×</button>
4712
+ </span>`
4654
4713
  )}
4655
4714
  </div>
4656
4715
  </div>
4657
4716
  </form>
4658
- ` : f}
4717
+ ` : m}
4659
4718
  </div>
4660
4719
  `;
4661
4720
  }
@@ -4664,7 +4723,7 @@ O.styles = [
4664
4723
  ee,
4665
4724
  ge,
4666
4725
  _e,
4667
- A`
4726
+ I`
4668
4727
  :host {
4669
4728
  display: block;
4670
4729
  }
@@ -4905,7 +4964,10 @@ O.styles = [
4905
4964
  }
4906
4965
 
4907
4966
  .reply-preview-badge {
4908
- display: inline-block;
4967
+ position: relative;
4968
+ display: inline-flex;
4969
+ align-items: center;
4970
+ gap: 4px;
4909
4971
  padding: 2px 8px;
4910
4972
  border-radius: 4px;
4911
4973
  background: var(--pw-surface-hover);
@@ -4913,6 +4975,24 @@ O.styles = [
4913
4975
  color: var(--pw-text-muted);
4914
4976
  }
4915
4977
 
4978
+ .reply-preview-remove {
4979
+ border: none;
4980
+ background: var(--pw-danger, #ef4444);
4981
+ color: #fff;
4982
+ width: 14px;
4983
+ height: 14px;
4984
+ border-radius: 50%;
4985
+ font-size: 10px;
4986
+ line-height: 1;
4987
+ cursor: pointer;
4988
+ display: inline-flex;
4989
+ align-items: center;
4990
+ justify-content: center;
4991
+ padding: 0;
4992
+ font-weight: 700;
4993
+ flex-shrink: 0;
4994
+ }
4995
+
4916
4996
  .reply-form .pw-btn-primary {
4917
4997
  padding: 8px 14px;
4918
4998
  font-size: 12px;
@@ -5184,39 +5264,39 @@ O.styles = [
5184
5264
  `
5185
5265
  ];
5186
5266
  j([
5187
- g({ attribute: !1 })
5267
+ b({ attribute: !1 })
5188
5268
  ], O.prototype, "client", 2);
5189
5269
  j([
5190
- g()
5270
+ b()
5191
5271
  ], O.prototype, "highlightThreadId", 2);
5192
5272
  j([
5193
- v()
5273
+ x()
5194
5274
  ], O.prototype, "threadsVersion", 2);
5195
5275
  j([
5196
- v()
5276
+ x()
5197
5277
  ], O.prototype, "replyingTo", 2);
5198
5278
  j([
5199
- v()
5279
+ x()
5200
5280
  ], O.prototype, "editingCommentId", 2);
5201
5281
  j([
5202
- v()
5282
+ x()
5203
5283
  ], O.prototype, "editBody", 2);
5204
5284
  j([
5205
- v()
5285
+ x()
5206
5286
  ], O.prototype, "pickerOpenForComment", 2);
5207
5287
  j([
5208
- v()
5288
+ x()
5209
5289
  ], O.prototype, "typingByThread", 2);
5210
5290
  j([
5211
- v()
5291
+ x()
5212
5292
  ], O.prototype, "reactionsVersion", 2);
5213
5293
  O = j([
5214
5294
  R("pulse-widget-comments-panel")
5215
5295
  ], O);
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;
5296
+ var is = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, Ve = (s, e, t, i) => {
5297
+ for (var n = i > 1 ? void 0 : i ? ss(e, t) : e, o = s.length - 1, r; o >= 0; o--)
5298
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
5299
+ return i && n && is(e, t, n), n;
5220
5300
  };
5221
5301
  const ns = {
5222
5302
  "comment:created": "left a comment",
@@ -5231,7 +5311,7 @@ const ns = {
5231
5311
  "thread:resolved": "✅",
5232
5312
  "reaction:added": "🎉"
5233
5313
  };
5234
- let de = class extends T {
5314
+ let de = class extends S {
5235
5315
  constructor() {
5236
5316
  super(...arguments), this.notifications = [];
5237
5317
  }
@@ -5239,18 +5319,18 @@ let de = class extends T {
5239
5319
  super.connectedCallback(), this.setupListener();
5240
5320
  }
5241
5321
  disconnectedCallback() {
5242
- var n;
5243
- super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
5322
+ var s;
5323
+ super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
5244
5324
  }
5245
- updated(n) {
5325
+ updated(s) {
5246
5326
  var e;
5247
- n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
5327
+ s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
5248
5328
  }
5249
5329
  setupListener() {
5250
5330
  this.client && (this.notifications = this.client.state.notifications, this.unsub = this.client.state.on(
5251
5331
  "notifications",
5252
- (n) => {
5253
- this.notifications = [...n];
5332
+ (s) => {
5333
+ this.notifications = [...s];
5254
5334
  }
5255
5335
  ));
5256
5336
  }
@@ -5259,35 +5339,35 @@ let de = class extends T {
5259
5339
  new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
5260
5340
  );
5261
5341
  }
5262
- handleClick(n) {
5263
- n.read || this.client.markRead(n.id);
5342
+ handleClick(s) {
5343
+ s.read || this.client.markRead(s.id);
5264
5344
  }
5265
- getActorName(n) {
5345
+ getActorName(s) {
5266
5346
  var e;
5267
- return ((e = this.client.state.getUser(n)) == null ? void 0 : e.name) ?? "Someone";
5347
+ return ((e = this.client.state.getUser(s)) == null ? void 0 : e.name) ?? "Someone";
5268
5348
  }
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);
5349
+ formatTime(s) {
5350
+ const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
5351
+ if (n < 1) return "now";
5352
+ if (n < 60) return `${n}m`;
5353
+ const o = Math.floor(n / 60);
5274
5354
  return o < 24 ? `${o}h` : e.toLocaleDateString();
5275
5355
  }
5276
5356
  render() {
5277
- const n = this.notifications.filter((e) => !e.read).length;
5357
+ const s = this.notifications.filter((e) => !e.read).length;
5278
5358
  return h`
5279
5359
  <div class="panel">
5280
5360
  <div class="panel-header">
5281
5361
  <span class="panel-title">
5282
5362
  Notifications
5283
- ${n > 0 ? h`<span class="unread-badge">${n}</span>` : f}
5363
+ ${s > 0 ? h`<span class="unread-badge">${s}</span>` : m}
5284
5364
  </span>
5285
5365
  <div style="display:flex;align-items:center;gap:4px;">
5286
- ${n > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
5366
+ ${s > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
5287
5367
  Mark all read
5288
- </button>` : f}
5368
+ </button>` : m}
5289
5369
  <button class="close-btn" @click=${this.fireClose} title="Close">
5290
- ${k(me, 16)}
5370
+ ${C(me, 16)}
5291
5371
  </button>
5292
5372
  </div>
5293
5373
  </div>
@@ -5323,7 +5403,7 @@ de.styles = [
5323
5403
  ee,
5324
5404
  ge,
5325
5405
  _e,
5326
- A`
5406
+ I`
5327
5407
  :host {
5328
5408
  display: block;
5329
5409
  }
@@ -5517,10 +5597,10 @@ de.styles = [
5517
5597
  `
5518
5598
  ];
5519
5599
  Ve([
5520
- g({ attribute: !1 })
5600
+ b({ attribute: !1 })
5521
5601
  ], de.prototype, "client", 2);
5522
5602
  Ve([
5523
- v()
5603
+ x()
5524
5604
  ], de.prototype, "notifications", 2);
5525
5605
  de = Ve([
5526
5606
  R("pulse-widget-notifications-panel")
@@ -5555,13 +5635,13 @@ class as {
5555
5635
  if (i)
5556
5636
  i.position = t;
5557
5637
  else {
5558
- const s = this.client.state.presence.find(
5638
+ const n = this.client.state.presence.find(
5559
5639
  (o) => o.user.id === e
5560
5640
  );
5561
- s && this.cursors.set(e, {
5641
+ n && this.cursors.set(e, {
5562
5642
  userId: e,
5563
- name: s.user.name,
5564
- color: s.user.color,
5643
+ name: n.user.name,
5644
+ color: n.user.color,
5565
5645
  position: t
5566
5646
  });
5567
5647
  }
@@ -5571,17 +5651,17 @@ class as {
5571
5651
  ), this.unsubs.push(
5572
5652
  this.client.state.on("presence", (e) => {
5573
5653
  var i;
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));
5654
+ const t = new Set(e.map((n) => n.user.id));
5655
+ for (const n of this.cursors.keys())
5656
+ t.has(n) || (this.cursors.delete(n), (i = this.cursorEls.get(n)) == null || i.remove(), this.cursorEls.delete(n), this.cursorLastSeen.delete(n));
5577
5657
  })
5578
5658
  ), this.setSending(!0), this.staleTimer = setInterval(() => {
5579
5659
  const e = Date.now();
5580
5660
  for (const [t, i] of this.cursorLastSeen)
5581
5661
  if (e - i > rs) {
5582
5662
  this.cursors.delete(t);
5583
- const s = this.cursorEls.get(t);
5584
- s && s.remove(), this.cursorEls.delete(t), this.cursorLastSeen.delete(t);
5663
+ const n = this.cursorEls.get(t);
5664
+ n && n.remove(), this.cursorEls.delete(t), this.cursorLastSeen.delete(t);
5585
5665
  }
5586
5666
  }, 1e3));
5587
5667
  }
@@ -5605,7 +5685,7 @@ class as {
5605
5685
  if (!this.container) return;
5606
5686
  const i = this.client.state.presence.find(
5607
5687
  (r) => r.user.id === e
5608
- ), s = (i == null ? void 0 : i.user.color) ?? "#6366f1", o = document.createElement("div");
5688
+ ), n = (i == null ? void 0 : i.user.color) ?? "#6366f1", o = document.createElement("div");
5609
5689
  Object.assign(o.style, {
5610
5690
  position: "absolute",
5611
5691
  left: `${t.x}px`,
@@ -5613,7 +5693,7 @@ class as {
5613
5693
  width: "0px",
5614
5694
  height: "0px",
5615
5695
  borderRadius: "50%",
5616
- border: `3px solid ${s}`,
5696
+ border: `3px solid ${n}`,
5617
5697
  transform: "translate(-50%, -50%)",
5618
5698
  pointerEvents: "none",
5619
5699
  opacity: "1",
@@ -5624,8 +5704,8 @@ class as {
5624
5704
  }
5625
5705
  showEmojiDrop(e, t, i) {
5626
5706
  if (!this.container) return;
5627
- const s = document.createElement("div");
5628
- Object.assign(s.style, {
5707
+ const n = document.createElement("div");
5708
+ Object.assign(n.style, {
5629
5709
  position: "absolute",
5630
5710
  left: `${i.x}px`,
5631
5711
  top: `${i.y}px`,
@@ -5635,9 +5715,9 @@ class as {
5635
5715
  transform: "translate(-50%, 0)",
5636
5716
  zIndex: "10",
5637
5717
  lineHeight: "1"
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);
5718
+ }), n.textContent = t, this.container.appendChild(n), requestAnimationFrame(() => {
5719
+ n.style.transform = "translate(-50%, -80px)", n.style.opacity = "0";
5720
+ }), setTimeout(() => n.remove(), 2e3);
5641
5721
  }
5642
5722
  destroy() {
5643
5723
  this.disable();
@@ -5654,9 +5734,9 @@ class as {
5654
5734
  willChange: "transform",
5655
5735
  pointerEvents: "none"
5656
5736
  });
5657
- const s = t.color || "#e74c3c";
5737
+ const n = t.color || "#e74c3c";
5658
5738
  i.innerHTML = `
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))">
5739
+ <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))">
5660
5740
  <path d="M0 0l6.5 16L8 9l7-2.5z" stroke="#fff" stroke-width="1"/>
5661
5741
  </svg>
5662
5742
  <span style="
@@ -5665,7 +5745,7 @@ class as {
5665
5745
  font-size:12px;font-weight:700;
5666
5746
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
5667
5747
  color:#fff;white-space:nowrap;
5668
- background:${s};
5748
+ background:${n};
5669
5749
  box-shadow:0 2px 10px rgba(0,0,0,0.25);
5670
5750
  letter-spacing:0.01em;
5671
5751
  ">${t.name}</span>
@@ -5679,26 +5759,26 @@ class ls {
5679
5759
  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) => {
5680
5760
  var l, a, c;
5681
5761
  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 };
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;
5762
+ const i = this.client.state.user, n = (i == null ? void 0 : i.color) ?? "#6366f1", r = 2 + (t.pressure > 0 ? t.pressure : 0.5) * 4;
5683
5763
  this.currentPath = document.createElementNS(
5684
5764
  "http://www.w3.org/2000/svg",
5685
5765
  "polyline"
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(
5766
+ ), 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(
5687
5767
  "points",
5688
5768
  `${t.clientX},${t.clientY}`
5689
5769
  ), (c = this.container) == null || c.appendChild(this.currentPath), document.addEventListener("pointermove", this.handlePointerMove), document.addEventListener("pointerup", this.handlePointerUp);
5690
5770
  }, this.handlePointerMove = (t) => {
5691
5771
  if (!this.currentPath || !this.lastPoint) return;
5692
- const i = t.clientX - this.lastPoint.x, s = t.clientY - this.lastPoint.y;
5693
- if (i * i + s * s < 4) return;
5772
+ const i = t.clientX - this.lastPoint.x, n = t.clientY - this.lastPoint.y;
5773
+ if (i * i + n * n < 4) return;
5694
5774
  this.currentPoints.push({ x: t.clientX, y: t.clientY }), this.lastPoint = { x: t.clientX, y: t.clientY };
5695
5775
  const o = this.currentPoints.map((r) => `${r.x},${r.y}`).join(" ");
5696
5776
  this.currentPath.setAttribute("points", o);
5697
5777
  }, this.handlePointerUp = () => {
5698
5778
  var t;
5699
5779
  if (document.removeEventListener("pointermove", this.handlePointerMove), document.removeEventListener("pointerup", this.handlePointerUp), this.currentPoints.length > 1) {
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);
5780
+ const i = this.client.state.user, n = (i == null ? void 0 : i.color) ?? "#6366f1";
5781
+ this.client.drawStroke(this.currentPoints, n, 3), this.currentPath && this.scheduleFade(this.currentPath);
5702
5782
  } else
5703
5783
  (t = this.currentPath) == null || t.remove();
5704
5784
  this.currentPoints = [], this.currentPath = null, this.lastPoint = null;
@@ -5712,8 +5792,8 @@ class ls {
5712
5792
  "style",
5713
5793
  "position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:9989;"
5714
5794
  ), document.body.appendChild(this.container), this.unsubs.push(
5715
- this.client.state.on("draw-stroke", ({ userId: e, points: t, color: i, width: s }) => {
5716
- this.renderStroke(t, i, s);
5795
+ this.client.state.on("draw-stroke", ({ userId: e, points: t, color: i, width: n }) => {
5796
+ this.renderStroke(t, i, n);
5717
5797
  })
5718
5798
  ), this.unsubs.push(
5719
5799
  this.client.state.on("draw-clear", ({ userId: e }) => {
@@ -5739,14 +5819,14 @@ class ls {
5739
5819
  }
5740
5820
  renderStroke(e, t, i) {
5741
5821
  if (!this.container || e.length < 2) return;
5742
- const s = document.createElementNS(
5822
+ const n = document.createElementNS(
5743
5823
  "http://www.w3.org/2000/svg",
5744
5824
  "polyline"
5745
5825
  );
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(
5826
+ 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(
5747
5827
  "points",
5748
5828
  e.map((o) => `${o.x},${o.y}`).join(" ")
5749
- ), s.style.willChange = "opacity", this.container.appendChild(s), this.scheduleFade(s);
5829
+ ), n.style.willChange = "opacity", this.container.appendChild(n), this.scheduleFade(n);
5750
5830
  }
5751
5831
  scheduleFade(e) {
5752
5832
  const t = setTimeout(() => {
@@ -5757,48 +5837,48 @@ class ls {
5757
5837
  this.fadeTimers.set(e, t);
5758
5838
  }
5759
5839
  }
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,
5840
+ function cs(s) {
5841
+ if (!s.rangeCount || s.isCollapsed) return null;
5842
+ const e = s.getRangeAt(0), t = e.startContainer, i = e.endContainer, n = ft(t), o = ft(i);
5843
+ return !n || !o ? null : {
5844
+ startSelector: n,
5765
5845
  startOffset: e.startOffset,
5766
5846
  endSelector: o,
5767
5847
  endOffset: e.endOffset
5768
5848
  };
5769
5849
  }
5770
- function ds(n) {
5850
+ function ds(s) {
5771
5851
  var e, t;
5772
5852
  try {
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;
5853
+ const i = gt(s.startSelector), n = gt(s.endSelector);
5854
+ if (!i || !n) return null;
5855
+ 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;
5856
+ return o.setStart(i, Math.min(s.startOffset, r)), o.setEnd(n, Math.min(s.endOffset, l)), o;
5777
5857
  } catch {
5778
5858
  return null;
5779
5859
  }
5780
5860
  }
5781
- function ft(n) {
5782
- if (n.nodeType === Node.TEXT_NODE) {
5783
- const e = n.parentElement;
5861
+ function ft(s) {
5862
+ if (s.nodeType === Node.TEXT_NODE) {
5863
+ const e = s.parentElement;
5784
5864
  if (!e) return null;
5785
5865
  const t = mt(e);
5786
5866
  if (!t) return null;
5787
- const i = Array.from(e.childNodes).indexOf(n);
5867
+ const i = Array.from(e.childNodes).indexOf(s);
5788
5868
  return `${t}::text(${i})`;
5789
5869
  }
5790
- return n.nodeType === Node.ELEMENT_NODE ? mt(n) : null;
5870
+ return s.nodeType === Node.ELEMENT_NODE ? mt(s) : null;
5791
5871
  }
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)}`;
5872
+ function mt(s) {
5873
+ if (!s || s === document.documentElement) return "html";
5874
+ if (s === document.body) return "body";
5875
+ if (s.id) return `#${CSS.escape(s.id)}`;
5796
5876
  const e = [];
5797
- let t = n, i = 0;
5877
+ let t = s, i = 0;
5798
5878
  for (; t && t !== document.body && i < 10; ) {
5799
- const s = t.parentElement;
5800
- if (!s) break;
5801
- const o = t.tagName.toLowerCase(), r = t.tagName, l = Array.from(s.children).filter(
5879
+ const n = t.parentElement;
5880
+ if (!n) break;
5881
+ const o = t.tagName.toLowerCase(), r = t.tagName, l = Array.from(n.children).filter(
5802
5882
  (a) => a.tagName === r
5803
5883
  );
5804
5884
  if (l.length === 1)
@@ -5807,27 +5887,27 @@ function mt(n) {
5807
5887
  const a = l.indexOf(t) + 1;
5808
5888
  e.unshift(`${o}:nth-of-type(${a})`);
5809
5889
  }
5810
- if (s.id) {
5811
- e.unshift(`#${CSS.escape(s.id)}`);
5890
+ if (n.id) {
5891
+ e.unshift(`#${CSS.escape(n.id)}`);
5812
5892
  break;
5813
5893
  }
5814
- t = s, i++;
5894
+ t = n, i++;
5815
5895
  }
5816
5896
  return e.length > 0 ? e.join(" > ") : null;
5817
5897
  }
5818
- function gt(n) {
5819
- const e = n.match(/^(.+)::text\((\d+)\)$/);
5898
+ function gt(s) {
5899
+ const e = s.match(/^(.+)::text\((\d+)\)$/);
5820
5900
  if (e) {
5821
5901
  const t = e[1], i = parseInt(e[2], 10);
5822
5902
  try {
5823
- const s = document.querySelector(t);
5824
- return s ? s.childNodes[i] ?? null : null;
5903
+ const n = document.querySelector(t);
5904
+ return n ? n.childNodes[i] ?? null : null;
5825
5905
  } catch {
5826
5906
  return null;
5827
5907
  }
5828
5908
  }
5829
5909
  try {
5830
- return document.querySelector(n);
5910
+ return document.querySelector(s);
5831
5911
  } catch {
5832
5912
  return null;
5833
5913
  }
@@ -5876,16 +5956,16 @@ class hs {
5876
5956
  if (!this.container) return;
5877
5957
  const i = (l = this.client.state.user) == null ? void 0 : l.id;
5878
5958
  if (e === i || (this.clearSelection(e), !t)) return;
5879
- const s = ds(t);
5880
- if (!s) return;
5959
+ const n = ds(t);
5960
+ if (!n) return;
5881
5961
  const o = this.client.state.presence.find(
5882
5962
  (a) => a.user.id === e
5883
5963
  ), r = (o == null ? void 0 : o.user.color) ?? "#6366f1";
5884
5964
  try {
5885
- const a = s.getClientRects(), c = [];
5965
+ const a = n.getClientRects(), c = [];
5886
5966
  for (let p = 0; p < a.length; p++) {
5887
- const d = a[p], u = document.createElement("div");
5888
- Object.assign(u.style, {
5967
+ const d = a[p], f = document.createElement("div");
5968
+ Object.assign(f.style, {
5889
5969
  position: "absolute",
5890
5970
  left: `${d.left}px`,
5891
5971
  top: `${d.top}px`,
@@ -5895,7 +5975,7 @@ class hs {
5895
5975
  opacity: "0.2",
5896
5976
  borderRadius: "2px",
5897
5977
  pointerEvents: "none"
5898
- }), this.container.appendChild(u), c.push(u);
5978
+ }), this.container.appendChild(f), c.push(f);
5899
5979
  }
5900
5980
  this.selectionEls.set(e, c);
5901
5981
  } catch {
@@ -5915,12 +5995,12 @@ class hs {
5915
5995
  }
5916
5996
  }
5917
5997
  }
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;
5998
+ var ps = Object.defineProperty, us = Object.getOwnPropertyDescriptor, qe = (s, e, t, i) => {
5999
+ for (var n = i > 1 ? void 0 : i ? us(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6000
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6001
+ return i && n && ps(e, t, n), n;
5922
6002
  };
5923
- let he = class extends T {
6003
+ let he = class extends S {
5924
6004
  constructor() {
5925
6005
  super(...arguments), this.roomId = "";
5926
6006
  }
@@ -5929,8 +6009,8 @@ let he = class extends T {
5929
6009
  new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
5930
6010
  );
5931
6011
  }
5932
- toggle(n) {
5933
- const e = { ...this.settings, [n]: !this.settings[n] };
6012
+ toggle(s) {
6013
+ const e = { ...this.settings, [s]: !this.settings[s] };
5934
6014
  this.dispatchEvent(
5935
6015
  new CustomEvent("settings-change", {
5936
6016
  detail: e,
@@ -5939,10 +6019,10 @@ let he = class extends T {
5939
6019
  })
5940
6020
  );
5941
6021
  }
5942
- renderToggle(n, e) {
6022
+ renderToggle(s, e) {
5943
6023
  return h`
5944
6024
  <div class="setting-row">
5945
- <span class="setting-label">${n}</span>
6025
+ <span class="setting-label">${s}</span>
5946
6026
  <label class="toggle">
5947
6027
  <input
5948
6028
  type="checkbox"
@@ -5955,13 +6035,13 @@ let he = class extends T {
5955
6035
  `;
5956
6036
  }
5957
6037
  render() {
5958
- const n = !this.settings.enabled;
6038
+ const s = !this.settings.enabled;
5959
6039
  return h`
5960
6040
  <div class="panel">
5961
6041
  <div class="panel-header">
5962
6042
  <span class="panel-title">Settings</span>
5963
6043
  <button class="close-btn" @click=${this.fireClose} title="Close">
5964
- ${k(me, 16)}
6044
+ ${C(me, 16)}
5965
6045
  </button>
5966
6046
  </div>
5967
6047
 
@@ -5980,7 +6060,7 @@ let he = class extends T {
5980
6060
  </label>
5981
6061
  </div>
5982
6062
 
5983
- <div class="panel-body pw-scrollable ${n ? "settings-disabled" : ""}">
6063
+ <div class="panel-body pw-scrollable ${s ? "settings-disabled" : ""}">
5984
6064
  <div class="section-label">Cursors</div>
5985
6065
  ${this.renderToggle("Show my cursor to others", "showMyCursor")}
5986
6066
  ${this.renderToggle("Show others' cursors", "showOthersCursors")}
@@ -6010,7 +6090,7 @@ he.styles = [
6010
6090
  ee,
6011
6091
  ge,
6012
6092
  _e,
6013
- A`
6093
+ I`
6014
6094
  :host {
6015
6095
  display: block;
6016
6096
  }
@@ -6182,10 +6262,10 @@ he.styles = [
6182
6262
  `
6183
6263
  ];
6184
6264
  qe([
6185
- g({ attribute: !1 })
6265
+ b({ attribute: !1 })
6186
6266
  ], he.prototype, "settings", 2);
6187
6267
  qe([
6188
- g()
6268
+ b()
6189
6269
  ], he.prototype, "roomId", 2);
6190
6270
  he = qe([
6191
6271
  R("pulse-widget-settings-panel")
@@ -6202,23 +6282,23 @@ const ye = {
6202
6282
  showSelections: !0,
6203
6283
  showDrawings: !0
6204
6284
  }, St = "pulse:settings:";
6205
- function fs(n) {
6285
+ function fs(s) {
6206
6286
  try {
6207
- const e = localStorage.getItem(`${St}${n}`);
6287
+ const e = localStorage.getItem(`${St}${s}`);
6208
6288
  return e ? { ...ye, ...JSON.parse(e) } : { ...ye };
6209
6289
  } catch {
6210
6290
  return { ...ye };
6211
6291
  }
6212
6292
  }
6213
- function ms(n, e) {
6214
- localStorage.setItem(`${St}${n}`, JSON.stringify(e));
6293
+ function ms(s, e) {
6294
+ localStorage.setItem(`${St}${s}`, JSON.stringify(e));
6215
6295
  }
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;
6296
+ var gs = Object.defineProperty, bs = Object.getOwnPropertyDescriptor, L = (s, e, t, i) => {
6297
+ for (var n = i > 1 ? void 0 : i ? bs(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6298
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6299
+ return i && n && gs(e, t, n), n;
6220
6300
  };
6221
- let M = class extends T {
6301
+ let M = class extends S {
6222
6302
  constructor() {
6223
6303
  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;
6224
6304
  }
@@ -6226,36 +6306,36 @@ let M = class extends T {
6226
6306
  super.connectedCallback(), this.setupPresence();
6227
6307
  }
6228
6308
  disconnectedCallback() {
6229
- var n, e;
6230
- super.disconnectedCallback(), (n = this.unsub) == null || n.call(this), (e = this.notifUnsub) == null || e.call(this);
6309
+ var s, e;
6310
+ super.disconnectedCallback(), (s = this.unsub) == null || s.call(this), (e = this.notifUnsub) == null || e.call(this);
6231
6311
  }
6232
- updated(n) {
6312
+ updated(s) {
6233
6313
  var e, t;
6234
- n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), (t = this.notifUnsub) == null || t.call(this), this.setupPresence());
6314
+ s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), (t = this.notifUnsub) == null || t.call(this), this.setupPresence());
6235
6315
  }
6236
6316
  setupPresence() {
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;
6317
+ this.client && (this.users = this.client.state.presence, this.unreadCount = this.client.state.unreadCount, this.unsub = this.client.state.on("presence", (s) => {
6318
+ this.users = s;
6239
6319
  }), this.notifUnsub = this.client.state.on("notifications", () => {
6240
6320
  this.unreadCount = this.client.state.unreadCount;
6241
6321
  }));
6242
6322
  }
6243
- getInitials(n) {
6244
- return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
6323
+ getInitials(s) {
6324
+ return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
6245
6325
  }
6246
- fire(n) {
6326
+ fire(s) {
6247
6327
  this.dispatchEvent(
6248
6328
  new CustomEvent("toolbar-action", {
6249
- detail: n,
6329
+ detail: s,
6250
6330
  bubbles: !0,
6251
6331
  composed: !0
6252
6332
  })
6253
6333
  );
6254
6334
  }
6255
- fireFollow(n) {
6335
+ fireFollow(s) {
6256
6336
  this.dispatchEvent(
6257
6337
  new CustomEvent("toolbar-follow", {
6258
- detail: n,
6338
+ detail: s,
6259
6339
  bubbles: !0,
6260
6340
  composed: !0
6261
6341
  })
@@ -6267,20 +6347,20 @@ let M = class extends T {
6267
6347
  );
6268
6348
  }
6269
6349
  render() {
6270
- const n = this.display === "inline";
6350
+ const s = this.display === "inline";
6271
6351
  if (this.collapsed)
6272
6352
  return h`
6273
- <div class="toolbar collapsed ${n ? "inline" : ""}" @click=${this.fireToggle}>
6274
- <span class="fab-icon">${k(Ri, n ? 18 : 24)}</span>
6353
+ <div class="toolbar collapsed ${s ? "inline" : ""}" @click=${this.fireToggle}>
6354
+ <span class="fab-icon">${C(Ri, s ? 18 : 24)}</span>
6275
6355
  </div>
6276
6356
  `;
6277
6357
  const e = this.users.slice(0, 3), t = this.users.length - 3;
6278
6358
  return h`
6279
- <div class="toolbar ${n ? "inline" : ""}"
6359
+ <div class="toolbar ${s ? "inline" : ""}"
6280
6360
  <!-- Presence avatars -->
6281
6361
  ${this.users.length > 0 ? h`
6282
6362
  <div class="presence">
6283
- ${t > 0 ? h`<div class="presence-overflow">+${t}</div>` : f}
6363
+ ${t > 0 ? h`<div class="presence-overflow">+${t}</div>` : m}
6284
6364
  ${e.map(
6285
6365
  (i) => h`
6286
6366
  <div
@@ -6291,13 +6371,13 @@ let M = class extends T {
6291
6371
  >
6292
6372
  ${i.user.avatar ? h`<img src="${i.user.avatar}" alt="${i.user.name}" />` : this.getInitials(i.user.name)}
6293
6373
  <span class="presence-tooltip">${i.user.name}</span>
6294
- ${i.deviceType && i.deviceType !== "desktop" ? h`<span class="device-icon">${i.deviceType === "mobile" ? "📱" : "📲"}</span>` : f}
6374
+ ${i.deviceType && i.deviceType !== "desktop" ? h`<span class="device-icon">${i.deviceType === "mobile" ? "📱" : "📲"}</span>` : m}
6295
6375
  </div>
6296
6376
  `
6297
6377
  )}
6298
6378
  </div>
6299
6379
  <div class="separator"></div>
6300
- ` : f}
6380
+ ` : m}
6301
6381
 
6302
6382
  <!-- Pin comment (primary) -->
6303
6383
  <button
@@ -6307,7 +6387,7 @@ let M = class extends T {
6307
6387
  ?disabled=${this.featuresDisabled}
6308
6388
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6309
6389
  >
6310
- ${k(_t)}
6390
+ ${C(_t)}
6311
6391
  </button>
6312
6392
 
6313
6393
  <!-- View comments -->
@@ -6318,7 +6398,7 @@ let M = class extends T {
6318
6398
  ?disabled=${this.featuresDisabled}
6319
6399
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6320
6400
  >
6321
- ${k(_i)}
6401
+ ${C(_i)}
6322
6402
  </button>
6323
6403
 
6324
6404
  <!-- Activity feed -->
@@ -6329,7 +6409,7 @@ let M = class extends T {
6329
6409
  ?disabled=${this.featuresDisabled}
6330
6410
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6331
6411
  >
6332
- ${k(Ci)}
6412
+ ${C(Ci)}
6333
6413
  </button>
6334
6414
 
6335
6415
  <!-- Draw mode -->
@@ -6340,7 +6420,7 @@ let M = class extends T {
6340
6420
  ?disabled=${this.featuresDisabled}
6341
6421
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6342
6422
  >
6343
- ${k(Pi)}
6423
+ ${C(Pi)}
6344
6424
  </button>
6345
6425
 
6346
6426
  <!-- Notifications -->
@@ -6351,8 +6431,8 @@ let M = class extends T {
6351
6431
  ?disabled=${this.featuresDisabled}
6352
6432
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : "position:relative"}"
6353
6433
  >
6354
- ${k(Ei)}
6355
- ${this.unreadCount > 0 ? h`<span class="badge">${this.unreadCount > 9 ? "9+" : this.unreadCount}</span>` : f}
6434
+ ${C(Ei)}
6435
+ ${this.unreadCount > 0 ? h`<span class="badge">${this.unreadCount > 9 ? "9+" : this.unreadCount}</span>` : m}
6356
6436
  </button>
6357
6437
 
6358
6438
  <!-- Settings -->
@@ -6361,7 +6441,7 @@ let M = class extends T {
6361
6441
  @click=${() => this.fire("settings")}
6362
6442
  title="Settings"
6363
6443
  >
6364
- ${k(Ii)}
6444
+ ${C(Ii)}
6365
6445
  </button>
6366
6446
 
6367
6447
  <div class="separator"></div>
@@ -6372,7 +6452,7 @@ let M = class extends T {
6372
6452
  @click=${this.fireToggle}
6373
6453
  title="Collapse"
6374
6454
  >
6375
- ${k(me, 14)}
6455
+ ${C(me, 14)}
6376
6456
  </button>
6377
6457
  </div>
6378
6458
  `;
@@ -6381,7 +6461,7 @@ let M = class extends T {
6381
6461
  M.styles = [
6382
6462
  ee,
6383
6463
  ge,
6384
- A`
6464
+ I`
6385
6465
  :host {
6386
6466
  display: block;
6387
6467
  }
@@ -6594,34 +6674,34 @@ M.styles = [
6594
6674
  `
6595
6675
  ];
6596
6676
  L([
6597
- g({ attribute: !1 })
6677
+ b({ attribute: !1 })
6598
6678
  ], M.prototype, "client", 2);
6599
6679
  L([
6600
- g({ type: Boolean })
6680
+ b({ type: Boolean })
6601
6681
  ], M.prototype, "collapsed", 2);
6602
6682
  L([
6603
- g()
6683
+ b()
6604
6684
  ], M.prototype, "activePanel", 2);
6605
6685
  L([
6606
- g({ type: Boolean })
6686
+ b({ type: Boolean })
6607
6687
  ], M.prototype, "pinModeActive", 2);
6608
6688
  L([
6609
- g({ type: Boolean })
6689
+ b({ type: Boolean })
6610
6690
  ], M.prototype, "featuresDisabled", 2);
6611
6691
  L([
6612
- g({ type: Boolean })
6692
+ b({ type: Boolean })
6613
6693
  ], M.prototype, "drawModeActive", 2);
6614
6694
  L([
6615
- g()
6695
+ b()
6616
6696
  ], M.prototype, "followingUserId", 2);
6617
6697
  L([
6618
- g()
6698
+ b()
6619
6699
  ], M.prototype, "display", 2);
6620
6700
  L([
6621
- v()
6701
+ x()
6622
6702
  ], M.prototype, "users", 2);
6623
6703
  L([
6624
- v()
6704
+ x()
6625
6705
  ], M.prototype, "unreadCount", 2);
6626
6706
  M = L([
6627
6707
  R("pulse-widget-toolbar")
@@ -6664,26 +6744,26 @@ class vs {
6664
6744
  this.pillEls.clear();
6665
6745
  return;
6666
6746
  }
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();
6747
+ 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();
6668
6748
  for (const [l, a] of this.client.state.viewports) {
6669
- if (l === s) continue;
6670
- const c = a.scrollY, p = a.scrollY + a.viewportHeight, d = e, u = e + t;
6671
- if (c >= d && p <= u) {
6672
- const $ = this.pillEls.get(l);
6673
- $ && ($.style.display = "none");
6749
+ if (l === n) continue;
6750
+ const c = a.scrollY, p = a.scrollY + a.viewportHeight, d = e, f = e + t;
6751
+ if (c >= d && p <= f) {
6752
+ const E = this.pillEls.get(l);
6753
+ E && (E.style.display = "none");
6674
6754
  continue;
6675
6755
  }
6676
6756
  o.add(l);
6677
- const m = this.client.state.presence.find(
6678
- ($) => $.user.id === l
6757
+ const u = this.client.state.presence.find(
6758
+ (E) => E.user.id === l
6679
6759
  );
6680
- if (!m) continue;
6681
- const b = a.scrollY + a.viewportHeight / 2, I = i > 0 ? b / i : 0, C = Math.max(
6760
+ if (!u) continue;
6761
+ const g = a.scrollY + a.viewportHeight / 2, v = i > 0 ? g / i : 0, $ = Math.max(
6682
6762
  8,
6683
- Math.min(t - 28, I * t)
6763
+ Math.min(t - 28, v * t)
6684
6764
  );
6685
- let w = this.pillEls.get(l);
6686
- w || (w = document.createElement("div"), Object.assign(w.style, {
6765
+ let y = this.pillEls.get(l);
6766
+ y || (y = document.createElement("div"), Object.assign(y.style, {
6687
6767
  position: "absolute",
6688
6768
  right: "8px",
6689
6769
  padding: "2px 6px",
@@ -6695,7 +6775,7 @@ class vs {
6695
6775
  whiteSpace: "nowrap",
6696
6776
  pointerEvents: "none",
6697
6777
  transition: "top 0.3s ease"
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);
6778
+ }), this.container.appendChild(y), this.pillEls.set(l, y)), y.style.display = "", y.style.background = u.user.color, y.style.top = `${$}px`, y.textContent = this.getInitials(u.user.name);
6699
6779
  }
6700
6780
  for (const [l, a] of this.pillEls)
6701
6781
  !o.has(l) && !this.client.state.viewports.has(l) && (a.remove(), this.pillEls.delete(l));
@@ -6704,17 +6784,17 @@ class vs {
6704
6784
  return e.split(" ").map((t) => t[0]).join("").toUpperCase().slice(0, 2);
6705
6785
  }
6706
6786
  }
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;
6787
+ var xs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, P = (s, e, t, i) => {
6788
+ for (var n = i > 1 ? void 0 : i ? ys(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6789
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6790
+ return i && n && xs(e, t, n), n;
6711
6791
  };
6712
- let E = class extends T {
6792
+ let _ = class extends S {
6713
6793
  constructor() {
6714
6794
  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 = () => {
6715
6795
  !this.settings.enabled || !this.client || this._isFollowScrolling || (this.followingUserId && (this.followingUserId = null), !this._viewportThrottleTimer && (this._viewportThrottleTimer = setTimeout(() => {
6716
- var n;
6717
- this._viewportThrottleTimer = null, (n = this.client) == null || n.updateViewport({
6796
+ var s;
6797
+ this._viewportThrottleTimer = null, (s = this.client) == null || s.updateViewport({
6718
6798
  scrollX: window.scrollX,
6719
6799
  scrollY: window.scrollY,
6720
6800
  viewportWidth: window.innerWidth,
@@ -6727,25 +6807,25 @@ let E = class extends T {
6727
6807
  !this.settings.enabled || !this.settings.showSelections || !this.client || this._selectionThrottleTimer || (this._selectionThrottleTimer = setTimeout(() => {
6728
6808
  var t, i;
6729
6809
  this._selectionThrottleTimer = null;
6730
- const n = window.getSelection();
6731
- if (!n || n.isCollapsed) {
6810
+ const s = window.getSelection();
6811
+ if (!s || s.isCollapsed) {
6732
6812
  (t = this.client) == null || t.updateSelection(null);
6733
6813
  return;
6734
6814
  }
6735
- const e = cs(n);
6815
+ const e = cs(s);
6736
6816
  (i = this.client) == null || i.updateSelection(e);
6737
6817
  }, 500));
6738
- }, this.handleDocumentClick = (n) => {
6818
+ }, this.handleDocumentClick = (s) => {
6739
6819
  var e;
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
6820
+ this.settings.enabled && this.settings.showMyClicks && (this.contains(s.target) || (e = this.client) == null || e.performClick({
6821
+ x: s.clientX,
6822
+ y: s.clientY,
6823
+ pageX: s.pageX,
6824
+ pageY: s.pageY
6745
6825
  }));
6746
- }, this.handleKeydown = (n) => {
6826
+ }, this.handleKeydown = (s) => {
6747
6827
  var e, t;
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));
6828
+ 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));
6749
6829
  };
6750
6830
  }
6751
6831
  connectedCallback() {
@@ -6758,13 +6838,13 @@ let E = class extends T {
6758
6838
  return `${this.apiKey}\0${this.token}\0${this.room}\0${this.endpoint ?? ""}`;
6759
6839
  }
6760
6840
  initClient() {
6761
- const n = {
6841
+ const s = {
6762
6842
  apiKey: this.apiKey,
6763
6843
  token: this.token,
6764
6844
  room: this.room,
6765
6845
  endpoint: this.endpoint
6766
6846
  };
6767
- this.client = new xt(n), this.clientConfigKey = this.getConfigKey(), this.cursorOverlay = new as(this.client), this.commentPins = new Ji(this.client, {
6847
+ this.client = new xt(s), this.clientConfigKey = this.getConfigKey(), this.cursorOverlay = new as(this.client), this.commentPins = new Ji(this.client, {
6768
6848
  onPinModeExit: () => {
6769
6849
  this.pinModeActive = !1;
6770
6850
  }
@@ -6798,15 +6878,15 @@ let E = class extends T {
6798
6878
  ), window.addEventListener("scroll", this.handleScroll), document.addEventListener("selectionchange", this.handleSelectionChange), this.client.connect();
6799
6879
  }
6800
6880
  teardownClient() {
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);
6881
+ var s, e, t, i, n, o;
6882
+ 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);
6803
6883
  }
6804
6884
  handlePanelClose() {
6805
6885
  this.activePanel = null, this.highlightThreadId = null;
6806
6886
  }
6807
- handleToolbarAction(n) {
6808
- var t, i, s, o;
6809
- const e = n.detail;
6887
+ handleToolbarAction(s) {
6888
+ var t, i, n, o;
6889
+ const e = s.detail;
6810
6890
  if (!(!this.settings.enabled && e !== "settings"))
6811
6891
  switch (e) {
6812
6892
  case "comments":
@@ -6825,70 +6905,70 @@ let E = class extends T {
6825
6905
  this.pinModeActive = !this.pinModeActive, this.pinModeActive ? (t = this.commentPins) == null || t.enterPinMode() : (i = this.commentPins) == null || i.exitPinMode();
6826
6906
  break;
6827
6907
  case "draw-mode":
6828
- this.drawModeActive = !this.drawModeActive, this.drawModeActive ? (s = this.drawingOverlay) == null || s.enableDrawMode() : (o = this.drawingOverlay) == null || o.disableDrawMode();
6908
+ this.drawModeActive = !this.drawModeActive, this.drawModeActive ? (n = this.drawingOverlay) == null || n.enableDrawMode() : (o = this.drawingOverlay) == null || o.disableDrawMode();
6829
6909
  break;
6830
6910
  }
6831
6911
  }
6832
- handleFollow(n) {
6833
- const e = n.detail;
6912
+ handleFollow(s) {
6913
+ const e = s.detail;
6834
6914
  this.followingUserId === e ? this.followingUserId = null : this.followingUserId = e;
6835
6915
  }
6836
- handleSettingsChange(n) {
6837
- const e = n.detail;
6916
+ handleSettingsChange(s) {
6917
+ const e = s.detail;
6838
6918
  this.settings = e, ms(this.room, e), this.applySettings(e);
6839
6919
  }
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;
6920
+ applySettings(s) {
6921
+ var e, t, i, n, o, r, l, a, c, p, d, f, u, g, v, $, y;
6922
+ if (!s.enabled) {
6923
+ (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;
6844
6924
  return;
6845
6925
  }
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));
6926
+ 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() : (f = this.viewportOverlay) == null || f.disable(), s.showSelections ? (u = this.selectionOverlay) == null || u.enable() : (g = this.selectionOverlay) == null || g.disable(), s.showDrawings ? (v = this.drawingOverlay) == null || v.enable() : (($ = this.drawingOverlay) == null || $.disable(), this.drawModeActive && ((y = this.drawingOverlay) == null || y.disableDrawMode(), this.drawModeActive = !1));
6847
6927
  }
6848
- applyCursorSettings(n) {
6928
+ applyCursorSettings(s) {
6849
6929
  if (!this.cursorOverlay) return;
6850
- n.showMyCursor || n.showOthersCursors ? (this.cursorOverlay.enable(), this.cursorOverlay.setSending(n.showMyCursor), this.cursorOverlay.setReceiving(n.showOthersCursors)) : this.cursorOverlay.disable();
6930
+ s.showMyCursor || s.showOthersCursors ? (this.cursorOverlay.enable(), this.cursorOverlay.setSending(s.showMyCursor), this.cursorOverlay.setReceiving(s.showOthersCursors)) : this.cursorOverlay.disable();
6851
6931
  }
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());
6932
+ updated(s) {
6933
+ (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());
6854
6934
  }
6855
6935
  /**
6856
6936
  * Smart-position all fixed popups (toolbar popover + panel) relative to
6857
6937
  * the trigger element, flipping vertically/horizontally as needed.
6858
6938
  */
6859
6939
  positionPopups() {
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;
6940
+ var g, v, $, y;
6941
+ const s = this.display === "inline", e = (g = this.shadowRoot) == null ? void 0 : g.querySelector(".inline-trigger"), t = (v = this.shadowRoot) == null ? void 0 : v.querySelector("pulse-widget-toolbar"), i = s ? e : t;
6862
6942
  if (!i) return;
6863
- const s = i.getBoundingClientRect(), o = window.innerWidth, r = window.innerHeight, l = 8, a = (C = this.shadowRoot) == null ? void 0 : C.querySelector(".toolbar-popover");
6943
+ const n = i.getBoundingClientRect(), o = window.innerWidth, r = window.innerHeight, l = 8, a = ($ = this.shadowRoot) == null ? void 0 : $.querySelector(".toolbar-popover");
6864
6944
  if (a) {
6865
6945
  Object.assign(a.style, { top: "auto", left: "auto" });
6866
- const $ = a.getBoundingClientRect(), P = this.computePosition(s, $, o, r, l);
6867
- a.style.top = `${P.top}px`, a.style.left = `${P.left}px`;
6946
+ const E = a.getBoundingClientRect(), A = this.computePosition(n, E, o, r, l);
6947
+ a.style.top = `${A.top}px`, a.style.left = `${A.left}px`;
6868
6948
  }
6869
- const c = (w = this.shadowRoot) == null ? void 0 : w.querySelector(".panel-container");
6949
+ const c = (y = this.shadowRoot) == null ? void 0 : y.querySelector(".panel-container");
6870
6950
  if (!c) return;
6871
6951
  Object.assign(c.style, { top: "auto", left: "auto" });
6872
6952
  const p = a ?? t;
6873
6953
  if (!p) return;
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`;
6954
+ const d = p.getBoundingClientRect(), f = c.getBoundingClientRect(), u = this.computePosition(d, f, o, r, l);
6955
+ c.style.top = `${u.top}px`, c.style.left = `${u.left}px`;
6876
6956
  }
6877
- computePosition(n, e, t, i, s) {
6878
- const o = n.top, r = i - n.bottom;
6957
+ computePosition(s, e, t, i, n) {
6958
+ const o = s.top, r = i - s.bottom;
6879
6959
  let l;
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;
6960
+ 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;
6881
6961
  let 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 };
6962
+ const c = s.right - e.width;
6963
+ 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 };
6884
6964
  }
6885
6965
  getFollowUserName() {
6886
6966
  var e;
6887
6967
  if (!this.followingUserId) return "";
6888
- const n = (e = this.client) == null ? void 0 : e.state.presence.find(
6968
+ const s = (e = this.client) == null ? void 0 : e.state.presence.find(
6889
6969
  (t) => t.user.id === this.followingUserId
6890
6970
  );
6891
- return (n == null ? void 0 : n.user.name) ?? "user";
6971
+ return (s == null ? void 0 : s.user.name) ?? "user";
6892
6972
  }
6893
6973
  renderConnectionBanner() {
6894
6974
  return this.showConnectedFlash ? h`<div class="connection-banner connected">
@@ -6897,14 +6977,14 @@ let E = class extends T {
6897
6977
  <span class="connection-dot"></span>Reconnecting...
6898
6978
  </div>` : this.connectionState === "disconnected" && this.client ? h`<div class="connection-banner disconnected">
6899
6979
  <span class="connection-dot"></span>Disconnected
6900
- </div>` : f;
6980
+ </div>` : m;
6901
6981
  }
6902
6982
  handleToolbarToggle() {
6903
6983
  this.collapsed = !this.collapsed, this.collapsed && (this.activePanel = null, this.highlightThreadId = null);
6904
6984
  }
6905
6985
  render() {
6906
- const n = this.display === "inline";
6907
- if (n && this.collapsed)
6986
+ const s = this.display === "inline";
6987
+ if (s && this.collapsed)
6908
6988
  return h`
6909
6989
  <div class="widget-root">
6910
6990
  <div class="inline-trigger" @click=${this.handleToolbarToggle}>
@@ -6917,26 +6997,26 @@ let E = class extends T {
6917
6997
  ${this.activePanel === "comments" ? h`<pulse-widget-comments-panel
6918
6998
  .client=${this.client}
6919
6999
  .highlightThreadId=${this.highlightThreadId}
6920
- ></pulse-widget-comments-panel>` : f}
7000
+ ></pulse-widget-comments-panel>` : m}
6921
7001
  ${this.activePanel === "settings" ? h`<pulse-widget-settings-panel
6922
7002
  .settings=${this.settings}
6923
7003
  .roomId=${this.room}
6924
7004
  @settings-change=${this.handleSettingsChange}
6925
- ></pulse-widget-settings-panel>` : f}
7005
+ ></pulse-widget-settings-panel>` : m}
6926
7006
  ${this.activePanel === "notifications" ? h`<pulse-widget-notifications-panel
6927
7007
  .client=${this.client}
6928
- ></pulse-widget-notifications-panel>` : f}
7008
+ ></pulse-widget-notifications-panel>` : m}
6929
7009
  ${this.activePanel === "activity" ? h`<pulse-widget-activity-panel
6930
7010
  .client=${this.client}
6931
- ></pulse-widget-activity-panel>` : f}
7011
+ ></pulse-widget-activity-panel>` : m}
6932
7012
  </div>
6933
- ` : f, t = this.followingUserId ? h`<div class="follow-banner">
7013
+ ` : m, t = this.followingUserId ? h`<div class="follow-banner">
6934
7014
  Following ${this.getFollowUserName()}
6935
7015
  <button @click=${() => {
6936
7016
  this.followingUserId = null;
6937
7017
  }}>Stop</button>
6938
- </div>` : f;
6939
- return n ? h`
7018
+ </div>` : m;
7019
+ return s ? h`
6940
7020
  ${t}
6941
7021
  <div class="widget-root">
6942
7022
  <div class="inline-trigger" @click=${this.handleToolbarToggle}>
@@ -6982,9 +7062,9 @@ let E = class extends T {
6982
7062
  `;
6983
7063
  }
6984
7064
  };
6985
- E.styles = [
7065
+ _.styles = [
6986
7066
  ee,
6987
- A`
7067
+ I`
6988
7068
  :host {
6989
7069
  display: block;
6990
7070
  }
@@ -7160,54 +7240,54 @@ E.styles = [
7160
7240
  }
7161
7241
  `
7162
7242
  ];
7163
- S([
7164
- g({ attribute: "api-key" })
7165
- ], E.prototype, "apiKey", 2);
7166
- S([
7167
- g()
7168
- ], E.prototype, "token", 2);
7169
- S([
7170
- g()
7171
- ], E.prototype, "room", 2);
7172
- S([
7173
- g()
7174
- ], E.prototype, "endpoint", 2);
7175
- S([
7176
- g({ reflect: !0 })
7177
- ], E.prototype, "position", 2);
7178
- S([
7179
- g({ reflect: !0 })
7180
- ], E.prototype, "display", 2);
7181
- S([
7182
- v()
7183
- ], E.prototype, "collapsed", 2);
7184
- S([
7185
- v()
7186
- ], E.prototype, "activePanel", 2);
7187
- S([
7188
- v()
7189
- ], E.prototype, "pinModeActive", 2);
7190
- S([
7191
- v()
7192
- ], E.prototype, "highlightThreadId", 2);
7193
- S([
7194
- v()
7195
- ], E.prototype, "settings", 2);
7196
- S([
7197
- v()
7198
- ], E.prototype, "followingUserId", 2);
7199
- S([
7200
- v()
7201
- ], E.prototype, "drawModeActive", 2);
7202
- S([
7203
- v()
7204
- ], E.prototype, "connectionState", 2);
7205
- S([
7206
- v()
7207
- ], E.prototype, "showConnectedFlash", 2);
7208
- E = S([
7243
+ P([
7244
+ b({ attribute: "api-key" })
7245
+ ], _.prototype, "apiKey", 2);
7246
+ P([
7247
+ b()
7248
+ ], _.prototype, "token", 2);
7249
+ P([
7250
+ b()
7251
+ ], _.prototype, "room", 2);
7252
+ P([
7253
+ b()
7254
+ ], _.prototype, "endpoint", 2);
7255
+ P([
7256
+ b({ reflect: !0 })
7257
+ ], _.prototype, "position", 2);
7258
+ P([
7259
+ b({ reflect: !0 })
7260
+ ], _.prototype, "display", 2);
7261
+ P([
7262
+ x()
7263
+ ], _.prototype, "collapsed", 2);
7264
+ P([
7265
+ x()
7266
+ ], _.prototype, "activePanel", 2);
7267
+ P([
7268
+ x()
7269
+ ], _.prototype, "pinModeActive", 2);
7270
+ P([
7271
+ x()
7272
+ ], _.prototype, "highlightThreadId", 2);
7273
+ P([
7274
+ x()
7275
+ ], _.prototype, "settings", 2);
7276
+ P([
7277
+ x()
7278
+ ], _.prototype, "followingUserId", 2);
7279
+ P([
7280
+ x()
7281
+ ], _.prototype, "drawModeActive", 2);
7282
+ P([
7283
+ x()
7284
+ ], _.prototype, "connectionState", 2);
7285
+ P([
7286
+ x()
7287
+ ], _.prototype, "showConnectedFlash", 2);
7288
+ _ = P([
7209
7289
  R("pulse-widget")
7210
- ], E);
7290
+ ], _);
7211
7291
  export {
7212
7292
  W as PulseComments,
7213
7293
  le as PulseCursors,
@@ -7215,5 +7295,5 @@ export {
7215
7295
  G as PulsePresence,
7216
7296
  q as PulseProvider,
7217
7297
  D as PulseReactions,
7218
- E as PulseWidget
7298
+ _ as PulseWidget
7219
7299
  };