deep-chat-dev 9.0.197 → 9.0.198
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 +4360 -4257
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +565 -541
- package/dist/types/azure.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/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 ae = /*#__PURE__*/function () {
|
494
|
+
function ae() {
|
495
|
+
_classCallCheck(this, ae);
|
496
496
|
}
|
497
|
-
return _createClass(
|
497
|
+
return _createClass(ae, 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,14 +659,14 @@ 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 =
|
668
|
+
Y.CONTAINER_CLASS = "avatar-container";
|
669
|
+
var Mt = Y;
|
670
670
|
var pe = /*#__PURE__*/function () {
|
671
671
|
function pe() {
|
672
672
|
_classCallCheck(this, pe);
|
@@ -720,11 +720,11 @@ var pe = /*#__PURE__*/function () {
|
|
720
720
|
}();
|
721
721
|
pe.NAME_CLASS = "name";
|
722
722
|
var Rt = pe;
|
723
|
-
var
|
724
|
-
function
|
725
|
-
_classCallCheck(this,
|
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,7 +1025,7 @@ 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
|
}]);
|
@@ -1026,7 +1050,7 @@ var Be = /*#__PURE__*/function () {
|
|
1026
1050
|
value: function overwrite(e, t, i, s) {
|
1027
1051
|
var r = e.messages,
|
1028
1052
|
o = b.overwriteMessage(r, s, t, i, "html", "html-message");
|
1029
|
-
return o && (o.bubbleElement.innerHTML = t,
|
1053
|
+
return o && (o.bubbleElement.innerHTML = t, te.apply(e, o.outerContainer), ae.flagHTMLUpdateClass(o.bubbleElement)), o;
|
1030
1054
|
}
|
1031
1055
|
// prettier-ignore
|
1032
1056
|
}, {
|
@@ -1040,7 +1064,7 @@ var Be = /*#__PURE__*/function () {
|
|
1040
1064
|
r.status = !1;
|
1041
1065
|
}
|
1042
1066
|
var a = Be.createElements(e, t, i, o);
|
1043
|
-
return b.fillEmptyMessageElement(a.bubbleElement, t),
|
1067
|
+
return b.fillEmptyMessageElement(a.bubbleElement, t), te.apply(e, a.outerContainer), ae.flagHTMLUpdateClass(a.bubbleElement), e.applyCustomStyles(a, i, !1, (l = e.messageStyles) == null ? void 0 : l.html), o || Be.addElement(e, a.outerContainer), a;
|
1044
1068
|
}
|
1045
1069
|
}]);
|
1046
1070
|
}();
|
@@ -1100,7 +1124,7 @@ var qn = /[&<>"]/,
|
|
1100
1124
|
function Vn(n) {
|
1101
1125
|
return Gn[n];
|
1102
1126
|
}
|
1103
|
-
function
|
1127
|
+
function K(n) {
|
1104
1128
|
return qn.test(n) ? n.replace(zn, Vn) : n;
|
1105
1129
|
}
|
1106
1130
|
var g = {};
|
@@ -1111,7 +1135,7 @@ g.blockquote_close = function (n, e) {
|
|
1111
1135
|
return "</blockquote>" + st(n, e);
|
1112
1136
|
};
|
1113
1137
|
g.code = function (n, e) {
|
1114
|
-
return n[e].block ? "<pre><code>" +
|
1138
|
+
return n[e].block ? "<pre><code>" + K(n[e].content) + "</code></pre>" + st(n, e) : "<code>" + K(n[e].content) + "</code>";
|
1115
1139
|
};
|
1116
1140
|
g.fence = function (n, e, t, i, s) {
|
1117
1141
|
var r = n[e],
|
@@ -1123,9 +1147,9 @@ g.fence = function (n, e, t, i, s) {
|
|
1123
1147
|
h;
|
1124
1148
|
if (r.params) {
|
1125
1149
|
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 =
|
1150
|
+
l = K(tt(Bt(d))), o = ' class="' + a + l + '"';
|
1127
1151
|
}
|
1128
|
-
return t.highlight ? h = t.highlight.apply(t.highlight, [r.content].concat(c)) ||
|
1152
|
+
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
1153
|
};
|
1130
1154
|
g.fence_custom = {};
|
1131
1155
|
g.heading_open = function (n, e) {
|
@@ -1165,17 +1189,17 @@ g.paragraph_close = function (n, e) {
|
|
1165
1189
|
return (n[e].tight ? "" : "</p>") + (t ? st(n, e) : "");
|
1166
1190
|
};
|
1167
1191
|
g.link_open = function (n, e, t) {
|
1168
|
-
var i = n[e].title ? ' title="' +
|
1192
|
+
var i = n[e].title ? ' title="' + K(tt(n[e].title)) + '"' : "",
|
1169
1193
|
s = t.linkTarget ? ' target="' + t.linkTarget + '"' : "";
|
1170
|
-
return '<a href="' +
|
1194
|
+
return '<a href="' + K(n[e].href) + '"' + i + s + ">";
|
1171
1195
|
};
|
1172
1196
|
g.link_close = function () {
|
1173
1197
|
return "</a>";
|
1174
1198
|
};
|
1175
1199
|
g.image = function (n, e, t) {
|
1176
|
-
var i = ' src="' +
|
1177
|
-
s = n[e].title ? ' title="' +
|
1178
|
-
r = ' alt="' + (n[e].alt ?
|
1200
|
+
var i = ' src="' + K(n[e].src) + '"',
|
1201
|
+
s = n[e].title ? ' title="' + K(tt(n[e].title)) + '"' : "",
|
1202
|
+
r = ' alt="' + (n[e].alt ? K(tt(Bt(n[e].alt))) : "") + '"',
|
1179
1203
|
o = t.xhtmlOut ? " /" : "";
|
1180
1204
|
return "<img" + i + r + s + o + ">";
|
1181
1205
|
};
|
@@ -1248,10 +1272,10 @@ g.mark_close = function () {
|
|
1248
1272
|
return "</mark>";
|
1249
1273
|
};
|
1250
1274
|
g.sub = function (n, e) {
|
1251
|
-
return "<sub>" +
|
1275
|
+
return "<sub>" + K(n[e].content) + "</sub>";
|
1252
1276
|
};
|
1253
1277
|
g.sup = function (n, e) {
|
1254
|
-
return "<sup>" +
|
1278
|
+
return "<sup>" + K(n[e].content) + "</sup>";
|
1255
1279
|
};
|
1256
1280
|
g.hardbreak = function (n, e, t) {
|
1257
1281
|
return t.xhtmlOut ? "<br />\n" : "<br>\n";
|
@@ -1260,7 +1284,7 @@ g.softbreak = function (n, e, t) {
|
|
1260
1284
|
return t.breaks ? t.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
|
1261
1285
|
};
|
1262
1286
|
g.text = function (n, e) {
|
1263
|
-
return
|
1287
|
+
return K(n[e].content);
|
1264
1288
|
};
|
1265
1289
|
g.htmlblock = function (n, e) {
|
1266
1290
|
return n[e].content;
|
@@ -1269,7 +1293,7 @@ g.htmltag = function (n, e) {
|
|
1269
1293
|
return n[e].content;
|
1270
1294
|
};
|
1271
1295
|
g.abbr_open = function (n, e) {
|
1272
|
-
return '<abbr title="' +
|
1296
|
+
return '<abbr title="' + K(tt(n[e].title)) + '">';
|
1273
1297
|
};
|
1274
1298
|
g.abbr_close = function () {
|
1275
1299
|
return "</abbr>";
|
@@ -1333,14 +1357,14 @@ Ss.prototype.render = function (n, e, t) {
|
|
1333
1357
|
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
1358
|
return o;
|
1335
1359
|
};
|
1336
|
-
function
|
1360
|
+
function se() {
|
1337
1361
|
this.__rules__ = [], this.__cache__ = null;
|
1338
1362
|
}
|
1339
|
-
|
1363
|
+
se.prototype.__find__ = function (n) {
|
1340
1364
|
for (var e = this.__rules__.length, t = -1; e--;) if (this.__rules__[++t].name === n) return t;
|
1341
1365
|
return -1;
|
1342
1366
|
};
|
1343
|
-
|
1367
|
+
se.prototype.__compile__ = function () {
|
1344
1368
|
var n = this,
|
1345
1369
|
e = [""];
|
1346
1370
|
n.__rules__.forEach(function (t) {
|
@@ -1353,13 +1377,13 @@ ie.prototype.__compile__ = function () {
|
|
1353
1377
|
});
|
1354
1378
|
});
|
1355
1379
|
};
|
1356
|
-
|
1380
|
+
se.prototype.at = function (n, e, t) {
|
1357
1381
|
var i = this.__find__(n),
|
1358
1382
|
s = t || {};
|
1359
1383
|
if (i === -1) throw new Error("Parser rule not found: " + n);
|
1360
1384
|
this.__rules__[i].fn = e, this.__rules__[i].alt = s.alt || [], this.__cache__ = null;
|
1361
1385
|
};
|
1362
|
-
|
1386
|
+
se.prototype.before = function (n, e, t, i) {
|
1363
1387
|
var s = this.__find__(n),
|
1364
1388
|
r = i || {};
|
1365
1389
|
if (s === -1) throw new Error("Parser rule not found: " + n);
|
@@ -1370,7 +1394,7 @@ ie.prototype.before = function (n, e, t, i) {
|
|
1370
1394
|
alt: r.alt || []
|
1371
1395
|
}), this.__cache__ = null;
|
1372
1396
|
};
|
1373
|
-
|
1397
|
+
se.prototype.after = function (n, e, t, i) {
|
1374
1398
|
var s = this.__find__(n),
|
1375
1399
|
r = i || {};
|
1376
1400
|
if (s === -1) throw new Error("Parser rule not found: " + n);
|
@@ -1381,7 +1405,7 @@ ie.prototype.after = function (n, e, t, i) {
|
|
1381
1405
|
alt: r.alt || []
|
1382
1406
|
}), this.__cache__ = null;
|
1383
1407
|
};
|
1384
|
-
|
1408
|
+
se.prototype.push = function (n, e, t) {
|
1385
1409
|
var i = t || {};
|
1386
1410
|
this.__rules__.push({
|
1387
1411
|
name: n,
|
@@ -1390,7 +1414,7 @@ ie.prototype.push = function (n, e, t) {
|
|
1390
1414
|
alt: i.alt || []
|
1391
1415
|
}), this.__cache__ = null;
|
1392
1416
|
};
|
1393
|
-
|
1417
|
+
se.prototype.enable = function (n, e) {
|
1394
1418
|
n = Array.isArray(n) ? n : [n], e && this.__rules__.forEach(function (t) {
|
1395
1419
|
t.enabled = !1;
|
1396
1420
|
}), n.forEach(function (t) {
|
@@ -1399,14 +1423,14 @@ ie.prototype.enable = function (n, e) {
|
|
1399
1423
|
this.__rules__[i].enabled = !0;
|
1400
1424
|
}, this), this.__cache__ = null;
|
1401
1425
|
};
|
1402
|
-
|
1426
|
+
se.prototype.disable = function (n) {
|
1403
1427
|
n = Array.isArray(n) ? n : [n], n.forEach(function (e) {
|
1404
1428
|
var t = this.__find__(e);
|
1405
1429
|
if (t < 0) throw new Error("Rules manager: invalid rule name " + e);
|
1406
1430
|
this.__rules__[t].enabled = !1;
|
1407
1431
|
}, this), this.__cache__ = null;
|
1408
1432
|
};
|
1409
|
-
|
1433
|
+
se.prototype.getRules = function (n) {
|
1410
1434
|
return this.__cache__ === null && this.__compile__(), this.__cache__[n] || [];
|
1411
1435
|
};
|
1412
1436
|
function $n(n) {
|
@@ -1726,7 +1750,7 @@ function ar(n) {
|
|
1726
1750
|
}
|
1727
1751
|
var Ji = [["block", $n], ["abbr", Kn], ["references", Zn], ["inline", Xn], ["footnote_tail", Yn], ["abbr2", Qn], ["replacements", nr], ["smartquotes", ar]];
|
1728
1752
|
function En() {
|
1729
|
-
this.options = {}, this.ruler = new
|
1753
|
+
this.options = {}, this.ruler = new se();
|
1730
1754
|
for (var n = 0; n < Ji.length; n++) this.ruler.push(Ji[n][0], Ji[n][1]);
|
1731
1755
|
}
|
1732
1756
|
En.prototype.process = function (n) {
|
@@ -1916,19 +1940,19 @@ function fr(n, e, t, i) {
|
|
1916
1940
|
p,
|
1917
1941
|
y,
|
1918
1942
|
x,
|
1919
|
-
|
1920
|
-
|
1943
|
+
j,
|
1944
|
+
G,
|
1921
1945
|
Le,
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1946
|
+
I,
|
1947
|
+
Z = !0,
|
1948
|
+
X,
|
1949
|
+
D,
|
1926
1950
|
je,
|
1927
1951
|
Tt;
|
1928
1952
|
if ((h = qs(n, e)) >= 0) y = !0;else if ((h = Hs(n, e)) >= 0) y = !1;else return !1;
|
1929
1953
|
if (n.level >= n.options.maxNesting) return !1;
|
1930
1954
|
if (p = n.src.charCodeAt(h - 1), i) return !0;
|
1931
|
-
for (
|
1955
|
+
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
1956
|
type: "ordered_list_open",
|
1933
1957
|
order: m,
|
1934
1958
|
lines: Le = [e, 0],
|
@@ -1937,15 +1961,15 @@ function fr(n, e, t, i) {
|
|
1937
1961
|
type: "bullet_list_open",
|
1938
1962
|
lines: Le = [e, 0],
|
1939
1963
|
level: n.level++
|
1940
|
-
}), s = e,
|
1964
|
+
}), 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
1965
|
type: "list_item_open",
|
1942
|
-
lines:
|
1966
|
+
lines: I = [e, 0],
|
1943
1967
|
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 ||
|
1968
|
+
}), 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
1969
|
type: "list_item_close",
|
1946
1970
|
level: --n.level
|
1947
|
-
}), s = e = n.line,
|
1948
|
-
for (Tt = !1,
|
1971
|
+
}), s = e = n.line, I[1] = s, x = n.bMarks[e], !(s >= t || n.isEmpty(s) || n.tShift[s] < n.blkIndent));) {
|
1972
|
+
for (Tt = !1, D = 0, je = X.length; D < je; D++) if (X[D](n, s, t, !0)) {
|
1949
1973
|
Tt = !0;
|
1950
1974
|
break;
|
1951
1975
|
}
|
@@ -1958,7 +1982,7 @@ function fr(n, e, t, i) {
|
|
1958
1982
|
return n.tokens.push({
|
1959
1983
|
type: y ? "ordered_list_close" : "bullet_list_close",
|
1960
1984
|
level: --n.level
|
1961
|
-
}), Le[1] = s, n.line = s,
|
1985
|
+
}), Le[1] = s, n.line = s, Z && ur(n, j), !0;
|
1962
1986
|
}
|
1963
1987
|
function pr(n, e, t, i) {
|
1964
1988
|
var s,
|
@@ -2240,7 +2264,7 @@ function wr(n, e) {
|
|
2240
2264
|
}
|
2241
2265
|
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
2266
|
function _s() {
|
2243
|
-
this.ruler = new
|
2267
|
+
this.ruler = new se();
|
2244
2268
|
for (var n = 0; n < ri.length; n++) this.ruler.push(ri[n][0], ri[n][1], {
|
2245
2269
|
alt: (ri[n][2] || []).slice()
|
2246
2270
|
});
|
@@ -2725,7 +2749,7 @@ function uo(n, e) {
|
|
2725
2749
|
}
|
2726
2750
|
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
2751
|
function Pi() {
|
2728
|
-
this.ruler = new
|
2752
|
+
this.ruler = new se();
|
2729
2753
|
for (var n = 0; n < Xi.length; n++) this.ruler.push(Xi[n][0], Xi[n][1]);
|
2730
2754
|
this.validateLink = fo;
|
2731
2755
|
}
|
@@ -2883,7 +2907,7 @@ function Sn(n, e, t) {
|
|
2883
2907
|
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
2908
|
}
|
2885
2909
|
function Re(n, e) {
|
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
|
2910
|
+
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
2911
|
}
|
2888
2912
|
Re.prototype.set = function (n) {
|
2889
2913
|
pn(this.options, n);
|
@@ -3052,7 +3076,7 @@ var xe = /*#__PURE__*/function () {
|
|
3052
3076
|
}]);
|
3053
3077
|
}();
|
3054
3078
|
xe.DEFAULT_FILE_NAME = "file";
|
3055
|
-
var
|
3079
|
+
var B = xe;
|
3056
3080
|
var hi = /*#__PURE__*/function () {
|
3057
3081
|
function hi() {
|
3058
3082
|
_classCallCheck(this, hi);
|
@@ -3066,9 +3090,9 @@ var hi = /*#__PURE__*/function () {
|
|
3066
3090
|
isHistory: i,
|
3067
3091
|
isInitial: i
|
3068
3092
|
}));
|
3069
|
-
|
3093
|
+
B.reAddFileRefToObject(t, s), (r = e.onMessage) == null || r.call(e, s), e.dispatchEvent(new CustomEvent("message", {
|
3070
3094
|
detail: s
|
3071
|
-
})),
|
3095
|
+
})), ae.fireOnNewMessage(e, s);
|
3072
3096
|
}
|
3073
3097
|
}, {
|
3074
3098
|
key: "onClearMessages",
|
@@ -3094,11 +3118,11 @@ var hi = /*#__PURE__*/function () {
|
|
3094
3118
|
}
|
3095
3119
|
}]);
|
3096
3120
|
}();
|
3097
|
-
var
|
3098
|
-
function
|
3099
|
-
_classCallCheck(this,
|
3121
|
+
var F = /*#__PURE__*/function () {
|
3122
|
+
function F() {
|
3123
|
+
_classCallCheck(this, F);
|
3100
3124
|
}
|
3101
|
-
return _createClass(
|
3125
|
+
return _createClass(F, null, [{
|
3102
3126
|
key: "generateLoadingRingElement",
|
3103
3127
|
value: function generateLoadingRingElement() {
|
3104
3128
|
var e = document.createElement("div");
|
@@ -3114,18 +3138,18 @@ var D = /*#__PURE__*/function () {
|
|
3114
3138
|
value: function addLoadHistoryMessage(e, t) {
|
3115
3139
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
3116
3140
|
var o, a, l, c, d, h, u, f;
|
3117
|
-
e.bubbleElement.classList.add(
|
3118
|
-
var s = i ?
|
3141
|
+
e.bubbleElement.classList.add(F.CLASS);
|
3142
|
+
var s = i ? F.FULL_VIEW_CLASS : F.SMALL_CLASS;
|
3119
3143
|
e.outerContainer.classList.add(s);
|
3120
3144
|
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
|
-
|
3145
|
+
F.apply(t, e, r), t.elementRef.prepend(e.outerContainer);
|
3122
3146
|
}
|
3123
3147
|
}, {
|
3124
3148
|
key: "createDefaultElements",
|
3125
3149
|
value: function createDefaultElements(e) {
|
3126
3150
|
var t = e.createMessageElements("", b.AI_ROLE),
|
3127
3151
|
i = t.bubbleElement,
|
3128
|
-
s =
|
3152
|
+
s = F.generateLoadingRingElement();
|
3129
3153
|
return i.appendChild(s), t;
|
3130
3154
|
}
|
3131
3155
|
}, {
|
@@ -3134,30 +3158,30 @@ var D = /*#__PURE__*/function () {
|
|
3134
3158
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
3135
3159
|
var r, o, a, l;
|
3136
3160
|
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 ? Be.createElements(e, i, b.AI_ROLE, !0) :
|
3138
|
-
return
|
3161
|
+
s = i ? Be.createElements(e, i, b.AI_ROLE, !0) : F.createDefaultElements(e);
|
3162
|
+
return F.addLoadHistoryMessage(s, e, t), s;
|
3139
3163
|
}
|
3140
3164
|
}, {
|
3141
3165
|
key: "changeFullViewToSmall",
|
3142
3166
|
value: function changeFullViewToSmall(e, t) {
|
3143
3167
|
var i, s, r, o, a, l, c, d;
|
3144
|
-
if (t != null && t.outerContainer.classList.contains(
|
3145
|
-
t.outerContainer.classList.replace(
|
3168
|
+
if (t != null && t.outerContainer.classList.contains(F.FULL_VIEW_CLASS)) {
|
3169
|
+
t.outerContainer.classList.replace(F.FULL_VIEW_CLASS, F.SMALL_CLASS);
|
3146
3170
|
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 &&
|
3171
|
+
h && F.apply(e, t, h);
|
3148
3172
|
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
3173
|
u && (t.bubbleElement.innerHTML = u);
|
3150
3174
|
}
|
3151
3175
|
}
|
3152
3176
|
}]);
|
3153
3177
|
}();
|
3154
|
-
|
3155
|
-
var Qe =
|
3156
|
-
var
|
3157
|
-
function
|
3158
|
-
_classCallCheck(this,
|
3178
|
+
F.CLASS = "loading-history-message", F.FULL_VIEW_CLASS = "loading-history-message-full-view", F.SMALL_CLASS = "loading-history-message-small";
|
3179
|
+
var Qe = F;
|
3180
|
+
var q = /*#__PURE__*/function () {
|
3181
|
+
function q() {
|
3182
|
+
_classCallCheck(this, q);
|
3159
3183
|
}
|
3160
|
-
return _createClass(
|
3184
|
+
return _createClass(q, null, [{
|
3161
3185
|
key: "applyCustomStylesToElements",
|
3162
3186
|
value: function applyCustomStylesToElements(e, t, i) {
|
3163
3187
|
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 +3193,7 @@ var H = /*#__PURE__*/function () {
|
|
3169
3193
|
}, {
|
3170
3194
|
key: "applySideStyles",
|
3171
3195
|
value: function applySideStyles(e, t, i, s) {
|
3172
|
-
s && (
|
3196
|
+
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
3197
|
}
|
3174
3198
|
}, {
|
3175
3199
|
key: "isElementsStyles",
|
@@ -3181,7 +3205,7 @@ var H = /*#__PURE__*/function () {
|
|
3181
3205
|
key: "applyCustomStyles",
|
3182
3206
|
value: function applyCustomStyles(e, t, i, s, r) {
|
3183
3207
|
var o;
|
3184
|
-
r && e["default"] !== r ?
|
3208
|
+
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
3209
|
}
|
3186
3210
|
// prettier-ignore
|
3187
3211
|
}, {
|
@@ -3241,7 +3265,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3241
3265
|
var _this4 = this;
|
3242
3266
|
var i = this.createNewMessageElement(e, t);
|
3243
3267
|
return this.elementRef.appendChild(i.outerContainer), setTimeout(function () {
|
3244
|
-
return
|
3268
|
+
return J.scrollToBottom(_this4.elementRef);
|
3245
3269
|
}), i;
|
3246
3270
|
}
|
3247
3271
|
}, {
|
@@ -3285,11 +3309,11 @@ var Fe = /*#__PURE__*/function () {
|
|
3285
3309
|
key: "createMessageElements",
|
3286
3310
|
value: function createMessageElements(e, t) {
|
3287
3311
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
3288
|
-
var s = Fe.createBaseElements(),
|
3312
|
+
var s = Fe.createBaseElements(t),
|
3289
3313
|
r = s.outerContainer,
|
3290
3314
|
o = s.innerContainer,
|
3291
3315
|
a = s.bubbleElement;
|
3292
|
-
return r.appendChild(o), this.addInnerContainerElements(a, e, t), b.updateRefArr(this.messageElementRefs, s, i), s;
|
3316
|
+
return r.appendChild(o), this.addInnerContainerElements(a, e, t), b.updateRefArr(this.messageElementRefs, s, i), b.classifyMessages(t, this.messageElementRefs), s;
|
3293
3317
|
}
|
3294
3318
|
}, {
|
3295
3319
|
key: "addInnerContainerElements",
|
@@ -3305,7 +3329,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3305
3329
|
}, {
|
3306
3330
|
key: "applyCustomStyles",
|
3307
3331
|
value: function applyCustomStyles(e, t, i, s) {
|
3308
|
-
e && this.messageStyles &&
|
3332
|
+
e && this.messageStyles && q.applyCustomStyles(this.messageStyles, e, t, i, s);
|
3309
3333
|
}
|
3310
3334
|
}, {
|
3311
3335
|
key: "removeMessage",
|
@@ -3361,15 +3385,15 @@ var Fe = /*#__PURE__*/function () {
|
|
3361
3385
|
}
|
3362
3386
|
}, {
|
3363
3387
|
key: "createBaseElements",
|
3364
|
-
value: function createBaseElements() {
|
3365
|
-
var
|
3366
|
-
|
3367
|
-
|
3368
|
-
var
|
3369
|
-
return
|
3370
|
-
outerContainer:
|
3371
|
-
innerContainer:
|
3372
|
-
bubbleElement:
|
3388
|
+
value: function createBaseElements(e) {
|
3389
|
+
var t = document.createElement("div"),
|
3390
|
+
i = document.createElement("div");
|
3391
|
+
i.classList.add("inner-message-container"), t.appendChild(i), t.classList.add("outer-message-container"), t.classList.add(b.buildRoleContainerClass(e));
|
3392
|
+
var s = document.createElement("div");
|
3393
|
+
return s.classList.add("message-bubble"), i.appendChild(s), {
|
3394
|
+
outerContainer: t,
|
3395
|
+
innerContainer: i,
|
3396
|
+
bubbleElement: s
|
3373
3397
|
};
|
3374
3398
|
}
|
3375
3399
|
}, {
|
@@ -3403,15 +3427,15 @@ var Se = /*#__PURE__*/function () {
|
|
3403
3427
|
value: function upsertStreamedMessage(e) {
|
3404
3428
|
var r;
|
3405
3429
|
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(
|
3430
|
+
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
3431
|
var t = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.html) || "",
|
3408
|
-
i =
|
3432
|
+
i = J.isScrollbarAtBottomOfElement(this._messages.elementRef),
|
3409
3433
|
s = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
|
3410
3434
|
if (!this._elements && this._streamedContent === "") this.setInitialState(s, t, e == null ? void 0 : e.role);else {
|
3411
|
-
if (this._streamType !== s) return console.error(
|
3435
|
+
if (this._streamType !== s) return console.error(M.INVALID_STREAM_EVENT_MIX);
|
3412
3436
|
this.updateBasedOnType(t, s, (r = this._elements) == null ? void 0 : r.bubbleElement, e == null ? void 0 : e.overwrite);
|
3413
3437
|
}
|
3414
|
-
i &&
|
3438
|
+
i && J.scrollToBottom(this._messages.elementRef);
|
3415
3439
|
}
|
3416
3440
|
}, {
|
3417
3441
|
key: "setInitialState",
|
@@ -3446,8 +3470,8 @@ var Se = /*#__PURE__*/function () {
|
|
3446
3470
|
var t, i;
|
3447
3471
|
var e = this._messages.textElementsToText;
|
3448
3472
|
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 &&
|
3473
|
+
if (!this._elements) throw Error(M.NO_VALID_STREAM_EVENTS_SENT);
|
3474
|
+
(t = this._elements.bubbleElement) != null && t.classList.contains(Se.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._message && (this._message.text = this._streamedContent), this._messages.textToSpeech && bt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === Se.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((i = this._elements.bubbleElement) == null ? void 0 : i.innerHTML) || ""), this._elements && te.apply(this._messages, this._elements.outerContainer), this._message && (this._message.html = this._streamedContent)), this._elements.bubbleElement.classList.remove(Se.MESSAGE_CLASS), this._message && this._messages.sendClientUpdate(Fe.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
|
3451
3475
|
}
|
3452
3476
|
}
|
3453
3477
|
}, {
|
@@ -3743,49 +3767,49 @@ function wo(n, e) {
|
|
3743
3767
|
f.accept || (f.accept = as);
|
3744
3768
|
var m;
|
3745
3769
|
function p() {
|
3746
|
-
m.abort(), document.hidden ||
|
3770
|
+
m.abort(), document.hidden || I();
|
3747
3771
|
}
|
3748
3772
|
l || document.addEventListener("visibilitychange", p);
|
3749
3773
|
var y = _o,
|
3750
3774
|
x = 0;
|
3751
|
-
function
|
3775
|
+
function j() {
|
3752
3776
|
document.removeEventListener("visibilitychange", p), window.clearTimeout(x), m.abort();
|
3753
3777
|
}
|
3754
3778
|
t == null || t.addEventListener("abort", function () {
|
3755
|
-
|
3779
|
+
j(), h();
|
3756
3780
|
});
|
3757
|
-
var
|
3781
|
+
var G = c !== null && c !== void 0 ? c : window.fetch,
|
3758
3782
|
Le = s !== null && s !== void 0 ? s : To;
|
3759
|
-
function
|
3760
|
-
return
|
3783
|
+
function I() {
|
3784
|
+
return _I.apply(this, arguments);
|
3761
3785
|
}
|
3762
|
-
function
|
3763
|
-
|
3764
|
-
var
|
3786
|
+
function _I() {
|
3787
|
+
_I = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
3788
|
+
var Z, X, D;
|
3765
3789
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
3766
3790
|
while (1) switch (_context4.prev = _context4.next) {
|
3767
3791
|
case 0:
|
3768
3792
|
m = new AbortController();
|
3769
3793
|
_context4.prev = 1;
|
3770
3794
|
_context4.next = 4;
|
3771
|
-
return
|
3795
|
+
return G(n, Object.assign(Object.assign({}, d), {
|
3772
3796
|
headers: f,
|
3773
3797
|
signal: m.signal
|
3774
3798
|
}));
|
3775
3799
|
case 4:
|
3776
|
-
|
3800
|
+
X = _context4.sent;
|
3777
3801
|
_context4.next = 7;
|
3778
|
-
return Le(
|
3802
|
+
return Le(X);
|
3779
3803
|
case 7:
|
3780
3804
|
_context4.next = 9;
|
3781
|
-
return vo(
|
3782
|
-
|
3783
|
-
}, function (
|
3784
|
-
y =
|
3805
|
+
return vo(X.body, yo(Eo(function (D) {
|
3806
|
+
D ? f[Ws] = D : delete f[Ws];
|
3807
|
+
}, function (D) {
|
3808
|
+
y = D;
|
3785
3809
|
}, r)));
|
3786
3810
|
case 9:
|
3787
3811
|
o == null || o();
|
3788
|
-
|
3812
|
+
j();
|
3789
3813
|
h();
|
3790
3814
|
_context4.next = 17;
|
3791
3815
|
break;
|
@@ -3793,10 +3817,10 @@ function wo(n, e) {
|
|
3793
3817
|
_context4.prev = 14;
|
3794
3818
|
_context4.t0 = _context4["catch"](1);
|
3795
3819
|
if (!m.signal.aborted) try {
|
3796
|
-
|
3797
|
-
window.clearTimeout(x), x = window.setTimeout(
|
3798
|
-
} catch (
|
3799
|
-
|
3820
|
+
D = (Z = a == null ? void 0 : a(_context4.t0)) !== null && Z !== void 0 ? Z : y;
|
3821
|
+
window.clearTimeout(x), x = window.setTimeout(I, D);
|
3822
|
+
} catch (D) {
|
3823
|
+
j(), u(D);
|
3800
3824
|
}
|
3801
3825
|
case 17:
|
3802
3826
|
case "end":
|
@@ -3804,20 +3828,20 @@ function wo(n, e) {
|
|
3804
3828
|
}
|
3805
3829
|
}, _callee4, null, [[1, 14]]);
|
3806
3830
|
}));
|
3807
|
-
return
|
3831
|
+
return _I.apply(this, arguments);
|
3808
3832
|
}
|
3809
|
-
|
3833
|
+
I();
|
3810
3834
|
});
|
3811
3835
|
}
|
3812
3836
|
function To(n) {
|
3813
3837
|
var e = n.headers.get("content-type");
|
3814
3838
|
if (!(e != null && e.startsWith(as))) throw new Error("Expected content-type to be ".concat(as, ", Actual: ").concat(e));
|
3815
3839
|
}
|
3816
|
-
var
|
3817
|
-
function
|
3818
|
-
_classCallCheck(this,
|
3840
|
+
var A = /*#__PURE__*/function () {
|
3841
|
+
function A() {
|
3842
|
+
_classCallCheck(this, A);
|
3819
3843
|
}
|
3820
|
-
return _createClass(
|
3844
|
+
return _createClass(A, null, [{
|
3821
3845
|
key: "request",
|
3822
3846
|
value: // prettier-ignore
|
3823
3847
|
function () {
|
@@ -3827,8 +3851,8 @@ var C = /*#__PURE__*/function () {
|
|
3827
3851
|
p,
|
3828
3852
|
y,
|
3829
3853
|
x,
|
3830
|
-
|
3831
|
-
|
3854
|
+
j,
|
3855
|
+
G,
|
3832
3856
|
Le,
|
3833
3857
|
o,
|
3834
3858
|
_yield$v$processReque,
|
@@ -3881,26 +3905,26 @@ var C = /*#__PURE__*/function () {
|
|
3881
3905
|
return _context7.abrupt("return", be.requestStream(i, e.streamHandlers));
|
3882
3906
|
case 19:
|
3883
3907
|
f = new ge(i), m = v.fetch.bind(this, e, l, s);
|
3884
|
-
return _context7.abrupt("return", (wo(((
|
3885
|
-
method: ((
|
3908
|
+
return _context7.abrupt("return", (wo(((j = e.connectSettings) == null ? void 0 : j.url) || e.url || "", {
|
3909
|
+
method: ((G = e.connectSettings) == null ? void 0 : G.method) || "POST",
|
3886
3910
|
headers: l,
|
3887
3911
|
credentials: (Le = e.connectSettings) == null ? void 0 : Le.credentials,
|
3888
3912
|
body: s ? JSON.stringify(a) : a,
|
3889
3913
|
openWhenHidden: !0,
|
3890
3914
|
// keep stream open when browser tab not open
|
3891
|
-
onopen: function onopen(
|
3915
|
+
onopen: function onopen(I) {
|
3892
3916
|
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
3893
3917
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
3894
3918
|
while (1) switch (_context5.prev = _context5.next) {
|
3895
3919
|
case 0:
|
3896
|
-
if (!
|
3920
|
+
if (!I.ok) {
|
3897
3921
|
_context5.next = 2;
|
3898
3922
|
break;
|
3899
3923
|
}
|
3900
3924
|
return _context5.abrupt("return", d());
|
3901
3925
|
case 2:
|
3902
3926
|
_context5.next = 4;
|
3903
|
-
return v.processResponseByType(
|
3927
|
+
return v.processResponseByType(I);
|
3904
3928
|
case 4:
|
3905
3929
|
throw _context5.sent;
|
3906
3930
|
case 5:
|
@@ -3910,23 +3934,23 @@ var C = /*#__PURE__*/function () {
|
|
3910
3934
|
}, _callee5);
|
3911
3935
|
}))();
|
3912
3936
|
},
|
3913
|
-
onmessage: function onmessage(
|
3937
|
+
onmessage: function onmessage(I) {
|
3914
3938
|
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
3915
|
-
var
|
3939
|
+
var Z, X, D, je, Tt;
|
3916
3940
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
3917
3941
|
while (1) switch (_context6.prev = _context6.next) {
|
3918
3942
|
case 0:
|
3919
|
-
if (!(JSON.stringify(
|
3943
|
+
if (!(JSON.stringify(I.data) !== JSON.stringify("[DONE]"))) {
|
3920
3944
|
_context6.next = 9;
|
3921
3945
|
break;
|
3922
3946
|
}
|
3923
3947
|
try {
|
3924
|
-
je = JSON.parse(
|
3948
|
+
je = JSON.parse(I.data);
|
3925
3949
|
} catch (_unused6) {
|
3926
3950
|
je = {};
|
3927
3951
|
}
|
3928
3952
|
_context6.next = 4;
|
3929
|
-
return (
|
3953
|
+
return (X = (Z = e.deepChat).responseInterceptor) == null ? void 0 : X.call(Z, je);
|
3930
3954
|
case 4:
|
3931
3955
|
_context6.t0 = _context6.sent;
|
3932
3956
|
if (_context6.t0) {
|
@@ -3936,8 +3960,8 @@ var C = /*#__PURE__*/function () {
|
|
3936
3960
|
_context6.t0 = je;
|
3937
3961
|
case 7:
|
3938
3962
|
Tt = _context6.t0;
|
3939
|
-
(
|
3940
|
-
e.asyncCallInProgress && He && He.text !== "" ? (
|
3963
|
+
(D = e.extractResultData) == null || D.call(e, Tt, m, a).then(function (He) {
|
3964
|
+
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
3965
|
})["catch"](function (He) {
|
3942
3966
|
return v.displayError(i, He);
|
3943
3967
|
});
|
@@ -3948,23 +3972,23 @@ var C = /*#__PURE__*/function () {
|
|
3948
3972
|
}, _callee6);
|
3949
3973
|
}))();
|
3950
3974
|
},
|
3951
|
-
onerror: function onerror(
|
3952
|
-
throw h(),
|
3975
|
+
onerror: function onerror(I) {
|
3976
|
+
throw h(), I;
|
3953
3977
|
},
|
3954
3978
|
onclose: function onclose() {
|
3955
3979
|
if (!e.asyncCallInProgress) try {
|
3956
3980
|
f.finaliseStreamedMessage(), h();
|
3957
|
-
} catch (
|
3958
|
-
if (!r) throw
|
3981
|
+
} catch (I) {
|
3982
|
+
if (!r) throw I;
|
3959
3983
|
}
|
3960
3984
|
},
|
3961
3985
|
signal: u.signal
|
3962
|
-
})["catch"](function (
|
3963
|
-
var
|
3964
|
-
i.isLastMessageError() || (
|
3965
|
-
v.displayError(i,
|
3966
|
-
})["catch"](function (
|
3967
|
-
v.displayError(i,
|
3986
|
+
})["catch"](function (I) {
|
3987
|
+
var Z;
|
3988
|
+
i.isLastMessageError() || (Z = e.extractResultData) == null || Z.call(e, I).then(function () {
|
3989
|
+
v.displayError(i, I);
|
3990
|
+
})["catch"](function (X) {
|
3991
|
+
v.displayError(i, X);
|
3968
3992
|
});
|
3969
3993
|
}), f));
|
3970
3994
|
case 21:
|
@@ -3988,12 +4012,12 @@ var C = /*#__PURE__*/function () {
|
|
3988
4012
|
}, i), !1), i.text) {
|
3989
4013
|
t.onOpen();
|
3990
4014
|
var r = i.text.split("");
|
3991
|
-
|
4015
|
+
A.populateMessages(r, new ge(e), s, "text");
|
3992
4016
|
}
|
3993
4017
|
if (i.html) {
|
3994
4018
|
t.onOpen();
|
3995
|
-
var _r2 =
|
3996
|
-
|
4019
|
+
var _r2 = te.splitHTML(i.html);
|
4020
|
+
A.populateMessages(_r2, new ge(e), s, "html");
|
3997
4021
|
}
|
3998
4022
|
}
|
3999
4023
|
// prettier-ignore
|
@@ -4005,10 +4029,10 @@ var C = /*#__PURE__*/function () {
|
|
4005
4029
|
if (o) {
|
4006
4030
|
t.upsertStreamedMessage(_defineProperty({}, s, o));
|
4007
4031
|
var a = setTimeout(function () {
|
4008
|
-
|
4032
|
+
A.populateMessages(e, t, i, s, r + 1);
|
4009
4033
|
}, i.simulationInterim || 6);
|
4010
4034
|
i.abortStream.abort = function () {
|
4011
|
-
|
4035
|
+
A.abort(a, t, i.onClose);
|
4012
4036
|
};
|
4013
4037
|
} else t.finaliseStreamedMessage(), i.onClose();
|
4014
4038
|
}
|
@@ -4020,7 +4044,7 @@ var C = /*#__PURE__*/function () {
|
|
4020
4044
|
}, {
|
4021
4045
|
key: "isSimulatable",
|
4022
4046
|
value: function isSimulatable(e, t) {
|
4023
|
-
return
|
4047
|
+
return A.isSimulation(e) && t && (t.text || t.html);
|
4024
4048
|
}
|
4025
4049
|
}, {
|
4026
4050
|
key: "abort",
|
@@ -4093,7 +4117,7 @@ var Ke = /*#__PURE__*/function () {
|
|
4093
4117
|
_context8.t0 = i;
|
4094
4118
|
case 5:
|
4095
4119
|
s = _context8.t0;
|
4096
|
-
s.error ? (t.addNewErrorMessage("service", s.error), e.completionsHandlers.onFinish()) :
|
4120
|
+
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
4121
|
case 7:
|
4098
4122
|
case "end":
|
4099
4123
|
return _context8.stop();
|
@@ -4107,18 +4131,18 @@ var Ke = /*#__PURE__*/function () {
|
|
4107
4131
|
value: function requestStream(e, t) {
|
4108
4132
|
setTimeout(function () {
|
4109
4133
|
var i = Ke.getResponse(e);
|
4110
|
-
|
4134
|
+
A.simulate(e, t, i);
|
4111
4135
|
}, 400);
|
4112
4136
|
}
|
4113
4137
|
}]);
|
4114
4138
|
}();
|
4115
4139
|
Ke.URL = "deep-chat-demo";
|
4116
4140
|
var be = Ke;
|
4117
|
-
var
|
4118
|
-
function
|
4119
|
-
_classCallCheck(this,
|
4141
|
+
var U = /*#__PURE__*/function () {
|
4142
|
+
function U() {
|
4143
|
+
_classCallCheck(this, U);
|
4120
4144
|
}
|
4121
|
-
return _createClass(
|
4145
|
+
return _createClass(U, null, [{
|
4122
4146
|
key: "setup",
|
4123
4147
|
value: function setup(e) {
|
4124
4148
|
e.connectSettings.url !== be.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
@@ -4133,7 +4157,7 @@ var B = /*#__PURE__*/function () {
|
|
4133
4157
|
}, {
|
4134
4158
|
key: "createConnection",
|
4135
4159
|
value: function createConnection(e, t) {
|
4136
|
-
if (!
|
4160
|
+
if (!U.isElementPresentInDOM(e.deepChat)) return;
|
4137
4161
|
var i = e.connectSettings.websocket;
|
4138
4162
|
if (i) {
|
4139
4163
|
if (e.connectSettings.handler) return Ce.websocket(e, t);
|
@@ -4142,12 +4166,12 @@ var B = /*#__PURE__*/function () {
|
|
4142
4166
|
r = new WebSocket(e.connectSettings.url || "", s);
|
4143
4167
|
e.websocket = r, e.websocket.onopen = function () {
|
4144
4168
|
var o, a;
|
4145
|
-
t.removeError(), e.websocket && _typeof(e.websocket) == "object" &&
|
4169
|
+
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && U.assignListeners(e, r, t), (a = (o = e.deepChat)._validationHandler) == null || a.call(o);
|
4146
4170
|
}, e.websocket.onerror = function (o) {
|
4147
|
-
console.error(o),
|
4171
|
+
console.error(o), U.retryConnection(e, t);
|
4148
4172
|
};
|
4149
4173
|
} catch (s) {
|
4150
|
-
console.error(s),
|
4174
|
+
console.error(s), U.retryConnection(e, t);
|
4151
4175
|
}
|
4152
4176
|
}
|
4153
4177
|
}
|
@@ -4155,8 +4179,8 @@ var B = /*#__PURE__*/function () {
|
|
4155
4179
|
key: "retryConnection",
|
4156
4180
|
value: function retryConnection(e, t) {
|
4157
4181
|
var i, s;
|
4158
|
-
(s = (i = e.deepChat)._validationHandler) == null || s.call(i),
|
4159
|
-
|
4182
|
+
(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 () {
|
4183
|
+
U.createConnection(e, t);
|
4160
4184
|
}, 5e3));
|
4161
4185
|
}
|
4162
4186
|
}, {
|
@@ -4195,11 +4219,11 @@ var B = /*#__PURE__*/function () {
|
|
4195
4219
|
_context9.next = 14;
|
4196
4220
|
break;
|
4197
4221
|
}
|
4198
|
-
throw Error(
|
4222
|
+
throw Error(M.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
4199
4223
|
case 14:
|
4200
|
-
if (
|
4201
|
-
h =
|
4202
|
-
|
4224
|
+
if (A.isSimulation(e.stream)) {
|
4225
|
+
h = U.stream.bind(_this6, e, i, s), u = s[l.role || b.AI_ROLE];
|
4226
|
+
A.upsertWFiles(i, h, u, d);
|
4203
4227
|
} else i.addNewMessage(d);
|
4204
4228
|
_context9.next = 20;
|
4205
4229
|
break;
|
@@ -4217,7 +4241,7 @@ var B = /*#__PURE__*/function () {
|
|
4217
4241
|
return _ref3.apply(this, arguments);
|
4218
4242
|
};
|
4219
4243
|
}(), t.onclose = function () {
|
4220
|
-
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(),
|
4244
|
+
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(), U.createConnection(e, i);
|
4221
4245
|
};
|
4222
4246
|
}
|
4223
4247
|
}, {
|
@@ -4261,7 +4285,7 @@ var B = /*#__PURE__*/function () {
|
|
4261
4285
|
}
|
4262
4286
|
return _context10.abrupt("return", i.addNewErrorMessage("service", l));
|
4263
4287
|
case 12:
|
4264
|
-
if (
|
4288
|
+
if (U.isWebSocket(r)) {
|
4265
4289
|
_context10.next = 14;
|
4266
4290
|
break;
|
4267
4291
|
}
|
@@ -4289,7 +4313,7 @@ var B = /*#__PURE__*/function () {
|
|
4289
4313
|
}, {
|
4290
4314
|
key: "canSendMessage",
|
4291
4315
|
value: function canSendMessage(e) {
|
4292
|
-
return e ? e === "pending" ? !1 :
|
4316
|
+
return e ? e === "pending" ? !1 : U.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
|
4293
4317
|
}
|
4294
4318
|
// if false then it is the internal websocket handler
|
4295
4319
|
}, {
|
@@ -4307,7 +4331,7 @@ var B = /*#__PURE__*/function () {
|
|
4307
4331
|
var o = s.role || b.AI_ROLE,
|
4308
4332
|
a = i[o];
|
4309
4333
|
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
|
4334
|
+
} else A.simulate(t, e.streamHandlers, s);
|
4311
4335
|
}
|
4312
4336
|
}]);
|
4313
4337
|
}();
|
@@ -4348,7 +4372,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4348
4372
|
_context11.t0 = c;
|
4349
4373
|
case 8:
|
4350
4374
|
d = _context11.t0;
|
4351
|
-
v.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) :
|
4375
|
+
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
4376
|
case 10:
|
4353
4377
|
case "end":
|
4354
4378
|
return _context11.stop();
|
@@ -4420,7 +4444,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4420
4444
|
_context13.t0 = f;
|
4421
4445
|
case 7:
|
4422
4446
|
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) :
|
4447
|
+
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
4448
|
case 9:
|
4425
4449
|
case "end":
|
4426
4450
|
return _context13.stop();
|
@@ -4485,9 +4509,9 @@ var Ce = /*#__PURE__*/function () {
|
|
4485
4509
|
_context14.t0 = d;
|
4486
4510
|
case 7:
|
4487
4511
|
h = _context14.t0;
|
4488
|
-
if (!v.validateResponseFormat(h)) console.error(
|
4489
|
-
m =
|
4490
|
-
|
4512
|
+
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)) {
|
4513
|
+
m = U.stream.bind(_this7, e, t, i.roleToStream), p = i.roleToStream[d.role || b.AI_ROLE];
|
4514
|
+
A.upsertWFiles(t, m, p, d);
|
4491
4515
|
} else t.addNewMessage(h);
|
4492
4516
|
case 9:
|
4493
4517
|
case "end":
|
@@ -4587,7 +4611,7 @@ var T = /*#__PURE__*/function () {
|
|
4587
4611
|
return v.processResponseByType(p);
|
4588
4612
|
}).then(/*#__PURE__*/function () {
|
4589
4613
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(p) {
|
4590
|
-
var
|
4614
|
+
var j, G, y, x;
|
4591
4615
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
4592
4616
|
while (1) switch (_context15.prev = _context15.next) {
|
4593
4617
|
case 0:
|
@@ -4598,7 +4622,7 @@ var T = /*#__PURE__*/function () {
|
|
4598
4622
|
return _context15.abrupt("return");
|
4599
4623
|
case 2:
|
4600
4624
|
_context15.next = 4;
|
4601
|
-
return (
|
4625
|
+
return (G = (j = e.deepChat).responseInterceptor) == null ? void 0 : G.call(j, p);
|
4602
4626
|
case 4:
|
4603
4627
|
_context15.t0 = _context15.sent;
|
4604
4628
|
if (_context15.t0) {
|
@@ -4622,9 +4646,9 @@ var T = /*#__PURE__*/function () {
|
|
4622
4646
|
_context15.next = 15;
|
4623
4647
|
break;
|
4624
4648
|
}
|
4625
|
-
throw Error(
|
4649
|
+
throw Error(M.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, y));
|
4626
4650
|
case 15:
|
4627
|
-
x.makingAnotherRequest || (
|
4651
|
+
x.makingAnotherRequest || (A.isSimulatable(e.stream, x) ? A.simulate(i, e.streamHandlers, x) : (i.addNewMessage(x), c()));
|
4628
4652
|
case 16:
|
4629
4653
|
case "end":
|
4630
4654
|
return _context15.stop();
|
@@ -4684,7 +4708,7 @@ var T = /*#__PURE__*/function () {
|
|
4684
4708
|
a = _context17.sent;
|
4685
4709
|
a.timeoutMS ? setTimeout(function () {
|
4686
4710
|
T.executePollRequest(e, t, i, s);
|
4687
|
-
}, a.timeoutMS) :
|
4711
|
+
}, a.timeoutMS) : A.isSimulatable(e.stream, a) ? A.simulate(s, e.streamHandlers, a) : (s.addNewMessage(a), r());
|
4688
4712
|
case 13:
|
4689
4713
|
case "end":
|
4690
4714
|
return _context17.stop();
|
@@ -4758,7 +4782,7 @@ var T = /*#__PURE__*/function () {
|
|
4758
4782
|
}, {
|
4759
4783
|
key: "verifyKey",
|
4760
4784
|
value: function verifyKey(e, t, i, s, r, o, a, l, c) {
|
4761
|
-
if (e === "") return o(
|
4785
|
+
if (e === "") return o(M.INVALID_KEY);
|
4762
4786
|
a(), fetch(t, {
|
4763
4787
|
method: s,
|
4764
4788
|
headers: i,
|
@@ -4768,7 +4792,7 @@ var T = /*#__PURE__*/function () {
|
|
4768
4792
|
}).then(function (d) {
|
4769
4793
|
l(d, e, r, o);
|
4770
4794
|
})["catch"](function (d) {
|
4771
|
-
o(
|
4795
|
+
o(M.CONNECTION_FAILED), console.error(d);
|
4772
4796
|
});
|
4773
4797
|
}
|
4774
4798
|
}]);
|
@@ -4795,7 +4819,7 @@ var pt = /*#__PURE__*/function () {
|
|
4795
4819
|
this._messages.removeMessage(t), i.forEach(function (s) {
|
4796
4820
|
return _this8._messages.addAnyMessage(s, !0);
|
4797
4821
|
}), setTimeout(function () {
|
4798
|
-
return
|
4822
|
+
return J.scrollToBottom(_this8._messages.elementRef);
|
4799
4823
|
}, 0);
|
4800
4824
|
case 5:
|
4801
4825
|
case "end":
|
@@ -4881,7 +4905,7 @@ var pt = /*#__PURE__*/function () {
|
|
4881
4905
|
value: function populateInitialHistory(e) {
|
4882
4906
|
var _this11 = this;
|
4883
4907
|
e.forEach(function (t) {
|
4884
|
-
|
4908
|
+
ae.processHistoryFile(t), _this11._messages.addNewMessage(t, !0);
|
4885
4909
|
});
|
4886
4910
|
}
|
4887
4911
|
}, {
|
@@ -4908,7 +4932,7 @@ var pt = /*#__PURE__*/function () {
|
|
4908
4932
|
return !!o;
|
4909
4933
|
});
|
4910
4934
|
this.processLoadedHistory(r), s === 0 && setTimeout(function () {
|
4911
|
-
return
|
4935
|
+
return J.scrollToBottom(_this12._messages.elementRef);
|
4912
4936
|
}, 0);
|
4913
4937
|
_context22.next = 15;
|
4914
4938
|
break;
|
@@ -4938,7 +4962,7 @@ var pt = /*#__PURE__*/function () {
|
|
4938
4962
|
while (1) switch (_context23.prev = _context23.next) {
|
4939
4963
|
case 0:
|
4940
4964
|
e.loadHistory && this.loadInitialHistory(e.loadHistory);
|
4941
|
-
t = e.history ||
|
4965
|
+
t = e.history || ae.processHistory(e);
|
4942
4966
|
t && (this.populateInitialHistory(t), this._index += 1);
|
4943
4967
|
case 3:
|
4944
4968
|
case "end":
|
@@ -4997,11 +5021,11 @@ var St = /*#__PURE__*/function () {
|
|
4997
5021
|
}
|
4998
5022
|
}]);
|
4999
5023
|
}();
|
5000
|
-
var
|
5001
|
-
function
|
5002
|
-
_classCallCheck(this,
|
5024
|
+
var P = /*#__PURE__*/function () {
|
5025
|
+
function P() {
|
5026
|
+
_classCallCheck(this, P);
|
5003
5027
|
}
|
5004
|
-
return _createClass(
|
5028
|
+
return _createClass(P, null, [{
|
5005
5029
|
key: "parseConfig",
|
5006
5030
|
value:
|
5007
5031
|
// prettier-ignore
|
@@ -5011,7 +5035,7 @@ var L = /*#__PURE__*/function () {
|
|
5011
5035
|
files: t
|
5012
5036
|
};
|
5013
5037
|
if (_typeof(s) == "object") {
|
5014
|
-
|
5038
|
+
ae.processFileConfigConnect(s);
|
5015
5039
|
var a = s.files,
|
5016
5040
|
l = s.connect,
|
5017
5041
|
c = s.button;
|
@@ -5031,7 +5055,7 @@ var L = /*#__PURE__*/function () {
|
|
5031
5055
|
var s = {
|
5032
5056
|
acceptedFormats: ""
|
5033
5057
|
};
|
5034
|
-
e.fileTypes.mixedFiles =
|
5058
|
+
e.fileTypes.mixedFiles = P.parseConfig(e.connectSettings, s, t, i);
|
5035
5059
|
}
|
5036
5060
|
}
|
5037
5061
|
// needs to be set after audio to overwrite maxNumberOfFiles
|
@@ -5044,7 +5068,7 @@ var L = /*#__PURE__*/function () {
|
|
5044
5068
|
var o = _objectSpread({
|
5045
5069
|
acceptedFormats: "audio/*"
|
5046
5070
|
}, ((a = e.fileTypes.audio) == null ? void 0 : a.files) || {});
|
5047
|
-
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio =
|
5071
|
+
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
5072
|
}
|
5049
5073
|
// prettier-ignore
|
5050
5074
|
}, {
|
@@ -5054,7 +5078,7 @@ var L = /*#__PURE__*/function () {
|
|
5054
5078
|
var o = _objectSpread({
|
5055
5079
|
acceptedFormats: "audio/*"
|
5056
5080
|
}, (s == null ? void 0 : s.files) || {});
|
5057
|
-
e.fileTypes.audio =
|
5081
|
+
e.fileTypes.audio = P.parseConfig(e.connectSettings, o, t, i);
|
5058
5082
|
}
|
5059
5083
|
// prettier-ignore
|
5060
5084
|
}, {
|
@@ -5064,7 +5088,7 @@ var L = /*#__PURE__*/function () {
|
|
5064
5088
|
var o = _objectSpread({
|
5065
5089
|
acceptedFormats: "image/gif"
|
5066
5090
|
}, (s == null ? void 0 : s.files) || {});
|
5067
|
-
e.fileTypes.gifs =
|
5091
|
+
e.fileTypes.gifs = P.parseConfig(e.connectSettings, o, t, i);
|
5068
5092
|
}
|
5069
5093
|
// needs to be set after images to overwrite maxNumberOfFiles
|
5070
5094
|
// prettier-ignore
|
@@ -5076,7 +5100,7 @@ var L = /*#__PURE__*/function () {
|
|
5076
5100
|
var o = _objectSpread({
|
5077
5101
|
acceptedFormats: "image/*"
|
5078
5102
|
}, ((a = e.fileTypes.images) == null ? void 0 : a.files) || {});
|
5079
|
-
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.camera =
|
5103
|
+
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
5104
|
}
|
5081
5105
|
// prettier-ignore
|
5082
5106
|
}, {
|
@@ -5086,7 +5110,7 @@ var L = /*#__PURE__*/function () {
|
|
5086
5110
|
var o = _objectSpread({
|
5087
5111
|
acceptedFormats: "image/*"
|
5088
5112
|
}, (s == null ? void 0 : s.files) || {});
|
5089
|
-
e.fileTypes.images =
|
5113
|
+
e.fileTypes.images = P.parseConfig(e.connectSettings, o, t, i);
|
5090
5114
|
}
|
5091
5115
|
// default for direct service
|
5092
5116
|
}, {
|
@@ -5099,9 +5123,9 @@ var L = /*#__PURE__*/function () {
|
|
5099
5123
|
}, {
|
5100
5124
|
key: "set",
|
5101
5125
|
value: function set(e, t, i) {
|
5102
|
-
|
5126
|
+
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
5127
|
var s = jt.createNew();
|
5104
|
-
|
5128
|
+
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
5129
|
}
|
5106
5130
|
}]);
|
5107
5131
|
}();
|
@@ -5110,7 +5134,7 @@ var it = /*#__PURE__*/function () {
|
|
5110
5134
|
var _a$url;
|
5111
5135
|
_classCallCheck(this, it);
|
5112
5136
|
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,
|
5137
|
+
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = it.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (s = e.connect) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (r = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : r.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, P.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = be.URL), this.connectSettings.websocket && U.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || ae.checkForStream(this.deepChat), e.loadHistory && Ht.addErrorPrefix(this);
|
5114
5138
|
}
|
5115
5139
|
return _createClass(it, [{
|
5116
5140
|
key: "verifyKey",
|
@@ -5136,7 +5160,7 @@ var it = /*#__PURE__*/function () {
|
|
5136
5160
|
while (1) switch (_context24.prev = _context24.next) {
|
5137
5161
|
case 0:
|
5138
5162
|
i = _args24.length > 2 && _args24[2] !== undefined ? _args24[2] : !0;
|
5139
|
-
return _context24.abrupt("return", this.stream && !
|
5163
|
+
return _context24.abrupt("return", this.stream && !A.isSimulation(this.stream) ? A.request(this, e, t, i) : T.request(this, e, t, i));
|
5140
5164
|
case 2:
|
5141
5165
|
case "end":
|
5142
5166
|
return _context24.stop();
|
@@ -5240,7 +5264,7 @@ var it = /*#__PURE__*/function () {
|
|
5240
5264
|
s = _objectSpread({
|
5241
5265
|
messages: i
|
5242
5266
|
}, this.rawBody);
|
5243
|
-
|
5267
|
+
U.sendWebsocket(this, s, t, !1);
|
5244
5268
|
} else this.callServiceAPI(t, i, e.files);
|
5245
5269
|
case 4:
|
5246
5270
|
case "end":
|
@@ -5270,7 +5294,7 @@ var it = /*#__PURE__*/function () {
|
|
5270
5294
|
_context29.next = 4;
|
5271
5295
|
break;
|
5272
5296
|
}
|
5273
|
-
return _context29.abrupt("return",
|
5297
|
+
return _context29.abrupt("return", ae.handleResponseProperty(e));
|
5274
5298
|
case 4:
|
5275
5299
|
if (!v.validateResponseFormat(e)) {
|
5276
5300
|
_context29.next = 6;
|
@@ -5321,17 +5345,17 @@ var it = /*#__PURE__*/function () {
|
|
5321
5345
|
}
|
5322
5346
|
}]);
|
5323
5347
|
}();
|
5324
|
-
var
|
5348
|
+
var z = /*#__PURE__*/function (_it) {
|
5325
5349
|
// prettier-ignore
|
5326
|
-
function
|
5350
|
+
function z(e, t, i, s, r) {
|
5327
5351
|
var _this13;
|
5328
|
-
_classCallCheck(this,
|
5352
|
+
_classCallCheck(this, z);
|
5329
5353
|
var o;
|
5330
|
-
_this13 = _callSuper(this,
|
5354
|
+
_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
5355
|
return _this13;
|
5332
5356
|
}
|
5333
|
-
_inherits(
|
5334
|
-
return _createClass(
|
5357
|
+
_inherits(z, _it);
|
5358
|
+
return _createClass(z, [{
|
5335
5359
|
key: "setApiKeyProperties",
|
5336
5360
|
value: function setApiKeyProperties(e) {
|
5337
5361
|
this.key = e.key, e.validateKeyProperty && (this.validateKeyProperty = e.validateKeyProperty);
|
@@ -5435,11 +5459,11 @@ _e._attributes_ = {}, _e._attributeToProperty_ = {};
|
|
5435
5459
|
var ls = _e;
|
5436
5460
|
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
5461
|
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,
|
5462
|
+
var ie = /*#__PURE__*/function () {
|
5463
|
+
function ie() {
|
5464
|
+
_classCallCheck(this, ie);
|
5441
5465
|
}
|
5442
|
-
return _createClass(
|
5466
|
+
return _createClass(ie, null, [{
|
5443
5467
|
key: "createSVGElement",
|
5444
5468
|
value: function createSVGElement(e) {
|
5445
5469
|
return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
|
@@ -5460,7 +5484,7 @@ var Oe = /*#__PURE__*/function () {
|
|
5460
5484
|
}, {
|
5461
5485
|
key: "createIconElement",
|
5462
5486
|
value: function createIconElement(e, t) {
|
5463
|
-
var i =
|
5487
|
+
var i = ie.createSVGElement(e);
|
5464
5488
|
return i.id = t, i.classList.add("visibility-icon"), i;
|
5465
5489
|
}
|
5466
5490
|
// prettier-ignore
|
@@ -5478,11 +5502,11 @@ var Oe = /*#__PURE__*/function () {
|
|
5478
5502
|
}();
|
5479
5503
|
Oe.VISIBLE_ICON_ID = "visible-icon";
|
5480
5504
|
var cs = Oe;
|
5481
|
-
var
|
5482
|
-
function
|
5483
|
-
_classCallCheck(this,
|
5505
|
+
var H = /*#__PURE__*/function () {
|
5506
|
+
function H() {
|
5507
|
+
_classCallCheck(this, H);
|
5484
5508
|
}
|
5485
|
-
return _createClass(
|
5509
|
+
return _createClass(H, null, [{
|
5486
5510
|
key: "createCautionText",
|
5487
5511
|
value: function createCautionText() {
|
5488
5512
|
var e = document.createElement("a");
|
@@ -5508,13 +5532,13 @@ var j = /*#__PURE__*/function () {
|
|
5508
5532
|
i.id = "insert-key-help-text-container";
|
5509
5533
|
var s = document.createElement("div");
|
5510
5534
|
s.id = "insert-key-help-text-contents";
|
5511
|
-
var r =
|
5535
|
+
var r = H.createFailText();
|
5512
5536
|
if (s.appendChild(r), e) {
|
5513
|
-
var o =
|
5537
|
+
var o = H.createHelpLink(e);
|
5514
5538
|
s.appendChild(o);
|
5515
5539
|
}
|
5516
5540
|
if (t === !0) {
|
5517
|
-
var _o2 =
|
5541
|
+
var _o2 = H.createCautionText();
|
5518
5542
|
s.appendChild(_o2);
|
5519
5543
|
}
|
5520
5544
|
return i.appendChild(s), {
|
@@ -5545,12 +5569,12 @@ var j = /*#__PURE__*/function () {
|
|
5545
5569
|
value: function addVerificationEvents(e, t, i, s, r) {
|
5546
5570
|
var o = {
|
5547
5571
|
onSuccess: s,
|
5548
|
-
onFail:
|
5549
|
-
onLoad:
|
5572
|
+
onFail: H.onFail.bind(this, e, t, i),
|
5573
|
+
onLoad: H.onLoad.bind(this, e, t)
|
5550
5574
|
},
|
5551
|
-
a =
|
5575
|
+
a = H.verifyKey.bind(this, e, o, r);
|
5552
5576
|
t.onclick = a, e.onkeydown = function (l) {
|
5553
|
-
!e.classList.contains("loading") && l.key ===
|
5577
|
+
!e.classList.contains("loading") && l.key === O.ENTER && a();
|
5554
5578
|
};
|
5555
5579
|
}
|
5556
5580
|
}, {
|
@@ -5570,7 +5594,7 @@ var j = /*#__PURE__*/function () {
|
|
5570
5594
|
var t = document.createElement("div");
|
5571
5595
|
t.id = "insert-key-input-container";
|
5572
5596
|
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 =
|
5597
|
+
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
5598
|
}
|
5575
5599
|
// prettier-ignore
|
5576
5600
|
}, {
|
@@ -5579,51 +5603,51 @@ var j = /*#__PURE__*/function () {
|
|
5579
5603
|
var d;
|
5580
5604
|
var i = document.createElement("div");
|
5581
5605
|
i.id = "insert-key-contents";
|
5582
|
-
var s =
|
5606
|
+
var s = H.createInput(t.insertKeyPlaceholderText),
|
5583
5607
|
r = s.children[0],
|
5584
5608
|
o = cs.create(r);
|
5585
5609
|
s.appendChild(o), i.appendChild(s);
|
5586
|
-
var a =
|
5587
|
-
|
5588
|
-
l =
|
5589
|
-
c =
|
5590
|
-
return i.appendChild(a), i.appendChild(l),
|
5610
|
+
var a = H.createStartButton(),
|
5611
|
+
_H$createHelpTextCont = H.createHelpTextContainer(t.keyHelpUrl, (d = t.deepChat._insertKeyViewStyles) == null ? void 0 : d.displayCautionText),
|
5612
|
+
l = _H$createHelpTextCont.helpTextContainerElement,
|
5613
|
+
c = _H$createHelpTextCont.failTextElement;
|
5614
|
+
return i.appendChild(a), i.appendChild(l), H.addVerificationEvents(r, a, c, e, t), i;
|
5591
5615
|
}
|
5592
5616
|
}, {
|
5593
5617
|
key: "createElements",
|
5594
5618
|
value: function createElements(e, t) {
|
5595
5619
|
var i = document.createElement("div");
|
5596
5620
|
i.id = "insert-key-view";
|
5597
|
-
var s =
|
5621
|
+
var s = H.createContents(e, t);
|
5598
5622
|
return i.appendChild(s), i;
|
5599
5623
|
}
|
5600
5624
|
}, {
|
5601
5625
|
key: "render",
|
5602
5626
|
value: function render(e, t, i) {
|
5603
|
-
var s =
|
5627
|
+
var s = H.createElements(t, i);
|
5604
5628
|
e.replaceChildren(s);
|
5605
5629
|
}
|
5606
5630
|
}]);
|
5607
5631
|
}();
|
5608
|
-
var
|
5609
|
-
function
|
5610
|
-
_classCallCheck(this,
|
5632
|
+
var Q = /*#__PURE__*/function () {
|
5633
|
+
function Q() {
|
5634
|
+
_classCallCheck(this, Q);
|
5611
5635
|
}
|
5612
|
-
return _createClass(
|
5636
|
+
return _createClass(Q, null, [{
|
5613
5637
|
key: "enableButtons",
|
5614
5638
|
value: function enableButtons(e, t) {
|
5615
5639
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
5616
5640
|
window.webLLM ? (e && (e.disabled = !1), t && (t.disabled = !1)) : i < qt.MODULE_SEARCH_LIMIT_S * 4 && setTimeout(function () {
|
5617
|
-
return
|
5641
|
+
return Q.enableButtons(e, t, i + 1);
|
5618
5642
|
}, 250);
|
5619
5643
|
}
|
5620
5644
|
// prettier-ignore
|
5621
5645
|
}, {
|
5622
5646
|
key: "setUpInitial",
|
5623
5647
|
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) ||
|
5648
|
+
var r = (t == null ? void 0 : t.downloadClass) || Q.DOWNLOAD_BUTTON_CLASS,
|
5649
|
+
o = (t == null ? void 0 : t.uploadClass) || Q.UPLOAD_BUTTON_CLASS,
|
5650
|
+
a = (t == null ? void 0 : t.fileInputClass) || Q.FILE_INPUT_CLASS;
|
5627
5651
|
return setTimeout(function () {
|
5628
5652
|
var l = i == null ? void 0 : i.getElementsByClassName(r)[0],
|
5629
5653
|
c = i == null ? void 0 : i.getElementsByClassName(a)[0],
|
@@ -5634,7 +5658,7 @@ var Y = /*#__PURE__*/function () {
|
|
5634
5658
|
c.files && c.files.length > 0 && e(c.files);
|
5635
5659
|
}), d && (d.onclick = function () {
|
5636
5660
|
return c.click();
|
5637
|
-
}), (l || d) &&
|
5661
|
+
}), (l || d) && Q.enableButtons(l, d);
|
5638
5662
|
}), (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
5663
|
}
|
5640
5664
|
}, {
|
@@ -5659,18 +5683,18 @@ var Y = /*#__PURE__*/function () {
|
|
5659
5683
|
}, {
|
5660
5684
|
key: "setUpAfterLoad",
|
5661
5685
|
value: function setUpAfterLoad(e, t, i, s) {
|
5662
|
-
var r = (t == null ? void 0 : t.exportFilesClass) ||
|
5686
|
+
var r = (t == null ? void 0 : t.exportFilesClass) || Q.EXPORT_BUTTON_CLASS;
|
5663
5687
|
return setTimeout(function () {
|
5664
5688
|
var o = i == null ? void 0 : i.getElementsByClassName(r)[0];
|
5665
5689
|
o && (o.onclick = function () {
|
5666
|
-
return
|
5690
|
+
return Q.exportFile(e);
|
5667
5691
|
});
|
5668
5692
|
}), (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
5693
|
}
|
5670
5694
|
}]);
|
5671
5695
|
}();
|
5672
|
-
|
5673
|
-
var fi =
|
5696
|
+
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";
|
5697
|
+
var fi = Q;
|
5674
5698
|
var Ks = {
|
5675
5699
|
model_list: [
|
5676
5700
|
// Llama-2
|
@@ -5838,7 +5862,7 @@ var Ks = {
|
|
5838
5862
|
var t;
|
5839
5863
|
((t = this._webModel.introMessage) == null ? void 0 : t.autoScroll) !== !1 && setTimeout(function () {
|
5840
5864
|
var i, s;
|
5841
|
-
(i = _this18._messages) != null && i.elementRef &&
|
5865
|
+
(i = _this18._messages) != null && i.elementRef && J.scrollToTop((s = _this18._messages) == null ? void 0 : s.elementRef);
|
5842
5866
|
}, e);
|
5843
5867
|
}
|
5844
5868
|
// prettier-ignore
|
@@ -5970,7 +5994,7 @@ var Ks = {
|
|
5970
5994
|
sendUpdate: !1
|
5971
5995
|
}), i && (setTimeout(function () {
|
5972
5996
|
var p;
|
5973
|
-
return
|
5997
|
+
return J.scrollToBottom((p = _this19._messages) == null ? void 0 : p.elementRef);
|
5974
5998
|
}), i = !1);
|
5975
5999
|
};
|
5976
6000
|
w.chat.setInitProgressCallback(s);
|
@@ -6189,7 +6213,7 @@ var Ks = {
|
|
6189
6213
|
a = !!this.stream;
|
6190
6214
|
try {
|
6191
6215
|
if (o) v.displayError(e, new Error(o)), (a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish)();else if (!r || !r.text) {
|
6192
|
-
l =
|
6216
|
+
l = M.INVALID_MODEL_REQUEST({
|
6193
6217
|
body: r
|
6194
6218
|
}, !1);
|
6195
6219
|
console.error(l);
|
@@ -6296,7 +6320,7 @@ var Ks = {
|
|
6296
6320
|
_context40.next = 15;
|
6297
6321
|
break;
|
6298
6322
|
}
|
6299
|
-
o =
|
6323
|
+
o = M.INVALID_MODEL_RESPONSE(i, !!e.responseInterceptor, s);
|
6300
6324
|
v.displayError(t, new Error(o));
|
6301
6325
|
return _context40.abrupt("return");
|
6302
6326
|
case 15:
|
@@ -6350,7 +6374,7 @@ var pi = /*#__PURE__*/function () {
|
|
6350
6374
|
key: "handleVerificationResult",
|
6351
6375
|
value: function handleVerificationResult(e, t, i, s) {
|
6352
6376
|
var r = e;
|
6353
|
-
Array.isArray(r.error) && r.error[0] === "Error in `parameters`: field required" ? i(t) : s(
|
6377
|
+
Array.isArray(r.error) && r.error[0] === "Error in `parameters`: field required" ? i(t) : s(M.INVALID_KEY);
|
6354
6378
|
}
|
6355
6379
|
}, {
|
6356
6380
|
key: "buildKeyVerificationDetails",
|
@@ -6363,7 +6387,7 @@ var pi = /*#__PURE__*/function () {
|
|
6363
6387
|
}
|
6364
6388
|
}]);
|
6365
6389
|
}();
|
6366
|
-
var Nt = /*#__PURE__*/function (
|
6390
|
+
var Nt = /*#__PURE__*/function (_z) {
|
6367
6391
|
// prettier-ignore
|
6368
6392
|
function Nt(e, t, i, s, r, o) {
|
6369
6393
|
var _this21;
|
@@ -6372,7 +6396,7 @@ var Nt = /*#__PURE__*/function (_q) {
|
|
6372
6396
|
return _this21;
|
6373
6397
|
}
|
6374
6398
|
// prettier-ignore
|
6375
|
-
_inherits(Nt,
|
6399
|
+
_inherits(Nt, _z);
|
6376
6400
|
return _createClass(Nt, [{
|
6377
6401
|
key: "preprocessBody",
|
6378
6402
|
value: function preprocessBody(e, t, i) {
|
@@ -6411,7 +6435,7 @@ var Nt = /*#__PURE__*/function (_q) {
|
|
6411
6435
|
return callServiceAPI;
|
6412
6436
|
}()
|
6413
6437
|
}]);
|
6414
|
-
}(
|
6438
|
+
}(z);
|
6415
6439
|
Nt.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
6416
6440
|
var Ie = Nt;
|
6417
6441
|
var Jt = /*#__PURE__*/function (_Ie) {
|
@@ -6583,7 +6607,7 @@ var ve = /*#__PURE__*/function () {
|
|
6583
6607
|
}, {
|
6584
6608
|
key: "handleVerificationResult",
|
6585
6609
|
value: function handleVerificationResult(e, t, i, s) {
|
6586
|
-
e.message ? s(
|
6610
|
+
e.message ? s(M.INVALID_KEY) : i(t);
|
6587
6611
|
}
|
6588
6612
|
}, {
|
6589
6613
|
key: "buildKeyVerificationDetails",
|
@@ -6596,7 +6620,7 @@ var ve = /*#__PURE__*/function () {
|
|
6596
6620
|
}
|
6597
6621
|
}]);
|
6598
6622
|
}();
|
6599
|
-
var Oi = /*#__PURE__*/function (
|
6623
|
+
var Oi = /*#__PURE__*/function (_z2) {
|
6600
6624
|
// prettier-ignore
|
6601
6625
|
function Oi(e, t, i, s, r) {
|
6602
6626
|
var _this23;
|
@@ -6604,9 +6628,9 @@ var Oi = /*#__PURE__*/function (_q2) {
|
|
6604
6628
|
_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
6629
|
return _this23;
|
6606
6630
|
}
|
6607
|
-
_inherits(Oi,
|
6631
|
+
_inherits(Oi, _z2);
|
6608
6632
|
return _createClass(Oi);
|
6609
|
-
}(
|
6633
|
+
}(z);
|
6610
6634
|
var mi = /*#__PURE__*/function (_Oi) {
|
6611
6635
|
function mi(e) {
|
6612
6636
|
var _this24;
|
@@ -7363,11 +7387,11 @@ var Do = /*#__PURE__*/function (_Ie7) {
|
|
7363
7387
|
}()
|
7364
7388
|
}]);
|
7365
7389
|
}(Ie);
|
7366
|
-
var
|
7367
|
-
function
|
7368
|
-
_classCallCheck(this,
|
7390
|
+
var L = /*#__PURE__*/function () {
|
7391
|
+
function L() {
|
7392
|
+
_classCallCheck(this, L);
|
7369
7393
|
}
|
7370
|
-
return _createClass(
|
7394
|
+
return _createClass(L, null, [{
|
7371
7395
|
key: "buildHeaders",
|
7372
7396
|
value: function buildHeaders(e) {
|
7373
7397
|
return {
|
@@ -7380,7 +7404,7 @@ var I = /*#__PURE__*/function () {
|
|
7380
7404
|
key: "handleVerificationResult",
|
7381
7405
|
value: function handleVerificationResult(e, t, i, s) {
|
7382
7406
|
var r = e;
|
7383
|
-
r.error ? r.error.code === "invalid_api_key" ? s(
|
7407
|
+
r.error ? r.error.code === "invalid_api_key" ? s(M.INVALID_KEY) : s(M.CONNECTION_FAILED) : i(t);
|
7384
7408
|
}
|
7385
7409
|
}, {
|
7386
7410
|
key: "buildKeyVerificationDetails",
|
@@ -7388,7 +7412,7 @@ var I = /*#__PURE__*/function () {
|
|
7388
7412
|
return {
|
7389
7413
|
url: "https://api.openai.com/v1/models",
|
7390
7414
|
method: "GET",
|
7391
|
-
handleVerificationResult:
|
7415
|
+
handleVerificationResult: L.handleVerificationResult
|
7392
7416
|
};
|
7393
7417
|
}
|
7394
7418
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -7430,11 +7454,11 @@ var I = /*#__PURE__*/function () {
|
|
7430
7454
|
}()
|
7431
7455
|
}]);
|
7432
7456
|
}();
|
7433
|
-
var
|
7434
|
-
function
|
7435
|
-
_classCallCheck(this,
|
7457
|
+
var ee = /*#__PURE__*/function () {
|
7458
|
+
function ee() {
|
7459
|
+
_classCallCheck(this, ee);
|
7436
7460
|
}
|
7437
|
-
return _createClass(
|
7461
|
+
return _createClass(ee, null, [{
|
7438
7462
|
key: "storeFiles",
|
7439
7463
|
value: function () {
|
7440
7464
|
var _storeFiles = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t, i, s) {
|
@@ -7460,7 +7484,7 @@ var Q = /*#__PURE__*/function () {
|
|
7460
7484
|
case 0:
|
7461
7485
|
c = new FormData();
|
7462
7486
|
return _context61.abrupt("return", (c.append("purpose", "assistants"), c.append("file", l), new Promise(function (d) {
|
7463
|
-
d(
|
7487
|
+
d(L.directFetch(e, c, "POST", !1));
|
7464
7488
|
})));
|
7465
7489
|
case 2:
|
7466
7490
|
case "end":
|
@@ -7515,7 +7539,7 @@ var Q = /*#__PURE__*/function () {
|
|
7515
7539
|
r = t.map(function (_ref12) {
|
7516
7540
|
var l = _ref12.fileId;
|
7517
7541
|
return e.url = "".concat(i).concat(l).concat(s), new Promise(function (c) {
|
7518
|
-
c(
|
7542
|
+
c(L.directFetch(e, void 0, "GET", !1));
|
7519
7543
|
});
|
7520
7544
|
});
|
7521
7545
|
_context63.next = 3;
|
@@ -7528,7 +7552,7 @@ var Q = /*#__PURE__*/function () {
|
|
7528
7552
|
d({
|
7529
7553
|
src: u.target.result,
|
7530
7554
|
name: t[c].name,
|
7531
|
-
type:
|
7555
|
+
type: ee.getType(t, c)
|
7532
7556
|
});
|
7533
7557
|
};
|
7534
7558
|
});
|
@@ -7570,7 +7594,7 @@ var Q = /*#__PURE__*/function () {
|
|
7570
7594
|
break;
|
7571
7595
|
}
|
7572
7596
|
_context64.next = 5;
|
7573
|
-
return
|
7597
|
+
return ee.getFiles(e, t, a, l);
|
7574
7598
|
case 5:
|
7575
7599
|
o = _context64.sent;
|
7576
7600
|
(c = r == null ? void 0 : r.text) != null && c.value && o.forEach(function (h, u) {
|
@@ -7614,7 +7638,7 @@ var Q = /*#__PURE__*/function () {
|
|
7614
7638
|
l.text && l.text.startsWith("sandbox:") && (c = l.file_path) != null && c.file_id && i.push({
|
7615
7639
|
path: l.text,
|
7616
7640
|
fileId: l.file_path.file_id,
|
7617
|
-
name:
|
7641
|
+
name: ee.getFileName(l.text)
|
7618
7642
|
});
|
7619
7643
|
});
|
7620
7644
|
}), t != null && t.image_file && i.push({
|
@@ -7630,9 +7654,9 @@ var Q = /*#__PURE__*/function () {
|
|
7630
7654
|
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
7631
7655
|
while (1) switch (_context65.prev = _context65.next) {
|
7632
7656
|
case 0:
|
7633
|
-
r =
|
7657
|
+
r = ee.getFileDetails(t, s);
|
7634
7658
|
_context65.next = 3;
|
7635
|
-
return
|
7659
|
+
return ee.getFilesAndNewText(e, r, i, t.role, s);
|
7636
7660
|
case 3:
|
7637
7661
|
return _context65.abrupt("return", _context65.sent);
|
7638
7662
|
case 4:
|
@@ -7676,7 +7700,7 @@ var Q = /*#__PURE__*/function () {
|
|
7676
7700
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
7677
7701
|
while (1) switch (_context66.prev = _context66.next) {
|
7678
7702
|
case 0:
|
7679
|
-
s.push(
|
7703
|
+
s.push(ee.getFilesAndText(e, r, i, o));
|
7680
7704
|
case 1:
|
7681
7705
|
case "end":
|
7682
7706
|
return _context66.stop();
|
@@ -7705,7 +7729,7 @@ var Q = /*#__PURE__*/function () {
|
|
7705
7729
|
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
7706
7730
|
while (1) switch (_context68.prev = _context68.next) {
|
7707
7731
|
case 0:
|
7708
|
-
return _context68.abrupt("return",
|
7732
|
+
return _context68.abrupt("return", ee.parseMessages(e, [{
|
7709
7733
|
content: t,
|
7710
7734
|
role: "assistant"
|
7711
7735
|
}], i));
|
@@ -7728,8 +7752,8 @@ var Q = /*#__PURE__*/function () {
|
|
7728
7752
|
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
7729
7753
|
while (1) switch (_context69.prev = _context69.next) {
|
7730
7754
|
case 0:
|
7731
|
-
r =
|
7732
|
-
return _context69.abrupt("return",
|
7755
|
+
r = ee.parseResult(t, i);
|
7756
|
+
return _context69.abrupt("return", ee.parseMessages(e, r, s));
|
7733
7757
|
case 2:
|
7734
7758
|
case "end":
|
7735
7759
|
return _context69.stop();
|
@@ -7743,13 +7767,13 @@ var Q = /*#__PURE__*/function () {
|
|
7743
7767
|
}()
|
7744
7768
|
}]);
|
7745
7769
|
}();
|
7746
|
-
|
7747
|
-
var ye =
|
7748
|
-
var Ne = /*#__PURE__*/function (
|
7770
|
+
ee.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", ee.FUNCTION_TOOL_RESP_ERROR = "Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.";
|
7771
|
+
var ye = ee;
|
7772
|
+
var Ne = /*#__PURE__*/function (_z3) {
|
7749
7773
|
function Ne(e, t, i, s) {
|
7750
7774
|
var _this31;
|
7751
7775
|
_classCallCheck(this, Ne);
|
7752
|
-
if (_this31 = _callSuper(this, Ne, [e,
|
7776
|
+
if (_this31 = _callSuper(this, Ne, [e, L.buildKeyVerificationDetails(), L.buildHeaders, s]), _this31.insertKeyPlaceholderText = "OpenAI API Key", _this31.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this31.url = "", _this31.permittedErrorPrefixes = ["Incorrect", "Please send text", Ht.FAILED_ERROR_MESSAGE], _this31.shouldFetchHistory = !1, _this31.searchedForThreadId = !1, _this31.config = {}, _this31.newAssistantDetails = {
|
7753
7777
|
model: "gpt-4"
|
7754
7778
|
}, _this31.waitingForStreamResponse = !1, _this31.isSSEStream = !1, _this31.urlSegments = i, _typeof(t) == "object") {
|
7755
7779
|
_this31.config = t;
|
@@ -7764,7 +7788,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
7764
7788
|
_this31.maxMessages = 1, _this31.isSSEStream = !!(_this31.stream && (_typeof(_this31.stream) != "object" || !_this31.stream.simulation));
|
7765
7789
|
return _assertThisInitialized(_this31);
|
7766
7790
|
}
|
7767
|
-
_inherits(Ne,
|
7791
|
+
_inherits(Ne, _z3);
|
7768
7792
|
return _createClass(Ne, [{
|
7769
7793
|
key: "fetchHistoryFunc",
|
7770
7794
|
value: function () {
|
@@ -7818,7 +7842,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
7818
7842
|
if (r === "code_interpreter") return Ne.processAttachmentsMessage(s, t, "code_interpreter");
|
7819
7843
|
if (t.find(function (_ref16) {
|
7820
7844
|
var a = _ref16.name;
|
7821
|
-
return !
|
7845
|
+
return !B.isImageFileExtension(a);
|
7822
7846
|
})) 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
7847
|
var _a2 = Ne.processImageMessage(s, t);
|
7824
7848
|
if (_a2) return _a2;
|
@@ -7924,7 +7948,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
7924
7948
|
_context72.prev = 0;
|
7925
7949
|
this.url = this.urlSegments.newAssistantUrl;
|
7926
7950
|
_context72.next = 4;
|
7927
|
-
return
|
7951
|
+
return L.directFetch(this, JSON.parse(JSON.stringify(this.newAssistantDetails)), "POST");
|
7928
7952
|
case 4:
|
7929
7953
|
_e3 = _context72.sent;
|
7930
7954
|
return _context72.abrupt("return", (this.config.assistant_id = _e3.id, this.config.assistant_id));
|
@@ -8010,7 +8034,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8010
8034
|
}
|
8011
8035
|
this.url = "".concat(this.urlSegments.threadsPrefix, "/").concat(this.sessionId, "/runs").concat(this.urlSegments.threadsPosfix);
|
8012
8036
|
_context74.next = 4;
|
8013
|
-
return
|
8037
|
+
return L.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
|
8014
8038
|
case 4:
|
8015
8039
|
t = _context74.sent;
|
8016
8040
|
this.run_id = t.id;
|
@@ -8044,7 +8068,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8044
8068
|
t = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : !1;
|
8045
8069
|
this.url = "".concat(this.urlSegments.threadsPrefix, "/").concat(e, "/messages?").concat(this.urlSegments.listMessagesPostfix);
|
8046
8070
|
_context75.next = 4;
|
8047
|
-
return
|
8071
|
+
return L.directFetch(this, {}, "GET");
|
8048
8072
|
case 4:
|
8049
8073
|
i = _context75.sent;
|
8050
8074
|
_context75.t0 = !t && this.deepChat.responseInterceptor;
|
@@ -8192,7 +8216,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8192
8216
|
break;
|
8193
8217
|
case 20:
|
8194
8218
|
_context77.next = 22;
|
8195
|
-
return
|
8219
|
+
return L.directFetch(this, {
|
8196
8220
|
tool_outputs: r
|
8197
8221
|
}, "POST");
|
8198
8222
|
case 22:
|
@@ -8336,7 +8360,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8336
8360
|
e.stream = !0;
|
8337
8361
|
this.waitingForStreamResponse = !0;
|
8338
8362
|
_context80.next = 4;
|
8339
|
-
return
|
8363
|
+
return A.request(this, e, this.messages, !0, !0);
|
8340
8364
|
case 4:
|
8341
8365
|
this.messageStream = _context80.sent;
|
8342
8366
|
case 5:
|
@@ -8354,7 +8378,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8354
8378
|
key: "processImageMessage",
|
8355
8379
|
value: function processImageMessage(e, t) {
|
8356
8380
|
var i = t == null ? void 0 : t.filter(function (s) {
|
8357
|
-
return
|
8381
|
+
return B.isImageFileExtension(s.name);
|
8358
8382
|
}).map(function (s) {
|
8359
8383
|
return {
|
8360
8384
|
type: "image_file",
|
@@ -8391,7 +8415,7 @@ var Ne = /*#__PURE__*/function (_q3) {
|
|
8391
8415
|
};
|
8392
8416
|
}
|
8393
8417
|
}]);
|
8394
|
-
}(
|
8418
|
+
}(z);
|
8395
8419
|
Ne.POLLING_TIMEOUT_MS = 800;
|
8396
8420
|
var yi = Ne;
|
8397
8421
|
var Ii = /*#__PURE__*/function (_yi) {
|
@@ -8438,7 +8462,7 @@ var Ei = /*#__PURE__*/function () {
|
|
8438
8462
|
key: "handleVerificationResult",
|
8439
8463
|
value: function handleVerificationResult(e, t, i, s) {
|
8440
8464
|
var o;
|
8441
|
-
(o = e.message) != null && o.includes("invalid request: prompt must be at least 1 token long") ? i(t) : s(
|
8465
|
+
(o = e.message) != null && o.includes("invalid request: prompt must be at least 1 token long") ? i(t) : s(M.INVALID_KEY);
|
8442
8466
|
}
|
8443
8467
|
}, {
|
8444
8468
|
key: "buildKeyVerificationDetails",
|
@@ -8454,16 +8478,16 @@ var Ei = /*#__PURE__*/function () {
|
|
8454
8478
|
}
|
8455
8479
|
}]);
|
8456
8480
|
}();
|
8457
|
-
var Ts = /*#__PURE__*/function (
|
8481
|
+
var Ts = /*#__PURE__*/function (_z4) {
|
8458
8482
|
function Ts(e, t, i, s, r) {
|
8459
8483
|
var _this35;
|
8460
8484
|
_classCallCheck(this, Ts);
|
8461
8485
|
_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
8486
|
return _this35;
|
8463
8487
|
}
|
8464
|
-
_inherits(Ts,
|
8488
|
+
_inherits(Ts, _z4);
|
8465
8489
|
return _createClass(Ts);
|
8466
|
-
}(
|
8490
|
+
}(z);
|
8467
8491
|
var Fo = /*#__PURE__*/function (_Ts) {
|
8468
8492
|
function Fo(e) {
|
8469
8493
|
_classCallCheck(this, Fo);
|
@@ -8557,7 +8581,7 @@ var Ls = /*#__PURE__*/function () {
|
|
8557
8581
|
return {
|
8558
8582
|
url: "".concat(e.endpoint, "/openai/models?api-version=").concat(e.version),
|
8559
8583
|
method: "GET",
|
8560
|
-
handleVerificationResult:
|
8584
|
+
handleVerificationResult: L.handleVerificationResult
|
8561
8585
|
};
|
8562
8586
|
}
|
8563
8587
|
}, {
|
@@ -8682,7 +8706,7 @@ var Bo = /*#__PURE__*/function (_Ts2) {
|
|
8682
8706
|
}()
|
8683
8707
|
}]);
|
8684
8708
|
}(Ts);
|
8685
|
-
var gt = /*#__PURE__*/function (
|
8709
|
+
var gt = /*#__PURE__*/function (_z5) {
|
8686
8710
|
function gt(e) {
|
8687
8711
|
var _o$model, _a$voice;
|
8688
8712
|
var _this37;
|
@@ -8690,12 +8714,12 @@ var gt = /*#__PURE__*/function (_q5) {
|
|
8690
8714
|
var r, o, a;
|
8691
8715
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8692
8716
|
i = t == null ? void 0 : t.openAI;
|
8693
|
-
_this37 = _callSuper(this, gt, [e,
|
8717
|
+
_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
8718
|
var s = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.textToSpeech;
|
8695
8719
|
_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
8720
|
return _this37;
|
8697
8721
|
}
|
8698
|
-
_inherits(gt,
|
8722
|
+
_inherits(gt, _z5);
|
8699
8723
|
return _createClass(gt, [{
|
8700
8724
|
key: "preprocessBody",
|
8701
8725
|
value: function preprocessBody(e, t) {
|
@@ -8776,10 +8800,10 @@ var gt = /*#__PURE__*/function (_q5) {
|
|
8776
8800
|
return extractResultData;
|
8777
8801
|
}()
|
8778
8802
|
}]);
|
8779
|
-
}(
|
8803
|
+
}(z);
|
8780
8804
|
gt.DEFAULT_MODEL = "tts-1", gt.DEFAULT_VOIDE = "alloy";
|
8781
8805
|
var us = gt;
|
8782
|
-
var ce = /*#__PURE__*/function (
|
8806
|
+
var ce = /*#__PURE__*/function (_z6) {
|
8783
8807
|
function ce(e) {
|
8784
8808
|
var _o$model2;
|
8785
8809
|
var _this38;
|
@@ -8787,14 +8811,14 @@ var ce = /*#__PURE__*/function (_q6) {
|
|
8787
8811
|
var r, o;
|
8788
8812
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8789
8813
|
i = t == null ? void 0 : t.openAI;
|
8790
|
-
_this38 = _callSuper(this, ce, [e,
|
8814
|
+
_this38 = _callSuper(this, ce, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, {
|
8791
8815
|
audio: {}
|
8792
8816
|
}]), _this38.insertKeyPlaceholderText = "OpenAI API Key", _this38.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this38.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this38.url = "", _this38.permittedErrorPrefixes = ["Invalid"], _this38.textInputPlaceholderText = "Upload an audio file", _this38._service_url = ce.AUDIO_TRANSCRIPTIONS_URL;
|
8793
8817
|
var s = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
8794
8818
|
_typeof(s) == "object" && (_this38.processConfig(s), ce.cleanConfig(s), Object.assign(_this38.rawBody, s)), (_o$model2 = (o = _this38.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = ce.DEFAULT_MODEL, _this38.rawBody.response_format = "json", _this38.canSendMessage = ce.canSendFileMessage;
|
8795
8819
|
return _this38;
|
8796
8820
|
}
|
8797
|
-
_inherits(ce,
|
8821
|
+
_inherits(ce, _z6);
|
8798
8822
|
return _createClass(ce, [{
|
8799
8823
|
key: "processConfig",
|
8800
8824
|
value: function processConfig(e) {
|
@@ -8889,14 +8913,14 @@ var ce = /*#__PURE__*/function (_q6) {
|
|
8889
8913
|
}), i;
|
8890
8914
|
}
|
8891
8915
|
}]);
|
8892
|
-
}(
|
8916
|
+
}(z);
|
8893
8917
|
ce.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", ce.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", ce.DEFAULT_MODEL = "whisper-1";
|
8894
8918
|
var fs = ce;
|
8895
|
-
var
|
8896
|
-
function
|
8897
|
-
_classCallCheck(this,
|
8919
|
+
var oe = /*#__PURE__*/function () {
|
8920
|
+
function oe() {
|
8921
|
+
_classCallCheck(this, oe);
|
8898
8922
|
}
|
8899
|
-
return _createClass(
|
8923
|
+
return _createClass(oe, null, [{
|
8900
8924
|
key: "buildTextToSpeechHeaders",
|
8901
8925
|
value: function buildTextToSpeechHeaders(e, t) {
|
8902
8926
|
return {
|
@@ -8917,7 +8941,7 @@ var re = /*#__PURE__*/function () {
|
|
8917
8941
|
}, {
|
8918
8942
|
key: "handleSpeechVerificationResult",
|
8919
8943
|
value: function handleSpeechVerificationResult(e, t, i, s) {
|
8920
|
-
e.error ? s(
|
8944
|
+
e.error ? s(M.INVALID_KEY) : i(t);
|
8921
8945
|
}
|
8922
8946
|
}, {
|
8923
8947
|
key: "buildSpeechKeyVerificationDetails",
|
@@ -8930,7 +8954,7 @@ var re = /*#__PURE__*/function () {
|
|
8930
8954
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
8931
8955
|
};
|
8932
8956
|
},
|
8933
|
-
handleVerificationResult:
|
8957
|
+
handleVerificationResult: oe.handleSpeechVerificationResult
|
8934
8958
|
};
|
8935
8959
|
}
|
8936
8960
|
}, {
|
@@ -8946,7 +8970,7 @@ var re = /*#__PURE__*/function () {
|
|
8946
8970
|
key: "handleLanguageVerificationResult",
|
8947
8971
|
value: function handleLanguageVerificationResult(e, t, i, s) {
|
8948
8972
|
var o;
|
8949
|
-
((o = e.error) == null ? void 0 : o.code) === "401" ? s(
|
8973
|
+
((o = e.error) == null ? void 0 : o.code) === "401" ? s(M.INVALID_KEY) : i(t);
|
8950
8974
|
}
|
8951
8975
|
}, {
|
8952
8976
|
key: "buildLanguageKeyVerificationDetails",
|
@@ -8959,7 +8983,7 @@ var re = /*#__PURE__*/function () {
|
|
8959
8983
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
8960
8984
|
};
|
8961
8985
|
},
|
8962
|
-
handleVerificationResult:
|
8986
|
+
handleVerificationResult: oe.handleLanguageVerificationResult
|
8963
8987
|
};
|
8964
8988
|
}
|
8965
8989
|
// prettier-ignore
|
@@ -8967,7 +8991,7 @@ var re = /*#__PURE__*/function () {
|
|
8967
8991
|
key: "handleTranslationVerificationResult",
|
8968
8992
|
value: function handleTranslationVerificationResult(e, t, i, s) {
|
8969
8993
|
e.json().then(function (o) {
|
8970
|
-
!Array.isArray(o) && o.error.code === 401e3 ? s(
|
8994
|
+
!Array.isArray(o) && o.error.code === 401e3 ? s(M.INVALID_KEY) : i(t);
|
8971
8995
|
});
|
8972
8996
|
}
|
8973
8997
|
}, {
|
@@ -8977,9 +9001,9 @@ var re = /*#__PURE__*/function () {
|
|
8977
9001
|
url: "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",
|
8978
9002
|
method: "POST",
|
8979
9003
|
createHeaders: function createHeaders(t) {
|
8980
|
-
return
|
9004
|
+
return oe.buildTranslationHeaders(e, t);
|
8981
9005
|
},
|
8982
|
-
handleVerificationResult:
|
9006
|
+
handleVerificationResult: oe.handleTranslationVerificationResult
|
8983
9007
|
};
|
8984
9008
|
}
|
8985
9009
|
}, {
|
@@ -8993,19 +9017,19 @@ var re = /*#__PURE__*/function () {
|
|
8993
9017
|
}
|
8994
9018
|
}]);
|
8995
9019
|
}();
|
8996
|
-
var Uo = /*#__PURE__*/function (
|
9020
|
+
var Uo = /*#__PURE__*/function (_z7) {
|
8997
9021
|
// prettier-ignore
|
8998
9022
|
function Uo(e, t, i, s, r) {
|
8999
9023
|
var _this39;
|
9000
9024
|
_classCallCheck(this, Uo);
|
9001
|
-
_this39 = _callSuper(this, Uo, [e,
|
9025
|
+
_this39 = _callSuper(this, Uo, [e, oe.buildLanguageKeyVerificationDetails(i), t, s, r]), _this39.insertKeyPlaceholderText = "Azure Language Subscription Key", _this39.keyHelpUrl =
|
9002
9026
|
// eslint-disable-next-line max-len
|
9003
9027
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this39.permittedErrorPrefixes = ["Access"];
|
9004
9028
|
return _this39;
|
9005
9029
|
}
|
9006
|
-
_inherits(Uo,
|
9030
|
+
_inherits(Uo, _z7);
|
9007
9031
|
return _createClass(Uo);
|
9008
|
-
}(
|
9032
|
+
}(z);
|
9009
9033
|
var Dt = /*#__PURE__*/function (_Uo) {
|
9010
9034
|
function Dt(e) {
|
9011
9035
|
var _a$language;
|
@@ -9014,7 +9038,7 @@ var Dt = /*#__PURE__*/function (_Uo) {
|
|
9014
9038
|
var s, r, o, a;
|
9015
9039
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.summarization,
|
9016
9040
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
9017
|
-
_this40 = _callSuper(this, Dt, [e,
|
9041
|
+
_this40 = _callSuper(this, Dt, [e, oe.buildSummarizationHeader, t.endpoint, i]), _this40.permittedErrorPrefixes = [Dt.ENDPOINT_ERROR_MESSAGE], _this40.url = "", _this40.textInputPlaceholderText = "Insert text to summarize", _this40.isTextInputDisabled = !1, t.endpoint ? ((_a$language = (a = _this40.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this40.rawBody, t), _this40.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview")) : (_this40.isTextInputDisabled = !0, _this40.canSendMessage = function () {
|
9018
9042
|
return !1;
|
9019
9043
|
}, setTimeout(function () {
|
9020
9044
|
e.addMessage({
|
@@ -9261,7 +9285,7 @@ var It = /*#__PURE__*/function () {
|
|
9261
9285
|
key: "handleVerificationResult",
|
9262
9286
|
value: function handleVerificationResult(e, t, i, s) {
|
9263
9287
|
var r = e;
|
9264
|
-
r.error ? r.error.code === "invalid_api_key" ? s(
|
9288
|
+
r.error ? r.error.code === "invalid_api_key" ? s(M.INVALID_KEY) : s(M.CONNECTION_FAILED) : i(t);
|
9265
9289
|
}
|
9266
9290
|
}, {
|
9267
9291
|
key: "buildKeyVerificationDetails",
|
@@ -9274,7 +9298,7 @@ var It = /*#__PURE__*/function () {
|
|
9274
9298
|
}
|
9275
9299
|
}]);
|
9276
9300
|
}();
|
9277
|
-
var Cs = /*#__PURE__*/function (
|
9301
|
+
var Cs = /*#__PURE__*/function (_z8) {
|
9278
9302
|
function Cs(e) {
|
9279
9303
|
var _this41;
|
9280
9304
|
_classCallCheck(this, Cs);
|
@@ -9285,7 +9309,7 @@ var Cs = /*#__PURE__*/function (_q8) {
|
|
9285
9309
|
}]), _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
9310
|
return _this41;
|
9287
9311
|
}
|
9288
|
-
_inherits(Cs,
|
9312
|
+
_inherits(Cs, _z8);
|
9289
9313
|
return _createClass(Cs, [{
|
9290
9314
|
key: "callServiceAPI",
|
9291
9315
|
value: function () {
|
@@ -9357,20 +9381,20 @@ var Cs = /*#__PURE__*/function (_q8) {
|
|
9357
9381
|
return !!(t != null && t[0]);
|
9358
9382
|
}
|
9359
9383
|
}]);
|
9360
|
-
}(
|
9361
|
-
var _n = /*#__PURE__*/function (
|
9384
|
+
}(z);
|
9385
|
+
var _n = /*#__PURE__*/function (_z9) {
|
9362
9386
|
// prettier-ignore
|
9363
9387
|
function _n(e, t, i, s, r) {
|
9364
9388
|
var _this42;
|
9365
9389
|
_classCallCheck(this, _n);
|
9366
|
-
_this42 = _callSuper(this, _n, [e,
|
9390
|
+
_this42 = _callSuper(this, _n, [e, oe.buildSpeechKeyVerificationDetails(i), t, s, r]), _this42.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this42.keyHelpUrl =
|
9367
9391
|
// eslint-disable-next-line max-len
|
9368
9392
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
9369
9393
|
return _this42;
|
9370
9394
|
}
|
9371
|
-
_inherits(_n,
|
9395
|
+
_inherits(_n, _z9);
|
9372
9396
|
return _createClass(_n);
|
9373
|
-
}(
|
9397
|
+
}(z);
|
9374
9398
|
var Je = /*#__PURE__*/function (_n2) {
|
9375
9399
|
// prettier-ignore
|
9376
9400
|
function Je(e) {
|
@@ -9380,7 +9404,7 @@ var Je = /*#__PURE__*/function (_n2) {
|
|
9380
9404
|
var s, r, o, a, l, c;
|
9381
9405
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.textToSpeech,
|
9382
9406
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
9383
|
-
_this43 = _callSuper(this, Je, [e,
|
9407
|
+
_this43 = _callSuper(this, Je, [e, oe.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i]), _this43.permittedErrorPrefixes = [Je.REGION_ERROR_MESSAGE], _this43.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(Je.HELP_LINK, "\">here</a> for more info.\n </p>"), _this43.isTextInputDisabled = !1, _this43.url = "", t.region ? (Object.assign(_this43.rawBody, t), (_a$lang = (a = _this43.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this43.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this43.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this43.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1")) : (_this43.isTextInputDisabled = !0, _this43.canSendMessage = function () {
|
9384
9408
|
return !1;
|
9385
9409
|
}, setTimeout(function () {
|
9386
9410
|
e.addMessage({
|
@@ -9474,7 +9498,7 @@ var De = /*#__PURE__*/function (_n3) {
|
|
9474
9498
|
}
|
9475
9499
|
}
|
9476
9500
|
};
|
9477
|
-
if (_this44 = _callSuper(this, De, [e,
|
9501
|
+
if (_this44 = _callSuper(this, De, [e, oe.buildSpeechToTextHeaders, t.region, i, s]), _this44.permittedErrorPrefixes = [De.REGION_ERROR_MESSAGE], _this44.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(De.HELP_LINK, "\">here</a> for more info.\n </p>"), _this44.url = "", _this44.isTextInputDisabled = !0, _this44.textInputPlaceholderText = "Upload an audio file", !t.region) _this44.isTextInputDisabled = !0, _this44.canSendMessage = function () {
|
9478
9502
|
return !1;
|
9479
9503
|
}, setTimeout(function () {
|
9480
9504
|
e.addMessage({
|
@@ -9560,7 +9584,7 @@ De.HELP_LINK =
|
|
9560
9584
|
// eslint-disable-next-line max-len
|
9561
9585
|
"Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#SpeechToText)";
|
9562
9586
|
var gs = De;
|
9563
|
-
var jo = /*#__PURE__*/function (
|
9587
|
+
var jo = /*#__PURE__*/function (_z10) {
|
9564
9588
|
// prettier-ignore
|
9565
9589
|
function jo(e) {
|
9566
9590
|
var _this45;
|
@@ -9568,12 +9592,12 @@ var jo = /*#__PURE__*/function (_q10) {
|
|
9568
9592
|
var s, r, o;
|
9569
9593
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.translation,
|
9570
9594
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
9571
|
-
_this45 = _callSuper(this, jo, [e,
|
9595
|
+
_this45 = _callSuper(this, jo, [e, oe.buildTranslationKeyVerificationDetails(t.region), oe.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i]), _this45.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this45.keyHelpUrl =
|
9572
9596
|
// eslint-disable-next-line max-len
|
9573
9597
|
"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
9598
|
return _this45;
|
9575
9599
|
}
|
9576
|
-
_inherits(jo,
|
9600
|
+
_inherits(jo, _z10);
|
9577
9601
|
return _createClass(jo, [{
|
9578
9602
|
key: "preprocessBody",
|
9579
9603
|
value: function preprocessBody(e) {
|
@@ -9638,8 +9662,8 @@ var jo = /*#__PURE__*/function (_q10) {
|
|
9638
9662
|
return extractResultData;
|
9639
9663
|
}()
|
9640
9664
|
}]);
|
9641
|
-
}(
|
9642
|
-
var vt = /*#__PURE__*/function (
|
9665
|
+
}(z);
|
9666
|
+
var vt = /*#__PURE__*/function (_z11) {
|
9643
9667
|
// prettier-ignore
|
9644
9668
|
function vt(e, t, i, s, r) {
|
9645
9669
|
var _this46$maxMessages, _m$model;
|
@@ -9647,8 +9671,8 @@ var vt = /*#__PURE__*/function (_q11) {
|
|
9647
9671
|
_classCallCheck(this, vt);
|
9648
9672
|
var h, u, f, m;
|
9649
9673
|
var o = JSON.parse(JSON.stringify(e.directConnection)),
|
9650
|
-
a = t ||
|
9651
|
-
l = i ||
|
9674
|
+
a = t || L.buildKeyVerificationDetails(),
|
9675
|
+
l = i || L.buildHeaders,
|
9652
9676
|
c = s || o.openAI;
|
9653
9677
|
_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
9678
|
var d = r || ((h = o.openAI) == null ? void 0 : h.chat);
|
@@ -9661,7 +9685,7 @@ var vt = /*#__PURE__*/function (_q11) {
|
|
9661
9685
|
(_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
9686
|
return _this46;
|
9663
9687
|
}
|
9664
|
-
_inherits(vt,
|
9688
|
+
_inherits(vt, _z11);
|
9665
9689
|
return _createClass(vt, [{
|
9666
9690
|
key: "cleanConfig",
|
9667
9691
|
value: function cleanConfig(e) {
|
@@ -9699,7 +9723,7 @@ var vt = /*#__PURE__*/function (_q11) {
|
|
9699
9723
|
throw new Error("Request settings have not been set up");
|
9700
9724
|
case 2:
|
9701
9725
|
i = this.preprocessBody(this.rawBody, t), s = this.stream;
|
9702
|
-
s && (_typeof(s) != "object" || !s.simulation) || i.stream ? (i.stream = !0,
|
9726
|
+
s && (_typeof(s) != "object" || !s.simulation) || i.stream ? (i.stream = !0, A.request(this, i, e)) : T.request(this, i, e);
|
9703
9727
|
case 4:
|
9704
9728
|
case "end":
|
9705
9729
|
return _context101.stop();
|
@@ -9915,7 +9939,7 @@ var vt = /*#__PURE__*/function (_q11) {
|
|
9915
9939
|
return e.text;
|
9916
9940
|
}
|
9917
9941
|
}]);
|
9918
|
-
}(
|
9942
|
+
}(z);
|
9919
9943
|
var As = /*#__PURE__*/function (_vt) {
|
9920
9944
|
function As(e) {
|
9921
9945
|
var _this48;
|
@@ -9945,7 +9969,7 @@ var As = /*#__PURE__*/function (_vt) {
|
|
9945
9969
|
}
|
9946
9970
|
}]);
|
9947
9971
|
}(vt);
|
9948
|
-
var de = /*#__PURE__*/function (
|
9972
|
+
var de = /*#__PURE__*/function (_z12) {
|
9949
9973
|
function de(e) {
|
9950
9974
|
var _this49;
|
9951
9975
|
_classCallCheck(this, de);
|
@@ -9960,7 +9984,7 @@ var de = /*#__PURE__*/function (_q12) {
|
|
9960
9984
|
}
|
9961
9985
|
}
|
9962
9986
|
};
|
9963
|
-
_this49 = _callSuper(this, de, [e,
|
9987
|
+
_this49 = _callSuper(this, de, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, s]), _this49.insertKeyPlaceholderText = "OpenAI API Key", _this49.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this49.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this49.url = "", _this49.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
|
9964
9988
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
9965
9989
|
if (_this49.camera) {
|
9966
9990
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
@@ -9974,7 +9998,7 @@ var de = /*#__PURE__*/function (_q12) {
|
|
9974
9998
|
_typeof(r) == "object" && Object.assign(_this49.rawBody, r), _this49.canSendMessage = de.canFileSendMessage;
|
9975
9999
|
return _this49;
|
9976
10000
|
}
|
9977
|
-
_inherits(de,
|
10001
|
+
_inherits(de, _z12);
|
9978
10002
|
return _createClass(de, [{
|
9979
10003
|
key: "preprocessBody",
|
9980
10004
|
value: function preprocessBody(e, t) {
|
@@ -10094,7 +10118,7 @@ var de = /*#__PURE__*/function (_q12) {
|
|
10094
10118
|
}), s;
|
10095
10119
|
}
|
10096
10120
|
}]);
|
10097
|
-
}(
|
10121
|
+
}(z);
|
10098
10122
|
de.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", de.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", de.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
10099
10123
|
var bs = de;
|
10100
10124
|
var Ho = /*#__PURE__*/function (_Ts3) {
|
@@ -10198,7 +10222,7 @@ var xi = /*#__PURE__*/function () {
|
|
10198
10222
|
key: "handleVerificationResult",
|
10199
10223
|
value: function handleVerificationResult(e, t, i, s) {
|
10200
10224
|
var o;
|
10201
|
-
(o = e.message) != null && o.includes("invalid request: prompt must be at least 1 token long") ? i(t) : s(
|
10225
|
+
(o = e.message) != null && o.includes("invalid request: prompt must be at least 1 token long") ? i(t) : s(M.INVALID_KEY);
|
10202
10226
|
}
|
10203
10227
|
}, {
|
10204
10228
|
key: "buildKeyVerificationDetails",
|
@@ -10211,7 +10235,7 @@ var xi = /*#__PURE__*/function () {
|
|
10211
10235
|
}
|
10212
10236
|
}]);
|
10213
10237
|
}();
|
10214
|
-
var qo = /*#__PURE__*/function (
|
10238
|
+
var qo = /*#__PURE__*/function (_z13) {
|
10215
10239
|
function qo(e) {
|
10216
10240
|
var _this51$maxMessages, _s$model;
|
10217
10241
|
var _this51;
|
@@ -10221,7 +10245,7 @@ var qo = /*#__PURE__*/function (_q13) {
|
|
10221
10245
|
_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
10246
|
return _this51;
|
10223
10247
|
}
|
10224
|
-
_inherits(qo,
|
10248
|
+
_inherits(qo, _z13);
|
10225
10249
|
return _createClass(qo, [{
|
10226
10250
|
key: "cleanConfig",
|
10227
10251
|
value: function cleanConfig(e) {
|
@@ -10297,7 +10321,7 @@ var qo = /*#__PURE__*/function (_q13) {
|
|
10297
10321
|
return extractResultData;
|
10298
10322
|
}()
|
10299
10323
|
}]);
|
10300
|
-
}(
|
10324
|
+
}(z);
|
10301
10325
|
var zo = /*#__PURE__*/function () {
|
10302
10326
|
function zo() {
|
10303
10327
|
_classCallCheck(this, zo);
|
@@ -10428,7 +10452,7 @@ var Pe = /*#__PURE__*/function () {
|
|
10428
10452
|
key: "createImage",
|
10429
10453
|
value: function createImage(e, t, i) {
|
10430
10454
|
var s = new Image();
|
10431
|
-
return s.src = e.src, i ||
|
10455
|
+
return s.src = e.src, i || B.scrollDownOnImageLoad(s.src, t), B.processContent("image", s, s.src, e.name);
|
10432
10456
|
}
|
10433
10457
|
// WORK - image still does not scroll down when loaded
|
10434
10458
|
}, {
|
@@ -10440,7 +10464,7 @@ var Pe = /*#__PURE__*/function () {
|
|
10440
10464
|
while (1) switch (_context111.prev = _context111.next) {
|
10441
10465
|
case 0:
|
10442
10466
|
r = Pe.createImage(t, e.elementRef, s), o = e.createNewMessageElement("", i);
|
10443
|
-
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("image-message"),
|
10467
|
+
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("image-message"), B.addMessage(e, o, "image", i, s);
|
10444
10468
|
case 2:
|
10445
10469
|
case "end":
|
10446
10470
|
return _context111.stop();
|
@@ -10463,7 +10487,7 @@ var Pe = /*#__PURE__*/function () {
|
|
10463
10487
|
value: function addNewAudioMessage(e, t, i, s) {
|
10464
10488
|
var r = Pe.createAudioElement(t, i),
|
10465
10489
|
o = e.createMessageElementsOnOrientation("", i, s);
|
10466
|
-
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"),
|
10490
|
+
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"), B.addMessage(e, o, "audio", i, s);
|
10467
10491
|
}
|
10468
10492
|
}, {
|
10469
10493
|
key: "createAnyFile",
|
@@ -10472,24 +10496,24 @@ var Pe = /*#__PURE__*/function () {
|
|
10472
10496
|
t.classList.add("any-file-message-contents");
|
10473
10497
|
var i = document.createElement("div");
|
10474
10498
|
i.classList.add("any-file-message-icon-container");
|
10475
|
-
var s =
|
10499
|
+
var s = ie.createSVGElement(Vo);
|
10476
10500
|
s.classList.add("any-file-message-icon"), i.appendChild(s);
|
10477
10501
|
var r = document.createElement("div");
|
10478
|
-
return r.classList.add("any-file-message-text"), r.textContent = e.name ||
|
10502
|
+
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
10503
|
}
|
10480
10504
|
}, {
|
10481
10505
|
key: "addNewAnyFileMessage",
|
10482
10506
|
value: function addNewAnyFileMessage(e, t, i, s) {
|
10483
10507
|
var r = e.createMessageElementsOnOrientation("", i, s),
|
10484
10508
|
o = Pe.createAnyFile(t);
|
10485
|
-
r.bubbleElement.classList.add("any-file-message-bubble"), r.bubbleElement.appendChild(o),
|
10509
|
+
r.bubbleElement.classList.add("any-file-message-bubble"), r.bubbleElement.appendChild(o), B.addMessage(e, r, "file", i, s);
|
10486
10510
|
}
|
10487
10511
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
10488
10512
|
}, {
|
10489
10513
|
key: "addMessages",
|
10490
10514
|
value: function addMessages(e, t, i, s) {
|
10491
10515
|
t.forEach(function (r) {
|
10492
|
-
r.ref && (r =
|
10516
|
+
r.ref && (r = B.removeFileRef(r)), B.isAudioFile(r) ? Pe.addNewAudioMessage(e, r, i, s) : B.isImageFile(r) ? Pe.addNewImageMessage(e, r, i, s) : Pe.addNewAnyFileMessage(e, r, i, s);
|
10493
10517
|
});
|
10494
10518
|
}
|
10495
10519
|
}]);
|
@@ -10505,7 +10529,7 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10505
10529
|
o = t.demo;
|
10506
10530
|
_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
10531
|
return JSON.parse(JSON.stringify(_this52.messages));
|
10508
|
-
}, e.clearMessages = _this52.clearMessages.bind(_this52, t), e.refreshMessages = _this52.refreshTextMessages.bind(_this52), e.scrollToBottom =
|
10532
|
+
}, 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
10533
|
_this52.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
|
10510
10534
|
sendUpdate: !!d
|
10511
10535
|
}), !d);
|
@@ -10606,13 +10630,13 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10606
10630
|
var c, d, h, u, f;
|
10607
10631
|
this.removeMessageOnError();
|
10608
10632
|
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);
|
10633
|
+
r = this.createMessageElementsOnOrientation(s, "error", i);
|
10610
10634
|
b.hideRoleElements(this.messageElementRefs, !!this._avatars, !!this._names);
|
10611
10635
|
var o = r.bubbleElement,
|
10612
10636
|
a = r.outerContainer;
|
10613
10637
|
o.classList.add("error-message-text"), this.renderText(o, s);
|
10614
|
-
var l =
|
10615
|
-
|
10638
|
+
var l = q.extractParticularSharedStyles(["fontSize", "fontFamily"], (h = this.messageStyles) == null ? void 0 : h["default"]);
|
10639
|
+
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
10640
|
}
|
10617
10641
|
}, {
|
10618
10642
|
key: "getPermittedMessage",
|
@@ -10652,12 +10676,12 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10652
10676
|
if (!this._displayLoadingMessage) return;
|
10653
10677
|
var e = (r = (s = (i = this.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.message) == null ? void 0 : r.html,
|
10654
10678
|
t = e ? Be.createElements(this, e, b.AI_ROLE, !1) : this.addDefaultLoadingMessage();
|
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),
|
10679
|
+
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
10680
|
}
|
10657
10681
|
}, {
|
10658
10682
|
key: "populateIntroPanel",
|
10659
10683
|
value: function populateIntroPanel(e, t, i) {
|
10660
|
-
(e || t) && (this._introPanel = new Si(e, t, i), this._introPanel._elementRef && (
|
10684
|
+
(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
10685
|
}
|
10662
10686
|
}, {
|
10663
10687
|
key: "addMultipleFiles",
|
@@ -10669,7 +10693,7 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10669
10693
|
return _context112.abrupt("return", Promise.all((e || []).map(function (t) {
|
10670
10694
|
return new Promise(function (i) {
|
10671
10695
|
if (!t.type || t.type === "any") {
|
10672
|
-
var s = t.file.name ||
|
10696
|
+
var s = t.file.name || B.DEFAULT_FILE_NAME;
|
10673
10697
|
i({
|
10674
10698
|
name: s,
|
10675
10699
|
type: "any",
|
@@ -10741,11 +10765,11 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10741
10765
|
}
|
10742
10766
|
}]);
|
10743
10767
|
}(Fe);
|
10744
|
-
var
|
10745
|
-
function
|
10746
|
-
_classCallCheck(this,
|
10768
|
+
var N = /*#__PURE__*/function () {
|
10769
|
+
function N() {
|
10770
|
+
_classCallCheck(this, N);
|
10747
10771
|
}
|
10748
|
-
return _createClass(
|
10772
|
+
return _createClass(N, null, [{
|
10749
10773
|
key: "adjustInputPadding",
|
10750
10774
|
value: function adjustInputPadding(e, t) {
|
10751
10775
|
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 +10777,7 @@ var O = /*#__PURE__*/function () {
|
|
10753
10777
|
}, {
|
10754
10778
|
key: "adjustForOutsideButton",
|
10755
10779
|
value: function adjustForOutsideButton(e, t, i) {
|
10756
|
-
i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(
|
10780
|
+
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
10781
|
}
|
10758
10782
|
// when submit is the only button
|
10759
10783
|
// when submit button is outside by itself - we increase the height for a better look
|
@@ -10761,10 +10785,10 @@ var O = /*#__PURE__*/function () {
|
|
10761
10785
|
key: "adjustOutsideSubmit",
|
10762
10786
|
value: function adjustOutsideSubmit(e, t, i) {
|
10763
10787
|
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(
|
10788
|
+
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
10789
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
10766
10790
|
});
|
10767
|
-
if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(
|
10791
|
+
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
10792
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
10769
10793
|
});
|
10770
10794
|
}
|
@@ -10772,12 +10796,12 @@ var O = /*#__PURE__*/function () {
|
|
10772
10796
|
}, {
|
10773
10797
|
key: "set",
|
10774
10798
|
value: function set(e, t, i, s) {
|
10775
|
-
!!
|
10799
|
+
!!N.adjustOutsideSubmit(t, i, s) || N.adjustForOutsideButton(t, i, s), N.adjustInputPadding(e, s);
|
10776
10800
|
}
|
10777
10801
|
}]);
|
10778
10802
|
}();
|
10779
|
-
|
10780
|
-
var ys =
|
10803
|
+
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";
|
10804
|
+
var ys = N;
|
10781
10805
|
var _t = /*#__PURE__*/function () {
|
10782
10806
|
function _t() {
|
10783
10807
|
_classCallCheck(this, _t);
|
@@ -10812,11 +10836,11 @@ var _t = /*#__PURE__*/function () {
|
|
10812
10836
|
}]);
|
10813
10837
|
}();
|
10814
10838
|
var Js = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "microphone"];
|
10815
|
-
var
|
10816
|
-
function
|
10817
|
-
_classCallCheck(this,
|
10839
|
+
var W = /*#__PURE__*/function () {
|
10840
|
+
function W() {
|
10841
|
+
_classCallCheck(this, W);
|
10818
10842
|
}
|
10819
|
-
return _createClass(
|
10843
|
+
return _createClass(W, null, [{
|
10820
10844
|
key: "createTextElement",
|
10821
10845
|
value: function createTextElement(e) {
|
10822
10846
|
var t = document.createElement("div");
|
@@ -10825,15 +10849,15 @@ var $ = /*#__PURE__*/function () {
|
|
10825
10849
|
}, {
|
10826
10850
|
key: "createElement",
|
10827
10851
|
value: function createElement(e, t) {
|
10828
|
-
return t ?
|
10852
|
+
return t ? W.createTextElement(e) : ie.createSVGElement(e);
|
10829
10853
|
}
|
10830
10854
|
}, {
|
10831
10855
|
key: "createCustomElement",
|
10832
10856
|
value: function createCustomElement(e, t) {
|
10833
10857
|
var s, r, o, a;
|
10834
10858
|
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
|
10859
|
+
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);
|
10860
|
+
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
10861
|
}
|
10838
10862
|
}, {
|
10839
10863
|
key: "processElement",
|
@@ -10846,7 +10870,7 @@ var $ = /*#__PURE__*/function () {
|
|
10846
10870
|
key: "createSpecificStateElement",
|
10847
10871
|
value: function createSpecificStateElement(e, t, i) {
|
10848
10872
|
var s;
|
10849
|
-
return i && (s =
|
10873
|
+
return i && (s = W.createCustomElement(t, i)), W.processElement(e, s), s;
|
10850
10874
|
}
|
10851
10875
|
// https://github.com/OvidijusParsiunas/deep-chat/issues/175
|
10852
10876
|
// isDropup here is only determined by the user and not when moved to dropup automatically
|
@@ -10856,7 +10880,7 @@ var $ = /*#__PURE__*/function () {
|
|
10856
10880
|
value: function createInnerElement(e, t, i, s) {
|
10857
10881
|
var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
|
10858
10882
|
var o, a;
|
10859
|
-
return r && !((a = (o = s == null ? void 0 : s[i]) == null ? void 0 : o.svg) != null && a.content) ? t :
|
10883
|
+
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
10884
|
}
|
10861
10885
|
}]);
|
10862
10886
|
}();
|
@@ -10869,13 +10893,13 @@ var ue = /*#__PURE__*/function () {
|
|
10869
10893
|
key: "unsetAllCSS",
|
10870
10894
|
value: function unsetAllCSS(e, t) {
|
10871
10895
|
var i, s;
|
10872
|
-
t.container &&
|
10896
|
+
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
10897
|
}
|
10874
10898
|
}, {
|
10875
10899
|
key: "unsetActionCSS",
|
10876
10900
|
value: function unsetActionCSS(e, t) {
|
10877
10901
|
var i, s;
|
10878
|
-
t.container &&
|
10902
|
+
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
10903
|
}
|
10880
10904
|
}, {
|
10881
10905
|
key: "setElementsCSS",
|
@@ -11005,7 +11029,7 @@ var qe = /*#__PURE__*/function () {
|
|
11005
11029
|
r = t.dropupText,
|
11006
11030
|
o = document.createElement("div");
|
11007
11031
|
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 =
|
11032
|
+
var a = R.processStateful((i == null ? void 0 : i.item) || {}, {
|
11009
11033
|
backgroundColor: "#f3f3f3"
|
11010
11034
|
}, {
|
11011
11035
|
backgroundColor: "#ebebeb"
|
@@ -11061,7 +11085,7 @@ var ks = /*#__PURE__*/function () {
|
|
11061
11085
|
key: "windowKeyDown",
|
11062
11086
|
value: function windowKeyDown(e, t) {
|
11063
11087
|
var i, s, r;
|
11064
|
-
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key ===
|
11088
|
+
!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
11089
|
}
|
11066
11090
|
}], [{
|
11067
11091
|
key: "createElement",
|
@@ -11094,7 +11118,7 @@ var yt = /*#__PURE__*/function (_Xt) {
|
|
11094
11118
|
}, {
|
11095
11119
|
key: "createInnerElement",
|
11096
11120
|
value: function createInnerElement(e, t, i) {
|
11097
|
-
return
|
11121
|
+
return W.createSpecificStateElement(this.elementRef, t, i) || e;
|
11098
11122
|
}
|
11099
11123
|
}, {
|
11100
11124
|
key: "addClickEvent",
|
@@ -11123,7 +11147,7 @@ var yt = /*#__PURE__*/function (_Xt) {
|
|
11123
11147
|
}, {
|
11124
11148
|
key: "createSVGIconElement",
|
11125
11149
|
value: function createSVGIconElement() {
|
11126
|
-
return
|
11150
|
+
return ie.createSVGElement($o);
|
11127
11151
|
}
|
11128
11152
|
}, {
|
11129
11153
|
key: "createButtonContainer",
|
@@ -11139,11 +11163,11 @@ var yt = /*#__PURE__*/function (_Xt) {
|
|
11139
11163
|
}
|
11140
11164
|
}]);
|
11141
11165
|
}(Xt);
|
11142
|
-
var
|
11143
|
-
function
|
11144
|
-
_classCallCheck(this,
|
11166
|
+
var V = /*#__PURE__*/function () {
|
11167
|
+
function V() {
|
11168
|
+
_classCallCheck(this, V);
|
11145
11169
|
}
|
11146
|
-
return _createClass(
|
11170
|
+
return _createClass(V, null, [{
|
11147
11171
|
key: "addToDropup",
|
11148
11172
|
value:
|
11149
11173
|
// prettier-ignore
|
@@ -11192,25 +11216,25 @@ var G = /*#__PURE__*/function () {
|
|
11192
11216
|
}, {
|
11193
11217
|
key: "generatePositions",
|
11194
11218
|
value: function generatePositions(e) {
|
11195
|
-
var t =
|
11219
|
+
var t = V.createPositionsObj();
|
11196
11220
|
Object.keys(e).forEach(function (s) {
|
11197
11221
|
var o;
|
11198
11222
|
var r = (o = e[s]) == null ? void 0 : o.button.position;
|
11199
|
-
r &&
|
11200
|
-
}), t["inside-right"].length === 0 && e.submit &&
|
11223
|
+
r && V.setPosition(e, s, t[r]);
|
11224
|
+
}), 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
11225
|
var i = Object.keys(e);
|
11202
11226
|
return i.length > 1 || t["dropup-menu"].length > 0 ? Js.forEach(function (s) {
|
11203
11227
|
e[s] && t["dropup-menu"].push(_objectSpread(_objectSpread({}, e[s]), {}, {
|
11204
11228
|
buttonType: s
|
11205
11229
|
}));
|
11206
|
-
}) : i.length === 1 &&
|
11230
|
+
}) : i.length === 1 && V.setPosition(e, i[0], t["outside-right"].length === 0 ? t["outside-right"] : t["outside-left"]), t;
|
11207
11231
|
}
|
11208
11232
|
// prettier-ignore
|
11209
11233
|
}, {
|
11210
11234
|
key: "addButtons",
|
11211
11235
|
value: function addButtons(e, t, i, s) {
|
11212
|
-
var r =
|
11213
|
-
return
|
11236
|
+
var r = V.generatePositions(t);
|
11237
|
+
return V.addToSideContainer(e, r), r["dropup-menu"].length > 0 && V.addToDropup(e, r, i, s), r;
|
11214
11238
|
}
|
11215
11239
|
}]);
|
11216
11240
|
}();
|
@@ -11264,7 +11288,7 @@ var Gt = /*#__PURE__*/function (_Xt2) {
|
|
11264
11288
|
}, {
|
11265
11289
|
key: "createInnerElement",
|
11266
11290
|
value: function createInnerElement(e, t, i) {
|
11267
|
-
return
|
11291
|
+
return W.createSpecificStateElement(this.elementRef, t, i) || e;
|
11268
11292
|
}
|
11269
11293
|
}, {
|
11270
11294
|
key: "changeToActive",
|
@@ -11311,7 +11335,7 @@ var Gt = /*#__PURE__*/function (_Xt2) {
|
|
11311
11335
|
}, {
|
11312
11336
|
key: "createSVGIconElement",
|
11313
11337
|
value: function createSVGIconElement() {
|
11314
|
-
var e =
|
11338
|
+
var e = ie.createSVGElement(Yo);
|
11315
11339
|
return e.id = "microphone-icon", e;
|
11316
11340
|
}
|
11317
11341
|
}]);
|
@@ -11436,11 +11460,11 @@ Object.defineProperty(Fi, "__esModule", {
|
|
11436
11460
|
value: !0
|
11437
11461
|
});
|
11438
11462
|
Fi.EventListeners = void 0;
|
11439
|
-
var
|
11440
|
-
function
|
11441
|
-
_classCallCheck(this,
|
11463
|
+
var re = /*#__PURE__*/function () {
|
11464
|
+
function re() {
|
11465
|
+
_classCallCheck(this, re);
|
11442
11466
|
}
|
11443
|
-
return _createClass(
|
11467
|
+
return _createClass(re, null, [{
|
11444
11468
|
key: "getElementIfFocusedOnAvailable",
|
11445
11469
|
value: function getElementIfFocusedOnAvailable(e, t) {
|
11446
11470
|
return Array.isArray(e) ? e.find(function (i) {
|
@@ -11451,14 +11475,14 @@ var ne = /*#__PURE__*/function () {
|
|
11451
11475
|
key: "keyDownWindow",
|
11452
11476
|
value: function keyDownWindow(e) {
|
11453
11477
|
var _this58 = this;
|
11454
|
-
e.element &&
|
11455
|
-
|
11478
|
+
e.element && re.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (re.KEY_DOWN_TIMEOUT !== null && clearTimeout(re.KEY_DOWN_TIMEOUT), re.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
11479
|
+
re.KEY_DOWN_TIMEOUT = null, _this58.resetRecording(e);
|
11456
11480
|
}, 500));
|
11457
11481
|
}
|
11458
11482
|
}, {
|
11459
11483
|
key: "mouseDownWindow",
|
11460
11484
|
value: function mouseDownWindow(e, t) {
|
11461
|
-
this.mouseDownElement =
|
11485
|
+
this.mouseDownElement = re.getElementIfFocusedOnAvailable(e, t.target);
|
11462
11486
|
}
|
11463
11487
|
}, {
|
11464
11488
|
key: "mouseUpWindow",
|
@@ -11469,7 +11493,7 @@ var ne = /*#__PURE__*/function () {
|
|
11469
11493
|
key: "add",
|
11470
11494
|
value: function add(e, t) {
|
11471
11495
|
var i = (t == null ? void 0 : t.insertInCursorLocation) === void 0 || (t == null ? void 0 : t.insertInCursorLocation);
|
11472
|
-
t != null && t.element && i && (e.mouseDownEvent =
|
11496
|
+
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
11497
|
}
|
11474
11498
|
}, {
|
11475
11499
|
key: "remove",
|
@@ -11478,8 +11502,8 @@ var ne = /*#__PURE__*/function () {
|
|
11478
11502
|
}
|
11479
11503
|
}]);
|
11480
11504
|
}();
|
11481
|
-
Fi.EventListeners =
|
11482
|
-
|
11505
|
+
Fi.EventListeners = re;
|
11506
|
+
re.KEY_DOWN_TIMEOUT = null;
|
11483
11507
|
var Bi = {};
|
11484
11508
|
Object.defineProperty(Bi, "__esModule", {
|
11485
11509
|
value: !0
|
@@ -11689,11 +11713,11 @@ var Xs = ti,
|
|
11689
11713
|
ra = wt,
|
11690
11714
|
Ys = lt,
|
11691
11715
|
Qs = ot;
|
11692
|
-
var
|
11693
|
-
function
|
11694
|
-
_classCallCheck(this,
|
11716
|
+
var ne = /*#__PURE__*/function () {
|
11717
|
+
function ne() {
|
11718
|
+
_classCallCheck(this, ne);
|
11695
11719
|
}
|
11696
|
-
return _createClass(
|
11720
|
+
return _createClass(ne, null, [{
|
11697
11721
|
key: "processCommand",
|
11698
11722
|
value: function processCommand(e, t) {
|
11699
11723
|
return (!t || !t.caseSensitive) && (e = e.toLowerCase()), (t == null ? void 0 : t.substrings) === !1 ? Qs.Text.breakupIntoWordsArr(e) : e;
|
@@ -11704,7 +11728,7 @@ var se = /*#__PURE__*/function () {
|
|
11704
11728
|
var t;
|
11705
11729
|
return ((t = e.settings) === null || t === void 0 ? void 0 : t.caseSensitive) === !0 ? e : Object.keys(e).reduce(function (s, r) {
|
11706
11730
|
var o = e[r];
|
11707
|
-
return s[r] = typeof o == "string" ?
|
11731
|
+
return s[r] = typeof o == "string" ? ne.processCommand(o, e.settings) : o, s;
|
11708
11732
|
}, {});
|
11709
11733
|
}
|
11710
11734
|
}, {
|
@@ -11722,7 +11746,7 @@ var se = /*#__PURE__*/function () {
|
|
11722
11746
|
}, {
|
11723
11747
|
key: "setText",
|
11724
11748
|
value: function setText(e, t, i, s) {
|
11725
|
-
|
11749
|
+
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
11750
|
return Xs.AutoScroll.scrollGeneric(e, s);
|
11727
11751
|
})), e.resetRecording(t);
|
11728
11752
|
}
|
@@ -11752,38 +11776,38 @@ var se = /*#__PURE__*/function () {
|
|
11752
11776
|
if (!c || !s || !i) return;
|
11753
11777
|
var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
|
11754
11778
|
h = Qs.Text.breakupIntoWordsArr(d),
|
11755
|
-
u = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ?
|
11779
|
+
u = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? ne.checkIfMatchesWord : ne.checkIfMatchesSubstring;
|
11756
11780
|
if (c.commandMode && u(c.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
|
11757
|
-
return
|
11781
|
+
return ne.toggleCommandModeOn(e);
|
11758
11782
|
}), {
|
11759
11783
|
doNotProcessTranscription: !1
|
11760
11784
|
};
|
11761
11785
|
if (!(c.commandMode && !e.isWaitingForCommand)) {
|
11762
|
-
if (c.stop && u(c.stop, d, h)) return
|
11786
|
+
if (c.stop && u(c.stop, d, h)) return ne.toggleCommandModeOff(e), setTimeout(function () {
|
11763
11787
|
return e.stop();
|
11764
11788
|
}), {
|
11765
11789
|
doNotProcessTranscription: !1
|
11766
11790
|
};
|
11767
|
-
if (c.pause && u(c.pause, d, h)) return
|
11791
|
+
if (c.pause && u(c.pause, d, h)) return ne.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
11768
11792
|
var f;
|
11769
11793
|
e.isPaused = !0, (f = e.onPauseTrigger) === null || f === void 0 || f.call(e, !0);
|
11770
11794
|
}), {
|
11771
11795
|
doNotProcessTranscription: !1
|
11772
11796
|
};
|
11773
|
-
if (c.resume && u(c.resume, d, h)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1),
|
11797
|
+
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
11798
|
doNotProcessTranscription: !0
|
11775
11799
|
};
|
11776
|
-
if (c.reset && u(c.reset, d, h)) return r !== void 0 &&
|
11800
|
+
if (c.reset && u(c.reset, d, h)) return r !== void 0 && ne.setText(e, i, r, s), {
|
11777
11801
|
doNotProcessTranscription: !0
|
11778
11802
|
};
|
11779
|
-
if (c.removeAllText && u(c.removeAllText, d, h)) return
|
11803
|
+
if (c.removeAllText && u(c.removeAllText, d, h)) return ne.setText(e, i, "", s), {
|
11780
11804
|
doNotProcessTranscription: !0
|
11781
11805
|
};
|
11782
11806
|
}
|
11783
11807
|
}
|
11784
11808
|
}]);
|
11785
11809
|
}();
|
11786
|
-
ei.CommandUtils =
|
11810
|
+
ei.CommandUtils = ne;
|
11787
11811
|
var Ui = {};
|
11788
11812
|
Object.defineProperty(Ui, "__esModule", {
|
11789
11813
|
value: !0
|
@@ -12460,7 +12484,7 @@ Object.defineProperty(wn, "__esModule", {
|
|
12460
12484
|
});
|
12461
12485
|
var hn = Ni,
|
12462
12486
|
ma = ei,
|
12463
|
-
|
12487
|
+
le = Hi,
|
12464
12488
|
ga = qi;
|
12465
12489
|
var ht = /*#__PURE__*/function () {
|
12466
12490
|
function ht() {
|
@@ -12471,12 +12495,12 @@ var ht = /*#__PURE__*/function () {
|
|
12471
12495
|
value: function toggle(e, t) {
|
12472
12496
|
var i, s;
|
12473
12497
|
var r = e.toLocaleLowerCase().trim();
|
12474
|
-
!((i =
|
12498
|
+
!((i = le.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? ht.startWebSpeech(t) : r === "azure" ? ht.startAzure(t) : (console.error("service not found - must be either 'webspeech' or 'azure'"), (s = t == null ? void 0 : t.onError) === null || s === void 0 || s.call(t, "service not found - must be either 'webspeech' or 'azure'"));
|
12475
12499
|
}
|
12476
12500
|
}, {
|
12477
12501
|
key: "startWebSpeech",
|
12478
12502
|
value: function startWebSpeech(e) {
|
12479
|
-
ht.stop() || (
|
12503
|
+
ht.stop() || (le.GlobalState.service = new hn.WebSpeech(), le.GlobalState.service.start(e));
|
12480
12504
|
}
|
12481
12505
|
}, {
|
12482
12506
|
key: "isWebSpeechSupported",
|
@@ -12487,18 +12511,18 @@ var ht = /*#__PURE__*/function () {
|
|
12487
12511
|
key: "startAzure",
|
12488
12512
|
value: function startAzure(e) {
|
12489
12513
|
var t;
|
12490
|
-
ht.stop() || !((t =
|
12514
|
+
ht.stop() || !((t = le.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (le.GlobalState.service = new ga.Azure(), le.GlobalState.service.start(e));
|
12491
12515
|
}
|
12492
12516
|
}, {
|
12493
12517
|
key: "stop",
|
12494
12518
|
value: function stop() {
|
12495
12519
|
var e;
|
12496
|
-
return
|
12520
|
+
return le.GlobalState.doubleClickDetector() ? !0 : (!((e = le.GlobalState.service) === null || e === void 0) && e.recognizing && le.GlobalState.service.stop(), !1);
|
12497
12521
|
}
|
12498
12522
|
}, {
|
12499
12523
|
key: "endCommandMode",
|
12500
12524
|
value: function endCommandMode() {
|
12501
|
-
|
12525
|
+
le.GlobalState.service && ma.CommandUtils.toggleCommandModeOff(le.GlobalState.service);
|
12502
12526
|
}
|
12503
12527
|
}]);
|
12504
12528
|
}();
|
@@ -12812,7 +12836,7 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12812
12836
|
i.classList.add("audio-placeholder-text-3-digits");
|
12813
12837
|
var s = document.createElement("div");
|
12814
12838
|
s.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), s.appendChild(i);
|
12815
|
-
var r =
|
12839
|
+
var r = ie.createSVGElement(un);
|
12816
12840
|
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
12841
|
}
|
12818
12842
|
}, {
|
@@ -12865,12 +12889,12 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12865
12889
|
}, {
|
12866
12890
|
key: "addAudioElements",
|
12867
12891
|
value: function addAudioElements(e, t) {
|
12868
|
-
var i = e.parentElement ?
|
12892
|
+
var i = e.parentElement ? J.cloneElement(e) : e,
|
12869
12893
|
s = document.createElement("audio");
|
12870
12894
|
s.src = t;
|
12871
|
-
var r =
|
12895
|
+
var r = ie.createSVGElement(va);
|
12872
12896
|
r.classList.add("attachment-icon", "play-icon");
|
12873
|
-
var o =
|
12897
|
+
var o = ie.createSVGElement(un);
|
12874
12898
|
o.classList.add("attachment-icon", "stop-icon"), i.replaceChildren(r), s.onplay = function () {
|
12875
12899
|
i.replaceChildren(o);
|
12876
12900
|
}, s.onpause = function () {
|
@@ -13067,7 +13091,7 @@ var he = /*#__PURE__*/function () {
|
|
13067
13091
|
key: "windowKeyDown",
|
13068
13092
|
value: function windowKeyDown(e, t) {
|
13069
13093
|
var i, s;
|
13070
|
-
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key ===
|
13094
|
+
!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
13095
|
}
|
13072
13096
|
}], [{
|
13073
13097
|
key: "createContainer",
|
@@ -13105,7 +13129,7 @@ var he = /*#__PURE__*/function () {
|
|
13105
13129
|
value: function createSVGButton(e) {
|
13106
13130
|
var t = document.createElement("div");
|
13107
13131
|
t.classList.add("modal-button", "modal-svg-button");
|
13108
|
-
var i =
|
13132
|
+
var i = ie.createSVGElement(e);
|
13109
13133
|
return i.classList.add("modal-svg-button-icon"), t.appendChild(i), t;
|
13110
13134
|
}
|
13111
13135
|
}, {
|
@@ -13126,13 +13150,13 @@ var Pt = /*#__PURE__*/function (_Xt3) {
|
|
13126
13150
|
function Pt(e, t, i, s, r, o) {
|
13127
13151
|
var _this71;
|
13128
13152
|
_classCallCheck(this, Pt);
|
13129
|
-
var h, u, f, m, p, y, x,
|
13153
|
+
var h, u, f, m, p, y, x, j, G;
|
13130
13154
|
var a = (h = i == null ? void 0 : i.button) == null ? void 0 : h.position,
|
13131
13155
|
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
13156
|
_this71 = _callSuper(this, Pt, [Pt.createButtonElement(), a, i.button, l]);
|
13133
13157
|
var c = a === "dropup-menu",
|
13134
13158
|
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 || (
|
13159
|
+
_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
13160
|
return _this71;
|
13137
13161
|
}
|
13138
13162
|
_inherits(Pt, _Xt3);
|
@@ -13142,7 +13166,7 @@ var Pt = /*#__PURE__*/function (_Xt3) {
|
|
13142
13166
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
13143
13167
|
var r = Pt.createSVGIconElement(e, t);
|
13144
13168
|
return {
|
13145
|
-
styles:
|
13169
|
+
styles: W.createInnerElement(this.elementRef, r, "styles", i, s)
|
13146
13170
|
};
|
13147
13171
|
}
|
13148
13172
|
}, {
|
@@ -13182,7 +13206,7 @@ var Pt = /*#__PURE__*/function (_Xt3) {
|
|
13182
13206
|
}, {
|
13183
13207
|
key: "createSVGIconElement",
|
13184
13208
|
value: function createSVGIconElement(e, t) {
|
13185
|
-
var i =
|
13209
|
+
var i = ie.createSVGElement(t);
|
13186
13210
|
return i.id = e, i;
|
13187
13211
|
}
|
13188
13212
|
}]);
|
@@ -13306,13 +13330,13 @@ var ze = /*#__PURE__*/function () {
|
|
13306
13330
|
}, {
|
13307
13331
|
key: "validateWebsocket",
|
13308
13332
|
value: function validateWebsocket(e, t) {
|
13309
|
-
return e.websocket && !
|
13333
|
+
return e.websocket && !U.canSendMessage(e.websocket) ? (t.changeToDisabledIcon(), !1) : !0;
|
13310
13334
|
}
|
13311
13335
|
// prettier-ignore
|
13312
13336
|
}, {
|
13313
13337
|
key: "attach",
|
13314
13338
|
value: function attach(e, t, i, s, r) {
|
13315
|
-
var o = e.validateInput ||
|
13339
|
+
var o = e.validateInput || ae.processValidateInput(e);
|
13316
13340
|
e._validationHandler = /*#__PURE__*/function () {
|
13317
13341
|
var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee121(a) {
|
13318
13342
|
var l;
|
@@ -13417,38 +13441,38 @@ var Ea = /*#__PURE__*/function (_Gt2) {
|
|
13417
13441
|
}]);
|
13418
13442
|
}(Gt);
|
13419
13443
|
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,
|
13444
|
+
var $ = /*#__PURE__*/function () {
|
13445
|
+
function $() {
|
13446
|
+
_classCallCheck(this, $);
|
13423
13447
|
}
|
13424
|
-
return _createClass(
|
13448
|
+
return _createClass($, null, [{
|
13425
13449
|
key: "setPropertyValueIfDoesNotExist",
|
13426
13450
|
value: function setPropertyValueIfDoesNotExist(e, t, i) {
|
13427
13451
|
var _e$s, _e$s2;
|
13428
13452
|
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(),
|
13453
|
+
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
13454
|
}
|
13431
13455
|
}, {
|
13432
13456
|
key: "setPropertyValue",
|
13433
13457
|
value: function setPropertyValue(e, t, i) {
|
13434
13458
|
var _e$s3;
|
13435
13459
|
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(),
|
13460
|
+
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
13461
|
}
|
13438
13462
|
}, {
|
13439
13463
|
key: "getObjectValue",
|
13440
13464
|
value: function getObjectValue(e, t) {
|
13441
13465
|
var i = t[0],
|
13442
13466
|
s = e[i];
|
13443
|
-
return s === void 0 || t.length === 1 ? s :
|
13467
|
+
return s === void 0 || t.length === 1 ? s : $.getObjectValue(s, t.slice(1));
|
13444
13468
|
}
|
13445
13469
|
}, {
|
13446
13470
|
key: "overwritePropertyObjectFromAnother",
|
13447
13471
|
value: function overwritePropertyObjectFromAnother(e, t, i) {
|
13448
|
-
var s =
|
13472
|
+
var s = $.getObjectValue(t, i);
|
13449
13473
|
if (s) {
|
13450
|
-
var r = _objectSpread(_objectSpread({}, s),
|
13451
|
-
|
13474
|
+
var r = _objectSpread(_objectSpread({}, s), $.getObjectValue(e, i) || {});
|
13475
|
+
$.setPropertyValue(e, i, r);
|
13452
13476
|
}
|
13453
13477
|
}
|
13454
13478
|
}]);
|
@@ -13467,13 +13491,13 @@ var Ye = /*#__PURE__*/function () {
|
|
13467
13491
|
value: function overwriteDefaultStyleWithSubmit(e, t) {
|
13468
13492
|
if (!e.submit) return;
|
13469
13493
|
var i = JSON.parse(JSON.stringify(e[t] || {}));
|
13470
|
-
|
13494
|
+
$.overwritePropertyObjectFromAnother(i, e.submit, ["container", "default"]), $.overwritePropertyObjectFromAnother(i, e.submit, ["text", "styles", "default"]), $.overwritePropertyObjectFromAnother(i, e.submit, ["svg", "styles", "default"]), e[t] = i;
|
13471
13495
|
}
|
13472
13496
|
// prettier-ignore
|
13473
13497
|
}, {
|
13474
13498
|
key: "setUpDisabledButton",
|
13475
13499
|
value: function setUpDisabledButton(e) {
|
13476
|
-
|
13500
|
+
$.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
13501
|
}
|
13478
13502
|
}, {
|
13479
13503
|
key: "process",
|
@@ -13483,13 +13507,13 @@ var Ye = /*#__PURE__*/function () {
|
|
13483
13507
|
}
|
13484
13508
|
}]);
|
13485
13509
|
}();
|
13486
|
-
var
|
13510
|
+
var k = /*#__PURE__*/function (_Xt4) {
|
13487
13511
|
// prettier-ignore
|
13488
|
-
function
|
13512
|
+
function k(e, t, i, s, r, o) {
|
13489
13513
|
var _this76;
|
13490
|
-
_classCallCheck(this,
|
13514
|
+
_classCallCheck(this, k);
|
13491
13515
|
var a = Ye.process(e.submitButtonStyles);
|
13492
|
-
_this76 = _callSuper(this,
|
13516
|
+
_this76 = _callSuper(this, k, [k.createButtonContainerElement(), a == null ? void 0 : a.position, a]), _this76._isSVGLoadingIconOverriden = !1, _this76.status = {
|
13493
13517
|
requestInProgress: !1,
|
13494
13518
|
loadingActive: !1
|
13495
13519
|
}, _this76._messages = i, _this76._textInput = t, _this76._fileAttachments = r, _this76._innerElements = _this76.createInnerElements(), _this76._abortStream = new AbortController(), _this76._stopClicked = {
|
@@ -13500,19 +13524,19 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13500
13524
|
});
|
13501
13525
|
return _this76;
|
13502
13526
|
}
|
13503
|
-
_inherits(
|
13504
|
-
return _createClass(
|
13527
|
+
_inherits(k, _Xt4);
|
13528
|
+
return _createClass(k, [{
|
13505
13529
|
key: "createInnerElements",
|
13506
13530
|
value: function createInnerElements() {
|
13507
13531
|
var _this$createCustomEle = this.createCustomElements(),
|
13508
13532
|
e = _this$createCustomEle.submit,
|
13509
13533
|
t = _this$createCustomEle.loading,
|
13510
13534
|
i = _this$createCustomEle.stop,
|
13511
|
-
s = e ||
|
13535
|
+
s = e || k.createSubmitIconElement();
|
13512
13536
|
return {
|
13513
13537
|
submit: s,
|
13514
|
-
loading: t ||
|
13515
|
-
stop: i ||
|
13538
|
+
loading: t || k.createLoadingIconElement(),
|
13539
|
+
stop: i || k.createStopIconElement(),
|
13516
13540
|
disabled: this.createDisabledIconElement(s)
|
13517
13541
|
};
|
13518
13542
|
}
|
@@ -13520,21 +13544,21 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13520
13544
|
key: "createCustomElements",
|
13521
13545
|
value: function createCustomElements() {
|
13522
13546
|
var _this77 = this;
|
13523
|
-
var e =
|
13547
|
+
var e = W.createSpecificStateElement(this.elementRef, "submit", this._customStyles),
|
13524
13548
|
t = {
|
13525
13549
|
loading: void 0,
|
13526
13550
|
stop: void 0
|
13527
13551
|
};
|
13528
13552
|
return Object.keys(t).forEach(function (i) {
|
13529
13553
|
var s = i,
|
13530
|
-
r =
|
13554
|
+
r = W.createCustomElement(s, _this77._customStyles);
|
13531
13555
|
r && (t[s] = r);
|
13532
13556
|
}), t.submit = e, t;
|
13533
13557
|
}
|
13534
13558
|
}, {
|
13535
13559
|
key: "createDisabledIconElement",
|
13536
13560
|
value: function createDisabledIconElement(e) {
|
13537
|
-
return
|
13561
|
+
return W.createCustomElement("disabled", this._customStyles) || e.cloneNode(!0);
|
13538
13562
|
}
|
13539
13563
|
// prettier-ignore
|
13540
13564
|
}, {
|
@@ -13612,7 +13636,7 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13612
13636
|
return _regeneratorRuntime().wrap(function _callee123$(_context123) {
|
13613
13637
|
while (1) switch (_context123.prev = _context123.next) {
|
13614
13638
|
case 0:
|
13615
|
-
typeof e == "string" && (e =
|
13639
|
+
typeof e == "string" && (e = ae.processSubmitUserMessage(e));
|
13616
13640
|
t = {
|
13617
13641
|
text: e.text
|
13618
13642
|
};
|
@@ -13733,19 +13757,19 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13733
13757
|
}, {
|
13734
13758
|
key: "changeToStopIcon",
|
13735
13759
|
value: function changeToStopIcon() {
|
13736
|
-
this._serviceIO.websocket || (this.elementRef.classList.remove(
|
13760
|
+
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
13761
|
}
|
13738
13762
|
}, {
|
13739
13763
|
key: "changeToLoadingIcon",
|
13740
13764
|
value: function changeToLoadingIcon() {
|
13741
|
-
this._serviceIO.websocket || (this._isSVGLoadingIconOverriden || this.elementRef.replaceChildren(this._innerElements.loading), this.elementRef.classList.remove(
|
13765
|
+
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
13766
|
}
|
13743
13767
|
// called every time when user triggers an input via ValidationHandler - hence use class to check if not already present
|
13744
13768
|
}, {
|
13745
13769
|
key: "changeToSubmitIcon",
|
13746
13770
|
value: function changeToSubmitIcon() {
|
13747
13771
|
var _this79 = this;
|
13748
|
-
this.elementRef.classList.contains(
|
13772
|
+
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
13773
|
var e;
|
13750
13774
|
_this79.submitFromInput(), (e = _this79._microphoneButton) != null && e.isActive && $t.toggleSpeechAfterSubmit(_this79._microphoneButton.elementRef, !!_this79._stopSTTAfterSubmit);
|
13751
13775
|
});
|
@@ -13755,7 +13779,7 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13755
13779
|
key: "changeToDisabledIcon",
|
13756
13780
|
value: function changeToDisabledIcon() {
|
13757
13781
|
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
13758
|
-
this._alwaysEnabled && !e ? this.changeToSubmitIcon() : this.elementRef.classList.contains(
|
13782
|
+
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
13783
|
}
|
13760
13784
|
}, {
|
13761
13785
|
key: "disableSubmitButton",
|
@@ -13772,7 +13796,7 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13772
13796
|
}, {
|
13773
13797
|
key: "createSubmitIconElement",
|
13774
13798
|
value: function createSubmitIconElement() {
|
13775
|
-
var e =
|
13799
|
+
var e = ie.createSVGElement(xa);
|
13776
13800
|
return e.id = "submit-icon", e;
|
13777
13801
|
}
|
13778
13802
|
}, {
|
@@ -13789,8 +13813,8 @@ var A = /*#__PURE__*/function (_Xt4) {
|
|
13789
13813
|
}
|
13790
13814
|
}]);
|
13791
13815
|
}(Xt);
|
13792
|
-
|
13793
|
-
var Es =
|
13816
|
+
k.SUBMIT_CLASS = "submit-button", k.LOADING_CLASS = "loading-button", k.DISABLED_CLASS = "disabled-button";
|
13817
|
+
var Es = k;
|
13794
13818
|
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
13819
|
_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
13820
|
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 +13828,7 @@ var Rs = /*#__PURE__*/function (_Xe) {
|
|
13804
13828
|
var _this80$addButtonsAnd = _this80.addButtonsAndTheirEvents(t),
|
13805
13829
|
r = _this80$addButtonsAnd.captureButton,
|
13806
13830
|
o = _this80$addButtonsAnd.submitButton;
|
13807
|
-
_this80._captureButton = r, _this80._submitButton = o, _this80._captureIcon = _this80._captureButton.children[0], _this80._refreshIcon =
|
13831
|
+
_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
13832
|
return _this80;
|
13809
13833
|
}
|
13810
13834
|
_inherits(Rs, _Xe);
|
@@ -13928,7 +13952,7 @@ var ki = /*#__PURE__*/function (_Xt5) {
|
|
13928
13952
|
value: function createInnerElements(e) {
|
13929
13953
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
13930
13954
|
return {
|
13931
|
-
styles:
|
13955
|
+
styles: W.createInnerElement(this.elementRef, ki.createSVGIconElement(), "styles", e, t)
|
13932
13956
|
};
|
13933
13957
|
}
|
13934
13958
|
}, {
|
@@ -13948,7 +13972,7 @@ var ki = /*#__PURE__*/function (_Xt5) {
|
|
13948
13972
|
}, {
|
13949
13973
|
key: "createSVGIconElement",
|
13950
13974
|
value: function createSVGIconElement() {
|
13951
|
-
var e =
|
13975
|
+
var e = ie.createSVGElement(Ca);
|
13952
13976
|
return e.id = "camera-icon", e;
|
13953
13977
|
}
|
13954
13978
|
}]);
|
@@ -14020,9 +14044,9 @@ var Ot = /*#__PURE__*/function () {
|
|
14020
14044
|
}, {
|
14021
14045
|
key: "addElements",
|
14022
14046
|
value: function addElements(e, t, i, s, r, o) {
|
14023
|
-
|
14047
|
+
J.addElements(e, t.elementRef);
|
14024
14048
|
var a = _t.create(),
|
14025
|
-
l =
|
14049
|
+
l = V.addButtons(a, i, s, o);
|
14026
14050
|
ys.set(t.inputElementRef, a, r.elementRef, l), _t.add(e, a);
|
14027
14051
|
}
|
14028
14052
|
}]);
|
@@ -14037,9 +14061,9 @@ var Is = /*#__PURE__*/function () {
|
|
14037
14061
|
var s = document.createElement("div");
|
14038
14062
|
s.id = "chat-view";
|
14039
14063
|
var r = new Ee(e, t, i);
|
14040
|
-
t.websocket &&
|
14064
|
+
t.websocket && U.createConnection(t, r);
|
14041
14065
|
var o = new Ot(e, r, t, s);
|
14042
|
-
return
|
14066
|
+
return J.addElements(s, r.elementRef, o.elementRef), s;
|
14043
14067
|
}
|
14044
14068
|
}, {
|
14045
14069
|
key: "render",
|
@@ -14085,7 +14109,7 @@ var E = /*#__PURE__*/function (_ls) {
|
|
14085
14109
|
key: "onRender",
|
14086
14110
|
value: function onRender() {
|
14087
14111
|
var _this$_childElement;
|
14088
|
-
ci.attemptAppendStyleSheetToHead(this.style),
|
14112
|
+
ci.attemptAppendStyleSheetToHead(this.style), ae.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = zo.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (kt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), kt.applyDefaultStyleToComponent(this.style, this.chatStyle), ae.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? li.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof z) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Is.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof z && H.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, hi.onRender(this);
|
14089
14113
|
}
|
14090
14114
|
}, {
|
14091
14115
|
key: "disconnectedCallback",
|