@onedeskpro/chatbot-core 0.4.0 → 0.5.0

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
@@ -287,75 +287,75 @@ var x = Object.create(null);
287
287
  Object.keys(b).forEach((e) => {
288
288
  x[b[e]] = e;
289
289
  });
290
- var pe = {
290
+ var S = {
291
291
  type: "error",
292
292
  data: "parser error"
293
- }, me = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", he = typeof ArrayBuffer == "function", ge = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e && e.buffer instanceof ArrayBuffer, S = ({ type: e, data: t }, n, r) => me && t instanceof Blob ? n ? r(t) : _e(t, r) : he && (t instanceof ArrayBuffer || ge(t)) ? n ? r(t) : _e(new Blob([t]), r) : r(b[e] + (t || "")), _e = (e, t) => {
293
+ }, pe = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", me = typeof ArrayBuffer == "function", he = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e && e.buffer instanceof ArrayBuffer, C = ({ type: e, data: t }, n, r) => pe && t instanceof Blob ? n ? r(t) : ge(t, r) : me && (t instanceof ArrayBuffer || he(t)) ? n ? r(t) : ge(new Blob([t]), r) : r(b[e] + (t || "")), ge = (e, t) => {
294
294
  let n = new FileReader();
295
295
  return n.onload = function() {
296
296
  let e = n.result.split(",")[1];
297
297
  t("b" + (e || ""));
298
298
  }, n.readAsDataURL(e);
299
299
  };
