deep-chat-dev 9.0.199 → 9.0.201

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.
Files changed (27) hide show
  1. package/custom-elements.json +11057 -11105
  2. package/dist/deepChat.bundle.js +1 -1
  3. package/dist/deepChat.js +856 -811
  4. package/dist/services/azure/azureOpenAIAssistantIO.d.ts.map +1 -1
  5. package/dist/services/azure/azureOpenAIChatIO.d.ts.map +1 -1
  6. package/dist/services/openAI/assistant/openAIAssistantIO.d.ts.map +1 -1
  7. package/dist/services/openAI/assistant/openAIAssistantIOI.d.ts +4 -4
  8. package/dist/services/openAI/assistant/openAIAssistantIOI.d.ts.map +1 -1
  9. package/dist/services/openAI/openAIChatIO.d.ts +2 -2
  10. package/dist/services/openAI/openAIChatIO.d.ts.map +1 -1
  11. package/dist/services/utils/messageLimitUtils.d.ts.map +1 -1
  12. package/dist/types/messagesInternal.d.ts +2 -0
  13. package/dist/types/messagesInternal.d.ts.map +1 -1
  14. package/dist/utils/HTTP/stream.d.ts.map +1 -1
  15. package/dist/utils/demo/demo.d.ts.map +1 -1
  16. package/dist/views/chat/messages/avatar.d.ts.map +1 -1
  17. package/dist/views/chat/messages/history/history.d.ts.map +1 -1
  18. package/dist/views/chat/messages/html/htmlMessages.d.ts +1 -2
  19. package/dist/views/chat/messages/html/htmlMessages.d.ts.map +1 -1
  20. package/dist/views/chat/messages/messageUtils.d.ts +4 -3
  21. package/dist/views/chat/messages/messageUtils.d.ts.map +1 -1
  22. package/dist/views/chat/messages/messages.d.ts.map +1 -1
  23. package/dist/views/chat/messages/messagesBase.d.ts +2 -2
  24. package/dist/views/chat/messages/messagesBase.d.ts.map +1 -1
  25. package/dist/views/chat/messages/stream/messageStream.d.ts +0 -2
  26. package/dist/views/chat/messages/stream/messageStream.d.ts.map +1 -1
  27. package/package.json +1 -1
package/dist/deepChat.js CHANGED
@@ -9,6 +9,10 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
9
9
  function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
10
10
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
11
11
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
12
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
13
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
12
16
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
13
17
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
14
18
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
@@ -132,37 +136,37 @@ var R = /*#__PURE__*/function () {
132
136
  }
133
137
  }]);
134
138
  }();
