@paramms/chat-widget 1.0.12 → 1.0.14

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
@@ -1,9 +1,9 @@
1
- var Te = Object.defineProperty;
2
- var Ue = (s, e, t) => e in s ? Te(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var r = (s, e, t) => Ue(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { p as Pe, r as Be, h as Ke } from "./uid.js";
5
- const Rt = (s) => s;
6
- function Ae(s) {
1
+ var Pe = Object.defineProperty;
2
+ var Be = (s, e, t) => e in s ? Pe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var r = (s, e, t) => Be(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { p as Ke, r as Ae, h as ze } from "./uid.js";
5
+ const jt = (s) => s;
6
+ function Le(s) {
7
7
  const e = s.length;
8
8
  let t = 0, n = 0;
9
9
  for (; n < e; ) {
@@ -25,7 +25,7 @@ function Ae(s) {
25
25
  }
26
26
  return t;
27
27
  }
28
- function ze(s, e, t) {
28
+ function Me(s, e, t) {
29
29
  const n = s.length;
30
30
  let i = t, o = 0;
31
31
  for (; o < n; ) {
@@ -47,14 +47,14 @@ function ze(s, e, t) {
47
47
  e[i++] = c & 63 | 128;
48
48
  }
49
49
  }
50
- const Le = new TextEncoder(), Me = 50;
51
- function De(s, e, t) {
52
- Le.encodeInto(s, e.subarray(t));
50
+ const De = new TextEncoder(), _e = 50;
51
+ function $e(s, e, t) {
52
+ De.encodeInto(s, e.subarray(t));
53
53
  }
54
- function _e(s, e, t) {
55
- s.length > Me ? De(s, e, t) : ze(s, e, t);
54
+ function He(s, e, t) {
55
+ s.length > _e ? $e(s, e, t) : Me(s, e, t);
56
56
  }
57
- const $e = 4096;
57
+ const Re = 4096;
58
58
  function xe(s, e, t) {
59
59
  let n = e;
60
60
  const i = n + t, o = [];
@@ -70,22 +70,22 @@ function xe(s, e, t) {
70
70
  const w = s[n++] & 63, f = s[n++] & 63;
71
71
  o.push((l & 31) << 12 | w << 6 | f);
72
72
  } else if ((l & 248) === 240) {
73
- const w = s[n++] & 63, f = s[n++] & 63, m = s[n++] & 63;
74
- let x = (l & 7) << 18 | w << 12 | f << 6 | m;
73
+ const w = s[n++] & 63, f = s[n++] & 63, b = s[n++] & 63;
74
+ let x = (l & 7) << 18 | w << 12 | f << 6 | b;
75
75
  x > 65535 && (x -= 65536, o.push(x >>> 10 & 1023 | 55296), x = 56320 | x & 1023), o.push(x);
76
76
  } else
77
77
  o.push(l);
78
- o.length >= $e && (c += String.fromCharCode(...o), o.length = 0);
78
+ o.length >= Re && (c += String.fromCharCode(...o), o.length = 0);
79
79
  }
80
80
  return o.length > 0 && (c += String.fromCharCode(...o)), c;
81
81
  }
82
- const He = new TextDecoder(), Re = 200;
83
- function Fe(s, e, t) {
82
+ const Fe = new TextDecoder(), je = 200;
83
+ function qe(s, e, t) {
84
84
  const n = s.subarray(e, e + t);
85
- return He.decode(n);
85
+ return Fe.decode(n);
86
86
  }
87
- function je(s, e, t) {
88
- return t > Re ? Fe(s, e, t) : xe(s, e, t);
87
+ function Oe(s, e, t) {
88
+ return t > je ? qe(s, e, t) : xe(s, e, t);
89
89
  }
90
90
  class W {
91
91
  constructor(e, t) {
@@ -106,7 +106,7 @@ class z extends Error {
106
106
  }
107
107
  }
108
108
  const j = 4294967295;
109
- function qe(s, e, t) {
109
+ function Ne(s, e, t) {
110
110
  const n = t / 4294967296, i = t;
111
111
  s.setUint32(e, n), s.setUint32(e + 4, i);
112
112
  }
@@ -118,14 +118,14 @@ function ge(s, e) {
118
118
  const t = s.getInt32(e), n = s.getUint32(e + 4);
119
119
  return t * 4294967296 + n;
120
120
  }
121
- function Oe(s, e) {
121
+ function Ve(s, e) {
122
122
  const t = s.getUint32(e), n = s.getUint32(e + 4);
123
123
  return t * 4294967296 + n;
124
124
  }
125
- const Ne = -1, Ve = 4294967296 - 1, We = 17179869184 - 1;
126
- function Xe({ sec: s, nsec: e }) {
127
- if (s >= 0 && e >= 0 && s <= We)
128
- if (e === 0 && s <= Ve) {
125
+ const We = -1, Xe = 4294967296 - 1, Ye = 17179869184 - 1;
126
+ function Je({ sec: s, nsec: e }) {
127
+ if (s >= 0 && e >= 0 && s <= Ye)
128
+ if (e === 0 && s <= Xe) {
129
129
  const t = new Uint8Array(4);
130
130
  return new DataView(t.buffer).setUint32(0, s), t;
131
131
  } else {
@@ -137,21 +137,21 @@ function Xe({ sec: s, nsec: e }) {
137
137
  return n.setUint32(0, e), ye(n, 4, s), t;
138
138
  }
139
139
  }
140
- function Ye(s) {
140
+ function Ge(s) {
141
141
  const e = s.getTime(), t = Math.floor(e / 1e3), n = (e - t * 1e3) * 1e6, i = Math.floor(n / 1e9);
142
142
  return {
143
143
  sec: t + i,
144
144
  nsec: n - i * 1e9
145
145
  };
146
146
  }
147
- function Je(s) {
147
+ function Qe(s) {
148
148
  if (s instanceof Date) {
149
- const e = Ye(s);
150
- return Xe(e);
149
+ const e = Ge(s);
150
+ return Je(e);
151
151
  } else
152
152
  return null;
153
153
  }
154
- function Ge(s) {
154
+ function Ze(s) {
155
155
  const e = new DataView(s.buffer, s.byteOffset, s.byteLength);
156
156
  switch (s.byteLength) {
157
157
  case 4:
@@ -168,14 +168,14 @@ function Ge(s) {
168
168
  throw new z(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${s.length}`);
169
169
  }
170
170
  }
171
- function Ze(s) {
172
- const e = Ge(s);
171
+ function et(s) {
172
+ const e = Ze(s);
173
173
  return new Date(e.sec * 1e3 + e.nsec / 1e6);
174
174
  }
175
- const Qe = {
176
- type: Ne,
177
- encode: Je,
178
- decode: Ze
175
+ const tt = {
176
+ type: We,
177
+ encode: Qe,
178
+ decode: et
179
179
  }, J = class J {
180
180
  constructor() {
181
181
  // ensures ExtensionCodecType<X> matches ExtensionCodec<X>
@@ -188,7 +188,7 @@ const Qe = {
188
188
  // custom extensions
189
189
  r(this, "encoders", []);
190
190
  r(this, "decoders", []);
191
- this.register(Qe);
191
+ this.register(tt);
192
192
  }
193
193
  register({ type: e, encode: t, decode: n }) {
194
194
  if (e >= 0)
@@ -228,13 +228,13 @@ const Qe = {
228
228
  };
229
229
  r(J, "defaultCodec", new J());
230
230
  let X = J;
231
- function et(s) {
231
+ function nt(s) {
232
232
  return s instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && s instanceof SharedArrayBuffer;
233
233
  }
234
234
  function ee(s) {
235
- return s instanceof Uint8Array ? s : ArrayBuffer.isView(s) ? new Uint8Array(s.buffer, s.byteOffset, s.byteLength) : et(s) ? new Uint8Array(s) : Uint8Array.from(s);
235
+ return s instanceof Uint8Array ? s : ArrayBuffer.isView(s) ? new Uint8Array(s.buffer, s.byteOffset, s.byteLength) : nt(s) ? new Uint8Array(s) : Uint8Array.from(s);
236
236
  }
237
- const tt = 100, nt = 2048;
237
+ const it = 100, st = 2048;
238
238
  class ie {
239
239
  constructor(e) {
240
240
  r(this, "extensionCodec");
@@ -250,7 +250,7 @@ class ie {
250
250
  r(this, "view");
251
251
  r(this, "bytes");
252
252
  r(this, "entered", !1);
253
- this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? X.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.maxDepth = (e == null ? void 0 : e.maxDepth) ?? tt, this.initialBufferSize = (e == null ? void 0 : e.initialBufferSize) ?? nt, this.sortKeys = (e == null ? void 0 : e.sortKeys) ?? !1, this.forceFloat32 = (e == null ? void 0 : e.forceFloat32) ?? !1, this.ignoreUndefined = (e == null ? void 0 : e.ignoreUndefined) ?? !1, this.forceIntegerToFloat = (e == null ? void 0 : e.forceIntegerToFloat) ?? !1, this.pos = 0, this.view = new DataView(new ArrayBuffer(this.initialBufferSize)), this.bytes = new Uint8Array(this.view.buffer);
253
+ this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? X.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.maxDepth = (e == null ? void 0 : e.maxDepth) ?? it, this.initialBufferSize = (e == null ? void 0 : e.initialBufferSize) ?? st, this.sortKeys = (e == null ? void 0 : e.sortKeys) ?? !1, this.forceFloat32 = (e == null ? void 0 : e.forceFloat32) ?? !1, this.ignoreUndefined = (e == null ? void 0 : e.ignoreUndefined) ?? !1, this.forceIntegerToFloat = (e == null ? void 0 : e.forceIntegerToFloat) ?? !1, this.pos = 0, this.view = new DataView(new ArrayBuffer(this.initialBufferSize)), this.bytes = new Uint8Array(this.view.buffer);
254
254
  }
255
255
  clone() {
256
256
  return new ie({
@@ -335,8 +335,8 @@ class ie {
335
335
  throw new Error(`Too long string: ${e} bytes in UTF-8`);
336
336
  }
337
337
  encodeString(e) {
338
- const n = Ae(e);
339
- this.ensureBufferSizeToWrite(5 + n), this.writeStringHeader(n), _e(e, this.bytes, this.pos), this.pos += n;
338
+ const n = Le(e);
339
+ this.ensureBufferSizeToWrite(5 + n), this.writeStringHeader(n), He(e, this.bytes, this.pos), this.pos += n;
340
340
  }
341
341
  encodeObject(e, t) {
342
342
  const n = this.extensionCodec.tryToEncode(e, this.context);
@@ -458,7 +458,7 @@ class ie {
458
458
  this.ensureBufferSizeToWrite(8), this.view.setFloat64(this.pos, e), this.pos += 8;
459
459
  }
460
460
  writeU64(e) {
461
- this.ensureBufferSizeToWrite(8), qe(this.view, this.pos, e), this.pos += 8;
461
+ this.ensureBufferSizeToWrite(8), Ne(this.view, this.pos, e), this.pos += 8;
462
462
  }
463
463
  writeI64(e) {
464
464
  this.ensureBufferSizeToWrite(8), ye(this.view, this.pos, e), this.pos += 8;
@@ -470,15 +470,15 @@ class ie {
470
470
  this.ensureBufferSizeToWrite(8), this.view.setBigInt64(this.pos, e), this.pos += 8;
471
471
  }
472
472
  }
473
- function it(s, e) {
473
+ function ot(s, e) {
474
474
  return new ie(e).encodeSharedRef(s);
475
475
  }
476
- function Z(s) {
476
+ function Q(s) {
477
477
  return `${s < 0 ? "-" : ""}0x${Math.abs(s).toString(16).padStart(2, "0")}`;
478
478
  }
479
- const st = 16, ot = 16;
480
- class rt {
481
- constructor(e = st, t = ot) {
479
+ const rt = 16, at = 16;
480
+ class ct {
481
+ constructor(e = rt, t = at) {
482
482
  r(this, "hit", 0);
483
483
  r(this, "miss", 0);
484
484
  r(this, "caches");
@@ -515,12 +515,12 @@ class rt {
515
515
  return this.store(c, o), o;
516
516
  }
517
517
  }
518
- const te = "array", O = "map_key", be = "map_value", at = (s) => {
518
+ const te = "array", O = "map_key", be = "map_value", dt = (s) => {
519
519
  if (typeof s == "string" || typeof s == "number")
520
520
  return s;
521
521
  throw new z("The type of key must be string or number but " + typeof s);
522
522
  };
523
- class ct {
523
+ class lt {
524
524
  constructor() {
525
525
  r(this, "stack", []);
526
526
  r(this, "stackHeadPosition", -1);
@@ -571,14 +571,14 @@ class ct {
571
571
  this.stack.length = 0, this.stackHeadPosition = -1;
572
572
  }
573
573
  }
574
- const q = -1, se = new DataView(new ArrayBuffer(0)), dt = new Uint8Array(se.buffer);
574
+ const q = -1, se = new DataView(new ArrayBuffer(0)), ht = new Uint8Array(se.buffer);
575
575
  try {
576
576
  se.getInt8(0);
577
577
  } catch (s) {
578
578
  if (!(s instanceof RangeError))
579
579
  throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access");
580
580
  }
581
- const he = new RangeError("Insufficient data"), lt = new rt();
581
+ const he = new RangeError("Insufficient data"), pt = new ct();
582
582
  class oe {
583
583
  constructor(e) {
584
584
  r(this, "extensionCodec");
@@ -595,11 +595,11 @@ class oe {
595
595
  r(this, "totalPos", 0);
596
596
  r(this, "pos", 0);
597
597
  r(this, "view", se);
598
- r(this, "bytes", dt);
598
+ r(this, "bytes", ht);
599
599
  r(this, "headByte", q);
600
- r(this, "stack", new ct());
600
+ r(this, "stack", new lt());
601
601
  r(this, "entered", !1);
602
- this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? X.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.rawStrings = (e == null ? void 0 : e.rawStrings) ?? !1, this.maxStrLength = (e == null ? void 0 : e.maxStrLength) ?? j, this.maxBinLength = (e == null ? void 0 : e.maxBinLength) ?? j, this.maxArrayLength = (e == null ? void 0 : e.maxArrayLength) ?? j, this.maxMapLength = (e == null ? void 0 : e.maxMapLength) ?? j, this.maxExtLength = (e == null ? void 0 : e.maxExtLength) ?? j, this.keyDecoder = (e == null ? void 0 : e.keyDecoder) !== void 0 ? e.keyDecoder : lt, this.mapKeyConverter = (e == null ? void 0 : e.mapKeyConverter) ?? at;
602
+ this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? X.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.rawStrings = (e == null ? void 0 : e.rawStrings) ?? !1, this.maxStrLength = (e == null ? void 0 : e.maxStrLength) ?? j, this.maxBinLength = (e == null ? void 0 : e.maxBinLength) ?? j, this.maxArrayLength = (e == null ? void 0 : e.maxArrayLength) ?? j, this.maxMapLength = (e == null ? void 0 : e.maxMapLength) ?? j, this.maxExtLength = (e == null ? void 0 : e.maxExtLength) ?? j, this.keyDecoder = (e == null ? void 0 : e.keyDecoder) !== void 0 ? e.keyDecoder : pt, this.mapKeyConverter = (e == null ? void 0 : e.mapKeyConverter) ?? dt;
603
603
  }
604
604
  clone() {
605
605
  return new oe({
@@ -690,7 +690,7 @@ class oe {
690
690
  return n;
691
691
  }
692
692
  const { headByte: i, pos: o, totalPos: c } = this;
693
- throw new RangeError(`Insufficient data in parsing ${Z(i)} at ${c} (${o} in the current buffer)`);
693
+ throw new RangeError(`Insufficient data in parsing ${Q(i)} at ${c} (${o} in the current buffer)`);
694
694
  } finally {
695
695
  this.entered = !1;
696
696
  }
@@ -845,7 +845,7 @@ class oe {
845
845
  const i = this.lookU32();
846
846
  t = this.decodeExtension(i, 4);
847
847
  } else
848
- throw new z(`Unrecognized type byte: ${Z(e)}`);
848
+ throw new z(`Unrecognized type byte: ${Q(e)}`);
849
849
  this.complete();
850
850
  const n = this.stack;
851
851
  for (; n.length > 0; ) {
@@ -886,7 +886,7 @@ class oe {
886
886
  default: {
887
887
  if (e < 160)
888
888
  return e - 144;
889
- throw new z(`Unrecognized array type byte: ${Z(e)}`);
889
+ throw new z(`Unrecognized array type byte: ${Q(e)}`);
890
890
  }
891
891
  }
892
892
  }
@@ -914,7 +914,7 @@ class oe {
914
914
  throw he;
915
915
  const n = this.pos + t;
916
916
  let i;
917
- return this.stateIsMapKey() && ((o = this.keyDecoder) != null && o.canBeCached(e)) ? i = this.keyDecoder.decode(this.bytes, n, e) : i = je(this.bytes, n, e), this.pos += t + e, i;
917
+ return this.stateIsMapKey() && ((o = this.keyDecoder) != null && o.canBeCached(e)) ? i = this.keyDecoder.decode(this.bytes, n, e) : i = Oe(this.bytes, n, e), this.pos += t + e, i;
918
918
  }
919
919
  stateIsMapKey() {
920
920
  return this.stack.length > 0 ? this.stack.top().type === O : !1;
@@ -974,7 +974,7 @@ class oe {
974
974
  return this.pos += 4, e;
975
975
  }
976
976
  readU64() {
977
- const e = Oe(this.view, this.pos);
977
+ const e = Ve(this.view, this.pos);
978
978
  return this.pos += 8, e;
979
979
  }
980
980
  readI64() {
@@ -998,10 +998,10 @@ class oe {
998
998
  return this.pos += 8, e;
999
999
  }
1000
1000
  }
1001
- function ht(s, e) {
1001
+ function ut(s, e) {
1002
1002
  return new oe(e).decode(s);
1003
1003
  }
1004
- const pt = /* @__PURE__ */ new Set([
1004
+ const ft = /* @__PURE__ */ new Set([
1005
1005
  "auth",
1006
1006
  "open",
1007
1007
  "send",
@@ -1018,22 +1018,22 @@ const pt = /* @__PURE__ */ new Set([
1018
1018
  "annotate",
1019
1019
  "annotate_clear"
1020
1020
  ]);
1021
- function ut(s) {
1022
- return pt.has(s.type);
1021
+ function wt(s) {
1022
+ return ft.has(s.type);
1023
1023
  }
1024
- function ft(s) {
1025
- return it(s);
1024
+ function xt(s) {
1025
+ return ot(s);
1026
1026
  }
1027
- function wt(s) {
1027
+ function yt(s) {
1028
1028
  let e;
1029
1029
  try {
1030
- e = ht(s);
1030
+ e = ut(s);
1031
1031
  } catch {
1032
1032
  return null;
1033
1033
  }
1034
1034
  return typeof e != "object" || e === null || typeof e.type != "string" ? null : e;
1035
1035
  }
1036
- class xt {
1036
+ class gt {
1037
1037
  constructor(e) {
1038
1038
  r(this, "conversationId");
1039
1039
  r(this, "state", "");
@@ -1197,7 +1197,7 @@ function pe(s) {
1197
1197
  return 0;
1198
1198
  }
1199
1199
  }
1200
- class yt {
1200
+ class bt {
1201
1201
  constructor(e) {
1202
1202
  r(this, "socket", null);
1203
1203
  r(this, "state", "idle");
@@ -1212,12 +1212,12 @@ class yt {
1212
1212
  var n, i;
1213
1213
  if (this.state === "connecting" || this.state === "open") return;
1214
1214
  this.stopped = !1, this.state = "connecting", this.authed = !1, (i = (n = this.opts).onStatusChange) == null || i.call(n, this.attempt > 0 ? "reconnecting" : "connecting");
1215
- const t = (this.opts.socketFactory ?? gt)(this.opts.url);
1215
+ const t = (this.opts.socketFactory ?? mt)(this.opts.url);
1216
1216
  t.binaryType = "arraybuffer", this.socket = t, t.onopen = () => {
1217
1217
  this.raw({ type: "auth", token: this.opts.token });
1218
1218
  }, t.onmessage = (o) => {
1219
- const c = wt(new Uint8Array(o.data));
1220
- !c || ut(c) || this.handle(c);
1219
+ const c = yt(new Uint8Array(o.data));
1220
+ !c || wt(c) || this.handle(c);
1221
1221
  }, t.onclose = () => this.onClosed(), t.onerror = () => {
1222
1222
  try {
1223
1223
  t.close();
@@ -1256,7 +1256,7 @@ class yt {
1256
1256
  raw(e) {
1257
1257
  var t;
1258
1258
  try {
1259
- (t = this.socket) == null || t.send(ft(e));
1259
+ (t = this.socket) == null || t.send(xt(e));
1260
1260
  } catch {
1261
1261
  this.outbox.push(e);
1262
1262
  }
@@ -1271,11 +1271,11 @@ class yt {
1271
1271
  this.attempt++, this.timer = setTimeout(() => this.connect(), n);
1272
1272
  }
1273
1273
  }
1274
- function gt(s) {
1274
+ function mt(s) {
1275
1275
  return new WebSocket(s);
1276
1276
  }
1277
- const ue = 200, bt = 7 * 864e5;
1278
- class mt {
1277
+ const ue = 200, vt = 7 * 864e5;
1278
+ class kt {
1279
1279
  constructor(e) {
1280
1280
  r(this, "key");
1281
1281
  this.key = `ocw_outbox_${e}`;
@@ -1285,7 +1285,7 @@ class mt {
1285
1285
  try {
1286
1286
  const e = localStorage.getItem(this.key);
1287
1287
  if (!e) return [];
1288
- const t = JSON.parse(e), n = Date.now() - bt, i = t.filter((o) => o.ts >= n);
1288
+ const t = JSON.parse(e), n = Date.now() - vt, i = t.filter((o) => o.ts >= n);
1289
1289
  return i.length !== t.length && this.save(i), i;
1290
1290
  } catch {
1291
1291
  return [];
@@ -1313,7 +1313,7 @@ class mt {
1313
1313
  }
1314
1314
  }
1315
1315
  }
1316
- const k = () => globalThis.crypto.subtle;
1316
+ const S = () => globalThis.crypto.subtle;
1317
1317
  function Y(s) {
1318
1318
  const e = s instanceof Uint8Array ? s : new Uint8Array(s);
1319
1319
  let t = "";
@@ -1326,18 +1326,18 @@ function ne(s) {
1326
1326
  return n;
1327
1327
  }
1328
1328
  async function N() {
1329
- const s = await k().generateKey({ name: "ECDH", namedCurve: "P-256" }, !0, ["deriveKey", "deriveBits"]);
1329
+ const s = await S().generateKey({ name: "ECDH", namedCurve: "P-256" }, !0, ["deriveKey", "deriveBits"]);
1330
1330
  return { publicKey: s.publicKey, privateKey: s.privateKey };
1331
1331
  }
1332
- async function $(s) {
1333
- return Y(await k().exportKey("raw", s));
1332
+ async function H(s) {
1333
+ return Y(await S().exportKey("raw", s));
1334
1334
  }
1335
1335
  async function F(s) {
1336
- return k().importKey("raw", ne(s), { name: "ECDH", namedCurve: "P-256" }, !1, []);
1336
+ return S().importKey("raw", ne(s), { name: "ECDH", namedCurve: "P-256" }, !1, []);
1337
1337
  }
1338
- async function vt(s, e) {
1338
+ async function St(s, e) {
1339
1339
  const t = await F(e);
1340
- return k().deriveKey(
1340
+ return S().deriveKey(
1341
1341
  { name: "ECDH", public: t },
1342
1342
  s,
1343
1343
  { name: "AES-GCM", length: 256 },
@@ -1345,43 +1345,43 @@ async function vt(s, e) {
1345
1345
  ["encrypt", "decrypt"]
1346
1346
  );
1347
1347
  }
1348
- async function kt(s, e) {
1349
- const t = globalThis.crypto.getRandomValues(new Uint8Array(12)), n = new TextEncoder().encode(e), i = await k().encrypt({ name: "AES-GCM", iv: t }, s, n);
1348
+ async function It(s, e) {
1349
+ const t = globalThis.crypto.getRandomValues(new Uint8Array(12)), n = new TextEncoder().encode(e), i = await S().encrypt({ name: "AES-GCM", iv: t }, s, n);
1350
1350
  return { ct: Y(i), iv: Y(t) };
1351
1351
  }
1352
- async function St(s, e, t) {
1353
- const n = await k().decrypt({ name: "AES-GCM", iv: ne(t) }, s, ne(e));
1352
+ async function Ct(s, e, t) {
1353
+ const n = await S().decrypt({ name: "AES-GCM", iv: ne(t) }, s, ne(e));
1354
1354
  return new TextDecoder().decode(n);
1355
1355
  }
1356
- async function It(s) {
1356
+ async function Et(s) {
1357
1357
  var t, n;
1358
1358
  try {
1359
1359
  const i = (t = globalThis.localStorage) == null ? void 0 : t.getItem(s);
1360
1360
  if (i) {
1361
- const { pub: o, priv: c } = JSON.parse(i), l = await k().importKey("jwk", o, { name: "ECDH", namedCurve: "P-256" }, !0, []), w = await k().importKey("jwk", c, { name: "ECDH", namedCurve: "P-256" }, !0, ["deriveKey", "deriveBits"]);
1361
+ const { pub: o, priv: c } = JSON.parse(i), l = await S().importKey("jwk", o, { name: "ECDH", namedCurve: "P-256" }, !0, []), w = await S().importKey("jwk", c, { name: "ECDH", namedCurve: "P-256" }, !0, ["deriveKey", "deriveBits"]);
1362
1362
  return { publicKey: l, privateKey: w };
1363
1363
  }
1364
1364
  } catch {
1365
1365
  }
1366
1366
  const e = await N();
1367
1367
  try {
1368
- const i = await k().exportKey("jwk", e.publicKey), o = await k().exportKey("jwk", e.privateKey);
1368
+ const i = await S().exportKey("jwk", e.publicKey), o = await S().exportKey("jwk", e.privateKey);
1369
1369
  (n = globalThis.localStorage) == null || n.setItem(s, JSON.stringify({ pub: i, priv: o }));
1370
1370
  } catch {
1371
1371
  }
1372
1372
  return e;
1373
1373
  }
1374
- async function Ct(s, e) {
1375
- const t = await k().exportKey("raw", e), n = await k().sign({ name: "ECDSA", hash: "SHA-256" }, s, t);
1374
+ async function Tt(s, e) {
1375
+ const t = await S().exportKey("raw", e), n = await S().sign({ name: "ECDSA", hash: "SHA-256" }, s, t);
1376
1376
  return Y(n);
1377
1377
  }
1378
- async function Et() {
1379
- const s = await N(), e = await k().generateKey({ name: "ECDSA", namedCurve: "P-256" }, !0, ["sign", "verify"]);
1378
+ async function Ut() {
1379
+ const s = await N(), e = await S().generateKey({ name: "ECDSA", namedCurve: "P-256" }, !0, ["sign", "verify"]);
1380
1380
  return {
1381
1381
  ecdhKP: s,
1382
1382
  ecdsaKP: { publicKey: e.publicKey, privateKey: e.privateKey },
1383
- publicKeyB64: await $(s.publicKey),
1384
- sigPublicKeyB64: await $(e.publicKey)
1383
+ publicKeyB64: await H(s.publicKey),
1384
+ sigPublicKeyB64: await H(e.publicKey)
1385
1385
  };
1386
1386
  }
1387
1387
  async function fe(s) {
@@ -1389,34 +1389,34 @@ async function fe(s) {
1389
1389
  try {
1390
1390
  const i = (t = globalThis.localStorage) == null ? void 0 : t.getItem(`${s}-identity`);
1391
1391
  if (i) {
1392
- const o = JSON.parse(i), c = await k().importKey("jwk", o.ecdhPub, { name: "ECDH", namedCurve: "P-256" }, !0, []), l = await k().importKey("jwk", o.ecdhPriv, { name: "ECDH", namedCurve: "P-256" }, !0, ["deriveKey", "deriveBits"]), w = await k().importKey("jwk", o.ecdsaPub, { name: "ECDSA", namedCurve: "P-256" }, !0, ["verify"]), f = await k().importKey("jwk", o.ecdsaPriv, { name: "ECDSA", namedCurve: "P-256" }, !0, ["sign"]);
1392
+ const o = JSON.parse(i), c = await S().importKey("jwk", o.ecdhPub, { name: "ECDH", namedCurve: "P-256" }, !0, []), l = await S().importKey("jwk", o.ecdhPriv, { name: "ECDH", namedCurve: "P-256" }, !0, ["deriveKey", "deriveBits"]), w = await S().importKey("jwk", o.ecdsaPub, { name: "ECDSA", namedCurve: "P-256" }, !0, ["verify"]), f = await S().importKey("jwk", o.ecdsaPriv, { name: "ECDSA", namedCurve: "P-256" }, !0, ["sign"]);
1393
1393
  return {
1394
1394
  ecdhKP: { publicKey: c, privateKey: l },
1395
1395
  ecdsaKP: { publicKey: w, privateKey: f },
1396
- publicKeyB64: await $(c),
1397
- sigPublicKeyB64: await $(w)
1396
+ publicKeyB64: await H(c),
1397
+ sigPublicKeyB64: await H(w)
1398
1398
  };
1399
1399
  }
1400
1400
  } catch {
1401
1401
  }
1402
- const e = await Et();
1402
+ const e = await Ut();
1403
1403
  try {
1404
- const i = await k().exportKey("jwk", e.ecdhKP.publicKey), o = await k().exportKey("jwk", e.ecdhKP.privateKey), c = await k().exportKey("jwk", e.ecdsaKP.publicKey), l = await k().exportKey("jwk", e.ecdsaKP.privateKey);
1404
+ const i = await S().exportKey("jwk", e.ecdhKP.publicKey), o = await S().exportKey("jwk", e.ecdhKP.privateKey), c = await S().exportKey("jwk", e.ecdsaKP.publicKey), l = await S().exportKey("jwk", e.ecdsaKP.privateKey);
1405
1405
  (n = globalThis.localStorage) == null || n.setItem(`${s}-identity`, JSON.stringify({ ecdhPub: i, ecdhPriv: o, ecdsaPub: c, ecdsaPriv: l }));
1406
1406
  } catch {
1407
1407
  }
1408
1408
  return e;
1409
1409
  }
1410
- async function Tt(s, e) {
1411
- const t = await N(), n = await $(t.publicKey), i = await F(e.identityKey), o = await F(e.signedPrekey), c = e.oneTimePrekey ? await F(e.oneTimePrekey) : null, l = await _(s.privateKey, o), w = await _(t.privateKey, i), f = await _(t.privateKey, o), m = c ? await _(t.privateKey, c) : null, x = me(l, w, f, ...m ? [m] : []);
1410
+ async function Pt(s, e) {
1411
+ const t = await N(), n = await H(t.publicKey), i = await F(e.identityKey), o = await F(e.signedPrekey), c = e.oneTimePrekey ? await F(e.oneTimePrekey) : null, l = await $(s.privateKey, o), w = await $(t.privateKey, i), f = await $(t.privateKey, o), b = c ? await $(t.privateKey, c) : null, x = me(l, w, f, ...b ? [b] : []);
1412
1412
  return { sharedKey: await ve(x), ephemeralPublicKey: n };
1413
1413
  }
1414
- async function Ut(s, e, t, n, i) {
1415
- const o = await F(t), c = await F(n), l = await _(e.privateKey, o), w = await _(s.privateKey, c), f = await _(e.privateKey, c), m = i ? await _(i.privateKey, c) : null, x = me(l, w, f, ...m ? [m] : []);
1414
+ async function Bt(s, e, t, n, i) {
1415
+ const o = await F(t), c = await F(n), l = await $(e.privateKey, o), w = await $(s.privateKey, c), f = await $(e.privateKey, c), b = i ? await $(i.privateKey, c) : null, x = me(l, w, f, ...b ? [b] : []);
1416
1416
  return ve(x);
1417
1417
  }
1418
- async function _(s, e) {
1419
- return k().deriveBits({ name: "ECDH", public: e }, s, 256);
1418
+ async function $(s, e) {
1419
+ return S().deriveBits({ name: "ECDH", public: e }, s, 256);
1420
1420
  }
1421
1421
  function me(...s) {
1422
1422
  const e = s.reduce((i, o) => i + o.byteLength, 0), t = new Uint8Array(e);
@@ -1426,8 +1426,8 @@ function me(...s) {
1426
1426
  return t.buffer;
1427
1427
  }
1428
1428
  async function ve(s) {
1429
- const e = await k().importKey("raw", s, "HKDF", !1, ["deriveKey"]);
1430
- return k().deriveKey(
1429
+ const e = await S().importKey("raw", s, "HKDF", !1, ["deriveKey"]);
1430
+ return S().deriveKey(
1431
1431
  { name: "HKDF", hash: "SHA-256", salt: new Uint8Array(32), info: new TextEncoder().encode("ObjectChat X3DH v1") },
1432
1432
  e,
1433
1433
  { name: "AES-GCM", length: 256 },
@@ -1435,8 +1435,8 @@ async function ve(s) {
1435
1435
  ["encrypt", "decrypt"]
1436
1436
  );
1437
1437
  }
1438
- const Pt = 20;
1439
- class Bt {
1438
+ const Kt = 20;
1439
+ class At {
1440
1440
  constructor(e) {
1441
1441
  // Live ECDH mode state
1442
1442
  r(this, "kp");
@@ -1457,19 +1457,19 @@ class Bt {
1457
1457
  }
1458
1458
  /** Live ECDH mode: Generate/restore our keypair and return our public key to publish. */
1459
1459
  async begin() {
1460
- return this.kp = await It(this.storageKey), $(this.kp.publicKey);
1460
+ return this.kp = await Et(this.storageKey), H(this.kp.publicKey);
1461
1461
  }
1462
1462
  /** Live ECDH mode: A peer published their key — derive the shared secret. */
1463
1463
  async onPeerKey(e) {
1464
- this.kp && (this.shared = await vt(this.kp.privateKey, e));
1464
+ this.kp && (this.shared = await St(this.kp.privateKey, e));
1465
1465
  }
1466
1466
  // ── X3DH async mode ────────────────────────────────────────────────────────
1467
1467
  /** X3DH: Generate identity key, signed prekey, and OTP prekeys.
1468
1468
  * Returns the upload frame payload the caller should send to the server. */
1469
1469
  async initX3DH() {
1470
1470
  this.identityKP = await fe(this.storageKey), this.signedPreKP = await N(), this.signedPrekeyId = `spk-${Date.now()}-${Math.random().toString(36).slice(2)}`;
1471
- for (let i = 0; i < Pt; i++) this.otpKeys.push(await N());
1472
- const e = await $(this.signedPreKP.publicKey), t = await Ct(this.identityKP.ecdsaKP.privateKey, this.signedPreKP.publicKey), n = await Promise.all(this.otpKeys.map((i) => $(i.publicKey)));
1471
+ for (let i = 0; i < Kt; i++) this.otpKeys.push(await N());
1472
+ const e = await H(this.signedPreKP.publicKey), t = await Tt(this.identityKP.ecdsaKP.privateKey, this.signedPreKP.publicKey), n = await Promise.all(this.otpKeys.map((i) => H(i.publicKey)));
1473
1473
  return {
1474
1474
  identityKey: this.identityKP.publicKeyB64,
1475
1475
  signedPrekey: e,
@@ -1482,7 +1482,7 @@ class Bt {
1482
1482
  * return the init message fields to embed in the first encrypted message. */
1483
1483
  async x3dhSendTo(e) {
1484
1484
  this.identityKP || (this.identityKP = await fe(this.storageKey));
1485
- const { sharedKey: t, ephemeralPublicKey: n } = await Tt(this.identityKP.ecdhKP, e);
1485
+ const { sharedKey: t, ephemeralPublicKey: n } = await Pt(this.identityKP.ecdhKP, e);
1486
1486
  return this.x3dhShared = t, { ephemeralKey: n, spkId: e.signedPrekeyId, usedOTP: !!e.oneTimePrekey, senderIK: this.identityKP.publicKeyB64 };
1487
1487
  }
1488
1488
  /** X3DH recipient: given an init message's sender IK + EK + SPK ID, derive the shared key. */
@@ -1492,7 +1492,7 @@ class Bt {
1492
1492
  return;
1493
1493
  }
1494
1494
  const i = this.otpKeys.shift();
1495
- this.x3dhShared = await Ut(this.identityKP.ecdhKP, this.signedPreKP, e, t, i);
1495
+ this.x3dhShared = await Bt(this.identityKP.ecdhKP, this.signedPreKP, e, t, i);
1496
1496
  }
1497
1497
  /** Flush pending X3DH derivation after initX3DH() completes. */
1498
1498
  async flushPendingX3DH() {
@@ -1505,7 +1505,7 @@ class Bt {
1505
1505
  async sealText(e, t) {
1506
1506
  const n = this.x3dhShared ?? this.shared;
1507
1507
  if (!n) throw new Error("secure channel not ready");
1508
- const { ct: i, iv: o } = await kt(n, e);
1508
+ const { ct: i, iv: o } = await It(n, e);
1509
1509
  return {
1510
1510
  kind: "text",
1511
1511
  text: i,
@@ -1520,7 +1520,7 @@ class Bt {
1520
1520
  const t = this.x3dhShared ?? this.shared;
1521
1521
  if (!t) return { kind: "text", text: "🔒 encrypted" };
1522
1522
  try {
1523
- return { kind: "text", text: await St(t, e.text, e.iv) };
1523
+ return { kind: "text", text: await Ct(t, e.text, e.iv) };
1524
1524
  } catch {
1525
1525
  return { kind: "text", text: "🔒 unable to decrypt" };
1526
1526
  }
@@ -1532,12 +1532,12 @@ class Bt {
1532
1532
  for (const t of e.messages) t.content = await this.openContent(t.content);
1533
1533
  }
1534
1534
  }
1535
- function Kt(s) {
1535
+ function zt(s) {
1536
1536
  if (s.kind !== "text" || !s.enc) return null;
1537
1537
  const e = s;
1538
1538
  return !e.x3dhEK || !e.x3dhSPK || !e.x3dhIK ? null : { x3dhEK: e.x3dhEK, x3dhSPK: e.x3dhSPK, x3dhIK: e.x3dhIK };
1539
1539
  }
1540
- const we = "objectchat-widget-styles", At = ["👍", "❤️", "😂", "😮", "😢", "🙏"], zt = `
1540
+ const we = "objectchat-widget-styles", Lt = ["👍", "❤️", "😂", "😮", "😢", "🙏"], Mt = `
1541
1541
  .ocw { --ocw-accent:#f5713c; --ocw-bg:#f3efe9; --ocw-card:#fff; --ocw-line:#ececec; --ocw-ink:#1c1b1a; --ocw-mut:#9b9690;
1542
1542
  position:relative;
1543
1543
  display:flex; flex-direction:column; height:100%; min-height:320px; background:var(--ocw-bg);
@@ -1696,23 +1696,23 @@ const we = "objectchat-widget-styles", At = ["👍", "❤️", "😂", "😮", "
1696
1696
  .ocw-bubble-wrap:hover .ocw-translate-btn { opacity:1; }
1697
1697
  .ocw-translated-tag { font-size:10px; color:var(--ocw-mut); margin-top:2px; }
1698
1698
  `;
1699
- function Lt() {
1699
+ function Dt() {
1700
1700
  if (typeof document > "u" || document.getElementById(we)) return;
1701
1701
  const s = document.createElement("style");
1702
- s.id = we, s.textContent = zt, document.head.appendChild(s);
1702
+ s.id = we, s.textContent = Mt, document.head.appendChild(s);
1703
1703
  }
1704
1704
  function a(s, e, t) {
1705
1705
  const n = document.createElement(s);
1706
1706
  return e && (n.className = e), t !== void 0 && (n.textContent = t), n;
1707
1707
  }
1708
- function Mt(s) {
1708
+ function _t(s) {
1709
1709
  try {
1710
1710
  return new Date(s).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
1711
1711
  } catch {
1712
1712
  return "";
1713
1713
  }
1714
1714
  }
1715
- function Q(s) {
1715
+ function Z(s) {
1716
1716
  var e;
1717
1717
  switch (s.kind) {
1718
1718
  case "text":
@@ -1729,7 +1729,7 @@ function Q(s) {
1729
1729
  return `📅 ${s.title} — ${new Date(s.startIso).toLocaleString()}`;
1730
1730
  }
1731
1731
  }
1732
- class Dt {
1732
+ class $t {
1733
1733
  /** Last seq the guest has seen per conversationId — used to compute unread badges. */
1734
1734
  constructor(e, t, n, i = {}) {
1735
1735
  r(this, "scroll");
@@ -1762,56 +1762,56 @@ class Dt {
1762
1762
  r(this, "translationCache", /* @__PURE__ */ new Map());
1763
1763
  r(this, "showingTranslation", /* @__PURE__ */ new Set());
1764
1764
  r(this, "subjectBuilt", !1);
1765
- var y, g, C, T, U, B, K, P, H;
1766
- this.root = e, this.me = t, this.h = n, this.cfg = i, Lt(), e.classList.add("ocw"), i.accent && e.style.setProperty("--ocw-accent", i.accent);
1765
+ var v, m, g, I, K, P, B, T, M;
1766
+ this.root = e, this.me = t, this.h = n, this.cfg = i, Dt(), e.replaceChildren(), e.classList.add("ocw"), i.accent && e.style.setProperty("--ocw-accent", i.accent);
1767
1767
  const o = a("div", "ocw-head"), c = a("div", "ocw-avatar");
1768
- if ((y = i.userInfo) != null && y.avatar) {
1769
- const v = document.createElement("img");
1770
- v.src = i.userInfo.avatar, v.alt = i.userInfo.name ?? "You", v.style.cssText = "width:100%;height:100%;border-radius:50%;object-fit:cover", c.append(v);
1768
+ if ((v = i.userInfo) != null && v.avatar) {
1769
+ const k = document.createElement("img");
1770
+ k.src = i.userInfo.avatar, k.alt = i.userInfo.name ?? "You", k.style.cssText = "width:100%;height:100%;border-radius:50%;object-fit:cover", c.append(k);
1771
1771
  } else
1772
- c.textContent = (g = i.userInfo) != null && g.name ? i.userInfo.name[0].toUpperCase() : "🧑";
1772
+ c.textContent = (m = i.userInfo) != null && m.name ? i.userInfo.name[0].toUpperCase() : "🧑";
1773
1773
  o.append(c);
1774
1774
  const l = a("div", "ocw-head-main");
1775
- this.headerName = a("div", "ocw-head-name", ((C = i.subject) == null ? void 0 : C.ownerLabel) ?? ((T = i.subject) == null ? void 0 : T.title) ?? ""), l.append(this.headerName), (U = i.subject) != null && U.subtitle && l.append(a("div", "ocw-head-meta", i.subject.subtitle)), o.append(l), this.statusBadge = a("span", "ocw-badge", ((B = i.subject) == null ? void 0 : B.status) ?? ""), (K = i.subject) != null && K.status || (this.statusBadge.style.display = "none"), o.append(this.statusBadge), this.e2eBadge = a("span", "ocw-e2e", "🔒 E2E"), this.e2eBadge.style.display = "none", o.append(this.e2eBadge), this.connStatus = a("span", "ocw-conn-status"), this.connStatus.style.display = "none", o.append(this.connStatus), this.cobrowseBtn = a("button", "ocw-menu ocw-cobrowse-btn", "🖍"), this.cobrowseBtn.title = "Shared whiteboard — draw to point things out together", this.cobrowseBtn.addEventListener("click", () => {
1775
+ this.headerName = a("div", "ocw-head-name", ((g = i.subject) == null ? void 0 : g.ownerLabel) ?? ((I = i.subject) == null ? void 0 : I.title) ?? ""), l.append(this.headerName), (K = i.subject) != null && K.subtitle && l.append(a("div", "ocw-head-meta", i.subject.subtitle)), o.append(l), this.statusBadge = a("span", "ocw-badge", ((P = i.subject) == null ? void 0 : P.status) ?? ""), (B = i.subject) != null && B.status || (this.statusBadge.style.display = "none"), o.append(this.statusBadge), this.e2eBadge = a("span", "ocw-e2e", "🔒 E2E"), this.e2eBadge.style.display = "none", o.append(this.e2eBadge), this.connStatus = a("span", "ocw-conn-status"), this.connStatus.style.display = "none", o.append(this.connStatus), this.cobrowseBtn = a("button", "ocw-menu ocw-cobrowse-btn", "🖍"), this.cobrowseBtn.title = "Shared whiteboard — draw to point things out together", this.cobrowseBtn.addEventListener("click", () => {
1776
1776
  this.cobrowseActive = !this.cobrowseActive, this.updateCobrowseUI();
1777
1777
  }), o.append(this.cobrowseBtn), o.append(a("button", "ocw-menu", "⋯")), this.chips = a("div", "ocw-chiprow"), this.scroll = a("div", "ocw-scroll"), this.subjectCard = a("div", "ocw-subject"), this.typing = a("div", "ocw-typing");
1778
1778
  const w = a("div", "ocw-typing-bubble");
1779
1779
  w.append(a("div", "ocw-typing-dot"), a("div", "ocw-typing-dot"), a("div", "ocw-typing-dot")), this.typing.append(a("div", "ocw-dot", "🧑"), w), this.quick = a("div", "ocw-quick");
1780
- for (const v of i.quickReplies ?? []) {
1781
- const A = a("button", void 0, v);
1780
+ for (const k of i.quickReplies ?? []) {
1781
+ const A = a("button", void 0, k);
1782
1782
  A.addEventListener("click", () => {
1783
- this.h.onSend(v), this.quick.style.display = "none";
1783
+ this.h.onSend(k), this.quick.style.display = "none";
1784
1784
  }), this.quick.append(A);
1785
1785
  }
1786
1786
  this.formHost = a("div", "ocw-form-host"), this.csatPanel = a("div", "ocw-csat"), this.csatPanel.style.display = "none", this.offlinePanel = a("div", "ocw-offline"), this.offlinePanel.style.display = "none", this.input = a("textarea", void 0), this.input.rows = 1, this.input.placeholder = "Message…";
1787
- const f = a("button", "ocw-sendbtn", ((P = i.i18n) == null ? void 0 : P.send) ?? "➤");
1788
- f.addEventListener("click", () => this.flushSend()), this.input.addEventListener("keydown", (v) => {
1789
- v.isComposing || v.keyCode === 229 || (v.key === "Enter" && !v.shiftKey ? (v.preventDefault(), this.flushSend()) : this.signalTyping());
1787
+ const f = a("button", "ocw-sendbtn", ((T = i.i18n) == null ? void 0 : T.send) ?? "➤");
1788
+ f.addEventListener("click", () => this.flushSend()), this.input.addEventListener("keydown", (k) => {
1789
+ k.isComposing || k.keyCode === 229 || (k.key === "Enter" && !k.shiftKey ? (k.preventDefault(), this.flushSend()) : this.signalTyping());
1790
1790
  });
1791
- const m = a("button", "ocw-attach", "📎");
1792
- m.title = "Attach image or file";
1791
+ const b = a("button", "ocw-attach", "📎");
1792
+ b.title = "Attach image or file";
1793
1793
  const x = document.createElement("input");
1794
- x.type = "file", x.accept = "image/*,.pdf,.txt,.doc,.docx", x.style.display = "none", m.addEventListener("click", () => x.click()), x.addEventListener("change", () => {
1795
- var v;
1796
- (v = x.files) != null && v[0] && this.h.onAttach && this.h.onAttach(x.files[0]), x.value = "";
1794
+ x.type = "file", x.accept = "image/*,.pdf,.txt,.doc,.docx", x.style.display = "none", b.addEventListener("click", () => x.click()), x.addEventListener("change", () => {
1795
+ var k;
1796
+ (k = x.files) != null && k[0] && this.h.onAttach && this.h.onAttach(x.files[0]), x.value = "";
1797
1797
  });
1798
1798
  const h = a("div", "ocw-input");
1799
- h.append(m, x, this.input, f);
1800
- const p = a("div", "ocw-footer");
1801
- ((H = i.i18n) == null ? void 0 : H.poweredBy) !== void 0 ? p.textContent = i.i18n.poweredBy : p.innerHTML = 'Powered by <a href="https://relay.paramms.com" target="_blank" rel="noopener">Relay</a>', this.footer = p, e.append(o, this.chips, this.scroll, this.typing, this.quick, this.formHost, this.csatPanel, this.offlinePanel, h, this.footer), this.cobrowseCanvas = a("canvas", "ocw-cobrowse-canvas"), this.cobrowseToolbar = a("div", "ocw-cobrowse-toolbar");
1802
- for (const v of ["#f5713c", "#1c1b1a", "#2563eb", "#16a34a", "#dc2626"]) {
1799
+ h.append(b, x, this.input, f);
1800
+ const u = a("div", "ocw-footer");
1801
+ ((M = i.i18n) == null ? void 0 : M.poweredBy) !== void 0 ? u.textContent = i.i18n.poweredBy : u.innerHTML = 'Powered by <a href="https://relay.paramms.com" target="_blank" rel="noopener">Relay</a>', this.footer = u, e.append(o, this.chips, this.scroll, this.typing, this.quick, this.formHost, this.csatPanel, this.offlinePanel, h, this.footer), this.cobrowseCanvas = a("canvas", "ocw-cobrowse-canvas"), this.cobrowseToolbar = a("div", "ocw-cobrowse-toolbar");
1802
+ for (const k of ["#f5713c", "#1c1b1a", "#2563eb", "#16a34a", "#dc2626"]) {
1803
1803
  const A = a("button", "ocw-cobrowse-swatch");
1804
- A.style.background = v, A.type = "button", v === this.cobrowseColor && A.classList.add("sel"), A.addEventListener("click", () => {
1805
- this.cobrowseColor = v;
1804
+ A.style.background = k, A.type = "button", k === this.cobrowseColor && A.classList.add("sel"), A.addEventListener("click", () => {
1805
+ this.cobrowseColor = k;
1806
1806
  for (const G of this.cobrowseToolbar.querySelectorAll(".ocw-cobrowse-swatch")) G.classList.remove("sel");
1807
1807
  A.classList.add("sel");
1808
1808
  }), this.cobrowseToolbar.append(A);
1809
1809
  }
1810
- const E = a("button", "ocw-cobrowse-clear", "Clear");
1811
- E.addEventListener("click", () => {
1812
- var v, A;
1813
- return (A = (v = this.h).onAnnotateClear) == null ? void 0 : A.call(v);
1814
- }), this.cobrowseToolbar.append(E), this.cobrowseHint = a("div", "ocw-cobrowse-hint", "🖍 Draw to point things out — visible to both sides"), e.append(this.cobrowseCanvas, this.cobrowseToolbar, this.cobrowseHint), this.bindCobrowsePointerEvents();
1810
+ const U = a("button", "ocw-cobrowse-clear", "Clear");
1811
+ U.addEventListener("click", () => {
1812
+ var k, A;
1813
+ return (A = (k = this.h).onAnnotateClear) == null ? void 0 : A.call(k);
1814
+ }), this.cobrowseToolbar.append(U), this.cobrowseHint = a("div", "ocw-cobrowse-hint", "🖍 Draw to point things out — visible to both sides"), e.append(this.cobrowseCanvas, this.cobrowseToolbar, this.cobrowseHint), this.bindCobrowsePointerEvents();
1815
1815
  }
1816
1816
  /** Returns the scroll container so history.ts can attach scroll listeners. */
1817
1817
  getScrollEl() {
@@ -1840,7 +1840,7 @@ class Dt {
1840
1840
  this.h.onTyping(!0), this.typingTimer && clearTimeout(this.typingTimer), this.typingTimer = setTimeout(() => this.h.onTyping(!1), 2e3);
1841
1841
  }
1842
1842
  render(e) {
1843
- var f, m, x;
1843
+ var f, b, x;
1844
1844
  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) {
1845
1845
  const h = (f = this.cfg.subject) == null ? void 0 : f.ownerLabel;
1846
1846
  h && (this.headerName.textContent = h);
@@ -1861,7 +1861,7 @@ class Dt {
1861
1861
  const c = [...e.typing];
1862
1862
  this.typing.classList.toggle("active", c.length > 0);
1863
1863
  const l = this.typing.querySelector(".ocw-typing-bubble");
1864
- l && l.setAttribute("aria-label", c.length ? "typing" : ""), this.footer.style.display = e.whiteLabel ? "none" : "block", e.offline ? (this.offlinePanel.style.display === "none" && this.buildOfflinePanel(e.offlineMessage), this.offlinePanel.style.display = "block", (m = this.root.querySelector(".ocw-input")) == null || m.style.setProperty("display", "none")) : (this.offlinePanel.style.display = "none", (x = this.root.querySelector(".ocw-input")) == null || x.style.removeProperty("display"));
1864
+ l && l.setAttribute("aria-label", c.length ? "typing" : ""), this.footer.style.display = e.whiteLabel ? "none" : "block", e.offline ? (this.offlinePanel.style.display === "none" && this.buildOfflinePanel(e.offlineMessage), this.offlinePanel.style.display = "block", (b = this.root.querySelector(".ocw-input")) == null || b.style.setProperty("display", "none")) : (this.offlinePanel.style.display = "none", (x = this.root.querySelector(".ocw-input")) == null || x.style.removeProperty("display"));
1865
1865
  const w = ["resolved", "closed", "sold", "issued", "checked_out"];
1866
1866
  this.h.onCsat && !this.csatSubmitted && w.includes(e.state) && e.messages().length > 0 && (this.csatPanel.style.display === "none" && this.buildCsatPanel(), this.csatPanel.style.display = "block");
1867
1867
  }
@@ -1992,30 +1992,30 @@ Message: ${o.value}`), this.offlinePanel.replaceChildren(a("div", "ocw-offline-t
1992
1992
  t.append(a("div", "ocw-form-title", e.icon ? `${e.icon} ${e.label}` : e.label));
1993
1993
  const n = /* @__PURE__ */ new Map();
1994
1994
  for (const f of e.input ?? []) {
1995
- const m = a("label", "ocw-form-row");
1996
- if (m.append(a("span", "ocw-form-lbl", f.label)), f.type === "select" && ((l = f.options) != null && l.length)) {
1995
+ const b = a("label", "ocw-form-row");
1996
+ if (b.append(a("span", "ocw-form-lbl", f.label)), f.type === "select" && ((l = f.options) != null && l.length)) {
1997
1997
  const x = a("select", "ocw-form-input");
1998
1998
  f.required || x.append(a("option", void 0, "— select —"));
1999
1999
  for (const h of f.options) {
2000
- const p = a("option");
2001
- p.value = h, p.textContent = h, x.append(p);
2000
+ const u = a("option");
2001
+ u.value = h, u.textContent = h, x.append(u);
2002
2002
  }
2003
- f.required && (x.required = !0), m.append(x), n.set(f.name, x);
2003
+ f.required && (x.required = !0), b.append(x), n.set(f.name, x);
2004
2004
  } else {
2005
2005
  const x = a("input", "ocw-form-input");
2006
- x.type = f.type === "number" ? "number" : f.type === "date" ? "datetime-local" : "text", f.required && (x.required = !0), m.append(x), n.set(f.name, x);
2006
+ x.type = f.type === "number" ? "number" : f.type === "date" ? "datetime-local" : "text", f.required && (x.required = !0), b.append(x), n.set(f.name, x);
2007
2007
  }
2008
- t.append(m);
2008
+ t.append(b);
2009
2009
  }
2010
2010
  const i = a("div", "ocw-form-actions"), o = a("button", "ocw-form-cancel", "Cancel"), c = a("button", "ocw-form-submit", "Send");
2011
2011
  o.addEventListener("click", () => this.formHost.replaceChildren()), c.addEventListener("click", () => {
2012
2012
  const f = {};
2013
- for (const [m, x] of n) {
2013
+ for (const [b, x] of n) {
2014
2014
  if (x.required && !x.value) {
2015
2015
  x.style.borderColor = "#e5484d";
2016
2016
  return;
2017
2017
  }
2018
- f[m] = x.type === "number" ? Number(x.value) : x.value;
2018
+ f[b] = x.type === "number" ? Number(x.value) : x.value;
2019
2019
  }
2020
2020
  this.formHost.replaceChildren(), this.h.onInvoke(e.id, f);
2021
2021
  }), i.append(o, c), t.append(i), this.formHost.append(t), (w = n.values().next().value) == null || w.focus();
@@ -2024,7 +2024,7 @@ Message: ${o.value}`), this.offlinePanel.replaceChildren(a("div", "ocw-offline-t
2024
2024
  var x;
2025
2025
  if (e.senderRole === "system") {
2026
2026
  const h = a("div", "ocw-sys");
2027
- return h.textContent = e.deletedAt ? "message deleted" : Q(e.content), h;
2027
+ return h.textContent = e.deletedAt ? "message deleted" : Z(e.content), h;
2028
2028
  }
2029
2029
  const n = e.senderId === this.me, i = !!e.internal, o = a("div", `ocw-row ${i ? "ocw-note mine" : n ? "mine" : "theirs"} ${e.senderRole === "bot" ? "ocw-bot" : ""}`);
2030
2030
  !n && !i && o.append(a("div", "ocw-dot", e.senderRole === "bot" ? "🤖" : "🧑"));
@@ -2039,115 +2039,115 @@ Message: ${o.value}`), this.offlinePanel.replaceChildren(a("div", "ocw-offline-t
2039
2039
  else if (e.content.kind === "attachment") {
2040
2040
  const h = e.content;
2041
2041
  if ((x = h.mime) != null && x.startsWith("image/")) {
2042
- const p = document.createElement("img");
2043
- p.src = h.url, p.alt = h.name ?? "image", p.style.cssText = "max-width:220px;max-height:160px;border-radius:10px;display:block;cursor:pointer", p.addEventListener("click", () => window.open(h.url, "_blank")), w.append(p);
2042
+ const u = document.createElement("img");
2043
+ u.src = h.url, u.alt = h.name ?? "image", u.style.cssText = "max-width:220px;max-height:160px;border-radius:10px;display:block;cursor:pointer", u.addEventListener("click", () => window.open(h.url, "_blank")), w.append(u);
2044
2044
  } else {
2045
- const p = document.createElement("a");
2046
- p.href = h.url, p.target = "_blank", p.rel = "noopener", p.style.cssText = "display:flex;align-items:center;gap:8px;color:inherit;text-decoration:none", p.append(a("span", void 0, "📄"), a("span", void 0, h.name ?? "file")), w.append(p);
2045
+ const u = document.createElement("a");
2046
+ u.href = h.url, u.target = "_blank", u.rel = "noopener", u.style.cssText = "display:flex;align-items:center;gap:8px;color:inherit;text-decoration:none", u.append(a("span", void 0, "📄"), a("span", void 0, h.name ?? "file")), w.append(u);
2047
2047
  }
2048
2048
  } else if (e.content.kind === "appointment") {
2049
- const h = e.content, p = a("div", "ocw-appt");
2050
- p.append(a("div", "ocw-appt-title", `📅 ${h.title}`)), p.append(a("div", "ocw-appt-time", new Date(h.startIso).toLocaleString() + " – " + new Date(h.endIso).toLocaleTimeString())), h.location && p.append(a("div", "ocw-appt-loc", `📍 ${h.location}`)), h.description && p.append(a("div", "ocw-appt-desc", h.description));
2051
- const E = a("div", "ocw-appt-links"), y = document.createElement("a");
2052
- y.href = h.googleUrl, y.target = "_blank", y.rel = "noopener", y.className = "ocw-appt-btn", y.textContent = "📅 Add to Google Calendar";
2053
- const g = document.createElement("a");
2054
- g.href = h.icalUrl, g.download = `${h.title}.ics`, g.className = "ocw-appt-btn ocw-appt-btn-sec", g.textContent = "🍎 Apple / iCal", E.append(y, g), p.append(E), w.append(p);
2049
+ const h = e.content, u = a("div", "ocw-appt");
2050
+ u.append(a("div", "ocw-appt-title", `📅 ${h.title}`)), u.append(a("div", "ocw-appt-time", new Date(h.startIso).toLocaleString() + " – " + new Date(h.endIso).toLocaleTimeString())), h.location && u.append(a("div", "ocw-appt-loc", `📍 ${h.location}`)), h.description && u.append(a("div", "ocw-appt-desc", h.description));
2051
+ const U = a("div", "ocw-appt-links"), v = document.createElement("a");
2052
+ v.href = h.googleUrl, v.target = "_blank", v.rel = "noopener", v.className = "ocw-appt-btn", v.textContent = "📅 Add to Google Calendar";
2053
+ const m = document.createElement("a");
2054
+ m.href = h.icalUrl, m.download = `${h.title}.ics`, m.className = "ocw-appt-btn ocw-appt-btn-sec", m.textContent = "🍎 Apple / iCal", U.append(v, m), u.append(U), w.append(u);
2055
2055
  } else
2056
- f = document.createTextNode(Q(e.content)), w.append(f), e.editedAt && w.append(a("span", "ocw-edited", "(edited)"));
2056
+ f = document.createTextNode(Z(e.content)), w.append(f), e.editedAt && w.append(a("span", "ocw-edited", "(edited)"));
2057
2057
  if (l.append(w), !n && !i && this.h.onTranslate && e.content.kind === "text" && !e.deletedAt && e.seq > 0 && f) {
2058
2058
  const h = e.content.text;
2059
2059
  if (h.trim()) {
2060
- const p = a("button", "ocw-translate-btn", "🌐");
2061
- p.type = "button", p.title = "Translate", p.addEventListener("click", (E) => {
2062
- if (E.stopPropagation(), this.showingTranslation.has(e.id)) {
2063
- this.showingTranslation.delete(e.id), f.textContent = h, p.textContent = "🌐", p.title = "Translate";
2060
+ const u = a("button", "ocw-translate-btn", "🌐");
2061
+ u.type = "button", u.title = "Translate", u.addEventListener("click", (U) => {
2062
+ if (U.stopPropagation(), this.showingTranslation.has(e.id)) {
2063
+ this.showingTranslation.delete(e.id), f.textContent = h, u.textContent = "🌐", u.title = "Translate";
2064
2064
  return;
2065
2065
  }
2066
- const y = this.translationCache.get(e.id);
2067
- if (y !== void 0) {
2068
- this.showingTranslation.add(e.id), f.textContent = y, p.textContent = "↩", p.title = "Show original";
2066
+ const v = this.translationCache.get(e.id);
2067
+ if (v !== void 0) {
2068
+ this.showingTranslation.add(e.id), f.textContent = v, u.textContent = "↩", u.title = "Show original";
2069
2069
  return;
2070
2070
  }
2071
- p.textContent = "⏳", this.h.onTranslate(h).then((g) => {
2072
- if (g === null) {
2073
- p.textContent = "⚠️", p.title = "Translation unavailable", setTimeout(() => {
2074
- p.textContent = "🌐", p.title = "Translate";
2071
+ u.textContent = "⏳", this.h.onTranslate(h).then((m) => {
2072
+ if (m === null) {
2073
+ u.textContent = "⚠️", u.title = "Translation unavailable", setTimeout(() => {
2074
+ u.textContent = "🌐", u.title = "Translate";
2075
2075
  }, 1500);
2076
2076
  return;
2077
2077
  }
2078
- this.translationCache.set(e.id, g), this.showingTranslation.add(e.id), f.textContent = g, p.textContent = "↩", p.title = "Show original";
2078
+ this.translationCache.set(e.id, m), this.showingTranslation.add(e.id), f.textContent = m, u.textContent = "↩", u.title = "Show original";
2079
2079
  });
2080
- }), l.append(p);
2080
+ }), l.append(u);
2081
2081
  }
2082
2082
  }
2083
2083
  if (n && !e.deletedAt && e.seq > 0 && (this.h.onEdit ?? this.h.onDelete)) {
2084
2084
  const h = a("div", "ocw-msg-menu");
2085
2085
  if (this.h.onEdit) {
2086
- const p = a("button", void 0, "✏️");
2087
- p.title = "Edit", p.addEventListener("click", (E) => {
2088
- E.stopPropagation();
2089
- const y = Q(e.content), g = document.createElement("textarea");
2090
- g.value = y, g.rows = Math.min(4, Math.ceil(y.length / 40) + 1), g.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";
2091
- const C = a("button", "ocw-form-submit", "Save");
2092
- C.style.cssText = "margin-top:6px;padding:5px 14px;font-size:13px";
2093
- const T = a("button", "ocw-form-cancel", "Cancel");
2094
- T.style.cssText = "margin-top:6px;padding:5px 10px;font-size:13px";
2095
- const U = a("div");
2096
- U.style.cssText = "display:flex;gap:6px;justify-content:flex-end", U.append(T, C);
2097
- const B = a("div");
2098
- B.append(g, U), w.replaceChildren(B), g.focus(), g.select();
2099
- const K = () => w.replaceChildren(f ?? document.createTextNode(y));
2100
- T.addEventListener("click", K), C.addEventListener("click", () => {
2101
- const P = g.value.trim();
2102
- P && P !== y && this.h.onEdit(e.id, P), K();
2103
- }), g.addEventListener("keydown", (P) => {
2104
- P.key === "Enter" && !P.shiftKey && (P.preventDefault(), C.click()), P.key === "Escape" && K();
2086
+ const u = a("button", void 0, "✏️");
2087
+ u.title = "Edit", u.addEventListener("click", (U) => {
2088
+ U.stopPropagation();
2089
+ const v = Z(e.content), m = document.createElement("textarea");
2090
+ m.value = v, m.rows = Math.min(4, Math.ceil(v.length / 40) + 1), m.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";
2091
+ const g = a("button", "ocw-form-submit", "Save");
2092
+ g.style.cssText = "margin-top:6px;padding:5px 14px;font-size:13px";
2093
+ const I = a("button", "ocw-form-cancel", "Cancel");
2094
+ I.style.cssText = "margin-top:6px;padding:5px 10px;font-size:13px";
2095
+ const K = a("div");
2096
+ K.style.cssText = "display:flex;gap:6px;justify-content:flex-end", K.append(I, g);
2097
+ const P = a("div");
2098
+ P.append(m, K), w.replaceChildren(P), m.focus(), m.select();
2099
+ const B = () => w.replaceChildren(f ?? document.createTextNode(v));
2100
+ I.addEventListener("click", B), g.addEventListener("click", () => {
2101
+ const T = m.value.trim();
2102
+ T && T !== v && this.h.onEdit(e.id, T), B();
2103
+ }), m.addEventListener("keydown", (T) => {
2104
+ T.key === "Enter" && !T.shiftKey && (T.preventDefault(), g.click()), T.key === "Escape" && B();
2105
2105
  });
2106
- }), h.append(p);
2106
+ }), h.append(u);
2107
2107
  }
2108
2108
  if (this.h.onDelete) {
2109
- const p = a("button", "del", "🗑");
2110
- p.title = "Delete", p.addEventListener("click", (E) => {
2111
- E.stopPropagation(), this.h.onDelete(e.id);
2112
- }), h.append(p);
2109
+ const u = a("button", "del", "🗑");
2110
+ u.title = "Delete", u.addEventListener("click", (U) => {
2111
+ U.stopPropagation(), this.h.onDelete(e.id);
2112
+ }), h.append(u);
2113
2113
  }
2114
2114
  l.append(h);
2115
2115
  }
2116
2116
  if (c.append(l), this.h.onReact && !e.deletedAt && e.seq > 0) {
2117
- const h = a("div", "ocw-react-wrap"), p = a("div", "ocw-react");
2117
+ const h = a("div", "ocw-react-wrap"), u = a("div", "ocw-react");
2118
2118
  if (e.reactions && Object.keys(e.reactions).length)
2119
- for (const [g, C] of Object.entries(e.reactions)) {
2120
- const T = a("button", `ocw-react-pill${C.includes(this.me) ? " mine" : ""}`, `${g} ${C.length}`);
2121
- T.addEventListener("click", () => {
2122
- var U, B;
2123
- return (B = (U = this.h).onReact) == null ? void 0 : B.call(U, e.id, g, C.includes(this.me));
2124
- }), p.append(T);
2119
+ for (const [m, g] of Object.entries(e.reactions)) {
2120
+ const I = a("button", `ocw-react-pill${g.includes(this.me) ? " mine" : ""}`, `${m} ${g.length}`);
2121
+ I.addEventListener("click", () => {
2122
+ var K, P;
2123
+ return (P = (K = this.h).onReact) == null ? void 0 : P.call(K, e.id, m, g.includes(this.me));
2124
+ }), u.append(I);
2125
2125
  }
2126
- const E = a("button", "ocw-react-btn", "+"), y = a("div", "ocw-react-picker");
2127
- for (const g of At) {
2128
- const C = a("button", void 0, g);
2129
- C.addEventListener("click", (T) => {
2130
- var B, K, P, H;
2131
- T.stopPropagation();
2132
- const U = (K = (B = e.reactions) == null ? void 0 : B[g]) == null ? void 0 : K.includes(this.me);
2133
- (H = (P = this.h).onReact) == null || H.call(P, e.id, g, !!U), y.style.display = "none";
2134
- }), y.append(C);
2126
+ const U = a("button", "ocw-react-btn", "+"), v = a("div", "ocw-react-picker");
2127
+ for (const m of Lt) {
2128
+ const g = a("button", void 0, m);
2129
+ g.addEventListener("click", (I) => {
2130
+ var P, B, T, M;
2131
+ I.stopPropagation();
2132
+ const K = (B = (P = e.reactions) == null ? void 0 : P[m]) == null ? void 0 : B.includes(this.me);
2133
+ (M = (T = this.h).onReact) == null || M.call(T, e.id, m, !!K), v.style.display = "none";
2134
+ }), v.append(g);
2135
2135
  }
2136
- y.style.display = "none", E.addEventListener("click", (g) => {
2137
- g.stopPropagation(), y.style.display = y.style.display === "none" ? "flex" : "none";
2136
+ v.style.display = "none", U.addEventListener("click", (m) => {
2137
+ m.stopPropagation(), v.style.display = v.style.display === "none" ? "flex" : "none";
2138
2138
  }), document.addEventListener("click", () => {
2139
- y.style.display = "none";
2140
- }, { once: !0 }), p.append(E), h.append(p, y), c.append(h);
2141
- } else e.reactions && Object.keys(e.reactions).length && c.append(a("div", "ocw-react", Object.entries(e.reactions).map(([h, p]) => `${h}${p.length}`).join(" ")));
2142
- const m = a("div", "ocw-time ocw-meta", Mt(e.ts));
2139
+ v.style.display = "none";
2140
+ }, { once: !0 }), u.append(U), h.append(u, v), c.append(h);
2141
+ } else e.reactions && Object.keys(e.reactions).length && c.append(a("div", "ocw-react", Object.entries(e.reactions).map(([h, u]) => `${h}${u.length}`).join(" ")));
2142
+ const b = a("div", "ocw-time ocw-meta", _t(e.ts));
2143
2143
  if (n && e.status) {
2144
- const h = a("span", `ocw-tick${e.status === "read" ? " read" : e.status === "delivered" ? " delivered" : ""}`, _t(e.status));
2145
- m.append(h);
2144
+ const h = a("span", `ocw-tick${e.status === "read" ? " read" : e.status === "delivered" ? " delivered" : ""}`, Ht(e.status));
2145
+ b.append(h);
2146
2146
  }
2147
- return n && e.seq > 0 && t.lastReadByOthers >= e.seq && m.append(a("span", "ocw-seen", " · Seen")), c.append(m), o.append(c), o;
2147
+ return n && e.seq > 0 && t.lastReadByOthers >= e.seq && b.append(a("span", "ocw-seen", " · Seen")), c.append(b), o.append(c), o;
2148
2148
  }
2149
2149
  }
2150
- function _t(s) {
2150
+ function Ht(s) {
2151
2151
  switch (s) {
2152
2152
  case "read":
2153
2153
  return "✓✓";
@@ -2160,25 +2160,25 @@ function _t(s) {
2160
2160
  }
2161
2161
  }
2162
2162
  const R = /* @__PURE__ */ new WeakMap();
2163
- function Ft(s) {
2163
+ function qt(s) {
2164
2164
  var e;
2165
2165
  (e = R.get(s)) == null || e.close(), R.delete(s);
2166
2166
  }
2167
- function jt(s) {
2167
+ function Ot(s) {
2168
2168
  var ae, ce, de, le;
2169
2169
  R.has(s.el) && (R.get(s.el).close(), R.delete(s.el));
2170
- const e = s.token ?? Pe();
2171
- let t = new xt(e);
2172
- const n = s.subjectId ? `${e}::${s.subjectId}` : e, i = new mt(n);
2170
+ const e = s.token ?? Ke();
2171
+ let t = new gt(e);
2172
+ const n = s.subjectId ? `${e}::${s.subjectId}` : e, i = new kt(n);
2173
2173
  let o, c = !1, l = null, w = null;
2174
2174
  !s.launcher && !s.el.style.height && s.el.clientHeight === 0 && (s.el.style.width = s.el.style.width || "100%", s.el.style.height = "600px");
2175
2175
  for (const d of i.load()) t.addOptimistic(d.clientMsgId, d.content);
2176
- let f = null, m = null, x = 0, h = !s.launcher;
2176
+ let f = null, b = null, x = 0, h = !s.launcher;
2177
2177
  if (s.launcher) {
2178
- const u = (s.position ?? "bottom-right").includes("right");
2179
- f = document.createElement("div"), f.style.cssText = `position:fixed;${u ? "right:20px" : "left:20px"};bottom:20px;z-index:9999;display:flex;flex-direction:column;align-items:${u ? "flex-end" : "flex-start"};gap:12px`;
2180
- const b = document.createElement("div"), I = typeof window < "u" ? window.matchMedia("(max-width: 479px)") : null, M = (D) => {
2181
- b.style.cssText = D ? [
2178
+ const p = (s.position ?? "bottom-right").includes("right");
2179
+ f = document.createElement("div"), f.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`;
2180
+ const y = document.createElement("div"), E = typeof window < "u" ? window.matchMedia("(max-width: 479px)") : null, D = (_) => {
2181
+ y.style.cssText = _ ? [
2182
2182
  "position:fixed",
2183
2183
  "inset:0",
2184
2184
  "width:100%",
@@ -2201,124 +2201,128 @@ function jt(s) {
2201
2201
  "display:none",
2202
2202
  "flex-direction:column",
2203
2203
  "background:#fff",
2204
- "transform-origin:bottom " + (u ? "right" : "left"),
2204
+ "transform-origin:bottom " + (p ? "right" : "left"),
2205
2205
  "transition:opacity .18s,transform .18s",
2206
2206
  "opacity:0",
2207
2207
  "transform:scale(.95)"
2208
2208
  ].join(";");
2209
2209
  };
2210
- M((I == null ? void 0 : I.matches) ?? !1), I == null || I.addEventListener("change", (D) => M(D.matches)), l = I, w = M, s.el.style.cssText = "width:100%;height:100%;overflow:hidden", b.append(s.el);
2211
- const S = document.createElement("button");
2212
- S.style.cssText = [
2210
+ D((E == null ? void 0 : E.matches) ?? !1), E == null || E.addEventListener("change", (_) => D(_.matches)), l = E, w = D, s.el.style.cssText = "width:100%;height:100%;overflow:hidden", y.append(s.el);
2211
+ const C = document.createElement("button");
2212
+ C.style.cssText = [
2213
2213
  "width:56px;height:56px;border-radius:50%",
2214
2214
  `background:${s.accent ?? "#4F63F5"}`,
2215
2215
  "color:#fff;border:none;font-size:24px;cursor:pointer",
2216
2216
  "box-shadow:0 4px 16px rgba(0,0,0,.25)",
2217
2217
  "position:relative;flex:none",
2218
2218
  "transition:transform .15s"
2219
- ].join(";"), S.textContent = "💬", S.onmouseenter = () => {
2220
- S.style.transform = "scale(1.08)";
2221
- }, S.onmouseleave = () => {
2222
- S.style.transform = "scale(1)";
2223
- }, m = document.createElement("span"), m.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", S.append(m), f.append(b, S), document.body.append(f);
2224
- const V = (D) => {
2225
- D ? (b.style.display = "flex", requestAnimationFrame(() => {
2226
- b.style.opacity = "1", b.style.transform = "scale(1)";
2227
- })) : (b.style.opacity = "0", b.style.transform = "scale(.95)", setTimeout(() => {
2228
- h || (b.style.display = "none");
2219
+ ].join(";"), C.textContent = "💬", C.onmouseenter = () => {
2220
+ C.style.transform = "scale(1.08)";
2221
+ }, C.onmouseleave = () => {
2222
+ C.style.transform = "scale(1)";
2223
+ }, b = document.createElement("span"), b.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", C.append(b), f.append(y, C), document.body.append(f);
2224
+ const V = (_) => {
2225
+ _ ? (y.style.display = "flex", requestAnimationFrame(() => {
2226
+ y.style.opacity = "1", y.style.transform = "scale(1)";
2227
+ })) : (y.style.opacity = "0", y.style.transform = "scale(.95)", setTimeout(() => {
2228
+ h || (y.style.display = "none");
2229
2229
  }, 180));
2230
2230
  };
2231
- S.addEventListener("click", () => {
2232
- h = !h, V(h), S.textContent = h ? "✕" : "💬", S.append(m), h && (x = 0, m && (m.style.display = "none"));
2233
- }), document.addEventListener("keydown", (D) => {
2234
- D.key === "Escape" && h && (h = !1, V(!1), S.textContent = "💬", S.append(m));
2231
+ C.addEventListener("click", () => {
2232
+ h = !h, V(h), C.textContent = h ? "✕" : "💬", C.append(b), h && (x = 0, b && (b.style.display = "none"));
2233
+ }), document.addEventListener("keydown", (_) => {
2234
+ _.key === "Escape" && h && (h = !1, V(!1), C.textContent = "💬", C.append(b));
2235
2235
  });
2236
2236
  }
2237
- const p = () => {
2238
- h || (x++, m && (m.textContent = String(x), m.style.display = "flex"));
2239
- }, E = () => {
2237
+ const u = () => {
2238
+ h || (x++, b && (b.textContent = String(x), b.style.display = "flex"));
2239
+ }, U = () => {
2240
2240
  try {
2241
- const d = new AudioContext(), u = d.createOscillator(), b = d.createGain();
2242
- u.connect(b), b.connect(d.destination), u.frequency.setValueAtTime(880, d.currentTime), u.frequency.exponentialRampToValueAtTime(440, d.currentTime + 0.15), b.gain.setValueAtTime(0.3, d.currentTime), b.gain.exponentialRampToValueAtTime(1e-3, d.currentTime + 0.3), u.start(), u.stop(d.currentTime + 0.3);
2241
+ const d = new AudioContext(), p = d.createOscillator(), y = d.createGain();
2242
+ p.connect(y), y.connect(d.destination), p.frequency.setValueAtTime(880, d.currentTime), p.frequency.exponentialRampToValueAtTime(440, d.currentTime + 0.15), y.gain.setValueAtTime(0.3, d.currentTime), y.gain.exponentialRampToValueAtTime(1e-3, d.currentTime + 0.3), p.start(), p.stop(d.currentTime + 0.3);
2243
2243
  } catch {
2244
2244
  }
2245
+ }, v = [], m = (d) => {
2246
+ for (; v.length; ) {
2247
+ const p = v.shift();
2248
+ i.add({ clientMsgId: p.clientMsgId, content: p.content, ts: Date.now() }), g.send({ type: "send", conversationId: d, clientMsgId: p.clientMsgId, content: p.content });
2249
+ }
2245
2250
  };
2246
- let y;
2247
- const g = new Bt(`ocw-e2e-${s.profileId}`);
2248
- let C = !1;
2249
- const T = [], U = [];
2250
- let B = !1;
2251
- const K = (d, u) => {
2252
- g.sealText(u).then((b) => {
2253
- o && y.send({ type: "send", conversationId: o, clientMsgId: d, content: b });
2251
+ let g;
2252
+ const I = new At(`ocw-e2e-${s.profileId}`);
2253
+ let K = !1;
2254
+ const P = [], B = [];
2255
+ let T = !1;
2256
+ const M = (d, p) => {
2257
+ I.sealText(p).then((y) => {
2258
+ o && g.send({ type: "send", conversationId: o, clientMsgId: d, content: y });
2254
2259
  });
2255
- }, P = (d, u, b) => {
2256
- g.sealText(u, b).then((I) => {
2257
- o && y.send({ type: "send", conversationId: o, clientMsgId: d, content: I });
2260
+ }, k = (d, p, y) => {
2261
+ I.sealText(p, y).then((E) => {
2262
+ o && g.send({ type: "send", conversationId: o, clientMsgId: d, content: E });
2258
2263
  });
2259
- }, H = () => {
2260
- for (; T.length; ) {
2261
- const d = T.shift();
2262
- K(d.clientMsgId, d.text);
2264
+ }, A = () => {
2265
+ for (; P.length; ) {
2266
+ const d = P.shift();
2267
+ M(d.clientMsgId, d.text);
2263
2268
  }
2264
- for (; U.length; ) {
2265
- const d = U.shift();
2266
- K(d.clientMsgId, d.text);
2269
+ for (; B.length; ) {
2270
+ const d = B.shift();
2271
+ M(d.clientMsgId, d.text);
2267
2272
  }
2268
- }, v = (d) => {
2269
- y.send({ type: "fetchPrekey", targetUserId: d });
2270
- }, A = s.i18n ?? {}, G = ["ar", "he", "fa", "ur"], ke = typeof navigator < "u" ? (navigator.language ?? "").slice(0, 2).toLowerCase() : "";
2271
- G.includes(ke) && !s.el.dir && (s.el.dir = "rtl", s.el.style.fontFamily = s.el.style.fontFamily || "Tahoma,Arial,system-ui,sans-serif");
2272
- const L = new Dt(s.el, e, {
2273
+ }, G = (d) => {
2274
+ g.send({ type: "fetchPrekey", targetUserId: d });
2275
+ }, ke = s.i18n ?? {}, Se = ["ar", "he", "fa", "ur"], Ie = typeof navigator < "u" ? (navigator.language ?? "").slice(0, 2).toLowerCase() : "";
2276
+ Se.includes(Ie) && !s.el.dir && (s.el.dir = "rtl", s.el.style.fontFamily = s.el.style.fontFamily || "Tahoma,Arial,system-ui,sans-serif");
2277
+ const L = new $t(s.el, e, {
2273
2278
  onSend(d) {
2274
- if (!o) return;
2275
- const u = `cm_${Math.random().toString(36).slice(2)}`;
2276
- t.addOptimistic(u, { kind: "text", text: d }), L.render(t), t.e2e ? g.ready ? K(u, d) : B ? U.push({ clientMsgId: u, text: d }) : (T.push({ clientMsgId: u, text: d }), t.assignedAgentId && v(t.assignedAgentId)) : (i.add({ clientMsgId: u, content: { kind: "text", text: d }, ts: Date.now() }), y.send({ type: "send", conversationId: o, clientMsgId: u, content: { kind: "text", text: d } }));
2279
+ const p = `cm_${Math.random().toString(36).slice(2)}`, y = { kind: "text", text: d };
2280
+ t.addOptimistic(p, y), L.render(t), t.e2e ? I.ready ? M(p, d) : T ? B.push({ clientMsgId: p, text: d }) : (P.push({ clientMsgId: p, text: d }), t.assignedAgentId && G(t.assignedAgentId)) : o ? (i.add({ clientMsgId: p, content: y, ts: Date.now() }), g.send({ type: "send", conversationId: o, clientMsgId: p, content: y })) : v.push({ clientMsgId: p, content: y });
2277
2281
  },
2278
2282
  async onAttach(d) {
2279
2283
  if (!o) return;
2280
- const I = `${s.url.replace(/^ws/, "http").replace(/\/ws$/, "")}/upload?name=${encodeURIComponent(d.name)}`, M = `cm_${Math.random().toString(36).slice(2)}`;
2281
- t.addOptimistic(M, { kind: "text", text: `📎 Uploading ${d.name}…` }), L.render(t);
2284
+ const E = `${s.url.replace(/^ws/, "http").replace(/\/ws$/, "")}/upload?name=${encodeURIComponent(d.name)}`, D = `cm_${Math.random().toString(36).slice(2)}`;
2285
+ t.addOptimistic(D, { kind: "text", text: `📎 Uploading ${d.name}…` }), L.render(t);
2282
2286
  try {
2283
- const S = await fetch(I, {
2287
+ const C = await fetch(E, {
2284
2288
  method: "POST",
2285
2289
  headers: { "content-type": d.type, ...s.token ? { authorization: `Bearer ${s.token}` } : {} },
2286
2290
  body: d
2287
2291
  });
2288
- if (!S.ok) throw new Error(`Upload failed: ${S.status}`);
2289
- const { url: V, name: D, mime: Ce, size: Ee } = await S.json();
2290
- y.send({ type: "send", conversationId: o, clientMsgId: M, content: { kind: "attachment", url: V, name: D, mime: Ce, size: Ee } });
2291
- } catch (S) {
2292
- t.addOptimistic(M, { kind: "text", text: `⚠️ Upload failed: ${S.message}` }), L.render(t);
2292
+ if (!C.ok) throw new Error(`Upload failed: ${C.status}`);
2293
+ const { url: V, name: _, mime: Te, size: Ue } = await C.json();
2294
+ g.send({ type: "send", conversationId: o, clientMsgId: D, content: { kind: "attachment", url: V, name: _, mime: Te, size: Ue } });
2295
+ } catch (C) {
2296
+ t.addOptimistic(D, { kind: "text", text: `⚠️ Upload failed: ${C.message}` }), L.render(t);
2293
2297
  }
2294
2298
  },
2295
- onInvoke(d, u) {
2296
- o && y.send({ type: "invoke", conversationId: o, actionId: d, clientInvokeId: `iv_${Math.random().toString(36).slice(2)}`, ...u ? { inputs: u } : {} });
2299
+ onInvoke(d, p) {
2300
+ o && g.send({ type: "invoke", conversationId: o, actionId: d, clientInvokeId: `iv_${Math.random().toString(36).slice(2)}`, ...p ? { inputs: p } : {} });
2297
2301
  },
2298
2302
  onTyping(d) {
2299
- o && y.send({ type: "typing", conversationId: o, isTyping: d });
2303
+ o && g.send({ type: "typing", conversationId: o, isTyping: d });
2300
2304
  },
2301
2305
  onReadUpTo(d) {
2302
- o && y.send({ type: "read", conversationId: o, seq: d });
2306
+ o && g.send({ type: "read", conversationId: o, seq: d });
2303
2307
  },
2304
2308
  onLoadMore() {
2305
2309
  if (!o || !t.e2e) return;
2306
2310
  const d = t.messages()[0];
2307
- d && y.send({ type: "history", conversationId: o, beforeSeq: d.seq, limit: 20 });
2311
+ d && g.send({ type: "history", conversationId: o, beforeSeq: d.seq, limit: 20 });
2308
2312
  },
2309
- onEdit(d, u) {
2310
- o && y.send({ type: "edit", conversationId: o, messageId: d, content: { kind: "text", text: u } });
2313
+ onEdit(d, p) {
2314
+ o && g.send({ type: "edit", conversationId: o, messageId: d, content: { kind: "text", text: p } });
2311
2315
  },
2312
2316
  onDelete(d) {
2313
- o && y.send({ type: "delete", conversationId: o, messageId: d });
2317
+ o && g.send({ type: "delete", conversationId: o, messageId: d });
2314
2318
  },
2315
- onReact(d, u, b) {
2316
- o && y.send({ type: "react", conversationId: o, messageId: d, emoji: u, remove: b });
2319
+ onReact(d, p, y) {
2320
+ o && g.send({ type: "react", conversationId: o, messageId: d, emoji: p, remove: y });
2317
2321
  },
2318
2322
  onCsat(d) {
2319
2323
  if (!o) return;
2320
- const u = Ke(s.url);
2321
- fetch(`${u}/conversations/${o}/csat`, {
2324
+ const p = ze(s.url);
2325
+ fetch(`${p}/conversations/${o}/csat`, {
2322
2326
  method: "POST",
2323
2327
  headers: { "Content-Type": "application/json", Authorization: `Bearer ${e}` },
2324
2328
  body: JSON.stringify({ score: d })
@@ -2326,23 +2330,23 @@ function jt(s) {
2326
2330
  });
2327
2331
  },
2328
2332
  onAnnotate(d) {
2329
- o && y.send({ type: "annotate", conversationId: o, stroke: d });
2333
+ o && g.send({ type: "annotate", conversationId: o, stroke: d });
2330
2334
  },
2331
2335
  onAnnotateClear() {
2332
- o && y.send({ type: "annotate_clear", conversationId: o });
2336
+ o && g.send({ type: "annotate_clear", conversationId: o });
2333
2337
  },
2334
2338
  ...s.translateLang ? {
2335
2339
  async onTranslate(d) {
2336
- const u = s.url.replace(/^ws/, "http").replace(/\/+$/, "");
2340
+ const p = s.url.replace(/^ws/, "http").replace(/\/+$/, "");
2337
2341
  try {
2338
- const b = await fetch(`${u}/translate`, {
2342
+ const y = await fetch(`${p}/translate`, {
2339
2343
  method: "POST",
2340
2344
  headers: { "content-type": "application/json", authorization: `Bearer ${e}` },
2341
2345
  body: JSON.stringify({ text: d, targetLang: s.translateLang })
2342
2346
  });
2343
- if (!b.ok) return null;
2344
- const { translated: I } = await b.json();
2345
- return I;
2347
+ if (!y.ok) return null;
2348
+ const { translated: E } = await y.json();
2349
+ return E;
2346
2350
  } catch {
2347
2351
  return null;
2348
2352
  }
@@ -2353,8 +2357,8 @@ function jt(s) {
2353
2357
  ...s.quickReplies ? { quickReplies: s.quickReplies } : {},
2354
2358
  ...s.accent ? { accent: s.accent } : {},
2355
2359
  ...(ae = s.user) != null && ae.name || (ce = s.user) != null && ce.avatar ? { userInfo: { ...s.user.name ? { name: s.user.name } : {}, ...s.user.avatar ? { avatar: s.user.avatar } : {} } } : {},
2356
- i18n: A
2357
- }), Se = {
2360
+ i18n: ke
2361
+ }), Ce = {
2358
2362
  type: "open",
2359
2363
  profileId: s.profileId,
2360
2364
  ...s.subjectId ? { subjectId: s.subjectId } : {},
@@ -2364,82 +2368,82 @@ function jt(s) {
2364
2368
  // This is how listingTitle and listingMeta get saved without a separate API call.
2365
2369
  ...(de = s.subject) != null && de.title ? { subjectTitle: s.subject.title } : {},
2366
2370
  ...(le = s.subject) != null && le.subtitle ? { subjectMeta: s.subject.subtitle } : {}
2367
- }, Ie = (d) => {
2368
- const u = s.user;
2369
- if (!u || !u.name && !u.email && !u.avatar && !u.meta) return;
2370
- const b = [];
2371
- if (u.name && b.push(`Name: ${u.name}`), u.email && b.push(`Email: ${u.email}`), u.avatar && b.push(`Avatar: ${u.avatar}`), u.meta) for (const [I, M] of Object.entries(u.meta)) b.push(`${I}: ${M}`);
2372
- y.send({ type: "note", conversationId: d, clientMsgId: `ui_${Date.now()}`, text: `[User info]
2373
- ${b.join(`
2371
+ }, Ee = (d) => {
2372
+ const p = s.user;
2373
+ if (!p || !p.name && !p.email && !p.avatar && !p.meta) return;
2374
+ const y = [];
2375
+ if (p.name && y.push(`Name: ${p.name}`), p.email && y.push(`Email: ${p.email}`), p.avatar && y.push(`Avatar: ${p.avatar}`), p.meta) for (const [E, D] of Object.entries(p.meta)) y.push(`${E}: ${D}`);
2376
+ g.send({ type: "note", conversationId: d, clientMsgId: `ui_${Date.now()}`, text: `[User info]
2377
+ ${y.join(`
2374
2378
  `)}` });
2375
2379
  };
2376
- y = new yt({
2380
+ g = new bt({
2377
2381
  url: s.url,
2378
2382
  token: e,
2379
- open: Se,
2383
+ open: Ce,
2380
2384
  getCursor: () => t.highestSeq(),
2381
2385
  onStatusChange: (d) => L.setConnStatus(d),
2382
2386
  onFrame(d) {
2383
2387
  if (d.type === "opened") {
2384
- const u = o === void 0;
2388
+ const p = o === void 0;
2385
2389
  if (o = d.conversation.id, !c) {
2386
2390
  c = !0;
2387
- for (const b of i.load())
2388
- y.send({ type: "send", conversationId: o, clientMsgId: b.clientMsgId, content: b.content });
2391
+ for (const y of i.load())
2392
+ g.send({ type: "send", conversationId: o, clientMsgId: y.clientMsgId, content: y.content });
2389
2393
  }
2390
- u && (Be(s.url, e, o, t, L), d.conversation.lastSeq === 0 && Ie(o));
2394
+ Ae(s.url, e, o, t, L), v.length && m(o), p && d.conversation.lastSeq === 0 && Ee(o);
2391
2395
  }
2392
2396
  if (d.type === "ack" && i.remove(d.clientMsgId), d.type === "prekeyBundle") {
2393
- d.bundle && (B = !0, g.x3dhSendTo(d.bundle).then((u) => {
2394
- const b = [...T.splice(0), ...U.splice(0)];
2395
- for (const I of b) P(I.clientMsgId, I.text, u);
2397
+ d.bundle && (T = !0, I.x3dhSendTo(d.bundle).then((p) => {
2398
+ const y = [...P.splice(0), ...B.splice(0)];
2399
+ for (const E of y) k(E.clientMsgId, E.text, p);
2396
2400
  L.render(t);
2397
2401
  }));
2398
2402
  return;
2399
2403
  }
2400
2404
  if (d.type === "message" && t.e2e) {
2401
- const u = Kt(d.message.content);
2402
- if (u && !g.ready) {
2403
- g.x3dhReceiveFrom(u.x3dhIK, u.x3dhEK, u.x3dhSPK).then(async () => {
2404
- await g.openFrame(d), t.apply(d), L.render(t);
2405
+ const p = zt(d.message.content);
2406
+ if (p && !I.ready) {
2407
+ I.x3dhReceiveFrom(p.x3dhIK, p.x3dhEK, p.x3dhSPK).then(async () => {
2408
+ await I.openFrame(d), t.apply(d), L.render(t);
2405
2409
  });
2406
2410
  return;
2407
2411
  }
2408
2412
  }
2409
2413
  if (d.type === "peerkey") {
2410
- g.onPeerKey(d.key).then(() => {
2411
- H(), L.render(t);
2414
+ I.onPeerKey(d.key).then(() => {
2415
+ A(), L.render(t);
2412
2416
  });
2413
2417
  return;
2414
2418
  }
2415
2419
  (async () => {
2416
- if (t.e2e && await g.openFrame(d), t.apply(d), d.type === "message" && d.message.senderId !== e && !d.message.internal && (p(), E()), t.e2e && o && !C) {
2417
- C = !0;
2418
- const u = await g.initX3DH();
2419
- y.send({ type: "uploadPrekeys", ...u });
2420
- const b = await g.begin();
2421
- y.send({ type: "pubkey", conversationId: o, key: b });
2420
+ if (t.e2e && await I.openFrame(d), t.apply(d), d.type === "message" && d.message.senderId !== e && !d.message.internal && (u(), U()), t.e2e && o && !K) {
2421
+ K = !0;
2422
+ const p = await I.initX3DH();
2423
+ g.send({ type: "uploadPrekeys", ...p });
2424
+ const y = await I.begin();
2425
+ g.send({ type: "pubkey", conversationId: o, key: y });
2422
2426
  }
2423
2427
  L.render(t);
2424
2428
  })();
2425
2429
  }
2426
- }), y.connect(), L.render(t);
2430
+ }), g.connect(), L.render(t);
2427
2431
  const re = { close: () => {
2428
- y.close(), f == null || f.remove(), L.destroy(), l && w && l.removeEventListener("change", (d) => w(d.matches)), R.delete(s.el);
2432
+ g.close(), f == null || f.remove(), L.destroy(), l && w && l.removeEventListener("change", (d) => w(d.matches)), R.delete(s.el);
2429
2433
  } };
2430
2434
  return R.set(s.el, re), re;
2431
2435
  }
2432
2436
  export {
2433
- xt as ChatStore,
2434
- yt as ConnectionManager,
2435
- Bt as E2ESession,
2436
- mt as PersistentOutbox,
2437
- Dt as Renderer,
2438
- Rt as asConversationId,
2439
- Kt as extractX3DHInit,
2440
- Ke as httpBaseFromWsUrl,
2441
- jt as mount,
2442
- Be as restoreHistory,
2443
- Ft as unmount
2437
+ gt as ChatStore,
2438
+ bt as ConnectionManager,
2439
+ At as E2ESession,
2440
+ kt as PersistentOutbox,
2441
+ $t as Renderer,
2442
+ jt as asConversationId,
2443
+ zt as extractX3DHInit,
2444
+ ze as httpBaseFromWsUrl,
2445
+ Ot as mount,
2446
+ Ae as restoreHistory,
2447
+ qt as unmount
2444
2448
  };
2445
2449
  //# sourceMappingURL=index.js.map