deep-chat-dev 9.0.198 → 9.0.199

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
@@ -490,11 +490,11 @@ var Ri = /*#__PURE__*/function () {
490
490
  }();
491
491
  Ri.LOAD_VOICES_MS = 200;
492
492
  var bt = Ri;
493
- var ae = /*#__PURE__*/function () {
494
- function ae() {
495
- _classCallCheck(this, ae);
493
+ var le = /*#__PURE__*/function () {
494
+ function le() {
495
+ _classCallCheck(this, le);
496
496
  }
497
- return _createClass(ae, null, [{
497
+ return _createClass(le, null, [{
498
498
  key: "checkForContainerStyles",
499
499
  value: function checkForContainerStyles(e, t) {
500
500
  var i = e.containerStyle;
@@ -667,20 +667,20 @@ var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
667
667
  }();
668
668
  Y.CONTAINER_CLASS = "avatar-container";
669
669
  var Mt = Y;
670
- var pe = /*#__PURE__*/function () {
671
- function pe() {
672
- _classCallCheck(this, pe);
670
+ var me = /*#__PURE__*/function () {
671
+ function me() {
672
+ _classCallCheck(this, me);
673
673
  }
674
- return _createClass(pe, null, [{
674
+ return _createClass(me, null, [{
675
675
  key: "hide",
676
676
  value: function hide(e) {
677
677
  var t;
678
- (t = e.getElementsByClassName(pe.NAME_CLASS)[0].style).visibility || (t.visibility = "hidden");
678
+ (t = e.getElementsByClassName(me.NAME_CLASS)[0].style).visibility || (t.visibility = "hidden");
679
679
  }
680
680
  }, {
681
681
  key: "reveal",
682
682
  value: function reveal(e) {
683
- e.getElementsByClassName(pe.NAME_CLASS)[0].style.visibility = "";
683
+ e.getElementsByClassName(me.NAME_CLASS)[0].style.visibility = "";
684
684
  }
685
685
  }, {
686
686
  key: "getPosition",
@@ -706,20 +706,20 @@ var pe = /*#__PURE__*/function () {
706
706
  key: "createName",
707
707
  value: function createName(e, t) {
708
708
  var i = document.createElement("div");
709
- return i.classList.add(pe.NAME_CLASS), i.textContent = pe.getNameText(e, t), pe.applyStyle(i, e, t), i;
709
+ return i.classList.add(me.NAME_CLASS), i.textContent = me.getNameText(e, t), me.applyStyle(i, e, t), i;
710
710
  }
711
711
  }, {
712
712
  key: "add",
713
713
  value: function add(e, t, i) {
714
714
  var s = typeof i == "boolean" ? {} : i,
715
- r = pe.createName(t, s),
716
- o = pe.getPosition(t, s);
715
+ r = me.createName(t, s),
716
+ o = me.getPosition(t, s);
717
717
  r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
718
718
  }
719
719
  }]);
720
720
  }();
721
- pe.NAME_CLASS = "name";
722
- var Rt = pe;
721
+ me.NAME_CLASS = "name";
722
+ var Rt = me;
723
723
  var C = /*#__PURE__*/function () {
724
724
  function C() {
725
725
  _classCallCheck(this, C);
@@ -1030,11 +1030,11 @@ var te = /*#__PURE__*/function () {
1030
1030
  }
1031
1031
  }]);
1032
1032
  }();
1033
- var Be = /*#__PURE__*/function () {
1034
- function Be() {
1035
- _classCallCheck(this, Be);
1033
+ var Re = /*#__PURE__*/function () {
1034
+ function Re() {
1035
+ _classCallCheck(this, Re);
1036
1036
  }
1037
- return _createClass(Be, null, [{
1037
+ return _createClass(Re, null, [{
1038
1038
  key: "addElement",
1039
1039
  value: function addElement(e, t) {
1040
1040
  e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
@@ -1047,10 +1047,15 @@ var Be = /*#__PURE__*/function () {
1047
1047
  }
1048
1048
  }, {
1049
1049
  key: "overwrite",
1050
- value: function overwrite(e, t, i, s) {
1050
+ value: function overwrite(e, t, i) {
1051
+ i.bubbleElement.innerHTML = t, te.apply(e, i.outerContainer), le.flagHTMLUpdateClass(i.bubbleElement);
1052
+ }
1053
+ }, {
1054
+ key: "overwriteLast",
1055
+ value: function overwriteLast(e, t, i, s) {
1051
1056
  var r = e.messages,
1052
1057
  o = b.overwriteMessage(r, s, t, i, "html", "html-message");
1053
- return o && (o.bubbleElement.innerHTML = t, te.apply(e, o.outerContainer), ae.flagHTMLUpdateClass(o.bubbleElement)), o;
1058
+ return o && Re.overwrite(e, t, o), o;
1054
1059
  }
1055
1060
  // prettier-ignore
1056
1061
  }, {
@@ -1059,12 +1064,12 @@ var Be = /*#__PURE__*/function () {
1059
1064
  var o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;
1060
1065
  var l;
1061
1066
  if (r != null && r.status) {
1062
- var c = this.overwrite(e, t, i, s);
1067
+ var c = this.overwriteLast(e, t, i, s);
1063
1068
  if (c) return c;
1064
1069
  r.status = !1;
1065
1070
  }
1066
- var a = Be.createElements(e, t, i, o);
1067
- return b.fillEmptyMessageElement(a.bubbleElement, t), te.apply(e, a.outerContainer), ae.flagHTMLUpdateClass(a.bubbleElement), e.applyCustomStyles(a, i, !1, (l = e.messageStyles) == null ? void 0 : l.html), o || Be.addElement(e, a.outerContainer), a;
1071
+ var a = Re.createElements(e, t, i, o);
1072
+ return b.fillEmptyMessageElement(a.bubbleElement, t), te.apply(e, a.outerContainer), le.flagHTMLUpdateClass(a.bubbleElement), e.applyCustomStyles(a, i, !1, (l = e.messageStyles) == null ? void 0 : l.html), o || Re.addElement(e, a.outerContainer), a;
1068
1073
  }
1069
1074
  }]);
1070
1075
  }();
@@ -1942,7 +1947,7 @@ function fr(n, e, t, i) {
1942
1947
  x,
1943
1948
  j,
1944
1949
  G,
1945
- Le,
1950
+ Pe,
1946
1951
  I,
1947
1952
  Z = !0,
1948
1953
  X,
@@ -1955,11 +1960,11 @@ function fr(n, e, t, i) {
1955
1960
  for (j = n.tokens.length, y ? (d = n.bMarks[e] + n.tShift[e], m = Number(n.src.substr(d, h - d - 1)), n.tokens.push({
1956
1961
  type: "ordered_list_open",
1957
1962
  order: m,
1958
- lines: Le = [e, 0],
1963
+ lines: Pe = [e, 0],
1959
1964
  level: n.level++
1960
1965
  })) : n.tokens.push({
1961
1966
  type: "bullet_list_open",
1962
- lines: Le = [e, 0],
1967
+ lines: Pe = [e, 0],
1963
1968
  level: n.level++
1964
1969
  }), s = e, G = !1, X = n.parser.ruler.getRules("list"); s < t && (x = n.skipSpaces(h), u = n.eMarks[s], x >= u ? f = 1 : f = x - h, f > 4 && (f = 1), f < 1 && (f = 1), r = h - n.bMarks[s] + f, n.tokens.push({
1965
1970
  type: "list_item_open",
@@ -1982,7 +1987,7 @@ function fr(n, e, t, i) {
1982
1987
  return n.tokens.push({
1983
1988
  type: y ? "ordered_list_close" : "bullet_list_close",
1984
1989
  level: --n.level
1985
- }), Le[1] = s, n.line = s, Z && ur(n, j), !0;
1990
+ }), Pe[1] = s, n.line = s, Z && ur(n, j), !0;
1986
1991
  }
1987
1992
  function pr(n, e, t, i) {
1988
1993
  var s,
@@ -2906,34 +2911,34 @@ var po = {
2906
2911
  function Sn(n, e, t) {
2907
2912
  this.src = e, this.env = t, this.options = n.options, this.tokens = [], this.inlineMode = !1, this.inline = n.inline, this.block = n.block, this.renderer = n.renderer, this.typographer = n.typographer;
2908
2913
  }
2909
- function Re(n, e) {
2914
+ function Ie(n, e) {
2910
2915
  typeof n != "string" && (e = n, n = "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 Pi(), this.block = new _s(), this.core = new En(), this.renderer = new Ss(), this.ruler = new se(), this.options = {}, this.configure(bo[n]), this.set(e || {});
2911
2916
  }
2912
- Re.prototype.set = function (n) {
2917
+ Ie.prototype.set = function (n) {
2913
2918
  pn(this.options, n);
2914
2919
  };
2915
- Re.prototype.configure = function (n) {
2920
+ Ie.prototype.configure = function (n) {
2916
2921
  var e = this;
2917
2922
  if (!n) throw new Error("Wrong `remarkable` preset, check name/content");
2918
2923
  n.options && e.set(n.options), n.components && Object.keys(n.components).forEach(function (t) {
2919
2924
  n.components[t].rules && e[t].ruler.enable(n.components[t].rules, !0);
2920
2925
  });
2921
2926
  };
2922
- Re.prototype.use = function (n, e) {
2927
+ Ie.prototype.use = function (n, e) {
2923
2928
  return n(this, e), this;
2924
2929
  };
2925
- Re.prototype.parse = function (n, e) {
2930
+ Ie.prototype.parse = function (n, e) {
2926
2931
  var t = new Sn(this, n, e);
2927
2932
  return this.core.process(t), t.tokens;
2928
2933
  };
2929
- Re.prototype.render = function (n, e) {
2934
+ Ie.prototype.render = function (n, e) {
2930
2935
  return e = e || {}, this.renderer.render(this.parse(n, e), this.options, e);
2931
2936
  };
2932
- Re.prototype.parseInline = function (n, e) {
2937
+ Ie.prototype.parseInline = function (n, e) {
2933
2938
  var t = new Sn(this, n, e);
2934
2939
  return t.inlineMode = !0, this.core.process(t), t.tokens;
2935
2940
  };
2936
- Re.prototype.renderInline = function (n, e) {
2941
+ Ie.prototype.renderInline = function (n, e) {
2937
2942
  return e = e || {}, this.renderer.render(this.parseInline(n, e), this.options, e);
2938
2943
  };
2939
2944
  var jt = /*#__PURE__*/function () {
@@ -2944,7 +2949,7 @@ var jt = /*#__PURE__*/function () {
2944
2949
  key: "instantiate",
2945
2950
  value: function instantiate() {
2946
2951
  var e = window.hljs;
2947
- return e ? new Re({
2952
+ return e ? new Ie({
2948
2953
  highlight: function highlight(t, i) {
2949
2954
  if (i && e.getLanguage(i)) try {
2950
2955
  return e.highlight(i, t).value;
@@ -2970,7 +2975,7 @@ var jt = /*#__PURE__*/function () {
2970
2975
  // set target to open in a new tab
2971
2976
  typographer: !0
2972
2977
  // Enable smartypants and other sweet transforms
2973
- }) : new Re({
2978
+ }) : new Ie({
2974
2979
  breaks: !0,
2975
2980
  linkTarget: "_blank"
2976
2981
  // set target to open in a new tab
@@ -3092,7 +3097,7 @@ var hi = /*#__PURE__*/function () {
3092
3097
  }));
3093
3098
  B.reAddFileRefToObject(t, s), (r = e.onMessage) == null || r.call(e, s), e.dispatchEvent(new CustomEvent("message", {
3094
3099
  detail: s
3095
- })), ae.fireOnNewMessage(e, s);
3100
+ })), le.fireOnNewMessage(e, s);
3096
3101
  }
3097
3102
  }, {
3098
3103
  key: "onClearMessages",
@@ -3158,7 +3163,7 @@ var F = /*#__PURE__*/function () {
3158
3163
  var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
3159
3164
  var r, o, a, l;
3160
3165
  var i = (l = (a = (o = (r = e.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.history) == null ? void 0 : a.full) == null ? void 0 : l.html,
3161
- s = i ? Be.createElements(e, i, b.AI_ROLE, !0) : F.createDefaultElements(e);
3166
+ s = i ? Re.createElements(e, i, b.AI_ROLE, !0) : F.createDefaultElements(e);
3162
3167
  return F.addLoadHistoryMessage(s, e, t), s;
3163
3168
  }
3164
3169
  }, {
@@ -3226,15 +3231,15 @@ var q = /*#__PURE__*/function () {
3226
3231
  }
3227
3232
  }]);
3228
3233
  }();
3229
- var Fe = /*#__PURE__*/function () {
3230
- function Fe(e) {
3234
+ var Be = /*#__PURE__*/function () {
3235
+ function Be(e) {
3231
3236
  var _this3 = this;
3232
- _classCallCheck(this, Fe);
3233
- this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef = Fe.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = jt.createNew(), this._avatars = e.avatars, this._names = e.names, this._onMessage = hi.onMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(function () {
3237
+ _classCallCheck(this, Be);
3238
+ this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef = Be.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = jt.createNew(), this._avatars = e.avatars, this._names = e.names, this._onMessage = hi.onMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(function () {
3234
3239
  _this3.submitUserMessage = e.submitUserMessage;
3235
3240
  });
3236
3241
  }
3237
- return _createClass(Fe, [{
3242
+ return _createClass(Be, [{
3238
3243
  key: "addNewTextMessage",
3239
3244
  value: function addNewTextMessage(e, t, i) {
3240
3245
  var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
@@ -3292,7 +3297,7 @@ var Fe = /*#__PURE__*/function () {
3292
3297
  var r;
3293
3298
  (r = this._introPanel) == null || r.hide();
3294
3299
  var s = this.messageElementRefs[this.messageElementRefs.length - 1];
3295
- return Qe.changeFullViewToSmall(this, s), Fe.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), s.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t, i);
3300
+ return Qe.changeFullViewToSmall(this, s), Be.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), s.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t, i);
3296
3301
  }
3297
3302
  // this can be tested by having an ai message, then a temp ai message with html that submits new user message:
3298
3303
  // https://github.com/OvidijusParsiunas/deep-chat/issues/258
@@ -3309,7 +3314,7 @@ var Fe = /*#__PURE__*/function () {
3309
3314
  key: "createMessageElements",
3310
3315
  value: function createMessageElements(e, t) {
3311
3316
  var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
3312
- var s = Fe.createBaseElements(t),
3317
+ var s = Be.createBaseElements(t),
3313
3318
  r = s.outerContainer,
3314
3319
  o = s.innerContainer,
3315
3320
  a = s.bubbleElement;
@@ -3381,7 +3386,7 @@ var Fe = /*#__PURE__*/function () {
3381
3386
  }, {
3382
3387
  key: "isTemporaryElement",
3383
3388
  value: function isTemporaryElement(e) {
3384
- return Fe.isLoadingMessage(e) || Me.isElementTemporary(e);
3389
+ return Be.isLoadingMessage(e) || Me.isElementTemporary(e);
3385
3390
  }
3386
3391
  }, {
3387
3392
  key: "createBaseElements",
@@ -3441,7 +3446,7 @@ var Se = /*#__PURE__*/function () {
3441
3446
  key: "setInitialState",
3442
3447
  value: function setInitialState(e, t, i) {
3443
3448
  var _i8;
3444
- this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : Be.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(Se.MESSAGE_CLASS), this._streamedContent = t, this._activeMessageRole = i, this._message = _defineProperty({
3449
+ this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : Re.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(Se.MESSAGE_CLASS), this._streamedContent = t, this._activeMessageRole = i, this._message = _defineProperty({
3445
3450
  role: this._activeMessageRole
3446
3451
  }, e, this._streamedContent), this._messages.messages.push(this._message);
3447
3452
  }
@@ -3471,7 +3476,7 @@ var Se = /*#__PURE__*/function () {
3471
3476
  var e = this._messages.textElementsToText;
3472
3477
  if (!this._endStreamAfterOperation && !(this._fileAdded && !this._elements)) {
3473
3478
  if (!this._elements) throw Error(M.NO_VALID_STREAM_EVENTS_SENT);
3474
- (t = this._elements.bubbleElement) != null && t.classList.contains(Se.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._message && (this._message.text = this._streamedContent), this._messages.textToSpeech && bt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === Se.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((i = this._elements.bubbleElement) == null ? void 0 : i.innerHTML) || ""), this._elements && te.apply(this._messages, this._elements.outerContainer), this._message && (this._message.html = this._streamedContent)), this._elements.bubbleElement.classList.remove(Se.MESSAGE_CLASS), this._message && this._messages.sendClientUpdate(Fe.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
3479
+ (t = this._elements.bubbleElement) != null && t.classList.contains(Se.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._message && (this._message.text = this._streamedContent), this._messages.textToSpeech && bt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === Se.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((i = this._elements.bubbleElement) == null ? void 0 : i.innerHTML) || ""), this._elements && te.apply(this._messages, this._elements.outerContainer), this._message && (this._message.html = this._streamedContent)), this._elements.bubbleElement.classList.remove(Se.MESSAGE_CLASS), this._message && this._messages.sendClientUpdate(Be.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
3475
3480
  }
3476
3481
  }
3477
3482
  }, {
@@ -3779,7 +3784,7 @@ function wo(n, e) {
3779
3784
  j(), h();
3780
3785
  });
3781
3786
  var G = c !== null && c !== void 0 ? c : window.fetch,
3782
- Le = s !== null && s !== void 0 ? s : To;
3787
+ Pe = s !== null && s !== void 0 ? s : To;
3783
3788
  function I() {
3784
3789
  return _I.apply(this, arguments);
3785
3790
  }
@@ -3799,7 +3804,7 @@ function wo(n, e) {
3799
3804
  case 4:
3800
3805
  X = _context4.sent;
3801
3806
  _context4.next = 7;
3802
- return Le(X);
3807
+ return Pe(X);
3803
3808
  case 7:
3804
3809
  _context4.next = 9;
3805
3810
  return vo(X.body, yo(Eo(function (D) {
@@ -3853,7 +3858,7 @@ var A = /*#__PURE__*/function () {
3853
3858
  x,
3854
3859
  j,
3855
3860
  G,
3856
- Le,
3861
+ Pe,
3857
3862
  o,
3858
3863
  _yield$v$processReque,
3859
3864
  a,
@@ -3908,7 +3913,7 @@ var A = /*#__PURE__*/function () {
3908
3913
  return _context7.abrupt("return", (wo(((j = e.connectSettings) == null ? void 0 : j.url) || e.url || "", {
3909
3914
  method: ((G = e.connectSettings) == null ? void 0 : G.method) || "POST",
3910
3915
  headers: l,
3911
- credentials: (Le = e.connectSettings) == null ? void 0 : Le.credentials,
3916
+ credentials: (Pe = e.connectSettings) == null ? void 0 : Pe.credentials,
3912
3917
  body: s ? JSON.stringify(a) : a,
3913
3918
  openWhenHidden: !0,
3914
3919
  // keep stream open when browser tab not open
@@ -4402,7 +4407,7 @@ var Ce = /*#__PURE__*/function () {
4402
4407
  value: function attemptToFinaliseStream(e, t) {
4403
4408
  try {
4404
4409
  var i = t.messageElementRefs[t.messageElementRefs.length - 1];
4405
- Fe.isLoadingMessage(i) ? t.removeLastMessage() : e.finaliseStreamedMessage();
4410
+ Be.isLoadingMessage(i) ? t.removeLastMessage() : e.finaliseStreamedMessage();
4406
4411
  } catch (i) {
4407
4412
  console.error(i), t.addNewErrorMessage("service", i);
4408
4413
  }
@@ -4905,7 +4910,7 @@ var pt = /*#__PURE__*/function () {
4905
4910
  value: function populateInitialHistory(e) {
4906
4911
  var _this11 = this;
4907
4912
  e.forEach(function (t) {
4908
- ae.processHistoryFile(t), _this11._messages.addNewMessage(t, !0);
4913
+ le.processHistoryFile(t), _this11._messages.addNewMessage(t, !0);
4909
4914
  });
4910
4915
  }
4911
4916
  }, {
@@ -4962,7 +4967,7 @@ var pt = /*#__PURE__*/function () {
4962
4967
  while (1) switch (_context23.prev = _context23.next) {
4963
4968
  case 0:
4964
4969
  e.loadHistory && this.loadInitialHistory(e.loadHistory);
4965
- t = e.history || ae.processHistory(e);
4970
+ t = e.history || le.processHistory(e);
4966
4971
  t && (this.populateInitialHistory(t), this._index += 1);
4967
4972
  case 3:
4968
4973
  case "end":
@@ -5035,7 +5040,7 @@ var P = /*#__PURE__*/function () {
5035
5040
  files: t
5036
5041
  };
5037
5042
  if (_typeof(s) == "object") {
5038
- ae.processFileConfigConnect(s);
5043
+ le.processFileConfigConnect(s);
5039
5044
  var a = s.files,
5040
5045
  l = s.connect,
5041
5046
  c = s.button;
@@ -5134,7 +5139,7 @@ var it = /*#__PURE__*/function () {
5134
5139
  var _a$url;
5135
5140
  _classCallCheck(this, it);
5136
5141
  var s, r, o, a, l;
5137
- this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = it.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (s = e.connect) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (r = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : r.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, P.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = be.URL), this.connectSettings.websocket && U.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || ae.checkForStream(this.deepChat), e.loadHistory && Ht.addErrorPrefix(this);
5142
+ this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = it.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (s = e.connect) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (r = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : r.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, P.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = be.URL), this.connectSettings.websocket && U.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || le.checkForStream(this.deepChat), e.loadHistory && Ht.addErrorPrefix(this);
5138
5143
  }
5139
5144
  return _createClass(it, [{
5140
5145
  key: "verifyKey",
@@ -5294,7 +5299,7 @@ var it = /*#__PURE__*/function () {
5294
5299
  _context29.next = 4;
5295
5300
  break;
5296
5301
  }
5297
- return _context29.abrupt("return", ae.handleResponseProperty(e));
5302
+ return _context29.abrupt("return", le.handleResponseProperty(e));
5298
5303
  case 4:
5299
5304
  if (!v.validateResponseFormat(e)) {
5300
5305
  _context29.next = 6;
@@ -5470,16 +5475,16 @@ var ie = /*#__PURE__*/function () {
5470
5475
  }
5471
5476
  }]);
5472
5477
  }();
5473
- var Oe = /*#__PURE__*/function () {
5474
- function Oe() {
5475
- _classCallCheck(this, Oe);
5478
+ var Ne = /*#__PURE__*/function () {
5479
+ function Ne() {
5480
+ _classCallCheck(this, Ne);
5476
5481
  }
5477
- return _createClass(Oe, null, [{
5482
+ return _createClass(Ne, null, [{
5478
5483
  key: "changeVisibility",
5479
5484
  value:
5480
5485
  // prettier-ignore
5481
5486
  function changeVisibility(e, t, i, s) {
5482
- s.target.id === Oe.VISIBLE_ICON_ID ? (t.style.display = "none", i.style.display = "block", e.type = "password") : (t.style.display = "block", i.style.display = "none", e.type = "text");
5487
+ s.target.id === Ne.VISIBLE_ICON_ID ? (t.style.display = "none", i.style.display = "block", e.type = "password") : (t.style.display = "block", i.style.display = "none", e.type = "text");
5483
5488
  }
5484
5489
  }, {
5485
5490
  key: "createIconElement",
@@ -5493,15 +5498,15 @@ var Oe = /*#__PURE__*/function () {
5493
5498
  value: function create(e) {
5494
5499
  var t = document.createElement("div");
5495
5500
  t.id = "visibility-icon-container";
5496
- var i = Oe.createIconElement(Ao, Oe.VISIBLE_ICON_ID);
5501
+ var i = Ne.createIconElement(Ao, Ne.VISIBLE_ICON_ID);
5497
5502
  i.style.display = "none", t.appendChild(i);
5498
- var s = Oe.createIconElement(Co, "not-visible-icon");
5499
- return t.appendChild(s), t.onclick = Oe.changeVisibility.bind(this, e, i, s), t;
5503
+ var s = Ne.createIconElement(Co, "not-visible-icon");
5504
+ return t.appendChild(s), t.onclick = Ne.changeVisibility.bind(this, e, i, s), t;
5500
5505
  }
5501
5506
  }]);
5502
5507
  }();
5503
- Oe.VISIBLE_ICON_ID = "visible-icon";
5504
- var cs = Oe;
5508
+ Ne.VISIBLE_ICON_ID = "visible-icon";
5509
+ var cs = Ne;
5505
5510
  var H = /*#__PURE__*/function () {
5506
5511
  function H() {
5507
5512
  _classCallCheck(this, H);
@@ -6437,8 +6442,8 @@ var Nt = /*#__PURE__*/function (_z) {
6437
6442
  }]);
6438
6443
  }(z);
6439
6444
  Nt.URL_PREFIX = "https://api-inference.huggingface.co/models/";
6440
- var Ie = Nt;
6441
- var Jt = /*#__PURE__*/function (_Ie) {
6445
+ var Le = Nt;
6446
+ var Jt = /*#__PURE__*/function (_Le) {
6442
6447
  // prettier-ignore
6443
6448
  function Jt(e, t, i, s, r, o) {
6444
6449
  var _this22;
@@ -6446,7 +6451,7 @@ var Jt = /*#__PURE__*/function (_Ie) {
6446
6451
  _this22 = _callSuper(this, Jt, [e, t, i, s, r, o]), _this22.isTextInputDisabled = !0, _this22.canSendMessage = Jt.canSendFile;
6447
6452
  return _this22;
6448
6453
  }
6449
- _inherits(Jt, _Ie);
6454
+ _inherits(Jt, _Le);
6450
6455
  return _createClass(Jt, [{
6451
6456
  key: "preprocessBody",
6452
6457
  value: function preprocessBody(e, t, i) {
@@ -6490,7 +6495,7 @@ var Jt = /*#__PURE__*/function (_Ie) {
6490
6495
  return !!(t != null && t[0]);
6491
6496
  }
6492
6497
  }]);
6493
- }(Ie);
6498
+ }(Le);
6494
6499
  var ko = /*#__PURE__*/function (_Jt) {
6495
6500
  // prettier-ignore
6496
6501
  function ko(e) {
@@ -6893,7 +6898,7 @@ var Ro = /*#__PURE__*/function (_Jt3) {
6893
6898
  }()
6894
6899
  }]);
6895
6900
  }(Jt);
6896
- var Io = /*#__PURE__*/function (_Ie2) {
6901
+ var Io = /*#__PURE__*/function (_Le2) {
6897
6902
  function Io(e) {
6898
6903
  _classCallCheck(this, Io);
6899
6904
  var s, r, o;
@@ -6901,7 +6906,7 @@ var Io = /*#__PURE__*/function (_Ie2) {
6901
6906
  i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
6902
6907
  return _callSuper(this, Io, [e, "Once upon a time", "gpt2", t, i]);
6903
6908
  }
6904
- _inherits(Io, _Ie2);
6909
+ _inherits(Io, _Le2);
6905
6910
  return _createClass(Io, [{
6906
6911
  key: "extractResultData",
6907
6912
  value: function () {
@@ -6931,8 +6936,8 @@ var Io = /*#__PURE__*/function (_Ie2) {
6931
6936
  return extractResultData;
6932
6937
  }()
6933
6938
  }]);
6934
- }(Ie);
6935
- var Lo = /*#__PURE__*/function (_Ie3) {
6939
+ }(Le);
6940
+ var Lo = /*#__PURE__*/function (_Le3) {
6936
6941
  function Lo(e) {
6937
6942
  var _this26;
6938
6943
  _classCallCheck(this, Lo);
@@ -6942,7 +6947,7 @@ var Lo = /*#__PURE__*/function (_Ie3) {
6942
6947
  _this26 = _callSuper(this, Lo, [e, "Ask a question", "bert-large-uncased-whole-word-masking-finetuned-squad", t, i]), _this26.permittedErrorPrefixes = ["Authorization header", "Error in"], _this26.context = t.context;
6943
6948
  return _this26;
6944
6949
  }
6945
- _inherits(Lo, _Ie3);
6950
+ _inherits(Lo, _Le3);
6946
6951
  return _createClass(Lo, [{
6947
6952
  key: "preprocessBody",
6948
6953
  value: function preprocessBody(e, t) {
@@ -6985,8 +6990,8 @@ var Lo = /*#__PURE__*/function (_Ie3) {
6985
6990
  return extractResultData;
6986
6991
  }()
6987
6992
  }]);
6988
- }(Ie);
6989
- var Po = /*#__PURE__*/function (_Ie4) {
6993
+ }(Le);
6994
+ var Po = /*#__PURE__*/function (_Le4) {
6990
6995
  function Po(e) {
6991
6996
  _classCallCheck(this, Po);
6992
6997
  var s, r, o;
@@ -6994,7 +6999,7 @@ var Po = /*#__PURE__*/function (_Ie4) {
6994
6999
  i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
6995
7000
  return _callSuper(this, Po, [e, "Insert text to summarize", "facebook/bart-large-cnn", t, i]);
6996
7001
  }
6997
- _inherits(Po, _Ie4);
7002
+ _inherits(Po, _Le4);
6998
7003
  return _createClass(Po, [{
6999
7004
  key: "extractResultData",
7000
7005
  value: function () {
@@ -7024,8 +7029,8 @@ var Po = /*#__PURE__*/function (_Ie4) {
7024
7029
  return extractResultData;
7025
7030
  }()
7026
7031
  }]);
7027
- }(Ie);
7028
- var Oo = /*#__PURE__*/function (_Ie5) {
7032
+ }(Le);
7033
+ var Oo = /*#__PURE__*/function (_Le5) {
7029
7034
  function Oo(e) {
7030
7035
  var _this27$maxMessages;
7031
7036
  var _this27;
@@ -7037,7 +7042,7 @@ var Oo = /*#__PURE__*/function (_Ie5) {
7037
7042
  return _this27;
7038
7043
  }
7039
7044
  // prettier-ignore
7040
- _inherits(Oo, _Ie5);
7045
+ _inherits(Oo, _Le5);
7041
7046
  return _createClass(Oo, [{
7042
7047
  key: "processMessages",
7043
7048
  value: function processMessages(e) {
@@ -7106,7 +7111,7 @@ var Oo = /*#__PURE__*/function (_Ie5) {
7106
7111
  return extractResultData;
7107
7112
  }()
7108
7113
  }]);
7109
- }(Ie);
7114
+ }(Le);
7110
7115
  var bi = /*#__PURE__*/function (_Oi3) {
7111
7116
  function bi(e) {
7112
7117
  var _this28;
@@ -7214,7 +7219,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
7214
7219
  }
7215
7220
  }]);
7216
7221
  }(Oi);
7217
- var No = /*#__PURE__*/function (_Ie6) {
7222
+ var No = /*#__PURE__*/function (_Le6) {
7218
7223
  function No(e) {
7219
7224
  _classCallCheck(this, No);
7220
7225
  var s, r, o;
@@ -7222,7 +7227,7 @@ var No = /*#__PURE__*/function (_Ie6) {
7222
7227
  i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
7223
7228
  return _callSuper(this, No, [e, "Insert text to translate", "Helsinki-NLP/opus-tatoeba-en-ja", t, i]);
7224
7229
  }
7225
- _inherits(No, _Ie6);
7230
+ _inherits(No, _Le6);
7226
7231
  return _createClass(No, [{
7227
7232
  key: "extractResultData",
7228
7233
  value: function () {
@@ -7252,7 +7257,7 @@ var No = /*#__PURE__*/function (_Ie6) {
7252
7257
  return extractResultData;
7253
7258
  }()
7254
7259
  }]);
7255
- }(Ie);
7260
+ }(Le);
7256
7261
  var vi = /*#__PURE__*/function (_Oi4) {
7257
7262
  function vi(e) {
7258
7263
  var _this29;
@@ -7346,7 +7351,7 @@ var vi = /*#__PURE__*/function (_Oi4) {
7346
7351
  }
7347
7352
  }]);
7348
7353
  }(Oi);
7349
- var Do = /*#__PURE__*/function (_Ie7) {
7354
+ var Do = /*#__PURE__*/function (_Le7) {
7350
7355
  function Do(e) {
7351
7356
  var _this30;
7352
7357
  _classCallCheck(this, Do);
@@ -7356,7 +7361,7 @@ var Do = /*#__PURE__*/function (_Ie7) {
7356
7361
  _this30 = _callSuper(this, Do, [e, "The goal of life is [MASK].", "bert-base-uncased", t, i]), _this30.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>Insert a sentence with the word [MASK] and the model will try to fill it for you. E.g. I want [MASK].</p>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this30.permittedErrorPrefixes = ["Authorization header", "No mask_token"];
7357
7362
  return _this30;
7358
7363
  }
7359
- _inherits(Do, _Ie7);
7364
+ _inherits(Do, _Le7);
7360
7365
  return _createClass(Do, [{
7361
7366
  key: "extractResultData",
7362
7367
  value: function () {
@@ -7386,7 +7391,7 @@ var Do = /*#__PURE__*/function (_Ie7) {
7386
7391
  return extractResultData;
7387
7392
  }()
7388
7393
  }]);
7389
- }(Ie);
7394
+ }(Le);
7390
7395
  var L = /*#__PURE__*/function () {
7391
7396
  function L() {
7392
7397
  _classCallCheck(this, L);
@@ -7769,27 +7774,28 @@ var ee = /*#__PURE__*/function () {
7769
7774
  }();
7770
7775
  ee.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", ee.FUNCTION_TOOL_RESP_ERROR = "Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.";
7771
7776
  var ye = ee;
7772
- var Ne = /*#__PURE__*/function (_z3) {
7773
- function Ne(e, t, i, s) {
7777
+ var De = /*#__PURE__*/function (_z3) {
7778
+ // prettier-ignore
7779
+ function De(e, t, i, s, r, o) {
7774
7780
  var _this31;
7775
- _classCallCheck(this, Ne);
7776
- if (_this31 = _callSuper(this, Ne, [e, L.buildKeyVerificationDetails(), L.buildHeaders, s]), _this31.insertKeyPlaceholderText = "OpenAI API Key", _this31.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this31.url = "", _this31.permittedErrorPrefixes = ["Incorrect", "Please send text", Ht.FAILED_ERROR_MESSAGE], _this31.shouldFetchHistory = !1, _this31.searchedForThreadId = !1, _this31.config = {}, _this31.newAssistantDetails = {
7781
+ _classCallCheck(this, De);
7782
+ if (_this31 = _callSuper(this, De, [e, s, r, o]), _this31.insertKeyPlaceholderText = "OpenAI API Key", _this31.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this31.url = "", _this31.permittedErrorPrefixes = ["Incorrect", "Please send text", Ht.FAILED_ERROR_MESSAGE], _this31.shouldFetchHistory = !1, _this31.searchedForThreadId = !1, _this31.config = {}, _this31.newAssistantDetails = {
7777
7783
  model: "gpt-4"
7778
7784
  }, _this31.waitingForStreamResponse = !1, _this31.isSSEStream = !1, _this31.urlSegments = i, _typeof(t) == "object") {
7779
7785
  _this31.config = t;
7780
7786
  var _this31$config = _this31.config,
7781
- r = _this31$config.new_assistant,
7782
- o = _this31$config.thread_id,
7783
- a = _this31$config.load_thread_history;
7784
- Object.assign(_this31.newAssistantDetails, r), o && (_this31.sessionId = o), a && (_this31.shouldFetchHistory = !0);
7785
- var l = t.function_handler;
7786
- l && (_this31._functionHandler = l), _this31.filesToolType = t.files_tool_type;
7787
+ a = _this31$config.new_assistant,
7788
+ l = _this31$config.thread_id,
7789
+ c = _this31$config.load_thread_history;
7790
+ Object.assign(_this31.newAssistantDetails, a), l && (_this31.sessionId = l), c && (_this31.shouldFetchHistory = !0);
7791
+ var d = t.function_handler;
7792
+ d && (_this31._functionHandler = d), _this31.filesToolType = t.files_tool_type;
7787
7793
  }
7788
7794
  _this31.maxMessages = 1, _this31.isSSEStream = !!(_this31.stream && (_typeof(_this31.stream) != "object" || !_this31.stream.simulation));
7789
7795
  return _assertThisInitialized(_this31);
7790
7796
  }
7791
- _inherits(Ne, _z3);
7792
- return _createClass(Ne, [{
7797
+ _inherits(De, _z3);
7798
+ return _createClass(De, [{
7793
7799
  key: "fetchHistoryFunc",
7794
7800
  value: function () {
7795
7801
  var _fetchHistoryFunc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee70() {
@@ -7838,13 +7844,13 @@ var Ne = /*#__PURE__*/function (_z3) {
7838
7844
  }));
7839
7845
  a === "code_interpreter" || a === "file_search" || a === "images" ? r = a : (console.error("Tool type \"".concat(a, "\" is not valid")), console.error('Expected "code_interpreter" or "file_search" or "images". Going to default to "images"'));
7840
7846
  }
7841
- if (r === "file_search") return Ne.processAttachmentsMessage(s, t, "file_search");
7842
- if (r === "code_interpreter") return Ne.processAttachmentsMessage(s, t, "code_interpreter");
7847
+ if (r === "file_search") return De.processAttachmentsMessage(s, t, "file_search");
7848
+ if (r === "code_interpreter") return De.processAttachmentsMessage(s, t, "code_interpreter");
7843
7849
  if (t.find(function (_ref16) {
7844
7850
  var a = _ref16.name;
7845
7851
  return !B.isImageFileExtension(a);
7846
7852
  })) console.error("The uploaded files contained a non-image file"), console.error('Make sure only images can be uploaded or define a "code_interpreter" or "file_search" value in the "files_tool_type" property'), console.warn('Make sure your existing assistant supports these "tools" or specify them in the "new_assistant" property');else {
7847
- var _a2 = Ne.processImageMessage(s, t);
7853
+ var _a2 = De.processImageMessage(s, t);
7848
7854
  if (_a2) return _a2;
7849
7855
  }
7850
7856
  }
@@ -8108,7 +8114,7 @@ var Ne = /*#__PURE__*/function (_z3) {
8108
8114
  break;
8109
8115
  }
8110
8116
  return _context76.abrupt("return", {
8111
- timeoutMS: Ne.POLLING_TIMEOUT_MS
8117
+ timeoutMS: De.POLLING_TIMEOUT_MS
8112
8118
  });
8113
8119
  case 3:
8114
8120
  if (!(t === "completed" && this.messages)) {
@@ -8221,7 +8227,7 @@ var Ne = /*#__PURE__*/function (_z3) {
8221
8227
  }, "POST");
8222
8228
  case 22:
8223
8229
  return _context77.abrupt("return", {
8224
- timeoutMS: Ne.POLLING_TIMEOUT_MS
8230
+ timeoutMS: De.POLLING_TIMEOUT_MS
8225
8231
  });
8226
8232
  case 23:
8227
8233
  case "end":
@@ -8416,8 +8422,8 @@ var Ne = /*#__PURE__*/function (_z3) {
8416
8422
  }
8417
8423
  }]);
8418
8424
  }(z);
8419
- Ne.POLLING_TIMEOUT_MS = 800;
8420
- var yi = Ne;
8425
+ De.POLLING_TIMEOUT_MS = 800;
8426
+ var yi = De;
8421
8427
  var Ii = /*#__PURE__*/function (_yi) {
8422
8428
  function Ii(e) {
8423
8429
  var _o$headers2, _a$OpenAIBeta;
@@ -8427,7 +8433,7 @@ var Ii = /*#__PURE__*/function (_yi) {
8427
8433
  var t = JSON.parse(JSON.stringify(e.directConnection)),
8428
8434
  i = t.openAI,
8429
8435
  s = (r = t.openAI) == null ? void 0 : r.assistant;
8430
- _this34 = _callSuper(this, Ii, [e, s, Ii.URL_SEGMENTS, i]), (_o$headers2 = (o = _this34.connectSettings).headers) !== null && _o$headers2 !== void 0 ? _o$headers2 : o.headers = {}, (_a$OpenAIBeta = (a = _this34.connectSettings.headers)["OpenAI-Beta"]) !== null && _a$OpenAIBeta !== void 0 ? _a$OpenAIBeta : a["OpenAI-Beta"] = "assistants=v2", _this34.shouldFetchHistory && _this34.sessionId && (_this34.fetchHistory = _this34.fetchHistoryFunc.bind(_assertThisInitialized(_this34)));
8436
+ _this34 = _callSuper(this, Ii, [e, s, Ii.URL_SEGMENTS, L.buildKeyVerificationDetails(), L.buildHeaders, i]), (_o$headers2 = (o = _this34.connectSettings).headers) !== null && _o$headers2 !== void 0 ? _o$headers2 : o.headers = {}, (_a$OpenAIBeta = (a = _this34.connectSettings.headers)["OpenAI-Beta"]) !== null && _a$OpenAIBeta !== void 0 ? _a$OpenAIBeta : a["OpenAI-Beta"] = "assistants=v2", _this34.shouldFetchHistory && _this34.sessionId && (_this34.fetchHistory = _this34.fetchHistoryFunc.bind(_assertThisInitialized(_this34)));
8431
8437
  return _this34;
8432
8438
  }
8433
8439
  _inherits(Ii, _yi);
@@ -8595,7 +8601,7 @@ var Ls = /*#__PURE__*/function () {
8595
8601
  }]);
8596
8602
  }();
8597
8603
  Ls.URL_DETAILS_ERROR_MESSAGE = "Please define the Azure URL Details. [More Information](https://deepchat.dev/docs/directConnection/Azure)";
8598
- var me = Ls;
8604
+ var oe = Ls;
8599
8605
  var mt = /*#__PURE__*/function (_yi2) {
8600
8606
  function mt(e) {
8601
8607
  var _f$headers;
@@ -8612,17 +8618,17 @@ var mt = /*#__PURE__*/function (_yi2) {
8612
8618
  threadsPrefix: "".concat(o).concat(mt.THREAD_RESOURCE),
8613
8619
  threadsPosfix: a,
8614
8620
  newAssistantUrl: "".concat(o).concat(mt.NEW_ASSISTANT_RESOURCE).concat(a),
8615
- createMessagePostfix: "?order=desc&api-version=".concat((u = s == null ? void 0 : s.urlDetails) == null ? void 0 : u.version),
8616
- listMessagesPostfix: a,
8621
+ createMessagePostfix: a,
8622
+ listMessagesPostfix: "order=desc&api-version=".concat((u = s == null ? void 0 : s.urlDetails) == null ? void 0 : u.version),
8617
8623
  storeFiles: "".concat(o, "files").concat(a),
8618
8624
  getFilesPrefix: "".concat(o, "files/"),
8619
8625
  getFilesPostfix: "/content".concat(a)
8620
8626
  };
8621
- _this36 = _callSuper(this, mt, [e, s == null ? void 0 : s.assistant, l, i]), _this36.permittedErrorPrefixes = [me.URL_DETAILS_ERROR_MESSAGE], _this36.isTextInputDisabled = !1, me.validateURLDetails(r) ? (_f$headers = (f = _this36.connectSettings).headers) !== null && _f$headers !== void 0 ? _f$headers : f.headers = {} : (_this36.isTextInputDisabled = !0, _this36.canSendMessage = function () {
8627
+ _this36 = _callSuper(this, mt, [e, s == null ? void 0 : s.assistant, l, oe.buildKeyVerificationDetails(r), oe.buildHeaders, i]), _this36.permittedErrorPrefixes = [oe.URL_DETAILS_ERROR_MESSAGE], _this36.insertKeyPlaceholderText = "Azure OpenAI API Key", _this36.keyHelpUrl = "https://learn.microsoft.com/en-us/answers/questions/1193991/how-to-get-the-value-of-openai-api-key", _this36.isTextInputDisabled = !1, oe.validateURLDetails(r) ? (_f$headers = (f = _this36.connectSettings).headers) !== null && _f$headers !== void 0 ? _f$headers : f.headers = {} : (_this36.isTextInputDisabled = !0, _this36.canSendMessage = function () {
8622
8628
  return !1;
8623
8629
  }, setTimeout(function () {
8624
8630
  e.addMessage({
8625
- error: me.URL_DETAILS_ERROR_MESSAGE
8631
+ error: oe.URL_DETAILS_ERROR_MESSAGE
8626
8632
  });
8627
8633
  }));
8628
8634
  return _this36;
@@ -8803,26 +8809,26 @@ var gt = /*#__PURE__*/function (_z5) {
8803
8809
  }(z);
8804
8810
  gt.DEFAULT_MODEL = "tts-1", gt.DEFAULT_VOIDE = "alloy";
8805
8811
  var us = gt;
8806
- var ce = /*#__PURE__*/function (_z6) {
8807
- function ce(e) {
8812
+ var de = /*#__PURE__*/function (_z6) {
8813
+ function de(e) {
8808
8814
  var _o$model2;
8809
8815
  var _this38;
8810
- _classCallCheck(this, ce);
8816
+ _classCallCheck(this, de);
8811
8817
  var r, o;
8812
8818
  var t = JSON.parse(JSON.stringify(e.directConnection)),
8813
8819
  i = t == null ? void 0 : t.openAI;
8814
- _this38 = _callSuper(this, ce, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, {
8820
+ _this38 = _callSuper(this, de, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, {
8815
8821
  audio: {}
8816
- }]), _this38.insertKeyPlaceholderText = "OpenAI API Key", _this38.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this38.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this38.url = "", _this38.permittedErrorPrefixes = ["Invalid"], _this38.textInputPlaceholderText = "Upload an audio file", _this38._service_url = ce.AUDIO_TRANSCRIPTIONS_URL;
8822
+ }]), _this38.insertKeyPlaceholderText = "OpenAI API Key", _this38.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this38.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this38.url = "", _this38.permittedErrorPrefixes = ["Invalid"], _this38.textInputPlaceholderText = "Upload an audio file", _this38._service_url = de.AUDIO_TRANSCRIPTIONS_URL;
8817
8823
  var s = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
8818
- _typeof(s) == "object" && (_this38.processConfig(s), ce.cleanConfig(s), Object.assign(_this38.rawBody, s)), (_o$model2 = (o = _this38.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = ce.DEFAULT_MODEL, _this38.rawBody.response_format = "json", _this38.canSendMessage = ce.canSendFileMessage;
8824
+ _typeof(s) == "object" && (_this38.processConfig(s), de.cleanConfig(s), Object.assign(_this38.rawBody, s)), (_o$model2 = (o = _this38.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = de.DEFAULT_MODEL, _this38.rawBody.response_format = "json", _this38.canSendMessage = de.canSendFileMessage;
8819
8825
  return _this38;
8820
8826
  }
8821
- _inherits(ce, _z6);
8822
- return _createClass(ce, [{
8827
+ _inherits(de, _z6);
8828
+ return _createClass(de, [{
8823
8829
  key: "processConfig",
8824
8830
  value: function processConfig(e) {
8825
- e != null && e.type && e.type === "translation" && (this._service_url = ce.AUDIO_TRANSLATIONS_URL, delete e.language);
8831
+ e != null && e.type && e.type === "translation" && (this._service_url = de.AUDIO_TRANSLATIONS_URL, delete e.language);
8826
8832
  }
8827
8833
  }, {
8828
8834
  key: "preprocessBody",
@@ -8854,7 +8860,7 @@ var ce = /*#__PURE__*/function (_z6) {
8854
8860
  throw new Error("No file was added");
8855
8861
  case 4:
8856
8862
  this.url = this.connectSettings.url || this._service_url;
8857
- s = this.preprocessBody(this.rawBody, t), r = ce.createFormDataBody(s, i[0]);
8863
+ s = this.preprocessBody(this.rawBody, t), r = de.createFormDataBody(s, i[0]);
8858
8864
  v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
8859
8865
  case 7:
8860
8866
  case "end":
@@ -8914,13 +8920,13 @@ var ce = /*#__PURE__*/function (_z6) {
8914
8920
  }
8915
8921
  }]);
8916
8922
  }(z);
8917
- ce.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", ce.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", ce.DEFAULT_MODEL = "whisper-1";
8918
- var fs = ce;
8919
- var oe = /*#__PURE__*/function () {
8920
- function oe() {
8921
- _classCallCheck(this, oe);
8923
+ de.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", de.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", de.DEFAULT_MODEL = "whisper-1";
8924
+ var fs = de;
8925
+ var ae = /*#__PURE__*/function () {
8926
+ function ae() {
8927
+ _classCallCheck(this, ae);
8922
8928
  }
8923
- return _createClass(oe, null, [{
8929
+ return _createClass(ae, null, [{
8924
8930
  key: "buildTextToSpeechHeaders",
8925
8931
  value: function buildTextToSpeechHeaders(e, t) {
8926
8932
  return {
@@ -8954,7 +8960,7 @@ var oe = /*#__PURE__*/function () {
8954
8960
  "Ocp-Apim-Subscription-Key": "".concat(t)
8955
8961
  };
8956
8962
  },
8957
- handleVerificationResult: oe.handleSpeechVerificationResult
8963
+ handleVerificationResult: ae.handleSpeechVerificationResult
8958
8964
  };
8959
8965
  }
8960
8966
  }, {
@@ -8983,7 +8989,7 @@ var oe = /*#__PURE__*/function () {
8983
8989
  "Ocp-Apim-Subscription-Key": "".concat(t)
8984
8990
  };
8985
8991
  },
8986
- handleVerificationResult: oe.handleLanguageVerificationResult
8992
+ handleVerificationResult: ae.handleLanguageVerificationResult
8987
8993
  };
8988
8994
  }
8989
8995
  // prettier-ignore
@@ -9001,9 +9007,9 @@ var oe = /*#__PURE__*/function () {
9001
9007
  url: "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",
9002
9008
  method: "POST",
9003
9009
  createHeaders: function createHeaders(t) {
9004
- return oe.buildTranslationHeaders(e, t);
9010
+ return ae.buildTranslationHeaders(e, t);
9005
9011
  },
9006
- handleVerificationResult: oe.handleTranslationVerificationResult
9012
+ handleVerificationResult: ae.handleTranslationVerificationResult
9007
9013
  };
9008
9014
  }
9009
9015
  }, {
@@ -9022,7 +9028,7 @@ var Uo = /*#__PURE__*/function (_z7) {
9022
9028
  function Uo(e, t, i, s, r) {
9023
9029
  var _this39;
9024
9030
  _classCallCheck(this, Uo);
9025
- _this39 = _callSuper(this, Uo, [e, oe.buildLanguageKeyVerificationDetails(i), t, s, r]), _this39.insertKeyPlaceholderText = "Azure Language Subscription Key", _this39.keyHelpUrl =
9031
+ _this39 = _callSuper(this, Uo, [e, ae.buildLanguageKeyVerificationDetails(i), t, s, r]), _this39.insertKeyPlaceholderText = "Azure Language Subscription Key", _this39.keyHelpUrl =
9026
9032
  // eslint-disable-next-line max-len
9027
9033
  "https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this39.permittedErrorPrefixes = ["Access"];
9028
9034
  return _this39;
@@ -9038,7 +9044,7 @@ var Dt = /*#__PURE__*/function (_Uo) {
9038
9044
  var s, r, o, a;
9039
9045
  var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.summarization,
9040
9046
  i = (o = e.directConnection) == null ? void 0 : o.azure;
9041
- _this40 = _callSuper(this, Dt, [e, oe.buildSummarizationHeader, t.endpoint, i]), _this40.permittedErrorPrefixes = [Dt.ENDPOINT_ERROR_MESSAGE], _this40.url = "", _this40.textInputPlaceholderText = "Insert text to summarize", _this40.isTextInputDisabled = !1, t.endpoint ? ((_a$language = (a = _this40.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this40.rawBody, t), _this40.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview")) : (_this40.isTextInputDisabled = !0, _this40.canSendMessage = function () {
9047
+ _this40 = _callSuper(this, Dt, [e, ae.buildSummarizationHeader, t.endpoint, i]), _this40.permittedErrorPrefixes = [Dt.ENDPOINT_ERROR_MESSAGE], _this40.url = "", _this40.textInputPlaceholderText = "Insert text to summarize", _this40.isTextInputDisabled = !1, t.endpoint ? ((_a$language = (a = _this40.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this40.rawBody, t), _this40.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview")) : (_this40.isTextInputDisabled = !0, _this40.canSendMessage = function () {
9042
9048
  return !1;
9043
9049
  }, setTimeout(function () {
9044
9050
  e.addMessage({
@@ -9387,7 +9393,7 @@ var _n = /*#__PURE__*/function (_z9) {
9387
9393
  function _n(e, t, i, s, r) {
9388
9394
  var _this42;
9389
9395
  _classCallCheck(this, _n);
9390
- _this42 = _callSuper(this, _n, [e, oe.buildSpeechKeyVerificationDetails(i), t, s, r]), _this42.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this42.keyHelpUrl =
9396
+ _this42 = _callSuper(this, _n, [e, ae.buildSpeechKeyVerificationDetails(i), t, s, r]), _this42.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this42.keyHelpUrl =
9391
9397
  // eslint-disable-next-line max-len
9392
9398
  "https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
9393
9399
  return _this42;
@@ -9404,7 +9410,7 @@ var Je = /*#__PURE__*/function (_n2) {
9404
9410
  var s, r, o, a, l, c;
9405
9411
  var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.textToSpeech,
9406
9412
  i = (o = e.directConnection) == null ? void 0 : o.azure;
9407
- _this43 = _callSuper(this, Je, [e, oe.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i]), _this43.permittedErrorPrefixes = [Je.REGION_ERROR_MESSAGE], _this43.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(Je.HELP_LINK, "\">here</a> for more info.\n </p>"), _this43.isTextInputDisabled = !1, _this43.url = "", t.region ? (Object.assign(_this43.rawBody, t), (_a$lang = (a = _this43.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this43.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this43.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this43.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1")) : (_this43.isTextInputDisabled = !0, _this43.canSendMessage = function () {
9413
+ _this43 = _callSuper(this, Je, [e, ae.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i]), _this43.permittedErrorPrefixes = [Je.REGION_ERROR_MESSAGE], _this43.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(Je.HELP_LINK, "\">here</a> for more info.\n </p>"), _this43.isTextInputDisabled = !1, _this43.url = "", t.region ? (Object.assign(_this43.rawBody, t), (_a$lang = (a = _this43.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this43.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this43.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this43.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1")) : (_this43.isTextInputDisabled = !0, _this43.canSendMessage = function () {
9408
9414
  return !1;
9409
9415
  }, setTimeout(function () {
9410
9416
  e.addMessage({
@@ -9484,10 +9490,10 @@ Je.HELP_LINK =
9484
9490
  // eslint-disable-next-line max-len
9485
9491
  "Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#TextToSpeech)";
9486
9492
  var ms = Je;
9487
- var De = /*#__PURE__*/function (_n3) {
9488
- function De(e) {
9493
+ var Fe = /*#__PURE__*/function (_n3) {
9494
+ function Fe(e) {
9489
9495
  var _this44;
9490
- _classCallCheck(this, De);
9496
+ _classCallCheck(this, Fe);
9491
9497
  var r, o, a;
9492
9498
  var t = (o = (r = e.directConnection) == null ? void 0 : r.azure) == null ? void 0 : o.speechToText,
9493
9499
  i = (a = e.directConnection) == null ? void 0 : a.azure,
@@ -9498,21 +9504,21 @@ var De = /*#__PURE__*/function (_n3) {
9498
9504
  }
9499
9505
  }
9500
9506
  };
9501
- if (_this44 = _callSuper(this, De, [e, oe.buildSpeechToTextHeaders, t.region, i, s]), _this44.permittedErrorPrefixes = [De.REGION_ERROR_MESSAGE], _this44.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(De.HELP_LINK, "\">here</a> for more info.\n </p>"), _this44.url = "", _this44.isTextInputDisabled = !0, _this44.textInputPlaceholderText = "Upload an audio file", !t.region) _this44.isTextInputDisabled = !0, _this44.canSendMessage = function () {
9507
+ if (_this44 = _callSuper(this, Fe, [e, ae.buildSpeechToTextHeaders, t.region, i, s]), _this44.permittedErrorPrefixes = [Fe.REGION_ERROR_MESSAGE], _this44.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(Fe.HELP_LINK, "\">here</a> for more info.\n </p>"), _this44.url = "", _this44.isTextInputDisabled = !0, _this44.textInputPlaceholderText = "Upload an audio file", !t.region) _this44.isTextInputDisabled = !0, _this44.canSendMessage = function () {
9502
9508
  return !1;
9503
9509
  }, setTimeout(function () {
9504
9510
  e.addMessage({
9505
- error: De.REGION_ERROR_MESSAGE
9511
+ error: Fe.REGION_ERROR_MESSAGE
9506
9512
  });
9507
9513
  });else {
9508
- _this44.canSendMessage = De.canFileSendMessage;
9514
+ _this44.canSendMessage = Fe.canFileSendMessage;
9509
9515
  var l = t.lang || "en-US";
9510
9516
  _this44.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(l, "&format=detailed"), _this44.recordAudio = void 0;
9511
9517
  }
9512
9518
  return _assertThisInitialized(_this44);
9513
9519
  }
9514
- _inherits(De, _n3);
9515
- return _createClass(De, [{
9520
+ _inherits(Fe, _n3);
9521
+ return _createClass(Fe, [{
9516
9522
  key: "callServiceAPI",
9517
9523
  value: function () {
9518
9524
  var _callServiceAPI17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t, i) {
@@ -9578,12 +9584,12 @@ var De = /*#__PURE__*/function (_n3) {
9578
9584
  }
9579
9585
  }]);
9580
9586
  }(_n);
9581
- De.HELP_LINK =
9587
+ Fe.HELP_LINK =
9582
9588
  // eslint-disable-next-line max-len
9583
- "https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest", De.REGION_ERROR_MESSAGE =
9589
+ "https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest", Fe.REGION_ERROR_MESSAGE =
9584
9590
  // eslint-disable-next-line max-len
9585
9591
  "Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#SpeechToText)";
9586
- var gs = De;
9592
+ var gs = Fe;
9587
9593
  var jo = /*#__PURE__*/function (_z10) {
9588
9594
  // prettier-ignore
9589
9595
  function jo(e) {
@@ -9592,7 +9598,7 @@ var jo = /*#__PURE__*/function (_z10) {
9592
9598
  var s, r, o;
9593
9599
  var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.translation,
9594
9600
  i = (o = e.directConnection) == null ? void 0 : o.azure;
9595
- _this45 = _callSuper(this, jo, [e, oe.buildTranslationKeyVerificationDetails(t.region), oe.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i]), _this45.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this45.keyHelpUrl =
9601
+ _this45 = _callSuper(this, jo, [e, ae.buildTranslationKeyVerificationDetails(t.region), ae.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i]), _this45.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this45.keyHelpUrl =
9596
9602
  // eslint-disable-next-line max-len
9597
9603
  "https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this45.url = "", _this45.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
9598
9604
  return _this45;
@@ -9949,11 +9955,11 @@ var As = /*#__PURE__*/function (_vt) {
9949
9955
  i = t.azure,
9950
9956
  s = ((a = (o = t.azure) == null ? void 0 : o.openAI) == null ? void 0 : a.urlDetails) || {},
9951
9957
  r = (c = (l = t.azure) == null ? void 0 : l.openAI) == null ? void 0 : c.chat;
9952
- _this48 = _callSuper(this, As, [e, me.buildKeyVerificationDetails(s), me.buildHeaders, i, r]), _this48.permittedErrorPrefixes = [me.URL_DETAILS_ERROR_MESSAGE], _this48.isTextInputDisabled = !1, me.validateURLDetails(s) ? _this48.url = As.buildURL(s) : (_this48.isTextInputDisabled = !0, _this48.canSendMessage = function () {
9958
+ _this48 = _callSuper(this, As, [e, oe.buildKeyVerificationDetails(s), oe.buildHeaders, i, r]), _this48.permittedErrorPrefixes = [oe.URL_DETAILS_ERROR_MESSAGE], _this48.isTextInputDisabled = !1, oe.validateURLDetails(s) ? _this48.url = As.buildURL(s) : (_this48.isTextInputDisabled = !0, _this48.canSendMessage = function () {
9953
9959
  return !1;
9954
9960
  }, setTimeout(function () {
9955
9961
  e.addMessage({
9956
- error: me.URL_DETAILS_ERROR_MESSAGE
9962
+ error: oe.URL_DETAILS_ERROR_MESSAGE
9957
9963
  });
9958
9964
  }));
9959
9965
  return _this48;
@@ -9969,10 +9975,10 @@ var As = /*#__PURE__*/function (_vt) {
9969
9975
  }
9970
9976
  }]);
9971
9977
  }(vt);
9972
- var de = /*#__PURE__*/function (_z12) {
9973
- function de(e) {
9978
+ var he = /*#__PURE__*/function (_z12) {
9979
+ function he(e) {
9974
9980
  var _this49;
9975
- _classCallCheck(this, de);
9981
+ _classCallCheck(this, he);
9976
9982
  var o;
9977
9983
  var t = e.directConnection,
9978
9984
  i = t == null ? void 0 : t.openAI,
@@ -9984,7 +9990,7 @@ var de = /*#__PURE__*/function (_z12) {
9984
9990
  }
9985
9991
  }
9986
9992
  };
9987
- _this49 = _callSuper(this, de, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, s]), _this49.insertKeyPlaceholderText = "OpenAI API Key", _this49.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this49.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>", _this49.url = "", _this49.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
9993
+ _this49 = _callSuper(this, he, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, s]), _this49.insertKeyPlaceholderText = "OpenAI API Key", _this49.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this49.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>", _this49.url = "", _this49.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
9988
9994
  var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
9989
9995
  if (_this49.camera) {
9990
9996
  var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
@@ -9995,11 +10001,11 @@ var de = /*#__PURE__*/function (_z12) {
9995
10001
  }
9996
10002
  };
9997
10003
  }
9998
- _typeof(r) == "object" && Object.assign(_this49.rawBody, r), _this49.canSendMessage = de.canFileSendMessage;
10004
+ _typeof(r) == "object" && Object.assign(_this49.rawBody, r), _this49.canSendMessage = he.canFileSendMessage;
9999
10005
  return _this49;
10000
10006
  }
10001
- _inherits(de, _z12);
10002
- return _createClass(de, [{
10007
+ _inherits(he, _z12);
10008
+ return _createClass(he, [{
10003
10009
  key: "preprocessBody",
10004
10010
  value: function preprocessBody(e, t) {
10005
10011
  var i = JSON.parse(JSON.stringify(e));
@@ -10013,10 +10019,10 @@ var de = /*#__PURE__*/function (_z12) {
10013
10019
  var s;
10014
10020
  var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
10015
10021
  if (i[1] || r && r !== "") {
10016
- this.url = de.IMAGE_EDIT_URL;
10022
+ this.url = he.IMAGE_EDIT_URL;
10017
10023
  var l = this.preprocessBody(this.rawBody, r);
10018
- s = de.createFormDataBody(l, i[0], i[1]);
10019
- } else this.url = de.IMAGE_VARIATIONS_URL, s = de.createFormDataBody(this.rawBody, i[0]);
10024
+ s = he.createFormDataBody(l, i[0], i[1]);
10025
+ } else this.url = he.IMAGE_VARIATIONS_URL, s = he.createFormDataBody(this.rawBody, i[0]);
10020
10026
  v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
10021
10027
  }
10022
10028
  }, {
@@ -10047,7 +10053,7 @@ var de = /*#__PURE__*/function (_z12) {
10047
10053
  }
10048
10054
  throw new Error("Request settings have not been set up");
10049
10055
  case 8:
10050
- this.url = de.IMAGE_GENERATION_URL;
10056
+ this.url = he.IMAGE_GENERATION_URL;
10051
10057
  r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
10052
10058
  T.request(this, r, e);
10053
10059
  case 11:
@@ -10119,8 +10125,8 @@ var de = /*#__PURE__*/function (_z12) {
10119
10125
  }
10120
10126
  }]);
10121
10127
  }(z);
10122
- de.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", de.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", de.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
10123
- var bs = de;
10128
+ he.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", he.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", he.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
10129
+ var bs = he;
10124
10130
  var Ho = /*#__PURE__*/function (_Ts3) {
10125
10131
  function Ho(e) {
10126
10132
  var _this50$maxMessages;
@@ -10444,11 +10450,11 @@ var Go = /*#__PURE__*/function () {
10444
10450
  }]);
10445
10451
  }();
10446
10452
  var Vo = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n\t viewBox=\"50 30 420 450\" xml:space=\"preserve\">\n<g filter=\"brightness(0) saturate(100%) invert(16%) sepia(0%) saturate(1942%) hue-rotate(215deg) brightness(99%) contrast(93%)\">\n\t<g>\n\t\t<path d=\"M447.933,103.629c-0.034-3.076-1.224-6.09-3.485-8.352L352.683,3.511c-0.004-0.004-0.007-0.005-0.011-0.008\n\t\t\tC350.505,1.338,347.511,0,344.206,0H89.278C75.361,0,64.04,11.32,64.04,25.237v461.525c0,13.916,11.32,25.237,25.237,25.237\n\t\t\th333.444c13.916,0,25.237-11.32,25.237-25.237V103.753C447.96,103.709,447.937,103.672,447.933,103.629z M356.194,40.931\n\t\t\tl50.834,50.834h-49.572c-0.695,0-1.262-0.567-1.262-1.262V40.931z M423.983,486.763c0,0.695-0.566,1.261-1.261,1.261H89.278\n\t\t\tc-0.695,0-1.261-0.566-1.261-1.261V25.237c0-0.695,0.566-1.261,1.261-1.261h242.94v66.527c0,13.916,11.322,25.239,25.239,25.239\n\t\t\th66.527V486.763z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,164.014H149.912c-6.62,0-11.988,5.367-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,169.381,368.707,164.014,362.088,164.014z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,236.353H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,241.721,368.707,236.353,362.088,236.353z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,308.691H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C374.076,314.06,368.707,308.691,362.088,308.691z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M256,381.031H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988H256\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C267.988,386.398,262.62,381.031,256,381.031z\"/>\n\t</g>\n</g>\n</svg>";
10447
- var Pe = /*#__PURE__*/function () {
10448
- function Pe() {
10449
- _classCallCheck(this, Pe);
10453
+ var Oe = /*#__PURE__*/function () {
10454
+ function Oe() {
10455
+ _classCallCheck(this, Oe);
10450
10456
  }
10451
- return _createClass(Pe, null, [{
10457
+ return _createClass(Oe, null, [{
10452
10458
  key: "createImage",
10453
10459
  value: function createImage(e, t, i) {
10454
10460
  var s = new Image();
@@ -10463,7 +10469,7 @@ var Pe = /*#__PURE__*/function () {
10463
10469
  return _regeneratorRuntime().wrap(function _callee111$(_context111) {
10464
10470
  while (1) switch (_context111.prev = _context111.next) {
10465
10471
  case 0:
10466
- r = Pe.createImage(t, e.elementRef, s), o = e.createNewMessageElement("", i);
10472
+ r = Oe.createImage(t, e.elementRef, s), o = e.createNewMessageElement("", i);
10467
10473
  o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("image-message"), B.addMessage(e, o, "image", i, s);
10468
10474
  case 2:
10469
10475
  case "end":
@@ -10485,7 +10491,7 @@ var Pe = /*#__PURE__*/function () {
10485
10491
  }, {
10486
10492
  key: "addNewAudioMessage",
10487
10493
  value: function addNewAudioMessage(e, t, i, s) {
10488
- var r = Pe.createAudioElement(t, i),
10494
+ var r = Oe.createAudioElement(t, i),
10489
10495
  o = e.createMessageElementsOnOrientation("", i, s);
10490
10496
  o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"), B.addMessage(e, o, "audio", i, s);
10491
10497
  }
@@ -10505,7 +10511,7 @@ var Pe = /*#__PURE__*/function () {
10505
10511
  key: "addNewAnyFileMessage",
10506
10512
  value: function addNewAnyFileMessage(e, t, i, s) {
10507
10513
  var r = e.createMessageElementsOnOrientation("", i, s),
10508
- o = Pe.createAnyFile(t);
10514
+ o = Oe.createAnyFile(t);
10509
10515
  r.bubbleElement.classList.add("any-file-message-bubble"), r.bubbleElement.appendChild(o), B.addMessage(e, r, "file", i, s);
10510
10516
  }
10511
10517
  // no overwrite previous message logic as it is complex to track which files are to be overwritten
@@ -10513,12 +10519,12 @@ var Pe = /*#__PURE__*/function () {
10513
10519
  key: "addMessages",
10514
10520
  value: function addMessages(e, t, i, s) {
10515
10521
  t.forEach(function (r) {
10516
- r.ref && (r = B.removeFileRef(r)), B.isAudioFile(r) ? Pe.addNewAudioMessage(e, r, i, s) : B.isImageFile(r) ? Pe.addNewImageMessage(e, r, i, s) : Pe.addNewAnyFileMessage(e, r, i, s);
10522
+ r.ref && (r = B.removeFileRef(r)), B.isAudioFile(r) ? Oe.addNewAudioMessage(e, r, i, s) : B.isImageFile(r) ? Oe.addNewImageMessage(e, r, i, s) : Oe.addNewAnyFileMessage(e, r, i, s);
10517
10523
  });
10518
10524
  }
10519
10525
  }]);
10520
10526
  }();
10521
- var Ee = /*#__PURE__*/function (_Fe) {
10527
+ var Ee = /*#__PURE__*/function (_Be) {
10522
10528
  function Ee(e, t, i) {
10523
10529
  var _this52;
10524
10530
  _classCallCheck(this, Ee);
@@ -10538,7 +10544,11 @@ var Ee = /*#__PURE__*/function (_Fe) {
10538
10544
  });
10539
10545
  return _this52;
10540
10546
  }
10541
- _inherits(Ee, _Fe);
10547
+ // private updateHTMLMessage(html: string, index: number) {
10548
+ // HTMLMessages.overwrite(this, '<div>overwrite</div>', this.messageElementRefs[2]);
10549
+ // this.messages[2].html = '<div>overwrite</div>';
10550
+ // }
10551
+ _inherits(Ee, _Be);
10542
10552
  return _createClass(Ee, [{
10543
10553
  key: "prepareDemo",
10544
10554
  value: function prepareDemo(e) {
@@ -10571,7 +10581,7 @@ var Ee = /*#__PURE__*/function (_Fe) {
10571
10581
  value: function addIntroductoryMessage(e) {
10572
10582
  var i;
10573
10583
  var t;
10574
- e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t = Be.add(this, e.html, b.AI_ROLE, this.messageElementRefs)), t && (this.applyCustomStyles(t, b.AI_ROLE, !1, (i = this.messageStyles) == null ? void 0 : i.intro), t.outerContainer.classList.add("deep-chat-intro"));
10584
+ e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t = Re.add(this, e.html, b.AI_ROLE, this.messageElementRefs)), t && (this.applyCustomStyles(t, b.AI_ROLE, !1, (i = this.messageStyles) == null ? void 0 : i.intro), t.outerContainer.classList.add("deep-chat-intro"));
10575
10585
  }
10576
10586
  }, {
10577
10587
  key: "removeIntroductoryMessage",
@@ -10596,8 +10606,8 @@ var Ee = /*#__PURE__*/function (_Fe) {
10596
10606
  r = {
10597
10607
  status: e.overwrite
10598
10608
  };
10599
- if (!e.ignoreText && s.text !== void 0 && e.text !== null && (this.addNewTextMessage(s.text, s.role, r, i), !t && this.textToSpeech && s.role !== b.USER_ROLE && bt.speak(s.text, this.textToSpeech)), s.files && Array.isArray(s.files) && Pe.addMessages(this, s.files, s.role, i), s.html !== void 0 && s.html !== null) {
10600
- var o = Be.add(this, s.html, s.role, this.messageElementRefs, r, i);
10609
+ if (!e.ignoreText && s.text !== void 0 && e.text !== null && (this.addNewTextMessage(s.text, s.role, r, i), !t && this.textToSpeech && s.role !== b.USER_ROLE && bt.speak(s.text, this.textToSpeech)), s.files && Array.isArray(s.files) && Oe.addMessages(this, s.files, s.role, i), s.html !== void 0 && s.html !== null) {
10610
+ var o = Re.add(this, s.html, s.role, this.messageElementRefs, r, i);
10601
10611
  Me.isElementTemporary(o) && delete s.html;
10602
10612
  }
10603
10613
  return this.isValidMessageContent(s) && !i && this.updateStateOnMessage(s, e.overwrite, e.sendUpdate, t), s;
@@ -10675,7 +10685,7 @@ var Ee = /*#__PURE__*/function (_Fe) {
10675
10685
  var i, s, r, o, a, l;
10676
10686
  if (!this._displayLoadingMessage) return;
10677
10687
  var e = (r = (s = (i = this.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.message) == null ? void 0 : r.html,
10678
- t = e ? Be.createElements(this, e, b.AI_ROLE, !1) : this.addDefaultLoadingMessage();
10688
+ t = e ? Re.createElements(this, e, b.AI_ROLE, !1) : this.addDefaultLoadingMessage();
10679
10689
  this.elementRef.appendChild(t.outerContainer), t.bubbleElement.classList.add(ke.BUBBLE_CLASS), this.applyCustomStyles(t, b.AI_ROLE, !1, (l = (a = (o = this.messageStyles) == null ? void 0 : o.loading) == null ? void 0 : a.message) == null ? void 0 : l.styles), J.scrollToBottom(this.elementRef);
10680
10690
  }
10681
10691
  }, {
@@ -10764,7 +10774,7 @@ var Ee = /*#__PURE__*/function (_Fe) {
10764
10774
  return e.contains(ke.BUBBLE_CLASS) || e.contains(Qe.CLASS) || e.contains(ge.MESSAGE_CLASS);
10765
10775
  }
10766
10776
  }]);
10767
- }(Fe);
10777
+ }(Be);
10768
10778
  var N = /*#__PURE__*/function () {
10769
10779
  function N() {
10770
10780
  _classCallCheck(this, N);
@@ -10885,11 +10895,11 @@ var W = /*#__PURE__*/function () {
10885
10895
  }]);
10886
10896
  }();
10887
10897
  var $o = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M16 0c-8.836 0-16 7.163-16 16s7.163 16 16 16c8.837 0 16-7.163 16-16s-7.163-16-16-16zM16 30.032c-7.72 0-14-6.312-14-14.032s6.28-14 14-14 14 6.28 14 14-6.28 14.032-14 14.032zM23 15h-6v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1v6h-6c-0.552 0-1 0.448-1 1s0.448 1 1 1h6v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6h6c0.552 0 1-0.448 1-1s-0.448-1-1-1z\"></path>\n</svg>";
10888
- var ue = /*#__PURE__*/function () {
10889
- function ue() {
10890
- _classCallCheck(this, ue);
10898
+ var fe = /*#__PURE__*/function () {
10899
+ function fe() {
10900
+ _classCallCheck(this, fe);
10891
10901
  }
10892
- return _createClass(ue, null, [{
10902
+ return _createClass(fe, null, [{
10893
10903
  key: "unsetAllCSS",
10894
10904
  value: function unsetAllCSS(e, t) {
10895
10905
  var i, s;
@@ -10910,7 +10920,7 @@ var ue = /*#__PURE__*/function () {
10910
10920
  }, {
10911
10921
  key: "setElementCssUpToState",
10912
10922
  value: function setElementCssUpToState(e, t, i) {
10913
- ue.setElementsCSS(e, t, "default"), i !== "default" && (ue.setElementsCSS(e, t, "hover"), i !== "hover" && ue.setElementsCSS(e, t, "click"));
10923
+ fe.setElementsCSS(e, t, "default"), i !== "default" && (fe.setElementsCSS(e, t, "hover"), i !== "hover" && fe.setElementsCSS(e, t, "click"));
10914
10924
  }
10915
10925
  }]);
10916
10926
  }();
@@ -10924,22 +10934,22 @@ var Xt = /*#__PURE__*/function () {
10924
10934
  return _createClass(Xt, [{
10925
10935
  key: "buttonMouseLeave",
10926
10936
  value: function buttonMouseLeave(e) {
10927
- this._mouseState.state = "default", e && (ue.unsetAllCSS(this.elementRef, e), ue.setElementsCSS(this.elementRef, e, "default"));
10937
+ this._mouseState.state = "default", e && (fe.unsetAllCSS(this.elementRef, e), fe.setElementsCSS(this.elementRef, e, "default"));
10928
10938
  }
10929
10939
  }, {
10930
10940
  key: "buttonMouseEnter",
10931
10941
  value: function buttonMouseEnter(e) {
10932
- this._mouseState.state = "hover", e && ue.setElementsCSS(this.elementRef, e, "hover");
10942
+ this._mouseState.state = "hover", e && fe.setElementsCSS(this.elementRef, e, "hover");
10933
10943
  }
10934
10944
  }, {
10935
10945
  key: "buttonMouseUp",
10936
10946
  value: function buttonMouseUp(e) {
10937
- e && ue.unsetActionCSS(this.elementRef, e), this.buttonMouseEnter(e);
10947
+ e && fe.unsetActionCSS(this.elementRef, e), this.buttonMouseEnter(e);
10938
10948
  }
10939
10949
  }, {
10940
10950
  key: "buttonMouseDown",
10941
10951
  value: function buttonMouseDown(e) {
10942
- this._mouseState.state = "click", e && ue.setElementsCSS(this.elementRef, e, "click");
10952
+ this._mouseState.state = "click", e && fe.setElementsCSS(this.elementRef, e, "click");
10943
10953
  }
10944
10954
  // be careful not to use onclick as that is used for button functionality
10945
10955
  }, {
@@ -10953,7 +10963,7 @@ var Xt = /*#__PURE__*/function () {
10953
10963
  if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
10954
10964
  var _i15 = e[t],
10955
10965
  s = _i15 && this._customStyles[_i15];
10956
- s && ue.unsetActionCSS(this.elementRef, s);
10966
+ s && fe.unsetActionCSS(this.elementRef, s);
10957
10967
  }
10958
10968
  }
10959
10969
  }, {
@@ -10962,7 +10972,7 @@ var Xt = /*#__PURE__*/function () {
10962
10972
  if (!this._customStyles) return;
10963
10973
  t && this.unsetCustomStateStyles(t);
10964
10974
  var i = this._customStyles[e];
10965
- i && ue.setElementCssUpToState(this.elementRef, i, this._mouseState.state), this.setEvents(i);
10975
+ i && fe.setElementCssUpToState(this.elementRef, i, this._mouseState.state), this.setEvents(i);
10966
10976
  }
10967
10977
  }]);
10968
10978
  }();
@@ -11939,7 +11949,7 @@ var tn = Fi,
11939
11949
  sn = ei,
11940
11950
  oi = ti,
11941
11951
  Yi = Ui,
11942
- fe = at,
11952
+ pe = at,
11943
11953
  Qi = ji,
11944
11954
  nn = wt,
11945
11955
  rn = lt,
@@ -11947,7 +11957,7 @@ var tn = Fi,
11947
11957
  var ca = /*#__PURE__*/function () {
11948
11958
  function ca() {
11949
11959
  _classCallCheck(this, ca);
11950
- this.finalTranscript = "", this.interimSpan = fe.Elements.createInterimSpan(), this.finalSpan = fe.Elements.createGenericSpan(), this.scrollingSpan = fe.Elements.createGenericSpan(), this.isCursorAtEnd = !1, this.spansPopulated = !1, this.startPadding = "", this.endPadding = "", this.numberOfSpacesBeforeNewText = 0, this.numberOfSpacesAfterNewText = 0, this.isHighlighted = !1, this.primitiveTextRecorded = !1, this.recognizing = !1, this._displayInterimResults = !0, this.insertInCursorLocation = !0, this.autoScroll = !0, this.isRestarting = !1, this.isPaused = !1, this.isWaitingForCommand = !1, this.isTargetInShadow = !1, this.cannotBeStopped = !1, this.resetState();
11960
+ this.finalTranscript = "", this.interimSpan = pe.Elements.createInterimSpan(), this.finalSpan = pe.Elements.createGenericSpan(), this.scrollingSpan = pe.Elements.createGenericSpan(), this.isCursorAtEnd = !1, this.spansPopulated = !1, this.startPadding = "", this.endPadding = "", this.numberOfSpacesBeforeNewText = 0, this.numberOfSpacesAfterNewText = 0, this.isHighlighted = !1, this.primitiveTextRecorded = !1, this.recognizing = !1, this._displayInterimResults = !0, this.insertInCursorLocation = !0, this.autoScroll = !0, this.isRestarting = !1, this.isPaused = !1, this.isWaitingForCommand = !1, this.isTargetInShadow = !1, this.cannotBeStopped = !1, this.resetState();
11951
11961
  }
11952
11962
  return _createClass(ca, [{
11953
11963
  key: "prepareBeforeStart",
@@ -11960,12 +11970,12 @@ var ca = /*#__PURE__*/function () {
11960
11970
  if (!r) return;
11961
11971
  this.prepare(r);
11962
11972
  } else this.prepare(e.element);
11963
- (e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"], fe.Elements.applyCustomColors(this, e.textColor)), (e == null ? void 0 : e.insertInCursorLocation) !== void 0 && (this.insertInCursorLocation = e.insertInCursorLocation), (e == null ? void 0 : e.autoScroll) !== void 0 && (this.autoScroll = e.autoScroll), this._onResult = e == null ? void 0 : e.onResult, this._onPreResult = e == null ? void 0 : e.onPreResult, this._onStart = e == null ? void 0 : e.onStart, this._onStop = e == null ? void 0 : e.onStop, this._onError = e == null ? void 0 : e.onError, this.onCommandModeTrigger = e == null ? void 0 : e.onCommandModeTrigger, this.onPauseTrigger = e == null ? void 0 : e.onPauseTrigger, this._options = e, !((i = this._options) === null || i === void 0) && i.commands && (this.commands = sn.CommandUtils.process(this._options.commands));
11973
+ (e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"], pe.Elements.applyCustomColors(this, e.textColor)), (e == null ? void 0 : e.insertInCursorLocation) !== void 0 && (this.insertInCursorLocation = e.insertInCursorLocation), (e == null ? void 0 : e.autoScroll) !== void 0 && (this.autoScroll = e.autoScroll), this._onResult = e == null ? void 0 : e.onResult, this._onPreResult = e == null ? void 0 : e.onPreResult, this._onStart = e == null ? void 0 : e.onStart, this._onStop = e == null ? void 0 : e.onStop, this._onError = e == null ? void 0 : e.onError, this.onCommandModeTrigger = e == null ? void 0 : e.onCommandModeTrigger, this.onPauseTrigger = e == null ? void 0 : e.onPauseTrigger, this._options = e, !((i = this._options) === null || i === void 0) && i.commands && (this.commands = sn.CommandUtils.process(this._options.commands));
11964
11974
  }
11965
11975
  }, {
11966
11976
  key: "prepare",
11967
11977
  value: function prepare(e) {
11968
- Qi.Padding.setState(this, e), Yi.Highlight.setState(this, e), this.isTargetInShadow = fe.Elements.isInsideShadowDOM(e), fe.Elements.isPrimitiveElement(e) ? (this._primitiveElement = e, this._originalText = this._primitiveElement.value) : (this._genericElement = e, this._originalText = this._genericElement.textContent);
11978
+ Qi.Padding.setState(this, e), Yi.Highlight.setState(this, e), this.isTargetInShadow = pe.Elements.isInsideShadowDOM(e), pe.Elements.isPrimitiveElement(e) ? (this._primitiveElement = e, this._originalText = this._primitiveElement.value) : (this._genericElement = e, this._originalText = this._genericElement.textContent);
11969
11979
  }
11970
11980
  // there was an attempt to optimize this by not having to restart the service and just reset state:
11971
11981
  // unfortunately it did not work because the service would still continue firing the intermediate and final results
@@ -12009,7 +12019,7 @@ var ca = /*#__PURE__*/function () {
12009
12019
  }, {
12010
12020
  key: "updateGenericElement",
12011
12021
  value: function updateGenericElement(e, t, i) {
12012
- this.isHighlighted && Yi.Highlight.removeForGeneric(this, e), this.spansPopulated || fe.Elements.appendSpans(this, e);
12022
+ this.isHighlighted && Yi.Highlight.removeForGeneric(this, e), this.spansPopulated || pe.Elements.appendSpans(this, e);
12013
12023
  var s = (i ? "" : this.startPadding) + es.Text.lineBreak(this.finalTranscript);
12014
12024
  this.finalSpan.innerHTML = s;
12015
12025
  var r = oi.AutoScroll.isRequired(this.autoScroll, e);
@@ -12020,7 +12030,7 @@ var ca = /*#__PURE__*/function () {
12020
12030
  }, {
12021
12031
  key: "finalise",
12022
12032
  value: function finalise(e) {
12023
- this._genericElement && (e ? (this.finalSpan = fe.Elements.createGenericSpan(), this.setInterimColorToFinal(), this.interimSpan = fe.Elements.createInterimSpan(), this.scrollingSpan = fe.Elements.createGenericSpan()) : this._genericElement.textContent = this._genericElement.textContent, this.spansPopulated = !1), tn.EventListeners.remove(this);
12033
+ this._genericElement && (e ? (this.finalSpan = pe.Elements.createGenericSpan(), this.setInterimColorToFinal(), this.interimSpan = pe.Elements.createInterimSpan(), this.scrollingSpan = pe.Elements.createGenericSpan()) : this._genericElement.textContent = this._genericElement.textContent, this.spansPopulated = !1), tn.EventListeners.remove(this);
12024
12034
  }
12025
12035
  }, {
12026
12036
  key: "setInterimColorToFinal",
@@ -12484,7 +12494,7 @@ Object.defineProperty(wn, "__esModule", {
12484
12494
  });
12485
12495
  var hn = Ni,
12486
12496
  ma = ei,
12487
- le = Hi,
12497
+ ce = Hi,
12488
12498
  ga = qi;
12489
12499
  var ht = /*#__PURE__*/function () {
12490
12500
  function ht() {
@@ -12495,12 +12505,12 @@ var ht = /*#__PURE__*/function () {
12495
12505
  value: function toggle(e, t) {
12496
12506
  var i, s;
12497
12507
  var r = e.toLocaleLowerCase().trim();
12498
- !((i = le.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? ht.startWebSpeech(t) : r === "azure" ? ht.startAzure(t) : (console.error("service not found - must be either 'webspeech' or 'azure'"), (s = t == null ? void 0 : t.onError) === null || s === void 0 || s.call(t, "service not found - must be either 'webspeech' or 'azure'"));
12508
+ !((i = ce.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? ht.startWebSpeech(t) : r === "azure" ? ht.startAzure(t) : (console.error("service not found - must be either 'webspeech' or 'azure'"), (s = t == null ? void 0 : t.onError) === null || s === void 0 || s.call(t, "service not found - must be either 'webspeech' or 'azure'"));
12499
12509
  }
12500
12510
  }, {
12501
12511
  key: "startWebSpeech",
12502
12512
  value: function startWebSpeech(e) {
12503
- ht.stop() || (le.GlobalState.service = new hn.WebSpeech(), le.GlobalState.service.start(e));
12513
+ ht.stop() || (ce.GlobalState.service = new hn.WebSpeech(), ce.GlobalState.service.start(e));
12504
12514
  }
12505
12515
  }, {
12506
12516
  key: "isWebSpeechSupported",
@@ -12511,18 +12521,18 @@ var ht = /*#__PURE__*/function () {
12511
12521
  key: "startAzure",
12512
12522
  value: function startAzure(e) {
12513
12523
  var t;
12514
- ht.stop() || !((t = le.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (le.GlobalState.service = new ga.Azure(), le.GlobalState.service.start(e));
12524
+ ht.stop() || !((t = ce.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (ce.GlobalState.service = new ga.Azure(), ce.GlobalState.service.start(e));
12515
12525
  }
12516
12526
  }, {
12517
12527
  key: "stop",
12518
12528
  value: function stop() {
12519
12529
  var e;
12520
- return le.GlobalState.doubleClickDetector() ? !0 : (!((e = le.GlobalState.service) === null || e === void 0) && e.recognizing && le.GlobalState.service.stop(), !1);
12530
+ return ce.GlobalState.doubleClickDetector() ? !0 : (!((e = ce.GlobalState.service) === null || e === void 0) && e.recognizing && ce.GlobalState.service.stop(), !1);
12521
12531
  }
12522
12532
  }, {
12523
12533
  key: "endCommandMode",
12524
12534
  value: function endCommandMode() {
12525
- le.GlobalState.service && ma.CommandUtils.toggleCommandModeOff(le.GlobalState.service);
12535
+ ce.GlobalState.service && ma.CommandUtils.toggleCommandModeOff(ce.GlobalState.service);
12526
12536
  }
12527
12537
  }]);
12528
12538
  }();
@@ -13032,12 +13042,12 @@ var ii = /*#__PURE__*/function () {
13032
13042
  }
13033
13043
  }]);
13034
13044
  }();
13035
- var he = /*#__PURE__*/function () {
13036
- function he(e, t, i) {
13037
- _classCallCheck(this, he);
13038
- this._isOpen = !1, this._contentRef = he.createModalContent(t, i == null ? void 0 : i.backgroundColor), this._buttonPanel = he.createButtonPanel(i == null ? void 0 : i.backgroundColor), this._elementRef = he.createContainer(this._contentRef, i), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = he.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents(e);
13045
+ var ue = /*#__PURE__*/function () {
13046
+ function ue(e, t, i) {
13047
+ _classCallCheck(this, ue);
13048
+ this._isOpen = !1, this._contentRef = ue.createModalContent(t, i == null ? void 0 : i.backgroundColor), this._buttonPanel = ue.createButtonPanel(i == null ? void 0 : i.backgroundColor), this._elementRef = ue.createContainer(this._contentRef, i), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = ue.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents(e);
13039
13049
  }
13040
- return _createClass(he, [{
13050
+ return _createClass(ue, [{
13041
13051
  key: "isOpen",
13042
13052
  value: function isOpen() {
13043
13053
  return this._isOpen;
@@ -13059,7 +13069,7 @@ var he = /*#__PURE__*/function () {
13059
13069
  var _this69 = this;
13060
13070
  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 () {
13061
13071
  _this69._elementRef.style.display = "none", _this69._backgroundPanelRef.style.display = "none";
13062
- }, he.MODAL_CLOSE_TIMEOUT_MS);
13072
+ }, ue.MODAL_CLOSE_TIMEOUT_MS);
13063
13073
  }
13064
13074
  }, {
13065
13075
  key: "displayModalElements",
@@ -13075,7 +13085,7 @@ var he = /*#__PURE__*/function () {
13075
13085
  key: "addCloseButton",
13076
13086
  value: function addCloseButton(e, t, i) {
13077
13087
  var _this70 = this;
13078
- var s = t ? he.createSVGButton(e) : he.createTextButton(e);
13088
+ var s = t ? ue.createSVGButton(e) : ue.createTextButton(e);
13079
13089
  return this.addButtons(s), s.onclick = function () {
13080
13090
  _this70.close(), setTimeout(function () {
13081
13091
  i == null || i();
@@ -13137,14 +13147,14 @@ var he = /*#__PURE__*/function () {
13137
13147
  value: function createTextModalFunc(e, t, i) {
13138
13148
  var s;
13139
13149
  if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
13140
- var r = new he(e, ["modal-content"], t.files.infoModal.containerStyle);
13150
+ var r = new ue(e, ["modal-content"], t.files.infoModal.containerStyle);
13141
13151
  return r.addCloseButton("OK", !1, i), r.openTextModal.bind(r, t.infoModalTextMarkUp || "");
13142
13152
  }
13143
13153
  }
13144
13154
  }]);
13145
13155
  }();
13146
- he.MODAL_CLOSE_TIMEOUT_MS = 190;
13147
- var Xe = he;
13156
+ ue.MODAL_CLOSE_TIMEOUT_MS = 190;
13157
+ var Xe = ue;
13148
13158
  var Pt = /*#__PURE__*/function (_Xt3) {
13149
13159
  // prettier-ignore
13150
13160
  function Pt(e, t, i, s, r, o) {
@@ -13336,7 +13346,7 @@ var ze = /*#__PURE__*/function () {
13336
13346
  }, {
13337
13347
  key: "attach",
13338
13348
  value: function attach(e, t, i, s, r) {
13339
- var o = e.validateInput || ae.processValidateInput(e);
13349
+ var o = e.validateInput || le.processValidateInput(e);
13340
13350
  e._validationHandler = /*#__PURE__*/function () {
13341
13351
  var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee121(a) {
13342
13352
  var l;
@@ -13636,7 +13646,7 @@ var k = /*#__PURE__*/function (_Xt4) {
13636
13646
  return _regeneratorRuntime().wrap(function _callee123$(_context123) {
13637
13647
  while (1) switch (_context123.prev = _context123.next) {
13638
13648
  case 0:
13639
- typeof e == "string" && (e = ae.processSubmitUserMessage(e));
13649
+ typeof e == "string" && (e = le.processSubmitUserMessage(e));
13640
13650
  t = {
13641
13651
  text: e.text
13642
13652
  };
@@ -14109,7 +14119,7 @@ var E = /*#__PURE__*/function (_ls) {
14109
14119
  key: "onRender",
14110
14120
  value: function onRender() {
14111
14121
  var _this$_childElement;
14112
- ci.attemptAppendStyleSheetToHead(this.style), ae.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = zo.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (kt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), kt.applyDefaultStyleToComponent(this.style, this.chatStyle), ae.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? li.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof z) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Is.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof z && H.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, hi.onRender(this);
14122
+ ci.attemptAppendStyleSheetToHead(this.style), le.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = zo.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (kt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), kt.applyDefaultStyleToComponent(this.style, this.chatStyle), le.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? li.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof z) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Is.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof z && H.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, hi.onRender(this);
14113
14123
  }
14114
14124
  }, {
14115
14125
  key: "disconnectedCallback",