deep-chat-dev 9.0.199 → 9.0.200
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 +7996 -7946
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts +1 -0
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +421 -355
- package/dist/services/azure/azureOpenAIAssistantIO.d.ts.map +1 -1
- package/dist/services/azure/azureOpenAIChatIO.d.ts.map +1 -1
- package/dist/services/openAI/assistant/openAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/assistant/openAIAssistantIOI.d.ts +3 -3
- package/dist/services/openAI/assistant/openAIAssistantIOI.d.ts.map +1 -1
- package/dist/services/openAI/openAIChatIO.d.ts +2 -2
- package/dist/services/openAI/openAIChatIO.d.ts.map +1 -1
- package/dist/services/utils/messageLimitUtils.d.ts.map +1 -1
- package/dist/types/messagesInternal.d.ts +2 -0
- package/dist/types/messagesInternal.d.ts.map +1 -1
- package/dist/utils/HTTP/stream.d.ts.map +1 -1
- package/dist/utils/demo/demo.d.ts.map +1 -1
- package/dist/views/chat/messages/avatar.d.ts.map +1 -1
- package/dist/views/chat/messages/history/history.d.ts.map +1 -1
- package/dist/views/chat/messages/messageUtils.d.ts +4 -3
- package/dist/views/chat/messages/messageUtils.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts +1 -0
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/dist/views/chat/messages/messagesBase.d.ts +3 -2
- package/dist/views/chat/messages/messagesBase.d.ts.map +1 -1
- package/dist/views/chat/messages/stream/messageStream.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -9,6 +9,10 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
9
9
|
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
10
10
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
11
11
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
12
16
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
13
17
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
14
18
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
@@ -605,7 +609,7 @@ var ft = /*#__PURE__*/function () {
|
|
605
609
|
}]);
|
606
610
|
}();
|
607
611
|
ft.BUBBLE_CLASS = "deep-chat-loading-message-bubble", ft.DOTS_CONTAINER_CLASS = "deep-chat-loading-message-dots-container";
|
608
|
-
var
|
612
|
+
var Me = ft;
|
609
613
|
var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20fill='%23000000'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2032%2032'%20xml:space='preserve'%3e%3cpath%20d='M23,30.36H9c-2.404,0-4.36-1.956-4.36-4.36V15c0-2.404,1.956-4.36,4.36-4.36h3.659%20c0.167-1.566,1.415-2.813,2.981-2.981V5.333c-1.131-0.174-2-1.154-2-2.333c0-1.301,1.059-2.36,2.36-2.36%20c1.302,0,2.36,1.059,2.36,2.36c0,1.179-0.869,2.159-2,2.333V7.66c1.566,0.167,2.814,1.415,2.981,2.981H23%20c2.404,0,4.36,1.956,4.36,4.36v11C27.36,28.404,25.404,30.36,23,30.36z%20M9,11.36c-2.007,0-3.64,1.633-3.64,3.64v11%20c0,2.007,1.633,3.64,3.64,3.64h14c2.007,0,3.64-1.633,3.64-3.64V15c0-2.007-1.633-3.64-3.64-3.64H9z%20M13.384,10.64h5.231%20C18.439,9.354,17.334,8.36,16,8.36C14.667,8.36,13.561,9.354,13.384,10.64z%20M16,1.36c-0.904,0-1.64,0.736-1.64,1.64%20S15.096,4.64,16,4.64c0.904,0,1.64-0.736,1.64-1.64S16.904,1.36,16,1.36z%20M20,27.36h-8c-1.301,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36h8c1.302,0,2.36,1.059,2.36,2.36S21.302,27.36,20,27.36z%20M12,23.36c-0.904,0-1.64,0.735-1.64,1.64%20s0.736,1.64,1.64,1.64h8c0.904,0,1.64-0.735,1.64-1.64s-0.735-1.64-1.64-1.64H12z%20M31,23.86h-2c-0.199,0-0.36-0.161-0.36-0.36V15%20c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5C31.36,23.699,31.199,23.86,31,23.86z%20M29.36,23.14h1.279v-7.78%20H29.36V23.14z%20M3,23.86H1c-0.199,0-0.36-0.161-0.36-0.36V15c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5%20C3.36,23.699,3.199,23.86,3,23.86z%20M1.36,23.14h1.28v-7.78H1.36V23.14z%20M20,20.36c-1.302,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36s2.36,1.059,2.36,2.36C22.36,19.302,21.302,20.36,20,20.36z%20M20,16.36c-0.904,0-1.64,0.736-1.64,1.64%20s0.735,1.64,1.64,1.64s1.64-0.735,1.64-1.64S20.904,16.36,20,16.36z%20M12,20.36c-1.301,0-2.36-1.059-2.36-2.36s1.059-2.36,2.36-2.36%20s2.36,1.059,2.36,2.36C14.36,19.302,13.301,20.36,12,20.36z%20M12,16.36c-0.904,0-1.64,0.736-1.64,1.64s0.736,1.64,1.64,1.64%20s1.64-0.735,1.64-1.64S12.904,16.36,12,16.36z'/%3e%3crect%20style='fill:none;'%20width='32'%20height='32'/%3e%3c/svg%3e",
|
610
614
|
Pn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAMAAAC/MqoPAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////9vX18vLy/Pz86enp4+Li2tnZ1tbWzczM+fn57Ozs4N/f09LS0M/P5uXl7+/v3dzcwtncCAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAZNSURBVHja7d3bdtsqEABQYABZSLH9/3+ZpnUsIcF5iOM6PfElNoMHMfPQdq3GmL0GkLhEUqLaUExnOtOZznSmM53pTGc605nOdKYznelMZzrTmV4LXSqllKyJDkob26xWq8Zae/iH0QoWTm9d1xur4WuypQJtTd+5dqn0VjcxzNO5/57mEBvdLo8Oron6aseWOjYOFkVvjQs3DmgyONMuht52EfztP+4hdu0i6LCO808/M8c1lE/fuPGej41uUzgdtoO/75N+2ELJ9I3b3//hPXbiMenm3pR/Jt4USgcLBIp4Bh10gqKVhvLo0klCxeSky96nKcj3siw6pJIL4XsoiQ7apyvMY/V3HHrSRioLopvEhSpTCn2TPEuwKYMOIX0tAxRBf/Hpa+lfSqBv9gi1FPsNfTrMAiVmIE/vJhz61FGnQxRIEYE4vfNYdN8Rp6MlHaHotHTn8ejekaZPAjEmyvQWdZFTtYTpXqCGJ0zvcek9Yfoel76nS0ffv1NMp1ca+pkgyfRCGind4L7OWWc605l+cxjsyhqy9AGbPpClc1/nvl5VX0c/3Alk6RU3+Am7shNZ+h6bvidLr7jBB+zKBrL0irOOudmIUDzTmf5gIP+iEuXtRuTVaEmY/oZLfyNMrzjryPc0gerMTdpVg0tvjJUU6bLPcGOoUv46SLL6Wi8yhLf06C7TUyekI0efRaaYqdFltkeNpPumRPSMDxgBYvSM035FrKAmH72hRW99PrpvSdEHkTEGUvSsK3yKVDkuJ92RohcZaehzzirPpOg+J92Tolfc4Cumx5xVXpGiZ34+ICX6W84qv5GiR5NPbiIpOv6BCoSvSkTX+eiaGP092zINvBOj4x8mSf9FqejvNo/cvpOji19ZbmviL0GPLsYMFzgzCor0+Bv/ePDvSJKOb9dJ5UlnbnEHiHgzv6cdTpJOWuc/u3FEucLDOL75xGtBiefrcwgoC9NDSH/jkH6pAuXmBqPQ9HSUPVdZBH1GGOrMXAQdYxcKZfxAoK+KKBKFLosoEoX+u4giUehz8jlcnAuhp78I46yDYNAd+QLR6K+pr+yvxdBTHyVDubQh0UfSxaHSd0lbvNkVRE87JGOtc+PQd2QLQ6fHhJkKsSh6yg13tO08JPprsgrrXWH0dJd2vH1MLPprot4eXoujpzrdhngiD40ek2y92lggPcnWa8qN1Yz0BFuvZhRl0uOfR0v4Ewuli/Bg4Qr3lArqGdndQ3UPO1EunXYwnelMZzrTmc50pjOd6UxnOtOZznSmM53pTGf6kuj6oedFKV0s3fX6sX1S3bsi6a4PD7+/YAqYeBw6pIB/4qEgOqxdSPbGiim4NRRCbzs3Jj0L4UfXtQXQVRfn5IdA/Bw7RZzurEV6EtdsLeGXkIPuA+K1UoVeA0l62zmN/LqfSSft9KkepmoRuvi3nd5uKNFB9zbbXEANqdr941XO0NJx2v2jdJenpf+/3bvn0ts16ph+sd6hX7dPo2+2cZzE02Ia43bzDHqr+2Evnhz74ZHU30ffbKOeng1/NPV30Ns1gYQnSP2P6e65Pfxc6h02XZqXQCjhJ6kPL6bFo4NrGvAU4UII4SE2P1vQuZkuOxckVfehisF1MjUddN/MZBN+kvq5uf0O/xa66gyNS9ktMWlz44rO1Z8C19i5FPdHzPamXn+F3hryPfxMr78+4F+kq22kO6Rf6fUQt+puuustyWv4rbG3l/duztFB96GYoe1cTBdXMr+nw9qVM6ZfxOvzezff0nXi/ZOndvrR6Zvpm0c3h6nhdb+5iS7tsIim/qXZD9+97/Jf+rpZ5BET1ayv0GUzLhEuhBBjIy/RdVPgndutIRt9nt7p5cKFEEJ3Z+jQFDZL+XnMDXxHB73gxn5s9Kc3d3/pFciFkN/QTSXHJpX5l66gDrkQoP6hL3xsPw39la4qOiV8tH78XeSbue6N9mvWa6J/ybpc1CT1Wnh5Qq9meP8IOKH3ddH7E/ri1iYux/SXDrXR4UiPdck/wUpU+FtPf6/orja6O9KL3l56LOvVxe5Ib2qjN0d6Vbex4ghWlU3bPqI90If66MNng680FNpbJijH6kCvaF3uMzQ3+IrpFerV4Y9dffQdN3im10ivbuImhD3Qq5u4HdZkua8znelMZ/pS4z9CPVKkxowNxgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMy0yN1QxNTo0NToxNSswMDowMN1xSg4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDMtMjdUMTU6NDU6MTUrMDA6MDCsLPKyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==",
|
611
615
|
Y = /*#__PURE__*/function () {
|
@@ -643,7 +647,7 @@ var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
643
647
|
value: function createAvatar(e, t) {
|
644
648
|
var r, o, a, l, c;
|
645
649
|
var i = document.createElement("img");
|
646
|
-
e === b.USER_ROLE ? i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || Pn : i.src = ((a = t == null ? void 0 : t[e]) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t.ai) == null ? void 0 : l.src) || ((c = t == null ? void 0 : t["default"]) == null ? void 0 : c.src) || Ln, i.classList.add("avatar");
|
650
|
+
e === b.USER_ROLE ? i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || Pn : i.src = ((a = t == null ? void 0 : t[e]) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t.ai) == null ? void 0 : l.src) || ((c = t == null ? void 0 : t["default"]) == null ? void 0 : c.src) || Ln, i.classList.add("avatar"), i.alt = "".concat(e, " avatar");
|
647
651
|
var s = document.createElement("div");
|
648
652
|
return s.classList.add(Y.CONTAINER_CLASS), s.appendChild(i), t && Y.applyCustomStyles(s, i, t, e), s;
|
649
653
|
}
|
@@ -667,20 +671,20 @@ var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
667
671
|
}();
|
668
672
|
Y.CONTAINER_CLASS = "avatar-container";
|
669
673
|
var Mt = Y;
|
670
|
-
var
|
671
|
-
function
|
672
|
-
_classCallCheck(this,
|
674
|
+
var ge = /*#__PURE__*/function () {
|
675
|
+
function ge() {
|
676
|
+
_classCallCheck(this, ge);
|
673
677
|
}
|
674
|
-
return _createClass(
|
678
|
+
return _createClass(ge, null, [{
|
675
679
|
key: "hide",
|
676
680
|
value: function hide(e) {
|
677
681
|
var t;
|
678
|
-
(t = e.getElementsByClassName(
|
682
|
+
(t = e.getElementsByClassName(ge.NAME_CLASS)[0].style).visibility || (t.visibility = "hidden");
|
679
683
|
}
|
680
684
|
}, {
|
681
685
|
key: "reveal",
|
682
686
|
value: function reveal(e) {
|
683
|
-
e.getElementsByClassName(
|
687
|
+
e.getElementsByClassName(ge.NAME_CLASS)[0].style.visibility = "";
|
684
688
|
}
|
685
689
|
}, {
|
686
690
|
key: "getPosition",
|
@@ -706,20 +710,20 @@ var me = /*#__PURE__*/function () {
|
|
706
710
|
key: "createName",
|
707
711
|
value: function createName(e, t) {
|
708
712
|
var i = document.createElement("div");
|
709
|
-
return i.classList.add(
|
713
|
+
return i.classList.add(ge.NAME_CLASS), i.textContent = ge.getNameText(e, t), ge.applyStyle(i, e, t), i;
|
710
714
|
}
|
711
715
|
}, {
|
712
716
|
key: "add",
|
713
717
|
value: function add(e, t, i) {
|
714
718
|
var s = typeof i == "boolean" ? {} : i,
|
715
|
-
r =
|
716
|
-
o =
|
719
|
+
r = ge.createName(t, s),
|
720
|
+
o = ge.getPosition(t, s);
|
717
721
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
718
722
|
}
|
719
723
|
}]);
|
720
724
|
}();
|
721
|
-
|
722
|
-
var Rt =
|
725
|
+
ge.NAME_CLASS = "name";
|
726
|
+
var Rt = ge;
|
723
727
|
var C = /*#__PURE__*/function () {
|
724
728
|
function C() {
|
725
729
|
_classCallCheck(this, C);
|
@@ -750,9 +754,9 @@ var C = /*#__PURE__*/function () {
|
|
750
754
|
}, {
|
751
755
|
key: "getLastMessage",
|
752
756
|
value: function getLastMessage(e, t, i) {
|
753
|
-
for (var s = e.length - 1; s >= 0; s -= 1) if (e[s].role === t) if (i) {
|
754
|
-
if (e[s][i]) return e[s];
|
755
|
-
} else return e[s];
|
757
|
+
for (var s = e.length - 1; s >= 0; s -= 1) if (e[s][0].role === t) if (i) {
|
758
|
+
if (e[s][0][i]) return e[s][0];
|
759
|
+
} else return e[s][0];
|
756
760
|
}
|
757
761
|
}, {
|
758
762
|
key: "getLastTextToElement",
|
@@ -765,7 +769,7 @@ var C = /*#__PURE__*/function () {
|
|
765
769
|
}, {
|
766
770
|
key: "overwriteMessage",
|
767
771
|
value: function overwriteMessage(e, t, i, s, r, o) {
|
768
|
-
var a = C.getLastElementsByClass(t, [C.getRoleClass(s), o], [
|
772
|
+
var a = C.getLastElementsByClass(t, [C.getRoleClass(s), o], [Me.BUBBLE_CLASS]),
|
769
773
|
l = C.getLastMessage(e, s, r);
|
770
774
|
return l && (l[r] = i), a;
|
771
775
|
}
|
@@ -830,6 +834,12 @@ var C = /*#__PURE__*/function () {
|
|
830
834
|
var _e$outerContainer$cla;
|
831
835
|
e.outerContainer.classList.remove(C.POSITION_TOP_MESSAGE_CLASS, C.POSITION_MIDDLE_MESSAGE_CLASS, C.POSITION_BOTTOM_MESSAGE_CLASS), (_e$outerContainer$cla = e.outerContainer.classList).add.apply(_e$outerContainer$cla, _toConsumableArray(t));
|
832
836
|
}
|
837
|
+
}, {
|
838
|
+
key: "getNumberOfElements",
|
839
|
+
value: function getNumberOfElements(e) {
|
840
|
+
var t = 0;
|
841
|
+
return e.text !== void 0 && (t += 1), e.html !== void 0 && (t += 1), e.files && (t += e.files.length), t;
|
842
|
+
}
|
833
843
|
}, {
|
834
844
|
key: "classifyMessages",
|
835
845
|
value: function classifyMessages(e, t) {
|
@@ -902,11 +912,11 @@ var On = "deep-chat-temporary-message",
|
|
902
912
|
}
|
903
913
|
},
|
904
914
|
Ds = Object.keys(ns);
|
905
|
-
var
|
906
|
-
function
|
907
|
-
_classCallCheck(this,
|
915
|
+
var Re = /*#__PURE__*/function () {
|
916
|
+
function Re() {
|
917
|
+
_classCallCheck(this, Re);
|
908
918
|
}
|
909
|
-
return _createClass(
|
919
|
+
return _createClass(Re, null, [{
|
910
920
|
key: "applySuggestionEvent",
|
911
921
|
value: function applySuggestionEvent(e, t) {
|
912
922
|
setTimeout(function () {
|
@@ -961,13 +971,13 @@ var Me = /*#__PURE__*/function () {
|
|
961
971
|
Ds.forEach(function (r) {
|
962
972
|
var o = i.getElementsByClassName(r);
|
963
973
|
Array.from(o || []).forEach(function (a) {
|
964
|
-
var l =
|
965
|
-
te.applyStylesToElement(a, l),
|
974
|
+
var l = Re.getProcessedStyles(t, a, r);
|
975
|
+
te.applyStylesToElement(a, l), Re.applyEvents(a, r);
|
966
976
|
});
|
967
977
|
});
|
968
978
|
var s = i.getElementsByClassName(Nn);
|
969
979
|
Array.from(s).forEach(function (r) {
|
970
|
-
return
|
980
|
+
return Re.applySuggestionEvent(e, r);
|
971
981
|
});
|
972
982
|
}
|
973
983
|
}]);
|
@@ -995,7 +1005,7 @@ var te = /*#__PURE__*/function () {
|
|
995
1005
|
value: function applyClassUtilitiesToElement(e, t) {
|
996
1006
|
var i = t.events,
|
997
1007
|
s = t.styles;
|
998
|
-
i && te.applyEventsToElement(e, i), s && !
|
1008
|
+
i && te.applyEventsToElement(e, i), s && !Re.doesElementContainDeepChatClass(e) && te.applyStylesToElement(e, s);
|
999
1009
|
}
|
1000
1010
|
}, {
|
1001
1011
|
key: "applyCustomClassUtilities",
|
@@ -1010,7 +1020,7 @@ var te = /*#__PURE__*/function () {
|
|
1010
1020
|
}, {
|
1011
1021
|
key: "apply",
|
1012
1022
|
value: function apply(e, t) {
|
1013
|
-
|
1023
|
+
Re.applyDeepChatUtilities(e, e.htmlClassUtilities, t), te.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
1014
1024
|
}
|
1015
1025
|
}, {
|
1016
1026
|
key: "traverseNodes",
|
@@ -1030,11 +1040,11 @@ var te = /*#__PURE__*/function () {
|
|
1030
1040
|
}
|
1031
1041
|
}]);
|
1032
1042
|
}();
|
1033
|
-
var
|
1034
|
-
function
|
1035
|
-
_classCallCheck(this,
|
1043
|
+
var be = /*#__PURE__*/function () {
|
1044
|
+
function be() {
|
1045
|
+
_classCallCheck(this, be);
|
1036
1046
|
}
|
1037
|
-
return _createClass(
|
1047
|
+
return _createClass(be, null, [{
|
1038
1048
|
key: "addElement",
|
1039
1049
|
value: function addElement(e, t) {
|
1040
1050
|
e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
@@ -1053,9 +1063,9 @@ var Re = /*#__PURE__*/function () {
|
|
1053
1063
|
}, {
|
1054
1064
|
key: "overwriteLast",
|
1055
1065
|
value: function overwriteLast(e, t, i, s) {
|
1056
|
-
var r = e.
|
1066
|
+
var r = e.messageToElements,
|
1057
1067
|
o = b.overwriteMessage(r, s, t, i, "html", "html-message");
|
1058
|
-
return o &&
|
1068
|
+
return o && be.overwrite(e, t, o), o;
|
1059
1069
|
}
|
1060
1070
|
// prettier-ignore
|
1061
1071
|
}, {
|
@@ -1068,8 +1078,8 @@ var Re = /*#__PURE__*/function () {
|
|
1068
1078
|
if (c) return c;
|
1069
1079
|
r.status = !1;
|
1070
1080
|
}
|
1071
|
-
var a =
|
1072
|
-
return b.fillEmptyMessageElement(a.bubbleElement, t), te.apply(e, a.outerContainer), le.flagHTMLUpdateClass(a.bubbleElement), e.applyCustomStyles(a, i, !1, (l = e.messageStyles) == null ? void 0 : l.html), o ||
|
1081
|
+
var a = be.createElements(e, t, i, o);
|
1082
|
+
return b.fillEmptyMessageElement(a.bubbleElement, t), te.apply(e, a.outerContainer), le.flagHTMLUpdateClass(a.bubbleElement), e.applyCustomStyles(a, i, !1, (l = e.messageStyles) == null ? void 0 : l.html), o || be.addElement(e, a.outerContainer), a;
|
1073
1083
|
}
|
1074
1084
|
}]);
|
1075
1085
|
}();
|
@@ -1725,11 +1735,11 @@ function ct(n, e, t) {
|
|
1725
1735
|
return n.substr(0, e) + t + n.substr(e + 1);
|
1726
1736
|
}
|
1727
1737
|
function ar(n) {
|
1728
|
-
var e, t, i, s, r, o, a, l, c, d, h, u, f, m, p,
|
1738
|
+
var e, t, i, s, r, o, a, l, c, d, h, u, f, m, p, v, x;
|
1729
1739
|
if (n.options.typographer) {
|
1730
1740
|
for (x = [], p = n.tokens.length - 1; p >= 0; p--) if (n.tokens[p].type === "inline") {
|
1731
|
-
for (
|
1732
|
-
for (a =
|
1741
|
+
for (v = n.tokens[p].children, x.length = 0, e = 0; e < v.length; e++) if (t = v[e], !(t.type !== "text" || rr.test(t.text))) {
|
1742
|
+
for (a = v[e].level, f = x.length - 1; f >= 0 && !(x[f].level <= a); f--);
|
1733
1743
|
x.length = f + 1, i = t.content, r = 0, o = i.length;
|
1734
1744
|
e: for (; r < o && (Bs.lastIndex = r, s = Bs.exec(i), !!s);) {
|
1735
1745
|
if (l = !js(i, s.index - 1), r = s.index + 1, m = s[0] === "'", c = !js(i, r), !c && !l) {
|
@@ -1738,7 +1748,7 @@ function ar(n) {
|
|
1738
1748
|
}
|
1739
1749
|
if (h = !c, u = !l, u) {
|
1740
1750
|
for (f = x.length - 1; f >= 0 && (d = x[f], !(x[f].level < a)); f--) if (d.single === m && x[f].level === a) {
|
1741
|
-
d = x[f], m ? (
|
1751
|
+
d = x[f], m ? (v[d.token].content = ct(v[d.token].content, d.pos, n.options.quotes[2]), t.content = ct(t.content, s.index, n.options.quotes[3])) : (v[d.token].content = ct(v[d.token].content, d.pos, n.options.quotes[0]), t.content = ct(t.content, s.index, n.options.quotes[1])), x.length = f;
|
1742
1752
|
continue e;
|
1743
1753
|
}
|
1744
1754
|
}
|
@@ -1863,12 +1873,12 @@ function dr(n, e, t, i) {
|
|
1863
1873
|
f,
|
1864
1874
|
m,
|
1865
1875
|
p = n.bMarks[e] + n.tShift[e],
|
1866
|
-
|
1867
|
-
if (p >
|
1876
|
+
v = n.eMarks[e];
|
1877
|
+
if (p > v || n.src.charCodeAt(p++) !== 62 || n.level >= n.options.maxNesting) return !1;
|
1868
1878
|
if (i) return !0;
|
1869
|
-
for (n.src.charCodeAt(p) === 32 && p++, l = n.blkIndent, n.blkIndent = 0, a = [n.bMarks[e]], n.bMarks[e] = p, p = p <
|
1879
|
+
for (n.src.charCodeAt(p) === 32 && p++, l = n.blkIndent, n.blkIndent = 0, a = [n.bMarks[e]], n.bMarks[e] = p, p = p < v ? n.skipSpaces(p) : p, r = p >= v, o = [n.tShift[e]], n.tShift[e] = p - n.bMarks[e], h = n.parser.ruler.getRules("blockquote"), s = e + 1; s < t && (p = n.bMarks[s] + n.tShift[s], v = n.eMarks[s], !(p >= v)); s++) {
|
1870
1880
|
if (n.src.charCodeAt(p++) === 62) {
|
1871
|
-
n.src.charCodeAt(p) === 32 && p++, a.push(n.bMarks[s]), n.bMarks[s] = p, p = p <
|
1881
|
+
n.src.charCodeAt(p) === 32 && p++, a.push(n.bMarks[s]), n.bMarks[s] = p, p = p < v ? n.skipSpaces(p) : p, r = p >= v, o.push(n.tShift[s]), n.tShift[s] = p - n.bMarks[s];
|
1872
1882
|
continue;
|
1873
1883
|
}
|
1874
1884
|
if (r) break;
|
@@ -1943,7 +1953,7 @@ function fr(n, e, t, i) {
|
|
1943
1953
|
f,
|
1944
1954
|
m,
|
1945
1955
|
p,
|
1946
|
-
|
1956
|
+
v,
|
1947
1957
|
x,
|
1948
1958
|
j,
|
1949
1959
|
G,
|
@@ -1954,10 +1964,10 @@ function fr(n, e, t, i) {
|
|
1954
1964
|
D,
|
1955
1965
|
je,
|
1956
1966
|
Tt;
|
1957
|
-
if ((h = qs(n, e)) >= 0)
|
1967
|
+
if ((h = qs(n, e)) >= 0) v = !0;else if ((h = Hs(n, e)) >= 0) v = !1;else return !1;
|
1958
1968
|
if (n.level >= n.options.maxNesting) return !1;
|
1959
1969
|
if (p = n.src.charCodeAt(h - 1), i) return !0;
|
1960
|
-
for (j = n.tokens.length,
|
1970
|
+
for (j = n.tokens.length, v ? (d = n.bMarks[e] + n.tShift[e], m = Number(n.src.substr(d, h - d - 1)), n.tokens.push({
|
1961
1971
|
type: "ordered_list_open",
|
1962
1972
|
order: m,
|
1963
1973
|
lines: Pe = [e, 0],
|
@@ -1979,13 +1989,13 @@ function fr(n, e, t, i) {
|
|
1979
1989
|
break;
|
1980
1990
|
}
|
1981
1991
|
if (Tt) break;
|
1982
|
-
if (
|
1992
|
+
if (v) {
|
1983
1993
|
if (h = qs(n, s), h < 0) break;
|
1984
1994
|
} else if (h = Hs(n, s), h < 0) break;
|
1985
1995
|
if (p !== n.src.charCodeAt(h - 1)) break;
|
1986
1996
|
}
|
1987
1997
|
return n.tokens.push({
|
1988
|
-
type:
|
1998
|
+
type: v ? "ordered_list_close" : "bullet_list_close",
|
1989
1999
|
level: --n.level
|
1990
2000
|
}), Pe[1] = s, n.line = s, Z && ur(n, j), !0;
|
1991
2001
|
}
|
@@ -2192,7 +2202,7 @@ function Sr(n, e) {
|
|
2192
2202
|
for (t = e + 2, i = n.tokens.length - 2; t < i; t++) n.tokens[t].level === s && n.tokens[t].type === "paragraph_open" && (n.tokens[t + 2].tight = !0, n.tokens[t].tight = !0, t += 2);
|
2193
2203
|
}
|
2194
2204
|
function _r(n, e, t, i) {
|
2195
|
-
var s, r, o, a, l, c, d, h, u, f, m, p,
|
2205
|
+
var s, r, o, a, l, c, d, h, u, f, m, p, v, x;
|
2196
2206
|
if (i) return n.ddIndent < 0 ? !1 : ni(n, e) >= 0;
|
2197
2207
|
if (d = e + 1, n.isEmpty(d) && ++d > t || n.tShift[d] < n.blkIndent || (s = ni(n, d), s < 0) || n.level >= n.options.maxNesting) return !1;
|
2198
2208
|
c = n.tokens.length, n.tokens.push({
|
@@ -2201,7 +2211,7 @@ function _r(n, e, t, i) {
|
|
2201
2211
|
level: n.level++
|
2202
2212
|
}), o = e, r = d;
|
2203
2213
|
e: for (;;) {
|
2204
|
-
for (x = !0,
|
2214
|
+
for (x = !0, v = !1, n.tokens.push({
|
2205
2215
|
type: "dt_open",
|
2206
2216
|
lines: [o, o],
|
2207
2217
|
level: n.level++
|
@@ -2219,7 +2229,7 @@ function _r(n, e, t, i) {
|
|
2219
2229
|
type: "dd_open",
|
2220
2230
|
lines: a = [d, 0],
|
2221
2231
|
level: n.level++
|
2222
|
-
}), p = n.tight, u = n.ddIndent, h = n.blkIndent, m = n.tShift[r], f = n.parentType, n.blkIndent = n.ddIndent = n.tShift[r] + 2, n.tShift[r] = s - n.bMarks[r], n.tight = !0, n.parentType = "deflist", n.parser.tokenize(n, r, t, !0), (!n.tight ||
|
2232
|
+
}), p = n.tight, u = n.ddIndent, h = n.blkIndent, m = n.tShift[r], f = n.parentType, n.blkIndent = n.ddIndent = n.tShift[r] + 2, n.tShift[r] = s - n.bMarks[r], n.tight = !0, n.parentType = "deflist", n.parser.tokenize(n, r, t, !0), (!n.tight || v) && (x = !1), v = n.line - r > 1 && n.isEmpty(n.line - 1), n.tShift[r] = m, n.tight = p, n.parentType = f, n.blkIndent = h, n.ddIndent = u, n.tokens.push({
|
2223
2233
|
type: "dd_close",
|
2224
2234
|
level: --n.level
|
2225
2235
|
}), a[1] = d = n.line, d >= t || n.tShift[d] < n.blkIndent) break e;
|
@@ -2991,11 +3001,11 @@ var jt = /*#__PURE__*/function () {
|
|
2991
3001
|
}
|
2992
3002
|
}]);
|
2993
3003
|
}();
|
2994
|
-
var
|
2995
|
-
function
|
2996
|
-
_classCallCheck(this,
|
3004
|
+
var Se = /*#__PURE__*/function () {
|
3005
|
+
function Se() {
|
3006
|
+
_classCallCheck(this, Se);
|
2997
3007
|
}
|
2998
|
-
return _createClass(
|
3008
|
+
return _createClass(Se, null, [{
|
2999
3009
|
key: "addMessage",
|
3000
3010
|
value:
|
3001
3011
|
// prettier-ignore
|
@@ -3007,7 +3017,7 @@ var xe = /*#__PURE__*/function () {
|
|
3007
3017
|
key: "wrapInLink",
|
3008
3018
|
value: function wrapInLink(e, t, i) {
|
3009
3019
|
var s = document.createElement("a");
|
3010
|
-
return s.href = t, s.download = i ||
|
3020
|
+
return s.href = t, s.download = i || Se.DEFAULT_FILE_NAME, s.target = "_blank", s.appendChild(e), s;
|
3011
3021
|
}
|
3012
3022
|
}, {
|
3013
3023
|
key: "isNonLinkableDataUrl",
|
@@ -3017,7 +3027,7 @@ var xe = /*#__PURE__*/function () {
|
|
3017
3027
|
}, {
|
3018
3028
|
key: "processContent",
|
3019
3029
|
value: function processContent(e, t, i, s) {
|
3020
|
-
return !i ||
|
3030
|
+
return !i || Se.isNonLinkableDataUrl(e, i) ? t : Se.wrapInLink(t, i, s);
|
3021
3031
|
}
|
3022
3032
|
}, {
|
3023
3033
|
key: "waitToLoadThenScroll",
|
@@ -3029,11 +3039,11 @@ var xe = /*#__PURE__*/function () {
|
|
3029
3039
|
}, {
|
3030
3040
|
key: "scrollDownOnImageLoad",
|
3031
3041
|
value: function scrollDownOnImageLoad(e, t) {
|
3032
|
-
if (e.startsWith("data"))
|
3042
|
+
if (e.startsWith("data")) Se.waitToLoadThenScroll(t);else try {
|
3033
3043
|
fetch(e, {
|
3034
3044
|
mode: "no-cors"
|
3035
3045
|
})["catch"](function () {})["finally"](function () {
|
3036
|
-
|
3046
|
+
Se.waitToLoadThenScroll(t);
|
3037
3047
|
});
|
3038
3048
|
} catch (_unused5) {
|
3039
3049
|
t.scrollTop = t.scrollHeight;
|
@@ -3071,7 +3081,7 @@ var xe = /*#__PURE__*/function () {
|
|
3071
3081
|
value: function isImageFile(e) {
|
3072
3082
|
var t = e.type,
|
3073
3083
|
i = e.src;
|
3074
|
-
return t === "image" || (i == null ? void 0 : i.startsWith("data:image")) || i &&
|
3084
|
+
return t === "image" || (i == null ? void 0 : i.startsWith("data:image")) || i && Se.isImageFileExtension(i);
|
3075
3085
|
}
|
3076
3086
|
}, {
|
3077
3087
|
key: "isImageFileExtension",
|
@@ -3080,8 +3090,8 @@ var xe = /*#__PURE__*/function () {
|
|
3080
3090
|
}
|
3081
3091
|
}]);
|
3082
3092
|
}();
|
3083
|
-
|
3084
|
-
var B =
|
3093
|
+
Se.DEFAULT_FILE_NAME = "file";
|
3094
|
+
var B = Se;
|
3085
3095
|
var hi = /*#__PURE__*/function () {
|
3086
3096
|
function hi() {
|
3087
3097
|
_classCallCheck(this, hi);
|
@@ -3136,7 +3146,7 @@ var F = /*#__PURE__*/function () {
|
|
3136
3146
|
}, {
|
3137
3147
|
key: "apply",
|
3138
3148
|
value: function apply(e, t, i) {
|
3139
|
-
|
3149
|
+
Me.setRing(t.bubbleElement, i == null ? void 0 : i.bubble), i != null && i.bubble && (i = JSON.parse(JSON.stringify(i)), delete i.bubble), e.applyCustomStyles(t, "history", !1, i);
|
3140
3150
|
}
|
3141
3151
|
}, {
|
3142
3152
|
key: "addLoadHistoryMessage",
|
@@ -3163,7 +3173,7 @@ var F = /*#__PURE__*/function () {
|
|
3163
3173
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
3164
3174
|
var r, o, a, l;
|
3165
3175
|
var i = (l = (a = (o = (r = e.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.history) == null ? void 0 : a.full) == null ? void 0 : l.html,
|
3166
|
-
s = i ?
|
3176
|
+
s = i ? be.createElements(e, i, b.AI_ROLE, !0) : F.createDefaultElements(e);
|
3167
3177
|
return F.addLoadHistoryMessage(s, e, t), s;
|
3168
3178
|
}
|
3169
3179
|
}, {
|
@@ -3235,7 +3245,7 @@ var Be = /*#__PURE__*/function () {
|
|
3235
3245
|
function Be(e) {
|
3236
3246
|
var _this3 = this;
|
3237
3247
|
_classCallCheck(this, Be);
|
3238
|
-
this.messageElementRefs = [], this.
|
3248
|
+
this.messageElementRefs = [], this.htmlClassUtilities = {}, this.messageToElements = [], this.textElementsToText = [], this.htmlElementsToMessage = [], this.elementRef = Be.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = jt.createNew(), this._avatars = e.avatars, this._names = e.names, this._onMessage = hi.onMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(function () {
|
3239
3249
|
_this3.submitUserMessage = e.submitUserMessage;
|
3240
3250
|
});
|
3241
3251
|
}
|
@@ -3256,7 +3266,7 @@ var Be = /*#__PURE__*/function () {
|
|
3256
3266
|
}, {
|
3257
3267
|
key: "overwriteText",
|
3258
3268
|
value: function overwriteText(e, t, i) {
|
3259
|
-
var s = b.overwriteMessage(this.
|
3269
|
+
var s = b.overwriteMessage(this.messageToElements, i, t, e, "text", "text-message");
|
3260
3270
|
if (s) {
|
3261
3271
|
this.renderText(s.bubbleElement, t);
|
3262
3272
|
var r = b.getLastTextToElement(this.textElementsToText, s);
|
@@ -3305,9 +3315,9 @@ var Be = /*#__PURE__*/function () {
|
|
3305
3315
|
}, {
|
3306
3316
|
key: "revealRoleElementsIfTempRemoved",
|
3307
3317
|
value: function revealRoleElementsIfTempRemoved(e, t) {
|
3308
|
-
if ((this._avatars || this._names) &&
|
3318
|
+
if ((this._avatars || this._names) && Re.isElementTemporary(e)) {
|
3309
3319
|
var i = this.messageElementRefs[this.messageElementRefs.length - 2];
|
3310
|
-
i && this.
|
3320
|
+
i && this.messageToElements.length > 0 && !e.bubbleElement.classList.contains(b.getRoleClass(t)) && b.revealRoleElements(i.innerContainer, this._avatars, this._names);
|
3311
3321
|
}
|
3312
3322
|
}
|
3313
3323
|
}, {
|
@@ -3326,7 +3336,7 @@ var Be = /*#__PURE__*/function () {
|
|
3326
3336
|
// prettier-ignore
|
3327
3337
|
function addInnerContainerElements(e, t, i) {
|
3328
3338
|
var s;
|
3329
|
-
return ((s = this.
|
3339
|
+
return ((s = this.messageToElements[this.messageToElements.length - 1]) == null ? void 0 : s[0].role) === i && !this.isLastMessageError() && b.hideRoleElements(this.messageElementRefs, !!this._avatars, !!this._names), e.classList.add("message-bubble", b.getRoleClass(i), i === b.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), b.addRoleElements(e, i, this._avatars, this._names), {
|
3330
3340
|
bubbleElement: e
|
3331
3341
|
};
|
3332
3342
|
}
|
@@ -3386,7 +3396,7 @@ var Be = /*#__PURE__*/function () {
|
|
3386
3396
|
}, {
|
3387
3397
|
key: "isTemporaryElement",
|
3388
3398
|
value: function isTemporaryElement(e) {
|
3389
|
-
return Be.isLoadingMessage(e) ||
|
3399
|
+
return Be.isLoadingMessage(e) || Re.isElementTemporary(e);
|
3390
3400
|
}
|
3391
3401
|
}, {
|
3392
3402
|
key: "createBaseElements",
|
@@ -3417,17 +3427,17 @@ var Be = /*#__PURE__*/function () {
|
|
3417
3427
|
}, {
|
3418
3428
|
key: "isLoadingMessage",
|
3419
3429
|
value: function isLoadingMessage(e) {
|
3420
|
-
return e == null ? void 0 : e.bubbleElement.classList.contains(
|
3430
|
+
return e == null ? void 0 : e.bubbleElement.classList.contains(Me.BUBBLE_CLASS);
|
3421
3431
|
}
|
3422
3432
|
}]);
|
3423
3433
|
}();
|
3424
|
-
var
|
3434
|
+
var _e = /*#__PURE__*/function () {
|
3425
3435
|
// used for extracting at end and for isStreaming
|
3426
|
-
function
|
3427
|
-
_classCallCheck(this,
|
3436
|
+
function _e(e) {
|
3437
|
+
_classCallCheck(this, _e);
|
3428
3438
|
this._fileAdded = !1, this._streamedContent = "", this._streamType = "", this._hasStreamEnded = !1, this._messages = e;
|
3429
3439
|
}
|
3430
|
-
return _createClass(
|
3440
|
+
return _createClass(_e, [{
|
3431
3441
|
key: "upsertStreamedMessage",
|
3432
3442
|
value: function upsertStreamedMessage(e) {
|
3433
3443
|
var r;
|
@@ -3446,9 +3456,9 @@ var Se = /*#__PURE__*/function () {
|
|
3446
3456
|
key: "setInitialState",
|
3447
3457
|
value: function setInitialState(e, t, i) {
|
3448
3458
|
var _i8;
|
3449
|
-
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) :
|
3459
|
+
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : be.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(_e.MESSAGE_CLASS), this._streamedContent = t, this._activeMessageRole = i, this._message = _defineProperty({
|
3450
3460
|
role: this._activeMessageRole
|
3451
|
-
}, e, this._streamedContent), this._messages.
|
3461
|
+
}, e, this._streamedContent), this._messages.messageToElements.push([this._message, [this._elements]]);
|
3452
3462
|
}
|
3453
3463
|
}, {
|
3454
3464
|
key: "updateBasedOnType",
|
@@ -3466,7 +3476,7 @@ var Se = /*#__PURE__*/function () {
|
|
3466
3476
|
value: function updateHTML(e, t, i) {
|
3467
3477
|
if (i) this._streamedContent = e, t.innerHTML = e;else {
|
3468
3478
|
var s = document.createElement("span");
|
3469
|
-
s.innerHTML = e, t.appendChild(s), this._streamedContent =
|
3479
|
+
s.innerHTML = e, t.appendChild(s), this._streamedContent = _e.HTML_CONTENT_PLACEHOLDER;
|
3470
3480
|
}
|
3471
3481
|
}
|
3472
3482
|
}, {
|
@@ -3476,7 +3486,7 @@ var Se = /*#__PURE__*/function () {
|
|
3476
3486
|
var e = this._messages.textElementsToText;
|
3477
3487
|
if (!this._endStreamAfterOperation && !(this._fileAdded && !this._elements)) {
|
3478
3488
|
if (!this._elements) throw Error(M.NO_VALID_STREAM_EVENTS_SENT);
|
3479
|
-
(t = this._elements.bubbleElement) != null && t.classList.contains(
|
3489
|
+
(t = this._elements.bubbleElement) != null && t.classList.contains(_e.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 === _e.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(_e.MESSAGE_CLASS), this._message && this._messages.sendClientUpdate(Be.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
|
3480
3490
|
}
|
3481
3491
|
}
|
3482
3492
|
}, {
|
@@ -3521,8 +3531,8 @@ var Se = /*#__PURE__*/function () {
|
|
3521
3531
|
}()
|
3522
3532
|
}]);
|
3523
3533
|
}();
|
3524
|
-
|
3525
|
-
var
|
3534
|
+
_e.MESSAGE_CLASS = "streamed-message", _e.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3535
|
+
var ve = _e;
|
3526
3536
|
var We = /*#__PURE__*/function () {
|
3527
3537
|
function We() {
|
3528
3538
|
_classCallCheck(this, We);
|
@@ -3651,7 +3661,7 @@ var We = /*#__PURE__*/function () {
|
|
3651
3661
|
}]);
|
3652
3662
|
}();
|
3653
3663
|
We.CONTENT_TYPE = "Content-Type";
|
3654
|
-
var
|
3664
|
+
var y = We;
|
3655
3665
|
function vo(_x12, _x13) {
|
3656
3666
|
return _vo.apply(this, arguments);
|
3657
3667
|
}
|
@@ -3775,7 +3785,7 @@ function wo(n, e) {
|
|
3775
3785
|
m.abort(), document.hidden || I();
|
3776
3786
|
}
|
3777
3787
|
l || document.addEventListener("visibilitychange", p);
|
3778
|
-
var
|
3788
|
+
var v = _o,
|
3779
3789
|
x = 0;
|
3780
3790
|
function j() {
|
3781
3791
|
document.removeEventListener("visibilitychange", p), window.clearTimeout(x), m.abort();
|
@@ -3810,7 +3820,7 @@ function wo(n, e) {
|
|
3810
3820
|
return vo(X.body, yo(Eo(function (D) {
|
3811
3821
|
D ? f[Ws] = D : delete f[Ws];
|
3812
3822
|
}, function (D) {
|
3813
|
-
|
3823
|
+
v = D;
|
3814
3824
|
}, r)));
|
3815
3825
|
case 9:
|
3816
3826
|
o == null || o();
|
@@ -3822,7 +3832,7 @@ function wo(n, e) {
|
|
3822
3832
|
_context4.prev = 14;
|
3823
3833
|
_context4.t0 = _context4["catch"](1);
|
3824
3834
|
if (!m.signal.aborted) try {
|
3825
|
-
D = (Z = a == null ? void 0 : a(_context4.t0)) !== null && Z !== void 0 ? Z :
|
3835
|
+
D = (Z = a == null ? void 0 : a(_context4.t0)) !== null && Z !== void 0 ? Z : v;
|
3826
3836
|
window.clearTimeout(x), x = window.setTimeout(I, D);
|
3827
3837
|
} catch (D) {
|
3828
3838
|
j(), u(D);
|
@@ -3854,13 +3864,13 @@ var A = /*#__PURE__*/function () {
|
|
3854
3864
|
var s,
|
3855
3865
|
r,
|
3856
3866
|
p,
|
3857
|
-
|
3867
|
+
v,
|
3858
3868
|
x,
|
3859
3869
|
j,
|
3860
3870
|
G,
|
3861
3871
|
Pe,
|
3862
3872
|
o,
|
3863
|
-
_yield$
|
3873
|
+
_yield$y$processReque,
|
3864
3874
|
a,
|
3865
3875
|
l,
|
3866
3876
|
c,
|
@@ -3881,12 +3891,12 @@ var A = /*#__PURE__*/function () {
|
|
3881
3891
|
headers: (p = e.connectSettings) == null ? void 0 : p.headers
|
3882
3892
|
};
|
3883
3893
|
_context7.next = 5;
|
3884
|
-
return
|
3894
|
+
return y.processRequestInterceptor(e.deepChat, o);
|
3885
3895
|
case 5:
|
3886
|
-
_yield$
|
3887
|
-
a = _yield$
|
3888
|
-
l = _yield$
|
3889
|
-
c = _yield$
|
3896
|
+
_yield$y$processReque = _context7.sent;
|
3897
|
+
a = _yield$y$processReque.body;
|
3898
|
+
l = _yield$y$processReque.headers;
|
3899
|
+
c = _yield$y$processReque.error;
|
3890
3900
|
_e$streamHandlers = e.streamHandlers;
|
3891
3901
|
d = _e$streamHandlers.onOpen;
|
3892
3902
|
h = _e$streamHandlers.onClose;
|
@@ -3895,21 +3905,21 @@ var A = /*#__PURE__*/function () {
|
|
3895
3905
|
_context7.next = 15;
|
3896
3906
|
break;
|
3897
3907
|
}
|
3898
|
-
return _context7.abrupt("return",
|
3908
|
+
return _context7.abrupt("return", y.onInterceptorError(i, c, h));
|
3899
3909
|
case 15:
|
3900
|
-
if (!((
|
3910
|
+
if (!((v = e.connectSettings) != null && v.handler)) {
|
3901
3911
|
_context7.next = 17;
|
3902
3912
|
break;
|
3903
3913
|
}
|
3904
|
-
return _context7.abrupt("return",
|
3914
|
+
return _context7.abrupt("return", Ae.stream(e, a, i));
|
3905
3915
|
case 17:
|
3906
|
-
if (!(((x = e.connectSettings) == null ? void 0 : x.url) ===
|
3916
|
+
if (!(((x = e.connectSettings) == null ? void 0 : x.url) === ye.URL)) {
|
3907
3917
|
_context7.next = 19;
|
3908
3918
|
break;
|
3909
3919
|
}
|
3910
|
-
return _context7.abrupt("return",
|
3920
|
+
return _context7.abrupt("return", ye.requestStream(i, e.streamHandlers));
|
3911
3921
|
case 19:
|
3912
|
-
f = new
|
3922
|
+
f = new ve(i), m = y.fetch.bind(this, e, l, s);
|
3913
3923
|
return _context7.abrupt("return", (wo(((j = e.connectSettings) == null ? void 0 : j.url) || e.url || "", {
|
3914
3924
|
method: ((G = e.connectSettings) == null ? void 0 : G.method) || "POST",
|
3915
3925
|
headers: l,
|
@@ -3929,7 +3939,7 @@ var A = /*#__PURE__*/function () {
|
|
3929
3939
|
return _context5.abrupt("return", d());
|
3930
3940
|
case 2:
|
3931
3941
|
_context5.next = 4;
|
3932
|
-
return
|
3942
|
+
return y.processResponseByType(I);
|
3933
3943
|
case 4:
|
3934
3944
|
throw _context5.sent;
|
3935
3945
|
case 5:
|
@@ -3968,7 +3978,7 @@ var A = /*#__PURE__*/function () {
|
|
3968
3978
|
(D = e.extractResultData) == null || D.call(e, Tt, m, a).then(function (He) {
|
3969
3979
|
e.asyncCallInProgress && He && He.text !== "" ? (A.simulate(i, e.streamHandlers, He), h(), e.asyncCallInProgress = !1) : A.upsertWFiles(i, f.upsertStreamedMessage.bind(f), f, He);
|
3970
3980
|
})["catch"](function (He) {
|
3971
|
-
return
|
3981
|
+
return y.displayError(i, He);
|
3972
3982
|
});
|
3973
3983
|
case 9:
|
3974
3984
|
case "end":
|
@@ -3991,9 +4001,9 @@ var A = /*#__PURE__*/function () {
|
|
3991
4001
|
})["catch"](function (I) {
|
3992
4002
|
var Z;
|
3993
4003
|
i.isLastMessageError() || (Z = e.extractResultData) == null || Z.call(e, I).then(function () {
|
3994
|
-
|
4004
|
+
y.displayError(i, I);
|
3995
4005
|
})["catch"](function (X) {
|
3996
|
-
|
4006
|
+
y.displayError(i, X);
|
3997
4007
|
});
|
3998
4008
|
}), f));
|
3999
4009
|
case 21:
|
@@ -4017,12 +4027,12 @@ var A = /*#__PURE__*/function () {
|
|
4017
4027
|
}, i), !1), i.text) {
|
4018
4028
|
t.onOpen();
|
4019
4029
|
var r = i.text.split("");
|
4020
|
-
A.populateMessages(r, new
|
4030
|
+
A.populateMessages(r, new ve(e), s, "text");
|
4021
4031
|
}
|
4022
4032
|
if (i.html) {
|
4023
4033
|
t.onOpen();
|
4024
4034
|
var _r2 = te.splitHTML(i.html);
|
4025
|
-
A.populateMessages(_r2, new
|
4035
|
+
_r2.length === 0 && (_r2 = i.html.split("")), A.populateMessages(_r2, new ve(e), s, "html");
|
4026
4036
|
}
|
4027
4037
|
}
|
4028
4038
|
// prettier-ignore
|
@@ -4077,7 +4087,7 @@ var Ke = /*#__PURE__*/function () {
|
|
4077
4087
|
return _createClass(Ke, null, [{
|
4078
4088
|
key: "generateResponse",
|
4079
4089
|
value: function generateResponse(e) {
|
4080
|
-
var t = e
|
4090
|
+
var t = e[e.length - 1][0];
|
4081
4091
|
if (t.files && t.files.length > 0) {
|
4082
4092
|
if (t.files.length > 1) return "These are interesting files!";
|
4083
4093
|
var i = t.files[0];
|
@@ -4096,9 +4106,11 @@ var Ke = /*#__PURE__*/function () {
|
|
4096
4106
|
}
|
4097
4107
|
}, {
|
4098
4108
|
key: "getResponse",
|
4099
|
-
value: function getResponse(
|
4100
|
-
|
4101
|
-
|
4109
|
+
value: function getResponse(_ref2) {
|
4110
|
+
var e = _ref2.customDemoResponse,
|
4111
|
+
t = _ref2.messageToElements;
|
4112
|
+
return e ? Ke.getCustomResponse(e, t[t.length - 1][0]) : {
|
4113
|
+
text: Ke.generateResponse(t)
|
4102
4114
|
};
|
4103
4115
|
}
|
4104
4116
|
// timeout is used to simulate a timeout for a response to come back
|
@@ -4142,7 +4154,7 @@ var Ke = /*#__PURE__*/function () {
|
|
4142
4154
|
}]);
|
4143
4155
|
}();
|
4144
4156
|
Ke.URL = "deep-chat-demo";
|
4145
|
-
var
|
4157
|
+
var ye = Ke;
|
4146
4158
|
var U = /*#__PURE__*/function () {
|
4147
4159
|
function U() {
|
4148
4160
|
_classCallCheck(this, U);
|
@@ -4150,7 +4162,7 @@ var U = /*#__PURE__*/function () {
|
|
4150
4162
|
return _createClass(U, null, [{
|
4151
4163
|
key: "setup",
|
4152
4164
|
value: function setup(e) {
|
4153
|
-
e.connectSettings.url !==
|
4165
|
+
e.connectSettings.url !== ye.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
4154
4166
|
}
|
4155
4167
|
}, {
|
4156
4168
|
key: "isElementPresentInDOM",
|
@@ -4165,7 +4177,7 @@ var U = /*#__PURE__*/function () {
|
|
4165
4177
|
if (!U.isElementPresentInDOM(e.deepChat)) return;
|
4166
4178
|
var i = e.connectSettings.websocket;
|
4167
4179
|
if (i) {
|
4168
|
-
if (e.connectSettings.handler) return
|
4180
|
+
if (e.connectSettings.handler) return Ae.websocket(e, t);
|
4169
4181
|
try {
|
4170
4182
|
var s = typeof i != "boolean" ? i : void 0,
|
4171
4183
|
r = new WebSocket(e.connectSettings.url || "", s);
|
@@ -4194,7 +4206,7 @@ var U = /*#__PURE__*/function () {
|
|
4194
4206
|
var _this6 = this;
|
4195
4207
|
var s = {};
|
4196
4208
|
t.onmessage = /*#__PURE__*/function () {
|
4197
|
-
var
|
4209
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(r) {
|
4198
4210
|
var o, a, l, c, d, h, u;
|
4199
4211
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
4200
4212
|
while (1) switch (_context9.prev = _context9.next) {
|
@@ -4235,7 +4247,7 @@ var U = /*#__PURE__*/function () {
|
|
4235
4247
|
case 17:
|
4236
4248
|
_context9.prev = 17;
|
4237
4249
|
_context9.t1 = _context9["catch"](1);
|
4238
|
-
|
4250
|
+
y.displayError(i, _context9.t1, "Error in server message");
|
4239
4251
|
case 20:
|
4240
4252
|
case "end":
|
4241
4253
|
return _context9.stop();
|
@@ -4243,7 +4255,7 @@ var U = /*#__PURE__*/function () {
|
|
4243
4255
|
}, _callee9, null, [[1, 17]]);
|
4244
4256
|
}));
|
4245
4257
|
return function (_x17) {
|
4246
|
-
return
|
4258
|
+
return _ref4.apply(this, arguments);
|
4247
4259
|
};
|
4248
4260
|
}(), t.onclose = function () {
|
4249
4261
|
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(), U.createConnection(e, i);
|
@@ -4258,7 +4270,7 @@ var U = /*#__PURE__*/function () {
|
|
4258
4270
|
h,
|
4259
4271
|
r,
|
4260
4272
|
o,
|
4261
|
-
_yield$
|
4273
|
+
_yield$y$processReque2,
|
4262
4274
|
a,
|
4263
4275
|
l,
|
4264
4276
|
c,
|
@@ -4279,11 +4291,11 @@ var U = /*#__PURE__*/function () {
|
|
4279
4291
|
headers: (d = e.connectSettings) == null ? void 0 : d.headers
|
4280
4292
|
};
|
4281
4293
|
_context10.next = 7;
|
4282
|
-
return
|
4294
|
+
return y.processRequestInterceptor(e.deepChat, o);
|
4283
4295
|
case 7:
|
4284
|
-
_yield$
|
4285
|
-
a = _yield$
|
4286
|
-
l = _yield$
|
4296
|
+
_yield$y$processReque2 = _context10.sent;
|
4297
|
+
a = _yield$y$processReque2.body;
|
4298
|
+
l = _yield$y$processReque2.error;
|
4287
4299
|
if (!l) {
|
4288
4300
|
_context10.next = 12;
|
4289
4301
|
break;
|
@@ -4297,11 +4309,11 @@ var U = /*#__PURE__*/function () {
|
|
4297
4309
|
return _context10.abrupt("return", r.newUserMessage.listener(a));
|
4298
4310
|
case 14:
|
4299
4311
|
c = s ? JSON.stringify(a) : a;
|
4300
|
-
if (!(((h = e.connectSettings) == null ? void 0 : h.url) ===
|
4312
|
+
if (!(((h = e.connectSettings) == null ? void 0 : h.url) === ye.URL)) {
|
4301
4313
|
_context10.next = 17;
|
4302
4314
|
break;
|
4303
4315
|
}
|
4304
|
-
return _context10.abrupt("return",
|
4316
|
+
return _context10.abrupt("return", ye.request(e, i));
|
4305
4317
|
case 17:
|
4306
4318
|
r.readyState === void 0 || r.readyState !== r.OPEN ? (console.error("Connection is not open"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error")) : (r.send(JSON.stringify(c)), e.completionsHandlers.onFinish());
|
4307
4319
|
case 18:
|
@@ -4335,16 +4347,16 @@ var U = /*#__PURE__*/function () {
|
|
4335
4347
|
var _i$o;
|
4336
4348
|
var o = s.role || b.AI_ROLE,
|
4337
4349
|
a = i[o];
|
4338
|
-
s.text === r || s.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new
|
4350
|
+
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 ve(t), i[o].upsertStreamedMessage(s));
|
4339
4351
|
} else A.simulate(t, e.streamHandlers, s);
|
4340
4352
|
}
|
4341
4353
|
}]);
|
4342
4354
|
}();
|
4343
|
-
var
|
4344
|
-
function
|
4345
|
-
_classCallCheck(this,
|
4355
|
+
var Ae = /*#__PURE__*/function () {
|
4356
|
+
function Ae() {
|
4357
|
+
_classCallCheck(this, Ae);
|
4346
4358
|
}
|
4347
|
-
return _createClass(
|
4359
|
+
return _createClass(Ae, null, [{
|
4348
4360
|
key: "request",
|
4349
4361
|
value: function () {
|
4350
4362
|
var _request2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, i) {
|
@@ -4354,7 +4366,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4354
4366
|
case 0:
|
4355
4367
|
s = !0;
|
4356
4368
|
r = /*#__PURE__*/function () {
|
4357
|
-
var
|
4369
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(c) {
|
4358
4370
|
var h, u, d;
|
4359
4371
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
4360
4372
|
while (1) switch (_context11.prev = _context11.next) {
|
@@ -4377,7 +4389,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4377
4389
|
_context11.t0 = c;
|
4378
4390
|
case 8:
|
4379
4391
|
d = _context11.t0;
|
4380
|
-
|
4392
|
+
y.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : A.isSimulatable(e.stream, d) ? A.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(M.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
|
4381
4393
|
case 10:
|
4382
4394
|
case "end":
|
4383
4395
|
return _context11.stop();
|
@@ -4385,9 +4397,9 @@ var Ce = /*#__PURE__*/function () {
|
|
4385
4397
|
}, _callee11);
|
4386
4398
|
}));
|
4387
4399
|
return function r(_x24) {
|
4388
|
-
return
|
4400
|
+
return _ref5.apply(this, arguments);
|
4389
4401
|
};
|
4390
|
-
}(), o =
|
4402
|
+
}(), o = Ae.generateOptionalSignals();
|
4391
4403
|
(l = (a = e.connectSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
|
4392
4404
|
onResponse: r
|
4393
4405
|
}));
|
@@ -4419,16 +4431,16 @@ var Ce = /*#__PURE__*/function () {
|
|
4419
4431
|
var h, u;
|
4420
4432
|
var s = !0,
|
4421
4433
|
r = !1;
|
4422
|
-
var o = new
|
4434
|
+
var o = new ve(i),
|
4423
4435
|
a = function a() {
|
4424
4436
|
r || !s || (e.streamHandlers.onOpen(), r = !0);
|
4425
4437
|
},
|
4426
4438
|
l = function l() {
|
4427
|
-
s && (
|
4439
|
+
s && (Ae.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1);
|
4428
4440
|
},
|
4429
4441
|
c = /*#__PURE__*/function () {
|
4430
|
-
var
|
4431
|
-
var p,
|
4442
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(f) {
|
4443
|
+
var p, v, m;
|
4432
4444
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
4433
4445
|
while (1) switch (_context13.prev = _context13.next) {
|
4434
4446
|
case 0:
|
@@ -4439,7 +4451,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4439
4451
|
return _context13.abrupt("return");
|
4440
4452
|
case 2:
|
4441
4453
|
_context13.next = 4;
|
4442
|
-
return (
|
4454
|
+
return (v = (p = e.deepChat).responseInterceptor) == null ? void 0 : v.call(p, f);
|
4443
4455
|
case 4:
|
4444
4456
|
_context13.t0 = _context13.sent;
|
4445
4457
|
if (_context13.t0) {
|
@@ -4449,7 +4461,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4449
4461
|
_context13.t0 = f;
|
4450
4462
|
case 7:
|
4451
4463
|
m = _context13.t0;
|
4452
|
-
|
4464
|
+
y.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), s = !1) : A.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, m) : console.error(M.INVALID_RESPONSE(f, "server", !!e.deepChat.responseInterceptor, m));
|
4453
4465
|
case 9:
|
4454
4466
|
case "end":
|
4455
4467
|
return _context13.stop();
|
@@ -4457,13 +4469,13 @@ var Ce = /*#__PURE__*/function () {
|
|
4457
4469
|
}, _callee13);
|
4458
4470
|
}));
|
4459
4471
|
return function c(_x25) {
|
4460
|
-
return
|
4472
|
+
return _ref6.apply(this, arguments);
|
4461
4473
|
};
|
4462
4474
|
}();
|
4463
4475
|
e.streamHandlers.abortStream.abort = function () {
|
4464
|
-
|
4476
|
+
Ae.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1;
|
4465
4477
|
};
|
4466
|
-
var d =
|
4478
|
+
var d = Ae.generateOptionalSignals();
|
4467
4479
|
(u = (h = e.connectSettings).handler) == null || u.call(h, t, _objectSpread(_objectSpread({}, d), {}, {
|
4468
4480
|
onOpen: a,
|
4469
4481
|
onResponse: c,
|
@@ -4492,7 +4504,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4492
4504
|
i.isOpen = !1;
|
4493
4505
|
},
|
4494
4506
|
o = /*#__PURE__*/function () {
|
4495
|
-
var
|
4507
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(d) {
|
4496
4508
|
var u, f, h, m, p;
|
4497
4509
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
4498
4510
|
while (1) switch (_context14.prev = _context14.next) {
|
@@ -4514,7 +4526,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4514
4526
|
_context14.t0 = d;
|
4515
4527
|
case 7:
|
4516
4528
|
h = _context14.t0;
|
4517
|
-
if (!
|
4529
|
+
if (!y.validateResponseFormat(h)) console.error(M.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message");else if (typeof h.error == "string") console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error);else if (A.isSimulation(e.stream)) {
|
4518
4530
|
m = U.stream.bind(_this7, e, t, i.roleToStream), p = i.roleToStream[d.role || b.AI_ROLE];
|
4519
4531
|
A.upsertWFiles(t, m, p, d);
|
4520
4532
|
} else t.addNewMessage(h);
|
@@ -4525,10 +4537,10 @@ var Ce = /*#__PURE__*/function () {
|
|
4525
4537
|
}, _callee14);
|
4526
4538
|
}));
|
4527
4539
|
return function o(_x26) {
|
4528
|
-
return
|
4540
|
+
return _ref7.apply(this, arguments);
|
4529
4541
|
};
|
4530
4542
|
}(),
|
4531
|
-
a =
|
4543
|
+
a = Ae.generateOptionalSignals();
|
4532
4544
|
(c = (l = e.connectSettings).handler) == null || c.call(l, void 0, _objectSpread(_objectSpread({}, a), {}, {
|
4533
4545
|
onOpen: s,
|
4534
4546
|
onResponse: o,
|
@@ -4566,7 +4578,7 @@ var T = /*#__PURE__*/function () {
|
|
4566
4578
|
f,
|
4567
4579
|
m,
|
4568
4580
|
r,
|
4569
|
-
_yield$
|
4581
|
+
_yield$y$processReque3,
|
4570
4582
|
o,
|
4571
4583
|
a,
|
4572
4584
|
l,
|
@@ -4583,40 +4595,40 @@ var T = /*#__PURE__*/function () {
|
|
4583
4595
|
headers: (u = e.connectSettings) == null ? void 0 : u.headers
|
4584
4596
|
};
|
4585
4597
|
_context16.next = 4;
|
4586
|
-
return
|
4598
|
+
return y.processRequestInterceptor(e.deepChat, r);
|
4587
4599
|
case 4:
|
4588
|
-
_yield$
|
4589
|
-
o = _yield$
|
4590
|
-
a = _yield$
|
4591
|
-
l = _yield$
|
4600
|
+
_yield$y$processReque3 = _context16.sent;
|
4601
|
+
o = _yield$y$processReque3.body;
|
4602
|
+
a = _yield$y$processReque3.headers;
|
4603
|
+
l = _yield$y$processReque3.error;
|
4592
4604
|
c = e.completionsHandlers.onFinish;
|
4593
4605
|
if (!l) {
|
4594
4606
|
_context16.next = 11;
|
4595
4607
|
break;
|
4596
4608
|
}
|
4597
|
-
return _context16.abrupt("return",
|
4609
|
+
return _context16.abrupt("return", y.onInterceptorError(i, l, c));
|
4598
4610
|
case 11:
|
4599
4611
|
if (!((f = e.connectSettings) != null && f.handler)) {
|
4600
4612
|
_context16.next = 13;
|
4601
4613
|
break;
|
4602
4614
|
}
|
4603
|
-
return _context16.abrupt("return",
|
4615
|
+
return _context16.abrupt("return", Ae.request(e, o, i));
|
4604
4616
|
case 13:
|
4605
|
-
if (!(((m = e.connectSettings) == null ? void 0 : m.url) ===
|
4617
|
+
if (!(((m = e.connectSettings) == null ? void 0 : m.url) === ye.URL)) {
|
4606
4618
|
_context16.next = 15;
|
4607
4619
|
break;
|
4608
4620
|
}
|
4609
|
-
return _context16.abrupt("return",
|
4621
|
+
return _context16.abrupt("return", ye.request(e, i));
|
4610
4622
|
case 15:
|
4611
4623
|
d = !0;
|
4612
|
-
h =
|
4624
|
+
h = y.fetch.bind(this, e, a, s);
|
4613
4625
|
h(o).then(function (p) {
|
4614
4626
|
return d = !!p.ok, p;
|
4615
4627
|
}).then(function (p) {
|
4616
|
-
return
|
4628
|
+
return y.processResponseByType(p);
|
4617
4629
|
}).then(/*#__PURE__*/function () {
|
4618
|
-
var
|
4619
|
-
var j, G,
|
4630
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(p) {
|
4631
|
+
var j, G, v, x;
|
4620
4632
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
4621
4633
|
while (1) switch (_context15.prev = _context15.next) {
|
4622
4634
|
case 0:
|
@@ -4636,9 +4648,9 @@ var T = /*#__PURE__*/function () {
|
|
4636
4648
|
}
|
4637
4649
|
_context15.t0 = p;
|
4638
4650
|
case 7:
|
4639
|
-
|
4651
|
+
v = _context15.t0;
|
4640
4652
|
_context15.next = 10;
|
4641
|
-
return e.extractResultData(
|
4653
|
+
return e.extractResultData(v, h, o);
|
4642
4654
|
case 10:
|
4643
4655
|
x = _context15.sent;
|
4644
4656
|
if (d) {
|
@@ -4651,7 +4663,7 @@ var T = /*#__PURE__*/function () {
|
|
4651
4663
|
_context15.next = 15;
|
4652
4664
|
break;
|
4653
4665
|
}
|
4654
|
-
throw Error(M.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor,
|
4666
|
+
throw Error(M.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, v));
|
4655
4667
|
case 15:
|
4656
4668
|
x.makingAnotherRequest || (A.isSimulatable(e.stream, x) ? A.simulate(i, e.streamHandlers, x) : (i.addNewMessage(x), c()));
|
4657
4669
|
case 16:
|
@@ -4661,10 +4673,10 @@ var T = /*#__PURE__*/function () {
|
|
4661
4673
|
}, _callee15);
|
4662
4674
|
}));
|
4663
4675
|
return function (_x30) {
|
4664
|
-
return
|
4676
|
+
return _ref8.apply(this, arguments);
|
4665
4677
|
};
|
4666
4678
|
}())["catch"](function (p) {
|
4667
|
-
|
4679
|
+
y.displayError(i, p), c();
|
4668
4680
|
});
|
4669
4681
|
case 18:
|
4670
4682
|
case "end":
|
@@ -4684,7 +4696,7 @@ var T = /*#__PURE__*/function () {
|
|
4684
4696
|
fetch(t, i).then(function (o) {
|
4685
4697
|
return o.json();
|
4686
4698
|
}).then(/*#__PURE__*/function () {
|
4687
|
-
var
|
4699
|
+
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(o) {
|
4688
4700
|
var l, c, a;
|
4689
4701
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
4690
4702
|
while (1) switch (_context17.prev = _context17.next) {
|
@@ -4721,10 +4733,10 @@ var T = /*#__PURE__*/function () {
|
|
4721
4733
|
}, _callee17);
|
4722
4734
|
}));
|
4723
4735
|
return function (_x31) {
|
4724
|
-
return
|
4736
|
+
return _ref9.apply(this, arguments);
|
4725
4737
|
};
|
4726
4738
|
}())["catch"](function (o) {
|
4727
|
-
|
4739
|
+
y.displayError(s, o), r();
|
4728
4740
|
});
|
4729
4741
|
}
|
4730
4742
|
// prettier-ignore
|
@@ -4737,7 +4749,7 @@ var T = /*#__PURE__*/function () {
|
|
4737
4749
|
m,
|
4738
4750
|
p,
|
4739
4751
|
r,
|
4740
|
-
_yield$
|
4752
|
+
_yield$y$processReque4,
|
4741
4753
|
o,
|
4742
4754
|
a,
|
4743
4755
|
l,
|
@@ -4755,17 +4767,17 @@ var T = /*#__PURE__*/function () {
|
|
4755
4767
|
headers: (f = e.connectSettings) == null ? void 0 : f.headers
|
4756
4768
|
};
|
4757
4769
|
_context18.next = 4;
|
4758
|
-
return
|
4770
|
+
return y.processRequestInterceptor(e.deepChat, r);
|
4759
4771
|
case 4:
|
4760
|
-
_yield$
|
4761
|
-
o = _yield$
|
4762
|
-
a = _yield$
|
4763
|
-
l = _yield$
|
4772
|
+
_yield$y$processReque4 = _context18.sent;
|
4773
|
+
o = _yield$y$processReque4.body;
|
4774
|
+
a = _yield$y$processReque4.headers;
|
4775
|
+
l = _yield$y$processReque4.error;
|
4764
4776
|
if (!l) {
|
4765
4777
|
_context18.next = 10;
|
4766
4778
|
break;
|
4767
4779
|
}
|
4768
|
-
return _context18.abrupt("return",
|
4780
|
+
return _context18.abrupt("return", y.onInterceptorError(i, l));
|
4769
4781
|
case 10:
|
4770
4782
|
c = ((m = e.connectSettings) == null ? void 0 : m.url) || e.url || "", d = ((p = e.connectSettings) == null ? void 0 : p.method) || "POST", h = s ? JSON.stringify(o) : o, u = {
|
4771
4783
|
method: d,
|
@@ -4793,7 +4805,7 @@ var T = /*#__PURE__*/function () {
|
|
4793
4805
|
headers: i,
|
4794
4806
|
body: c || null
|
4795
4807
|
}).then(function (d) {
|
4796
|
-
return
|
4808
|
+
return y.processResponseByType(d);
|
4797
4809
|
}).then(function (d) {
|
4798
4810
|
l(d, e, r, o);
|
4799
4811
|
})["catch"](function (d) {
|
@@ -4841,21 +4853,31 @@ var pt = /*#__PURE__*/function () {
|
|
4841
4853
|
key: "processLoadedHistory",
|
4842
4854
|
value: function processLoadedHistory(e) {
|
4843
4855
|
var _this9 = this;
|
4844
|
-
var
|
4845
|
-
var
|
4846
|
-
|
4847
|
-
|
4848
|
-
|
4849
|
-
|
4856
|
+
var c;
|
4857
|
+
var _this$_messages = this._messages,
|
4858
|
+
t = _this$_messages.messageElementRefs,
|
4859
|
+
i = _this$_messages.messageToElements,
|
4860
|
+
s = _this$_messages.elementRef,
|
4861
|
+
r = _this$_messages.addAnyMessage,
|
4862
|
+
o = _this$_messages.sendClientUpdate,
|
4863
|
+
a = (c = t[0]) == null ? void 0 : c.outerContainer,
|
4864
|
+
l = s.scrollTop;
|
4865
|
+
e == null || e.reverse().map(function (d) {
|
4866
|
+
if (d) {
|
4867
|
+
var h = r(_objectSpread(_objectSpread({}, d), {}, {
|
4850
4868
|
sendUpdate: !0
|
4851
4869
|
}), !0, !0);
|
4852
|
-
|
4870
|
+
if (h) {
|
4871
|
+
var u = b.getNumberOfElements(h);
|
4872
|
+
i.unshift([h, t.slice(0, u)]);
|
4873
|
+
}
|
4874
|
+
return h;
|
4853
4875
|
} else _this9._isPaginationComplete = !0;
|
4854
|
-
}).filter(function (
|
4855
|
-
return !!
|
4856
|
-
}).reverse().forEach(function (
|
4857
|
-
return
|
4858
|
-
}),
|
4876
|
+
}).filter(function (d) {
|
4877
|
+
return !!d;
|
4878
|
+
}).reverse().forEach(function (d) {
|
4879
|
+
return o(d, !0);
|
4880
|
+
}), a && (s.scrollTop = l + a.offsetTop);
|
4859
4881
|
}
|
4860
4882
|
}, {
|
4861
4883
|
key: "setupLoadHistoryOnScroll",
|
@@ -5015,7 +5037,6 @@ var St = /*#__PURE__*/function () {
|
|
5015
5037
|
value: function getMaxMessages(e, t) {
|
5016
5038
|
return e.slice(Math.max(e.length - t, 0));
|
5017
5039
|
}
|
5018
|
-
// prettier-ignore
|
5019
5040
|
// if maxMessages is not defined we send all messages
|
5020
5041
|
// if maxMessages above 0 we send that number
|
5021
5042
|
// if maxMessages 0 or below we send only what is in the request
|
@@ -5139,7 +5160,7 @@ var it = /*#__PURE__*/function () {
|
|
5139
5160
|
var _a$url;
|
5140
5161
|
_classCallCheck(this, it);
|
5141
5162
|
var s, r, o, a, l;
|
5142
|
-
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = it.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (s = e.connect) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (r = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : r.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, P.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url =
|
5163
|
+
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 = ye.URL), this.connectSettings.websocket && U.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || le.checkForStream(this.deepChat), e.loadHistory && Ht.addErrorPrefix(this);
|
5143
5164
|
}
|
5144
5165
|
return _createClass(it, [{
|
5145
5166
|
key: "verifyKey",
|
@@ -5264,7 +5285,11 @@ var it = /*#__PURE__*/function () {
|
|
5264
5285
|
}
|
5265
5286
|
throw new Error("Request settings have not been set up");
|
5266
5287
|
case 2:
|
5267
|
-
i = St.processMessages(t.
|
5288
|
+
i = St.processMessages(t.messageToElements.map(function (_ref11) {
|
5289
|
+
var _ref12 = _slicedToArray(_ref11, 1),
|
5290
|
+
s = _ref12[0];
|
5291
|
+
return s;
|
5292
|
+
}), this.maxMessages, this.totalMessagesMaxCharLength);
|
5268
5293
|
if (this.connectSettings.websocket) {
|
5269
5294
|
s = _objectSpread({
|
5270
5295
|
messages: i
|
@@ -5301,7 +5326,7 @@ var it = /*#__PURE__*/function () {
|
|
5301
5326
|
}
|
5302
5327
|
return _context29.abrupt("return", le.handleResponseProperty(e));
|
5303
5328
|
case 4:
|
5304
|
-
if (!
|
5329
|
+
if (!y.validateResponseFormat(e)) {
|
5305
5330
|
_context29.next = 6;
|
5306
5331
|
break;
|
5307
5332
|
}
|
@@ -5415,19 +5440,19 @@ var ui = /*#__PURE__*/function () {
|
|
5415
5440
|
}
|
5416
5441
|
}]);
|
5417
5442
|
}();
|
5418
|
-
var
|
5443
|
+
var we = /*#__PURE__*/function (_HTMLElement) {
|
5419
5444
|
// If this is not working, try using propertyName directly
|
5420
|
-
function
|
5445
|
+
function we() {
|
5421
5446
|
var _this14;
|
5422
|
-
_classCallCheck(this,
|
5423
|
-
_this14 = _callSuper(this,
|
5424
|
-
var t =
|
5447
|
+
_classCallCheck(this, we);
|
5448
|
+
_this14 = _callSuper(this, we), _this14._waitingToRender_ = !1, _this14._propUpdated_ = !1, Object.keys(we._attributeToProperty_).forEach(function (e) {
|
5449
|
+
var t = we._attributeToProperty_[e];
|
5425
5450
|
_this14.constructPropertyAccessors(t), _this14.hasOwnProperty(e) || _this14.constructPropertyAccessors(t, e);
|
5426
5451
|
});
|
5427
5452
|
return _this14;
|
5428
5453
|
}
|
5429
|
-
_inherits(
|
5430
|
-
return _createClass(
|
5454
|
+
_inherits(we, _HTMLElement);
|
5455
|
+
return _createClass(we, [{
|
5431
5456
|
key: "constructPropertyAccessors",
|
5432
5457
|
value:
|
5433
5458
|
// need to be called here as accessors need to be set for the class instance
|
@@ -5446,8 +5471,8 @@ var _e = /*#__PURE__*/function (_HTMLElement) {
|
|
5446
5471
|
key: "attributeChangedCallback",
|
5447
5472
|
value: function attributeChangedCallback(e, t, i) {
|
5448
5473
|
if (t === i) return;
|
5449
|
-
var s =
|
5450
|
-
r =
|
5474
|
+
var s = we._attributes_[e](i),
|
5475
|
+
r = we._attributeToProperty_[e];
|
5451
5476
|
this[r] = s;
|
5452
5477
|
}
|
5453
5478
|
}, {
|
@@ -5456,12 +5481,12 @@ var _e = /*#__PURE__*/function (_HTMLElement) {
|
|
5456
5481
|
}], [{
|
5457
5482
|
key: "observedAttributes",
|
5458
5483
|
get: function get() {
|
5459
|
-
return Object.keys(
|
5484
|
+
return Object.keys(we._attributes_) || [];
|
5460
5485
|
}
|
5461
5486
|
}]);
|
5462
5487
|
}(/*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
5463
|
-
|
5464
|
-
var ls =
|
5488
|
+
we._attributes_ = {}, we._attributeToProperty_ = {};
|
5489
|
+
var ls = we;
|
5465
5490
|
var Co = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path d=\"\n\t\t\tM669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536\n\t\t\tc-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764\n\t\t\tc59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033\n\t\t\tl-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888\n\t\t\tc0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541\n\t\t\tc103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174\n\t\t\tc31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763\n\t\t\tc-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z\n\t\t\tM599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897\n\t\t\tc0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854\n\t\t\tc-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513\n\t\t\tL638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z\"\n\t\t\t/>\n</svg>\n",
|
5466
5491
|
Ao = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path id=\"path6686\" inkscape:connector-curvature=\"0\" d=\"M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612\n\t\t\tc-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612\n\t\t\tC699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.904,73.557\n\t\t\tc-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763\n\t\t\tc59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557\n\t\t\tc103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179\n\t\t\tc31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764\n\t\t\tc-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769\n\t\t\tc156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02\n\t\t\tC317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z\"/>\n</svg>\n";
|
5467
5492
|
var ie = /*#__PURE__*/function () {
|
@@ -6115,10 +6140,10 @@ var Ks = {
|
|
6115
6140
|
this.streamHandlers.abortStream.abort = function () {
|
6116
6141
|
i.interruptGenerate();
|
6117
6142
|
}, this.streamHandlers.onOpen();
|
6118
|
-
s = new
|
6143
|
+
s = new ve(e);
|
6119
6144
|
_context36.next = 4;
|
6120
6145
|
return i.generate(t, /*#__PURE__*/function () {
|
6121
|
-
var
|
6146
|
+
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(r, o) {
|
6122
6147
|
var a;
|
6123
6148
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
6124
6149
|
while (1) switch (_context35.prev = _context35.next) {
|
@@ -6140,7 +6165,7 @@ var Ks = {
|
|
6140
6165
|
}, _callee35);
|
6141
6166
|
}));
|
6142
6167
|
return function (_x63, _x64) {
|
6143
|
-
return
|
6168
|
+
return _ref13.apply(this, arguments);
|
6144
6169
|
};
|
6145
6170
|
}());
|
6146
6171
|
case 4:
|
@@ -6200,30 +6225,30 @@ var Ks = {
|
|
6200
6225
|
key: "generateResp",
|
6201
6226
|
value: function () {
|
6202
6227
|
var _generateResp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t, i) {
|
6203
|
-
var s, _yield$
|
6228
|
+
var s, _yield$y$processReque5, r, o, a, l, c;
|
6204
6229
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
6205
6230
|
while (1) switch (_context38.prev = _context38.next) {
|
6206
6231
|
case 0:
|
6207
6232
|
s = t[t.length - 1].text;
|
6208
6233
|
_context38.next = 3;
|
6209
|
-
return
|
6234
|
+
return y.processRequestInterceptor(this.deepChat, {
|
6210
6235
|
body: {
|
6211
6236
|
text: s
|
6212
6237
|
}
|
6213
6238
|
});
|
6214
6239
|
case 3:
|
6215
|
-
_yield$
|
6216
|
-
r = _yield$
|
6217
|
-
o = _yield$
|
6240
|
+
_yield$y$processReque5 = _context38.sent;
|
6241
|
+
r = _yield$y$processReque5.body;
|
6242
|
+
o = _yield$y$processReque5.error;
|
6218
6243
|
a = !!this.stream;
|
6219
6244
|
try {
|
6220
|
-
if (o)
|
6245
|
+
if (o) y.displayError(e, new Error(o)), (a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish)();else if (!r || !r.text) {
|
6221
6246
|
l = M.INVALID_MODEL_REQUEST({
|
6222
6247
|
body: r
|
6223
6248
|
}, !1);
|
6224
6249
|
console.error(l);
|
6225
6250
|
c = a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish;
|
6226
|
-
|
6251
|
+
y.onInterceptorError(e, l, c);
|
6227
6252
|
} else this.generateRespByType(e, r.text, !!this.stream, i);
|
6228
6253
|
} catch (l) {
|
6229
6254
|
this.unloadChat(l);
|
@@ -6318,7 +6343,7 @@ var Ks = {
|
|
6318
6343
|
_context40.next = 11;
|
6319
6344
|
break;
|
6320
6345
|
}
|
6321
|
-
|
6346
|
+
y.displayError(t, new Error(s.error));
|
6322
6347
|
return _context40.abrupt("return");
|
6323
6348
|
case 11:
|
6324
6349
|
if (!(!s || !s.text)) {
|
@@ -6326,7 +6351,7 @@ var Ks = {
|
|
6326
6351
|
break;
|
6327
6352
|
}
|
6328
6353
|
o = M.INVALID_MODEL_RESPONSE(i, !!e.responseInterceptor, s);
|
6329
|
-
|
6354
|
+
y.displayError(t, new Error(o));
|
6330
6355
|
return _context40.abrupt("return");
|
6331
6356
|
case 15:
|
6332
6357
|
return _context40.abrupt("return", s);
|
@@ -6596,11 +6621,11 @@ var Mo = /*#__PURE__*/function (_Jt2) {
|
|
6596
6621
|
}]);
|
6597
6622
|
}(Jt);
|
6598
6623
|
var Zt = "data:image/png;base64,";
|
6599
|
-
var
|
6600
|
-
function
|
6601
|
-
_classCallCheck(this,
|
6624
|
+
var Ee = /*#__PURE__*/function () {
|
6625
|
+
function Ee() {
|
6626
|
+
_classCallCheck(this, Ee);
|
6602
6627
|
}
|
6603
|
-
return _createClass(
|
6628
|
+
return _createClass(Ee, null, [{
|
6604
6629
|
key: "buildHeaders",
|
6605
6630
|
value: function buildHeaders(e) {
|
6606
6631
|
return {
|
@@ -6620,7 +6645,7 @@ var ve = /*#__PURE__*/function () {
|
|
6620
6645
|
return {
|
6621
6646
|
url: "https://api.stability.ai/v1/engines/list",
|
6622
6647
|
method: "GET",
|
6623
|
-
handleVerificationResult:
|
6648
|
+
handleVerificationResult: Ee.handleVerificationResult
|
6624
6649
|
};
|
6625
6650
|
}
|
6626
6651
|
}]);
|
@@ -6651,7 +6676,7 @@ var mi = /*#__PURE__*/function (_Oi) {
|
|
6651
6676
|
}
|
6652
6677
|
}
|
6653
6678
|
};
|
6654
|
-
_this24 = _callSuper(this, mi, [e,
|
6679
|
+
_this24 = _callSuper(this, mi, [e, Ee.buildKeyVerificationDetails(), Ee.buildHeaders, i, s]), _this24.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this24.textInputPlaceholderText = "Describe image changes", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Upscale</b></div>\n <p>Upload an image to generate a new one with higher resolution.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6655
6680
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
6656
6681
|
_typeof(r) == "object" && (r.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), mi.cleanConfig(r), Object.assign(_this24.rawBody, r)), _this24.canSendMessage = mi.canSendFileMessage;
|
6657
6682
|
return _this24;
|
@@ -6687,7 +6712,7 @@ var mi = /*#__PURE__*/function (_Oi) {
|
|
6687
6712
|
throw new Error("Image was not found");
|
6688
6713
|
case 4:
|
6689
6714
|
s = this.createFormDataBody(this.rawBody, i[0]);
|
6690
|
-
|
6715
|
+
y.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
6691
6716
|
case 6:
|
6692
6717
|
case "end":
|
6693
6718
|
return _context45.stop();
|
@@ -6758,7 +6783,7 @@ var gi = /*#__PURE__*/function (_Oi2) {
|
|
6758
6783
|
}
|
6759
6784
|
}
|
6760
6785
|
};
|
6761
|
-
_this25 = _callSuper(this, gi, [e,
|
6786
|
+
_this25 = _callSuper(this, gi, [e, Ee.buildKeyVerificationDetails(), Ee.buildHeaders, i, s]), _this25.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this25._maskSource = "MASK_IMAGE_WHITE", _this25.textInputPlaceholderText = "Describe image changes", _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Masking</b></div>\n <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6762
6787
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
6763
6788
|
_typeof(r) == "object" && (r.engine_id && (_this25.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this25._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this25._maskSource = r.mask_source), gi.cleanConfig(r), Object.assign(_this25.rawBody, r)), _this25.canSendMessage = gi.canSendFileTextMessage;
|
6764
6789
|
return _this25;
|
@@ -6794,7 +6819,7 @@ var gi = /*#__PURE__*/function (_Oi2) {
|
|
6794
6819
|
throw new Error("Image was not found");
|
6795
6820
|
case 4:
|
6796
6821
|
s = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], i[1], s);
|
6797
|
-
|
6822
|
+
y.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
6798
6823
|
case 6:
|
6799
6824
|
case "end":
|
6800
6825
|
return _context47.stop();
|
@@ -7127,7 +7152,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
|
|
7127
7152
|
}
|
7128
7153
|
}
|
7129
7154
|
};
|
7130
|
-
_this28 = _callSuper(this, bi, [e,
|
7155
|
+
_this28 = _callSuper(this, bi, [e, Ee.buildKeyVerificationDetails(), Ee.buildHeaders, i, s]), _this28.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this28.textInputPlaceholderText = "Describe image changes", _this28.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Image to Image</b></div>\n <p>Upload an image to create a new one with the changes you have described.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
7131
7156
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
7132
7157
|
_typeof(r) == "object" && (r.engine_id && (_this28.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this28._imageWeight = r.weight), bi.cleanConfig(r), Object.assign(_this28.rawBody, r)), _this28.canSendMessage = bi.canSendFileTextMessage;
|
7133
7158
|
return _this28;
|
@@ -7163,7 +7188,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
|
|
7163
7188
|
throw new Error("Image was not found");
|
7164
7189
|
case 4:
|
7165
7190
|
s = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], s);
|
7166
|
-
|
7191
|
+
y.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
7167
7192
|
case 6:
|
7168
7193
|
case "end":
|
7169
7194
|
return _context54.stop();
|
@@ -7265,7 +7290,7 @@ var vi = /*#__PURE__*/function (_Oi4) {
|
|
7265
7290
|
var r;
|
7266
7291
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7267
7292
|
i = t.stabilityAI;
|
7268
|
-
_this29 = _callSuper(this, vi, [e,
|
7293
|
+
_this29 = _callSuper(this, vi, [e, Ee.buildKeyVerificationDetails(), Ee.buildHeaders, i]), _this29.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this29.textInputPlaceholderText = "Describe an image", _this29.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Text to Image</b></div>\n <p>Insert text to generate an image.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
7269
7294
|
var s = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
7270
7295
|
_typeof(s) == "object" && (s.engine_id && (_this29.url = "https://api.stability.ai/v1/generation/".concat(s.engine_id, "/text-to-image")), s.weight !== void 0 && s.weight !== null && (_this29._imageWeight = s.weight), vi.cleanConfig(s), Object.assign(_this29.rawBody, s)), _this29.canSendMessage = vi.canSendTextMessage;
|
7271
7296
|
return _this29;
|
@@ -7434,8 +7459,8 @@ var L = /*#__PURE__*/function () {
|
|
7434
7459
|
s = _args60.length > 3 && _args60[3] !== undefined ? _args60[3] : !0;
|
7435
7460
|
e.connectSettings.method = i;
|
7436
7461
|
_context60.next = 4;
|
7437
|
-
return
|
7438
|
-
return
|
7462
|
+
return y.fetch(e, e.connectSettings.headers, s, t).then(function (o) {
|
7463
|
+
return y.processResponseByType(o);
|
7439
7464
|
});
|
7440
7465
|
case 4:
|
7441
7466
|
r = _context60.sent;
|
@@ -7479,10 +7504,10 @@ var ee = /*#__PURE__*/function () {
|
|
7479
7504
|
return _context62.abrupt("return");
|
7480
7505
|
case 3:
|
7481
7506
|
e.url = s;
|
7482
|
-
o = r[
|
7483
|
-
delete r[
|
7507
|
+
o = r[y.CONTENT_TYPE];
|
7508
|
+
delete r[y.CONTENT_TYPE];
|
7484
7509
|
a = i.map(/*#__PURE__*/function () {
|
7485
|
-
var
|
7510
|
+
var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(l) {
|
7486
7511
|
var c;
|
7487
7512
|
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
7488
7513
|
while (1) switch (_context61.prev = _context61.next) {
|
@@ -7498,7 +7523,7 @@ var ee = /*#__PURE__*/function () {
|
|
7498
7523
|
}, _callee61);
|
7499
7524
|
}));
|
7500
7525
|
return function (_x114) {
|
7501
|
-
return
|
7526
|
+
return _ref14.apply(this, arguments);
|
7502
7527
|
};
|
7503
7528
|
}());
|
7504
7529
|
_context62.prev = 7;
|
@@ -7511,11 +7536,11 @@ var ee = /*#__PURE__*/function () {
|
|
7511
7536
|
name: c.filename
|
7512
7537
|
};
|
7513
7538
|
});
|
7514
|
-
return _context62.abrupt("return", (r[
|
7539
|
+
return _context62.abrupt("return", (r[y.CONTENT_TYPE] = o, l));
|
7515
7540
|
case 14:
|
7516
7541
|
_context62.prev = 14;
|
7517
7542
|
_context62.t0 = _context62["catch"](7);
|
7518
|
-
throw r[
|
7543
|
+
throw r[y.CONTENT_TYPE] = o, y.displayError(t, _context62.t0), e.completionsHandlers.onFinish(), _context62.t0;
|
7519
7544
|
case 17:
|
7520
7545
|
case "end":
|
7521
7546
|
return _context62.stop();
|
@@ -7541,8 +7566,8 @@ var ee = /*#__PURE__*/function () {
|
|
7541
7566
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
7542
7567
|
while (1) switch (_context63.prev = _context63.next) {
|
7543
7568
|
case 0:
|
7544
|
-
r = t.map(function (
|
7545
|
-
var l =
|
7569
|
+
r = t.map(function (_ref15) {
|
7570
|
+
var l = _ref15.fileId;
|
7546
7571
|
return e.url = "".concat(i).concat(l).concat(s), new Promise(function (c) {
|
7547
7572
|
c(L.directFetch(e, void 0, "GET", !1));
|
7548
7573
|
});
|
@@ -7692,7 +7717,7 @@ var ee = /*#__PURE__*/function () {
|
|
7692
7717
|
value: function parseMessages(e, t, i) {
|
7693
7718
|
var s = [];
|
7694
7719
|
return t.forEach(/*#__PURE__*/function () {
|
7695
|
-
var
|
7720
|
+
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee67(r) {
|
7696
7721
|
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
7697
7722
|
while (1) switch (_context67.prev = _context67.next) {
|
7698
7723
|
case 0:
|
@@ -7701,7 +7726,7 @@ var ee = /*#__PURE__*/function () {
|
|
7701
7726
|
}).sort(function (o) {
|
7702
7727
|
return o.text ? -1 : o.image_file ? 1 : 0;
|
7703
7728
|
}).forEach(/*#__PURE__*/function () {
|
7704
|
-
var
|
7729
|
+
var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee66(o) {
|
7705
7730
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
7706
7731
|
while (1) switch (_context66.prev = _context66.next) {
|
7707
7732
|
case 0:
|
@@ -7713,7 +7738,7 @@ var ee = /*#__PURE__*/function () {
|
|
7713
7738
|
}, _callee66);
|
7714
7739
|
}));
|
7715
7740
|
return function (_x129) {
|
7716
|
-
return
|
7741
|
+
return _ref17.apply(this, arguments);
|
7717
7742
|
};
|
7718
7743
|
}());
|
7719
7744
|
case 1:
|
@@ -7723,7 +7748,7 @@ var ee = /*#__PURE__*/function () {
|
|
7723
7748
|
}, _callee67);
|
7724
7749
|
}));
|
7725
7750
|
return function (_x128) {
|
7726
|
-
return
|
7751
|
+
return _ref16.apply(this, arguments);
|
7727
7752
|
};
|
7728
7753
|
}()), Promise.all(s);
|
7729
7754
|
}
|
@@ -7773,7 +7798,7 @@ var ee = /*#__PURE__*/function () {
|
|
7773
7798
|
}]);
|
7774
7799
|
}();
|
7775
7800
|
ee.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", ee.FUNCTION_TOOL_RESP_ERROR = "Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.";
|
7776
|
-
var
|
7801
|
+
var xe = ee;
|
7777
7802
|
var De = /*#__PURE__*/function (_z3) {
|
7778
7803
|
// prettier-ignore
|
7779
7804
|
function De(e, t, i, s, r, o) {
|
@@ -7787,9 +7812,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
7787
7812
|
a = _this31$config.new_assistant,
|
7788
7813
|
l = _this31$config.thread_id,
|
7789
7814
|
c = _this31$config.load_thread_history;
|
7790
|
-
Object.assign(_this31.newAssistantDetails, a), l && (_this31.sessionId = l), c && (_this31.shouldFetchHistory = !0);
|
7791
|
-
var d = t.function_handler;
|
7792
|
-
d && (_this31._functionHandler = d), _this31.filesToolType = t.files_tool_type;
|
7815
|
+
Object.assign(_this31.newAssistantDetails, a), l && (_this31.sessionId = l), c && (_this31.shouldFetchHistory = !0), _this31.filesToolType = t.files_tool_type;
|
7793
7816
|
}
|
7794
7817
|
_this31.maxMessages = 1, _this31.isSSEStream = !!(_this31.stream && (_typeof(_this31.stream) != "object" || !_this31.stream.simulation));
|
7795
7818
|
return _assertThisInitialized(_this31);
|
@@ -7838,16 +7861,16 @@ var De = /*#__PURE__*/function (_z3) {
|
|
7838
7861
|
if (t && t.length > 0) {
|
7839
7862
|
var r = this.filesToolType;
|
7840
7863
|
if (typeof this.filesToolType == "function") {
|
7841
|
-
var a = this.filesToolType(t.map(function (
|
7842
|
-
var l =
|
7864
|
+
var a = this.filesToolType(t.map(function (_ref18) {
|
7865
|
+
var l = _ref18.name;
|
7843
7866
|
return l;
|
7844
7867
|
}));
|
7845
7868
|
a === "code_interpreter" || a === "file_search" || a === "images" ? r = a : (console.error("Tool type \"".concat(a, "\" is not valid")), console.error('Expected "code_interpreter" or "file_search" or "images". Going to default to "images"'));
|
7846
7869
|
}
|
7847
7870
|
if (r === "file_search") return De.processAttachmentsMessage(s, t, "file_search");
|
7848
7871
|
if (r === "code_interpreter") return De.processAttachmentsMessage(s, t, "code_interpreter");
|
7849
|
-
if (t.find(function (
|
7850
|
-
var a =
|
7872
|
+
if (t.find(function (_ref19) {
|
7873
|
+
var a = _ref19.name;
|
7851
7874
|
return !B.isImageFileExtension(a);
|
7852
7875
|
})) console.error("The uploaded files contained a non-image file"), console.error('Make sure only images can be uploaded or define a "code_interpreter" or "file_search" value in the "files_tool_type" property'), console.warn('Make sure your existing assistant supports these "tools" or specify them in the "new_assistant" property');else {
|
7853
7876
|
var _a2 = De.processImageMessage(s, t);
|
@@ -7916,13 +7939,13 @@ var De = /*#__PURE__*/function (_z3) {
|
|
7916
7939
|
case 11:
|
7917
7940
|
r.assistant_id = _context71.t0;
|
7918
7941
|
case 12:
|
7919
|
-
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.
|
7942
|
+
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messageToElements);
|
7920
7943
|
if (!i) {
|
7921
7944
|
_context71.next = 19;
|
7922
7945
|
break;
|
7923
7946
|
}
|
7924
7947
|
_context71.next = 16;
|
7925
|
-
return
|
7948
|
+
return xe.storeFiles(this, e, i, this.urlSegments.storeFiles);
|
7926
7949
|
case 16:
|
7927
7950
|
_context71.t1 = _context71.sent;
|
7928
7951
|
_context71.next = 20;
|
@@ -7976,10 +7999,12 @@ var De = /*#__PURE__*/function (_z3) {
|
|
7976
7999
|
}, {
|
7977
8000
|
key: "searchPreviousMessagesForThreadId",
|
7978
8001
|
value: function searchPreviousMessagesForThreadId(e) {
|
7979
|
-
var t = e.find(function (
|
8002
|
+
var t = e.find(function (_ref20) {
|
8003
|
+
var _ref21 = _slicedToArray(_ref20, 1),
|
8004
|
+
i = _ref21[0];
|
7980
8005
|
return i._sessionId;
|
7981
8006
|
});
|
7982
|
-
t && (this.sessionId = t._sessionId), this.searchedForThreadId = !0;
|
8007
|
+
t && (this.sessionId = t[0]._sessionId), this.searchedForThreadId = !0;
|
7983
8008
|
}
|
7984
8009
|
// prettier-ignore
|
7985
8010
|
}, {
|
@@ -8003,7 +8028,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8003
8028
|
_context73.next = 6;
|
8004
8029
|
break;
|
8005
8030
|
}
|
8006
|
-
throw e.error.message.startsWith(
|
8031
|
+
throw e.error.message.startsWith(xe.FILES_WITH_TEXT_ERROR) ? Error("Please send text with your file(s)") : e.error.message;
|
8007
8032
|
case 6:
|
8008
8033
|
_context73.next = 8;
|
8009
8034
|
return this.assignThreadAndRun(e);
|
@@ -8047,7 +8072,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8047
8072
|
_context74.next = 9;
|
8048
8073
|
break;
|
8049
8074
|
case 8:
|
8050
|
-
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && this.messages.
|
8075
|
+
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && this.messages.messageToElements.length > 0 && (this.messages.messageToElements[this.messages.messageToElements.length - 1][0]._sessionId = this.sessionId);
|
8051
8076
|
case 9:
|
8052
8077
|
case "end":
|
8053
8078
|
return _context74.stop();
|
@@ -8087,7 +8112,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8087
8112
|
case 9:
|
8088
8113
|
i = _context75.sent;
|
8089
8114
|
case 10:
|
8090
|
-
return _context75.abrupt("return",
|
8115
|
+
return _context75.abrupt("return", xe.processAPIMessages(this, i, t, this.urlSegments));
|
8091
8116
|
case 11:
|
8092
8117
|
case "end":
|
8093
8118
|
return _context75.stop();
|
@@ -8188,7 +8213,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8188
8213
|
_context77.next = 8;
|
8189
8214
|
break;
|
8190
8215
|
}
|
8191
|
-
throw Error(
|
8216
|
+
throw Error(xe.FUNCTION_TOOL_RESP_ERROR);
|
8192
8217
|
case 8:
|
8193
8218
|
_context77.next = 10;
|
8194
8219
|
return Promise.all(i);
|
@@ -8200,7 +8225,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8200
8225
|
_context77.next = 13;
|
8201
8226
|
break;
|
8202
8227
|
}
|
8203
|
-
throw Error(
|
8228
|
+
throw Error(xe.FUNCTION_TOOL_RESP_ERROR);
|
8204
8229
|
case 13:
|
8205
8230
|
r = s.map(function (l, c) {
|
8206
8231
|
return {
|
@@ -8305,7 +8330,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8305
8330
|
}
|
8306
8331
|
l = e.content.find(function (d) {
|
8307
8332
|
return !!d.text;
|
8308
|
-
}) || e.content[0], c =
|
8333
|
+
}) || e.content[0], c = xe.getFilesAndText.bind(this, this, {
|
8309
8334
|
role: "assistant",
|
8310
8335
|
content: e.content
|
8311
8336
|
}, this.urlSegments, l);
|
@@ -8329,7 +8354,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8329
8354
|
break;
|
8330
8355
|
}
|
8331
8356
|
_context79.next = 11;
|
8332
|
-
return
|
8357
|
+
return xe.processStreamMessages(this, e.delta.content, this.urlSegments);
|
8333
8358
|
case 11:
|
8334
8359
|
_l = _context79.sent;
|
8335
8360
|
return _context79.abrupt("return", {
|
@@ -8429,12 +8454,16 @@ var Ii = /*#__PURE__*/function (_yi) {
|
|
8429
8454
|
var _o$headers2, _a$OpenAIBeta;
|
8430
8455
|
var _this34;
|
8431
8456
|
_classCallCheck(this, Ii);
|
8432
|
-
var r, o, a;
|
8457
|
+
var r, o, a, l, c;
|
8433
8458
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8434
8459
|
i = t.openAI,
|
8435
8460
|
s = (r = t.openAI) == null ? void 0 : r.assistant;
|
8436
|
-
_this34 = _callSuper(this, Ii, [e, s, Ii.URL_SEGMENTS, L.buildKeyVerificationDetails(), L.buildHeaders, i]), (_o$headers2 = (o = _this34.connectSettings).headers) !== null && _o$headers2 !== void 0 ? _o$headers2 : o.headers = {}, (_a$OpenAIBeta = (a = _this34.connectSettings.headers)["OpenAI-Beta"]) !== null && _a$OpenAIBeta !== void 0 ? _a$OpenAIBeta : a["OpenAI-Beta"] = "assistants=v2", _this34.shouldFetchHistory && _this34.sessionId && (_this34.fetchHistory = _this34.fetchHistoryFunc.bind(_assertThisInitialized(_this34)))
|
8437
|
-
|
8461
|
+
if (_this34 = _callSuper(this, Ii, [e, s, Ii.URL_SEGMENTS, L.buildKeyVerificationDetails(), L.buildHeaders, i]), (_o$headers2 = (o = _this34.connectSettings).headers) !== null && _o$headers2 !== void 0 ? _o$headers2 : o.headers = {}, (_a$OpenAIBeta = (a = _this34.connectSettings.headers)["OpenAI-Beta"]) !== null && _a$OpenAIBeta !== void 0 ? _a$OpenAIBeta : a["OpenAI-Beta"] = "assistants=v2", _this34.shouldFetchHistory && _this34.sessionId && (_this34.fetchHistory = _this34.fetchHistoryFunc.bind(_assertThisInitialized(_this34))), _typeof(s) == "object") {
|
8462
|
+
var _ref22 = (c = (l = e.directConnection) == null ? void 0 : l.openAI) == null ? void 0 : c.assistant,
|
8463
|
+
d = _ref22.function_handler;
|
8464
|
+
d && (_this34._functionHandler = d);
|
8465
|
+
}
|
8466
|
+
return _assertThisInitialized(_this34);
|
8438
8467
|
}
|
8439
8468
|
_inherits(Ii, _yi);
|
8440
8469
|
return _createClass(Ii);
|
@@ -8604,10 +8633,10 @@ Ls.URL_DETAILS_ERROR_MESSAGE = "Please define the Azure URL Details. [More Infor
|
|
8604
8633
|
var oe = Ls;
|
8605
8634
|
var mt = /*#__PURE__*/function (_yi2) {
|
8606
8635
|
function mt(e) {
|
8607
|
-
var
|
8636
|
+
var _p$headers;
|
8608
8637
|
var _this36;
|
8609
8638
|
_classCallCheck(this, mt);
|
8610
|
-
var c, d, h, u, f;
|
8639
|
+
var c, d, h, u, f, m, p;
|
8611
8640
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8612
8641
|
i = t.azure,
|
8613
8642
|
s = (c = t.azure) == null ? void 0 : c.openAI,
|
@@ -8624,14 +8653,19 @@ var mt = /*#__PURE__*/function (_yi2) {
|
|
8624
8653
|
getFilesPrefix: "".concat(o, "files/"),
|
8625
8654
|
getFilesPostfix: "/content".concat(a)
|
8626
8655
|
};
|
8627
|
-
_this36 = _callSuper(this, mt, [e, s == null ? void 0 : s.assistant, l, oe.buildKeyVerificationDetails(r), oe.buildHeaders, i]), _this36.permittedErrorPrefixes = [oe.URL_DETAILS_ERROR_MESSAGE], _this36.insertKeyPlaceholderText = "Azure OpenAI API Key", _this36.keyHelpUrl = "https://learn.microsoft.com/en-us/answers/questions/1193991/how-to-get-the-value-of-openai-api-key", _this36.isTextInputDisabled = !1,
|
8656
|
+
if (_this36 = _callSuper(this, mt, [e, s == null ? void 0 : s.assistant, l, oe.buildKeyVerificationDetails(r), oe.buildHeaders, i]), _this36.permittedErrorPrefixes = [oe.URL_DETAILS_ERROR_MESSAGE], _this36.insertKeyPlaceholderText = "Azure OpenAI API Key", _this36.keyHelpUrl = "https://learn.microsoft.com/en-us/answers/questions/1193991/how-to-get-the-value-of-openai-api-key", _this36.isTextInputDisabled = !1, _typeof(s) == "object") {
|
8657
|
+
var _ref23 = (m = (f = e.directConnection) == null ? void 0 : f.azure) == null ? void 0 : m.openAI,
|
8658
|
+
v = _ref23.function_handler;
|
8659
|
+
v && (_this36._functionHandler = v);
|
8660
|
+
}
|
8661
|
+
oe.validateURLDetails(r) ? (_p$headers = (p = _this36.connectSettings).headers) !== null && _p$headers !== void 0 ? _p$headers : p.headers = {} : (_this36.isTextInputDisabled = !0, _this36.canSendMessage = function () {
|
8628
8662
|
return !1;
|
8629
8663
|
}, setTimeout(function () {
|
8630
8664
|
e.addMessage({
|
8631
8665
|
error: oe.URL_DETAILS_ERROR_MESSAGE
|
8632
8666
|
});
|
8633
8667
|
}));
|
8634
|
-
return _this36;
|
8668
|
+
return _assertThisInitialized(_this36);
|
8635
8669
|
}
|
8636
8670
|
_inherits(mt, _yi2);
|
8637
8671
|
return _createClass(mt);
|
@@ -8861,7 +8895,7 @@ var de = /*#__PURE__*/function (_z6) {
|
|
8861
8895
|
case 4:
|
8862
8896
|
this.url = this.connectSettings.url || this._service_url;
|
8863
8897
|
s = this.preprocessBody(this.rawBody, t), r = de.createFormDataBody(s, i[0]);
|
8864
|
-
|
8898
|
+
y.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
8865
8899
|
case 7:
|
8866
8900
|
case "end":
|
8867
8901
|
return _context87.stop();
|
@@ -9684,8 +9718,8 @@ var vt = /*#__PURE__*/function (_z11) {
|
|
9684
9718
|
var d = r || ((h = o.openAI) == null ? void 0 : h.chat);
|
9685
9719
|
if (_typeof(d) == "object") {
|
9686
9720
|
d.system_prompt && (_this46._systemMessage = vt.generateSystemMessage(d.system_prompt));
|
9687
|
-
var
|
9688
|
-
p =
|
9721
|
+
var _ref24 = (f = (u = e.directConnection) == null ? void 0 : u.openAI) == null ? void 0 : f.chat,
|
9722
|
+
p = _ref24.function_handler;
|
9689
9723
|
p && (_this46._functionHandler = p), _this46.cleanConfig(d), Object.assign(_this46.rawBody, d);
|
9690
9724
|
}
|
9691
9725
|
(_this46$maxMessages = _this46.maxMessages) !== null && _this46$maxMessages !== void 0 ? _this46$maxMessages : _this46.maxMessages = -1, (_m$model = (m = _this46.rawBody).model) !== null && _m$model !== void 0 ? _m$model : m.model = "gpt-4o";
|
@@ -9876,7 +9910,7 @@ var vt = /*#__PURE__*/function (_z11) {
|
|
9876
9910
|
_context104.prev = 17;
|
9877
9911
|
_context104.next = 20;
|
9878
9912
|
return t == null ? void 0 : t(s).then(function (f) {
|
9879
|
-
return
|
9913
|
+
return y.processResponseByType(f);
|
9880
9914
|
});
|
9881
9915
|
case 20:
|
9882
9916
|
_u = _context104.sent;
|
@@ -9950,19 +9984,24 @@ var As = /*#__PURE__*/function (_vt) {
|
|
9950
9984
|
function As(e) {
|
9951
9985
|
var _this48;
|
9952
9986
|
_classCallCheck(this, As);
|
9953
|
-
var o, a, l, c;
|
9987
|
+
var o, a, l, c, d, h, u;
|
9954
9988
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
9955
9989
|
i = t.azure,
|
9956
9990
|
s = ((a = (o = t.azure) == null ? void 0 : o.openAI) == null ? void 0 : a.urlDetails) || {},
|
9957
9991
|
r = (c = (l = t.azure) == null ? void 0 : l.openAI) == null ? void 0 : c.chat;
|
9958
|
-
_this48 = _callSuper(this, As, [e, oe.buildKeyVerificationDetails(s), oe.buildHeaders, i, r]), _this48.permittedErrorPrefixes = [oe.URL_DETAILS_ERROR_MESSAGE], _this48.isTextInputDisabled = !1,
|
9992
|
+
if (_this48 = _callSuper(this, As, [e, oe.buildKeyVerificationDetails(s), oe.buildHeaders, i, r]), _this48.permittedErrorPrefixes = [oe.URL_DETAILS_ERROR_MESSAGE], _this48.isTextInputDisabled = !1, _typeof(r) == "object") {
|
9993
|
+
var _ref25 = (u = (h = (d = e.directConnection) == null ? void 0 : d.azure) == null ? void 0 : h.openAI) == null ? void 0 : u.chat,
|
9994
|
+
f = _ref25.function_handler;
|
9995
|
+
f && (_this48._functionHandler = f);
|
9996
|
+
}
|
9997
|
+
oe.validateURLDetails(s) ? _this48.url = As.buildURL(s) : (_this48.isTextInputDisabled = !0, _this48.canSendMessage = function () {
|
9959
9998
|
return !1;
|
9960
9999
|
}, setTimeout(function () {
|
9961
10000
|
e.addMessage({
|
9962
10001
|
error: oe.URL_DETAILS_ERROR_MESSAGE
|
9963
10002
|
});
|
9964
10003
|
}));
|
9965
|
-
return _this48;
|
10004
|
+
return _assertThisInitialized(_this48);
|
9966
10005
|
}
|
9967
10006
|
_inherits(As, _vt);
|
9968
10007
|
return _createClass(As, null, [{
|
@@ -10023,7 +10062,7 @@ var he = /*#__PURE__*/function (_z12) {
|
|
10023
10062
|
var l = this.preprocessBody(this.rawBody, r);
|
10024
10063
|
s = he.createFormDataBody(l, i[0], i[1]);
|
10025
10064
|
} else this.url = he.IMAGE_VARIATIONS_URL, s = he.createFormDataBody(this.rawBody, i[0]);
|
10026
|
-
|
10065
|
+
y.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
10027
10066
|
}
|
10028
10067
|
}, {
|
10029
10068
|
key: "callServiceAPI",
|
@@ -10524,32 +10563,32 @@ var Oe = /*#__PURE__*/function () {
|
|
10524
10563
|
}
|
10525
10564
|
}]);
|
10526
10565
|
}();
|
10527
|
-
var
|
10528
|
-
function
|
10566
|
+
var me = /*#__PURE__*/function (_Be) {
|
10567
|
+
function me(e, t, i) {
|
10529
10568
|
var _this52;
|
10530
|
-
_classCallCheck(this,
|
10569
|
+
_classCallCheck(this, me);
|
10531
10570
|
var a, l;
|
10532
|
-
_this52 = _callSuper(this,
|
10571
|
+
_this52 = _callSuper(this, me, [e]);
|
10533
10572
|
var s = t.permittedErrorPrefixes,
|
10534
10573
|
r = t.introPanelMarkUp,
|
10535
10574
|
o = t.demo;
|
10536
|
-
_this52._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this52._onClearMessages = hi.onClearMessages.bind(_this52, e), _this52._onError = hi.onError.bind(_this52, e), _this52._displayLoadingMessage =
|
10537
|
-
return JSON.parse(JSON.stringify(_this52.
|
10575
|
+
_this52._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this52._onClearMessages = hi.onClearMessages.bind(_this52, e), _this52._onError = hi.onError.bind(_this52, e), _this52._displayLoadingMessage = me.getDisplayLoadingMessage(e, t), _this52._permittedErrorPrefixes = s, _this52.addSetupMessageIfNeeded(e, t) || _this52.populateIntroPanel(i, r, e.introPanelStyle), _this52.addIntroductoryMessages(e, t), new Ht(e, _this52, t), _this52._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
10576
|
+
return JSON.parse(JSON.stringify(_this52.messageToElements.map(function (_ref26) {
|
10577
|
+
var _ref27 = _slicedToArray(_ref26, 1),
|
10578
|
+
c = _ref27[0];
|
10579
|
+
return c;
|
10580
|
+
})));
|
10538
10581
|
}, e.clearMessages = _this52.clearMessages.bind(_this52, t), e.refreshMessages = _this52.refreshTextMessages.bind(_this52), e.scrollToBottom = J.scrollToBottom.bind(_this52, _this52.elementRef), e.addMessage = function (c, d) {
|
10539
10582
|
_this52.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
|
10540
10583
|
sendUpdate: !!d
|
10541
10584
|
}), !d);
|
10542
|
-
}, t.isWebModel() && t.setUpMessages(_this52), o && _this52.prepareDemo(o), e.textToSpeech && bt.processConfig(e.textToSpeech, function (c) {
|
10585
|
+
}, e.updateHTMLMessage = _this52.updateHTMLMessage.bind(_this52), t.isWebModel() && t.setUpMessages(_this52), o && _this52.prepareDemo(o), e.textToSpeech && bt.processConfig(e.textToSpeech, function (c) {
|
10543
10586
|
_this52.textToSpeech = c;
|
10544
10587
|
});
|
10545
10588
|
return _this52;
|
10546
10589
|
}
|
10547
|
-
|
10548
|
-
|
10549
|
-
// this.messages[2].html = '<div>overwrite</div>';
|
10550
|
-
// }
|
10551
|
-
_inherits(Ee, _Be);
|
10552
|
-
return _createClass(Ee, [{
|
10590
|
+
_inherits(me, _Be);
|
10591
|
+
return _createClass(me, [{
|
10553
10592
|
key: "prepareDemo",
|
10554
10593
|
value: function prepareDemo(e) {
|
10555
10594
|
_typeof(e) == "object" && (e.response && (this.customDemoResponse = e.response), e.displayErrors && (e.displayErrors["default"] && this.addNewErrorMessage("", ""), e.displayErrors.service && this.addNewErrorMessage("service", ""), e.displayErrors.speechToText && this.addNewErrorMessage("speechToText", "")), e.displayLoadingBubble && this.addLoadingMessage());
|
@@ -10581,7 +10620,7 @@ var Ee = /*#__PURE__*/function (_Be) {
|
|
10581
10620
|
value: function addIntroductoryMessage(e) {
|
10582
10621
|
var i;
|
10583
10622
|
var t;
|
10584
|
-
e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t =
|
10623
|
+
e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t = be.add(this, e.html, b.AI_ROLE, this.messageElementRefs)), t && (this.applyCustomStyles(t, b.AI_ROLE, !1, (i = this.messageStyles) == null ? void 0 : i.intro), t.outerContainer.classList.add("deep-chat-intro"));
|
10585
10624
|
}
|
10586
10625
|
}, {
|
10587
10626
|
key: "removeIntroductoryMessage",
|
@@ -10602,13 +10641,16 @@ var Ee = /*#__PURE__*/function (_Be) {
|
|
10602
10641
|
value: function addNewMessage(e) {
|
10603
10642
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
10604
10643
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
10605
|
-
var s =
|
10644
|
+
var s = me.createMessageContent(e),
|
10606
10645
|
r = {
|
10607
10646
|
status: e.overwrite
|
10608
10647
|
};
|
10609
10648
|
if (!e.ignoreText && s.text !== void 0 && e.text !== null && (this.addNewTextMessage(s.text, s.role, r, i), !t && this.textToSpeech && s.role !== b.USER_ROLE && bt.speak(s.text, this.textToSpeech)), s.files && Array.isArray(s.files) && Oe.addMessages(this, s.files, s.role, i), s.html !== void 0 && s.html !== null) {
|
10610
|
-
var o =
|
10611
|
-
|
10649
|
+
var o = be.add(this, s.html, s.role, this.messageElementRefs, r, i);
|
10650
|
+
if (Re.isElementTemporary(o) && delete s.html, s.html) {
|
10651
|
+
var a = [o, s];
|
10652
|
+
b.updateRefArr(this.htmlElementsToMessage, a, i);
|
10653
|
+
}
|
10612
10654
|
}
|
10613
10655
|
return this.isValidMessageContent(s) && !i && this.updateStateOnMessage(s, e.overwrite, e.sendUpdate, t), s;
|
10614
10656
|
}
|
@@ -10622,7 +10664,11 @@ var Ee = /*#__PURE__*/function (_Be) {
|
|
10622
10664
|
value: function updateStateOnMessage(e, t) {
|
10623
10665
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
10624
10666
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
10625
|
-
|
10667
|
+
if (!t) {
|
10668
|
+
var r = b.getNumberOfElements(e);
|
10669
|
+
this.messageToElements.push([e, this.messageElementRefs.slice(this.messageElementRefs.length - r)]);
|
10670
|
+
}
|
10671
|
+
i && this.sendClientUpdate(e, s);
|
10626
10672
|
}
|
10627
10673
|
// prettier-ignore
|
10628
10674
|
}, {
|
@@ -10630,7 +10676,7 @@ var Ee = /*#__PURE__*/function (_Be) {
|
|
10630
10676
|
value: function removeMessageOnError() {
|
10631
10677
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
10632
10678
|
t = e == null ? void 0 : e.bubbleElement;
|
10633
|
-
(t != null && t.classList.contains(
|
10679
|
+
(t != null && t.classList.contains(ve.MESSAGE_CLASS) && t.textContent === "" || me.isTemporaryElement(e)) && this.removeLastMessage();
|
10634
10680
|
}
|
10635
10681
|
// prettier-ignore
|
10636
10682
|
}, {
|
@@ -10652,13 +10698,13 @@ var Ee = /*#__PURE__*/function (_Be) {
|
|
10652
10698
|
key: "getPermittedMessage",
|
10653
10699
|
value: function getPermittedMessage(e) {
|
10654
10700
|
if (e) {
|
10655
|
-
var t =
|
10701
|
+
var t = me.extractErrorMessages(e);
|
10656
10702
|
for (var _i13 = 0; _i13 < t.length; _i13 += 1) {
|
10657
10703
|
var s = t[_i13];
|
10658
10704
|
if (typeof s == "string") {
|
10659
10705
|
if (this._displayServiceErrorMessages) return s;
|
10660
10706
|
if (this._permittedErrorPrefixes) {
|
10661
|
-
var r =
|
10707
|
+
var r = me.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, s);
|
10662
10708
|
if (r) return r;
|
10663
10709
|
}
|
10664
10710
|
}
|
@@ -10675,9 +10721,9 @@ var Ee = /*#__PURE__*/function (_Be) {
|
|
10675
10721
|
value: function addDefaultLoadingMessage() {
|
10676
10722
|
var e = this.createMessageElements("", b.AI_ROLE),
|
10677
10723
|
t = e.bubbleElement;
|
10678
|
-
e.bubbleElement.classList.add(
|
10724
|
+
e.bubbleElement.classList.add(Me.DOTS_CONTAINER_CLASS);
|
10679
10725
|
var i = document.createElement("div");
|
10680
|
-
return i.classList.add("loading-message-dots"), t.appendChild(i),
|
10726
|
+
return i.classList.add("loading-message-dots"), t.appendChild(i), Me.setDots(t, this.messageStyles), e;
|
10681
10727
|
}
|
10682
10728
|
}, {
|
10683
10729
|
key: "addLoadingMessage",
|
@@ -10685,8 +10731,8 @@ var Ee = /*#__PURE__*/function (_Be) {
|
|
10685
10731
|
var i, s, r, o, a, l;
|
10686
10732
|
if (!this._displayLoadingMessage) return;
|
10687
10733
|
var e = (r = (s = (i = this.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.message) == null ? void 0 : r.html,
|
10688
|
-
t = e ?
|
10689
|
-
this.elementRef.appendChild(t.outerContainer), t.bubbleElement.classList.add(
|
10734
|
+
t = e ? be.createElements(this, e, b.AI_ROLE, !1) : this.addDefaultLoadingMessage();
|
10735
|
+
this.elementRef.appendChild(t.outerContainer), t.bubbleElement.classList.add(Me.BUBBLE_CLASS), this.applyCustomStyles(t, b.AI_ROLE, !1, (l = (a = (o = this.messageStyles) == null ? void 0 : o.loading) == null ? void 0 : a.message) == null ? void 0 : l.styles), J.scrollToBottom(this.elementRef);
|
10690
10736
|
}
|
10691
10737
|
}, {
|
10692
10738
|
key: "populateIntroPanel",
|
@@ -10736,21 +10782,41 @@ var Ee = /*#__PURE__*/function (_Be) {
|
|
10736
10782
|
key: "clearMessages",
|
10737
10783
|
value:
|
10738
10784
|
// WORK - update all message classes to use deep-chat prefix
|
10785
|
+
// WORK - should retain the messages objects
|
10739
10786
|
function clearMessages(e, t) {
|
10740
|
-
var
|
10787
|
+
var _this$messageToElemen;
|
10788
|
+
var o, a;
|
10741
10789
|
var i = [],
|
10742
10790
|
s = [];
|
10743
|
-
this.messageElementRefs.forEach(function (
|
10744
|
-
|
10745
|
-
|
10746
|
-
|
10747
|
-
|
10748
|
-
|
10749
|
-
|
10750
|
-
var c;
|
10751
|
-
|
10752
|
-
|
10753
|
-
|
10791
|
+
this.messageElementRefs.forEach(function (l) {
|
10792
|
+
me.isActiveElement(l.bubbleElement.classList) ? i.push(l) : l.outerContainer.remove();
|
10793
|
+
}), this.textElementsToText.forEach(function (l) {
|
10794
|
+
var c = l[0].bubbleElement.classList;
|
10795
|
+
me.isActiveElement(c) && s.push(l);
|
10796
|
+
}), Array.from(this.elementRef.children).forEach(function (l) {
|
10797
|
+
var d;
|
10798
|
+
var c = (d = l.children[0]) == null ? void 0 : d.children[0];
|
10799
|
+
c != null && c.classList.contains("error-message-text") && l.remove();
|
10800
|
+
}), this.messageElementRefs = i;
|
10801
|
+
var r = this.messageToElements.filter(function (l) {
|
10802
|
+
return l[0].text !== void 0 || l[0].html !== void 0 ? l[1].find(function (c) {
|
10803
|
+
return me.isActiveElement(c.bubbleElement.classList);
|
10804
|
+
}) : !1;
|
10805
|
+
});
|
10806
|
+
(_this$messageToElemen = this.messageToElements).splice.apply(_this$messageToElemen, [0, this.messageToElements.length].concat(_toConsumableArray(r))), t !== !1 && ((o = this._introPanel) != null && o._elementRef && this._introPanel.display(), this.addIntroductoryMessages()), this.textElementsToText = s, (a = this._onClearMessages) == null || a.call(this), delete e.sessionId;
|
10807
|
+
}
|
10808
|
+
}, {
|
10809
|
+
key: "updateHTMLMessage",
|
10810
|
+
value: function updateHTMLMessage(e, t) {
|
10811
|
+
if (e === void 0 || typeof e != "string") return console.error("The first argument of updateHTMLMessage must be of type String");
|
10812
|
+
if (t === void 0 || typeof t != "number") return console.error("The second argument of updateHTMLMessage must be of type Number");
|
10813
|
+
var i = Math.floor(t),
|
10814
|
+
s = this.messageToElements[i][0];
|
10815
|
+
if (!(s != null && s.html)) return console.error("The message at index ".concat(i, " does not contain a 'html' message"));
|
10816
|
+
var r = this.htmlElementsToMessage.find(function (o) {
|
10817
|
+
return o[1] === s;
|
10818
|
+
});
|
10819
|
+
if (r) be.overwrite(this, e, r[0]), r[1].html = e;else return console.error("Deep Chat error - HTML message was not found");
|
10754
10820
|
}
|
10755
10821
|
}], [{
|
10756
10822
|
key: "getDisplayLoadingMessage",
|
@@ -10771,7 +10837,7 @@ var Ee = /*#__PURE__*/function (_Be) {
|
|
10771
10837
|
}, {
|
10772
10838
|
key: "isActiveElement",
|
10773
10839
|
value: function isActiveElement(e) {
|
10774
|
-
return e.contains(
|
10840
|
+
return e.contains(Me.BUBBLE_CLASS) || e.contains(Qe.CLASS) || e.contains(ve.MESSAGE_CLASS);
|
10775
10841
|
}
|
10776
10842
|
}]);
|
10777
10843
|
}(Be);
|
@@ -12682,32 +12748,32 @@ var Ft = /*#__PURE__*/function (_Gt) {
|
|
12682
12748
|
}(Gt);
|
12683
12749
|
Ft.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
12684
12750
|
var $t = Ft;
|
12685
|
-
var
|
12751
|
+
var ke = /*#__PURE__*/function () {
|
12686
12752
|
// prettier-ignore
|
12687
|
-
function
|
12753
|
+
function ke(e, t, i, s) {
|
12688
12754
|
var _this65 = this;
|
12689
|
-
_classCallCheck(this,
|
12755
|
+
_classCallCheck(this, ke);
|
12690
12756
|
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = s, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
|
12691
12757
|
_this65._validationHandler = e._validationHandler;
|
12692
12758
|
});
|
12693
12759
|
}
|
12694
|
-
return _createClass(
|
12760
|
+
return _createClass(ke, [{
|
12695
12761
|
key: "attemptAddFile",
|
12696
12762
|
value: function attemptAddFile(e, t) {
|
12697
|
-
return
|
12763
|
+
return ke.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
|
12698
12764
|
}
|
12699
12765
|
}, {
|
12700
12766
|
key: "addAttachmentBasedOnType",
|
12701
12767
|
value: function addAttachmentBasedOnType(e, t, i) {
|
12702
|
-
var s =
|
12768
|
+
var s = ke.getTypeFromBlob(e);
|
12703
12769
|
if (s === "image") {
|
12704
|
-
var r =
|
12770
|
+
var r = ke.createImageAttachment(t);
|
12705
12771
|
this.addFileAttachment(e, "image", r, i);
|
12706
12772
|
} else if (s === "audio") {
|
12707
12773
|
var _r3 = Wt.createAudioAttachment(t);
|
12708
12774
|
this.addFileAttachment(e, "audio", _r3, i);
|
12709
12775
|
} else {
|
12710
|
-
var _r4 =
|
12776
|
+
var _r4 = ke.createAnyFileAttachment(e.name);
|
12711
12777
|
this.addFileAttachment(e, "any", _r4, i);
|
12712
12778
|
}
|
12713
12779
|
}
|
@@ -12715,7 +12781,7 @@ var Ae = /*#__PURE__*/function () {
|
|
12715
12781
|
key: "addFileAttachment",
|
12716
12782
|
value: function addFileAttachment(e, t, i, s) {
|
12717
12783
|
var a;
|
12718
|
-
var r =
|
12784
|
+
var r = ke.createContainer(i);
|
12719
12785
|
if (this._attachments.length >= this._fileCountLimit) {
|
12720
12786
|
var l = this._attachments[this._attachments.length - 1].removeButton;
|
12721
12787
|
l == null || l.click();
|
@@ -12817,19 +12883,19 @@ var Ae = /*#__PURE__*/function () {
|
|
12817
12883
|
}();
|
12818
12884
|
var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
|
12819
12885
|
un = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
|
12820
|
-
|
12886
|
+
Te = /*#__PURE__*/function (_ke) {
|
12821
12887
|
// prettier-ignore
|
12822
|
-
function
|
12823
|
-
_classCallCheck(this,
|
12824
|
-
return _callSuper(this,
|
12888
|
+
function Te(e, t, i, s) {
|
12889
|
+
_classCallCheck(this, Te);
|
12890
|
+
return _callSuper(this, Te, [e, t, i, s]);
|
12825
12891
|
}
|
12826
|
-
_inherits(
|
12827
|
-
return _createClass(
|
12892
|
+
_inherits(Te, _ke);
|
12893
|
+
return _createClass(Te, [{
|
12828
12894
|
key: "createTimer",
|
12829
12895
|
value: function createTimer(e, t) {
|
12830
12896
|
var _this66 = this;
|
12831
12897
|
var i = 0;
|
12832
|
-
var s = t !== void 0 && t <
|
12898
|
+
var s = t !== void 0 && t < Te.TIMER_LIMIT_S ? t : Te.TIMER_LIMIT_S;
|
12833
12899
|
return setInterval(function () {
|
12834
12900
|
var a;
|
12835
12901
|
i += 1, i === s && ((a = _this66.stopPlaceholderCallback) == null || a.call(_this66), _this66.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -12841,7 +12907,7 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12841
12907
|
}, {
|
12842
12908
|
key: "createPlaceholderAudioAttachment",
|
12843
12909
|
value: function createPlaceholderAudioAttachment(e) {
|
12844
|
-
var t =
|
12910
|
+
var t = Te.createAudioContainer(),
|
12845
12911
|
i = document.createElement("div");
|
12846
12912
|
i.classList.add("audio-placeholder-text-3-digits");
|
12847
12913
|
var s = document.createElement("div");
|
@@ -12878,7 +12944,7 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12878
12944
|
key: "completePlaceholderAttachment",
|
12879
12945
|
value: function completePlaceholderAttachment(e, t) {
|
12880
12946
|
var i = this._activePlaceholderAttachment;
|
12881
|
-
i && (i.file = e,
|
12947
|
+
i && (i.file = e, Te.addAudioElements(i.attachmentContainerElement.children[0], t), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
12882
12948
|
}
|
12883
12949
|
}, {
|
12884
12950
|
key: "removePlaceholderAttachment",
|
@@ -12918,8 +12984,8 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12918
12984
|
}, {
|
12919
12985
|
key: "createAudioAttachment",
|
12920
12986
|
value: function createAudioAttachment(e) {
|
12921
|
-
var t =
|
12922
|
-
return
|
12987
|
+
var t = Te.createAudioContainer();
|
12988
|
+
return Te.addAudioElements(t, e), t;
|
12923
12989
|
}
|
12924
12990
|
}, {
|
12925
12991
|
key: "stopAttachmentPlayback",
|
@@ -12928,9 +12994,9 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12928
12994
|
(s = (i = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : i[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
|
12929
12995
|
}
|
12930
12996
|
}]);
|
12931
|
-
}(
|
12932
|
-
|
12933
|
-
var Wt =
|
12997
|
+
}(ke);
|
12998
|
+
Te.TIMER_LIMIT_S = 5999;
|
12999
|
+
var Wt = Te;
|
12934
13000
|
var ya = /*#__PURE__*/function () {
|
12935
13001
|
function ya() {
|
12936
13002
|
_classCallCheck(this, ya);
|
@@ -12940,7 +13006,7 @@ var ya = /*#__PURE__*/function () {
|
|
12940
13006
|
value:
|
12941
13007
|
// prettier-ignore
|
12942
13008
|
function create(e, t, i, s, r) {
|
12943
|
-
return r === "audio" ? new Wt(e, t, i, s) : new
|
13009
|
+
return r === "audio" ? new Wt(e, t, i, s) : new ke(e, t, i, s);
|
12944
13010
|
}
|
12945
13011
|
}]);
|
12946
13012
|
}();
|
@@ -12986,7 +13052,7 @@ var ii = /*#__PURE__*/function () {
|
|
12986
13052
|
case 0:
|
12987
13053
|
_context118.next = 2;
|
12988
13054
|
return Promise.all(this._fileAttachmentsTypes.map(/*#__PURE__*/function () {
|
12989
|
-
var
|
13055
|
+
var _ref28 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee117(e) {
|
12990
13056
|
var t;
|
12991
13057
|
return _regeneratorRuntime().wrap(function _callee117$(_context117) {
|
12992
13058
|
while (1) switch (_context117.prev = _context117.next) {
|
@@ -12999,7 +13065,7 @@ var ii = /*#__PURE__*/function () {
|
|
12999
13065
|
}, _callee117);
|
13000
13066
|
}));
|
13001
13067
|
return function (_x213) {
|
13002
|
-
return
|
13068
|
+
return _ref28.apply(this, arguments);
|
13003
13069
|
};
|
13004
13070
|
}()));
|
13005
13071
|
case 2:
|
@@ -13160,13 +13226,13 @@ var Pt = /*#__PURE__*/function (_Xt3) {
|
|
13160
13226
|
function Pt(e, t, i, s, r, o) {
|
13161
13227
|
var _this71;
|
13162
13228
|
_classCallCheck(this, Pt);
|
13163
|
-
var h, u, f, m, p,
|
13229
|
+
var h, u, f, m, p, v, x, j, G;
|
13164
13230
|
var a = (h = i == null ? void 0 : i.button) == null ? void 0 : h.position,
|
13165
13231
|
l = ((m = (f = (u = i == null ? void 0 : i.button) == null ? void 0 : u.styles) == null ? void 0 : f.text) == null ? void 0 : m.content) || o;
|
13166
13232
|
_this71 = _callSuper(this, Pt, [Pt.createButtonElement(), a, i.button, l]);
|
13167
13233
|
var c = a === "dropup-menu",
|
13168
13234
|
d = _this71.createInnerElements(s, r, _this71._customStyles, c);
|
13169
|
-
_this71._inputElement = Pt.createInputElement((p = i == null ? void 0 : i.files) == null ? void 0 : p.acceptedFormats), _this71.addClickEvent(e, i), _this71.elementRef.replaceChildren(d.styles), _this71.reapplyStateStyle("styles"), _this71._fileAttachmentsType = t, _this71._openModalOnce = ((x = (
|
13235
|
+
_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 = (v = i.files) == null ? void 0 : v.infoModal) == null ? void 0 : x.openModalOnce) === !1 || (G = (j = i.files) == null ? void 0 : j.infoModal) == null ? void 0 : G.openModalOnce;
|
13170
13236
|
return _this71;
|
13171
13237
|
}
|
13172
13238
|
_inherits(Pt, _Xt3);
|
@@ -13221,15 +13287,15 @@ var Pt = /*#__PURE__*/function (_Xt3) {
|
|
13221
13287
|
}
|
13222
13288
|
}]);
|
13223
13289
|
}(Xt);
|
13224
|
-
var
|
13225
|
-
function
|
13226
|
-
_classCallCheck(this,
|
13290
|
+
var Ce = /*#__PURE__*/function () {
|
13291
|
+
function Ce() {
|
13292
|
+
_classCallCheck(this, Ce);
|
13227
13293
|
}
|
13228
|
-
return _createClass(
|
13294
|
+
return _createClass(Ce, null, [{
|
13229
13295
|
key: "create",
|
13230
13296
|
value: function create(e, t, i) {
|
13231
|
-
var s =
|
13232
|
-
|
13297
|
+
var s = Ce.createElement(i);
|
13298
|
+
Ce.addEvents(s, e, t), e.appendChild(s);
|
13233
13299
|
}
|
13234
13300
|
}, {
|
13235
13301
|
key: "createElement",
|
@@ -13241,13 +13307,13 @@ var Te = /*#__PURE__*/function () {
|
|
13241
13307
|
key: "addEvents",
|
13242
13308
|
value: function addEvents(e, t, i) {
|
13243
13309
|
t.ondragenter = function (s) {
|
13244
|
-
s.preventDefault(),
|
13310
|
+
s.preventDefault(), Ce.display(e);
|
13245
13311
|
}, e.ondragleave = function (s) {
|
13246
|
-
s.preventDefault(),
|
13312
|
+
s.preventDefault(), Ce.hide(e);
|
13247
13313
|
}, e.ondragover = function (s) {
|
13248
13314
|
s.preventDefault();
|
13249
13315
|
}, e.ondrop = function (s) {
|
13250
|
-
s.preventDefault(),
|
13316
|
+
s.preventDefault(), Ce.uploadFile(i, s), Ce.hide(e);
|
13251
13317
|
};
|
13252
13318
|
}
|
13253
13319
|
}, {
|
@@ -13348,7 +13414,7 @@ var ze = /*#__PURE__*/function () {
|
|
13348
13414
|
value: function attach(e, t, i, s, r) {
|
13349
13415
|
var o = e.validateInput || le.processValidateInput(e);
|
13350
13416
|
e._validationHandler = /*#__PURE__*/function () {
|
13351
|
-
var
|
13417
|
+
var _ref29 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee121(a) {
|
13352
13418
|
var l;
|
13353
13419
|
return _regeneratorRuntime().wrap(function _callee121$(_context121) {
|
13354
13420
|
while (1) switch (_context121.prev = _context121.next) {
|
@@ -13368,7 +13434,7 @@ var ze = /*#__PURE__*/function () {
|
|
13368
13434
|
}, _callee121);
|
13369
13435
|
}));
|
13370
13436
|
return function (_x221) {
|
13371
|
-
return
|
13437
|
+
return _ref29.apply(this, arguments);
|
13372
13438
|
};
|
13373
13439
|
}();
|
13374
13440
|
}
|
@@ -13653,7 +13719,7 @@ var k = /*#__PURE__*/function (_Xt4) {
|
|
13653
13719
|
e.files && (t.files = Array.from(e.files).map(function (i) {
|
13654
13720
|
return {
|
13655
13721
|
file: i,
|
13656
|
-
type:
|
13722
|
+
type: ke.getTypeFromBlob(i)
|
13657
13723
|
};
|
13658
13724
|
})), setTimeout(function () {
|
13659
13725
|
return _this78.attemptSubmit(t, !0);
|
@@ -13725,12 +13791,12 @@ var k = /*#__PURE__*/function (_Xt4) {
|
|
13725
13791
|
}, {
|
13726
13792
|
key: "addNewMessage",
|
13727
13793
|
value: function () {
|
13728
|
-
var _addNewMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee125(
|
13794
|
+
var _addNewMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee125(_ref30) {
|
13729
13795
|
var e, t, i;
|
13730
13796
|
return _regeneratorRuntime().wrap(function _callee125$(_context125) {
|
13731
13797
|
while (1) switch (_context125.prev = _context125.next) {
|
13732
13798
|
case 0:
|
13733
|
-
e =
|
13799
|
+
e = _ref30.text, t = _ref30.files;
|
13734
13800
|
i = {
|
13735
13801
|
role: b.USER_ROLE
|
13736
13802
|
};
|
@@ -14021,7 +14087,7 @@ var Ot = /*#__PURE__*/function () {
|
|
14021
14087
|
button: new Ea(_d, t.recordAudio)
|
14022
14088
|
};
|
14023
14089
|
}
|
14024
|
-
return
|
14090
|
+
return Ce.isEnabled(r, e.dragAndDrop) && Ce.create(i, r, e.dragAndDrop), r;
|
14025
14091
|
}
|
14026
14092
|
// prettier-ignore
|
14027
14093
|
}], [{
|
@@ -14070,7 +14136,7 @@ var Is = /*#__PURE__*/function () {
|
|
14070
14136
|
value: function createElements(e, t, i) {
|
14071
14137
|
var s = document.createElement("div");
|
14072
14138
|
s.id = "chat-view";
|
14073
|
-
var r = new
|
14139
|
+
var r = new me(e, t, i);
|
14074
14140
|
t.websocket && U.createConnection(t, r);
|
14075
14141
|
var o = new Ot(e, r, t, s);
|
14076
14142
|
return J.addElements(s, r.elementRef, o.elementRef), s;
|
@@ -14101,7 +14167,7 @@ var E = /*#__PURE__*/function (_ls) {
|
|
14101
14167
|
return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
|
14102
14168
|
}, _this85.focusInput = function () {
|
14103
14169
|
return Kt.focusFromParentElement(_this85._elementRef);
|
14104
|
-
}, _this85.refreshMessages = function () {}, _this85.clearMessages = function () {}, _this85.scrollToBottom = function () {}, _this85.disableSubmitButton = function () {}, _this85.setPlaceholderText = function () {}, _this85._hasBeenRendered = !1, _this85._auxiliaryStyleApplied = !1, _this85._elementRef = document.createElement("div"), _this85._elementRef.id = "container", _this85.attachShadow({
|
14170
|
+
}, _this85.refreshMessages = function () {}, _this85.clearMessages = function () {}, _this85.scrollToBottom = function () {}, _this85.disableSubmitButton = function () {}, _this85.setPlaceholderText = function () {}, _this85.updateHTMLMessage = function () {}, _this85._hasBeenRendered = !1, _this85._auxiliaryStyleApplied = !1, _this85._elementRef = document.createElement("div"), _this85._elementRef.id = "container", _this85.attachShadow({
|
14105
14171
|
mode: "open"
|
14106
14172
|
}).appendChild(_this85._elementRef), kt.apply(Aa, _this85.shadowRoot), setTimeout(function () {
|
14107
14173
|
_this85._hasBeenRendered || _this85.onRender();
|