@gamention/pulse-elements 0.1.11 → 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.
@@ -157,11 +157,11 @@ function pe({ context: s, subscribe: e }) {
157
157
  }));
158
158
  };
159
159
  }
160
- var Ot = Object.defineProperty, Rt = (s, e, t) => e in s ? Ot(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, x = (s, e, t) => Rt(s, 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());
@@ -181,7 +181,7 @@ let je = class {
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;
@@ -218,11 +218,21 @@ let je = class {
218
218
  }
219
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;
225
225
  }
226
+ /** Optimistically remove a comment from local state (before server round-trip). */
227
+ removeComment(e) {
228
+ for (const [t, i] of this._threads) {
229
+ const 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
+ return;
233
+ }
234
+ }
235
+ }
226
236
  get presence() {
227
237
  return [...this._presence.values()];
228
238
  }
@@ -419,7 +429,7 @@ let je = class {
419
429
  }, xt = class extends je {
420
430
  constructor(e) {
421
431
  var t;
422
- super(), x(this, "state"), x(this, "connection"), x(this, "config"), x(this, "heartbeatTimer", null), x(this, "lastCursorSend", 0), x(this, "pendingCursor", null), x(this, "cursorTimer", null), this.config = e, this.state = new zt(), 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(/\/$/, "");
423
433
  const i = ((t = e.endpoint) == null ? void 0 : t.replace(/^http/, "ws")) ?? void 0;
424
434
  this.connection = new jt(i), this.connection.on("message", (n) => {
425
435
  this.state.handleMessage(n), this.emit(n.type, n);
@@ -490,7 +500,7 @@ let je = class {
490
500
  this.send({ type: "comment:edit", commentId: e, body: t, mentions: i });
491
501
  }
492
502
  deleteComment(e) {
493
- this.send({ type: "comment:delete", commentId: e });
503
+ this.state.removeComment(e), this.send({ type: "comment:delete", commentId: e });
494
504
  }
495
505
  resolveThread(e, t = !0) {
496
506
  this.send({ type: "thread:resolve", threadId: e, resolved: t });
@@ -584,7 +594,7 @@ let yt = class {
584
594
  return this.cssText;
585
595
  }
586
596
  };
587
- const Ut = (s) => new yt(typeof s == "string" ? s : s + "", void 0, Ue), A = (s, ...e) => {
597
+ const Ut = (s) => new yt(typeof s == "string" ? s : s + "", void 0, Ue), I = (s, ...e) => {
588
598
  const t = s.length === 1 ? s[0] : e.reduce((i, n, o) => i + ((r) => {
589
599
  if (r._$cssResult$ === !0) return r.cssText;
590
600
  if (typeof r == "number") return r;
@@ -607,7 +617,7 @@ const Ut = (s) => new yt(typeof s == "string" ? s : s + "", void 0, Ue), A = (s,
607
617
  * Copyright 2017 Google LLC
608
618
  * SPDX-License-Identifier: BSD-3-Clause
609
619
  */
610
- const { is: Ht, defineProperty: Nt, getOwnPropertyDescriptor: Bt, getOwnPropertyNames: Ft, getOwnPropertySymbols: Vt, getPrototypeOf: qt } = Object, U = globalThis, Ge = U.trustedTypes, Wt = Ge ? Ge.emptyScript : "", Te = U.reactiveElementPolyfillSupport, ie = (s, e) => s, we = { toAttribute(s, e) {
620
+ const { is: Ht, defineProperty: 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) {
611
621
  switch (e) {
612
622
  case Boolean:
613
623
  s = s ? Wt : null;
@@ -647,11 +657,11 @@ let Y = class extends HTMLElement {
647
657
  static createProperty(e, t = Ze) {
648
658
  if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
649
659
  const i = Symbol(), n = this.getPropertyDescriptor(e, i, t);
650
- n !== void 0 && Nt(this.prototype, e, n);
660
+ n !== void 0 && Bt(this.prototype, e, n);
651
661
  }
652
662
  }
653
663
  static getPropertyDescriptor(e, t, i) {
654
- const { get: n, set: o } = Bt(this.prototype, e) ?? { get() {
664
+ const { get: n, set: o } = Nt(this.prototype, e) ?? { get() {
655
665
  return this[t];
656
666
  }, set(r) {
657
667
  this[t] = r;
@@ -848,7 +858,7 @@ Y.elementStyles = [], Y.shadowRootOptions = { mode: "open" }, Y[ie("elementPrope
848
858
  */
849
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 = `[
850
860
  \f\r]`, te = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, et = /-->/g, tt = />/g, H = RegExp(`>|${Se}(?:([^\\s"'>=/]+)(${Se}*=${Se}*(?:[^
851
- \f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, st = /"/g, kt = /^(?:script|style|textarea|title)$/i, Et = (s) => (e, ...t) => ({ _$litType$: s, 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);
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);
852
862
  function Ct(s, e) {
853
863
  if (!He(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
854
864
  return Qe !== void 0 ? Qe.createHTML(e) : e;
@@ -858,10 +868,10 @@ const Gt = (s, e) => {
858
868
  let n, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = te;
859
869
  for (let l = 0; l < t; l++) {
860
870
  const a = s[l];
861
- let c, p, d = -1, u = 0;
862
- for (; u < a.length && (r.lastIndex = u, p = r.exec(a), p !== null); ) u = r.lastIndex, r === te ? p[1] === "!--" ? r = et : p[1] !== void 0 ? r = tt : p[2] !== void 0 ? (kt.test(p[2]) && (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);
863
- const m = r === H && s[l + 1].startsWith("/>") ? " " : "";
864
- o += r === te ? a + Xt : d >= 0 ? (i.push(c), a.slice(0, d) + wt + a.slice(d) + z + m) : a + z + (d === -2 ? l : m);
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);
865
875
  }
866
876
  return [Ct(s, o + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
867
877
  };
@@ -871,22 +881,22 @@ class ae {
871
881
  this.parts = [];
872
882
  let o = 0, r = 0;
873
883
  const l = e.length - 1, a = this.parts, [c, p] = Gt(e, t);
874
- 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) {
875
885
  const d = this.el.content.firstChild;
876
886
  d.replaceWith(...d.childNodes);
877
887
  }
878
- for (; (n = N.nextNode()) !== null && a.length < l; ) {
888
+ for (; (n = B.nextNode()) !== null && a.length < l; ) {
879
889
  if (n.nodeType === 1) {
880
890
  if (n.hasAttributes()) for (const d of n.getAttributeNames()) if (d.endsWith(wt)) {
881
- const u = p[r++], m = n.getAttribute(d).split(z), b = /([.?@])?(.*)/.exec(u);
882
- a.push({ type: 1, index: o, name: b[2], strings: m, ctor: b[1] === "." ? Jt : b[1] === "?" ? Qt : b[1] === "@" ? ei : Ee }), n.removeAttribute(d);
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);
883
893
  } else d.startsWith(z) && (a.push({ type: 6, index: o }), n.removeAttribute(d));
884
894
  if (kt.test(n.tagName)) {
885
- const d = n.textContent.split(z), u = d.length - 1;
886
- if (u > 0) {
895
+ const d = n.textContent.split(z), f = d.length - 1;
896
+ if (f > 0) {
887
897
  n.textContent = $e ? $e.emptyScript : "";
888
- for (let m = 0; m < u; m++) n.append(d[m], oe()), N.nextNode(), a.push({ type: 2, index: ++o });
889
- n.append(d[u], oe());
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());
890
900
  }
891
901
  }
892
902
  } else if (n.nodeType === 8) if (n.data === $t) a.push({ type: 2, index: o });
@@ -921,16 +931,16 @@ class Zt {
921
931
  }
922
932
  u(e) {
923
933
  const { el: { content: t }, parts: i } = this._$AD, n = ((e == null ? void 0 : e.creationScope) ?? F).importNode(t, !0);
924
- N.currentNode = n;
925
- let o = N.nextNode(), r = 0, l = 0, a = i[0];
934
+ B.currentNode = n;
935
+ let o = B.nextNode(), r = 0, l = 0, a = i[0];
926
936
  for (; a !== void 0; ) {
927
937
  if (r === a.index) {
928
938
  let c;
929
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];
930
940
  }
931
- r !== (a == null ? void 0 : a.index) && (o = N.nextNode(), r++);
941
+ r !== (a == null ? void 0 : a.index) && (o = B.nextNode(), r++);
932
942
  }
933
- return N.currentNode = F, n;
943
+ return B.currentNode = F, n;
934
944
  }
935
945
  p(e) {
936
946
  let t = 0;
@@ -943,7 +953,7 @@ class ue {
943
953
  return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
944
954
  }
945
955
  constructor(e, t, i, n) {
946
- this.type = 2, this._$AH = f, 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;
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;
947
957
  }
948
958
  get parentNode() {
949
959
  let e = this._$AA.parentNode;
@@ -957,7 +967,7 @@ class ue {
957
967
  return this._$AB;
958
968
  }
959
969
  _$AI(e, t = this) {
960
- 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);
961
971
  }
962
972
  O(e) {
963
973
  return this._$AA.parentNode.insertBefore(e, this._$AB);
@@ -966,7 +976,7 @@ class ue {
966
976
  this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
967
977
  }
968
978
  _(e) {
969
- 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;
970
980
  }
971
981
  $(e) {
972
982
  var o;
@@ -1008,7 +1018,7 @@ class Ee {
1008
1018
  return this._$AM._$AU;
1009
1019
  }
1010
1020
  constructor(e, t, i, n, o) {
1011
- this.type = 1, this._$AH = f, 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 = f;
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;
1012
1022
  }
1013
1023
  _$AI(e, t = this, i, n) {
1014
1024
  const o = this.strings;
@@ -1017,12 +1027,12 @@ class Ee {
1017
1027
  else {
1018
1028
  const l = e;
1019
1029
  let a, c;
1020
- 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;
1021
1031
  }
1022
1032
  r && !n && this.j(e);
1023
1033
  }
1024
1034
  j(e) {
1025
- 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 ?? "");
1026
1036
  }
1027
1037
  }
1028
1038
  class Jt extends Ee {
@@ -1030,7 +1040,7 @@ class Jt extends Ee {
1030
1040
  super(...arguments), this.type = 3;
1031
1041
  }
1032
1042
  j(e) {
1033
- this.element[this.name] = e === f ? void 0 : e;
1043
+ this.element[this.name] = e === m ? void 0 : e;
1034
1044
  }
1035
1045
  }
1036
1046
  class Qt extends Ee {
@@ -1038,7 +1048,7 @@ class Qt extends Ee {
1038
1048
  super(...arguments), this.type = 4;
1039
1049
  }
1040
1050
  j(e) {
1041
- this.element.toggleAttribute(this.name, !!e && e !== f);
1051
+ this.element.toggleAttribute(this.name, !!e && e !== m);
1042
1052
  }
1043
1053
  }
1044
1054
  class ei extends Ee {
@@ -1046,8 +1056,8 @@ class ei extends Ee {
1046
1056
  super(e, t, i, n, o), this.type = 5;
1047
1057
  }
1048
1058
  _$AI(e, t = this) {
1049
- if ((e = K(this, e, t, 0) ?? f) === V) return;
1050
- const i = this._$AH, n = e === f && i !== f || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, o = e !== f && (i === f || n);
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);
1051
1061
  n && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
1052
1062
  }
1053
1063
  handleEvent(e) {
@@ -1082,8 +1092,8 @@ const ii = (s, e, t) => {
1082
1092
  * Copyright 2017 Google LLC
1083
1093
  * SPDX-License-Identifier: BSD-3-Clause
1084
1094
  */
1085
- const B = globalThis;
1086
- let T = class extends Y {
1095
+ const N = globalThis;
1096
+ let S = class extends Y {
1087
1097
  constructor() {
1088
1098
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
1089
1099
  }
@@ -1109,10 +1119,10 @@ let T = class extends Y {
1109
1119
  }
1110
1120
  };
1111
1121
  var bt;
1112
- T._$litElement$ = !0, T.finalized = !0, (bt = B.litElementHydrateSupport) == null || bt.call(B, { LitElement: T });
1113
- const Ae = B.litElementPolyfillSupport;
1114
- Ae == null || Ae({ LitElement: T });
1115
- (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");
1116
1126
  /**
1117
1127
  * @license
1118
1128
  * Copyright 2017 Google LLC
@@ -1149,7 +1159,7 @@ const si = { attribute: !0, type: String, converter: we, reflect: !1, hasChanged
1149
1159
  }
1150
1160
  throw Error("Unsupported decorator location: " + i);
1151
1161
  };
1152
- function g(s) {
1162
+ function b(s) {
1153
1163
  return (e, t) => typeof t == "object" ? ni(s, e, t) : ((i, n, o) => {
1154
1164
  const r = n.hasOwnProperty(o);
1155
1165
  return n.constructor.createProperty(o, i), r ? Object.getOwnPropertyDescriptor(n, o) : void 0;
@@ -1160,8 +1170,8 @@ function g(s) {
1160
1170
  * Copyright 2017 Google LLC
1161
1171
  * SPDX-License-Identifier: BSD-3-Clause
1162
1172
  */
1163
- function v(s) {
1164
- return g({ ...s, state: !0, attribute: !1 });
1173
+ function x(s) {
1174
+ return b({ ...s, state: !0, attribute: !1 });
1165
1175
  }
1166
1176
  const Z = "pulse-client";
1167
1177
  var oi = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, J = (s, e, t, i) => {
@@ -1169,7 +1179,7 @@ var oi = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, J = (s, e,
1169
1179
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1170
1180
  return i && n && oi(e, t, n), n;
1171
1181
  };
1172
- let q = class extends T {
1182
+ let q = class extends S {
1173
1183
  constructor() {
1174
1184
  super(...arguments), this.apiKey = "", this.token = "", this.room = "";
1175
1185
  }
@@ -1192,16 +1202,16 @@ let q = class extends T {
1192
1202
  }
1193
1203
  };
1194
1204
  J([
1195
- g({ attribute: "api-key" })
1205
+ b({ attribute: "api-key" })
1196
1206
  ], q.prototype, "apiKey", 2);
1197
1207
  J([
1198
- g()
1208
+ b()
1199
1209
  ], q.prototype, "token", 2);
1200
1210
  J([
1201
- g()
1211
+ b()
1202
1212
  ], q.prototype, "room", 2);
1203
1213
  J([
1204
- g()
1214
+ b()
1205
1215
  ], q.prototype, "endpoint", 2);
1206
1216
  J([
1207
1217
  Mt({ context: Z })
@@ -1214,7 +1224,7 @@ var ai = Object.defineProperty, li = Object.getOwnPropertyDescriptor, Ce = (s, e
1214
1224
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1215
1225
  return i && n && ai(e, t, n), n;
1216
1226
  };
1217
- let G = class extends T {
1227
+ let G = class extends S {
1218
1228
  constructor() {
1219
1229
  super(...arguments), this.maxVisible = 5, this.users = [];
1220
1230
  }
@@ -1258,7 +1268,7 @@ let G = class extends T {
1258
1268
  `;
1259
1269
  }
1260
1270
  };
1261
- G.styles = A`
1271
+ G.styles = I`
1262
1272
  :host {
1263
1273
  display: inline-flex;
1264
1274
  align-items: center;
@@ -1364,23 +1374,23 @@ G.styles = A`
1364
1374
  `;
1365
1375
  Ce([
1366
1376
  pe({ context: Z, subscribe: !0 }),
1367
- g({ attribute: !1 })
1377
+ b({ attribute: !1 })
1368
1378
  ], G.prototype, "client", 2);
1369
1379
  Ce([
1370
- g({ type: Number, attribute: "max-visible" })
1380
+ b({ type: Number, attribute: "max-visible" })
1371
1381
  ], G.prototype, "maxVisible", 2);
1372
1382
  Ce([
1373
- v()
1383
+ x()
1374
1384
  ], G.prototype, "users", 2);
1375
1385
  G = Ce([
1376
1386
  R("pulse-presence")
1377
1387
  ], G);
1378
- var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, Ne = (s, e, t, i) => {
1388
+ var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, Be = (s, e, t, i) => {
1379
1389
  for (var n = i > 1 ? void 0 : i ? di(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1380
1390
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1381
1391
  return i && n && ci(e, t, n), n;
1382
1392
  };
1383
- let le = class extends T {
1393
+ let le = class extends S {
1384
1394
  constructor() {
1385
1395
  super(...arguments), this.cursors = /* @__PURE__ */ new Map(), this.unsubs = [], this.handleLocalCursor = (s) => {
1386
1396
  var e;
@@ -1457,7 +1467,7 @@ let le = class extends T {
1457
1467
  `;
1458
1468
  }
1459
1469
  };
1460
- le.styles = A`
1470
+ le.styles = I`
1461
1471
  :host {
1462
1472
  position: fixed;
1463
1473
  top: 0;
@@ -1494,14 +1504,14 @@ le.styles = A`
1494
1504
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
1495
1505
  }
1496
1506
  `;
1497
- Ne([
1507
+ Be([
1498
1508
  pe({ context: Z, subscribe: !0 }),
1499
- g({ attribute: !1 })
1509
+ b({ attribute: !1 })
1500
1510
  ], le.prototype, "client", 2);
1501
- Ne([
1502
- v()
1511
+ Be([
1512
+ x()
1503
1513
  ], le.prototype, "cursors", 2);
1504
- le = Ne([
1514
+ le = Be([
1505
1515
  R("pulse-cursors")
1506
1516
  ], le);
1507
1517
  var hi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fe = (s, e, t, i) => {
@@ -1509,7 +1519,7 @@ var hi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fe = (s, e
1509
1519
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1510
1520
  return i && n && hi(e, t, n), n;
1511
1521
  };
1512
- let W = class extends T {
1522
+ let W = class extends S {
1513
1523
  constructor() {
1514
1524
  super(...arguments), this.showResolved = !1, this.threads = [], this.replyingTo = null;
1515
1525
  }
@@ -1578,7 +1588,7 @@ let W = class extends T {
1578
1588
  ${s.comments.map((e, t) => {
1579
1589
  const i = this.getUserForComment(e.userId);
1580
1590
  return h`
1581
- ${t > 0 ? h`<div class="divider"></div>` : f}
1591
+ ${t > 0 ? h`<div class="divider"></div>` : m}
1582
1592
  <div class="comment">
1583
1593
  <div class="comment-header">
1584
1594
  <div
@@ -1615,7 +1625,7 @@ let W = class extends T {
1615
1625
  <input type="text" placeholder="Write a reply..." />
1616
1626
  <button type="submit">Send</button>
1617
1627
  </form>
1618
- ` : f}
1628
+ ` : m}
1619
1629
  </div>
1620
1630
  `;
1621
1631
  }
@@ -1627,7 +1637,7 @@ let W = class extends T {
1627
1637
  return o < 24 ? `${o}h ago` : e.toLocaleDateString();
1628
1638
  }
1629
1639
  };
1630
- W.styles = A`
1640
+ W.styles = I`
1631
1641
  :host {
1632
1642
  display: block;
1633
1643
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -1841,21 +1851,21 @@ W.styles = A`
1841
1851
  `;
1842
1852
  fe([
1843
1853
  pe({ context: Z, subscribe: !0 }),
1844
- g({ attribute: !1 })
1854
+ b({ attribute: !1 })
1845
1855
  ], W.prototype, "client", 2);
1846
1856
  fe([
1847
- g({ type: Boolean, attribute: "show-resolved" })
1857
+ b({ type: Boolean, attribute: "show-resolved" })
1848
1858
  ], W.prototype, "showResolved", 2);
1849
1859
  fe([
1850
- v()
1860
+ x()
1851
1861
  ], W.prototype, "threads", 2);
1852
1862
  fe([
1853
- v()
1863
+ x()
1854
1864
  ], W.prototype, "replyingTo", 2);
1855
1865
  W = fe([
1856
1866
  R("pulse-comments")
1857
1867
  ], W);
1858
- var ui = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, Be = (s, e, t, i) => {
1868
+ var ui = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, Ne = (s, e, t, i) => {
1859
1869
  for (var n = i > 1 ? void 0 : i ? fi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1860
1870
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1861
1871
  return i && n && ui(e, t, n), n;
@@ -1873,7 +1883,7 @@ const mi = {
1873
1883
  "thread:resolved": "✅",
1874
1884
  "reaction:added": "🎉"
1875
1885
  };
1876
- let ce = class extends T {
1886
+ let ce = class extends S {
1877
1887
  constructor() {
1878
1888
  super(...arguments), this.notifications = [];
1879
1889
  }
@@ -1924,11 +1934,11 @@ let ce = class extends T {
1924
1934
  <div class="header">
1925
1935
  <span class="title">
1926
1936
  Notifications
1927
- ${s > 0 ? h`<span class="badge">${s}</span>` : f}
1937
+ ${s > 0 ? h`<span class="badge">${s}</span>` : m}
1928
1938
  </span>
1929
1939
  ${s > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
1930
1940
  Mark all read
1931
- </button>` : f}
1941
+ </button>` : m}
1932
1942
  </div>
1933
1943
  <div class="list">
1934
1944
  ${this.notifications.length === 0 ? h`<div class="empty">
@@ -1956,7 +1966,7 @@ let ce = class extends T {
1956
1966
  `;
1957
1967
  }
1958
1968
  };
1959
- ce.styles = A`
1969
+ ce.styles = I`
1960
1970
  :host {
1961
1971
  display: block;
1962
1972
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -2097,14 +2107,14 @@ ce.styles = A`
2097
2107
  opacity: 0.4;
2098
2108
  }
2099
2109
  `;
2100
- Be([
2110
+ Ne([
2101
2111
  pe({ context: Z, subscribe: !0 }),
2102
- g({ attribute: !1 })
2112
+ b({ attribute: !1 })
2103
2113
  ], ce.prototype, "client", 2);
2104
- Be([
2105
- v()
2114
+ Ne([
2115
+ x()
2106
2116
  ], ce.prototype, "notifications", 2);
2107
- ce = Be([
2117
+ ce = Ne([
2108
2118
  R("pulse-notifications")
2109
2119
  ], ce);
2110
2120
  var bi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Q = (s, e, t, i) => {
@@ -2113,7 +2123,7 @@ var bi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Q = (s, e,
2113
2123
  return i && n && bi(e, t, n), n;
2114
2124
  };
2115
2125
  const xi = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
2116
- let D = class extends T {
2126
+ let D = class extends S {
2117
2127
  constructor() {
2118
2128
  super(...arguments), this.targetId = "", this.targetType = "comment", this.reactions = [], this.showPicker = !1;
2119
2129
  }
@@ -2182,12 +2192,12 @@ let D = class extends T {
2182
2192
  `
2183
2193
  )}
2184
2194
  </div>
2185
- ` : f}
2195
+ ` : m}
2186
2196
  </div>
2187
2197
  `;
2188
2198
  }
2189
2199
  };
2190
- D.styles = A`
2200
+ D.styles = I`
2191
2201
  :host {
2192
2202
  display: inline-flex;
2193
2203
  align-items: center;
@@ -2301,19 +2311,19 @@ D.styles = A`
2301
2311
  `;
2302
2312
  Q([
2303
2313
  pe({ context: Z, subscribe: !0 }),
2304
- g({ attribute: !1 })
2314
+ b({ attribute: !1 })
2305
2315
  ], D.prototype, "client", 2);
2306
2316
  Q([
2307
- g({ attribute: "target-id" })
2317
+ b({ attribute: "target-id" })
2308
2318
  ], D.prototype, "targetId", 2);
2309
2319
  Q([
2310
- g({ attribute: "target-type" })
2320
+ b({ attribute: "target-type" })
2311
2321
  ], D.prototype, "targetType", 2);
2312
2322
  Q([
2313
- v()
2323
+ x()
2314
2324
  ], D.prototype, "reactions", 2);
2315
2325
  Q([
2316
- v()
2326
+ x()
2317
2327
  ], D.prototype, "showPicker", 2);
2318
2328
  D = Q([
2319
2329
  R("pulse-reactions")
@@ -2347,10 +2357,10 @@ class $i {
2347
2357
  */
2348
2358
  class Ie extends $i {
2349
2359
  constructor(e) {
2350
- 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");
2351
2361
  }
2352
2362
  render(e) {
2353
- 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;
2354
2364
  if (e === V) return e;
2355
2365
  if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
2356
2366
  if (e === this.it) return this._t;
@@ -2553,7 +2563,7 @@ function Li(s) {
2553
2563
  return `<${e} ${i}/>`;
2554
2564
  }).join("");
2555
2565
  }
2556
- function k(s, e = 18) {
2566
+ function C(s, e = 18) {
2557
2567
  return Kt`<svg
2558
2568
  xmlns="http://www.w3.org/2000/svg"
2559
2569
  width="${e}"
@@ -2566,7 +2576,7 @@ function k(s, e = 18) {
2566
2576
  stroke-linejoin="round"
2567
2577
  >${ki(Li(s))}</svg>`;
2568
2578
  }
2569
- const ee = A`
2579
+ const ee = I`
2570
2580
  * {
2571
2581
  box-sizing: border-box;
2572
2582
  margin: 0;
@@ -2609,7 +2619,7 @@ const ee = A`
2609
2619
  --pw-shadow: var(--pulse-shadow);
2610
2620
  --pw-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
2611
2621
  }
2612
- `, ge = A`
2622
+ `, ge = I`
2613
2623
  .pw-btn {
2614
2624
  display: inline-flex;
2615
2625
  align-items: center;
@@ -2653,7 +2663,7 @@ const ee = A`
2653
2663
  width: 18px;
2654
2664
  height: 18px;
2655
2665
  }
2656
- `, _e = A`
2666
+ `, _e = I`
2657
2667
  .pw-scrollable::-webkit-scrollbar {
2658
2668
  width: 4px;
2659
2669
  }
@@ -2670,7 +2680,7 @@ var ji = Object.defineProperty, zi = Object.getOwnPropertyDescriptor, Fe = (s, e
2670
2680
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
2671
2681
  return i && n && ji(e, t, n), n;
2672
2682
  };
2673
- let X = class extends T {
2683
+ let X = class extends S {
2674
2684
  constructor() {
2675
2685
  super(...arguments), this.items = [], this.unsubs = [], this.counter = 0;
2676
2686
  }
@@ -2721,7 +2731,7 @@ let X = class extends T {
2721
2731
  <div class="panel-header">
2722
2732
  <span class="panel-title">Activity</span>
2723
2733
  <button class="close-btn" @click=${this.fireClose} title="Close">
2724
- ${k(me, 16)}
2734
+ ${C(me, 16)}
2725
2735
  </button>
2726
2736
  </div>
2727
2737
 
@@ -2756,7 +2766,7 @@ X.styles = [
2756
2766
  ee,
2757
2767
  ge,
2758
2768
  _e,
2759
- A`
2769
+ I`
2760
2770
  :host {
2761
2771
  display: block;
2762
2772
  }
@@ -2882,15 +2892,15 @@ X.TYPE_COLORS = {
2882
2892
  resolve: "#22c55e"
2883
2893
  };
2884
2894
  Fe([
2885
- g({ attribute: !1 })
2895
+ b({ attribute: !1 })
2886
2896
  ], X.prototype, "client", 2);
2887
2897
  Fe([
2888
- v()
2898
+ x()
2889
2899
  ], X.prototype, "items", 2);
2890
2900
  X = Fe([
2891
2901
  R("pulse-widget-activity-panel")
2892
2902
  ], X);
2893
- const Ui = "-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 }, (s, e) => 0.2 + Math.abs(Math.sin(e * 12.9898 + 78.233) * 43758.5453) % 1 * 0.8);
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);
2894
2904
  function lt(s) {
2895
2905
  const e = Math.max(0, Math.floor(s)), t = Math.floor(e / 60), i = e % 60;
2896
2906
  return `${t}:${i.toString().padStart(2, "0")}`;
@@ -2960,8 +2970,8 @@ class Oe {
2960
2970
  </svg>`;
2961
2971
  }
2962
2972
  p(), a.appendChild(c);
2963
- const u = document.createElement("div");
2964
- Object.assign(u.style, {
2973
+ const f = document.createElement("div");
2974
+ Object.assign(f.style, {
2965
2975
  flex: "1",
2966
2976
  display: "flex",
2967
2977
  flexDirection: "column",
@@ -2969,50 +2979,50 @@ class Oe {
2969
2979
  overflow: "hidden",
2970
2980
  minWidth: "0"
2971
2981
  });
2972
- const m = document.createElement("div");
2973
- Object.assign(m.style, {
2982
+ const u = document.createElement("div");
2983
+ Object.assign(u.style, {
2974
2984
  display: "flex",
2975
2985
  alignItems: "center",
2976
2986
  gap: "1.5px",
2977
2987
  height: "22px",
2978
2988
  cursor: "pointer"
2979
2989
  });
2980
- const b = [];
2981
- for (let $ = 0; $ < xe; $++) {
2982
- const P = document.createElement("div"), y = Math.round(Ni[$] * 20);
2983
- 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, {
2984
2994
  flex: "1",
2985
- height: `${Math.max(3, y)}px`,
2995
+ height: `${Math.max(3, k)}px`,
2986
2996
  borderRadius: "1px",
2987
2997
  background: rt,
2988
2998
  transition: "background 0.1s ease",
2989
2999
  minWidth: "0"
2990
- }), b.push(P), m.appendChild(P);
3000
+ }), g.push(A), u.appendChild(A);
2991
3001
  }
2992
- const I = document.createElement("div");
2993
- Object.assign(I.style, {
3002
+ const v = document.createElement("div");
3003
+ Object.assign(v.style, {
2994
3004
  fontSize: "10px",
2995
3005
  color: at,
2996
3006
  whiteSpace: "nowrap",
2997
3007
  lineHeight: "1"
2998
3008
  });
2999
- function C() {
3000
- const $ = lt(o), P = lt(n);
3001
- I.textContent = `${$} / ${P}`;
3009
+ function $() {
3010
+ const E = lt(o), A = lt(n);
3011
+ v.textContent = `${E} / ${A}`;
3002
3012
  }
3003
- C(), u.appendChild(m), u.appendChild(I), l.appendChild(a), l.appendChild(u);
3004
- function w() {
3005
- const $ = n > 0 ? o / n : 0, P = Math.floor($ * xe);
3006
- for (let y = 0; y < xe; y++)
3007
- b[y].style.background = y <= P ? ot : rt;
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;
3008
3018
  }
3009
- return m.addEventListener("click", ($) => {
3019
+ return u.addEventListener("click", (E) => {
3010
3020
  if (n <= 0) return;
3011
- const P = m.getBoundingClientRect(), y = Math.min(
3021
+ const A = u.getBoundingClientRect(), k = Math.min(
3012
3022
  1,
3013
- Math.max(0, ($.clientX - P.left) / P.width)
3023
+ Math.max(0, (E.clientX - A.left) / A.width)
3014
3024
  );
3015
- r.currentTime = y * n, o = r.currentTime, w(), C();
3025
+ r.currentTime = k * n, o = r.currentTime, y(), $();
3016
3026
  }), a.addEventListener("click", () => {
3017
3027
  i ? r.pause() : r.play().catch(() => {
3018
3028
  });
@@ -3021,13 +3031,13 @@ class Oe {
3021
3031
  }), r.addEventListener("pause", () => {
3022
3032
  i = !1, p();
3023
3033
  }), r.addEventListener("ended", () => {
3024
- i = !1, p(), o = 0, w(), C();
3034
+ i = !1, p(), o = 0, y(), $();
3025
3035
  }), r.addEventListener("timeupdate", () => {
3026
- o = r.currentTime, w(), C();
3036
+ o = r.currentTime, y(), $();
3027
3037
  }), r.addEventListener("loadedmetadata", () => {
3028
- r.duration && isFinite(r.duration) && (n = r.duration, C());
3038
+ r.duration && isFinite(r.duration) && (n = r.duration, $());
3029
3039
  }), r.addEventListener("durationchange", () => {
3030
- r.duration && isFinite(r.duration) && (n = r.duration, C());
3040
+ r.duration && isFinite(r.duration) && (n = r.duration, $());
3031
3041
  }), l;
3032
3042
  }
3033
3043
  }
@@ -3162,8 +3172,8 @@ class Re {
3162
3172
  this.analyser.getByteFrequencyData(o), e.clearRect(0, 0, t, i);
3163
3173
  const r = n, l = Math.max(2, t / r * 0.7), a = (t - l * r) / (r - 1 || 1);
3164
3174
  for (let c = 0; c < r; c++) {
3165
- const p = o[c] / 255, d = Math.max(2, p * i * 0.85), u = c * (l + a), m = (i - d) / 2, b = 0.4 + p * 0.6;
3166
- 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();
3167
3177
  }
3168
3178
  }
3169
3179
  updateTimer() {
@@ -3181,7 +3191,7 @@ class Re {
3181
3191
  this.recorder = null, this.container && (this.container.remove(), this.container = null), this.canvas = null, this.timerEl = null;
3182
3192
  }
3183
3193
  }
3184
- const ct = 80, Bi = "#e2e8f0", Fi = `
3194
+ const ct = 80, Ni = "#e2e8f0", Fi = `
3185
3195
  <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
3186
3196
  <circle cx="14" cy="14" r="14" fill="rgba(0,0,0,0.35)"/>
3187
3197
  <polygon points="11,8 22,14 11,20" fill="rgba(255,255,255,0.9)"/>
@@ -3211,7 +3221,7 @@ class Tt {
3211
3221
  width: `${ct}px`,
3212
3222
  height: `${ct}px`,
3213
3223
  borderRadius: "50%",
3214
- border: `2px solid ${Bi}`,
3224
+ border: `2px solid ${Ni}`,
3215
3225
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
3216
3226
  overflow: "hidden",
3217
3227
  cursor: "pointer",
@@ -3504,10 +3514,10 @@ class Le {
3504
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;
3505
3515
  }
3506
3516
  }
3507
- const _ = class _ {
3517
+ const T = class T {
3508
3518
  /** Opens a fullscreen lightbox overlay showing the image. */
3509
3519
  static open(e) {
3510
- _.close();
3520
+ T.close();
3511
3521
  const t = document.createElement("div");
3512
3522
  t.id = "pulse-widget-lightbox", Object.assign(t.style, {
3513
3523
  position: "fixed",
@@ -3551,7 +3561,7 @@ const _ = class _ {
3551
3561
  }), i.addEventListener("mouseleave", () => {
3552
3562
  i.style.background = "rgba(255,255,255,0.15)";
3553
3563
  }), i.addEventListener("click", (r) => {
3554
- r.stopPropagation(), _.close();
3564
+ r.stopPropagation(), T.close();
3555
3565
  });
3556
3566
  const n = document.createElement("img");
3557
3567
  n.src = e, n.alt = "Lightbox image", Object.assign(n.style, {
@@ -3564,26 +3574,26 @@ const _ = class _ {
3564
3574
  }), n.addEventListener("click", (r) => {
3565
3575
  r.stopPropagation();
3566
3576
  }), t.appendChild(i), t.appendChild(n), t.addEventListener("click", () => {
3567
- _.close();
3577
+ T.close();
3568
3578
  });
3569
3579
  const o = (r) => {
3570
- r.key === "Escape" && _.close();
3580
+ r.key === "Escape" && T.close();
3571
3581
  };
3572
- 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(() => {
3573
3583
  t.style.opacity = "1";
3574
3584
  });
3575
3585
  }
3576
3586
  /** Closes the lightbox if open. */
3577
3587
  static close() {
3578
- if (!_.overlay) return;
3579
- const e = _.overlay;
3580
- _.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", () => {
3581
3591
  e.remove();
3582
- }), _.overlay = null;
3592
+ }), T.overlay = null;
3583
3593
  }
3584
3594
  };
3585
- _.overlay = null, _.onKeyDown = null;
3586
- let ke = _;
3595
+ T.overlay = null, T.onKeyDown = null;
3596
+ let ke = T;
3587
3597
  class ne {
3588
3598
  constructor(e) {
3589
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);
@@ -3818,45 +3828,71 @@ class Ji {
3818
3828
  ">Pin Comment</button>
3819
3829
  </div>
3820
3830
  </div>
3821
- <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>
3822
3832
  `;
3823
3833
  const a = this.form.querySelector("textarea"), c = this.form.querySelector(".pulse-close-btn"), p = this.form.querySelector(".pin-submit");
3824
3834
  c.addEventListener("click", () => this.exitPinMode()), this.pendingAttachmentIds = [], this.upload || (this.upload = new ne(this.client));
3825
- 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
+ };
3826
3862
  this.form.querySelector(".attach-img").addEventListener("click", async () => {
3827
3863
  const u = await this.upload.pickFile("image/*");
3828
3864
  if (u) {
3829
3865
  this.pendingAttachmentIds.push(u.id);
3830
- const m = document.createElement("img");
3831
- 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);
3832
3868
  }
3833
3869
  }), this.form.querySelector(".attach-mic").addEventListener("click", async () => {
3834
3870
  this.audioRecorder || (this.audioRecorder = new Re());
3835
3871
  const u = await this.audioRecorder.startRecording(d);
3836
3872
  if (u) {
3837
- const m = await this.upload.uploadBlob(u, "audio.webm");
3838
- if (m) {
3839
- this.pendingAttachmentIds.push(m.id);
3840
- const b = document.createElement("span");
3841
- 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);
3842
3878
  }
3843
3879
  }
3844
3880
  }), this.form.querySelector(".attach-video").addEventListener("click", async () => {
3845
3881
  this.videoRecorder || (this.videoRecorder = new Le());
3846
3882
  const u = await this.videoRecorder.startRecording(d);
3847
3883
  if (u) {
3848
- const m = await this.upload.uploadBlob(u.blob, "video.webm");
3849
- if (m) {
3850
- this.pendingAttachmentIds.push(m.id);
3851
- const b = document.createElement("span");
3852
- 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);
3853
3889
  }
3854
3890
  }
3855
3891
  }), p.addEventListener("click", () => {
3856
3892
  const u = a.value.trim();
3857
3893
  if (!u && this.pendingAttachmentIds.length === 0) return;
3858
- const m = [...(u || "").matchAll(/@(\w+)/g)].map((b) => b[1]);
3859
- 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();
3860
3896
  }), a.addEventListener("keydown", (u) => {
3861
3897
  u.key === "Escape" && this.exitPinMode(), u.stopPropagation();
3862
3898
  }), document.body.appendChild(this.form), requestAnimationFrame(() => a.focus());
@@ -3922,13 +3958,13 @@ class Ji {
3922
3958
  }
3923
3959
  const i = (l = this.client.state.user) == null ? void 0 : l.id;
3924
3960
  t.innerHTML = e.comments.map((a) => {
3925
- 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>' : "";
3926
3962
  if (this.editingPopoverCommentId === a.id)
3927
3963
  return `
3928
3964
  <div style="margin-bottom:10px;" data-comment-id="${a.id}">
3929
3965
  <div style="display:flex;align-items:center;gap:7px;margin-bottom:4px;">
3930
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>
3931
- <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>
3932
3968
  </div>
3933
3969
  <div style="margin-left:29px;">
3934
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>
@@ -3939,37 +3975,37 @@ class Ji {
3939
3975
  </div>
3940
3976
  </div>
3941
3977
  `;
3942
- const C = a.body && a.body !== "(attachment)" ? a.body.replace(
3978
+ const $ = a.body && a.body !== "(attachment)" ? a.body.replace(
3943
3979
  /@(\w+)/g,
3944
3980
  '<span style="color:#6366f1;font-weight:600;background:#eef2ff;padding:0 3px;border-radius:3px;">@$1</span>'
3945
- ) : "", w = (a.attachments ?? []).map((y) => {
3946
- if (y.type === "image") {
3947
- const Pt = y.thumbnailUrl || y.url;
3948
- return `<div class="popover-attachment-img" data-full-url="${this.escapeHtml(y.url)}" style="margin:4px 0 4px 29px;cursor:pointer;">
3949
- <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;" />
3950
3986
  </div>`;
3951
3987
  }
3952
- 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>` : "";
3953
- }).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;">
3954
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"
3955
3991
  onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'"
3956
3992
  onmouseout="this.style.color='#94a3b8';this.style.background='none'">${Gi}</button>
3957
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"
3958
3994
  onmouseover="this.style.color='#ef4444';this.style.background='#fef2f2'"
3959
3995
  onmouseout="this.style.color='#94a3b8';this.style.background='none'">${Zi}</button>
3960
- </div>` : "", P = this.buildReactionPillsHtml(a.id);
3996
+ </div>` : "", A = this.buildReactionPillsHtml(a.id);
3961
3997
  return `
3962
3998
  <div class="popover-comment" style="margin-bottom:10px;" data-comment-id="${a.id}">
3963
3999
  <div style="display:flex;align-items:center;gap:7px;margin-bottom:2px;">
3964
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>
3965
- <span style="font-size:12px;font-weight:600;color:#0f172a;">${u}</span>
3966
- <span style="font-size:10px;color:#94a3b8;">${m}</span>
3967
- ${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}
3968
4004
  </div>
3969
- ${C ? `<div style="font-size:13px;color:#334155;line-height:1.45;margin-left:29px;word-wrap:break-word;">${C}</div>` : ""}
3970
- ${w}
3971
- ${$}
3972
- ${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}
3973
4009
  </div>
3974
4010
  `;
3975
4011
  }).join(""), t.querySelectorAll(".edit-btn").forEach((a) => {
@@ -3998,8 +4034,8 @@ class Ji {
3998
4034
  }), t.querySelectorAll("[data-reaction-emoji]").forEach((a) => {
3999
4035
  a.addEventListener("click", (c) => {
4000
4036
  c.stopPropagation();
4001
- const p = a.dataset.reactionEmoji, d = a.dataset.reactionTarget, u = a.dataset.reactionId;
4002
- 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);
4003
4039
  });
4004
4040
  }), t.querySelectorAll(".popover-reaction-add").forEach((a) => {
4005
4041
  a.addEventListener("click", (c) => {
@@ -4055,37 +4091,60 @@ class Ji {
4055
4091
  `;
4056
4092
  const o = t.querySelector("input"), r = t.querySelector(".reply-send"), l = t.querySelector(".reply-attachments-preview");
4057
4093
  this.upload || (this.upload = new ne(this.client));
4058
- const a = [], c = (d) => {
4094
+ const a = [], c = (d, f) => {
4059
4095
  const u = document.createElement("span");
4060
- 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);
4061
4120
  };
4062
4121
  t.querySelector(".reply-attach-img").addEventListener("click", async () => {
4063
4122
  const d = await this.upload.pickFile("image/*");
4064
- d && (a.push(d.id), c("📎 Image"));
4123
+ d && (a.push(d.id), c(d.id, "📎 Image"));
4065
4124
  }), t.querySelector(".reply-attach-mic").addEventListener("click", async () => {
4066
4125
  this.audioRecorder || (this.audioRecorder = new Re());
4067
4126
  const d = await this.audioRecorder.startRecording(t);
4068
4127
  if (d) {
4069
- const u = await this.upload.uploadBlob(d, "audio.webm");
4070
- 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"));
4071
4130
  }
4072
4131
  }), t.querySelector(".reply-attach-video").addEventListener("click", async () => {
4073
4132
  this.videoRecorder || (this.videoRecorder = new Le());
4074
4133
  const d = await this.videoRecorder.startRecording(t);
4075
4134
  if (d) {
4076
- const u = await this.upload.uploadBlob(d.blob, "video.webm");
4077
- 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"));
4078
4137
  }
4079
4138
  });
4080
4139
  const p = () => {
4081
4140
  const d = o.value.trim();
4082
4141
  if (!d && a.length === 0) return;
4083
- const u = [...(d || "").matchAll(/@(\w+)/g)].map((m) => m[1]);
4084
- 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 = "";
4085
4144
  };
4086
4145
  r.addEventListener("click", p), o.addEventListener("input", () => {
4087
- const d = Date.now(), u = this.lastTypingSendPins.get(e.id) ?? 0;
4088
- 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));
4089
4148
  }), o.addEventListener("keydown", (d) => {
4090
4149
  d.key === "Enter" && (d.preventDefault(), p()), d.key === "Escape" && this.closePopover(), d.stopPropagation();
4091
4150
  }), this.popover.appendChild(t);
@@ -4145,8 +4204,8 @@ class Ji {
4145
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;";
4146
4205
  let l = '<div style="margin-left:29px;display:flex;gap:4px;flex-wrap:wrap;margin-top:4px;">';
4147
4206
  for (const [c, { count: p, ownId: d }] of n) {
4148
- const u = d ? r : o;
4149
- l += `<button data-reaction-emoji="${c}" data-reaction-target="${e}" ${d ? `data-reaction-id="${d}"` : ""} style="${u}">
4207
+ const f = d ? r : o;
4208
+ l += `<button data-reaction-emoji="${c}" data-reaction-target="${e}" ${d ? `data-reaction-id="${d}"` : ""} style="${f}">
4150
4209
  <span>${c}</span><span style="font-size:11px;font-weight:600;color:#64748b;">${p}</span>
4151
4210
  </button>`;
4152
4211
  }
@@ -4253,7 +4312,7 @@ var Qi = Object.defineProperty, es = Object.getOwnPropertyDescriptor, j = (s, e,
4253
4312
  return i && n && Qi(e, t, n), n;
4254
4313
  };
4255
4314
  const ts = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
4256
- let O = class extends T {
4315
+ let O = class extends S {
4257
4316
  constructor() {
4258
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 = [];
4259
4318
  }
@@ -4286,9 +4345,9 @@ let O = class extends T {
4286
4345
  });
4287
4346
  }
4288
4347
  teardownListeners() {
4289
- var s, e, t;
4290
- (s = this.unsub) == null || s.call(this), this.unsub = void 0, (e = this.reactionUnsub) == null || e.call(this), this.reactionUnsub = void 0, (t = this.typingUnsub) == null || t.call(this), this.typingUnsub = void 0;
4291
- for (const i of this.typingTimers.values()) clearTimeout(i);
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);
4292
4351
  this.typingTimers.clear();
4293
4352
  }
4294
4353
  ensureListener() {
@@ -4297,6 +4356,8 @@ let O = class extends T {
4297
4356
  setupListener() {
4298
4357
  this.client && (this.unsub = this.client.state.on("threads", () => {
4299
4358
  this.threadsVersion++;
4359
+ }), this.authUnsub = this.client.state.on("auth", () => {
4360
+ this.threadsVersion++;
4300
4361
  }), this.reactionUnsub = this.client.state.on("reactions", () => {
4301
4362
  this.reactionsVersion++;
4302
4363
  }), this.typingUnsub = this.client.state.on(
@@ -4387,6 +4448,9 @@ let O = class extends T {
4387
4448
  n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
4388
4449
  }
4389
4450
  }
4451
+ removeReplyAttachment(s) {
4452
+ this.replyAttachmentIds = this.replyAttachmentIds.filter((e) => e !== s), this.requestUpdate();
4453
+ }
4390
4454
  handleReply(s, e) {
4391
4455
  e.preventDefault();
4392
4456
  const i = e.target.querySelector("input"), n = i.value.trim();
@@ -4469,14 +4533,14 @@ let O = class extends T {
4469
4533
  `
4470
4534
  )}
4471
4535
  </div>
4472
- ` : f}
4536
+ ` : m}
4473
4537
  </button>
4474
4538
  </div>
4475
4539
  `;
4476
4540
  }
4477
4541
  renderTypingIndicator(s) {
4478
4542
  const e = this.typingByThread.get(s) ?? [];
4479
- if (e.length === 0) return f;
4543
+ if (e.length === 0) return m;
4480
4544
  const t = e.length === 1 ? `${e[0]} is typing...` : `${e.join(", ")} are typing...`;
4481
4545
  return h`<div class="typing-indicator">${t}</div>`;
4482
4546
  }
@@ -4497,7 +4561,7 @@ let O = class extends T {
4497
4561
  <span class="thread-count">${this.threads.length}</span>
4498
4562
  </span>
4499
4563
  <button class="close-btn" @click=${this.fireClose} title="Close">
4500
- ${k(me, 16)}
4564
+ ${C(me, 16)}
4501
4565
  </button>
4502
4566
  </div>
4503
4567
 
@@ -4515,7 +4579,7 @@ let O = class extends T {
4515
4579
  `;
4516
4580
  }
4517
4581
  renderAttachments(s) {
4518
- return !s || s.length === 0 ? f : h`
4582
+ return !s || s.length === 0 ? m : h`
4519
4583
  ${s.map((e) => {
4520
4584
  if (e.type === "image") {
4521
4585
  const t = e.thumbnailUrl || e.url;
@@ -4538,7 +4602,7 @@ let O = class extends T {
4538
4602
  <div class="comment-attachment-media" id="video-${e.id}">
4539
4603
  ${this.renderVideoPlayer(e)}
4540
4604
  </div>
4541
- ` : f;
4605
+ ` : m;
4542
4606
  })}
4543
4607
  `;
4544
4608
  }
@@ -4557,13 +4621,13 @@ let O = class extends T {
4557
4621
  data-thread-id=${s.id}
4558
4622
  >
4559
4623
  ${s.position ? h`<div class="pin-badge">
4560
- ${k(_t, 12)}
4624
+ ${C(_t, 12)}
4561
4625
  Pinned
4562
- </div>` : f}
4626
+ </div>` : m}
4563
4627
  ${s.comments.map((t, i) => {
4564
4628
  const n = this.getUserForComment(t.userId), o = this.isOwnComment(t), r = this.editingCommentId === t.id;
4565
4629
  return h`
4566
- ${i > 0 ? h`<div class="comment-divider"></div>` : f}
4630
+ ${i > 0 ? h`<div class="comment-divider"></div>` : m}
4567
4631
  <div class="comment">
4568
4632
  <div class="comment-header">
4569
4633
  <div
@@ -4574,16 +4638,16 @@ let O = class extends T {
4574
4638
  </div>
4575
4639
  <span class="comment-author">${(n == null ? void 0 : n.name) ?? "Unknown"}</span>
4576
4640
  <span class="comment-time">${this.formatTime(t.createdAt)}</span>
4577
- ${t.editedAt ? h`<span class="edited-badge">(edited)</span>` : f}
4641
+ ${t.editedAt ? h`<span class="edited-badge">(edited)</span>` : m}
4578
4642
  </div>
4579
4643
  ${r ? this.renderEditForm(t) : h`
4580
- ${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}
4581
4645
  ${this.renderAttachments(t.attachments ?? [])}
4582
4646
  `}
4583
4647
  ${o && !r ? h`<div class="comment-actions">
4584
- <button @click=${() => this.startEdit(t)} title="Edit">${k(Ai, 14)}</button>
4585
- <button class="danger" @click=${() => this.deleteComment(t.id)} title="Delete">${k(Mi, 14)}</button>
4586
- </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}
4587
4651
  ${this.renderReactions(t)}
4588
4652
  </div>
4589
4653
  `;
@@ -4623,27 +4687,34 @@ let O = class extends T {
4623
4687
  class="reply-media-btn"
4624
4688
  title="Attach image"
4625
4689
  @click=${() => this.handleAttachImage()}
4626
- >${k(Si, 16)}</button>
4690
+ >${C(Si, 16)}</button>
4627
4691
  <button
4628
4692
  type="button"
4629
4693
  class="reply-media-btn"
4630
4694
  title="Record audio"
4631
4695
  @click=${() => this.handleRecordAudio(s.id)}
4632
- >${k(Ti, 16)}</button>
4696
+ >${C(Ti, 16)}</button>
4633
4697
  <button
4634
4698
  type="button"
4635
4699
  class="reply-media-btn"
4636
4700
  title="Record video"
4637
4701
  @click=${() => this.handleRecordVideo(s.id)}
4638
- >${k(Oi, 16)}</button>
4702
+ >${C(Oi, 16)}</button>
4639
4703
  <div class="reply-preview">
4640
4704
  ${this.replyAttachmentIds.map(
4641
- (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>`
4642
4713
  )}
4643
4714
  </div>
4644
4715
  </div>
4645
4716
  </form>
4646
- ` : f}
4717
+ ` : m}
4647
4718
  </div>
4648
4719
  `;
4649
4720
  }
@@ -4652,7 +4723,7 @@ O.styles = [
4652
4723
  ee,
4653
4724
  ge,
4654
4725
  _e,
4655
- A`
4726
+ I`
4656
4727
  :host {
4657
4728
  display: block;
4658
4729
  }
@@ -4893,7 +4964,10 @@ O.styles = [
4893
4964
  }
4894
4965
 
4895
4966
  .reply-preview-badge {
4896
- display: inline-block;
4967
+ position: relative;
4968
+ display: inline-flex;
4969
+ align-items: center;
4970
+ gap: 4px;
4897
4971
  padding: 2px 8px;
4898
4972
  border-radius: 4px;
4899
4973
  background: var(--pw-surface-hover);
@@ -4901,6 +4975,24 @@ O.styles = [
4901
4975
  color: var(--pw-text-muted);
4902
4976
  }
4903
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
+
4904
4996
  .reply-form .pw-btn-primary {
4905
4997
  padding: 8px 14px;
4906
4998
  font-size: 12px;
@@ -5172,31 +5264,31 @@ O.styles = [
5172
5264
  `
5173
5265
  ];
5174
5266
  j([
5175
- g({ attribute: !1 })
5267
+ b({ attribute: !1 })
5176
5268
  ], O.prototype, "client", 2);
5177
5269
  j([
5178
- g()
5270
+ b()
5179
5271
  ], O.prototype, "highlightThreadId", 2);
5180
5272
  j([
5181
- v()
5273
+ x()
5182
5274
  ], O.prototype, "threadsVersion", 2);
5183
5275
  j([
5184
- v()
5276
+ x()
5185
5277
  ], O.prototype, "replyingTo", 2);
5186
5278
  j([
5187
- v()
5279
+ x()
5188
5280
  ], O.prototype, "editingCommentId", 2);
5189
5281
  j([
5190
- v()
5282
+ x()
5191
5283
  ], O.prototype, "editBody", 2);
5192
5284
  j([
5193
- v()
5285
+ x()
5194
5286
  ], O.prototype, "pickerOpenForComment", 2);
5195
5287
  j([
5196
- v()
5288
+ x()
5197
5289
  ], O.prototype, "typingByThread", 2);
5198
5290
  j([
5199
- v()
5291
+ x()
5200
5292
  ], O.prototype, "reactionsVersion", 2);
5201
5293
  O = j([
5202
5294
  R("pulse-widget-comments-panel")
@@ -5219,7 +5311,7 @@ const ns = {
5219
5311
  "thread:resolved": "✅",
5220
5312
  "reaction:added": "🎉"
5221
5313
  };
5222
- let de = class extends T {
5314
+ let de = class extends S {
5223
5315
  constructor() {
5224
5316
  super(...arguments), this.notifications = [];
5225
5317
  }
@@ -5268,14 +5360,14 @@ let de = class extends T {
5268
5360
  <div class="panel-header">
5269
5361
  <span class="panel-title">
5270
5362
  Notifications
5271
- ${s > 0 ? h`<span class="unread-badge">${s}</span>` : f}
5363
+ ${s > 0 ? h`<span class="unread-badge">${s}</span>` : m}
5272
5364
  </span>
5273
5365
  <div style="display:flex;align-items:center;gap:4px;">
5274
5366
  ${s > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
5275
5367
  Mark all read
5276
- </button>` : f}
5368
+ </button>` : m}
5277
5369
  <button class="close-btn" @click=${this.fireClose} title="Close">
5278
- ${k(me, 16)}
5370
+ ${C(me, 16)}
5279
5371
  </button>
5280
5372
  </div>
5281
5373
  </div>
@@ -5311,7 +5403,7 @@ de.styles = [
5311
5403
  ee,
5312
5404
  ge,
5313
5405
  _e,
5314
- A`
5406
+ I`
5315
5407
  :host {
5316
5408
  display: block;
5317
5409
  }
@@ -5505,10 +5597,10 @@ de.styles = [
5505
5597
  `
5506
5598
  ];
5507
5599
  Ve([
5508
- g({ attribute: !1 })
5600
+ b({ attribute: !1 })
5509
5601
  ], de.prototype, "client", 2);
5510
5602
  Ve([
5511
- v()
5603
+ x()
5512
5604
  ], de.prototype, "notifications", 2);
5513
5605
  de = Ve([
5514
5606
  R("pulse-widget-notifications-panel")
@@ -5872,8 +5964,8 @@ class hs {
5872
5964
  try {
5873
5965
  const a = n.getClientRects(), c = [];
5874
5966
  for (let p = 0; p < a.length; p++) {
5875
- const d = a[p], u = document.createElement("div");
5876
- Object.assign(u.style, {
5967
+ const d = a[p], f = document.createElement("div");
5968
+ Object.assign(f.style, {
5877
5969
  position: "absolute",
5878
5970
  left: `${d.left}px`,
5879
5971
  top: `${d.top}px`,
@@ -5883,7 +5975,7 @@ class hs {
5883
5975
  opacity: "0.2",
5884
5976
  borderRadius: "2px",
5885
5977
  pointerEvents: "none"
5886
- }), this.container.appendChild(u), c.push(u);
5978
+ }), this.container.appendChild(f), c.push(f);
5887
5979
  }
5888
5980
  this.selectionEls.set(e, c);
5889
5981
  } catch {
@@ -5908,7 +6000,7 @@ var ps = Object.defineProperty, us = Object.getOwnPropertyDescriptor, qe = (s, e
5908
6000
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
5909
6001
  return i && n && ps(e, t, n), n;
5910
6002
  };
5911
- let he = class extends T {
6003
+ let he = class extends S {
5912
6004
  constructor() {
5913
6005
  super(...arguments), this.roomId = "";
5914
6006
  }
@@ -5949,7 +6041,7 @@ let he = class extends T {
5949
6041
  <div class="panel-header">
5950
6042
  <span class="panel-title">Settings</span>
5951
6043
  <button class="close-btn" @click=${this.fireClose} title="Close">
5952
- ${k(me, 16)}
6044
+ ${C(me, 16)}
5953
6045
  </button>
5954
6046
  </div>
5955
6047
 
@@ -5998,7 +6090,7 @@ he.styles = [
5998
6090
  ee,
5999
6091
  ge,
6000
6092
  _e,
6001
- A`
6093
+ I`
6002
6094
  :host {
6003
6095
  display: block;
6004
6096
  }
@@ -6170,10 +6262,10 @@ he.styles = [
6170
6262
  `
6171
6263
  ];
6172
6264
  qe([
6173
- g({ attribute: !1 })
6265
+ b({ attribute: !1 })
6174
6266
  ], he.prototype, "settings", 2);
6175
6267
  qe([
6176
- g()
6268
+ b()
6177
6269
  ], he.prototype, "roomId", 2);
6178
6270
  he = qe([
6179
6271
  R("pulse-widget-settings-panel")
@@ -6206,7 +6298,7 @@ var gs = Object.defineProperty, bs = Object.getOwnPropertyDescriptor, L = (s, e,
6206
6298
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6207
6299
  return i && n && gs(e, t, n), n;
6208
6300
  };
6209
- let M = class extends T {
6301
+ let M = class extends S {
6210
6302
  constructor() {
6211
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;
6212
6304
  }
@@ -6259,7 +6351,7 @@ let M = class extends T {
6259
6351
  if (this.collapsed)
6260
6352
  return h`
6261
6353
  <div class="toolbar collapsed ${s ? "inline" : ""}" @click=${this.fireToggle}>
6262
- <span class="fab-icon">${k(Ri, s ? 18 : 24)}</span>
6354
+ <span class="fab-icon">${C(Ri, s ? 18 : 24)}</span>
6263
6355
  </div>
6264
6356
  `;
6265
6357
  const e = this.users.slice(0, 3), t = this.users.length - 3;
@@ -6268,7 +6360,7 @@ let M = class extends T {
6268
6360
  <!-- Presence avatars -->
6269
6361
  ${this.users.length > 0 ? h`
6270
6362
  <div class="presence">
6271
- ${t > 0 ? h`<div class="presence-overflow">+${t}</div>` : f}
6363
+ ${t > 0 ? h`<div class="presence-overflow">+${t}</div>` : m}
6272
6364
  ${e.map(
6273
6365
  (i) => h`
6274
6366
  <div
@@ -6279,13 +6371,13 @@ let M = class extends T {
6279
6371
  >
6280
6372
  ${i.user.avatar ? h`<img src="${i.user.avatar}" alt="${i.user.name}" />` : this.getInitials(i.user.name)}
6281
6373
  <span class="presence-tooltip">${i.user.name}</span>
6282
- ${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}
6283
6375
  </div>
6284
6376
  `
6285
6377
  )}
6286
6378
  </div>
6287
6379
  <div class="separator"></div>
6288
- ` : f}
6380
+ ` : m}
6289
6381
 
6290
6382
  <!-- Pin comment (primary) -->
6291
6383
  <button
@@ -6295,7 +6387,7 @@ let M = class extends T {
6295
6387
  ?disabled=${this.featuresDisabled}
6296
6388
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6297
6389
  >
6298
- ${k(_t)}
6390
+ ${C(_t)}
6299
6391
  </button>
6300
6392
 
6301
6393
  <!-- View comments -->
@@ -6306,7 +6398,7 @@ let M = class extends T {
6306
6398
  ?disabled=${this.featuresDisabled}
6307
6399
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6308
6400
  >
6309
- ${k(_i)}
6401
+ ${C(_i)}
6310
6402
  </button>
6311
6403
 
6312
6404
  <!-- Activity feed -->
@@ -6317,7 +6409,7 @@ let M = class extends T {
6317
6409
  ?disabled=${this.featuresDisabled}
6318
6410
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6319
6411
  >
6320
- ${k(Ci)}
6412
+ ${C(Ci)}
6321
6413
  </button>
6322
6414
 
6323
6415
  <!-- Draw mode -->
@@ -6328,7 +6420,7 @@ let M = class extends T {
6328
6420
  ?disabled=${this.featuresDisabled}
6329
6421
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6330
6422
  >
6331
- ${k(Pi)}
6423
+ ${C(Pi)}
6332
6424
  </button>
6333
6425
 
6334
6426
  <!-- Notifications -->
@@ -6339,8 +6431,8 @@ let M = class extends T {
6339
6431
  ?disabled=${this.featuresDisabled}
6340
6432
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : "position:relative"}"
6341
6433
  >
6342
- ${k(Ei)}
6343
- ${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}
6344
6436
  </button>
6345
6437
 
6346
6438
  <!-- Settings -->
@@ -6349,7 +6441,7 @@ let M = class extends T {
6349
6441
  @click=${() => this.fire("settings")}
6350
6442
  title="Settings"
6351
6443
  >
6352
- ${k(Ii)}
6444
+ ${C(Ii)}
6353
6445
  </button>
6354
6446
 
6355
6447
  <div class="separator"></div>
@@ -6360,7 +6452,7 @@ let M = class extends T {
6360
6452
  @click=${this.fireToggle}
6361
6453
  title="Collapse"
6362
6454
  >
6363
- ${k(me, 14)}
6455
+ ${C(me, 14)}
6364
6456
  </button>
6365
6457
  </div>
6366
6458
  `;
@@ -6369,7 +6461,7 @@ let M = class extends T {
6369
6461
  M.styles = [
6370
6462
  ee,
6371
6463
  ge,
6372
- A`
6464
+ I`
6373
6465
  :host {
6374
6466
  display: block;
6375
6467
  }
@@ -6582,34 +6674,34 @@ M.styles = [
6582
6674
  `
6583
6675
  ];
6584
6676
  L([
6585
- g({ attribute: !1 })
6677
+ b({ attribute: !1 })
6586
6678
  ], M.prototype, "client", 2);
6587
6679
  L([
6588
- g({ type: Boolean })
6680
+ b({ type: Boolean })
6589
6681
  ], M.prototype, "collapsed", 2);
6590
6682
  L([
6591
- g()
6683
+ b()
6592
6684
  ], M.prototype, "activePanel", 2);
6593
6685
  L([
6594
- g({ type: Boolean })
6686
+ b({ type: Boolean })
6595
6687
  ], M.prototype, "pinModeActive", 2);
6596
6688
  L([
6597
- g({ type: Boolean })
6689
+ b({ type: Boolean })
6598
6690
  ], M.prototype, "featuresDisabled", 2);
6599
6691
  L([
6600
- g({ type: Boolean })
6692
+ b({ type: Boolean })
6601
6693
  ], M.prototype, "drawModeActive", 2);
6602
6694
  L([
6603
- g()
6695
+ b()
6604
6696
  ], M.prototype, "followingUserId", 2);
6605
6697
  L([
6606
- g()
6698
+ b()
6607
6699
  ], M.prototype, "display", 2);
6608
6700
  L([
6609
- v()
6701
+ x()
6610
6702
  ], M.prototype, "users", 2);
6611
6703
  L([
6612
- v()
6704
+ x()
6613
6705
  ], M.prototype, "unreadCount", 2);
6614
6706
  M = L([
6615
6707
  R("pulse-widget-toolbar")
@@ -6655,23 +6747,23 @@ class vs {
6655
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();
6656
6748
  for (const [l, a] of this.client.state.viewports) {
6657
6749
  if (l === n) continue;
6658
- const c = a.scrollY, p = a.scrollY + a.viewportHeight, d = e, u = e + t;
6659
- if (c >= d && p <= u) {
6660
- const $ = this.pillEls.get(l);
6661
- $ && ($.style.display = "none");
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");
6662
6754
  continue;
6663
6755
  }
6664
6756
  o.add(l);
6665
- const m = this.client.state.presence.find(
6666
- ($) => $.user.id === l
6757
+ const u = this.client.state.presence.find(
6758
+ (E) => E.user.id === l
6667
6759
  );
6668
- if (!m) continue;
6669
- 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(
6670
6762
  8,
6671
- Math.min(t - 28, I * t)
6763
+ Math.min(t - 28, v * t)
6672
6764
  );
6673
- let w = this.pillEls.get(l);
6674
- 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, {
6675
6767
  position: "absolute",
6676
6768
  right: "8px",
6677
6769
  padding: "2px 6px",
@@ -6683,7 +6775,7 @@ class vs {
6683
6775
  whiteSpace: "nowrap",
6684
6776
  pointerEvents: "none",
6685
6777
  transition: "top 0.3s ease"
6686
- }), 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);
6687
6779
  }
6688
6780
  for (const [l, a] of this.pillEls)
6689
6781
  !o.has(l) && !this.client.state.viewports.has(l) && (a.remove(), this.pillEls.delete(l));
@@ -6692,12 +6784,12 @@ class vs {
6692
6784
  return e.split(" ").map((t) => t[0]).join("").toUpperCase().slice(0, 2);
6693
6785
  }
6694
6786
  }
6695
- var xs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, S = (s, e, t, i) => {
6787
+ var xs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, P = (s, e, t, i) => {
6696
6788
  for (var n = i > 1 ? void 0 : i ? ys(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6697
6789
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6698
6790
  return i && n && xs(e, t, n), n;
6699
6791
  };
6700
- let E = class extends T {
6792
+ let _ = class extends S {
6701
6793
  constructor() {
6702
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 = () => {
6703
6795
  !this.settings.enabled || !this.client || this._isFollowScrolling || (this.followingUserId && (this.followingUserId = null), !this._viewportThrottleTimer && (this._viewportThrottleTimer = setTimeout(() => {
@@ -6826,12 +6918,12 @@ let E = class extends T {
6826
6918
  this.settings = e, ms(this.room, e), this.applySettings(e);
6827
6919
  }
6828
6920
  applySettings(s) {
6829
- var e, t, i, n, o, r, l, a, c, p, d, u, m, b, I, C, w;
6921
+ var e, t, i, n, o, r, l, a, c, p, d, f, u, g, v, $, y;
6830
6922
  if (!s.enabled) {
6831
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;
6832
6924
  return;
6833
6925
  }
6834
- this.applyCursorSettings(s), (c = this.client) == null || c.setAppearOffline(s.appearOffline), (p = this.commentPins) == null || p.setVisible(s.showCommentPins), s.showViewportIndicators ? (d = this.viewportOverlay) == null || d.enable() : (u = this.viewportOverlay) == null || u.disable(), s.showSelections ? (m = this.selectionOverlay) == null || m.enable() : (b = this.selectionOverlay) == null || b.disable(), s.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));
6835
6927
  }
6836
6928
  applyCursorSettings(s) {
6837
6929
  if (!this.cursorOverlay) return;
@@ -6845,22 +6937,22 @@ let E = class extends T {
6845
6937
  * the trigger element, flipping vertically/horizontally as needed.
6846
6938
  */
6847
6939
  positionPopups() {
6848
- var b, I, C, w;
6849
- const s = 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 = s ? 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;
6850
6942
  if (!i) return;
6851
- const n = 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");
6852
6944
  if (a) {
6853
6945
  Object.assign(a.style, { top: "auto", left: "auto" });
6854
- const $ = a.getBoundingClientRect(), P = this.computePosition(n, $, o, r, l);
6855
- 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`;
6856
6948
  }
6857
- 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");
6858
6950
  if (!c) return;
6859
6951
  Object.assign(c.style, { top: "auto", left: "auto" });
6860
6952
  const p = a ?? t;
6861
6953
  if (!p) return;
6862
- const d = p.getBoundingClientRect(), u = c.getBoundingClientRect(), m = this.computePosition(d, u, o, r, l);
6863
- 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`;
6864
6956
  }
6865
6957
  computePosition(s, e, t, i, n) {
6866
6958
  const o = s.top, r = i - s.bottom;
@@ -6885,7 +6977,7 @@ let E = class extends T {
6885
6977
  <span class="connection-dot"></span>Reconnecting...
6886
6978
  </div>` : this.connectionState === "disconnected" && this.client ? h`<div class="connection-banner disconnected">
6887
6979
  <span class="connection-dot"></span>Disconnected
6888
- </div>` : f;
6980
+ </div>` : m;
6889
6981
  }
6890
6982
  handleToolbarToggle() {
6891
6983
  this.collapsed = !this.collapsed, this.collapsed && (this.activePanel = null, this.highlightThreadId = null);
@@ -6905,25 +6997,25 @@ let E = class extends T {
6905
6997
  ${this.activePanel === "comments" ? h`<pulse-widget-comments-panel
6906
6998
  .client=${this.client}
6907
6999
  .highlightThreadId=${this.highlightThreadId}
6908
- ></pulse-widget-comments-panel>` : f}
7000
+ ></pulse-widget-comments-panel>` : m}
6909
7001
  ${this.activePanel === "settings" ? h`<pulse-widget-settings-panel
6910
7002
  .settings=${this.settings}
6911
7003
  .roomId=${this.room}
6912
7004
  @settings-change=${this.handleSettingsChange}
6913
- ></pulse-widget-settings-panel>` : f}
7005
+ ></pulse-widget-settings-panel>` : m}
6914
7006
  ${this.activePanel === "notifications" ? h`<pulse-widget-notifications-panel
6915
7007
  .client=${this.client}
6916
- ></pulse-widget-notifications-panel>` : f}
7008
+ ></pulse-widget-notifications-panel>` : m}
6917
7009
  ${this.activePanel === "activity" ? h`<pulse-widget-activity-panel
6918
7010
  .client=${this.client}
6919
- ></pulse-widget-activity-panel>` : f}
7011
+ ></pulse-widget-activity-panel>` : m}
6920
7012
  </div>
6921
- ` : f, t = this.followingUserId ? h`<div class="follow-banner">
7013
+ ` : m, t = this.followingUserId ? h`<div class="follow-banner">
6922
7014
  Following ${this.getFollowUserName()}
6923
7015
  <button @click=${() => {
6924
7016
  this.followingUserId = null;
6925
7017
  }}>Stop</button>
6926
- </div>` : f;
7018
+ </div>` : m;
6927
7019
  return s ? h`
6928
7020
  ${t}
6929
7021
  <div class="widget-root">
@@ -6970,9 +7062,9 @@ let E = class extends T {
6970
7062
  `;
6971
7063
  }
6972
7064
  };
6973
- E.styles = [
7065
+ _.styles = [
6974
7066
  ee,
6975
- A`
7067
+ I`
6976
7068
  :host {
6977
7069
  display: block;
6978
7070
  }
@@ -7148,54 +7240,54 @@ E.styles = [
7148
7240
  }
7149
7241
  `
7150
7242
  ];
7151
- S([
7152
- g({ attribute: "api-key" })
7153
- ], E.prototype, "apiKey", 2);
7154
- S([
7155
- g()
7156
- ], E.prototype, "token", 2);
7157
- S([
7158
- g()
7159
- ], E.prototype, "room", 2);
7160
- S([
7161
- g()
7162
- ], E.prototype, "endpoint", 2);
7163
- S([
7164
- g({ reflect: !0 })
7165
- ], E.prototype, "position", 2);
7166
- S([
7167
- g({ reflect: !0 })
7168
- ], E.prototype, "display", 2);
7169
- S([
7170
- v()
7171
- ], E.prototype, "collapsed", 2);
7172
- S([
7173
- v()
7174
- ], E.prototype, "activePanel", 2);
7175
- S([
7176
- v()
7177
- ], E.prototype, "pinModeActive", 2);
7178
- S([
7179
- v()
7180
- ], E.prototype, "highlightThreadId", 2);
7181
- S([
7182
- v()
7183
- ], E.prototype, "settings", 2);
7184
- S([
7185
- v()
7186
- ], E.prototype, "followingUserId", 2);
7187
- S([
7188
- v()
7189
- ], E.prototype, "drawModeActive", 2);
7190
- S([
7191
- v()
7192
- ], E.prototype, "connectionState", 2);
7193
- S([
7194
- v()
7195
- ], E.prototype, "showConnectedFlash", 2);
7196
- 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([
7197
7289
  R("pulse-widget")
7198
- ], E);
7290
+ ], _);
7199
7291
  export {
7200
7292
  W as PulseComments,
7201
7293
  le as PulseCursors,
@@ -7203,5 +7295,5 @@ export {
7203
7295
  G as PulsePresence,
7204
7296
  q as PulseProvider,
7205
7297
  D as PulseReactions,
7206
- E as PulseWidget
7298
+ _ as PulseWidget
7207
7299
  };