deep-chat-dev 9.0.197 → 9.0.199
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +2308 -2179
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +745 -711
- package/dist/services/azure/azureOpenAIAssistantIO.d.ts +2 -0
- package/dist/services/azure/azureOpenAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/assistant/openAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/assistant/openAIAssistantIOI.d.ts +4 -2
- package/dist/services/openAI/assistant/openAIAssistantIOI.d.ts.map +1 -1
- package/dist/types/azure.d.ts.map +1 -1
- package/dist/views/chat/messages/html/htmlMessages.d.ts +2 -1
- package/dist/views/chat/messages/html/htmlMessages.d.ts.map +1 -1
- package/dist/views/chat/messages/messageUtils.d.ts +6 -0
- package/dist/views/chat/messages/messageUtils.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/dist/views/chat/messages/messagesBase.d.ts +1 -1
- package/dist/views/chat/messages/messagesBase.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
2
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
4
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
5
1
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n4 = 0, F = function F() {}; return { s: F, n: function n() { return _n4 >= r.length ? { done: !0 } : { done: !1, value: r[_n4++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
6
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
7
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
8
2
|
function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
|
9
3
|
function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
|
10
4
|
function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
|
@@ -18,6 +12,12 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
|
|
18
12
|
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; }
|
19
13
|
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); }
|
20
14
|
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); }); }; }
|
15
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
16
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
17
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
18
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
19
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
20
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
21
21
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
22
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
23
23
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
@@ -67,11 +67,11 @@ var li = /*#__PURE__*/function () {
|
|
67
67
|
}
|
68
68
|
}]);
|
69
69
|
}();
|
70
|
-
var
|
71
|
-
function
|
72
|
-
_classCallCheck(this,
|
70
|
+
var R = /*#__PURE__*/function () {
|
71
|
+
function R() {
|
72
|
+
_classCallCheck(this, R);
|
73
73
|
}
|
74
|
-
return _createClass(
|
74
|
+
return _createClass(R, null, [{
|
75
75
|
key: "unsetStyle",
|
76
76
|
value: function unsetStyle(e, t) {
|
77
77
|
var i = Object.keys(t).reduce(function (s, r) {
|
@@ -82,12 +82,12 @@ var M = /*#__PURE__*/function () {
|
|
82
82
|
}, {
|
83
83
|
key: "unsetActivityCSSMouseStates",
|
84
84
|
value: function unsetActivityCSSMouseStates(e, t) {
|
85
|
-
t.click &&
|
85
|
+
t.click && R.unsetStyle(e, t.click), t.hover && R.unsetStyle(e, t.hover);
|
86
86
|
}
|
87
87
|
}, {
|
88
88
|
key: "unsetAllCSSMouseStates",
|
89
89
|
value: function unsetAllCSSMouseStates(e, t) {
|
90
|
-
|
90
|
+
R.unsetActivityCSSMouseStates(e, t), t["default"] && R.unsetStyle(e, t["default"]);
|
91
91
|
}
|
92
92
|
}, {
|
93
93
|
key: "processStateful",
|
@@ -180,7 +180,7 @@ var ut = /*#__PURE__*/function () {
|
|
180
180
|
}, {
|
181
181
|
key: "applyDefaultStyleToComponent",
|
182
182
|
value: function applyDefaultStyleToComponent(e, t) {
|
183
|
-
t &&
|
183
|
+
t && R.applyToStyleIfNotDefined(e, t), R.applyToStyleIfNotDefined(e, ut.DEFAULT_COMPONENT_STYLE);
|
184
184
|
}
|
185
185
|
}]);
|
186
186
|
}();
|
@@ -203,9 +203,9 @@ var et;
|
|
203
203
|
var xt = (et = /*#__PURE__*/_createClass(function et() {
|
204
204
|
_classCallCheck(this, et);
|
205
205
|
}), et.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), et.IS_CHROMIUM = window.chrome, et);
|
206
|
-
var
|
206
|
+
var O = /* @__PURE__ */function (n) {
|
207
207
|
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
|
-
}(
|
208
|
+
}(O || {});
|
209
209
|
var Ve = /*#__PURE__*/function () {
|
210
210
|
function Ve() {
|
211
211
|
_classCallCheck(this, Ve);
|
@@ -242,7 +242,7 @@ var Ve = /*#__PURE__*/function () {
|
|
242
242
|
}
|
243
243
|
}]);
|
244
244
|
}();
|
245
|
-
Ve.PERMITTED_KEYS = /* @__PURE__ */new Set([
|
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
246
|
var ss = Ve;
|
247
247
|
var An = /*#__PURE__*/function () {
|
248
248
|
function An() {
|
@@ -290,7 +290,7 @@ var $e = /*#__PURE__*/function () {
|
|
290
290
|
key: "removePlaceholderStyle",
|
291
291
|
value: function removePlaceholderStyle() {
|
292
292
|
var e, t, i, s;
|
293
|
-
!this.inputElementRef.classList.contains("text-input-disabled") && (e = this._config.placeholder) != null && e.style && (
|
293
|
+
!this.inputElementRef.classList.contains("text-input-disabled") && (e = this._config.placeholder) != null && e.style && (R.unsetStyle(this.inputElementRef, (t = this._config.placeholder) == null ? void 0 : t.style), Object.assign(this.inputElementRef.style, (s = (i = this._config) == null ? void 0 : i.styles) == null ? void 0 : s.text));
|
294
294
|
}
|
295
295
|
}, {
|
296
296
|
key: "addEventListeners",
|
@@ -305,13 +305,13 @@ var $e = /*#__PURE__*/function () {
|
|
305
305
|
}, {
|
306
306
|
key: "onBlur",
|
307
307
|
value: function onBlur(e, t) {
|
308
|
-
|
308
|
+
R.unsetStyle(this.elementRef, e), t && Object.assign(this.elementRef.style, t);
|
309
309
|
}
|
310
310
|
}, {
|
311
311
|
key: "onKeydown",
|
312
312
|
value: function onKeydown(e) {
|
313
313
|
var t;
|
314
|
-
e.key ===
|
314
|
+
e.key === O.ENTER && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), (t = this.submit) == null || t.call(this));
|
315
315
|
}
|
316
316
|
}, {
|
317
317
|
key: "onInput",
|
@@ -406,7 +406,7 @@ function In(n, e) {
|
|
406
406
|
return "".concat(xs(n, t, e), "Make sure the ").concat(t, " message is using the {body: {text: string}} format, e.g: {body: {text: \"Model Response\"}}");
|
407
407
|
}
|
408
408
|
var Ns = "Make sure the events are using {text: string} or {html: string} format.\nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor",
|
409
|
-
|
409
|
+
M = {
|
410
410
|
INVALID_KEY: "Invalid API Key",
|
411
411
|
CONNECTION_FAILED: "Failed to connect",
|
412
412
|
INVALID_RESPONSE: Mn,
|
@@ -458,7 +458,7 @@ var Ns = "Make sure the events are using {text: string} or {html: string} format
|
|
458
458
|
}]);
|
459
459
|
}();
|
460
460
|
Mi.CODE_SNIPPET_GENERATION_JUMP = 0.5;
|
461
|
-
var
|
461
|
+
var J = Mi;
|
462
462
|
var Ri = /*#__PURE__*/function () {
|
463
463
|
function Ri() {
|
464
464
|
_classCallCheck(this, Ri);
|
@@ -490,11 +490,11 @@ var Ri = /*#__PURE__*/function () {
|
|
490
490
|
}();
|
491
491
|
Ri.LOAD_VOICES_MS = 200;
|
492
492
|
var bt = Ri;
|
493
|
-
var
|
494
|
-
function
|
495
|
-
_classCallCheck(this,
|
493
|
+
var le = /*#__PURE__*/function () {
|
494
|
+
function le() {
|
495
|
+
_classCallCheck(this, le);
|
496
496
|
}
|
497
|
-
return _createClass(
|
497
|
+
return _createClass(le, null, [{
|
498
498
|
key: "checkForContainerStyles",
|
499
499
|
value: function checkForContainerStyles(e, t) {
|
500
500
|
var i = e.containerStyle;
|
@@ -608,20 +608,20 @@ ft.BUBBLE_CLASS = "deep-chat-loading-message-bubble", ft.DOTS_CONTAINER_CLASS =
|
|
608
608
|
var ke = ft;
|
609
609
|
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
610
|
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
|
-
|
612
|
-
function
|
613
|
-
_classCallCheck(this,
|
611
|
+
Y = /*#__PURE__*/function () {
|
612
|
+
function Y() {
|
613
|
+
_classCallCheck(this, Y);
|
614
614
|
}
|
615
|
-
return _createClass(
|
615
|
+
return _createClass(Y, null, [{
|
616
616
|
key: "hide",
|
617
617
|
value: function hide(e) {
|
618
618
|
var t;
|
619
|
-
(t = e.getElementsByClassName(
|
619
|
+
(t = e.getElementsByClassName(Y.CONTAINER_CLASS)[0].style).visibility || (t.visibility = "hidden");
|
620
620
|
}
|
621
621
|
}, {
|
622
622
|
key: "reveal",
|
623
623
|
value: function reveal(e) {
|
624
|
-
e.getElementsByClassName(
|
624
|
+
e.getElementsByClassName(Y.CONTAINER_CLASS)[0].style.visibility = "";
|
625
625
|
}
|
626
626
|
}, {
|
627
627
|
key: "applyCustomStylesToElements",
|
@@ -632,10 +632,10 @@ var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
632
632
|
key: "applyCustomStyles",
|
633
633
|
value: function applyCustomStyles(e, t, i, s) {
|
634
634
|
var r, o, a, l;
|
635
|
-
if ((r = i["default"]) != null && r.styles &&
|
636
|
-
(a = i.ai) != null && a.styles &&
|
635
|
+
if ((r = i["default"]) != null && r.styles && Y.applyCustomStylesToElements(e, t, i["default"].styles), s === b.USER_ROLE) (o = i.user) != null && o.styles && Y.applyCustomStylesToElements(e, t, i.user.styles);else {
|
636
|
+
(a = i.ai) != null && a.styles && Y.applyCustomStylesToElements(e, t, i.ai.styles);
|
637
637
|
var c = (l = i[s]) == null ? void 0 : l.styles;
|
638
|
-
c &&
|
638
|
+
c && Y.applyCustomStylesToElements(e, t, c);
|
639
639
|
}
|
640
640
|
}
|
641
641
|
}, {
|
@@ -645,7 +645,7 @@ var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
645
645
|
var i = document.createElement("img");
|
646
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");
|
647
647
|
var s = document.createElement("div");
|
648
|
-
return s.classList.add(
|
648
|
+
return s.classList.add(Y.CONTAINER_CLASS), s.appendChild(i), t && Y.applyCustomStyles(s, i, t, e), s;
|
649
649
|
}
|
650
650
|
}, {
|
651
651
|
key: "getPosition",
|
@@ -659,28 +659,28 @@ var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
659
659
|
key: "add",
|
660
660
|
value: function add(e, t, i) {
|
661
661
|
var s = typeof i == "boolean" ? void 0 : i,
|
662
|
-
r =
|
663
|
-
o =
|
662
|
+
r = Y.createAvatar(t, s),
|
663
|
+
o = Y.getPosition(t, s);
|
664
664
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
665
665
|
}
|
666
666
|
}]);
|
667
667
|
}();
|
668
|
-
|
669
|
-
var Mt =
|
670
|
-
var
|
671
|
-
function
|
672
|
-
_classCallCheck(this,
|
668
|
+
Y.CONTAINER_CLASS = "avatar-container";
|
669
|
+
var Mt = Y;
|
670
|
+
var me = /*#__PURE__*/function () {
|
671
|
+
function me() {
|
672
|
+
_classCallCheck(this, me);
|
673
673
|
}
|
674
|
-
return _createClass(
|
674
|
+
return _createClass(me, null, [{
|
675
675
|
key: "hide",
|
676
676
|
value: function hide(e) {
|
677
677
|
var t;
|
678
|
-
(t = e.getElementsByClassName(
|
678
|
+
(t = e.getElementsByClassName(me.NAME_CLASS)[0].style).visibility || (t.visibility = "hidden");
|
679
679
|
}
|
680
680
|
}, {
|
681
681
|
key: "reveal",
|
682
682
|
value: function reveal(e) {
|
683
|
-
e.getElementsByClassName(
|
683
|
+
e.getElementsByClassName(me.NAME_CLASS)[0].style.visibility = "";
|
684
684
|
}
|
685
685
|
}, {
|
686
686
|
key: "getPosition",
|
@@ -706,25 +706,25 @@ var pe = /*#__PURE__*/function () {
|
|
706
706
|
key: "createName",
|
707
707
|
value: function createName(e, t) {
|
708
708
|
var i = document.createElement("div");
|
709
|
-
return i.classList.add(
|
709
|
+
return i.classList.add(me.NAME_CLASS), i.textContent = me.getNameText(e, t), me.applyStyle(i, e, t), i;
|
710
710
|
}
|
711
711
|
}, {
|
712
712
|
key: "add",
|
713
713
|
value: function add(e, t, i) {
|
714
714
|
var s = typeof i == "boolean" ? {} : i,
|
715
|
-
r =
|
716
|
-
o =
|
715
|
+
r = me.createName(t, s),
|
716
|
+
o = me.getPosition(t, s);
|
717
717
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
718
718
|
}
|
719
719
|
}]);
|
720
720
|
}();
|
721
|
-
|
722
|
-
var Rt =
|
723
|
-
var
|
724
|
-
function
|
725
|
-
_classCallCheck(this,
|
721
|
+
me.NAME_CLASS = "name";
|
722
|
+
var Rt = me;
|
723
|
+
var C = /*#__PURE__*/function () {
|
724
|
+
function C() {
|
725
|
+
_classCallCheck(this, C);
|
726
726
|
}
|
727
|
-
return _createClass(
|
727
|
+
return _createClass(C, null, [{
|
728
728
|
key: "getLastElementsByClass",
|
729
729
|
value: function getLastElementsByClass(e, t, i) {
|
730
730
|
var _loop = function _loop() {
|
@@ -765,8 +765,8 @@ var le = /*#__PURE__*/function () {
|
|
765
765
|
}, {
|
766
766
|
key: "overwriteMessage",
|
767
767
|
value: function overwriteMessage(e, t, i, s, r, o) {
|
768
|
-
var a =
|
769
|
-
l =
|
768
|
+
var a = C.getLastElementsByClass(t, [C.getRoleClass(s), o], [ke.BUBBLE_CLASS]),
|
769
|
+
l = C.getLastMessage(e, s, r);
|
770
770
|
return l && (l[r] = i), a;
|
771
771
|
}
|
772
772
|
}, {
|
@@ -778,18 +778,18 @@ var le = /*#__PURE__*/function () {
|
|
778
778
|
}, {
|
779
779
|
key: "fillEmptyMessageElement",
|
780
780
|
value: function fillEmptyMessageElement(e, t) {
|
781
|
-
t.trim().length === 0 && (e.classList.add(
|
781
|
+
t.trim().length === 0 && (e.classList.add(C.EMPTY_MESSAGE_CLASS), e.innerHTML = '<div style="color:#00000000">.</div>');
|
782
782
|
}
|
783
783
|
}, {
|
784
784
|
key: "unfillEmptyMessageElement",
|
785
785
|
value: function unfillEmptyMessageElement(e, t) {
|
786
|
-
e.classList.contains(
|
786
|
+
e.classList.contains(C.EMPTY_MESSAGE_CLASS) && t.trim().length > 0 && e.replaceChildren();
|
787
787
|
}
|
788
788
|
}, {
|
789
789
|
key: "getLastMessageBubbleElement",
|
790
790
|
value: function getLastMessageBubbleElement(e) {
|
791
791
|
var t, i, s;
|
792
|
-
return Array.from(((s = (i = (t =
|
792
|
+
return Array.from(((s = (i = (t = C.getLastMessageElement(e)) == null ? void 0 : t.children) == null ? void 0 : i[0]) == null ? void 0 : s.children) || []).find(function (r) {
|
793
793
|
return r.classList.contains("message-bubble");
|
794
794
|
});
|
795
795
|
}
|
@@ -819,10 +819,34 @@ var le = /*#__PURE__*/function () {
|
|
819
819
|
value: function updateRefArr(e, t, i) {
|
820
820
|
i ? e.unshift(t) : e.push(t);
|
821
821
|
}
|
822
|
+
}, {
|
823
|
+
key: "buildRoleContainerClass",
|
824
|
+
value: function buildRoleContainerClass(e) {
|
825
|
+
return "deep-chat-".concat(e, "-container");
|
826
|
+
}
|
827
|
+
}, {
|
828
|
+
key: "addNewPositionClasses",
|
829
|
+
value: function addNewPositionClasses(e, t) {
|
830
|
+
var _e$outerContainer$cla;
|
831
|
+
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
|
+
}
|
833
|
+
}, {
|
834
|
+
key: "classifyMessages",
|
835
|
+
value: function classifyMessages(e, t) {
|
836
|
+
var i = C.buildRoleContainerClass(e);
|
837
|
+
t.forEach(function (s, r) {
|
838
|
+
var o = s.outerContainer.classList.contains(i),
|
839
|
+
a = t[r - 1],
|
840
|
+
l = t[r + 1],
|
841
|
+
c = a == null ? void 0 : a.outerContainer.classList.contains(i),
|
842
|
+
d = l == null ? void 0 : l.outerContainer.classList.contains(i);
|
843
|
+
o && (!c && d ? C.addNewPositionClasses(s, [C.POSITION_TOP_MESSAGE_CLASS]) : c && d ? C.addNewPositionClasses(s, [C.POSITION_MIDDLE_MESSAGE_CLASS]) : c && !d ? C.addNewPositionClasses(s, [C.POSITION_BOTTOM_MESSAGE_CLASS]) : !c && !d && C.addNewPositionClasses(s, [C.POSITION_TOP_MESSAGE_CLASS, C.POSITION_BOTTOM_MESSAGE_CLASS]));
|
844
|
+
});
|
845
|
+
}
|
822
846
|
}]);
|
823
847
|
}();
|
824
|
-
|
825
|
-
var b =
|
848
|
+
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
|
+
var b = C;
|
826
850
|
var Ze = /*#__PURE__*/function () {
|
827
851
|
function Ze() {
|
828
852
|
_classCallCheck(this, Ze);
|
@@ -830,7 +854,7 @@ var Ze = /*#__PURE__*/function () {
|
|
830
854
|
return _createClass(Ze, null, [{
|
831
855
|
key: "mouseUp",
|
832
856
|
value: function mouseUp(e, t) {
|
833
|
-
|
857
|
+
R.unsetAllCSSMouseStates(e, t), Object.assign(e.style, t["default"]), Object.assign(e.style, t.hover);
|
834
858
|
}
|
835
859
|
}, {
|
836
860
|
key: "mouseDown",
|
@@ -840,7 +864,7 @@ var Ze = /*#__PURE__*/function () {
|
|
840
864
|
}, {
|
841
865
|
key: "mouseLeave",
|
842
866
|
value: function mouseLeave(e, t) {
|
843
|
-
|
867
|
+
R.unsetAllCSSMouseStates(e, t), Object.assign(e.style, t["default"]);
|
844
868
|
}
|
845
869
|
}, {
|
846
870
|
key: "mouseEnter",
|
@@ -926,10 +950,10 @@ var Me = /*#__PURE__*/function () {
|
|
926
950
|
r = ns[i].styles;
|
927
951
|
if (r) {
|
928
952
|
var a = JSON.parse(JSON.stringify(r));
|
929
|
-
a["default"] &&
|
953
|
+
a["default"] && R.overwriteDefaultWithAlreadyApplied(a, t), s.unshift(a);
|
930
954
|
}
|
931
|
-
var o =
|
932
|
-
return
|
955
|
+
var o = R.mergeStatefulStyles(s);
|
956
|
+
return R.processStateful(o, {}, {});
|
933
957
|
}
|
934
958
|
}, {
|
935
959
|
key: "applyDeepChatUtilities",
|
@@ -938,7 +962,7 @@ var Me = /*#__PURE__*/function () {
|
|
938
962
|
var o = i.getElementsByClassName(r);
|
939
963
|
Array.from(o || []).forEach(function (a) {
|
940
964
|
var l = Me.getProcessedStyles(t, a, r);
|
941
|
-
|
965
|
+
te.applyStylesToElement(a, l), Me.applyEvents(a, r);
|
942
966
|
});
|
943
967
|
});
|
944
968
|
var s = i.getElementsByClassName(Nn);
|
@@ -948,14 +972,14 @@ var Me = /*#__PURE__*/function () {
|
|
948
972
|
}
|
949
973
|
}]);
|
950
974
|
}();
|
951
|
-
var
|
952
|
-
function
|
953
|
-
_classCallCheck(this,
|
975
|
+
var te = /*#__PURE__*/function () {
|
976
|
+
function te() {
|
977
|
+
_classCallCheck(this, te);
|
954
978
|
}
|
955
|
-
return _createClass(
|
979
|
+
return _createClass(te, null, [{
|
956
980
|
key: "applyStylesToElement",
|
957
981
|
value: function applyStylesToElement(e, t) {
|
958
|
-
var i =
|
982
|
+
var i = R.processStateful(t, {}, {});
|
959
983
|
Ze.add(e, i), Object.assign(e.style, i["default"]);
|
960
984
|
}
|
961
985
|
}, {
|
@@ -971,7 +995,7 @@ var ee = /*#__PURE__*/function () {
|
|
971
995
|
value: function applyClassUtilitiesToElement(e, t) {
|
972
996
|
var i = t.events,
|
973
997
|
s = t.styles;
|
974
|
-
i &&
|
998
|
+
i && te.applyEventsToElement(e, i), s && !Me.doesElementContainDeepChatClass(e) && te.applyStylesToElement(e, s);
|
975
999
|
}
|
976
1000
|
}, {
|
977
1001
|
key: "applyCustomClassUtilities",
|
@@ -979,20 +1003,20 @@ var ee = /*#__PURE__*/function () {
|
|
979
1003
|
Object.keys(e).forEach(function (i) {
|
980
1004
|
var s = t.getElementsByClassName(i);
|
981
1005
|
Array.from(s).forEach(function (r) {
|
982
|
-
e[i] &&
|
1006
|
+
e[i] && te.applyClassUtilitiesToElement(r, e[i]);
|
983
1007
|
});
|
984
1008
|
});
|
985
1009
|
}
|
986
1010
|
}, {
|
987
1011
|
key: "apply",
|
988
1012
|
value: function apply(e, t) {
|
989
|
-
Me.applyDeepChatUtilities(e, e.htmlClassUtilities, t),
|
1013
|
+
Me.applyDeepChatUtilities(e, e.htmlClassUtilities, t), te.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
990
1014
|
}
|
991
1015
|
}, {
|
992
1016
|
key: "traverseNodes",
|
993
1017
|
value: function traverseNodes(e, t) {
|
994
1018
|
e.nodeType === Node.ELEMENT_NODE && t.push(e.outerHTML), e.childNodes.forEach(function (i) {
|
995
|
-
|
1019
|
+
te.traverseNodes(i, t);
|
996
1020
|
});
|
997
1021
|
}
|
998
1022
|
}, {
|
@@ -1001,16 +1025,16 @@ var ee = /*#__PURE__*/function () {
|
|
1001
1025
|
var i = new DOMParser().parseFromString(e, "text/html"),
|
1002
1026
|
s = [];
|
1003
1027
|
return i.body.childNodes.forEach(function (r) {
|
1004
|
-
|
1028
|
+
te.traverseNodes(r, s);
|
1005
1029
|
}), s;
|
1006
1030
|
}
|
1007
1031
|
}]);
|
1008
1032
|
}();
|
1009
|
-
var
|
1010
|
-
function
|
1011
|
-
_classCallCheck(this,
|
1033
|
+
var Re = /*#__PURE__*/function () {
|
1034
|
+
function Re() {
|
1035
|
+
_classCallCheck(this, Re);
|
1012
1036
|
}
|
1013
|
-
return _createClass(
|
1037
|
+
return _createClass(Re, null, [{
|
1014
1038
|
key: "addElement",
|
1015
1039
|
value: function addElement(e, t) {
|
1016
1040
|
e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
@@ -1023,10 +1047,15 @@ var Be = /*#__PURE__*/function () {
|
|
1023
1047
|
}
|
1024
1048
|
}, {
|
1025
1049
|
key: "overwrite",
|
1026
|
-
value: function overwrite(e, t, i
|
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) {
|
1027
1056
|
var r = e.messages,
|
1028
1057
|
o = b.overwriteMessage(r, s, t, i, "html", "html-message");
|
1029
|
-
return o &&
|
1058
|
+
return o && Re.overwrite(e, t, o), o;
|
1030
1059
|
}
|
1031
1060
|
// prettier-ignore
|
1032
1061
|
}, {
|
@@ -1035,12 +1064,12 @@ var Be = /*#__PURE__*/function () {
|
|
1035
1064
|
var o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;
|
1036
1065
|
var l;
|
1037
1066
|
if (r != null && r.status) {
|
1038
|
-
var c = this.
|
1067
|
+
var c = this.overwriteLast(e, t, i, s);
|
1039
1068
|
if (c) return c;
|
1040
1069
|
r.status = !1;
|
1041
1070
|
}
|
1042
|
-
var a =
|
1043
|
-
return b.fillEmptyMessageElement(a.bubbleElement, t),
|
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;
|
1044
1073
|
}
|
1045
1074
|
}]);
|
1046
1075
|
}();
|
@@ -1100,7 +1129,7 @@ var qn = /[&<>"]/,
|
|
1100
1129
|
function Vn(n) {
|
1101
1130
|
return Gn[n];
|
1102
1131
|
}
|
1103
|
-
function
|
1132
|
+
function K(n) {
|
1104
1133
|
return qn.test(n) ? n.replace(zn, Vn) : n;
|
1105
1134
|
}
|
1106
1135
|
var g = {};
|
@@ -1111,7 +1140,7 @@ g.blockquote_close = function (n, e) {
|
|
1111
1140
|
return "</blockquote>" + st(n, e);
|
1112
1141
|
};
|
1113
1142
|
g.code = function (n, e) {
|
1114
|
-
return n[e].block ? "<pre><code>" +
|
1143
|
+
return n[e].block ? "<pre><code>" + K(n[e].content) + "</code></pre>" + st(n, e) : "<code>" + K(n[e].content) + "</code>";
|
1115
1144
|
};
|
1116
1145
|
g.fence = function (n, e, t, i, s) {
|
1117
1146
|
var r = n[e],
|
@@ -1123,9 +1152,9 @@ g.fence = function (n, e, t, i, s) {
|
|
1123
1152
|
h;
|
1124
1153
|
if (r.params) {
|
1125
1154
|
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);
|
1126
|
-
l =
|
1155
|
+
l = K(tt(Bt(d))), o = ' class="' + a + l + '"';
|
1127
1156
|
}
|
1128
|
-
return t.highlight ? h = t.highlight.apply(t.highlight, [r.content].concat(c)) ||
|
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);
|
1129
1158
|
};
|
1130
1159
|
g.fence_custom = {};
|
1131
1160
|
g.heading_open = function (n, e) {
|
@@ -1165,17 +1194,17 @@ g.paragraph_close = function (n, e) {
|
|
1165
1194
|
return (n[e].tight ? "" : "</p>") + (t ? st(n, e) : "");
|
1166
1195
|
};
|
1167
1196
|
g.link_open = function (n, e, t) {
|
1168
|
-
var i = n[e].title ? ' title="' +
|
1197
|
+
var i = n[e].title ? ' title="' + K(tt(n[e].title)) + '"' : "",
|
1169
1198
|
s = t.linkTarget ? ' target="' + t.linkTarget + '"' : "";
|
1170
|
-
return '<a href="' +
|
1199
|
+
return '<a href="' + K(n[e].href) + '"' + i + s + ">";
|
1171
1200
|
};
|
1172
1201
|
g.link_close = function () {
|
1173
1202
|
return "</a>";
|
1174
1203
|
};
|
1175
1204
|
g.image = function (n, e, t) {
|
1176
|
-
var i = ' src="' +
|
1177
|
-
s = n[e].title ? ' title="' +
|
1178
|
-
r = ' alt="' + (n[e].alt ?
|
1205
|
+
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))) : "") + '"',
|
1179
1208
|
o = t.xhtmlOut ? " /" : "";
|
1180
1209
|
return "<img" + i + r + s + o + ">";
|
1181
1210
|
};
|
@@ -1248,10 +1277,10 @@ g.mark_close = function () {
|
|
1248
1277
|
return "</mark>";
|
1249
1278
|
};
|
1250
1279
|
g.sub = function (n, e) {
|
1251
|
-
return "<sub>" +
|
1280
|
+
return "<sub>" + K(n[e].content) + "</sub>";
|
1252
1281
|
};
|
1253
1282
|
g.sup = function (n, e) {
|
1254
|
-
return "<sup>" +
|
1283
|
+
return "<sup>" + K(n[e].content) + "</sup>";
|
1255
1284
|
};
|
1256
1285
|
g.hardbreak = function (n, e, t) {
|
1257
1286
|
return t.xhtmlOut ? "<br />\n" : "<br>\n";
|
@@ -1260,7 +1289,7 @@ g.softbreak = function (n, e, t) {
|
|
1260
1289
|
return t.breaks ? t.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
|
1261
1290
|
};
|
1262
1291
|
g.text = function (n, e) {
|
1263
|
-
return
|
1292
|
+
return K(n[e].content);
|
1264
1293
|
};
|
1265
1294
|
g.htmlblock = function (n, e) {
|
1266
1295
|
return n[e].content;
|
@@ -1269,7 +1298,7 @@ g.htmltag = function (n, e) {
|
|
1269
1298
|
return n[e].content;
|
1270
1299
|
};
|
1271
1300
|
g.abbr_open = function (n, e) {
|
1272
|
-
return '<abbr title="' +
|
1301
|
+
return '<abbr title="' + K(tt(n[e].title)) + '">';
|
1273
1302
|
};
|
1274
1303
|
g.abbr_close = function () {
|
1275
1304
|
return "</abbr>";
|
@@ -1333,14 +1362,14 @@ Ss.prototype.render = function (n, e, t) {
|
|
1333
1362
|
for (var i = this.rules, s = n.length, r = -1, o = ""; ++r < s;) n[r].type === "inline" ? o += this.renderInline(n[r].children, e, t) : o += i[n[r].type](n, r, e, t, this);
|
1334
1363
|
return o;
|
1335
1364
|
};
|
1336
|
-
function
|
1365
|
+
function se() {
|
1337
1366
|
this.__rules__ = [], this.__cache__ = null;
|
1338
1367
|
}
|
1339
|
-
|
1368
|
+
se.prototype.__find__ = function (n) {
|
1340
1369
|
for (var e = this.__rules__.length, t = -1; e--;) if (this.__rules__[++t].name === n) return t;
|
1341
1370
|
return -1;
|
1342
1371
|
};
|
1343
|
-
|
1372
|
+
se.prototype.__compile__ = function () {
|
1344
1373
|
var n = this,
|
1345
1374
|
e = [""];
|
1346
1375
|
n.__rules__.forEach(function (t) {
|
@@ -1353,13 +1382,13 @@ ie.prototype.__compile__ = function () {
|
|
1353
1382
|
});
|
1354
1383
|
});
|
1355
1384
|
};
|
1356
|
-
|
1385
|
+
se.prototype.at = function (n, e, t) {
|
1357
1386
|
var i = this.__find__(n),
|
1358
1387
|
s = t || {};
|
1359
1388
|
if (i === -1) throw new Error("Parser rule not found: " + n);
|
1360
1389
|
this.__rules__[i].fn = e, this.__rules__[i].alt = s.alt || [], this.__cache__ = null;
|
1361
1390
|
};
|
1362
|
-
|
1391
|
+
se.prototype.before = function (n, e, t, i) {
|
1363
1392
|
var s = this.__find__(n),
|
1364
1393
|
r = i || {};
|
1365
1394
|
if (s === -1) throw new Error("Parser rule not found: " + n);
|
@@ -1370,7 +1399,7 @@ ie.prototype.before = function (n, e, t, i) {
|
|
1370
1399
|
alt: r.alt || []
|
1371
1400
|
}), this.__cache__ = null;
|
1372
1401
|
};
|
1373
|
-
|
1402
|
+
se.prototype.after = function (n, e, t, i) {
|
1374
1403
|
var s = this.__find__(n),
|
1375
1404
|
r = i || {};
|
1376
1405
|
if (s === -1) throw new Error("Parser rule not found: " + n);
|
@@ -1381,7 +1410,7 @@ ie.prototype.after = function (n, e, t, i) {
|
|
1381
1410
|
alt: r.alt || []
|
1382
1411
|
}), this.__cache__ = null;
|
1383
1412
|
};
|
1384
|
-
|
1413
|
+
se.prototype.push = function (n, e, t) {
|
1385
1414
|
var i = t || {};
|
1386
1415
|
this.__rules__.push({
|
1387
1416
|
name: n,
|
@@ -1390,7 +1419,7 @@ ie.prototype.push = function (n, e, t) {
|
|
1390
1419
|
alt: i.alt || []
|
1391
1420
|
}), this.__cache__ = null;
|
1392
1421
|
};
|
1393
|
-
|
1422
|
+
se.prototype.enable = function (n, e) {
|
1394
1423
|
n = Array.isArray(n) ? n : [n], e && this.__rules__.forEach(function (t) {
|
1395
1424
|
t.enabled = !1;
|
1396
1425
|
}), n.forEach(function (t) {
|
@@ -1399,14 +1428,14 @@ ie.prototype.enable = function (n, e) {
|
|
1399
1428
|
this.__rules__[i].enabled = !0;
|
1400
1429
|
}, this), this.__cache__ = null;
|
1401
1430
|
};
|
1402
|
-
|
1431
|
+
se.prototype.disable = function (n) {
|
1403
1432
|
n = Array.isArray(n) ? n : [n], n.forEach(function (e) {
|
1404
1433
|
var t = this.__find__(e);
|
1405
1434
|
if (t < 0) throw new Error("Rules manager: invalid rule name " + e);
|
1406
1435
|
this.__rules__[t].enabled = !1;
|
1407
1436
|
}, this), this.__cache__ = null;
|
1408
1437
|
};
|
1409
|
-
|
1438
|
+
se.prototype.getRules = function (n) {
|
1410
1439
|
return this.__cache__ === null && this.__compile__(), this.__cache__[n] || [];
|
1411
1440
|
};
|
1412
1441
|
function $n(n) {
|
@@ -1726,7 +1755,7 @@ function ar(n) {
|
|
1726
1755
|
}
|
1727
1756
|
var Ji = [["block", $n], ["abbr", Kn], ["references", Zn], ["inline", Xn], ["footnote_tail", Yn], ["abbr2", Qn], ["replacements", nr], ["smartquotes", ar]];
|
1728
1757
|
function En() {
|
1729
|
-
this.options = {}, this.ruler = new
|
1758
|
+
this.options = {}, this.ruler = new se();
|
1730
1759
|
for (var n = 0; n < Ji.length; n++) this.ruler.push(Ji[n][0], Ji[n][1]);
|
1731
1760
|
}
|
1732
1761
|
En.prototype.process = function (n) {
|
@@ -1916,36 +1945,36 @@ function fr(n, e, t, i) {
|
|
1916
1945
|
p,
|
1917
1946
|
y,
|
1918
1947
|
x,
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1948
|
+
j,
|
1949
|
+
G,
|
1950
|
+
Pe,
|
1951
|
+
I,
|
1952
|
+
Z = !0,
|
1953
|
+
X,
|
1954
|
+
D,
|
1926
1955
|
je,
|
1927
1956
|
Tt;
|
1928
1957
|
if ((h = qs(n, e)) >= 0) y = !0;else if ((h = Hs(n, e)) >= 0) y = !1;else return !1;
|
1929
1958
|
if (n.level >= n.options.maxNesting) return !1;
|
1930
1959
|
if (p = n.src.charCodeAt(h - 1), i) return !0;
|
1931
|
-
for (
|
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({
|
1932
1961
|
type: "ordered_list_open",
|
1933
1962
|
order: m,
|
1934
|
-
lines:
|
1963
|
+
lines: Pe = [e, 0],
|
1935
1964
|
level: n.level++
|
1936
1965
|
})) : n.tokens.push({
|
1937
1966
|
type: "bullet_list_open",
|
1938
|
-
lines:
|
1967
|
+
lines: Pe = [e, 0],
|
1939
1968
|
level: n.level++
|
1940
|
-
}), s = e,
|
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({
|
1941
1970
|
type: "list_item_open",
|
1942
|
-
lines:
|
1971
|
+
lines: I = [e, 0],
|
1943
1972
|
level: n.level++
|
1944
|
-
}), 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 ||
|
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({
|
1945
1974
|
type: "list_item_close",
|
1946
1975
|
level: --n.level
|
1947
|
-
}), s = e = n.line,
|
1948
|
-
for (Tt = !1,
|
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)) {
|
1949
1978
|
Tt = !0;
|
1950
1979
|
break;
|
1951
1980
|
}
|
@@ -1958,7 +1987,7 @@ function fr(n, e, t, i) {
|
|
1958
1987
|
return n.tokens.push({
|
1959
1988
|
type: y ? "ordered_list_close" : "bullet_list_close",
|
1960
1989
|
level: --n.level
|
1961
|
-
}),
|
1990
|
+
}), Pe[1] = s, n.line = s, Z && ur(n, j), !0;
|
1962
1991
|
}
|
1963
1992
|
function pr(n, e, t, i) {
|
1964
1993
|
var s,
|
@@ -2240,7 +2269,7 @@ function wr(n, e) {
|
|
2240
2269
|
}
|
2241
2270
|
var ri = [["code", lr], ["fences", cr, ["paragraph", "blockquote", "list"]], ["blockquote", dr, ["paragraph", "blockquote", "list"]], ["hr", hr, ["paragraph", "blockquote", "list"]], ["list", fr, ["paragraph", "blockquote"]], ["footnote", pr, ["paragraph"]], ["heading", mr, ["paragraph", "blockquote"]], ["lheading", gr], ["htmlblock", Er, ["paragraph", "blockquote"]], ["table", xr, ["paragraph"]], ["deflist", _r, ["paragraph"]], ["paragraph", wr]];
|
2242
2271
|
function _s() {
|
2243
|
-
this.ruler = new
|
2272
|
+
this.ruler = new se();
|
2244
2273
|
for (var n = 0; n < ri.length; n++) this.ruler.push(ri[n][0], ri[n][1], {
|
2245
2274
|
alt: (ri[n][2] || []).slice()
|
2246
2275
|
});
|
@@ -2725,7 +2754,7 @@ function uo(n, e) {
|
|
2725
2754
|
}
|
2726
2755
|
var Xi = [["text", Mr], ["newline", Rr], ["escape", Ir], ["backticks", Lr], ["del", Pr], ["ins", Or], ["mark", Nr], ["emphasis", Dr], ["sub", Br], ["sup", jr], ["links", Hr], ["footnote_inline", qr], ["footnote_ref", zr], ["autolink", Wr], ["htmltag", lo], ["entity", uo]];
|
2727
2756
|
function Pi() {
|
2728
|
-
this.ruler = new
|
2757
|
+
this.ruler = new se();
|
2729
2758
|
for (var n = 0; n < Xi.length; n++) this.ruler.push(Xi[n][0], Xi[n][1]);
|
2730
2759
|
this.validateLink = fo;
|
2731
2760
|
}
|
@@ -2882,34 +2911,34 @@ var po = {
|
|
2882
2911
|
function Sn(n, e, t) {
|
2883
2912
|
this.src = e, this.env = t, this.options = n.options, this.tokens = [], this.inlineMode = !1, this.inline = n.inline, this.block = n.block, this.renderer = n.renderer, this.typographer = n.typographer;
|
2884
2913
|
}
|
2885
|
-
function
|
2886
|
-
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
|
2914
|
+
function Ie(n, e) {
|
2915
|
+
typeof n != "string" && (e = n, n = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new Pi(), this.block = new _s(), this.core = new En(), this.renderer = new Ss(), this.ruler = new se(), this.options = {}, this.configure(bo[n]), this.set(e || {});
|
2887
2916
|
}
|
2888
|
-
|
2917
|
+
Ie.prototype.set = function (n) {
|
2889
2918
|
pn(this.options, n);
|
2890
2919
|
};
|
2891
|
-
|
2920
|
+
Ie.prototype.configure = function (n) {
|
2892
2921
|
var e = this;
|
2893
2922
|
if (!n) throw new Error("Wrong `remarkable` preset, check name/content");
|
2894
2923
|
n.options && e.set(n.options), n.components && Object.keys(n.components).forEach(function (t) {
|
2895
2924
|
n.components[t].rules && e[t].ruler.enable(n.components[t].rules, !0);
|
2896
2925
|
});
|
2897
2926
|
};
|
2898
|
-
|
2927
|
+
Ie.prototype.use = function (n, e) {
|
2899
2928
|
return n(this, e), this;
|
2900
2929
|
};
|
2901
|
-
|
2930
|
+
Ie.prototype.parse = function (n, e) {
|
2902
2931
|
var t = new Sn(this, n, e);
|
2903
2932
|
return this.core.process(t), t.tokens;
|
2904
2933
|
};
|
2905
|
-
|
2934
|
+
Ie.prototype.render = function (n, e) {
|
2906
2935
|
return e = e || {}, this.renderer.render(this.parse(n, e), this.options, e);
|
2907
2936
|
};
|
2908
|
-
|
2937
|
+
Ie.prototype.parseInline = function (n, e) {
|
2909
2938
|
var t = new Sn(this, n, e);
|
2910
2939
|
return t.inlineMode = !0, this.core.process(t), t.tokens;
|
2911
2940
|
};
|
2912
|
-
|
2941
|
+
Ie.prototype.renderInline = function (n, e) {
|
2913
2942
|
return e = e || {}, this.renderer.render(this.parseInline(n, e), this.options, e);
|
2914
2943
|
};
|
2915
2944
|
var jt = /*#__PURE__*/function () {
|
@@ -2920,7 +2949,7 @@ var jt = /*#__PURE__*/function () {
|
|
2920
2949
|
key: "instantiate",
|
2921
2950
|
value: function instantiate() {
|
2922
2951
|
var e = window.hljs;
|
2923
|
-
return e ? new
|
2952
|
+
return e ? new Ie({
|
2924
2953
|
highlight: function highlight(t, i) {
|
2925
2954
|
if (i && e.getLanguage(i)) try {
|
2926
2955
|
return e.highlight(i, t).value;
|
@@ -2946,7 +2975,7 @@ var jt = /*#__PURE__*/function () {
|
|
2946
2975
|
// set target to open in a new tab
|
2947
2976
|
typographer: !0
|
2948
2977
|
// Enable smartypants and other sweet transforms
|
2949
|
-
}) : new
|
2978
|
+
}) : new Ie({
|
2950
2979
|
breaks: !0,
|
2951
2980
|
linkTarget: "_blank"
|
2952
2981
|
// set target to open in a new tab
|
@@ -3052,7 +3081,7 @@ var xe = /*#__PURE__*/function () {
|
|
3052
3081
|
}]);
|
3053
3082
|
}();
|
3054
3083
|
xe.DEFAULT_FILE_NAME = "file";
|
3055
|
-
var
|
3084
|
+
var B = xe;
|
3056
3085
|
var hi = /*#__PURE__*/function () {
|
3057
3086
|
function hi() {
|
3058
3087
|
_classCallCheck(this, hi);
|
@@ -3066,9 +3095,9 @@ var hi = /*#__PURE__*/function () {
|
|
3066
3095
|
isHistory: i,
|
3067
3096
|
isInitial: i
|
3068
3097
|
}));
|
3069
|
-
|
3098
|
+
B.reAddFileRefToObject(t, s), (r = e.onMessage) == null || r.call(e, s), e.dispatchEvent(new CustomEvent("message", {
|
3070
3099
|
detail: s
|
3071
|
-
})),
|
3100
|
+
})), le.fireOnNewMessage(e, s);
|
3072
3101
|
}
|
3073
3102
|
}, {
|
3074
3103
|
key: "onClearMessages",
|
@@ -3094,11 +3123,11 @@ var hi = /*#__PURE__*/function () {
|
|
3094
3123
|
}
|
3095
3124
|
}]);
|
3096
3125
|
}();
|
3097
|
-
var
|
3098
|
-
function
|
3099
|
-
_classCallCheck(this,
|
3126
|
+
var F = /*#__PURE__*/function () {
|
3127
|
+
function F() {
|
3128
|
+
_classCallCheck(this, F);
|
3100
3129
|
}
|
3101
|
-
return _createClass(
|
3130
|
+
return _createClass(F, null, [{
|
3102
3131
|
key: "generateLoadingRingElement",
|
3103
3132
|
value: function generateLoadingRingElement() {
|
3104
3133
|
var e = document.createElement("div");
|
@@ -3114,18 +3143,18 @@ var D = /*#__PURE__*/function () {
|
|
3114
3143
|
value: function addLoadHistoryMessage(e, t) {
|
3115
3144
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
3116
3145
|
var o, a, l, c, d, h, u, f;
|
3117
|
-
e.bubbleElement.classList.add(
|
3118
|
-
var s = i ?
|
3146
|
+
e.bubbleElement.classList.add(F.CLASS);
|
3147
|
+
var s = i ? F.FULL_VIEW_CLASS : F.SMALL_CLASS;
|
3119
3148
|
e.outerContainer.classList.add(s);
|
3120
3149
|
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;
|
3121
|
-
|
3150
|
+
F.apply(t, e, r), t.elementRef.prepend(e.outerContainer);
|
3122
3151
|
}
|
3123
3152
|
}, {
|
3124
3153
|
key: "createDefaultElements",
|
3125
3154
|
value: function createDefaultElements(e) {
|
3126
3155
|
var t = e.createMessageElements("", b.AI_ROLE),
|
3127
3156
|
i = t.bubbleElement,
|
3128
|
-
s =
|
3157
|
+
s = F.generateLoadingRingElement();
|
3129
3158
|
return i.appendChild(s), t;
|
3130
3159
|
}
|
3131
3160
|
}, {
|
@@ -3134,30 +3163,30 @@ var D = /*#__PURE__*/function () {
|
|
3134
3163
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
3135
3164
|
var r, o, a, l;
|
3136
3165
|
var i = (l = (a = (o = (r = e.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.history) == null ? void 0 : a.full) == null ? void 0 : l.html,
|
3137
|
-
s = i ?
|
3138
|
-
return
|
3166
|
+
s = i ? Re.createElements(e, i, b.AI_ROLE, !0) : F.createDefaultElements(e);
|
3167
|
+
return F.addLoadHistoryMessage(s, e, t), s;
|
3139
3168
|
}
|
3140
3169
|
}, {
|
3141
3170
|
key: "changeFullViewToSmall",
|
3142
3171
|
value: function changeFullViewToSmall(e, t) {
|
3143
3172
|
var i, s, r, o, a, l, c, d;
|
3144
|
-
if (t != null && t.outerContainer.classList.contains(
|
3145
|
-
t.outerContainer.classList.replace(
|
3173
|
+
if (t != null && t.outerContainer.classList.contains(F.FULL_VIEW_CLASS)) {
|
3174
|
+
t.outerContainer.classList.replace(F.FULL_VIEW_CLASS, F.SMALL_CLASS);
|
3146
3175
|
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;
|
3147
|
-
h &&
|
3176
|
+
h && F.apply(e, t, h);
|
3148
3177
|
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;
|
3149
3178
|
u && (t.bubbleElement.innerHTML = u);
|
3150
3179
|
}
|
3151
3180
|
}
|
3152
3181
|
}]);
|
3153
3182
|
}();
|
3154
|
-
|
3155
|
-
var Qe =
|
3156
|
-
var
|
3157
|
-
function
|
3158
|
-
_classCallCheck(this,
|
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;
|
3185
|
+
var q = /*#__PURE__*/function () {
|
3186
|
+
function q() {
|
3187
|
+
_classCallCheck(this, q);
|
3159
3188
|
}
|
3160
|
-
return _createClass(
|
3189
|
+
return _createClass(q, null, [{
|
3161
3190
|
key: "applyCustomStylesToElements",
|
3162
3191
|
value: function applyCustomStylesToElements(e, t, i) {
|
3163
3192
|
if (i && (Object.assign(e.outerContainer.style, i.outerContainer), Object.assign(e.innerContainer.style, i.innerContainer), Object.assign(e.bubbleElement.style, i.bubble), t)) {
|
@@ -3169,7 +3198,7 @@ var H = /*#__PURE__*/function () {
|
|
3169
3198
|
}, {
|
3170
3199
|
key: "applySideStyles",
|
3171
3200
|
value: function applySideStyles(e, t, i, s) {
|
3172
|
-
s && (
|
3201
|
+
s && (q.applyCustomStylesToElements(e, i, s.shared), t === b.USER_ROLE ? q.applyCustomStylesToElements(e, i, s.user) : (q.applyCustomStylesToElements(e, i, s.ai), q.applyCustomStylesToElements(e, i, s[t])));
|
3173
3202
|
}
|
3174
3203
|
}, {
|
3175
3204
|
key: "isElementsStyles",
|
@@ -3181,7 +3210,7 @@ var H = /*#__PURE__*/function () {
|
|
3181
3210
|
key: "applyCustomStyles",
|
3182
3211
|
value: function applyCustomStyles(e, t, i, s, r) {
|
3183
3212
|
var o;
|
3184
|
-
r && e["default"] !== r ?
|
3213
|
+
r && e["default"] !== r ? q.isElementsStyles(r) ? (q.applyCustomStylesToElements(t, s, (o = e["default"]) == null ? void 0 : o.shared), q.applyCustomStylesToElements(t, s, r)) : (q.applySideStyles(t, i, s, e["default"]), q.applySideStyles(t, i, s, r)) : q.applySideStyles(t, i, s, e["default"]);
|
3185
3214
|
}
|
3186
3215
|
// prettier-ignore
|
3187
3216
|
}, {
|
@@ -3202,15 +3231,15 @@ var H = /*#__PURE__*/function () {
|
|
3202
3231
|
}
|
3203
3232
|
}]);
|
3204
3233
|
}();
|
3205
|
-
var
|
3206
|
-
function
|
3234
|
+
var Be = /*#__PURE__*/function () {
|
3235
|
+
function Be(e) {
|
3207
3236
|
var _this3 = this;
|
3208
|
-
_classCallCheck(this,
|
3209
|
-
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef =
|
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 () {
|
3210
3239
|
_this3.submitUserMessage = e.submitUserMessage;
|
3211
3240
|
});
|
3212
3241
|
}
|
3213
|
-
return _createClass(
|
3242
|
+
return _createClass(Be, [{
|
3214
3243
|
key: "addNewTextMessage",
|
3215
3244
|
value: function addNewTextMessage(e, t, i) {
|
3216
3245
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
@@ -3241,7 +3270,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3241
3270
|
var _this4 = this;
|
3242
3271
|
var i = this.createNewMessageElement(e, t);
|
3243
3272
|
return this.elementRef.appendChild(i.outerContainer), setTimeout(function () {
|
3244
|
-
return
|
3273
|
+
return J.scrollToBottom(_this4.elementRef);
|
3245
3274
|
}), i;
|
3246
3275
|
}
|
3247
3276
|
}, {
|
@@ -3268,7 +3297,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3268
3297
|
var r;
|
3269
3298
|
(r = this._introPanel) == null || r.hide();
|
3270
3299
|
var s = this.messageElementRefs[this.messageElementRefs.length - 1];
|
3271
|
-
return Qe.changeFullViewToSmall(this, s),
|
3300
|
+
return Qe.changeFullViewToSmall(this, s), Be.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), s.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t, i);
|
3272
3301
|
}
|
3273
3302
|
// this can be tested by having an ai message, then a temp ai message with html that submits new user message:
|
3274
3303
|
// https://github.com/OvidijusParsiunas/deep-chat/issues/258
|
@@ -3285,11 +3314,11 @@ var Fe = /*#__PURE__*/function () {
|
|
3285
3314
|
key: "createMessageElements",
|
3286
3315
|
value: function createMessageElements(e, t) {
|
3287
3316
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
3288
|
-
var s =
|
3317
|
+
var s = Be.createBaseElements(t),
|
3289
3318
|
r = s.outerContainer,
|
3290
3319
|
o = s.innerContainer,
|
3291
3320
|
a = s.bubbleElement;
|
3292
|
-
return r.appendChild(o), this.addInnerContainerElements(a, e, t), b.updateRefArr(this.messageElementRefs, s, i), s;
|
3321
|
+
return r.appendChild(o), this.addInnerContainerElements(a, e, t), b.updateRefArr(this.messageElementRefs, s, i), b.classifyMessages(t, this.messageElementRefs), s;
|
3293
3322
|
}
|
3294
3323
|
}, {
|
3295
3324
|
key: "addInnerContainerElements",
|
@@ -3305,7 +3334,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3305
3334
|
}, {
|
3306
3335
|
key: "applyCustomStyles",
|
3307
3336
|
value: function applyCustomStyles(e, t, i, s) {
|
3308
|
-
e && this.messageStyles &&
|
3337
|
+
e && this.messageStyles && q.applyCustomStyles(this.messageStyles, e, t, i, s);
|
3309
3338
|
}
|
3310
3339
|
}, {
|
3311
3340
|
key: "removeMessage",
|
@@ -3357,19 +3386,19 @@ var Fe = /*#__PURE__*/function () {
|
|
3357
3386
|
}, {
|
3358
3387
|
key: "isTemporaryElement",
|
3359
3388
|
value: function isTemporaryElement(e) {
|
3360
|
-
return
|
3389
|
+
return Be.isLoadingMessage(e) || Me.isElementTemporary(e);
|
3361
3390
|
}
|
3362
3391
|
}, {
|
3363
3392
|
key: "createBaseElements",
|
3364
|
-
value: function createBaseElements() {
|
3365
|
-
var
|
3366
|
-
|
3367
|
-
|
3368
|
-
var
|
3369
|
-
return
|
3370
|
-
outerContainer:
|
3371
|
-
innerContainer:
|
3372
|
-
bubbleElement:
|
3393
|
+
value: function createBaseElements(e) {
|
3394
|
+
var t = document.createElement("div"),
|
3395
|
+
i = document.createElement("div");
|
3396
|
+
i.classList.add("inner-message-container"), t.appendChild(i), t.classList.add("outer-message-container"), t.classList.add(b.buildRoleContainerClass(e));
|
3397
|
+
var s = document.createElement("div");
|
3398
|
+
return s.classList.add("message-bubble"), i.appendChild(s), {
|
3399
|
+
outerContainer: t,
|
3400
|
+
innerContainer: i,
|
3401
|
+
bubbleElement: s
|
3373
3402
|
};
|
3374
3403
|
}
|
3375
3404
|
}, {
|
@@ -3403,21 +3432,21 @@ var Se = /*#__PURE__*/function () {
|
|
3403
3432
|
value: function upsertStreamedMessage(e) {
|
3404
3433
|
var r;
|
3405
3434
|
if (this._hasStreamEnded) return;
|
3406
|
-
if ((e == null ? void 0 : e.text) === void 0 && (e == null ? void 0 : e.html) === void 0) return console.error(
|
3435
|
+
if ((e == null ? void 0 : e.text) === void 0 && (e == null ? void 0 : e.html) === void 0) return console.error(M.INVALID_STREAM_EVENT);
|
3407
3436
|
var t = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.html) || "",
|
3408
|
-
i =
|
3437
|
+
i = J.isScrollbarAtBottomOfElement(this._messages.elementRef),
|
3409
3438
|
s = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
|
3410
3439
|
if (!this._elements && this._streamedContent === "") this.setInitialState(s, t, e == null ? void 0 : e.role);else {
|
3411
|
-
if (this._streamType !== s) return console.error(
|
3440
|
+
if (this._streamType !== s) return console.error(M.INVALID_STREAM_EVENT_MIX);
|
3412
3441
|
this.updateBasedOnType(t, s, (r = this._elements) == null ? void 0 : r.bubbleElement, e == null ? void 0 : e.overwrite);
|
3413
3442
|
}
|
3414
|
-
i &&
|
3443
|
+
i && J.scrollToBottom(this._messages.elementRef);
|
3415
3444
|
}
|
3416
3445
|
}, {
|
3417
3446
|
key: "setInitialState",
|
3418
3447
|
value: function setInitialState(e, t, i) {
|
3419
3448
|
var _i8;
|
3420
|
-
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) :
|
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({
|
3421
3450
|
role: this._activeMessageRole
|
3422
3451
|
}, e, this._streamedContent), this._messages.messages.push(this._message);
|
3423
3452
|
}
|
@@ -3446,8 +3475,8 @@ var Se = /*#__PURE__*/function () {
|
|
3446
3475
|
var t, i;
|
3447
3476
|
var e = this._messages.textElementsToText;
|
3448
3477
|
if (!this._endStreamAfterOperation && !(this._fileAdded && !this._elements)) {
|
3449
|
-
if (!this._elements) throw Error(
|
3450
|
-
(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 &&
|
3478
|
+
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);
|
3451
3480
|
}
|
3452
3481
|
}
|
3453
3482
|
}, {
|
@@ -3743,49 +3772,49 @@ function wo(n, e) {
|
|
3743
3772
|
f.accept || (f.accept = as);
|
3744
3773
|
var m;
|
3745
3774
|
function p() {
|
3746
|
-
m.abort(), document.hidden ||
|
3775
|
+
m.abort(), document.hidden || I();
|
3747
3776
|
}
|
3748
3777
|
l || document.addEventListener("visibilitychange", p);
|
3749
3778
|
var y = _o,
|
3750
3779
|
x = 0;
|
3751
|
-
function
|
3780
|
+
function j() {
|
3752
3781
|
document.removeEventListener("visibilitychange", p), window.clearTimeout(x), m.abort();
|
3753
3782
|
}
|
3754
3783
|
t == null || t.addEventListener("abort", function () {
|
3755
|
-
|
3784
|
+
j(), h();
|
3756
3785
|
});
|
3757
|
-
var
|
3758
|
-
|
3759
|
-
function
|
3760
|
-
return
|
3761
|
-
}
|
3762
|
-
function
|
3763
|
-
|
3764
|
-
var
|
3786
|
+
var G = c !== null && c !== void 0 ? c : window.fetch,
|
3787
|
+
Pe = s !== null && s !== void 0 ? s : To;
|
3788
|
+
function I() {
|
3789
|
+
return _I.apply(this, arguments);
|
3790
|
+
}
|
3791
|
+
function _I() {
|
3792
|
+
_I = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
3793
|
+
var Z, X, D;
|
3765
3794
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
3766
3795
|
while (1) switch (_context4.prev = _context4.next) {
|
3767
3796
|
case 0:
|
3768
3797
|
m = new AbortController();
|
3769
3798
|
_context4.prev = 1;
|
3770
3799
|
_context4.next = 4;
|
3771
|
-
return
|
3800
|
+
return G(n, Object.assign(Object.assign({}, d), {
|
3772
3801
|
headers: f,
|
3773
3802
|
signal: m.signal
|
3774
3803
|
}));
|
3775
3804
|
case 4:
|
3776
|
-
|
3805
|
+
X = _context4.sent;
|
3777
3806
|
_context4.next = 7;
|
3778
|
-
return
|
3807
|
+
return Pe(X);
|
3779
3808
|
case 7:
|
3780
3809
|
_context4.next = 9;
|
3781
|
-
return vo(
|
3782
|
-
|
3783
|
-
}, function (
|
3784
|
-
y =
|
3810
|
+
return vo(X.body, yo(Eo(function (D) {
|
3811
|
+
D ? f[Ws] = D : delete f[Ws];
|
3812
|
+
}, function (D) {
|
3813
|
+
y = D;
|
3785
3814
|
}, r)));
|
3786
3815
|
case 9:
|
3787
3816
|
o == null || o();
|
3788
|
-
|
3817
|
+
j();
|
3789
3818
|
h();
|
3790
3819
|
_context4.next = 17;
|
3791
3820
|
break;
|
@@ -3793,10 +3822,10 @@ function wo(n, e) {
|
|
3793
3822
|
_context4.prev = 14;
|
3794
3823
|
_context4.t0 = _context4["catch"](1);
|
3795
3824
|
if (!m.signal.aborted) try {
|
3796
|
-
|
3797
|
-
window.clearTimeout(x), x = window.setTimeout(
|
3798
|
-
} catch (
|
3799
|
-
|
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);
|
3800
3829
|
}
|
3801
3830
|
case 17:
|
3802
3831
|
case "end":
|
@@ -3804,20 +3833,20 @@ function wo(n, e) {
|
|
3804
3833
|
}
|
3805
3834
|
}, _callee4, null, [[1, 14]]);
|
3806
3835
|
}));
|
3807
|
-
return
|
3836
|
+
return _I.apply(this, arguments);
|
3808
3837
|
}
|
3809
|
-
|
3838
|
+
I();
|
3810
3839
|
});
|
3811
3840
|
}
|
3812
3841
|
function To(n) {
|
3813
3842
|
var e = n.headers.get("content-type");
|
3814
3843
|
if (!(e != null && e.startsWith(as))) throw new Error("Expected content-type to be ".concat(as, ", Actual: ").concat(e));
|
3815
3844
|
}
|
3816
|
-
var
|
3817
|
-
function
|
3818
|
-
_classCallCheck(this,
|
3845
|
+
var A = /*#__PURE__*/function () {
|
3846
|
+
function A() {
|
3847
|
+
_classCallCheck(this, A);
|
3819
3848
|
}
|
3820
|
-
return _createClass(
|
3849
|
+
return _createClass(A, null, [{
|
3821
3850
|
key: "request",
|
3822
3851
|
value: // prettier-ignore
|
3823
3852
|
function () {
|
@@ -3827,9 +3856,9 @@ var C = /*#__PURE__*/function () {
|
|
3827
3856
|
p,
|
3828
3857
|
y,
|
3829
3858
|
x,
|
3830
|
-
|
3831
|
-
|
3832
|
-
|
3859
|
+
j,
|
3860
|
+
G,
|
3861
|
+
Pe,
|
3833
3862
|
o,
|
3834
3863
|
_yield$v$processReque,
|
3835
3864
|
a,
|
@@ -3881,26 +3910,26 @@ var C = /*#__PURE__*/function () {
|
|
3881
3910
|
return _context7.abrupt("return", be.requestStream(i, e.streamHandlers));
|
3882
3911
|
case 19:
|
3883
3912
|
f = new ge(i), m = v.fetch.bind(this, e, l, s);
|
3884
|
-
return _context7.abrupt("return", (wo(((
|
3885
|
-
method: ((
|
3913
|
+
return _context7.abrupt("return", (wo(((j = e.connectSettings) == null ? void 0 : j.url) || e.url || "", {
|
3914
|
+
method: ((G = e.connectSettings) == null ? void 0 : G.method) || "POST",
|
3886
3915
|
headers: l,
|
3887
|
-
credentials: (
|
3916
|
+
credentials: (Pe = e.connectSettings) == null ? void 0 : Pe.credentials,
|
3888
3917
|
body: s ? JSON.stringify(a) : a,
|
3889
3918
|
openWhenHidden: !0,
|
3890
3919
|
// keep stream open when browser tab not open
|
3891
|
-
onopen: function onopen(
|
3920
|
+
onopen: function onopen(I) {
|
3892
3921
|
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
3893
3922
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
3894
3923
|
while (1) switch (_context5.prev = _context5.next) {
|
3895
3924
|
case 0:
|
3896
|
-
if (!
|
3925
|
+
if (!I.ok) {
|
3897
3926
|
_context5.next = 2;
|
3898
3927
|
break;
|
3899
3928
|
}
|
3900
3929
|
return _context5.abrupt("return", d());
|
3901
3930
|
case 2:
|
3902
3931
|
_context5.next = 4;
|
3903
|
-
return v.processResponseByType(
|
3932
|
+
return v.processResponseByType(I);
|
3904
3933
|
case 4:
|
3905
3934
|
throw _context5.sent;
|
3906
3935
|
case 5:
|
@@ -3910,23 +3939,23 @@ var C = /*#__PURE__*/function () {
|
|
3910
3939
|
}, _callee5);
|
3911
3940
|
}))();
|
3912
3941
|
},
|
3913
|
-
onmessage: function onmessage(
|
3942
|
+
onmessage: function onmessage(I) {
|
3914
3943
|
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
3915
|
-
var
|
3944
|
+
var Z, X, D, je, Tt;
|
3916
3945
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
3917
3946
|
while (1) switch (_context6.prev = _context6.next) {
|
3918
3947
|
case 0:
|
3919
|
-
if (!(JSON.stringify(
|
3948
|
+
if (!(JSON.stringify(I.data) !== JSON.stringify("[DONE]"))) {
|
3920
3949
|
_context6.next = 9;
|
3921
3950
|
break;
|
3922
3951
|
}
|
3923
3952
|
try {
|
3924
|
-
je = JSON.parse(
|
3953
|
+
je = JSON.parse(I.data);
|
3925
3954
|
} catch (_unused6) {
|
3926
3955
|
je = {};
|
3927
3956
|
}
|
3928
3957
|
_context6.next = 4;
|
3929
|
-
return (
|
3958
|
+
return (X = (Z = e.deepChat).responseInterceptor) == null ? void 0 : X.call(Z, je);
|
3930
3959
|
case 4:
|
3931
3960
|
_context6.t0 = _context6.sent;
|
3932
3961
|
if (_context6.t0) {
|
@@ -3936,8 +3965,8 @@ var C = /*#__PURE__*/function () {
|
|
3936
3965
|
_context6.t0 = je;
|
3937
3966
|
case 7:
|
3938
3967
|
Tt = _context6.t0;
|
3939
|
-
(
|
3940
|
-
e.asyncCallInProgress && He && He.text !== "" ? (
|
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);
|
3941
3970
|
})["catch"](function (He) {
|
3942
3971
|
return v.displayError(i, He);
|
3943
3972
|
});
|
@@ -3948,23 +3977,23 @@ var C = /*#__PURE__*/function () {
|
|
3948
3977
|
}, _callee6);
|
3949
3978
|
}))();
|
3950
3979
|
},
|
3951
|
-
onerror: function onerror(
|
3952
|
-
throw h(),
|
3980
|
+
onerror: function onerror(I) {
|
3981
|
+
throw h(), I;
|
3953
3982
|
},
|
3954
3983
|
onclose: function onclose() {
|
3955
3984
|
if (!e.asyncCallInProgress) try {
|
3956
3985
|
f.finaliseStreamedMessage(), h();
|
3957
|
-
} catch (
|
3958
|
-
if (!r) throw
|
3986
|
+
} catch (I) {
|
3987
|
+
if (!r) throw I;
|
3959
3988
|
}
|
3960
3989
|
},
|
3961
3990
|
signal: u.signal
|
3962
|
-
})["catch"](function (
|
3963
|
-
var
|
3964
|
-
i.isLastMessageError() || (
|
3965
|
-
v.displayError(i,
|
3966
|
-
})["catch"](function (
|
3967
|
-
v.displayError(i,
|
3991
|
+
})["catch"](function (I) {
|
3992
|
+
var Z;
|
3993
|
+
i.isLastMessageError() || (Z = e.extractResultData) == null || Z.call(e, I).then(function () {
|
3994
|
+
v.displayError(i, I);
|
3995
|
+
})["catch"](function (X) {
|
3996
|
+
v.displayError(i, X);
|
3968
3997
|
});
|
3969
3998
|
}), f));
|
3970
3999
|
case 21:
|
@@ -3988,12 +4017,12 @@ var C = /*#__PURE__*/function () {
|
|
3988
4017
|
}, i), !1), i.text) {
|
3989
4018
|
t.onOpen();
|
3990
4019
|
var r = i.text.split("");
|
3991
|
-
|
4020
|
+
A.populateMessages(r, new ge(e), s, "text");
|
3992
4021
|
}
|
3993
4022
|
if (i.html) {
|
3994
4023
|
t.onOpen();
|
3995
|
-
var _r2 =
|
3996
|
-
|
4024
|
+
var _r2 = te.splitHTML(i.html);
|
4025
|
+
A.populateMessages(_r2, new ge(e), s, "html");
|
3997
4026
|
}
|
3998
4027
|
}
|
3999
4028
|
// prettier-ignore
|
@@ -4005,10 +4034,10 @@ var C = /*#__PURE__*/function () {
|
|
4005
4034
|
if (o) {
|
4006
4035
|
t.upsertStreamedMessage(_defineProperty({}, s, o));
|
4007
4036
|
var a = setTimeout(function () {
|
4008
|
-
|
4037
|
+
A.populateMessages(e, t, i, s, r + 1);
|
4009
4038
|
}, i.simulationInterim || 6);
|
4010
4039
|
i.abortStream.abort = function () {
|
4011
|
-
|
4040
|
+
A.abort(a, t, i.onClose);
|
4012
4041
|
};
|
4013
4042
|
} else t.finaliseStreamedMessage(), i.onClose();
|
4014
4043
|
}
|
@@ -4020,7 +4049,7 @@ var C = /*#__PURE__*/function () {
|
|
4020
4049
|
}, {
|
4021
4050
|
key: "isSimulatable",
|
4022
4051
|
value: function isSimulatable(e, t) {
|
4023
|
-
return
|
4052
|
+
return A.isSimulation(e) && t && (t.text || t.html);
|
4024
4053
|
}
|
4025
4054
|
}, {
|
4026
4055
|
key: "abort",
|
@@ -4093,7 +4122,7 @@ var Ke = /*#__PURE__*/function () {
|
|
4093
4122
|
_context8.t0 = i;
|
4094
4123
|
case 5:
|
4095
4124
|
s = _context8.t0;
|
4096
|
-
s.error ? (t.addNewErrorMessage("service", s.error), e.completionsHandlers.onFinish()) :
|
4125
|
+
s.error ? (t.addNewErrorMessage("service", s.error), e.completionsHandlers.onFinish()) : A.isSimulatable(e.stream, s) ? A.simulate(t, e.streamHandlers, s) : (t.addNewMessage(s), e.completionsHandlers.onFinish());
|
4097
4126
|
case 7:
|
4098
4127
|
case "end":
|
4099
4128
|
return _context8.stop();
|
@@ -4107,18 +4136,18 @@ var Ke = /*#__PURE__*/function () {
|
|
4107
4136
|
value: function requestStream(e, t) {
|
4108
4137
|
setTimeout(function () {
|
4109
4138
|
var i = Ke.getResponse(e);
|
4110
|
-
|
4139
|
+
A.simulate(e, t, i);
|
4111
4140
|
}, 400);
|
4112
4141
|
}
|
4113
4142
|
}]);
|
4114
4143
|
}();
|
4115
4144
|
Ke.URL = "deep-chat-demo";
|
4116
4145
|
var be = Ke;
|
4117
|
-
var
|
4118
|
-
function
|
4119
|
-
_classCallCheck(this,
|
4146
|
+
var U = /*#__PURE__*/function () {
|
4147
|
+
function U() {
|
4148
|
+
_classCallCheck(this, U);
|
4120
4149
|
}
|
4121
|
-
return _createClass(
|
4150
|
+
return _createClass(U, null, [{
|
4122
4151
|
key: "setup",
|
4123
4152
|
value: function setup(e) {
|
4124
4153
|
e.connectSettings.url !== be.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
@@ -4133,7 +4162,7 @@ var B = /*#__PURE__*/function () {
|
|
4133
4162
|
}, {
|
4134
4163
|
key: "createConnection",
|
4135
4164
|
value: function createConnection(e, t) {
|
4136
|
-
if (!
|
4165
|
+
if (!U.isElementPresentInDOM(e.deepChat)) return;
|
4137
4166
|
var i = e.connectSettings.websocket;
|
4138
4167
|
if (i) {
|
4139
4168
|
if (e.connectSettings.handler) return Ce.websocket(e, t);
|
@@ -4142,12 +4171,12 @@ var B = /*#__PURE__*/function () {
|
|
4142
4171
|
r = new WebSocket(e.connectSettings.url || "", s);
|
4143
4172
|
e.websocket = r, e.websocket.onopen = function () {
|
4144
4173
|
var o, a;
|
4145
|
-
t.removeError(), e.websocket && _typeof(e.websocket) == "object" &&
|
4174
|
+
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && U.assignListeners(e, r, t), (a = (o = e.deepChat)._validationHandler) == null || a.call(o);
|
4146
4175
|
}, e.websocket.onerror = function (o) {
|
4147
|
-
console.error(o),
|
4176
|
+
console.error(o), U.retryConnection(e, t);
|
4148
4177
|
};
|
4149
4178
|
} catch (s) {
|
4150
|
-
console.error(s),
|
4179
|
+
console.error(s), U.retryConnection(e, t);
|
4151
4180
|
}
|
4152
4181
|
}
|
4153
4182
|
}
|
@@ -4155,8 +4184,8 @@ var B = /*#__PURE__*/function () {
|
|
4155
4184
|
key: "retryConnection",
|
4156
4185
|
value: function retryConnection(e, t) {
|
4157
4186
|
var i, s;
|
4158
|
-
(s = (i = e.deepChat)._validationHandler) == null || s.call(i),
|
4159
|
-
|
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);
|
4160
4189
|
}, 5e3));
|
4161
4190
|
}
|
4162
4191
|
}, {
|
@@ -4195,11 +4224,11 @@ var B = /*#__PURE__*/function () {
|
|
4195
4224
|
_context9.next = 14;
|
4196
4225
|
break;
|
4197
4226
|
}
|
4198
|
-
throw Error(
|
4227
|
+
throw Error(M.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
4199
4228
|
case 14:
|
4200
|
-
if (
|
4201
|
-
h =
|
4202
|
-
|
4229
|
+
if (A.isSimulation(e.stream)) {
|
4230
|
+
h = U.stream.bind(_this6, e, i, s), u = s[l.role || b.AI_ROLE];
|
4231
|
+
A.upsertWFiles(i, h, u, d);
|
4203
4232
|
} else i.addNewMessage(d);
|
4204
4233
|
_context9.next = 20;
|
4205
4234
|
break;
|
@@ -4217,7 +4246,7 @@ var B = /*#__PURE__*/function () {
|
|
4217
4246
|
return _ref3.apply(this, arguments);
|
4218
4247
|
};
|
4219
4248
|
}(), t.onclose = function () {
|
4220
|
-
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(),
|
4249
|
+
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(), U.createConnection(e, i);
|
4221
4250
|
};
|
4222
4251
|
}
|
4223
4252
|
}, {
|
@@ -4261,7 +4290,7 @@ var B = /*#__PURE__*/function () {
|
|
4261
4290
|
}
|
4262
4291
|
return _context10.abrupt("return", i.addNewErrorMessage("service", l));
|
4263
4292
|
case 12:
|
4264
|
-
if (
|
4293
|
+
if (U.isWebSocket(r)) {
|
4265
4294
|
_context10.next = 14;
|
4266
4295
|
break;
|
4267
4296
|
}
|
@@ -4289,7 +4318,7 @@ var B = /*#__PURE__*/function () {
|
|
4289
4318
|
}, {
|
4290
4319
|
key: "canSendMessage",
|
4291
4320
|
value: function canSendMessage(e) {
|
4292
|
-
return e ? e === "pending" ? !1 :
|
4321
|
+
return e ? e === "pending" ? !1 : U.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
|
4293
4322
|
}
|
4294
4323
|
// if false then it is the internal websocket handler
|
4295
4324
|
}, {
|
@@ -4307,7 +4336,7 @@ var B = /*#__PURE__*/function () {
|
|
4307
4336
|
var o = s.role || b.AI_ROLE,
|
4308
4337
|
a = i[o];
|
4309
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));
|
4310
|
-
} else
|
4339
|
+
} else A.simulate(t, e.streamHandlers, s);
|
4311
4340
|
}
|
4312
4341
|
}]);
|
4313
4342
|
}();
|
@@ -4348,7 +4377,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4348
4377
|
_context11.t0 = c;
|
4349
4378
|
case 8:
|
4350
4379
|
d = _context11.t0;
|
4351
|
-
v.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) :
|
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());
|
4352
4381
|
case 10:
|
4353
4382
|
case "end":
|
4354
4383
|
return _context11.stop();
|
@@ -4378,7 +4407,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4378
4407
|
value: function attemptToFinaliseStream(e, t) {
|
4379
4408
|
try {
|
4380
4409
|
var i = t.messageElementRefs[t.messageElementRefs.length - 1];
|
4381
|
-
|
4410
|
+
Be.isLoadingMessage(i) ? t.removeLastMessage() : e.finaliseStreamedMessage();
|
4382
4411
|
} catch (i) {
|
4383
4412
|
console.error(i), t.addNewErrorMessage("service", i);
|
4384
4413
|
}
|
@@ -4420,7 +4449,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4420
4449
|
_context13.t0 = f;
|
4421
4450
|
case 7:
|
4422
4451
|
m = _context13.t0;
|
4423
|
-
v.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), s = !1) :
|
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));
|
4424
4453
|
case 9:
|
4425
4454
|
case "end":
|
4426
4455
|
return _context13.stop();
|
@@ -4485,9 +4514,9 @@ var Ce = /*#__PURE__*/function () {
|
|
4485
4514
|
_context14.t0 = d;
|
4486
4515
|
case 7:
|
4487
4516
|
h = _context14.t0;
|
4488
|
-
if (!v.validateResponseFormat(h)) console.error(
|
4489
|
-
m =
|
4490
|
-
|
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];
|
4519
|
+
A.upsertWFiles(t, m, p, d);
|
4491
4520
|
} else t.addNewMessage(h);
|
4492
4521
|
case 9:
|
4493
4522
|
case "end":
|
@@ -4587,7 +4616,7 @@ var T = /*#__PURE__*/function () {
|
|
4587
4616
|
return v.processResponseByType(p);
|
4588
4617
|
}).then(/*#__PURE__*/function () {
|
4589
4618
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(p) {
|
4590
|
-
var
|
4619
|
+
var j, G, y, x;
|
4591
4620
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
4592
4621
|
while (1) switch (_context15.prev = _context15.next) {
|
4593
4622
|
case 0:
|
@@ -4598,7 +4627,7 @@ var T = /*#__PURE__*/function () {
|
|
4598
4627
|
return _context15.abrupt("return");
|
4599
4628
|
case 2:
|
4600
4629
|
_context15.next = 4;
|
4601
|
-
return (
|
4630
|
+
return (G = (j = e.deepChat).responseInterceptor) == null ? void 0 : G.call(j, p);
|
4602
4631
|
case 4:
|
4603
4632
|
_context15.t0 = _context15.sent;
|
4604
4633
|
if (_context15.t0) {
|
@@ -4622,9 +4651,9 @@ var T = /*#__PURE__*/function () {
|
|
4622
4651
|
_context15.next = 15;
|
4623
4652
|
break;
|
4624
4653
|
}
|
4625
|
-
throw Error(
|
4654
|
+
throw Error(M.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, y));
|
4626
4655
|
case 15:
|
4627
|
-
x.makingAnotherRequest || (
|
4656
|
+
x.makingAnotherRequest || (A.isSimulatable(e.stream, x) ? A.simulate(i, e.streamHandlers, x) : (i.addNewMessage(x), c()));
|
4628
4657
|
case 16:
|
4629
4658
|
case "end":
|
4630
4659
|
return _context15.stop();
|
@@ -4684,7 +4713,7 @@ var T = /*#__PURE__*/function () {
|
|
4684
4713
|
a = _context17.sent;
|
4685
4714
|
a.timeoutMS ? setTimeout(function () {
|
4686
4715
|
T.executePollRequest(e, t, i, s);
|
4687
|
-
}, a.timeoutMS) :
|
4716
|
+
}, a.timeoutMS) : A.isSimulatable(e.stream, a) ? A.simulate(s, e.streamHandlers, a) : (s.addNewMessage(a), r());
|
4688
4717
|
case 13:
|
4689
4718
|
case "end":
|
4690
4719
|
return _context17.stop();
|
@@ -4758,7 +4787,7 @@ var T = /*#__PURE__*/function () {
|
|
4758
4787
|
}, {
|
4759
4788
|
key: "verifyKey",
|
4760
4789
|
value: function verifyKey(e, t, i, s, r, o, a, l, c) {
|
4761
|
-
if (e === "") return o(
|
4790
|
+
if (e === "") return o(M.INVALID_KEY);
|
4762
4791
|
a(), fetch(t, {
|
4763
4792
|
method: s,
|
4764
4793
|
headers: i,
|
@@ -4768,7 +4797,7 @@ var T = /*#__PURE__*/function () {
|
|
4768
4797
|
}).then(function (d) {
|
4769
4798
|
l(d, e, r, o);
|
4770
4799
|
})["catch"](function (d) {
|
4771
|
-
o(
|
4800
|
+
o(M.CONNECTION_FAILED), console.error(d);
|
4772
4801
|
});
|
4773
4802
|
}
|
4774
4803
|
}]);
|
@@ -4795,7 +4824,7 @@ var pt = /*#__PURE__*/function () {
|
|
4795
4824
|
this._messages.removeMessage(t), i.forEach(function (s) {
|
4796
4825
|
return _this8._messages.addAnyMessage(s, !0);
|
4797
4826
|
}), setTimeout(function () {
|
4798
|
-
return
|
4827
|
+
return J.scrollToBottom(_this8._messages.elementRef);
|
4799
4828
|
}, 0);
|
4800
4829
|
case 5:
|
4801
4830
|
case "end":
|
@@ -4881,7 +4910,7 @@ var pt = /*#__PURE__*/function () {
|
|
4881
4910
|
value: function populateInitialHistory(e) {
|
4882
4911
|
var _this11 = this;
|
4883
4912
|
e.forEach(function (t) {
|
4884
|
-
|
4913
|
+
le.processHistoryFile(t), _this11._messages.addNewMessage(t, !0);
|
4885
4914
|
});
|
4886
4915
|
}
|
4887
4916
|
}, {
|
@@ -4908,7 +4937,7 @@ var pt = /*#__PURE__*/function () {
|
|
4908
4937
|
return !!o;
|
4909
4938
|
});
|
4910
4939
|
this.processLoadedHistory(r), s === 0 && setTimeout(function () {
|
4911
|
-
return
|
4940
|
+
return J.scrollToBottom(_this12._messages.elementRef);
|
4912
4941
|
}, 0);
|
4913
4942
|
_context22.next = 15;
|
4914
4943
|
break;
|
@@ -4938,7 +4967,7 @@ var pt = /*#__PURE__*/function () {
|
|
4938
4967
|
while (1) switch (_context23.prev = _context23.next) {
|
4939
4968
|
case 0:
|
4940
4969
|
e.loadHistory && this.loadInitialHistory(e.loadHistory);
|
4941
|
-
t = e.history ||
|
4970
|
+
t = e.history || le.processHistory(e);
|
4942
4971
|
t && (this.populateInitialHistory(t), this._index += 1);
|
4943
4972
|
case 3:
|
4944
4973
|
case "end":
|
@@ -4997,11 +5026,11 @@ var St = /*#__PURE__*/function () {
|
|
4997
5026
|
}
|
4998
5027
|
}]);
|
4999
5028
|
}();
|
5000
|
-
var
|
5001
|
-
function
|
5002
|
-
_classCallCheck(this,
|
5029
|
+
var P = /*#__PURE__*/function () {
|
5030
|
+
function P() {
|
5031
|
+
_classCallCheck(this, P);
|
5003
5032
|
}
|
5004
|
-
return _createClass(
|
5033
|
+
return _createClass(P, null, [{
|
5005
5034
|
key: "parseConfig",
|
5006
5035
|
value:
|
5007
5036
|
// prettier-ignore
|
@@ -5011,7 +5040,7 @@ var L = /*#__PURE__*/function () {
|
|
5011
5040
|
files: t
|
5012
5041
|
};
|
5013
5042
|
if (_typeof(s) == "object") {
|
5014
|
-
|
5043
|
+
le.processFileConfigConnect(s);
|
5015
5044
|
var a = s.files,
|
5016
5045
|
l = s.connect,
|
5017
5046
|
c = s.button;
|
@@ -5031,7 +5060,7 @@ var L = /*#__PURE__*/function () {
|
|
5031
5060
|
var s = {
|
5032
5061
|
acceptedFormats: ""
|
5033
5062
|
};
|
5034
|
-
e.fileTypes.mixedFiles =
|
5063
|
+
e.fileTypes.mixedFiles = P.parseConfig(e.connectSettings, s, t, i);
|
5035
5064
|
}
|
5036
5065
|
}
|
5037
5066
|
// needs to be set after audio to overwrite maxNumberOfFiles
|
@@ -5044,7 +5073,7 @@ var L = /*#__PURE__*/function () {
|
|
5044
5073
|
var o = _objectSpread({
|
5045
5074
|
acceptedFormats: "audio/*"
|
5046
5075
|
}, ((a = e.fileTypes.audio) == null ? void 0 : a.files) || {});
|
5047
|
-
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio =
|
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)));
|
5048
5077
|
}
|
5049
5078
|
// prettier-ignore
|
5050
5079
|
}, {
|
@@ -5054,7 +5083,7 @@ var L = /*#__PURE__*/function () {
|
|
5054
5083
|
var o = _objectSpread({
|
5055
5084
|
acceptedFormats: "audio/*"
|
5056
5085
|
}, (s == null ? void 0 : s.files) || {});
|
5057
|
-
e.fileTypes.audio =
|
5086
|
+
e.fileTypes.audio = P.parseConfig(e.connectSettings, o, t, i);
|
5058
5087
|
}
|
5059
5088
|
// prettier-ignore
|
5060
5089
|
}, {
|
@@ -5064,7 +5093,7 @@ var L = /*#__PURE__*/function () {
|
|
5064
5093
|
var o = _objectSpread({
|
5065
5094
|
acceptedFormats: "image/gif"
|
5066
5095
|
}, (s == null ? void 0 : s.files) || {});
|
5067
|
-
e.fileTypes.gifs =
|
5096
|
+
e.fileTypes.gifs = P.parseConfig(e.connectSettings, o, t, i);
|
5068
5097
|
}
|
5069
5098
|
// needs to be set after images to overwrite maxNumberOfFiles
|
5070
5099
|
// prettier-ignore
|
@@ -5076,7 +5105,7 @@ var L = /*#__PURE__*/function () {
|
|
5076
5105
|
var o = _objectSpread({
|
5077
5106
|
acceptedFormats: "image/*"
|
5078
5107
|
}, ((a = e.fileTypes.images) == null ? void 0 : a.files) || {});
|
5079
|
-
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.camera =
|
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)));
|
5080
5109
|
}
|
5081
5110
|
// prettier-ignore
|
5082
5111
|
}, {
|
@@ -5086,7 +5115,7 @@ var L = /*#__PURE__*/function () {
|
|
5086
5115
|
var o = _objectSpread({
|
5087
5116
|
acceptedFormats: "image/*"
|
5088
5117
|
}, (s == null ? void 0 : s.files) || {});
|
5089
|
-
e.fileTypes.images =
|
5118
|
+
e.fileTypes.images = P.parseConfig(e.connectSettings, o, t, i);
|
5090
5119
|
}
|
5091
5120
|
// default for direct service
|
5092
5121
|
}, {
|
@@ -5099,9 +5128,9 @@ var L = /*#__PURE__*/function () {
|
|
5099
5128
|
}, {
|
5100
5129
|
key: "set",
|
5101
5130
|
value: function set(e, t, i) {
|
5102
|
-
|
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");
|
5103
5132
|
var s = jt.createNew();
|
5104
|
-
|
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);
|
5105
5134
|
}
|
5106
5135
|
}]);
|
5107
5136
|
}();
|
@@ -5110,7 +5139,7 @@ var it = /*#__PURE__*/function () {
|
|
5110
5139
|
var _a$url;
|
5111
5140
|
_classCallCheck(this, it);
|
5112
5141
|
var s, r, o, a, l;
|
5113
|
-
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,
|
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);
|
5114
5143
|
}
|
5115
5144
|
return _createClass(it, [{
|
5116
5145
|
key: "verifyKey",
|
@@ -5136,7 +5165,7 @@ var it = /*#__PURE__*/function () {
|
|
5136
5165
|
while (1) switch (_context24.prev = _context24.next) {
|
5137
5166
|
case 0:
|
5138
5167
|
i = _args24.length > 2 && _args24[2] !== undefined ? _args24[2] : !0;
|
5139
|
-
return _context24.abrupt("return", this.stream && !
|
5168
|
+
return _context24.abrupt("return", this.stream && !A.isSimulation(this.stream) ? A.request(this, e, t, i) : T.request(this, e, t, i));
|
5140
5169
|
case 2:
|
5141
5170
|
case "end":
|
5142
5171
|
return _context24.stop();
|
@@ -5240,7 +5269,7 @@ var it = /*#__PURE__*/function () {
|
|
5240
5269
|
s = _objectSpread({
|
5241
5270
|
messages: i
|
5242
5271
|
}, this.rawBody);
|
5243
|
-
|
5272
|
+
U.sendWebsocket(this, s, t, !1);
|
5244
5273
|
} else this.callServiceAPI(t, i, e.files);
|
5245
5274
|
case 4:
|
5246
5275
|
case "end":
|
@@ -5270,7 +5299,7 @@ var it = /*#__PURE__*/function () {
|
|
5270
5299
|
_context29.next = 4;
|
5271
5300
|
break;
|
5272
5301
|
}
|
5273
|
-
return _context29.abrupt("return",
|
5302
|
+
return _context29.abrupt("return", le.handleResponseProperty(e));
|
5274
5303
|
case 4:
|
5275
5304
|
if (!v.validateResponseFormat(e)) {
|
5276
5305
|
_context29.next = 6;
|
@@ -5321,17 +5350,17 @@ var it = /*#__PURE__*/function () {
|
|
5321
5350
|
}
|
5322
5351
|
}]);
|
5323
5352
|
}();
|
5324
|
-
var
|
5353
|
+
var z = /*#__PURE__*/function (_it) {
|
5325
5354
|
// prettier-ignore
|
5326
|
-
function
|
5355
|
+
function z(e, t, i, s, r) {
|
5327
5356
|
var _this13;
|
5328
|
-
_classCallCheck(this,
|
5357
|
+
_classCallCheck(this, z);
|
5329
5358
|
var o;
|
5330
|
-
_this13 = _callSuper(this,
|
5359
|
+
_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);
|
5331
5360
|
return _this13;
|
5332
5361
|
}
|
5333
|
-
_inherits(
|
5334
|
-
return _createClass(
|
5362
|
+
_inherits(z, _it);
|
5363
|
+
return _createClass(z, [{
|
5335
5364
|
key: "setApiKeyProperties",
|
5336
5365
|
value: function setApiKeyProperties(e) {
|
5337
5366
|
this.key = e.key, e.validateKeyProperty && (this.validateKeyProperty = e.validateKeyProperty);
|
@@ -5435,32 +5464,32 @@ _e._attributes_ = {}, _e._attributeToProperty_ = {};
|
|
5435
5464
|
var ls = _e;
|
5436
5465
|
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",
|
5437
5466
|
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";
|
5438
|
-
var
|
5439
|
-
function
|
5440
|
-
_classCallCheck(this,
|
5467
|
+
var ie = /*#__PURE__*/function () {
|
5468
|
+
function ie() {
|
5469
|
+
_classCallCheck(this, ie);
|
5441
5470
|
}
|
5442
|
-
return _createClass(
|
5471
|
+
return _createClass(ie, null, [{
|
5443
5472
|
key: "createSVGElement",
|
5444
5473
|
value: function createSVGElement(e) {
|
5445
5474
|
return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
|
5446
5475
|
}
|
5447
5476
|
}]);
|
5448
5477
|
}();
|
5449
|
-
var
|
5450
|
-
function
|
5451
|
-
_classCallCheck(this,
|
5478
|
+
var Ne = /*#__PURE__*/function () {
|
5479
|
+
function Ne() {
|
5480
|
+
_classCallCheck(this, Ne);
|
5452
5481
|
}
|
5453
|
-
return _createClass(
|
5482
|
+
return _createClass(Ne, null, [{
|
5454
5483
|
key: "changeVisibility",
|
5455
5484
|
value:
|
5456
5485
|
// prettier-ignore
|
5457
5486
|
function changeVisibility(e, t, i, s) {
|
5458
|
-
s.target.id ===
|
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");
|
5459
5488
|
}
|
5460
5489
|
}, {
|
5461
5490
|
key: "createIconElement",
|
5462
5491
|
value: function createIconElement(e, t) {
|
5463
|
-
var i =
|
5492
|
+
var i = ie.createSVGElement(e);
|
5464
5493
|
return i.id = t, i.classList.add("visibility-icon"), i;
|
5465
5494
|
}
|
5466
5495
|
// prettier-ignore
|
@@ -5469,20 +5498,20 @@ var Oe = /*#__PURE__*/function () {
|
|
5469
5498
|
value: function create(e) {
|
5470
5499
|
var t = document.createElement("div");
|
5471
5500
|
t.id = "visibility-icon-container";
|
5472
|
-
var i =
|
5501
|
+
var i = Ne.createIconElement(Ao, Ne.VISIBLE_ICON_ID);
|
5473
5502
|
i.style.display = "none", t.appendChild(i);
|
5474
|
-
var s =
|
5475
|
-
return t.appendChild(s), t.onclick =
|
5503
|
+
var s = Ne.createIconElement(Co, "not-visible-icon");
|
5504
|
+
return t.appendChild(s), t.onclick = Ne.changeVisibility.bind(this, e, i, s), t;
|
5476
5505
|
}
|
5477
5506
|
}]);
|
5478
5507
|
}();
|
5479
|
-
|
5480
|
-
var cs =
|
5481
|
-
var
|
5482
|
-
function
|
5483
|
-
_classCallCheck(this,
|
5508
|
+
Ne.VISIBLE_ICON_ID = "visible-icon";
|
5509
|
+
var cs = Ne;
|
5510
|
+
var H = /*#__PURE__*/function () {
|
5511
|
+
function H() {
|
5512
|
+
_classCallCheck(this, H);
|
5484
5513
|
}
|
5485
|
-
return _createClass(
|
5514
|
+
return _createClass(H, null, [{
|
5486
5515
|
key: "createCautionText",
|
5487
5516
|
value: function createCautionText() {
|
5488
5517
|
var e = document.createElement("a");
|
@@ -5508,13 +5537,13 @@ var j = /*#__PURE__*/function () {
|
|
5508
5537
|
i.id = "insert-key-help-text-container";
|
5509
5538
|
var s = document.createElement("div");
|
5510
5539
|
s.id = "insert-key-help-text-contents";
|
5511
|
-
var r =
|
5540
|
+
var r = H.createFailText();
|
5512
5541
|
if (s.appendChild(r), e) {
|
5513
|
-
var o =
|
5542
|
+
var o = H.createHelpLink(e);
|
5514
5543
|
s.appendChild(o);
|
5515
5544
|
}
|
5516
5545
|
if (t === !0) {
|
5517
|
-
var _o2 =
|
5546
|
+
var _o2 = H.createCautionText();
|
5518
5547
|
s.appendChild(_o2);
|
5519
5548
|
}
|
5520
5549
|
return i.appendChild(s), {
|
@@ -5545,12 +5574,12 @@ var j = /*#__PURE__*/function () {
|
|
5545
5574
|
value: function addVerificationEvents(e, t, i, s, r) {
|
5546
5575
|
var o = {
|
5547
5576
|
onSuccess: s,
|
5548
|
-
onFail:
|
5549
|
-
onLoad:
|
5577
|
+
onFail: H.onFail.bind(this, e, t, i),
|
5578
|
+
onLoad: H.onLoad.bind(this, e, t)
|
5550
5579
|
},
|
5551
|
-
a =
|
5580
|
+
a = H.verifyKey.bind(this, e, o, r);
|
5552
5581
|
t.onclick = a, e.onkeydown = function (l) {
|
5553
|
-
!e.classList.contains("loading") && l.key ===
|
5582
|
+
!e.classList.contains("loading") && l.key === O.ENTER && a();
|
5554
5583
|
};
|
5555
5584
|
}
|
5556
5585
|
}, {
|
@@ -5570,7 +5599,7 @@ var j = /*#__PURE__*/function () {
|
|
5570
5599
|
var t = document.createElement("div");
|
5571
5600
|
t.id = "insert-key-input-container";
|
5572
5601
|
var i = document.createElement("input");
|
5573
|
-
return i.id = "insert-key-input", i.placeholder = e || "API Key", i.type = "password", i.classList.add("insert-key-input-valid"), i.onfocus =
|
5602
|
+
return i.id = "insert-key-input", i.placeholder = e || "API Key", i.type = "password", i.classList.add("insert-key-input-valid"), i.onfocus = H.onInputFocus, t.appendChild(i), t;
|
5574
5603
|
}
|
5575
5604
|
// prettier-ignore
|
5576
5605
|
}, {
|
@@ -5579,51 +5608,51 @@ var j = /*#__PURE__*/function () {
|
|
5579
5608
|
var d;
|
5580
5609
|
var i = document.createElement("div");
|
5581
5610
|
i.id = "insert-key-contents";
|
5582
|
-
var s =
|
5611
|
+
var s = H.createInput(t.insertKeyPlaceholderText),
|
5583
5612
|
r = s.children[0],
|
5584
5613
|
o = cs.create(r);
|
5585
5614
|
s.appendChild(o), i.appendChild(s);
|
5586
|
-
var a =
|
5587
|
-
|
5588
|
-
l =
|
5589
|
-
c =
|
5590
|
-
return i.appendChild(a), i.appendChild(l),
|
5615
|
+
var a = H.createStartButton(),
|
5616
|
+
_H$createHelpTextCont = H.createHelpTextContainer(t.keyHelpUrl, (d = t.deepChat._insertKeyViewStyles) == null ? void 0 : d.displayCautionText),
|
5617
|
+
l = _H$createHelpTextCont.helpTextContainerElement,
|
5618
|
+
c = _H$createHelpTextCont.failTextElement;
|
5619
|
+
return i.appendChild(a), i.appendChild(l), H.addVerificationEvents(r, a, c, e, t), i;
|
5591
5620
|
}
|
5592
5621
|
}, {
|
5593
5622
|
key: "createElements",
|
5594
5623
|
value: function createElements(e, t) {
|
5595
5624
|
var i = document.createElement("div");
|
5596
5625
|
i.id = "insert-key-view";
|
5597
|
-
var s =
|
5626
|
+
var s = H.createContents(e, t);
|
5598
5627
|
return i.appendChild(s), i;
|
5599
5628
|
}
|
5600
5629
|
}, {
|
5601
5630
|
key: "render",
|
5602
5631
|
value: function render(e, t, i) {
|
5603
|
-
var s =
|
5632
|
+
var s = H.createElements(t, i);
|
5604
5633
|
e.replaceChildren(s);
|
5605
5634
|
}
|
5606
5635
|
}]);
|
5607
5636
|
}();
|
5608
|
-
var
|
5609
|
-
function
|
5610
|
-
_classCallCheck(this,
|
5637
|
+
var Q = /*#__PURE__*/function () {
|
5638
|
+
function Q() {
|
5639
|
+
_classCallCheck(this, Q);
|
5611
5640
|
}
|
5612
|
-
return _createClass(
|
5641
|
+
return _createClass(Q, null, [{
|
5613
5642
|
key: "enableButtons",
|
5614
5643
|
value: function enableButtons(e, t) {
|
5615
5644
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
5616
5645
|
window.webLLM ? (e && (e.disabled = !1), t && (t.disabled = !1)) : i < qt.MODULE_SEARCH_LIMIT_S * 4 && setTimeout(function () {
|
5617
|
-
return
|
5646
|
+
return Q.enableButtons(e, t, i + 1);
|
5618
5647
|
}, 250);
|
5619
5648
|
}
|
5620
5649
|
// prettier-ignore
|
5621
5650
|
}, {
|
5622
5651
|
key: "setUpInitial",
|
5623
5652
|
value: function setUpInitial(e, t, i, s) {
|
5624
|
-
var r = (t == null ? void 0 : t.downloadClass) ||
|
5625
|
-
o = (t == null ? void 0 : t.uploadClass) ||
|
5626
|
-
a = (t == null ? void 0 : t.fileInputClass) ||
|
5653
|
+
var r = (t == null ? void 0 : t.downloadClass) || Q.DOWNLOAD_BUTTON_CLASS,
|
5654
|
+
o = (t == null ? void 0 : t.uploadClass) || Q.UPLOAD_BUTTON_CLASS,
|
5655
|
+
a = (t == null ? void 0 : t.fileInputClass) || Q.FILE_INPUT_CLASS;
|
5627
5656
|
return setTimeout(function () {
|
5628
5657
|
var l = i == null ? void 0 : i.getElementsByClassName(r)[0],
|
5629
5658
|
c = i == null ? void 0 : i.getElementsByClassName(a)[0],
|
@@ -5634,7 +5663,7 @@ var Y = /*#__PURE__*/function () {
|
|
5634
5663
|
c.files && c.files.length > 0 && e(c.files);
|
5635
5664
|
}), d && (d.onclick = function () {
|
5636
5665
|
return c.click();
|
5637
|
-
}), (l || d) &&
|
5666
|
+
}), (l || d) && Q.enableButtons(l, d);
|
5638
5667
|
}), (t == null ? void 0 : t.initialHtml) || "<div>\n Download or upload a web model that will run entirely on your browser: <br/> \n <button disabled class=\"".concat(r, " deep-chat-button deep-chat-web-model-button\">Download</button>\n ").concat(s ? "" : "<input type=\"file\" class=\"".concat(a, "\" hidden multiple />\n <button disabled class=\"").concat(o, " deep-chat-button deep-chat-web-model-button\">Upload</button>"), "\n </div>");
|
5639
5668
|
}
|
5640
5669
|
}, {
|
@@ -5659,18 +5688,18 @@ var Y = /*#__PURE__*/function () {
|
|
5659
5688
|
}, {
|
5660
5689
|
key: "setUpAfterLoad",
|
5661
5690
|
value: function setUpAfterLoad(e, t, i, s) {
|
5662
|
-
var r = (t == null ? void 0 : t.exportFilesClass) ||
|
5691
|
+
var r = (t == null ? void 0 : t.exportFilesClass) || Q.EXPORT_BUTTON_CLASS;
|
5663
5692
|
return setTimeout(function () {
|
5664
5693
|
var o = i == null ? void 0 : i.getElementsByClassName(r)[0];
|
5665
5694
|
o && (o.onclick = function () {
|
5666
|
-
return
|
5695
|
+
return Q.exportFile(e);
|
5667
5696
|
});
|
5668
5697
|
}), (t == null ? void 0 : t.afterLoadHtml) || "<div>\n Model loaded successfully and has been cached for future requests.\n ".concat(s ? "" : "<br/> <button style=\"margin-top: 5px\" class=\"".concat(r, " deep-chat-button\">Export</button>"), "\n </div>");
|
5669
5698
|
}
|
5670
5699
|
}]);
|
5671
5700
|
}();
|
5672
|
-
|
5673
|
-
var fi =
|
5701
|
+
Q.DOWNLOAD_BUTTON_CLASS = "deep-chat-download-button", Q.UPLOAD_BUTTON_CLASS = "deep-chat-upload-button", Q.FILE_INPUT_CLASS = "deep-chat-file-input", Q.EXPORT_BUTTON_CLASS = "deep-chat-export-button";
|
5702
|
+
var fi = Q;
|
5674
5703
|
var Ks = {
|
5675
5704
|
model_list: [
|
5676
5705
|
// Llama-2
|
@@ -5838,7 +5867,7 @@ var Ks = {
|
|
5838
5867
|
var t;
|
5839
5868
|
((t = this._webModel.introMessage) == null ? void 0 : t.autoScroll) !== !1 && setTimeout(function () {
|
5840
5869
|
var i, s;
|
5841
|
-
(i = _this18._messages) != null && i.elementRef &&
|
5870
|
+
(i = _this18._messages) != null && i.elementRef && J.scrollToTop((s = _this18._messages) == null ? void 0 : s.elementRef);
|
5842
5871
|
}, e);
|
5843
5872
|
}
|
5844
5873
|
// prettier-ignore
|
@@ -5970,7 +5999,7 @@ var Ks = {
|
|
5970
5999
|
sendUpdate: !1
|
5971
6000
|
}), i && (setTimeout(function () {
|
5972
6001
|
var p;
|
5973
|
-
return
|
6002
|
+
return J.scrollToBottom((p = _this19._messages) == null ? void 0 : p.elementRef);
|
5974
6003
|
}), i = !1);
|
5975
6004
|
};
|
5976
6005
|
w.chat.setInitProgressCallback(s);
|
@@ -6189,7 +6218,7 @@ var Ks = {
|
|
6189
6218
|
a = !!this.stream;
|
6190
6219
|
try {
|
6191
6220
|
if (o) v.displayError(e, new Error(o)), (a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish)();else if (!r || !r.text) {
|
6192
|
-
l =
|
6221
|
+
l = M.INVALID_MODEL_REQUEST({
|
6193
6222
|
body: r
|
6194
6223
|
}, !1);
|
6195
6224
|
console.error(l);
|
@@ -6296,7 +6325,7 @@ var Ks = {
|
|
6296
6325
|
_context40.next = 15;
|
6297
6326
|
break;
|
6298
6327
|
}
|
6299
|
-
o =
|
6328
|
+
o = M.INVALID_MODEL_RESPONSE(i, !!e.responseInterceptor, s);
|
6300
6329
|
v.displayError(t, new Error(o));
|
6301
6330
|
return _context40.abrupt("return");
|
6302
6331
|
case 15:
|
@@ -6350,7 +6379,7 @@ var pi = /*#__PURE__*/function () {
|
|
6350
6379
|
key: "handleVerificationResult",
|
6351
6380
|
value: function handleVerificationResult(e, t, i, s) {
|
6352
6381
|
var r = e;
|
6353
|
-
Array.isArray(r.error) && r.error[0] === "Error in `parameters`: field required" ? i(t) : s(
|
6382
|
+
Array.isArray(r.error) && r.error[0] === "Error in `parameters`: field required" ? i(t) : s(M.INVALID_KEY);
|
6354
6383
|
}
|
6355
6384
|
}, {
|
6356
6385
|
key: "buildKeyVerificationDetails",
|
@@ -6363,7 +6392,7 @@ var pi = /*#__PURE__*/function () {
|
|
6363
6392
|
}
|
6364
6393
|
}]);
|
6365
6394
|
}();
|
6366
|
-
var Nt = /*#__PURE__*/function (
|
6395
|
+
var Nt = /*#__PURE__*/function (_z) {
|
6367
6396
|
// prettier-ignore
|
6368
6397
|
function Nt(e, t, i, s, r, o) {
|
6369
6398
|
var _this21;
|
@@ -6372,7 +6401,7 @@ var Nt = /*#__PURE__*/function (_q) {
|
|
6372
6401
|
return _this21;
|
6373
6402
|
}
|
6374
6403
|
// prettier-ignore
|
6375
|
-
_inherits(Nt,
|
6404
|
+
_inherits(Nt, _z);
|
6376
6405
|
return _createClass(Nt, [{
|
6377
6406
|
key: "preprocessBody",
|
6378
6407
|
value: function preprocessBody(e, t, i) {
|
@@ -6411,10 +6440,10 @@ var Nt = /*#__PURE__*/function (_q) {
|
|
6411
6440
|
return callServiceAPI;
|
6412
6441
|
}()
|
6413
6442
|
}]);
|
6414
|
-
}(
|
6443
|
+
}(z);
|
6415
6444
|
Nt.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
6416
|
-
var
|
6417
|
-
var Jt = /*#__PURE__*/function (
|
6445
|
+
var Le = Nt;
|
6446
|
+
var Jt = /*#__PURE__*/function (_Le) {
|
6418
6447
|
// prettier-ignore
|
6419
6448
|
function Jt(e, t, i, s, r, o) {
|
6420
6449
|
var _this22;
|
@@ -6422,7 +6451,7 @@ var Jt = /*#__PURE__*/function (_Ie) {
|
|
6422
6451
|
_this22 = _callSuper(this, Jt, [e, t, i, s, r, o]), _this22.isTextInputDisabled = !0, _this22.canSendMessage = Jt.canSendFile;
|
6423
6452
|
return _this22;
|
6424
6453
|
}
|
6425
|
-
_inherits(Jt,
|
6454
|
+
_inherits(Jt, _Le);
|
6426
6455
|
return _createClass(Jt, [{
|
6427
6456
|
key: "preprocessBody",
|
6428
6457
|
value: function preprocessBody(e, t, i) {
|
@@ -6466,7 +6495,7 @@ var Jt = /*#__PURE__*/function (_Ie) {
|
|
6466
6495
|
return !!(t != null && t[0]);
|
6467
6496
|
}
|
6468
6497
|
}]);
|
6469
|
-
}(
|
6498
|
+
}(Le);
|
6470
6499
|
var ko = /*#__PURE__*/function (_Jt) {
|
6471
6500
|
// prettier-ignore
|
6472
6501
|
function ko(e) {
|
@@ -6583,7 +6612,7 @@ var ve = /*#__PURE__*/function () {
|
|
6583
6612
|
}, {
|
6584
6613
|
key: "handleVerificationResult",
|
6585
6614
|
value: function handleVerificationResult(e, t, i, s) {
|
6586
|
-
e.message ? s(
|
6615
|
+
e.message ? s(M.INVALID_KEY) : i(t);
|
6587
6616
|
}
|
6588
6617
|
}, {
|
6589
6618
|
key: "buildKeyVerificationDetails",
|
@@ -6596,7 +6625,7 @@ var ve = /*#__PURE__*/function () {
|
|
6596
6625
|
}
|
6597
6626
|
}]);
|
6598
6627
|
}();
|
6599
|
-
var Oi = /*#__PURE__*/function (
|
6628
|
+
var Oi = /*#__PURE__*/function (_z2) {
|
6600
6629
|
// prettier-ignore
|
6601
6630
|
function Oi(e, t, i, s, r) {
|
6602
6631
|
var _this23;
|
@@ -6604,9 +6633,9 @@ var Oi = /*#__PURE__*/function (_q2) {
|
|
6604
6633
|
_this23 = _callSuper(this, Oi, [e, t, i, s, r]), _this23.insertKeyPlaceholderText = "Stability AI API Key", _this23.keyHelpUrl = "https://platform.stability.ai/docs/getting-started/authentication", _this23.permittedErrorPrefixes = ["Incorrect", "invalid_"];
|
6605
6634
|
return _this23;
|
6606
6635
|
}
|
6607
|
-
_inherits(Oi,
|
6636
|
+
_inherits(Oi, _z2);
|
6608
6637
|
return _createClass(Oi);
|
6609
|
-
}(
|
6638
|
+
}(z);
|
6610
6639
|
var mi = /*#__PURE__*/function (_Oi) {
|
6611
6640
|
function mi(e) {
|
6612
6641
|
var _this24;
|
@@ -6869,7 +6898,7 @@ var Ro = /*#__PURE__*/function (_Jt3) {
|
|
6869
6898
|
}()
|
6870
6899
|
}]);
|
6871
6900
|
}(Jt);
|
6872
|
-
var Io = /*#__PURE__*/function (
|
6901
|
+
var Io = /*#__PURE__*/function (_Le2) {
|
6873
6902
|
function Io(e) {
|
6874
6903
|
_classCallCheck(this, Io);
|
6875
6904
|
var s, r, o;
|
@@ -6877,7 +6906,7 @@ var Io = /*#__PURE__*/function (_Ie2) {
|
|
6877
6906
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6878
6907
|
return _callSuper(this, Io, [e, "Once upon a time", "gpt2", t, i]);
|
6879
6908
|
}
|
6880
|
-
_inherits(Io,
|
6909
|
+
_inherits(Io, _Le2);
|
6881
6910
|
return _createClass(Io, [{
|
6882
6911
|
key: "extractResultData",
|
6883
6912
|
value: function () {
|
@@ -6907,8 +6936,8 @@ var Io = /*#__PURE__*/function (_Ie2) {
|
|
6907
6936
|
return extractResultData;
|
6908
6937
|
}()
|
6909
6938
|
}]);
|
6910
|
-
}(
|
6911
|
-
var Lo = /*#__PURE__*/function (
|
6939
|
+
}(Le);
|
6940
|
+
var Lo = /*#__PURE__*/function (_Le3) {
|
6912
6941
|
function Lo(e) {
|
6913
6942
|
var _this26;
|
6914
6943
|
_classCallCheck(this, Lo);
|
@@ -6918,7 +6947,7 @@ var Lo = /*#__PURE__*/function (_Ie3) {
|
|
6918
6947
|
_this26 = _callSuper(this, Lo, [e, "Ask a question", "bert-large-uncased-whole-word-masking-finetuned-squad", t, i]), _this26.permittedErrorPrefixes = ["Authorization header", "Error in"], _this26.context = t.context;
|
6919
6948
|
return _this26;
|
6920
6949
|
}
|
6921
|
-
_inherits(Lo,
|
6950
|
+
_inherits(Lo, _Le3);
|
6922
6951
|
return _createClass(Lo, [{
|
6923
6952
|
key: "preprocessBody",
|
6924
6953
|
value: function preprocessBody(e, t) {
|
@@ -6961,8 +6990,8 @@ var Lo = /*#__PURE__*/function (_Ie3) {
|
|
6961
6990
|
return extractResultData;
|
6962
6991
|
}()
|
6963
6992
|
}]);
|
6964
|
-
}(
|
6965
|
-
var Po = /*#__PURE__*/function (
|
6993
|
+
}(Le);
|
6994
|
+
var Po = /*#__PURE__*/function (_Le4) {
|
6966
6995
|
function Po(e) {
|
6967
6996
|
_classCallCheck(this, Po);
|
6968
6997
|
var s, r, o;
|
@@ -6970,7 +6999,7 @@ var Po = /*#__PURE__*/function (_Ie4) {
|
|
6970
6999
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6971
7000
|
return _callSuper(this, Po, [e, "Insert text to summarize", "facebook/bart-large-cnn", t, i]);
|
6972
7001
|
}
|
6973
|
-
_inherits(Po,
|
7002
|
+
_inherits(Po, _Le4);
|
6974
7003
|
return _createClass(Po, [{
|
6975
7004
|
key: "extractResultData",
|
6976
7005
|
value: function () {
|
@@ -7000,8 +7029,8 @@ var Po = /*#__PURE__*/function (_Ie4) {
|
|
7000
7029
|
return extractResultData;
|
7001
7030
|
}()
|
7002
7031
|
}]);
|
7003
|
-
}(
|
7004
|
-
var Oo = /*#__PURE__*/function (
|
7032
|
+
}(Le);
|
7033
|
+
var Oo = /*#__PURE__*/function (_Le5) {
|
7005
7034
|
function Oo(e) {
|
7006
7035
|
var _this27$maxMessages;
|
7007
7036
|
var _this27;
|
@@ -7013,7 +7042,7 @@ var Oo = /*#__PURE__*/function (_Ie5) {
|
|
7013
7042
|
return _this27;
|
7014
7043
|
}
|
7015
7044
|
// prettier-ignore
|
7016
|
-
_inherits(Oo,
|
7045
|
+
_inherits(Oo, _Le5);
|
7017
7046
|
return _createClass(Oo, [{
|
7018
7047
|
key: "processMessages",
|
7019
7048
|
value: function processMessages(e) {
|
@@ -7082,7 +7111,7 @@ var Oo = /*#__PURE__*/function (_Ie5) {
|
|
7082
7111
|
return extractResultData;
|
7083
7112
|
}()
|
7084
7113
|
}]);
|
7085
|
-
}(
|
7114
|
+
}(Le);
|
7086
7115
|
var bi = /*#__PURE__*/function (_Oi3) {
|
7087
7116
|
function bi(e) {
|
7088
7117
|
var _this28;
|
@@ -7190,7 +7219,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
|
|
7190
7219
|
}
|
7191
7220
|
}]);
|
7192
7221
|
}(Oi);
|
7193
|
-
var No = /*#__PURE__*/function (
|
7222
|
+
var No = /*#__PURE__*/function (_Le6) {
|
7194
7223
|
function No(e) {
|
7195
7224
|
_classCallCheck(this, No);
|
7196
7225
|
var s, r, o;
|
@@ -7198,7 +7227,7 @@ var No = /*#__PURE__*/function (_Ie6) {
|
|
7198
7227
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7199
7228
|
return _callSuper(this, No, [e, "Insert text to translate", "Helsinki-NLP/opus-tatoeba-en-ja", t, i]);
|
7200
7229
|
}
|
7201
|
-
_inherits(No,
|
7230
|
+
_inherits(No, _Le6);
|
7202
7231
|
return _createClass(No, [{
|
7203
7232
|
key: "extractResultData",
|
7204
7233
|
value: function () {
|
@@ -7228,7 +7257,7 @@ var No = /*#__PURE__*/function (_Ie6) {
|
|
7228
7257
|
return extractResultData;
|
7229
7258
|
}()
|
7230
7259
|
}]);
|
7231
|
-
}(
|
7260
|
+
}(Le);
|
7232
7261
|
var vi = /*#__PURE__*/function (_Oi4) {
|
7233
7262
|
function vi(e) {
|
7234
7263
|
var _this29;
|
@@ -7322,7 +7351,7 @@ var vi = /*#__PURE__*/function (_Oi4) {
|
|
7322
7351
|
}
|
7323
7352
|
}]);
|
7324
7353
|
}(Oi);
|
7325
|
-
var Do = /*#__PURE__*/function (
|
7354
|
+
var Do = /*#__PURE__*/function (_Le7) {
|
7326
7355
|
function Do(e) {
|
7327
7356
|
var _this30;
|
7328
7357
|
_classCallCheck(this, Do);
|
@@ -7332,7 +7361,7 @@ var Do = /*#__PURE__*/function (_Ie7) {
|
|
7332
7361
|
_this30 = _callSuper(this, Do, [e, "The goal of life is [MASK].", "bert-base-uncased", t, i]), _this30.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>Insert a sentence with the word [MASK] and the model will try to fill it for you. E.g. I want [MASK].</p>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this30.permittedErrorPrefixes = ["Authorization header", "No mask_token"];
|
7333
7362
|
return _this30;
|
7334
7363
|
}
|
7335
|
-
_inherits(Do,
|
7364
|
+
_inherits(Do, _Le7);
|
7336
7365
|
return _createClass(Do, [{
|
7337
7366
|
key: "extractResultData",
|
7338
7367
|
value: function () {
|
@@ -7362,12 +7391,12 @@ var Do = /*#__PURE__*/function (_Ie7) {
|
|
7362
7391
|
return extractResultData;
|
7363
7392
|
}()
|
7364
7393
|
}]);
|
7365
|
-
}(
|
7366
|
-
var
|
7367
|
-
function
|
7368
|
-
_classCallCheck(this,
|
7394
|
+
}(Le);
|
7395
|
+
var L = /*#__PURE__*/function () {
|
7396
|
+
function L() {
|
7397
|
+
_classCallCheck(this, L);
|
7369
7398
|
}
|
7370
|
-
return _createClass(
|
7399
|
+
return _createClass(L, null, [{
|
7371
7400
|
key: "buildHeaders",
|
7372
7401
|
value: function buildHeaders(e) {
|
7373
7402
|
return {
|
@@ -7380,7 +7409,7 @@ var I = /*#__PURE__*/function () {
|
|
7380
7409
|
key: "handleVerificationResult",
|
7381
7410
|
value: function handleVerificationResult(e, t, i, s) {
|
7382
7411
|
var r = e;
|
7383
|
-
r.error ? r.error.code === "invalid_api_key" ? s(
|
7412
|
+
r.error ? r.error.code === "invalid_api_key" ? s(M.INVALID_KEY) : s(M.CONNECTION_FAILED) : i(t);
|
7384
7413
|
}
|
7385
7414
|
}, {
|
7386
7415
|
key: "buildKeyVerificationDetails",
|
@@ -7388,7 +7417,7 @@ var I = /*#__PURE__*/function () {
|
|
7388
7417
|
return {
|
7389
7418
|
url: "https://api.openai.com/v1/models",
|
7390
7419
|
method: "GET",
|
7391
|
-
handleVerificationResult:
|
7420
|
+
handleVerificationResult: L.handleVerificationResult
|
7392
7421
|
};
|
7393
7422
|
}
|
7394
7423
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -7430,11 +7459,11 @@ var I = /*#__PURE__*/function () {
|
|
7430
7459
|
}()
|
7431
7460
|
}]);
|
7432
7461
|
}();
|
7433
|
-
var
|
7434
|
-
function
|
7435
|
-
_classCallCheck(this,
|
7462
|
+
var ee = /*#__PURE__*/function () {
|
7463
|
+
function ee() {
|
7464
|
+
_classCallCheck(this, ee);
|
7436
7465
|
}
|
7437
|
-
return _createClass(
|
7466
|
+
return _createClass(ee, null, [{
|
7438
7467
|
key: "storeFiles",
|
7439
7468
|
value: function () {
|
7440
7469
|
var _storeFiles = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t, i, s) {
|
@@ -7460,7 +7489,7 @@ var Q = /*#__PURE__*/function () {
|
|
7460
7489
|
case 0:
|
7461
7490
|
c = new FormData();
|
7462
7491
|
return _context61.abrupt("return", (c.append("purpose", "assistants"), c.append("file", l), new Promise(function (d) {
|
7463
|
-
d(
|
7492
|
+
d(L.directFetch(e, c, "POST", !1));
|
7464
7493
|
})));
|
7465
7494
|
case 2:
|
7466
7495
|
case "end":
|
@@ -7515,7 +7544,7 @@ var Q = /*#__PURE__*/function () {
|
|
7515
7544
|
r = t.map(function (_ref12) {
|
7516
7545
|
var l = _ref12.fileId;
|
7517
7546
|
return e.url = "".concat(i).concat(l).concat(s), new Promise(function (c) {
|
7518
|
-
c(
|
7547
|
+
c(L.directFetch(e, void 0, "GET", !1));
|
7519
7548
|
});
|
7520
7549
|
});
|
7521
7550
|
_context63.next = 3;
|
@@ -7528,7 +7557,7 @@ var Q = /*#__PURE__*/function () {
|
|
7528
7557
|
d({
|
7529
7558
|
src: u.target.result,
|
7530
7559
|
name: t[c].name,
|
7531
|
-
type:
|
7560
|
+
type: ee.getType(t, c)
|
7532
7561
|
});
|
7533
7562
|
};
|
7534
7563
|
});
|
@@ -7570,7 +7599,7 @@ var Q = /*#__PURE__*/function () {
|
|
7570
7599
|
break;
|
7571
7600
|
}
|
7572
7601
|
_context64.next = 5;
|
7573
|
-
return
|
7602
|
+
return ee.getFiles(e, t, a, l);
|
7574
7603
|
case 5:
|
7575
7604
|
o = _context64.sent;
|
7576
7605
|
(c = r == null ? void 0 : r.text) != null && c.value && o.forEach(function (h, u) {
|
@@ -7614,7 +7643,7 @@ var Q = /*#__PURE__*/function () {
|
|
7614
7643
|
l.text && l.text.startsWith("sandbox:") && (c = l.file_path) != null && c.file_id && i.push({
|
7615
7644
|
path: l.text,
|
7616
7645
|
fileId: l.file_path.file_id,
|
7617
|
-
name:
|
7646
|
+
name: ee.getFileName(l.text)
|
7618
7647
|
});
|
7619
7648
|
});
|
7620
7649
|
}), t != null && t.image_file && i.push({
|
@@ -7630,9 +7659,9 @@ var Q = /*#__PURE__*/function () {
|
|
7630
7659
|
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
7631
7660
|
while (1) switch (_context65.prev = _context65.next) {
|
7632
7661
|
case 0:
|
7633
|
-
r =
|
7662
|
+
r = ee.getFileDetails(t, s);
|
7634
7663
|
_context65.next = 3;
|
7635
|
-
return
|
7664
|
+
return ee.getFilesAndNewText(e, r, i, t.role, s);
|
7636
7665
|
case 3:
|
7637
7666
|
return _context65.abrupt("return", _context65.sent);
|
7638
7667
|
case 4:
|
@@ -7676,7 +7705,7 @@ var Q = /*#__PURE__*/function () {
|
|
7676
7705
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
7677
7706
|
while (1) switch (_context66.prev = _context66.next) {
|
7678
7707
|
case 0:
|
7679
|
-
s.push(
|
7708
|
+
s.push(ee.getFilesAndText(e, r, i, o));
|
7680
7709
|
case 1:
|
7681
7710
|
case "end":
|
7682
7711
|
return _context66.stop();
|
@@ -7705,7 +7734,7 @@ var Q = /*#__PURE__*/function () {
|
|
7705
7734
|
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
7706
7735
|
while (1) switch (_context68.prev = _context68.next) {
|
7707
7736
|
case 0:
|
7708
|
-
return _context68.abrupt("return",
|
7737
|
+
return _context68.abrupt("return", ee.parseMessages(e, [{
|
7709
7738
|
content: t,
|
7710
7739
|
role: "assistant"
|
7711
7740
|
}], i));
|
@@ -7728,8 +7757,8 @@ var Q = /*#__PURE__*/function () {
|
|
7728
7757
|
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
7729
7758
|
while (1) switch (_context69.prev = _context69.next) {
|
7730
7759
|
case 0:
|
7731
|
-
r =
|
7732
|
-
return _context69.abrupt("return",
|
7760
|
+
r = ee.parseResult(t, i);
|
7761
|
+
return _context69.abrupt("return", ee.parseMessages(e, r, s));
|
7733
7762
|
case 2:
|
7734
7763
|
case "end":
|
7735
7764
|
return _context69.stop();
|
@@ -7743,29 +7772,30 @@ var Q = /*#__PURE__*/function () {
|
|
7743
7772
|
}()
|
7744
7773
|
}]);
|
7745
7774
|
}();
|
7746
|
-
|
7747
|
-
var ye =
|
7748
|
-
var
|
7749
|
-
|
7775
|
+
ee.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", ee.FUNCTION_TOOL_RESP_ERROR = "Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.";
|
7776
|
+
var ye = ee;
|
7777
|
+
var De = /*#__PURE__*/function (_z3) {
|
7778
|
+
// prettier-ignore
|
7779
|
+
function De(e, t, i, s, r, o) {
|
7750
7780
|
var _this31;
|
7751
|
-
_classCallCheck(this,
|
7752
|
-
if (_this31 = _callSuper(this,
|
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 = {
|
7753
7783
|
model: "gpt-4"
|
7754
7784
|
}, _this31.waitingForStreamResponse = !1, _this31.isSSEStream = !1, _this31.urlSegments = i, _typeof(t) == "object") {
|
7755
7785
|
_this31.config = t;
|
7756
7786
|
var _this31$config = _this31.config,
|
7757
|
-
|
7758
|
-
|
7759
|
-
|
7760
|
-
Object.assign(_this31.newAssistantDetails,
|
7761
|
-
var
|
7762
|
-
|
7787
|
+
a = _this31$config.new_assistant,
|
7788
|
+
l = _this31$config.thread_id,
|
7789
|
+
c = _this31$config.load_thread_history;
|
7790
|
+
Object.assign(_this31.newAssistantDetails, a), l && (_this31.sessionId = l), c && (_this31.shouldFetchHistory = !0);
|
7791
|
+
var d = t.function_handler;
|
7792
|
+
d && (_this31._functionHandler = d), _this31.filesToolType = t.files_tool_type;
|
7763
7793
|
}
|
7764
7794
|
_this31.maxMessages = 1, _this31.isSSEStream = !!(_this31.stream && (_typeof(_this31.stream) != "object" || !_this31.stream.simulation));
|
7765
7795
|
return _assertThisInitialized(_this31);
|
7766
7796
|
}
|
7767
|
-
_inherits(
|
7768
|
-
return _createClass(
|
7797
|
+
_inherits(De, _z3);
|
7798
|
+
return _createClass(De, [{
|
7769
7799
|
key: "fetchHistoryFunc",
|
7770
7800
|
value: function () {
|
7771
7801
|
var _fetchHistoryFunc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee70() {
|
@@ -7814,13 +7844,13 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
7814
7844
|
}));
|
7815
7845
|
a === "code_interpreter" || a === "file_search" || a === "images" ? r = a : (console.error("Tool type \"".concat(a, "\" is not valid")), console.error('Expected "code_interpreter" or "file_search" or "images". Going to default to "images"'));
|
7816
7846
|
}
|
7817
|
-
if (r === "file_search") return
|
7818
|
-
if (r === "code_interpreter") return
|
7847
|
+
if (r === "file_search") return De.processAttachmentsMessage(s, t, "file_search");
|
7848
|
+
if (r === "code_interpreter") return De.processAttachmentsMessage(s, t, "code_interpreter");
|
7819
7849
|
if (t.find(function (_ref16) {
|
7820
7850
|
var a = _ref16.name;
|
7821
|
-
return !
|
7851
|
+
return !B.isImageFileExtension(a);
|
7822
7852
|
})) console.error("The uploaded files contained a non-image file"), console.error('Make sure only images can be uploaded or define a "code_interpreter" or "file_search" value in the "files_tool_type" property'), console.warn('Make sure your existing assistant supports these "tools" or specify them in the "new_assistant" property');else {
|
7823
|
-
var _a2 =
|
7853
|
+
var _a2 = De.processImageMessage(s, t);
|
7824
7854
|
if (_a2) return _a2;
|
7825
7855
|
}
|
7826
7856
|
}
|
@@ -7924,7 +7954,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
7924
7954
|
_context72.prev = 0;
|
7925
7955
|
this.url = this.urlSegments.newAssistantUrl;
|
7926
7956
|
_context72.next = 4;
|
7927
|
-
return
|
7957
|
+
return L.directFetch(this, JSON.parse(JSON.stringify(this.newAssistantDetails)), "POST");
|
7928
7958
|
case 4:
|
7929
7959
|
_e3 = _context72.sent;
|
7930
7960
|
return _context72.abrupt("return", (this.config.assistant_id = _e3.id, this.config.assistant_id));
|
@@ -8010,7 +8040,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8010
8040
|
}
|
8011
8041
|
this.url = "".concat(this.urlSegments.threadsPrefix, "/").concat(this.sessionId, "/runs").concat(this.urlSegments.threadsPosfix);
|
8012
8042
|
_context74.next = 4;
|
8013
|
-
return
|
8043
|
+
return L.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
|
8014
8044
|
case 4:
|
8015
8045
|
t = _context74.sent;
|
8016
8046
|
this.run_id = t.id;
|
@@ -8044,7 +8074,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8044
8074
|
t = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : !1;
|
8045
8075
|
this.url = "".concat(this.urlSegments.threadsPrefix, "/").concat(e, "/messages?").concat(this.urlSegments.listMessagesPostfix);
|
8046
8076
|
_context75.next = 4;
|
8047
|
-
return
|
8077
|
+
return L.directFetch(this, {}, "GET");
|
8048
8078
|
case 4:
|
8049
8079
|
i = _context75.sent;
|
8050
8080
|
_context75.t0 = !t && this.deepChat.responseInterceptor;
|
@@ -8084,7 +8114,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8084
8114
|
break;
|
8085
8115
|
}
|
8086
8116
|
return _context76.abrupt("return", {
|
8087
|
-
timeoutMS:
|
8117
|
+
timeoutMS: De.POLLING_TIMEOUT_MS
|
8088
8118
|
});
|
8089
8119
|
case 3:
|
8090
8120
|
if (!(t === "completed" && this.messages)) {
|
@@ -8192,12 +8222,12 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8192
8222
|
break;
|
8193
8223
|
case 20:
|
8194
8224
|
_context77.next = 22;
|
8195
|
-
return
|
8225
|
+
return L.directFetch(this, {
|
8196
8226
|
tool_outputs: r
|
8197
8227
|
}, "POST");
|
8198
8228
|
case 22:
|
8199
8229
|
return _context77.abrupt("return", {
|
8200
|
-
timeoutMS:
|
8230
|
+
timeoutMS: De.POLLING_TIMEOUT_MS
|
8201
8231
|
});
|
8202
8232
|
case 23:
|
8203
8233
|
case "end":
|
@@ -8336,7 +8366,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8336
8366
|
e.stream = !0;
|
8337
8367
|
this.waitingForStreamResponse = !0;
|
8338
8368
|
_context80.next = 4;
|
8339
|
-
return
|
8369
|
+
return A.request(this, e, this.messages, !0, !0);
|
8340
8370
|
case 4:
|
8341
8371
|
this.messageStream = _context80.sent;
|
8342
8372
|
case 5:
|
@@ -8354,7 +8384,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8354
8384
|
key: "processImageMessage",
|
8355
8385
|
value: function processImageMessage(e, t) {
|
8356
8386
|
var i = t == null ? void 0 : t.filter(function (s) {
|
8357
|
-
return
|
8387
|
+
return B.isImageFileExtension(s.name);
|
8358
8388
|
}).map(function (s) {
|
8359
8389
|
return {
|
8360
8390
|
type: "image_file",
|
@@ -8391,9 +8421,9 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8391
8421
|
};
|
8392
8422
|
}
|
8393
8423
|
}]);
|
8394
|
-
}(
|
8395
|
-
|
8396
|
-
var yi =
|
8424
|
+
}(z);
|
8425
|
+
De.POLLING_TIMEOUT_MS = 800;
|
8426
|
+
var yi = De;
|
8397
8427
|
var Ii = /*#__PURE__*/function (_yi) {
|
8398
8428
|
function Ii(e) {
|
8399
8429
|
var _o$headers2, _a$OpenAIBeta;
|
@@ -8403,7 +8433,7 @@ var Ii = /*#__PURE__*/function (_yi) {
|
|
8403
8433
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8404
8434
|
i = t.openAI,
|
8405
8435
|
s = (r = t.openAI) == null ? void 0 : r.assistant;
|
8406
|
-
_this34 = _callSuper(this, Ii, [e, s, Ii.URL_SEGMENTS, i]), (_o$headers2 = (o = _this34.connectSettings).headers) !== null && _o$headers2 !== void 0 ? _o$headers2 : o.headers = {}, (_a$OpenAIBeta = (a = _this34.connectSettings.headers)["OpenAI-Beta"]) !== null && _a$OpenAIBeta !== void 0 ? _a$OpenAIBeta : a["OpenAI-Beta"] = "assistants=v2", _this34.shouldFetchHistory && _this34.sessionId && (_this34.fetchHistory = _this34.fetchHistoryFunc.bind(_assertThisInitialized(_this34)));
|
8436
|
+
_this34 = _callSuper(this, Ii, [e, s, Ii.URL_SEGMENTS, L.buildKeyVerificationDetails(), L.buildHeaders, i]), (_o$headers2 = (o = _this34.connectSettings).headers) !== null && _o$headers2 !== void 0 ? _o$headers2 : o.headers = {}, (_a$OpenAIBeta = (a = _this34.connectSettings.headers)["OpenAI-Beta"]) !== null && _a$OpenAIBeta !== void 0 ? _a$OpenAIBeta : a["OpenAI-Beta"] = "assistants=v2", _this34.shouldFetchHistory && _this34.sessionId && (_this34.fetchHistory = _this34.fetchHistoryFunc.bind(_assertThisInitialized(_this34)));
|
8407
8437
|
return _this34;
|
8408
8438
|
}
|
8409
8439
|
_inherits(Ii, _yi);
|
@@ -8438,7 +8468,7 @@ var Ei = /*#__PURE__*/function () {
|
|
8438
8468
|
key: "handleVerificationResult",
|
8439
8469
|
value: function handleVerificationResult(e, t, i, s) {
|
8440
8470
|
var o;
|
8441
|
-
(o = e.message) != null && o.includes("invalid request: prompt must be at least 1 token long") ? i(t) : s(
|
8471
|
+
(o = e.message) != null && o.includes("invalid request: prompt must be at least 1 token long") ? i(t) : s(M.INVALID_KEY);
|
8442
8472
|
}
|
8443
8473
|
}, {
|
8444
8474
|
key: "buildKeyVerificationDetails",
|
@@ -8454,16 +8484,16 @@ var Ei = /*#__PURE__*/function () {
|
|
8454
8484
|
}
|
8455
8485
|
}]);
|
8456
8486
|
}();
|
8457
|
-
var Ts = /*#__PURE__*/function (
|
8487
|
+
var Ts = /*#__PURE__*/function (_z4) {
|
8458
8488
|
function Ts(e, t, i, s, r) {
|
8459
8489
|
var _this35;
|
8460
8490
|
_classCallCheck(this, Ts);
|
8461
8491
|
_this35 = _callSuper(this, Ts, [e, Ei.buildKeyVerificationDetails(), Ei.buildHeaders, r]), _this35.insertKeyPlaceholderText = "Cohere API Key", _this35.keyHelpUrl = "https://dashboard.cohere.ai/api-keys", _this35.permittedErrorPrefixes = ["invalid"], _this35.url = t, _this35.textInputPlaceholderText = i, s && _typeof(s) == "object" && Object.assign(_this35.rawBody, s);
|
8462
8492
|
return _this35;
|
8463
8493
|
}
|
8464
|
-
_inherits(Ts,
|
8494
|
+
_inherits(Ts, _z4);
|
8465
8495
|
return _createClass(Ts);
|
8466
|
-
}(
|
8496
|
+
}(z);
|
8467
8497
|
var Fo = /*#__PURE__*/function (_Ts) {
|
8468
8498
|
function Fo(e) {
|
8469
8499
|
_classCallCheck(this, Fo);
|
@@ -8557,7 +8587,7 @@ var Ls = /*#__PURE__*/function () {
|
|
8557
8587
|
return {
|
8558
8588
|
url: "".concat(e.endpoint, "/openai/models?api-version=").concat(e.version),
|
8559
8589
|
method: "GET",
|
8560
|
-
handleVerificationResult:
|
8590
|
+
handleVerificationResult: L.handleVerificationResult
|
8561
8591
|
};
|
8562
8592
|
}
|
8563
8593
|
}, {
|
@@ -8571,7 +8601,7 @@ var Ls = /*#__PURE__*/function () {
|
|
8571
8601
|
}]);
|
8572
8602
|
}();
|
8573
8603
|
Ls.URL_DETAILS_ERROR_MESSAGE = "Please define the Azure URL Details. [More Information](https://deepchat.dev/docs/directConnection/Azure)";
|
8574
|
-
var
|
8604
|
+
var oe = Ls;
|
8575
8605
|
var mt = /*#__PURE__*/function (_yi2) {
|
8576
8606
|
function mt(e) {
|
8577
8607
|
var _f$headers;
|
@@ -8588,17 +8618,17 @@ var mt = /*#__PURE__*/function (_yi2) {
|
|
8588
8618
|
threadsPrefix: "".concat(o).concat(mt.THREAD_RESOURCE),
|
8589
8619
|
threadsPosfix: a,
|
8590
8620
|
newAssistantUrl: "".concat(o).concat(mt.NEW_ASSISTANT_RESOURCE).concat(a),
|
8591
|
-
createMessagePostfix:
|
8592
|
-
listMessagesPostfix:
|
8621
|
+
createMessagePostfix: a,
|
8622
|
+
listMessagesPostfix: "order=desc&api-version=".concat((u = s == null ? void 0 : s.urlDetails) == null ? void 0 : u.version),
|
8593
8623
|
storeFiles: "".concat(o, "files").concat(a),
|
8594
8624
|
getFilesPrefix: "".concat(o, "files/"),
|
8595
8625
|
getFilesPostfix: "/content".concat(a)
|
8596
8626
|
};
|
8597
|
-
_this36 = _callSuper(this, mt, [e, s == null ? void 0 : s.assistant, l, i]), _this36.permittedErrorPrefixes = [
|
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 () {
|
8598
8628
|
return !1;
|
8599
8629
|
}, setTimeout(function () {
|
8600
8630
|
e.addMessage({
|
8601
|
-
error:
|
8631
|
+
error: oe.URL_DETAILS_ERROR_MESSAGE
|
8602
8632
|
});
|
8603
8633
|
}));
|
8604
8634
|
return _this36;
|
@@ -8682,7 +8712,7 @@ var Bo = /*#__PURE__*/function (_Ts2) {
|
|
8682
8712
|
}()
|
8683
8713
|
}]);
|
8684
8714
|
}(Ts);
|
8685
|
-
var gt = /*#__PURE__*/function (
|
8715
|
+
var gt = /*#__PURE__*/function (_z5) {
|
8686
8716
|
function gt(e) {
|
8687
8717
|
var _o$model, _a$voice;
|
8688
8718
|
var _this37;
|
@@ -8690,12 +8720,12 @@ var gt = /*#__PURE__*/function (_q5) {
|
|
8690
8720
|
var r, o, a;
|
8691
8721
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8692
8722
|
i = t == null ? void 0 : t.openAI;
|
8693
|
-
_this37 = _callSuper(this, gt, [e,
|
8723
|
+
_this37 = _callSuper(this, gt, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i]), _this37.insertKeyPlaceholderText = "OpenAI API Key", _this37.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this37.url = "https://api.openai.com/v1/audio/speech", _this37.permittedErrorPrefixes = ["Invalid"], _this37.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Text To Speech</b></div>\n <p>Generate an audio file based on your text input.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/text-to-speech\">here</a> for more information.</p>";
|
8694
8724
|
var s = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.textToSpeech;
|
8695
8725
|
_typeof(s) == "object" && Object.assign(_this37.rawBody, s), (_o$model = (o = _this37.rawBody).model) !== null && _o$model !== void 0 ? _o$model : o.model = gt.DEFAULT_MODEL, (_a$voice = (a = _this37.rawBody).voice) !== null && _a$voice !== void 0 ? _a$voice : a.voice = gt.DEFAULT_VOIDE, _this37.textInputPlaceholderText = "Insert text to generate audio", _this37.rawBody.response_format = "mp3";
|
8696
8726
|
return _this37;
|
8697
8727
|
}
|
8698
|
-
_inherits(gt,
|
8728
|
+
_inherits(gt, _z5);
|
8699
8729
|
return _createClass(gt, [{
|
8700
8730
|
key: "preprocessBody",
|
8701
8731
|
value: function preprocessBody(e, t) {
|
@@ -8776,29 +8806,29 @@ var gt = /*#__PURE__*/function (_q5) {
|
|
8776
8806
|
return extractResultData;
|
8777
8807
|
}()
|
8778
8808
|
}]);
|
8779
|
-
}(
|
8809
|
+
}(z);
|
8780
8810
|
gt.DEFAULT_MODEL = "tts-1", gt.DEFAULT_VOIDE = "alloy";
|
8781
8811
|
var us = gt;
|
8782
|
-
var
|
8783
|
-
function
|
8812
|
+
var de = /*#__PURE__*/function (_z6) {
|
8813
|
+
function de(e) {
|
8784
8814
|
var _o$model2;
|
8785
8815
|
var _this38;
|
8786
|
-
_classCallCheck(this,
|
8816
|
+
_classCallCheck(this, de);
|
8787
8817
|
var r, o;
|
8788
8818
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8789
8819
|
i = t == null ? void 0 : t.openAI;
|
8790
|
-
_this38 = _callSuper(this,
|
8820
|
+
_this38 = _callSuper(this, de, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, {
|
8791
8821
|
audio: {}
|
8792
|
-
}]), _this38.insertKeyPlaceholderText = "OpenAI API Key", _this38.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this38.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this38.url = "", _this38.permittedErrorPrefixes = ["Invalid"], _this38.textInputPlaceholderText = "Upload an audio file", _this38._service_url =
|
8822
|
+
}]), _this38.insertKeyPlaceholderText = "OpenAI API Key", _this38.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this38.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this38.url = "", _this38.permittedErrorPrefixes = ["Invalid"], _this38.textInputPlaceholderText = "Upload an audio file", _this38._service_url = de.AUDIO_TRANSCRIPTIONS_URL;
|
8793
8823
|
var s = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
8794
|
-
_typeof(s) == "object" && (_this38.processConfig(s),
|
8824
|
+
_typeof(s) == "object" && (_this38.processConfig(s), de.cleanConfig(s), Object.assign(_this38.rawBody, s)), (_o$model2 = (o = _this38.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = de.DEFAULT_MODEL, _this38.rawBody.response_format = "json", _this38.canSendMessage = de.canSendFileMessage;
|
8795
8825
|
return _this38;
|
8796
8826
|
}
|
8797
|
-
_inherits(
|
8798
|
-
return _createClass(
|
8827
|
+
_inherits(de, _z6);
|
8828
|
+
return _createClass(de, [{
|
8799
8829
|
key: "processConfig",
|
8800
8830
|
value: function processConfig(e) {
|
8801
|
-
e != null && e.type && e.type === "translation" && (this._service_url =
|
8831
|
+
e != null && e.type && e.type === "translation" && (this._service_url = de.AUDIO_TRANSLATIONS_URL, delete e.language);
|
8802
8832
|
}
|
8803
8833
|
}, {
|
8804
8834
|
key: "preprocessBody",
|
@@ -8830,7 +8860,7 @@ var ce = /*#__PURE__*/function (_q6) {
|
|
8830
8860
|
throw new Error("No file was added");
|
8831
8861
|
case 4:
|
8832
8862
|
this.url = this.connectSettings.url || this._service_url;
|
8833
|
-
s = this.preprocessBody(this.rawBody, t), r =
|
8863
|
+
s = this.preprocessBody(this.rawBody, t), r = de.createFormDataBody(s, i[0]);
|
8834
8864
|
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
8835
8865
|
case 7:
|
8836
8866
|
case "end":
|
@@ -8889,14 +8919,14 @@ var ce = /*#__PURE__*/function (_q6) {
|
|
8889
8919
|
}), i;
|
8890
8920
|
}
|
8891
8921
|
}]);
|
8892
|
-
}(
|
8893
|
-
|
8894
|
-
var fs =
|
8895
|
-
var
|
8896
|
-
function
|
8897
|
-
_classCallCheck(this,
|
8922
|
+
}(z);
|
8923
|
+
de.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", de.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", de.DEFAULT_MODEL = "whisper-1";
|
8924
|
+
var fs = de;
|
8925
|
+
var ae = /*#__PURE__*/function () {
|
8926
|
+
function ae() {
|
8927
|
+
_classCallCheck(this, ae);
|
8898
8928
|
}
|
8899
|
-
return _createClass(
|
8929
|
+
return _createClass(ae, null, [{
|
8900
8930
|
key: "buildTextToSpeechHeaders",
|
8901
8931
|
value: function buildTextToSpeechHeaders(e, t) {
|
8902
8932
|
return {
|
@@ -8917,7 +8947,7 @@ var re = /*#__PURE__*/function () {
|
|
8917
8947
|
}, {
|
8918
8948
|
key: "handleSpeechVerificationResult",
|
8919
8949
|
value: function handleSpeechVerificationResult(e, t, i, s) {
|
8920
|
-
e.error ? s(
|
8950
|
+
e.error ? s(M.INVALID_KEY) : i(t);
|
8921
8951
|
}
|
8922
8952
|
}, {
|
8923
8953
|
key: "buildSpeechKeyVerificationDetails",
|
@@ -8930,7 +8960,7 @@ var re = /*#__PURE__*/function () {
|
|
8930
8960
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
8931
8961
|
};
|
8932
8962
|
},
|
8933
|
-
handleVerificationResult:
|
8963
|
+
handleVerificationResult: ae.handleSpeechVerificationResult
|
8934
8964
|
};
|
8935
8965
|
}
|
8936
8966
|
}, {
|
@@ -8946,7 +8976,7 @@ var re = /*#__PURE__*/function () {
|
|
8946
8976
|
key: "handleLanguageVerificationResult",
|
8947
8977
|
value: function handleLanguageVerificationResult(e, t, i, s) {
|
8948
8978
|
var o;
|
8949
|
-
((o = e.error) == null ? void 0 : o.code) === "401" ? s(
|
8979
|
+
((o = e.error) == null ? void 0 : o.code) === "401" ? s(M.INVALID_KEY) : i(t);
|
8950
8980
|
}
|
8951
8981
|
}, {
|
8952
8982
|
key: "buildLanguageKeyVerificationDetails",
|
@@ -8959,7 +8989,7 @@ var re = /*#__PURE__*/function () {
|
|
8959
8989
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
8960
8990
|
};
|
8961
8991
|
},
|
8962
|
-
handleVerificationResult:
|
8992
|
+
handleVerificationResult: ae.handleLanguageVerificationResult
|
8963
8993
|
};
|
8964
8994
|
}
|
8965
8995
|
// prettier-ignore
|
@@ -8967,7 +8997,7 @@ var re = /*#__PURE__*/function () {
|
|
8967
8997
|
key: "handleTranslationVerificationResult",
|
8968
8998
|
value: function handleTranslationVerificationResult(e, t, i, s) {
|
8969
8999
|
e.json().then(function (o) {
|
8970
|
-
!Array.isArray(o) && o.error.code === 401e3 ? s(
|
9000
|
+
!Array.isArray(o) && o.error.code === 401e3 ? s(M.INVALID_KEY) : i(t);
|
8971
9001
|
});
|
8972
9002
|
}
|
8973
9003
|
}, {
|
@@ -8977,9 +9007,9 @@ var re = /*#__PURE__*/function () {
|
|
8977
9007
|
url: "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",
|
8978
9008
|
method: "POST",
|
8979
9009
|
createHeaders: function createHeaders(t) {
|
8980
|
-
return
|
9010
|
+
return ae.buildTranslationHeaders(e, t);
|
8981
9011
|
},
|
8982
|
-
handleVerificationResult:
|
9012
|
+
handleVerificationResult: ae.handleTranslationVerificationResult
|
8983
9013
|
};
|
8984
9014
|
}
|
8985
9015
|
}, {
|
@@ -8993,19 +9023,19 @@ var re = /*#__PURE__*/function () {
|
|
8993
9023
|
}
|
8994
9024
|
}]);
|
8995
9025
|
}();
|
8996
|
-
var Uo = /*#__PURE__*/function (
|
9026
|
+
var Uo = /*#__PURE__*/function (_z7) {
|
8997
9027
|
// prettier-ignore
|
8998
9028
|
function Uo(e, t, i, s, r) {
|
8999
9029
|
var _this39;
|
9000
9030
|
_classCallCheck(this, Uo);
|
9001
|
-
_this39 = _callSuper(this, Uo, [e,
|
9031
|
+
_this39 = _callSuper(this, Uo, [e, ae.buildLanguageKeyVerificationDetails(i), t, s, r]), _this39.insertKeyPlaceholderText = "Azure Language Subscription Key", _this39.keyHelpUrl =
|
9002
9032
|
// eslint-disable-next-line max-len
|
9003
9033
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this39.permittedErrorPrefixes = ["Access"];
|
9004
9034
|
return _this39;
|
9005
9035
|
}
|
9006
|
-
_inherits(Uo,
|
9036
|
+
_inherits(Uo, _z7);
|
9007
9037
|
return _createClass(Uo);
|
9008
|
-
}(
|
9038
|
+
}(z);
|
9009
9039
|
var Dt = /*#__PURE__*/function (_Uo) {
|
9010
9040
|
function Dt(e) {
|
9011
9041
|
var _a$language;
|
@@ -9014,7 +9044,7 @@ var Dt = /*#__PURE__*/function (_Uo) {
|
|
9014
9044
|
var s, r, o, a;
|
9015
9045
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.summarization,
|
9016
9046
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
9017
|
-
_this40 = _callSuper(this, Dt, [e,
|
9047
|
+
_this40 = _callSuper(this, Dt, [e, ae.buildSummarizationHeader, t.endpoint, i]), _this40.permittedErrorPrefixes = [Dt.ENDPOINT_ERROR_MESSAGE], _this40.url = "", _this40.textInputPlaceholderText = "Insert text to summarize", _this40.isTextInputDisabled = !1, t.endpoint ? ((_a$language = (a = _this40.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this40.rawBody, t), _this40.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview")) : (_this40.isTextInputDisabled = !0, _this40.canSendMessage = function () {
|
9018
9048
|
return !1;
|
9019
9049
|
}, setTimeout(function () {
|
9020
9050
|
e.addMessage({
|
@@ -9261,7 +9291,7 @@ var It = /*#__PURE__*/function () {
|
|
9261
9291
|
key: "handleVerificationResult",
|
9262
9292
|
value: function handleVerificationResult(e, t, i, s) {
|
9263
9293
|
var r = e;
|
9264
|
-
r.error ? r.error.code === "invalid_api_key" ? s(
|
9294
|
+
r.error ? r.error.code === "invalid_api_key" ? s(M.INVALID_KEY) : s(M.CONNECTION_FAILED) : i(t);
|
9265
9295
|
}
|
9266
9296
|
}, {
|
9267
9297
|
key: "buildKeyVerificationDetails",
|
@@ -9274,7 +9304,7 @@ var It = /*#__PURE__*/function () {
|
|
9274
9304
|
}
|
9275
9305
|
}]);
|
9276
9306
|
}();
|
9277
|
-
var Cs = /*#__PURE__*/function (
|
9307
|
+
var Cs = /*#__PURE__*/function (_z8) {
|
9278
9308
|
function Cs(e) {
|
9279
9309
|
var _this41;
|
9280
9310
|
_classCallCheck(this, Cs);
|
@@ -9285,7 +9315,7 @@ var Cs = /*#__PURE__*/function (_q8) {
|
|
9285
9315
|
}]), _this41.insertKeyPlaceholderText = "AssemblyAI API Key", _this41.keyHelpUrl = "https://www.assemblyai.com/app/account", _this41.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>AssemblyAI Audio</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"https://www.assemblyai.com/docs/Guides/transcribing_an_audio_file#get-started\">here</a> for more info.\n </p>", _this41.url = "https://api.assemblyai.com/v2/upload", _this41.isTextInputDisabled = !0, _this41.textInputPlaceholderText = "Upload an audio file", _this41.permittedErrorPrefixes = ["Authentication", "Invalid"], _this41.canSendMessage = Cs.canFileSendMessage;
|
9286
9316
|
return _this41;
|
9287
9317
|
}
|
9288
|
-
_inherits(Cs,
|
9318
|
+
_inherits(Cs, _z8);
|
9289
9319
|
return _createClass(Cs, [{
|
9290
9320
|
key: "callServiceAPI",
|
9291
9321
|
value: function () {
|
@@ -9357,20 +9387,20 @@ var Cs = /*#__PURE__*/function (_q8) {
|
|
9357
9387
|
return !!(t != null && t[0]);
|
9358
9388
|
}
|
9359
9389
|
}]);
|
9360
|
-
}(
|
9361
|
-
var _n = /*#__PURE__*/function (
|
9390
|
+
}(z);
|
9391
|
+
var _n = /*#__PURE__*/function (_z9) {
|
9362
9392
|
// prettier-ignore
|
9363
9393
|
function _n(e, t, i, s, r) {
|
9364
9394
|
var _this42;
|
9365
9395
|
_classCallCheck(this, _n);
|
9366
|
-
_this42 = _callSuper(this, _n, [e,
|
9396
|
+
_this42 = _callSuper(this, _n, [e, ae.buildSpeechKeyVerificationDetails(i), t, s, r]), _this42.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this42.keyHelpUrl =
|
9367
9397
|
// eslint-disable-next-line max-len
|
9368
9398
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
9369
9399
|
return _this42;
|
9370
9400
|
}
|
9371
|
-
_inherits(_n,
|
9401
|
+
_inherits(_n, _z9);
|
9372
9402
|
return _createClass(_n);
|
9373
|
-
}(
|
9403
|
+
}(z);
|
9374
9404
|
var Je = /*#__PURE__*/function (_n2) {
|
9375
9405
|
// prettier-ignore
|
9376
9406
|
function Je(e) {
|
@@ -9380,7 +9410,7 @@ var Je = /*#__PURE__*/function (_n2) {
|
|
9380
9410
|
var s, r, o, a, l, c;
|
9381
9411
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.textToSpeech,
|
9382
9412
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
9383
|
-
_this43 = _callSuper(this, Je, [e,
|
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 () {
|
9384
9414
|
return !1;
|
9385
9415
|
}, setTimeout(function () {
|
9386
9416
|
e.addMessage({
|
@@ -9460,10 +9490,10 @@ Je.HELP_LINK =
|
|
9460
9490
|
// eslint-disable-next-line max-len
|
9461
9491
|
"Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#TextToSpeech)";
|
9462
9492
|
var ms = Je;
|
9463
|
-
var
|
9464
|
-
function
|
9493
|
+
var Fe = /*#__PURE__*/function (_n3) {
|
9494
|
+
function Fe(e) {
|
9465
9495
|
var _this44;
|
9466
|
-
_classCallCheck(this,
|
9496
|
+
_classCallCheck(this, Fe);
|
9467
9497
|
var r, o, a;
|
9468
9498
|
var t = (o = (r = e.directConnection) == null ? void 0 : r.azure) == null ? void 0 : o.speechToText,
|
9469
9499
|
i = (a = e.directConnection) == null ? void 0 : a.azure,
|
@@ -9474,21 +9504,21 @@ var De = /*#__PURE__*/function (_n3) {
|
|
9474
9504
|
}
|
9475
9505
|
}
|
9476
9506
|
};
|
9477
|
-
if (_this44 = _callSuper(this,
|
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 () {
|
9478
9508
|
return !1;
|
9479
9509
|
}, setTimeout(function () {
|
9480
9510
|
e.addMessage({
|
9481
|
-
error:
|
9511
|
+
error: Fe.REGION_ERROR_MESSAGE
|
9482
9512
|
});
|
9483
9513
|
});else {
|
9484
|
-
_this44.canSendMessage =
|
9514
|
+
_this44.canSendMessage = Fe.canFileSendMessage;
|
9485
9515
|
var l = t.lang || "en-US";
|
9486
9516
|
_this44.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(l, "&format=detailed"), _this44.recordAudio = void 0;
|
9487
9517
|
}
|
9488
9518
|
return _assertThisInitialized(_this44);
|
9489
9519
|
}
|
9490
|
-
_inherits(
|
9491
|
-
return _createClass(
|
9520
|
+
_inherits(Fe, _n3);
|
9521
|
+
return _createClass(Fe, [{
|
9492
9522
|
key: "callServiceAPI",
|
9493
9523
|
value: function () {
|
9494
9524
|
var _callServiceAPI17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t, i) {
|
@@ -9554,13 +9584,13 @@ var De = /*#__PURE__*/function (_n3) {
|
|
9554
9584
|
}
|
9555
9585
|
}]);
|
9556
9586
|
}(_n);
|
9557
|
-
|
9587
|
+
Fe.HELP_LINK =
|
9558
9588
|
// eslint-disable-next-line max-len
|
9559
|
-
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest",
|
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 =
|
9560
9590
|
// eslint-disable-next-line max-len
|
9561
9591
|
"Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#SpeechToText)";
|
9562
|
-
var gs =
|
9563
|
-
var jo = /*#__PURE__*/function (
|
9592
|
+
var gs = Fe;
|
9593
|
+
var jo = /*#__PURE__*/function (_z10) {
|
9564
9594
|
// prettier-ignore
|
9565
9595
|
function jo(e) {
|
9566
9596
|
var _this45;
|
@@ -9568,12 +9598,12 @@ var jo = /*#__PURE__*/function (_q10) {
|
|
9568
9598
|
var s, r, o;
|
9569
9599
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.translation,
|
9570
9600
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
9571
|
-
_this45 = _callSuper(this, jo, [e,
|
9601
|
+
_this45 = _callSuper(this, jo, [e, ae.buildTranslationKeyVerificationDetails(t.region), ae.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i]), _this45.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this45.keyHelpUrl =
|
9572
9602
|
// eslint-disable-next-line max-len
|
9573
9603
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this45.url = "", _this45.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
|
9574
9604
|
return _this45;
|
9575
9605
|
}
|
9576
|
-
_inherits(jo,
|
9606
|
+
_inherits(jo, _z10);
|
9577
9607
|
return _createClass(jo, [{
|
9578
9608
|
key: "preprocessBody",
|
9579
9609
|
value: function preprocessBody(e) {
|
@@ -9638,8 +9668,8 @@ var jo = /*#__PURE__*/function (_q10) {
|
|
9638
9668
|
return extractResultData;
|
9639
9669
|
}()
|
9640
9670
|
}]);
|
9641
|
-
}(
|
9642
|
-
var vt = /*#__PURE__*/function (
|
9671
|
+
}(z);
|
9672
|
+
var vt = /*#__PURE__*/function (_z11) {
|
9643
9673
|
// prettier-ignore
|
9644
9674
|
function vt(e, t, i, s, r) {
|
9645
9675
|
var _this46$maxMessages, _m$model;
|
@@ -9647,8 +9677,8 @@ var vt = /*#__PURE__*/function (_q11) {
|
|
9647
9677
|
_classCallCheck(this, vt);
|
9648
9678
|
var h, u, f, m;
|
9649
9679
|
var o = JSON.parse(JSON.stringify(e.directConnection)),
|
9650
|
-
a = t ||
|
9651
|
-
l = i ||
|
9680
|
+
a = t || L.buildKeyVerificationDetails(),
|
9681
|
+
l = i || L.buildHeaders,
|
9652
9682
|
c = s || o.openAI;
|
9653
9683
|
_this46 = _callSuper(this, vt, [e, a, l, c]), _this46.insertKeyPlaceholderText = "OpenAI API Key", _this46.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this46.url = "https://api.openai.com/v1/chat/completions", _this46.permittedErrorPrefixes = ["Incorrect"], _this46.asyncCallInProgress = !1, _this46._systemMessage = vt.generateSystemMessage("You are a helpful assistant.");
|
9654
9684
|
var d = r || ((h = o.openAI) == null ? void 0 : h.chat);
|
@@ -9661,7 +9691,7 @@ var vt = /*#__PURE__*/function (_q11) {
|
|
9661
9691
|
(_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";
|
9662
9692
|
return _this46;
|
9663
9693
|
}
|
9664
|
-
_inherits(vt,
|
9694
|
+
_inherits(vt, _z11);
|
9665
9695
|
return _createClass(vt, [{
|
9666
9696
|
key: "cleanConfig",
|
9667
9697
|
value: function cleanConfig(e) {
|
@@ -9699,7 +9729,7 @@ var vt = /*#__PURE__*/function (_q11) {
|
|
9699
9729
|
throw new Error("Request settings have not been set up");
|
9700
9730
|
case 2:
|
9701
9731
|
i = this.preprocessBody(this.rawBody, t), s = this.stream;
|
9702
|
-
s && (_typeof(s) != "object" || !s.simulation) || i.stream ? (i.stream = !0,
|
9732
|
+
s && (_typeof(s) != "object" || !s.simulation) || i.stream ? (i.stream = !0, A.request(this, i, e)) : T.request(this, i, e);
|
9703
9733
|
case 4:
|
9704
9734
|
case "end":
|
9705
9735
|
return _context101.stop();
|
@@ -9915,7 +9945,7 @@ var vt = /*#__PURE__*/function (_q11) {
|
|
9915
9945
|
return e.text;
|
9916
9946
|
}
|
9917
9947
|
}]);
|
9918
|
-
}(
|
9948
|
+
}(z);
|
9919
9949
|
var As = /*#__PURE__*/function (_vt) {
|
9920
9950
|
function As(e) {
|
9921
9951
|
var _this48;
|
@@ -9925,11 +9955,11 @@ var As = /*#__PURE__*/function (_vt) {
|
|
9925
9955
|
i = t.azure,
|
9926
9956
|
s = ((a = (o = t.azure) == null ? void 0 : o.openAI) == null ? void 0 : a.urlDetails) || {},
|
9927
9957
|
r = (c = (l = t.azure) == null ? void 0 : l.openAI) == null ? void 0 : c.chat;
|
9928
|
-
_this48 = _callSuper(this, As, [e,
|
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 () {
|
9929
9959
|
return !1;
|
9930
9960
|
}, setTimeout(function () {
|
9931
9961
|
e.addMessage({
|
9932
|
-
error:
|
9962
|
+
error: oe.URL_DETAILS_ERROR_MESSAGE
|
9933
9963
|
});
|
9934
9964
|
}));
|
9935
9965
|
return _this48;
|
@@ -9945,10 +9975,10 @@ var As = /*#__PURE__*/function (_vt) {
|
|
9945
9975
|
}
|
9946
9976
|
}]);
|
9947
9977
|
}(vt);
|
9948
|
-
var
|
9949
|
-
function
|
9978
|
+
var he = /*#__PURE__*/function (_z12) {
|
9979
|
+
function he(e) {
|
9950
9980
|
var _this49;
|
9951
|
-
_classCallCheck(this,
|
9981
|
+
_classCallCheck(this, he);
|
9952
9982
|
var o;
|
9953
9983
|
var t = e.directConnection,
|
9954
9984
|
i = t == null ? void 0 : t.openAI,
|
@@ -9960,7 +9990,7 @@ var de = /*#__PURE__*/function (_q12) {
|
|
9960
9990
|
}
|
9961
9991
|
}
|
9962
9992
|
};
|
9963
|
-
_this49 = _callSuper(this,
|
9993
|
+
_this49 = _callSuper(this, he, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, s]), _this49.insertKeyPlaceholderText = "OpenAI API Key", _this49.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this49.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this49.url = "", _this49.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
|
9964
9994
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
9965
9995
|
if (_this49.camera) {
|
9966
9996
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
@@ -9971,11 +10001,11 @@ var de = /*#__PURE__*/function (_q12) {
|
|
9971
10001
|
}
|
9972
10002
|
};
|
9973
10003
|
}
|
9974
|
-
_typeof(r) == "object" && Object.assign(_this49.rawBody, r), _this49.canSendMessage =
|
10004
|
+
_typeof(r) == "object" && Object.assign(_this49.rawBody, r), _this49.canSendMessage = he.canFileSendMessage;
|
9975
10005
|
return _this49;
|
9976
10006
|
}
|
9977
|
-
_inherits(
|
9978
|
-
return _createClass(
|
10007
|
+
_inherits(he, _z12);
|
10008
|
+
return _createClass(he, [{
|
9979
10009
|
key: "preprocessBody",
|
9980
10010
|
value: function preprocessBody(e, t) {
|
9981
10011
|
var i = JSON.parse(JSON.stringify(e));
|
@@ -9989,10 +10019,10 @@ var de = /*#__PURE__*/function (_q12) {
|
|
9989
10019
|
var s;
|
9990
10020
|
var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
|
9991
10021
|
if (i[1] || r && r !== "") {
|
9992
|
-
this.url =
|
10022
|
+
this.url = he.IMAGE_EDIT_URL;
|
9993
10023
|
var l = this.preprocessBody(this.rawBody, r);
|
9994
|
-
s =
|
9995
|
-
} else this.url =
|
10024
|
+
s = he.createFormDataBody(l, i[0], i[1]);
|
10025
|
+
} else this.url = he.IMAGE_VARIATIONS_URL, s = he.createFormDataBody(this.rawBody, i[0]);
|
9996
10026
|
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
9997
10027
|
}
|
9998
10028
|
}, {
|
@@ -10023,7 +10053,7 @@ var de = /*#__PURE__*/function (_q12) {
|
|
10023
10053
|
}
|
10024
10054
|
throw new Error("Request settings have not been set up");
|
10025
10055
|
case 8:
|
10026
|
-
this.url =
|
10056
|
+
this.url = he.IMAGE_GENERATION_URL;
|
10027
10057
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
10028
10058
|
T.request(this, r, e);
|
10029
10059
|
case 11:
|
@@ -10094,9 +10124,9 @@ var de = /*#__PURE__*/function (_q12) {
|
|
10094
10124
|
}), s;
|
10095
10125
|
}
|
10096
10126
|
}]);
|
10097
|
-
}(
|
10098
|
-
|
10099
|
-
var bs =
|
10127
|
+
}(z);
|
10128
|
+
he.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", he.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", he.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
10129
|
+
var bs = he;
|
10100
10130
|
var Ho = /*#__PURE__*/function (_Ts3) {
|
10101
10131
|
function Ho(e) {
|
10102
10132
|
var _this50$maxMessages;
|
@@ -10198,7 +10228,7 @@ var xi = /*#__PURE__*/function () {
|
|
10198
10228
|
key: "handleVerificationResult",
|
10199
10229
|
value: function handleVerificationResult(e, t, i, s) {
|
10200
10230
|
var o;
|
10201
|
-
(o = e.message) != null && o.includes("invalid request: prompt must be at least 1 token long") ? i(t) : s(
|
10231
|
+
(o = e.message) != null && o.includes("invalid request: prompt must be at least 1 token long") ? i(t) : s(M.INVALID_KEY);
|
10202
10232
|
}
|
10203
10233
|
}, {
|
10204
10234
|
key: "buildKeyVerificationDetails",
|
@@ -10211,7 +10241,7 @@ var xi = /*#__PURE__*/function () {
|
|
10211
10241
|
}
|
10212
10242
|
}]);
|
10213
10243
|
}();
|
10214
|
-
var qo = /*#__PURE__*/function (
|
10244
|
+
var qo = /*#__PURE__*/function (_z13) {
|
10215
10245
|
function qo(e) {
|
10216
10246
|
var _this51$maxMessages, _s$model;
|
10217
10247
|
var _this51;
|
@@ -10221,7 +10251,7 @@ var qo = /*#__PURE__*/function (_q13) {
|
|
10221
10251
|
_this51 = _callSuper(this, qo, [e, xi.buildKeyVerificationDetails(), xi.buildHeaders, i]), _this51.insertKeyPlaceholderText = "Mistral API Key", _this51.keyHelpUrl = "https://console.mistral.ai/api-keys/", _this51.url = "https://api.mistral.ai/v1/chat/completions", _this51.permittedErrorPrefixes = ["invalid"], i && (_this51.cleanConfig(i), Object.assign(_this51.rawBody, i)), (_this51$maxMessages = _this51.maxMessages) !== null && _this51$maxMessages !== void 0 ? _this51$maxMessages : _this51.maxMessages = -1, (_s$model = (s = _this51.rawBody).model) !== null && _s$model !== void 0 ? _s$model : s.model = "open-mistral-7b";
|
10222
10252
|
return _this51;
|
10223
10253
|
}
|
10224
|
-
_inherits(qo,
|
10254
|
+
_inherits(qo, _z13);
|
10225
10255
|
return _createClass(qo, [{
|
10226
10256
|
key: "cleanConfig",
|
10227
10257
|
value: function cleanConfig(e) {
|
@@ -10297,7 +10327,7 @@ var qo = /*#__PURE__*/function (_q13) {
|
|
10297
10327
|
return extractResultData;
|
10298
10328
|
}()
|
10299
10329
|
}]);
|
10300
|
-
}(
|
10330
|
+
}(z);
|
10301
10331
|
var zo = /*#__PURE__*/function () {
|
10302
10332
|
function zo() {
|
10303
10333
|
_classCallCheck(this, zo);
|
@@ -10420,15 +10450,15 @@ var Go = /*#__PURE__*/function () {
|
|
10420
10450
|
}]);
|
10421
10451
|
}();
|
10422
10452
|
var Vo = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n\t viewBox=\"50 30 420 450\" xml:space=\"preserve\">\n<g filter=\"brightness(0) saturate(100%) invert(16%) sepia(0%) saturate(1942%) hue-rotate(215deg) brightness(99%) contrast(93%)\">\n\t<g>\n\t\t<path d=\"M447.933,103.629c-0.034-3.076-1.224-6.09-3.485-8.352L352.683,3.511c-0.004-0.004-0.007-0.005-0.011-0.008\n\t\t\tC350.505,1.338,347.511,0,344.206,0H89.278C75.361,0,64.04,11.32,64.04,25.237v461.525c0,13.916,11.32,25.237,25.237,25.237\n\t\t\th333.444c13.916,0,25.237-11.32,25.237-25.237V103.753C447.96,103.709,447.937,103.672,447.933,103.629z M356.194,40.931\n\t\t\tl50.834,50.834h-49.572c-0.695,0-1.262-0.567-1.262-1.262V40.931z M423.983,486.763c0,0.695-0.566,1.261-1.261,1.261H89.278\n\t\t\tc-0.695,0-1.261-0.566-1.261-1.261V25.237c0-0.695,0.566-1.261,1.261-1.261h242.94v66.527c0,13.916,11.322,25.239,25.239,25.239\n\t\t\th66.527V486.763z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,164.014H149.912c-6.62,0-11.988,5.367-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,169.381,368.707,164.014,362.088,164.014z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,236.353H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,241.721,368.707,236.353,362.088,236.353z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,308.691H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C374.076,314.06,368.707,308.691,362.088,308.691z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M256,381.031H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988H256\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C267.988,386.398,262.62,381.031,256,381.031z\"/>\n\t</g>\n</g>\n</svg>";
|
10423
|
-
var
|
10424
|
-
function
|
10425
|
-
_classCallCheck(this,
|
10453
|
+
var Oe = /*#__PURE__*/function () {
|
10454
|
+
function Oe() {
|
10455
|
+
_classCallCheck(this, Oe);
|
10426
10456
|
}
|
10427
|
-
return _createClass(
|
10457
|
+
return _createClass(Oe, null, [{
|
10428
10458
|
key: "createImage",
|
10429
10459
|
value: function createImage(e, t, i) {
|
10430
10460
|
var s = new Image();
|
10431
|
-
return s.src = e.src, i ||
|
10461
|
+
return s.src = e.src, i || B.scrollDownOnImageLoad(s.src, t), B.processContent("image", s, s.src, e.name);
|
10432
10462
|
}
|
10433
10463
|
// WORK - image still does not scroll down when loaded
|
10434
10464
|
}, {
|
@@ -10439,8 +10469,8 @@ var Pe = /*#__PURE__*/function () {
|
|
10439
10469
|
return _regeneratorRuntime().wrap(function _callee111$(_context111) {
|
10440
10470
|
while (1) switch (_context111.prev = _context111.next) {
|
10441
10471
|
case 0:
|
10442
|
-
r =
|
10443
|
-
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("image-message"),
|
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);
|
10444
10474
|
case 2:
|
10445
10475
|
case "end":
|
10446
10476
|
return _context111.stop();
|
@@ -10461,9 +10491,9 @@ var Pe = /*#__PURE__*/function () {
|
|
10461
10491
|
}, {
|
10462
10492
|
key: "addNewAudioMessage",
|
10463
10493
|
value: function addNewAudioMessage(e, t, i, s) {
|
10464
|
-
var r =
|
10494
|
+
var r = Oe.createAudioElement(t, i),
|
10465
10495
|
o = e.createMessageElementsOnOrientation("", i, s);
|
10466
|
-
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"),
|
10496
|
+
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"), B.addMessage(e, o, "audio", i, s);
|
10467
10497
|
}
|
10468
10498
|
}, {
|
10469
10499
|
key: "createAnyFile",
|
@@ -10472,29 +10502,29 @@ var Pe = /*#__PURE__*/function () {
|
|
10472
10502
|
t.classList.add("any-file-message-contents");
|
10473
10503
|
var i = document.createElement("div");
|
10474
10504
|
i.classList.add("any-file-message-icon-container");
|
10475
|
-
var s =
|
10505
|
+
var s = ie.createSVGElement(Vo);
|
10476
10506
|
s.classList.add("any-file-message-icon"), i.appendChild(s);
|
10477
10507
|
var r = document.createElement("div");
|
10478
|
-
return r.classList.add("any-file-message-text"), r.textContent = e.name ||
|
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);
|
10479
10509
|
}
|
10480
10510
|
}, {
|
10481
10511
|
key: "addNewAnyFileMessage",
|
10482
10512
|
value: function addNewAnyFileMessage(e, t, i, s) {
|
10483
10513
|
var r = e.createMessageElementsOnOrientation("", i, s),
|
10484
|
-
o =
|
10485
|
-
r.bubbleElement.classList.add("any-file-message-bubble"), r.bubbleElement.appendChild(o),
|
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);
|
10486
10516
|
}
|
10487
10517
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
10488
10518
|
}, {
|
10489
10519
|
key: "addMessages",
|
10490
10520
|
value: function addMessages(e, t, i, s) {
|
10491
10521
|
t.forEach(function (r) {
|
10492
|
-
r.ref && (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);
|
10493
10523
|
});
|
10494
10524
|
}
|
10495
10525
|
}]);
|
10496
10526
|
}();
|
10497
|
-
var Ee = /*#__PURE__*/function (
|
10527
|
+
var Ee = /*#__PURE__*/function (_Be) {
|
10498
10528
|
function Ee(e, t, i) {
|
10499
10529
|
var _this52;
|
10500
10530
|
_classCallCheck(this, Ee);
|
@@ -10505,7 +10535,7 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10505
10535
|
o = t.demo;
|
10506
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 () {
|
10507
10537
|
return JSON.parse(JSON.stringify(_this52.messages));
|
10508
|
-
}, e.clearMessages = _this52.clearMessages.bind(_this52, t), e.refreshMessages = _this52.refreshTextMessages.bind(_this52), e.scrollToBottom =
|
10538
|
+
}, 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) {
|
10509
10539
|
_this52.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
|
10510
10540
|
sendUpdate: !!d
|
10511
10541
|
}), !d);
|
@@ -10514,7 +10544,11 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10514
10544
|
});
|
10515
10545
|
return _this52;
|
10516
10546
|
}
|
10517
|
-
|
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);
|
10518
10552
|
return _createClass(Ee, [{
|
10519
10553
|
key: "prepareDemo",
|
10520
10554
|
value: function prepareDemo(e) {
|
@@ -10547,7 +10581,7 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10547
10581
|
value: function addIntroductoryMessage(e) {
|
10548
10582
|
var i;
|
10549
10583
|
var t;
|
10550
|
-
e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (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"));
|
10551
10585
|
}
|
10552
10586
|
}, {
|
10553
10587
|
key: "removeIntroductoryMessage",
|
@@ -10572,8 +10606,8 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10572
10606
|
r = {
|
10573
10607
|
status: e.overwrite
|
10574
10608
|
};
|
10575
|
-
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) &&
|
10576
|
-
var o =
|
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);
|
10577
10611
|
Me.isElementTemporary(o) && delete s.html;
|
10578
10612
|
}
|
10579
10613
|
return this.isValidMessageContent(s) && !i && this.updateStateOnMessage(s, e.overwrite, e.sendUpdate, t), s;
|
@@ -10606,13 +10640,13 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10606
10640
|
var c, d, h, u, f;
|
10607
10641
|
this.removeMessageOnError();
|
10608
10642
|
var s = this.getPermittedMessage(t) || ((c = this._errorMessageOverrides) == null ? void 0 : c[e]) || ((d = this._errorMessageOverrides) == null ? void 0 : d["default"]) || "Error, please try again.",
|
10609
|
-
r = this.createMessageElementsOnOrientation(s, "", i);
|
10643
|
+
r = this.createMessageElementsOnOrientation(s, "error", i);
|
10610
10644
|
b.hideRoleElements(this.messageElementRefs, !!this._avatars, !!this._names);
|
10611
10645
|
var o = r.bubbleElement,
|
10612
10646
|
a = r.outerContainer;
|
10613
10647
|
o.classList.add("error-message-text"), this.renderText(o, s);
|
10614
|
-
var l =
|
10615
|
-
|
10648
|
+
var l = q.extractParticularSharedStyles(["fontSize", "fontFamily"], (h = this.messageStyles) == null ? void 0 : h["default"]);
|
10649
|
+
q.applyCustomStylesToElements(r, !1, l), q.applyCustomStylesToElements(r, !1, (u = this.messageStyles) == null ? void 0 : u.error), i || this.elementRef.appendChild(a), this.textToSpeech && bt.speak(s, this.textToSpeech), (f = this._onError) == null || f.call(this, s);
|
10616
10650
|
}
|
10617
10651
|
}, {
|
10618
10652
|
key: "getPermittedMessage",
|
@@ -10651,13 +10685,13 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10651
10685
|
var i, s, r, o, a, l;
|
10652
10686
|
if (!this._displayLoadingMessage) return;
|
10653
10687
|
var e = (r = (s = (i = this.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.message) == null ? void 0 : r.html,
|
10654
|
-
t = e ?
|
10655
|
-
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),
|
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);
|
10656
10690
|
}
|
10657
10691
|
}, {
|
10658
10692
|
key: "populateIntroPanel",
|
10659
10693
|
value: function populateIntroPanel(e, t, i) {
|
10660
|
-
(e || t) && (this._introPanel = new Si(e, t, i), this._introPanel._elementRef && (
|
10694
|
+
(e || t) && (this._introPanel = new Si(e, t, i), this._introPanel._elementRef && (te.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
10661
10695
|
}
|
10662
10696
|
}, {
|
10663
10697
|
key: "addMultipleFiles",
|
@@ -10669,7 +10703,7 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10669
10703
|
return _context112.abrupt("return", Promise.all((e || []).map(function (t) {
|
10670
10704
|
return new Promise(function (i) {
|
10671
10705
|
if (!t.type || t.type === "any") {
|
10672
|
-
var s = t.file.name ||
|
10706
|
+
var s = t.file.name || B.DEFAULT_FILE_NAME;
|
10673
10707
|
i({
|
10674
10708
|
name: s,
|
10675
10709
|
type: "any",
|
@@ -10740,12 +10774,12 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10740
10774
|
return e.contains(ke.BUBBLE_CLASS) || e.contains(Qe.CLASS) || e.contains(ge.MESSAGE_CLASS);
|
10741
10775
|
}
|
10742
10776
|
}]);
|
10743
|
-
}(
|
10744
|
-
var
|
10745
|
-
function
|
10746
|
-
_classCallCheck(this,
|
10777
|
+
}(Be);
|
10778
|
+
var N = /*#__PURE__*/function () {
|
10779
|
+
function N() {
|
10780
|
+
_classCallCheck(this, N);
|
10747
10781
|
}
|
10748
|
-
return _createClass(
|
10782
|
+
return _createClass(N, null, [{
|
10749
10783
|
key: "adjustInputPadding",
|
10750
10784
|
value: function adjustInputPadding(e, t) {
|
10751
10785
|
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");
|
@@ -10753,7 +10787,7 @@ var O = /*#__PURE__*/function () {
|
|
10753
10787
|
}, {
|
10754
10788
|
key: "adjustForOutsideButton",
|
10755
10789
|
value: function adjustForOutsideButton(e, t, i) {
|
10756
|
-
i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(
|
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));
|
10757
10791
|
}
|
10758
10792
|
// when submit is the only button
|
10759
10793
|
// when submit button is outside by itself - we increase the height for a better look
|
@@ -10761,10 +10795,10 @@ var O = /*#__PURE__*/function () {
|
|
10761
10795
|
key: "adjustOutsideSubmit",
|
10762
10796
|
value: function adjustOutsideSubmit(e, t, i) {
|
10763
10797
|
if (!(i["inside-left"].length > 0 || i["inside-right"].length > 0)) {
|
10764
|
-
if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(
|
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) {
|
10765
10799
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
10766
10800
|
});
|
10767
|
-
if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(
|
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) {
|
10768
10802
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
10769
10803
|
});
|
10770
10804
|
}
|
@@ -10772,12 +10806,12 @@ var O = /*#__PURE__*/function () {
|
|
10772
10806
|
}, {
|
10773
10807
|
key: "set",
|
10774
10808
|
value: function set(e, t, i, s) {
|
10775
|
-
!!
|
10809
|
+
!!N.adjustOutsideSubmit(t, i, s) || N.adjustForOutsideButton(t, i, s), N.adjustInputPadding(e, s);
|
10776
10810
|
}
|
10777
10811
|
}]);
|
10778
10812
|
}();
|
10779
|
-
|
10780
|
-
var ys =
|
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;
|
10781
10815
|
var _t = /*#__PURE__*/function () {
|
10782
10816
|
function _t() {
|
10783
10817
|
_classCallCheck(this, _t);
|
@@ -10812,11 +10846,11 @@ var _t = /*#__PURE__*/function () {
|
|
10812
10846
|
}]);
|
10813
10847
|
}();
|
10814
10848
|
var Js = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "microphone"];
|
10815
|
-
var
|
10816
|
-
function
|
10817
|
-
_classCallCheck(this,
|
10849
|
+
var W = /*#__PURE__*/function () {
|
10850
|
+
function W() {
|
10851
|
+
_classCallCheck(this, W);
|
10818
10852
|
}
|
10819
|
-
return _createClass(
|
10853
|
+
return _createClass(W, null, [{
|
10820
10854
|
key: "createTextElement",
|
10821
10855
|
value: function createTextElement(e) {
|
10822
10856
|
var t = document.createElement("div");
|
@@ -10825,15 +10859,15 @@ var $ = /*#__PURE__*/function () {
|
|
10825
10859
|
}, {
|
10826
10860
|
key: "createElement",
|
10827
10861
|
value: function createElement(e, t) {
|
10828
|
-
return t ?
|
10862
|
+
return t ? W.createTextElement(e) : ie.createSVGElement(e);
|
10829
10863
|
}
|
10830
10864
|
}, {
|
10831
10865
|
key: "createCustomElement",
|
10832
10866
|
value: function createCustomElement(e, t) {
|
10833
10867
|
var s, r, o, a;
|
10834
10868
|
var i = t == null ? void 0 : t[e];
|
10835
|
-
if ((s = i == null ? void 0 : i.svg) != null && s.content) return
|
10836
|
-
if ((o = i == null ? void 0 : i.text) != null && o.content) return
|
10869
|
+
if ((s = i == null ? void 0 : i.svg) != null && s.content) return W.createElement((r = i == null ? void 0 : i.svg) == null ? void 0 : r.content, !1);
|
10870
|
+
if ((o = i == null ? void 0 : i.text) != null && o.content) return W.createElement((a = i == null ? void 0 : i.text) == null ? void 0 : a.content, !0);
|
10837
10871
|
}
|
10838
10872
|
}, {
|
10839
10873
|
key: "processElement",
|
@@ -10846,7 +10880,7 @@ var $ = /*#__PURE__*/function () {
|
|
10846
10880
|
key: "createSpecificStateElement",
|
10847
10881
|
value: function createSpecificStateElement(e, t, i) {
|
10848
10882
|
var s;
|
10849
|
-
return i && (s =
|
10883
|
+
return i && (s = W.createCustomElement(t, i)), W.processElement(e, s), s;
|
10850
10884
|
}
|
10851
10885
|
// https://github.com/OvidijusParsiunas/deep-chat/issues/175
|
10852
10886
|
// isDropup here is only determined by the user and not when moved to dropup automatically
|
@@ -10856,26 +10890,26 @@ var $ = /*#__PURE__*/function () {
|
|
10856
10890
|
value: function createInnerElement(e, t, i, s) {
|
10857
10891
|
var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
|
10858
10892
|
var o, a;
|
10859
|
-
return r && !((a = (o = s == null ? void 0 : s[i]) == null ? void 0 : o.svg) != null && a.content) ? t :
|
10893
|
+
return r && !((a = (o = s == null ? void 0 : s[i]) == null ? void 0 : o.svg) != null && a.content) ? t : W.createSpecificStateElement(e, i, s) || t;
|
10860
10894
|
}
|
10861
10895
|
}]);
|
10862
10896
|
}();
|
10863
10897
|
var $o = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M16 0c-8.836 0-16 7.163-16 16s7.163 16 16 16c8.837 0 16-7.163 16-16s-7.163-16-16-16zM16 30.032c-7.72 0-14-6.312-14-14.032s6.28-14 14-14 14 6.28 14 14-6.28 14.032-14 14.032zM23 15h-6v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1v6h-6c-0.552 0-1 0.448-1 1s0.448 1 1 1h6v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6h6c0.552 0 1-0.448 1-1s-0.448-1-1-1z\"></path>\n</svg>";
|
10864
|
-
var
|
10865
|
-
function
|
10866
|
-
_classCallCheck(this,
|
10898
|
+
var fe = /*#__PURE__*/function () {
|
10899
|
+
function fe() {
|
10900
|
+
_classCallCheck(this, fe);
|
10867
10901
|
}
|
10868
|
-
return _createClass(
|
10902
|
+
return _createClass(fe, null, [{
|
10869
10903
|
key: "unsetAllCSS",
|
10870
10904
|
value: function unsetAllCSS(e, t) {
|
10871
10905
|
var i, s;
|
10872
|
-
t.container &&
|
10906
|
+
t.container && R.unsetAllCSSMouseStates(e, t.container), (i = t.svg) != null && i.styles && R.unsetAllCSSMouseStates(e.children[0], t.svg.styles), (s = t.text) != null && s.styles && R.unsetAllCSSMouseStates(e.children[0], t.text.styles);
|
10873
10907
|
}
|
10874
10908
|
}, {
|
10875
10909
|
key: "unsetActionCSS",
|
10876
10910
|
value: function unsetActionCSS(e, t) {
|
10877
10911
|
var i, s;
|
10878
|
-
t.container &&
|
10912
|
+
t.container && R.unsetActivityCSSMouseStates(e, t.container), (i = t.svg) != null && i.styles && R.unsetActivityCSSMouseStates(e.children[0], t.svg.styles), (s = t.text) != null && s.styles && R.unsetActivityCSSMouseStates(e.children[0], t.text.styles);
|
10879
10913
|
}
|
10880
10914
|
}, {
|
10881
10915
|
key: "setElementsCSS",
|
@@ -10886,7 +10920,7 @@ var ue = /*#__PURE__*/function () {
|
|
10886
10920
|
}, {
|
10887
10921
|
key: "setElementCssUpToState",
|
10888
10922
|
value: function setElementCssUpToState(e, t, i) {
|
10889
|
-
|
10923
|
+
fe.setElementsCSS(e, t, "default"), i !== "default" && (fe.setElementsCSS(e, t, "hover"), i !== "hover" && fe.setElementsCSS(e, t, "click"));
|
10890
10924
|
}
|
10891
10925
|
}]);
|
10892
10926
|
}();
|
@@ -10900,22 +10934,22 @@ var Xt = /*#__PURE__*/function () {
|
|
10900
10934
|
return _createClass(Xt, [{
|
10901
10935
|
key: "buttonMouseLeave",
|
10902
10936
|
value: function buttonMouseLeave(e) {
|
10903
|
-
this._mouseState.state = "default", e && (
|
10937
|
+
this._mouseState.state = "default", e && (fe.unsetAllCSS(this.elementRef, e), fe.setElementsCSS(this.elementRef, e, "default"));
|
10904
10938
|
}
|
10905
10939
|
}, {
|
10906
10940
|
key: "buttonMouseEnter",
|
10907
10941
|
value: function buttonMouseEnter(e) {
|
10908
|
-
this._mouseState.state = "hover", e &&
|
10942
|
+
this._mouseState.state = "hover", e && fe.setElementsCSS(this.elementRef, e, "hover");
|
10909
10943
|
}
|
10910
10944
|
}, {
|
10911
10945
|
key: "buttonMouseUp",
|
10912
10946
|
value: function buttonMouseUp(e) {
|
10913
|
-
e &&
|
10947
|
+
e && fe.unsetActionCSS(this.elementRef, e), this.buttonMouseEnter(e);
|
10914
10948
|
}
|
10915
10949
|
}, {
|
10916
10950
|
key: "buttonMouseDown",
|
10917
10951
|
value: function buttonMouseDown(e) {
|
10918
|
-
this._mouseState.state = "click", e &&
|
10952
|
+
this._mouseState.state = "click", e && fe.setElementsCSS(this.elementRef, e, "click");
|
10919
10953
|
}
|
10920
10954
|
// be careful not to use onclick as that is used for button functionality
|
10921
10955
|
}, {
|
@@ -10929,7 +10963,7 @@ var Xt = /*#__PURE__*/function () {
|
|
10929
10963
|
if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
|
10930
10964
|
var _i15 = e[t],
|
10931
10965
|
s = _i15 && this._customStyles[_i15];
|
10932
|
-
s &&
|
10966
|
+
s && fe.unsetActionCSS(this.elementRef, s);
|
10933
10967
|
}
|
10934
10968
|
}
|
10935
10969
|
}, {
|
@@ -10938,7 +10972,7 @@ var Xt = /*#__PURE__*/function () {
|
|
10938
10972
|
if (!this._customStyles) return;
|
10939
10973
|
t && this.unsetCustomStateStyles(t);
|
10940
10974
|
var i = this._customStyles[e];
|
10941
|
-
i &&
|
10975
|
+
i && fe.setElementCssUpToState(this.elementRef, i, this._mouseState.state), this.setEvents(i);
|
10942
10976
|
}
|
10943
10977
|
}]);
|
10944
10978
|
}();
|
@@ -11005,7 +11039,7 @@ var qe = /*#__PURE__*/function () {
|
|
11005
11039
|
r = t.dropupText,
|
11006
11040
|
o = document.createElement("div");
|
11007
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");
|
11008
|
-
var a =
|
11042
|
+
var a = R.processStateful((i == null ? void 0 : i.item) || {}, {
|
11009
11043
|
backgroundColor: "#f3f3f3"
|
11010
11044
|
}, {
|
11011
11045
|
backgroundColor: "#ebebeb"
|
@@ -11061,7 +11095,7 @@ var ks = /*#__PURE__*/function () {
|
|
11061
11095
|
key: "windowKeyDown",
|
11062
11096
|
value: function windowKeyDown(e, t) {
|
11063
11097
|
var i, s, r;
|
11064
|
-
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key ===
|
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));
|
11065
11099
|
}
|
11066
11100
|
}], [{
|
11067
11101
|
key: "createElement",
|
@@ -11094,7 +11128,7 @@ var yt = /*#__PURE__*/function (_Xt) {
|
|
11094
11128
|
}, {
|
11095
11129
|
key: "createInnerElement",
|
11096
11130
|
value: function createInnerElement(e, t, i) {
|
11097
|
-
return
|
11131
|
+
return W.createSpecificStateElement(this.elementRef, t, i) || e;
|
11098
11132
|
}
|
11099
11133
|
}, {
|
11100
11134
|
key: "addClickEvent",
|
@@ -11123,7 +11157,7 @@ var yt = /*#__PURE__*/function (_Xt) {
|
|
11123
11157
|
}, {
|
11124
11158
|
key: "createSVGIconElement",
|
11125
11159
|
value: function createSVGIconElement() {
|
11126
|
-
return
|
11160
|
+
return ie.createSVGElement($o);
|
11127
11161
|
}
|
11128
11162
|
}, {
|
11129
11163
|
key: "createButtonContainer",
|
@@ -11139,11 +11173,11 @@ var yt = /*#__PURE__*/function (_Xt) {
|
|
11139
11173
|
}
|
11140
11174
|
}]);
|
11141
11175
|
}(Xt);
|
11142
|
-
var
|
11143
|
-
function
|
11144
|
-
_classCallCheck(this,
|
11176
|
+
var V = /*#__PURE__*/function () {
|
11177
|
+
function V() {
|
11178
|
+
_classCallCheck(this, V);
|
11145
11179
|
}
|
11146
|
-
return _createClass(
|
11180
|
+
return _createClass(V, null, [{
|
11147
11181
|
key: "addToDropup",
|
11148
11182
|
value:
|
11149
11183
|
// prettier-ignore
|
@@ -11192,25 +11226,25 @@ var G = /*#__PURE__*/function () {
|
|
11192
11226
|
}, {
|
11193
11227
|
key: "generatePositions",
|
11194
11228
|
value: function generatePositions(e) {
|
11195
|
-
var t =
|
11229
|
+
var t = V.createPositionsObj();
|
11196
11230
|
Object.keys(e).forEach(function (s) {
|
11197
11231
|
var o;
|
11198
11232
|
var r = (o = e[s]) == null ? void 0 : o.button.position;
|
11199
|
-
r &&
|
11200
|
-
}), t["inside-right"].length === 0 && e.submit &&
|
11233
|
+
r && V.setPosition(e, s, t[r]);
|
11234
|
+
}), t["inside-right"].length === 0 && e.submit && V.setPosition(e, "submit", t["inside-right"]), t["outside-right"].length === 0 && (e.submit ? V.setPosition(e, "submit", t["outside-right"]) : e.microphone ? V.setPosition(e, "microphone", t["outside-right"]) : e.camera && V.setPosition(e, "camera", t["outside-right"])), e.submit && V.setPosition(e, "submit", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]), e.microphone && V.setPosition(e, "microphone", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]);
|
11201
11235
|
var i = Object.keys(e);
|
11202
11236
|
return i.length > 1 || t["dropup-menu"].length > 0 ? Js.forEach(function (s) {
|
11203
11237
|
e[s] && t["dropup-menu"].push(_objectSpread(_objectSpread({}, e[s]), {}, {
|
11204
11238
|
buttonType: s
|
11205
11239
|
}));
|
11206
|
-
}) : i.length === 1 &&
|
11240
|
+
}) : i.length === 1 && V.setPosition(e, i[0], t["outside-right"].length === 0 ? t["outside-right"] : t["outside-left"]), t;
|
11207
11241
|
}
|
11208
11242
|
// prettier-ignore
|
11209
11243
|
}, {
|
11210
11244
|
key: "addButtons",
|
11211
11245
|
value: function addButtons(e, t, i, s) {
|
11212
|
-
var r =
|
11213
|
-
return
|
11246
|
+
var r = V.generatePositions(t);
|
11247
|
+
return V.addToSideContainer(e, r), r["dropup-menu"].length > 0 && V.addToDropup(e, r, i, s), r;
|
11214
11248
|
}
|
11215
11249
|
}]);
|
11216
11250
|
}();
|
@@ -11264,7 +11298,7 @@ var Gt = /*#__PURE__*/function (_Xt2) {
|
|
11264
11298
|
}, {
|
11265
11299
|
key: "createInnerElement",
|
11266
11300
|
value: function createInnerElement(e, t, i) {
|
11267
|
-
return
|
11301
|
+
return W.createSpecificStateElement(this.elementRef, t, i) || e;
|
11268
11302
|
}
|
11269
11303
|
}, {
|
11270
11304
|
key: "changeToActive",
|
@@ -11311,7 +11345,7 @@ var Gt = /*#__PURE__*/function (_Xt2) {
|
|
11311
11345
|
}, {
|
11312
11346
|
key: "createSVGIconElement",
|
11313
11347
|
value: function createSVGIconElement() {
|
11314
|
-
var e =
|
11348
|
+
var e = ie.createSVGElement(Yo);
|
11315
11349
|
return e.id = "microphone-icon", e;
|
11316
11350
|
}
|
11317
11351
|
}]);
|
@@ -11436,11 +11470,11 @@ Object.defineProperty(Fi, "__esModule", {
|
|
11436
11470
|
value: !0
|
11437
11471
|
});
|
11438
11472
|
Fi.EventListeners = void 0;
|
11439
|
-
var
|
11440
|
-
function
|
11441
|
-
_classCallCheck(this,
|
11473
|
+
var re = /*#__PURE__*/function () {
|
11474
|
+
function re() {
|
11475
|
+
_classCallCheck(this, re);
|
11442
11476
|
}
|
11443
|
-
return _createClass(
|
11477
|
+
return _createClass(re, null, [{
|
11444
11478
|
key: "getElementIfFocusedOnAvailable",
|
11445
11479
|
value: function getElementIfFocusedOnAvailable(e, t) {
|
11446
11480
|
return Array.isArray(e) ? e.find(function (i) {
|
@@ -11451,14 +11485,14 @@ var ne = /*#__PURE__*/function () {
|
|
11451
11485
|
key: "keyDownWindow",
|
11452
11486
|
value: function keyDownWindow(e) {
|
11453
11487
|
var _this58 = this;
|
11454
|
-
e.element &&
|
11455
|
-
|
11488
|
+
e.element && re.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (re.KEY_DOWN_TIMEOUT !== null && clearTimeout(re.KEY_DOWN_TIMEOUT), re.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
11489
|
+
re.KEY_DOWN_TIMEOUT = null, _this58.resetRecording(e);
|
11456
11490
|
}, 500));
|
11457
11491
|
}
|
11458
11492
|
}, {
|
11459
11493
|
key: "mouseDownWindow",
|
11460
11494
|
value: function mouseDownWindow(e, t) {
|
11461
|
-
this.mouseDownElement =
|
11495
|
+
this.mouseDownElement = re.getElementIfFocusedOnAvailable(e, t.target);
|
11462
11496
|
}
|
11463
11497
|
}, {
|
11464
11498
|
key: "mouseUpWindow",
|
@@ -11469,7 +11503,7 @@ var ne = /*#__PURE__*/function () {
|
|
11469
11503
|
key: "add",
|
11470
11504
|
value: function add(e, t) {
|
11471
11505
|
var i = (t == null ? void 0 : t.insertInCursorLocation) === void 0 || (t == null ? void 0 : t.insertInCursorLocation);
|
11472
|
-
t != null && t.element && i && (e.mouseDownEvent =
|
11506
|
+
t != null && t.element && i && (e.mouseDownEvent = re.mouseDownWindow.bind(e, t.element), document.addEventListener("mousedown", e.mouseDownEvent), e.mouseUpEvent = re.mouseUpWindow.bind(e, t), document.addEventListener("mouseup", e.mouseUpEvent), e.keyDownEvent = re.keyDownWindow.bind(e, t), document.addEventListener("keydown", e.keyDownEvent));
|
11473
11507
|
}
|
11474
11508
|
}, {
|
11475
11509
|
key: "remove",
|
@@ -11478,8 +11512,8 @@ var ne = /*#__PURE__*/function () {
|
|
11478
11512
|
}
|
11479
11513
|
}]);
|
11480
11514
|
}();
|
11481
|
-
Fi.EventListeners =
|
11482
|
-
|
11515
|
+
Fi.EventListeners = re;
|
11516
|
+
re.KEY_DOWN_TIMEOUT = null;
|
11483
11517
|
var Bi = {};
|
11484
11518
|
Object.defineProperty(Bi, "__esModule", {
|
11485
11519
|
value: !0
|
@@ -11689,11 +11723,11 @@ var Xs = ti,
|
|
11689
11723
|
ra = wt,
|
11690
11724
|
Ys = lt,
|
11691
11725
|
Qs = ot;
|
11692
|
-
var
|
11693
|
-
function
|
11694
|
-
_classCallCheck(this,
|
11726
|
+
var ne = /*#__PURE__*/function () {
|
11727
|
+
function ne() {
|
11728
|
+
_classCallCheck(this, ne);
|
11695
11729
|
}
|
11696
|
-
return _createClass(
|
11730
|
+
return _createClass(ne, null, [{
|
11697
11731
|
key: "processCommand",
|
11698
11732
|
value: function processCommand(e, t) {
|
11699
11733
|
return (!t || !t.caseSensitive) && (e = e.toLowerCase()), (t == null ? void 0 : t.substrings) === !1 ? Qs.Text.breakupIntoWordsArr(e) : e;
|
@@ -11704,7 +11738,7 @@ var se = /*#__PURE__*/function () {
|
|
11704
11738
|
var t;
|
11705
11739
|
return ((t = e.settings) === null || t === void 0 ? void 0 : t.caseSensitive) === !0 ? e : Object.keys(e).reduce(function (s, r) {
|
11706
11740
|
var o = e[r];
|
11707
|
-
return s[r] = typeof o == "string" ?
|
11741
|
+
return s[r] = typeof o == "string" ? ne.processCommand(o, e.settings) : o, s;
|
11708
11742
|
}, {});
|
11709
11743
|
}
|
11710
11744
|
}, {
|
@@ -11722,7 +11756,7 @@ var se = /*#__PURE__*/function () {
|
|
11722
11756
|
}, {
|
11723
11757
|
key: "setText",
|
11724
11758
|
value: function setText(e, t, i, s) {
|
11725
|
-
|
11759
|
+
ne.toggleCommandModeOff(e), na.Elements.isPrimitiveElement(s) ? (s.value = i, e.isTargetInShadow || Ys.Cursor.setOffsetForPrimitive(s, i.length, !0), ra.Browser.IS_SAFARI() && e.autoScroll && Xs.AutoScroll.scrollSafariPrimitiveToEnd(s)) : (s.textContent = i, e.isTargetInShadow || Ys.Cursor.focusEndOfGeneric(s), setTimeout(function () {
|
11726
11760
|
return Xs.AutoScroll.scrollGeneric(e, s);
|
11727
11761
|
})), e.resetRecording(t);
|
11728
11762
|
}
|
@@ -11752,38 +11786,38 @@ var se = /*#__PURE__*/function () {
|
|
11752
11786
|
if (!c || !s || !i) return;
|
11753
11787
|
var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
|
11754
11788
|
h = Qs.Text.breakupIntoWordsArr(d),
|
11755
|
-
u = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ?
|
11789
|
+
u = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? ne.checkIfMatchesWord : ne.checkIfMatchesSubstring;
|
11756
11790
|
if (c.commandMode && u(c.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
|
11757
|
-
return
|
11791
|
+
return ne.toggleCommandModeOn(e);
|
11758
11792
|
}), {
|
11759
11793
|
doNotProcessTranscription: !1
|
11760
11794
|
};
|
11761
11795
|
if (!(c.commandMode && !e.isWaitingForCommand)) {
|
11762
|
-
if (c.stop && u(c.stop, d, h)) return
|
11796
|
+
if (c.stop && u(c.stop, d, h)) return ne.toggleCommandModeOff(e), setTimeout(function () {
|
11763
11797
|
return e.stop();
|
11764
11798
|
}), {
|
11765
11799
|
doNotProcessTranscription: !1
|
11766
11800
|
};
|
11767
|
-
if (c.pause && u(c.pause, d, h)) return
|
11801
|
+
if (c.pause && u(c.pause, d, h)) return ne.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
11768
11802
|
var f;
|
11769
11803
|
e.isPaused = !0, (f = e.onPauseTrigger) === null || f === void 0 || f.call(e, !0);
|
11770
11804
|
}), {
|
11771
11805
|
doNotProcessTranscription: !1
|
11772
11806
|
};
|
11773
|
-
if (c.resume && u(c.resume, d, h)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1),
|
11807
|
+
if (c.resume && u(c.resume, d, h)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1), ne.toggleCommandModeOff(e), e.resetRecording(i), {
|
11774
11808
|
doNotProcessTranscription: !0
|
11775
11809
|
};
|
11776
|
-
if (c.reset && u(c.reset, d, h)) return r !== void 0 &&
|
11810
|
+
if (c.reset && u(c.reset, d, h)) return r !== void 0 && ne.setText(e, i, r, s), {
|
11777
11811
|
doNotProcessTranscription: !0
|
11778
11812
|
};
|
11779
|
-
if (c.removeAllText && u(c.removeAllText, d, h)) return
|
11813
|
+
if (c.removeAllText && u(c.removeAllText, d, h)) return ne.setText(e, i, "", s), {
|
11780
11814
|
doNotProcessTranscription: !0
|
11781
11815
|
};
|
11782
11816
|
}
|
11783
11817
|
}
|
11784
11818
|
}]);
|
11785
11819
|
}();
|
11786
|
-
ei.CommandUtils =
|
11820
|
+
ei.CommandUtils = ne;
|
11787
11821
|
var Ui = {};
|
11788
11822
|
Object.defineProperty(Ui, "__esModule", {
|
11789
11823
|
value: !0
|
@@ -11915,7 +11949,7 @@ var tn = Fi,
|
|
11915
11949
|
sn = ei,
|
11916
11950
|
oi = ti,
|
11917
11951
|
Yi = Ui,
|
11918
|
-
|
11952
|
+
pe = at,
|
11919
11953
|
Qi = ji,
|
11920
11954
|
nn = wt,
|
11921
11955
|
rn = lt,
|
@@ -11923,7 +11957,7 @@ var tn = Fi,
|
|
11923
11957
|
var ca = /*#__PURE__*/function () {
|
11924
11958
|
function ca() {
|
11925
11959
|
_classCallCheck(this, ca);
|
11926
|
-
this.finalTranscript = "", this.interimSpan =
|
11960
|
+
this.finalTranscript = "", this.interimSpan = pe.Elements.createInterimSpan(), this.finalSpan = pe.Elements.createGenericSpan(), this.scrollingSpan = pe.Elements.createGenericSpan(), this.isCursorAtEnd = !1, this.spansPopulated = !1, this.startPadding = "", this.endPadding = "", this.numberOfSpacesBeforeNewText = 0, this.numberOfSpacesAfterNewText = 0, this.isHighlighted = !1, this.primitiveTextRecorded = !1, this.recognizing = !1, this._displayInterimResults = !0, this.insertInCursorLocation = !0, this.autoScroll = !0, this.isRestarting = !1, this.isPaused = !1, this.isWaitingForCommand = !1, this.isTargetInShadow = !1, this.cannotBeStopped = !1, this.resetState();
|
11927
11961
|
}
|
11928
11962
|
return _createClass(ca, [{
|
11929
11963
|
key: "prepareBeforeStart",
|
@@ -11936,12 +11970,12 @@ var ca = /*#__PURE__*/function () {
|
|
11936
11970
|
if (!r) return;
|
11937
11971
|
this.prepare(r);
|
11938
11972
|
} else this.prepare(e.element);
|
11939
|
-
(e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"],
|
11973
|
+
(e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"], pe.Elements.applyCustomColors(this, e.textColor)), (e == null ? void 0 : e.insertInCursorLocation) !== void 0 && (this.insertInCursorLocation = e.insertInCursorLocation), (e == null ? void 0 : e.autoScroll) !== void 0 && (this.autoScroll = e.autoScroll), this._onResult = e == null ? void 0 : e.onResult, this._onPreResult = e == null ? void 0 : e.onPreResult, this._onStart = e == null ? void 0 : e.onStart, this._onStop = e == null ? void 0 : e.onStop, this._onError = e == null ? void 0 : e.onError, this.onCommandModeTrigger = e == null ? void 0 : e.onCommandModeTrigger, this.onPauseTrigger = e == null ? void 0 : e.onPauseTrigger, this._options = e, !((i = this._options) === null || i === void 0) && i.commands && (this.commands = sn.CommandUtils.process(this._options.commands));
|
11940
11974
|
}
|
11941
11975
|
}, {
|
11942
11976
|
key: "prepare",
|
11943
11977
|
value: function prepare(e) {
|
11944
|
-
Qi.Padding.setState(this, e), Yi.Highlight.setState(this, e), this.isTargetInShadow =
|
11978
|
+
Qi.Padding.setState(this, e), Yi.Highlight.setState(this, e), this.isTargetInShadow = pe.Elements.isInsideShadowDOM(e), pe.Elements.isPrimitiveElement(e) ? (this._primitiveElement = e, this._originalText = this._primitiveElement.value) : (this._genericElement = e, this._originalText = this._genericElement.textContent);
|
11945
11979
|
}
|
11946
11980
|
// there was an attempt to optimize this by not having to restart the service and just reset state:
|
11947
11981
|
// unfortunately it did not work because the service would still continue firing the intermediate and final results
|
@@ -11985,7 +12019,7 @@ var ca = /*#__PURE__*/function () {
|
|
11985
12019
|
}, {
|
11986
12020
|
key: "updateGenericElement",
|
11987
12021
|
value: function updateGenericElement(e, t, i) {
|
11988
|
-
this.isHighlighted && Yi.Highlight.removeForGeneric(this, e), this.spansPopulated ||
|
12022
|
+
this.isHighlighted && Yi.Highlight.removeForGeneric(this, e), this.spansPopulated || pe.Elements.appendSpans(this, e);
|
11989
12023
|
var s = (i ? "" : this.startPadding) + es.Text.lineBreak(this.finalTranscript);
|
11990
12024
|
this.finalSpan.innerHTML = s;
|
11991
12025
|
var r = oi.AutoScroll.isRequired(this.autoScroll, e);
|
@@ -11996,7 +12030,7 @@ var ca = /*#__PURE__*/function () {
|
|
11996
12030
|
}, {
|
11997
12031
|
key: "finalise",
|
11998
12032
|
value: function finalise(e) {
|
11999
|
-
this._genericElement && (e ? (this.finalSpan =
|
12033
|
+
this._genericElement && (e ? (this.finalSpan = pe.Elements.createGenericSpan(), this.setInterimColorToFinal(), this.interimSpan = pe.Elements.createInterimSpan(), this.scrollingSpan = pe.Elements.createGenericSpan()) : this._genericElement.textContent = this._genericElement.textContent, this.spansPopulated = !1), tn.EventListeners.remove(this);
|
12000
12034
|
}
|
12001
12035
|
}, {
|
12002
12036
|
key: "setInterimColorToFinal",
|
@@ -12460,7 +12494,7 @@ Object.defineProperty(wn, "__esModule", {
|
|
12460
12494
|
});
|
12461
12495
|
var hn = Ni,
|
12462
12496
|
ma = ei,
|
12463
|
-
|
12497
|
+
ce = Hi,
|
12464
12498
|
ga = qi;
|
12465
12499
|
var ht = /*#__PURE__*/function () {
|
12466
12500
|
function ht() {
|
@@ -12471,12 +12505,12 @@ var ht = /*#__PURE__*/function () {
|
|
12471
12505
|
value: function toggle(e, t) {
|
12472
12506
|
var i, s;
|
12473
12507
|
var r = e.toLocaleLowerCase().trim();
|
12474
|
-
!((i =
|
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'"));
|
12475
12509
|
}
|
12476
12510
|
}, {
|
12477
12511
|
key: "startWebSpeech",
|
12478
12512
|
value: function startWebSpeech(e) {
|
12479
|
-
ht.stop() || (
|
12513
|
+
ht.stop() || (ce.GlobalState.service = new hn.WebSpeech(), ce.GlobalState.service.start(e));
|
12480
12514
|
}
|
12481
12515
|
}, {
|
12482
12516
|
key: "isWebSpeechSupported",
|
@@ -12487,18 +12521,18 @@ var ht = /*#__PURE__*/function () {
|
|
12487
12521
|
key: "startAzure",
|
12488
12522
|
value: function startAzure(e) {
|
12489
12523
|
var t;
|
12490
|
-
ht.stop() || !((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));
|
12491
12525
|
}
|
12492
12526
|
}, {
|
12493
12527
|
key: "stop",
|
12494
12528
|
value: function stop() {
|
12495
12529
|
var e;
|
12496
|
-
return
|
12530
|
+
return ce.GlobalState.doubleClickDetector() ? !0 : (!((e = ce.GlobalState.service) === null || e === void 0) && e.recognizing && ce.GlobalState.service.stop(), !1);
|
12497
12531
|
}
|
12498
12532
|
}, {
|
12499
12533
|
key: "endCommandMode",
|
12500
12534
|
value: function endCommandMode() {
|
12501
|
-
|
12535
|
+
ce.GlobalState.service && ma.CommandUtils.toggleCommandModeOff(ce.GlobalState.service);
|
12502
12536
|
}
|
12503
12537
|
}]);
|
12504
12538
|
}();
|
@@ -12812,7 +12846,7 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12812
12846
|
i.classList.add("audio-placeholder-text-3-digits");
|
12813
12847
|
var s = document.createElement("div");
|
12814
12848
|
s.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), s.appendChild(i);
|
12815
|
-
var r =
|
12849
|
+
var r = ie.createSVGElement(un);
|
12816
12850
|
return r.classList.add("attachment-icon", "stop-icon", "not-removable-attachment-icon"), i.textContent = "0:00", this._activePlaceholderTimer = this.createTimer(i, e), t.appendChild(s), this.addPlaceholderAudioAttachmentEvents(t, r, s), t;
|
12817
12851
|
}
|
12818
12852
|
}, {
|
@@ -12865,12 +12899,12 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12865
12899
|
}, {
|
12866
12900
|
key: "addAudioElements",
|
12867
12901
|
value: function addAudioElements(e, t) {
|
12868
|
-
var i = e.parentElement ?
|
12902
|
+
var i = e.parentElement ? J.cloneElement(e) : e,
|
12869
12903
|
s = document.createElement("audio");
|
12870
12904
|
s.src = t;
|
12871
|
-
var r =
|
12905
|
+
var r = ie.createSVGElement(va);
|
12872
12906
|
r.classList.add("attachment-icon", "play-icon");
|
12873
|
-
var o =
|
12907
|
+
var o = ie.createSVGElement(un);
|
12874
12908
|
o.classList.add("attachment-icon", "stop-icon"), i.replaceChildren(r), s.onplay = function () {
|
12875
12909
|
i.replaceChildren(o);
|
12876
12910
|
}, s.onpause = function () {
|
@@ -13008,12 +13042,12 @@ var ii = /*#__PURE__*/function () {
|
|
13008
13042
|
}
|
13009
13043
|
}]);
|
13010
13044
|
}();
|
13011
|
-
var
|
13012
|
-
function
|
13013
|
-
_classCallCheck(this,
|
13014
|
-
this._isOpen = !1, this._contentRef =
|
13045
|
+
var ue = /*#__PURE__*/function () {
|
13046
|
+
function ue(e, t, i) {
|
13047
|
+
_classCallCheck(this, ue);
|
13048
|
+
this._isOpen = !1, this._contentRef = ue.createModalContent(t, i == null ? void 0 : i.backgroundColor), this._buttonPanel = ue.createButtonPanel(i == null ? void 0 : i.backgroundColor), this._elementRef = ue.createContainer(this._contentRef, i), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = ue.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents(e);
|
13015
13049
|
}
|
13016
|
-
return _createClass(
|
13050
|
+
return _createClass(ue, [{
|
13017
13051
|
key: "isOpen",
|
13018
13052
|
value: function isOpen() {
|
13019
13053
|
return this._isOpen;
|
@@ -13035,7 +13069,7 @@ var he = /*#__PURE__*/function () {
|
|
13035
13069
|
var _this69 = this;
|
13036
13070
|
this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
|
13037
13071
|
_this69._elementRef.style.display = "none", _this69._backgroundPanelRef.style.display = "none";
|
13038
|
-
},
|
13072
|
+
}, ue.MODAL_CLOSE_TIMEOUT_MS);
|
13039
13073
|
}
|
13040
13074
|
}, {
|
13041
13075
|
key: "displayModalElements",
|
@@ -13051,7 +13085,7 @@ var he = /*#__PURE__*/function () {
|
|
13051
13085
|
key: "addCloseButton",
|
13052
13086
|
value: function addCloseButton(e, t, i) {
|
13053
13087
|
var _this70 = this;
|
13054
|
-
var s = t ?
|
13088
|
+
var s = t ? ue.createSVGButton(e) : ue.createTextButton(e);
|
13055
13089
|
return this.addButtons(s), s.onclick = function () {
|
13056
13090
|
_this70.close(), setTimeout(function () {
|
13057
13091
|
i == null || i();
|
@@ -13067,7 +13101,7 @@ var he = /*#__PURE__*/function () {
|
|
13067
13101
|
key: "windowKeyDown",
|
13068
13102
|
value: function windowKeyDown(e, t) {
|
13069
13103
|
var i, s;
|
13070
|
-
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key ===
|
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)));
|
13071
13105
|
}
|
13072
13106
|
}], [{
|
13073
13107
|
key: "createContainer",
|
@@ -13105,7 +13139,7 @@ var he = /*#__PURE__*/function () {
|
|
13105
13139
|
value: function createSVGButton(e) {
|
13106
13140
|
var t = document.createElement("div");
|
13107
13141
|
t.classList.add("modal-button", "modal-svg-button");
|
13108
|
-
var i =
|
13142
|
+
var i = ie.createSVGElement(e);
|
13109
13143
|
return i.classList.add("modal-svg-button-icon"), t.appendChild(i), t;
|
13110
13144
|
}
|
13111
13145
|
}, {
|
@@ -13113,26 +13147,26 @@ var he = /*#__PURE__*/function () {
|
|
13113
13147
|
value: function createTextModalFunc(e, t, i) {
|
13114
13148
|
var s;
|
13115
13149
|
if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
|
13116
|
-
var r = new
|
13150
|
+
var r = new ue(e, ["modal-content"], t.files.infoModal.containerStyle);
|
13117
13151
|
return r.addCloseButton("OK", !1, i), r.openTextModal.bind(r, t.infoModalTextMarkUp || "");
|
13118
13152
|
}
|
13119
13153
|
}
|
13120
13154
|
}]);
|
13121
13155
|
}();
|
13122
|
-
|
13123
|
-
var Xe =
|
13156
|
+
ue.MODAL_CLOSE_TIMEOUT_MS = 190;
|
13157
|
+
var Xe = ue;
|
13124
13158
|
var Pt = /*#__PURE__*/function (_Xt3) {
|
13125
13159
|
// prettier-ignore
|
13126
13160
|
function Pt(e, t, i, s, r, o) {
|
13127
13161
|
var _this71;
|
13128
13162
|
_classCallCheck(this, Pt);
|
13129
|
-
var h, u, f, m, p, y, x,
|
13163
|
+
var h, u, f, m, p, y, x, j, G;
|
13130
13164
|
var a = (h = i == null ? void 0 : i.button) == null ? void 0 : h.position,
|
13131
13165
|
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;
|
13132
13166
|
_this71 = _callSuper(this, Pt, [Pt.createButtonElement(), a, i.button, l]);
|
13133
13167
|
var c = a === "dropup-menu",
|
13134
13168
|
d = _this71.createInnerElements(s, r, _this71._customStyles, c);
|
13135
|
-
_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 || (
|
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;
|
13136
13170
|
return _this71;
|
13137
13171
|
}
|
13138
13172
|
_inherits(Pt, _Xt3);
|
@@ -13142,7 +13176,7 @@ var Pt = /*#__PURE__*/function (_Xt3) {
|
|
13142
13176
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
13143
13177
|
var r = Pt.createSVGIconElement(e, t);
|
13144
13178
|
return {
|
13145
|
-
styles:
|
13179
|
+
styles: W.createInnerElement(this.elementRef, r, "styles", i, s)
|
13146
13180
|
};
|
13147
13181
|
}
|
13148
13182
|
}, {
|
@@ -13182,7 +13216,7 @@ var Pt = /*#__PURE__*/function (_Xt3) {
|
|
13182
13216
|
}, {
|
13183
13217
|
key: "createSVGIconElement",
|
13184
13218
|
value: function createSVGIconElement(e, t) {
|
13185
|
-
var i =
|
13219
|
+
var i = ie.createSVGElement(t);
|
13186
13220
|
return i.id = e, i;
|
13187
13221
|
}
|
13188
13222
|
}]);
|
@@ -13306,13 +13340,13 @@ var ze = /*#__PURE__*/function () {
|
|
13306
13340
|
}, {
|
13307
13341
|
key: "validateWebsocket",
|
13308
13342
|
value: function validateWebsocket(e, t) {
|
13309
|
-
return e.websocket && !
|
13343
|
+
return e.websocket && !U.canSendMessage(e.websocket) ? (t.changeToDisabledIcon(), !1) : !0;
|
13310
13344
|
}
|
13311
13345
|
// prettier-ignore
|
13312
13346
|
}, {
|
13313
13347
|
key: "attach",
|
13314
13348
|
value: function attach(e, t, i, s, r) {
|
13315
|
-
var o = e.validateInput ||
|
13349
|
+
var o = e.validateInput || le.processValidateInput(e);
|
13316
13350
|
e._validationHandler = /*#__PURE__*/function () {
|
13317
13351
|
var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee121(a) {
|
13318
13352
|
var l;
|
@@ -13417,38 +13451,38 @@ var Ea = /*#__PURE__*/function (_Gt2) {
|
|
13417
13451
|
}]);
|
13418
13452
|
}(Gt);
|
13419
13453
|
var xa = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"1\" viewBox=\"0 0 24 24\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"22\" y1=\"2\" x2=\"11\" y2=\"14\"></line>\n <polygon points=\"22 2 15 22 11 14 2 10 22 2\"></polygon>\n</svg>\n";
|
13420
|
-
var
|
13421
|
-
function
|
13422
|
-
_classCallCheck(this,
|
13454
|
+
var $ = /*#__PURE__*/function () {
|
13455
|
+
function $() {
|
13456
|
+
_classCallCheck(this, $);
|
13423
13457
|
}
|
13424
|
-
return _createClass(
|
13458
|
+
return _createClass($, null, [{
|
13425
13459
|
key: "setPropertyValueIfDoesNotExist",
|
13426
13460
|
value: function setPropertyValueIfDoesNotExist(e, t, i) {
|
13427
13461
|
var _e$s, _e$s2;
|
13428
13462
|
var s = t[0];
|
13429
|
-
t.length === 1 ? (_e$s = e[s]) !== null && _e$s !== void 0 ? _e$s : e[s] = i : ((_e$s2 = e[s]) !== null && _e$s2 !== void 0 ? _e$s2 : e[s] = {}, t.shift(),
|
13463
|
+
t.length === 1 ? (_e$s = e[s]) !== null && _e$s !== void 0 ? _e$s : e[s] = i : ((_e$s2 = e[s]) !== null && _e$s2 !== void 0 ? _e$s2 : e[s] = {}, t.shift(), $.setPropertyValueIfDoesNotExist(e[s], t, i));
|
13430
13464
|
}
|
13431
13465
|
}, {
|
13432
13466
|
key: "setPropertyValue",
|
13433
13467
|
value: function setPropertyValue(e, t, i) {
|
13434
13468
|
var _e$s3;
|
13435
13469
|
var s = t[0];
|
13436
|
-
t.length === 1 ? e[s] = i : ((_e$s3 = e[s]) !== null && _e$s3 !== void 0 ? _e$s3 : e[s] = {}, t.shift(),
|
13470
|
+
t.length === 1 ? e[s] = i : ((_e$s3 = e[s]) !== null && _e$s3 !== void 0 ? _e$s3 : e[s] = {}, t.shift(), $.setPropertyValue(e[s], t, i));
|
13437
13471
|
}
|
13438
13472
|
}, {
|
13439
13473
|
key: "getObjectValue",
|
13440
13474
|
value: function getObjectValue(e, t) {
|
13441
13475
|
var i = t[0],
|
13442
13476
|
s = e[i];
|
13443
|
-
return s === void 0 || t.length === 1 ? s :
|
13477
|
+
return s === void 0 || t.length === 1 ? s : $.getObjectValue(s, t.slice(1));
|
13444
13478
|
}
|
13445
13479
|
}, {
|
13446
13480
|
key: "overwritePropertyObjectFromAnother",
|
13447
13481
|
value: function overwritePropertyObjectFromAnother(e, t, i) {
|
13448
|
-
var s =
|
13482
|
+
var s = $.getObjectValue(t, i);
|
13449
13483
|
if (s) {
|
13450
|
-
var r = _objectSpread(_objectSpread({}, s),
|
13451
|
-
|
13484
|
+
var r = _objectSpread(_objectSpread({}, s), $.getObjectValue(e, i) || {});
|
13485
|
+
$.setPropertyValue(e, i, r);
|
13452
13486
|
}
|
13453
13487
|
}
|
13454
13488
|
}]);
|
@@ -13467,13 +13501,13 @@ var Ye = /*#__PURE__*/function () {
|
|
13467
13501
|
value: function overwriteDefaultStyleWithSubmit(e, t) {
|
13468
13502
|
if (!e.submit) return;
|
13469
13503
|
var i = JSON.parse(JSON.stringify(e[t] || {}));
|
13470
|
-
|
13504
|
+
$.overwritePropertyObjectFromAnother(i, e.submit, ["container", "default"]), $.overwritePropertyObjectFromAnother(i, e.submit, ["text", "styles", "default"]), $.overwritePropertyObjectFromAnother(i, e.submit, ["svg", "styles", "default"]), e[t] = i;
|
13471
13505
|
}
|
13472
13506
|
// prettier-ignore
|
13473
13507
|
}, {
|
13474
13508
|
key: "setUpDisabledButton",
|
13475
13509
|
value: function setUpDisabledButton(e) {
|
13476
|
-
|
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");
|
13477
13511
|
}
|
13478
13512
|
}, {
|
13479
13513
|
key: "process",
|
@@ -13483,13 +13517,13 @@ var Ye = /*#__PURE__*/function () {
|
|
13483
13517
|
}
|
13484
13518
|
}]);
|
13485
13519
|
}();
|
13486
|
-
var
|
13520
|
+
var k = /*#__PURE__*/function (_Xt4) {
|
13487
13521
|
// prettier-ignore
|
13488
|
-
function
|
13522
|
+
function k(e, t, i, s, r, o) {
|
13489
13523
|
var _this76;
|
13490
|
-
_classCallCheck(this,
|
13524
|
+
_classCallCheck(this, k);
|
13491
13525
|
var a = Ye.process(e.submitButtonStyles);
|
13492
|
-
_this76 = _callSuper(this,
|
13526
|
+
_this76 = _callSuper(this, k, [k.createButtonContainerElement(), a == null ? void 0 : a.position, a]), _this76._isSVGLoadingIconOverriden = !1, _this76.status = {
|
13493
13527
|
requestInProgress: !1,
|
13494
13528
|
loadingActive: !1
|
13495
13529
|
}, _this76._messages = i, _this76._textInput = t, _this76._fileAttachments = r, _this76._innerElements = _this76.createInnerElements(), _this76._abortStream = new AbortController(), _this76._stopClicked = {
|
@@ -13500,19 +13534,19 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13500
13534
|
});
|
13501
13535
|
return _this76;
|
13502
13536
|
}
|
13503
|
-
_inherits(
|
13504
|
-
return _createClass(
|
13537
|
+
_inherits(k, _Xt4);
|
13538
|
+
return _createClass(k, [{
|
13505
13539
|
key: "createInnerElements",
|
13506
13540
|
value: function createInnerElements() {
|
13507
13541
|
var _this$createCustomEle = this.createCustomElements(),
|
13508
13542
|
e = _this$createCustomEle.submit,
|
13509
13543
|
t = _this$createCustomEle.loading,
|
13510
13544
|
i = _this$createCustomEle.stop,
|
13511
|
-
s = e ||
|
13545
|
+
s = e || k.createSubmitIconElement();
|
13512
13546
|
return {
|
13513
13547
|
submit: s,
|
13514
|
-
loading: t ||
|
13515
|
-
stop: i ||
|
13548
|
+
loading: t || k.createLoadingIconElement(),
|
13549
|
+
stop: i || k.createStopIconElement(),
|
13516
13550
|
disabled: this.createDisabledIconElement(s)
|
13517
13551
|
};
|
13518
13552
|
}
|
@@ -13520,21 +13554,21 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13520
13554
|
key: "createCustomElements",
|
13521
13555
|
value: function createCustomElements() {
|
13522
13556
|
var _this77 = this;
|
13523
|
-
var e =
|
13557
|
+
var e = W.createSpecificStateElement(this.elementRef, "submit", this._customStyles),
|
13524
13558
|
t = {
|
13525
13559
|
loading: void 0,
|
13526
13560
|
stop: void 0
|
13527
13561
|
};
|
13528
13562
|
return Object.keys(t).forEach(function (i) {
|
13529
13563
|
var s = i,
|
13530
|
-
r =
|
13564
|
+
r = W.createCustomElement(s, _this77._customStyles);
|
13531
13565
|
r && (t[s] = r);
|
13532
13566
|
}), t.submit = e, t;
|
13533
13567
|
}
|
13534
13568
|
}, {
|
13535
13569
|
key: "createDisabledIconElement",
|
13536
13570
|
value: function createDisabledIconElement(e) {
|
13537
|
-
return
|
13571
|
+
return W.createCustomElement("disabled", this._customStyles) || e.cloneNode(!0);
|
13538
13572
|
}
|
13539
13573
|
// prettier-ignore
|
13540
13574
|
}, {
|
@@ -13612,7 +13646,7 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13612
13646
|
return _regeneratorRuntime().wrap(function _callee123$(_context123) {
|
13613
13647
|
while (1) switch (_context123.prev = _context123.next) {
|
13614
13648
|
case 0:
|
13615
|
-
typeof e == "string" && (e =
|
13649
|
+
typeof e == "string" && (e = le.processSubmitUserMessage(e));
|
13616
13650
|
t = {
|
13617
13651
|
text: e.text
|
13618
13652
|
};
|
@@ -13733,19 +13767,19 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13733
13767
|
}, {
|
13734
13768
|
key: "changeToStopIcon",
|
13735
13769
|
value: function changeToStopIcon() {
|
13736
|
-
this._serviceIO.websocket || (this.elementRef.classList.remove(
|
13770
|
+
this._serviceIO.websocket || (this.elementRef.classList.remove(k.LOADING_CLASS, k.DISABLED_CLASS, k.SUBMIT_CLASS), this.elementRef.replaceChildren(this._innerElements.stop), this.reapplyStateStyle("stop", ["loading", "submit"]), this.elementRef.onclick = this.stopStream.bind(this), this.status.loadingActive = !1);
|
13737
13771
|
}
|
13738
13772
|
}, {
|
13739
13773
|
key: "changeToLoadingIcon",
|
13740
13774
|
value: function changeToLoadingIcon() {
|
13741
|
-
this._serviceIO.websocket || (this._isSVGLoadingIconOverriden || this.elementRef.replaceChildren(this._innerElements.loading), this.elementRef.classList.remove(
|
13775
|
+
this._serviceIO.websocket || (this._isSVGLoadingIconOverriden || this.elementRef.replaceChildren(this._innerElements.loading), this.elementRef.classList.remove(k.SUBMIT_CLASS, k.DISABLED_CLASS), this.elementRef.classList.add(k.LOADING_CLASS), this.reapplyStateStyle("loading", ["submit"]), this.elementRef.onclick = function () {}, this.status.requestInProgress = !0, this.status.loadingActive = !0);
|
13742
13776
|
}
|
13743
13777
|
// called every time when user triggers an input via ValidationHandler - hence use class to check if not already present
|
13744
13778
|
}, {
|
13745
13779
|
key: "changeToSubmitIcon",
|
13746
13780
|
value: function changeToSubmitIcon() {
|
13747
13781
|
var _this79 = this;
|
13748
|
-
this.elementRef.classList.contains(
|
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 () {
|
13749
13783
|
var e;
|
13750
13784
|
_this79.submitFromInput(), (e = _this79._microphoneButton) != null && e.isActive && $t.toggleSpeechAfterSubmit(_this79._microphoneButton.elementRef, !!_this79._stopSTTAfterSubmit);
|
13751
13785
|
});
|
@@ -13755,7 +13789,7 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13755
13789
|
key: "changeToDisabledIcon",
|
13756
13790
|
value: function changeToDisabledIcon() {
|
13757
13791
|
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
13758
|
-
this._alwaysEnabled && !e ? this.changeToSubmitIcon() : this.elementRef.classList.contains(
|
13792
|
+
this._alwaysEnabled && !e ? this.changeToSubmitIcon() : this.elementRef.classList.contains(k.DISABLED_CLASS) || (this.elementRef.classList.remove(k.LOADING_CLASS, k.SUBMIT_CLASS), this.elementRef.classList.add(k.DISABLED_CLASS), this.elementRef.replaceChildren(this._innerElements.disabled), this.reapplyStateStyle("disabled", ["submit"]), this.elementRef.onclick = function () {});
|
13759
13793
|
}
|
13760
13794
|
}, {
|
13761
13795
|
key: "disableSubmitButton",
|
@@ -13772,7 +13806,7 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13772
13806
|
}, {
|
13773
13807
|
key: "createSubmitIconElement",
|
13774
13808
|
value: function createSubmitIconElement() {
|
13775
|
-
var e =
|
13809
|
+
var e = ie.createSVGElement(xa);
|
13776
13810
|
return e.id = "submit-icon", e;
|
13777
13811
|
}
|
13778
13812
|
}, {
|
@@ -13789,8 +13823,8 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13789
13823
|
}
|
13790
13824
|
}]);
|
13791
13825
|
}(Xt);
|
13792
|
-
|
13793
|
-
var Es =
|
13826
|
+
k.SUBMIT_CLASS = "submit-button", k.LOADING_CLASS = "loading-button", k.DISABLED_CLASS = "disabled-button";
|
13827
|
+
var Es = k;
|
13794
13828
|
var Sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M27.1 14.313V5.396L24.158 8.34c-2.33-2.325-5.033-3.503-8.11-3.503C9.902 4.837 4.901 9.847 4.899 16c.001 6.152 5.003 11.158 11.15 11.16 4.276 0 9.369-2.227 10.836-8.478l.028-.122h-3.23l-.022.068c-1.078 3.242-4.138 5.421-7.613 5.421a8 8 0 0 1-5.691-2.359A7.993 7.993 0 0 1 8 16.001c0-4.438 3.611-8.049 8.05-8.049 2.069 0 3.638.58 5.924 2.573l-3.792 3.789H27.1z\"/>\n</svg>\n",
|
13795
13829
|
_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",
|
13796
13830
|
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>",
|
@@ -13804,7 +13838,7 @@ var Rs = /*#__PURE__*/function (_Xe) {
|
|
13804
13838
|
var _this80$addButtonsAnd = _this80.addButtonsAndTheirEvents(t),
|
13805
13839
|
r = _this80$addButtonsAnd.captureButton,
|
13806
13840
|
o = _this80$addButtonsAnd.submitButton;
|
13807
|
-
_this80._captureButton = r, _this80._submitButton = o, _this80._captureIcon = _this80._captureButton.children[0], _this80._refreshIcon =
|
13841
|
+
_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;
|
13808
13842
|
return _this80;
|
13809
13843
|
}
|
13810
13844
|
_inherits(Rs, _Xe);
|
@@ -13928,7 +13962,7 @@ var ki = /*#__PURE__*/function (_Xt5) {
|
|
13928
13962
|
value: function createInnerElements(e) {
|
13929
13963
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
13930
13964
|
return {
|
13931
|
-
styles:
|
13965
|
+
styles: W.createInnerElement(this.elementRef, ki.createSVGIconElement(), "styles", e, t)
|
13932
13966
|
};
|
13933
13967
|
}
|
13934
13968
|
}, {
|
@@ -13948,7 +13982,7 @@ var ki = /*#__PURE__*/function (_Xt5) {
|
|
13948
13982
|
}, {
|
13949
13983
|
key: "createSVGIconElement",
|
13950
13984
|
value: function createSVGIconElement() {
|
13951
|
-
var e =
|
13985
|
+
var e = ie.createSVGElement(Ca);
|
13952
13986
|
return e.id = "camera-icon", e;
|
13953
13987
|
}
|
13954
13988
|
}]);
|
@@ -14020,9 +14054,9 @@ var Ot = /*#__PURE__*/function () {
|
|
14020
14054
|
}, {
|
14021
14055
|
key: "addElements",
|
14022
14056
|
value: function addElements(e, t, i, s, r, o) {
|
14023
|
-
|
14057
|
+
J.addElements(e, t.elementRef);
|
14024
14058
|
var a = _t.create(),
|
14025
|
-
l =
|
14059
|
+
l = V.addButtons(a, i, s, o);
|
14026
14060
|
ys.set(t.inputElementRef, a, r.elementRef, l), _t.add(e, a);
|
14027
14061
|
}
|
14028
14062
|
}]);
|
@@ -14037,9 +14071,9 @@ var Is = /*#__PURE__*/function () {
|
|
14037
14071
|
var s = document.createElement("div");
|
14038
14072
|
s.id = "chat-view";
|
14039
14073
|
var r = new Ee(e, t, i);
|
14040
|
-
t.websocket &&
|
14074
|
+
t.websocket && U.createConnection(t, r);
|
14041
14075
|
var o = new Ot(e, r, t, s);
|
14042
|
-
return
|
14076
|
+
return J.addElements(s, r.elementRef, o.elementRef), s;
|
14043
14077
|
}
|
14044
14078
|
}, {
|
14045
14079
|
key: "render",
|
@@ -14085,7 +14119,7 @@ var E = /*#__PURE__*/function (_ls) {
|
|
14085
14119
|
key: "onRender",
|
14086
14120
|
value: function onRender() {
|
14087
14121
|
var _this$_childElement;
|
14088
|
-
ci.attemptAppendStyleSheetToHead(this.style),
|
14122
|
+
ci.attemptAppendStyleSheetToHead(this.style), le.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = zo.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (kt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), kt.applyDefaultStyleToComponent(this.style, this.chatStyle), le.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? li.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof z) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Is.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof z && H.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, hi.onRender(this);
|
14089
14123
|
}
|
14090
14124
|
}, {
|
14091
14125
|
key: "disconnectedCallback",
|