@paramms/chat-widget 1.0.7 → 1.0.8

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,10 +1,10 @@
1
- var ke = Object.defineProperty;
2
- var Se = (s, e, t) => e in s ? ke(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var r = (s, e, t) => Se(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { p as Ie, r as Ce } from "./uid-BeWsLRS3.js";
5
- import { h as _t } from "./uid-BeWsLRS3.js";
6
- const Lt = (s) => s;
7
- function Ee(s) {
1
+ var Ie = Object.defineProperty;
2
+ var Ce = (s, e, t) => e in s ? Ie(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var r = (s, e, t) => Ce(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { p as Ee, r as Ue } from "./uid.js";
5
+ import { h as Rt } from "./uid.js";
6
+ const Dt = (s) => s;
7
+ function Te(s) {
8
8
  const e = s.length;
9
9
  let t = 0, i = 0;
10
10
  for (; i < e; ) {
@@ -26,7 +26,7 @@ function Ee(s) {
26
26
  }
27
27
  return t;
28
28
  }
29
- function Ue(s, e, t) {
29
+ function Pe(s, e, t) {
30
30
  const i = s.length;
31
31
  let n = t, o = 0;
32
32
  for (; o < i; ) {
@@ -48,15 +48,15 @@ function Ue(s, e, t) {
48
48
  e[n++] = c & 63 | 128;
49
49
  }
50
50
  }
51
- const Te = new TextEncoder(), Pe = 50;
52
- function Be(s, e, t) {
53
- Te.encodeInto(s, e.subarray(t));
51
+ const Be = new TextEncoder(), Ke = 50;
52
+ function Ae(s, e, t) {
53
+ Be.encodeInto(s, e.subarray(t));
54
54
  }
55
- function Ke(s, e, t) {
56
- s.length > Pe ? Be(s, e, t) : Ue(s, e, t);
55
+ function ze(s, e, t) {
56
+ s.length > Ke ? Ae(s, e, t) : Pe(s, e, t);
57
57
  }
58
- const Ae = 4096;
59
- function he(s, e, t) {
58
+ const Le = 4096;
59
+ function ue(s, e, t) {
60
60
  let i = e;
61
61
  const n = i + t, o = [];
62
62
  let c = "";
@@ -76,17 +76,17 @@ function he(s, e, t) {
76
76
  w > 65535 && (w -= 65536, o.push(w >>> 10 & 1023 | 55296), w = 56320 | w & 1023), o.push(w);
77
77
  } else
78
78
  o.push(l);
79
- o.length >= Ae && (c += String.fromCharCode(...o), o.length = 0);
79
+ o.length >= Le && (c += String.fromCharCode(...o), o.length = 0);
80
80
  }
81
81
  return o.length > 0 && (c += String.fromCharCode(...o)), c;
82
82
  }
83
- const ze = new TextDecoder(), Le = 200;
84
- function Me(s, e, t) {
83
+ const Me = new TextDecoder(), De = 200;
84
+ function $e(s, e, t) {
85
85
  const i = s.subarray(e, e + t);
86
- return ze.decode(i);
86
+ return Me.decode(i);
87
87
  }
88
- function De(s, e, t) {
89
- return t > Le ? Me(s, e, t) : he(s, e, t);
88
+ function _e(s, e, t) {
89
+ return t > De ? $e(s, e, t) : ue(s, e, t);
90
90
  }
91
91
  class N {
92
92
  constructor(e, t) {
@@ -107,26 +107,26 @@ class U extends Error {
107
107
  }
108
108
  }
109
109
  const F = 4294967295;
110
- function $e(s, e, t) {
110
+ function He(s, e, t) {
111
111
  const i = t / 4294967296, n = t;
112
112
  s.setUint32(e, i), s.setUint32(e + 4, n);
113
113
  }
114
- function pe(s, e, t) {
114
+ function fe(s, e, t) {
115
115
  const i = Math.floor(t / 4294967296), n = t;
116
116
  s.setUint32(e, i), s.setUint32(e + 4, n);
117
117
  }
118
- function ue(s, e) {
118
+ function we(s, e) {
119
119
  const t = s.getInt32(e), i = s.getUint32(e + 4);
120
120
  return t * 4294967296 + i;
121
121
  }
122
- function _e(s, e) {
122
+ function Re(s, e) {
123
123
  const t = s.getUint32(e), i = s.getUint32(e + 4);
124
124
  return t * 4294967296 + i;
125
125
  }
126
- const He = -1, Re = 4294967296 - 1, Fe = 17179869184 - 1;
127
- function qe({ sec: s, nsec: e }) {
128
- if (s >= 0 && e >= 0 && s <= Fe)
129
- if (e === 0 && s <= Re) {
126
+ const Fe = -1, je = 4294967296 - 1, qe = 17179869184 - 1;
127
+ function Oe({ sec: s, nsec: e }) {
128
+ if (s >= 0 && e >= 0 && s <= qe)
129
+ if (e === 0 && s <= je) {
130
130
  const t = new Uint8Array(4);
131
131
  return new DataView(t.buffer).setUint32(0, s), t;
132
132
  } else {
@@ -135,24 +135,24 @@ function qe({ sec: s, nsec: e }) {
135
135
  }
136
136
  else {
137
137
  const t = new Uint8Array(12), i = new DataView(t.buffer);
138
- return i.setUint32(0, e), pe(i, 4, s), t;
138
+ return i.setUint32(0, e), fe(i, 4, s), t;
139
139
  }
140
140
  }
141
- function je(s) {
141
+ function Ne(s) {
142
142
  const e = s.getTime(), t = Math.floor(e / 1e3), i = (e - t * 1e3) * 1e6, n = Math.floor(i / 1e9);
143
143
  return {
144
144
  sec: t + n,
145
145
  nsec: i - n * 1e9
146
146
  };
147
147
  }
148
- function Oe(s) {
148
+ function Ve(s) {
149
149
  if (s instanceof Date) {
150
- const e = je(s);
151
- return qe(e);
150
+ const e = Ne(s);
151
+ return Oe(e);
152
152
  } else
153
153
  return null;
154
154
  }
155
- function Ne(s) {
155
+ function We(s) {
156
156
  const e = new DataView(s.buffer, s.byteOffset, s.byteLength);
157
157
  switch (s.byteLength) {
158
158
  case 4:
@@ -162,21 +162,21 @@ function Ne(s) {
162
162
  return { sec: n, nsec: o };
163
163
  }
164
164
  case 12: {
165
- const t = ue(e, 4), i = e.getUint32(0);
165
+ const t = we(e, 4), i = e.getUint32(0);
166
166
  return { sec: t, nsec: i };
167
167
  }
168
168
  default:
169
169
  throw new U(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${s.length}`);
170
170
  }
171
171
  }
172
- function Ve(s) {
173
- const e = Ne(s);
172
+ function Xe(s) {
173
+ const e = We(s);
174
174
  return new Date(e.sec * 1e3 + e.nsec / 1e6);
175
175
  }
176
- const We = {
177
- type: He,
178
- encode: Oe,
179
- decode: Ve
176
+ const Ye = {
177
+ type: Fe,
178
+ encode: Ve,
179
+ decode: Xe
180
180
  }, X = class X {
181
181
  constructor() {
182
182
  // ensures ExtensionCodecType<X> matches ExtensionCodec<X>
@@ -189,7 +189,7 @@ const We = {
189
189
  // custom extensions
190
190
  r(this, "encoders", []);
191
191
  r(this, "decoders", []);
192
- this.register(We);
192
+ this.register(Ye);
193
193
  }
194
194
  register({ type: e, encode: t, decode: i }) {
195
195
  if (e >= 0)
@@ -229,13 +229,13 @@ const We = {
229
229
  };
230
230
  r(X, "defaultCodec", new X());
231
231
  let V = X;
232
- function Xe(s) {
232
+ function Je(s) {
233
233
  return s instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && s instanceof SharedArrayBuffer;
234
234
  }
235
235
  function Z(s) {
236
- return s instanceof Uint8Array ? s : ArrayBuffer.isView(s) ? new Uint8Array(s.buffer, s.byteOffset, s.byteLength) : Xe(s) ? new Uint8Array(s) : Uint8Array.from(s);
236
+ return s instanceof Uint8Array ? s : ArrayBuffer.isView(s) ? new Uint8Array(s.buffer, s.byteOffset, s.byteLength) : Je(s) ? new Uint8Array(s) : Uint8Array.from(s);
237
237
  }
238
- const Ye = 100, Je = 2048;
238
+ const Ge = 100, Ze = 2048;
239
239
  class te {
240
240
  constructor(e) {
241
241
  r(this, "extensionCodec");
@@ -251,7 +251,7 @@ class te {
251
251
  r(this, "view");
252
252
  r(this, "bytes");
253
253
  r(this, "entered", !1);
254
- this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? V.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) ?? Ye, this.initialBufferSize = (e == null ? void 0 : e.initialBufferSize) ?? Je, 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
+ this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? V.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) ?? Ge, this.initialBufferSize = (e == null ? void 0 : e.initialBufferSize) ?? Ze, 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);
255
255
  }
256
256
  clone() {
257
257
  return new te({
@@ -336,8 +336,8 @@ class te {
336
336
  throw new Error(`Too long string: ${e} bytes in UTF-8`);
337
337
  }
338
338
  encodeString(e) {
339
- const i = Ee(e);
340
- this.ensureBufferSizeToWrite(5 + i), this.writeStringHeader(i), Ke(e, this.bytes, this.pos), this.pos += i;
339
+ const i = Te(e);
340
+ this.ensureBufferSizeToWrite(5 + i), this.writeStringHeader(i), ze(e, this.bytes, this.pos), this.pos += i;
341
341
  }
342
342
  encodeObject(e, t) {
343
343
  const i = this.extensionCodec.tryToEncode(e, this.context);
@@ -459,10 +459,10 @@ class te {
459
459
  this.ensureBufferSizeToWrite(8), this.view.setFloat64(this.pos, e), this.pos += 8;
460
460
  }
461
461
  writeU64(e) {
462
- this.ensureBufferSizeToWrite(8), $e(this.view, this.pos, e), this.pos += 8;
462
+ this.ensureBufferSizeToWrite(8), He(this.view, this.pos, e), this.pos += 8;
463
463
  }
464
464
  writeI64(e) {
465
- this.ensureBufferSizeToWrite(8), pe(this.view, this.pos, e), this.pos += 8;
465
+ this.ensureBufferSizeToWrite(8), fe(this.view, this.pos, e), this.pos += 8;
466
466
  }
467
467
  writeBigUint64(e) {
468
468
  this.ensureBufferSizeToWrite(8), this.view.setBigUint64(this.pos, e), this.pos += 8;
@@ -471,15 +471,15 @@ class te {
471
471
  this.ensureBufferSizeToWrite(8), this.view.setBigInt64(this.pos, e), this.pos += 8;
472
472
  }
473
473
  }
474
- function Ge(s, e) {
474
+ function Qe(s, e) {
475
475
  return new te(e).encodeSharedRef(s);
476
476
  }
477
477
  function J(s) {
478
478
  return `${s < 0 ? "-" : ""}0x${Math.abs(s).toString(16).padStart(2, "0")}`;
479
479
  }
480
- const Ze = 16, Qe = 16;
481
- class et {
482
- constructor(e = Ze, t = Qe) {
480
+ const et = 16, tt = 16;
481
+ class it {
482
+ constructor(e = et, t = tt) {
483
483
  r(this, "hit", 0);
484
484
  r(this, "miss", 0);
485
485
  r(this, "caches");
@@ -512,16 +512,16 @@ class et {
512
512
  if (n != null)
513
513
  return this.hit++, n;
514
514
  this.miss++;
515
- const o = he(e, t, i), c = Uint8Array.prototype.slice.call(e, t, t + i);
515
+ const o = ue(e, t, i), c = Uint8Array.prototype.slice.call(e, t, t + i);
516
516
  return this.store(c, o), o;
517
517
  }
518
518
  }
519
- const Q = "array", j = "map_key", fe = "map_value", tt = (s) => {
519
+ const Q = "array", q = "map_key", xe = "map_value", nt = (s) => {
520
520
  if (typeof s == "string" || typeof s == "number")
521
521
  return s;
522
522
  throw new U("The type of key must be string or number but " + typeof s);
523
523
  };
524
- class it {
524
+ class st {
525
525
  constructor() {
526
526
  r(this, "stack", []);
527
527
  r(this, "stackHeadPosition", -1);
@@ -538,7 +538,7 @@ class it {
538
538
  }
539
539
  pushMapState(e) {
540
540
  const t = this.getUninitializedStateFromPool();
541
- t.type = j, t.readCount = 0, t.size = e, t.map = {};
541
+ t.type = q, t.readCount = 0, t.size = e, t.map = {};
542
542
  }
543
543
  getUninitializedStateFromPool() {
544
544
  if (this.stackHeadPosition++, this.stackHeadPosition === this.stack.length) {
@@ -562,7 +562,7 @@ class it {
562
562
  const i = e;
563
563
  i.size = 0, i.array = void 0, i.position = 0, i.type = void 0;
564
564
  }
565
- if (e.type === j || e.type === fe) {
565
+ if (e.type === q || e.type === xe) {
566
566
  const i = e;
567
567
  i.size = 0, i.map = void 0, i.readCount = 0, i.type = void 0;
568
568
  }
@@ -572,14 +572,14 @@ class it {
572
572
  this.stack.length = 0, this.stackHeadPosition = -1;
573
573
  }
574
574
  }
575
- const q = -1, ie = new DataView(new ArrayBuffer(0)), nt = new Uint8Array(ie.buffer);
575
+ const j = -1, ie = new DataView(new ArrayBuffer(0)), ot = new Uint8Array(ie.buffer);
576
576
  try {
577
577
  ie.getInt8(0);
578
578
  } catch (s) {
579
579
  if (!(s instanceof RangeError))
580
580
  throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access");
581
581
  }
582
- const re = new RangeError("Insufficient data"), st = new et();
582
+ const ce = new RangeError("Insufficient data"), rt = new it();
583
583
  class ne {
584
584
  constructor(e) {
585
585
  r(this, "extensionCodec");
@@ -596,11 +596,11 @@ class ne {
596
596
  r(this, "totalPos", 0);
597
597
  r(this, "pos", 0);
598
598
  r(this, "view", ie);
599
- r(this, "bytes", nt);
600
- r(this, "headByte", q);
601
- r(this, "stack", new it());
599
+ r(this, "bytes", ot);
600
+ r(this, "headByte", j);
601
+ r(this, "stack", new st());
602
602
  r(this, "entered", !1);
603
- this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? V.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) ?? F, this.maxBinLength = (e == null ? void 0 : e.maxBinLength) ?? F, this.maxArrayLength = (e == null ? void 0 : e.maxArrayLength) ?? F, this.maxMapLength = (e == null ? void 0 : e.maxMapLength) ?? F, this.maxExtLength = (e == null ? void 0 : e.maxExtLength) ?? F, this.keyDecoder = (e == null ? void 0 : e.keyDecoder) !== void 0 ? e.keyDecoder : st, this.mapKeyConverter = (e == null ? void 0 : e.mapKeyConverter) ?? tt;
603
+ this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? V.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) ?? F, this.maxBinLength = (e == null ? void 0 : e.maxBinLength) ?? F, this.maxArrayLength = (e == null ? void 0 : e.maxArrayLength) ?? F, this.maxMapLength = (e == null ? void 0 : e.maxMapLength) ?? F, this.maxExtLength = (e == null ? void 0 : e.maxExtLength) ?? F, this.keyDecoder = (e == null ? void 0 : e.keyDecoder) !== void 0 ? e.keyDecoder : rt, this.mapKeyConverter = (e == null ? void 0 : e.mapKeyConverter) ?? nt;
604
604
  }
605
605
  clone() {
606
606
  return new ne({
@@ -617,14 +617,14 @@ class ne {
617
617
  });
618
618
  }
619
619
  reinitializeState() {
620
- this.totalPos = 0, this.headByte = q, this.stack.reset();
620
+ this.totalPos = 0, this.headByte = j, this.stack.reset();
621
621
  }
622
622
  setBuffer(e) {
623
623
  const t = Z(e);
624
624
  this.bytes = t, this.view = new DataView(t.buffer, t.byteOffset, t.byteLength), this.pos = 0;
625
625
  }
626
626
  appendBuffer(e) {
627
- if (this.headByte === q && !this.hasRemaining(1))
627
+ if (this.headByte === j && !this.hasRemaining(1))
628
628
  this.setBuffer(e);
629
629
  else {
630
630
  const t = this.bytes.subarray(this.pos), i = Z(e), n = new Uint8Array(t.length + i.length);
@@ -856,15 +856,15 @@ class ne {
856
856
  t = n.array, i.release(n);
857
857
  else
858
858
  continue e;
859
- else if (n.type === j) {
859
+ else if (n.type === q) {
860
860
  if (t === "__proto__")
861
861
  throw new U("The key __proto__ is not allowed");
862
- n.key = this.mapKeyConverter(t), n.type = fe;
862
+ n.key = this.mapKeyConverter(t), n.type = xe;
863
863
  continue e;
864
864
  } else if (n.map[n.key] = t, n.readCount++, n.readCount === n.size)
865
865
  t = n.map, i.release(n);
866
866
  else {
867
- n.key = null, n.type = j;
867
+ n.key = null, n.type = q;
868
868
  continue e;
869
869
  }
870
870
  }
@@ -872,10 +872,10 @@ class ne {
872
872
  }
873
873
  }
874
874
  readHeadByte() {
875
- return this.headByte === q && (this.headByte = this.readU8()), this.headByte;
875
+ return this.headByte === j && (this.headByte = this.readU8()), this.headByte;
876
876
  }
877
877
  complete() {
878
- this.headByte = q;
878
+ this.headByte = j;
879
879
  }
880
880
  readArraySize() {
881
881
  const e = this.readHeadByte();
@@ -912,13 +912,13 @@ class ne {
912
912
  if (e > this.maxStrLength)
913
913
  throw new U(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);
914
914
  if (this.bytes.byteLength < this.pos + t + e)
915
- throw re;
915
+ throw ce;
916
916
  const i = this.pos + t;
917
917
  let n;
918
- return this.stateIsMapKey() && ((o = this.keyDecoder) != null && o.canBeCached(e)) ? n = this.keyDecoder.decode(this.bytes, i, e) : n = De(this.bytes, i, e), this.pos += t + e, n;
918
+ return this.stateIsMapKey() && ((o = this.keyDecoder) != null && o.canBeCached(e)) ? n = this.keyDecoder.decode(this.bytes, i, e) : n = _e(this.bytes, i, e), this.pos += t + e, n;
919
919
  }
920
920
  stateIsMapKey() {
921
- return this.stack.length > 0 ? this.stack.top().type === j : !1;
921
+ return this.stack.length > 0 ? this.stack.top().type === q : !1;
922
922
  }
923
923
  /**
924
924
  * @throws {@link RangeError}
@@ -927,7 +927,7 @@ class ne {
927
927
  if (e > this.maxBinLength)
928
928
  throw new U(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);
929
929
  if (!this.hasRemaining(e + t))
930
- throw re;
930
+ throw ce;
931
931
  const i = this.pos + t, n = this.bytes.subarray(i, i + e);
932
932
  return this.pos += t + e, n;
933
933
  }
@@ -975,11 +975,11 @@ class ne {
975
975
  return this.pos += 4, e;
976
976
  }
977
977
  readU64() {
978
- const e = _e(this.view, this.pos);
978
+ const e = Re(this.view, this.pos);
979
979
  return this.pos += 8, e;
980
980
  }
981
981
  readI64() {
982
- const e = ue(this.view, this.pos);
982
+ const e = we(this.view, this.pos);
983
983
  return this.pos += 8, e;
984
984
  }
985
985
  readU64AsBigInt() {
@@ -999,10 +999,10 @@ class ne {
999
999
  return this.pos += 8, e;
1000
1000
  }
1001
1001
  }
1002
- function ot(s, e) {
1002
+ function at(s, e) {
1003
1003
  return new ne(e).decode(s);
1004
1004
  }
1005
- const rt = /* @__PURE__ */ new Set([
1005
+ const ct = /* @__PURE__ */ new Set([
1006
1006
  "auth",
1007
1007
  "open",
1008
1008
  "send",
@@ -1019,22 +1019,22 @@ const rt = /* @__PURE__ */ new Set([
1019
1019
  "annotate",
1020
1020
  "annotate_clear"
1021
1021
  ]);
1022
- function at(s) {
1023
- return rt.has(s.type);
1022
+ function dt(s) {
1023
+ return ct.has(s.type);
1024
1024
  }
1025
- function ct(s) {
1026
- return Ge(s);
1025
+ function lt(s) {
1026
+ return Qe(s);
1027
1027
  }
1028
- function dt(s) {
1028
+ function ht(s) {
1029
1029
  let e;
1030
1030
  try {
1031
- e = ot(s);
1031
+ e = at(s);
1032
1032
  } catch {
1033
1033
  return null;
1034
1034
  }
1035
1035
  return typeof e != "object" || e === null || typeof e.type != "string" ? null : e;
1036
1036
  }
1037
- class lt {
1037
+ class pt {
1038
1038
  constructor(e) {
1039
1039
  r(this, "conversationId");
1040
1040
  r(this, "state", "");
@@ -1180,10 +1180,10 @@ class lt {
1180
1180
  }
1181
1181
  markOwnStatus(e, t) {
1182
1182
  for (const [i, n] of this.byId)
1183
- n.senderId === this.me && n.seq > 0 && n.seq <= e && ae(t) > ae(n.status) && (this.byId.set(i, { ...n, status: t }), this._sorted = null);
1183
+ n.senderId === this.me && n.seq > 0 && n.seq <= e && de(t) > de(n.status) && (this.byId.set(i, { ...n, status: t }), this._sorted = null);
1184
1184
  }
1185
1185
  }
1186
- function ae(s) {
1186
+ function de(s) {
1187
1187
  switch (s) {
1188
1188
  case "read":
1189
1189
  return 3;
@@ -1195,7 +1195,7 @@ function ae(s) {
1195
1195
  return 0;
1196
1196
  }
1197
1197
  }
1198
- class ht {
1198
+ class ut {
1199
1199
  constructor(e) {
1200
1200
  r(this, "socket", null);
1201
1201
  r(this, "state", "idle");
@@ -1210,12 +1210,12 @@ class ht {
1210
1210
  var i, n;
1211
1211
  if (this.state === "connecting" || this.state === "open") return;
1212
1212
  this.stopped = !1, this.state = "connecting", this.authed = !1, (n = (i = this.opts).onStatusChange) == null || n.call(i, this.attempt > 0 ? "reconnecting" : "connecting");
1213
- const t = (this.opts.socketFactory ?? pt)(this.opts.url);
1213
+ const t = (this.opts.socketFactory ?? ft)(this.opts.url);
1214
1214
  t.binaryType = "arraybuffer", this.socket = t, t.onopen = () => {
1215
1215
  this.raw({ type: "auth", token: this.opts.token });
1216
1216
  }, t.onmessage = (o) => {
1217
- const c = dt(new Uint8Array(o.data));
1218
- !c || at(c) || this.handle(c);
1217
+ const c = ht(new Uint8Array(o.data));
1218
+ !c || dt(c) || this.handle(c);
1219
1219
  }, t.onclose = () => this.onClosed(), t.onerror = () => {
1220
1220
  try {
1221
1221
  t.close();
@@ -1254,7 +1254,7 @@ class ht {
1254
1254
  raw(e) {
1255
1255
  var t;
1256
1256
  try {
1257
- (t = this.socket) == null || t.send(ct(e));
1257
+ (t = this.socket) == null || t.send(lt(e));
1258
1258
  } catch {
1259
1259
  this.outbox.push(e);
1260
1260
  }
@@ -1269,11 +1269,11 @@ class ht {
1269
1269
  this.attempt++, this.timer = setTimeout(() => this.connect(), i);
1270
1270
  }
1271
1271
  }
1272
- function pt(s) {
1272
+ function ft(s) {
1273
1273
  return new WebSocket(s);
1274
1274
  }
1275
- const ce = 200, ut = 7 * 864e5;
1276
- class ft {
1275
+ const le = 200, wt = 7 * 864e5;
1276
+ class xt {
1277
1277
  constructor(e) {
1278
1278
  r(this, "key");
1279
1279
  this.key = `ocw_outbox_${e}`;
@@ -1283,7 +1283,7 @@ class ft {
1283
1283
  try {
1284
1284
  const e = localStorage.getItem(this.key);
1285
1285
  if (!e) return [];
1286
- const t = JSON.parse(e), i = Date.now() - ut, n = t.filter((o) => o.ts >= i);
1286
+ const t = JSON.parse(e), i = Date.now() - wt, n = t.filter((o) => o.ts >= i);
1287
1287
  return n.length !== t.length && this.save(n), n;
1288
1288
  } catch {
1289
1289
  return [];
@@ -1292,7 +1292,7 @@ class ft {
1292
1292
  add(e) {
1293
1293
  try {
1294
1294
  const t = this.load();
1295
- t.push(e), this.save(t.length > ce ? t.slice(t.length - ce) : t);
1295
+ t.push(e), this.save(t.length > le ? t.slice(t.length - le) : t);
1296
1296
  } catch {
1297
1297
  }
1298
1298
  }
@@ -1333,7 +1333,7 @@ async function M(s) {
1333
1333
  async function H(s) {
1334
1334
  return S().importKey("raw", ee(s), { name: "ECDH", namedCurve: "P-256" }, !1, []);
1335
1335
  }
1336
- async function wt(s, e) {
1336
+ async function yt(s, e) {
1337
1337
  const t = await H(e);
1338
1338
  return S().deriveKey(
1339
1339
  { name: "ECDH", public: t },
@@ -1343,15 +1343,15 @@ async function wt(s, e) {
1343
1343
  ["encrypt", "decrypt"]
1344
1344
  );
1345
1345
  }
1346
- async function xt(s, e) {
1346
+ async function gt(s, e) {
1347
1347
  const t = globalThis.crypto.getRandomValues(new Uint8Array(12)), i = new TextEncoder().encode(e), n = await S().encrypt({ name: "AES-GCM", iv: t }, s, i);
1348
1348
  return { ct: W(n), iv: W(t) };
1349
1349
  }
1350
- async function yt(s, e, t) {
1350
+ async function bt(s, e, t) {
1351
1351
  const i = await S().decrypt({ name: "AES-GCM", iv: ee(t) }, s, ee(e));
1352
1352
  return new TextDecoder().decode(i);
1353
1353
  }
1354
- async function gt(s) {
1354
+ async function mt(s) {
1355
1355
  var t, i;
1356
1356
  try {
1357
1357
  const n = (t = globalThis.localStorage) == null ? void 0 : t.getItem(s);
@@ -1369,11 +1369,11 @@ async function gt(s) {
1369
1369
  }
1370
1370
  return e;
1371
1371
  }
1372
- async function bt(s, e) {
1372
+ async function vt(s, e) {
1373
1373
  const t = await S().exportKey("raw", e), i = await S().sign({ name: "ECDSA", hash: "SHA-256" }, s, t);
1374
1374
  return W(i);
1375
1375
  }
1376
- async function mt() {
1376
+ async function kt() {
1377
1377
  const s = await O(), e = await S().generateKey({ name: "ECDSA", namedCurve: "P-256" }, !0, ["sign", "verify"]);
1378
1378
  return {
1379
1379
  ecdhKP: s,
@@ -1382,7 +1382,7 @@ async function mt() {
1382
1382
  sigPublicKeyB64: await M(e.publicKey)
1383
1383
  };
1384
1384
  }
1385
- async function de(s) {
1385
+ async function he(s) {
1386
1386
  var t, i;
1387
1387
  try {
1388
1388
  const n = (t = globalThis.localStorage) == null ? void 0 : t.getItem(`${s}-identity`);
@@ -1397,7 +1397,7 @@ async function de(s) {
1397
1397
  }
1398
1398
  } catch {
1399
1399
  }
1400
- const e = await mt();
1400
+ const e = await kt();
1401
1401
  try {
1402
1402
  const n = 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);
1403
1403
  (i = globalThis.localStorage) == null || i.setItem(`${s}-identity`, JSON.stringify({ ecdhPub: n, ecdhPriv: o, ecdsaPub: c, ecdsaPriv: l }));
@@ -1405,25 +1405,25 @@ async function de(s) {
1405
1405
  }
1406
1406
  return e;
1407
1407
  }
1408
- async function vt(s, e) {
1409
- const t = await O(), i = await M(t.publicKey), n = await H(e.identityKey), o = await H(e.signedPrekey), c = e.oneTimePrekey ? await H(e.oneTimePrekey) : null, l = await L(s.privateKey, o), x = await L(t.privateKey, n), f = await L(t.privateKey, o), m = c ? await L(t.privateKey, c) : null, w = we(l, x, f, ...m ? [m] : []);
1410
- return { sharedKey: await xe(w), ephemeralPublicKey: i };
1408
+ async function St(s, e) {
1409
+ const t = await O(), i = await M(t.publicKey), n = await H(e.identityKey), o = await H(e.signedPrekey), c = e.oneTimePrekey ? await H(e.oneTimePrekey) : null, l = await L(s.privateKey, o), x = await L(t.privateKey, n), f = await L(t.privateKey, o), m = c ? await L(t.privateKey, c) : null, w = ye(l, x, f, ...m ? [m] : []);
1410
+ return { sharedKey: await ge(w), ephemeralPublicKey: i };
1411
1411
  }
1412
- async function kt(s, e, t, i, n) {
1413
- const o = await H(t), c = await H(i), l = await L(e.privateKey, o), x = await L(s.privateKey, c), f = await L(e.privateKey, c), m = n ? await L(n.privateKey, c) : null, w = we(l, x, f, ...m ? [m] : []);
1414
- return xe(w);
1412
+ async function It(s, e, t, i, n) {
1413
+ const o = await H(t), c = await H(i), l = await L(e.privateKey, o), x = await L(s.privateKey, c), f = await L(e.privateKey, c), m = n ? await L(n.privateKey, c) : null, w = ye(l, x, f, ...m ? [m] : []);
1414
+ return ge(w);
1415
1415
  }
1416
1416
  async function L(s, e) {
1417
1417
  return S().deriveBits({ name: "ECDH", public: e }, s, 256);
1418
1418
  }
1419
- function we(...s) {
1419
+ function ye(...s) {
1420
1420
  const e = s.reduce((n, o) => n + o.byteLength, 0), t = new Uint8Array(e);
1421
1421
  let i = 0;
1422
1422
  for (const n of s)
1423
1423
  t.set(new Uint8Array(n), i), i += n.byteLength;
1424
1424
  return t.buffer;
1425
1425
  }
1426
- async function xe(s) {
1426
+ async function ge(s) {
1427
1427
  const e = await S().importKey("raw", s, "HKDF", !1, ["deriveKey"]);
1428
1428
  return S().deriveKey(
1429
1429
  { name: "HKDF", hash: "SHA-256", salt: new Uint8Array(32), info: new TextEncoder().encode("ObjectChat X3DH v1") },
@@ -1433,8 +1433,8 @@ async function xe(s) {
1433
1433
  ["encrypt", "decrypt"]
1434
1434
  );
1435
1435
  }
1436
- const St = 20;
1437
- class It {
1436
+ const Ct = 20;
1437
+ class Et {
1438
1438
  constructor(e) {
1439
1439
  // Live ECDH mode state
1440
1440
  r(this, "kp");
@@ -1455,19 +1455,19 @@ class It {
1455
1455
  }
1456
1456
  /** Live ECDH mode: Generate/restore our keypair and return our public key to publish. */
1457
1457
  async begin() {
1458
- return this.kp = await gt(this.storageKey), M(this.kp.publicKey);
1458
+ return this.kp = await mt(this.storageKey), M(this.kp.publicKey);
1459
1459
  }
1460
1460
  /** Live ECDH mode: A peer published their key — derive the shared secret. */
1461
1461
  async onPeerKey(e) {
1462
- this.kp && (this.shared = await wt(this.kp.privateKey, e));
1462
+ this.kp && (this.shared = await yt(this.kp.privateKey, e));
1463
1463
  }
1464
1464
  // ── X3DH async mode ────────────────────────────────────────────────────────
1465
1465
  /** X3DH: Generate identity key, signed prekey, and OTP prekeys.
1466
1466
  * Returns the upload frame payload the caller should send to the server. */
1467
1467
  async initX3DH() {
1468
- this.identityKP = await de(this.storageKey), this.signedPreKP = await O(), this.signedPrekeyId = `spk-${Date.now()}-${Math.random().toString(36).slice(2)}`;
1469
- for (let n = 0; n < St; n++) this.otpKeys.push(await O());
1470
- const e = await M(this.signedPreKP.publicKey), t = await bt(this.identityKP.ecdsaKP.privateKey, this.signedPreKP.publicKey), i = await Promise.all(this.otpKeys.map((n) => M(n.publicKey)));
1468
+ this.identityKP = await he(this.storageKey), this.signedPreKP = await O(), this.signedPrekeyId = `spk-${Date.now()}-${Math.random().toString(36).slice(2)}`;
1469
+ for (let n = 0; n < Ct; n++) this.otpKeys.push(await O());
1470
+ const e = await M(this.signedPreKP.publicKey), t = await vt(this.identityKP.ecdsaKP.privateKey, this.signedPreKP.publicKey), i = await Promise.all(this.otpKeys.map((n) => M(n.publicKey)));
1471
1471
  return {
1472
1472
  identityKey: this.identityKP.publicKeyB64,
1473
1473
  signedPrekey: e,
@@ -1479,8 +1479,8 @@ class It {
1479
1479
  /** X3DH sender: given a recipient's prekey bundle, derive the shared key and
1480
1480
  * return the init message fields to embed in the first encrypted message. */
1481
1481
  async x3dhSendTo(e) {
1482
- this.identityKP || (this.identityKP = await de(this.storageKey));
1483
- const { sharedKey: t, ephemeralPublicKey: i } = await vt(this.identityKP.ecdhKP, e);
1482
+ this.identityKP || (this.identityKP = await he(this.storageKey));
1483
+ const { sharedKey: t, ephemeralPublicKey: i } = await St(this.identityKP.ecdhKP, e);
1484
1484
  return this.x3dhShared = t, { ephemeralKey: i, spkId: e.signedPrekeyId, usedOTP: !!e.oneTimePrekey, senderIK: this.identityKP.publicKeyB64 };
1485
1485
  }
1486
1486
  /** X3DH recipient: given an init message's sender IK + EK + SPK ID, derive the shared key. */
@@ -1490,7 +1490,7 @@ class It {
1490
1490
  return;
1491
1491
  }
1492
1492
  const n = this.otpKeys.shift();
1493
- this.x3dhShared = await kt(this.identityKP.ecdhKP, this.signedPreKP, e, t, n);
1493
+ this.x3dhShared = await It(this.identityKP.ecdhKP, this.signedPreKP, e, t, n);
1494
1494
  }
1495
1495
  /** Flush pending X3DH derivation after initX3DH() completes. */
1496
1496
  async flushPendingX3DH() {
@@ -1503,7 +1503,7 @@ class It {
1503
1503
  async sealText(e, t) {
1504
1504
  const i = this.x3dhShared ?? this.shared;
1505
1505
  if (!i) throw new Error("secure channel not ready");
1506
- const { ct: n, iv: o } = await xt(i, e);
1506
+ const { ct: n, iv: o } = await gt(i, e);
1507
1507
  return {
1508
1508
  kind: "text",
1509
1509
  text: n,
@@ -1518,7 +1518,7 @@ class It {
1518
1518
  const t = this.x3dhShared ?? this.shared;
1519
1519
  if (!t) return { kind: "text", text: "🔒 encrypted" };
1520
1520
  try {
1521
- return { kind: "text", text: await yt(t, e.text, e.iv) };
1521
+ return { kind: "text", text: await bt(t, e.text, e.iv) };
1522
1522
  } catch {
1523
1523
  return { kind: "text", text: "🔒 unable to decrypt" };
1524
1524
  }
@@ -1530,12 +1530,12 @@ class It {
1530
1530
  for (const t of e.messages) t.content = await this.openContent(t.content);
1531
1531
  }
1532
1532
  }
1533
- function Ct(s) {
1533
+ function Ut(s) {
1534
1534
  if (s.kind !== "text" || !s.enc) return null;
1535
1535
  const e = s;
1536
1536
  return !e.x3dhEK || !e.x3dhSPK || !e.x3dhIK ? null : { x3dhEK: e.x3dhEK, x3dhSPK: e.x3dhSPK, x3dhIK: e.x3dhIK };
1537
1537
  }
1538
- const le = "objectchat-widget-styles", Et = ["👍", "❤️", "😂", "😮", "😢", "🙏"], Ut = `
1538
+ const pe = "objectchat-widget-styles", Tt = ["👍", "❤️", "😂", "😮", "😢", "🙏"], Pt = `
1539
1539
  .ocw { --ocw-accent:#f5713c; --ocw-bg:#f3efe9; --ocw-card:#fff; --ocw-line:#ececec; --ocw-ink:#1c1b1a; --ocw-mut:#9b9690;
1540
1540
  position:relative;
1541
1541
  display:flex; flex-direction:column; height:100%; min-height:320px; background:var(--ocw-bg);
@@ -1693,16 +1693,16 @@ const le = "objectchat-widget-styles", Et = ["👍", "❤️", "😂", "😮", "
1693
1693
  .ocw-bubble-wrap:hover .ocw-translate-btn { opacity:1; }
1694
1694
  .ocw-translated-tag { font-size:10px; color:var(--ocw-mut); margin-top:2px; }
1695
1695
  `;
1696
- function Tt() {
1697
- if (typeof document > "u" || document.getElementById(le)) return;
1696
+ function Bt() {
1697
+ if (typeof document > "u" || document.getElementById(pe)) return;
1698
1698
  const s = document.createElement("style");
1699
- s.id = le, s.textContent = Ut, document.head.appendChild(s);
1699
+ s.id = pe, s.textContent = Pt, document.head.appendChild(s);
1700
1700
  }
1701
1701
  function a(s, e, t) {
1702
1702
  const i = document.createElement(s);
1703
1703
  return e && (i.className = e), t !== void 0 && (i.textContent = t), i;
1704
1704
  }
1705
- function Pt(s) {
1705
+ function Kt(s) {
1706
1706
  try {
1707
1707
  return new Date(s).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
1708
1708
  } catch {
@@ -1726,7 +1726,7 @@ function G(s) {
1726
1726
  return `📅 ${s.title} — ${new Date(s.startIso).toLocaleString()}`;
1727
1727
  }
1728
1728
  }
1729
- class Bt {
1729
+ class At {
1730
1730
  /** Last seq the guest has seen per conversationId — used to compute unread badges. */
1731
1731
  constructor(e, t, i, n = {}) {
1732
1732
  r(this, "scroll");
@@ -1760,7 +1760,7 @@ class Bt {
1760
1760
  r(this, "showingTranslation", /* @__PURE__ */ new Set());
1761
1761
  r(this, "subjectBuilt", !1);
1762
1762
  var b, v, C, T, A, P, D, $, _;
1763
- this.root = e, this.me = t, this.h = i, this.cfg = n, Tt(), e.classList.add("ocw"), n.accent && e.style.setProperty("--ocw-accent", n.accent);
1763
+ this.root = e, this.me = t, this.h = i, this.cfg = n, Bt(), e.classList.add("ocw"), n.accent && e.style.setProperty("--ocw-accent", n.accent);
1764
1764
  const o = a("div", "ocw-head"), c = a("div", "ocw-avatar");
1765
1765
  if ((b = n.userInfo) != null && b.avatar) {
1766
1766
  const k = document.createElement("img");
@@ -2104,7 +2104,7 @@ Message: ${o.value}`), this.offlinePanel.replaceChildren(a("div", "ocw-offline-t
2104
2104
  }), p.append(T);
2105
2105
  }
2106
2106
  const g = a("button", "ocw-react-btn", "+"), b = a("div", "ocw-react-picker");
2107
- for (const v of Et) {
2107
+ for (const v of Tt) {
2108
2108
  const C = a("button", void 0, v);
2109
2109
  C.addEventListener("click", (T) => {
2110
2110
  var P, D, $, _;
@@ -2119,15 +2119,15 @@ Message: ${o.value}`), this.offlinePanel.replaceChildren(a("div", "ocw-offline-t
2119
2119
  b.style.display = "none";
2120
2120
  }, { once: !0 }), p.append(g), h.append(p, b), c.append(h);
2121
2121
  } 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(" ")));
2122
- const m = a("div", "ocw-time ocw-meta", Pt(e.ts));
2122
+ const m = a("div", "ocw-time ocw-meta", Kt(e.ts));
2123
2123
  if (i && e.status) {
2124
- const h = a("span", `ocw-tick${e.status === "read" ? " read" : e.status === "delivered" ? " delivered" : ""}`, Kt(e.status));
2124
+ const h = a("span", `ocw-tick${e.status === "read" ? " read" : e.status === "delivered" ? " delivered" : ""}`, zt(e.status));
2125
2125
  m.append(h);
2126
2126
  }
2127
2127
  return i && e.seq > 0 && t.lastReadByOthers >= e.seq && m.append(a("span", "ocw-seen", " · Seen")), c.append(m), o.append(c), o;
2128
2128
  }
2129
2129
  }
2130
- function Kt(s) {
2130
+ function zt(s) {
2131
2131
  switch (s) {
2132
2132
  case "read":
2133
2133
  return "✓✓";
@@ -2139,11 +2139,11 @@ function Kt(s) {
2139
2139
  return "🕓";
2140
2140
  }
2141
2141
  }
2142
- function Mt(s) {
2143
- var se, oe;
2144
- const e = s.token ?? Ie();
2145
- let t = new lt(e);
2146
- const i = s.subjectId ? `${e}::${s.subjectId}` : e, n = new ft(i);
2142
+ function $t(s) {
2143
+ var se, oe, re, ae;
2144
+ const e = s.token ?? Ee();
2145
+ let t = new pt(e);
2146
+ const i = s.subjectId ? `${e}::${s.subjectId}` : e, n = new xt(i);
2147
2147
  let o, c = !1, l = null;
2148
2148
  !s.launcher && !s.el.style.height && s.el.clientHeight === 0 && (s.el.style.width = s.el.style.width || "100%", s.el.style.height = "600px");
2149
2149
  for (const d of n.load()) t.addOptimistic(d.clientMsgId, d.content);
@@ -2216,7 +2216,7 @@ function Mt(s) {
2216
2216
  }
2217
2217
  };
2218
2218
  let g;
2219
- const b = new It(`ocw-e2e-${s.profileId}`);
2219
+ const b = new Et(`ocw-e2e-${s.profileId}`);
2220
2220
  let v = !1;
2221
2221
  const C = [], T = [];
2222
2222
  let A = !1;
@@ -2241,7 +2241,7 @@ function Mt(s) {
2241
2241
  g.send({ type: "fetchPrekey", targetUserId: d });
2242
2242
  }, k = s.i18n ?? {}, E = ["ar", "he", "fa", "ur"], Y = typeof navigator < "u" ? (navigator.language ?? "").slice(0, 2).toLowerCase() : "";
2243
2243
  E.includes(Y) && !s.el.dir && (s.el.dir = "rtl", s.el.style.fontFamily = s.el.style.fontFamily || "Tahoma,Arial,system-ui,sans-serif");
2244
- const K = new Bt(s.el, e, {
2244
+ const K = new At(s.el, e, {
2245
2245
  onSend(d) {
2246
2246
  if (!o) return;
2247
2247
  const u = `cm_${Math.random().toString(36).slice(2)}`;
@@ -2258,8 +2258,8 @@ function Mt(s) {
2258
2258
  body: d
2259
2259
  });
2260
2260
  if (!z.ok) throw new Error(`Upload failed: ${z.status}`);
2261
- const { url: R, name: be, mime: me, size: ve } = await z.json();
2262
- g.send({ type: "send", conversationId: o, clientMsgId: I, content: { kind: "attachment", url: R, name: be, mime: me, size: ve } });
2261
+ const { url: R, name: ve, mime: ke, size: Se } = await z.json();
2262
+ g.send({ type: "send", conversationId: o, clientMsgId: I, content: { kind: "attachment", url: R, name: ve, mime: ke, size: Se } });
2263
2263
  } catch (z) {
2264
2264
  t.addOptimistic(I, { kind: "text", text: `⚠️ Upload failed: ${z.message}` }), K.render(t);
2265
2265
  }
@@ -2326,15 +2326,17 @@ function Mt(s) {
2326
2326
  ...s.accent ? { accent: s.accent } : {},
2327
2327
  ...(se = s.user) != null && se.name || (oe = s.user) != null && oe.avatar ? { userInfo: { ...s.user.name ? { name: s.user.name } : {}, ...s.user.avatar ? { avatar: s.user.avatar } : {} } } : {},
2328
2328
  i18n: k
2329
- }), ye = {
2329
+ }), be = {
2330
2330
  type: "open",
2331
2331
  profileId: s.profileId,
2332
2332
  ...s.subjectId ? { subjectId: s.subjectId } : {},
2333
- // Auto-capture the page context so agents know where the guest is browsing.
2334
- // This is pure display metadata — it never affects identity or access.
2335
2333
  ...typeof location < "u" ? { pageUrl: location.href } : {},
2336
- ...typeof document < "u" && document.title ? { pageTitle: document.title } : {}
2337
- }, ge = (d) => {
2334
+ ...typeof document < "u" && document.title ? { pageTitle: document.title } : {},
2335
+ // Pass subject display info so the server can persist it to the Subject record.
2336
+ // This is how listingTitle and listingMeta get saved without a separate API call.
2337
+ ...(re = s.subject) != null && re.title ? { subjectTitle: s.subject.title } : {},
2338
+ ...(ae = s.subject) != null && ae.subtitle ? { subjectMeta: s.subject.subtitle } : {}
2339
+ }, me = (d) => {
2338
2340
  const u = s.user;
2339
2341
  if (!u || !u.name && !u.email && !u.avatar && !u.meta) return;
2340
2342
  const y = [];
@@ -2343,10 +2345,10 @@ function Mt(s) {
2343
2345
  ${y.join(`
2344
2346
  `)}` });
2345
2347
  };
2346
- return g = new ht({
2348
+ return g = new ut({
2347
2349
  url: s.url,
2348
2350
  token: e,
2349
- open: ye,
2351
+ open: be,
2350
2352
  getCursor: () => t.highestSeq(),
2351
2353
  onStatusChange: (d) => K.setConnStatus(d),
2352
2354
  onFrame(d) {
@@ -2357,7 +2359,7 @@ ${y.join(`
2357
2359
  for (const y of n.load())
2358
2360
  g.send({ type: "send", conversationId: o, clientMsgId: y.clientMsgId, content: y.content });
2359
2361
  }
2360
- u && (Ce(s.url, e, o, t, K), d.conversation.lastSeq === 0 && ge(o));
2362
+ u && (Ue(s.url, e, o, t, K), d.conversation.lastSeq === 0 && me(o));
2361
2363
  }
2362
2364
  if (d.type === "ack" && n.remove(d.clientMsgId), d.type === "prekeyBundle") {
2363
2365
  d.bundle && (A = !0, b.x3dhSendTo(d.bundle).then((u) => {
@@ -2368,7 +2370,7 @@ ${y.join(`
2368
2370
  return;
2369
2371
  }
2370
2372
  if (d.type === "message" && t.e2e) {
2371
- const u = Ct(d.message.content);
2373
+ const u = Ut(d.message.content);
2372
2374
  if (u && !b.ready) {
2373
2375
  b.x3dhReceiveFrom(u.x3dhIK, u.x3dhEK, u.x3dhSPK).then(async () => {
2374
2376
  await b.openFrame(d), t.apply(d), K.render(t);
@@ -2398,15 +2400,15 @@ ${y.join(`
2398
2400
  } }, l;
2399
2401
  }
2400
2402
  export {
2401
- lt as ChatStore,
2402
- ht as ConnectionManager,
2403
- It as E2ESession,
2404
- ft as PersistentOutbox,
2405
- Bt as Renderer,
2406
- Lt as asConversationId,
2407
- Ct as extractX3DHInit,
2408
- _t as httpBaseFromWsUrl,
2409
- Mt as mount,
2410
- Ce as restoreHistory
2403
+ pt as ChatStore,
2404
+ ut as ConnectionManager,
2405
+ Et as E2ESession,
2406
+ xt as PersistentOutbox,
2407
+ At as Renderer,
2408
+ Dt as asConversationId,
2409
+ Ut as extractX3DHInit,
2410
+ Rt as httpBaseFromWsUrl,
2411
+ $t as mount,
2412
+ Ue as restoreHistory
2411
2413
  };
2412
2414
  //# sourceMappingURL=index.js.map