135
- var Ge = /*#__PURE__*/function () {
136
- function Ge() {
137
- _classCallCheck(this, Ge);
139
+ var ze = /*#__PURE__*/function () {
140
+ function ze() {
141
+ _classCallCheck(this, ze);
138
142
  }
139
- return _createClass(Ge, null, [{
143
+ return _createClass(ze, null, [{
140
144
  key: "attemptAppendStyleSheetToHead",
141
145
  value: function attemptAppendStyleSheetToHead(e) {
142
- if (e.fontFamily && e.fontFamily !== Ge.DEFAULT_FONT_FAMILY) return;
146
+ if (e.fontFamily && e.fontFamily !== ze.DEFAULT_FONT_FAMILY) return;
143
147
  var t = document.getElementsByTagName("head")[0];
144
148
  if (!Array.from(t.getElementsByTagName("link")).some(function (s) {
145
- return s.getAttribute("href") === Ge.FONT_URL;
149
+ return s.getAttribute("href") === ze.FONT_URL;
146
150
  })) {
147
151
  var s = document.createElement("link");
148
- s.rel = "stylesheet", s.href = Ge.FONT_URL, t.appendChild(s);
152
+ s.rel = "stylesheet", s.href = ze.FONT_URL, t.appendChild(s);
149
153
  }
150
154
  }
151
155
  }]);
152
156
  }();
153
- Ge.FONT_URL = "https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap", Ge.DEFAULT_FONT_FAMILY = "'Inter', sans-serif, Avenir, Helvetica, Arial";
154
- var ci = Ge;
155
- var ut = /*#__PURE__*/function () {
156
- function ut() {
157
- _classCallCheck(this, ut);
157
+ ze.FONT_URL = "https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap", ze.DEFAULT_FONT_FAMILY = "'Inter', sans-serif, Avenir, Helvetica, Arial";
158
+ var ci = ze;
159
+ var ht = /*#__PURE__*/function () {
160
+ function ht() {
161
+ _classCallCheck(this, ht);
158
162
  }
159
- return _createClass(ut, null, [{
163
+ return _createClass(ht, null, [{
160
164
  key: "apply",
161
165
  value: function apply(e, t) {
162
166
  if (t) try {
163
- ut.applyStyleSheet(e, t);
167
+ ht.applyStyleSheet(e, t);
164
168
  } catch (_unused) {
165
- ut.addStyleElement(e, t);
169
+ ht.addStyleElement(e, t);
166
170
  }
167
171
  }
168
172
  }, {
@@ -180,11 +184,11 @@ var ut = /*#__PURE__*/function () {
180
184
  }, {
181
185
  key: "applyDefaultStyleToComponent",
182
186
  value: function applyDefaultStyleToComponent(e, t) {
183
- t && R.applyToStyleIfNotDefined(e, t), R.applyToStyleIfNotDefined(e, ut.DEFAULT_COMPONENT_STYLE);
187
+ t && R.applyToStyleIfNotDefined(e, t), R.applyToStyleIfNotDefined(e, ht.DEFAULT_COMPONENT_STYLE);
184
188
  }
185
189
  }]);
186
190
  }();
187
- ut.DEFAULT_COMPONENT_STYLE = {
191
+ ht.DEFAULT_COMPONENT_STYLE = {
188
192
  height: "350px",
189
193
  width: "320px",
190
194
  border: "1px solid #cacaca",
@@ -198,24 +202,24 @@ ut.DEFAULT_COMPONENT_STYLE = {
198
202
  // this is also causing the chat to squeeze when there is no space
199
203
  overflow: "hidden"
200
204
  };
201
- var kt = ut;
202
- var et;
203
- var xt = (et = /*#__PURE__*/_createClass(function et() {
204
- _classCallCheck(this, et);
205
- }), et.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), et.IS_CHROMIUM = window.chrome, et);
206
- var O = /* @__PURE__ */function (n) {
205
+ var kt = ht;
206
+ var Qe;
207
+ var xt = (Qe = /*#__PURE__*/_createClass(function Qe() {
208
+ _classCallCheck(this, Qe);
209
+ }), Qe.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), Qe.IS_CHROMIUM = window.chrome, Qe);
210
+ var N = /* @__PURE__ */function (n) {
207
211
  return n.ESCAPE = "Escape", n.ENTER = "Enter", n.TAB = "Tab", n.ARROW_UP = "ArrowUp", n.ARROW_DOWN = "ArrowDown", n.ARROW_RIGHT = "ArrowRight", n.ARROW_LEFT = "ArrowLeft", n.BACKSPACE = "Backspace", n.DELETE = "Delete", n.META = "Meta", n.CONTROL = "Control", n;
208
- }(O || {});
209
- var Ve = /*#__PURE__*/function () {
210
- function Ve() {
211
- _classCallCheck(this, Ve);
212
+ }(N || {});
213
+ var Ge = /*#__PURE__*/function () {
214
+ function Ge() {
215
+ _classCallCheck(this, Ge);
212
216
  }
213
- return _createClass(Ve, null, [{
217
+ return _createClass(Ge, null, [{
214
218
  key: "add",
215
219
  value:
216
220
  // prettier-ignore
217
221
  function add(e, t, i, s) {
218
- i !== void 0 && e.addEventListener("keydown", Ve.onKeyDown.bind(this, i)), e.oninput = Ve.onInput.bind(this, i, s), e.addEventListener("paste", function (r) {
222
+ i !== void 0 && e.addEventListener("keydown", Ge.onKeyDown.bind(this, i)), e.oninput = Ge.onInput.bind(this, i, s), e.addEventListener("paste", function (r) {
219
223
  var o;
220
224
  r.preventDefault(), (o = r.clipboardData) != null && o.files.length && t.addFilesToAnyType(Array.from(r.clipboardData.files));
221
225
  });
@@ -226,7 +230,7 @@ var Ve = /*#__PURE__*/function () {
226
230
  key: "onKeyDown",
227
231
  value: function onKeyDown(e, t) {
228
232
  var s = t.target.textContent;
229
- s && s.length >= e && !Ve.PERMITTED_KEYS.has(t.key) && !Ve.isKeyCombinationPermitted(t) && t.preventDefault();
233
+ s && s.length >= e && !Ge.PERMITTED_KEYS.has(t.key) && !Ge.isKeyCombinationPermitted(t) && t.preventDefault();
230
234
  }
231
235
  }, {
232
236
  key: "isKeyCombinationPermitted",
@@ -242,8 +246,8 @@ var Ve = /*#__PURE__*/function () {
242
246
  }
243
247
  }]);
244
248
  }();
245
- Ve.PERMITTED_KEYS = /* @__PURE__ */new Set([O.BACKSPACE, O.DELETE, O.ARROW_RIGHT, O.ARROW_LEFT, O.ARROW_DOWN, O.ARROW_UP, O.META, O.CONTROL, O.ENTER]);
246
- var ss = Ve;
249
+ Ge.PERMITTED_KEYS = /* @__PURE__ */new Set([N.BACKSPACE, N.DELETE, N.ARROW_RIGHT, N.ARROW_LEFT, N.ARROW_DOWN, N.ARROW_UP, N.META, N.CONTROL, N.ENTER]);
250
+ var ss = Ge;
247
251
  var An = /*#__PURE__*/function () {
248
252
  function An() {
249
253
  _classCallCheck(this, An);
@@ -258,17 +262,17 @@ var An = /*#__PURE__*/function () {
258
262
  }
259
263
  }]);
260
264
  }();
261
- var $e = /*#__PURE__*/function () {
262
- function $e(e, t, i) {
265
+ var Ve = /*#__PURE__*/function () {
266
+ function Ve(e, t, i) {
263
267
  var _this = this;
264
- _classCallCheck(this, $e);
268
+ _classCallCheck(this, Ve);
265
269
  var r, o;
266
- var s = $e.processConfig(t, e.textInput);
267
- this.elementRef = $e.createContainerElement((r = s == null ? void 0 : s.styles) == null ? void 0 : r.container), this._config = s, this.inputElementRef = this.createInputElement(), this.elementRef.appendChild(this.inputElementRef), e.setPlaceholderText = this.setPlaceholderText.bind(this), e.setPlaceholderText(((o = this._config.placeholder) == null ? void 0 : o.text) || "Ask me anything!"), setTimeout(function () {
270
+ var s = Ve.processConfig(t, e.textInput);
271
+ this.elementRef = Ve.createContainerElement((r = s == null ? void 0 : s.styles) == null ? void 0 : r.container), this._config = s, this.inputElementRef = this.createInputElement(), this.elementRef.appendChild(this.inputElementRef), e.setPlaceholderText = this.setPlaceholderText.bind(this), e.setPlaceholderText(((o = this._config.placeholder) == null ? void 0 : o.text) || "Ask me anything!"), setTimeout(function () {
268
272
  ss.add(_this.inputElementRef, i, _this._config.characterLimit, e._validationHandler);
269
273
  });
270
274
  }
271
- return _createClass($e, [{
275
+ return _createClass(Ve, [{
272
276
  key: "clear",
273
277
  value:
274
278
  // this also similarly prevents scroll up
@@ -284,7 +288,7 @@ var $e = /*#__PURE__*/function () {
284
288
  value: function createInputElement() {
285
289
  var t, i, s, r;
286
290
  var e = document.createElement("div");
287
- return e.id = $e.TEXT_INPUT_ID, e.classList.add("text-input-styling"), xt.IS_CHROMIUM && $e.preventAutomaticScrollUpOnNewLine(e), typeof this._config.disabled == "boolean" && this._config.disabled === !0 ? (e.contentEditable = "false", e.classList.add("text-input-disabled")) : (e.contentEditable = "true", this.addEventListeners(e)), Object.assign(e.style, (t = this._config.styles) == null ? void 0 : t.text), Object.assign(e.style, (i = this._config.placeholder) == null ? void 0 : i.style), (r = (s = this._config.placeholder) == null ? void 0 : s.style) != null && r.color || e.setAttribute("textcolor", ""), e;
291
+ return e.id = Ve.TEXT_INPUT_ID, e.classList.add("text-input-styling"), xt.IS_CHROMIUM && Ve.preventAutomaticScrollUpOnNewLine(e), typeof this._config.disabled == "boolean" && this._config.disabled === !0 ? (e.contentEditable = "false", e.classList.add("text-input-disabled")) : (e.contentEditable = "true", this.addEventListeners(e)), Object.assign(e.style, (t = this._config.styles) == null ? void 0 : t.text), Object.assign(e.style, (i = this._config.placeholder) == null ? void 0 : i.style), (r = (s = this._config.placeholder) == null ? void 0 : s.style) != null && r.color || e.setAttribute("textcolor", ""), e;
288
292
  }
289
293
  }, {
290
294
  key: "removePlaceholderStyle",
@@ -311,7 +315,7 @@ var $e = /*#__PURE__*/function () {
311
315
  key: "onKeydown",
312
316
  value: function onKeydown(e) {
313
317
  var t;
314
- e.key === O.ENTER && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), (t = this.submit) == null || t.call(this));
318
+ e.key === N.ENTER && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), (t = this.submit) == null || t.call(this));
315
319
  }
316
320
  }, {
317
321
  key: "onInput",
@@ -361,8 +365,8 @@ var $e = /*#__PURE__*/function () {
361
365
  }
362
366
  }]);
363
367
  }();
364
- $e.TEXT_INPUT_ID = "text-input";
365
- var di = $e;
368
+ Ve.TEXT_INPUT_ID = "text-input";
369
+ var di = Ve;
366
370
  var Kt = /*#__PURE__*/function () {
367
371
  function Kt() {
368
372
  _classCallCheck(this, Kt);
@@ -566,11 +570,11 @@ var le = /*#__PURE__*/function () {
566
570
  }
567
571
  }]);
568
572
  }();
569
- var ft = /*#__PURE__*/function () {
570
- function ft() {
571
- _classCallCheck(this, ft);
573
+ var ut = /*#__PURE__*/function () {
574
+ function ut() {
575
+ _classCallCheck(this, ut);
572
576
  }
573
- return _createClass(ft, null, [{
577
+ return _createClass(ut, null, [{
574
578
  key: "colorToHex",
575
579
  value: function colorToHex(e) {
576
580
  var t = document.createElement("div");
@@ -583,7 +587,7 @@ var ft = /*#__PURE__*/function () {
583
587
  value: function setDots(e, t) {
584
588
  var i, s, r, o;
585
589
  if ((o = (r = (s = (i = t == null ? void 0 : t.loading) == null ? void 0 : i.message) == null ? void 0 : s.styles) == null ? void 0 : r.bubble) != null && o.color) {
586
- var a = ft.colorToHex(t.loading.message.styles.bubble.color);
590
+ var a = ut.colorToHex(t.loading.message.styles.bubble.color);
587
591
  e.style.setProperty("--loading-message-color", a), e.style.setProperty("--loading-message-color-fade", "".concat(a, "33"));
588
592
  } else e.style.setProperty("--loading-message-color", "#848484"), e.style.setProperty("--loading-message-color-fade", "#55555533");
589
593
  }
@@ -597,15 +601,15 @@ var ft = /*#__PURE__*/function () {
597
601
  o = _ref.margin,
598
602
  a = _ref.border;
599
603
  if (i) {
600
- var l = ft.colorToHex(i);
604
+ var l = ut.colorToHex(i);
601
605
  e.style.setProperty("--loading-history-color", l);
602
606
  } else e.style.setProperty("--loading-history-color", "#dbdbdb");
603
607
  e.style.setProperty("--loading-history-height", r || "57px"), e.style.setProperty("--loading-history-width", s || "57px"), e.style.setProperty("--loading-history-margin", o || "7px"), e.style.setProperty("--loading-history-border", a || "6px");
604
608
  }
605
609
  }]);
606
610
  }();
607
- ft.BUBBLE_CLASS = "deep-chat-loading-message-bubble", ft.DOTS_CONTAINER_CLASS = "deep-chat-loading-message-dots-container";
608
- var ke = ft;
611
+ ut.BUBBLE_CLASS = "deep-chat-loading-message-bubble", ut.DOTS_CONTAINER_CLASS = "deep-chat-loading-message-dots-container";
612
+ var Ae = ut;
609
613
  var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20fill='%23000000'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2032%2032'%20xml:space='preserve'%3e%3cpath%20d='M23,30.36H9c-2.404,0-4.36-1.956-4.36-4.36V15c0-2.404,1.956-4.36,4.36-4.36h3.659%20c0.167-1.566,1.415-2.813,2.981-2.981V5.333c-1.131-0.174-2-1.154-2-2.333c0-1.301,1.059-2.36,2.36-2.36%20c1.302,0,2.36,1.059,2.36,2.36c0,1.179-0.869,2.159-2,2.333V7.66c1.566,0.167,2.814,1.415,2.981,2.981H23%20c2.404,0,4.36,1.956,4.36,4.36v11C27.36,28.404,25.404,30.36,23,30.36z%20M9,11.36c-2.007,0-3.64,1.633-3.64,3.64v11%20c0,2.007,1.633,3.64,3.64,3.64h14c2.007,0,3.64-1.633,3.64-3.64V15c0-2.007-1.633-3.64-3.64-3.64H9z%20M13.384,10.64h5.231%20C18.439,9.354,17.334,8.36,16,8.36C14.667,8.36,13.561,9.354,13.384,10.64z%20M16,1.36c-0.904,0-1.64,0.736-1.64,1.64%20S15.096,4.64,16,4.64c0.904,0,1.64-0.736,1.64-1.64S16.904,1.36,16,1.36z%20M20,27.36h-8c-1.301,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36h8c1.302,0,2.36,1.059,2.36,2.36S21.302,27.36,20,27.36z%20M12,23.36c-0.904,0-1.64,0.735-1.64,1.64%20s0.736,1.64,1.64,1.64h8c0.904,0,1.64-0.735,1.64-1.64s-0.735-1.64-1.64-1.64H12z%20M31,23.86h-2c-0.199,0-0.36-0.161-0.36-0.36V15%20c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5C31.36,23.699,31.199,23.86,31,23.86z%20M29.36,23.14h1.279v-7.78%20H29.36V23.14z%20M3,23.86H1c-0.199,0-0.36-0.161-0.36-0.36V15c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5%20C3.36,23.699,3.199,23.86,3,23.86z%20M1.36,23.14h1.28v-7.78H1.36V23.14z%20M20,20.36c-1.302,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36s2.36,1.059,2.36,2.36C22.36,19.302,21.302,20.36,20,20.36z%20M20,16.36c-0.904,0-1.64,0.736-1.64,1.64%20s0.735,1.64,1.64,1.64s1.64-0.735,1.64-1.64S20.904,16.36,20,16.36z%20M12,20.36c-1.301,0-2.36-1.059-2.36-2.36s1.059-2.36,2.36-2.36%20s2.36,1.059,2.36,2.36C14.36,19.302,13.301,20.36,12,20.36z%20M12,16.36c-0.904,0-1.64,0.736-1.64,1.64s0.736,1.64,1.64,1.64%20s1.64-0.735,1.64-1.64S12.904,16.36,12,16.36z'/%3e%3crect%20style='fill:none;'%20width='32'%20height='32'/%3e%3c/svg%3e",
610
614
  Pn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAMAAAC/MqoPAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////9vX18vLy/Pz86enp4+Li2tnZ1tbWzczM+fn57Ozs4N/f09LS0M/P5uXl7+/v3dzcwtncCAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAZNSURBVHja7d3bdtsqEABQYABZSLH9/3+ZpnUsIcF5iOM6PfElNoMHMfPQdq3GmL0GkLhEUqLaUExnOtOZznSmM53pTGc605nOdKYznelMZzrTmV4LXSqllKyJDkob26xWq8Zae/iH0QoWTm9d1xur4WuypQJtTd+5dqn0VjcxzNO5/57mEBvdLo8Oron6aseWOjYOFkVvjQs3DmgyONMuht52EfztP+4hdu0i6LCO808/M8c1lE/fuPGej41uUzgdtoO/75N+2ELJ9I3b3//hPXbiMenm3pR/Jt4USgcLBIp4Bh10gqKVhvLo0klCxeSky96nKcj3siw6pJIL4XsoiQ7apyvMY/V3HHrSRioLopvEhSpTCn2TPEuwKYMOIX0tAxRBf/Hpa+lfSqBv9gi1FPsNfTrMAiVmIE/vJhz61FGnQxRIEYE4vfNYdN8Rp6MlHaHotHTn8ejekaZPAjEmyvQWdZFTtYTpXqCGJ0zvcek9Yfoel76nS0ffv1NMp1ca+pkgyfRCGind4L7OWWc605l+cxjsyhqy9AGbPpClc1/nvl5VX0c/3Alk6RU3+Am7shNZ+h6bvidLr7jBB+zKBrL0irOOudmIUDzTmf5gIP+iEuXtRuTVaEmY/oZLfyNMrzjryPc0gerMTdpVg0tvjJUU6bLPcGOoUv46SLL6Wi8yhLf06C7TUyekI0efRaaYqdFltkeNpPumRPSMDxgBYvSM035FrKAmH72hRW99PrpvSdEHkTEGUvSsK3yKVDkuJ92RohcZaehzzirPpOg+J92Tolfc4Cumx5xVXpGiZ34+ICX6W84qv5GiR5NPbiIpOv6BCoSvSkTX+eiaGP092zINvBOj4x8mSf9FqejvNo/cvpOji19ZbmviL0GPLsYMFzgzCor0+Bv/ePDvSJKOb9dJ5UlnbnEHiHgzv6cdTpJOWuc/u3FEucLDOL75xGtBiefrcwgoC9NDSH/jkH6pAuXmBqPQ9HSUPVdZBH1GGOrMXAQdYxcKZfxAoK+KKBKFLosoEoX+u4giUehz8jlcnAuhp78I46yDYNAd+QLR6K+pr+yvxdBTHyVDubQh0UfSxaHSd0lbvNkVRE87JGOtc+PQd2QLQ6fHhJkKsSh6yg13tO08JPprsgrrXWH0dJd2vH1MLPprot4eXoujpzrdhngiD40ek2y92lggPcnWa8qN1Yz0BFuvZhRl0uOfR0v4Ewuli/Bg4Qr3lArqGdndQ3UPO1EunXYwnelMZzrTmc50pjOd6UxnOtOZznSmM53pTGf6kuj6oedFKV0s3fX6sX1S3bsi6a4PD7+/YAqYeBw6pIB/4qEgOqxdSPbGiim4NRRCbzs3Jj0L4UfXtQXQVRfn5IdA/Bw7RZzurEV6EtdsLeGXkIPuA+K1UoVeA0l62zmN/LqfSSft9KkepmoRuvi3nd5uKNFB9zbbXEANqdr941XO0NJx2v2jdJenpf+/3bvn0ts16ph+sd6hX7dPo2+2cZzE02Ia43bzDHqr+2Evnhz74ZHU30ffbKOeng1/NPV30Ns1gYQnSP2P6e65Pfxc6h02XZqXQCjhJ6kPL6bFo4NrGvAU4UII4SE2P1vQuZkuOxckVfehisF1MjUddN/MZBN+kvq5uf0O/xa66gyNS9ktMWlz44rO1Z8C19i5FPdHzPamXn+F3hryPfxMr78+4F+kq22kO6Rf6fUQt+puuustyWv4rbG3l/duztFB96GYoe1cTBdXMr+nw9qVM6ZfxOvzezff0nXi/ZOndvrR6Zvpm0c3h6nhdb+5iS7tsIim/qXZD9+97/Jf+rpZ5BET1ayv0GUzLhEuhBBjIy/RdVPgndutIRt9nt7p5cKFEEJ3Z+jQFDZL+XnMDXxHB73gxn5s9Kc3d3/pFciFkN/QTSXHJpX5l66gDrkQoP6hL3xsPw39la4qOiV8tH78XeSbue6N9mvWa6J/ybpc1CT1Wnh5Qq9meP8IOKH3ddH7E/ri1iYux/SXDrXR4UiPdck/wUpU+FtPf6/orja6O9KL3l56LOvVxe5Ib2qjN0d6Vbex4ghWlU3bPqI90If66MNng680FNpbJijH6kCvaF3uMzQ3+IrpFerV4Y9dffQdN3im10ivbuImhD3Qq5u4HdZkua8znelMZ/pS4z9CPVKkxowNxgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMy0yN1QxNTo0NToxNSswMDowMN1xSg4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDMtMjdUMTU6NDU6MTUrMDA6MDCsLPKyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==",
611
615
  Y = /*#__PURE__*/function () {
@@ -643,7 +647,7 @@ var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
643
647
  value: function createAvatar(e, t) {
644
648
  var r, o, a, l, c;
645
649
  var i = document.createElement("img");
646
- e === b.USER_ROLE ? i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || Pn : i.src = ((a = t == null ? void 0 : t[e]) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t.ai) == null ? void 0 : l.src) || ((c = t == null ? void 0 : t["default"]) == null ? void 0 : c.src) || Ln, i.classList.add("avatar");
650
+ e === b.USER_ROLE ? i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || Pn : i.src = ((a = t == null ? void 0 : t[e]) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t.ai) == null ? void 0 : l.src) || ((c = t == null ? void 0 : t["default"]) == null ? void 0 : c.src) || Ln, i.classList.add("avatar"), i.alt = "".concat(e, " avatar");
647
651
  var s = document.createElement("div");
648
652
  return s.classList.add(Y.CONTAINER_CLASS), s.appendChild(i), t && Y.applyCustomStyles(s, i, t, e), s;
649
653
  }
@@ -667,20 +671,20 @@ var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
667
671
  }();
668
672
  Y.CONTAINER_CLASS = "avatar-container";
669
673
  var Mt = Y;
670
- var me = /*#__PURE__*/function () {
671
- function me() {
672
- _classCallCheck(this, me);
674
+ var ge = /*#__PURE__*/function () {
675
+ function ge() {
676
+ _classCallCheck(this, ge);
673
677
  }
674
- return _createClass(me, null, [{
678
+ return _createClass(ge, null, [{
675
679
  key: "hide",
676
680
  value: function hide(e) {
677
681
  var t;
678
- (t = e.getElementsByClassName(me.NAME_CLASS)[0].style).visibility || (t.visibility = "hidden");
682
+ (t = e.getElementsByClassName(ge.NAME_CLASS)[0].style).visibility || (t.visibility = "hidden");
679
683
  }
680
684
  }, {
681
685
  key: "reveal",
682
686
  value: function reveal(e) {
683
- e.getElementsByClassName(me.NAME_CLASS)[0].style.visibility = "";
687
+ e.getElementsByClassName(ge.NAME_CLASS)[0].style.visibility = "";
684
688
  }
685
689
  }, {
686
690
  key: "getPosition",
@@ -706,20 +710,20 @@ var me = /*#__PURE__*/function () {
706
710
  key: "createName",
707
711
  value: function createName(e, t) {
708
712
  var i = document.createElement("div");
709
- return i.classList.add(me.NAME_CLASS), i.textContent = me.getNameText(e, t), me.applyStyle(i, e, t), i;
713
+ return i.classList.add(ge.NAME_CLASS), i.textContent = ge.getNameText(e, t), ge.applyStyle(i, e, t), i;
710
714
  }
711
715
  }, {
712
716
  key: "add",
713
717
  value: function add(e, t, i) {
714
718
  var s = typeof i == "boolean" ? {} : i,
715
- r = me.createName(t, s),
716
- o = me.getPosition(t, s);
719
+ r = ge.createName(t, s),
720
+ o = ge.getPosition(t, s);
717
721
  r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
718
722
  }
719
723
  }]);
720
724
  }();
721
- me.NAME_CLASS = "name";
722
- var Rt = me;
725
+ ge.NAME_CLASS = "name";
726
+ var Rt = ge;
723
727
  var C = /*#__PURE__*/function () {
724
728
  function C() {
725
729
  _classCallCheck(this, C);
@@ -750,9 +754,9 @@ var C = /*#__PURE__*/function () {
750
754
  }, {
751
755
  key: "getLastMessage",
752
756
  value: function getLastMessage(e, t, i) {
753
- for (var s = e.length - 1; s >= 0; s -= 1) if (e[s].role === t) if (i) {
754
- if (e[s][i]) return e[s];
755
- } else return e[s];
757
+ for (var s = e.length - 1; s >= 0; s -= 1) if (e[s][0].role === t) if (i) {
758
+ if (e[s][0][i]) return e[s][0];
759
+ } else return e[s][0];
756
760
  }
757
761
  }, {
758
762
  key: "getLastTextToElement",
@@ -765,7 +769,7 @@ var C = /*#__PURE__*/function () {
765
769
  }, {
766
770
  key: "overwriteMessage",
767
771
  value: function overwriteMessage(e, t, i, s, r, o) {
768
- var a = C.getLastElementsByClass(t, [C.getRoleClass(s), o], [ke.BUBBLE_CLASS]),
772
+ var a = C.getLastElementsByClass(t, [C.getRoleClass(s), o], [Ae.BUBBLE_CLASS]),
769
773
  l = C.getLastMessage(e, s, r);
770
774
  return l && (l[r] = i), a;
771
775
  }
@@ -830,6 +834,12 @@ var C = /*#__PURE__*/function () {
830
834
  var _e$outerContainer$cla;
831
835
  e.outerContainer.classList.remove(C.POSITION_TOP_MESSAGE_CLASS, C.POSITION_MIDDLE_MESSAGE_CLASS, C.POSITION_BOTTOM_MESSAGE_CLASS), (_e$outerContainer$cla = e.outerContainer.classList).add.apply(_e$outerContainer$cla, _toConsumableArray(t));
832
836
  }
837
+ }, {
838
+ key: "getNumberOfElements",
839
+ value: function getNumberOfElements(e) {
840
+ var t = 0;
841
+ return e.text !== void 0 && (t += 1), e.html !== void 0 && (t += 1), e.files && (t += e.files.length), t;
842
+ }
833
843
  }, {
834
844
  key: "classifyMessages",
835
845
  value: function classifyMessages(e, t) {
@@ -847,11 +857,11 @@ var C = /*#__PURE__*/function () {
847
857
  }();
848
858
  C.AI_ROLE = "ai", C.USER_ROLE = "user", C.EMPTY_MESSAGE_CLASS = "empty-message", C.POSITION_TOP_MESSAGE_CLASS = "deep-chat-top-message", C.POSITION_MIDDLE_MESSAGE_CLASS = "deep-chat-middle-message", C.POSITION_BOTTOM_MESSAGE_CLASS = "deep-chat-bottom-message";
849
859
  var b = C;
850
- var Ze = /*#__PURE__*/function () {
851
- function Ze() {
852
- _classCallCheck(this, Ze);
860
+ var Je = /*#__PURE__*/function () {
861
+ function Je() {
862
+ _classCallCheck(this, Je);
853
863
  }
854
- return _createClass(Ze, null, [{
864
+ return _createClass(Je, null, [{
855
865
  key: "mouseUp",
856
866
  value: function mouseUp(e, t) {
857
867
  R.unsetAllCSSMouseStates(e, t), Object.assign(e.style, t["default"]), Object.assign(e.style, t.hover);
@@ -874,7 +884,7 @@ var Ze = /*#__PURE__*/function () {
874
884
  }, {
875
885
  key: "add",
876
886
  value: function add(e, t) {
877
- e.addEventListener("mouseenter", Ze.mouseEnter.bind(this, e, t)), e.addEventListener("mouseleave", Ze.mouseLeave.bind(this, e, t)), e.addEventListener("mousedown", Ze.mouseDown.bind(this, e, t)), e.addEventListener("mouseup", Ze.mouseUp.bind(this, e, t));
887
+ e.addEventListener("mouseenter", Je.mouseEnter.bind(this, e, t)), e.addEventListener("mouseleave", Je.mouseLeave.bind(this, e, t)), e.addEventListener("mousedown", Je.mouseDown.bind(this, e, t)), e.addEventListener("mouseup", Je.mouseUp.bind(this, e, t));
878
888
  }
879
889
  }]);
880
890
  }();
@@ -902,11 +912,11 @@ var On = "deep-chat-temporary-message",
902
912
  }
903
913
  },
904
914
  Ds = Object.keys(ns);
905
- var Me = /*#__PURE__*/function () {
906
- function Me() {
907
- _classCallCheck(this, Me);
915
+ var ke = /*#__PURE__*/function () {
916
+ function ke() {
917
+ _classCallCheck(this, ke);
908
918
  }
909
- return _createClass(Me, null, [{
919
+ return _createClass(ke, null, [{
910
920
  key: "applySuggestionEvent",
911
921
  value: function applySuggestionEvent(e, t) {
912
922
  setTimeout(function () {
@@ -961,13 +971,13 @@ var Me = /*#__PURE__*/function () {
961
971
  Ds.forEach(function (r) {
962
972
  var o = i.getElementsByClassName(r);
963
973
  Array.from(o || []).forEach(function (a) {
964
- var l = Me.getProcessedStyles(t, a, r);
965
- te.applyStylesToElement(a, l), Me.applyEvents(a, r);
974
+ var l = ke.getProcessedStyles(t, a, r);
975
+ te.applyStylesToElement(a, l), ke.applyEvents(a, r);
966
976
  });
967
977
  });
968
978
  var s = i.getElementsByClassName(Nn);
969
979
  Array.from(s).forEach(function (r) {
970
- return Me.applySuggestionEvent(e, r);
980
+ return ke.applySuggestionEvent(e, r);
971
981
  });
972
982
  }
973
983
  }]);
@@ -980,7 +990,7 @@ var te = /*#__PURE__*/function () {
980
990
  key: "applyStylesToElement",
981
991
  value: function applyStylesToElement(e, t) {
982
992
  var i = R.processStateful(t, {}, {});
983
- Ze.add(e, i), Object.assign(e.style, i["default"]);
993
+ Je.add(e, i), Object.assign(e.style, i["default"]);
984
994
  }
985
995
  }, {
986
996
  key: "applyEventsToElement",
@@ -995,7 +1005,7 @@ var te = /*#__PURE__*/function () {
995
1005
  value: function applyClassUtilitiesToElement(e, t) {
996
1006
  var i = t.events,
997
1007
  s = t.styles;
998
- i && te.applyEventsToElement(e, i), s && !Me.doesElementContainDeepChatClass(e) && te.applyStylesToElement(e, s);
1008
+ i && te.applyEventsToElement(e, i), s && !ke.doesElementContainDeepChatClass(e) && te.applyStylesToElement(e, s);
999
1009
  }
1000
1010
  }, {
1001
1011
  key: "applyCustomClassUtilities",
@@ -1010,7 +1020,7 @@ var te = /*#__PURE__*/function () {
1010
1020
  }, {
1011
1021
  key: "apply",
1012
1022
  value: function apply(e, t) {
1013
- Me.applyDeepChatUtilities(e, e.htmlClassUtilities, t), te.applyCustomClassUtilities(e.htmlClassUtilities, t);
1023
+ ke.applyDeepChatUtilities(e, e.htmlClassUtilities, t), te.applyCustomClassUtilities(e.htmlClassUtilities, t);
1014
1024
  }
1015
1025
  }, {
1016
1026
  key: "traverseNodes",
@@ -1030,11 +1040,11 @@ var te = /*#__PURE__*/function () {
1030
1040
  }
1031
1041
  }]);
1032
1042
  }();
1033
- var Re = /*#__PURE__*/function () {
1034
- function Re() {
1035
- _classCallCheck(this, Re);
1043
+ var Fe = /*#__PURE__*/function () {
1044
+ function Fe() {
1045
+ _classCallCheck(this, Fe);
1036
1046
  }
1037
- return _createClass(Re, null, [{
1047
+ return _createClass(Fe, null, [{
1038
1048
  key: "addElement",
1039
1049
  value: function addElement(e, t) {
1040
1050
  e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
@@ -1047,15 +1057,10 @@ var Re = /*#__PURE__*/function () {
1047
1057
  }
1048
1058
  }, {
1049
1059
  key: "overwrite",
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) {
1056
- var r = e.messages,
1060
+ value: function overwrite(e, t, i, s) {
1061
+ var r = e.messageToElements,
1057
1062
  o = b.overwriteMessage(r, s, t, i, "html", "html-message");
1058
- return o && Re.overwrite(e, t, o), o;
1063
+ return o && (o.bubbleElement.innerHTML = t, te.apply(e, o.outerContainer), le.flagHTMLUpdateClass(o.bubbleElement)), o;
1059
1064
  }
1060
1065
  // prettier-ignore
1061
1066
  }, {
@@ -1064,12 +1069,12 @@ var Re = /*#__PURE__*/function () {
1064
1069
  var o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;
1065
1070
  var l;
1066
1071
  if (r != null && r.status) {
1067
- var c = this.overwriteLast(e, t, i, s);
1072
+ var c = this.overwrite(e, t, i, s);
1068
1073
  if (c) return c;
1069
1074
  r.status = !1;
1070
1075
  }
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;
1076
+ var a = Fe.createElements(e, t, i, o);
1077
+ 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 || Fe.addElement(e, a.outerContainer), a;
1073
1078
  }
1074
1079
  }]);
1075
1080
  }();
@@ -1115,7 +1120,7 @@ function Hn(n, e) {
1115
1120
  i = fn(e);
1116
1121
  return e !== i ? i : e.charCodeAt(0) === 35 && jn.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), mn(t)) ? rs(t) : n;
1117
1122
  }
1118
- function tt(n) {
1123
+ function et(n) {
1119
1124
  return n.indexOf("&") < 0 ? n : n.replace(Un, Hn);
1120
1125
  }
1121
1126
  var qn = /[&<>"]/,
@@ -1137,10 +1142,10 @@ g.blockquote_open = function () {
1137
1142
  return "<blockquote>\n";
1138
1143
  };
1139
1144
  g.blockquote_close = function (n, e) {
1140
- return "</blockquote>" + st(n, e);
1145
+ return "</blockquote>" + it(n, e);
1141
1146
  };
1142
1147
  g.code = function (n, e) {
1143
- return n[e].block ? "<pre><code>" + K(n[e].content) + "</code></pre>" + st(n, e) : "<code>" + K(n[e].content) + "</code>";
1148
+ return n[e].block ? "<pre><code>" + K(n[e].content) + "</code></pre>" + it(n, e) : "<code>" + K(n[e].content) + "</code>";
1144
1149
  };
1145
1150
  g.fence = function (n, e, t, i, s) {
1146
1151
  var r = n[e],
@@ -1152,9 +1157,9 @@ g.fence = function (n, e, t, i, s) {
1152
1157
  h;
1153
1158
  if (r.params) {
1154
1159
  if (c = r.params.split(/\s+/g), d = c.join(" "), Fn(s.rules.fence_custom, c[0])) return s.rules.fence_custom[c[0]](n, e, t, i, s);
1155
- l = K(tt(Bt(d))), o = ' class="' + a + l + '"';
1160
+ l = K(et(Bt(d))), o = ' class="' + a + l + '"';
1156
1161
  }
1157
- return t.highlight ? h = t.highlight.apply(t.highlight, [r.content].concat(c)) || K(r.content) : h = K(r.content), "<pre><code" + o + ">" + h + "</code></pre>" + st(n, e);
1162
+ return t.highlight ? h = t.highlight.apply(t.highlight, [r.content].concat(c)) || K(r.content) : h = K(r.content), "<pre><code" + o + ">" + h + "</code></pre>" + it(n, e);
1158
1163
  };
1159
1164
  g.fence_custom = {};
1160
1165
  g.heading_open = function (n, e) {
@@ -1164,13 +1169,13 @@ g.heading_close = function (n, e) {
1164
1169
  return "</h" + n[e].hLevel + ">\n";
1165
1170
  };
1166
1171
  g.hr = function (n, e, t) {
1167
- return (t.xhtmlOut ? "<hr />" : "<hr>") + st(n, e);
1172
+ return (t.xhtmlOut ? "<hr />" : "<hr>") + it(n, e);
1168
1173
  };
1169
1174
  g.bullet_list_open = function () {
1170
1175
  return "<ul>\n";
1171
1176
  };
1172
1177
  g.bullet_list_close = function (n, e) {
1173
- return "</ul>" + st(n, e);
1178
+ return "</ul>" + it(n, e);
1174
1179
  };
1175
1180
  g.list_item_open = function () {
1176
1181
  return "<li>";
@@ -1184,17 +1189,17 @@ g.ordered_list_open = function (n, e) {
1184
1189
  return "<ol" + i + ">\n";
1185
1190
  };
1186
1191
  g.ordered_list_close = function (n, e) {
1187
- return "</ol>" + st(n, e);
1192
+ return "</ol>" + it(n, e);
1188
1193
  };
1189
1194
  g.paragraph_open = function (n, e) {
1190
1195
  return n[e].tight ? "" : "<p>";
1191
1196
  };
1192
1197
  g.paragraph_close = function (n, e) {
1193
1198
  var t = !(n[e].tight && e && n[e - 1].type === "inline" && !n[e - 1].content);
1194
- return (n[e].tight ? "" : "</p>") + (t ? st(n, e) : "");
1199
+ return (n[e].tight ? "" : "</p>") + (t ? it(n, e) : "");
1195
1200
  };
1196
1201
  g.link_open = function (n, e, t) {
1197
- var i = n[e].title ? ' title="' + K(tt(n[e].title)) + '"' : "",
1202
+ var i = n[e].title ? ' title="' + K(et(n[e].title)) + '"' : "",
1198
1203
  s = t.linkTarget ? ' target="' + t.linkTarget + '"' : "";
1199
1204
  return '<a href="' + K(n[e].href) + '"' + i + s + ">";
1200
1205
  };
@@ -1203,8 +1208,8 @@ g.link_close = function () {
1203
1208
  };
1204
1209
  g.image = function (n, e, t) {
1205
1210
  var i = ' src="' + K(n[e].src) + '"',
1206
- s = n[e].title ? ' title="' + K(tt(n[e].title)) + '"' : "",
1207
- r = ' alt="' + (n[e].alt ? K(tt(Bt(n[e].alt))) : "") + '"',
1211
+ s = n[e].title ? ' title="' + K(et(n[e].title)) + '"' : "",
1212
+ r = ' alt="' + (n[e].alt ? K(et(Bt(n[e].alt))) : "") + '"',
1208
1213
  o = t.xhtmlOut ? " /" : "";
1209
1214
  return "<img" + i + r + s + o + ">";
1210
1215
  };
@@ -1298,7 +1303,7 @@ g.htmltag = function (n, e) {
1298
1303
  return n[e].content;
1299
1304
  };
1300
1305
  g.abbr_open = function (n, e) {
1301
- return '<abbr title="' + K(tt(n[e].title)) + '">';
1306
+ return '<abbr title="' + K(et(n[e].title)) + '">';
1302
1307
  };
1303
1308
  g.abbr_close = function () {
1304
1309
  return "</abbr>";
@@ -1348,7 +1353,7 @@ g.dd_close = function () {
1348
1353
  function gn(n, e) {
1349
1354
  return ++e >= n.length - 2 ? e : n[e].type === "paragraph_open" && n[e].tight && n[e + 1].type === "inline" && n[e + 1].content.length === 0 && n[e + 2].type === "paragraph_close" && n[e + 2].tight ? gn(n, e + 2) : e;
1350
1355
  }
1351
- var st = g.getBreak = function (e, t) {
1356
+ var it = g.getBreak = function (e, t) {
1352
1357
  return t = gn(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
1353
1358
  };
1354
1359
  function Ss() {
@@ -1447,24 +1452,24 @@ function $n(n) {
1447
1452
  children: []
1448
1453
  }) : n.block.parse(n.src, n.options, n.env, n.tokens);
1449
1454
  }
1450
- function nt(n, e, t, i, s) {
1455
+ function st(n, e, t, i, s) {
1451
1456
  this.src = n, this.env = i, this.options = t, this.parser = e, this.tokens = s, this.pos = 0, this.posMax = this.src.length, this.level = 0, this.pending = "", this.pendingLevel = 0, this.cache = [], this.isInLabel = !1, this.linkLevel = 0, this.linkContent = "", this.labelUnmatchedScopes = 0;
1452
1457
  }
1453
- nt.prototype.pushPending = function () {
1458
+ st.prototype.pushPending = function () {
1454
1459
  this.tokens.push({
1455
1460
  type: "text",
1456
1461
  content: this.pending,
1457
1462
  level: this.pendingLevel
1458
1463
  }), this.pending = "";
1459
1464
  };
1460
- nt.prototype.push = function (n) {
1465
+ st.prototype.push = function (n) {
1461
1466
  this.pending && this.pushPending(), this.tokens.push(n), this.pendingLevel = this.level;
1462
1467
  };
1463
- nt.prototype.cacheSet = function (n, e) {
1468
+ st.prototype.cacheSet = function (n, e) {
1464
1469
  for (var t = this.cache.length; t <= n; t++) this.cache.push(0);
1465
1470
  this.cache[n] = e;
1466
1471
  };
1467
- nt.prototype.cacheGet = function (n) {
1472
+ st.prototype.cacheGet = function (n) {
1468
1473
  return n < this.cache.length ? this.cache[n] : 0;
1469
1474
  };
1470
1475
  function Ut(n, e) {
@@ -1488,7 +1493,7 @@ function Ut(n, e) {
1488
1493
  }
1489
1494
  function Wn(n, e, t, i) {
1490
1495
  var s, r, o, a, l, c;
1491
- if (n.charCodeAt(0) !== 42 || n.charCodeAt(1) !== 91 || n.indexOf("]:") === -1 || (s = new nt(n, e, t, i, []), r = Ut(s, 1), r < 0 || n.charCodeAt(r + 1) !== 58)) return -1;
1496
+ if (n.charCodeAt(0) !== 42 || n.charCodeAt(1) !== 91 || n.indexOf("]:") === -1 || (s = new st(n, e, t, i, []), r = Ut(s, 1), r < 0 || n.charCodeAt(r + 1) !== 58)) return -1;
1492
1497
  for (a = s.posMax, o = r + 2; o < a && s.src.charCodeAt(o) !== 10; o++);
1493
1498
  return l = n.slice(2, r), c = n.slice(r + 2, o).trim(), c.length === 0 ? -1 : (i.abbreviations || (i.abbreviations = {}), _typeof(i.abbreviations[":" + l]) > "u" && (i.abbreviations[":" + l] = c), o);
1494
1499
  }
@@ -1506,7 +1511,7 @@ function Kn(n) {
1506
1511
  }
1507
1512
  }
1508
1513
  function os(n) {
1509
- var e = tt(n);
1514
+ var e = et(n);
1510
1515
  try {
1511
1516
  e = decodeURI(e);
1512
1517
  } catch (_unused2) {}
@@ -1561,7 +1566,7 @@ function yn(n) {
1561
1566
  }
1562
1567
  function Jn(n, e, t, i) {
1563
1568
  var s, r, o, a, l, c, d, h, u;
1564
- if (n.charCodeAt(0) !== 91 || n.indexOf("]:") === -1 || (s = new nt(n, e, t, i, []), r = Ut(s, 0), r < 0 || n.charCodeAt(r + 1) !== 58)) return -1;
1569
+ if (n.charCodeAt(0) !== 91 || n.indexOf("]:") === -1 || (s = new st(n, e, t, i, []), r = Ut(s, 0), r < 0 || n.charCodeAt(r + 1) !== 58)) return -1;
1565
1570
  for (a = s.posMax, o = r + 2; o < a && (l = s.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
1566
1571
  if (!bn(s, o)) return -1;
1567
1572
  for (d = s.linkContent, o = s.pos, c = o, o = o + 1; o < a && (l = s.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
@@ -1721,33 +1726,33 @@ var rr = /['"]/,
1721
1726
  function js(n, e) {
1722
1727
  return e < 0 || e >= n.length ? !1 : !or.test(n[e]);
1723
1728
  }
1724
- function ct(n, e, t) {
1729
+ function lt(n, e, t) {
1725
1730
  return n.substr(0, e) + t + n.substr(e + 1);
1726
1731
  }
1727
1732
  function ar(n) {
1728
- var e, t, i, s, r, o, a, l, c, d, h, u, f, m, p, y, x;
1733
+ var e, t, i, s, r, o, a, l, c, d, h, u, f, m, p, v, y;
1729
1734
  if (n.options.typographer) {
1730
- for (x = [], p = n.tokens.length - 1; p >= 0; p--) if (n.tokens[p].type === "inline") {
1731
- for (y = n.tokens[p].children, x.length = 0, e = 0; e < y.length; e++) if (t = y[e], !(t.type !== "text" || rr.test(t.text))) {
1732
- for (a = y[e].level, f = x.length - 1; f >= 0 && !(x[f].level <= a); f--);
1733
- x.length = f + 1, i = t.content, r = 0, o = i.length;
1735
+ for (y = [], p = n.tokens.length - 1; p >= 0; p--) if (n.tokens[p].type === "inline") {
1736
+ for (v = n.tokens[p].children, y.length = 0, e = 0; e < v.length; e++) if (t = v[e], !(t.type !== "text" || rr.test(t.text))) {
1737
+ for (a = v[e].level, f = y.length - 1; f >= 0 && !(y[f].level <= a); f--);
1738
+ y.length = f + 1, i = t.content, r = 0, o = i.length;
1734
1739
  e: for (; r < o && (Bs.lastIndex = r, s = Bs.exec(i), !!s);) {
1735
1740
  if (l = !js(i, s.index - 1), r = s.index + 1, m = s[0] === "'", c = !js(i, r), !c && !l) {
1736
- m && (t.content = ct(t.content, s.index, Us));
1741
+ m && (t.content = lt(t.content, s.index, Us));
1737
1742
  continue;
1738
1743
  }
1739
1744
  if (h = !c, u = !l, u) {
1740
- for (f = x.length - 1; f >= 0 && (d = x[f], !(x[f].level < a)); f--) if (d.single === m && x[f].level === a) {
1741
- d = x[f], m ? (y[d.token].content = ct(y[d.token].content, d.pos, n.options.quotes[2]), t.content = ct(t.content, s.index, n.options.quotes[3])) : (y[d.token].content = ct(y[d.token].content, d.pos, n.options.quotes[0]), t.content = ct(t.content, s.index, n.options.quotes[1])), x.length = f;
1745
+ for (f = y.length - 1; f >= 0 && (d = y[f], !(y[f].level < a)); f--) if (d.single === m && y[f].level === a) {
1746
+ d = y[f], m ? (v[d.token].content = lt(v[d.token].content, d.pos, n.options.quotes[2]), t.content = lt(t.content, s.index, n.options.quotes[3])) : (v[d.token].content = lt(v[d.token].content, d.pos, n.options.quotes[0]), t.content = lt(t.content, s.index, n.options.quotes[1])), y.length = f;
1742
1747
  continue e;
1743
1748
  }
1744
1749
  }
1745
- h ? x.push({
1750
+ h ? y.push({
1746
1751
  token: e,
1747
1752
  pos: s.index,
1748
1753
  single: m,
1749
1754
  level: a
1750
- }) : u && m && (t.content = ct(t.content, s.index, Us));
1755
+ }) : u && m && (t.content = lt(t.content, s.index, Us));
1751
1756
  }
1752
1757
  }
1753
1758
  }
@@ -1762,7 +1767,7 @@ En.prototype.process = function (n) {
1762
1767
  var e, t, i;
1763
1768
  for (i = this.ruler.getRules(""), e = 0, t = i.length; e < t; e++) i[e](n);
1764
1769
  };
1765
- function rt(n, e, t, i, s) {
1770
+ function nt(n, e, t, i, s) {
1766
1771
  var r, o, a, l, c, d, h;
1767
1772
  for (this.src = n, this.parser = e, this.options = t, this.env = i, this.tokens = s, this.bMarks = [], this.eMarks = [], this.tShift = [], this.blkIndent = 0, this.line = 0, this.lineMax = 0, this.tight = !1, this.parentType = "root", this.ddIndent = -1, this.level = 0, this.result = "", o = this.src, d = 0, h = !1, a = l = d = 0, c = o.length; l < c; l++) {
1768
1773
  if (r = o.charCodeAt(l), !h) if (r === 32) {
@@ -1773,27 +1778,27 @@ function rt(n, e, t, i, s) {
1773
1778
  }
1774
1779
  this.bMarks.push(o.length), this.eMarks.push(o.length), this.tShift.push(0), this.lineMax = this.bMarks.length - 1;
1775
1780
  }
1776
- rt.prototype.isEmpty = function (e) {
1781
+ nt.prototype.isEmpty = function (e) {
1777
1782
  return this.bMarks[e] + this.tShift[e] >= this.eMarks[e];
1778
1783
  };
1779
- rt.prototype.skipEmptyLines = function (e) {
1784
+ nt.prototype.skipEmptyLines = function (e) {
1780
1785
  for (var t = this.lineMax; e < t && !(this.bMarks[e] + this.tShift[e] < this.eMarks[e]); e++);
1781
1786
  return e;
1782
1787
  };
1783
- rt.prototype.skipSpaces = function (e) {
1788
+ nt.prototype.skipSpaces = function (e) {
1784
1789
  for (var t = this.src.length; e < t && this.src.charCodeAt(e) === 32; e++);
1785
1790
  return e;
1786
1791
  };
1787
- rt.prototype.skipChars = function (e, t) {
1792
+ nt.prototype.skipChars = function (e, t) {
1788
1793
  for (var i = this.src.length; e < i && this.src.charCodeAt(e) === t; e++);
1789
1794
  return e;
1790
1795
  };
1791
- rt.prototype.skipCharsBack = function (e, t, i) {
1796
+ nt.prototype.skipCharsBack = function (e, t, i) {
1792
1797
  if (e <= i) return e;
1793
1798
  for (; e > i;) if (t !== this.src.charCodeAt(--e)) return e + 1;
1794
1799
  return e;
1795
1800
  };
1796
- rt.prototype.getLines = function (e, t, i, s) {
1801
+ nt.prototype.getLines = function (e, t, i, s) {
1797
1802
  var r,
1798
1803
  o,
1799
1804
  a,
@@ -1863,12 +1868,12 @@ function dr(n, e, t, i) {
1863
1868
  f,
1864
1869
  m,
1865
1870
  p = n.bMarks[e] + n.tShift[e],
1866
- y = n.eMarks[e];
1867
- if (p > y || n.src.charCodeAt(p++) !== 62 || n.level >= n.options.maxNesting) return !1;
1871
+ v = n.eMarks[e];
1872
+ if (p > v || n.src.charCodeAt(p++) !== 62 || n.level >= n.options.maxNesting) return !1;
1868
1873
  if (i) return !0;
1869
- for (n.src.charCodeAt(p) === 32 && p++, l = n.blkIndent, n.blkIndent = 0, a = [n.bMarks[e]], n.bMarks[e] = p, p = p < y ? n.skipSpaces(p) : p, r = p >= y, o = [n.tShift[e]], n.tShift[e] = p - n.bMarks[e], h = n.parser.ruler.getRules("blockquote"), s = e + 1; s < t && (p = n.bMarks[s] + n.tShift[s], y = n.eMarks[s], !(p >= y)); s++) {
1874
+ for (n.src.charCodeAt(p) === 32 && p++, l = n.blkIndent, n.blkIndent = 0, a = [n.bMarks[e]], n.bMarks[e] = p, p = p < v ? n.skipSpaces(p) : p, r = p >= v, o = [n.tShift[e]], n.tShift[e] = p - n.bMarks[e], h = n.parser.ruler.getRules("blockquote"), s = e + 1; s < t && (p = n.bMarks[s] + n.tShift[s], v = n.eMarks[s], !(p >= v)); s++) {
1870
1875
  if (n.src.charCodeAt(p++) === 62) {
1871
- n.src.charCodeAt(p) === 32 && p++, a.push(n.bMarks[s]), n.bMarks[s] = p, p = p < y ? n.skipSpaces(p) : p, r = p >= y, o.push(n.tShift[s]), n.tShift[s] = p - n.bMarks[s];
1876
+ n.src.charCodeAt(p) === 32 && p++, a.push(n.bMarks[s]), n.bMarks[s] = p, p = p < v ? n.skipSpaces(p) : p, r = p >= v, o.push(n.tShift[s]), n.tShift[s] = p - n.bMarks[s];
1872
1877
  continue;
1873
1878
  }
1874
1879
  if (r) break;
@@ -1943,51 +1948,51 @@ function fr(n, e, t, i) {
1943
1948
  f,
1944
1949
  m,
1945
1950
  p,
1951
+ v,
1946
1952
  y,
1947
- x,
1948
- j,
1953
+ P,
1949
1954
  G,
1950
- Pe,
1955
+ Ie,
1951
1956
  I,
1952
1957
  Z = !0,
1953
1958
  X,
1954
- D,
1955
- je,
1959
+ F,
1960
+ Ue,
1956
1961
  Tt;
1957
- if ((h = qs(n, e)) >= 0) y = !0;else if ((h = Hs(n, e)) >= 0) y = !1;else return !1;
1962
+ if ((h = qs(n, e)) >= 0) v = !0;else if ((h = Hs(n, e)) >= 0) v = !1;else return !1;
1958
1963
  if (n.level >= n.options.maxNesting) return !1;
1959
1964
  if (p = n.src.charCodeAt(h - 1), i) return !0;
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({
1965
+ for (P = n.tokens.length, v ? (d = n.bMarks[e] + n.tShift[e], m = Number(n.src.substr(d, h - d - 1)), n.tokens.push({
1961
1966
  type: "ordered_list_open",
1962
1967
  order: m,
1963
- lines: Pe = [e, 0],
1968
+ lines: Ie = [e, 0],
1964
1969
  level: n.level++
1965
1970
  })) : n.tokens.push({
1966
1971
  type: "bullet_list_open",
1967
- lines: Pe = [e, 0],
1972
+ lines: Ie = [e, 0],
1968
1973
  level: n.level++
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({
1974
+ }), s = e, G = !1, X = n.parser.ruler.getRules("list"); s < t && (y = n.skipSpaces(h), u = n.eMarks[s], y >= u ? f = 1 : f = y - h, f > 4 && (f = 1), f < 1 && (f = 1), r = h - n.bMarks[s] + f, n.tokens.push({
1970
1975
  type: "list_item_open",
1971
1976
  lines: I = [e, 0],
1972
1977
  level: n.level++
1973
- }), a = n.blkIndent, l = n.tight, o = n.tShift[e], c = n.parentType, n.tShift[e] = x - n.bMarks[e], n.blkIndent = r, n.tight = !0, n.parentType = "list", n.parser.tokenize(n, e, t, !0), (!n.tight || G) && (Z = !1), G = n.line - e > 1 && n.isEmpty(n.line - 1), n.blkIndent = a, n.tShift[e] = o, n.tight = l, n.parentType = c, n.tokens.push({
1978
+ }), a = n.blkIndent, l = n.tight, o = n.tShift[e], c = n.parentType, n.tShift[e] = y - n.bMarks[e], n.blkIndent = r, n.tight = !0, n.parentType = "list", n.parser.tokenize(n, e, t, !0), (!n.tight || G) && (Z = !1), G = n.line - e > 1 && n.isEmpty(n.line - 1), n.blkIndent = a, n.tShift[e] = o, n.tight = l, n.parentType = c, n.tokens.push({
1974
1979
  type: "list_item_close",
1975
1980
  level: --n.level
1976
- }), s = e = n.line, I[1] = s, x = n.bMarks[e], !(s >= t || n.isEmpty(s) || n.tShift[s] < n.blkIndent));) {
1977
- for (Tt = !1, D = 0, je = X.length; D < je; D++) if (X[D](n, s, t, !0)) {
1981
+ }), s = e = n.line, I[1] = s, y = n.bMarks[e], !(s >= t || n.isEmpty(s) || n.tShift[s] < n.blkIndent));) {
1982
+ for (Tt = !1, F = 0, Ue = X.length; F < Ue; F++) if (X[F](n, s, t, !0)) {
1978
1983
  Tt = !0;
1979
1984
  break;
1980
1985
  }
1981
1986
  if (Tt) break;
1982
- if (y) {
1987
+ if (v) {
1983
1988
  if (h = qs(n, s), h < 0) break;
1984
1989
  } else if (h = Hs(n, s), h < 0) break;
1985
1990
  if (p !== n.src.charCodeAt(h - 1)) break;
1986
1991
  }
1987
1992
  return n.tokens.push({
1988
- type: y ? "ordered_list_close" : "bullet_list_close",
1993
+ type: v ? "ordered_list_close" : "bullet_list_close",
1989
1994
  level: --n.level
1990
- }), Pe[1] = s, n.line = s, Z && ur(n, j), !0;
1995
+ }), Ie[1] = s, n.line = s, Z && ur(n, P), !0;
1991
1996
  }
1992
1997
  function pr(n, e, t, i) {
1993
1998
  var s,
@@ -2192,7 +2197,7 @@ function Sr(n, e) {
2192
2197
  for (t = e + 2, i = n.tokens.length - 2; t < i; t++) n.tokens[t].level === s && n.tokens[t].type === "paragraph_open" && (n.tokens[t + 2].tight = !0, n.tokens[t].tight = !0, t += 2);
2193
2198
  }
2194
2199
  function _r(n, e, t, i) {
2195
- var s, r, o, a, l, c, d, h, u, f, m, p, y, x;
2200
+ var s, r, o, a, l, c, d, h, u, f, m, p, v, y;
2196
2201
  if (i) return n.ddIndent < 0 ? !1 : ni(n, e) >= 0;
2197
2202
  if (d = e + 1, n.isEmpty(d) && ++d > t || n.tShift[d] < n.blkIndent || (s = ni(n, d), s < 0) || n.level >= n.options.maxNesting) return !1;
2198
2203
  c = n.tokens.length, n.tokens.push({
@@ -2201,7 +2206,7 @@ function _r(n, e, t, i) {
2201
2206
  level: n.level++
2202
2207
  }), o = e, r = d;
2203
2208
  e: for (;;) {
2204
- for (x = !0, y = !1, n.tokens.push({
2209
+ for (y = !0, v = !1, n.tokens.push({
2205
2210
  type: "dt_open",
2206
2211
  lines: [o, o],
2207
2212
  level: n.level++
@@ -2219,7 +2224,7 @@ function _r(n, e, t, i) {
2219
2224
  type: "dd_open",
2220
2225
  lines: a = [d, 0],
2221
2226
  level: n.level++
2222
- }), p = n.tight, u = n.ddIndent, h = n.blkIndent, m = n.tShift[r], f = n.parentType, n.blkIndent = n.ddIndent = n.tShift[r] + 2, n.tShift[r] = s - n.bMarks[r], n.tight = !0, n.parentType = "deflist", n.parser.tokenize(n, r, t, !0), (!n.tight || y) && (x = !1), y = n.line - r > 1 && n.isEmpty(n.line - 1), n.tShift[r] = m, n.tight = p, n.parentType = f, n.blkIndent = h, n.ddIndent = u, n.tokens.push({
2227
+ }), p = n.tight, u = n.ddIndent, h = n.blkIndent, m = n.tShift[r], f = n.parentType, n.blkIndent = n.ddIndent = n.tShift[r] + 2, n.tShift[r] = s - n.bMarks[r], n.tight = !0, n.parentType = "deflist", n.parser.tokenize(n, r, t, !0), (!n.tight || v) && (y = !1), v = n.line - r > 1 && n.isEmpty(n.line - 1), n.tShift[r] = m, n.tight = p, n.parentType = f, n.blkIndent = h, n.ddIndent = u, n.tokens.push({
2223
2228
  type: "dd_close",
2224
2229
  level: --n.level
2225
2230
  }), a[1] = d = n.line, d >= t || n.tShift[d] < n.blkIndent) break e;
@@ -2231,7 +2236,7 @@ function _r(n, e, t, i) {
2231
2236
  return n.tokens.push({
2232
2237
  type: "dl_close",
2233
2238
  level: --n.level
2234
- }), l[1] = d, n.line = d, x && Sr(n, c), !0;
2239
+ }), l[1] = d, n.line = d, y && Sr(n, c), !0;
2235
2240
  }
2236
2241
  function wr(n, e) {
2237
2242
  var t,
@@ -2294,7 +2299,7 @@ _s.prototype.parse = function (n, e, t, i) {
2294
2299
  n = n.replace(Ar, " "), n = n.replace(Cr, "\n"), n.indexOf(" ") >= 0 && (n = n.replace(Tr, function (a, l) {
2295
2300
  var c;
2296
2301
  return n.charCodeAt(l) === 10 ? (r = l + 1, o = 0, a) : (c = " ".slice((l - r - o) % 4), o = l - r + 1, c);
2297
- })), s = new rt(n, this, e, t, i), this.tokenize(s, s.line, s.lineMax);
2302
+ })), s = new nt(n, this, e, t, i), this.tokenize(s, s.line, s.lineMax);
2298
2303
  };
2299
2304
  function kr(n) {
2300
2305
  switch (n) {
@@ -2786,13 +2791,13 @@ Pi.prototype.tokenize = function (n) {
2786
2791
  n.pending && n.pushPending();
2787
2792
  };
2788
2793
  Pi.prototype.parse = function (n, e, t, i) {
2789
- var s = new nt(n, this, e, t, i);
2794
+ var s = new st(n, this, e, t, i);
2790
2795
  this.tokenize(s);
2791
2796
  };
2792
2797
  function fo(n) {
2793
2798
  var e = ["vbscript", "javascript", "file", "data"],
2794
2799
  t = n.trim().toLowerCase();
2795
- return t = tt(t), !(t.indexOf(":") !== -1 && e.indexOf(t.split(":")[0]) !== -1);
2800
+ return t = et(t), !(t.indexOf(":") !== -1 && e.indexOf(t.split(":")[0]) !== -1);
2796
2801
  }
2797
2802
  var po = {
2798
2803
  options: {
@@ -2911,34 +2916,34 @@ var po = {
2911
2916
  function Sn(n, e, t) {
2912
2917
  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;
2913
2918
  }
2914
- function Ie(n, e) {
2919
+ function Me(n, e) {
2915
2920
  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 || {});
2916
2921
  }
2917
- Ie.prototype.set = function (n) {
2922
+ Me.prototype.set = function (n) {
2918
2923
  pn(this.options, n);
2919
2924
  };
2920
- Ie.prototype.configure = function (n) {
2925
+ Me.prototype.configure = function (n) {
2921
2926
  var e = this;
2922
2927
  if (!n) throw new Error("Wrong `remarkable` preset, check name/content");
2923
2928
  n.options && e.set(n.options), n.components && Object.keys(n.components).forEach(function (t) {
2924
2929
  n.components[t].rules && e[t].ruler.enable(n.components[t].rules, !0);
2925
2930
  });
2926
2931
  };
2927
- Ie.prototype.use = function (n, e) {
2932
+ Me.prototype.use = function (n, e) {
2928
2933
  return n(this, e), this;
2929
2934
  };
2930
- Ie.prototype.parse = function (n, e) {
2935
+ Me.prototype.parse = function (n, e) {
2931
2936
  var t = new Sn(this, n, e);
2932
2937
  return this.core.process(t), t.tokens;
2933
2938
  };
2934
- Ie.prototype.render = function (n, e) {
2939
+ Me.prototype.render = function (n, e) {
2935
2940
  return e = e || {}, this.renderer.render(this.parse(n, e), this.options, e);
2936
2941
  };
2937
- Ie.prototype.parseInline = function (n, e) {
2942
+ Me.prototype.parseInline = function (n, e) {
2938
2943
  var t = new Sn(this, n, e);
2939
2944
  return t.inlineMode = !0, this.core.process(t), t.tokens;
2940
2945
  };
2941
- Ie.prototype.renderInline = function (n, e) {
2946
+ Me.prototype.renderInline = function (n, e) {
2942
2947
  return e = e || {}, this.renderer.render(this.parseInline(n, e), this.options, e);
2943
2948
  };
2944
2949
  var jt = /*#__PURE__*/function () {
@@ -2949,7 +2954,7 @@ var jt = /*#__PURE__*/function () {
2949
2954
  key: "instantiate",
2950
2955
  value: function instantiate() {
2951
2956
  var e = window.hljs;
2952
- return e ? new Ie({
2957
+ return e ? new Me({
2953
2958
  highlight: function highlight(t, i) {
2954
2959
  if (i && e.getLanguage(i)) try {
2955
2960
  return e.highlight(i, t).value;
@@ -2975,7 +2980,7 @@ var jt = /*#__PURE__*/function () {
2975
2980
  // set target to open in a new tab
2976
2981
  typographer: !0
2977
2982
  // Enable smartypants and other sweet transforms
2978
- }) : new Ie({
2983
+ }) : new Me({
2979
2984
  breaks: !0,
2980
2985
  linkTarget: "_blank"
2981
2986
  // set target to open in a new tab
@@ -3081,7 +3086,7 @@ var xe = /*#__PURE__*/function () {
3081
3086
  }]);
3082
3087
  }();
3083
3088
  xe.DEFAULT_FILE_NAME = "file";
3084
- var B = xe;
3089
+ var U = xe;
3085
3090
  var hi = /*#__PURE__*/function () {
3086
3091
  function hi() {
3087
3092
  _classCallCheck(this, hi);
@@ -3095,7 +3100,7 @@ var hi = /*#__PURE__*/function () {
3095
3100
  isHistory: i,
3096
3101
  isInitial: i
3097
3102
  }));
3098
- B.reAddFileRefToObject(t, s), (r = e.onMessage) == null || r.call(e, s), e.dispatchEvent(new CustomEvent("message", {
3103
+ U.reAddFileRefToObject(t, s), (r = e.onMessage) == null || r.call(e, s), e.dispatchEvent(new CustomEvent("message", {
3099
3104
  detail: s
3100
3105
  })), le.fireOnNewMessage(e, s);
3101
3106
  }
@@ -3123,11 +3128,11 @@ var hi = /*#__PURE__*/function () {
3123
3128
  }
3124
3129
  }]);
3125
3130
  }();
3126
- var F = /*#__PURE__*/function () {
3127
- function F() {
3128
- _classCallCheck(this, F);
3131
+ var B = /*#__PURE__*/function () {
3132
+ function B() {
3133
+ _classCallCheck(this, B);
3129
3134
  }
3130
- return _createClass(F, null, [{
3135
+ return _createClass(B, null, [{
3131
3136
  key: "generateLoadingRingElement",
3132
3137
  value: function generateLoadingRingElement() {
3133
3138
  var e = document.createElement("div");
@@ -3136,25 +3141,25 @@ var F = /*#__PURE__*/function () {
3136
3141
  }, {
3137
3142
  key: "apply",
3138
3143
  value: function apply(e, t, i) {
3139
- ke.setRing(t.bubbleElement, i == null ? void 0 : i.bubble), i != null && i.bubble && (i = JSON.parse(JSON.stringify(i)), delete i.bubble), e.applyCustomStyles(t, "history", !1, i);
3144
+ Ae.setRing(t.bubbleElement, i == null ? void 0 : i.bubble), i != null && i.bubble && (i = JSON.parse(JSON.stringify(i)), delete i.bubble), e.applyCustomStyles(t, "history", !1, i);
3140
3145
  }
3141
3146
  }, {
3142
3147
  key: "addLoadHistoryMessage",
3143
3148
  value: function addLoadHistoryMessage(e, t) {
3144
3149
  var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
3145
3150
  var o, a, l, c, d, h, u, f;
3146
- e.bubbleElement.classList.add(F.CLASS);
3147
- var s = i ? F.FULL_VIEW_CLASS : F.SMALL_CLASS;
3151
+ e.bubbleElement.classList.add(B.CLASS);
3152
+ var s = i ? B.FULL_VIEW_CLASS : B.SMALL_CLASS;
3148
3153
  e.outerContainer.classList.add(s);
3149
3154
  var r = i ? (c = (l = (a = (o = t.messageStyles) == null ? void 0 : o.loading) == null ? void 0 : a.history) == null ? void 0 : l.full) == null ? void 0 : c.styles : (f = (u = (h = (d = t.messageStyles) == null ? void 0 : d.loading) == null ? void 0 : h.history) == null ? void 0 : u.small) == null ? void 0 : f.styles;
3150
- F.apply(t, e, r), t.elementRef.prepend(e.outerContainer);
3155
+ B.apply(t, e, r), t.elementRef.prepend(e.outerContainer);
3151
3156
  }
3152
3157
  }, {
3153
3158
  key: "createDefaultElements",
3154
3159
  value: function createDefaultElements(e) {
3155
3160
  var t = e.createMessageElements("", b.AI_ROLE),
3156
3161
  i = t.bubbleElement,
3157
- s = F.generateLoadingRingElement();
3162
+ s = B.generateLoadingRingElement();
3158
3163
  return i.appendChild(s), t;
3159
3164
  }
3160
3165
  }, {
@@ -3163,25 +3168,25 @@ var F = /*#__PURE__*/function () {
3163
3168
  var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
3164
3169
  var r, o, a, l;
3165
3170
  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,
3166
- s = i ? Re.createElements(e, i, b.AI_ROLE, !0) : F.createDefaultElements(e);
3167
- return F.addLoadHistoryMessage(s, e, t), s;
3171
+ s = i ? Fe.createElements(e, i, b.AI_ROLE, !0) : B.createDefaultElements(e);
3172
+ return B.addLoadHistoryMessage(s, e, t), s;
3168
3173
  }
3169
3174
  }, {
3170
3175
  key: "changeFullViewToSmall",
3171
3176
  value: function changeFullViewToSmall(e, t) {
3172
3177
  var i, s, r, o, a, l, c, d;
3173
- if (t != null && t.outerContainer.classList.contains(F.FULL_VIEW_CLASS)) {
3174
- t.outerContainer.classList.replace(F.FULL_VIEW_CLASS, F.SMALL_CLASS);
3178
+ if (t != null && t.outerContainer.classList.contains(B.FULL_VIEW_CLASS)) {
3179
+ t.outerContainer.classList.replace(B.FULL_VIEW_CLASS, B.SMALL_CLASS);
3175
3180
  var h = (o = (r = (s = (i = e.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.history) == null ? void 0 : r.small) == null ? void 0 : o.styles;
3176
- h && F.apply(e, t, h);
3181
+ h && B.apply(e, t, h);
3177
3182
  var u = (d = (c = (l = (a = e.messageStyles) == null ? void 0 : a.loading) == null ? void 0 : l.history) == null ? void 0 : c.small) == null ? void 0 : d.html;
3178
3183
  u && (t.bubbleElement.innerHTML = u);
3179
3184
  }
3180
3185
  }
3181
3186
  }]);
3182
3187
  }();
3183
- F.CLASS = "loading-history-message", F.FULL_VIEW_CLASS = "loading-history-message-full-view", F.SMALL_CLASS = "loading-history-message-small";
3184
- var Qe = F;
3188
+ B.CLASS = "loading-history-message", B.FULL_VIEW_CLASS = "loading-history-message-full-view", B.SMALL_CLASS = "loading-history-message-small";
3189
+ var Ye = B;
3185
3190
  var q = /*#__PURE__*/function () {
3186
3191
  function q() {
3187
3192
  _classCallCheck(this, q);
@@ -3231,15 +3236,15 @@ var q = /*#__PURE__*/function () {
3231
3236
  }
3232
3237
  }]);
3233
3238
  }();
3234
- var Be = /*#__PURE__*/function () {
3235
- function Be(e) {
3239
+ var De = /*#__PURE__*/function () {
3240
+ function De(e) {
3236
3241
  var _this3 = this;
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 () {
3242
+ _classCallCheck(this, De);
3243
+ this.messageElementRefs = [], this.htmlClassUtilities = {}, this.messageToElements = [], this.textElementsToText = [], this.elementRef = De.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 () {
3239
3244
  _this3.submitUserMessage = e.submitUserMessage;
3240
3245
  });
3241
3246
  }
3242
- return _createClass(Be, [{
3247
+ return _createClass(De, [{
3243
3248
  key: "addNewTextMessage",
3244
3249
  value: function addNewTextMessage(e, t, i) {
3245
3250
  var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
@@ -3256,7 +3261,7 @@ var Be = /*#__PURE__*/function () {
3256
3261
  }, {
3257
3262
  key: "overwriteText",
3258
3263
  value: function overwriteText(e, t, i) {
3259
- var s = b.overwriteMessage(this.messages, i, t, e, "text", "text-message");
3264
+ var s = b.overwriteMessage(this.messageToElements, i, t, e, "text", "text-message");
3260
3265
  if (s) {
3261
3266
  this.renderText(s.bubbleElement, t);
3262
3267
  var r = b.getLastTextToElement(this.textElementsToText, s);
@@ -3297,7 +3302,7 @@ var Be = /*#__PURE__*/function () {
3297
3302
  var r;
3298
3303
  (r = this._introPanel) == null || r.hide();
3299
3304
  var s = this.messageElementRefs[this.messageElementRefs.length - 1];
3300
- return Qe.changeFullViewToSmall(this, s), Be.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), s.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t, i);
3305
+ return Ye.changeFullViewToSmall(this, s), De.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), s.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t, i);
3301
3306
  }
3302
3307
  // this can be tested by having an ai message, then a temp ai message with html that submits new user message:
3303
3308
  // https://github.com/OvidijusParsiunas/deep-chat/issues/258
@@ -3305,16 +3310,16 @@ var Be = /*#__PURE__*/function () {
3305
3310
  }, {
3306
3311
  key: "revealRoleElementsIfTempRemoved",
3307
3312
  value: function revealRoleElementsIfTempRemoved(e, t) {
3308
- if ((this._avatars || this._names) && Me.isElementTemporary(e)) {
3313
+ if ((this._avatars || this._names) && ke.isElementTemporary(e)) {
3309
3314
  var i = this.messageElementRefs[this.messageElementRefs.length - 2];
3310
- i && this.messages[this.messages.length - 1] && !e.bubbleElement.classList.contains(b.getRoleClass(t)) && b.revealRoleElements(i.innerContainer, this._avatars, this._names);
3315
+ i && this.messageToElements.length > 0 && !e.bubbleElement.classList.contains(b.getRoleClass(t)) && b.revealRoleElements(i.innerContainer, this._avatars, this._names);
3311
3316
  }
3312
3317
  }
3313
3318
  }, {
3314
3319
  key: "createMessageElements",
3315
3320
  value: function createMessageElements(e, t) {
3316
3321
  var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
3317
- var s = Be.createBaseElements(t),
3322
+ var s = De.createBaseElements(t),
3318
3323
  r = s.outerContainer,
3319
3324
  o = s.innerContainer,
3320
3325
  a = s.bubbleElement;
@@ -3326,7 +3331,7 @@ var Be = /*#__PURE__*/function () {
3326
3331
  // prettier-ignore
3327
3332
  function addInnerContainerElements(e, t, i) {
3328
3333
  var s;
3329
- return ((s = this.messages[this.messages.length - 1]) == null ? void 0 : s.role) === i && !this.isLastMessageError() && b.hideRoleElements(this.messageElementRefs, !!this._avatars, !!this._names), e.classList.add("message-bubble", b.getRoleClass(i), i === b.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), b.addRoleElements(e, i, this._avatars, this._names), {
3334
+ return ((s = this.messageToElements[this.messageToElements.length - 1]) == null ? void 0 : s[0].role) === i && !this.isLastMessageError() && b.hideRoleElements(this.messageElementRefs, !!this._avatars, !!this._names), e.classList.add("message-bubble", b.getRoleClass(i), i === b.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), b.addRoleElements(e, i, this._avatars, this._names), {
3330
3335
  bubbleElement: e
3331
3336
  };
3332
3337
  }
@@ -3386,7 +3391,7 @@ var Be = /*#__PURE__*/function () {
3386
3391
  }, {
3387
3392
  key: "isTemporaryElement",
3388
3393
  value: function isTemporaryElement(e) {
3389
- return Be.isLoadingMessage(e) || Me.isElementTemporary(e);
3394
+ return De.isLoadingMessage(e) || ke.isElementTemporary(e);
3390
3395
  }
3391
3396
  }, {
3392
3397
  key: "createBaseElements",
@@ -3417,17 +3422,16 @@ var Be = /*#__PURE__*/function () {
3417
3422
  }, {
3418
3423
  key: "isLoadingMessage",
3419
3424
  value: function isLoadingMessage(e) {
3420
- return e == null ? void 0 : e.bubbleElement.classList.contains(ke.BUBBLE_CLASS);
3425
+ return e == null ? void 0 : e.bubbleElement.classList.contains(Ae.BUBBLE_CLASS);
3421
3426
  }
3422
3427
  }]);
3423
3428
  }();
3424
- var Se = /*#__PURE__*/function () {
3425
- // used for extracting at end and for isStreaming
3426
- function Se(e) {
3427
- _classCallCheck(this, Se);
3428
- this._fileAdded = !1, this._streamedContent = "", this._streamType = "", this._hasStreamEnded = !1, this._messages = e;
3429
+ var ft = /*#__PURE__*/function () {
3430
+ function ft(e) {
3431
+ _classCallCheck(this, ft);
3432
+ this._fileAdded = !1, this._streamType = "", this._hasStreamEnded = !1, this._messages = e;
3429
3433
  }
3430
- return _createClass(Se, [{
3434
+ return _createClass(ft, [{
3431
3435
  key: "upsertStreamedMessage",
3432
3436
  value: function upsertStreamedMessage(e) {
3433
3437
  var r;
@@ -3436,7 +3440,7 @@ var Se = /*#__PURE__*/function () {
3436
3440
  var t = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.html) || "",
3437
3441
  i = J.isScrollbarAtBottomOfElement(this._messages.elementRef),
3438
3442
  s = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
3439
- if (!this._elements && this._streamedContent === "") this.setInitialState(s, t, e == null ? void 0 : e.role);else {
3443
+ if (!this._elements && !this._message) this.setInitialState(s, t, e == null ? void 0 : e.role);else {
3440
3444
  if (this._streamType !== s) return console.error(M.INVALID_STREAM_EVENT_MIX);
3441
3445
  this.updateBasedOnType(t, s, (r = this._elements) == null ? void 0 : r.bubbleElement, e == null ? void 0 : e.overwrite);
3442
3446
  }
@@ -3446,9 +3450,9 @@ var Se = /*#__PURE__*/function () {
3446
3450
  key: "setInitialState",
3447
3451
  value: function setInitialState(e, t, i) {
3448
3452
  var _i8;
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({
3453
+ this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : Fe.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(ft.MESSAGE_CLASS), this._activeMessageRole = i, this._message = _defineProperty({
3450
3454
  role: this._activeMessageRole
3451
- }, e, this._streamedContent), this._messages.messages.push(this._message);
3455
+ }, e, t), this._messages.messageToElements.push([this._message, [this._elements]]);
3452
3456
  }
3453
3457
  }, {
3454
3458
  key: "updateBasedOnType",
@@ -3459,24 +3463,24 @@ var Se = /*#__PURE__*/function () {
3459
3463
  }, {
3460
3464
  key: "updateText",
3461
3465
  value: function updateText(e, t, i) {
3462
- this._streamedContent = i ? e : this._streamedContent + e, this._messages.textElementsToText[this._messages.textElementsToText.length - 1][1] = this._streamedContent, this._messages.renderText(t, this._streamedContent);
3466
+ this._message && (this._message.text = i ? e : this._message.text + e, this._messages.textElementsToText[this._messages.textElementsToText.length - 1][1] = this._message.text, this._messages.renderText(t, this._message.text));
3463
3467
  }
3464
3468
  }, {
3465
3469
  key: "updateHTML",
3466
3470
  value: function updateHTML(e, t, i) {
3467
- if (i) this._streamedContent = e, t.innerHTML = e;else {
3471
+ if (this._message) if (i) this._message.html = e, t.innerHTML = e;else {
3468
3472
  var s = document.createElement("span");
3469
- s.innerHTML = e, t.appendChild(s), this._streamedContent = Se.HTML_CONTENT_PLACEHOLDER;
3473
+ s.innerHTML = e, t.appendChild(s), this._message.html = (t == null ? void 0 : t.innerHTML) || "";
3470
3474
  }
3471
3475
  }
3472
3476
  }, {
3473
3477
  key: "finaliseStreamedMessage",
3474
3478
  value: function finaliseStreamedMessage() {
3475
- var t, i;
3479
+ var t;
3476
3480
  var e = this._messages.textElementsToText;
3477
- if (!this._endStreamAfterOperation && !(this._fileAdded && !this._elements)) {
3481
+ if (!(this._endStreamAfterOperation || !this._message) && !(this._fileAdded && !this._elements)) {
3478
3482
  if (!this._elements) throw Error(M.NO_VALID_STREAM_EVENTS_SENT);
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);
3483
+ (t = this._elements.bubbleElement) != null && t.classList.contains(ft.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._message.text || "", this._messages.textToSpeech && bt.speak(this._message.text || "", this._messages.textToSpeech)) : this._streamType === "html" && this._elements && te.apply(this._messages, this._elements.outerContainer), this._elements.bubbleElement.classList.remove(ft.MESSAGE_CLASS), this._message && this._messages.sendClientUpdate(De.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
3480
3484
  }
3481
3485
  }
3482
3486
  }, {
@@ -3487,7 +3491,7 @@ var Se = /*#__PURE__*/function () {
3487
3491
  }, {
3488
3492
  key: "newMessage",
3489
3493
  value: function newMessage() {
3490
- this.finaliseStreamedMessage(), this._elements = void 0, this._streamedContent = "", this._fileAdded = !1, this._hasStreamEnded = !1, this._activeMessageRole = void 0;
3494
+ this.finaliseStreamedMessage(), this._elements = void 0, delete this._message, this._fileAdded = !1, this._hasStreamEnded = !1, this._activeMessageRole = void 0;
3491
3495
  }
3492
3496
  // prettier-ignore
3493
3497
  }, {
@@ -3521,13 +3525,13 @@ var Se = /*#__PURE__*/function () {
3521
3525
  }()
3522
3526
  }]);
3523
3527
  }();
3524
- Se.MESSAGE_CLASS = "streamed-message", Se.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
3525
- var ge = Se;
3526
- var We = /*#__PURE__*/function () {
3527
- function We() {
3528
- _classCallCheck(this, We);
3528
+ ft.MESSAGE_CLASS = "streamed-message";
3529
+ var be = ft;
3530
+ var $e = /*#__PURE__*/function () {
3531
+ function $e() {
3532
+ _classCallCheck(this, $e);
3529
3533
  }
3530
- return _createClass(We, null, [{
3534
+ return _createClass($e, null, [{
3531
3535
  key: "tempRemoveContentHeader",
3532
3536
  value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
3533
3537
  // prettier-ignore
@@ -3543,8 +3547,8 @@ var We = /*#__PURE__*/function () {
3543
3547
  }
3544
3548
  throw new Error("Request settings have not been set up");
3545
3549
  case 2:
3546
- s = e.headers[We.CONTENT_TYPE];
3547
- delete e.headers[We.CONTENT_TYPE];
3550
+ s = e.headers[$e.CONTENT_TYPE];
3551
+ delete e.headers[$e.CONTENT_TYPE];
3548
3552
  _context2.prev = 4;
3549
3553
  _context2.next = 7;
3550
3554
  return t(i);
@@ -3555,9 +3559,9 @@ var We = /*#__PURE__*/function () {
3555
3559
  case 10:
3556
3560
  _context2.prev = 10;
3557
3561
  _context2.t0 = _context2["catch"](4);
3558
- throw e.headers[We.CONTENT_TYPE] = s, _context2.t0;
3562
+ throw e.headers[$e.CONTENT_TYPE] = s, _context2.t0;
3559
3563
  case 13:
3560
- return _context2.abrupt("return", (e.headers[We.CONTENT_TYPE] = s, r));
3564
+ return _context2.abrupt("return", (e.headers[$e.CONTENT_TYPE] = s, r));
3561
3565
  case 14:
3562
3566
  case "end":
3563
3567
  return _context2.stop();
@@ -3650,8 +3654,8 @@ var We = /*#__PURE__*/function () {
3650
3654
  }
3651
3655
  }]);
3652
3656
  }();
3653
- We.CONTENT_TYPE = "Content-Type";
3654
- var v = We;
3657
+ $e.CONTENT_TYPE = "Content-Type";
3658
+ var E = $e;
3655
3659
  function vo(_x12, _x13) {
3656
3660
  return _vo.apply(this, arguments);
3657
3661
  }
@@ -3775,22 +3779,22 @@ function wo(n, e) {
3775
3779
  m.abort(), document.hidden || I();
3776
3780
  }
3777
3781
  l || document.addEventListener("visibilitychange", p);
3778
- var y = _o,
3779
- x = 0;
3780
- function j() {
3781
- document.removeEventListener("visibilitychange", p), window.clearTimeout(x), m.abort();
3782
+ var v = _o,
3783
+ y = 0;
3784
+ function P() {
3785
+ document.removeEventListener("visibilitychange", p), window.clearTimeout(y), m.abort();
3782
3786
  }
3783
3787
  t == null || t.addEventListener("abort", function () {
3784
- j(), h();
3788
+ P(), h();
3785
3789
  });
3786
3790
  var G = c !== null && c !== void 0 ? c : window.fetch,
3787
- Pe = s !== null && s !== void 0 ? s : To;
3791
+ Ie = s !== null && s !== void 0 ? s : To;
3788
3792
  function I() {
3789
3793
  return _I.apply(this, arguments);
3790
3794
  }
3791
3795
  function _I() {
3792
3796
  _I = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
3793
- var Z, X, D;
3797
+ var Z, X, F;
3794
3798
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
3795
3799
  while (1) switch (_context4.prev = _context4.next) {
3796
3800
  case 0:
@@ -3804,17 +3808,17 @@ function wo(n, e) {
3804
3808
  case 4:
3805
3809
  X = _context4.sent;
3806
3810
  _context4.next = 7;
3807
- return Pe(X);
3811
+ return Ie(X);
3808
3812
  case 7:
3809
3813
  _context4.next = 9;
3810
- return vo(X.body, yo(Eo(function (D) {
3811
- D ? f[Ws] = D : delete f[Ws];
3812
- }, function (D) {
3813
- y = D;
3814
+ return vo(X.body, yo(Eo(function (F) {
3815
+ F ? f[Ws] = F : delete f[Ws];
3816
+ }, function (F) {
3817
+ v = F;
3814
3818
  }, r)));
3815
3819
  case 9:
3816
3820
  o == null || o();
3817
- j();
3821
+ P();
3818
3822
  h();
3819
3823
  _context4.next = 17;
3820
3824
  break;
@@ -3822,10 +3826,10 @@ function wo(n, e) {
3822
3826
  _context4.prev = 14;
3823
3827
  _context4.t0 = _context4["catch"](1);
3824
3828
  if (!m.signal.aborted) try {
3825
- D = (Z = a == null ? void 0 : a(_context4.t0)) !== null && Z !== void 0 ? Z : y;
3826
- window.clearTimeout(x), x = window.setTimeout(I, D);
3827
- } catch (D) {
3828
- j(), u(D);
3829
+ F = (Z = a == null ? void 0 : a(_context4.t0)) !== null && Z !== void 0 ? Z : v;
3830
+ window.clearTimeout(y), y = window.setTimeout(I, F);
3831
+ } catch (F) {
3832
+ P(), u(F);
3829
3833
  }
3830
3834
  case 17:
3831
3835
  case "end":
@@ -3854,13 +3858,13 @@ var A = /*#__PURE__*/function () {
3854
3858
  var s,
3855
3859
  r,
3856
3860
  p,
3861
+ v,
3857
3862
  y,
3858
- x,
3859
- j,
3863
+ P,
3860
3864
  G,
3861
- Pe,
3865
+ Ie,
3862
3866
  o,
3863
- _yield$v$processReque,
3867
+ _yield$E$processReque,
3864
3868
  a,
3865
3869
  l,
3866
3870
  c,
@@ -3881,12 +3885,12 @@ var A = /*#__PURE__*/function () {
3881
3885
  headers: (p = e.connectSettings) == null ? void 0 : p.headers
3882
3886
  };
3883
3887
  _context7.next = 5;
3884
- return v.processRequestInterceptor(e.deepChat, o);
3888
+ return E.processRequestInterceptor(e.deepChat, o);
3885
3889
  case 5:
3886
- _yield$v$processReque = _context7.sent;
3887
- a = _yield$v$processReque.body;
3888
- l = _yield$v$processReque.headers;
3889
- c = _yield$v$processReque.error;
3890
+ _yield$E$processReque = _context7.sent;
3891
+ a = _yield$E$processReque.body;
3892
+ l = _yield$E$processReque.headers;
3893
+ c = _yield$E$processReque.error;
3890
3894
  _e$streamHandlers = e.streamHandlers;
3891
3895
  d = _e$streamHandlers.onOpen;
3892
3896
  h = _e$streamHandlers.onClose;
@@ -3895,25 +3899,25 @@ var A = /*#__PURE__*/function () {
3895
3899
  _context7.next = 15;
3896
3900
  break;
3897
3901
  }
3898
- return _context7.abrupt("return", v.onInterceptorError(i, c, h));
3902
+ return _context7.abrupt("return", E.onInterceptorError(i, c, h));
3899
3903
  case 15:
3900
- if (!((y = e.connectSettings) != null && y.handler)) {
3904
+ if (!((v = e.connectSettings) != null && v.handler)) {
3901
3905
  _context7.next = 17;
3902
3906
  break;
3903
3907
  }
3904
- return _context7.abrupt("return", Ce.stream(e, a, i));
3908
+ return _context7.abrupt("return", Te.stream(e, a, i));
3905
3909
  case 17:
3906
- if (!(((x = e.connectSettings) == null ? void 0 : x.url) === be.URL)) {
3910
+ if (!(((y = e.connectSettings) == null ? void 0 : y.url) === ve.URL)) {
3907
3911
  _context7.next = 19;
3908
3912
  break;
3909
3913
  }
3910
- return _context7.abrupt("return", be.requestStream(i, e.streamHandlers));
3914
+ return _context7.abrupt("return", ve.requestStream(i, e.streamHandlers));
3911
3915
  case 19:
3912
- f = new ge(i), m = v.fetch.bind(this, e, l, s);
3913
- return _context7.abrupt("return", (wo(((j = e.connectSettings) == null ? void 0 : j.url) || e.url || "", {
3916
+ f = new be(i), m = E.fetch.bind(this, e, l, s);
3917
+ return _context7.abrupt("return", (wo(((P = e.connectSettings) == null ? void 0 : P.url) || e.url || "", {
3914
3918
  method: ((G = e.connectSettings) == null ? void 0 : G.method) || "POST",
3915
3919
  headers: l,
3916
- credentials: (Pe = e.connectSettings) == null ? void 0 : Pe.credentials,
3920
+ credentials: (Ie = e.connectSettings) == null ? void 0 : Ie.credentials,
3917
3921
  body: s ? JSON.stringify(a) : a,
3918
3922
  openWhenHidden: !0,
3919
3923
  // keep stream open when browser tab not open
@@ -3929,7 +3933,7 @@ var A = /*#__PURE__*/function () {
3929
3933
  return _context5.abrupt("return", d());
3930
3934
  case 2:
3931
3935
  _context5.next = 4;
3932
- return v.processResponseByType(I);
3936
+ return E.processResponseByType(I);
3933
3937
  case 4:
3934
3938
  throw _context5.sent;
3935
3939
  case 5:
@@ -3941,7 +3945,7 @@ var A = /*#__PURE__*/function () {
3941
3945
  },
3942
3946
  onmessage: function onmessage(I) {
3943
3947
  return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
3944
- var Z, X, D, je, Tt;
3948
+ var Z, X, F, Ue, Tt;
3945
3949
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
3946
3950
  while (1) switch (_context6.prev = _context6.next) {
3947
3951
  case 0:
@@ -3950,25 +3954,25 @@ var A = /*#__PURE__*/function () {
3950
3954
  break;
3951
3955
  }
3952
3956
  try {
3953
- je = JSON.parse(I.data);
3957
+ Ue = JSON.parse(I.data);
3954
3958
  } catch (_unused6) {
3955
- je = {};
3959
+ Ue = {};
3956
3960
  }
3957
3961
  _context6.next = 4;
3958
- return (X = (Z = e.deepChat).responseInterceptor) == null ? void 0 : X.call(Z, je);
3962
+ return (X = (Z = e.deepChat).responseInterceptor) == null ? void 0 : X.call(Z, Ue);
3959
3963
  case 4:
3960
3964
  _context6.t0 = _context6.sent;
3961
3965
  if (_context6.t0) {
3962
3966
  _context6.next = 7;
3963
3967
  break;
3964
3968
  }
3965
- _context6.t0 = je;
3969
+ _context6.t0 = Ue;
3966
3970
  case 7:
3967
3971
  Tt = _context6.t0;
3968
- (D = e.extractResultData) == null || D.call(e, Tt, m, a).then(function (He) {
3969
- e.asyncCallInProgress && He && He.text !== "" ? (A.simulate(i, e.streamHandlers, He), h(), e.asyncCallInProgress = !1) : A.upsertWFiles(i, f.upsertStreamedMessage.bind(f), f, He);
3970
- })["catch"](function (He) {
3971
- return v.displayError(i, He);
3972
+ (F = e.extractResultData) == null || F.call(e, Tt, m, a).then(function (je) {
3973
+ e.asyncCallInProgress && je && je.text !== "" ? (A.simulate(i, e.streamHandlers, je), h(), e.asyncCallInProgress = !1) : A.upsertWFiles(i, f.upsertStreamedMessage.bind(f), f, je);
3974
+ })["catch"](function (je) {
3975
+ return E.displayError(i, je);
3972
3976
  });
3973
3977
  case 9:
3974
3978
  case "end":
@@ -3991,9 +3995,9 @@ var A = /*#__PURE__*/function () {
3991
3995
  })["catch"](function (I) {
3992
3996
  var Z;
3993
3997
  i.isLastMessageError() || (Z = e.extractResultData) == null || Z.call(e, I).then(function () {
3994
- v.displayError(i, I);
3998
+ E.displayError(i, I);
3995
3999
  })["catch"](function (X) {
3996
- v.displayError(i, X);
4000
+ E.displayError(i, X);
3997
4001
  });
3998
4002
  }), f));
3999
4003
  case 21:
@@ -4017,12 +4021,12 @@ var A = /*#__PURE__*/function () {
4017
4021
  }, i), !1), i.text) {
4018
4022
  t.onOpen();
4019
4023
  var r = i.text.split("");
4020
- A.populateMessages(r, new ge(e), s, "text");
4024
+ A.populateMessages(r, new be(e), s, "text");
4021
4025
  }
4022
4026
  if (i.html) {
4023
4027
  t.onOpen();
4024
4028
  var _r2 = te.splitHTML(i.html);
4025
- A.populateMessages(_r2, new ge(e), s, "html");
4029
+ _r2.length === 0 && (_r2 = i.html.split("")), A.populateMessages(_r2, new be(e), s, "html");
4026
4030
  }
4027
4031
  }
4028
4032
  // prettier-ignore
@@ -4070,14 +4074,14 @@ var A = /*#__PURE__*/function () {
4070
4074
  }
4071
4075
  }]);
4072
4076
  }();
4073
- var Ke = /*#__PURE__*/function () {
4074
- function Ke() {
4075
- _classCallCheck(this, Ke);
4077
+ var We = /*#__PURE__*/function () {
4078
+ function We() {
4079
+ _classCallCheck(this, We);
4076
4080
  }
4077
- return _createClass(Ke, null, [{
4081
+ return _createClass(We, null, [{
4078
4082
  key: "generateResponse",
4079
4083
  value: function generateResponse(e) {
4080
- var t = e.messages[e.messages.length - 1];
4084
+ var t = e[e.length - 1][0];
4081
4085
  if (t.files && t.files.length > 0) {
4082
4086
  if (t.files.length > 1) return "These are interesting files!";
4083
4087
  var i = t.files[0];
@@ -4096,16 +4100,18 @@ var Ke = /*#__PURE__*/function () {
4096
4100
  }
4097
4101
  }, {
4098
4102
  key: "getResponse",
4099
- value: function getResponse(e) {
4100
- return e.customDemoResponse ? Ke.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
4101
- text: Ke.generateResponse(e)
4103
+ value: function getResponse(_ref2) {
4104
+ var e = _ref2.customDemoResponse,
4105
+ t = _ref2.messageToElements;
4106
+ return e ? We.getCustomResponse(e, t[t.length - 1][0]) : {
4107
+ text: We.generateResponse(t)
4102
4108
  };
4103
4109
  }
4104
4110
  // timeout is used to simulate a timeout for a response to come back
4105
4111
  }, {
4106
4112
  key: "request",
4107
4113
  value: function request(e, t) {
4108
- var i = Ke.getResponse(t);
4114
+ var i = We.getResponse(t);
4109
4115
  setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
4110
4116
  var r, o, s;
4111
4117
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
@@ -4135,22 +4141,22 @@ var Ke = /*#__PURE__*/function () {
4135
4141
  key: "requestStream",
4136
4142
  value: function requestStream(e, t) {
4137
4143
  setTimeout(function () {
4138
- var i = Ke.getResponse(e);
4144
+ var i = We.getResponse(e);
4139
4145
  A.simulate(e, t, i);
4140
4146
  }, 400);
4141
4147
  }
4142
4148
  }]);
4143
4149
  }();
4144
- Ke.URL = "deep-chat-demo";
4145
- var be = Ke;
4146
- var U = /*#__PURE__*/function () {
4147
- function U() {
4148
- _classCallCheck(this, U);
4150
+ We.URL = "deep-chat-demo";
4151
+ var ve = We;
4152
+ var j = /*#__PURE__*/function () {
4153
+ function j() {
4154
+ _classCallCheck(this, j);
4149
4155
  }
4150
- return _createClass(U, null, [{
4156
+ return _createClass(j, null, [{
4151
4157
  key: "setup",
4152
4158
  value: function setup(e) {
4153
- e.connectSettings.url !== be.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
4159
+ e.connectSettings.url !== ve.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
4154
4160
  }
4155
4161
  }, {
4156
4162
  key: "isElementPresentInDOM",
@@ -4162,21 +4168,21 @@ var U = /*#__PURE__*/function () {
4162
4168
  }, {
4163
4169
  key: "createConnection",
4164
4170
  value: function createConnection(e, t) {
4165
- if (!U.isElementPresentInDOM(e.deepChat)) return;
4171
+ if (!j.isElementPresentInDOM(e.deepChat)) return;
4166
4172
  var i = e.connectSettings.websocket;
4167
4173
  if (i) {
4168
- if (e.connectSettings.handler) return Ce.websocket(e, t);
4174
+ if (e.connectSettings.handler) return Te.websocket(e, t);
4169
4175
  try {
4170
4176
  var s = typeof i != "boolean" ? i : void 0,
4171
4177
  r = new WebSocket(e.connectSettings.url || "", s);
4172
4178
  e.websocket = r, e.websocket.onopen = function () {
4173
4179
  var o, a;
4174
- t.removeError(), e.websocket && _typeof(e.websocket) == "object" && U.assignListeners(e, r, t), (a = (o = e.deepChat)._validationHandler) == null || a.call(o);
4180
+ t.removeError(), e.websocket && _typeof(e.websocket) == "object" && j.assignListeners(e, r, t), (a = (o = e.deepChat)._validationHandler) == null || a.call(o);
4175
4181
  }, e.websocket.onerror = function (o) {
4176
- console.error(o), U.retryConnection(e, t);
4182
+ console.error(o), j.retryConnection(e, t);
4177
4183
  };
4178
4184
  } catch (s) {
4179
- console.error(s), U.retryConnection(e, t);
4185
+ console.error(s), j.retryConnection(e, t);
4180
4186
  }
4181
4187
  }
4182
4188
  }
@@ -4184,8 +4190,8 @@ var U = /*#__PURE__*/function () {
4184
4190
  key: "retryConnection",
4185
4191
  value: function retryConnection(e, t) {
4186
4192
  var i, s;
4187
- (s = (i = e.deepChat)._validationHandler) == null || s.call(i), U.isElementPresentInDOM(e.deepChat) && (e.websocket = "pending", t.isLastMessageError() || t.addNewErrorMessage("service", "Connection error"), setTimeout(function () {
4188
- U.createConnection(e, t);
4193
+ (s = (i = e.deepChat)._validationHandler) == null || s.call(i), j.isElementPresentInDOM(e.deepChat) && (e.websocket = "pending", t.isLastMessageError() || t.addNewErrorMessage("service", "Connection error"), setTimeout(function () {
4194
+ j.createConnection(e, t);
4189
4195
  }, 5e3));
4190
4196
  }
4191
4197
  }, {
@@ -4194,7 +4200,7 @@ var U = /*#__PURE__*/function () {
4194
4200
  var _this6 = this;
4195
4201
  var s = {};
4196
4202
  t.onmessage = /*#__PURE__*/function () {
4197
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(r) {
4203
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(r) {
4198
4204
  var o, a, l, c, d, h, u;
4199
4205
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
4200
4206
  while (1) switch (_context9.prev = _context9.next) {
@@ -4227,7 +4233,7 @@ var U = /*#__PURE__*/function () {
4227
4233
  throw Error(M.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
4228
4234
  case 14:
4229
4235
  if (A.isSimulation(e.stream)) {
4230
- h = U.stream.bind(_this6, e, i, s), u = s[l.role || b.AI_ROLE];
4236
+ h = j.stream.bind(_this6, e, i, s), u = s[l.role || b.AI_ROLE];
4231
4237
  A.upsertWFiles(i, h, u, d);
4232
4238
  } else i.addNewMessage(d);
4233
4239
  _context9.next = 20;
@@ -4235,7 +4241,7 @@ var U = /*#__PURE__*/function () {
4235
4241
  case 17:
4236
4242
  _context9.prev = 17;
4237
4243
  _context9.t1 = _context9["catch"](1);
4238
- v.displayError(i, _context9.t1, "Error in server message");
4244
+ E.displayError(i, _context9.t1, "Error in server message");
4239
4245
  case 20:
4240
4246
  case "end":
4241
4247
  return _context9.stop();
@@ -4243,10 +4249,10 @@ var U = /*#__PURE__*/function () {
4243
4249
  }, _callee9, null, [[1, 17]]);
4244
4250
  }));
4245
4251
  return function (_x17) {
4246
- return _ref3.apply(this, arguments);
4252
+ return _ref4.apply(this, arguments);
4247
4253
  };
4248
4254
  }(), t.onclose = function () {
4249
- console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(), U.createConnection(e, i);
4255
+ console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(), j.createConnection(e, i);
4250
4256
  };
4251
4257
  }
4252
4258
  }, {
@@ -4258,7 +4264,7 @@ var U = /*#__PURE__*/function () {
4258
4264
  h,
4259
4265
  r,
4260
4266
  o,
4261
- _yield$v$processReque2,
4267
+ _yield$E$processReque2,
4262
4268
  a,
4263
4269
  l,
4264
4270
  c,
@@ -4279,29 +4285,29 @@ var U = /*#__PURE__*/function () {
4279
4285
  headers: (d = e.connectSettings) == null ? void 0 : d.headers
4280
4286
  };
4281
4287
  _context10.next = 7;
4282
- return v.processRequestInterceptor(e.deepChat, o);
4288
+ return E.processRequestInterceptor(e.deepChat, o);
4283
4289
  case 7:
4284
- _yield$v$processReque2 = _context10.sent;
4285
- a = _yield$v$processReque2.body;
4286
- l = _yield$v$processReque2.error;
4290
+ _yield$E$processReque2 = _context10.sent;
4291
+ a = _yield$E$processReque2.body;
4292
+ l = _yield$E$processReque2.error;
4287
4293
  if (!l) {
4288
4294
  _context10.next = 12;
4289
4295
  break;
4290
4296
  }
4291
4297
  return _context10.abrupt("return", i.addNewErrorMessage("service", l));
4292
4298
  case 12:
4293
- if (U.isWebSocket(r)) {
4299
+ if (j.isWebSocket(r)) {
4294
4300
  _context10.next = 14;
4295
4301
  break;
4296
4302
  }
4297
4303
  return _context10.abrupt("return", r.newUserMessage.listener(a));
4298
4304
  case 14:
4299
4305
  c = s ? JSON.stringify(a) : a;
4300
- if (!(((h = e.connectSettings) == null ? void 0 : h.url) === be.URL)) {
4306
+ if (!(((h = e.connectSettings) == null ? void 0 : h.url) === ve.URL)) {
4301
4307
  _context10.next = 17;
4302
4308
  break;
4303
4309
  }
4304
- return _context10.abrupt("return", be.request(e, i));
4310
+ return _context10.abrupt("return", ve.request(e, i));
4305
4311
  case 17:
4306
4312
  r.readyState === void 0 || r.readyState !== r.OPEN ? (console.error("Connection is not open"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error")) : (r.send(JSON.stringify(c)), e.completionsHandlers.onFinish());
4307
4313
  case 18:
@@ -4318,7 +4324,7 @@ var U = /*#__PURE__*/function () {
4318
4324
  }, {
4319
4325
  key: "canSendMessage",
4320
4326
  value: function canSendMessage(e) {
4321
- return e ? e === "pending" ? !1 : U.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
4327
+ return e ? e === "pending" ? !1 : j.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
4322
4328
  }
4323
4329
  // if false then it is the internal websocket handler
4324
4330
  }, {
@@ -4335,16 +4341,16 @@ var U = /*#__PURE__*/function () {
4335
4341
  var _i$o;
4336
4342
  var o = s.role || b.AI_ROLE,
4337
4343
  a = i[o];
4338
- s.text === r || s.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new ge(t), i[o].upsertStreamedMessage(s));
4344
+ s.text === r || s.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new be(t), i[o].upsertStreamedMessage(s));
4339
4345
  } else A.simulate(t, e.streamHandlers, s);
4340
4346
  }
4341
4347
  }]);
4342
4348
  }();
4343
- var Ce = /*#__PURE__*/function () {
4344
- function Ce() {
4345
- _classCallCheck(this, Ce);
4349
+ var Te = /*#__PURE__*/function () {
4350
+ function Te() {
4351
+ _classCallCheck(this, Te);
4346
4352
  }
4347
- return _createClass(Ce, null, [{
4353
+ return _createClass(Te, null, [{
4348
4354
  key: "request",
4349
4355
  value: function () {
4350
4356
  var _request2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, i) {
@@ -4354,7 +4360,7 @@ var Ce = /*#__PURE__*/function () {
4354
4360
  case 0:
4355
4361
  s = !0;
4356
4362
  r = /*#__PURE__*/function () {
4357
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(c) {
4363
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(c) {
4358
4364
  var h, u, d;
4359
4365
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
4360
4366
  while (1) switch (_context11.prev = _context11.next) {
@@ -4377,7 +4383,7 @@ var Ce = /*#__PURE__*/function () {
4377
4383
  _context11.t0 = c;
4378
4384
  case 8:
4379
4385
  d = _context11.t0;
4380
- v.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : A.isSimulatable(e.stream, d) ? A.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(M.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
4386
+ E.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : A.isSimulatable(e.stream, d) ? A.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(M.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
4381
4387
  case 10:
4382
4388
  case "end":
4383
4389
  return _context11.stop();
@@ -4385,9 +4391,9 @@ var Ce = /*#__PURE__*/function () {
4385
4391
  }, _callee11);
4386
4392
  }));
4387
4393
  return function r(_x24) {
4388
- return _ref4.apply(this, arguments);
4394
+ return _ref5.apply(this, arguments);
4389
4395
  };
4390
- }(), o = Ce.generateOptionalSignals();
4396
+ }(), o = Te.generateOptionalSignals();
4391
4397
  (l = (a = e.connectSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
4392
4398
  onResponse: r
4393
4399
  }));
@@ -4407,7 +4413,7 @@ var Ce = /*#__PURE__*/function () {
4407
4413
  value: function attemptToFinaliseStream(e, t) {
4408
4414
  try {
4409
4415
  var i = t.messageElementRefs[t.messageElementRefs.length - 1];
4410
- Be.isLoadingMessage(i) ? t.removeLastMessage() : e.finaliseStreamedMessage();
4416
+ De.isLoadingMessage(i) ? t.removeLastMessage() : e.finaliseStreamedMessage();
4411
4417
  } catch (i) {
4412
4418
  console.error(i), t.addNewErrorMessage("service", i);
4413
4419
  }
@@ -4419,16 +4425,16 @@ var Ce = /*#__PURE__*/function () {
4419
4425
  var h, u;
4420
4426
  var s = !0,
4421
4427
  r = !1;
4422
- var o = new ge(i),
4428
+ var o = new be(i),
4423
4429
  a = function a() {
4424
4430
  r || !s || (e.streamHandlers.onOpen(), r = !0);
4425
4431
  },
4426
4432
  l = function l() {
4427
- s && (Ce.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1);
4433
+ s && (Te.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1);
4428
4434
  },
4429
4435
  c = /*#__PURE__*/function () {
4430
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(f) {
4431
- var p, y, m;
4436
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(f) {
4437
+ var p, v, m;
4432
4438
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
4433
4439
  while (1) switch (_context13.prev = _context13.next) {
4434
4440
  case 0:
@@ -4439,7 +4445,7 @@ var Ce = /*#__PURE__*/function () {
4439
4445
  return _context13.abrupt("return");
4440
4446
  case 2:
4441
4447
  _context13.next = 4;
4442
- return (y = (p = e.deepChat).responseInterceptor) == null ? void 0 : y.call(p, f);
4448
+ return (v = (p = e.deepChat).responseInterceptor) == null ? void 0 : v.call(p, f);
4443
4449
  case 4:
4444
4450
  _context13.t0 = _context13.sent;
4445
4451
  if (_context13.t0) {
@@ -4449,7 +4455,7 @@ var Ce = /*#__PURE__*/function () {
4449
4455
  _context13.t0 = f;
4450
4456
  case 7:
4451
4457
  m = _context13.t0;
4452
- v.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), s = !1) : A.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, m) : console.error(M.INVALID_RESPONSE(f, "server", !!e.deepChat.responseInterceptor, m));
4458
+ E.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), s = !1) : A.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, m) : console.error(M.INVALID_RESPONSE(f, "server", !!e.deepChat.responseInterceptor, m));
4453
4459
  case 9:
4454
4460
  case "end":
4455
4461
  return _context13.stop();
@@ -4457,13 +4463,13 @@ var Ce = /*#__PURE__*/function () {
4457
4463
  }, _callee13);
4458
4464
  }));
4459
4465
  return function c(_x25) {
4460
- return _ref5.apply(this, arguments);
4466
+ return _ref6.apply(this, arguments);
4461
4467
  };
4462
4468
  }();
4463
4469
  e.streamHandlers.abortStream.abort = function () {
4464
- Ce.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1;
4470
+ Te.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1;
4465
4471
  };
4466
- var d = Ce.generateOptionalSignals();
4472
+ var d = Te.generateOptionalSignals();
4467
4473
  (u = (h = e.connectSettings).handler) == null || u.call(h, t, _objectSpread(_objectSpread({}, d), {}, {
4468
4474
  onOpen: a,
4469
4475
  onResponse: c,
@@ -4492,7 +4498,7 @@ var Ce = /*#__PURE__*/function () {
4492
4498
  i.isOpen = !1;
4493
4499
  },
4494
4500
  o = /*#__PURE__*/function () {
4495
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(d) {
4501
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(d) {
4496
4502
  var u, f, h, m, p;
4497
4503
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
4498
4504
  while (1) switch (_context14.prev = _context14.next) {
@@ -4514,8 +4520,8 @@ var Ce = /*#__PURE__*/function () {
4514
4520
  _context14.t0 = d;
4515
4521
  case 7:
4516
4522
  h = _context14.t0;
4517
- if (!v.validateResponseFormat(h)) console.error(M.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message");else if (typeof h.error == "string") console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error);else if (A.isSimulation(e.stream)) {
4518
- m = U.stream.bind(_this7, e, t, i.roleToStream), p = i.roleToStream[d.role || b.AI_ROLE];
4523
+ if (!E.validateResponseFormat(h)) console.error(M.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message");else if (typeof h.error == "string") console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error);else if (A.isSimulation(e.stream)) {
4524
+ m = j.stream.bind(_this7, e, t, i.roleToStream), p = i.roleToStream[d.role || b.AI_ROLE];
4519
4525
  A.upsertWFiles(t, m, p, d);
4520
4526
  } else t.addNewMessage(h);
4521
4527
  case 9:
@@ -4525,10 +4531,10 @@ var Ce = /*#__PURE__*/function () {
4525
4531
  }, _callee14);
4526
4532
  }));
4527
4533
  return function o(_x26) {
4528
- return _ref6.apply(this, arguments);
4534
+ return _ref7.apply(this, arguments);
4529
4535
  };
4530
4536
  }(),
4531
- a = Ce.generateOptionalSignals();
4537
+ a = Te.generateOptionalSignals();
4532
4538
  (c = (l = e.connectSettings).handler) == null || c.call(l, void 0, _objectSpread(_objectSpread({}, a), {}, {
4533
4539
  onOpen: s,
4534
4540
  onResponse: o,
@@ -4566,7 +4572,7 @@ var T = /*#__PURE__*/function () {
4566
4572
  f,
4567
4573
  m,
4568
4574
  r,
4569
- _yield$v$processReque3,
4575
+ _yield$E$processReque3,
4570
4576
  o,
4571
4577
  a,
4572
4578
  l,
@@ -4583,40 +4589,40 @@ var T = /*#__PURE__*/function () {
4583
4589
  headers: (u = e.connectSettings) == null ? void 0 : u.headers
4584
4590
  };
4585
4591
  _context16.next = 4;
4586
- return v.processRequestInterceptor(e.deepChat, r);
4592
+ return E.processRequestInterceptor(e.deepChat, r);
4587
4593
  case 4:
4588
- _yield$v$processReque3 = _context16.sent;
4589
- o = _yield$v$processReque3.body;
4590
- a = _yield$v$processReque3.headers;
4591
- l = _yield$v$processReque3.error;
4594
+ _yield$E$processReque3 = _context16.sent;
4595
+ o = _yield$E$processReque3.body;
4596
+ a = _yield$E$processReque3.headers;
4597
+ l = _yield$E$processReque3.error;
4592
4598
  c = e.completionsHandlers.onFinish;
4593
4599
  if (!l) {
4594
4600
  _context16.next = 11;
4595
4601
  break;
4596
4602
  }
4597
- return _context16.abrupt("return", v.onInterceptorError(i, l, c));
4603
+ return _context16.abrupt("return", E.onInterceptorError(i, l, c));
4598
4604
  case 11:
4599
4605
  if (!((f = e.connectSettings) != null && f.handler)) {
4600
4606
  _context16.next = 13;
4601
4607
  break;
4602
4608
  }
4603
- return _context16.abrupt("return", Ce.request(e, o, i));
4609
+ return _context16.abrupt("return", Te.request(e, o, i));
4604
4610
  case 13:
4605
- if (!(((m = e.connectSettings) == null ? void 0 : m.url) === be.URL)) {
4611
+ if (!(((m = e.connectSettings) == null ? void 0 : m.url) === ve.URL)) {
4606
4612
  _context16.next = 15;
4607
4613
  break;
4608
4614
  }
4609
- return _context16.abrupt("return", be.request(e, i));
4615
+ return _context16.abrupt("return", ve.request(e, i));
4610
4616
  case 15:
4611
4617
  d = !0;
4612
- h = v.fetch.bind(this, e, a, s);
4618
+ h = E.fetch.bind(this, e, a, s);
4613
4619
  h(o).then(function (p) {
4614
4620
  return d = !!p.ok, p;
4615
4621
  }).then(function (p) {
4616
- return v.processResponseByType(p);
4622
+ return E.processResponseByType(p);
4617
4623
  }).then(/*#__PURE__*/function () {
4618
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(p) {
4619
- var j, G, y, x;
4624
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(p) {
4625
+ var P, G, v, y;
4620
4626
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
4621
4627
  while (1) switch (_context15.prev = _context15.next) {
4622
4628
  case 0:
@@ -4627,7 +4633,7 @@ var T = /*#__PURE__*/function () {
4627
4633
  return _context15.abrupt("return");
4628
4634
  case 2:
4629
4635
  _context15.next = 4;
4630
- return (G = (j = e.deepChat).responseInterceptor) == null ? void 0 : G.call(j, p);
4636
+ return (G = (P = e.deepChat).responseInterceptor) == null ? void 0 : G.call(P, p);
4631
4637
  case 4:
4632
4638
  _context15.t0 = _context15.sent;
4633
4639
  if (_context15.t0) {
@@ -4636,24 +4642,24 @@ var T = /*#__PURE__*/function () {
4636
4642
  }
4637
4643
  _context15.t0 = p;
4638
4644
  case 7:
4639
- y = _context15.t0;
4645
+ v = _context15.t0;
4640
4646
  _context15.next = 10;
4641
- return e.extractResultData(y, h, o);
4647
+ return e.extractResultData(v, h, o);
4642
4648
  case 10:
4643
- x = _context15.sent;
4649
+ y = _context15.sent;
4644
4650
  if (d) {
4645
4651
  _context15.next = 13;
4646
4652
  break;
4647
4653
  }
4648
4654
  throw p;
4649
4655
  case 13:
4650
- if (!(!x || _typeof(x) != "object")) {
4656
+ if (!(!y || _typeof(y) != "object")) {
4651
4657
  _context15.next = 15;
4652
4658
  break;
4653
4659
  }
4654
- throw Error(M.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, y));
4660
+ throw Error(M.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, v));
4655
4661
  case 15:
4656
- x.makingAnotherRequest || (A.isSimulatable(e.stream, x) ? A.simulate(i, e.streamHandlers, x) : (i.addNewMessage(x), c()));
4662
+ y.makingAnotherRequest || (A.isSimulatable(e.stream, y) ? A.simulate(i, e.streamHandlers, y) : (i.addNewMessage(y), c()));
4657
4663
  case 16:
4658
4664
  case "end":
4659
4665
  return _context15.stop();
@@ -4661,10 +4667,10 @@ var T = /*#__PURE__*/function () {
4661
4667
  }, _callee15);
4662
4668
  }));
4663
4669
  return function (_x30) {
4664
- return _ref7.apply(this, arguments);
4670
+ return _ref8.apply(this, arguments);
4665
4671
  };
4666
4672
  }())["catch"](function (p) {
4667
- v.displayError(i, p), c();
4673
+ E.displayError(i, p), c();
4668
4674
  });
4669
4675
  case 18:
4670
4676
  case "end":
@@ -4684,7 +4690,7 @@ var T = /*#__PURE__*/function () {
4684
4690
  fetch(t, i).then(function (o) {
4685
4691
  return o.json();
4686
4692
  }).then(/*#__PURE__*/function () {
4687
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(o) {
4693
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(o) {
4688
4694
  var l, c, a;
4689
4695
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
4690
4696
  while (1) switch (_context17.prev = _context17.next) {
@@ -4721,10 +4727,10 @@ var T = /*#__PURE__*/function () {
4721
4727
  }, _callee17);
4722
4728
  }));
4723
4729
  return function (_x31) {
4724
- return _ref8.apply(this, arguments);
4730
+ return _ref9.apply(this, arguments);
4725
4731
  };
4726
4732
  }())["catch"](function (o) {
4727
- v.displayError(s, o), r();
4733
+ E.displayError(s, o), r();
4728
4734
  });
4729
4735
  }
4730
4736
  // prettier-ignore
@@ -4737,7 +4743,7 @@ var T = /*#__PURE__*/function () {
4737
4743
  m,
4738
4744
  p,
4739
4745
  r,
4740
- _yield$v$processReque4,
4746
+ _yield$E$processReque4,
4741
4747
  o,
4742
4748
  a,
4743
4749
  l,
@@ -4755,17 +4761,17 @@ var T = /*#__PURE__*/function () {
4755
4761
  headers: (f = e.connectSettings) == null ? void 0 : f.headers
4756
4762
  };
4757
4763
  _context18.next = 4;
4758
- return v.processRequestInterceptor(e.deepChat, r);
4764
+ return E.processRequestInterceptor(e.deepChat, r);
4759
4765
  case 4:
4760
- _yield$v$processReque4 = _context18.sent;
4761
- o = _yield$v$processReque4.body;
4762
- a = _yield$v$processReque4.headers;
4763
- l = _yield$v$processReque4.error;
4766
+ _yield$E$processReque4 = _context18.sent;
4767
+ o = _yield$E$processReque4.body;
4768
+ a = _yield$E$processReque4.headers;
4769
+ l = _yield$E$processReque4.error;
4764
4770
  if (!l) {
4765
4771
  _context18.next = 10;
4766
4772
  break;
4767
4773
  }
4768
- return _context18.abrupt("return", v.onInterceptorError(i, l));
4774
+ return _context18.abrupt("return", E.onInterceptorError(i, l));
4769
4775
  case 10:
4770
4776
  c = ((m = e.connectSettings) == null ? void 0 : m.url) || e.url || "", d = ((p = e.connectSettings) == null ? void 0 : p.method) || "POST", h = s ? JSON.stringify(o) : o, u = {
4771
4777
  method: d,
@@ -4793,7 +4799,7 @@ var T = /*#__PURE__*/function () {
4793
4799
  headers: i,
4794
4800
  body: c || null
4795
4801
  }).then(function (d) {
4796
- return v.processResponseByType(d);
4802
+ return E.processResponseByType(d);
4797
4803
  }).then(function (d) {
4798
4804
  l(d, e, r, o);
4799
4805
  })["catch"](function (d) {
@@ -4816,7 +4822,7 @@ var pt = /*#__PURE__*/function () {
4816
4822
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
4817
4823
  while (1) switch (_context19.prev = _context19.next) {
4818
4824
  case 0:
4819
- t = Qe.addMessage(this._messages);
4825
+ t = Ye.addMessage(this._messages);
4820
4826
  _context19.next = 3;
4821
4827
  return e();
4822
4828
  case 3:
@@ -4841,21 +4847,31 @@ var pt = /*#__PURE__*/function () {
4841
4847
  key: "processLoadedHistory",
4842
4848
  value: function processLoadedHistory(e) {
4843
4849
  var _this9 = this;
4844
- var s;
4845
- var t = (s = this._messages.messageElementRefs[0]) == null ? void 0 : s.outerContainer,
4846
- i = this._messages.elementRef.scrollTop;
4847
- e == null || e.reverse().map(function (r) {
4848
- if (r) {
4849
- var o = _this9._messages.addAnyMessage(_objectSpread(_objectSpread({}, r), {}, {
4850
+ var c;
4851
+ var _this$_messages = this._messages,
4852
+ t = _this$_messages.messageElementRefs,
4853
+ i = _this$_messages.messageToElements,
4854
+ s = _this$_messages.elementRef,
4855
+ r = _this$_messages.addAnyMessage,
4856
+ o = _this$_messages.sendClientUpdate,
4857
+ a = (c = t[0]) == null ? void 0 : c.outerContainer,
4858
+ l = s.scrollTop;
4859
+ e == null || e.reverse().map(function (d) {
4860
+ if (d) {
4861
+ var h = r(_objectSpread(_objectSpread({}, d), {}, {
4850
4862
  sendUpdate: !0
4851
4863
  }), !0, !0);
4852
- return o && _this9._messages.messages.unshift(o), o;
4864
+ if (h) {
4865
+ var u = b.getNumberOfElements(h);
4866
+ i.unshift([h, t.slice(0, u)]);
4867
+ }
4868
+ return h;
4853
4869
  } else _this9._isPaginationComplete = !0;
4854
- }).filter(function (r) {
4855
- return !!r;
4856
- }).reverse().forEach(function (r) {
4857
- return _this9._messages.sendClientUpdate(r, !0);
4858
- }), t && (this._messages.elementRef.scrollTop = i + t.offsetTop);
4870
+ }).filter(function (d) {
4871
+ return !!d;
4872
+ }).reverse().forEach(function (d) {
4873
+ return o(d, !0);
4874
+ }), a && (s.scrollTop = l + a.offsetTop);
4859
4875
  }
4860
4876
  }, {
4861
4877
  key: "setupLoadHistoryOnScroll",
@@ -4875,7 +4891,7 @@ var pt = /*#__PURE__*/function () {
4875
4891
  break;
4876
4892
  }
4877
4893
  _this10._isLoading = !0;
4878
- t = Qe.addMessage(_this10._messages, !1);
4894
+ t = Ye.addMessage(_this10._messages, !1);
4879
4895
  _context20.prev = 3;
4880
4896
  _context20.next = 6;
4881
4897
  return e(_this10._index++);
@@ -4923,7 +4939,7 @@ var pt = /*#__PURE__*/function () {
4923
4939
  while (1) switch (_context22.prev = _context22.next) {
4924
4940
  case 0:
4925
4941
  this._isLoading = !0;
4926
- t = Qe.addMessage(this._messages);
4942
+ t = Ye.addMessage(this._messages);
4927
4943
  _context22.prev = 2;
4928
4944
  _context22.next = 5;
4929
4945
  return e(this._index++);
@@ -5015,7 +5031,6 @@ var St = /*#__PURE__*/function () {
5015
5031
  value: function getMaxMessages(e, t) {
5016
5032
  return e.slice(Math.max(e.length - t, 0));
5017
5033
  }
5018
- // prettier-ignore
5019
5034
  // if maxMessages is not defined we send all messages
5020
5035
  // if maxMessages above 0 we send that number
5021
5036
  // if maxMessages 0 or below we send only what is in the request
@@ -5026,11 +5041,11 @@ var St = /*#__PURE__*/function () {
5026
5041
  }
5027
5042
  }]);
5028
5043
  }();
5029
- var P = /*#__PURE__*/function () {
5030
- function P() {
5031
- _classCallCheck(this, P);
5044
+ var O = /*#__PURE__*/function () {
5045
+ function O() {
5046
+ _classCallCheck(this, O);
5032
5047
  }
5033
- return _createClass(P, null, [{
5048
+ return _createClass(O, null, [{
5034
5049
  key: "parseConfig",
5035
5050
  value:
5036
5051
  // prettier-ignore
@@ -5060,7 +5075,7 @@ var P = /*#__PURE__*/function () {
5060
5075
  var s = {
5061
5076
  acceptedFormats: ""
5062
5077
  };
5063
- e.fileTypes.mixedFiles = P.parseConfig(e.connectSettings, s, t, i);
5078
+ e.fileTypes.mixedFiles = O.parseConfig(e.connectSettings, s, t, i);
5064
5079
  }
5065
5080
  }
5066
5081
  // needs to be set after audio to overwrite maxNumberOfFiles
@@ -5073,7 +5088,7 @@ var P = /*#__PURE__*/function () {
5073
5088
  var o = _objectSpread({
5074
5089
  acceptedFormats: "audio/*"
5075
5090
  }, ((a = e.fileTypes.audio) == null ? void 0 : a.files) || {});
5076
- i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = P.parseConfig(e.connectSettings, o, t, i), _typeof(i) == "object" && i.files && ((_l$files = (l = e.recordAudio).files) !== null && _l$files !== void 0 ? _l$files : l.files = {}, e.recordAudio.files.format = (c = i.files) == null ? void 0 : c.format, e.recordAudio.files.maxDurationSeconds = (d = i.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_u$maxNumberOfFiles = (u = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _u$maxNumberOfFiles !== void 0 ? _u$maxNumberOfFiles : u.maxNumberOfFiles = i.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = P.parseConfig(e.connectSettings, o, t, i)));
5091
+ i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = O.parseConfig(e.connectSettings, o, t, i), _typeof(i) == "object" && i.files && ((_l$files = (l = e.recordAudio).files) !== null && _l$files !== void 0 ? _l$files : l.files = {}, e.recordAudio.files.format = (c = i.files) == null ? void 0 : c.format, e.recordAudio.files.maxDurationSeconds = (d = i.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_u$maxNumberOfFiles = (u = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _u$maxNumberOfFiles !== void 0 ? _u$maxNumberOfFiles : u.maxNumberOfFiles = i.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = O.parseConfig(e.connectSettings, o, t, i)));
5077
5092
  }
5078
5093
  // prettier-ignore
5079
5094
  }, {
@@ -5083,7 +5098,7 @@ var P = /*#__PURE__*/function () {
5083
5098
  var o = _objectSpread({
5084
5099
  acceptedFormats: "audio/*"
5085
5100
  }, (s == null ? void 0 : s.files) || {});
5086
- e.fileTypes.audio = P.parseConfig(e.connectSettings, o, t, i);
5101
+ e.fileTypes.audio = O.parseConfig(e.connectSettings, o, t, i);
5087
5102
  }
5088
5103
  // prettier-ignore
5089
5104
  }, {
@@ -5093,7 +5108,7 @@ var P = /*#__PURE__*/function () {
5093
5108
  var o = _objectSpread({
5094
5109
  acceptedFormats: "image/gif"
5095
5110
  }, (s == null ? void 0 : s.files) || {});
5096
- e.fileTypes.gifs = P.parseConfig(e.connectSettings, o, t, i);
5111
+ e.fileTypes.gifs = O.parseConfig(e.connectSettings, o, t, i);
5097
5112
  }
5098
5113
  // needs to be set after images to overwrite maxNumberOfFiles
5099
5114
  // prettier-ignore
@@ -5105,7 +5120,7 @@ var P = /*#__PURE__*/function () {
5105
5120
  var o = _objectSpread({
5106
5121
  acceptedFormats: "image/*"
5107
5122
  }, ((a = e.fileTypes.images) == null ? void 0 : a.files) || {});
5108
- i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.camera = P.parseConfig(e.connectSettings, o, t, i), _typeof(i) == "object" && (e.camera.modalContainerStyle = i.modalContainerStyle, i.files && ((_l$files2 = (l = e.camera).files) !== null && _l$files2 !== void 0 ? _l$files2 : l.files = {}, e.camera.files.format = (c = i.files) == null ? void 0 : c.format, e.camera.files.dimensions = (d = i.files) == null ? void 0 : d.dimensions))) : s || (e.fileTypes.images = P.parseConfig(e.connectSettings, o, t, i)));
5123
+ i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.camera = O.parseConfig(e.connectSettings, o, t, i), _typeof(i) == "object" && (e.camera.modalContainerStyle = i.modalContainerStyle, i.files && ((_l$files2 = (l = e.camera).files) !== null && _l$files2 !== void 0 ? _l$files2 : l.files = {}, e.camera.files.format = (c = i.files) == null ? void 0 : c.format, e.camera.files.dimensions = (d = i.files) == null ? void 0 : d.dimensions))) : s || (e.fileTypes.images = O.parseConfig(e.connectSettings, o, t, i)));
5109
5124
  }
5110
5125
  // prettier-ignore
5111
5126
  }, {
@@ -5115,7 +5130,7 @@ var P = /*#__PURE__*/function () {
5115
5130
  var o = _objectSpread({
5116
5131
  acceptedFormats: "image/*"
5117
5132
  }, (s == null ? void 0 : s.files) || {});
5118
- e.fileTypes.images = P.parseConfig(e.connectSettings, o, t, i);
5133
+ e.fileTypes.images = O.parseConfig(e.connectSettings, o, t, i);
5119
5134
  }
5120
5135
  // default for direct service
5121
5136
  }, {
@@ -5128,20 +5143,20 @@ var P = /*#__PURE__*/function () {
5128
5143
  }, {
5129
5144
  key: "set",
5130
5145
  value: function set(e, t, i) {
5131
- P.populateDefaultFileIO(i == null ? void 0 : i.audio, ".4a,.mp3,.webm,.mp4,.mpga,.wav,.mpeg,.m4a"), P.populateDefaultFileIO(i == null ? void 0 : i.images, ".png,.jpg");
5146
+ O.populateDefaultFileIO(i == null ? void 0 : i.audio, ".4a,.mp3,.webm,.mp4,.mpga,.wav,.mpeg,.m4a"), O.populateDefaultFileIO(i == null ? void 0 : i.images, ".png,.jpg");
5132
5147
  var s = jt.createNew();
5133
- P.processImagesConfig(t, s, e.images, i == null ? void 0 : i.images), P.processCamera(t, s, e.camera, e.images), P.processGifConfig(t, s, e.gifs, i == null ? void 0 : i.gifs), P.processAudioConfig(t, s, e.audio, i == null ? void 0 : i.audio), P.processMicrophone(t, s, e.microphone, e.audio), P.processMixedFiles(t, s, e.mixedFiles);
5148
+ O.processImagesConfig(t, s, e.images, i == null ? void 0 : i.images), O.processCamera(t, s, e.camera, e.images), O.processGifConfig(t, s, e.gifs, i == null ? void 0 : i.gifs), O.processAudioConfig(t, s, e.audio, i == null ? void 0 : i.audio), O.processMicrophone(t, s, e.microphone, e.audio), O.processMixedFiles(t, s, e.mixedFiles);
5134
5149
  }
5135
5150
  }]);
5136
5151
  }();
5137
- var it = /*#__PURE__*/function () {
5138
- function it(e, t, i) {
5152
+ var tt = /*#__PURE__*/function () {
5153
+ function tt(e, t, i) {
5139
5154
  var _a$url;
5140
- _classCallCheck(this, it);
5155
+ _classCallCheck(this, tt);
5141
5156
  var s, r, o, a, l;
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);
5157
+ this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = tt.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, O.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 = ve.URL), this.connectSettings.websocket && j.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || le.checkForStream(this.deepChat), e.loadHistory && Ht.addErrorPrefix(this);
5143
5158
  }
5144
- return _createClass(it, [{
5159
+ return _createClass(tt, [{
5145
5160
  key: "verifyKey",
5146
5161
  value: function verifyKey(e, t) {}
5147
5162
  }, {
@@ -5214,7 +5229,7 @@ var it = /*#__PURE__*/function () {
5214
5229
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
5215
5230
  while (1) switch (_context26.prev = _context26.next) {
5216
5231
  case 0:
5217
- s = it.createCustomFormDataBody(this.rawBody, t, i), r = this.connectSettings, o = this.getServiceIOByType(i[0]);
5232
+ s = tt.createCustomFormDataBody(this.rawBody, t, i), r = this.connectSettings, o = this.getServiceIOByType(i[0]);
5218
5233
  this.connectSettings = (o == null ? void 0 : o.connect) || this.connectSettings;
5219
5234
  _context26.next = 4;
5220
5235
  return this.request(s, e, !1);
@@ -5264,12 +5279,16 @@ var it = /*#__PURE__*/function () {
5264
5279
  }
5265
5280
  throw new Error("Request settings have not been set up");
5266
5281
  case 2:
5267
- i = St.processMessages(t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
5282
+ i = St.processMessages(t.messageToElements.map(function (_ref11) {
5283
+ var _ref12 = _slicedToArray(_ref11, 1),
5284
+ s = _ref12[0];
5285
+ return s;
5286
+ }), this.maxMessages, this.totalMessagesMaxCharLength);
5268
5287
  if (this.connectSettings.websocket) {
5269
5288
  s = _objectSpread({
5270
5289
  messages: i
5271
5290
  }, this.rawBody);
5272
- U.sendWebsocket(this, s, t, !1);
5291
+ j.sendWebsocket(this, s, t, !1);
5273
5292
  } else this.callServiceAPI(t, i, e.files);
5274
5293
  case 4:
5275
5294
  case "end":
@@ -5301,7 +5320,7 @@ var it = /*#__PURE__*/function () {
5301
5320
  }
5302
5321
  return _context29.abrupt("return", le.handleResponseProperty(e));
5303
5322
  case 4:
5304
- if (!v.validateResponseFormat(e)) {
5323
+ if (!E.validateResponseFormat(e)) {
5305
5324
  _context29.next = 6;
5306
5325
  break;
5307
5326
  }
@@ -5350,7 +5369,7 @@ var it = /*#__PURE__*/function () {
5350
5369
  }
5351
5370
  }]);
5352
5371
  }();
5353
- var z = /*#__PURE__*/function (_it) {
5372
+ var z = /*#__PURE__*/function (_tt) {
5354
5373
  // prettier-ignore
5355
5374
  function z(e, t, i, s, r) {
5356
5375
  var _this13;
@@ -5359,7 +5378,7 @@ var z = /*#__PURE__*/function (_it) {
5359
5378
  _this13 = _callSuper(this, z, [e, r]), _this13.insertKeyPlaceholderText = "API Key", _this13.keyHelpUrl = "", Object.assign(_this13.rawBody, (o = e.connect) == null ? void 0 : o.additionalBodyProps), _this13.keyVerificationDetails = t, _this13.buildHeadersFunc = i, s && _this13.setApiKeyProperties(s), _this13.connectSettings = _this13.buildConnectSettings(_this13.key || "", e.connect);
5360
5379
  return _this13;
5361
5380
  }
5362
- _inherits(z, _it);
5381
+ _inherits(z, _tt);
5363
5382
  return _createClass(z, [{
5364
5383
  key: "setApiKeyProperties",
5365
5384
  value: function setApiKeyProperties(e) {
@@ -5396,7 +5415,7 @@ var z = /*#__PURE__*/function (_it) {
5396
5415
  return !0;
5397
5416
  }
5398
5417
  }]);
5399
- }(it);
5418
+ }(tt);
5400
5419
  var ui = /*#__PURE__*/function () {
5401
5420
  function ui() {
5402
5421
  _classCallCheck(this, ui);
@@ -5415,19 +5434,19 @@ var ui = /*#__PURE__*/function () {
5415
5434
  }
5416
5435
  }]);
5417
5436
  }();
5418
- var _e = /*#__PURE__*/function (_HTMLElement) {
5437
+ var Se = /*#__PURE__*/function (_HTMLElement) {
5419
5438
  // If this is not working, try using propertyName directly
5420
- function _e() {
5439
+ function Se() {
5421
5440
  var _this14;
5422
- _classCallCheck(this, _e);
5423
- _this14 = _callSuper(this, _e), _this14._waitingToRender_ = !1, _this14._propUpdated_ = !1, Object.keys(_e._attributeToProperty_).forEach(function (e) {
5424
- var t = _e._attributeToProperty_[e];
5441
+ _classCallCheck(this, Se);
5442
+ _this14 = _callSuper(this, Se), _this14._waitingToRender_ = !1, _this14._propUpdated_ = !1, Object.keys(Se._attributeToProperty_).forEach(function (e) {
5443
+ var t = Se._attributeToProperty_[e];
5425
5444
  _this14.constructPropertyAccessors(t), _this14.hasOwnProperty(e) || _this14.constructPropertyAccessors(t, e);
5426
5445
  });
5427
5446
  return _this14;
5428
5447
  }
5429
- _inherits(_e, _HTMLElement);
5430
- return _createClass(_e, [{
5448
+ _inherits(Se, _HTMLElement);
5449
+ return _createClass(Se, [{
5431
5450
  key: "constructPropertyAccessors",
5432
5451
  value:
5433
5452
  // need to be called here as accessors need to be set for the class instance
@@ -5446,8 +5465,8 @@ var _e = /*#__PURE__*/function (_HTMLElement) {
5446
5465
  key: "attributeChangedCallback",
5447
5466
  value: function attributeChangedCallback(e, t, i) {
5448
5467
  if (t === i) return;
5449
- var s = _e._attributes_[e](i),
5450
- r = _e._attributeToProperty_[e];
5468
+ var s = Se._attributes_[e](i),
5469
+ r = Se._attributeToProperty_[e];
5451
5470
  this[r] = s;
5452
5471
  }
5453
5472
  }, {
@@ -5456,12 +5475,12 @@ var _e = /*#__PURE__*/function (_HTMLElement) {
5456
5475
  }], [{
5457
5476
  key: "observedAttributes",
5458
5477
  get: function get() {
5459
- return Object.keys(_e._attributes_) || [];
5478
+ return Object.keys(Se._attributes_) || [];
5460
5479
  }
5461
5480
  }]);
5462
5481
  }(/*#__PURE__*/_wrapNativeSuper(HTMLElement));
5463
- _e._attributes_ = {}, _e._attributeToProperty_ = {};
5464
- var ls = _e;
5482
+ Se._attributes_ = {}, Se._attributeToProperty_ = {};
5483
+ var ls = Se;
5465
5484
  var Co = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path d=\"\n\t\t\tM669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536\n\t\t\tc-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764\n\t\t\tc59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033\n\t\t\tl-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888\n\t\t\tc0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541\n\t\t\tc103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174\n\t\t\tc31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763\n\t\t\tc-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z\n\t\t\tM599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897\n\t\t\tc0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854\n\t\t\tc-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513\n\t\t\tL638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z\"\n\t\t\t/>\n</svg>\n",
5466
5485
  Ao = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path id=\"path6686\" inkscape:connector-curvature=\"0\" d=\"M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612\n\t\t\tc-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612\n\t\t\tC699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.904,73.557\n\t\t\tc-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763\n\t\t\tc59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557\n\t\t\tc103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179\n\t\t\tc31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764\n\t\t\tc-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769\n\t\t\tc156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02\n\t\t\tC317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z\"/>\n</svg>\n";
5467
5486
  var ie = /*#__PURE__*/function () {
@@ -5475,16 +5494,16 @@ var ie = /*#__PURE__*/function () {
5475
5494
  }
5476
5495
  }]);
5477
5496
  }();
5478
- var Ne = /*#__PURE__*/function () {
5479
- function Ne() {
5480
- _classCallCheck(this, Ne);
5497
+ var Pe = /*#__PURE__*/function () {
5498
+ function Pe() {
5499
+ _classCallCheck(this, Pe);
5481
5500
  }
5482
- return _createClass(Ne, null, [{
5501
+ return _createClass(Pe, null, [{
5483
5502
  key: "changeVisibility",
5484
5503
  value:
5485
5504
  // prettier-ignore
5486
5505
  function changeVisibility(e, t, i, s) {
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");
5506
+ s.target.id === Pe.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");
5488
5507
  }
5489
5508
  }, {
5490
5509
  key: "createIconElement",
@@ -5498,15 +5517,15 @@ var Ne = /*#__PURE__*/function () {
5498
5517
  value: function create(e) {
5499
5518
  var t = document.createElement("div");
5500
5519
  t.id = "visibility-icon-container";
5501
- var i = Ne.createIconElement(Ao, Ne.VISIBLE_ICON_ID);
5520
+ var i = Pe.createIconElement(Ao, Pe.VISIBLE_ICON_ID);
5502
5521
  i.style.display = "none", t.appendChild(i);
5503
- var s = Ne.createIconElement(Co, "not-visible-icon");
5504
- return t.appendChild(s), t.onclick = Ne.changeVisibility.bind(this, e, i, s), t;
5522
+ var s = Pe.createIconElement(Co, "not-visible-icon");
5523
+ return t.appendChild(s), t.onclick = Pe.changeVisibility.bind(this, e, i, s), t;
5505
5524
  }
5506
5525
  }]);
5507
5526
  }();
5508
- Ne.VISIBLE_ICON_ID = "visible-icon";
5509
- var cs = Ne;
5527
+ Pe.VISIBLE_ICON_ID = "visible-icon";
5528
+ var cs = Pe;
5510
5529
  var H = /*#__PURE__*/function () {
5511
5530
  function H() {
5512
5531
  _classCallCheck(this, H);
@@ -5579,7 +5598,7 @@ var H = /*#__PURE__*/function () {
5579
5598
  },
5580
5599
  a = H.verifyKey.bind(this, e, o, r);
5581
5600
  t.onclick = a, e.onkeydown = function (l) {
5582
- !e.classList.contains("loading") && l.key === O.ENTER && a();
5601
+ !e.classList.contains("loading") && l.key === N.ENTER && a();
5583
5602
  };
5584
5603
  }
5585
5604
  }, {
@@ -5826,7 +5845,7 @@ var Ks = {
5826
5845
  }],
5827
5846
  use_web_worker: !0
5828
5847
  },
5829
- w = /*#__PURE__*/function (_it2) {
5848
+ w = /*#__PURE__*/function (_tt2) {
5830
5849
  function w(e) {
5831
5850
  var _this15;
5832
5851
  _classCallCheck(this, w);
@@ -5835,7 +5854,7 @@ var Ks = {
5835
5854
  return _this15;
5836
5855
  }
5837
5856
  // need ref of messages object as web model exhibits unique behaviour to manipulate chat
5838
- _inherits(w, _it2);
5857
+ _inherits(w, _tt2);
5839
5858
  return _createClass(w, [{
5840
5859
  key: "setUpMessages",
5841
5860
  value: function setUpMessages(e) {
@@ -6115,10 +6134,10 @@ var Ks = {
6115
6134
  this.streamHandlers.abortStream.abort = function () {
6116
6135
  i.interruptGenerate();
6117
6136
  }, this.streamHandlers.onOpen();
6118
- s = new ge(e);
6137
+ s = new be(e);
6119
6138
  _context36.next = 4;
6120
6139
  return i.generate(t, /*#__PURE__*/function () {
6121
- var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(r, o) {
6140
+ var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(r, o) {
6122
6141
  var a;
6123
6142
  return _regeneratorRuntime().wrap(function _callee35$(_context35) {
6124
6143
  while (1) switch (_context35.prev = _context35.next) {
@@ -6140,7 +6159,7 @@ var Ks = {
6140
6159
  }, _callee35);
6141
6160
  }));
6142
6161
  return function (_x63, _x64) {
6143
- return _ref10.apply(this, arguments);
6162
+ return _ref13.apply(this, arguments);
6144
6163
  };
6145
6164
  }());
6146
6165
  case 4:
@@ -6200,30 +6219,30 @@ var Ks = {
6200
6219
  key: "generateResp",
6201
6220
  value: function () {
6202
6221
  var _generateResp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t, i) {
6203
- var s, _yield$v$processReque5, r, o, a, l, c;
6222
+ var s, _yield$E$processReque5, r, o, a, l, c;
6204
6223
  return _regeneratorRuntime().wrap(function _callee38$(_context38) {
6205
6224
  while (1) switch (_context38.prev = _context38.next) {
6206
6225
  case 0:
6207
6226
  s = t[t.length - 1].text;
6208
6227
  _context38.next = 3;
6209
- return v.processRequestInterceptor(this.deepChat, {
6228
+ return E.processRequestInterceptor(this.deepChat, {
6210
6229
  body: {
6211
6230
  text: s
6212
6231
  }
6213
6232
  });
6214
6233
  case 3:
6215
- _yield$v$processReque5 = _context38.sent;
6216
- r = _yield$v$processReque5.body;
6217
- o = _yield$v$processReque5.error;
6234
+ _yield$E$processReque5 = _context38.sent;
6235
+ r = _yield$E$processReque5.body;
6236
+ o = _yield$E$processReque5.error;
6218
6237
  a = !!this.stream;
6219
6238
  try {
6220
- if (o) v.displayError(e, new Error(o)), (a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish)();else if (!r || !r.text) {
6239
+ if (o) E.displayError(e, new Error(o)), (a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish)();else if (!r || !r.text) {
6221
6240
  l = M.INVALID_MODEL_REQUEST({
6222
6241
  body: r
6223
6242
  }, !1);
6224
6243
  console.error(l);
6225
6244
  c = a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish;
6226
- v.onInterceptorError(e, l, c);
6245
+ E.onInterceptorError(e, l, c);
6227
6246
  } else this.generateRespByType(e, r.text, !!this.stream, i);
6228
6247
  } catch (l) {
6229
6248
  this.unloadChat(l);
@@ -6318,7 +6337,7 @@ var Ks = {
6318
6337
  _context40.next = 11;
6319
6338
  break;
6320
6339
  }
6321
- v.displayError(t, new Error(s.error));
6340
+ E.displayError(t, new Error(s.error));
6322
6341
  return _context40.abrupt("return");
6323
6342
  case 11:
6324
6343
  if (!(!s || !s.text)) {
@@ -6326,7 +6345,7 @@ var Ks = {
6326
6345
  break;
6327
6346
  }
6328
6347
  o = M.INVALID_MODEL_RESPONSE(i, !!e.responseInterceptor, s);
6329
- v.displayError(t, new Error(o));
6348
+ E.displayError(t, new Error(o));
6330
6349
  return _context40.abrupt("return");
6331
6350
  case 15:
6332
6351
  return _context40.abrupt("return", s);
@@ -6358,7 +6377,7 @@ var Ks = {
6358
6377
  });
6359
6378
  }
6360
6379
  }]);
6361
- }(it);
6380
+ }(tt);
6362
6381
  w.GENERIC_ERROR = "Error, please check the [troubleshooting](https://deepchat.dev/docs/webModel#troubleshooting) section of documentation for help.", w.MULTIPLE_MODELS_ERROR = "Cannot run multiple web models", w.WEB_LLM_NOT_FOUND_ERROR = "WebLLM module not found", w.DEFAULT_MODEL = "Llama-2-7b-chat-hf-q4f32_1", w.MODULE_SEARCH_LIMIT_S = 5;
6363
6382
  var qt = w;
6364
6383
  var pi = /*#__PURE__*/function () {
@@ -6442,8 +6461,8 @@ var Nt = /*#__PURE__*/function (_z) {
6442
6461
  }]);
6443
6462
  }(z);
6444
6463
  Nt.URL_PREFIX = "https://api-inference.huggingface.co/models/";
6445
- var Le = Nt;
6446
- var Jt = /*#__PURE__*/function (_Le) {
6464
+ var Re = Nt;
6465
+ var Jt = /*#__PURE__*/function (_Re) {
6447
6466
  // prettier-ignore
6448
6467
  function Jt(e, t, i, s, r, o) {
6449
6468
  var _this22;
@@ -6451,7 +6470,7 @@ var Jt = /*#__PURE__*/function (_Le) {
6451
6470
  _this22 = _callSuper(this, Jt, [e, t, i, s, r, o]), _this22.isTextInputDisabled = !0, _this22.canSendMessage = Jt.canSendFile;
6452
6471
  return _this22;
6453
6472
  }
6454
- _inherits(Jt, _Le);
6473
+ _inherits(Jt, _Re);
6455
6474
  return _createClass(Jt, [{
6456
6475
  key: "preprocessBody",
6457
6476
  value: function preprocessBody(e, t, i) {
@@ -6495,7 +6514,7 @@ var Jt = /*#__PURE__*/function (_Le) {
6495
6514
  return !!(t != null && t[0]);
6496
6515
  }
6497
6516
  }]);
6498
- }(Le);
6517
+ }(Re);
6499
6518
  var ko = /*#__PURE__*/function (_Jt) {
6500
6519
  // prettier-ignore
6501
6520
  function ko(e) {
@@ -6596,11 +6615,11 @@ var Mo = /*#__PURE__*/function (_Jt2) {
6596
6615
  }]);
6597
6616
  }(Jt);
6598
6617
  var Zt = "data:image/png;base64,";
6599
- var ve = /*#__PURE__*/function () {
6600
- function ve() {
6601
- _classCallCheck(this, ve);
6618
+ var ye = /*#__PURE__*/function () {
6619
+ function ye() {
6620
+ _classCallCheck(this, ye);
6602
6621
  }
6603
- return _createClass(ve, null, [{
6622
+ return _createClass(ye, null, [{
6604
6623
  key: "buildHeaders",
6605
6624
  value: function buildHeaders(e) {
6606
6625
  return {
@@ -6620,7 +6639,7 @@ var ve = /*#__PURE__*/function () {
6620
6639
  return {
6621
6640
  url: "https://api.stability.ai/v1/engines/list",
6622
6641
  method: "GET",
6623
- handleVerificationResult: ve.handleVerificationResult
6642
+ handleVerificationResult: ye.handleVerificationResult
6624
6643
  };
6625
6644
  }
6626
6645
  }]);
@@ -6651,7 +6670,7 @@ var mi = /*#__PURE__*/function (_Oi) {
6651
6670
  }
6652
6671
  }
6653
6672
  };
6654
- _this24 = _callSuper(this, mi, [e, ve.buildKeyVerificationDetails(), ve.buildHeaders, i, s]), _this24.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this24.textInputPlaceholderText = "Describe image changes", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Upscale</b></div>\n <p>Upload an image to generate a new one with higher resolution.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
6673
+ _this24 = _callSuper(this, mi, [e, ye.buildKeyVerificationDetails(), ye.buildHeaders, i, s]), _this24.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this24.textInputPlaceholderText = "Describe image changes", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Upscale</b></div>\n <p>Upload an image to generate a new one with higher resolution.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
6655
6674
  var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
6656
6675
  _typeof(r) == "object" && (r.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), mi.cleanConfig(r), Object.assign(_this24.rawBody, r)), _this24.canSendMessage = mi.canSendFileMessage;
6657
6676
  return _this24;
@@ -6687,7 +6706,7 @@ var mi = /*#__PURE__*/function (_Oi) {
6687
6706
  throw new Error("Image was not found");
6688
6707
  case 4:
6689
6708
  s = this.createFormDataBody(this.rawBody, i[0]);
6690
- v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
6709
+ E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
6691
6710
  case 6:
6692
6711
  case "end":
6693
6712
  return _context45.stop();
@@ -6758,7 +6777,7 @@ var gi = /*#__PURE__*/function (_Oi2) {
6758
6777
  }
6759
6778
  }
6760
6779
  };
6761
- _this25 = _callSuper(this, gi, [e, ve.buildKeyVerificationDetails(), ve.buildHeaders, i, s]), _this25.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this25._maskSource = "MASK_IMAGE_WHITE", _this25.textInputPlaceholderText = "Describe image changes", _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Masking</b></div>\n <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
6780
+ _this25 = _callSuper(this, gi, [e, ye.buildKeyVerificationDetails(), ye.buildHeaders, i, s]), _this25.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this25._maskSource = "MASK_IMAGE_WHITE", _this25.textInputPlaceholderText = "Describe image changes", _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Masking</b></div>\n <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
6762
6781
  var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
6763
6782
  _typeof(r) == "object" && (r.engine_id && (_this25.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this25._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this25._maskSource = r.mask_source), gi.cleanConfig(r), Object.assign(_this25.rawBody, r)), _this25.canSendMessage = gi.canSendFileTextMessage;
6764
6783
  return _this25;
@@ -6794,7 +6813,7 @@ var gi = /*#__PURE__*/function (_Oi2) {
6794
6813
  throw new Error("Image was not found");
6795
6814
  case 4:
6796
6815
  s = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], i[1], s);
6797
- v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
6816
+ E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
6798
6817
  case 6:
6799
6818
  case "end":
6800
6819
  return _context47.stop();
@@ -6898,7 +6917,7 @@ var Ro = /*#__PURE__*/function (_Jt3) {
6898
6917
  }()
6899
6918
  }]);
6900
6919
  }(Jt);
6901
- var Io = /*#__PURE__*/function (_Le2) {
6920
+ var Io = /*#__PURE__*/function (_Re2) {
6902
6921
  function Io(e) {
6903
6922
  _classCallCheck(this, Io);
6904
6923
  var s, r, o;
@@ -6906,7 +6925,7 @@ var Io = /*#__PURE__*/function (_Le2) {
6906
6925
  i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
6907
6926
  return _callSuper(this, Io, [e, "Once upon a time", "gpt2", t, i]);
6908
6927
  }
6909
- _inherits(Io, _Le2);
6928
+ _inherits(Io, _Re2);
6910
6929
  return _createClass(Io, [{
6911
6930
  key: "extractResultData",
6912
6931
  value: function () {
@@ -6936,8 +6955,8 @@ var Io = /*#__PURE__*/function (_Le2) {
6936
6955
  return extractResultData;
6937
6956
  }()
6938
6957
  }]);
6939
- }(Le);
6940
- var Lo = /*#__PURE__*/function (_Le3) {
6958
+ }(Re);
6959
+ var Lo = /*#__PURE__*/function (_Re3) {
6941
6960
  function Lo(e) {
6942
6961
  var _this26;
6943
6962
  _classCallCheck(this, Lo);
@@ -6947,7 +6966,7 @@ var Lo = /*#__PURE__*/function (_Le3) {
6947
6966
  _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;
6948
6967
  return _this26;
6949
6968
  }
6950
- _inherits(Lo, _Le3);
6969
+ _inherits(Lo, _Re3);
6951
6970
  return _createClass(Lo, [{
6952
6971
  key: "preprocessBody",
6953
6972
  value: function preprocessBody(e, t) {
@@ -6990,8 +7009,8 @@ var Lo = /*#__PURE__*/function (_Le3) {
6990
7009
  return extractResultData;
6991
7010
  }()
6992
7011
  }]);
6993
- }(Le);
6994
- var Po = /*#__PURE__*/function (_Le4) {
7012
+ }(Re);
7013
+ var Po = /*#__PURE__*/function (_Re4) {
6995
7014
  function Po(e) {
6996
7015
  _classCallCheck(this, Po);
6997
7016
  var s, r, o;
@@ -6999,7 +7018,7 @@ var Po = /*#__PURE__*/function (_Le4) {
6999
7018
  i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
7000
7019
  return _callSuper(this, Po, [e, "Insert text to summarize", "facebook/bart-large-cnn", t, i]);
7001
7020
  }
7002
- _inherits(Po, _Le4);
7021
+ _inherits(Po, _Re4);
7003
7022
  return _createClass(Po, [{
7004
7023
  key: "extractResultData",
7005
7024
  value: function () {
@@ -7029,8 +7048,8 @@ var Po = /*#__PURE__*/function (_Le4) {
7029
7048
  return extractResultData;
7030
7049
  }()
7031
7050
  }]);
7032
- }(Le);
7033
- var Oo = /*#__PURE__*/function (_Le5) {
7051
+ }(Re);
7052
+ var Oo = /*#__PURE__*/function (_Re5) {
7034
7053
  function Oo(e) {
7035
7054
  var _this27$maxMessages;
7036
7055
  var _this27;
@@ -7042,7 +7061,7 @@ var Oo = /*#__PURE__*/function (_Le5) {
7042
7061
  return _this27;
7043
7062
  }
7044
7063
  // prettier-ignore
7045
- _inherits(Oo, _Le5);
7064
+ _inherits(Oo, _Re5);
7046
7065
  return _createClass(Oo, [{
7047
7066
  key: "processMessages",
7048
7067
  value: function processMessages(e) {
@@ -7111,7 +7130,7 @@ var Oo = /*#__PURE__*/function (_Le5) {
7111
7130
  return extractResultData;
7112
7131
  }()
7113
7132
  }]);
7114
- }(Le);
7133
+ }(Re);
7115
7134
  var bi = /*#__PURE__*/function (_Oi3) {
7116
7135
  function bi(e) {
7117
7136
  var _this28;
@@ -7127,7 +7146,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
7127
7146
  }
7128
7147
  }
7129
7148
  };
7130
- _this28 = _callSuper(this, bi, [e, ve.buildKeyVerificationDetails(), ve.buildHeaders, i, s]), _this28.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this28.textInputPlaceholderText = "Describe image changes", _this28.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Image to Image</b></div>\n <p>Upload an image to create a new one with the changes you have described.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
7149
+ _this28 = _callSuper(this, bi, [e, ye.buildKeyVerificationDetails(), ye.buildHeaders, i, s]), _this28.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this28.textInputPlaceholderText = "Describe image changes", _this28.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Image to Image</b></div>\n <p>Upload an image to create a new one with the changes you have described.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
7131
7150
  var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
7132
7151
  _typeof(r) == "object" && (r.engine_id && (_this28.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this28._imageWeight = r.weight), bi.cleanConfig(r), Object.assign(_this28.rawBody, r)), _this28.canSendMessage = bi.canSendFileTextMessage;
7133
7152
  return _this28;
@@ -7163,7 +7182,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
7163
7182
  throw new Error("Image was not found");
7164
7183
  case 4:
7165
7184
  s = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], s);
7166
- v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
7185
+ E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
7167
7186
  case 6:
7168
7187
  case "end":
7169
7188
  return _context54.stop();
@@ -7219,7 +7238,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
7219
7238
  }
7220
7239
  }]);
7221
7240
  }(Oi);
7222
- var No = /*#__PURE__*/function (_Le6) {
7241
+ var No = /*#__PURE__*/function (_Re6) {
7223
7242
  function No(e) {
7224
7243
  _classCallCheck(this, No);
7225
7244
  var s, r, o;
@@ -7227,7 +7246,7 @@ var No = /*#__PURE__*/function (_Le6) {
7227
7246
  i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
7228
7247
  return _callSuper(this, No, [e, "Insert text to translate", "Helsinki-NLP/opus-tatoeba-en-ja", t, i]);
7229
7248
  }
7230
- _inherits(No, _Le6);
7249
+ _inherits(No, _Re6);
7231
7250
  return _createClass(No, [{
7232
7251
  key: "extractResultData",
7233
7252
  value: function () {
@@ -7257,7 +7276,7 @@ var No = /*#__PURE__*/function (_Le6) {
7257
7276
  return extractResultData;
7258
7277
  }()
7259
7278
  }]);
7260
- }(Le);
7279
+ }(Re);
7261
7280
  var vi = /*#__PURE__*/function (_Oi4) {
7262
7281
  function vi(e) {
7263
7282
  var _this29;
@@ -7265,7 +7284,7 @@ var vi = /*#__PURE__*/function (_Oi4) {
7265
7284
  var r;
7266
7285
  var t = JSON.parse(JSON.stringify(e.directConnection)),
7267
7286
  i = t.stabilityAI;
7268
- _this29 = _callSuper(this, vi, [e, ve.buildKeyVerificationDetails(), ve.buildHeaders, i]), _this29.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this29.textInputPlaceholderText = "Describe an image", _this29.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Text to Image</b></div>\n <p>Insert text to generate an image.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
7287
+ _this29 = _callSuper(this, vi, [e, ye.buildKeyVerificationDetails(), ye.buildHeaders, i]), _this29.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this29.textInputPlaceholderText = "Describe an image", _this29.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Text to Image</b></div>\n <p>Insert text to generate an image.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
7269
7288
  var s = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
7270
7289
  _typeof(s) == "object" && (s.engine_id && (_this29.url = "https://api.stability.ai/v1/generation/".concat(s.engine_id, "/text-to-image")), s.weight !== void 0 && s.weight !== null && (_this29._imageWeight = s.weight), vi.cleanConfig(s), Object.assign(_this29.rawBody, s)), _this29.canSendMessage = vi.canSendTextMessage;
7271
7290
  return _this29;
@@ -7351,7 +7370,7 @@ var vi = /*#__PURE__*/function (_Oi4) {
7351
7370
  }
7352
7371
  }]);
7353
7372
  }(Oi);
7354
- var Do = /*#__PURE__*/function (_Le7) {
7373
+ var Do = /*#__PURE__*/function (_Re7) {
7355
7374
  function Do(e) {
7356
7375
  var _this30;
7357
7376
  _classCallCheck(this, Do);
@@ -7361,7 +7380,7 @@ var Do = /*#__PURE__*/function (_Le7) {
7361
7380
  _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"];
7362
7381
  return _this30;
7363
7382
  }
7364
- _inherits(Do, _Le7);
7383
+ _inherits(Do, _Re7);
7365
7384
  return _createClass(Do, [{
7366
7385
  key: "extractResultData",
7367
7386
  value: function () {
@@ -7391,7 +7410,7 @@ var Do = /*#__PURE__*/function (_Le7) {
7391
7410
  return extractResultData;
7392
7411
  }()
7393
7412
  }]);
7394
- }(Le);
7413
+ }(Re);
7395
7414
  var L = /*#__PURE__*/function () {
7396
7415
  function L() {
7397
7416
  _classCallCheck(this, L);
@@ -7434,8 +7453,8 @@ var L = /*#__PURE__*/function () {
7434
7453
  s = _args60.length > 3 && _args60[3] !== undefined ? _args60[3] : !0;
7435
7454
  e.connectSettings.method = i;
7436
7455
  _context60.next = 4;
7437
- return v.fetch(e, e.connectSettings.headers, s, t).then(function (o) {
7438
- return v.processResponseByType(o);
7456
+ return E.fetch(e, e.connectSettings.headers, s, t).then(function (o) {
7457
+ return E.processResponseByType(o);
7439
7458
  });
7440
7459
  case 4:
7441
7460
  r = _context60.sent;
@@ -7479,10 +7498,10 @@ var ee = /*#__PURE__*/function () {
7479
7498
  return _context62.abrupt("return");
7480
7499
  case 3:
7481
7500
  e.url = s;
7482
- o = r[v.CONTENT_TYPE];
7483
- delete r[v.CONTENT_TYPE];
7501
+ o = r[E.CONTENT_TYPE];
7502
+ delete r[E.CONTENT_TYPE];
7484
7503
  a = i.map(/*#__PURE__*/function () {
7485
- var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(l) {
7504
+ var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(l) {
7486
7505
  var c;
7487
7506
  return _regeneratorRuntime().wrap(function _callee61$(_context61) {
7488
7507
  while (1) switch (_context61.prev = _context61.next) {
@@ -7498,7 +7517,7 @@ var ee = /*#__PURE__*/function () {
7498
7517
  }, _callee61);
7499
7518
  }));
7500
7519
  return function (_x114) {
7501
- return _ref11.apply(this, arguments);
7520
+ return _ref14.apply(this, arguments);
7502
7521
  };
7503
7522
  }());
7504
7523
  _context62.prev = 7;
@@ -7511,11 +7530,11 @@ var ee = /*#__PURE__*/function () {
7511
7530
  name: c.filename
7512
7531
  };
7513
7532
  });
7514
- return _context62.abrupt("return", (r[v.CONTENT_TYPE] = o, l));
7533
+ return _context62.abrupt("return", (r[E.CONTENT_TYPE] = o, l));
7515
7534
  case 14:
7516
7535
  _context62.prev = 14;
7517
7536
  _context62.t0 = _context62["catch"](7);
7518
- throw r[v.CONTENT_TYPE] = o, v.displayError(t, _context62.t0), e.completionsHandlers.onFinish(), _context62.t0;
7537
+ throw r[E.CONTENT_TYPE] = o, E.displayError(t, _context62.t0), e.completionsHandlers.onFinish(), _context62.t0;
7519
7538
  case 17:
7520
7539
  case "end":
7521
7540
  return _context62.stop();
@@ -7541,8 +7560,8 @@ var ee = /*#__PURE__*/function () {
7541
7560
  return _regeneratorRuntime().wrap(function _callee63$(_context63) {
7542
7561
  while (1) switch (_context63.prev = _context63.next) {
7543
7562
  case 0:
7544
- r = t.map(function (_ref12) {
7545
- var l = _ref12.fileId;
7563
+ r = t.map(function (_ref15) {
7564
+ var l = _ref15.fileId;
7546
7565
  return e.url = "".concat(i).concat(l).concat(s), new Promise(function (c) {
7547
7566
  c(L.directFetch(e, void 0, "GET", !1));
7548
7567
  });
@@ -7692,7 +7711,7 @@ var ee = /*#__PURE__*/function () {
7692
7711
  value: function parseMessages(e, t, i) {
7693
7712
  var s = [];
7694
7713
  return t.forEach(/*#__PURE__*/function () {
7695
- var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee67(r) {
7714
+ var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee67(r) {
7696
7715
  return _regeneratorRuntime().wrap(function _callee67$(_context67) {
7697
7716
  while (1) switch (_context67.prev = _context67.next) {
7698
7717
  case 0:
@@ -7701,7 +7720,7 @@ var ee = /*#__PURE__*/function () {
7701
7720
  }).sort(function (o) {
7702
7721
  return o.text ? -1 : o.image_file ? 1 : 0;
7703
7722
  }).forEach(/*#__PURE__*/function () {
7704
- var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee66(o) {
7723
+ var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee66(o) {
7705
7724
  return _regeneratorRuntime().wrap(function _callee66$(_context66) {
7706
7725
  while (1) switch (_context66.prev = _context66.next) {
7707
7726
  case 0:
@@ -7713,7 +7732,7 @@ var ee = /*#__PURE__*/function () {
7713
7732
  }, _callee66);
7714
7733
  }));
7715
7734
  return function (_x129) {
7716
- return _ref14.apply(this, arguments);
7735
+ return _ref17.apply(this, arguments);
7717
7736
  };
7718
7737
  }());
7719
7738
  case 1:
@@ -7723,7 +7742,7 @@ var ee = /*#__PURE__*/function () {
7723
7742
  }, _callee67);
7724
7743
  }));
7725
7744
  return function (_x128) {
7726
- return _ref13.apply(this, arguments);
7745
+ return _ref16.apply(this, arguments);
7727
7746
  };
7728
7747
  }()), Promise.all(s);
7729
7748
  }
@@ -7773,13 +7792,13 @@ var ee = /*#__PURE__*/function () {
7773
7792
  }]);
7774
7793
  }();
7775
7794
  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.";
7776
- var ye = ee;
7777
- var De = /*#__PURE__*/function (_z3) {
7795
+ var Ee = ee;
7796
+ var Oe = /*#__PURE__*/function (_z3) {
7778
7797
  // prettier-ignore
7779
- function De(e, t, i, s, r, o) {
7798
+ function Oe(e, t, i, s, r, o) {
7780
7799
  var _this31;
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 = {
7800
+ _classCallCheck(this, Oe);
7801
+ if (_this31 = _callSuper(this, Oe, [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 = {
7783
7802
  model: "gpt-4"
7784
7803
  }, _this31.waitingForStreamResponse = !1, _this31.isSSEStream = !1, _this31.urlSegments = i, _typeof(t) == "object") {
7785
7804
  _this31.config = t;
@@ -7788,14 +7807,12 @@ var De = /*#__PURE__*/function (_z3) {
7788
7807
  l = _this31$config.thread_id,
7789
7808
  c = _this31$config.load_thread_history;
7790
7809
  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;
7793
7810
  }
7794
7811
  _this31.maxMessages = 1, _this31.isSSEStream = !!(_this31.stream && (_typeof(_this31.stream) != "object" || !_this31.stream.simulation));
7795
7812
  return _assertThisInitialized(_this31);
7796
7813
  }
7797
- _inherits(De, _z3);
7798
- return _createClass(De, [{
7814
+ _inherits(Oe, _z3);
7815
+ return _createClass(Oe, [{
7799
7816
  key: "fetchHistoryFunc",
7800
7817
  value: function () {
7801
7818
  var _fetchHistoryFunc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee70() {
@@ -7838,19 +7855,19 @@ var De = /*#__PURE__*/function (_z3) {
7838
7855
  if (t && t.length > 0) {
7839
7856
  var r = this.filesToolType;
7840
7857
  if (typeof this.filesToolType == "function") {
7841
- var a = this.filesToolType(t.map(function (_ref15) {
7842
- var l = _ref15.name;
7858
+ var a = this.filesToolType(t.map(function (_ref18) {
7859
+ var l = _ref18.name;
7843
7860
  return l;
7844
7861
  }));
7845
7862
  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"'));
7846
7863
  }
7847
- if (r === "file_search") return De.processAttachmentsMessage(s, t, "file_search");
7848
- if (r === "code_interpreter") return De.processAttachmentsMessage(s, t, "code_interpreter");
7849
- if (t.find(function (_ref16) {
7850
- var a = _ref16.name;
7851
- return !B.isImageFileExtension(a);
7864
+ if (r === "file_search") return Oe.processAttachmentsMessage(s, t, "file_search");
7865
+ if (r === "code_interpreter") return Oe.processAttachmentsMessage(s, t, "code_interpreter");
7866
+ if (t.find(function (_ref19) {
7867
+ var a = _ref19.name;
7868
+ return !U.isImageFileExtension(a);
7852
7869
  })) 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 {
7853
- var _a2 = De.processImageMessage(s, t);
7870
+ var _a2 = Oe.processImageMessage(s, t);
7854
7871
  if (_a2) return _a2;
7855
7872
  }
7856
7873
  }
@@ -7916,13 +7933,13 @@ var De = /*#__PURE__*/function (_z3) {
7916
7933
  case 11:
7917
7934
  r.assistant_id = _context71.t0;
7918
7935
  case 12:
7919
- this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messages);
7936
+ this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messageToElements);
7920
7937
  if (!i) {
7921
7938
  _context71.next = 19;
7922
7939
  break;
7923
7940
  }
7924
7941
  _context71.next = 16;
7925
- return ye.storeFiles(this, e, i, this.urlSegments.storeFiles);
7942
+ return Ee.storeFiles(this, e, i, this.urlSegments.storeFiles);
7926
7943
  case 16:
7927
7944
  _context71.t1 = _context71.sent;
7928
7945
  _context71.next = 20;
@@ -7976,10 +7993,12 @@ var De = /*#__PURE__*/function (_z3) {
7976
7993
  }, {
7977
7994
  key: "searchPreviousMessagesForThreadId",
7978
7995
  value: function searchPreviousMessagesForThreadId(e) {
7979
- var t = e.find(function (i) {
7996
+ var t = e.find(function (_ref20) {
7997
+ var _ref21 = _slicedToArray(_ref20, 1),
7998
+ i = _ref21[0];
7980
7999
  return i._sessionId;
7981
8000
  });
7982
- t && (this.sessionId = t._sessionId), this.searchedForThreadId = !0;
8001
+ t && (this.sessionId = t[0]._sessionId), this.searchedForThreadId = !0;
7983
8002
  }
7984
8003
  // prettier-ignore
7985
8004
  }, {
@@ -8003,7 +8022,7 @@ var De = /*#__PURE__*/function (_z3) {
8003
8022
  _context73.next = 6;
8004
8023
  break;
8005
8024
  }
8006
- throw e.error.message.startsWith(ye.FILES_WITH_TEXT_ERROR) ? Error("Please send text with your file(s)") : e.error.message;
8025
+ throw e.error.message.startsWith(Ee.FILES_WITH_TEXT_ERROR) ? Error("Please send text with your file(s)") : e.error.message;
8007
8026
  case 6:
8008
8027
  _context73.next = 8;
8009
8028
  return this.assignThreadAndRun(e);
@@ -8047,7 +8066,7 @@ var De = /*#__PURE__*/function (_z3) {
8047
8066
  _context74.next = 9;
8048
8067
  break;
8049
8068
  case 8:
8050
- this.sessionId = e.thread_id, this.run_id = e.id, this.messages && this.messages.messages.length > 0 && (this.messages.messages[this.messages.messages.length - 1]._sessionId = this.sessionId);
8069
+ this.sessionId = e.thread_id, this.run_id = e.id, this.messages && this.messages.messageToElements.length > 0 && (this.messages.messageToElements[this.messages.messageToElements.length - 1][0]._sessionId = this.sessionId);
8051
8070
  case 9:
8052
8071
  case "end":
8053
8072
  return _context74.stop();
@@ -8087,7 +8106,7 @@ var De = /*#__PURE__*/function (_z3) {
8087
8106
  case 9:
8088
8107
  i = _context75.sent;
8089
8108
  case 10:
8090
- return _context75.abrupt("return", ye.processAPIMessages(this, i, t, this.urlSegments));
8109
+ return _context75.abrupt("return", Ee.processAPIMessages(this, i, t, this.urlSegments));
8091
8110
  case 11:
8092
8111
  case "end":
8093
8112
  return _context75.stop();
@@ -8114,7 +8133,7 @@ var De = /*#__PURE__*/function (_z3) {
8114
8133
  break;
8115
8134
  }
8116
8135
  return _context76.abrupt("return", {
8117
- timeoutMS: De.POLLING_TIMEOUT_MS
8136
+ timeoutMS: Oe.POLLING_TIMEOUT_MS
8118
8137
  });
8119
8138
  case 3:
8120
8139
  if (!(t === "completed" && this.messages)) {
@@ -8168,7 +8187,7 @@ var De = /*#__PURE__*/function (_z3) {
8168
8187
  return _regeneratorRuntime().wrap(function _callee77$(_context77) {
8169
8188
  while (1) switch (_context77.prev = _context77.next) {
8170
8189
  case 0:
8171
- if (this._functionHandler) {
8190
+ if (this.functionHandler) {
8172
8191
  _context77.next = 2;
8173
8192
  break;
8174
8193
  }
@@ -8181,14 +8200,14 @@ var De = /*#__PURE__*/function (_z3) {
8181
8200
  };
8182
8201
  });
8183
8202
  _context77.next = 5;
8184
- return this._functionHandler(t);
8203
+ return this.functionHandler(t);
8185
8204
  case 5:
8186
8205
  i = _context77.sent;
8187
8206
  if (!(!Array.isArray(i) || e.length !== i.length)) {
8188
8207
  _context77.next = 8;
8189
8208
  break;
8190
8209
  }
8191
- throw Error(ye.FUNCTION_TOOL_RESP_ERROR);
8210
+ throw Error(Ee.FUNCTION_TOOL_RESP_ERROR);
8192
8211
  case 8:
8193
8212
  _context77.next = 10;
8194
8213
  return Promise.all(i);
@@ -8200,7 +8219,7 @@ var De = /*#__PURE__*/function (_z3) {
8200
8219
  _context77.next = 13;
8201
8220
  break;
8202
8221
  }
8203
- throw Error(ye.FUNCTION_TOOL_RESP_ERROR);
8222
+ throw Error(Ee.FUNCTION_TOOL_RESP_ERROR);
8204
8223
  case 13:
8205
8224
  r = s.map(function (l, c) {
8206
8225
  return {
@@ -8227,7 +8246,7 @@ var De = /*#__PURE__*/function (_z3) {
8227
8246
  }, "POST");
8228
8247
  case 22:
8229
8248
  return _context77.abrupt("return", {
8230
- timeoutMS: De.POLLING_TIMEOUT_MS
8249
+ timeoutMS: Oe.POLLING_TIMEOUT_MS
8231
8250
  });
8232
8251
  case 23:
8233
8252
  case "end":
@@ -8305,7 +8324,7 @@ var De = /*#__PURE__*/function (_z3) {
8305
8324
  }
8306
8325
  l = e.content.find(function (d) {
8307
8326
  return !!d.text;
8308
- }) || e.content[0], c = ye.getFilesAndText.bind(this, this, {
8327
+ }) || e.content[0], c = Ee.getFilesAndText.bind(this, this, {
8309
8328
  role: "assistant",
8310
8329
  content: e.content
8311
8330
  }, this.urlSegments, l);
@@ -8329,7 +8348,7 @@ var De = /*#__PURE__*/function (_z3) {
8329
8348
  break;
8330
8349
  }
8331
8350
  _context79.next = 11;
8332
- return ye.processStreamMessages(this, e.delta.content, this.urlSegments);
8351
+ return Ee.processStreamMessages(this, e.delta.content, this.urlSegments);
8333
8352
  case 11:
8334
8353
  _l = _context79.sent;
8335
8354
  return _context79.abrupt("return", {
@@ -8384,7 +8403,7 @@ var De = /*#__PURE__*/function (_z3) {
8384
8403
  key: "processImageMessage",
8385
8404
  value: function processImageMessage(e, t) {
8386
8405
  var i = t == null ? void 0 : t.filter(function (s) {
8387
- return B.isImageFileExtension(s.name);
8406
+ return U.isImageFileExtension(s.name);
8388
8407
  }).map(function (s) {
8389
8408
  return {
8390
8409
  type: "image_file",
@@ -8422,19 +8441,24 @@ var De = /*#__PURE__*/function (_z3) {
8422
8441
  }
8423
8442
  }]);
8424
8443
  }(z);
8425
- De.POLLING_TIMEOUT_MS = 800;
8426
- var yi = De;
8444
+ Oe.POLLING_TIMEOUT_MS = 800;
8445
+ var yi = Oe;
8427
8446
  var Ii = /*#__PURE__*/function (_yi) {
8428
8447
  function Ii(e) {
8429
8448
  var _o$headers2, _a$OpenAIBeta;
8430
8449
  var _this34;
8431
8450
  _classCallCheck(this, Ii);
8432
- var r, o, a;
8451
+ var r, o, a, l, c;
8433
8452
  var t = JSON.parse(JSON.stringify(e.directConnection)),
8434
8453
  i = t.openAI,
8435
8454
  s = (r = t.openAI) == null ? void 0 : r.assistant;
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)));
8437
- return _this34;
8455
+ if (_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))), _typeof(s) == "object") {
8456
+ var _ref22 = (c = (l = e.directConnection) == null ? void 0 : l.openAI) == null ? void 0 : c.assistant,
8457
+ d = _ref22.function_handler,
8458
+ h = _ref22.files_tool_type;
8459
+ d && (_this34.functionHandler = d), h && (_this34.filesToolType = h);
8460
+ }
8461
+ return _assertThisInitialized(_this34);
8438
8462
  }
8439
8463
  _inherits(Ii, _yi);
8440
8464
  return _createClass(Ii);
@@ -8604,10 +8628,10 @@ Ls.URL_DETAILS_ERROR_MESSAGE = "Please define the Azure URL Details. [More Infor
8604
8628
  var oe = Ls;
8605
8629
  var mt = /*#__PURE__*/function (_yi2) {
8606
8630
  function mt(e) {
8607
- var _f$headers;
8631
+ var _v$headers;
8608
8632
  var _this36;
8609
8633
  _classCallCheck(this, mt);
8610
- var c, d, h, u, f;
8634
+ var c, d, h, u, f, m, p, v;
8611
8635
  var t = JSON.parse(JSON.stringify(e.directConnection)),
8612
8636
  i = t.azure,
8613
8637
  s = (c = t.azure) == null ? void 0 : c.openAI,
@@ -8624,14 +8648,20 @@ var mt = /*#__PURE__*/function (_yi2) {
8624
8648
  getFilesPrefix: "".concat(o, "files/"),
8625
8649
  getFilesPostfix: "/content".concat(a)
8626
8650
  };
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 () {
8651
+ if (_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, _typeof(s == null ? void 0 : s.assistant) == "object") {
8652
+ var _ref23 = (p = (m = (f = e.directConnection) == null ? void 0 : f.azure) == null ? void 0 : m.openAI) == null ? void 0 : p.assistant,
8653
+ y = _ref23.function_handler,
8654
+ P = _ref23.files_tool_type;
8655
+ y && (_this36.functionHandler = y), P && (_this36.filesToolType = P);
8656
+ }
8657
+ oe.validateURLDetails(r) ? (_v$headers = (v = _this36.connectSettings).headers) !== null && _v$headers !== void 0 ? _v$headers : v.headers = {} : (_this36.isTextInputDisabled = !0, _this36.canSendMessage = function () {
8628
8658
  return !1;
8629
8659
  }, setTimeout(function () {
8630
8660
  e.addMessage({
8631
8661
  error: oe.URL_DETAILS_ERROR_MESSAGE
8632
8662
  });
8633
8663
  }));
8634
- return _this36;
8664
+ return _assertThisInitialized(_this36);
8635
8665
  }
8636
8666
  _inherits(mt, _yi2);
8637
8667
  return _createClass(mt);
@@ -8861,7 +8891,7 @@ var de = /*#__PURE__*/function (_z6) {
8861
8891
  case 4:
8862
8892
  this.url = this.connectSettings.url || this._service_url;
8863
8893
  s = this.preprocessBody(this.rawBody, t), r = de.createFormDataBody(s, i[0]);
8864
- v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
8894
+ E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
8865
8895
  case 7:
8866
8896
  case "end":
8867
8897
  return _context87.stop();
@@ -9401,26 +9431,26 @@ var _n = /*#__PURE__*/function (_z9) {
9401
9431
  _inherits(_n, _z9);
9402
9432
  return _createClass(_n);
9403
9433
  }(z);
9404
- var Je = /*#__PURE__*/function (_n2) {
9434
+ var Ke = /*#__PURE__*/function (_n2) {
9405
9435
  // prettier-ignore
9406
- function Je(e) {
9436
+ function Ke(e) {
9407
9437
  var _a$lang, _l$name, _c$gender;
9408
9438
  var _this43;
9409
- _classCallCheck(this, Je);
9439
+ _classCallCheck(this, Ke);
9410
9440
  var s, r, o, a, l, c;
9411
9441
  var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.textToSpeech,
9412
9442
  i = (o = e.directConnection) == null ? void 0 : o.azure;
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 () {
9443
+ _this43 = _callSuper(this, Ke, [e, ae.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i]), _this43.permittedErrorPrefixes = [Ke.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(Ke.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 () {
9414
9444
  return !1;
9415
9445
  }, setTimeout(function () {
9416
9446
  e.addMessage({
9417
- error: Je.REGION_ERROR_MESSAGE
9447
+ error: Ke.REGION_ERROR_MESSAGE
9418
9448
  });
9419
9449
  }));
9420
9450
  return _this43;
9421
9451
  }
9422
- _inherits(Je, _n2);
9423
- return _createClass(Je, [{
9452
+ _inherits(Ke, _n2);
9453
+ return _createClass(Ke, [{
9424
9454
  key: "preprocessBody",
9425
9455
  value: function preprocessBody(e, t) {
9426
9456
  var i = t[t.length - 1].text;
@@ -9484,16 +9514,16 @@ var Je = /*#__PURE__*/function (_n2) {
9484
9514
  }()
9485
9515
  }]);
9486
9516
  }(_n);
9487
- Je.HELP_LINK =
9517
+ Ke.HELP_LINK =
9488
9518
  // eslint-disable-next-line max-len
9489
- "https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest", Je.REGION_ERROR_MESSAGE =
9519
+ "https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest", Ke.REGION_ERROR_MESSAGE =
9490
9520
  // eslint-disable-next-line max-len
9491
9521
  "Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#TextToSpeech)";
9492
- var ms = Je;
9493
- var Fe = /*#__PURE__*/function (_n3) {
9494
- function Fe(e) {
9522
+ var ms = Ke;
9523
+ var Ne = /*#__PURE__*/function (_n3) {
9524
+ function Ne(e) {
9495
9525
  var _this44;
9496
- _classCallCheck(this, Fe);
9526
+ _classCallCheck(this, Ne);
9497
9527
  var r, o, a;
9498
9528
  var t = (o = (r = e.directConnection) == null ? void 0 : r.azure) == null ? void 0 : o.speechToText,
9499
9529
  i = (a = e.directConnection) == null ? void 0 : a.azure,
@@ -9504,21 +9534,21 @@ var Fe = /*#__PURE__*/function (_n3) {
9504
9534
  }
9505
9535
  }
9506
9536
  };
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 () {
9537
+ if (_this44 = _callSuper(this, Ne, [e, ae.buildSpeechToTextHeaders, t.region, i, s]), _this44.permittedErrorPrefixes = [Ne.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(Ne.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 () {
9508
9538
  return !1;
9509
9539
  }, setTimeout(function () {
9510
9540
  e.addMessage({
9511
- error: Fe.REGION_ERROR_MESSAGE
9541
+ error: Ne.REGION_ERROR_MESSAGE
9512
9542
  });
9513
9543
  });else {
9514
- _this44.canSendMessage = Fe.canFileSendMessage;
9544
+ _this44.canSendMessage = Ne.canFileSendMessage;
9515
9545
  var l = t.lang || "en-US";
9516
9546
  _this44.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(l, "&format=detailed"), _this44.recordAudio = void 0;
9517
9547
  }
9518
9548
  return _assertThisInitialized(_this44);
9519
9549
  }
9520
- _inherits(Fe, _n3);
9521
- return _createClass(Fe, [{
9550
+ _inherits(Ne, _n3);
9551
+ return _createClass(Ne, [{
9522
9552
  key: "callServiceAPI",
9523
9553
  value: function () {
9524
9554
  var _callServiceAPI17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t, i) {
@@ -9584,12 +9614,12 @@ var Fe = /*#__PURE__*/function (_n3) {
9584
9614
  }
9585
9615
  }]);
9586
9616
  }(_n);
9587
- Fe.HELP_LINK =
9617
+ Ne.HELP_LINK =
9588
9618
  // eslint-disable-next-line max-len
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 =
9619
+ "https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest", Ne.REGION_ERROR_MESSAGE =
9590
9620
  // eslint-disable-next-line max-len
9591
9621
  "Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#SpeechToText)";
9592
- var gs = Fe;
9622
+ var gs = Ne;
9593
9623
  var jo = /*#__PURE__*/function (_z10) {
9594
9624
  // prettier-ignore
9595
9625
  function jo(e) {
@@ -9684,8 +9714,8 @@ var vt = /*#__PURE__*/function (_z11) {
9684
9714
  var d = r || ((h = o.openAI) == null ? void 0 : h.chat);
9685
9715
  if (_typeof(d) == "object") {
9686
9716
  d.system_prompt && (_this46._systemMessage = vt.generateSystemMessage(d.system_prompt));
9687
- var _ref17 = (f = (u = e.directConnection) == null ? void 0 : u.openAI) == null ? void 0 : f.chat,
9688
- p = _ref17.function_handler;
9717
+ var _ref24 = (f = (u = e.directConnection) == null ? void 0 : u.openAI) == null ? void 0 : f.chat,
9718
+ p = _ref24.function_handler;
9689
9719
  p && (_this46._functionHandler = p), _this46.cleanConfig(d), Object.assign(_this46.rawBody, d);
9690
9720
  }
9691
9721
  (_this46$maxMessages = _this46.maxMessages) !== null && _this46$maxMessages !== void 0 ? _this46$maxMessages : _this46.maxMessages = -1, (_m$model = (m = _this46.rawBody).model) !== null && _m$model !== void 0 ? _m$model : m.model = "gpt-4o";
@@ -9876,7 +9906,7 @@ var vt = /*#__PURE__*/function (_z11) {
9876
9906
  _context104.prev = 17;
9877
9907
  _context104.next = 20;
9878
9908
  return t == null ? void 0 : t(s).then(function (f) {
9879
- return v.processResponseByType(f);
9909
+ return E.processResponseByType(f);
9880
9910
  });
9881
9911
  case 20:
9882
9912
  _u = _context104.sent;
@@ -9950,19 +9980,24 @@ var As = /*#__PURE__*/function (_vt) {
9950
9980
  function As(e) {
9951
9981
  var _this48;
9952
9982
  _classCallCheck(this, As);
9953
- var o, a, l, c;
9983
+ var o, a, l, c, d, h, u;
9954
9984
  var t = JSON.parse(JSON.stringify(e.directConnection)),
9955
9985
  i = t.azure,
9956
9986
  s = ((a = (o = t.azure) == null ? void 0 : o.openAI) == null ? void 0 : a.urlDetails) || {},
9957
9987
  r = (c = (l = t.azure) == null ? void 0 : l.openAI) == null ? void 0 : c.chat;
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 () {
9988
+ if (_this48 = _callSuper(this, As, [e, oe.buildKeyVerificationDetails(s), oe.buildHeaders, i, r]), _this48.permittedErrorPrefixes = [oe.URL_DETAILS_ERROR_MESSAGE], _this48.isTextInputDisabled = !1, _typeof(r) == "object") {
9989
+ var _ref25 = (u = (h = (d = e.directConnection) == null ? void 0 : d.azure) == null ? void 0 : h.openAI) == null ? void 0 : u.chat,
9990
+ f = _ref25.function_handler;
9991
+ f && (_this48._functionHandler = f);
9992
+ }
9993
+ oe.validateURLDetails(s) ? _this48.url = As.buildURL(s) : (_this48.isTextInputDisabled = !0, _this48.canSendMessage = function () {
9959
9994
  return !1;
9960
9995
  }, setTimeout(function () {
9961
9996
  e.addMessage({
9962
9997
  error: oe.URL_DETAILS_ERROR_MESSAGE
9963
9998
  });
9964
9999
  }));
9965
- return _this48;
10000
+ return _assertThisInitialized(_this48);
9966
10001
  }
9967
10002
  _inherits(As, _vt);
9968
10003
  return _createClass(As, null, [{
@@ -10023,7 +10058,7 @@ var he = /*#__PURE__*/function (_z12) {
10023
10058
  var l = this.preprocessBody(this.rawBody, r);
10024
10059
  s = he.createFormDataBody(l, i[0], i[1]);
10025
10060
  } else this.url = he.IMAGE_VARIATIONS_URL, s = he.createFormDataBody(this.rawBody, i[0]);
10026
- v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
10061
+ E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
10027
10062
  }
10028
10063
  }, {
10029
10064
  key: "callServiceAPI",
@@ -10360,7 +10395,7 @@ var zo = /*#__PURE__*/function () {
10360
10395
  if (t.stabilityAI) return t.stabilityAI.imageToImage ? new bi(e) : t.stabilityAI.imageToImageUpscale ? new mi(e) : t.stabilityAI.imageToImageMasking ? new gi(e) : new vi(e);
10361
10396
  if (t.mistral) return new qo(e);
10362
10397
  }
10363
- return i && (!s || !i.stream) ? new it(e) : new it(e, void 0, s || !0);
10398
+ return i && (!s || !i.stream) ? new tt(e) : new tt(e, void 0, s || !0);
10364
10399
  }
10365
10400
  }]);
10366
10401
  }();
@@ -10450,15 +10485,15 @@ var Go = /*#__PURE__*/function () {
10450
10485
  }]);
10451
10486
  }();
10452
10487
  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>";
10453
- var Oe = /*#__PURE__*/function () {
10454
- function Oe() {
10455
- _classCallCheck(this, Oe);
10488
+ var Le = /*#__PURE__*/function () {
10489
+ function Le() {
10490
+ _classCallCheck(this, Le);
10456
10491
  }
10457
- return _createClass(Oe, null, [{
10492
+ return _createClass(Le, null, [{
10458
10493
  key: "createImage",
10459
10494
  value: function createImage(e, t, i) {
10460
10495
  var s = new Image();
10461
- return s.src = e.src, i || B.scrollDownOnImageLoad(s.src, t), B.processContent("image", s, s.src, e.name);
10496
+ return s.src = e.src, i || U.scrollDownOnImageLoad(s.src, t), U.processContent("image", s, s.src, e.name);
10462
10497
  }
10463
10498
  // WORK - image still does not scroll down when loaded
10464
10499
  }, {
@@ -10469,8 +10504,8 @@ var Oe = /*#__PURE__*/function () {
10469
10504
  return _regeneratorRuntime().wrap(function _callee111$(_context111) {
10470
10505
  while (1) switch (_context111.prev = _context111.next) {
10471
10506
  case 0:
10472
- r = Oe.createImage(t, e.elementRef, s), o = e.createNewMessageElement("", i);
10473
- o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("image-message"), B.addMessage(e, o, "image", i, s);
10507
+ r = Le.createImage(t, e.elementRef, s), o = e.createNewMessageElement("", i);
10508
+ o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("image-message"), U.addMessage(e, o, "image", i, s);
10474
10509
  case 2:
10475
10510
  case "end":
10476
10511
  return _context111.stop();
@@ -10491,9 +10526,9 @@ var Oe = /*#__PURE__*/function () {
10491
10526
  }, {
10492
10527
  key: "addNewAudioMessage",
10493
10528
  value: function addNewAudioMessage(e, t, i, s) {
10494
- var r = Oe.createAudioElement(t, i),
10529
+ var r = Le.createAudioElement(t, i),
10495
10530
  o = e.createMessageElementsOnOrientation("", i, s);
10496
- o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"), B.addMessage(e, o, "audio", i, s);
10531
+ o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"), U.addMessage(e, o, "audio", i, s);
10497
10532
  }
10498
10533
  }, {
10499
10534
  key: "createAnyFile",
@@ -10505,36 +10540,40 @@ var Oe = /*#__PURE__*/function () {
10505
10540
  var s = ie.createSVGElement(Vo);
10506
10541
  s.classList.add("any-file-message-icon"), i.appendChild(s);
10507
10542
  var r = document.createElement("div");
10508
- return r.classList.add("any-file-message-text"), r.textContent = e.name || B.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), B.processContent("any", t, e.src, r.textContent);
10543
+ return r.classList.add("any-file-message-text"), r.textContent = e.name || U.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), U.processContent("any", t, e.src, r.textContent);
10509
10544
  }
10510
10545
  }, {
10511
10546
  key: "addNewAnyFileMessage",
10512
10547
  value: function addNewAnyFileMessage(e, t, i, s) {
10513
10548
  var r = e.createMessageElementsOnOrientation("", i, s),
10514
- o = Oe.createAnyFile(t);
10515
- r.bubbleElement.classList.add("any-file-message-bubble"), r.bubbleElement.appendChild(o), B.addMessage(e, r, "file", i, s);
10549
+ o = Le.createAnyFile(t);
10550
+ r.bubbleElement.classList.add("any-file-message-bubble"), r.bubbleElement.appendChild(o), U.addMessage(e, r, "file", i, s);
10516
10551
  }
10517
10552
  // no overwrite previous message logic as it is complex to track which files are to be overwritten
10518
10553
  }, {
10519
10554
  key: "addMessages",
10520
10555
  value: function addMessages(e, t, i, s) {
10521
10556
  t.forEach(function (r) {
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);
10557
+ r.ref && (r = U.removeFileRef(r)), U.isAudioFile(r) ? Le.addNewAudioMessage(e, r, i, s) : U.isImageFile(r) ? Le.addNewImageMessage(e, r, i, s) : Le.addNewAnyFileMessage(e, r, i, s);
10523
10558
  });
10524
10559
  }
10525
10560
  }]);
10526
10561
  }();
10527
- var Ee = /*#__PURE__*/function (_Be) {
10528
- function Ee(e, t, i) {
10562
+ var me = /*#__PURE__*/function (_De) {
10563
+ function me(e, t, i) {
10529
10564
  var _this52;
10530
- _classCallCheck(this, Ee);
10565
+ _classCallCheck(this, me);
10531
10566
  var a, l;
10532
- _this52 = _callSuper(this, Ee, [e]);
10567
+ _this52 = _callSuper(this, me, [e]);
10533
10568
  var s = t.permittedErrorPrefixes,
10534
10569
  r = t.introPanelMarkUp,
10535
10570
  o = t.demo;
10536
- _this52._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this52._onClearMessages = hi.onClearMessages.bind(_this52, e), _this52._onError = hi.onError.bind(_this52, e), _this52._displayLoadingMessage = Ee.getDisplayLoadingMessage(e, t), _this52._permittedErrorPrefixes = s, _this52.addSetupMessageIfNeeded(e, t) || _this52.populateIntroPanel(i, r, e.introPanelStyle), _this52.addIntroductoryMessages(e, t), new Ht(e, _this52, t), _this52._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
10537
- return JSON.parse(JSON.stringify(_this52.messages));
10571
+ _this52._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this52._onClearMessages = hi.onClearMessages.bind(_this52, e), _this52._onError = hi.onError.bind(_this52, e), _this52._displayLoadingMessage = me.getDisplayLoadingMessage(e, t), _this52._permittedErrorPrefixes = s, _this52.addSetupMessageIfNeeded(e, t) || _this52.populateIntroPanel(i, r, e.introPanelStyle), _this52.addIntroductoryMessages(e, t), new Ht(e, _this52, t), _this52._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
10572
+ return JSON.parse(JSON.stringify(_this52.messageToElements.map(function (_ref26) {
10573
+ var _ref27 = _slicedToArray(_ref26, 1),
10574
+ c = _ref27[0];
10575
+ return c;
10576
+ })));
10538
10577
  }, e.clearMessages = _this52.clearMessages.bind(_this52, t), e.refreshMessages = _this52.refreshTextMessages.bind(_this52), e.scrollToBottom = J.scrollToBottom.bind(_this52, _this52.elementRef), e.addMessage = function (c, d) {
10539
10578
  _this52.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
10540
10579
  sendUpdate: !!d
@@ -10544,12 +10583,8 @@ var Ee = /*#__PURE__*/function (_Be) {
10544
10583
  });
10545
10584
  return _this52;
10546
10585
  }
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);
10552
- return _createClass(Ee, [{
10586
+ _inherits(me, _De);
10587
+ return _createClass(me, [{
10553
10588
  key: "prepareDemo",
10554
10589
  value: function prepareDemo(e) {
10555
10590
  _typeof(e) == "object" && (e.response && (this.customDemoResponse = e.response), e.displayErrors && (e.displayErrors["default"] && this.addNewErrorMessage("", ""), e.displayErrors.service && this.addNewErrorMessage("service", ""), e.displayErrors.speechToText && this.addNewErrorMessage("speechToText", "")), e.displayLoadingBubble && this.addLoadingMessage());
@@ -10581,7 +10616,7 @@ var Ee = /*#__PURE__*/function (_Be) {
10581
10616
  value: function addIntroductoryMessage(e) {
10582
10617
  var i;
10583
10618
  var t;
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"));
10619
+ e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t = Fe.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"));
10585
10620
  }
10586
10621
  }, {
10587
10622
  key: "removeIntroductoryMessage",
@@ -10602,13 +10637,13 @@ var Ee = /*#__PURE__*/function (_Be) {
10602
10637
  value: function addNewMessage(e) {
10603
10638
  var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
10604
10639
  var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
10605
- var s = Ee.createMessageContent(e),
10640
+ var s = me.createMessageContent(e),
10606
10641
  r = {
10607
10642
  status: e.overwrite
10608
10643
  };
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);
10611
- Me.isElementTemporary(o) && delete s.html;
10644
+ 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) && Le.addMessages(this, s.files, s.role, i), s.html !== void 0 && s.html !== null) {
10645
+ var o = Fe.add(this, s.html, s.role, this.messageElementRefs, r, i);
10646
+ ke.isElementTemporary(o) && delete s.html;
10612
10647
  }
10613
10648
  return this.isValidMessageContent(s) && !i && this.updateStateOnMessage(s, e.overwrite, e.sendUpdate, t), s;
10614
10649
  }
@@ -10622,7 +10657,11 @@ var Ee = /*#__PURE__*/function (_Be) {
10622
10657
  value: function updateStateOnMessage(e, t) {
10623
10658
  var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
10624
10659
  var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
10625
- t || this.messages.push(e), i && this.sendClientUpdate(e, s);
10660
+ if (!t) {
10661
+ var r = b.getNumberOfElements(e);
10662
+ this.messageToElements.push([e, this.messageElementRefs.slice(this.messageElementRefs.length - r)]);
10663
+ }
10664
+ i && this.sendClientUpdate(e, s);
10626
10665
  }
10627
10666
  // prettier-ignore
10628
10667
  }, {
@@ -10630,7 +10669,7 @@ var Ee = /*#__PURE__*/function (_Be) {
10630
10669
  value: function removeMessageOnError() {
10631
10670
  var e = this.messageElementRefs[this.messageElementRefs.length - 1],
10632
10671
  t = e == null ? void 0 : e.bubbleElement;
10633
- (t != null && t.classList.contains(ge.MESSAGE_CLASS) && t.textContent === "" || Ee.isTemporaryElement(e)) && this.removeLastMessage();
10672
+ (t != null && t.classList.contains(be.MESSAGE_CLASS) && t.textContent === "" || me.isTemporaryElement(e)) && this.removeLastMessage();
10634
10673
  }
10635
10674
  // prettier-ignore
10636
10675
  }, {
@@ -10652,13 +10691,13 @@ var Ee = /*#__PURE__*/function (_Be) {
10652
10691
  key: "getPermittedMessage",
10653
10692
  value: function getPermittedMessage(e) {
10654
10693
  if (e) {
10655
- var t = Ee.extractErrorMessages(e);
10694
+ var t = me.extractErrorMessages(e);
10656
10695
  for (var _i13 = 0; _i13 < t.length; _i13 += 1) {
10657
10696
  var s = t[_i13];
10658
10697
  if (typeof s == "string") {
10659
10698
  if (this._displayServiceErrorMessages) return s;
10660
10699
  if (this._permittedErrorPrefixes) {
10661
- var r = Ee.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, s);
10700
+ var r = me.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, s);
10662
10701
  if (r) return r;
10663
10702
  }
10664
10703
  }
@@ -10675,9 +10714,9 @@ var Ee = /*#__PURE__*/function (_Be) {
10675
10714
  value: function addDefaultLoadingMessage() {
10676
10715
  var e = this.createMessageElements("", b.AI_ROLE),
10677
10716
  t = e.bubbleElement;
10678
- e.bubbleElement.classList.add(ke.DOTS_CONTAINER_CLASS);
10717
+ e.bubbleElement.classList.add(Ae.DOTS_CONTAINER_CLASS);
10679
10718
  var i = document.createElement("div");
10680
- return i.classList.add("loading-message-dots"), t.appendChild(i), ke.setDots(t, this.messageStyles), e;
10719
+ return i.classList.add("loading-message-dots"), t.appendChild(i), Ae.setDots(t, this.messageStyles), e;
10681
10720
  }
10682
10721
  }, {
10683
10722
  key: "addLoadingMessage",
@@ -10685,8 +10724,8 @@ var Ee = /*#__PURE__*/function (_Be) {
10685
10724
  var i, s, r, o, a, l;
10686
10725
  if (!this._displayLoadingMessage) return;
10687
10726
  var e = (r = (s = (i = this.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.message) == null ? void 0 : r.html,
10688
- t = e ? Re.createElements(this, e, b.AI_ROLE, !1) : this.addDefaultLoadingMessage();
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);
10727
+ t = e ? Fe.createElements(this, e, b.AI_ROLE, !1) : this.addDefaultLoadingMessage();
10728
+ this.elementRef.appendChild(t.outerContainer), t.bubbleElement.classList.add(Ae.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);
10690
10729
  }
10691
10730
  }, {
10692
10731
  key: "populateIntroPanel",
@@ -10703,7 +10742,7 @@ var Ee = /*#__PURE__*/function (_Be) {
10703
10742
  return _context112.abrupt("return", Promise.all((e || []).map(function (t) {
10704
10743
  return new Promise(function (i) {
10705
10744
  if (!t.type || t.type === "any") {
10706
- var s = t.file.name || B.DEFAULT_FILE_NAME;
10745
+ var s = t.file.name || U.DEFAULT_FILE_NAME;
10707
10746
  i({
10708
10747
  name: s,
10709
10748
  type: "any",
@@ -10737,20 +10776,26 @@ var Ee = /*#__PURE__*/function (_Be) {
10737
10776
  value:
10738
10777
  // WORK - update all message classes to use deep-chat prefix
10739
10778
  function clearMessages(e, t) {
10740
- var r, o;
10779
+ var _this$messageToElemen;
10780
+ var o, a;
10741
10781
  var i = [],
10742
10782
  s = [];
10743
- this.messageElementRefs.forEach(function (a) {
10744
- var l = a.bubbleElement.classList;
10745
- Ee.isActiveElement(l) ? i.push(a) : a.outerContainer.remove();
10746
- }), this.textElementsToText.forEach(function (a) {
10747
- var l = a[0].bubbleElement.classList;
10748
- Ee.isActiveElement(l) && s.push(a);
10749
- }), Array.from(this.elementRef.children).forEach(function (a) {
10750
- var c;
10751
- var l = (c = a.children[0]) == null ? void 0 : c.children[0];
10752
- l != null && l.classList.contains("error-message-text") && a.remove();
10753
- }), this.messageElementRefs = i, this.messages.splice(0, this.messages.length), t !== !1 && ((r = this._introPanel) != null && r._elementRef && this._introPanel.display(), this.addIntroductoryMessages()), this.textElementsToText = s, (o = this._onClearMessages) == null || o.call(this), delete e.sessionId;
10783
+ this.messageElementRefs.forEach(function (l) {
10784
+ me.isActiveElement(l.bubbleElement.classList) ? i.push(l) : l.outerContainer.remove();
10785
+ }), this.textElementsToText.forEach(function (l) {
10786
+ var c = l[0].bubbleElement.classList;
10787
+ me.isActiveElement(c) && s.push(l);
10788
+ }), Array.from(this.elementRef.children).forEach(function (l) {
10789
+ var d;
10790
+ var c = (d = l.children[0]) == null ? void 0 : d.children[0];
10791
+ c != null && c.classList.contains("error-message-text") && l.remove();
10792
+ }), this.messageElementRefs = i;
10793
+ var r = this.messageToElements.filter(function (l) {
10794
+ return l[0].text !== void 0 || l[0].html !== void 0 ? l[1].find(function (c) {
10795
+ return me.isActiveElement(c.bubbleElement.classList);
10796
+ }) : !1;
10797
+ });
10798
+ (_this$messageToElemen = this.messageToElements).splice.apply(_this$messageToElemen, [0, this.messageToElements.length].concat(_toConsumableArray(r))), t !== !1 && ((o = this._introPanel) != null && o._elementRef && this._introPanel.display(), this.addIntroductoryMessages()), this.textElementsToText = s, (a = this._onClearMessages) == null || a.call(this), delete e.sessionId;
10754
10799
  }
10755
10800
  }], [{
10756
10801
  key: "getDisplayLoadingMessage",
@@ -10771,15 +10816,15 @@ var Ee = /*#__PURE__*/function (_Be) {
10771
10816
  }, {
10772
10817
  key: "isActiveElement",
10773
10818
  value: function isActiveElement(e) {
10774
- return e.contains(ke.BUBBLE_CLASS) || e.contains(Qe.CLASS) || e.contains(ge.MESSAGE_CLASS);
10819
+ return e.contains(Ae.BUBBLE_CLASS) || e.contains(Ye.CLASS) || e.contains(be.MESSAGE_CLASS);
10775
10820
  }
10776
10821
  }]);
10777
- }(Be);
10778
- var N = /*#__PURE__*/function () {
10779
- function N() {
10780
- _classCallCheck(this, N);
10822
+ }(De);
10823
+ var D = /*#__PURE__*/function () {
10824
+ function D() {
10825
+ _classCallCheck(this, D);
10781
10826
  }
10782
- return _createClass(N, null, [{
10827
+ return _createClass(D, null, [{
10783
10828
  key: "adjustInputPadding",
10784
10829
  value: function adjustInputPadding(e, t) {
10785
10830
  t["inside-left"].length > 0 && e.classList.add("text-input-inner-left-adjustment"), t["inside-right"].length > 0 && e.classList.add("text-input-inner-right-adjustment");
@@ -10787,7 +10832,7 @@ var N = /*#__PURE__*/function () {
10787
10832
  }, {
10788
10833
  key: "adjustForOutsideButton",
10789
10834
  value: function adjustForOutsideButton(e, t, i) {
10790
- i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(N.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(N.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : i["outside-left"].length === 0 && i["outside-right"].length > 0 && (e[3].classList.add(N.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(N.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
10835
+ i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(D.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(D.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : i["outside-left"].length === 0 && i["outside-right"].length > 0 && (e[3].classList.add(D.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(D.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
10791
10836
  }
10792
10837
  // when submit is the only button
10793
10838
  // when submit button is outside by itself - we increase the height for a better look
@@ -10795,10 +10840,10 @@ var N = /*#__PURE__*/function () {
10795
10840
  key: "adjustOutsideSubmit",
10796
10841
  value: function adjustOutsideSubmit(e, t, i) {
10797
10842
  if (!(i["inside-left"].length > 0 || i["inside-right"].length > 0)) {
10798
- if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(N.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(N.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), i["outside-left"].map(function (s) {
10843
+ if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(D.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(D.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), i["outside-left"].map(function (s) {
10799
10844
  return s.button.elementRef.classList.add("submit-button-enlarged");
10800
10845
  });
10801
- if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(N.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(N.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), i["outside-right"].map(function (s) {
10846
+ if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(D.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(D.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), i["outside-right"].map(function (s) {
10802
10847
  return s.button.elementRef.classList.add("submit-button-enlarged");
10803
10848
  });
10804
10849
  }
@@ -10806,12 +10851,12 @@ var N = /*#__PURE__*/function () {
10806
10851
  }, {
10807
10852
  key: "set",
10808
10853
  value: function set(e, t, i, s) {
10809
- !!N.adjustOutsideSubmit(t, i, s) || N.adjustForOutsideButton(t, i, s), N.adjustInputPadding(e, s);
10854
+ !!D.adjustOutsideSubmit(t, i, s) || D.adjustForOutsideButton(t, i, s), D.adjustInputPadding(e, s);
10810
10855
  }
10811
10856
  }]);
10812
10857
  }();
10813
- N.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment", N.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment", N.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS = "text-input-container-left-small-adjustment", N.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS = "text-input-container-right-small-adjustment";
10814
- var ys = N;
10858
+ D.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment", D.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment", D.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS = "text-input-container-left-small-adjustment", D.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS = "text-input-container-right-small-adjustment";
10859
+ var ys = D;
10815
10860
  var _t = /*#__PURE__*/function () {
10816
10861
  function _t() {
10817
10862
  _classCallCheck(this, _t);
@@ -10997,14 +11042,14 @@ var zt = /*#__PURE__*/function () {
10997
11042
  }
10998
11043
  }]);
10999
11044
  }();
11000
- var qe = /*#__PURE__*/function () {
11001
- function qe() {
11002
- _classCallCheck(this, qe);
11045
+ var He = /*#__PURE__*/function () {
11046
+ function He() {
11047
+ _classCallCheck(this, He);
11003
11048
  }
11004
- return _createClass(qe, null, [{
11049
+ return _createClass(He, null, [{
11005
11050
  key: "addItemEvents",
11006
11051
  value: function addItemEvents(e, t, i, s) {
11007
- Ze.add(t, s), t.addEventListener("click", function () {
11052
+ Je.add(t, s), t.addEventListener("click", function () {
11008
11053
  i.click();
11009
11054
  }), t.addEventListener("mouseenter", function (r) {
11010
11055
  e.highlightedItem = r.target;
@@ -11028,7 +11073,7 @@ var qe = /*#__PURE__*/function () {
11028
11073
  key: "populateItem",
11029
11074
  value: function populateItem(e, t, i, s) {
11030
11075
  var r = e.children[0];
11031
- r.classList.contains("text-button") ? t.appendChild(qe.createItemText(r.textContent, s == null ? void 0 : s.text)) : (t.appendChild(qe.createItemIcon(e, s == null ? void 0 : s.iconContainer)), t.appendChild(qe.createItemText(i, s == null ? void 0 : s.text)));
11076
+ r.classList.contains("text-button") ? t.appendChild(He.createItemText(r.textContent, s == null ? void 0 : s.text)) : (t.appendChild(He.createItemIcon(e, s == null ? void 0 : s.iconContainer)), t.appendChild(He.createItemText(i, s == null ? void 0 : s.text)));
11032
11077
  }
11033
11078
  // prettier-ignore
11034
11079
  }, {
@@ -11038,13 +11083,13 @@ var qe = /*#__PURE__*/function () {
11038
11083
  var s = t.elementRef,
11039
11084
  r = t.dropupText,
11040
11085
  o = document.createElement("div");
11041
- Object.assign(o.style, (l = i == null ? void 0 : i.item) == null ? void 0 : l["default"]), qe.populateItem(s, o, r, i), o.classList.add("dropup-menu-item");
11086
+ Object.assign(o.style, (l = i == null ? void 0 : i.item) == null ? void 0 : l["default"]), He.populateItem(s, o, r, i), o.classList.add("dropup-menu-item");
11042
11087
  var a = R.processStateful((i == null ? void 0 : i.item) || {}, {
11043
11088
  backgroundColor: "#f3f3f3"
11044
11089
  }, {
11045
11090
  backgroundColor: "#ebebeb"
11046
11091
  });
11047
- return qe.addItemEvents(e, o, s, a), o;
11092
+ return He.addItemEvents(e, o, s, a), o;
11048
11093
  }
11049
11094
  }]);
11050
11095
  }();
@@ -11075,7 +11120,7 @@ var ks = /*#__PURE__*/function () {
11075
11120
  }, {
11076
11121
  key: "addItem",
11077
11122
  value: function addItem(e) {
11078
- var t = qe.createItem(this, e, this._styles);
11123
+ var t = He.createItem(this, e, this._styles);
11079
11124
  this.elementRef.appendChild(t);
11080
11125
  }
11081
11126
  // prettier-ignore
@@ -11095,7 +11140,7 @@ var ks = /*#__PURE__*/function () {
11095
11140
  key: "windowKeyDown",
11096
11141
  value: function windowKeyDown(e, t) {
11097
11142
  var i, s, r;
11098
- !e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key === O.ESCAPE ? (this.close(), (i = this.highlightedItem) == null || i.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === O.ENTER ? ((s = this.highlightedItem) == null || s.click(), (r = this.highlightedItem) == null || r.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === O.ARROW_DOWN ? zt.focusSiblingItem(this.highlightedItem || this.elementRef.children[this.elementRef.children.length - 1], this.elementRef, !0) : t.key === O.ARROW_UP && zt.focusSiblingItem(this.highlightedItem || this.elementRef.children[0], this.elementRef, !1));
11143
+ !e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key === N.ESCAPE ? (this.close(), (i = this.highlightedItem) == null || i.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === N.ENTER ? ((s = this.highlightedItem) == null || s.click(), (r = this.highlightedItem) == null || r.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === N.ARROW_DOWN ? zt.focusSiblingItem(this.highlightedItem || this.elementRef.children[this.elementRef.children.length - 1], this.elementRef, !0) : t.key === N.ARROW_UP && zt.focusSiblingItem(this.highlightedItem || this.elementRef.children[0], this.elementRef, !1));
11099
11144
  }
11100
11145
  }], [{
11101
11146
  key: "createElement",
@@ -11354,26 +11399,26 @@ var wn = {},
11354
11399
  Ni = {},
11355
11400
  Di = {},
11356
11401
  Yt = {},
11357
- ot = {};
11358
- Object.defineProperty(ot, "__esModule", {
11402
+ rt = {};
11403
+ Object.defineProperty(rt, "__esModule", {
11359
11404
  value: !0
11360
11405
  });
11361
- ot.Text = void 0;
11362
- var Ue = /*#__PURE__*/function () {
11363
- function Ue() {
11364
- _classCallCheck(this, Ue);
11406
+ rt.Text = void 0;
11407
+ var Be = /*#__PURE__*/function () {
11408
+ function Be() {
11409
+ _classCallCheck(this, Be);
11365
11410
  }
11366
- return _createClass(Ue, null, [{
11411
+ return _createClass(Be, null, [{
11367
11412
  key: "capitalize",
11368
11413
  value: function capitalize(e) {
11369
- return e.replace(Ue.FIRST_CHAR_REGEX, function (t) {
11414
+ return e.replace(Be.FIRST_CHAR_REGEX, function (t) {
11370
11415
  return t.toUpperCase();
11371
11416
  });
11372
11417
  }
11373
11418
  }, {
11374
11419
  key: "lineBreak",
11375
11420
  value: function lineBreak(e) {
11376
- return e.replace(Ue.DOUBLE_LINE, "<p></p>").replace(Ue.ONE_LINE, "<br>");
11421
+ return e.replace(Be.DOUBLE_LINE, "<p></p>").replace(Be.ONE_LINE, "<br>");
11377
11422
  }
11378
11423
  }, {
11379
11424
  key: "isCharDefined",
@@ -11388,15 +11433,15 @@ var Ue = /*#__PURE__*/function () {
11388
11433
  }
11389
11434
  }]);
11390
11435
  }();
11391
- ot.Text = Ue;
11392
- Ue.FIRST_CHAR_REGEX = /\S/;
11393
- Ue.DOUBLE_LINE = /\n\n/g;
11394
- Ue.ONE_LINE = /\n/g;
11436
+ rt.Text = Be;
11437
+ Be.FIRST_CHAR_REGEX = /\S/;
11438
+ Be.DOUBLE_LINE = /\n\n/g;
11439
+ Be.ONE_LINE = /\n/g;
11395
11440
  Object.defineProperty(Yt, "__esModule", {
11396
11441
  value: !0
11397
11442
  });
11398
11443
  Yt.Translate = void 0;
11399
- var Qo = ot;
11444
+ var Qo = rt;
11400
11445
  var ea = /*#__PURE__*/function () {
11401
11446
  function ea() {
11402
11447
  _classCallCheck(this, ea);
@@ -11576,11 +11621,11 @@ var Ms = /*#__PURE__*/function () {
11576
11621
  }]);
11577
11622
  }();
11578
11623
  ti.AutoScroll = Ms;
11579
- var at = {};
11580
- Object.defineProperty(at, "__esModule", {
11624
+ var ot = {};
11625
+ Object.defineProperty(ot, "__esModule", {
11581
11626
  value: !0
11582
11627
  });
11583
- at.Elements = void 0;
11628
+ ot.Elements = void 0;
11584
11629
  var sa = /*#__PURE__*/function () {
11585
11630
  function sa() {
11586
11631
  _classCallCheck(this, sa);
@@ -11627,12 +11672,12 @@ var sa = /*#__PURE__*/function () {
11627
11672
  }
11628
11673
  }]);
11629
11674
  }();
11630
- at.Elements = sa;
11631
- var lt = {};
11632
- Object.defineProperty(lt, "__esModule", {
11675
+ ot.Elements = sa;
11676
+ var at = {};
11677
+ Object.defineProperty(at, "__esModule", {
11633
11678
  value: !0
11634
11679
  });
11635
- lt.Cursor = void 0;
11680
+ at.Cursor = void 0;
11636
11681
  var Lt = /*#__PURE__*/function () {
11637
11682
  function Lt() {
11638
11683
  _classCallCheck(this, Lt);
@@ -11713,16 +11758,16 @@ var Lt = /*#__PURE__*/function () {
11713
11758
  }
11714
11759
  }]);
11715
11760
  }();
11716
- lt.Cursor = Lt;
11761
+ at.Cursor = Lt;
11717
11762
  Object.defineProperty(ei, "__esModule", {
11718
11763
  value: !0
11719
11764
  });
11720
11765
  ei.CommandUtils = void 0;
11721
11766
  var Xs = ti,
11722
- na = at,
11767
+ na = ot,
11723
11768
  ra = wt,
11724
- Ys = lt,
11725
- Qs = ot;
11769
+ Ys = at,
11770
+ Qs = rt;
11726
11771
  var ne = /*#__PURE__*/function () {
11727
11772
  function ne() {
11728
11773
  _classCallCheck(this, ne);
@@ -11823,8 +11868,8 @@ Object.defineProperty(Ui, "__esModule", {
11823
11868
  value: !0
11824
11869
  });
11825
11870
  Ui.Highlight = void 0;
11826
- var oa = at,
11827
- Ct = lt;
11871
+ var oa = ot,
11872
+ Ct = at;
11828
11873
  var _i = /*#__PURE__*/function () {
11829
11874
  function _i() {
11830
11875
  _classCallCheck(this, _i);
@@ -11879,9 +11924,9 @@ Object.defineProperty(ji, "__esModule", {
11879
11924
  value: !0
11880
11925
  });
11881
11926
  ji.Padding = void 0;
11882
- var aa = at,
11883
- en = lt,
11884
- dt = ot;
11927
+ var aa = ot,
11928
+ en = at,
11929
+ ct = rt;
11885
11930
  var wi = /*#__PURE__*/function () {
11886
11931
  function wi() {
11887
11932
  _classCallCheck(this, wi);
@@ -11894,11 +11939,11 @@ var wi = /*#__PURE__*/function () {
11894
11939
  r = t.value[s - 1],
11895
11940
  o = t.selectionEnd === null ? s : t.selectionEnd,
11896
11941
  a = t.value[o];
11897
- dt.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), dt.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
11942
+ ct.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), ct.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
11898
11943
  return;
11899
11944
  }
11900
11945
  var i = t.value[t.value.length - 1];
11901
- dt.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
11946
+ ct.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
11902
11947
  }
11903
11948
  }, {
11904
11949
  key: "setStateForGenericElement",
@@ -11911,12 +11956,12 @@ var wi = /*#__PURE__*/function () {
11911
11956
  c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
11912
11957
  d = en.Cursor.getGenericElementCursorOffset(t, a, !1),
11913
11958
  h = (s = t.textContent) === null || s === void 0 ? void 0 : s[d];
11914
- dt.Text.isCharDefined(c) && (e.startPadding = " "), dt.Text.isCharDefined(h) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
11959
+ ct.Text.isCharDefined(c) && (e.startPadding = " "), ct.Text.isCharDefined(h) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
11915
11960
  return;
11916
11961
  }
11917
11962
  }
11918
11963
  var o = t.innerText.charAt(t.innerText.length - 1);
11919
- dt.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
11964
+ ct.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
11920
11965
  }
11921
11966
  }, {
11922
11967
  key: "setState",
@@ -11949,11 +11994,11 @@ var tn = Fi,
11949
11994
  sn = ei,
11950
11995
  oi = ti,
11951
11996
  Yi = Ui,
11952
- pe = at,
11997
+ pe = ot,
11953
11998
  Qi = ji,
11954
11999
  nn = wt,
11955
- rn = lt,
11956
- es = ot;
12000
+ rn = at,
12001
+ es = rt;
11957
12002
  var ca = /*#__PURE__*/function () {
11958
12003
  function ca() {
11959
12004
  _classCallCheck(this, ca);
@@ -12496,21 +12541,21 @@ var hn = Ni,
12496
12541
  ma = ei,
12497
12542
  ce = Hi,
12498
12543
  ga = qi;
12499
- var ht = /*#__PURE__*/function () {
12500
- function ht() {
12501
- _classCallCheck(this, ht);
12544
+ var dt = /*#__PURE__*/function () {
12545
+ function dt() {
12546
+ _classCallCheck(this, dt);
12502
12547
  }
12503
- return _createClass(ht, null, [{
12548
+ return _createClass(dt, null, [{
12504
12549
  key: "toggle",
12505
12550
  value: function toggle(e, t) {
12506
12551
  var i, s;
12507
12552
  var r = e.toLocaleLowerCase().trim();
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'"));
12553
+ !((i = ce.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? dt.startWebSpeech(t) : r === "azure" ? dt.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'"));
12509
12554
  }
12510
12555
  }, {
12511
12556
  key: "startWebSpeech",
12512
12557
  value: function startWebSpeech(e) {
12513
- ht.stop() || (ce.GlobalState.service = new hn.WebSpeech(), ce.GlobalState.service.start(e));
12558
+ dt.stop() || (ce.GlobalState.service = new hn.WebSpeech(), ce.GlobalState.service.start(e));
12514
12559
  }
12515
12560
  }, {
12516
12561
  key: "isWebSpeechSupported",
@@ -12521,7 +12566,7 @@ var ht = /*#__PURE__*/function () {
12521
12566
  key: "startAzure",
12522
12567
  value: function startAzure(e) {
12523
12568
  var t;
12524
- ht.stop() || !((t = ce.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (ce.GlobalState.service = new ga.Azure(), ce.GlobalState.service.start(e));
12569
+ dt.stop() || !((t = ce.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (ce.GlobalState.service = new ga.Azure(), ce.GlobalState.service.start(e));
12525
12570
  }
12526
12571
  }, {
12527
12572
  key: "stop",
@@ -12536,7 +12581,7 @@ var ht = /*#__PURE__*/function () {
12536
12581
  }
12537
12582
  }]);
12538
12583
  }();
12539
- var ai = wn["default"] = ht;
12584
+ var ai = wn["default"] = dt;
12540
12585
  var ba = /*#__PURE__*/function () {
12541
12586
  function ba(e, t) {
12542
12587
  _classCallCheck(this, ba);
@@ -12682,32 +12727,32 @@ var Ft = /*#__PURE__*/function (_Gt) {
12682
12727
  }(Gt);
12683
12728
  Ft.MICROPHONE_RESET_TIMEOUT_MS = 300;
12684
12729
  var $t = Ft;
12685
- var Ae = /*#__PURE__*/function () {
12730
+ var Ce = /*#__PURE__*/function () {
12686
12731
  // prettier-ignore
12687
- function Ae(e, t, i, s) {
12732
+ function Ce(e, t, i, s) {
12688
12733
  var _this65 = this;
12689
- _classCallCheck(this, Ae);
12734
+ _classCallCheck(this, Ce);
12690
12735
  this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = s, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
12691
12736
  _this65._validationHandler = e._validationHandler;
12692
12737
  });
12693
12738
  }
12694
- return _createClass(Ae, [{
12739
+ return _createClass(Ce, [{
12695
12740
  key: "attemptAddFile",
12696
12741
  value: function attemptAddFile(e, t) {
12697
- return Ae.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
12742
+ return Ce.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
12698
12743
  }
12699
12744
  }, {
12700
12745
  key: "addAttachmentBasedOnType",
12701
12746
  value: function addAttachmentBasedOnType(e, t, i) {
12702
- var s = Ae.getTypeFromBlob(e);
12747
+ var s = Ce.getTypeFromBlob(e);
12703
12748
  if (s === "image") {
12704
- var r = Ae.createImageAttachment(t);
12749
+ var r = Ce.createImageAttachment(t);
12705
12750
  this.addFileAttachment(e, "image", r, i);
12706
12751
  } else if (s === "audio") {
12707
12752
  var _r3 = Wt.createAudioAttachment(t);
12708
12753
  this.addFileAttachment(e, "audio", _r3, i);
12709
12754
  } else {
12710
- var _r4 = Ae.createAnyFileAttachment(e.name);
12755
+ var _r4 = Ce.createAnyFileAttachment(e.name);
12711
12756
  this.addFileAttachment(e, "any", _r4, i);
12712
12757
  }
12713
12758
  }
@@ -12715,7 +12760,7 @@ var Ae = /*#__PURE__*/function () {
12715
12760
  key: "addFileAttachment",
12716
12761
  value: function addFileAttachment(e, t, i, s) {
12717
12762
  var a;
12718
- var r = Ae.createContainer(i);
12763
+ var r = Ce.createContainer(i);
12719
12764
  if (this._attachments.length >= this._fileCountLimit) {
12720
12765
  var l = this._attachments[this._attachments.length - 1].removeButton;
12721
12766
  l == null || l.click();
@@ -12817,19 +12862,19 @@ var Ae = /*#__PURE__*/function () {
12817
12862
  }();
12818
12863
  var va = "<?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 <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
12819
12864
  un = "<?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<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
12820
- we = /*#__PURE__*/function (_Ae) {
12865
+ _e = /*#__PURE__*/function (_Ce) {
12821
12866
  // prettier-ignore
12822
- function we(e, t, i, s) {
12823
- _classCallCheck(this, we);
12824
- return _callSuper(this, we, [e, t, i, s]);
12867
+ function _e(e, t, i, s) {
12868
+ _classCallCheck(this, _e);
12869
+ return _callSuper(this, _e, [e, t, i, s]);
12825
12870
  }
12826
- _inherits(we, _Ae);
12827
- return _createClass(we, [{
12871
+ _inherits(_e, _Ce);
12872
+ return _createClass(_e, [{
12828
12873
  key: "createTimer",
12829
12874
  value: function createTimer(e, t) {
12830
12875
  var _this66 = this;
12831
12876
  var i = 0;
12832
- var s = t !== void 0 && t < we.TIMER_LIMIT_S ? t : we.TIMER_LIMIT_S;
12877
+ var s = t !== void 0 && t < _e.TIMER_LIMIT_S ? t : _e.TIMER_LIMIT_S;
12833
12878
  return setInterval(function () {
12834
12879
  var a;
12835
12880
  i += 1, i === s && ((a = _this66.stopPlaceholderCallback) == null || a.call(_this66), _this66.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
@@ -12841,7 +12886,7 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
12841
12886
  }, {
12842
12887
  key: "createPlaceholderAudioAttachment",
12843
12888
  value: function createPlaceholderAudioAttachment(e) {
12844
- var t = we.createAudioContainer(),
12889
+ var t = _e.createAudioContainer(),
12845
12890
  i = document.createElement("div");
12846
12891
  i.classList.add("audio-placeholder-text-3-digits");
12847
12892
  var s = document.createElement("div");
@@ -12878,7 +12923,7 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
12878
12923
  key: "completePlaceholderAttachment",
12879
12924
  value: function completePlaceholderAttachment(e, t) {
12880
12925
  var i = this._activePlaceholderAttachment;
12881
- i && (i.file = e, we.addAudioElements(i.attachmentContainerElement.children[0], t), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
12926
+ i && (i.file = e, _e.addAudioElements(i.attachmentContainerElement.children[0], t), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
12882
12927
  }
12883
12928
  }, {
12884
12929
  key: "removePlaceholderAttachment",
@@ -12918,8 +12963,8 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
12918
12963
  }, {
12919
12964
  key: "createAudioAttachment",
12920
12965
  value: function createAudioAttachment(e) {
12921
- var t = we.createAudioContainer();
12922
- return we.addAudioElements(t, e), t;
12966
+ var t = _e.createAudioContainer();
12967
+ return _e.addAudioElements(t, e), t;
12923
12968
  }
12924
12969
  }, {
12925
12970
  key: "stopAttachmentPlayback",
@@ -12928,9 +12973,9 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
12928
12973
  (s = (i = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : i[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
12929
12974
  }
12930
12975
  }]);
12931
- }(Ae);
12932
- we.TIMER_LIMIT_S = 5999;
12933
- var Wt = we;
12976
+ }(Ce);
12977
+ _e.TIMER_LIMIT_S = 5999;
12978
+ var Wt = _e;
12934
12979
  var ya = /*#__PURE__*/function () {
12935
12980
  function ya() {
12936
12981
  _classCallCheck(this, ya);
@@ -12940,7 +12985,7 @@ var ya = /*#__PURE__*/function () {
12940
12985
  value:
12941
12986
  // prettier-ignore
12942
12987
  function create(e, t, i, s, r) {
12943
- return r === "audio" ? new Wt(e, t, i, s) : new Ae(e, t, i, s);
12988
+ return r === "audio" ? new Wt(e, t, i, s) : new Ce(e, t, i, s);
12944
12989
  }
12945
12990
  }]);
12946
12991
  }();
@@ -12986,7 +13031,7 @@ var ii = /*#__PURE__*/function () {
12986
13031
  case 0:
12987
13032
  _context118.next = 2;
12988
13033
  return Promise.all(this._fileAttachmentsTypes.map(/*#__PURE__*/function () {
12989
- var _ref18 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee117(e) {
13034
+ var _ref28 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee117(e) {
12990
13035
  var t;
12991
13036
  return _regeneratorRuntime().wrap(function _callee117$(_context117) {
12992
13037
  while (1) switch (_context117.prev = _context117.next) {
@@ -12999,7 +13044,7 @@ var ii = /*#__PURE__*/function () {
12999
13044
  }, _callee117);
13000
13045
  }));
13001
13046
  return function (_x213) {
13002
- return _ref18.apply(this, arguments);
13047
+ return _ref28.apply(this, arguments);
13003
13048
  };
13004
13049
  }()));
13005
13050
  case 2:
@@ -13101,7 +13146,7 @@ var ue = /*#__PURE__*/function () {
13101
13146
  key: "windowKeyDown",
13102
13147
  value: function windowKeyDown(e, t) {
13103
13148
  var i, s;
13104
- !e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key === O.ESCAPE ? (this.close(), (i = this.extensionCloseCallback) == null || i.call(this)) : t.key === O.ENTER && (this.close(), (s = this.extensionCloseCallback) == null || s.call(this)));
13149
+ !e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key === N.ESCAPE ? (this.close(), (i = this.extensionCloseCallback) == null || i.call(this)) : t.key === N.ENTER && (this.close(), (s = this.extensionCloseCallback) == null || s.call(this)));
13105
13150
  }
13106
13151
  }], [{
13107
13152
  key: "createContainer",
@@ -13154,19 +13199,19 @@ var ue = /*#__PURE__*/function () {
13154
13199
  }]);
13155
13200
  }();
13156
13201
  ue.MODAL_CLOSE_TIMEOUT_MS = 190;
13157
- var Xe = ue;
13202
+ var Ze = ue;
13158
13203
  var Pt = /*#__PURE__*/function (_Xt3) {
13159
13204
  // prettier-ignore
13160
13205
  function Pt(e, t, i, s, r, o) {
13161
13206
  var _this71;
13162
13207
  _classCallCheck(this, Pt);
13163
- var h, u, f, m, p, y, x, j, G;
13208
+ var h, u, f, m, p, v, y, P, G;
13164
13209
  var a = (h = i == null ? void 0 : i.button) == null ? void 0 : h.position,
13165
13210
  l = ((m = (f = (u = i == null ? void 0 : i.button) == null ? void 0 : u.styles) == null ? void 0 : f.text) == null ? void 0 : m.content) || o;
13166
13211
  _this71 = _callSuper(this, Pt, [Pt.createButtonElement(), a, i.button, l]);
13167
13212
  var c = a === "dropup-menu",
13168
13213
  d = _this71.createInnerElements(s, r, _this71._customStyles, c);
13169
- _this71._inputElement = Pt.createInputElement((p = i == null ? void 0 : i.files) == null ? void 0 : p.acceptedFormats), _this71.addClickEvent(e, i), _this71.elementRef.replaceChildren(d.styles), _this71.reapplyStateStyle("styles"), _this71._fileAttachmentsType = t, _this71._openModalOnce = ((x = (y = i.files) == null ? void 0 : y.infoModal) == null ? void 0 : x.openModalOnce) === !1 || (G = (j = i.files) == null ? void 0 : j.infoModal) == null ? void 0 : G.openModalOnce;
13214
+ _this71._inputElement = Pt.createInputElement((p = i == null ? void 0 : i.files) == null ? void 0 : p.acceptedFormats), _this71.addClickEvent(e, i), _this71.elementRef.replaceChildren(d.styles), _this71.reapplyStateStyle("styles"), _this71._fileAttachmentsType = t, _this71._openModalOnce = ((y = (v = i.files) == null ? void 0 : v.infoModal) == null ? void 0 : y.openModalOnce) === !1 || (G = (P = i.files) == null ? void 0 : P.infoModal) == null ? void 0 : G.openModalOnce;
13170
13215
  return _this71;
13171
13216
  }
13172
13217
  _inherits(Pt, _Xt3);
@@ -13193,7 +13238,7 @@ var Pt = /*#__PURE__*/function (_Xt3) {
13193
13238
  key: "addClickEvent",
13194
13239
  value: function addClickEvent(e, t) {
13195
13240
  var i = this.triggerImportPrompt.bind(this, this._inputElement),
13196
- s = Xe.createTextModalFunc(e, t, i);
13241
+ s = Ze.createTextModalFunc(e, t, i);
13197
13242
  this.elementRef.onclick = this.click.bind(this, s);
13198
13243
  }
13199
13244
  }, {
@@ -13221,15 +13266,15 @@ var Pt = /*#__PURE__*/function (_Xt3) {
13221
13266
  }
13222
13267
  }]);
13223
13268
  }(Xt);
13224
- var Te = /*#__PURE__*/function () {
13225
- function Te() {
13226
- _classCallCheck(this, Te);
13269
+ var we = /*#__PURE__*/function () {
13270
+ function we() {
13271
+ _classCallCheck(this, we);
13227
13272
  }
13228
- return _createClass(Te, null, [{
13273
+ return _createClass(we, null, [{
13229
13274
  key: "create",
13230
13275
  value: function create(e, t, i) {
13231
- var s = Te.createElement(i);
13232
- Te.addEvents(s, e, t), e.appendChild(s);
13276
+ var s = we.createElement(i);
13277
+ we.addEvents(s, e, t), e.appendChild(s);
13233
13278
  }
13234
13279
  }, {
13235
13280
  key: "createElement",
@@ -13241,13 +13286,13 @@ var Te = /*#__PURE__*/function () {
13241
13286
  key: "addEvents",
13242
13287
  value: function addEvents(e, t, i) {
13243
13288
  t.ondragenter = function (s) {
13244
- s.preventDefault(), Te.display(e);
13289
+ s.preventDefault(), we.display(e);
13245
13290
  }, e.ondragleave = function (s) {
13246
- s.preventDefault(), Te.hide(e);
13291
+ s.preventDefault(), we.hide(e);
13247
13292
  }, e.ondragover = function (s) {
13248
13293
  s.preventDefault();
13249
13294
  }, e.ondrop = function (s) {
13250
- s.preventDefault(), Te.uploadFile(i, s), Te.hide(e);
13295
+ s.preventDefault(), we.uploadFile(i, s), we.hide(e);
13251
13296
  };
13252
13297
  }
13253
13298
  }, {
@@ -13274,11 +13319,11 @@ var Te = /*#__PURE__*/function () {
13274
13319
  }
13275
13320
  }]);
13276
13321
  }();
13277
- var ze = /*#__PURE__*/function () {
13278
- function ze() {
13279
- _classCallCheck(this, ze);
13322
+ var qe = /*#__PURE__*/function () {
13323
+ function qe() {
13324
+ _classCallCheck(this, qe);
13280
13325
  }
13281
- return _createClass(ze, null, [{
13326
+ return _createClass(qe, null, [{
13282
13327
  key: "validate",
13283
13328
  value:
13284
13329
  // prettier-ignore
@@ -13302,7 +13347,7 @@ var ze = /*#__PURE__*/function () {
13302
13347
  o = i.getAllFileData(), a = o == null ? void 0 : o.map(function (l) {
13303
13348
  return l.file;
13304
13349
  });
13305
- return _context119.abrupt("return", ze.validate(e, s, r, a));
13350
+ return _context119.abrupt("return", qe.validate(e, s, r, a));
13306
13351
  case 5:
13307
13352
  case "end":
13308
13353
  return _context119.stop();
@@ -13325,7 +13370,7 @@ var ze = /*#__PURE__*/function () {
13325
13370
  s = (r = t.files) == null ? void 0 : r.map(function (o) {
13326
13371
  return o.file;
13327
13372
  });
13328
- return _context120.abrupt("return", ze.validate(e, i, t.text, s, !0));
13373
+ return _context120.abrupt("return", qe.validate(e, i, t.text, s, !0));
13329
13374
  case 2:
13330
13375
  case "end":
13331
13376
  return _context120.stop();
@@ -13340,7 +13385,7 @@ var ze = /*#__PURE__*/function () {
13340
13385
  }, {
13341
13386
  key: "validateWebsocket",
13342
13387
  value: function validateWebsocket(e, t) {
13343
- return e.websocket && !U.canSendMessage(e.websocket) ? (t.changeToDisabledIcon(), !1) : !0;
13388
+ return e.websocket && !j.canSendMessage(e.websocket) ? (t.changeToDisabledIcon(), !1) : !0;
13344
13389
  }
13345
13390
  // prettier-ignore
13346
13391
  }, {
@@ -13348,19 +13393,19 @@ var ze = /*#__PURE__*/function () {
13348
13393
  value: function attach(e, t, i, s, r) {
13349
13394
  var o = e.validateInput || le.processValidateInput(e);
13350
13395
  e._validationHandler = /*#__PURE__*/function () {
13351
- var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee121(a) {
13396
+ var _ref29 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee121(a) {
13352
13397
  var l;
13353
13398
  return _regeneratorRuntime().wrap(function _callee121$(_context121) {
13354
13399
  while (1) switch (_context121.prev = _context121.next) {
13355
13400
  case 0:
13356
- if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !ze.validateWebsocket(t, r))) {
13401
+ if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !qe.validateWebsocket(t, r))) {
13357
13402
  _context121.next = 2;
13358
13403
  break;
13359
13404
  }
13360
13405
  return _context121.abrupt("return", !1);
13361
13406
  case 2:
13362
13407
  l = o || t.canSendMessage;
13363
- return _context121.abrupt("return", l ? a ? ze.useValidationFuncProgrammatic(l, a, r) : ze.useValidationFunc(l, i, s, r) : null);
13408
+ return _context121.abrupt("return", l ? a ? qe.useValidationFuncProgrammatic(l, a, r) : qe.useValidationFunc(l, i, s, r) : null);
13364
13409
  case 4:
13365
13410
  case "end":
13366
13411
  return _context121.stop();
@@ -13368,7 +13413,7 @@ var ze = /*#__PURE__*/function () {
13368
13413
  }, _callee121);
13369
13414
  }));
13370
13415
  return function (_x221) {
13371
- return _ref19.apply(this, arguments);
13416
+ return _ref29.apply(this, arguments);
13372
13417
  };
13373
13418
  }();
13374
13419
  }
@@ -13487,11 +13532,11 @@ var $ = /*#__PURE__*/function () {
13487
13532
  }
13488
13533
  }]);
13489
13534
  }();
13490
- var Ye = /*#__PURE__*/function () {
13491
- function Ye() {
13492
- _classCallCheck(this, Ye);
13535
+ var Xe = /*#__PURE__*/function () {
13536
+ function Xe() {
13537
+ _classCallCheck(this, Xe);
13493
13538
  }
13494
- return _createClass(Ye, null, [{
13539
+ return _createClass(Xe, null, [{
13495
13540
  key: "resetSubmit",
13496
13541
  value: function resetSubmit(e, t) {
13497
13542
  t ? e.unsetCustomStateStyles(["loading", "submit"]) : e.unsetCustomStateStyles(["stop", "loading", "submit"]), e.reapplyStateStyle("submit");
@@ -13507,13 +13552,13 @@ var Ye = /*#__PURE__*/function () {
13507
13552
  }, {
13508
13553
  key: "setUpDisabledButton",
13509
13554
  value: function setUpDisabledButton(e) {
13510
- $.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), $.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), $.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), $.setPropertyValueIfDoesNotExist(e.disabled, ["svg", "styles", "default", "filter"], "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"), Ye.overwriteDefaultStyleWithSubmit(e, "disabled");
13555
+ $.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), $.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), $.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), $.setPropertyValueIfDoesNotExist(e.disabled, ["svg", "styles", "default", "filter"], "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"), Xe.overwriteDefaultStyleWithSubmit(e, "disabled");
13511
13556
  }
13512
13557
  }, {
13513
13558
  key: "process",
13514
13559
  value: function process(e) {
13515
13560
  var t = JSON.parse(JSON.stringify(e || {}));
13516
- return Ye.overwriteDefaultStyleWithSubmit(t, "loading"), Ye.overwriteDefaultStyleWithSubmit(t, "stop"), e != null && e.alwaysEnabled || Ye.setUpDisabledButton(t), t;
13561
+ return Xe.overwriteDefaultStyleWithSubmit(t, "loading"), Xe.overwriteDefaultStyleWithSubmit(t, "stop"), e != null && e.alwaysEnabled || Xe.setUpDisabledButton(t), t;
13517
13562
  }
13518
13563
  }]);
13519
13564
  }();
@@ -13522,7 +13567,7 @@ var k = /*#__PURE__*/function (_Xt4) {
13522
13567
  function k(e, t, i, s, r, o) {
13523
13568
  var _this76;
13524
13569
  _classCallCheck(this, k);
13525
- var a = Ye.process(e.submitButtonStyles);
13570
+ var a = Xe.process(e.submitButtonStyles);
13526
13571
  _this76 = _callSuper(this, k, [k.createButtonContainerElement(), a == null ? void 0 : a.position, a]), _this76._isSVGLoadingIconOverriden = !1, _this76.status = {
13527
13572
  requestInProgress: !1,
13528
13573
  loadingActive: !1
@@ -13653,7 +13698,7 @@ var k = /*#__PURE__*/function (_Xt4) {
13653
13698
  e.files && (t.files = Array.from(e.files).map(function (i) {
13654
13699
  return {
13655
13700
  file: i,
13656
- type: Ae.getTypeFromBlob(i)
13701
+ type: Ce.getTypeFromBlob(i)
13657
13702
  };
13658
13703
  })), setTimeout(function () {
13659
13704
  return _this78.attemptSubmit(t, !0);
@@ -13725,12 +13770,12 @@ var k = /*#__PURE__*/function (_Xt4) {
13725
13770
  }, {
13726
13771
  key: "addNewMessage",
13727
13772
  value: function () {
13728
- var _addNewMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee125(_ref20) {
13773
+ var _addNewMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee125(_ref30) {
13729
13774
  var e, t, i;
13730
13775
  return _regeneratorRuntime().wrap(function _callee125$(_context125) {
13731
13776
  while (1) switch (_context125.prev = _context125.next) {
13732
13777
  case 0:
13733
- e = _ref20.text, t = _ref20.files;
13778
+ e = _ref30.text, t = _ref30.files;
13734
13779
  i = {
13735
13780
  role: b.USER_ROLE
13736
13781
  };
@@ -13779,7 +13824,7 @@ var k = /*#__PURE__*/function (_Xt4) {
13779
13824
  key: "changeToSubmitIcon",
13780
13825
  value: function changeToSubmitIcon() {
13781
13826
  var _this79 = this;
13782
- this.elementRef.classList.contains(k.SUBMIT_CLASS) || (this.elementRef.classList.remove(k.LOADING_CLASS, k.DISABLED_CLASS), this.elementRef.classList.add(k.SUBMIT_CLASS), this.elementRef.replaceChildren(this._innerElements.submit), Ye.resetSubmit(this, this.status.loadingActive), this.elementRef.onclick = function () {
13827
+ this.elementRef.classList.contains(k.SUBMIT_CLASS) || (this.elementRef.classList.remove(k.LOADING_CLASS, k.DISABLED_CLASS), this.elementRef.classList.add(k.SUBMIT_CLASS), this.elementRef.replaceChildren(this._innerElements.submit), Xe.resetSubmit(this, this.status.loadingActive), this.elementRef.onclick = function () {
13783
13828
  var e;
13784
13829
  _this79.submitFromInput(), (e = _this79._microphoneButton) != null && e.isActive && $t.toggleSpeechAfterSubmit(_this79._microphoneButton.elementRef, !!_this79._stopSTTAfterSubmit);
13785
13830
  });
@@ -13829,7 +13874,7 @@ var Sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
13829
13874
  _a = "<?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 <title>capture</title>\n <path d=\"M0 16q0 3.264 1.28 6.208t3.392 5.12 5.12 3.424 6.208 1.248 6.208-1.248 5.12-3.424 3.392-5.12 1.28-6.208-1.28-6.208-3.392-5.12-5.088-3.392-6.24-1.28q-3.264 0-6.208 1.28t-5.12 3.392-3.392 5.12-1.28 6.208zM4 16q0-3.264 1.6-6.016t4.384-4.352 6.016-1.632 6.016 1.632 4.384 4.352 1.6 6.016-1.6 6.048-4.384 4.352-6.016 1.6-6.016-1.6-4.384-4.352-1.6-6.048z\"></path>\n</svg>\n",
13830
13875
  wa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z\"/>\n</svg>",
13831
13876
  Ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M4.89163 13.2687L9.16582 17.5427L18.7085 8\" stroke=\"#000000\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>";
13832
- var Rs = /*#__PURE__*/function (_Xe) {
13877
+ var Rs = /*#__PURE__*/function (_Ze) {
13833
13878
  // prettier-ignore
13834
13879
  function Rs(e, t, i, s) {
13835
13880
  var _this80;
@@ -13841,15 +13886,15 @@ var Rs = /*#__PURE__*/function (_Xe) {
13841
13886
  _this80._captureButton = r, _this80._submitButton = o, _this80._captureIcon = _this80._captureButton.children[0], _this80._refreshIcon = ie.createSVGElement(Sa), _this80._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (s == null ? void 0 : s.format) === "jpeg" && (_this80._format = "image/jpeg"), s != null && s.dimensions && (_this80._dimensions = s.dimensions), _this80._contentRef.appendChild(_this80._canvas), _this80.extensionCloseCallback = _this80.stop;
13842
13887
  return _this80;
13843
13888
  }
13844
- _inherits(Rs, _Xe);
13889
+ _inherits(Rs, _Ze);
13845
13890
  return _createClass(Rs, [{
13846
13891
  key: "addButtonsAndTheirEvents",
13847
13892
  value: function addButtonsAndTheirEvents(e) {
13848
- var t = Xe.createSVGButton(_a);
13893
+ var t = Ze.createSVGButton(_a);
13849
13894
  t.classList.add("modal-svg-camera-button"), t.children[0].classList.add("modal-svg-camera-icon");
13850
13895
  var i = this.addCloseButton(wa, !0);
13851
13896
  i.classList.add("modal-svg-close-button"), i.children[0].classList.add("modal-svg-close-icon");
13852
- var s = Xe.createSVGButton(Ta);
13897
+ var s = Ze.createSVGButton(Ta);
13853
13898
  return s.classList.add("modal-svg-submit-button"), this.addButtons(t, s), this.addButtonEvents(t, i, s, e), {
13854
13899
  captureButton: t,
13855
13900
  submitButton: s
@@ -13877,7 +13922,7 @@ var Rs = /*#__PURE__*/function (_Xe) {
13877
13922
  _this82._captureButton.replaceChildren(_this82._captureIcon), _this82._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
13878
13923
  var e = _this82._canvas.getContext("2d");
13879
13924
  e == null || e.clearRect(0, 0, _this82._canvas.width, _this82._canvas.height);
13880
- }, Xe.MODAL_CLOSE_TIMEOUT_MS);
13925
+ }, Ze.MODAL_CLOSE_TIMEOUT_MS);
13881
13926
  }
13882
13927
  }, {
13883
13928
  key: "start",
@@ -13941,7 +13986,7 @@ var Rs = /*#__PURE__*/function (_Xe) {
13941
13986
  return r.openCameraModal.bind(r, r);
13942
13987
  }
13943
13988
  }]);
13944
- }(Xe);
13989
+ }(Ze);
13945
13990
  var Ca = "<?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=\"M29 7h-4.599l-2.401-4h-12l-2.4 4h-4.6c-1 0-3 1-3 2.969v16.031c0 1.657 1.5 3 2.792 3h26.271c1.313 0 2.938-1.406 2.938-2.968v-16.032c0-1-1-3-3-3zM30 26.032c0 0.395-0.639 0.947-0.937 0.969h-26.265c-0.232-0.019-0.797-0.47-0.797-1v-16.031c0-0.634 0.851-0.953 1-0.969h5.732l2.4-4h9.802l1.785 3.030 0.55 0.97h5.731c0.705 0 0.99 0.921 1 1v16.032zM16 10c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7-3.134-7-7-7zM16 22c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z\"></path>\n</svg>";
13946
13991
  var ki = /*#__PURE__*/function (_Xt5) {
13947
13992
  function ki(e, t, i) {
@@ -13998,7 +14043,7 @@ var Ot = /*#__PURE__*/function () {
13998
14043
  button: new $t(e, a, t.addNewErrorMessage.bind(t))
13999
14044
  });
14000
14045
  var l = new Es(e, a, t, i, o, r);
14001
- a.submit = l.submitFromInput.bind(l), ze.attach(e, i, a, o, l), e.submitUserMessage = l.programmaticSubmit.bind(l), r.submit = {
14046
+ a.submit = l.submitFromInput.bind(l), qe.attach(e, i, a, o, l), e.submitUserMessage = l.programmaticSubmit.bind(l), r.submit = {
14002
14047
  button: l
14003
14048
  }, Ot.addElements(this.elementRef, a, r, s, o, e.dropupStyles);
14004
14049
  }
@@ -14021,7 +14066,7 @@ var Ot = /*#__PURE__*/function () {
14021
14066
  button: new Ea(_d, t.recordAudio)
14022
14067
  };
14023
14068
  }
14024
- return Te.isEnabled(r, e.dragAndDrop) && Te.create(i, r, e.dragAndDrop), r;
14069
+ return we.isEnabled(r, e.dragAndDrop) && we.create(i, r, e.dragAndDrop), r;
14025
14070
  }
14026
14071
  // prettier-ignore
14027
14072
  }], [{
@@ -14070,8 +14115,8 @@ var Is = /*#__PURE__*/function () {
14070
14115
  value: function createElements(e, t, i) {
14071
14116
  var s = document.createElement("div");
14072
14117
  s.id = "chat-view";
14073
- var r = new Ee(e, t, i);
14074
- t.websocket && U.createConnection(t, r);
14118
+ var r = new me(e, t, i);
14119
+ t.websocket && j.createConnection(t, r);
14075
14120
  var o = new Ot(e, r, t, s);
14076
14121
  return J.addElements(s, r.elementRef, o.elementRef), s;
14077
14122
  }
@@ -14089,11 +14134,11 @@ var ka = Object.defineProperty,
14089
14134
  for (var s = void 0, r = n.length - 1, o; r >= 0; r--) (o = n[r]) && (s = o(e, t, s) || s);
14090
14135
  return s && ka(e, t, s), s;
14091
14136
  };
14092
- var E = /*#__PURE__*/function (_ls) {
14093
- function E() {
14137
+ var x = /*#__PURE__*/function (_ls) {
14138
+ function x() {
14094
14139
  var _this85;
14095
- _classCallCheck(this, E);
14096
- _this85 = _callSuper(this, E), _this85.getMessages = function () {
14140
+ _classCallCheck(this, x);
14141
+ _this85 = _callSuper(this, x), _this85.getMessages = function () {
14097
14142
  return [];
14098
14143
  }, _this85.submitUserMessage = function () {
14099
14144
  return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
@@ -14108,8 +14153,8 @@ var E = /*#__PURE__*/function (_ls) {
14108
14153
  }, 20);
14109
14154
  return _this85;
14110
14155
  }
14111
- _inherits(E, _ls);
14112
- return _createClass(E, [{
14156
+ _inherits(x, _ls);
14157
+ return _createClass(x, [{
14113
14158
  key: "changeToChatView",
14114
14159
  value: function changeToChatView() {
14115
14160
  this._activeService && (this._activeService.validateKeyProperty = !1), this.onRender();
@@ -14128,44 +14173,44 @@ var E = /*#__PURE__*/function (_ls) {
14128
14173
  }
14129
14174
  }]);
14130
14175
  }(ls);
14131
- _([S("object")], E.prototype, "connect");
14132
- _([S("object")], E.prototype, "directConnection");
14133
- _([S("object")], E.prototype, "webModel");
14134
- _([S("object")], E.prototype, "requestBodyLimits");
14135
- _([S("function")], E.prototype, "requestInterceptor");
14136
- _([S("function")], E.prototype, "responseInterceptor");
14137
- _([S("function")], E.prototype, "validateInput");
14138
- _([S("function")], E.prototype, "loadHistory");
14139
- _([S("object")], E.prototype, "chatStyle");
14140
- _([S("object")], E.prototype, "attachmentContainerStyle");
14141
- _([S("object")], E.prototype, "dropupStyles");
14142
- _([S("object")], E.prototype, "inputAreaStyle");
14143
- _([S("object")], E.prototype, "textInput");
14144
- _([S("object")], E.prototype, "submitButtonStyles");
14145
- _([S("string")], E.prototype, "auxiliaryStyle");
14146
- _([S("array")], E.prototype, "history");
14147
- _([S("object")], E.prototype, "introMessage");
14148
- _([S("object")], E.prototype, "avatars");
14149
- _([S("object")], E.prototype, "names");
14150
- _([S("boolean")], E.prototype, "displayLoadingBubble");
14151
- _([S("object")], E.prototype, "errorMessages");
14152
- _([S("object")], E.prototype, "messageStyles");
14153
- _([S("object")], E.prototype, "textToSpeech");
14154
- _([S("object")], E.prototype, "speechToText");
14155
- _([S("object")], E.prototype, "images");
14156
- _([S("object")], E.prototype, "gifs");
14157
- _([S("object")], E.prototype, "camera");
14158
- _([S("object")], E.prototype, "audio");
14159
- _([S("object")], E.prototype, "microphone");
14160
- _([S("object")], E.prototype, "mixedFiles");
14161
- _([S("object")], E.prototype, "dragAndDrop");
14162
- _([S("object")], E.prototype, "introPanelStyle");
14163
- _([S("object")], E.prototype, "htmlClassUtilities");
14164
- _([S("function")], E.prototype, "onMessage");
14165
- _([S("function")], E.prototype, "onClearMessages");
14166
- _([S("function")], E.prototype, "onComponentRender");
14167
- _([S("function")], E.prototype, "onError");
14168
- _([S("object")], E.prototype, "demo");
14169
- _([S("object")], E.prototype, "_insertKeyViewStyles");
14170
- customElements.define("deep-chat", E);
14171
- export { E as DeepChat };
14176
+ _([S("object")], x.prototype, "connect");
14177
+ _([S("object")], x.prototype, "directConnection");
14178
+ _([S("object")], x.prototype, "webModel");
14179
+ _([S("object")], x.prototype, "requestBodyLimits");
14180
+ _([S("function")], x.prototype, "requestInterceptor");
14181
+ _([S("function")], x.prototype, "responseInterceptor");
14182
+ _([S("function")], x.prototype, "validateInput");
14183
+ _([S("function")], x.prototype, "loadHistory");
14184
+ _([S("object")], x.prototype, "chatStyle");
14185
+ _([S("object")], x.prototype, "attachmentContainerStyle");
14186
+ _([S("object")], x.prototype, "dropupStyles");
14187
+ _([S("object")], x.prototype, "inputAreaStyle");
14188
+ _([S("object")], x.prototype, "textInput");
14189
+ _([S("object")], x.prototype, "submitButtonStyles");
14190
+ _([S("string")], x.prototype, "auxiliaryStyle");
14191
+ _([S("array")], x.prototype, "history");
14192
+ _([S("object")], x.prototype, "introMessage");
14193
+ _([S("object")], x.prototype, "avatars");
14194
+ _([S("object")], x.prototype, "names");
14195
+ _([S("boolean")], x.prototype, "displayLoadingBubble");
14196
+ _([S("object")], x.prototype, "errorMessages");
14197
+ _([S("object")], x.prototype, "messageStyles");
14198
+ _([S("object")], x.prototype, "textToSpeech");
14199
+ _([S("object")], x.prototype, "speechToText");
14200
+ _([S("object")], x.prototype, "images");
14201
+ _([S("object")], x.prototype, "gifs");
14202
+ _([S("object")], x.prototype, "camera");
14203
+ _([S("object")], x.prototype, "audio");
14204
+ _([S("object")], x.prototype, "microphone");
14205
+ _([S("object")], x.prototype, "mixedFiles");
14206
+ _([S("object")], x.prototype, "dragAndDrop");
14207
+ _([S("object")], x.prototype, "introPanelStyle");
14208
+ _([S("object")], x.prototype, "htmlClassUtilities");
14209
+ _([S("function")], x.prototype, "onMessage");
14210
+ _([S("function")], x.prototype, "onClearMessages");
14211
+ _([S("function")], x.prototype, "onComponentRender");
14212
+ _([S("function")], x.prototype, "onError");
14213
+ _([S("object")], x.prototype, "demo");
14214
+ _([S("object")], x.prototype, "_insertKeyViewStyles");
14215
+ customElements.define("deep-chat", x);
14216
+ export { x as DeepChat };