@paramms/chat-widget 1.0.43 → 1.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -33,13 +33,13 @@ class Oe {
33
33
  var b;
34
34
  if (typeof document > "u" || !((b = e.points) != null && b.length)) return;
35
35
  const i = this.ensureSvg(), s = window.innerWidth, a = window.innerHeight, c = document.createElementNS(xe, "polyline");
36
- c.setAttribute("points", e.points.map((d) => `${(d.x * s).toFixed(1)},${(d.y * a).toFixed(1)}`).join(" ")), c.setAttribute("fill", "none"), c.setAttribute("stroke", e.color || "#ff3b30"), c.setAttribute("stroke-width", String(e.width || 3)), c.setAttribute("stroke-linecap", "round"), c.setAttribute("stroke-linejoin", "round"), c.setAttribute("data-stroke-id", e.id), i.append(c);
36
+ c.setAttribute("points", e.points.map((l) => `${(l.x * s).toFixed(1)},${(l.y * a).toFixed(1)}`).join(" ")), c.setAttribute("fill", "none"), c.setAttribute("stroke", e.color || "#ff3b30"), c.setAttribute("stroke-width", String(e.width || 3)), c.setAttribute("stroke-linecap", "round"), c.setAttribute("stroke-linejoin", "round"), c.setAttribute("data-stroke-id", e.id), i.append(c);
37
37
  const w = setTimeout(() => {
38
38
  c.style.transition = "opacity 600ms", c.style.opacity = "0";
39
- const d = setTimeout(() => {
40
- c.remove(), this.timers.delete(d);
39
+ const l = setTimeout(() => {
40
+ c.remove(), this.timers.delete(l);
41
41
  }, 650);
42
- this.timers.add(d), this.timers.delete(w);
42
+ this.timers.add(l), this.timers.delete(w);
43
43
  }, De);
44
44
  this.timers.add(w);
45
45
  }
@@ -317,7 +317,7 @@ class Ke {
317
317
  /** Whether the subject card (server Subject entity, mount config fallback)
318
318
  * has been built — built once when data first arrives. */
319
319
  y(this, "subjectBuilt", !1);
320
- var k, I, P, C, R, A, N, U, T, $;
320
+ var k, I, P, C, R, A, N, V, T, $;
321
321
  this.root = e, this.me = i, this.h = s, this.cfg = a, We(), e.replaceChildren(), e.classList.add("ocw"), a.accent && e.style.setProperty("--ocw-accent", a.accent);
322
322
  const c = o("div", "ocw-head");
323
323
  if (this.h.onBack) {
@@ -335,15 +335,15 @@ class Ke {
335
335
  this.headerName = o("div", "ocw-head-name", ((P = a.subject) == null ? void 0 : P.ownerLabel) ?? ((C = a.subject) == null ? void 0 : C.title) ?? ""), b.append(this.headerName), (R = a.subject) != null && R.subtitle && b.append(o("div", "ocw-head-meta", a.subject.subtitle)), c.append(b), this.statusBadge = o("span", "ocw-badge", ((A = a.subject) == null ? void 0 : A.status) ?? ""), (N = a.subject) != null && N.status || (this.statusBadge.style.display = "none"), c.append(this.statusBadge), this.e2eBadge = o("span", "ocw-e2e", "🔒 E2E"), this.e2eBadge.style.display = "none", c.append(this.e2eBadge), this.connStatus = o("span", "ocw-conn-status"), this.connStatus.style.display = "none", c.append(this.connStatus), this.cobrowseBtn = o("button", "ocw-menu ocw-cobrowse-btn", "🖍"), this.cobrowseBtn.title = "Shared whiteboard — draw to point things out together", this.cobrowseBtn.addEventListener("click", () => {
336
336
  this.cobrowseActive = !this.cobrowseActive, this.updateCobrowseUI();
337
337
  }), c.append(this.cobrowseBtn), c.append(o("button", "ocw-menu", "⋯")), this.chips = o("div", "ocw-chiprow"), this.scroll = o("div", "ocw-scroll"), this.subjectCard = o("div", "ocw-subject"), this.typing = o("div", "ocw-typing");
338
- const d = o("div", "ocw-typing-bubble");
339
- d.append(o("div", "ocw-typing-dot"), o("div", "ocw-typing-dot"), o("div", "ocw-typing-dot")), this.typing.append(o("div", "ocw-dot", "🧑"), d), this.quick = o("div", "ocw-quick");
338
+ const l = o("div", "ocw-typing-bubble");
339
+ l.append(o("div", "ocw-typing-dot"), o("div", "ocw-typing-dot"), o("div", "ocw-typing-dot")), this.typing.append(o("div", "ocw-dot", "🧑"), l), this.quick = o("div", "ocw-quick");
340
340
  for (const g of a.quickReplies ?? []) {
341
341
  const S = o("button", void 0, g);
342
342
  S.addEventListener("click", () => {
343
343
  this.h.onSend(g), this.quick.style.display = "none";
344
344
  }), this.quick.append(S);
345
345
  }
346
- this.formHost = o("div", "ocw-form-host"), this.csatPanel = o("div", "ocw-csat"), this.csatPanel.style.display = "none", this.awayNotice = o("div", "ocw-away"), this.awayNotice.style.display = "none", this.preChatPanel = o("div", "ocw-prechat"), this.preChatPanel.style.display = "none", this.deflectPanel = o("div", "ocw-deflect"), this.deflectPanel.style.display = "none", this.input = o("textarea", void 0), this.input.rows = 1, this.input.placeholder = ((U = a.i18n) == null ? void 0 : U.placeholder) ?? "Message…";
346
+ this.formHost = o("div", "ocw-form-host"), this.csatPanel = o("div", "ocw-csat"), this.csatPanel.style.display = "none", this.awayNotice = o("div", "ocw-away"), this.awayNotice.style.display = "none", this.preChatPanel = o("div", "ocw-prechat"), this.preChatPanel.style.display = "none", this.deflectPanel = o("div", "ocw-deflect"), this.deflectPanel.style.display = "none", this.input = o("textarea", void 0), this.input.rows = 1, this.input.placeholder = ((V = a.i18n) == null ? void 0 : V.placeholder) ?? "Message…";
347
347
  const h = o("button", "ocw-sendbtn");
348
348
  h.type = "button";
349
349
  const v = (T = a.i18n) == null ? void 0 : T.send;
@@ -360,10 +360,10 @@ class Ke {
360
360
  var g;
361
361
  (g = u.files) != null && g[0] && this.h.onAttach && this.h.onAttach(u.files[0]), u.value = "";
362
362
  });
363
- const l = o("div", "ocw-input");
364
- l.append(r, u, this.input, h);
363
+ const d = o("div", "ocw-input");
364
+ d.append(r, u, this.input, h);
365
365
  const E = o("div", "ocw-footer");
366
- (($ = a.i18n) == null ? void 0 : $.poweredBy) !== void 0 ? E.textContent = a.i18n.poweredBy : E.innerHTML = 'Powered by <a href="https://relay.paramms.com" target="_blank" rel="noopener">Relay</a>', this.footer = E, e.append(c, this.chips, this.scroll, this.typing, this.quick, this.formHost, this.csatPanel, this.preChatPanel, this.deflectPanel, this.awayNotice, l, this.footer), this.cobrowseCanvas = o("canvas", "ocw-cobrowse-canvas"), this.cobrowseToolbar = o("div", "ocw-cobrowse-toolbar");
366
+ (($ = a.i18n) == null ? void 0 : $.poweredBy) !== void 0 ? E.textContent = a.i18n.poweredBy : E.innerHTML = 'Powered by <a href="https://relay.paramms.com" target="_blank" rel="noopener">Relay</a>', this.footer = E, e.append(c, this.chips, this.scroll, this.typing, this.quick, this.formHost, this.csatPanel, this.preChatPanel, this.deflectPanel, this.awayNotice, d, this.footer), this.cobrowseCanvas = o("canvas", "ocw-cobrowse-canvas"), this.cobrowseToolbar = o("div", "ocw-cobrowse-toolbar");
367
367
  for (const g of ["#f5713c", "#1c1b1a", "#2563eb", "#16a34a", "#dc2626"]) {
368
368
  const S = o("button", "ocw-cobrowse-swatch");
369
369
  S.style.background = g, S.type = "button", g === this.cobrowseColor && S.classList.add("sel"), S.addEventListener("click", () => {
@@ -418,7 +418,7 @@ class Ke {
418
418
  this.h.onTyping(!0, e), this.typingTimer && clearTimeout(this.typingTimer), this.typingTimer = setTimeout(() => this.h.onTyping(!1), 2e3);
419
419
  }
420
420
  render(e) {
421
- var r, u, l, E, m;
421
+ var r, u, d, E, m;
422
422
  if (this.storeRef = e, this.cobrowseBtn.classList.toggle("show", !!e.subject), !e.subject && this.cobrowseActive && (this.cobrowseActive = !1, this.updateCobrowseUI()), this.cobrowseActive && e.annotationVersion !== this.lastAnnotationVersion && (this.lastAnnotationVersion = e.annotationVersion, this.resizeCobrowseCanvas(), this.redrawCobrowse()), e.accent && this.root.style.setProperty("--ocw-accent", e.accent), this.e2eBadge.style.display = e.e2e ? "inline-flex" : "none", this.buildSubjectCard(e), e.subject) {
423
423
  const f = (r = this.cfg.subject) == null ? void 0 : r.ownerLabel;
424
424
  f && (this.headerName.textContent = f);
@@ -440,9 +440,9 @@ class Ke {
440
440
  this.typing.classList.toggle("active", w.length > 0);
441
441
  const b = this.typing.querySelector(".ocw-typing-bubble");
442
442
  b && b.setAttribute("aria-label", w.length ? "typing" : ""), this.footer.style.display = e.whiteLabel ? "none" : "block";
443
- const d = e.messages().some((f) => f.senderRole === "guest");
444
- if (!!((u = e.preChat) != null && u.enabled) && !this.preChatDone && !d && (e.preChat.showWhen !== "offline" || e.offline))
445
- this.preChatBuilt || this.buildPreChatPanel(e.preChat), this.preChatPanel.style.display = "block", this.awayNotice.style.display = "none", (l = this.root.querySelector(".ocw-input")) == null || l.style.setProperty("display", "none");
443
+ const l = e.messages().some((f) => f.senderRole === "guest");
444
+ if (!!((u = e.preChat) != null && u.enabled) && !this.preChatDone && !l && (e.preChat.showWhen !== "offline" || e.offline))
445
+ this.preChatBuilt || this.buildPreChatPanel(e.preChat), this.preChatPanel.style.display = "block", this.awayNotice.style.display = "none", (d = this.root.querySelector(".ocw-input")) == null || d.style.setProperty("display", "none");
446
446
  else {
447
447
  if (this.preChatPanel.style.display = "none", e.offline) {
448
448
  this.awayNotice.firstChild || this.awayNotice.append(o("span", "ocw-away-icon", "🌙"), o("span", "", ""));
@@ -465,7 +465,7 @@ class Ke {
465
465
  this.connStatus.className = `ocw-conn-status${s ? " err" : e === "reconnecting" ? " warn" : ""}`, this.connStatus.textContent = s ? `⚠ ${i ?? "Chat unavailable"}` : e === "reconnecting" ? i ?? "↻ reconnecting…" : "● connecting…";
466
466
  }
467
467
  buildPreChatPanel(e) {
468
- var d;
468
+ var l;
469
469
  this.preChatBuilt = !0, this.preChatPanel.replaceChildren(), this.preChatPanel.append(o("div", "ocw-prechat-title", e.title ?? "Before we start…"));
470
470
  const i = o("div", "ocw-offline-form"), s = {};
471
471
  for (const h of e.fields ?? ["name", "email"]) {
@@ -473,7 +473,7 @@ class Ke {
473
473
  v.type = h === "email" ? "email" : h === "phone" ? "tel" : "text", v.placeholder = h === "name" ? "Your name" : h === "email" ? "Your email" : "Your phone number", s[h] = v, i.append(v);
474
474
  }
475
475
  let a = null;
476
- if ((d = e.topics) != null && d.length) {
476
+ if ((l = e.topics) != null && l.length) {
477
477
  a = o("select", void 0);
478
478
  const h = document.createElement("option");
479
479
  h.value = "", h.textContent = "What is this about?", a.append(h);
@@ -490,13 +490,13 @@ class Ke {
490
490
  }
491
491
  const b = o("button", "ocw-offline-submit", "Start chat");
492
492
  b.type = "button", b.addEventListener("click", () => {
493
- var u, l, E, m, f, k, I;
493
+ var u, d, E, m, f, k, I;
494
494
  const h = (u = s.email) == null ? void 0 : u.value.trim();
495
495
  if (s.email && (!h || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(h))) {
496
496
  s.email.focus();
497
497
  return;
498
498
  }
499
- const v = !!(c != null && c.checked), r = (((l = s.phone) == null ? void 0 : l.value) ?? (w == null ? void 0 : w.value) ?? "").trim();
499
+ const v = !!(c != null && c.checked), r = (((d = s.phone) == null ? void 0 : d.value) ?? (w == null ? void 0 : w.value) ?? "").trim();
500
500
  if (v && !r) {
501
501
  (E = s.phone ?? w) == null || E.focus();
502
502
  return;
@@ -571,8 +571,8 @@ class Ke {
571
571
  bindCobrowsePointerEvents() {
572
572
  let e = !1, i = [];
573
573
  const s = (w) => {
574
- const b = this.cobrowseCanvas.getBoundingClientRect(), d = b.width > 0 ? (w.clientX - b.left) / b.width : 0, h = b.height > 0 ? (w.clientY - b.top) / b.height : 0;
575
- return { x: Math.min(1, Math.max(0, d)), y: Math.min(1, Math.max(0, h)) };
574
+ const b = this.cobrowseCanvas.getBoundingClientRect(), l = b.width > 0 ? (w.clientX - b.left) / b.width : 0, h = b.height > 0 ? (w.clientY - b.top) / b.height : 0;
575
+ return { x: Math.min(1, Math.max(0, l)), y: Math.min(1, Math.max(0, h)) };
576
576
  }, a = 6e-3;
577
577
  this.cobrowseCanvas.addEventListener("pointerdown", (w) => {
578
578
  this.cobrowseActive && (e = !0, i = [s(w)], this.cobrowseCanvas.setPointerCapture(w.pointerId));
@@ -580,9 +580,9 @@ class Ke {
580
580
  e && (i.push(s(w)), this.redrawCobrowse(), this.drawStroke({ points: i, color: this.cobrowseColor, width: a }));
581
581
  });
582
582
  const c = (w) => {
583
- var b, d;
583
+ var b, l;
584
584
  if (e) {
585
- e = !1, i.length > 1 && ((d = (b = this.h).onAnnotate) == null || d.call(b, { id: `an_${Date.now()}_${Math.random().toString(36).slice(2)}`, points: i, color: this.cobrowseColor, width: a })), i = [];
585
+ e = !1, i.length > 1 && ((l = (b = this.h).onAnnotate) == null || l.call(b, { id: `an_${Date.now()}_${Math.random().toString(36).slice(2)}`, points: i, color: this.cobrowseColor, width: a })), i = [];
586
586
  try {
587
587
  this.cobrowseCanvas.releasePointerCapture(w.pointerId);
588
588
  } catch {
@@ -597,7 +597,7 @@ class Ke {
597
597
  if (!a) return;
598
598
  this.subjectBuilt = !0, this.subjectCard.replaceChildren(), this.subjectCard.append(o("div", "ocw-subject-title", a)), s != null && s.subtitle && this.subjectCard.append(o("div", "ocw-subject-sub", s.subtitle));
599
599
  const c = o("div", "ocw-tags");
600
- if (i) for (const [b, d] of Object.entries(i.fields)) c.append(o("span", "ocw-tag", `${b}: ${d}`));
600
+ if (i) for (const [b, l] of Object.entries(i.fields)) c.append(o("span", "ocw-tag", `${b}: ${l}`));
601
601
  else for (const b of (s == null ? void 0 : s.tags) ?? []) c.append(o("span", "ocw-tag", b));
602
602
  c.childNodes.length && this.subjectCard.append(c);
603
603
  const w = (i == null ? void 0 : i.state) ?? (s == null ? void 0 : s.status);
@@ -615,18 +615,18 @@ class Ke {
615
615
  return new Promise((i) => {
616
616
  const s = o("div", "ocw-modal"), a = o("div", "ocw-modal-card");
617
617
  a.append(o("div", "ocw-modal-title", e)), a.append(o("div", "ocw-modal-body", `Confirm “${e}”?`));
618
- const c = o("div", "ocw-modal-actions"), w = o("button", "ocw-modal-cancel", "Cancel"), b = o("button", "ocw-modal-ok", "Confirm"), d = (h) => {
618
+ const c = o("div", "ocw-modal-actions"), w = o("button", "ocw-modal-cancel", "Cancel"), b = o("button", "ocw-modal-ok", "Confirm"), l = (h) => {
619
619
  s.remove(), i(h);
620
620
  };
621
- w.addEventListener("click", () => d(!1)), b.addEventListener("click", () => d(!0)), s.addEventListener("click", (h) => {
622
- h.target === s && d(!1);
621
+ w.addEventListener("click", () => l(!1)), b.addEventListener("click", () => l(!0)), s.addEventListener("click", (h) => {
622
+ h.target === s && l(!1);
623
623
  }), c.append(w, b), a.append(c), s.append(a), this.root.append(s), b.focus();
624
624
  });
625
625
  }
626
626
  /** Inline form for a form-effect action: typed inputs (date picker, number,
627
627
  * text) rendered above the composer — no browser prompts. */
628
628
  openForm(e) {
629
- var b, d;
629
+ var b, l;
630
630
  this.formHost.replaceChildren();
631
631
  const i = o("div", "ocw-form");
632
632
  i.append(o("div", "ocw-form-title", e.icon ? `${e.icon} ${e.label}` : e.label));
@@ -637,8 +637,8 @@ class Ke {
637
637
  const r = o("select", "ocw-form-input");
638
638
  h.required || r.append(o("option", void 0, "— select —"));
639
639
  for (const u of h.options) {
640
- const l = o("option");
641
- l.value = u, l.textContent = u, r.append(l);
640
+ const d = o("option");
641
+ d.value = u, d.textContent = u, r.append(d);
642
642
  }
643
643
  h.required && (r.required = !0), v.append(r), s.set(h.name, r);
644
644
  } else {
@@ -658,7 +658,7 @@ class Ke {
658
658
  h[v] = r.type === "number" ? Number(r.value) : r.value;
659
659
  }
660
660
  this.formHost.replaceChildren(), this.h.onInvoke(e.id, h);
661
- }), a.append(c, w), i.append(a), this.formHost.append(i), (d = s.values().next().value) == null || d.focus();
661
+ }), a.append(c, w), i.append(a), this.formHost.append(i), (l = s.values().next().value) == null || l.focus();
662
662
  }
663
663
  messageEl(e, i) {
664
664
  var r;
@@ -673,58 +673,58 @@ class Ke {
673
673
  const u = o("div", "ocw-reply-to", "↩ replying to a message");
674
674
  u.style.cssText = "font-size:11px;color:var(--ocw-mut);margin-bottom:2px;font-style:italic", w.append(u);
675
675
  }
676
- const d = o("div", "ocw-bubble");
676
+ const l = o("div", "ocw-bubble");
677
677
  let h = null;
678
- if (e.deletedAt) d.append(o("span", "ocw-deleted", "message deleted"));
678
+ if (e.deletedAt) l.append(o("span", "ocw-deleted", "message deleted"));
679
679
  else if (e.content.kind === "attachment") {
680
680
  const u = e.content;
681
681
  if ((r = u.mime) != null && r.startsWith("image/")) {
682
- const l = document.createElement("img");
683
- l.src = u.url, l.alt = u.name ?? "image", l.style.cssText = "max-width:220px;max-height:160px;border-radius:10px;display:block;cursor:pointer", l.addEventListener("click", () => window.open(u.url, "_blank")), d.append(l);
682
+ const d = document.createElement("img");
683
+ d.src = u.url, d.alt = u.name ?? "image", d.style.cssText = "max-width:220px;max-height:160px;border-radius:10px;display:block;cursor:pointer", d.addEventListener("click", () => window.open(u.url, "_blank")), l.append(d);
684
684
  } else {
685
- const l = document.createElement("a");
686
- l.href = u.url, l.target = "_blank", l.rel = "noopener", l.style.cssText = "display:flex;align-items:center;gap:8px;color:inherit;text-decoration:none", l.append(o("span", void 0, "📄"), o("span", void 0, u.name ?? "file")), d.append(l);
685
+ const d = document.createElement("a");
686
+ d.href = u.url, d.target = "_blank", d.rel = "noopener", d.style.cssText = "display:flex;align-items:center;gap:8px;color:inherit;text-decoration:none", d.append(o("span", void 0, "📄"), o("span", void 0, u.name ?? "file")), l.append(d);
687
687
  }
688
688
  } else if (e.content.kind === "appointment") {
689
- const u = e.content, l = o("div", "ocw-appt");
690
- l.append(o("div", "ocw-appt-title", `📅 ${u.title}`)), l.append(o("div", "ocw-appt-time", new Date(u.startIso).toLocaleString() + " – " + new Date(u.endIso).toLocaleTimeString())), u.location && l.append(o("div", "ocw-appt-loc", `📍 ${u.location}`)), u.description && l.append(o("div", "ocw-appt-desc", u.description));
689
+ const u = e.content, d = o("div", "ocw-appt");
690
+ d.append(o("div", "ocw-appt-title", `📅 ${u.title}`)), d.append(o("div", "ocw-appt-time", new Date(u.startIso).toLocaleString() + " – " + new Date(u.endIso).toLocaleTimeString())), u.location && d.append(o("div", "ocw-appt-loc", `📍 ${u.location}`)), u.description && d.append(o("div", "ocw-appt-desc", u.description));
691
691
  const E = o("div", "ocw-appt-links"), m = document.createElement("a");
692
692
  m.href = u.googleUrl, m.target = "_blank", m.rel = "noopener", m.className = "ocw-appt-btn", m.textContent = "📅 Add to Google Calendar";
693
693
  const f = document.createElement("a");
694
- f.href = u.icalUrl, f.download = `${u.title}.ics`, f.className = "ocw-appt-btn ocw-appt-btn-sec", f.textContent = "🍎 Apple / iCal", E.append(m, f), l.append(E), d.append(l);
694
+ f.href = u.icalUrl, f.download = `${u.title}.ics`, f.className = "ocw-appt-btn ocw-appt-btn-sec", f.textContent = "🍎 Apple / iCal", E.append(m, f), d.append(E), l.append(d);
695
695
  } else
696
- h = document.createTextNode(ie(e.content)), d.append(h), e.editedAt && d.append(o("span", "ocw-edited", "(edited)"));
697
- if (b.append(d), !s && !a && this.h.onTranslate && e.content.kind === "text" && !e.deletedAt && e.seq > 0 && h) {
696
+ h = document.createTextNode(ie(e.content)), l.append(h), e.editedAt && l.append(o("span", "ocw-edited", "(edited)"));
697
+ if (b.append(l), !s && !a && this.h.onTranslate && e.content.kind === "text" && !e.deletedAt && e.seq > 0 && h) {
698
698
  const u = e.content.text;
699
699
  if (u.trim()) {
700
- const l = o("button", "ocw-translate-btn", "🌐");
701
- l.type = "button", l.title = "Translate", l.addEventListener("click", (E) => {
700
+ const d = o("button", "ocw-translate-btn", "🌐");
701
+ d.type = "button", d.title = "Translate", d.addEventListener("click", (E) => {
702
702
  if (E.stopPropagation(), this.showingTranslation.has(e.id)) {
703
- this.showingTranslation.delete(e.id), h.textContent = u, l.textContent = "🌐", l.title = "Translate";
703
+ this.showingTranslation.delete(e.id), h.textContent = u, d.textContent = "🌐", d.title = "Translate";
704
704
  return;
705
705
  }
706
706
  const m = this.translationCache.get(e.id);
707
707
  if (m !== void 0) {
708
- this.showingTranslation.add(e.id), h.textContent = m, l.textContent = "↩", l.title = "Show original";
708
+ this.showingTranslation.add(e.id), h.textContent = m, d.textContent = "↩", d.title = "Show original";
709
709
  return;
710
710
  }
711
- l.textContent = "⏳", this.h.onTranslate(u).then((f) => {
711
+ d.textContent = "⏳", this.h.onTranslate(u).then((f) => {
712
712
  if (f === null) {
713
- l.textContent = "⚠️", l.title = "Translation unavailable", setTimeout(() => {
714
- l.textContent = "🌐", l.title = "Translate";
713
+ d.textContent = "⚠️", d.title = "Translation unavailable", setTimeout(() => {
714
+ d.textContent = "🌐", d.title = "Translate";
715
715
  }, 1500);
716
716
  return;
717
717
  }
718
- this.translationCache.set(e.id, f), this.showingTranslation.add(e.id), h.textContent = f, l.textContent = "↩", l.title = "Show original";
718
+ this.translationCache.set(e.id, f), this.showingTranslation.add(e.id), h.textContent = f, d.textContent = "↩", d.title = "Show original";
719
719
  });
720
- }), b.append(l);
720
+ }), b.append(d);
721
721
  }
722
722
  }
723
723
  if (s && !e.deletedAt && e.seq > 0 && (this.h.onEdit ?? this.h.onDelete)) {
724
724
  const u = o("div", "ocw-msg-menu");
725
725
  if (this.h.onEdit) {
726
- const l = o("button", void 0, "✏️");
727
- l.title = "Edit", l.addEventListener("click", (E) => {
726
+ const d = o("button", void 0, "✏️");
727
+ d.title = "Edit", d.addEventListener("click", (E) => {
728
728
  E.stopPropagation();
729
729
  const m = ie(e.content), f = document.createElement("textarea");
730
730
  f.value = m, f.rows = Math.min(4, Math.ceil(m.length / 40) + 1), f.style.cssText = "width:100%;resize:vertical;border:1px solid var(--ocw-accent);border-radius:8px;padding:6px 10px;font:inherit;font-size:14px;background:#fff;color:#1c1b1a;box-sizing:border-box";
@@ -735,33 +735,33 @@ class Ke {
735
735
  const P = o("div");
736
736
  P.style.cssText = "display:flex;gap:6px;justify-content:flex-end", P.append(I, k);
737
737
  const C = o("div");
738
- C.append(f, P), d.replaceChildren(C), f.focus(), f.select();
739
- const R = () => d.replaceChildren(h ?? document.createTextNode(m));
738
+ C.append(f, P), l.replaceChildren(C), f.focus(), f.select();
739
+ const R = () => l.replaceChildren(h ?? document.createTextNode(m));
740
740
  I.addEventListener("click", R), k.addEventListener("click", () => {
741
741
  const A = f.value.trim();
742
742
  A && A !== m && this.h.onEdit(e.id, A), R();
743
743
  }), f.addEventListener("keydown", (A) => {
744
744
  A.key === "Enter" && !A.shiftKey && (A.preventDefault(), k.click()), A.key === "Escape" && R();
745
745
  });
746
- }), u.append(l);
746
+ }), u.append(d);
747
747
  }
748
748
  if (this.h.onDelete) {
749
- const l = o("button", "del", "🗑");
750
- l.title = "Delete", l.addEventListener("click", (E) => {
749
+ const d = o("button", "del", "🗑");
750
+ d.title = "Delete", d.addEventListener("click", (E) => {
751
751
  E.stopPropagation(), this.h.onDelete(e.id);
752
- }), u.append(l);
752
+ }), u.append(d);
753
753
  }
754
754
  b.append(u);
755
755
  }
756
756
  if (w.append(b), this.h.onReact && !e.deletedAt && e.seq > 0) {
757
- const u = o("div", "ocw-react-wrap"), l = o("div", "ocw-react");
757
+ const u = o("div", "ocw-react-wrap"), d = o("div", "ocw-react");
758
758
  if (e.reactions && Object.keys(e.reactions).length)
759
759
  for (const [f, k] of Object.entries(e.reactions)) {
760
760
  const I = o("button", `ocw-react-pill${k.includes(this.me) ? " mine" : ""}`, `${f} ${k.length}`);
761
761
  I.addEventListener("click", () => {
762
762
  var P, C;
763
763
  return (C = (P = this.h).onReact) == null ? void 0 : C.call(P, e.id, f, k.includes(this.me));
764
- }), l.append(I);
764
+ }), d.append(I);
765
765
  }
766
766
  const E = o("button", "ocw-react-btn", "+"), m = o("div", "ocw-react-picker");
767
767
  for (const f of He) {
@@ -779,8 +779,8 @@ class Ke {
779
779
  m.style.display = k ? "flex" : "none", k && document.addEventListener("click", () => {
780
780
  m.style.display = "none";
781
781
  }, { once: !0 });
782
- }), l.append(E), u.append(l, m), w.append(u);
783
- } else e.reactions && Object.keys(e.reactions).length && w.append(o("div", "ocw-react", Object.entries(e.reactions).map(([u, l]) => `${u}${l.length}`).join(" ")));
782
+ }), d.append(E), u.append(d, m), w.append(u);
783
+ } else e.reactions && Object.keys(e.reactions).length && w.append(o("div", "ocw-react", Object.entries(e.reactions).map(([u, d]) => `${u}${d.length}`).join(" ")));
784
784
  const v = o("div", "ocw-time ocw-meta", Ve(e.ts));
785
785
  if (s && e.status) {
786
786
  const u = o("span", `ocw-tick${e.status === "read" ? " read" : e.status === "delivered" ? " delivered" : ""}`, Ge(e.status));
@@ -801,15 +801,15 @@ function Ge(t) {
801
801
  return "🕓";
802
802
  }
803
803
  }
804
- const O = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new Map();
804
+ const O = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new Map();
805
805
  function me(t) {
806
806
  return `relay-launcher::${t.profileId}::${t.subjectId ?? ""}`;
807
807
  }
808
- let F = null;
808
+ let W = null;
809
809
  function Ye() {
810
- if (F && F.state !== "closed") return F;
810
+ if (W && W.state !== "closed") return W;
811
811
  try {
812
- return F = new AudioContext(), F;
812
+ return W = new AudioContext(), W;
813
813
  } catch {
814
814
  return null;
815
815
  }
@@ -820,20 +820,20 @@ function tt(t) {
820
820
  }
821
821
  function ot(t) {
822
822
  var le, de, pe, he, ue;
823
- O.has(t.el) && (O.get(t.el).close(), O.delete(t.el)), t.launcher && ((le = X.get(me(t))) == null || le.close());
823
+ O.has(t.el) && (O.get(t.el).close(), O.delete(t.el)), t.launcher && ((le = Q.get(me(t))) == null || le.close());
824
824
  const e = Pe();
825
825
  let i, s = !1;
826
826
  const a = t.token ?? t.userId ?? e, c = a !== e ? e : void 0, { wsUrl: w, httpBase: b } = Ae(t.url, t.apiUrl);
827
- let d = new Me(a);
827
+ let l = new Me(a);
828
828
  const h = t.subjectId ? `${a}::${t.subjectId}` : a, v = new $e(h);
829
- let r, u = !1, l = null, E = null, m = null, f = null;
829
+ let r, u = !1, d = null, E = null, m = null, f = null;
830
830
  !t.launcher && !t.el.style.height && t.el.clientHeight === 0 && (t.el.style.width = t.el.style.width || "100%", t.el.style.height = "600px");
831
- for (const n of v.load()) d.addOptimistic(n.clientMsgId, n.content);
831
+ for (const n of v.load()) l.addOptimistic(n.clientMsgId, n.content);
832
832
  let k = null, I = null, P = 0, C = !t.launcher;
833
833
  if (t.launcher) {
834
834
  const p = (t.position ?? "bottom-right").includes("right");
835
835
  k = document.createElement("div"), k.style.cssText = `position:fixed;${p ? "right:20px" : "left:20px"};bottom:20px;z-index:9999;display:flex;flex-direction:column;align-items:${p ? "flex-end" : "flex-start"};gap:12px`;
836
- const x = document.createElement("div"), j = typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(max-width: 479px)") : null, V = (L) => {
836
+ const x = document.createElement("div"), j = typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(max-width: 479px)") : null, F = (L) => {
837
837
  t.el.classList.toggle("ocw-fs", L), x.style.cssText = L ? [
838
838
  "position:fixed",
839
839
  "inset:0",
@@ -863,10 +863,10 @@ function ot(t) {
863
863
  "transform:scale(.95)"
864
864
  ].join(";");
865
865
  };
866
- V((j == null ? void 0 : j.matches) ?? !1);
867
- const K = (L) => V(L.matches);
868
- j == null || j.addEventListener("change", K), l = j, E = K, t.el.style.cssText = "width:100%;height:100%;overflow:hidden", x.append(t.el);
869
- const Q = '<svg viewBox="0 0 24 24" width="26" height="26" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>', Z = '<svg viewBox="0 0 24 24" width="22" height="22" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"/></svg>', M = document.createElement("button");
866
+ F((j == null ? void 0 : j.matches) ?? !1);
867
+ const U = (L) => F(L.matches);
868
+ j == null || j.addEventListener("change", U), d = j, E = U, t.el.style.cssText = "width:100%;height:100%;overflow:hidden", x.append(t.el);
869
+ const G = '<svg viewBox="0 0 24 24" width="26" height="26" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>', Y = '<svg viewBox="0 0 24 24" width="22" height="22" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"/></svg>', M = document.createElement("button");
870
870
  M.type = "button", M.style.cssText = [
871
871
  "width:56px;height:56px;border-radius:50%",
872
872
  `background:${t.accent ?? "#4F63F5"}`,
@@ -880,11 +880,11 @@ function ot(t) {
880
880
  }, M.onmouseleave = () => {
881
881
  M.style.transform = "scale(1)";
882
882
  }, I = document.createElement("span"), I.style.cssText = "position:absolute;top:-4px;right:-4px;background:#ef4444;color:#fff;border-radius:50%;width:20px;height:20px;font-size:11px;font-weight:700;display:none;align-items:center;justify-content:center";
883
- const G = () => {
884
- M.innerHTML = C ? Z : Q, M.setAttribute("aria-label", C ? "Close chat" : "Open chat"), M.setAttribute("aria-expanded", String(C)), M.append(I);
883
+ const X = () => {
884
+ M.innerHTML = C ? Y : G, M.setAttribute("aria-label", C ? "Close chat" : "Open chat"), M.setAttribute("aria-expanded", String(C)), M.append(I);
885
885
  };
886
- G(), k.append(x, M), document.body.append(k);
887
- const ee = `ocw-teaser-dismissed::${t.profileId}`, Y = typeof t.launcherMessage == "string" ? { title: t.launcherMessage } : t.launcherMessage;
886
+ X(), k.append(x, M), document.body.append(k);
887
+ const ee = `ocw-teaser-dismissed::${t.profileId}`, J = typeof t.launcherMessage == "string" ? { title: t.launcherMessage } : t.launcherMessage;
888
888
  let z = null;
889
889
  const Se = () => {
890
890
  try {
@@ -893,7 +893,7 @@ function ot(t) {
893
893
  return !1;
894
894
  }
895
895
  }, ze = '<svg viewBox="0 0 24 24" width="15" height="15" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>', fe = () => {
896
- const L = Y != null && Y.title ? Y : d.launcherMessage ?? void 0;
896
+ const L = J != null && J.title ? J : l.launcherMessage ?? void 0;
897
897
  if (!(!!(L != null && L.title) && !C && !Se())) {
898
898
  z && (z.remove(), z = null);
899
899
  return;
@@ -930,7 +930,7 @@ function ot(t) {
930
930
  z && (z.remove(), z = null);
931
931
  }), z.append(H);
932
932
  const we = () => {
933
- C || (C = !0, te(!0), G(), P = 0, I && (I.style.display = "none"), z && (z.remove(), z = null));
933
+ C || (C = !0, te(!0), X(), P = 0, I && (I.style.display = "none"), z && (z.remove(), z = null));
934
934
  };
935
935
  z.addEventListener("click", we), z.addEventListener("keydown", (D) => {
936
936
  (D.key === "Enter" || D.key === " ") && (D.preventDefault(), we());
@@ -949,7 +949,7 @@ function ot(t) {
949
949
  }, 180));
950
950
  };
951
951
  M.addEventListener("click", () => {
952
- if (C = !C, te(C), G(), C) {
952
+ if (C = !C, te(C), X(), C) {
953
953
  P = 0, I && (I.style.display = "none");
954
954
  try {
955
955
  sessionStorage.setItem(ee, "1");
@@ -958,7 +958,7 @@ function ot(t) {
958
958
  }
959
959
  f == null || f();
960
960
  }), m = (L) => {
961
- L.key === "Escape" && C && (C = !1, te(!1), G());
961
+ L.key === "Escape" && C && (C = !1, te(!1), X());
962
962
  }, document.addEventListener("keydown", m);
963
963
  }
964
964
  const R = () => {
@@ -973,7 +973,7 @@ function ot(t) {
973
973
  p.connect(x), x.connect(n.destination), p.frequency.setValueAtTime(880, n.currentTime), p.frequency.exponentialRampToValueAtTime(440, n.currentTime + 0.15), x.gain.setValueAtTime(0.3, n.currentTime), x.gain.exponentialRampToValueAtTime(1e-3, n.currentTime + 0.3), p.start(), p.stop(n.currentTime + 0.3);
974
974
  } catch {
975
975
  }
976
- }, N = [], U = (n) => {
976
+ }, N = [], V = (n) => {
977
977
  for (; N.length; ) {
978
978
  const p = N.shift();
979
979
  v.add({ clientMsgId: p.clientMsgId, content: p.content, ts: Date.now() }), T.send({ type: "send", conversationId: n, clientMsgId: p.clientMsgId, content: p.content });
@@ -984,7 +984,7 @@ function ot(t) {
984
984
  let g = !1;
985
985
  const S = [], q = [];
986
986
  let se = !1;
987
- const J = (n, p) => {
987
+ const Z = (n, p) => {
988
988
  $.sealText(p).then((x) => {
989
989
  r && T.send({ type: "send", conversationId: r, clientMsgId: n, content: x });
990
990
  });
@@ -995,11 +995,11 @@ function ot(t) {
995
995
  }, ve = () => {
996
996
  for (; S.length; ) {
997
997
  const n = S.shift();
998
- J(n.clientMsgId, n.text);
998
+ Z(n.clientMsgId, n.text);
999
999
  }
1000
1000
  for (; q.length; ) {
1001
1001
  const n = q.shift();
1002
- J(n.clientMsgId, n.text);
1002
+ Z(n.clientMsgId, n.text);
1003
1003
  }
1004
1004
  }, ke = (n) => {
1005
1005
  T.send({ type: "fetchPrekey", targetUserId: n });
@@ -1008,12 +1008,12 @@ function ot(t) {
1008
1008
  const ae = new Oe(), re = `oc_prechat_${t.profileId}_${a.slice(-8)}`, B = new Ke(t.el, a, {
1009
1009
  onSend(n) {
1010
1010
  const p = `cm_${Math.random().toString(36).slice(2)}`, x = { kind: "text", text: n };
1011
- d.addOptimistic(p, x), B.render(d), d.e2e ? $.ready ? J(p, n) : se ? q.push({ clientMsgId: p, text: n }) : (S.push({ clientMsgId: p, text: n }), d.assignedAgentId && ke(d.assignedAgentId)) : r ? (v.add({ clientMsgId: p, content: x, ts: Date.now() }), T.send({ type: "send", conversationId: r, clientMsgId: p, content: x })) : N.push({ clientMsgId: p, content: x });
1011
+ l.addOptimistic(p, x), B.render(l), l.e2e ? $.ready ? Z(p, n) : se ? q.push({ clientMsgId: p, text: n }) : (S.push({ clientMsgId: p, text: n }), l.assignedAgentId && ke(l.assignedAgentId)) : r ? (v.add({ clientMsgId: p, content: x, ts: Date.now() }), T.send({ type: "send", conversationId: r, clientMsgId: p, content: x })) : N.push({ clientMsgId: p, content: x });
1012
1012
  },
1013
1013
  async onAttach(n) {
1014
1014
  if (!r) return;
1015
1015
  const p = `${b}/upload?name=${encodeURIComponent(n.name)}`, x = `cm_${Math.random().toString(36).slice(2)}`;
1016
- d.addOptimistic(x, { kind: "text", text: `📎 Uploading ${n.name}…` }), B.render(d);
1016
+ l.addOptimistic(x, { kind: "text", text: `📎 Uploading ${n.name}…` }), B.render(l);
1017
1017
  try {
1018
1018
  const j = await fetch(p, {
1019
1019
  method: "POST",
@@ -1026,10 +1026,10 @@ function ot(t) {
1026
1026
  body: n
1027
1027
  });
1028
1028
  if (!j.ok) throw new Error(`Upload failed: ${j.status}`);
1029
- const { url: V, name: K, mime: Q, size: Z } = await j.json();
1030
- T.send({ type: "send", conversationId: r, clientMsgId: x, content: { kind: "attachment", url: V, name: K, mime: Q, size: Z } });
1029
+ const { url: F, name: U, mime: G, size: Y } = await j.json();
1030
+ l.addOptimistic(x, { kind: "attachment", url: F, name: U, mime: G, size: Y }), B.render(l), T.send({ type: "send", conversationId: r, clientMsgId: x, content: { kind: "attachment", url: F, name: U, mime: G, size: Y } });
1031
1031
  } catch (j) {
1032
- d.addOptimistic(x, { kind: "text", text: `⚠️ Upload failed: ${j.message}` }), B.render(d);
1032
+ l.addOptimistic(x, { kind: "text", text: `⚠️ Upload failed: ${j.message}` }), B.render(l);
1033
1033
  }
1034
1034
  },
1035
1035
  onInvoke(n, p) {
@@ -1057,7 +1057,7 @@ function ot(t) {
1057
1057
  }
1058
1058
  });
1059
1059
  const p = n.callback ? `📞 Call-back requested${n.phone ? `: ${n.phone}` : ""}${n.topic ? ` — ${n.topic}` : ""}` : n.topic ? `Topic: ${n.topic}` : "";
1060
- p && r && !d.e2e && T.send({ type: "send", conversationId: r, clientMsgId: `pc_${Math.random().toString(36).slice(2, 12)}`, content: { kind: "text", text: p } });
1060
+ p && r && !l.e2e && T.send({ type: "send", conversationId: r, clientMsgId: `pc_${Math.random().toString(36).slice(2, 12)}`, content: { kind: "text", text: p } });
1061
1061
  },
1062
1062
  onDeflectQuery(n) {
1063
1063
  if (s) return;
@@ -1075,8 +1075,8 @@ function ot(t) {
1075
1075
  r && T.send({ type: "read", conversationId: r, seq: n });
1076
1076
  },
1077
1077
  onLoadMore() {
1078
- if (!r || !d.e2e) return;
1079
- const n = d.messages()[0];
1078
+ if (!r || !l.e2e) return;
1079
+ const n = l.messages()[0];
1080
1080
  n && T.send({ type: "history", conversationId: r, beforeSeq: n.seq, limit: 20 });
1081
1081
  },
1082
1082
  onEdit(n, p) {
@@ -1156,7 +1156,7 @@ function ot(t) {
1156
1156
  url: w,
1157
1157
  token: a,
1158
1158
  open: Ie,
1159
- getCursor: () => d.highestSeq(),
1159
+ getCursor: () => l.highestSeq(),
1160
1160
  onStatusChange: (n, p) => B.setConnStatus(n, p),
1161
1161
  onFrame(n) {
1162
1162
  if (ae.apply(n), n.type === "opened") {
@@ -1165,47 +1165,47 @@ function ot(t) {
1165
1165
  for (const p of v.load())
1166
1166
  T.send({ type: "send", conversationId: r, clientMsgId: p.clientMsgId, content: p.content });
1167
1167
  }
1168
- Be(w, a, r, d, B, b), N.length && U(r);
1168
+ Be(w, a, r, l, B, b), N.length && V(r);
1169
1169
  }
1170
1170
  if (n.type === "ack" && v.remove(n.clientMsgId), n.type === "prekeyBundle") {
1171
1171
  n.bundle && (se = !0, $.x3dhSendTo(n.bundle).then((p) => {
1172
1172
  const x = [...S.splice(0), ...q.splice(0)];
1173
1173
  for (const j of x) ye(j.clientMsgId, j.text, p);
1174
- B.render(d);
1174
+ B.render(l);
1175
1175
  }));
1176
1176
  return;
1177
1177
  }
1178
- if (n.type === "message" && d.e2e) {
1178
+ if (n.type === "message" && l.e2e) {
1179
1179
  const p = Ne(n.message.content);
1180
1180
  if (p && !$.ready) {
1181
1181
  $.x3dhReceiveFrom(p.x3dhIK, p.x3dhEK, p.x3dhSPK).then(async () => {
1182
- await $.openFrame(n), d.apply(n), B.render(d);
1182
+ await $.openFrame(n), l.apply(n), B.render(l);
1183
1183
  });
1184
1184
  return;
1185
1185
  }
1186
1186
  }
1187
1187
  if (n.type === "peerkey") {
1188
1188
  $.onPeerKey(n.key).then(() => {
1189
- ve(), B.render(d);
1189
+ ve(), B.render(l);
1190
1190
  });
1191
1191
  return;
1192
1192
  }
1193
1193
  (async () => {
1194
- if (d.e2e && await $.openFrame(n), d.apply(n), n.type === "manifest" && (f == null || f()), n.type === "message" && n.message.senderId !== a && !n.message.internal && (R(), A()), d.e2e && r && !g) {
1194
+ if (l.e2e && await $.openFrame(n), l.apply(n), n.type === "manifest" && (f == null || f()), n.type === "message" && n.message.senderId !== a && !n.message.internal && (R(), A()), l.e2e && r && !g) {
1195
1195
  g = !0;
1196
1196
  const p = await $.initX3DH();
1197
1197
  T.send({ type: "uploadPrekeys", ...p });
1198
1198
  const x = await $.begin();
1199
1199
  T.send({ type: "pubkey", conversationId: r, key: x });
1200
1200
  }
1201
- B.render(d);
1201
+ B.render(l);
1202
1202
  })();
1203
1203
  }
1204
- }), T.connect(), B.render(d);
1205
- const _ = t.launcher ? me(t) : null, W = { close: () => {
1206
- s = !0, clearTimeout(i), T.close(), k == null || k.remove(), B.destroy(), ae.destroy(), l && E && l.removeEventListener("change", E), m && (document.removeEventListener("keydown", m), m = null), O.delete(t.el), _ && X.get(_) === W && X.delete(_);
1204
+ }), T.connect(), B.render(l);
1205
+ const _ = t.launcher ? me(t) : null, K = { close: () => {
1206
+ s = !0, clearTimeout(i), T.close(), k == null || k.remove(), B.destroy(), ae.destroy(), d && E && d.removeEventListener("change", E), m && (document.removeEventListener("keydown", m), m = null), O.delete(t.el), _ && Q.get(_) === K && Q.delete(_);
1207
1207
  } };
1208
- return O.set(t.el, W), _ && X.set(_, W), W;
1208
+ return O.set(t.el, K), _ && Q.set(_, K), K;
1209
1209
  }
1210
1210
  export {
1211
1211
  Me as ChatStore,