deep-chat-dev 9.0.124 → 9.0.125

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/deepChat.js CHANGED
@@ -435,7 +435,7 @@ var ln = "Make sure the events are using {text: string} or {html: string} format
435
435
  return Wn;
436
436
  }();
437
437
  Vn.CODE_SNIPPET_GENERATION_JUMP = 0.5;
438
- var Z = Vn;
438
+ var G = Vn;
439
439
  var Jn = /*#__PURE__*/function () {
440
440
  function $n() {
441
441
  _classCallCheck(this, $n);
@@ -1209,14 +1209,14 @@ Wi.prototype.render = function (s, e, t) {
1209
1209
  for (var i = this.rules, n = s.length, r = -1, o = ""; ++r < n;) s[r].type === "inline" ? o += this.renderInline(s[r].children, e, t) : o += i[s[r].type](s, r, e, t, this);
1210
1210
  return o;
1211
1211
  };
1212
- function V() {
1212
+ function W() {
1213
1213
  this.__rules__ = [], this.__cache__ = null;
1214
1214
  }
1215
- V.prototype.__find__ = function (s) {
1215
+ W.prototype.__find__ = function (s) {
1216
1216
  for (var e = this.__rules__.length, t = -1; e--;) if (this.__rules__[++t].name === s) return t;
1217
1217
  return -1;
1218
1218
  };
1219
- V.prototype.__compile__ = function () {
1219
+ W.prototype.__compile__ = function () {
1220
1220
  var s = this,
1221
1221
  e = [""];
1222
1222
  s.__rules__.forEach(function (t) {
@@ -1229,13 +1229,13 @@ V.prototype.__compile__ = function () {
1229
1229
  });
1230
1230
  });
1231
1231
  };
1232
- V.prototype.at = function (s, e, t) {
1232
+ W.prototype.at = function (s, e, t) {
1233
1233
  var i = this.__find__(s),
1234
1234
  n = t || {};
1235
1235
  if (i === -1) throw new Error("Parser rule not found: " + s);
1236
1236
  this.__rules__[i].fn = e, this.__rules__[i].alt = n.alt || [], this.__cache__ = null;
1237
1237
  };
1238
- V.prototype.before = function (s, e, t, i) {
1238
+ W.prototype.before = function (s, e, t, i) {
1239
1239
  var n = this.__find__(s),
1240
1240
  r = i || {};
1241
1241
  if (n === -1) throw new Error("Parser rule not found: " + s);
@@ -1246,7 +1246,7 @@ V.prototype.before = function (s, e, t, i) {
1246
1246
  alt: r.alt || []
1247
1247
  }), this.__cache__ = null;
1248
1248
  };
1249
- V.prototype.after = function (s, e, t, i) {
1249
+ W.prototype.after = function (s, e, t, i) {
1250
1250
  var n = this.__find__(s),
1251
1251
  r = i || {};
1252
1252
  if (n === -1) throw new Error("Parser rule not found: " + s);
@@ -1257,7 +1257,7 @@ V.prototype.after = function (s, e, t, i) {
1257
1257
  alt: r.alt || []
1258
1258
  }), this.__cache__ = null;
1259
1259
  };
1260
- V.prototype.push = function (s, e, t) {
1260
+ W.prototype.push = function (s, e, t) {
1261
1261
  var i = t || {};
1262
1262
  this.__rules__.push({
1263
1263
  name: s,
@@ -1266,7 +1266,7 @@ V.prototype.push = function (s, e, t) {
1266
1266
  alt: i.alt || []
1267
1267
  }), this.__cache__ = null;
1268
1268
  };
1269
- V.prototype.enable = function (s, e) {
1269
+ W.prototype.enable = function (s, e) {
1270
1270
  s = Array.isArray(s) ? s : [s], e && this.__rules__.forEach(function (t) {
1271
1271
  t.enabled = !1;
1272
1272
  }), s.forEach(function (t) {
@@ -1275,14 +1275,14 @@ V.prototype.enable = function (s, e) {
1275
1275
  this.__rules__[i].enabled = !0;
1276
1276
  }, this), this.__cache__ = null;
1277
1277
  };
1278
- V.prototype.disable = function (s) {
1278
+ W.prototype.disable = function (s) {
1279
1279
  s = Array.isArray(s) ? s : [s], s.forEach(function (e) {
1280
1280
  var t = this.__find__(e);
1281
1281
  if (t < 0) throw new Error("Rules manager: invalid rule name " + e);
1282
1282
  this.__rules__[t].enabled = !1;
1283
1283
  }, this), this.__cache__ = null;
1284
1284
  };
1285
- V.prototype.getRules = function (s) {
1285
+ W.prototype.getRules = function (s) {
1286
1286
  return this.__cache__ === null && this.__compile__(), this.__cache__[s] || [];
1287
1287
  };
1288
1288
  function Hs(s) {
@@ -1602,7 +1602,7 @@ function sr(s) {
1602
1602
  }
1603
1603
  var Ti = [["block", Hs], ["abbr", Vs], ["references", Js], ["inline", $s], ["footnote_tail", Ks], ["abbr2", Ys], ["replacements", tr], ["smartquotes", sr]];
1604
1604
  function ss() {
1605
- this.options = {}, this.ruler = new V();
1605
+ this.options = {}, this.ruler = new W();
1606
1606
  for (var s = 0; s < Ti.length; s++) this.ruler.push(Ti[s][0], Ti[s][1]);
1607
1607
  }
1608
1608
  ss.prototype.process = function (s) {
@@ -1792,9 +1792,9 @@ function dr(s, e, t, i) {
1792
1792
  f,
1793
1793
  E,
1794
1794
  S,
1795
- W,
1796
- k,
1797
1795
  J,
1796
+ k,
1797
+ $,
1798
1798
  Q,
1799
1799
  le = !0,
1800
1800
  H,
@@ -1804,14 +1804,14 @@ function dr(s, e, t, i) {
1804
1804
  if ((u = bn(s, e)) >= 0) E = !0;else if ((u = gn(s, e)) >= 0) E = !1;else return !1;
1805
1805
  if (s.level >= s.options.maxNesting) return !1;
1806
1806
  if (f = s.src.charCodeAt(u - 1), i) return !0;
1807
- for (W = s.tokens.length, E ? (d = s.bMarks[e] + s.tShift[e], g = Number(s.src.substr(d, u - d - 1)), s.tokens.push({
1807
+ for (J = s.tokens.length, E ? (d = s.bMarks[e] + s.tShift[e], g = Number(s.src.substr(d, u - d - 1)), s.tokens.push({
1808
1808
  type: "ordered_list_open",
1809
1809
  order: g,
1810
- lines: J = [e, 0],
1810
+ lines: $ = [e, 0],
1811
1811
  level: s.level++
1812
1812
  })) : s.tokens.push({
1813
1813
  type: "bullet_list_open",
1814
- lines: J = [e, 0],
1814
+ lines: $ = [e, 0],
1815
1815
  level: s.level++
1816
1816
  }), n = e, k = !1, H = s.parser.ruler.getRules("list"); n < t && (S = s.skipSpaces(u), h = s.eMarks[n], S >= h ? p = 1 : p = S - u, p > 4 && (p = 1), p < 1 && (p = 1), r = u - s.bMarks[n] + p, s.tokens.push({
1817
1817
  type: "list_item_open",
@@ -1834,7 +1834,7 @@ function dr(s, e, t, i) {
1834
1834
  return s.tokens.push({
1835
1835
  type: E ? "ordered_list_close" : "bullet_list_close",
1836
1836
  level: --s.level
1837
- }), J[1] = n, s.line = n, le && cr(s, W), !0;
1837
+ }), $[1] = n, s.line = n, le && cr(s, J), !0;
1838
1838
  }
1839
1839
  function ur(s, e, t, i) {
1840
1840
  var n,
@@ -2116,7 +2116,7 @@ function Er(s, e) {
2116
2116
  }
2117
2117
  var Ot = [["code", rr], ["fences", or, ["paragraph", "blockquote", "list"]], ["blockquote", ar, ["paragraph", "blockquote", "list"]], ["hr", lr, ["paragraph", "blockquote", "list"]], ["list", dr, ["paragraph", "blockquote"]], ["footnote", ur, ["paragraph"]], ["heading", hr, ["paragraph", "blockquote"]], ["lheading", pr], ["htmlblock", br, ["paragraph", "blockquote"]], ["table", vr, ["paragraph"]], ["deflist", xr, ["paragraph"]], ["paragraph", Er]];
2118
2118
  function Ji() {
2119
- this.ruler = new V();
2119
+ this.ruler = new W();
2120
2120
  for (var s = 0; s < Ot.length; s++) this.ruler.push(Ot[s][0], Ot[s][1], {
2121
2121
  alt: (Ot[s][2] || []).slice()
2122
2122
  });
@@ -2601,7 +2601,7 @@ function lo(s, e) {
2601
2601
  }
2602
2602
  var Ai = [["text", Tr], ["newline", Cr], ["escape", Ar], ["backticks", kr], ["del", Ir], ["ins", Lr], ["mark", Rr], ["emphasis", Nr], ["sub", Pr], ["sup", jr], ["links", Fr], ["footnote_inline", Br], ["footnote_ref", zr], ["autolink", Gr], ["htmltag", ro], ["entity", lo]];
2603
2603
  function si() {
2604
- this.ruler = new V();
2604
+ this.ruler = new W();
2605
2605
  for (var s = 0; s < Ai.length; s++) this.ruler.push(Ai[s][0], Ai[s][1]);
2606
2606
  this.validateLink = co;
2607
2607
  }
@@ -2759,7 +2759,7 @@ function os(s, e, t) {
2759
2759
  this.src = e, this.env = t, this.options = s.options, this.tokens = [], this.inlineMode = !1, this.inline = s.inline, this.block = s.block, this.renderer = s.renderer, this.typographer = s.typographer;
2760
2760
  }
2761
2761
  function pe(s, e) {
2762
- typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new si(), this.block = new Ji(), this.core = new ss(), this.renderer = new Wi(), this.ruler = new V(), this.options = {}, this.configure(fo[s]), this.set(e || {});
2762
+ typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new si(), this.block = new Ji(), this.core = new ss(), this.renderer = new Wi(), this.ruler = new W(), this.options = {}, this.configure(fo[s]), this.set(e || {});
2763
2763
  }
2764
2764
  pe.prototype.set = function (s) {
2765
2765
  Xn(this.options, s);
@@ -3038,7 +3038,7 @@ var Ye = /*#__PURE__*/function () {
3038
3038
  var _this4 = this;
3039
3039
  var i = this.createNewMessageElement(e, t);
3040
3040
  return this.elementRef.appendChild(i.outerContainer), setTimeout(function () {
3041
- return Z.scrollToBottom(_this4.elementRef);
3041
+ return G.scrollToBottom(_this4.elementRef);
3042
3042
  }), i;
3043
3043
  }
3044
3044
  }, {
@@ -3159,19 +3159,21 @@ var Ki = /*#__PURE__*/function () {
3159
3159
  if (this._hasStreamEnded) return;
3160
3160
  if ((e == null ? void 0 : e.text) === void 0 && (e == null ? void 0 : e.html) === void 0) return console.error(A.INVALID_STREAM_EVENT);
3161
3161
  var t = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.html) || "",
3162
- i = Z.isScrollbarAtBottomOfElement(this._messages.elementRef),
3162
+ i = G.isScrollbarAtBottomOfElement(this._messages.elementRef),
3163
3163
  n = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
3164
3164
  if (!this._elements && this._streamedContent === "") this.setInitialState(n, t, e == null ? void 0 : e.role);else {
3165
3165
  if (this._streamType !== n) return console.error(A.INVALID_STREAM_EVENT_MIX);
3166
3166
  this.updateBasedOnType(t, n, (r = this._elements) == null ? void 0 : r.bubbleElement, e == null ? void 0 : e.overwrite);
3167
3167
  }
3168
- i && Z.scrollToBottom(this._messages.elementRef);
3168
+ i && G.scrollToBottom(this._messages.elementRef);
3169
3169
  }
3170
3170
  }, {
3171
3171
  key: "setInitialState",
3172
3172
  value: function setInitialState(e, t, i) {
3173
3173
  var _i8;
3174
- this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : Qe.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(ot.MESSAGE_CLASS), this._streamedContent = t, this._activeMessageRole = i;
3174
+ this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : Qe.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(ot.MESSAGE_CLASS), this._streamedContent = t, this._activeMessageRole = i, this._message = _defineProperty({
3175
+ role: this._activeMessageRole
3176
+ }, e, this._streamedContent), this._messages.messages.push(this._message);
3175
3177
  }
3176
3178
  }, {
3177
3179
  key: "updateBasedOnType",
@@ -3195,15 +3197,12 @@ var Ki = /*#__PURE__*/function () {
3195
3197
  }, {
3196
3198
  key: "finaliseStreamedMessage",
3197
3199
  value: function finaliseStreamedMessage() {
3198
- var i, n;
3200
+ var t, i;
3199
3201
  var e = this._messages.textElementsToText;
3200
- if (this._fileAdded && !this._elements) return;
3201
- if (!this._elements) throw Error(A.NO_VALID_STREAM_EVENTS_SENT);
3202
- if (!((i = this._elements.bubbleElement) != null && i.classList.contains(ot.MESSAGE_CLASS))) return;
3203
- var t = {
3204
- role: this._activeMessageRole || b.AI_ROLE
3205
- };
3206
- this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, t.text = this._streamedContent, this._messages.textToSpeech && jt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === ot.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((n = this._elements.bubbleElement) == null ? void 0 : n.innerHTML) || ""), this._elements && oe.apply(this._messages, this._elements.outerContainer), t.html = this._streamedContent), t && (this._messages.messages.push(t), this._messages.sendClientUpdate(Ye.createMessageContent(t), !1)), this._hasStreamEnded = !0;
3202
+ if (!(this._fileAdded && !this._elements)) {
3203
+ if (!this._elements) throw Error(A.NO_VALID_STREAM_EVENTS_SENT);
3204
+ (t = this._elements.bubbleElement) != null && t.classList.contains(ot.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._message && (this._message.text = this._streamedContent), this._messages.textToSpeech && jt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === ot.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((i = this._elements.bubbleElement) == null ? void 0 : i.innerHTML) || ""), this._elements && oe.apply(this._messages, this._elements.outerContainer), this._message && (this._message.html = this._streamedContent)), this._message && this._messages.sendClientUpdate(Ye.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
3205
+ }
3207
3206
  }
3208
3207
  }, {
3209
3208
  key: "markFileAded",
@@ -3350,29 +3349,29 @@ function mo(_x10, _x11) {
3350
3349
  return _mo.apply(this, arguments);
3351
3350
  }
3352
3351
  function _mo() {
3353
- _mo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee107(s, e) {
3352
+ _mo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee111(s, e) {
3354
3353
  var t, i;
3355
- return _regeneratorRuntime().wrap(function _callee107$(_context107) {
3356
- while (1) switch (_context107.prev = _context107.next) {
3354
+ return _regeneratorRuntime().wrap(function _callee111$(_context111) {
3355
+ while (1) switch (_context111.prev = _context111.next) {
3357
3356
  case 0:
3358
3357
  t = s.getReader();
3359
3358
  case 1:
3360
- _context107.next = 3;
3359
+ _context111.next = 3;
3361
3360
  return t.read();
3362
3361
  case 3:
3363
- if ((i = _context107.sent).done) {
3364
- _context107.next = 7;
3362
+ if ((i = _context111.sent).done) {
3363
+ _context111.next = 7;
3365
3364
  break;
3366
3365
  }
3367
3366
  e(i.value);
3368
3367
  case 5:
3369
- _context107.next = 1;
3368
+ _context111.next = 1;
3370
3369
  break;
3371
3370
  case 7:
3372
3371
  case "end":
3373
- return _context107.stop();
3372
+ return _context111.stop();
3374
3373
  }
3375
- }, _callee107);
3374
+ }, _callee111);
3376
3375
  }));
3377
3376
  return _mo.apply(this, arguments);
3378
3377
  }
@@ -3471,14 +3470,14 @@ function Eo(s, e) {
3471
3470
  l || document.addEventListener("visibilitychange", f);
3472
3471
  var E = xo,
3473
3472
  S = 0;
3474
- function W() {
3473
+ function J() {
3475
3474
  document.removeEventListener("visibilitychange", f), window.clearTimeout(S), g.abort();
3476
3475
  }
3477
3476
  t == null || t.addEventListener("abort", function () {
3478
- W(), u();
3477
+ J(), u();
3479
3478
  });
3480
3479
  var k = c !== null && c !== void 0 ? c : window.fetch,
3481
- J = n !== null && n !== void 0 ? n : _o;
3480
+ $ = n !== null && n !== void 0 ? n : _o;
3482
3481
  function Q() {
3483
3482
  return _Q.apply(this, arguments);
3484
3483
  }
@@ -3498,7 +3497,7 @@ function Eo(s, e) {
3498
3497
  case 4:
3499
3498
  H = _context3.sent;
3500
3499
  _context3.next = 7;
3501
- return J(H);
3500
+ return $(H);
3502
3501
  case 7:
3503
3502
  _context3.next = 9;
3504
3503
  return mo(H.body, go(bo(function (O) {
@@ -3508,7 +3507,7 @@ function Eo(s, e) {
3508
3507
  }, r)));
3509
3508
  case 9:
3510
3509
  o == null || o();
3511
- W();
3510
+ J();
3512
3511
  u();
3513
3512
  _context3.next = 17;
3514
3513
  break;
@@ -3519,7 +3518,7 @@ function Eo(s, e) {
3519
3518
  O = (le = a == null ? void 0 : a(_context3.t0)) !== null && le !== void 0 ? le : E;
3520
3519
  window.clearTimeout(S), S = window.setTimeout(Q, O);
3521
3520
  } catch (O) {
3522
- W(), h(O);
3521
+ J(), h(O);
3523
3522
  }
3524
3523
  case 17:
3525
3524
  case "end":
@@ -3551,7 +3550,7 @@ var T = /*#__PURE__*/function () {
3551
3550
  f,
3552
3551
  E,
3553
3552
  S,
3554
- W,
3553
+ J,
3555
3554
  r,
3556
3555
  _yield$_$processReque,
3557
3556
  o,
@@ -3604,7 +3603,7 @@ var T = /*#__PURE__*/function () {
3604
3603
  Eo(((E = e.requestSettings) == null ? void 0 : E.url) || e.url || "", {
3605
3604
  method: ((S = e.requestSettings) == null ? void 0 : S.method) || "POST",
3606
3605
  headers: a,
3607
- credentials: (W = e.requestSettings) == null ? void 0 : W.credentials,
3606
+ credentials: (J = e.requestSettings) == null ? void 0 : J.credentials,
3608
3607
  body: n ? JSON.stringify(o) : o,
3609
3608
  openWhenHidden: !0,
3610
3609
  // keep stream open when browser tab not open
@@ -3632,7 +3631,7 @@ var T = /*#__PURE__*/function () {
3632
3631
  },
3633
3632
  onmessage: function onmessage(k) {
3634
3633
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
3635
- var J, Q, le, H, O;
3634
+ var $, Q, le, H, O;
3636
3635
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
3637
3636
  while (1) switch (_context5.prev = _context5.next) {
3638
3637
  case 0:
@@ -3646,7 +3645,7 @@ var T = /*#__PURE__*/function () {
3646
3645
  H = {};
3647
3646
  }
3648
3647
  _context5.next = 4;
3649
- return (Q = (J = e.deepChat).responseInterceptor) == null ? void 0 : Q.call(J, H);
3648
+ return (Q = ($ = e.deepChat).responseInterceptor) == null ? void 0 : Q.call($, H);
3650
3649
  case 4:
3651
3650
  _context5.t0 = _context5.sent;
3652
3651
  if (_context5.t0) {
@@ -3676,8 +3675,8 @@ var T = /*#__PURE__*/function () {
3676
3675
  },
3677
3676
  signal: u.signal
3678
3677
  })["catch"](function (k) {
3679
- var J;
3680
- (J = e.extractResultData) == null || J.call(e, k).then(function () {
3678
+ var $;
3679
+ ($ = e.extractResultData) == null || $.call(e, k).then(function () {
3681
3680
  _.displayError(i, k);
3682
3681
  })["catch"](function (Q) {
3683
3682
  _.displayError(i, Q);
@@ -4106,7 +4105,7 @@ var ue = /*#__PURE__*/function () {
4106
4105
  n && (ue.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), n = !1);
4107
4106
  },
4108
4107
  c = function c(p) {
4109
- n && (!p || _typeof(p) != "object" ? console.error(A.INVALID_RESPONSE(p, "server", !1)) : p.error ? (console.error(p.error), i.addNewErrorMessage("service", p.error), e.streamHandlers.onClose(), n = !1) : T.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, p));
4108
+ n && (!p || _typeof(p) != "object" ? console.error(A.INVALID_RESPONSE(p, "server", !1)) : p.error ? (console.error(p.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", p.error), e.streamHandlers.onClose(), n = !1) : T.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, p));
4110
4109
  };
4111
4110
  e.streamHandlers.abortStream.abort = function () {
4112
4111
  ue.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), n = !1;
@@ -4265,7 +4264,7 @@ var w = /*#__PURE__*/function () {
4265
4264
  return _.processResponseByType(f);
4266
4265
  }).then( /*#__PURE__*/function () {
4267
4266
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(f) {
4268
- var W, k, E, S;
4267
+ var J, k, E, S;
4269
4268
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
4270
4269
  while (1) switch (_context13.prev = _context13.next) {
4271
4270
  case 0:
@@ -4276,7 +4275,7 @@ var w = /*#__PURE__*/function () {
4276
4275
  return _context13.abrupt("return");
4277
4276
  case 2:
4278
4277
  _context13.next = 4;
4279
- return (k = (W = e.deepChat).responseInterceptor) == null ? void 0 : k.call(W, f);
4278
+ return (k = (J = e.deepChat).responseInterceptor) == null ? void 0 : k.call(J, f);
4280
4279
  case 4:
4281
4280
  _context13.t0 = _context13.sent;
4282
4281
  if (_context13.t0) {
@@ -4934,17 +4933,17 @@ Yi._attributeToProperty_ = {};
4934
4933
  var So = Yi;
4935
4934
  var wo = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path d=\"\n\t\t\tM669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536\n\t\t\tc-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764\n\t\t\tc59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033\n\t\t\tl-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888\n\t\t\tc0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541\n\t\t\tc103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174\n\t\t\tc31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763\n\t\t\tc-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z\n\t\t\tM599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897\n\t\t\tc0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854\n\t\t\tc-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513\n\t\t\tL638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z\"\n\t\t\t/>\n</svg>\n",
4936
4935
  Mo = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path id=\"path6686\" inkscape:connector-curvature=\"0\" d=\"M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612\n\t\t\tc-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612\n\t\t\tC699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.904,73.557\n\t\t\tc-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763\n\t\t\tc59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557\n\t\t\tc103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179\n\t\t\tc31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764\n\t\t\tc-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769\n\t\t\tc156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02\n\t\t\tC317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z\"/>\n</svg>\n";
4937
- var G = /*#__PURE__*/function () {
4938
- function G() {
4939
- _classCallCheck(this, G);
4936
+ var V = /*#__PURE__*/function () {
4937
+ function V() {
4938
+ _classCallCheck(this, V);
4940
4939
  }
4941
- _createClass(G, null, [{
4940
+ _createClass(V, null, [{
4942
4941
  key: "createSVGElement",
4943
4942
  value: function createSVGElement(e) {
4944
4943
  return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
4945
4944
  }
4946
4945
  }]);
4947
- return G;
4946
+ return V;
4948
4947
  }();
4949
4948
  var ds = /*#__PURE__*/function () {
4950
4949
  function $e() {
@@ -4960,7 +4959,7 @@ var ds = /*#__PURE__*/function () {
4960
4959
  }, {
4961
4960
  key: "createIconElement",
4962
4961
  value: function createIconElement(e, t) {
4963
- var i = G.createSVGElement(e);
4962
+ var i = V.createSVGElement(e);
4964
4963
  return i.id = t, i.classList.add("visibility-icon"), i;
4965
4964
  }
4966
4965
  // prettier-ignore
@@ -5344,7 +5343,7 @@ var wn = {
5344
5343
  var t;
5345
5344
  ((t = this._webModel.introMessage) == null ? void 0 : t.autoScroll) !== !1 && setTimeout(function () {
5346
5345
  var i, n;
5347
- (i = _this13._messages) != null && i.elementRef && Z.scrollToTop((n = _this13._messages) == null ? void 0 : n.elementRef);
5346
+ (i = _this13._messages) != null && i.elementRef && G.scrollToTop((n = _this13._messages) == null ? void 0 : n.elementRef);
5348
5347
  }, e);
5349
5348
  }
5350
5349
  // prettier-ignore
@@ -5476,7 +5475,7 @@ var wn = {
5476
5475
  sendUpdate: !1
5477
5476
  }), i && (setTimeout(function () {
5478
5477
  var f;
5479
- return Z.scrollToBottom((f = _this14._messages) == null ? void 0 : f.elementRef);
5478
+ return G.scrollToBottom((f = _this14._messages) == null ? void 0 : f.elementRef);
5480
5479
  }), i = !1);
5481
5480
  };
5482
5481
  M.chat.setInitProgressCallback(n);
@@ -8232,11 +8231,12 @@ var be = /*#__PURE__*/function () {
8232
8231
  fileId: t.image_file.file_id
8233
8232
  }), i;
8234
8233
  }
8234
+ // prettier-ignore
8235
8235
  }, {
8236
8236
  key: "getFilesAndNewText",
8237
8237
  value: function () {
8238
- var _getFilesAndNewText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(e, t, i) {
8239
- var r, o, n;
8238
+ var _getFilesAndNewText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(e, t, i, n) {
8239
+ var o, a, r;
8240
8240
  return _regeneratorRuntime().wrap(function _callee77$(_context77) {
8241
8241
  while (1) switch (_context77.prev = _context77.next) {
8242
8242
  case 0:
@@ -8248,17 +8248,18 @@ var be = /*#__PURE__*/function () {
8248
8248
  _context77.next = 4;
8249
8249
  return be.getFiles(e, t);
8250
8250
  case 4:
8251
- n = _context77.sent;
8252
- (r = i == null ? void 0 : i.text) != null && r.value && n.forEach(function (a, l) {
8253
- var d;
8254
- if (!a.src) return;
8255
- var c = t[l].path;
8256
- (d = i == null ? void 0 : i.text) != null && d.value && c && (i.text.value = i.text.value.replace(c, a.src));
8251
+ r = _context77.sent;
8252
+ (o = n == null ? void 0 : n.text) != null && o.value && r.forEach(function (l, c) {
8253
+ var u;
8254
+ if (!l.src) return;
8255
+ var d = t[c].path;
8256
+ (u = n == null ? void 0 : n.text) != null && u.value && d && (n.text.value = n.text.value.replace(d, l.src));
8257
8257
  });
8258
8258
  case 6:
8259
8259
  return _context77.abrupt("return", {
8260
- files: n,
8261
- text: (o = i == null ? void 0 : i.text) == null ? void 0 : o.value
8260
+ files: r,
8261
+ text: (a = n == null ? void 0 : n.text) == null ? void 0 : a.value,
8262
+ role: i
8262
8263
  });
8263
8264
  case 7:
8264
8265
  case "end":
@@ -8266,7 +8267,7 @@ var be = /*#__PURE__*/function () {
8266
8267
  }
8267
8268
  }, _callee77);
8268
8269
  }));
8269
- function getFilesAndNewText(_x142, _x143, _x144) {
8270
+ function getFilesAndNewText(_x142, _x143, _x144, _x145) {
8270
8271
  return _getFilesAndNewText.apply(this, arguments);
8271
8272
  }
8272
8273
  return getFilesAndNewText;
@@ -8281,7 +8282,7 @@ var be = /*#__PURE__*/function () {
8281
8282
  case 0:
8282
8283
  n = be.getFileDetails(t, i);
8283
8284
  _context78.next = 3;
8284
- return be.getFilesAndNewText(e, n, i);
8285
+ return be.getFilesAndNewText(e, n, t.role, i);
8285
8286
  case 3:
8286
8287
  return _context78.abrupt("return", _context78.sent);
8287
8288
  case 4:
@@ -8290,7 +8291,7 @@ var be = /*#__PURE__*/function () {
8290
8291
  }
8291
8292
  }, _callee78);
8292
8293
  }));
8293
- function getFilesAndText(_x145, _x146, _x147) {
8294
+ function getFilesAndText(_x146, _x147, _x148) {
8294
8295
  return _getFilesAndText.apply(this, arguments);
8295
8296
  }
8296
8297
  return getFilesAndText;
@@ -8301,26 +8302,64 @@ var be = /*#__PURE__*/function () {
8301
8302
  var ai = /*#__PURE__*/function (_q10) {
8302
8303
  _inherits(se, _q10);
8303
8304
  function se(e) {
8304
- var _c$headers, _d$OpenAIBeta;
8305
+ var _a$headers, _l$OpenAIBeta;
8305
8306
  var _this36;
8306
8307
  _classCallCheck(this, se);
8307
- var r, o, a, l, c, d;
8308
+ var r, o, a, l;
8308
8309
  var t = JSON.parse(JSON.stringify(e.directConnection)),
8309
8310
  i = t.openAI;
8310
8311
  _this36 = _callSuper(this, se, [e, N.buildKeyVerificationDetails(), N.buildHeaders, i]), _this36.insertKeyPlaceholderText = "OpenAI API Key", _this36.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this36.url = "", _this36.permittedErrorPrefixes = ["Incorrect"], _this36.searchedForThreadId = !1, _this36.config = {}, _this36.newAssistantDetails = {
8311
8312
  model: "gpt-4"
8312
- };
8313
+ }, _this36.shouldFetchHistory = !1;
8313
8314
  var n = (r = t.openAI) == null ? void 0 : r.assistant;
8314
8315
  if (_typeof(n) == "object") {
8315
- _this36.config = n, Object.assign(_this36.newAssistantDetails, _this36.config.new_assistant);
8316
- var _ref10 = (a = (o = e.directConnection) == null ? void 0 : o.openAI) == null ? void 0 : a.assistant,
8317
- u = _ref10.function_handler;
8318
- u && (_this36._functionHandler = u);
8319
- } else (l = t.openAI) != null && l.assistant && (t.openAI.assistant = n);
8320
- (_c$headers = (c = _this36.requestSettings).headers) !== null && _c$headers !== void 0 ? _c$headers : c.headers = {}, (_d$OpenAIBeta = (d = _this36.requestSettings.headers)["OpenAI-Beta"]) !== null && _d$OpenAIBeta !== void 0 ? _d$OpenAIBeta : d["OpenAI-Beta"] = "assistants=v1", _this36.maxMessages = 1;
8316
+ _this36.config = n;
8317
+ var _this36$config = _this36.config,
8318
+ c = _this36$config.new_assistant,
8319
+ d = _this36$config.thread_id,
8320
+ u = _this36$config.load_thread_history,
8321
+ h = _this36$config.function_handler;
8322
+ Object.assign(_this36.newAssistantDetails, c), d && (_this36.sessionId = d), u && (_this36.shouldFetchHistory = !0), h && (_this36._functionHandler = h);
8323
+ } else (o = t.openAI) != null && o.assistant && (t.openAI.assistant = n);
8324
+ (_a$headers = (a = _this36.requestSettings).headers) !== null && _a$headers !== void 0 ? _a$headers : a.headers = {}, (_l$OpenAIBeta = (l = _this36.requestSettings.headers)["OpenAI-Beta"]) !== null && _l$OpenAIBeta !== void 0 ? _l$OpenAIBeta : l["OpenAI-Beta"] = "assistants=v1", _this36.maxMessages = 1, _this36.shouldFetchHistory && _this36.sessionId && (_this36.fetchHistory = _this36.fetchHistoryFunc);
8321
8325
  return _this36;
8322
8326
  }
8323
8327
  _createClass(se, [{
8328
+ key: "fetchHistoryFunc",
8329
+ value: function () {
8330
+ var _fetchHistoryFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79() {
8331
+ var _this37 = this;
8332
+ var e;
8333
+ return _regeneratorRuntime().wrap(function _callee79$(_context79) {
8334
+ while (1) switch (_context79.prev = _context79.next) {
8335
+ case 0:
8336
+ setTimeout(function () {
8337
+ return _this37.deepChat.disableSubmitButton();
8338
+ }, 2);
8339
+ _context79.prev = 1;
8340
+ _context79.next = 4;
8341
+ return this.getThreadMessages(this.sessionId, !0);
8342
+ case 4:
8343
+ e = _context79.sent;
8344
+ return _context79.abrupt("return", (this.deepChat.disableSubmitButton(!1), e.reverse()));
8345
+ case 8:
8346
+ _context79.prev = 8;
8347
+ _context79.t0 = _context79["catch"](1);
8348
+ return _context79.abrupt("return", [{
8349
+ error: "failed to fetch thread history"
8350
+ }]);
8351
+ case 11:
8352
+ case "end":
8353
+ return _context79.stop();
8354
+ }
8355
+ }, _callee79, this, [[1, 8]]);
8356
+ }));
8357
+ function fetchHistoryFunc() {
8358
+ return _fetchHistoryFunc.apply(this, arguments);
8359
+ }
8360
+ return fetchHistoryFunc;
8361
+ }()
8362
+ }, {
8324
8363
  key: "processMessage",
8325
8364
  value: function processMessage(e, t) {
8326
8365
  var i = this.totalMessagesMaxCharLength || -1;
@@ -8356,61 +8395,61 @@ var ai = /*#__PURE__*/function (_q10) {
8356
8395
  }, {
8357
8396
  key: "callServiceAPI",
8358
8397
  value: function () {
8359
- var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(e, t, i) {
8398
+ var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(e, t, i) {
8360
8399
  var _r$assistant_id;
8361
8400
  var r, n;
8362
- return _regeneratorRuntime().wrap(function _callee79$(_context79) {
8363
- while (1) switch (_context79.prev = _context79.next) {
8401
+ return _regeneratorRuntime().wrap(function _callee80$(_context80) {
8402
+ while (1) switch (_context80.prev = _context80.next) {
8364
8403
  case 0:
8365
8404
  if (this.requestSettings) {
8366
- _context79.next = 2;
8405
+ _context80.next = 2;
8367
8406
  break;
8368
8407
  }
8369
8408
  throw new Error("Request settings have not been set up");
8370
8409
  case 2:
8371
8410
  if (!((_r$assistant_id = (r = this.rawBody).assistant_id) !== null && _r$assistant_id !== void 0)) {
8372
- _context79.next = 6;
8411
+ _context80.next = 6;
8373
8412
  break;
8374
8413
  }
8375
8414
  _r$assistant_id;
8376
- _context79.next = 12;
8415
+ _context80.next = 12;
8377
8416
  break;
8378
8417
  case 6:
8379
- _context79.t0 = this.config.assistant_id;
8380
- if (_context79.t0) {
8381
- _context79.next = 11;
8418
+ _context80.t0 = this.config.assistant_id;
8419
+ if (_context80.t0) {
8420
+ _context80.next = 11;
8382
8421
  break;
8383
8422
  }
8384
- _context79.next = 10;
8423
+ _context80.next = 10;
8385
8424
  return this.createNewAssistant();
8386
8425
  case 10:
8387
- _context79.t0 = _context79.sent;
8426
+ _context80.t0 = _context80.sent;
8388
8427
  case 11:
8389
- r.assistant_id = _context79.t0;
8428
+ r.assistant_id = _context80.t0;
8390
8429
  case 12:
8391
8430
  this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messages);
8392
8431
  if (!i) {
8393
- _context79.next = 19;
8432
+ _context80.next = 19;
8394
8433
  break;
8395
8434
  }
8396
- _context79.next = 16;
8435
+ _context80.next = 16;
8397
8436
  return be.storeFiles(this, e, i);
8398
8437
  case 16:
8399
- _context79.t1 = _context79.sent;
8400
- _context79.next = 20;
8438
+ _context80.t1 = _context80.sent;
8439
+ _context80.next = 20;
8401
8440
  break;
8402
8441
  case 19:
8403
- _context79.t1 = void 0;
8442
+ _context80.t1 = void 0;
8404
8443
  case 20:
8405
- n = _context79.t1;
8444
+ n = _context80.t1;
8406
8445
  this.requestSettings.method = "POST", this.callService(e, t, n);
8407
8446
  case 22:
8408
8447
  case "end":
8409
- return _context79.stop();
8448
+ return _context80.stop();
8410
8449
  }
8411
- }, _callee79, this);
8450
+ }, _callee80, this);
8412
8451
  }));
8413
- function callServiceAPI(_x148, _x149, _x150) {
8452
+ function callServiceAPI(_x149, _x150, _x151) {
8414
8453
  return _callServiceAPI18.apply(this, arguments);
8415
8454
  }
8416
8455
  return callServiceAPI;
@@ -8418,27 +8457,27 @@ var ai = /*#__PURE__*/function (_q10) {
8418
8457
  }, {
8419
8458
  key: "createNewAssistant",
8420
8459
  value: function () {
8421
- var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80() {
8460
+ var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81() {
8422
8461
  var e;
8423
- return _regeneratorRuntime().wrap(function _callee80$(_context80) {
8424
- while (1) switch (_context80.prev = _context80.next) {
8462
+ return _regeneratorRuntime().wrap(function _callee81$(_context81) {
8463
+ while (1) switch (_context81.prev = _context81.next) {
8425
8464
  case 0:
8426
- _context80.prev = 0;
8465
+ _context81.prev = 0;
8427
8466
  this.url = se.NEW_ASSISTANT_URL;
8428
- _context80.next = 4;
8467
+ _context81.next = 4;
8429
8468
  return N.directFetch(this, JSON.parse(JSON.stringify(this.newAssistantDetails)), "POST");
8430
8469
  case 4:
8431
- e = _context80.sent;
8432
- return _context80.abrupt("return", (this.config.assistant_id = e.id, this.config.assistant_id));
8470
+ e = _context81.sent;
8471
+ return _context81.abrupt("return", (this.config.assistant_id = e.id, this.config.assistant_id));
8433
8472
  case 8:
8434
- _context80.prev = 8;
8435
- _context80.t0 = _context80["catch"](0);
8436
- console.error(_context80.t0), console.error("Failed to create a new assistant");
8473
+ _context81.prev = 8;
8474
+ _context81.t0 = _context81["catch"](0);
8475
+ console.error(_context81.t0), console.error("Failed to create a new assistant");
8437
8476
  case 11:
8438
8477
  case "end":
8439
- return _context80.stop();
8478
+ return _context81.stop();
8440
8479
  }
8441
- }, _callee80, this, [[0, 8]]);
8480
+ }, _callee81, this, [[0, 8]]);
8442
8481
  }));
8443
8482
  function createNewAssistant() {
8444
8483
  return _createNewAssistant.apply(this, arguments);
@@ -8456,34 +8495,34 @@ var ai = /*#__PURE__*/function (_q10) {
8456
8495
  }, {
8457
8496
  key: "extractResultData",
8458
8497
  value: function () {
8459
- var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(e) {
8498
+ var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e) {
8460
8499
  var n, t, i;
8461
- return _regeneratorRuntime().wrap(function _callee81$(_context81) {
8462
- while (1) switch (_context81.prev = _context81.next) {
8500
+ return _regeneratorRuntime().wrap(function _callee82$(_context82) {
8501
+ while (1) switch (_context82.prev = _context82.next) {
8463
8502
  case 0:
8464
8503
  if (!e.error) {
8465
- _context81.next = 2;
8504
+ _context82.next = 2;
8466
8505
  break;
8467
8506
  }
8468
8507
  throw e.error.message;
8469
8508
  case 2:
8470
- _context81.next = 4;
8509
+ _context82.next = 4;
8471
8510
  return this.assignThreadAndRun(e);
8472
8511
  case 4:
8473
8512
  t = "".concat(se.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id), i = {
8474
8513
  method: "GET",
8475
8514
  headers: (n = this.requestSettings) == null ? void 0 : n.headers
8476
8515
  };
8477
- return _context81.abrupt("return", (w.executePollRequest(this, t, i, this.messages), {
8516
+ return _context82.abrupt("return", (w.executePollRequest(this, t, i, this.messages), {
8478
8517
  makingAnotherRequest: !0
8479
8518
  }));
8480
8519
  case 6:
8481
8520
  case "end":
8482
- return _context81.stop();
8521
+ return _context82.stop();
8483
8522
  }
8484
- }, _callee81, this);
8523
+ }, _callee82, this);
8485
8524
  }));
8486
- function extractResultData(_x151) {
8525
+ function extractResultData(_x152) {
8487
8526
  return _extractResultData21.apply(this, arguments);
8488
8527
  }
8489
8528
  return extractResultData;
@@ -8491,117 +8530,164 @@ var ai = /*#__PURE__*/function (_q10) {
8491
8530
  }, {
8492
8531
  key: "assignThreadAndRun",
8493
8532
  value: function () {
8494
- var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e) {
8533
+ var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(e) {
8495
8534
  var t;
8496
- return _regeneratorRuntime().wrap(function _callee82$(_context82) {
8497
- while (1) switch (_context82.prev = _context82.next) {
8535
+ return _regeneratorRuntime().wrap(function _callee83$(_context83) {
8536
+ while (1) switch (_context83.prev = _context83.next) {
8498
8537
  case 0:
8499
8538
  if (!this.sessionId) {
8500
- _context82.next = 8;
8539
+ _context83.next = 8;
8501
8540
  break;
8502
8541
  }
8503
8542
  this.url = "".concat(se.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
8504
- _context82.next = 4;
8543
+ _context83.next = 4;
8505
8544
  return N.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
8506
8545
  case 4:
8507
- t = _context82.sent;
8546
+ t = _context83.sent;
8508
8547
  this.run_id = t.id;
8509
- _context82.next = 9;
8548
+ _context83.next = 9;
8510
8549
  break;
8511
8550
  case 8:
8512
8551
  this.sessionId = e.thread_id, this.run_id = e.id, this.messages && (this.messages.messages[this.messages.messages.length - 1]._sessionId = this.sessionId);
8513
8552
  case 9:
8514
8553
  case "end":
8515
- return _context82.stop();
8554
+ return _context83.stop();
8516
8555
  }
8517
- }, _callee82, this);
8556
+ }, _callee83, this);
8518
8557
  }));
8519
- function assignThreadAndRun(_x152) {
8558
+ function assignThreadAndRun(_x153) {
8520
8559
  return _assignThreadAndRun.apply(this, arguments);
8521
8560
  }
8522
8561
  return assignThreadAndRun;
8523
8562
  }()
8563
+ }, {
8564
+ key: "getThreadMessages",
8565
+ value: function () {
8566
+ var _getThreadMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(e) {
8567
+ var _this38 = this;
8568
+ var t,
8569
+ o,
8570
+ a,
8571
+ i,
8572
+ r,
8573
+ _args85 = arguments;
8574
+ return _regeneratorRuntime().wrap(function _callee85$(_context85) {
8575
+ while (1) switch (_context85.prev = _context85.next) {
8576
+ case 0:
8577
+ t = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : !1;
8578
+ this.url = "".concat(se.THREAD_PREFIX, "/").concat(e, "/messages");
8579
+ _context85.next = 4;
8580
+ return N.directFetch(this, {}, "GET");
8581
+ case 4:
8582
+ i = _context85.sent;
8583
+ _context85.t0 = !t && this.deepChat.responseInterceptor;
8584
+ if (!_context85.t0) {
8585
+ _context85.next = 10;
8586
+ break;
8587
+ }
8588
+ _context85.next = 9;
8589
+ return (a = (o = this.deepChat).responseInterceptor) == null ? void 0 : a.call(o, i);
8590
+ case 9:
8591
+ i = _context85.sent;
8592
+ case 10:
8593
+ r = (t ? i.data : [i.data[0]]).map( /*#__PURE__*/function () {
8594
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84(l) {
8595
+ var c;
8596
+ return _regeneratorRuntime().wrap(function _callee84$(_context84) {
8597
+ while (1) switch (_context84.prev = _context84.next) {
8598
+ case 0:
8599
+ c = l.content.find(function (d) {
8600
+ return !!d.text || !!d.image_file;
8601
+ });
8602
+ _context84.next = 3;
8603
+ return be.getFilesAndText(_this38, l, c);
8604
+ case 3:
8605
+ return _context84.abrupt("return", _context84.sent);
8606
+ case 4:
8607
+ case "end":
8608
+ return _context84.stop();
8609
+ }
8610
+ }, _callee84);
8611
+ }));
8612
+ return function (_x155) {
8613
+ return _ref10.apply(this, arguments);
8614
+ };
8615
+ }());
8616
+ return _context85.abrupt("return", Promise.all(r));
8617
+ case 12:
8618
+ case "end":
8619
+ return _context85.stop();
8620
+ }
8621
+ }, _callee85, this);
8622
+ }));
8623
+ function getThreadMessages(_x154) {
8624
+ return _getThreadMessages.apply(this, arguments);
8625
+ }
8626
+ return getThreadMessages;
8627
+ }()
8524
8628
  }, {
8525
8629
  key: "extractPollResultData",
8526
8630
  value: function () {
8527
- var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(e) {
8528
- var r, o, a, l, c, t, i, d, u, h, _yield$be$getFilesAnd, p, g, n, _d;
8529
- return _regeneratorRuntime().wrap(function _callee83$(_context83) {
8530
- while (1) switch (_context83.prev = _context83.next) {
8631
+ var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(e) {
8632
+ var r, o, a, t, i, l, _l$, c, d, n, _l;
8633
+ return _regeneratorRuntime().wrap(function _callee86$(_context86) {
8634
+ while (1) switch (_context86.prev = _context86.next) {
8531
8635
  case 0:
8532
8636
  t = e.status, i = e.required_action;
8533
8637
  if (!(t === "queued" || t === "in_progress")) {
8534
- _context83.next = 3;
8638
+ _context86.next = 3;
8535
8639
  break;
8536
8640
  }
8537
- return _context83.abrupt("return", {
8641
+ return _context86.abrupt("return", {
8538
8642
  timeoutMS: se.POLLING_TIMEOUT_MS
8539
8643
  });
8540
8644
  case 3:
8541
8645
  if (!(t === "completed" && this.messages)) {
8542
- _context83.next = 21;
8543
- break;
8544
- }
8545
- this.url = "".concat(se.THREAD_PREFIX, "/").concat(e.thread_id, "/messages");
8546
- _context83.next = 7;
8547
- return N.directFetch(this, {}, "GET");
8548
- case 7:
8549
- d = _context83.sent;
8550
- _context83.t0 = this.deepChat.responseInterceptor;
8551
- if (!_context83.t0) {
8552
- _context83.next = 13;
8646
+ _context86.next = 11;
8553
8647
  break;
8554
8648
  }
8555
- _context83.next = 12;
8556
- return (o = (r = this.deepChat).responseInterceptor) == null ? void 0 : o.call(r, d);
8557
- case 12:
8558
- d = _context83.sent;
8559
- case 13:
8560
- u = d.data[0];
8561
- h = u.content.find(function (f) {
8562
- return !!f.text || !!f.image_file;
8563
- });
8564
- _context83.next = 17;
8565
- return be.getFilesAndText(this, u, h);
8566
- case 17:
8567
- _yield$be$getFilesAnd = _context83.sent;
8568
- p = _yield$be$getFilesAnd.text;
8569
- g = _yield$be$getFilesAnd.files;
8570
- return _context83.abrupt("return", {
8571
- text: p,
8649
+ _context86.next = 6;
8650
+ return this.getThreadMessages(e.thread_id);
8651
+ case 6:
8652
+ l = _context86.sent;
8653
+ _l$ = l[0];
8654
+ c = _l$.text;
8655
+ d = _l$.files;
8656
+ return _context86.abrupt("return", {
8657
+ text: c,
8572
8658
  _sessionId: this.sessionId,
8573
- files: g
8659
+ files: d
8574
8660
  });
8575
- case 21:
8576
- n = (a = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : a.tool_calls;
8661
+ case 11:
8662
+ n = (r = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : r.tool_calls;
8577
8663
  if (!(t === "requires_action" && n)) {
8578
- _context83.next = 32;
8664
+ _context86.next = 22;
8579
8665
  break;
8580
8666
  }
8581
- _context83.next = 25;
8667
+ _context86.next = 15;
8582
8668
  return this.handleTools(n);
8583
- case 25:
8584
- _d = _context83.sent;
8585
- _context83.next = 28;
8586
- return (c = (l = this.deepChat).responseInterceptor) == null ? void 0 : c.call(l, _d);
8587
- case 28:
8588
- _context83.t1 = _context83.sent;
8589
- if (_context83.t1) {
8590
- _context83.next = 31;
8669
+ case 15:
8670
+ _l = _context86.sent;
8671
+ _context86.next = 18;
8672
+ return (a = (o = this.deepChat).responseInterceptor) == null ? void 0 : a.call(o, _l);
8673
+ case 18:
8674
+ _context86.t0 = _context86.sent;
8675
+ if (_context86.t0) {
8676
+ _context86.next = 21;
8591
8677
  break;
8592
8678
  }
8593
- _context83.t1 = _d;
8594
- case 31:
8595
- return _context83.abrupt("return", _context83.t1);
8596
- case 32:
8679
+ _context86.t0 = _l;
8680
+ case 21:
8681
+ return _context86.abrupt("return", _context86.t0);
8682
+ case 22:
8597
8683
  throw Error("Thread run status: ".concat(t));
8598
- case 33:
8684
+ case 23:
8599
8685
  case "end":
8600
- return _context83.stop();
8686
+ return _context86.stop();
8601
8687
  }
8602
- }, _callee83, this);
8688
+ }, _callee86, this);
8603
8689
  }));
8604
- function extractPollResultData(_x153) {
8690
+ function extractPollResultData(_x156) {
8605
8691
  return _extractPollResultData5.apply(this, arguments);
8606
8692
  }
8607
8693
  return extractPollResultData;
@@ -8609,13 +8695,13 @@ var ai = /*#__PURE__*/function (_q10) {
8609
8695
  }, {
8610
8696
  key: "handleTools",
8611
8697
  value: function () {
8612
- var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84(e) {
8698
+ var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e) {
8613
8699
  var t, i, n;
8614
- return _regeneratorRuntime().wrap(function _callee84$(_context84) {
8615
- while (1) switch (_context84.prev = _context84.next) {
8700
+ return _regeneratorRuntime().wrap(function _callee87$(_context87) {
8701
+ while (1) switch (_context87.prev = _context87.next) {
8616
8702
  case 0:
8617
8703
  if (this._functionHandler) {
8618
- _context84.next = 2;
8704
+ _context87.next = 2;
8619
8705
  break;
8620
8706
  }
8621
8707
  throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.");
@@ -8626,14 +8712,14 @@ var ai = /*#__PURE__*/function (_q10) {
8626
8712
  arguments: r["function"].arguments
8627
8713
  };
8628
8714
  });
8629
- _context84.next = 5;
8715
+ _context87.next = 5;
8630
8716
  return this._functionHandler(t);
8631
8717
  case 5:
8632
- i = _context84.sent;
8718
+ i = _context87.sent;
8633
8719
  if (!(!Array.isArray(i) || i.find(function (r) {
8634
8720
  return typeof r != "string";
8635
8721
  }) || e.length !== i.length)) {
8636
- _context84.next = 8;
8722
+ _context87.next = 8;
8637
8723
  break;
8638
8724
  }
8639
8725
  throw Error("Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.");
@@ -8645,21 +8731,21 @@ var ai = /*#__PURE__*/function (_q10) {
8645
8731
  };
8646
8732
  });
8647
8733
  this.url = "".concat(se.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id, "/submit_tool_outputs");
8648
- _context84.next = 12;
8734
+ _context87.next = 12;
8649
8735
  return N.directFetch(this, {
8650
8736
  tool_outputs: n
8651
8737
  }, "POST");
8652
8738
  case 12:
8653
- return _context84.abrupt("return", {
8739
+ return _context87.abrupt("return", {
8654
8740
  timeoutMS: se.POLLING_TIMEOUT_MS
8655
8741
  });
8656
8742
  case 13:
8657
8743
  case "end":
8658
- return _context84.stop();
8744
+ return _context87.stop();
8659
8745
  }
8660
- }, _callee84, this);
8746
+ }, _callee87, this);
8661
8747
  }));
8662
- function handleTools(_x154) {
8748
+ function handleTools(_x157) {
8663
8749
  return _handleTools.apply(this, arguments);
8664
8750
  }
8665
8751
  return handleTools;
@@ -8674,7 +8760,7 @@ var Vo = ai;
8674
8760
  var li = /*#__PURE__*/function (_q11) {
8675
8761
  _inherits(Te, _q11);
8676
8762
  function Te(e) {
8677
- var _this37;
8763
+ var _this39;
8678
8764
  _classCallCheck(this, Te);
8679
8765
  var o;
8680
8766
  var t = e.directConnection,
@@ -8687,19 +8773,19 @@ var li = /*#__PURE__*/function (_q11) {
8687
8773
  }
8688
8774
  }
8689
8775
  };
8690
- _this37 = _callSuper(this, Te, [e, N.buildKeyVerificationDetails(), N.buildHeaders, i, n]), _this37.insertKeyPlaceholderText = "OpenAI API Key", _this37.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this37.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this37.url = "", _this37.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
8776
+ _this39 = _callSuper(this, Te, [e, N.buildKeyVerificationDetails(), N.buildHeaders, i, n]), _this39.insertKeyPlaceholderText = "OpenAI API Key", _this39.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this39.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this39.url = "", _this39.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
8691
8777
  var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
8692
- if (_this37.camera) {
8778
+ if (_this39.camera) {
8693
8779
  var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
8694
- _this37.camera.files = {
8780
+ _this39.camera.files = {
8695
8781
  dimensions: {
8696
8782
  width: a,
8697
8783
  height: a
8698
8784
  }
8699
8785
  };
8700
8786
  }
8701
- _typeof(r) == "object" && Object.assign(_this37.rawBody, r), _this37.canSendMessage = Te.canFileSendMessage;
8702
- return _this37;
8787
+ _typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage = Te.canFileSendMessage;
8788
+ return _this39;
8703
8789
  }
8704
8790
  _createClass(Te, [{
8705
8791
  key: "preprocessBody",
@@ -8724,27 +8810,27 @@ var li = /*#__PURE__*/function (_q11) {
8724
8810
  }, {
8725
8811
  key: "callServiceAPI",
8726
8812
  value: function () {
8727
- var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(e, t, i) {
8813
+ var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88(e, t, i) {
8728
8814
  var n, r;
8729
- return _regeneratorRuntime().wrap(function _callee85$(_context85) {
8730
- while (1) switch (_context85.prev = _context85.next) {
8815
+ return _regeneratorRuntime().wrap(function _callee88$(_context88) {
8816
+ while (1) switch (_context88.prev = _context88.next) {
8731
8817
  case 0:
8732
8818
  if ((n = this.requestSettings) != null && n.headers) {
8733
- _context85.next = 2;
8819
+ _context88.next = 2;
8734
8820
  break;
8735
8821
  }
8736
8822
  throw new Error("Request settings have not been set up");
8737
8823
  case 2:
8738
8824
  if (!(i != null && i[0])) {
8739
- _context85.next = 6;
8825
+ _context88.next = 6;
8740
8826
  break;
8741
8827
  }
8742
8828
  this.callApiWithImage(e, t, i);
8743
- _context85.next = 11;
8829
+ _context88.next = 11;
8744
8830
  break;
8745
8831
  case 6:
8746
8832
  if (this.requestSettings) {
8747
- _context85.next = 8;
8833
+ _context88.next = 8;
8748
8834
  break;
8749
8835
  }
8750
8836
  throw new Error("Request settings have not been set up");
@@ -8754,11 +8840,11 @@ var li = /*#__PURE__*/function (_q11) {
8754
8840
  w.request(this, r, e);
8755
8841
  case 11:
8756
8842
  case "end":
8757
- return _context85.stop();
8843
+ return _context88.stop();
8758
8844
  }
8759
- }, _callee85, this);
8845
+ }, _callee88, this);
8760
8846
  }));
8761
- function callServiceAPI(_x155, _x156, _x157) {
8847
+ function callServiceAPI(_x158, _x159, _x160) {
8762
8848
  return _callServiceAPI19.apply(this, arguments);
8763
8849
  }
8764
8850
  return callServiceAPI;
@@ -8766,17 +8852,17 @@ var li = /*#__PURE__*/function (_q11) {
8766
8852
  }, {
8767
8853
  key: "extractResultData",
8768
8854
  value: function () {
8769
- var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(e) {
8770
- return _regeneratorRuntime().wrap(function _callee86$(_context86) {
8771
- while (1) switch (_context86.prev = _context86.next) {
8855
+ var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89(e) {
8856
+ return _regeneratorRuntime().wrap(function _callee89$(_context89) {
8857
+ while (1) switch (_context89.prev = _context89.next) {
8772
8858
  case 0:
8773
8859
  if (!e.error) {
8774
- _context86.next = 2;
8860
+ _context89.next = 2;
8775
8861
  break;
8776
8862
  }
8777
8863
  throw e.error.message;
8778
8864
  case 2:
8779
- return _context86.abrupt("return", {
8865
+ return _context89.abrupt("return", {
8780
8866
  files: e.data.map(function (i) {
8781
8867
  return i.url ? {
8782
8868
  src: i.url,
@@ -8789,11 +8875,11 @@ var li = /*#__PURE__*/function (_q11) {
8789
8875
  });
8790
8876
  case 3:
8791
8877
  case "end":
8792
- return _context86.stop();
8878
+ return _context89.stop();
8793
8879
  }
8794
- }, _callee86);
8880
+ }, _callee89);
8795
8881
  }));
8796
- function extractResultData(_x158) {
8882
+ function extractResultData(_x161) {
8797
8883
  return _extractResultData22.apply(this, arguments);
8798
8884
  }
8799
8885
  return extractResultData;
@@ -8829,22 +8915,22 @@ var Wo = li;
8829
8915
  var ht = /*#__PURE__*/function (_q12) {
8830
8916
  _inherits(ht, _q12);
8831
8917
  function ht(e) {
8832
- var _this38$maxMessages, _l$model;
8833
- var _this38;
8918
+ var _this40$maxMessages, _l$model;
8919
+ var _this40;
8834
8920
  _classCallCheck(this, ht);
8835
8921
  var r, o, a, l;
8836
8922
  var t = JSON.parse(JSON.stringify(e.directConnection)),
8837
8923
  i = t.openAI;
8838
- _this38 = _callSuper(this, ht, [e, N.buildKeyVerificationDetails(), N.buildHeaders, i]), _this38.insertKeyPlaceholderText = "OpenAI API Key", _this38.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this38.url = "https://api.openai.com/v1/chat/completions", _this38.permittedErrorPrefixes = ["Incorrect"], _this38._systemMessage = ht.generateSystemMessage("You are a helpful assistant.");
8924
+ _this40 = _callSuper(this, ht, [e, N.buildKeyVerificationDetails(), N.buildHeaders, i]), _this40.insertKeyPlaceholderText = "OpenAI API Key", _this40.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this40.url = "https://api.openai.com/v1/chat/completions", _this40.permittedErrorPrefixes = ["Incorrect"], _this40._systemMessage = ht.generateSystemMessage("You are a helpful assistant.");
8839
8925
  var n = (r = t.openAI) == null ? void 0 : r.chat;
8840
8926
  if (_typeof(n) == "object") {
8841
- n.system_prompt && (_this38._systemMessage = ht.generateSystemMessage(n.system_prompt));
8927
+ n.system_prompt && (_this40._systemMessage = ht.generateSystemMessage(n.system_prompt));
8842
8928
  var _ref11 = (a = (o = e.directConnection) == null ? void 0 : o.openAI) == null ? void 0 : a.chat,
8843
8929
  c = _ref11.function_handler;
8844
- c && (_this38._functionHandler = c), _this38.cleanConfig(n), Object.assign(_this38.rawBody, n);
8930
+ c && (_this40._functionHandler = c), _this40.cleanConfig(n), Object.assign(_this40.rawBody, n);
8845
8931
  }
8846
- (_this38$maxMessages = _this38.maxMessages) !== null && _this38$maxMessages !== void 0 ? _this38$maxMessages : _this38.maxMessages = -1, (_l$model = (l = _this38.rawBody).model) !== null && _l$model !== void 0 ? _l$model : l.model = "gpt-3.5-turbo";
8847
- return _this38;
8932
+ (_this40$maxMessages = _this40.maxMessages) !== null && _this40$maxMessages !== void 0 ? _this40$maxMessages : _this40.maxMessages = -1, (_l$model = (l = _this40.rawBody).model) !== null && _l$model !== void 0 ? _l$model : l.model = "gpt-3.5-turbo";
8933
+ return _this40;
8848
8934
  }
8849
8935
  _createClass(ht, [{
8850
8936
  key: "cleanConfig",
@@ -8871,13 +8957,13 @@ var ht = /*#__PURE__*/function (_q12) {
8871
8957
  }, {
8872
8958
  key: "callServiceAPI",
8873
8959
  value: function () {
8874
- var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e, t) {
8960
+ var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e, t) {
8875
8961
  var i, n;
8876
- return _regeneratorRuntime().wrap(function _callee87$(_context87) {
8877
- while (1) switch (_context87.prev = _context87.next) {
8962
+ return _regeneratorRuntime().wrap(function _callee90$(_context90) {
8963
+ while (1) switch (_context90.prev = _context90.next) {
8878
8964
  case 0:
8879
8965
  if (this.requestSettings) {
8880
- _context87.next = 2;
8966
+ _context90.next = 2;
8881
8967
  break;
8882
8968
  }
8883
8969
  throw new Error("Request settings have not been set up");
@@ -8886,11 +8972,11 @@ var ht = /*#__PURE__*/function (_q12) {
8886
8972
  n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, T.request(this, i, e)) : w.request(this, i, e);
8887
8973
  case 4:
8888
8974
  case "end":
8889
- return _context87.stop();
8975
+ return _context90.stop();
8890
8976
  }
8891
- }, _callee87, this);
8977
+ }, _callee90, this);
8892
8978
  }));
8893
- function callServiceAPI(_x159, _x160) {
8979
+ function callServiceAPI(_x162, _x163) {
8894
8980
  return _callServiceAPI20.apply(this, arguments);
8895
8981
  }
8896
8982
  return callServiceAPI;
@@ -8898,17 +8984,17 @@ var ht = /*#__PURE__*/function (_q12) {
8898
8984
  }, {
8899
8985
  key: "extractResultData",
8900
8986
  value: function () {
8901
- var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88(e, t, i) {
8902
- return _regeneratorRuntime().wrap(function _callee88$(_context88) {
8903
- while (1) switch (_context88.prev = _context88.next) {
8987
+ var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e, t, i) {
8988
+ return _regeneratorRuntime().wrap(function _callee91$(_context91) {
8989
+ while (1) switch (_context91.prev = _context91.next) {
8904
8990
  case 0:
8905
8991
  if (!e.error) {
8906
- _context88.next = 2;
8992
+ _context91.next = 2;
8907
8993
  break;
8908
8994
  }
8909
8995
  throw e.error.message;
8910
8996
  case 2:
8911
- return _context88.abrupt("return", e.choices[0].delta ? {
8997
+ return _context91.abrupt("return", e.choices[0].delta ? {
8912
8998
  text: e.choices[0].delta.content || ""
8913
8999
  } : e.choices[0].message ? e.choices[0].message.tool_calls ? this.handleTools(e.choices[0].message, t, i) : {
8914
9000
  text: e.choices[0].message.content
@@ -8917,11 +9003,11 @@ var ht = /*#__PURE__*/function (_q12) {
8917
9003
  });
8918
9004
  case 3:
8919
9005
  case "end":
8920
- return _context88.stop();
9006
+ return _context91.stop();
8921
9007
  }
8922
- }, _callee88, this);
9008
+ }, _callee91, this);
8923
9009
  }));
8924
- function extractResultData(_x161, _x162, _x163) {
9010
+ function extractResultData(_x164, _x165, _x166) {
8925
9011
  return _extractResultData23.apply(this, arguments);
8926
9012
  }
8927
9013
  return extractResultData;
@@ -8929,13 +9015,13 @@ var ht = /*#__PURE__*/function (_q12) {
8929
9015
  }, {
8930
9016
  key: "handleTools",
8931
9017
  value: function () {
8932
- var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89(e, t, i) {
9018
+ var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e, t, i) {
8933
9019
  var a, l, c, d, u, n, r, o, h, _h;
8934
- return _regeneratorRuntime().wrap(function _callee89$(_context89) {
8935
- while (1) switch (_context89.prev = _context89.next) {
9020
+ return _regeneratorRuntime().wrap(function _callee92$(_context92) {
9021
+ while (1) switch (_context92.prev = _context92.next) {
8936
9022
  case 0:
8937
9023
  if (!(!e.tool_calls || !t || !i || !this._functionHandler)) {
8938
- _context89.next = 2;
9024
+ _context92.next = 2;
8939
9025
  break;
8940
9026
  }
8941
9027
  throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");
@@ -8947,33 +9033,33 @@ var ht = /*#__PURE__*/function (_q12) {
8947
9033
  arguments: h["function"].arguments
8948
9034
  };
8949
9035
  });
8950
- _context89.next = 6;
9036
+ _context92.next = 6;
8951
9037
  return (a = this._functionHandler) == null ? void 0 : a.call(this, r);
8952
9038
  case 6:
8953
- o = _context89.sent;
9039
+ o = _context92.sent;
8954
9040
  if (!o.text) {
8955
- _context89.next = 15;
9041
+ _context92.next = 15;
8956
9042
  break;
8957
9043
  }
8958
9044
  h = {
8959
9045
  text: o.text
8960
9046
  };
8961
- _context89.next = 11;
9047
+ _context92.next = 11;
8962
9048
  return (c = (l = this.deepChat).responseInterceptor) == null ? void 0 : c.call(l, h);
8963
9049
  case 11:
8964
- _context89.t0 = _context89.sent;
8965
- if (_context89.t0) {
8966
- _context89.next = 14;
9050
+ _context92.t0 = _context92.sent;
9051
+ if (_context92.t0) {
9052
+ _context92.next = 14;
8967
9053
  break;
8968
9054
  }
8969
- _context89.t0 = h;
9055
+ _context92.t0 = h;
8970
9056
  case 14:
8971
- return _context89.abrupt("return", _context89.t0);
9057
+ return _context92.abrupt("return", _context92.t0);
8972
9058
  case 15:
8973
9059
  if (!(n.messages.push(e), Array.isArray(o) && !o.find(function (h) {
8974
9060
  return typeof h != "string";
8975
9061
  }) || r.length === o.length)) {
8976
- _context89.next = 29;
9062
+ _context92.next = 29;
8977
9063
  break;
8978
9064
  }
8979
9065
  o.forEach(function (p, g) {
@@ -8986,41 +9072,41 @@ var ht = /*#__PURE__*/function (_q12) {
8986
9072
  content: p.response
8987
9073
  });
8988
9074
  }), delete n.tools, delete n.tool_choice;
8989
- _context89.next = 19;
9075
+ _context92.next = 19;
8990
9076
  return t == null ? void 0 : t(n).then(function (p) {
8991
9077
  return _.processResponseByType(p);
8992
9078
  });
8993
9079
  case 19:
8994
- _h = _context89.sent;
8995
- _context89.next = 22;
9080
+ _h = _context92.sent;
9081
+ _context92.next = 22;
8996
9082
  return (u = (d = this.deepChat).responseInterceptor) == null ? void 0 : u.call(d, _h);
8997
9083
  case 22:
8998
- _context89.t1 = _context89.sent;
8999
- if (_context89.t1) {
9000
- _context89.next = 25;
9084
+ _context92.t1 = _context92.sent;
9085
+ if (_context92.t1) {
9086
+ _context92.next = 25;
9001
9087
  break;
9002
9088
  }
9003
- _context89.t1 = _h;
9089
+ _context92.t1 = _h;
9004
9090
  case 25:
9005
- _h = _context89.t1;
9091
+ _h = _context92.t1;
9006
9092
  if (!_h.error) {
9007
- _context89.next = 28;
9093
+ _context92.next = 28;
9008
9094
  break;
9009
9095
  }
9010
9096
  throw _h.error.message;
9011
9097
  case 28:
9012
- return _context89.abrupt("return", {
9098
+ return _context92.abrupt("return", {
9013
9099
  text: _h.choices[0].message.content || ""
9014
9100
  });
9015
9101
  case 29:
9016
9102
  throw Error("Response object must either be {response: string}[] for each individual function or {text: string} for a direct response, see https://deepchat.dev/docs/directConnection/OpenAI#FunctionHandler.");
9017
9103
  case 30:
9018
9104
  case "end":
9019
- return _context89.stop();
9105
+ return _context92.stop();
9020
9106
  }
9021
- }, _callee89, this);
9107
+ }, _callee92, this);
9022
9108
  }));
9023
- function handleTools(_x164, _x165, _x166) {
9109
+ function handleTools(_x167, _x168, _x169) {
9024
9110
  return _handleTools2.apply(this, arguments);
9025
9111
  }
9026
9112
  return handleTools;
@@ -9058,15 +9144,15 @@ var ht = /*#__PURE__*/function (_q12) {
9058
9144
  var Jo = /*#__PURE__*/function (_Xi3) {
9059
9145
  _inherits(Jo, _Xi3);
9060
9146
  function Jo(e) {
9061
- var _this39$maxMessages;
9062
- var _this39;
9147
+ var _this41$maxMessages;
9148
+ var _this41;
9063
9149
  _classCallCheck(this, Jo);
9064
9150
  var r;
9065
9151
  var t = JSON.parse(JSON.stringify(e.directConnection)),
9066
9152
  i = (r = t.cohere) == null ? void 0 : r.chat,
9067
9153
  n = t.cohere;
9068
- _this39 = _callSuper(this, Jo, [e, "https://api.cohere.ai/v1/chat", "Ask me anything!", i, n]), _typeof(i) == "object" && Object.assign(_this39.rawBody, i), (_this39$maxMessages = _this39.maxMessages) !== null && _this39$maxMessages !== void 0 ? _this39$maxMessages : _this39.maxMessages = -1;
9069
- return _this39;
9154
+ _this41 = _callSuper(this, Jo, [e, "https://api.cohere.ai/v1/chat", "Ask me anything!", i, n]), _typeof(i) == "object" && Object.assign(_this41.rawBody, i), (_this41$maxMessages = _this41.maxMessages) !== null && _this41$maxMessages !== void 0 ? _this41$maxMessages : _this41.maxMessages = -1;
9155
+ return _this41;
9070
9156
  }
9071
9157
  _createClass(Jo, [{
9072
9158
  key: "preprocessBody",
@@ -9085,13 +9171,13 @@ var Jo = /*#__PURE__*/function (_Xi3) {
9085
9171
  }, {
9086
9172
  key: "callServiceAPI",
9087
9173
  value: function () {
9088
- var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e, t) {
9174
+ var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e, t) {
9089
9175
  var i;
9090
- return _regeneratorRuntime().wrap(function _callee90$(_context90) {
9091
- while (1) switch (_context90.prev = _context90.next) {
9176
+ return _regeneratorRuntime().wrap(function _callee93$(_context93) {
9177
+ while (1) switch (_context93.prev = _context93.next) {
9092
9178
  case 0:
9093
9179
  if (this.requestSettings) {
9094
- _context90.next = 2;
9180
+ _context93.next = 2;
9095
9181
  break;
9096
9182
  }
9097
9183
  throw new Error("Request settings have not been set up");
@@ -9100,11 +9186,11 @@ var Jo = /*#__PURE__*/function (_Xi3) {
9100
9186
  w.request(this, i, e);
9101
9187
  case 4:
9102
9188
  case "end":
9103
- return _context90.stop();
9189
+ return _context93.stop();
9104
9190
  }
9105
- }, _callee90, this);
9191
+ }, _callee93, this);
9106
9192
  }));
9107
- function callServiceAPI(_x167, _x168) {
9193
+ function callServiceAPI(_x170, _x171) {
9108
9194
  return _callServiceAPI21.apply(this, arguments);
9109
9195
  }
9110
9196
  return callServiceAPI;
@@ -9112,26 +9198,26 @@ var Jo = /*#__PURE__*/function (_Xi3) {
9112
9198
  }, {
9113
9199
  key: "extractResultData",
9114
9200
  value: function () {
9115
- var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e) {
9116
- return _regeneratorRuntime().wrap(function _callee91$(_context91) {
9117
- while (1) switch (_context91.prev = _context91.next) {
9201
+ var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94(e) {
9202
+ return _regeneratorRuntime().wrap(function _callee94$(_context94) {
9203
+ while (1) switch (_context94.prev = _context94.next) {
9118
9204
  case 0:
9119
9205
  if (!e.message) {
9120
- _context91.next = 2;
9206
+ _context94.next = 2;
9121
9207
  break;
9122
9208
  }
9123
9209
  throw e.message;
9124
9210
  case 2:
9125
- return _context91.abrupt("return", {
9211
+ return _context94.abrupt("return", {
9126
9212
  text: e.text
9127
9213
  });
9128
9214
  case 3:
9129
9215
  case "end":
9130
- return _context91.stop();
9216
+ return _context94.stop();
9131
9217
  }
9132
- }, _callee91);
9218
+ }, _callee94);
9133
9219
  }));
9134
- function extractResultData(_x169) {
9220
+ function extractResultData(_x172) {
9135
9221
  return _extractResultData24.apply(this, arguments);
9136
9222
  }
9137
9223
  return extractResultData;
@@ -9316,20 +9402,20 @@ var me = /*#__PURE__*/function () {
9316
9402
  }, {
9317
9403
  key: "addNewImageMessage",
9318
9404
  value: function () {
9319
- var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e, t, i) {
9405
+ var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95(e, t, i) {
9320
9406
  var n, r;
9321
- return _regeneratorRuntime().wrap(function _callee92$(_context92) {
9322
- while (1) switch (_context92.prev = _context92.next) {
9407
+ return _regeneratorRuntime().wrap(function _callee95$(_context95) {
9408
+ while (1) switch (_context95.prev = _context95.next) {
9323
9409
  case 0:
9324
9410
  n = me.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
9325
9411
  r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), re.addMessage(e, r, "image", i);
9326
9412
  case 2:
9327
9413
  case "end":
9328
- return _context92.stop();
9414
+ return _context95.stop();
9329
9415
  }
9330
- }, _callee92);
9416
+ }, _callee95);
9331
9417
  }));
9332
- function addNewImageMessage(_x170, _x171, _x172) {
9418
+ function addNewImageMessage(_x173, _x174, _x175) {
9333
9419
  return _addNewImageMessage.apply(this, arguments);
9334
9420
  }
9335
9421
  return addNewImageMessage;
@@ -9354,7 +9440,7 @@ var me = /*#__PURE__*/function () {
9354
9440
  t.classList.add("any-file-message-contents");
9355
9441
  var i = document.createElement("div");
9356
9442
  i.classList.add("any-file-message-icon-container");
9357
- var n = G.createSVGElement(Zo);
9443
+ var n = V.createSVGElement(Zo);
9358
9444
  n.classList.add("any-file-message-icon"), i.appendChild(n);
9359
9445
  var r = document.createElement("div");
9360
9446
  return r.classList.add("any-file-message-text"), r.textContent = e.name || re.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), re.processContent("any", t, e.src, r.textContent);
@@ -9381,23 +9467,23 @@ var me = /*#__PURE__*/function () {
9381
9467
  var ge = /*#__PURE__*/function (_Ye) {
9382
9468
  _inherits(ge, _Ye);
9383
9469
  function ge(e, t, i) {
9384
- var _this40;
9470
+ var _this42;
9385
9471
  _classCallCheck(this, ge);
9386
9472
  var a, l;
9387
- _this40 = _callSuper(this, ge, [e]);
9473
+ _this42 = _callSuper(this, ge, [e]);
9388
9474
  var n = t.permittedErrorPrefixes,
9389
9475
  r = t.introPanelMarkUp,
9390
9476
  o = t.demo;
9391
- _this40._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this40._onClearMessages = Bt.onClearMessages.bind(_assertThisInitialized(_this40), e), _this40._onError = Bt.onError.bind(_assertThisInitialized(_this40), e), _this40._displayLoadingMessage = ge.getDisplayLoadingMessage(e, t), _this40._permittedErrorPrefixes = n, _this40.addSetupMessageIfNeeded(e, t) || _this40.populateIntroPanel(i, r, e.introPanelStyle), _this40.addIntroductoryMessage(e, t), e.initialMessages && _this40.populateInitialMessages(e.initialMessages), _this40._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
9392
- return JSON.parse(JSON.stringify(_this40.messages));
9393
- }, e.clearMessages = _this40.clearMessages.bind(_assertThisInitialized(_this40), t), e.refreshMessages = _this40.refreshTextMessages.bind(_assertThisInitialized(_this40)), e.scrollToBottom = Z.scrollToBottom.bind(_assertThisInitialized(_this40), _this40.elementRef), e._addMessage = function (c, d) {
9394
- _this40.addNewMessage(_objectSpread(_objectSpread({}, c), {}, {
9477
+ _this42._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this42._onClearMessages = Bt.onClearMessages.bind(_assertThisInitialized(_this42), e), _this42._onError = Bt.onError.bind(_assertThisInitialized(_this42), e), _this42._displayLoadingMessage = ge.getDisplayLoadingMessage(e, t), _this42._permittedErrorPrefixes = n, _this42.addSetupMessageIfNeeded(e, t) || _this42.populateIntroPanel(i, r, e.introPanelStyle), _this42.addIntroductoryMessage(e, t), e.initialMessages && _this42.populateInitialMessages(e.initialMessages), _this42._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
9478
+ return JSON.parse(JSON.stringify(_this42.messages));
9479
+ }, e.clearMessages = _this42.clearMessages.bind(_assertThisInitialized(_this42), t), e.refreshMessages = _this42.refreshTextMessages.bind(_assertThisInitialized(_this42)), e.scrollToBottom = G.scrollToBottom.bind(_assertThisInitialized(_this42), _this42.elementRef), e._addMessage = function (c, d) {
9480
+ _this42.addNewMessage(_objectSpread(_objectSpread({}, c), {}, {
9395
9481
  sendUpdate: !!d
9396
9482
  }), !d);
9397
- }, t.isWebModel() && t.setUpMessages(_assertThisInitialized(_this40)), o && _this40.prepareDemo(o), e.textToSpeech && jt.processConfig(e.textToSpeech, function (c) {
9398
- _this40.textToSpeech = c;
9399
- });
9400
- return _this40;
9483
+ }, t.isWebModel() && t.setUpMessages(_assertThisInitialized(_this42)), o && _this42.prepareDemo(o), e.textToSpeech && jt.processConfig(e.textToSpeech, function (c) {
9484
+ _this42.textToSpeech = c;
9485
+ }), t.fetchHistory && _this42.fetchHistory(t.fetchHistory);
9486
+ return _this42;
9401
9487
  }
9402
9488
  _createClass(ge, [{
9403
9489
  key: "prepareDemo",
@@ -9436,14 +9522,41 @@ var ge = /*#__PURE__*/function (_Ye) {
9436
9522
  }, {
9437
9523
  key: "populateInitialMessages",
9438
9524
  value: function populateInitialMessages(e) {
9439
- var _this41 = this;
9525
+ var _this43 = this;
9440
9526
  e.forEach(function (t) {
9441
- Re.processInitialMessageFile(t), _this41.addNewMessage(t, !0);
9527
+ Re.processInitialMessageFile(t), _this43.addNewMessage(t, !0);
9442
9528
  }), setTimeout(function () {
9443
- return Z.scrollToBottom(_this41.elementRef);
9529
+ return G.scrollToBottom(_this43.elementRef);
9444
9530
  }, 0);
9445
9531
  }
9446
- // this should not be activated by streamed messages
9532
+ }, {
9533
+ key: "fetchHistory",
9534
+ value: function () {
9535
+ var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e) {
9536
+ var _this44 = this;
9537
+ return _regeneratorRuntime().wrap(function _callee96$(_context96) {
9538
+ while (1) switch (_context96.prev = _context96.next) {
9539
+ case 0:
9540
+ _context96.next = 2;
9541
+ return e();
9542
+ case 2:
9543
+ _context96.sent.forEach(function (i) {
9544
+ _this44.addNewMessage(i, !0);
9545
+ });
9546
+ setTimeout(function () {
9547
+ return G.scrollToBottom(_this44.elementRef);
9548
+ }, 0);
9549
+ case 4:
9550
+ case "end":
9551
+ return _context96.stop();
9552
+ }
9553
+ }, _callee96);
9554
+ }));
9555
+ function fetchHistory(_x176) {
9556
+ return _fetchHistory.apply(this, arguments);
9557
+ }
9558
+ return fetchHistory;
9559
+ }() // this should not be activated by streamed messages
9447
9560
  }, {
9448
9561
  key: "addNewMessage",
9449
9562
  value: function addNewMessage(e) {
@@ -9491,7 +9604,7 @@ var ge = /*#__PURE__*/function (_Ye) {
9491
9604
  var o = this.getPermittedMessage(t) || ((l = this._errorMessageOverrides) == null ? void 0 : l[e]) || ((c = this._errorMessageOverrides) == null ? void 0 : c["default"]) || "Error, please try again.";
9492
9605
  this.renderText(r, o);
9493
9606
  var a = D.extractParticularSharedStyles(["fontSize", "fontFamily"], (d = this.messageStyles) == null ? void 0 : d["default"]);
9494
- D.applyCustomStylesToElements(i, !1, a), D.applyCustomStylesToElements(i, !1, (u = this.messageStyles) == null ? void 0 : u.error), this.elementRef.appendChild(n), Z.scrollToBottom(this.elementRef), this.textToSpeech && jt.speak(o, this.textToSpeech), (h = this._onError) == null || h.call(this, o);
9607
+ D.applyCustomStylesToElements(i, !1, a), D.applyCustomStylesToElements(i, !1, (u = this.messageStyles) == null ? void 0 : u.error), this.elementRef.appendChild(n), G.scrollToBottom(this.elementRef), this.textToSpeech && jt.speak(o, this.textToSpeech), (h = this._onError) == null || h.call(this, o);
9495
9608
  }
9496
9609
  }, {
9497
9610
  key: "getPermittedMessage",
@@ -9522,7 +9635,7 @@ var ge = /*#__PURE__*/function (_Ye) {
9522
9635
  i = e.bubbleElement;
9523
9636
  i.classList.add("loading-message-text");
9524
9637
  var n = document.createElement("div");
9525
- n.classList.add("dots-flashing"), i.appendChild(n), this.applyCustomStyles(e, b.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.loading), tn.set(i, this.messageStyles), this.elementRef.appendChild(t), Z.scrollToBottom(this.elementRef);
9638
+ n.classList.add("dots-flashing"), i.appendChild(n), this.applyCustomStyles(e, b.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.loading), tn.set(i, this.messageStyles), this.elementRef.appendChild(t), G.scrollToBottom(this.elementRef);
9526
9639
  }
9527
9640
  }, {
9528
9641
  key: "populateIntroPanel",
@@ -9532,11 +9645,11 @@ var ge = /*#__PURE__*/function (_Ye) {
9532
9645
  }, {
9533
9646
  key: "addMultipleFiles",
9534
9647
  value: function () {
9535
- var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e) {
9536
- return _regeneratorRuntime().wrap(function _callee93$(_context93) {
9537
- while (1) switch (_context93.prev = _context93.next) {
9648
+ var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e) {
9649
+ return _regeneratorRuntime().wrap(function _callee97$(_context97) {
9650
+ while (1) switch (_context97.prev = _context97.next) {
9538
9651
  case 0:
9539
- return _context93.abrupt("return", Promise.all((e || []).map(function (t) {
9652
+ return _context97.abrupt("return", Promise.all((e || []).map(function (t) {
9540
9653
  return new Promise(function (i) {
9541
9654
  if (!t.type || t.type === "any") {
9542
9655
  var n = t.file.name || re.DEFAULT_FILE_NAME;
@@ -9559,11 +9672,11 @@ var ge = /*#__PURE__*/function (_Ye) {
9559
9672
  })));
9560
9673
  case 1:
9561
9674
  case "end":
9562
- return _context93.stop();
9675
+ return _context97.stop();
9563
9676
  }
9564
- }, _callee93);
9677
+ }, _callee97);
9565
9678
  }));
9566
- function addMultipleFiles(_x173) {
9679
+ function addMultipleFiles(_x177) {
9567
9680
  return _addMultipleFiles.apply(this, arguments);
9568
9681
  }
9569
9682
  return addMultipleFiles;
@@ -9597,10 +9710,10 @@ var ge = /*#__PURE__*/function (_Ye) {
9597
9710
  return ge;
9598
9711
  }(Ye);
9599
9712
  var Mt = /*#__PURE__*/function () {
9600
- function $() {
9601
- _classCallCheck(this, $);
9713
+ function K() {
9714
+ _classCallCheck(this, K);
9602
9715
  }
9603
- _createClass($, null, [{
9716
+ _createClass(K, null, [{
9604
9717
  key: "adjustInputPadding",
9605
9718
  value: function adjustInputPadding(e, t) {
9606
9719
  t["inside-left"].length > 0 && e.classList.add("text-input-inner-left-adjustment"), t["inside-right"].length > 0 && e.classList.add("text-input-inner-right-adjustment");
@@ -9608,7 +9721,7 @@ var Mt = /*#__PURE__*/function () {
9608
9721
  }, {
9609
9722
  key: "adjustForOutsideButton",
9610
9723
  value: function adjustForOutsideButton(e, t, i) {
9611
- i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add($.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add($.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : i["outside-left"].length === 0 && i["outside-right"].length > 0 && (e[3].classList.add($.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add($.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
9724
+ i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(K.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(K.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : i["outside-left"].length === 0 && i["outside-right"].length > 0 && (e[3].classList.add(K.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(K.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
9612
9725
  }
9613
9726
  // when submit is the only button
9614
9727
  // when submit button is outside by itself - we increase the height for a better look
@@ -9616,10 +9729,10 @@ var Mt = /*#__PURE__*/function () {
9616
9729
  key: "adjustOutsideSubmit",
9617
9730
  value: function adjustOutsideSubmit(e, t, i) {
9618
9731
  if (!(i["inside-left"].length > 0 || i["inside-right"].length > 0)) {
9619
- if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add($.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add($.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), i["outside-left"].map(function (n) {
9732
+ if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(K.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(K.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), i["outside-left"].map(function (n) {
9620
9733
  return n.button.elementRef.classList.add("submit-button-enlarged");
9621
9734
  });
9622
- if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add($.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add($.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), i["outside-right"].map(function (n) {
9735
+ if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(K.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(K.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), i["outside-right"].map(function (n) {
9623
9736
  return n.button.elementRef.classList.add("submit-button-enlarged");
9624
9737
  });
9625
9738
  }
@@ -9627,10 +9740,10 @@ var Mt = /*#__PURE__*/function () {
9627
9740
  }, {
9628
9741
  key: "set",
9629
9742
  value: function set(e, t, i, n) {
9630
- !!$.adjustOutsideSubmit(t, i, n) || $.adjustForOutsideButton(t, i, n), $.adjustInputPadding(e, n);
9743
+ !!K.adjustOutsideSubmit(t, i, n) || K.adjustForOutsideButton(t, i, n), K.adjustInputPadding(e, n);
9631
9744
  }
9632
9745
  }]);
9633
- return $;
9746
+ return K;
9634
9747
  }();
9635
9748
  Mt.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
9636
9749
  Mt.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
@@ -9685,7 +9798,7 @@ var j = /*#__PURE__*/function () {
9685
9798
  }, {
9686
9799
  key: "createElement",
9687
9800
  value: function createElement(e, t) {
9688
- return t ? j.createTextElement(e) : G.createSVGElement(e);
9801
+ return t ? j.createTextElement(e) : V.createSVGElement(e);
9689
9802
  }
9690
9803
  }, {
9691
9804
  key: "createCustomElement",
@@ -9885,11 +9998,11 @@ var Ae = /*#__PURE__*/function () {
9885
9998
  }();
9886
9999
  var nn = /*#__PURE__*/function () {
9887
10000
  function nn(e, t) {
9888
- var _this42 = this;
10001
+ var _this45 = this;
9889
10002
  _classCallCheck(this, nn);
9890
10003
  var i;
9891
10004
  this._isOpen = !0, this._styles = t, this.elementRef = nn.createElement((i = this._styles) == null ? void 0 : i.container), this.close(), setTimeout(function () {
9892
- return _this42.addWindowEvents(e);
10005
+ return _this45.addWindowEvents(e);
9893
10006
  });
9894
10007
  }
9895
10008
  _createClass(nn, [{
@@ -9944,15 +10057,15 @@ var nn = /*#__PURE__*/function () {
9944
10057
  var Ze = /*#__PURE__*/function (_Tt) {
9945
10058
  _inherits(Ze, _Tt);
9946
10059
  function Ze(e, t) {
9947
- var _this43;
10060
+ var _this46;
9948
10061
  _classCallCheck(this, Ze);
9949
10062
  var n;
9950
- _this43 = _callSuper(this, Ze, [Ze.createButtonElement(), void 0, {
10063
+ _this46 = _callSuper(this, Ze, [Ze.createButtonElement(), void 0, {
9951
10064
  styles: (n = t == null ? void 0 : t.button) == null ? void 0 : n.styles
9952
10065
  }]);
9953
- var i = _this43.createInnerElements(_this43._customStyles);
9954
- _this43._menu = new nn(e, t == null ? void 0 : t.menu), _this43.addClickEvent(), _this43.buttonContainer = Ze.createButtonContainer(), _this43.elementRef.appendChild(i.styles), _this43.buttonContainer.appendChild(_this43.elementRef), _this43.elementRef.classList.add("dropup-icon", "upload-file-button"), _this43.elementRef.children[0].id = "dropup-icon", _this43.buttonContainer.appendChild(_this43._menu.elementRef), _this43.reapplyStateStyle("styles"), _this43.addContainerEvents(e);
9955
- return _this43;
10066
+ var i = _this46.createInnerElements(_this46._customStyles);
10067
+ _this46._menu = new nn(e, t == null ? void 0 : t.menu), _this46.addClickEvent(), _this46.buttonContainer = Ze.createButtonContainer(), _this46.elementRef.appendChild(i.styles), _this46.buttonContainer.appendChild(_this46.elementRef), _this46.elementRef.classList.add("dropup-icon", "upload-file-button"), _this46.elementRef.children[0].id = "dropup-icon", _this46.buttonContainer.appendChild(_this46._menu.elementRef), _this46.reapplyStateStyle("styles"), _this46.addContainerEvents(e);
10068
+ return _this46;
9956
10069
  }
9957
10070
  _createClass(Ze, [{
9958
10071
  key: "createInnerElements",
@@ -9979,9 +10092,9 @@ var Ze = /*#__PURE__*/function (_Tt) {
9979
10092
  }, {
9980
10093
  key: "addContainerEvents",
9981
10094
  value: function addContainerEvents(e) {
9982
- var _this44 = this;
10095
+ var _this47 = this;
9983
10096
  e.addEventListener("click", function (t) {
9984
- t.target.classList.contains("dropup-icon") || _this44._menu.close();
10097
+ t.target.classList.contains("dropup-icon") || _this47._menu.close();
9985
10098
  });
9986
10099
  }
9987
10100
  }], [{
@@ -9993,7 +10106,7 @@ var Ze = /*#__PURE__*/function (_Tt) {
9993
10106
  }, {
9994
10107
  key: "createSVGIconElement",
9995
10108
  value: function createSVGIconElement() {
9996
- return G.createSVGElement(Qo);
10109
+ return V.createSVGElement(Qo);
9997
10110
  }
9998
10111
  }, {
9999
10112
  key: "createButtonContainer",
@@ -10115,10 +10228,10 @@ var ea = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\"
10115
10228
  var he = /*#__PURE__*/function () {
10116
10229
  // prettier-ignore
10117
10230
  function he(e, t, i, n) {
10118
- var _this45 = this;
10231
+ var _this48 = this;
10119
10232
  _classCallCheck(this, he);
10120
10233
  this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = n, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
10121
- _this45._validationHandler = e._validationHandler;
10234
+ _this48._validationHandler = e._validationHandler;
10122
10235
  });
10123
10236
  }
10124
10237
  _createClass(he, [{
@@ -10258,12 +10371,12 @@ var ra = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
10258
10371
  _createClass(Ce, [{
10259
10372
  key: "createTimer",
10260
10373
  value: function createTimer(e, t) {
10261
- var _this46 = this;
10374
+ var _this49 = this;
10262
10375
  var i = 0;
10263
10376
  var n = t !== void 0 && t < Ce.TIMER_LIMIT_S ? t : Ce.TIMER_LIMIT_S;
10264
10377
  return setInterval(function () {
10265
10378
  var a;
10266
- i += 1, i === n && ((a = _this46.stopPlaceholderCallback) == null || a.call(_this46), _this46.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
10379
+ i += 1, i === n && ((a = _this49.stopPlaceholderCallback) == null || a.call(_this49), _this49.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
10267
10380
  var r = Math.floor(i / 60),
10268
10381
  o = (i % 60).toString().padStart(2, "0");
10269
10382
  e.textContent = "".concat(r, ":").concat(o);
@@ -10277,13 +10390,13 @@ var ra = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
10277
10390
  i.classList.add("audio-placeholder-text-3-digits");
10278
10391
  var n = document.createElement("div");
10279
10392
  n.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), n.appendChild(i);
10280
- var r = G.createSVGElement(Tn);
10393
+ var r = V.createSVGElement(Tn);
10281
10394
  return r.classList.add("attachment-icon", "stop-icon", "not-removable-attachment-icon"), i.textContent = "0:00", this._activePlaceholderTimer = this.createTimer(i, e), t.appendChild(n), this.addPlaceholderAudioAttachmentEvents(t, r, n), t;
10282
10395
  }
10283
10396
  }, {
10284
10397
  key: "addPlaceholderAudioAttachmentEvents",
10285
10398
  value: function addPlaceholderAudioAttachmentEvents(e, t, i) {
10286
- var _this47 = this;
10399
+ var _this50 = this;
10287
10400
  var n = function n() {
10288
10401
  return e.replaceChildren(t);
10289
10402
  };
@@ -10294,7 +10407,7 @@ var ra = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
10294
10407
  e.addEventListener("mouseleave", r);
10295
10408
  var o = function o() {
10296
10409
  var a;
10297
- return (a = _this47.stopPlaceholderCallback) == null ? void 0 : a.call(_this47);
10410
+ return (a = _this50.stopPlaceholderCallback) == null ? void 0 : a.call(_this50);
10298
10411
  };
10299
10412
  e.addEventListener("click", o);
10300
10413
  }
@@ -10330,12 +10443,12 @@ var ra = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
10330
10443
  }, {
10331
10444
  key: "addAudioElements",
10332
10445
  value: function addAudioElements(e, t) {
10333
- var i = e.parentElement ? Z.cloneElement(e) : e,
10446
+ var i = e.parentElement ? G.cloneElement(e) : e,
10334
10447
  n = document.createElement("audio");
10335
10448
  n.src = t;
10336
- var r = G.createSVGElement(ra);
10449
+ var r = V.createSVGElement(ra);
10337
10450
  r.classList.add("attachment-icon", "play-icon");
10338
- var o = G.createSVGElement(Tn);
10451
+ var o = V.createSVGElement(Tn);
10339
10452
  o.classList.add("attachment-icon", "stop-icon"), i.replaceChildren(r), n.onplay = function () {
10340
10453
  i.replaceChildren(o);
10341
10454
  }, n.onpause = function () {
@@ -10413,33 +10526,33 @@ var Ct = /*#__PURE__*/function () {
10413
10526
  }, {
10414
10527
  key: "completePlaceholders",
10415
10528
  value: function () {
10416
- var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95() {
10417
- return _regeneratorRuntime().wrap(function _callee95$(_context95) {
10418
- while (1) switch (_context95.prev = _context95.next) {
10529
+ var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99() {
10530
+ return _regeneratorRuntime().wrap(function _callee99$(_context99) {
10531
+ while (1) switch (_context99.prev = _context99.next) {
10419
10532
  case 0:
10420
- _context95.next = 2;
10533
+ _context99.next = 2;
10421
10534
  return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
10422
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94(e) {
10535
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(e) {
10423
10536
  var t;
10424
- return _regeneratorRuntime().wrap(function _callee94$(_context94) {
10425
- while (1) switch (_context94.prev = _context94.next) {
10537
+ return _regeneratorRuntime().wrap(function _callee98$(_context98) {
10538
+ while (1) switch (_context98.prev = _context98.next) {
10426
10539
  case 0:
10427
- return _context94.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
10540
+ return _context98.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
10428
10541
  case 1:
10429
10542
  case "end":
10430
- return _context94.stop();
10543
+ return _context98.stop();
10431
10544
  }
10432
- }, _callee94);
10545
+ }, _callee98);
10433
10546
  }));
10434
- return function (_x174) {
10547
+ return function (_x178) {
10435
10548
  return _ref12.apply(this, arguments);
10436
10549
  };
10437
10550
  }()));
10438
10551
  case 2:
10439
10552
  case "end":
10440
- return _context95.stop();
10553
+ return _context99.stop();
10441
10554
  }
10442
- }, _callee95, this);
10555
+ }, _callee99, this);
10443
10556
  }));
10444
10557
  function completePlaceholders() {
10445
10558
  return _completePlaceholders.apply(this, arguments);
@@ -10489,20 +10602,20 @@ var ys = /*#__PURE__*/function () {
10489
10602
  }, {
10490
10603
  key: "addButtons",
10491
10604
  value: function addButtons() {
10492
- var _this48 = this;
10605
+ var _this51 = this;
10493
10606
  for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
10494
10607
  e[_key2] = arguments[_key2];
10495
10608
  }
10496
10609
  e.forEach(function (t) {
10497
- return _this48._buttonPanel.appendChild(t);
10610
+ return _this51._buttonPanel.appendChild(t);
10498
10611
  });
10499
10612
  }
10500
10613
  }, {
10501
10614
  key: "close",
10502
10615
  value: function close() {
10503
- var _this49 = this;
10616
+ var _this52 = this;
10504
10617
  this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
10505
- _this49._elementRef.style.display = "none", _this49._backgroundPanelRef.style.display = "none";
10618
+ _this52._elementRef.style.display = "none", _this52._backgroundPanelRef.style.display = "none";
10506
10619
  }, ce.MODAL_CLOSE_TIMEOUT_MS);
10507
10620
  }
10508
10621
  }, {
@@ -10518,10 +10631,10 @@ var ys = /*#__PURE__*/function () {
10518
10631
  }, {
10519
10632
  key: "addCloseButton",
10520
10633
  value: function addCloseButton(e, t, i) {
10521
- var _this50 = this;
10634
+ var _this53 = this;
10522
10635
  var n = t ? ce.createSVGButton(e) : ce.createTextButton(e);
10523
10636
  return this.addButtons(n), n.onclick = function () {
10524
- _this50.close(), setTimeout(function () {
10637
+ _this53.close(), setTimeout(function () {
10525
10638
  i == null || i();
10526
10639
  }, 140);
10527
10640
  }, n;
@@ -10573,7 +10686,7 @@ var ys = /*#__PURE__*/function () {
10573
10686
  value: function createSVGButton(e) {
10574
10687
  var t = document.createElement("div");
10575
10688
  t.classList.add("modal-button", "modal-svg-button");
10576
- var i = G.createSVGElement(e);
10689
+ var i = V.createSVGElement(e);
10577
10690
  return i.classList.add("modal-svg-button-icon"), t.appendChild(i), t;
10578
10691
  }
10579
10692
  }, {
@@ -10594,13 +10707,13 @@ var pt = /*#__PURE__*/function (_Tt2) {
10594
10707
  _inherits(pt, _Tt2);
10595
10708
  // prettier-ignore
10596
10709
  function pt(e, t, i, n, r, o) {
10597
- var _this51;
10710
+ var _this54;
10598
10711
  _classCallCheck(this, pt);
10599
10712
  var l, c, d, u, h, p;
10600
- _this51 = _callSuper(this, pt, [pt.createButtonElement(), (l = i.button) == null ? void 0 : l.position, i.button, o]);
10601
- var a = _this51.createInnerElements(n, r, _this51._customStyles);
10602
- _this51._inputElement = pt.createInputElement((c = i == null ? void 0 : i.files) == null ? void 0 : c.acceptedFormats), _this51.addClickEvent(e, i), _this51.elementRef.replaceChildren(a.styles), _this51.reapplyStateStyle("styles"), _this51._fileAttachmentsType = t, _this51._openModalOnce = ((u = (d = i.files) == null ? void 0 : d.infoModal) == null ? void 0 : u.openModalOnce) === !1 || (p = (h = i.files) == null ? void 0 : h.infoModal) == null ? void 0 : p.openModalOnce;
10603
- return _this51;
10713
+ _this54 = _callSuper(this, pt, [pt.createButtonElement(), (l = i.button) == null ? void 0 : l.position, i.button, o]);
10714
+ var a = _this54.createInnerElements(n, r, _this54._customStyles);
10715
+ _this54._inputElement = pt.createInputElement((c = i == null ? void 0 : i.files) == null ? void 0 : c.acceptedFormats), _this54.addClickEvent(e, i), _this54.elementRef.replaceChildren(a.styles), _this54.reapplyStateStyle("styles"), _this54._fileAttachmentsType = t, _this54._openModalOnce = ((u = (d = i.files) == null ? void 0 : d.infoModal) == null ? void 0 : u.openModalOnce) === !1 || (p = (h = i.files) == null ? void 0 : h.infoModal) == null ? void 0 : p.openModalOnce;
10716
+ return _this54;
10604
10717
  }
10605
10718
  _createClass(pt, [{
10606
10719
  key: "createInnerElements",
@@ -10652,7 +10765,7 @@ var pt = /*#__PURE__*/function (_Tt2) {
10652
10765
  }, {
10653
10766
  key: "createSVGIconElement",
10654
10767
  value: function createSVGIconElement(e, t) {
10655
- var i = G.createSVGElement(t);
10768
+ var i = V.createSVGElement(t);
10656
10769
  return i.id = e, i;
10657
10770
  }
10658
10771
  }]);
@@ -10728,26 +10841,26 @@ var ke = /*#__PURE__*/function () {
10728
10841
  }, {
10729
10842
  key: "useValidationFunc",
10730
10843
  value: function () {
10731
- var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e, t, i, n) {
10844
+ var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e, t, i, n) {
10732
10845
  var r, o, a, l;
10733
- return _regeneratorRuntime().wrap(function _callee96$(_context96) {
10734
- while (1) switch (_context96.prev = _context96.next) {
10846
+ return _regeneratorRuntime().wrap(function _callee100$(_context100) {
10847
+ while (1) switch (_context100.prev = _context100.next) {
10735
10848
  case 0:
10736
10849
  r = t.inputElementRef, o = r.classList.contains("text-input-placeholder") ? "" : r.textContent;
10737
- _context96.next = 3;
10850
+ _context100.next = 3;
10738
10851
  return i.completePlaceholders();
10739
10852
  case 3:
10740
10853
  a = i.getAllFileData(), l = a == null ? void 0 : a.map(function (c) {
10741
10854
  return c.file;
10742
10855
  });
10743
- return _context96.abrupt("return", ke.validate(e, n, o, l));
10856
+ return _context100.abrupt("return", ke.validate(e, n, o, l));
10744
10857
  case 5:
10745
10858
  case "end":
10746
- return _context96.stop();
10859
+ return _context100.stop();
10747
10860
  }
10748
- }, _callee96);
10861
+ }, _callee100);
10749
10862
  }));
10750
- function useValidationFunc(_x175, _x176, _x177, _x178) {
10863
+ function useValidationFunc(_x179, _x180, _x181, _x182) {
10751
10864
  return _useValidationFunc.apply(this, arguments);
10752
10865
  }
10753
10866
  return useValidationFunc;
@@ -10755,22 +10868,22 @@ var ke = /*#__PURE__*/function () {
10755
10868
  }, {
10756
10869
  key: "useValidationFuncProgrammatic",
10757
10870
  value: function () {
10758
- var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t, i) {
10871
+ var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e, t, i) {
10759
10872
  var r, n;
10760
- return _regeneratorRuntime().wrap(function _callee97$(_context97) {
10761
- while (1) switch (_context97.prev = _context97.next) {
10873
+ return _regeneratorRuntime().wrap(function _callee101$(_context101) {
10874
+ while (1) switch (_context101.prev = _context101.next) {
10762
10875
  case 0:
10763
10876
  n = (r = t.files) == null ? void 0 : r.map(function (o) {
10764
10877
  return o.file;
10765
10878
  });
10766
- return _context97.abrupt("return", ke.validate(e, i, t.text, n, !0));
10879
+ return _context101.abrupt("return", ke.validate(e, i, t.text, n, !0));
10767
10880
  case 2:
10768
10881
  case "end":
10769
- return _context97.stop();
10882
+ return _context101.stop();
10770
10883
  }
10771
- }, _callee97);
10884
+ }, _callee101);
10772
10885
  }));
10773
- function useValidationFuncProgrammatic(_x179, _x180, _x181) {
10886
+ function useValidationFuncProgrammatic(_x183, _x184, _x185) {
10774
10887
  return _useValidationFuncProgrammatic.apply(this, arguments);
10775
10888
  }
10776
10889
  return useValidationFuncProgrammatic;
@@ -10786,26 +10899,26 @@ var ke = /*#__PURE__*/function () {
10786
10899
  value: function attach(e, t, i, n, r) {
10787
10900
  var o = e.validateInput || Re.processValidateInput(e);
10788
10901
  e._validationHandler = /*#__PURE__*/function () {
10789
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(a) {
10902
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102(a) {
10790
10903
  var l;
10791
- return _regeneratorRuntime().wrap(function _callee98$(_context98) {
10792
- while (1) switch (_context98.prev = _context98.next) {
10904
+ return _regeneratorRuntime().wrap(function _callee102$(_context102) {
10905
+ while (1) switch (_context102.prev = _context102.next) {
10793
10906
  case 0:
10794
10907
  if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !ke.validateWebsocket(t, r))) {
10795
- _context98.next = 2;
10908
+ _context102.next = 2;
10796
10909
  break;
10797
10910
  }
10798
- return _context98.abrupt("return", !1);
10911
+ return _context102.abrupt("return", !1);
10799
10912
  case 2:
10800
10913
  l = o || t.canSendMessage;
10801
- return _context98.abrupt("return", l ? a ? ke.useValidationFuncProgrammatic(l, a, r) : ke.useValidationFunc(l, i, n, r) : null);
10914
+ return _context102.abrupt("return", l ? a ? ke.useValidationFuncProgrammatic(l, a, r) : ke.useValidationFunc(l, i, n, r) : null);
10802
10915
  case 4:
10803
10916
  case "end":
10804
- return _context98.stop();
10917
+ return _context102.stop();
10805
10918
  }
10806
- }, _callee98);
10919
+ }, _callee102);
10807
10920
  }));
10808
- return function (_x182) {
10921
+ return function (_x186) {
10809
10922
  return _ref13.apply(this, arguments);
10810
10923
  };
10811
10924
  }();
@@ -10817,10 +10930,10 @@ var aa = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg height=\"1.4em\"
10817
10930
  var xt = /*#__PURE__*/function (_Tt3) {
10818
10931
  _inherits(xt, _Tt3);
10819
10932
  function xt(e) {
10820
- var _this52;
10933
+ var _this55;
10821
10934
  _classCallCheck(this, xt);
10822
- (e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this52 = _callSuper(this, xt, [xt.createMicrophoneElement(), e == null ? void 0 : e.position, e]), _this52.isActive = !1, _this52._innerElements = _this52.createInnerElements(_this52._customStyles), _this52.changeToDefault();
10823
- return _this52;
10935
+ (e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this55 = _callSuper(this, xt, [xt.createMicrophoneElement(), e == null ? void 0 : e.position, e]), _this55.isActive = !1, _this55._innerElements = _this55.createInnerElements(_this55._customStyles), _this55.changeToDefault();
10936
+ return _this55;
10824
10937
  }
10825
10938
  _createClass(xt, [{
10826
10939
  key: "createInnerElements",
@@ -10884,7 +10997,7 @@ var xt = /*#__PURE__*/function (_Tt3) {
10884
10997
  }, {
10885
10998
  key: "createSVGIconElement",
10886
10999
  value: function createSVGIconElement() {
10887
- var e = G.createSVGElement(aa);
11000
+ var e = V.createSVGElement(aa);
10888
11001
  return e.id = "microphone-icon", e;
10889
11002
  }
10890
11003
  }]);
@@ -11013,11 +11126,11 @@ Object.defineProperty(ui, "__esModule", {
11013
11126
  value: !0
11014
11127
  });
11015
11128
  ui.EventListeners = void 0;
11016
- var Y = /*#__PURE__*/function () {
11017
- function Y() {
11018
- _classCallCheck(this, Y);
11129
+ var Z = /*#__PURE__*/function () {
11130
+ function Z() {
11131
+ _classCallCheck(this, Z);
11019
11132
  }
11020
- _createClass(Y, null, [{
11133
+ _createClass(Z, null, [{
11021
11134
  key: "getElementIfFocusedOnAvailable",
11022
11135
  value: function getElementIfFocusedOnAvailable(e, t) {
11023
11136
  return Array.isArray(e) ? e.find(function (i) {
@@ -11027,15 +11140,15 @@ var Y = /*#__PURE__*/function () {
11027
11140
  }, {
11028
11141
  key: "keyDownWindow",
11029
11142
  value: function keyDownWindow(e) {
11030
- var _this53 = this;
11031
- e.element && Y.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (Y.KEY_DOWN_TIMEOUT !== null && clearTimeout(Y.KEY_DOWN_TIMEOUT), Y.KEY_DOWN_TIMEOUT = setTimeout(function () {
11032
- Y.KEY_DOWN_TIMEOUT = null, _this53.resetRecording(e);
11143
+ var _this56 = this;
11144
+ e.element && Z.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (Z.KEY_DOWN_TIMEOUT !== null && clearTimeout(Z.KEY_DOWN_TIMEOUT), Z.KEY_DOWN_TIMEOUT = setTimeout(function () {
11145
+ Z.KEY_DOWN_TIMEOUT = null, _this56.resetRecording(e);
11033
11146
  }, 500));
11034
11147
  }
11035
11148
  }, {
11036
11149
  key: "mouseDownWindow",
11037
11150
  value: function mouseDownWindow(e, t) {
11038
- this.mouseDownElement = Y.getElementIfFocusedOnAvailable(e, t.target);
11151
+ this.mouseDownElement = Z.getElementIfFocusedOnAvailable(e, t.target);
11039
11152
  }
11040
11153
  }, {
11041
11154
  key: "mouseUpWindow",
@@ -11046,7 +11159,7 @@ var Y = /*#__PURE__*/function () {
11046
11159
  key: "add",
11047
11160
  value: function add(e, t) {
11048
11161
  var i = (t == null ? void 0 : t.insertInCursorLocation) === void 0 || (t == null ? void 0 : t.insertInCursorLocation);
11049
- t != null && t.element && i && (e.mouseDownEvent = Y.mouseDownWindow.bind(e, t.element), document.addEventListener("mousedown", e.mouseDownEvent), e.mouseUpEvent = Y.mouseUpWindow.bind(e, t), document.addEventListener("mouseup", e.mouseUpEvent), e.keyDownEvent = Y.keyDownWindow.bind(e, t), document.addEventListener("keydown", e.keyDownEvent));
11162
+ t != null && t.element && i && (e.mouseDownEvent = Z.mouseDownWindow.bind(e, t.element), document.addEventListener("mousedown", e.mouseDownEvent), e.mouseUpEvent = Z.mouseUpWindow.bind(e, t), document.addEventListener("mouseup", e.mouseUpEvent), e.keyDownEvent = Z.keyDownWindow.bind(e, t), document.addEventListener("keydown", e.keyDownEvent));
11050
11163
  }
11051
11164
  }, {
11052
11165
  key: "remove",
@@ -11054,10 +11167,10 @@ var Y = /*#__PURE__*/function () {
11054
11167
  document.removeEventListener("mousedown", e.mouseDownEvent), document.removeEventListener("mouseup", e.mouseUpEvent), document.removeEventListener("keydown", e.keyDownEvent);
11055
11168
  }
11056
11169
  }]);
11057
- return Y;
11170
+ return Z;
11058
11171
  }();
11059
- ui.EventListeners = Y;
11060
- Y.KEY_DOWN_TIMEOUT = null;
11172
+ ui.EventListeners = Z;
11173
+ Z.KEY_DOWN_TIMEOUT = null;
11061
11174
  var hi = {};
11062
11175
  Object.defineProperty(hi, "__esModule", {
11063
11176
  value: !0
@@ -11271,11 +11384,11 @@ var An = Lt,
11271
11384
  fa = nt,
11272
11385
  kn = qe,
11273
11386
  In = ze;
11274
- var K = /*#__PURE__*/function () {
11275
- function K() {
11276
- _classCallCheck(this, K);
11387
+ var Y = /*#__PURE__*/function () {
11388
+ function Y() {
11389
+ _classCallCheck(this, Y);
11277
11390
  }
11278
- _createClass(K, null, [{
11391
+ _createClass(Y, null, [{
11279
11392
  key: "processCommand",
11280
11393
  value: function processCommand(e, t) {
11281
11394
  return (!t || !t.caseSensitive) && (e = e.toLowerCase()), (t == null ? void 0 : t.substrings) === !1 ? In.Text.breakupIntoWordsArr(e) : e;
@@ -11286,7 +11399,7 @@ var K = /*#__PURE__*/function () {
11286
11399
  var t;
11287
11400
  return ((t = e.settings) === null || t === void 0 ? void 0 : t.caseSensitive) === !0 ? e : Object.keys(e).reduce(function (n, r) {
11288
11401
  var o = e[r];
11289
- return n[r] = typeof o == "string" ? K.processCommand(o, e.settings) : o, n;
11402
+ return n[r] = typeof o == "string" ? Y.processCommand(o, e.settings) : o, n;
11290
11403
  }, {});
11291
11404
  }
11292
11405
  }, {
@@ -11304,7 +11417,7 @@ var K = /*#__PURE__*/function () {
11304
11417
  }, {
11305
11418
  key: "setText",
11306
11419
  value: function setText(e, t, i, n) {
11307
- K.toggleCommandModeOff(e), pa.Elements.isPrimitiveElement(n) ? (n.value = i, e.isTargetInShadow || kn.Cursor.setOffsetForPrimitive(n, i.length, !0), fa.Browser.IS_SAFARI() && e.autoScroll && An.AutoScroll.scrollSafariPrimitiveToEnd(n)) : (n.textContent = i, e.isTargetInShadow || kn.Cursor.focusEndOfGeneric(n), setTimeout(function () {
11420
+ Y.toggleCommandModeOff(e), pa.Elements.isPrimitiveElement(n) ? (n.value = i, e.isTargetInShadow || kn.Cursor.setOffsetForPrimitive(n, i.length, !0), fa.Browser.IS_SAFARI() && e.autoScroll && An.AutoScroll.scrollSafariPrimitiveToEnd(n)) : (n.textContent = i, e.isTargetInShadow || kn.Cursor.focusEndOfGeneric(n), setTimeout(function () {
11308
11421
  return An.AutoScroll.scrollGeneric(e, n);
11309
11422
  })), e.resetRecording(t);
11310
11423
  }
@@ -11334,39 +11447,39 @@ var K = /*#__PURE__*/function () {
11334
11447
  if (!c || !n || !i) return;
11335
11448
  var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
11336
11449
  u = In.Text.breakupIntoWordsArr(d),
11337
- h = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? K.checkIfMatchesWord : K.checkIfMatchesSubstring;
11450
+ h = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? Y.checkIfMatchesWord : Y.checkIfMatchesSubstring;
11338
11451
  if (c.commandMode && h(c.commandMode, d, u)) return e.setInterimColorToFinal(), setTimeout(function () {
11339
- return K.toggleCommandModeOn(e);
11452
+ return Y.toggleCommandModeOn(e);
11340
11453
  }), {
11341
11454
  doNotProcessTranscription: !1
11342
11455
  };
11343
11456
  if (!(c.commandMode && !e.isWaitingForCommand)) {
11344
- if (c.stop && h(c.stop, d, u)) return K.toggleCommandModeOff(e), setTimeout(function () {
11457
+ if (c.stop && h(c.stop, d, u)) return Y.toggleCommandModeOff(e), setTimeout(function () {
11345
11458
  return e.stop();
11346
11459
  }), {
11347
11460
  doNotProcessTranscription: !1
11348
11461
  };
11349
- if (c.pause && h(c.pause, d, u)) return K.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
11462
+ if (c.pause && h(c.pause, d, u)) return Y.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
11350
11463
  var p;
11351
11464
  e.isPaused = !0, (p = e.onPauseTrigger) === null || p === void 0 || p.call(e, !0);
11352
11465
  }), {
11353
11466
  doNotProcessTranscription: !1
11354
11467
  };
11355
- if (c.resume && h(c.resume, d, u)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1), K.toggleCommandModeOff(e), e.resetRecording(i), {
11468
+ if (c.resume && h(c.resume, d, u)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1), Y.toggleCommandModeOff(e), e.resetRecording(i), {
11356
11469
  doNotProcessTranscription: !0
11357
11470
  };
11358
- if (c.reset && h(c.reset, d, u)) return r !== void 0 && K.setText(e, i, r, n), {
11471
+ if (c.reset && h(c.reset, d, u)) return r !== void 0 && Y.setText(e, i, r, n), {
11359
11472
  doNotProcessTranscription: !0
11360
11473
  };
11361
- if (c.removeAllText && h(c.removeAllText, d, u)) return K.setText(e, i, "", n), {
11474
+ if (c.removeAllText && h(c.removeAllText, d, u)) return Y.setText(e, i, "", n), {
11362
11475
  doNotProcessTranscription: !0
11363
11476
  };
11364
11477
  }
11365
11478
  }
11366
11479
  }]);
11367
- return K;
11480
+ return Y;
11368
11481
  }();
11369
- It.CommandUtils = K;
11482
+ It.CommandUtils = Y;
11370
11483
  var pi = {};
11371
11484
  Object.defineProperty(pi, "__esModule", {
11372
11485
  value: !0
@@ -11649,22 +11762,22 @@ var Yt = /*#__PURE__*/function (_ya$Speech) {
11649
11762
  }, {
11650
11763
  key: "setEvents",
11651
11764
  value: function setEvents() {
11652
- var _this54 = this;
11765
+ var _this57 = this;
11653
11766
  this._service && (this._service.onstart = function () {
11654
- _this54.setStateOnStart();
11767
+ _this57.setStateOnStart();
11655
11768
  }, this._service.onerror = function (e) {
11656
- jn.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" && _this54.isRestarting || e.error !== "no-speech" && _this54.error(e.message || e.error);
11769
+ jn.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" && _this57.isRestarting || e.error !== "no-speech" && _this57.error(e.message || e.error);
11657
11770
  }, this._service.onaudioend = function () {
11658
- _this54.setStateOnStop();
11771
+ _this57.setStateOnStop();
11659
11772
  }, this._service.onend = function () {
11660
- _this54._stopping = !1;
11773
+ _this57._stopping = !1;
11661
11774
  }, this._service.onresult = function (e) {
11662
- if (_typeof(e.results) > "u" && _this54._service) _this54._service.onend = null, _this54._service.stop();else if (_this54._extractText && !_this54._stopping) {
11663
- var _this54$_extractText = _this54._extractText(e, _this54.finalTranscript, _this54._translations),
11664
- t = _this54$_extractText.interimTranscript,
11665
- _i18 = _this54$_extractText.finalTranscript,
11666
- n = _this54$_extractText.newText;
11667
- _this54.updateElements(t, _i18, n);
11775
+ if (_typeof(e.results) > "u" && _this57._service) _this57._service.onend = null, _this57._service.stop();else if (_this57._extractText && !_this57._stopping) {
11776
+ var _this57$_extractText = _this57._extractText(e, _this57.finalTranscript, _this57._translations),
11777
+ t = _this57$_extractText.interimTranscript,
11778
+ _i18 = _this57$_extractText.finalTranscript,
11779
+ n = _this57$_extractText.newText;
11780
+ _this57.updateElements(t, _i18, n);
11668
11781
  }
11669
11782
  });
11670
11783
  }
@@ -11759,26 +11872,26 @@ var Zt = /*#__PURE__*/function () {
11759
11872
  }, {
11760
11873
  key: "getNewSpeechConfig",
11761
11874
  value: function () {
11762
- var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e, t) {
11763
- return _regeneratorRuntime().wrap(function _callee99$(_context99) {
11764
- while (1) switch (_context99.prev = _context99.next) {
11875
+ var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103(e, t) {
11876
+ return _regeneratorRuntime().wrap(function _callee103$(_context103) {
11877
+ while (1) switch (_context103.prev = _context103.next) {
11765
11878
  case 0:
11766
11879
  if (!t.region) {
11767
- _context99.next = 2;
11880
+ _context103.next = 2;
11768
11881
  break;
11769
11882
  }
11770
- return _context99.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (i) {
11883
+ return _context103.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (i) {
11771
11884
  return t.region ? e.fromAuthorizationToken((i == null ? void 0 : i.trim()) || "", t.region.trim()) : null;
11772
11885
  })["catch"](function (i) {
11773
11886
  return console.error(i), null;
11774
11887
  }) : null);
11775
11888
  case 2:
11776
11889
  case "end":
11777
- return _context99.stop();
11890
+ return _context103.stop();
11778
11891
  }
11779
- }, _callee99);
11892
+ }, _callee103);
11780
11893
  }));
11781
- function getNewSpeechConfig(_x183, _x184) {
11894
+ function getNewSpeechConfig(_x187, _x188) {
11782
11895
  return _getNewSpeechConfig.apply(this, arguments);
11783
11896
  }
11784
11897
  return getNewSpeechConfig;
@@ -11791,23 +11904,23 @@ var Zt = /*#__PURE__*/function () {
11791
11904
  }, {
11792
11905
  key: "get",
11793
11906
  value: function () {
11794
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e, t) {
11907
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e, t) {
11795
11908
  var i;
11796
- return _regeneratorRuntime().wrap(function _callee100$(_context100) {
11797
- while (1) switch (_context100.prev = _context100.next) {
11909
+ return _regeneratorRuntime().wrap(function _callee104$(_context104) {
11910
+ while (1) switch (_context104.prev = _context104.next) {
11798
11911
  case 0:
11799
- _context100.next = 2;
11912
+ _context104.next = 2;
11800
11913
  return Zt.getNewSpeechConfig(e, t);
11801
11914
  case 2:
11802
- i = _context100.sent;
11803
- return _context100.abrupt("return", (i && Zt.process(i, t), i));
11915
+ i = _context104.sent;
11916
+ return _context104.abrupt("return", (i && Zt.process(i, t), i));
11804
11917
  case 4:
11805
11918
  case "end":
11806
- return _context100.stop();
11919
+ return _context104.stop();
11807
11920
  }
11808
- }, _callee100);
11921
+ }, _callee104);
11809
11922
  }));
11810
- function get(_x185, _x186) {
11923
+ function get(_x189, _x190) {
11811
11924
  return _get.apply(this, arguments);
11812
11925
  }
11813
11926
  return get;
@@ -11883,10 +11996,10 @@ var Fn = bi,
11883
11996
  var Xt = /*#__PURE__*/function (_Sa$Speech) {
11884
11997
  _inherits(Xt, _Sa$Speech);
11885
11998
  function Xt() {
11886
- var _this55;
11999
+ var _this58;
11887
12000
  _classCallCheck(this, Xt);
11888
- _this55 = _callSuper(this, Xt, arguments), _this55._newTextPadding = "";
11889
- return _this55;
12001
+ _this58 = _callSuper(this, Xt, arguments), _this58._newTextPadding = "";
12002
+ return _this58;
11890
12003
  }
11891
12004
  _createClass(Xt, [{
11892
12005
  key: "start",
@@ -11896,28 +12009,28 @@ var Xt = /*#__PURE__*/function (_Sa$Speech) {
11896
12009
  }, {
11897
12010
  key: "startAsync",
11898
12011
  value: function () {
11899
- var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e) {
12012
+ var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(e) {
11900
12013
  var t;
11901
- return _regeneratorRuntime().wrap(function _callee101$(_context101) {
11902
- while (1) switch (_context101.prev = _context101.next) {
12014
+ return _regeneratorRuntime().wrap(function _callee105$(_context105) {
12015
+ while (1) switch (_context105.prev = _context105.next) {
11903
12016
  case 0:
11904
- _context101.t0 = this.validate(e);
11905
- if (!_context101.t0) {
11906
- _context101.next = 6;
12017
+ _context105.t0 = this.validate(e);
12018
+ if (!_context105.t0) {
12019
+ _context105.next = 6;
11907
12020
  break;
11908
12021
  }
11909
- _context101.next = 4;
12022
+ _context105.next = 4;
11910
12023
  return this.instantiateService(e);
11911
12024
  case 4:
11912
12025
  this._translations = e == null ? void 0 : e.translations;
11913
12026
  (t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
11914
12027
  case 6:
11915
12028
  case "end":
11916
- return _context101.stop();
12029
+ return _context105.stop();
11917
12030
  }
11918
- }, _callee101, this);
12031
+ }, _callee105, this);
11919
12032
  }));
11920
- function startAsync(_x187) {
12033
+ function startAsync(_x191) {
11921
12034
  return _startAsync.apply(this, arguments);
11922
12035
  }
11923
12036
  return startAsync;
@@ -11930,28 +12043,28 @@ var Xt = /*#__PURE__*/function (_Sa$Speech) {
11930
12043
  }, {
11931
12044
  key: "instantiateService",
11932
12045
  value: function () {
11933
- var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102(e) {
12046
+ var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(e) {
11934
12047
  var t, i, n, r;
11935
- return _regeneratorRuntime().wrap(function _callee102$(_context102) {
11936
- while (1) switch (_context102.prev = _context102.next) {
12048
+ return _regeneratorRuntime().wrap(function _callee106$(_context106) {
12049
+ while (1) switch (_context106.prev = _context106.next) {
11937
12050
  case 0:
11938
12051
  t = Xt.getAPI();
11939
12052
  i = t.AudioConfig.fromDefaultMicrophoneInput();
11940
- _context102.next = 4;
12053
+ _context106.next = 4;
11941
12054
  return Bn.AzureSpeechConfig.get(t.SpeechConfig, e);
11942
12055
  case 4:
11943
- n = _context102.sent;
12056
+ n = _context106.sent;
11944
12057
  if (n) {
11945
12058
  r = new t.SpeechRecognizer(n, i);
11946
12059
  this.setEvents(r), this._service = r, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
11947
12060
  } else this.error("Unable to contact Azure server");
11948
12061
  case 6:
11949
12062
  case "end":
11950
- return _context102.stop();
12063
+ return _context106.stop();
11951
12064
  }
11952
- }, _callee102, this);
12065
+ }, _callee106, this);
11953
12066
  }));
11954
- function instantiateService(_x188) {
12067
+ function instantiateService(_x192) {
11955
12068
  return _instantiateService.apply(this, arguments);
11956
12069
  }
11957
12070
  return instantiateService;
@@ -12014,12 +12127,12 @@ var Xt = /*#__PURE__*/function (_Sa$Speech) {
12014
12127
  }, {
12015
12128
  key: "retrieveTokenInterval",
12016
12129
  value: function retrieveTokenInterval(e) {
12017
- var _this56 = this;
12130
+ var _this59 = this;
12018
12131
  this._retrieveTokenInterval = setInterval(function () {
12019
12132
  e == null || e().then(function (t) {
12020
- _this56._service && (_this56._service.authorizationToken = (t == null ? void 0 : t.trim()) || "");
12133
+ _this59._service && (_this59._service.authorizationToken = (t == null ? void 0 : t.trim()) || "");
12021
12134
  })["catch"](function (t) {
12022
- _this56.error(t);
12135
+ _this59.error(t);
12023
12136
  });
12024
12137
  }, 1e4);
12025
12138
  }
@@ -12100,18 +12213,18 @@ var Oi = xs["default"] = Ke;
12100
12213
  var Qt = /*#__PURE__*/function (_xt) {
12101
12214
  _inherits(Qt, _xt);
12102
12215
  function Qt(e, t, i) {
12103
- var _this57;
12216
+ var _this60;
12104
12217
  _classCallCheck(this, Qt);
12105
12218
  var o;
12106
- _this57 = _callSuper(this, Qt, [_typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {}]);
12219
+ _this60 = _callSuper(this, Qt, [_typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {}]);
12107
12220
  var _Qt$processConfigurat = Qt.processConfiguration(t, e.speechToText),
12108
12221
  n = _Qt$processConfigurat.serviceName,
12109
12222
  r = _Qt$processConfigurat.processedConfig;
12110
- if (_this57._addErrorMessage = i, n === "webspeech" && !Oi.isWebSpeechSupported()) _this57.changeToUnsupported();else {
12223
+ if (_this60._addErrorMessage = i, n === "webspeech" && !Oi.isWebSpeechSupported()) _this60.changeToUnsupported();else {
12111
12224
  var a = !e.textInput || !e.textInput.disabled;
12112
- _this57.elementRef.onclick = _this57.buttonClick.bind(_assertThisInitialized(_this57), t, a, n, r);
12225
+ _this60.elementRef.onclick = _this60.buttonClick.bind(_assertThisInitialized(_this60), t, a, n, r);
12113
12226
  }
12114
- return _this57;
12227
+ return _this60;
12115
12228
  }
12116
12229
  // prettier-ignore
12117
12230
  _createClass(Qt, [{
@@ -12191,11 +12304,11 @@ var Es = /*#__PURE__*/function () {
12191
12304
  var Ta = /*#__PURE__*/function (_xt2) {
12192
12305
  _inherits(Ta, _xt2);
12193
12306
  function Ta(e, t) {
12194
- var _this58;
12307
+ var _this61;
12195
12308
  _classCallCheck(this, Ta);
12196
12309
  var i, n;
12197
- _this58 = _callSuper(this, Ta, [t.button]), _this58._waitingForBrowserApproval = !1, _this58._audioType = e, _this58._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this58._maxDurationSeconds = (n = t.files) == null ? void 0 : n.maxDurationSeconds, _this58.elementRef.onclick = _this58.buttonClick.bind(_assertThisInitialized(_this58));
12198
- return _this58;
12310
+ _this61 = _callSuper(this, Ta, [t.button]), _this61._waitingForBrowserApproval = !1, _this61._audioType = e, _this61._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this61._maxDurationSeconds = (n = t.files) == null ? void 0 : n.maxDurationSeconds, _this61.elementRef.onclick = _this61.buttonClick.bind(_assertThisInitialized(_this61));
12311
+ return _this61;
12199
12312
  }
12200
12313
  _createClass(Ta, [{
12201
12314
  key: "buttonClick",
@@ -12205,10 +12318,10 @@ var Ta = /*#__PURE__*/function (_xt2) {
12205
12318
  }, {
12206
12319
  key: "stop",
12207
12320
  value: function stop() {
12208
- var _this59 = this;
12321
+ var _this62 = this;
12209
12322
  return new Promise(function (e) {
12210
12323
  var t, i;
12211
- _this59.changeToDefault(), (t = _this59._mediaRecorder) == null || t.stop(), (i = _this59._mediaStream) == null || i.getTracks().forEach(function (n) {
12324
+ _this62.changeToDefault(), (t = _this62._mediaRecorder) == null || t.stop(), (i = _this62._mediaStream) == null || i.getTracks().forEach(function (n) {
12212
12325
  return n.stop();
12213
12326
  }), setTimeout(function () {
12214
12327
  e();
@@ -12218,23 +12331,23 @@ var Ta = /*#__PURE__*/function (_xt2) {
12218
12331
  }, {
12219
12332
  key: "record",
12220
12333
  value: function record() {
12221
- var _this60 = this;
12334
+ var _this63 = this;
12222
12335
  navigator.mediaDevices.getUserMedia({
12223
12336
  audio: !0
12224
12337
  }).then(function (e) {
12225
- _this60.changeToActive(), _this60._mediaRecorder = new MediaRecorder(e), _this60._audioType.addPlaceholderAttachment(_this60.stop.bind(_this60), _this60._maxDurationSeconds), _this60._mediaStream = e, _this60._mediaRecorder.addEventListener("dataavailable", function (t) {
12226
- _this60.createFile(t);
12227
- }), _this60._mediaRecorder.start();
12338
+ _this63.changeToActive(), _this63._mediaRecorder = new MediaRecorder(e), _this63._audioType.addPlaceholderAttachment(_this63.stop.bind(_this63), _this63._maxDurationSeconds), _this63._mediaStream = e, _this63._mediaRecorder.addEventListener("dataavailable", function (t) {
12339
+ _this63.createFile(t);
12340
+ }), _this63._mediaRecorder.start();
12228
12341
  })["catch"](function (e) {
12229
- console.error(e), _this60.stop();
12342
+ console.error(e), _this63.stop();
12230
12343
  })["finally"](function () {
12231
- _this60._waitingForBrowserApproval = !1;
12344
+ _this63._waitingForBrowserApproval = !1;
12232
12345
  });
12233
12346
  }
12234
12347
  }, {
12235
12348
  key: "createFile",
12236
12349
  value: function createFile(e) {
12237
- var _this61 = this;
12350
+ var _this64 = this;
12238
12351
  var t = new Blob([e.data], {
12239
12352
  type: "audio/".concat(this._extension)
12240
12353
  }),
@@ -12244,7 +12357,7 @@ var Ta = /*#__PURE__*/function (_xt2) {
12244
12357
  }),
12245
12358
  r = new FileReader();
12246
12359
  r.readAsDataURL(n), r.onload = function (o) {
12247
- _this61._audioType.completePlaceholderAttachment(n, o.target.result);
12360
+ _this64._audioType.completePlaceholderAttachment(n, o.target.result);
12248
12361
  };
12249
12362
  }
12250
12363
  }]);
@@ -12323,19 +12436,19 @@ var _i = /*#__PURE__*/function (_Tt4) {
12323
12436
  _inherits(I, _Tt4);
12324
12437
  // prettier-ignore
12325
12438
  function I(e, t, i, n, r) {
12326
- var _this62;
12439
+ var _this65;
12327
12440
  _classCallCheck(this, I);
12328
12441
  var o = Le.process(e.submitButtonStyles);
12329
- _this62 = _callSuper(this, I, [I.createButtonContainerElement(), o == null ? void 0 : o.position, o]), _this62._isSVGLoadingIconOverriden = !1, _this62.status = {
12442
+ _this65 = _callSuper(this, I, [I.createButtonContainerElement(), o == null ? void 0 : o.position, o]), _this65._isSVGLoadingIconOverriden = !1, _this65.status = {
12330
12443
  requestInProgress: !1,
12331
12444
  loadingActive: !1
12332
- }, _this62._messages = i, _this62._inputElementRef = t, _this62._fileAttachments = r, _this62._innerElements = _this62.createInnerElements(), _this62._abortStream = new AbortController(), _this62._stopClicked = {
12445
+ }, _this65._messages = i, _this65._inputElementRef = t, _this65._fileAttachments = r, _this65._innerElements = _this65.createInnerElements(), _this65._abortStream = new AbortController(), _this65._stopClicked = {
12333
12446
  listener: function listener() {}
12334
- }, _this62._serviceIO = n, _this62._alwaysEnabled = !!(o != null && o.alwaysEnabled), e.disableSubmitButton = _this62.disableSubmitButton.bind(_assertThisInitialized(_this62), n), _this62.attemptOverwriteLoadingStyle(e), setTimeout(function () {
12447
+ }, _this65._serviceIO = n, _this65._alwaysEnabled = !!(o != null && o.alwaysEnabled), e.disableSubmitButton = _this65.disableSubmitButton.bind(_assertThisInitialized(_this65), n), _this65.attemptOverwriteLoadingStyle(e), setTimeout(function () {
12335
12448
  var a;
12336
- _this62._validationHandler = e._validationHandler, _this62.assignHandlers(_this62._validationHandler), (a = _this62._validationHandler) == null || a.call(_assertThisInitialized(_this62));
12449
+ _this65._validationHandler = e._validationHandler, _this65.assignHandlers(_this65._validationHandler), (a = _this65._validationHandler) == null || a.call(_assertThisInitialized(_this65));
12337
12450
  });
12338
- return _this62;
12451
+ return _this65;
12339
12452
  }
12340
12453
  // prettier-ignore
12341
12454
  _createClass(I, [{
@@ -12390,12 +12503,12 @@ var _i = /*#__PURE__*/function (_Tt4) {
12390
12503
  }, {
12391
12504
  key: "submitFromInput",
12392
12505
  value: function () {
12393
- var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103() {
12506
+ var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee107() {
12394
12507
  var t, e, _i19;
12395
- return _regeneratorRuntime().wrap(function _callee103$(_context103) {
12396
- while (1) switch (_context103.prev = _context103.next) {
12508
+ return _regeneratorRuntime().wrap(function _callee107$(_context107) {
12509
+ while (1) switch (_context107.prev = _context107.next) {
12397
12510
  case 0:
12398
- _context103.next = 2;
12511
+ _context107.next = 2;
12399
12512
  return this._fileAttachments.completePlaceholders();
12400
12513
  case 2:
12401
12514
  e = this._fileAttachments.getAllFileData();
@@ -12411,9 +12524,9 @@ var _i = /*#__PURE__*/function (_Tt4) {
12411
12524
  }
12412
12525
  case 4:
12413
12526
  case "end":
12414
- return _context103.stop();
12527
+ return _context107.stop();
12415
12528
  }
12416
- }, _callee103, this);
12529
+ }, _callee107, this);
12417
12530
  }));
12418
12531
  function submitFromInput() {
12419
12532
  return _submitFromInput.apply(this, arguments);
@@ -12423,11 +12536,11 @@ var _i = /*#__PURE__*/function (_Tt4) {
12423
12536
  }, {
12424
12537
  key: "programmaticSubmit",
12425
12538
  value: function () {
12426
- var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e) {
12427
- var _this63 = this;
12539
+ var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee108(e) {
12540
+ var _this66 = this;
12428
12541
  var t;
12429
- return _regeneratorRuntime().wrap(function _callee104$(_context104) {
12430
- while (1) switch (_context104.prev = _context104.next) {
12542
+ return _regeneratorRuntime().wrap(function _callee108$(_context108) {
12543
+ while (1) switch (_context108.prev = _context108.next) {
12431
12544
  case 0:
12432
12545
  typeof e == "string" && (e = Re.processSubmitUserMessage(e));
12433
12546
  t = {
@@ -12439,15 +12552,15 @@ var _i = /*#__PURE__*/function (_Tt4) {
12439
12552
  type: he.getTypeFromBlob(i)
12440
12553
  };
12441
12554
  })), setTimeout(function () {
12442
- return _this63.attemptSubmit(t, !0);
12555
+ return _this66.attemptSubmit(t, !0);
12443
12556
  });
12444
12557
  case 3:
12445
12558
  case "end":
12446
- return _context104.stop();
12559
+ return _context108.stop();
12447
12560
  }
12448
- }, _callee104);
12561
+ }, _callee108);
12449
12562
  }));
12450
- function programmaticSubmit(_x189) {
12563
+ function programmaticSubmit(_x193) {
12451
12564
  return _programmaticSubmit.apply(this, arguments);
12452
12565
  }
12453
12566
  return programmaticSubmit;
@@ -12455,31 +12568,31 @@ var _i = /*#__PURE__*/function (_Tt4) {
12455
12568
  }, {
12456
12569
  key: "attemptSubmit",
12457
12570
  value: function () {
12458
- var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(e) {
12571
+ var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee109(e) {
12459
12572
  var t,
12460
12573
  r,
12461
12574
  o,
12462
12575
  a,
12463
12576
  i,
12464
12577
  n,
12465
- _args105 = arguments;
12466
- return _regeneratorRuntime().wrap(function _callee105$(_context105) {
12467
- while (1) switch (_context105.prev = _context105.next) {
12578
+ _args109 = arguments;
12579
+ return _regeneratorRuntime().wrap(function _callee109$(_context109) {
12580
+ while (1) switch (_context109.prev = _context109.next) {
12468
12581
  case 0:
12469
- t = _args105.length > 1 && _args105[1] !== undefined ? _args105[1] : !1;
12470
- _context105.next = 3;
12582
+ t = _args109.length > 1 && _args109[1] !== undefined ? _args109[1] : !1;
12583
+ _context109.next = 3;
12471
12584
  return (r = this._validationHandler) == null ? void 0 : r.call(this, t ? e : void 0);
12472
12585
  case 3:
12473
- _context105.t0 = _context105.sent;
12474
- _context105.t1 = !1;
12475
- if (!(_context105.t0 === _context105.t1)) {
12476
- _context105.next = 7;
12586
+ _context109.t0 = _context109.sent;
12587
+ _context109.t1 = !1;
12588
+ if (!(_context109.t0 === _context109.t1)) {
12589
+ _context109.next = 7;
12477
12590
  break;
12478
12591
  }
12479
- return _context105.abrupt("return");
12592
+ return _context109.abrupt("return");
12480
12593
  case 7:
12481
12594
  this.changeToLoadingIcon();
12482
- _context105.next = 10;
12595
+ _context109.next = 10;
12483
12596
  return this.addNewMessage(e);
12484
12597
  case 10:
12485
12598
  this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
@@ -12490,17 +12603,17 @@ var _i = /*#__PURE__*/function (_Tt4) {
12490
12603
  text: e.text === "" ? void 0 : e.text,
12491
12604
  files: i
12492
12605
  };
12493
- _context105.next = 15;
12606
+ _context109.next = 15;
12494
12607
  return this._serviceIO.callAPI(n, this._messages);
12495
12608
  case 15:
12496
12609
  (a = this._fileAttachments) == null || a.removeAllFiles();
12497
12610
  case 16:
12498
12611
  case "end":
12499
- return _context105.stop();
12612
+ return _context109.stop();
12500
12613
  }
12501
- }, _callee105, this);
12614
+ }, _callee109, this);
12502
12615
  }));
12503
- function attemptSubmit(_x190) {
12616
+ function attemptSubmit(_x194) {
12504
12617
  return _attemptSubmit.apply(this, arguments);
12505
12618
  }
12506
12619
  return attemptSubmit;
@@ -12508,35 +12621,35 @@ var _i = /*#__PURE__*/function (_Tt4) {
12508
12621
  }, {
12509
12622
  key: "addNewMessage",
12510
12623
  value: function () {
12511
- var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(_ref14) {
12624
+ var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee110(_ref14) {
12512
12625
  var e, t, i;
12513
- return _regeneratorRuntime().wrap(function _callee106$(_context106) {
12514
- while (1) switch (_context106.prev = _context106.next) {
12626
+ return _regeneratorRuntime().wrap(function _callee110$(_context110) {
12627
+ while (1) switch (_context110.prev = _context110.next) {
12515
12628
  case 0:
12516
12629
  e = _ref14.text, t = _ref14.files;
12517
12630
  i = {
12518
12631
  role: b.USER_ROLE
12519
12632
  };
12520
12633
  e && (i.text = e);
12521
- _context106.t0 = t;
12522
- if (!_context106.t0) {
12523
- _context106.next = 8;
12634
+ _context110.t0 = t;
12635
+ if (!_context110.t0) {
12636
+ _context110.next = 8;
12524
12637
  break;
12525
12638
  }
12526
- _context106.next = 7;
12639
+ _context110.next = 7;
12527
12640
  return this._messages.addMultipleFiles(t);
12528
12641
  case 7:
12529
- i.files = _context106.sent;
12642
+ i.files = _context110.sent;
12530
12643
  case 8:
12531
12644
  this._serviceIO.sessionId && (i._sessionId = this._serviceIO.sessionId);
12532
12645
  Object.keys(i).length > 0 && this._messages.addNewMessage(i);
12533
12646
  case 10:
12534
12647
  case "end":
12535
- return _context106.stop();
12648
+ return _context110.stop();
12536
12649
  }
12537
- }, _callee106, this);
12650
+ }, _callee110, this);
12538
12651
  }));
12539
- function addNewMessage(_x191) {
12652
+ function addNewMessage(_x195) {
12540
12653
  return _addNewMessage.apply(this, arguments);
12541
12654
  }
12542
12655
  return addNewMessage;
@@ -12586,7 +12699,7 @@ var _i = /*#__PURE__*/function (_Tt4) {
12586
12699
  }, {
12587
12700
  key: "createSubmitIconElement",
12588
12701
  value: function createSubmitIconElement() {
12589
- var e = G.createSVGElement(Ca);
12702
+ var e = V.createSVGElement(Ca);
12590
12703
  return e.id = "submit-icon", e;
12591
12704
  }
12592
12705
  }, {
@@ -12616,14 +12729,14 @@ var rn = /*#__PURE__*/function (_ct) {
12616
12729
  _inherits(rn, _ct);
12617
12730
  // prettier-ignore
12618
12731
  function rn(e, t, i, n) {
12619
- var _this64;
12732
+ var _this67;
12620
12733
  _classCallCheck(this, rn);
12621
- _this64 = _callSuper(this, rn, [e, ["modal-content", "modal-camera-content"], i]), _this64._stopped = !1, _this64._format = "image/png", _this64._canvas = document.createElement("canvas"), _this64._canvas.classList.add("camera-modal-canvas");
12622
- var _this64$addButtonsAnd = _this64.addButtonsAndTheirEvents(t),
12623
- r = _this64$addButtonsAnd.captureButton,
12624
- o = _this64$addButtonsAnd.submitButton;
12625
- _this64._captureButton = r, _this64._submitButton = o, _this64._captureIcon = _this64._captureButton.children[0], _this64._refreshIcon = G.createSVGElement(ka), _this64._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this64._format = "image/jpeg"), n != null && n.dimensions && (_this64._dimensions = n.dimensions), _this64._contentRef.appendChild(_this64._canvas), _this64.extensionCloseCallback = _this64.stop;
12626
- return _this64;
12734
+ _this67 = _callSuper(this, rn, [e, ["modal-content", "modal-camera-content"], i]), _this67._stopped = !1, _this67._format = "image/png", _this67._canvas = document.createElement("canvas"), _this67._canvas.classList.add("camera-modal-canvas");
12735
+ var _this67$addButtonsAnd = _this67.addButtonsAndTheirEvents(t),
12736
+ r = _this67$addButtonsAnd.captureButton,
12737
+ o = _this67$addButtonsAnd.submitButton;
12738
+ _this67._captureButton = r, _this67._submitButton = o, _this67._captureIcon = _this67._captureButton.children[0], _this67._refreshIcon = V.createSVGElement(ka), _this67._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this67._format = "image/jpeg"), n != null && n.dimensions && (_this67._dimensions = n.dimensions), _this67._contentRef.appendChild(_this67._canvas), _this67.extensionCloseCallback = _this67.stop;
12739
+ return _this67;
12627
12740
  }
12628
12741
  _createClass(rn, [{
12629
12742
  key: "addButtonsAndTheirEvents",
@@ -12642,38 +12755,38 @@ var rn = /*#__PURE__*/function (_ct) {
12642
12755
  }, {
12643
12756
  key: "addButtonEvents",
12644
12757
  value: function addButtonEvents(e, t, i, n) {
12645
- var _this65 = this;
12758
+ var _this68 = this;
12646
12759
  e.onclick = function () {
12647
- _this65.capture();
12760
+ _this68.capture();
12648
12761
  }, t.addEventListener("click", this.stop.bind(this)), i.onclick = function () {
12649
- var r = _this65.getFile();
12650
- r && Ct.addFilesToType([r], [n]), _this65.stop(), _this65.close();
12762
+ var r = _this68.getFile();
12763
+ r && Ct.addFilesToType([r], [n]), _this68.stop(), _this68.close();
12651
12764
  };
12652
12765
  }
12653
12766
  }, {
12654
12767
  key: "stop",
12655
12768
  value: function stop() {
12656
- var _this66 = this;
12769
+ var _this69 = this;
12657
12770
  this._mediaStream && this._mediaStream.getTracks().forEach(function (e) {
12658
12771
  return e.stop();
12659
12772
  }), this._stopped = !0, setTimeout(function () {
12660
- _this66._captureButton.replaceChildren(_this66._captureIcon), _this66._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
12661
- var e = _this66._canvas.getContext("2d");
12662
- e == null || e.clearRect(0, 0, _this66._canvas.width, _this66._canvas.height);
12773
+ _this69._captureButton.replaceChildren(_this69._captureIcon), _this69._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
12774
+ var e = _this69._canvas.getContext("2d");
12775
+ e == null || e.clearRect(0, 0, _this69._canvas.width, _this69._canvas.height);
12663
12776
  }, ct.MODAL_CLOSE_TIMEOUT_MS);
12664
12777
  }
12665
12778
  }, {
12666
12779
  key: "start",
12667
12780
  value: function start() {
12668
- var _this67 = this;
12781
+ var _this70 = this;
12669
12782
  this._dataURL = void 0, this._submitButton.classList.add("modal-svg-submit-disabled"), this._stopped = !1, navigator.mediaDevices.getUserMedia({
12670
12783
  video: this._dimensions || !0
12671
12784
  }).then(function (e) {
12672
- if (_this67._mediaStream = e, !_this67.isOpen()) return _this67.stop();
12785
+ if (_this70._mediaStream = e, !_this70.isOpen()) return _this70.stop();
12673
12786
  var t = document.createElement("video");
12674
- t.srcObject = e, t.play(), requestAnimationFrame(_this67.updateCanvas.bind(_this67, t, _this67._canvas));
12787
+ t.srcObject = e, t.play(), requestAnimationFrame(_this70.updateCanvas.bind(_this70, t, _this70._canvas));
12675
12788
  })["catch"](function (e) {
12676
- console.error(e), _this67.stop(), _this67.close();
12789
+ console.error(e), _this70.stop(), _this70.close();
12677
12790
  });
12678
12791
  }
12679
12792
  }, {
@@ -12730,13 +12843,13 @@ var Na = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
12730
12843
  var ei = /*#__PURE__*/function (_Tt5) {
12731
12844
  _inherits(ei, _Tt5);
12732
12845
  function ei(e, t, i) {
12733
- var _this68;
12846
+ var _this71;
12734
12847
  _classCallCheck(this, ei);
12735
12848
  var r;
12736
- _this68 = _callSuper(this, ei, [ei.createButtonElement(), (r = i == null ? void 0 : i.button) == null ? void 0 : r.position, (i == null ? void 0 : i.button) || {}, "Photo"]);
12737
- var n = _this68.createInnerElements(_this68._customStyles);
12738
- i && _this68.addClickEvent(e, t, i.modalContainerStyle, i.files), _this68.elementRef.classList.add("upload-file-button"), _this68.elementRef.appendChild(n.styles), _this68.reapplyStateStyle("styles");
12739
- return _this68;
12849
+ _this71 = _callSuper(this, ei, [ei.createButtonElement(), (r = i == null ? void 0 : i.button) == null ? void 0 : r.position, (i == null ? void 0 : i.button) || {}, "Photo"]);
12850
+ var n = _this71.createInnerElements(_this71._customStyles);
12851
+ i && _this71.addClickEvent(e, t, i.modalContainerStyle, i.files), _this71.elementRef.classList.add("upload-file-button"), _this71.elementRef.appendChild(n.styles), _this71.reapplyStateStyle("styles");
12852
+ return _this71;
12740
12853
  }
12741
12854
  _createClass(ei, [{
12742
12855
  key: "createInnerElements",
@@ -12767,7 +12880,7 @@ var ei = /*#__PURE__*/function (_Tt5) {
12767
12880
  }, {
12768
12881
  key: "createSVGIconElement",
12769
12882
  value: function createSVGIconElement() {
12770
- var e = G.createSVGElement(Na);
12883
+ var e = V.createSVGElement(Na);
12771
12884
  return e.id = "camera-icon", e;
12772
12885
  }
12773
12886
  }]);
@@ -12802,9 +12915,9 @@ var mt = /*#__PURE__*/function () {
12802
12915
  };
12803
12916
  }
12804
12917
  if ((l = t.recordAudio) != null && l.files) {
12805
- var _d2 = ((c = n.audio) == null ? void 0 : c.fileType) || r.addType(e, t.recordAudio.files, "audio");
12918
+ var _d = ((c = n.audio) == null ? void 0 : c.fileType) || r.addType(e, t.recordAudio.files, "audio");
12806
12919
  n.microphone = {
12807
- button: new Ta(_d2, t.recordAudio)
12920
+ button: new Ta(_d, t.recordAudio)
12808
12921
  };
12809
12922
  }
12810
12923
  return de.isEnabled(r, e.dragAndDrop) && de.create(i, r, e.dragAndDrop), r;
@@ -12840,7 +12953,7 @@ var mt = /*#__PURE__*/function () {
12840
12953
  }, {
12841
12954
  key: "addElements",
12842
12955
  value: function addElements(e, t, i, n, r, o) {
12843
- Z.addElements(e, t.elementRef);
12956
+ G.addElements(e, t.elementRef);
12844
12957
  var a = tt.create(),
12845
12958
  l = F.addButtons(a, i, n, o);
12846
12959
  Xo.set(t.inputElementRef, a, r.elementRef, l), tt.add(e, a);
@@ -12860,7 +12973,7 @@ var on = /*#__PURE__*/function () {
12860
12973
  var r = new ge(e, t, i);
12861
12974
  t.websocket && B.createConnection(t, r);
12862
12975
  var o = new mt(e, r, t, n);
12863
- return Z.addElements(n, r.elementRef, o.elementRef), n;
12976
+ return G.addElements(n, r.elementRef, o.elementRef), n;
12864
12977
  }
12865
12978
  }, {
12866
12979
  key: "render",
@@ -12881,22 +12994,22 @@ var Pa = Object.defineProperty,
12881
12994
  var v = /*#__PURE__*/function (_So) {
12882
12995
  _inherits(v, _So);
12883
12996
  function v() {
12884
- var _this69;
12997
+ var _this72;
12885
12998
  _classCallCheck(this, v);
12886
- _this69 = _callSuper(this, v), _this69.getMessages = function () {
12999
+ _this72 = _callSuper(this, v), _this72.getMessages = function () {
12887
13000
  return [];
12888
- }, _this69.submitUserMessage = function () {
13001
+ }, _this72.submitUserMessage = function () {
12889
13002
  return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
12890
- }, _this69.focusInput = function () {
12891
- return ti.focusFromParentElement(_this69._elementRef);
12892
- }, _this69.refreshMessages = function () {}, _this69.clearMessages = function () {}, _this69.scrollToBottom = function () {}, _this69.disableSubmitButton = function () {}, _this69._hasBeenRendered = !1, _this69._auxiliaryStyleApplied = !1, _this69._addMessage = function () {
13003
+ }, _this72.focusInput = function () {
13004
+ return ti.focusFromParentElement(_this72._elementRef);
13005
+ }, _this72.refreshMessages = function () {}, _this72.clearMessages = function () {}, _this72.scrollToBottom = function () {}, _this72.disableSubmitButton = function () {}, _this72._hasBeenRendered = !1, _this72._auxiliaryStyleApplied = !1, _this72._addMessage = function () {
12893
13006
  return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
12894
- }, Ko.appendStyleSheetToHead(), _this69._elementRef = document.createElement("div"), _this69._elementRef.id = "container", _this69.attachShadow({
13007
+ }, Ko.appendStyleSheetToHead(), _this72._elementRef = document.createElement("div"), _this72._elementRef.id = "container", _this72.attachShadow({
12895
13008
  mode: "open"
12896
- }).appendChild(_this69._elementRef), wi.apply(Oa, _this69.shadowRoot), setTimeout(function () {
12897
- _this69._hasBeenRendered || _this69.onRender();
13009
+ }).appendChild(_this72._elementRef), wi.apply(Oa, _this72.shadowRoot), setTimeout(function () {
13010
+ _this72._hasBeenRendered || _this72.onRender();
12898
13011
  }, 20);
12899
- return _this69;
13012
+ return _this72;
12900
13013
  }
12901
13014
  _createClass(v, [{
12902
13015
  key: "changeToChatView",