300
- function ve(e) {
300
+ function _e(e) {
301
301
  return e instanceof Uint8Array ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
302
302
  }
303
- var ye;
304
- function be(e, t) {
305
- if (me && e.data instanceof Blob) return e.data.arrayBuffer().then(ve).then(t);
306
- if (he && (e.data instanceof ArrayBuffer || ge(e.data))) return t(ve(e.data));
307
- S(e, !1, (e) => {
308
- ye ||= new TextEncoder(), t(ye.encode(e));
303
+ var ve;
304
+ function ye(e, t) {
305
+ if (pe && e.data instanceof Blob) return e.data.arrayBuffer().then(_e).then(t);
306
+ if (me && (e.data instanceof ArrayBuffer || he(e.data))) return t(_e(e.data));
307
+ C(e, !1, (e) => {
308
+ ve ||= new TextEncoder(), t(ve.encode(e));
309
309
  });
310
310
  }
311
311
  // ../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js
312
- var xe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", C = typeof Uint8Array > "u" ? [] : /* @__PURE__ */ new Uint8Array(256);
313
- for (let e = 0; e < 64; e++) C[xe.charCodeAt(e)] = e;
314
- var Se = (e) => {
312
+ var be = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", w = typeof Uint8Array > "u" ? [] : /* @__PURE__ */ new Uint8Array(256);
313
+ for (let e = 0; e < 64; e++) w[be.charCodeAt(e)] = e;
314
+ var xe = (e) => {
315
315
  let t = e.length * .75, n = e.length, r, i = 0, a, o, s, c;
316
316
  e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
317
317
  let l = new ArrayBuffer(t), u = new Uint8Array(l);
318
- for (r = 0; r < n; r += 4) a = C[e.charCodeAt(r)], o = C[e.charCodeAt(r + 1)], s = C[e.charCodeAt(r + 2)], c = C[e.charCodeAt(r + 3)], u[i++] = a << 2 | o >> 4, u[i++] = (o & 15) << 4 | s >> 2, u[i++] = (s & 3) << 6 | c & 63;
318
+ for (r = 0; r < n; r += 4) a = w[e.charCodeAt(r)], o = w[e.charCodeAt(r + 1)], s = w[e.charCodeAt(r + 2)], c = w[e.charCodeAt(r + 3)], u[i++] = a << 2 | o >> 4, u[i++] = (o & 15) << 4 | s >> 2, u[i++] = (s & 3) << 6 | c & 63;
319
319
  return l;
320
- }, Ce = typeof ArrayBuffer == "function", w = (e, t) => {
320
+ }, Se = typeof ArrayBuffer == "function", T = (e, t) => {
321
321
  if (typeof e != "string") return {
322
322
  type: "message",
323
- data: Te(e, t)
323
+ data: we(e, t)
324
324
  };
325
325
  let n = e.charAt(0);
326
326
  return n === "b" ? {
327
327
  type: "message",
328
- data: we(e.substring(1), t)
328
+ data: Ce(e.substring(1), t)
329
329
  } : x[n] ? e.length > 1 ? {
330
330
  type: x[n],
331
331
  data: e.substring(1)
332
- } : { type: x[n] } : pe;
333
- }, we = (e, t) => Ce ? Te(Se(e), t) : {
332
+ } : { type: x[n] } : S;
333
+ }, Ce = (e, t) => Se ? we(xe(e), t) : {
334
334
  base64: !0,
335
335
  data: e
336
- }, Te = (e, t) => {
336
+ }, we = (e, t) => {
337
337
  switch (t) {
338
338
  case "blob": return e instanceof Blob ? e : new Blob([e]);
339
339
  default: return e instanceof ArrayBuffer ? e : e.buffer;
340
340
  }
341
- }, Ee = "", De = (e, t) => {
341
+ }, Te = "", Ee = (e, t) => {
342
342
  let n = e.length, r = Array(n), i = 0;
343
343
  e.forEach((e, a) => {
344
- S(e, !1, (e) => {
345
- r[a] = e, ++i === n && t(r.join(Ee));
344
+ C(e, !1, (e) => {
345
+ r[a] = e, ++i === n && t(r.join(Te));
346
346
  });
347
347
  });
348
- }, Oe = (e, t) => {
349
- let n = e.split(Ee), r = [];
348
+ }, De = (e, t) => {
349
+ let n = e.split(Te), r = [];
350
350
  for (let e = 0; e < n.length; e++) {
351
- let i = w(n[e], t);
351
+ let i = T(n[e], t);
352
352
  if (r.push(i), i.type === "error") break;
353
353
  }
354
354
  return r;
355
355
  };
356
- function ke() {
356
+ function Oe() {
357
357
  return new TransformStream({ transform(e, t) {
358
- be(e, (n) => {
358
+ ye(e, (n) => {
359
359
  let r = n.length, i;
360
360
  if (r < 126) i = /* @__PURE__ */ new Uint8Array(1), new DataView(i.buffer).setUint8(0, r);
361
361
  else if (r < 65536) {
@@ -371,65 +371,65 @@ function ke() {
371
371
  });
372
372
  } });
373
373
  }
374
- var Ae;
375
- function T(e) {
374
+ var ke;
375
+ function E(e) {
376
376
  return e.reduce((e, t) => e + t.length, 0);
377
377
  }
378
- function E(e, t) {
378
+ function D(e, t) {
379
379
  if (e[0].length === t) return e.shift();
380
380
  let n = new Uint8Array(t), r = 0;
381
381
  for (let i = 0; i < t; i++) n[i] = e[0][r++], r === e[0].length && (e.shift(), r = 0);
382
382
  return e.length && r < e[0].length && (e[0] = e[0].slice(r)), n;
383
383
  }
384
- function je(e, t) {
385
- Ae ||= new TextDecoder();
384
+ function Ae(e, t) {
385
+ ke ||= new TextDecoder();
386
386
  let n = [], r = 0, i = -1, a = !1;
387
387
  return new TransformStream({ transform(o, s) {
388
388
  for (n.push(o);;) {
389
389
  if (r === 0) {
390
- if (T(n) < 1) break;
391
- let e = E(n, 1);
390
+ if (E(n) < 1) break;
391
+ let e = D(n, 1);
392
392
  a = (e[0] & 128) == 128, i = e[0] & 127, r = i < 126 ? 3 : i === 126 ? 1 : 2;
393
393
  } else if (r === 1) {
394
- if (T(n) < 2) break;
395
- let e = E(n, 2);
394
+ if (E(n) < 2) break;
395
+ let e = D(n, 2);
396
396
  i = new DataView(e.buffer, e.byteOffset, e.length).getUint16(0), r = 3;
397
397
  } else if (r === 2) {
398
- if (T(n) < 8) break;
399
- let e = E(n, 8), t = new DataView(e.buffer, e.byteOffset, e.length), a = t.getUint32(0);
398
+ if (E(n) < 8) break;
399
+ let e = D(n, 8), t = new DataView(e.buffer, e.byteOffset, e.length), a = t.getUint32(0);
400
400
  if (a > 2 ** 21 - 1) {
401
- s.enqueue(pe);
401
+ s.enqueue(S);
402
402
  break;
403
403
  }
404
404
  i = a * 2 ** 32 + t.getUint32(4), r = 3;
405
405
  } else {
406
- if (T(n) < i) break;
407
- let e = E(n, i);
408
- s.enqueue(w(a ? e : Ae.decode(e), t)), r = 0;
406
+ if (E(n) < i) break;
407
+ let e = D(n, i);
408
+ s.enqueue(T(a ? e : ke.decode(e), t)), r = 0;
409
409
  }
410
410
  if (i === 0 || i > e) {
411
- s.enqueue(pe);
411
+ s.enqueue(S);
412
412
  break;
413
413
  }
414
414
  }
415
415
  } });
416
416
  }
417
417
  // ../../node_modules/.pnpm/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/lib/esm/index.js
418
- function D(e) {
419
- if (e) return Me(e);
418
+ function O(e) {
419
+ if (e) return je(e);
420
420
  }
421
- function Me(e) {
422
- for (var t in D.prototype) e[t] = D.prototype[t];
421
+ function je(e) {
422
+ for (var t in O.prototype) e[t] = O.prototype[t];
423
423
  return e;
424
424
  }
425
- D.prototype.on = D.prototype.addEventListener = function(e, t) {
425
+ O.prototype.on = O.prototype.addEventListener = function(e, t) {
426
426
  return this._callbacks = this._callbacks || {}, (this._callbacks["$" + e] = this._callbacks["$" + e] || []).push(t), this;
427
- }, D.prototype.once = function(e, t) {
427
+ }, O.prototype.once = function(e, t) {
428
428
  function n() {
429
429
  this.off(e, n), t.apply(this, arguments);
430
430
  }
431
431
  return n.fn = t, this.on(e, n), this;
432
- }, D.prototype.off = D.prototype.removeListener = D.prototype.removeAllListeners = D.prototype.removeEventListener = function(e, t) {
432
+ }, O.prototype.off = O.prototype.removeListener = O.prototype.removeAllListeners = O.prototype.removeEventListener = function(e, t) {
433
433
  if (this._callbacks = this._callbacks || {}, arguments.length == 0) return this._callbacks = {}, this;
434
434
  var n = this._callbacks["$" + e];
435
435
  if (!n) return this;
@@ -439,7 +439,7 @@ D.prototype.on = D.prototype.addEventListener = function(e, t) {
439
439
  break;
440
440
  }
441
441
  return n.length === 0 && delete this._callbacks["$" + e], this;
442
- }, D.prototype.emit = function(e) {
442
+ }, O.prototype.emit = function(e) {
443
443
  this._callbacks = this._callbacks || {};
444
444
  for (var t = Array(arguments.length - 1), n = this._callbacks["$" + e], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
445
445
  if (n) {
@@ -447,40 +447,40 @@ D.prototype.on = D.prototype.addEventListener = function(e, t) {
447
447
  for (var r = 0, i = n.length; r < i; ++r) n[r].apply(this, t);
448
448
  }
449
449
  return this;
450
- }, D.prototype.emitReserved = D.prototype.emit, D.prototype.listeners = function(e) {
450
+ }, O.prototype.emitReserved = O.prototype.emit, O.prototype.listeners = function(e) {
451
451
  return this._callbacks = this._callbacks || {}, this._callbacks["$" + e] || [];
452
- }, D.prototype.hasListeners = function(e) {
452
+ }, O.prototype.hasListeners = function(e) {
453
453
  return !!this.listeners(e).length;
454
454
  };
455
455
  // ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/globals.js
456
- var O = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), k = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Ne = "arraybuffer";
456
+ var k = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), A = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Me = "arraybuffer";
457
457
  // ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/util.js
458
- function Pe(e, ...t) {
458
+ function Ne(e, ...t) {
459
459
  return t.reduce((t, n) => (e.hasOwnProperty(n) && (t[n] = e[n]), t), {});
460
460
  }
461
- var Fe = k.setTimeout, Ie = k.clearTimeout;
462
- function A(e, t) {
463
- t.useNativeTimers ? (e.setTimeoutFn = Fe.bind(k), e.clearTimeoutFn = Ie.bind(k)) : (e.setTimeoutFn = k.setTimeout.bind(k), e.clearTimeoutFn = k.clearTimeout.bind(k));
461
+ var Pe = A.setTimeout, Fe = A.clearTimeout;
462
+ function j(e, t) {
463
+ t.useNativeTimers ? (e.setTimeoutFn = Pe.bind(A), e.clearTimeoutFn = Fe.bind(A)) : (e.setTimeoutFn = A.setTimeout.bind(A), e.clearTimeoutFn = A.clearTimeout.bind(A));
464
464
  }
465
- var Le = 1.33;
466
- function Re(e) {
467
- return typeof e == "string" ? ze(e) : Math.ceil((e.byteLength || e.size) * Le);
465
+ var Ie = 1.33;
466
+ function Le(e) {
467
+ return typeof e == "string" ? Re(e) : Math.ceil((e.byteLength || e.size) * Ie);
468
468
  }
469
- function ze(e) {
469
+ function Re(e) {
470
470
  let t = 0, n = 0;
471
471
  for (let r = 0, i = e.length; r < i; r++) t = e.charCodeAt(r), t < 128 ? n += 1 : t < 2048 ? n += 2 : t < 55296 || t >= 57344 ? n += 3 : (r++, n += 4);
472
472
  return n;
473
473
  }
474
- function Be() {
474
+ function ze() {
475
475
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
476
476
  }
477
477
  // ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/contrib/parseqs.js
478
- function Ve(e) {
478
+ function Be(e) {
479
479
  let t = "";
480
480
  for (let n in e) e.hasOwnProperty(n) && (t.length && (t += "&"), t += encodeURIComponent(n) + "=" + encodeURIComponent(e[n]));
481
481
  return t;
482
482
  }
483
- function He(e) {
483
+ function Ve(e) {
484
484
  let t = {}, n = e.split("&");
485
485
  for (let e = 0, r = n.length; e < r; e++) {
486
486
  let r = n[e].split("=");
@@ -489,16 +489,16 @@ function He(e) {
489
489
  return t;
490
490
  }
491
491
  // ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/transport.js
492
- var Ue = class extends Error {
492
+ var He = class extends Error {
493
493
  constructor(e, t, n) {
494
494
  super(e), this.description = t, this.context = n, this.type = "TransportError";
495
495
  }
496
- }, j = class extends D {
496
+ }, M = class extends O {
497
497
  constructor(e) {
498
- super(), this.writable = !1, A(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
498
+ super(), this.writable = !1, j(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
499
499
  }
500
500
  onError(e, t, n) {
501
- return super.emitReserved("error", new Ue(e, t, n)), this;
501
+ return super.emitReserved("error", new He(e, t, n)), this;
502
502
  }
503
503
  open() {
504
504
  return this.readyState = "opening", this.doOpen(), this;
@@ -513,7 +513,7 @@ var Ue = class extends Error {
513
513
  this.readyState = "open", this.writable = !0, super.emitReserved("open");
514
514
  }
515
515
  onData(e) {
516
- let t = w(e, this.socket.binaryType);
516
+ let t = T(e, this.socket.binaryType);
517
517
  this.onPacket(t);
518
518
  }
519
519
  onPacket(e) {
@@ -534,10 +534,10 @@ var Ue = class extends Error {
534
534
  return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
535
535
  }
536
536
  _query(e) {
537
- let t = Ve(e);
537
+ let t = Be(e);
538
538
  return t.length ? "?" + t : "";
539
539
  }
540
- }, We = class extends j {
540
+ }, Ue = class extends M {
541
541
  constructor() {
542
542
  super(...arguments), this._polling = !1;
543
543
  }
@@ -565,7 +565,7 @@ var Ue = class extends Error {
565
565
  this._polling = !0, this.doPoll(), this.emitReserved("poll");
566
566
  }
567
567
  onData(e) {
568
- Oe(e, this.socket.binaryType).forEach((e) => {
568
+ De(e, this.socket.binaryType).forEach((e) => {
569
569
  if (this.readyState === "opening" && e.type === "open" && this.onOpen(), e.type === "close") return this.onClose({ description: "transport closed by the server" }), !1;
570
570
  this.onPacket(e);
571
571
  }), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
@@ -577,7 +577,7 @@ var Ue = class extends Error {
577
577
  this.readyState === "open" ? e() : this.once("open", e);
578
578
  }
579
579
  write(e) {
580
- this.writable = !1, De(e, (e) => {
580
+ this.writable = !1, Ee(e, (e) => {
581
581
  this.doWrite(e, () => {
582
582
  this.writable = !0, this.emitReserved("drain");
583
583
  });
@@ -585,16 +585,16 @@ var Ue = class extends Error {
585
585
  }
586
586
  uri() {
587
587
  let e = this.opts.secure ? "https" : "http", t = this.query || {};
588
- return !1 !== this.opts.timestampRequests && (t[this.opts.timestampParam] = Be()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
588
+ return !1 !== this.opts.timestampRequests && (t[this.opts.timestampParam] = ze()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
589
589
  }
590
- }, Ge = !1;
590
+ }, We = !1;
591
591
  try {
592
- Ge = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
592
+ We = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
593
593
  } catch {}
594
- var Ke = Ge;
594
+ var Ge = We;
595
595
  // ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/transports/polling-xhr.js
596
- function qe() {}
597
- var Je = class extends We {
596
+ function Ke() {}
597
+ var qe = class extends Ue {
598
598
  constructor(e) {
599
599
  if (super(e), typeof location < "u") {
600
600
  let t = location.protocol === "https:", n = location.port;
@@ -616,13 +616,13 @@ var Je = class extends We {
616
616
  this.onError("xhr poll error", e, t);
617
617
  }), this.pollXhr = e;
618
618
  }
619
- }, M = class e extends D {
619
+ }, N = class e extends O {
620
620
  constructor(e, t, n) {
621
- super(), this.createRequest = e, A(this, n), this._opts = n, this._method = n.method || "GET", this._uri = t, this._data = n.data === void 0 ? null : n.data, this._create();
621
+ super(), this.createRequest = e, j(this, n), this._opts = n, this._method = n.method || "GET", this._uri = t, this._data = n.data === void 0 ? null : n.data, this._create();
622
622
  }
623
623
  _create() {
624
624
  var t;
625
- let n = Pe(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
625
+ let n = Ne(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
626
626
  n.xdomain = !!this._opts.xd;
627
627
  let r = this._xhr = this.createRequest(n);
628
628
  try {
@@ -658,7 +658,7 @@ var Je = class extends We {
658
658
  }
659
659
  _cleanup(t) {
660
660
  if (this._xhr !== void 0 && this._xhr !== null) {
661
- if (this._xhr.onreadystatechange = qe, t) try {
661
+ if (this._xhr.onreadystatechange = Ke, t) try {
662
662
  this._xhr.abort();
663
663
  } catch {}
664
664
  typeof document < "u" && delete e.requests[this._index], this._xhr = null;
@@ -672,45 +672,45 @@ var Je = class extends We {
672
672
  this._cleanup();
673
673
  }
674
674
  };
675
- if (M.requestsCount = 0, M.requests = {}, typeof document < "u") {
676
- if (typeof attachEvent == "function") attachEvent("onunload", Ye);
675
+ if (N.requestsCount = 0, N.requests = {}, typeof document < "u") {
676
+ if (typeof attachEvent == "function") attachEvent("onunload", Je);
677
677
  else if (typeof addEventListener == "function") {
678
- let e = "onpagehide" in k ? "pagehide" : "unload";
679
- addEventListener(e, Ye, !1);
678
+ let e = "onpagehide" in A ? "pagehide" : "unload";
679
+ addEventListener(e, Je, !1);
680
680
  }
681
681
  }
682
- function Ye() {
683
- for (let e in M.requests) M.requests.hasOwnProperty(e) && M.requests[e].abort();
682
+ function Je() {
683
+ for (let e in N.requests) N.requests.hasOwnProperty(e) && N.requests[e].abort();
684
684
  }
685
- var Xe = (function() {
686
- let e = Qe({ xdomain: !1 });
685
+ var Ye = (function() {
686
+ let e = Ze({ xdomain: !1 });
687
687
  return e && e.responseType !== null;
688
- })(), Ze = class extends Je {
688
+ })(), Xe = class extends qe {
689
689
  constructor(e) {
690
690
  super(e);
691
691
  let t = e && e.forceBase64;
692
- this.supportsBinary = Xe && !t;
692
+ this.supportsBinary = Ye && !t;
693
693
  }
694
694
  request(e = {}) {
695
- return Object.assign(e, { xd: this.xd }, this.opts), new M(Qe, this.uri(), e);
695
+ return Object.assign(e, { xd: this.xd }, this.opts), new N(Ze, this.uri(), e);
696
696
  }
697
697
  };
698
- function Qe(e) {
698
+ function Ze(e) {
699
699
  let t = e.xdomain;
700
700
  try {
701
- if (typeof XMLHttpRequest < "u" && (!t || Ke)) return new XMLHttpRequest();
701
+ if (typeof XMLHttpRequest < "u" && (!t || Ge)) return new XMLHttpRequest();
702
702
  } catch {}
703
703
  if (!t) try {
704
- return new k.ActiveXObject("Microsoft.XMLHTTP");
704
+ return new A.ActiveXObject("Microsoft.XMLHTTP");
705
705
  } catch {}
706
706
  }
707
707
  // ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/transports/websocket.js
708
- var $e = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative", et = class extends j {
708
+ var Qe = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative", $e = class extends M {
709
709
  get name() {
710
710
  return "websocket";
711
711
  }
712
712
  doOpen() {
713
- let e = this.uri(), t = this.opts.protocols, n = $e ? {} : Pe(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
713
+ let e = this.uri(), t = this.opts.protocols, n = Qe ? {} : Ne(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
714
714
  this.opts.extraHeaders && (n.headers = this.opts.extraHeaders);
715
715
  try {
716
716
  this.ws = this.createSocket(e, t, n);
@@ -731,11 +731,11 @@ var $e = typeof navigator < "u" && typeof navigator.product == "string" && navig
731
731
  this.writable = !1;
732
732
  for (let t = 0; t < e.length; t++) {
733
733
  let n = e[t], r = t === e.length - 1;
734
- S(n, this.supportsBinary, (e) => {
734
+ C(n, this.supportsBinary, (e) => {
735
735
  try {
736
736
  this.doWrite(n, e);
737
737
  } catch {}
738
- r && O(() => {
738
+ r && k(() => {
739
739
  this.writable = !0, this.emitReserved("drain");
740
740
  }, this.setTimeoutFn);
741
741
  });
@@ -746,18 +746,18 @@ var $e = typeof navigator < "u" && typeof navigator.product == "string" && navig
746
746
  }
747
747
  uri() {
748
748
  let e = this.opts.secure ? "wss" : "ws", t = this.query || {};
749
- return this.opts.timestampRequests && (t[this.opts.timestampParam] = Be()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
749
+ return this.opts.timestampRequests && (t[this.opts.timestampParam] = ze()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
750
750
  }
751
- }, N = k.WebSocket || k.MozWebSocket, tt = {
752
- websocket: class extends et {
751
+ }, P = A.WebSocket || A.MozWebSocket, et = {
752
+ websocket: class extends $e {
753
753
  createSocket(e, t, n) {
754
- return $e ? new N(e, t, n) : t ? new N(e, t) : new N(e);
754
+ return Qe ? new P(e, t, n) : t ? new P(e, t) : new P(e);
755
755
  }
756
756
  doWrite(e, t) {
757
757
  this.ws.send(t);
758
758
  }
759
759
  },
760
- webtransport: class extends j {
760
+ webtransport: class extends M {
761
761
  get name() {
762
762
  return "webtransport";
763
763
  }
@@ -773,7 +773,7 @@ var $e = typeof navigator < "u" && typeof navigator.product == "string" && navig
773
773
  this.onError("webtransport error", e);
774
774
  }), this._transport.ready.then(() => {
775
775
  this._transport.createBidirectionalStream().then((e) => {
776
- let t = je(2 ** 53 - 1, this.socket.binaryType), n = e.readable.pipeThrough(t).getReader(), r = ke();
776
+ let t = Ae(2 ** 53 - 1, this.socket.binaryType), n = e.readable.pipeThrough(t).getReader(), r = Oe();
777
777
  r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
778
778
  let i = () => {
779
779
  n.read().then(({ done: e, value: t }) => {
@@ -791,7 +791,7 @@ var $e = typeof navigator < "u" && typeof navigator.product == "string" && navig
791
791
  for (let t = 0; t < e.length; t++) {
792
792
  let n = e[t], r = t === e.length - 1;
793
793
  this._writer.write(n).then(() => {
794
- r && O(() => {
794
+ r && k(() => {
795
795
  this.writable = !0, this.emitReserved("drain");
796
796
  }, this.setTimeoutFn);
797
797
  });
@@ -802,8 +802,8 @@ var $e = typeof navigator < "u" && typeof navigator.product == "string" && navig
802
802
  (e = this._transport) == null || e.close();
803
803
  }
804
804
  },
805
- polling: Ze
806
- }, nt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, rt = [
805
+ polling: Xe
806
+ }, tt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, nt = [
807
807
  "source",
808
808
  "protocol",
809
809
  "authority",
@@ -819,36 +819,36 @@ var $e = typeof navigator < "u" && typeof navigator.product == "string" && navig
819
819
  "query",
820
820
  "anchor"
821
821
  ];
822
- function P(e) {
822
+ function F(e) {
823
823
  if (e.length > 8e3) throw "URI too long";
824
824
  let t = e, n = e.indexOf("["), r = e.indexOf("]");
825
825
  n != -1 && r != -1 && (e = e.substring(0, n) + e.substring(n, r).replace(/:/g, ";") + e.substring(r, e.length));
826
- let i = nt.exec(e || ""), a = {}, o = 14;
827
- for (; o--;) a[rt[o]] = i[o] || "";
828
- return n != -1 && r != -1 && (a.source = t, a.host = a.host.substring(1, a.host.length - 1).replace(/;/g, ":"), a.authority = a.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), a.ipv6uri = !0), a.pathNames = it(a, a.path), a.queryKey = at(a, a.query), a;
826
+ let i = tt.exec(e || ""), a = {}, o = 14;
827
+ for (; o--;) a[nt[o]] = i[o] || "";
828
+ return n != -1 && r != -1 && (a.source = t, a.host = a.host.substring(1, a.host.length - 1).replace(/;/g, ":"), a.authority = a.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), a.ipv6uri = !0), a.pathNames = rt(a, a.path), a.queryKey = it(a, a.query), a;
829
829
  }
830
- function it(e, t) {
830
+ function rt(e, t) {
831
831
  let n = t.replace(/\/{2,9}/g, "/").split("/");
832
832
  return (t.slice(0, 1) == "/" || t.length === 0) && n.splice(0, 1), t.slice(-1) == "/" && n.splice(n.length - 1, 1), n;
833
833
  }
834
- function at(e, t) {
834
+ function it(e, t) {
835
835
  let n = {};
836
836
  return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(e, t, r) {
837
837
  t && (n[t] = r);
838
838
  }), n;
839
839
  }
840
840
  // ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/socket.js
841
- var F = typeof addEventListener == "function" && typeof removeEventListener == "function", I = [];
842
- F && addEventListener("offline", () => {
843
- I.forEach((e) => e());
841
+ var I = typeof addEventListener == "function" && typeof removeEventListener == "function", L = [];
842
+ I && addEventListener("offline", () => {
843
+ L.forEach((e) => e());
844
844
  }, !1);
845
- var L = class e extends D {
845
+ var R = class e extends O {
846
846
  constructor(e, t) {
847
- if (super(), this.binaryType = Ne, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = Infinity, e && typeof e == "object" && (t = e, e = null), e) {
848
- let n = P(e);
847
+ if (super(), this.binaryType = Me, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = Infinity, e && typeof e == "object" && (t = e, e = null), e) {
848
+ let n = F(e);
849
849
  t.hostname = n.host, t.secure = n.protocol === "https" || n.protocol === "wss", t.port = n.port, n.query && (t.query = n.query);
850
- } else t.host && (t.hostname = P(t.host).host);
851
- A(this, t), this.secure = t.secure == null ? typeof location < "u" && location.protocol === "https:" : t.secure, t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((e) => {
850
+ } else t.host && (t.hostname = F(t.host).host);
851
+ j(this, t), this.secure = t.secure == null ? typeof location < "u" && location.protocol === "https:" : t.secure, t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((e) => {
852
852
  let t = e.prototype.name;
853
853
  this.transports.push(t), this._transportsByName[t] = e;
854
854
  }), this.opts = Object.assign({
@@ -863,11 +863,11 @@ var L = class e extends D {
863
863
  perMessageDeflate: { threshold: 1024 },
864
864
  transportOptions: {},
865
865
  closeOnBeforeunload: !1
866
- }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = He(this.opts.query)), F && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
866
+ }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Ve(this.opts.query)), I && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
867
867
  this.transport && (this.transport.removeAllListeners(), this.transport.close());
868
868
  }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
869
869
  this._onClose("transport close", { description: "network connection lost" });
870
- }, I.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
870
+ }, L.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
871
871
  }
872
872
  createTransport(e) {
873
873
  let t = Object.assign({}, this.opts.query);
@@ -938,7 +938,7 @@ var L = class e extends D {
938
938
  let e = 1;
939
939
  for (let t = 0; t < this.writeBuffer.length; t++) {
940
940
  let n = this.writeBuffer[t].data;
941
- if (n && (e += Re(n)), t > 0 && e > this._maxPayload) return this.writeBuffer.slice(0, t);
941
+ if (n && (e += Le(n)), t > 0 && e > this._maxPayload) return this.writeBuffer.slice(0, t);
942
942
  e += 2;
943
943
  }
944
944
  return this.writeBuffer;
@@ -946,7 +946,7 @@ var L = class e extends D {
946
946
  _hasPingExpired() {
947
947
  if (!this._pingTimeoutTime) return !0;
948
948
  let e = Date.now() > this._pingTimeoutTime;
949
- return e && (this._pingTimeoutTime = 0, O(() => {
949
+ return e && (this._pingTimeoutTime = 0, k(() => {
950
950
  this._onClose("ping timeout");
951
951
  }, this.setTimeoutFn)), e;
952
952
  }
@@ -984,16 +984,16 @@ var L = class e extends D {
984
984
  }
985
985
  _onClose(e, t) {
986
986
  if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
987
- if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), F && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
988
- let e = I.indexOf(this._offlineEventListener);
989
- e !== -1 && I.splice(e, 1);
987
+ if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), I && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
988
+ let e = L.indexOf(this._offlineEventListener);
989
+ e !== -1 && L.splice(e, 1);
990
990
  }
991
991
  this.readyState = "closed", this.id = null, this.emitReserved("close", e, t), this.writeBuffer = [], this._prevBufferLen = 0;
992
992
  }
993
993
  }
994
994
  };
995
- L.protocol = 4;
996
- var ot = class extends L {
995
+ R.protocol = 4;
996
+ var at = class extends R {
997
997
  constructor() {
998
998
  super(...arguments), this._upgrades = [];
999
999
  }
@@ -1002,7 +1002,7 @@ var ot = class extends L {
1002
1002
  }
1003
1003
  _probe(e) {
1004
1004
  let t = this.createTransport(e), n = !1;
1005
- L.priorWebsocketSuccess = !1;
1005
+ R.priorWebsocketSuccess = !1;
1006
1006
  let r = () => {
1007
1007
  n || (t.send([{
1008
1008
  type: "ping",
@@ -1011,7 +1011,7 @@ var ot = class extends L {
1011
1011
  if (!n) {
1012
1012
  if (e.type === "pong" && e.data === "probe") {
1013
1013
  if (this.upgrading = !0, this.emitReserved("upgrading", t), !t) return;
1014
- L.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
1014
+ R.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
1015
1015
  n || this.readyState !== "closed" && (l(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
1016
1016
  });
1017
1017
  } else {
@@ -1052,51 +1052,51 @@ var ot = class extends L {
1052
1052
  for (let n = 0; n < e.length; n++) ~this.transports.indexOf(e[n]) && t.push(e[n]);
1053
1053
  return t;
1054
1054
  }
1055
- }, st = class extends ot {
1055
+ }, ot = class extends at {
1056
1056
  constructor(e, t = {}) {
1057
1057
  let n = typeof e == "object", r = n ? { ...e } : { ...t };
1058
1058
  (!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || [
1059
1059
  "polling",
1060
1060
  "websocket",
1061
1061
  "webtransport"
1062
- ]).map((e) => tt[e]).filter((e) => !!e)), super(n ? r : e, r);
1062
+ ]).map((e) => et[e]).filter((e) => !!e)), super(n ? r : e, r);
1063
1063
  }
1064
1064
  };
1065
- st.protocol;
1065
+ ot.protocol;
1066
1066
  // ../../node_modules/.pnpm/socket.io-client@4.8.4_supports-color@8.1.1/node_modules/socket.io-client/build/esm/url.js
1067
- function ct(e, t = "", n) {
1067
+ function st(e, t = "", n) {
1068
1068
  let r = e;
1069
- n ||= typeof location < "u" && location, e ??= n.protocol + "//" + n.host, typeof e == "string" && (e.charAt(0) === "/" && (e = e.charAt(1) === "/" ? n.protocol + e : n.host + e), /^(https?|wss?):\/\//.test(e) || (e = n === void 0 ? "https://" + e : n.protocol + "//" + e), r = P(e)), r.port || (/^(http|ws)$/.test(r.protocol) ? r.port = "80" : /^(http|ws)s$/.test(r.protocol) && (r.port = "443")), r.path = r.path || "/";
1069
+ n ||= typeof location < "u" && location, e ??= n.protocol + "//" + n.host, typeof e == "string" && (e.charAt(0) === "/" && (e = e.charAt(1) === "/" ? n.protocol + e : n.host + e), /^(https?|wss?):\/\//.test(e) || (e = n === void 0 ? "https://" + e : n.protocol + "//" + e), r = F(e)), r.port || (/^(http|ws)$/.test(r.protocol) ? r.port = "80" : /^(http|ws)s$/.test(r.protocol) && (r.port = "443")), r.path = r.path || "/";
1070
1070
  let i = r.host.indexOf(":") === -1 ? r.host : "[" + r.host + "]";
1071
1071
  return r.id = r.protocol + "://" + i + ":" + r.port + t, r.href = r.protocol + "://" + i + (n && n.port === r.port ? "" : ":" + r.port), r;
1072
1072
  }
1073
1073
  // ../../node_modules/.pnpm/socket.io-parser@4.2.7_supports-color@8.1.1/node_modules/socket.io-parser/build/esm/is-binary.js
1074
- var lt = typeof ArrayBuffer == "function", ut = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e.buffer instanceof ArrayBuffer, dt = Object.prototype.toString, ft = typeof Blob == "function" || typeof Blob < "u" && dt.call(Blob) === "[object BlobConstructor]", pt = typeof File == "function" || typeof File < "u" && dt.call(File) === "[object FileConstructor]";
1075
- function R(e) {
1076
- return lt && (e instanceof ArrayBuffer || ut(e)) || ft && e instanceof Blob || pt && e instanceof File;
1074
+ var ct = typeof ArrayBuffer == "function", lt = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e.buffer instanceof ArrayBuffer, ut = Object.prototype.toString, dt = typeof Blob == "function" || typeof Blob < "u" && ut.call(Blob) === "[object BlobConstructor]", ft = typeof File == "function" || typeof File < "u" && ut.call(File) === "[object FileConstructor]";
1075
+ function z(e) {
1076
+ return ct && (e instanceof ArrayBuffer || lt(e)) || dt && e instanceof Blob || ft && e instanceof File;
1077
1077
  }
1078
- function z(e, t) {
1078
+ function B(e, t) {
1079
1079
  if (!e || typeof e != "object") return !1;
1080
1080
  if (Array.isArray(e)) {
1081
- for (let t = 0, n = e.length; t < n; t++) if (z(e[t])) return !0;
1081
+ for (let t = 0, n = e.length; t < n; t++) if (B(e[t])) return !0;
1082
1082
  return !1;
1083
1083
  }
1084
- if (R(e)) return !0;
1085
- if (e.toJSON && typeof e.toJSON == "function" && arguments.length === 1) return z(e.toJSON(), !0);
1086
- for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && z(e[t])) return !0;
1084
+ if (z(e)) return !0;
1085
+ if (e.toJSON && typeof e.toJSON == "function" && arguments.length === 1) return B(e.toJSON(), !0);
1086
+ for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && B(e[t])) return !0;
1087
1087
  return !1;
1088
1088
  }
1089
1089
  // ../../node_modules/.pnpm/socket.io-parser@4.2.7_supports-color@8.1.1/node_modules/socket.io-parser/build/esm/binary.js
1090
- function mt(e) {
1090
+ function pt(e) {
1091
1091
  let t = [], n = e.data, r = e;
1092
- return r.data = B(n, t), r.attachments = t.length, {
1092
+ return r.data = V(n, t), r.attachments = t.length, {
1093
1093
  packet: r,
1094
1094
  buffers: t
1095
1095
  };
1096
1096
  }
1097
- function B(e, t, n) {
1097
+ function V(e, t, n) {
1098
1098
  if (!e) return e;
1099
- if (R(e)) {
1099
+ if (z(e)) {
1100
1100
  let n = {
1101
1101
  _placeholder: !0,
1102
1102
  num: t.length
@@ -1105,55 +1105,55 @@ function B(e, t, n) {
1105
1105
  }
1106
1106
  if (Array.isArray(e)) {
1107
1107
  let n = Array(e.length);
1108
- for (let r = 0; r < e.length; r++) n[r] = B(e[r], t);
1108
+ for (let r = 0; r < e.length; r++) n[r] = V(e[r], t);
1109
1109
  return n;
1110
1110
  }
1111
1111
  if (typeof e == "object" && !(e instanceof Date)) {
1112
- if (e.toJSON && typeof e.toJSON == "function" && !n) return B(e.toJSON(), t, !0);
1112
+ if (e.toJSON && typeof e.toJSON == "function" && !n) return V(e.toJSON(), t, !0);
1113
1113
  let r = {};
1114
- for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && (r[n] = B(e[n], t));
1114
+ for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && (r[n] = V(e[n], t));
1115
1115
  return r;
1116
1116
  }
1117
1117
  return e;
1118
1118
  }
1119
- function ht(e, t) {
1120
- return e.data = V(e.data, t), delete e.attachments, e;
1119
+ function mt(e, t) {
1120
+ return e.data = H(e.data, t), delete e.attachments, e;
1121
1121
  }
1122
- function V(e, t) {
1122
+ function H(e, t) {
1123
1123
  if (!e) return e;
1124
1124
  if (e && e._placeholder === !0) {
1125
1125
  if (typeof e.num == "number" && e.num >= 0 && e.num < t.length) return t[e.num];
1126
1126
  throw Error("illegal attachments");
1127
1127
  }
1128
- if (Array.isArray(e)) for (let n = 0; n < e.length; n++) e[n] = V(e[n], t);
1129
- else if (typeof e == "object") for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && (e[n] = V(e[n], t));
1128
+ if (Array.isArray(e)) for (let n = 0; n < e.length; n++) e[n] = H(e[n], t);
1129
+ else if (typeof e == "object") for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && (e[n] = H(e[n], t));
1130
1130
  return e;
1131
1131
  }
1132
1132
  // ../../node_modules/.pnpm/socket.io-parser@4.2.7_supports-color@8.1.1/node_modules/socket.io-parser/build/esm/index.js
1133
- var gt = /* @__PURE__ */ t({
1134
- Decoder: () => yt,
1135
- Encoder: () => vt,
1136
- PacketType: () => H,
1137
- isPacketValid: () => Tt,
1133
+ var ht = /* @__PURE__ */ t({
1134
+ Decoder: () => vt,
1135
+ Encoder: () => _t,
1136
+ PacketType: () => U,
1137
+ isPacketValid: () => wt,
1138
1138
  protocol: () => 5
1139
- }), _t = [
1139
+ }), gt = [
1140
1140
  "connect",
1141
1141
  "connect_error",
1142
1142
  "disconnect",
1143
1143
  "disconnecting",
1144
1144
  "newListener",
1145
1145
  "removeListener"
1146
- ], H;
1146
+ ], U;
1147
1147
  (function(e) {
1148
1148
  e[e.CONNECT = 0] = "CONNECT", e[e.DISCONNECT = 1] = "DISCONNECT", e[e.EVENT = 2] = "EVENT", e[e.ACK = 3] = "ACK", e[e.CONNECT_ERROR = 4] = "CONNECT_ERROR", e[e.BINARY_EVENT = 5] = "BINARY_EVENT", e[e.BINARY_ACK = 6] = "BINARY_ACK";
1149
- })(H ||= {});
1150
- var vt = class {
1149
+ })(U ||= {});
1150
+ var _t = class {
1151
1151
  constructor(e) {
1152
1152
  this.replacer = e;
1153
1153
  }
1154
1154
  encode(e) {
1155
- return (e.type === H.EVENT || e.type === H.ACK) && z(e) ? this.encodeAsBinary({
1156
- type: e.type === H.EVENT ? H.BINARY_EVENT : H.BINARY_ACK,
1155
+ return (e.type === U.EVENT || e.type === U.ACK) && B(e) ? this.encodeAsBinary({
1156
+ type: e.type === U.EVENT ? U.BINARY_EVENT : U.BINARY_ACK,
1157
1157
  nsp: e.nsp,
1158
1158
  data: e.data,
1159
1159
  id: e.id
@@ -1161,13 +1161,13 @@ var vt = class {
1161
1161
  }
1162
1162
  encodeAsString(e) {
1163
1163
  let t = "" + e.type;
1164
- return (e.type === H.BINARY_EVENT || e.type === H.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
1164
+ return (e.type === U.BINARY_EVENT || e.type === U.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
1165
1165
  }
1166
1166
  encodeAsBinary(e) {
1167
- let t = mt(e), n = this.encodeAsString(t.packet), r = t.buffers;
1167
+ let t = pt(e), n = this.encodeAsString(t.packet), r = t.buffers;
1168
1168
  return r.unshift(n), r;
1169
1169
  }
1170
- }, yt = class e extends D {
1170
+ }, vt = class e extends O {
1171
1171
  constructor(e) {
1172
1172
  super(), this.opts = Object.assign({
1173
1173
  reviver: void 0,
@@ -1179,23 +1179,23 @@ var vt = class {
1179
1179
  if (typeof e == "string") {
1180
1180
  if (this.reconstructor) throw Error("got plaintext data when reconstructing a packet");
1181
1181
  t = this.decodeString(e);
1182
- let n = t.type === H.BINARY_EVENT;
1183
- n || t.type === H.BINARY_ACK ? (t.type = n ? H.EVENT : H.ACK, this.reconstructor = new bt(t)) : super.emitReserved("decoded", t);
1184
- } else if (R(e) || e.base64) {
1182
+ let n = t.type === U.BINARY_EVENT;
1183
+ n || t.type === U.BINARY_ACK ? (t.type = n ? U.EVENT : U.ACK, this.reconstructor = new yt(t)) : super.emitReserved("decoded", t);
1184
+ } else if (z(e) || e.base64) {
1185
1185
  if (this.reconstructor) t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
1186
1186
  else throw Error("got binary data when not reconstructing a packet");
1187
1187
  } else throw Error("Unknown type: " + e);
1188
1188
  }
1189
1189
  decodeString(t) {
1190
1190
  let n = 0, r = { type: Number(t.charAt(0)) };
1191
- if (H[r.type] === void 0) throw Error("unknown packet type " + r.type);
1192
- if (r.type === H.BINARY_EVENT || r.type === H.BINARY_ACK) {
1191
+ if (U[r.type] === void 0) throw Error("unknown packet type " + r.type);
1192
+ if (r.type === U.BINARY_EVENT || r.type === U.BINARY_ACK) {
1193
1193
  let e = n + 1;
1194
1194
  for (; t.charAt(++n) !== "-" && n != t.length;);
1195
1195
  let i = t.substring(e, n);
1196
1196
  if (i != Number(i) || t.charAt(n) !== "-") throw Error("Illegal attachments");
1197
1197
  let a = Number(i);
1198
- if (!St(a) || a < 1) throw Error("Illegal attachments");
1198
+ if (!xt(a) || a < 1) throw Error("Illegal attachments");
1199
1199
  if (a > this.opts.maxAttachments) throw Error("too many attachments");
1200
1200
  r.attachments = a;
1201
1201
  }
@@ -1233,25 +1233,25 @@ var vt = class {
1233
1233
  }
1234
1234
  static isPayloadValid(e, t) {
1235
1235
  switch (e) {
1236
- case H.CONNECT: return U(t);
1237
- case H.DISCONNECT: return t === void 0;
1238
- case H.CONNECT_ERROR: return typeof t == "string" || U(t);
1239
- case H.EVENT:
1240
- case H.BINARY_EVENT: return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && _t.indexOf(t[0]) === -1);
1241
- case H.ACK:
1242
- case H.BINARY_ACK: return Array.isArray(t);
1236
+ case U.CONNECT: return W(t);
1237
+ case U.DISCONNECT: return t === void 0;
1238
+ case U.CONNECT_ERROR: return typeof t == "string" || W(t);
1239
+ case U.EVENT:
1240
+ case U.BINARY_EVENT: return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && gt.indexOf(t[0]) === -1);
1241
+ case U.ACK:
1242
+ case U.BINARY_ACK: return Array.isArray(t);
1243
1243
  }
1244
1244
  }
1245
1245
  destroy() {
1246
1246
  this.reconstructor &&= (this.reconstructor.finishedReconstruction(), null);
1247
1247
  }
1248
- }, bt = class {
1248
+ }, yt = class {
1249
1249
  constructor(e) {
1250
1250
  this.packet = e, this.buffers = [], this.reconPack = e;
1251
1251
  }
1252
1252
  takeBinaryData(e) {
1253
1253
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
1254
- let e = ht(this.reconPack, this.buffers);
1254
+ let e = mt(this.reconPack, this.buffers);
1255
1255
  return this.finishedReconstruction(), e;
1256
1256
  }
1257
1257
  return null;
@@ -1260,46 +1260,46 @@ var vt = class {
1260
1260
  this.reconPack = null, this.buffers = [];
1261
1261
  }
1262
1262
  };
1263
- function xt(e) {
1263
+ function bt(e) {
1264
1264
  return typeof e == "string";
1265
1265
  }
1266
- var St = Number.isInteger || function(e) {
1266
+ var xt = Number.isInteger || function(e) {
1267
1267
  return typeof e == "number" && isFinite(e) && Math.floor(e) === e;
1268
1268
  };
1269
- function Ct(e) {
1270
- return e === void 0 || St(e);
1269
+ function St(e) {
1270
+ return e === void 0 || xt(e);
1271
1271
  }
1272
- function U(e) {
1272
+ function W(e) {
1273
1273
  return Object.prototype.toString.call(e) === "[object Object]";
1274
1274
  }
1275
- function wt(e, t) {
1275
+ function Ct(e, t) {
1276
1276
  switch (e) {
1277
- case H.CONNECT: return t === void 0 || U(t);
1278
- case H.DISCONNECT: return t === void 0;
1279
- case H.EVENT: return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && _t.indexOf(t[0]) === -1);
1280
- case H.ACK: return Array.isArray(t);
1281
- case H.CONNECT_ERROR: return typeof t == "string" || U(t);
1277
+ case U.CONNECT: return t === void 0 || W(t);
1278
+ case U.DISCONNECT: return t === void 0;
1279
+ case U.EVENT: return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && gt.indexOf(t[0]) === -1);
1280
+ case U.ACK: return Array.isArray(t);
1281
+ case U.CONNECT_ERROR: return typeof t == "string" || W(t);
1282
1282
  default: return !1;
1283
1283
  }
1284
1284
  }
1285
- function Tt(e) {
1286
- return xt(e.nsp) && Ct(e.id) && wt(e.type, e.data);
1285
+ function wt(e) {
1286
+ return bt(e.nsp) && St(e.id) && Ct(e.type, e.data);
1287
1287
  }
1288
1288
  // ../../node_modules/.pnpm/socket.io-client@4.8.4_supports-color@8.1.1/node_modules/socket.io-client/build/esm/on.js
1289
- function W(e, t, n) {
1289
+ function G(e, t, n) {
1290
1290
  return e.on(t, n), function() {
1291
1291
  e.off(t, n);
1292
1292
  };
1293
1293
  }
1294
1294
  // ../../node_modules/.pnpm/socket.io-client@4.8.4_supports-color@8.1.1/node_modules/socket.io-client/build/esm/socket.js
1295
- var Et = Object.freeze({
1295
+ var Tt = Object.freeze({
1296
1296
  connect: 1,
1297
1297
  connect_error: 1,
1298
1298
  disconnect: 1,
1299
1299
  disconnecting: 1,
1300
1300
  newListener: 1,
1301
1301
  removeListener: 1
1302
- }), Dt = class extends D {
1302
+ }), Et = class extends O {
1303
1303
  constructor(e, t, n) {
1304
1304
  super(), this.connected = !1, this.recovered = !1, this.receiveBuffer = [], this.sendBuffer = [], this._queue = [], this._queueSeq = 0, this.ids = 0, this.acks = {}, this.flags = {}, this.io = e, this.nsp = t, n && n.auth && (this.auth = n.auth), this._opts = Object.assign({}, n), this.io._autoConnect && this.open();
1305
1305
  }
@@ -1310,10 +1310,10 @@ var Et = Object.freeze({
1310
1310
  if (this.subs) return;
1311
1311
  let e = this.io;
1312
1312
  this.subs = [
1313
- W(e, "open", this.onopen.bind(this)),
1314
- W(e, "packet", this.onpacket.bind(this)),
1315
- W(e, "error", this.onerror.bind(this)),
1316
- W(e, "close", this.onclose.bind(this))
1313
+ G(e, "open", this.onopen.bind(this)),
1314
+ G(e, "packet", this.onpacket.bind(this)),
1315
+ G(e, "error", this.onerror.bind(this)),
1316
+ G(e, "close", this.onclose.bind(this))
1317
1317
  ];
1318
1318
  }
1319
1319
  get active() {
@@ -1329,10 +1329,10 @@ var Et = Object.freeze({
1329
1329
  return e.unshift("message"), this.emit.apply(this, e), this;
1330
1330
  }
1331
1331
  emit(e, ...t) {
1332
- if (Et.hasOwnProperty(e)) throw Error("\"" + e.toString() + "\" is a reserved event name");
1332
+ if (Tt.hasOwnProperty(e)) throw Error("\"" + e.toString() + "\" is a reserved event name");
1333
1333
  if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile) return this._addToQueue(t), this;
1334
1334
  let n = {
1335
- type: H.EVENT,
1335
+ type: U.EVENT,
1336
1336
  data: t
1337
1337
  };
1338
1338
  if (n.options = {}, n.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
@@ -1390,7 +1390,7 @@ var Et = Object.freeze({
1390
1390
  }
1391
1391
  _sendConnectPacket(e) {
1392
1392
  this.packet({
1393
- type: H.CONNECT,
1393
+ type: U.CONNECT,
1394
1394
  data: this._pid ? Object.assign({
1395
1395
  pid: this._pid,
1396
1396
  offset: this._lastOffset
@@ -1413,21 +1413,21 @@ var Et = Object.freeze({
1413
1413
  }
1414
1414
  onpacket(e) {
1415
1415
  if (e.nsp === this.nsp) switch (e.type) {
1416
- case H.CONNECT:
1416
+ case U.CONNECT:
1417
1417
  e.data && e.data.sid ? this.onconnect(e.data.sid, e.data.pid) : this.emitReserved("connect_error", /* @__PURE__ */ Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
1418
1418
  break;
1419
- case H.EVENT:
1420
- case H.BINARY_EVENT:
1419
+ case U.EVENT:
1420
+ case U.BINARY_EVENT:
1421
1421
  this.onevent(e);
1422
1422
  break;
1423
- case H.ACK:
1424
- case H.BINARY_ACK:
1423
+ case U.ACK:
1424
+ case U.BINARY_ACK:
1425
1425
  this.onack(e);
1426
1426
  break;
1427
- case H.DISCONNECT:
1427
+ case U.DISCONNECT:
1428
1428
  this.ondisconnect();
1429
1429
  break;
1430
- case H.CONNECT_ERROR:
1430
+ case U.CONNECT_ERROR:
1431
1431
  this.destroy();
1432
1432
  let t = Error(e.data.message);
1433
1433
  t.data = e.data.data, this.emitReserved("connect_error", t);
@@ -1448,7 +1448,7 @@ var Et = Object.freeze({
1448
1448
  let t = this, n = !1;
1449
1449
  return function(...r) {
1450
1450
  n || (n = !0, t.packet({
1451
- type: H.ACK,
1451
+ type: U.ACK,
1452
1452
  id: e,
1453
1453
  data: r
1454
1454
  }));
@@ -1473,7 +1473,7 @@ var Et = Object.freeze({
1473
1473
  this.subs &&= (this.subs.forEach((e) => e()), void 0), this.io._destroy(this);
1474
1474
  }
1475
1475
  disconnect() {
1476
- return this.connected && this.packet({ type: H.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
1476
+ return this.connected && this.packet({ type: U.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
1477
1477
  }
1478
1478
  close() {
1479
1479
  return this.disconnect();
@@ -1529,34 +1529,34 @@ var Et = Object.freeze({
1529
1529
  }
1530
1530
  };
1531
1531
  // ../../node_modules/.pnpm/socket.io-client@4.8.4_supports-color@8.1.1/node_modules/socket.io-client/build/esm/contrib/backo2.js
1532
- function G(e) {
1532
+ function K(e) {
1533
1533
  e ||= {}, this.ms = e.min || 100, this.max = e.max || 1e4, this.factor = e.factor || 2, this.jitter = e.jitter > 0 && e.jitter <= 1 ? e.jitter : 0, this.attempts = 0;
1534
1534
  }
1535
- G.prototype.duration = function() {
1535
+ K.prototype.duration = function() {
1536
1536
  var e = this.ms * this.factor ** +this.attempts++;
1537
1537
  if (this.jitter) {
1538
1538
  var t = Math.random(), n = Math.floor(t * this.jitter * e);
1539
1539
  e = Math.floor(t * 10) & 1 ? e + n : e - n;
1540
1540
  }
1541
1541
  return Math.min(e, this.max) | 0;
1542
- }, G.prototype.reset = function() {
1542
+ }, K.prototype.reset = function() {
1543
1543
  this.attempts = 0;
1544
- }, G.prototype.setMin = function(e) {
1544
+ }, K.prototype.setMin = function(e) {
1545
1545
  this.ms = e;
1546
- }, G.prototype.setMax = function(e) {
1546
+ }, K.prototype.setMax = function(e) {
1547
1547
  this.max = e;
1548
- }, G.prototype.setJitter = function(e) {
1548
+ }, K.prototype.setJitter = function(e) {
1549
1549
  this.jitter = e;
1550
1550
  };
1551
1551
  // ../../node_modules/.pnpm/socket.io-client@4.8.4_supports-color@8.1.1/node_modules/socket.io-client/build/esm/manager.js
1552
- var K = class extends D {
1552
+ var q = class extends O {
1553
1553
  constructor(e, t) {
1554
- super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t ||= {}, t.path = t.path || "/socket.io", this.opts = t, A(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || Infinity), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor(t.randomizationFactor ?? .5), this.backoff = new G({
1554
+ super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t ||= {}, t.path = t.path || "/socket.io", this.opts = t, j(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || Infinity), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor(t.randomizationFactor ?? .5), this.backoff = new K({
1555
1555
  min: this.reconnectionDelay(),
1556
1556
  max: this.reconnectionDelayMax(),
1557
1557
  jitter: this.randomizationFactor()
1558
1558
  }), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
1559
- let n = t.parser || gt;
1559
+ let n = t.parser || ht;
1560
1560
  this.encoder = new n.Encoder(), this.decoder = new n.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
1561
1561
  }
1562
1562
  reconnection(e) {
@@ -1585,14 +1585,14 @@ var K = class extends D {
1585
1585
  }
1586
1586
  open(e) {
1587
1587
  if (~this._readyState.indexOf("open")) return this;
1588
- this.engine = new st(this.uri, this.opts);
1588
+ this.engine = new ot(this.uri, this.opts);
1589
1589
  let t = this.engine, n = this;
1590
1590
  this._readyState = "opening", this.skipReconnect = !1;
1591
- let r = W(t, "open", function() {
1591
+ let r = G(t, "open", function() {
1592
1592
  n.onopen(), e && e();
1593
1593
  }), i = (t) => {
1594
1594
  this.cleanup(), this._readyState = "closed", this.emitReserved("error", t), e ? e(t) : this.maybeReconnectOnOpen();
1595
- }, a = W(t, "error", i);
1595
+ }, a = G(t, "error", i);
1596
1596
  if (!1 !== this._timeout) {
1597
1597
  let e = this._timeout, n = this.setTimeoutFn(() => {
1598
1598
  r(), i(/* @__PURE__ */ Error("timeout")), t.close();
@@ -1609,7 +1609,7 @@ var K = class extends D {
1609
1609
  onopen() {
1610
1610
  this.cleanup(), this._readyState = "open", this.emitReserved("open");
1611
1611
  let e = this.engine;
1612
- this.subs.push(W(e, "ping", this.onping.bind(this)), W(e, "data", this.ondata.bind(this)), W(e, "error", this.onerror.bind(this)), W(e, "close", this.onclose.bind(this)), W(this.decoder, "decoded", this.ondecoded.bind(this)));
1612
+ this.subs.push(G(e, "ping", this.onping.bind(this)), G(e, "data", this.ondata.bind(this)), G(e, "error", this.onerror.bind(this)), G(e, "close", this.onclose.bind(this)), G(this.decoder, "decoded", this.ondecoded.bind(this)));
1613
1613
  }
1614
1614
  onping() {
1615
1615
  this.emitReserved("ping");
@@ -1622,7 +1622,7 @@ var K = class extends D {
1622
1622
  }
1623
1623
  }
1624
1624
  ondecoded(e) {
1625
- O(() => {
1625
+ k(() => {
1626
1626
  this.emitReserved("packet", e);
1627
1627
  }, this.setTimeoutFn);
1628
1628
  }
@@ -1631,7 +1631,7 @@ var K = class extends D {
1631
1631
  }
1632
1632
  socket(e, t) {
1633
1633
  let n = this.nsps[e];
1634
- return n ? this._autoConnect && !n.active && n.connect() : (n = new Dt(this, e, t), this.nsps[e] = n), n;
1634
+ return n ? this._autoConnect && !n.active && n.connect() : (n = new Et(this, e, t), this.nsps[e] = n), n;
1635
1635
  }
1636
1636
  _destroy(e) {
1637
1637
  let t = Object.keys(this.nsps);
@@ -1676,20 +1676,20 @@ var K = class extends D {
1676
1676
  let e = this.backoff.attempts;
1677
1677
  this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
1678
1678
  }
1679
- }, q = {};
1680
- function J(e, t) {
1679
+ }, J = {};
1680
+ function Y(e, t) {
1681
1681
  typeof e == "object" && (t = e, e = void 0), t ||= {};
1682
- let n = ct(e, t.path || "/socket.io"), r = n.source, i = n.id, a = n.path, o = q[i] && a in q[i].nsps, s = t.forceNew || t["force new connection"] || !1 === t.multiplex || o, c;
1683
- return s ? c = new K(r, t) : (q[i] || (q[i] = new K(r, t)), c = q[i]), n.query && !t.query && (t.query = n.queryKey), c.socket(n.path, t);
1682
+ let n = st(e, t.path || "/socket.io"), r = n.source, i = n.id, a = n.path, o = J[i] && a in J[i].nsps, s = t.forceNew || t["force new connection"] || !1 === t.multiplex || o, c;
1683
+ return s ? c = new q(r, t) : (J[i] || (J[i] = new q(r, t)), c = J[i]), n.query && !t.query && (t.query = n.queryKey), c.socket(n.path, t);
1684
1684
  }
1685
- Object.assign(J, {
1686
- Manager: K,
1687
- Socket: Dt,
1688
- io: J,
1689
- connect: J
1685
+ Object.assign(Y, {
1686
+ Manager: q,
1687
+ Socket: Et,
1688
+ io: Y,
1689
+ connect: Y
1690
1690
  });
1691
1691
  // src/sdk-socket.ts
1692
- function Ot(e) {
1692
+ function Dt(e) {
1693
1693
  let t = e.replace(/\/$/, "");
1694
1694
  try {
1695
1695
  return `${new URL(t).origin}/sdk`;
@@ -1697,7 +1697,7 @@ function Ot(e) {
1697
1697
  return `${t}/sdk`;
1698
1698
  }
1699
1699
  }
1700
- var kt = class {
1700
+ var Ot = class {
1701
1701
  constructor() {
1702
1702
  this.socket = null;
1703
1703
  }
@@ -1706,8 +1706,8 @@ var kt = class {
1706
1706
  }
1707
1707
  connect(e) {
1708
1708
  this.disconnect();
1709
- let t = Ot(e.baseUrl);
1710
- this.socket = J(t, {
1709
+ let t = Dt(e.baseUrl);
1710
+ this.socket = Y(t, {
1711
1711
  auth: {
1712
1712
  apiKey: e.apiKey,
1713
1713
  visitorToken: e.visitorToken
@@ -1730,7 +1730,7 @@ var kt = class {
1730
1730
  disconnect() {
1731
1731
  this.socket &&= (this.socket.removeAllListeners(), this.socket.disconnect(), null);
1732
1732
  }
1733
- }, Y = "onedeskpro_visitor_token";
1733
+ }, kt = "onedeskpro_visitor_token";
1734
1734
  function At(e) {
1735
1735
  try {
1736
1736
  return typeof window < "u" ? window.localStorage.getItem(e) : null;
@@ -1750,10 +1750,10 @@ function Mt(e) {
1750
1750
  }
1751
1751
  var Nt = class {
1752
1752
  constructor() {
1753
- this.token = null, this.storageKey = Y;
1753
+ this.token = null, this.storageKey = kt;
1754
1754
  }
1755
1755
  setScope(e) {
1756
- this.storageKey = e?.trim() ? `${Y}:${e.trim()}` : Y, this.token = At(this.storageKey);
1756
+ this.storageKey = e?.trim() ? `${kt}:${e.trim()}` : kt, this.token = At(this.storageKey);
1757
1757
  }
1758
1758
  get() {
1759
1759
  return this.token ?? At(this.storageKey);
@@ -1905,7 +1905,7 @@ var Bt = class e {
1905
1905
  }
1906
1906
  this.chunks = [], this.releaseMedia();
1907
1907
  }
1908
- }, X = [
1908
+ }, Vt = [
1909
1909
  {
1910
1910
  iso: "BD",
1911
1911
  name: "Bangladesh",
@@ -2272,8 +2272,8 @@ var Bt = class e {
2272
2272
  dial: "977",
2273
2273
  flag: "🇳🇵"
2274
2274
  }
2275
- ], Vt = X.find((e) => e.iso === "BD") ?? X[0];
2276
- function Ht(e, t) {
2275
+ ], Ht = Vt.find((e) => e.iso === "BD") ?? Vt[0];
2276
+ function Ut(e, t) {
2277
2277
  let n = t.trim();
2278
2278
  if (n.startsWith("+")) {
2279
2279
  let e = n.replace(/\D/g, "");
@@ -2283,8 +2283,8 @@ function Ht(e, t) {
2283
2283
  return !r || (r = r.replace(/^0+/, ""), !r) ? "" : `+${e}${r}`;
2284
2284
  }
2285
2285
  // src/widget/styles.ts
2286
- var Ut = "(max-width: 640px), (max-height: 500px) and (pointer: coarse)";
2287
- function Wt(e, t) {
2286
+ var Wt = "(max-width: 640px), (max-height: 500px) and (pointer: coarse)";
2287
+ function Gt(e, t) {
2288
2288
  let n = `
2289
2289
  --ttcb-bg: #ffffff;
2290
2290
  --ttcb-bg-secondary: #f3f4f6;
@@ -2950,7 +2950,7 @@ function Wt(e, t) {
2950
2950
 
2951
2951
  .ttcb-footer.hidden, .ttcb-messages.hidden { display: none; }
2952
2952
 
2953
- @media ${Ut} {
2953
+ @media ${Wt} {
2954
2954
  .ttcb-fab.bottom-right { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
2955
2955
  .ttcb-fab.bottom-left { left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
2956
2956
  /* The open panel covers the launcher; its own close button takes over. */
@@ -3017,18 +3017,18 @@ function Wt(e, t) {
3017
3017
  `;
3018
3018
  }
3019
3019
  // src/widget/render.ts
3020
- function Gt(e) {
3020
+ function Kt(e) {
3021
3021
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
3022
3022
  }
3023
- function Kt(e) {
3023
+ function qt(e) {
3024
3024
  let t = [], n = e.replace(/```[\w]*\n?([\s\S]*?)```/g, (e, n) => {
3025
3025
  let r = t.length;
3026
- return t.push(`<pre><code>${Gt(n.trim())}</code></pre>`), `\x04${r}\x05`;
3026
+ return t.push(`<pre><code>${Kt(n.trim())}</code></pre>`), `\x04${r}\x05`;
3027
3027
  });
3028
3028
  n = n.replace(/`([^`\n]+)`/g, (e, n) => {
3029
3029
  let r = t.length;
3030
- return t.push(`<code>${Gt(n)}</code>`), `\x02${r}\x03`;
3031
- }), n = Gt(n);
3030
+ return t.push(`<code>${Kt(n)}</code>`), `\x02${r}\x03`;
3031
+ }), n = Kt(n);
3032
3032
  let r = n.split("\n"), i = [], a = "", o = () => {
3033
3033
  a &&= (i.push(`</${a}>`), "");
3034
3034
  };
@@ -3045,70 +3045,70 @@ function Kt(e) {
3045
3045
  }).join("") : "";
3046
3046
  }).filter(Boolean).join(""), n = n.replace(/\x04(\d+)\x05/g, (e, n) => t[+n] ?? "").replace(/\x02(\d+)\x03/g, (e, n) => t[+n] ?? ""), n;
3047
3047
  }
3048
- function qt() {
3048
+ function Jt() {
3049
3049
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"/>\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"14\"/>\n <line x1=\"9\" y1=\"11\" x2=\"15\" y2=\"11\"/>\n </svg>";
3050
3050
  }
3051
- function Jt() {
3051
+ function Yt() {
3052
3052
  return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M20 2H4C2.9 2 2 2.9 2 4v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z\"/>\n </svg>";
3053
3053
  }
3054
- function Yt() {
3054
+ function Xt() {
3055
3055
  return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"/>\n </svg>";
3056
3056
  }
3057
- function Xt() {
3057
+ function Zt() {
3058
3058
  return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z\"/>\n </svg>";
3059
3059
  }
3060
- function Z() {
3060
+ function X() {
3061
3061
  return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3zm-2 10H6V7h12v12zm-9-6c-.83 0-1.5-.67-1.5-1.5S8.17 10 9 10s1.5.67 1.5 1.5S9.83 13 9 13zm6 0c-.83 0-1.5-.67-1.5-1.5S14.17 10 15 10s1.5.67 1.5 1.5S15.83 13 15 13z\"/>\n </svg>";
3062
3062
  }
3063
- function Zt() {
3063
+ function Qt() {
3064
3064
  return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\"/>\n </svg>";
3065
3065
  }
3066
- function Qt() {
3066
+ function $t() {
3067
3067
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2\"/>\n <circle cx=\"12\" cy=\"7\" r=\"4\"/>\n </svg>";
3068
3068
  }
3069
- function $t() {
3069
+ function en() {
3070
3070
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z\"/>\n <polyline points=\"22,6 12,13 2,6\"/>\n </svg>";
3071
3071
  }
3072
- function en() {
3072
+ function tn() {
3073
3073
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <polyline points=\"6 9 12 15 18 9\"/>\n </svg>";
3074
3074
  }
3075
- function tn() {
3075
+ function nn() {
3076
3076
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>\n <polyline points=\"12 5 19 12 12 19\"/>\n </svg>";
3077
3077
  }
3078
- function nn() {
3078
+ function rn() {
3079
3079
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z\"/>\n <polyline points=\"9 12 11 14 15 10\"/>\n </svg>";
3080
3080
  }
3081
- function rn() {
3081
+ function an() {
3082
3082
  return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" fill=\"currentColor\"/>\n <path d=\"M9 12l2 2 4-4\" fill=\"none\" stroke=\"#fff\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>";
3083
3083
  }
3084
- function an() {
3084
+ function on() {
3085
3085
  return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill=\"#F59E0B\" d=\"M8 2.5l1.1 2.2 2.4.3-1.7 1.7.4 2.4L8 8l-2.2 1.1.4-2.4L4.5 5l2.4-.3L8 2.5z\"/>\n <path fill=\"#F59E0B\" d=\"M16 3.5l.8 1.6 1.8.2-1.3 1.3.3 1.8L16 7.5l-1.6.9.3-1.8-1.3-1.3 1.8-.2L16 3.5z\"/>\n <path fill=\"#FBBF24\" d=\"M12 11.5l1 2 2.2.3-1.6 1.6.4 2.2-2-1.1-2 1.1.4-2.2-1.6-1.6 2.2-.3 1-2z\"/>\n </svg>";
3086
3086
  }
3087
- function on() {
3087
+ function sn() {
3088
3088
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2\"/>\n <circle cx=\"9\" cy=\"7\" r=\"4\"/>\n <path d=\"M23 21v-2a4 4 0 0 0-3-3.87\"/>\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\"/>\n </svg>";
3089
3089
  }
3090
- function sn() {
3090
+ function cn() {
3091
3091
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/>\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>\n </svg>";
3092
3092
  }
3093
- function cn() {
3093
+ function ln() {
3094
3094
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48\"/>\n </svg>";
3095
3095
  }
3096
- function ln() {
3096
+ function un() {
3097
3097
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"/>\n <circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/>\n <polyline points=\"21 15 16 10 5 21\"/>\n </svg>";
3098
3098
  }
3099
- function un() {
3099
+ function dn() {
3100
3100
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z\"/>\n <path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/>\n <line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"23\"/>\n <line x1=\"8\" y1=\"23\" x2=\"16\" y2=\"23\"/>\n </svg>";
3101
3101
  }
3102
- function dn() {
3102
+ function fn() {
3103
3103
  return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" fill=\"currentColor\"/>\n </svg>";
3104
3104
  }
3105
- function fn() {
3105
+ function pn() {
3106
3106
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <polyline points=\"3 6 5 6 21 6\"/>\n <path d=\"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6\"/>\n <path d=\"M10 11v6\"/>\n <path d=\"M14 11v6\"/>\n <path d=\"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\"/>\n </svg>";
3107
3107
  }
3108
- function pn() {
3108
+ function mn() {
3109
3109
  return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"/>\n <polyline points=\"14 2 14 8 20 8\"/>\n </svg>";
3110
3110
  }
3111
- function mn(e) {
3111
+ function hn(e) {
3112
3112
  let t = m(e.url) ? e.url : "", n = e.type.toLowerCase();
3113
3113
  if (t && n.startsWith("image/")) {
3114
3114
  let n = document.createElement("a");
@@ -3133,7 +3133,7 @@ function mn(e) {
3133
3133
  let r = document.createElement(t ? "a" : "div");
3134
3134
  r.className = "ttcb-attachment ttcb-attachment-file", r instanceof HTMLAnchorElement && (r.href = t, r.target = "_blank", r.rel = "noopener noreferrer");
3135
3135
  let i = document.createElement("span");
3136
- i.className = "ttcb-attachment-icon", i.setAttribute("aria-hidden", "true"), i.innerHTML = pn();
3136
+ i.className = "ttcb-attachment-icon", i.setAttribute("aria-hidden", "true"), i.innerHTML = mn();
3137
3137
  let a = document.createElement("span");
3138
3138
  a.className = "ttcb-attachment-meta";
3139
3139
  let o = document.createElement("span");
@@ -3145,11 +3145,11 @@ function mn(e) {
3145
3145
  }
3146
3146
  return r.appendChild(i), r.appendChild(a), r;
3147
3147
  }
3148
- function hn(e) {
3148
+ function gn(e) {
3149
3149
  let { type: t, content: n } = e, r = e.attachments ?? [], i = document.createElement("div");
3150
3150
  i.className = `ttcb-msg ${t}`, e.pending && i.classList.add("ttcb-pending");
3151
3151
  let a = document.createElement("div");
3152
- a.className = "ttcb-msg-avatar", a.innerHTML = t === "human" ? Zt() : t === "agent" ? Qt() : Z();
3152
+ a.className = "ttcb-msg-avatar", a.innerHTML = t === "human" ? Qt() : t === "agent" ? $t() : X();
3153
3153
  let o = document.createElement("div");
3154
3154
  if (o.className = "ttcb-msg-body", t === "agent") {
3155
3155
  let e = document.createElement("span");
@@ -3158,12 +3158,12 @@ function hn(e) {
3158
3158
  if (r.length > 0) {
3159
3159
  let e = document.createElement("div");
3160
3160
  e.className = "ttcb-attachments";
3161
- for (let t of r) e.appendChild(mn(t));
3161
+ for (let t of r) e.appendChild(hn(t));
3162
3162
  o.appendChild(e);
3163
3163
  }
3164
3164
  if (r.length === 0 || !re(n, r)) {
3165
3165
  let e = document.createElement("div");
3166
- e.className = "ttcb-bubble", t === "human" ? e.textContent = n : e.innerHTML = Kt(n), o.appendChild(e);
3166
+ e.className = "ttcb-bubble", t === "human" ? e.textContent = n : e.innerHTML = qt(n), o.appendChild(e);
3167
3167
  }
3168
3168
  if (e.pending) {
3169
3169
  let e = document.createElement("span");
@@ -3171,29 +3171,29 @@ function hn(e) {
3171
3171
  }
3172
3172
  return i.appendChild(a), i.appendChild(o), i;
3173
3173
  }
3174
- function gn() {
3174
+ function _n() {
3175
3175
  let e = document.createElement("div");
3176
3176
  e.className = "ttcb-msg ai", e.id = "ttcb-typing";
3177
3177
  let t = document.createElement("div");
3178
- t.className = "ttcb-msg-avatar", t.innerHTML = Z();
3178
+ t.className = "ttcb-msg-avatar", t.innerHTML = X();
3179
3179
  let n = document.createElement("div");
3180
3180
  return n.className = "ttcb-typing", n.innerHTML = "<span></span><span></span><span></span>", e.appendChild(t), e.appendChild(n), e;
3181
3181
  }
3182
3182
  // src/widget/widget.ts
3183
- var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mpeg,audio/wav,audio/x-m4a,audio/aac,audio/opus,application/pdf,text/csv", vn = "image/jpeg,image/png,image/gif", yn = class {
3183
+ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mpeg,audio/wav,audio/x-m4a,audio/aac,audio/opus,application/pdf,text/csv", yn = "image/jpeg,image/png,image/gif", bn = class {
3184
3184
  constructor(e, t) {
3185
- this.stopViewportSync = null, this.confirmingNew = !1, this.actionPending = !1, this.ticketMode = "ai", this.pendingFiles = [], this.attachMenuOpen = !1, this.recorder = null, this.voicePreviewUrl = "", this.selectedCountry = Vt, this.countryOpen = !1, this.isOpen = !1, this.destroyed = !1, this.position = e.position ?? "bottom-right", this.callbacks = t, this.autoOpen = e.autoOpen === !0, this.mount(e);
3185
+ this.stopViewportSync = null, this.confirmingNew = !1, this.actionPending = !1, this.ticketMode = "ai", this.pendingFiles = [], this.attachMenuOpen = !1, this.recorder = null, this.voicePreviewUrl = "", this.selectedCountry = Ht, this.countryOpen = !1, this.isOpen = !1, this.destroyed = !1, this.position = e.position ?? "bottom-right", this.callbacks = t, this.autoOpen = e.autoOpen === !0, this.mount(e);
3186
3186
  }
3187
3187
  mount(e) {
3188
3188
  this.host = document.createElement("div"), this.host.id = "onedeskpro-chatbot-host", this.host.style.display = "none", this.shadow = this.host.attachShadow({ mode: "closed" });
3189
3189
  let t = document.createElement("style");
3190
- t.textContent = Wt(e.primaryColor ?? "#2563EB", e.theme ?? "auto"), this.shadow.appendChild(t), this.fab = document.createElement("button"), this.fab.className = `ttcb-fab ${this.position}`, this.fab.setAttribute("aria-label", "Open chat"), this.fab.innerHTML = Jt(), this.fab.addEventListener("click", () => this.toggle()), this.shadow.appendChild(this.fab), this.panel = document.createElement("div"), this.panel.className = `ttcb-panel ${this.position} hidden ttcb-mode-compact`, this.panel.tabIndex = -1, this.panel.setAttribute("role", "dialog"), this.panel.setAttribute("aria-modal", "true"), this.panel.setAttribute("aria-label", e.chatbotName ?? "AI Assistant"), this.panel.appendChild(this.buildHeader(e)), this.identifyContainer = document.createElement("div"), this.identifyContainer.className = "ttcb-identify", this.buildIdentifyForm(this.identifyContainer), this.panel.appendChild(this.identifyContainer), this.messagesContainer = document.createElement("div"), this.messagesContainer.className = "ttcb-messages", this.messagesContainer.setAttribute("aria-live", "polite"), this.messagesContainer.setAttribute("aria-label", "Chat messages"), this.panel.appendChild(this.messagesContainer), this.modeBanner = document.createElement("div"), this.modeBanner.className = "ttcb-mode-banner", this.modeBannerText = document.createElement("span"), this.modeBannerText.className = "ttcb-mode-banner-text", this.modeBannerText.setAttribute("role", "status"), this.cancelHumanBtn = this.buildBannerButton("Cancel request", () => {
3190
+ t.textContent = Gt(e.primaryColor ?? "#2563EB", e.theme ?? "auto"), this.shadow.appendChild(t), this.fab = document.createElement("button"), this.fab.className = `ttcb-fab ${this.position}`, this.fab.setAttribute("aria-label", "Open chat"), this.fab.innerHTML = Yt(), this.fab.addEventListener("click", () => this.toggle()), this.shadow.appendChild(this.fab), this.panel = document.createElement("div"), this.panel.className = `ttcb-panel ${this.position} hidden ttcb-mode-compact`, this.panel.tabIndex = -1, this.panel.setAttribute("role", "dialog"), this.panel.setAttribute("aria-modal", "true"), this.panel.setAttribute("aria-label", e.chatbotName ?? "AI Assistant"), this.panel.appendChild(this.buildHeader(e)), this.identifyContainer = document.createElement("div"), this.identifyContainer.className = "ttcb-identify", this.buildIdentifyForm(this.identifyContainer), this.panel.appendChild(this.identifyContainer), this.messagesContainer = document.createElement("div"), this.messagesContainer.className = "ttcb-messages", this.messagesContainer.setAttribute("aria-live", "polite"), this.messagesContainer.setAttribute("aria-label", "Chat messages"), this.panel.appendChild(this.messagesContainer), this.modeBanner = document.createElement("div"), this.modeBanner.className = "ttcb-mode-banner", this.modeBannerText = document.createElement("span"), this.modeBannerText.className = "ttcb-mode-banner-text", this.modeBannerText.setAttribute("role", "status"), this.cancelHumanBtn = this.buildBannerButton("Cancel request", () => {
3191
3191
  this.actionPending || this.callbacks.onCancelHumanRequest();
3192
3192
  }), this.cancelHumanBtn.classList.add("hidden"), this.modeBanner.appendChild(this.modeBannerText), this.modeBanner.appendChild(this.cancelHumanBtn), this.panel.appendChild(this.modeBanner), this.panel.appendChild(this.buildConfirmNewBar()), this.footer = document.createElement("div"), this.footer.className = "ttcb-footer", this.pendingTray = document.createElement("div"), this.pendingTray.className = "ttcb-pending-tray", this.pendingTray.setAttribute("role", "list"), this.pendingTray.setAttribute("aria-label", "Files to send"), this.footer.appendChild(this.pendingTray), this.composeError = document.createElement("p"), this.composeError.className = "ttcb-compose-error", this.composeError.setAttribute("role", "alert"), this.footer.appendChild(this.composeError), this.footer.appendChild(this.buildVoiceBar()), this.footer.appendChild(this.buildVoicePreview());
3193
3193
  let n = document.createElement("form");
3194
3194
  n.className = "ttcb-form", n.addEventListener("submit", (e) => {
3195
3195
  e.preventDefault(), this.handleSend();
3196
- }), this.composeForm = n, n.appendChild(this.buildAttachControls()), this.input = document.createElement("input"), this.input.type = "text", this.input.className = "ttcb-input", this.input.placeholder = e.placeholder ?? "Type your message…", this.input.setAttribute("aria-label", "Message input"), this.input.setAttribute("autocomplete", "off"), this.sendBtn = document.createElement("button"), this.sendBtn.type = "submit", this.sendBtn.className = "ttcb-send-btn", this.sendBtn.innerHTML = Xt(), this.sendBtn.setAttribute("aria-label", "Send message"), this.micBtn = document.createElement("button"), this.micBtn.type = "button", this.micBtn.className = "ttcb-mic-btn", this.micBtn.setAttribute("aria-label", "Record voice message"), this.micBtn.title = "Record voice message", this.micBtn.innerHTML = un(), this.micBtn.addEventListener("click", () => void this.startVoice()), n.appendChild(this.input), n.appendChild(this.micBtn), n.appendChild(this.sendBtn), this.footer.appendChild(n), this.panel.appendChild(this.footer), this.shadow.appendChild(this.panel), this.shadow.addEventListener("click", (e) => {
3196
+ }), this.composeForm = n, n.appendChild(this.buildAttachControls()), this.input = document.createElement("input"), this.input.type = "text", this.input.className = "ttcb-input", this.input.placeholder = e.placeholder ?? "Type your message…", this.input.setAttribute("aria-label", "Message input"), this.input.setAttribute("autocomplete", "off"), this.sendBtn = document.createElement("button"), this.sendBtn.type = "submit", this.sendBtn.className = "ttcb-send-btn", this.sendBtn.innerHTML = Zt(), this.sendBtn.setAttribute("aria-label", "Send message"), this.micBtn = document.createElement("button"), this.micBtn.type = "button", this.micBtn.className = "ttcb-mic-btn", this.micBtn.setAttribute("aria-label", "Record voice message"), this.micBtn.title = "Record voice message", this.micBtn.innerHTML = dn(), this.micBtn.addEventListener("click", () => void this.startVoice()), n.appendChild(this.input), n.appendChild(this.micBtn), n.appendChild(this.sendBtn), this.footer.appendChild(n), this.panel.appendChild(this.footer), this.shadow.appendChild(this.panel), this.shadow.addEventListener("click", (e) => {
3197
3197
  let t = e.target;
3198
3198
  this.attachMenuOpen && !(t && (this.attachBtn.contains(t) || this.attachMenu.contains(t))) && this.closeAttachMenu(), this.countryOpen && (t && (this.dialBtn.contains(t) || this.countryPopover.contains(t)) || this.closeCountryPopover());
3199
3199
  }), this.panel.addEventListener("keydown", (e) => {
@@ -3209,13 +3209,13 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3209
3209
  let n = document.createElement("div");
3210
3210
  n.className = "ttcb-avatar-wrap";
3211
3211
  let r = document.createElement("div");
3212
- r.className = "ttcb-avatar", r.innerHTML = Z(), n.appendChild(r);
3212
+ r.className = "ttcb-avatar", r.innerHTML = X(), n.appendChild(r);
3213
3213
  let i = document.createElement("div");
3214
3214
  i.className = "ttcb-header-main";
3215
3215
  let a = document.createElement("div");
3216
3216
  a.className = "ttcb-header-title-row", this.headerTitle = document.createElement("span"), this.headerTitle.className = "ttcb-header-title", this.headerTitle.textContent = e.chatbotName ?? "AI Assistant";
3217
3217
  let o = document.createElement("span");
3218
- o.className = "ttcb-verified", o.setAttribute("aria-label", "Verified"), o.innerHTML = rn(), a.appendChild(this.headerTitle), a.appendChild(o);
3218
+ o.className = "ttcb-verified", o.setAttribute("aria-label", "Verified"), o.innerHTML = an(), a.appendChild(this.headerTitle), a.appendChild(o);
3219
3219
  let s = document.createElement("div");
3220
3220
  s.className = "ttcb-header-meta";
3221
3221
  let c = document.createElement("span");
@@ -3223,13 +3223,13 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3223
3223
  let l = document.createElement("span");
3224
3224
  l.className = "ttcb-meta-sep", l.setAttribute("aria-hidden", "true");
3225
3225
  let u = document.createElement("span");
3226
- u.className = "ttcb-meta-replies", u.innerHTML = `${an()}<span>Replies instantly</span>`, s.appendChild(c), s.appendChild(l), s.appendChild(u), i.appendChild(a), i.appendChild(s);
3226
+ u.className = "ttcb-meta-replies", u.innerHTML = `${on()}<span>Replies instantly</span>`, s.appendChild(c), s.appendChild(l), s.appendChild(u), i.appendChild(a), i.appendChild(s);
3227
3227
  let d = document.createElement("div");
3228
- d.className = "ttcb-header-actions", this.requestHumanBtn = document.createElement("button"), this.requestHumanBtn.type = "button", this.requestHumanBtn.className = "ttcb-request-human-btn hidden", this.requestHumanBtn.id = "ttcb-request-human-btn", this.requestHumanBtn.setAttribute("aria-label", "Request human agent"), this.requestHumanBtn.title = "Request human agent", this.requestHumanBtn.innerHTML = on(), this.requestHumanBtn.addEventListener("click", () => this.callbacks.onRequestHuman()), this.newSessionBtn = document.createElement("button"), this.newSessionBtn.type = "button", this.newSessionBtn.className = "ttcb-new-session-btn hidden", this.newSessionBtn.setAttribute("aria-label", "New conversation"), this.newSessionBtn.title = "New conversation", this.newSessionBtn.innerHTML = qt(), this.newSessionBtn.addEventListener("click", () => {
3228
+ d.className = "ttcb-header-actions", this.requestHumanBtn = document.createElement("button"), this.requestHumanBtn.type = "button", this.requestHumanBtn.className = "ttcb-request-human-btn hidden", this.requestHumanBtn.id = "ttcb-request-human-btn", this.requestHumanBtn.setAttribute("aria-label", "Request human agent"), this.requestHumanBtn.title = "Request human agent", this.requestHumanBtn.innerHTML = sn(), this.requestHumanBtn.addEventListener("click", () => this.callbacks.onRequestHuman()), this.newSessionBtn = document.createElement("button"), this.newSessionBtn.type = "button", this.newSessionBtn.className = "ttcb-new-session-btn hidden", this.newSessionBtn.setAttribute("aria-label", "New conversation"), this.newSessionBtn.title = "New conversation", this.newSessionBtn.innerHTML = Jt(), this.newSessionBtn.addEventListener("click", () => {
3229
3229
  this.actionPending || (this.ticketMode === "closed" ? this.callbacks.onNewConversation() : this.showConfirmNew());
3230
3230
  });
3231
3231
  let f = document.createElement("button");
3232
- return f.className = "ttcb-close-btn", f.setAttribute("aria-label", "Close chat"), f.innerHTML = Yt(), f.addEventListener("click", () => this.close()), d.appendChild(this.requestHumanBtn), d.appendChild(this.newSessionBtn), d.appendChild(f), t.appendChild(n), t.appendChild(i), t.appendChild(d), t;
3232
+ return f.className = "ttcb-close-btn", f.setAttribute("aria-label", "Close chat"), f.innerHTML = Xt(), f.addEventListener("click", () => this.close()), d.appendChild(this.requestHumanBtn), d.appendChild(this.newSessionBtn), d.appendChild(f), t.appendChild(n), t.appendChild(i), t.appendChild(d), t;
3233
3233
  }
3234
3234
  buildBannerButton(e, t) {
3235
3235
  let n = document.createElement("button");
@@ -3262,16 +3262,16 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3262
3262
  }
3263
3263
  buildAttachControls() {
3264
3264
  let e = document.createElement("div");
3265
- e.className = "ttcb-attach", this.attachBtn = document.createElement("button"), this.attachBtn.type = "button", this.attachBtn.className = "ttcb-attach-btn", this.attachBtn.setAttribute("aria-label", "Add attachment"), this.attachBtn.setAttribute("aria-haspopup", "menu"), this.attachBtn.setAttribute("aria-expanded", "false"), this.attachBtn.title = "Add attachment", this.attachBtn.innerHTML = sn(), this.attachBtn.addEventListener("click", (e) => {
3265
+ e.className = "ttcb-attach", this.attachBtn = document.createElement("button"), this.attachBtn.type = "button", this.attachBtn.className = "ttcb-attach-btn", this.attachBtn.setAttribute("aria-label", "Add attachment"), this.attachBtn.setAttribute("aria-haspopup", "menu"), this.attachBtn.setAttribute("aria-expanded", "false"), this.attachBtn.title = "Add attachment", this.attachBtn.innerHTML = cn(), this.attachBtn.addEventListener("click", (e) => {
3266
3266
  e.preventDefault(), e.stopPropagation(), this.toggleAttachMenu();
3267
- }), this.attachMenu = document.createElement("div"), this.attachMenu.className = "ttcb-attach-menu", this.attachMenu.setAttribute("role", "menu"), this.attachFileInput = this.createFileInput(_n, "Choose files"), this.attachPhotoInput = this.createFileInput(vn, "Choose photos");
3267
+ }), this.attachMenu = document.createElement("div"), this.attachMenu.className = "ttcb-attach-menu", this.attachMenu.setAttribute("role", "menu"), this.attachFileInput = this.createFileInput(vn, "Choose files"), this.attachPhotoInput = this.createFileInput(yn, "Choose photos");
3268
3268
  let t = [{
3269
3269
  label: "Attachment",
3270
- icon: cn(),
3270
+ icon: ln(),
3271
3271
  input: this.attachFileInput
3272
3272
  }, {
3273
3273
  label: "Photo",
3274
- icon: ln(),
3274
+ icon: un(),
3275
3275
  input: this.attachPhotoInput
3276
3276
  }];
3277
3277
  for (let e of t) {
@@ -3332,12 +3332,12 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3332
3332
  t.className = "ttcb-pending-thumb", t.src = e.previewUrl, t.alt = "", n.appendChild(t);
3333
3333
  } else {
3334
3334
  let e = document.createElement("span");
3335
- e.className = "ttcb-pending-icon", e.setAttribute("aria-hidden", "true"), e.innerHTML = pn(), n.appendChild(e);
3335
+ e.className = "ttcb-pending-icon", e.setAttribute("aria-hidden", "true"), e.innerHTML = mn(), n.appendChild(e);
3336
3336
  }
3337
3337
  let r = document.createElement("span");
3338
3338
  r.className = "ttcb-pending-name", r.textContent = e.file.name || "attachment", r.title = e.file.name, n.appendChild(r);
3339
3339
  let i = document.createElement("button");
3340
- i.type = "button", i.className = "ttcb-pending-remove", i.setAttribute("aria-label", `Remove ${e.file.name || "attachment"}`), i.innerHTML = Yt(), i.addEventListener("click", () => this.removePendingFile(t)), n.appendChild(i), this.pendingTray.appendChild(n);
3340
+ i.type = "button", i.className = "ttcb-pending-remove", i.setAttribute("aria-label", `Remove ${e.file.name || "attachment"}`), i.innerHTML = Xt(), i.addEventListener("click", () => this.removePendingFile(t)), n.appendChild(i), this.pendingTray.appendChild(n);
3341
3341
  });
3342
3342
  }
3343
3343
  buildVoiceBar() {
@@ -3345,10 +3345,10 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3345
3345
  let e = document.createElement("span");
3346
3346
  e.className = "ttcb-voice-dot", e.setAttribute("aria-hidden", "true"), this.voiceTime = document.createElement("span"), this.voiceTime.className = "ttcb-voice-time", this.voiceTime.setAttribute("role", "timer"), this.voiceTime.textContent = "0:00";
3347
3347
  let t = document.createElement("div");
3348
- return t.className = "ttcb-voice-meter", t.setAttribute("aria-hidden", "true"), this.voiceLevel = document.createElement("span"), this.voiceLevel.className = "ttcb-voice-level", t.appendChild(this.voiceLevel), this.voiceCancelBtn = this.createVoiceButton("Cancel recording", fn(), () => this.cancelVoice()), this.voiceStopBtn = this.createVoiceButton("Stop recording", dn(), () => void this.stopVoice()), this.voiceStopBtn.classList.add("primary"), this.voiceBar.appendChild(e), this.voiceBar.appendChild(this.voiceTime), this.voiceBar.appendChild(t), this.voiceBar.appendChild(this.voiceCancelBtn), this.voiceBar.appendChild(this.voiceStopBtn), this.voiceBar;
3348
+ return t.className = "ttcb-voice-meter", t.setAttribute("aria-hidden", "true"), this.voiceLevel = document.createElement("span"), this.voiceLevel.className = "ttcb-voice-level", t.appendChild(this.voiceLevel), this.voiceCancelBtn = this.createVoiceButton("Cancel recording", pn(), () => this.cancelVoice()), this.voiceStopBtn = this.createVoiceButton("Stop recording", fn(), () => void this.stopVoice()), this.voiceStopBtn.classList.add("primary"), this.voiceBar.appendChild(e), this.voiceBar.appendChild(this.voiceTime), this.voiceBar.appendChild(t), this.voiceBar.appendChild(this.voiceCancelBtn), this.voiceBar.appendChild(this.voiceStopBtn), this.voiceBar;
3349
3349
  }
3350
3350
  buildVoicePreview() {
3351
- return this.voicePreview = document.createElement("div"), this.voicePreview.className = "ttcb-voice-preview", this.voicePreview.setAttribute("role", "group"), this.voicePreview.setAttribute("aria-label", "Voice message preview"), this.voiceAudio = document.createElement("audio"), this.voiceAudio.className = "ttcb-voice-audio", this.voiceAudio.controls = !0, this.voiceAudio.preload = "metadata", this.voiceAudio.setAttribute("aria-label", "Recorded voice message"), this.voicePreviewTime = document.createElement("span"), this.voicePreviewTime.className = "ttcb-voice-time", this.voiceDiscardBtn = this.createVoiceButton("Discard voice message", fn(), () => this.cancelVoice()), this.voiceSendBtn = this.createVoiceButton("Send voice message", Xt(), () => this.sendVoice()), this.voiceSendBtn.classList.add("primary"), this.voicePreview.appendChild(this.voiceAudio), this.voicePreview.appendChild(this.voicePreviewTime), this.voicePreview.appendChild(this.voiceDiscardBtn), this.voicePreview.appendChild(this.voiceSendBtn), this.voicePreview;
3351
+ return this.voicePreview = document.createElement("div"), this.voicePreview.className = "ttcb-voice-preview", this.voicePreview.setAttribute("role", "group"), this.voicePreview.setAttribute("aria-label", "Voice message preview"), this.voiceAudio = document.createElement("audio"), this.voiceAudio.className = "ttcb-voice-audio", this.voiceAudio.controls = !0, this.voiceAudio.preload = "metadata", this.voiceAudio.setAttribute("aria-label", "Recorded voice message"), this.voicePreviewTime = document.createElement("span"), this.voicePreviewTime.className = "ttcb-voice-time", this.voiceDiscardBtn = this.createVoiceButton("Discard voice message", pn(), () => this.cancelVoice()), this.voiceSendBtn = this.createVoiceButton("Send voice message", Zt(), () => this.sendVoice()), this.voiceSendBtn.classList.add("primary"), this.voicePreview.appendChild(this.voiceAudio), this.voicePreview.appendChild(this.voicePreviewTime), this.voicePreview.appendChild(this.voiceDiscardBtn), this.voicePreview.appendChild(this.voiceSendBtn), this.voicePreview;
3352
3352
  }
3353
3353
  createVoiceButton(e, t, n) {
3354
3354
  let r = document.createElement("button");
@@ -3410,7 +3410,7 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3410
3410
  placeholder: "Your name",
3411
3411
  type: "text",
3412
3412
  autocomplete: "name",
3413
- icon: Qt()
3413
+ icon: $t()
3414
3414
  }), this.createPhoneField(t), this.emailInput = this.createIconField(t, {
3415
3415
  id: "email",
3416
3416
  label: "Email (optional)",
@@ -3419,10 +3419,10 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3419
3419
  placeholder: "Email (optional)",
3420
3420
  type: "email",
3421
3421
  autocomplete: "email",
3422
- icon: $t()
3423
- }), this.identifyError = document.createElement("p"), this.identifyError.className = "ttcb-identify-error", t.appendChild(this.identifyError), this.identifySubmit = document.createElement("button"), this.identifySubmit.type = "submit", this.identifySubmit.className = "ttcb-identify-submit", this.identifySubmit.innerHTML = `<span>Start Chatting</span>${tn()}`, t.appendChild(this.identifySubmit), e.appendChild(t);
3422
+ icon: en()
3423
+ }), this.identifyError = document.createElement("p"), this.identifyError.className = "ttcb-identify-error", t.appendChild(this.identifyError), this.identifySubmit = document.createElement("button"), this.identifySubmit.type = "submit", this.identifySubmit.className = "ttcb-identify-submit", this.identifySubmit.innerHTML = `<span>Start Chatting</span>${nn()}`, t.appendChild(this.identifySubmit), e.appendChild(t);
3424
3424
  let n = document.createElement("div");
3425
- n.className = "ttcb-trust", n.innerHTML = `${nn()}<span>Encrypted connection • No spam, ever</span>`, e.appendChild(n);
3425
+ n.className = "ttcb-trust", n.innerHTML = `${rn()}<span>Encrypted connection • No spam, ever</span>`, e.appendChild(n);
3426
3426
  }
3427
3427
  createIconField(e, t) {
3428
3428
  let n = document.createElement("div");
@@ -3452,7 +3452,7 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3452
3452
  let a = document.createElement("div");
3453
3453
  a.className = "ttcb-phone-row", a.id = "ttcb-phone-row", this.dialBtn = document.createElement("button"), this.dialBtn.type = "button", this.dialBtn.className = "ttcb-dial-btn", this.dialBtn.setAttribute("aria-label", "Select country code"), this.dialBtn.setAttribute("aria-haspopup", "listbox"), this.dialBtn.setAttribute("aria-expanded", "false"), this.dialFlag = document.createElement("span"), this.dialFlag.className = "ttcb-dial-flag", this.dialCode = document.createElement("span"), this.dialCode.className = "ttcb-dial-code", this.syncDialButton(), this.dialBtn.appendChild(this.dialFlag), this.dialBtn.appendChild(this.dialCode);
3454
3454
  let o = document.createElement("span");
3455
- o.setAttribute("aria-hidden", "true"), o.innerHTML = en(), this.dialBtn.appendChild(o), this.dialBtn.addEventListener("click", (e) => {
3455
+ o.setAttribute("aria-hidden", "true"), o.innerHTML = tn(), this.dialBtn.appendChild(o), this.dialBtn.addEventListener("click", (e) => {
3456
3456
  e.preventDefault(), e.stopPropagation(), this.toggleCountryPopover();
3457
3457
  }), this.phoneInput = document.createElement("input"), this.phoneInput.id = "ttcb-tel", this.phoneInput.name = "tel", this.phoneInput.type = "tel", this.phoneInput.className = "ttcb-phone-national", this.phoneInput.placeholder = "1712-345678", this.phoneInput.required = !0, this.phoneInput.autocomplete = "tel-national", this.phoneInput.setAttribute("inputmode", "tel"), a.appendChild(this.dialBtn), a.appendChild(this.phoneInput), this.countryPopover = document.createElement("div"), this.countryPopover.className = "ttcb-country-popover", this.countryPopover.setAttribute("role", "listbox"), this.countrySearch = document.createElement("input"), this.countrySearch.type = "search", this.countrySearch.className = "ttcb-country-search", this.countrySearch.placeholder = "Search country…", this.countrySearch.setAttribute("aria-label", "Search countries"), this.countrySearch.addEventListener("input", () => this.renderCountryList()), this.countryList = document.createElement("div"), this.countryList.className = "ttcb-country-list", this.countryPopover.appendChild(this.countrySearch), this.countryPopover.appendChild(this.countryList), this.renderCountryList(), t.appendChild(n), t.appendChild(a), t.appendChild(this.countryPopover), e.appendChild(t);
3458
3458
  }
@@ -3469,7 +3469,7 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3469
3469
  this.countryOpen = !1, this.countryPopover.classList.remove("open"), this.dialBtn.setAttribute("aria-expanded", "false");
3470
3470
  }
3471
3471
  renderCountryList() {
3472
- let e = this.countrySearch.value.trim().toLowerCase(), t = X.filter((t) => !e || t.name.toLowerCase().includes(e) || t.dial.includes(e) || t.iso.toLowerCase().includes(e) || `+${t.dial}`.includes(e));
3472
+ let e = this.countrySearch.value.trim().toLowerCase(), t = Vt.filter((t) => !e || t.name.toLowerCase().includes(e) || t.dial.includes(e) || t.iso.toLowerCase().includes(e) || `+${t.dial}`.includes(e));
3473
3473
  this.countryList.innerHTML = "";
3474
3474
  for (let e of t) {
3475
3475
  let t = document.createElement("button");
@@ -3501,7 +3501,7 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3501
3501
  let t = document.createElement("div");
3502
3502
  t.className = "ttcb-empty", t.id = "ttcb-empty";
3503
3503
  let n = document.createElement("div");
3504
- n.className = "ttcb-empty-icon", n.innerHTML = Z();
3504
+ n.className = "ttcb-empty-icon", n.innerHTML = X();
3505
3505
  let r = document.createElement("p"), i = document.createElement("strong");
3506
3506
  i.textContent = e, r.appendChild(document.createTextNode("Welcome to ")), r.appendChild(i);
3507
3507
  let a = document.createElement("p");
@@ -3521,7 +3521,7 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3521
3521
  }
3522
3522
  }
3523
3523
  handleIdentifySubmit() {
3524
- let e = this.nameInput.value.trim(), t = Ht(this.selectedCountry.dial, this.phoneInput.value), n = this.emailInput.value.trim();
3524
+ let e = this.nameInput.value.trim(), t = Ut(this.selectedCountry.dial, this.phoneInput.value), n = this.emailInput.value.trim();
3525
3525
  !e || !t ? this.showIdentifyError("Name and phone are required.") : (this.showIdentifyError(""), this.callbacks.onIdentify({
3526
3526
  name: e,
3527
3527
  phone: t,
@@ -3542,13 +3542,13 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3542
3542
  }
3543
3543
  buildMessage(e) {
3544
3544
  if ("message" in e) {
3545
- let t = hn({
3545
+ let t = gn({
3546
3546
  ...e.message,
3547
3547
  pending: e.pending
3548
3548
  });
3549
3549
  return t.dataset.msgId = String(e.id), t;
3550
3550
  }
3551
- return hn(e);
3551
+ return gn(e);
3552
3552
  }
3553
3553
  findMessageEl(e) {
3554
3554
  for (let t of this.messagesContainer.querySelectorAll(".ttcb-msg")) if (t.dataset.msgId === String(e)) return t;
@@ -3561,7 +3561,7 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3561
3561
  }
3562
3562
  }
3563
3563
  setLoading(e) {
3564
- if (this.sendBtn.disabled = e || this.input.disabled, this.attachBtn.disabled = e || this.input.disabled, this.micBtn.disabled = e || this.input.disabled, e) this.closeAttachMenu(), this.shadow.getElementById("ttcb-typing") || (this.messagesContainer.appendChild(gn()), this.scrollToBottom()), this.isFullScreen() || this.input.focus();
3564
+ if (this.sendBtn.disabled = e || this.input.disabled, this.attachBtn.disabled = e || this.input.disabled, this.micBtn.disabled = e || this.input.disabled, e) this.closeAttachMenu(), this.shadow.getElementById("ttcb-typing") || (this.messagesContainer.appendChild(_n()), this.scrollToBottom()), this.isFullScreen() || this.input.focus();
3565
3565
  else {
3566
3566
  let e = this.shadow.getElementById("ttcb-typing");
3567
3567
  e && e.remove(), !this.input.disabled && !this.isFullScreen() && this.input.focus();
@@ -3570,7 +3570,7 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3570
3570
  setIdentifyLoading(e) {
3571
3571
  this.identifySubmit.disabled = e, this.nameInput.disabled = e, this.phoneInput.disabled = e, this.emailInput.disabled = e, this.dialBtn.disabled = e, this.shadow.getElementById("ttcb-phone-row")?.classList.toggle("disabled", e);
3572
3572
  for (let t of this.identifyContainer.querySelectorAll(".ttcb-input-wrap")) t.classList.toggle("disabled", e);
3573
- this.identifySubmit.innerHTML = e ? "<span>Starting…</span>" : `<span>Start Chatting</span>${tn()}`, e && this.closeCountryPopover();
3573
+ this.identifySubmit.innerHTML = e ? "<span>Starting…</span>" : `<span>Start Chatting</span>${nn()}`, e && this.closeCountryPopover();
3574
3574
  }
3575
3575
  showIdentifyError(e) {
3576
3576
  this.identifyError.textContent = e;
@@ -3630,7 +3630,7 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3630
3630
  scrollToBottom() {
3631
3631
  this.messagesContainer.scrollTop = this.messagesContainer.scrollHeight;
3632
3632
  }
3633
- }, bn = {
3633
+ }, xn = {
3634
3634
  apiBaseUrl: u,
3635
3635
  chatbotName: "AI Assistant",
3636
3636
  primaryColor: "#2563EB",
@@ -3642,23 +3642,23 @@ var _n = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
3642
3642
  sessionId: "",
3643
3643
  requestTimeoutMs: n
3644
3644
  };
3645
- function xn(e) {
3645
+ function Sn(e) {
3646
3646
  return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
3647
3647
  }
3648
- var Sn = [
3648
+ var Cn = [
3649
3649
  5e3,
3650
3650
  15e3,
3651
3651
  3e4,
3652
3652
  6e4
3653
3653
  ];
3654
- function Cn(e) {
3654
+ function wn(e) {
3655
3655
  return c(e) ? e.status === 0 || e.status >= 500 || e.apiError.code === "BAD_RESPONSE" : !1;
3656
3656
  }
3657
- function wn(e) {
3657
+ function Tn(e) {
3658
3658
  return c(e) ? e.apiError.message : e instanceof Error ? e.message : "Failed to load chatbot config.";
3659
3659
  }
3660
- var Tn = 0, Q = () => Date.now() * 1e3 + Tn++ % 1e3;
3661
- function En(e) {
3660
+ var En = 0, Z = () => Date.now() * 1e3 + En++ % 1e3;
3661
+ function Dn(e) {
3662
3662
  if (!e || typeof e != "object") return null;
3663
3663
  let t = e;
3664
3664
  if (typeof t.textMessage == "string" && t.textMessage.trim()) return t.textMessage.trim();
@@ -3670,7 +3670,7 @@ function En(e) {
3670
3670
  }
3671
3671
  return null;
3672
3672
  }
3673
- function Dn(e) {
3673
+ function Q(e) {
3674
3674
  let t = (e.attachments ?? []).map((e) => e.url).join("");
3675
3675
  return `${e.content}\u0000${t}`;
3676
3676
  }
@@ -3725,8 +3725,8 @@ var kn = class {
3725
3725
  if (!e.apiKey) throw Error("[onedeskpro-chatbot] `apiKey` is required to initialise the chatbot.");
3726
3726
  let t = ++this.initToken;
3727
3727
  this.clearRetry(), this.disconnectSdkSocket(), this.widget?.destroy(), this.widget = null, this.callerSetName = e.chatbotName !== void 0, this.options = {
3728
- ...bn,
3729
- ...xn(e)
3728
+ ...xn,
3729
+ ...Sn(e)
3730
3730
  }, this.apiClient = new l({
3731
3731
  baseUrl: this.options.apiBaseUrl,
3732
3732
  apiKey: this.options.apiKey,
@@ -3748,13 +3748,13 @@ var kn = class {
3748
3748
  n = await this.apiClient.fetchConfig();
3749
3749
  } catch (n) {
3750
3750
  if (e !== this.initToken) return;
3751
- if (Cn(n)) {
3751
+ if (wn(n)) {
3752
3752
  this.setState({
3753
3753
  isReady: !1,
3754
3754
  blockReason: "server-unavailable",
3755
- error: wn(n)
3755
+ error: Tn(n)
3756
3756
  });
3757
- let r = Sn[t];
3757
+ let r = Cn[t];
3758
3758
  if (r !== void 0) {
3759
3759
  this.retryTimer = setTimeout(() => {
3760
3760
  this.retryTimer = null, this.checkReadiness(e, t + 1);
@@ -3775,7 +3775,7 @@ var kn = class {
3775
3775
  }), i ? (this.mountWidget(), this.visitorTokens.setScope(n.agentId), await this.resolveVisitorGate(e), e === this.initToken && (this.widget?.reveal(), this.emitter.emit("ready"))) : this.emitter.emit("ready");
3776
3776
  }
3777
3777
  mountWidget() {
3778
- typeof window < "u" && typeof document < "u" && (this.widget = new yn(this.options, {
3778
+ typeof window < "u" && typeof document < "u" && (this.widget = new bn(this.options, {
3779
3779
  onSend: (e) => void this.sendMessage(e),
3780
3780
  onSendAttachments: (e, t) => void this.sendAttachments(e, t),
3781
3781
  onSendVoice: (e) => void this.sendVoice(e),
@@ -3799,7 +3799,7 @@ var kn = class {
3799
3799
  this.setState({
3800
3800
  isReady: !1,
3801
3801
  blockReason: t,
3802
- error: wn(e)
3802
+ error: Tn(e)
3803
3803
  });
3804
3804
  }
3805
3805
  async resolveVisitorGate(e) {
@@ -3831,7 +3831,7 @@ var kn = class {
3831
3831
  }), this.widget?.readyToChat(this.options), this.connectSdkSocket(e), await this.restoreTicketStatus(e, n);
3832
3832
  }
3833
3833
  connectSdkSocket(e) {
3834
- this.sdkSocket ||= new kt(), this.sdkSocket.connect({
3834
+ this.sdkSocket ||= new Ot(), this.sdkSocket.connect({
3835
3835
  baseUrl: this.options.apiBaseUrl,
3836
3836
  apiKey: this.options.apiKey,
3837
3837
  visitorToken: e,
@@ -3861,16 +3861,16 @@ var kn = class {
3861
3861
  }
3862
3862
  handleMessageReceive(e) {
3863
3863
  if (this._state.mode === "ai") return;
3864
- let t = En(e) ?? "", n = ne(e);
3864
+ let t = Dn(e) ?? "", n = ne(e);
3865
3865
  if (!t && n.length === 0) return;
3866
3866
  let r = On(e), i = this._state.messages[this._state.messages.length - 1];
3867
- if (i && Dn(i.message) === Dn({
3867
+ if (i && Q(i.message) === Q({
3868
3868
  content: t,
3869
3869
  attachments: n
3870
3870
  }) && (i.message.type === "ai" || i.message.type === "agent" && (!r || r === this.lastPushId))) return;
3871
3871
  this.lastPushId = r;
3872
3872
  let a = this.visitorTokens.get() ?? this._state.visitorToken ?? "", o = {
3873
- id: Q(),
3873
+ id: Z(),
3874
3874
  sessionId: a,
3875
3875
  message: {
3876
3876
  type: "agent",
@@ -3992,7 +3992,7 @@ var kn = class {
3992
3992
  let n = e.trim();
3993
3993
  if (!n || this._state.isLoading || this._state.needsIdentify) return;
3994
3994
  let r = {
3995
- id: Q(),
3995
+ id: Z(),
3996
3996
  sessionId: t,
3997
3997
  message: {
3998
3998
  type: "human",
@@ -4064,7 +4064,7 @@ var kn = class {
4064
4064
  }
4065
4065
  async uploadThenDeliver(e) {
4066
4066
  let { visitorToken: t, files: n, previews: r, caption: i } = e, a = {
4067
- id: Q(),
4067
+ id: Z(),
4068
4068
  sessionId: t,
4069
4069
  message: {
4070
4070
  type: "human",
@@ -4111,16 +4111,20 @@ var kn = class {
4111
4111
  try {
4112
4112
  let n = await this.apiClient.sendMessage(e);
4113
4113
  this.hasActiveTicket = !0, this.endedConversationId = null;
4114
- let r = n.mode ?? t, i = [...this._state.messages], a = (n.text ?? "").trim();
4115
- if (r !== t && (this.setState({ mode: r }), this.syncWidgetMode(r), this.emitter.emit("ticket-status", { mode: r })), a) {
4114
+ let r = n.mode ?? t, i = [...this._state.messages], a = (n.text ?? "").trim(), o = ne(n);
4115
+ if (r !== t && (this.setState({ mode: r }), this.syncWidgetMode(r), this.emitter.emit("ticket-status", { mode: r })), a || o.length > 0) {
4116
4116
  let e = i[i.length - 1];
4117
- if (e?.message.type !== "agent" && e?.message.type !== "ai" || e.message.content !== a) {
4117
+ if (e?.message.type !== "agent" && e?.message.type !== "ai" || Q(e.message) !== Q({
4118
+ content: a,
4119
+ attachments: o
4120
+ })) {
4118
4121
  let e = {
4119
- id: Q(),
4122
+ id: Z(),
4120
4123
  sessionId: n.sessionId,
4121
4124
  message: {
4122
4125
  type: "ai",
4123
- content: a
4126
+ content: a,
4127
+ ...o.length > 0 ? { attachments: o } : {}
4124
4128
  }
4125
4129
  };
4126
4130
  i.push(e), this.widget?.appendMessage(e), this.emitter.emit("message", e);
@@ -4179,4 +4183,4 @@ var kn = class {
4179
4183
  return $;
4180
4184
  }
4181
4185
  };
4182
- export { l as ApiClient, kn as ChatbotCore, u as DEFAULT_API_BASE_URL, n as DEFAULT_REQUEST_TIMEOUT_MS, fe as EventEmitter, An as OnedeskProChatbot, f as SDK_CHAT_MAX_ATTACHMENTS, d as SDK_UPLOAD_MAX_BYTES, kt as SdkSocket, Nt as SessionManager, Pt as VOICE_MAX_DURATION_SECONDS, Bt as VoiceRecorder, c as isChatbotRequestError, Ot as resolveSdkSocketUrl };
4186
+ export { l as ApiClient, kn as ChatbotCore, u as DEFAULT_API_BASE_URL, n as DEFAULT_REQUEST_TIMEOUT_MS, fe as EventEmitter, An as OnedeskProChatbot, f as SDK_CHAT_MAX_ATTACHMENTS, d as SDK_UPLOAD_MAX_BYTES, Ot as SdkSocket, Nt as SessionManager, Pt as VOICE_MAX_DURATION_SECONDS, Bt as VoiceRecorder, c as isChatbotRequestError, Dt as resolveSdkSocketUrl };