deep-chat-dev 9.0.200 → 9.0.201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +11772 -11870
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts +0 -1
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +703 -724
- package/dist/services/azure/azureOpenAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/assistant/openAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/assistant/openAIAssistantIOI.d.ts +3 -3
- package/dist/services/openAI/assistant/openAIAssistantIOI.d.ts.map +1 -1
- package/dist/views/chat/messages/html/htmlMessages.d.ts +1 -2
- package/dist/views/chat/messages/html/htmlMessages.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts +0 -1
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/dist/views/chat/messages/messagesBase.d.ts +0 -1
- package/dist/views/chat/messages/messagesBase.d.ts.map +1 -1
- package/dist/views/chat/messages/stream/messageStream.d.ts +0 -2
- package/dist/views/chat/messages/stream/messageStream.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -136,37 +136,37 @@ var R = /*#__PURE__*/function () {
|
|
136
136
|
}
|
137
137
|
}]);
|
138
138
|
}();
|
139
|
-
var
|
140
|
-
function
|
141
|
-
_classCallCheck(this,
|
139
|
+
var ze = /*#__PURE__*/function () {
|
140
|
+
function ze() {
|
141
|
+
_classCallCheck(this, ze);
|
142
142
|
}
|
143
|
-
return _createClass(
|
143
|
+
return _createClass(ze, null, [{
|
144
144
|
key: "attemptAppendStyleSheetToHead",
|
145
145
|
value: function attemptAppendStyleSheetToHead(e) {
|
146
|
-
if (e.fontFamily && e.fontFamily !==
|
146
|
+
if (e.fontFamily && e.fontFamily !== ze.DEFAULT_FONT_FAMILY) return;
|
147
147
|
var t = document.getElementsByTagName("head")[0];
|
148
148
|
if (!Array.from(t.getElementsByTagName("link")).some(function (s) {
|
149
|
-
return s.getAttribute("href") ===
|
149
|
+
return s.getAttribute("href") === ze.FONT_URL;
|
150
150
|
})) {
|
151
151
|
var s = document.createElement("link");
|
152
|
-
s.rel = "stylesheet", s.href =
|
152
|
+
s.rel = "stylesheet", s.href = ze.FONT_URL, t.appendChild(s);
|
153
153
|
}
|
154
154
|
}
|
155
155
|
}]);
|
156
156
|
}();
|
157
|
-
|
158
|
-
var ci =
|
159
|
-
var
|
160
|
-
function
|
161
|
-
_classCallCheck(this,
|
157
|
+
ze.FONT_URL = "https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap", ze.DEFAULT_FONT_FAMILY = "'Inter', sans-serif, Avenir, Helvetica, Arial";
|
158
|
+
var ci = ze;
|
159
|
+
var ht = /*#__PURE__*/function () {
|
160
|
+
function ht() {
|
161
|
+
_classCallCheck(this, ht);
|
162
162
|
}
|
163
|
-
return _createClass(
|
163
|
+
return _createClass(ht, null, [{
|
164
164
|
key: "apply",
|
165
165
|
value: function apply(e, t) {
|
166
166
|
if (t) try {
|
167
|
-
|
167
|
+
ht.applyStyleSheet(e, t);
|
168
168
|
} catch (_unused) {
|
169
|
-
|
169
|
+
ht.addStyleElement(e, t);
|
170
170
|
}
|
171
171
|
}
|
172
172
|
}, {
|
@@ -184,11 +184,11 @@ var ut = /*#__PURE__*/function () {
|
|
184
184
|
}, {
|
185
185
|
key: "applyDefaultStyleToComponent",
|
186
186
|
value: function applyDefaultStyleToComponent(e, t) {
|
187
|
-
t && R.applyToStyleIfNotDefined(e, t), R.applyToStyleIfNotDefined(e,
|
187
|
+
t && R.applyToStyleIfNotDefined(e, t), R.applyToStyleIfNotDefined(e, ht.DEFAULT_COMPONENT_STYLE);
|
188
188
|
}
|
189
189
|
}]);
|
190
190
|
}();
|
191
|
-
|
191
|
+
ht.DEFAULT_COMPONENT_STYLE = {
|
192
192
|
height: "350px",
|
193
193
|
width: "320px",
|
194
194
|
border: "1px solid #cacaca",
|
@@ -202,24 +202,24 @@ ut.DEFAULT_COMPONENT_STYLE = {
|
|
202
202
|
// this is also causing the chat to squeeze when there is no space
|
203
203
|
overflow: "hidden"
|
204
204
|
};
|
205
|
-
var kt =
|
206
|
-
var
|
207
|
-
var xt = (
|
208
|
-
_classCallCheck(this,
|
209
|
-
}),
|
210
|
-
var
|
205
|
+
var kt = ht;
|
206
|
+
var Qe;
|
207
|
+
var xt = (Qe = /*#__PURE__*/_createClass(function Qe() {
|
208
|
+
_classCallCheck(this, Qe);
|
209
|
+
}), Qe.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), Qe.IS_CHROMIUM = window.chrome, Qe);
|
210
|
+
var N = /* @__PURE__ */function (n) {
|
211
211
|
return n.ESCAPE = "Escape", n.ENTER = "Enter", n.TAB = "Tab", n.ARROW_UP = "ArrowUp", n.ARROW_DOWN = "ArrowDown", n.ARROW_RIGHT = "ArrowRight", n.ARROW_LEFT = "ArrowLeft", n.BACKSPACE = "Backspace", n.DELETE = "Delete", n.META = "Meta", n.CONTROL = "Control", n;
|
212
|
-
}(
|
213
|
-
var
|
214
|
-
function
|
215
|
-
_classCallCheck(this,
|
212
|
+
}(N || {});
|
213
|
+
var Ge = /*#__PURE__*/function () {
|
214
|
+
function Ge() {
|
215
|
+
_classCallCheck(this, Ge);
|
216
216
|
}
|
217
|
-
return _createClass(
|
217
|
+
return _createClass(Ge, null, [{
|
218
218
|
key: "add",
|
219
219
|
value:
|
220
220
|
// prettier-ignore
|
221
221
|
function add(e, t, i, s) {
|
222
|
-
i !== void 0 && e.addEventListener("keydown",
|
222
|
+
i !== void 0 && e.addEventListener("keydown", Ge.onKeyDown.bind(this, i)), e.oninput = Ge.onInput.bind(this, i, s), e.addEventListener("paste", function (r) {
|
223
223
|
var o;
|
224
224
|
r.preventDefault(), (o = r.clipboardData) != null && o.files.length && t.addFilesToAnyType(Array.from(r.clipboardData.files));
|
225
225
|
});
|
@@ -230,7 +230,7 @@ var Ve = /*#__PURE__*/function () {
|
|
230
230
|
key: "onKeyDown",
|
231
231
|
value: function onKeyDown(e, t) {
|
232
232
|
var s = t.target.textContent;
|
233
|
-
s && s.length >= e && !
|
233
|
+
s && s.length >= e && !Ge.PERMITTED_KEYS.has(t.key) && !Ge.isKeyCombinationPermitted(t) && t.preventDefault();
|
234
234
|
}
|
235
235
|
}, {
|
236
236
|
key: "isKeyCombinationPermitted",
|
@@ -246,8 +246,8 @@ var Ve = /*#__PURE__*/function () {
|
|
246
246
|
}
|
247
247
|
}]);
|
248
248
|
}();
|
249
|
-
|
250
|
-
var ss =
|
249
|
+
Ge.PERMITTED_KEYS = /* @__PURE__ */new Set([N.BACKSPACE, N.DELETE, N.ARROW_RIGHT, N.ARROW_LEFT, N.ARROW_DOWN, N.ARROW_UP, N.META, N.CONTROL, N.ENTER]);
|
250
|
+
var ss = Ge;
|
251
251
|
var An = /*#__PURE__*/function () {
|
252
252
|
function An() {
|
253
253
|
_classCallCheck(this, An);
|
@@ -262,17 +262,17 @@ var An = /*#__PURE__*/function () {
|
|
262
262
|
}
|
263
263
|
}]);
|
264
264
|
}();
|
265
|
-
var
|
266
|
-
function
|
265
|
+
var Ve = /*#__PURE__*/function () {
|
266
|
+
function Ve(e, t, i) {
|
267
267
|
var _this = this;
|
268
|
-
_classCallCheck(this,
|
268
|
+
_classCallCheck(this, Ve);
|
269
269
|
var r, o;
|
270
|
-
var s =
|
271
|
-
this.elementRef =
|
270
|
+
var s = Ve.processConfig(t, e.textInput);
|
271
|
+
this.elementRef = Ve.createContainerElement((r = s == null ? void 0 : s.styles) == null ? void 0 : r.container), this._config = s, this.inputElementRef = this.createInputElement(), this.elementRef.appendChild(this.inputElementRef), e.setPlaceholderText = this.setPlaceholderText.bind(this), e.setPlaceholderText(((o = this._config.placeholder) == null ? void 0 : o.text) || "Ask me anything!"), setTimeout(function () {
|
272
272
|
ss.add(_this.inputElementRef, i, _this._config.characterLimit, e._validationHandler);
|
273
273
|
});
|
274
274
|
}
|
275
|
-
return _createClass(
|
275
|
+
return _createClass(Ve, [{
|
276
276
|
key: "clear",
|
277
277
|
value:
|
278
278
|
// this also similarly prevents scroll up
|
@@ -288,7 +288,7 @@ var $e = /*#__PURE__*/function () {
|
|
288
288
|
value: function createInputElement() {
|
289
289
|
var t, i, s, r;
|
290
290
|
var e = document.createElement("div");
|
291
|
-
return e.id =
|
291
|
+
return e.id = Ve.TEXT_INPUT_ID, e.classList.add("text-input-styling"), xt.IS_CHROMIUM && Ve.preventAutomaticScrollUpOnNewLine(e), typeof this._config.disabled == "boolean" && this._config.disabled === !0 ? (e.contentEditable = "false", e.classList.add("text-input-disabled")) : (e.contentEditable = "true", this.addEventListeners(e)), Object.assign(e.style, (t = this._config.styles) == null ? void 0 : t.text), Object.assign(e.style, (i = this._config.placeholder) == null ? void 0 : i.style), (r = (s = this._config.placeholder) == null ? void 0 : s.style) != null && r.color || e.setAttribute("textcolor", ""), e;
|
292
292
|
}
|
293
293
|
}, {
|
294
294
|
key: "removePlaceholderStyle",
|
@@ -315,7 +315,7 @@ var $e = /*#__PURE__*/function () {
|
|
315
315
|
key: "onKeydown",
|
316
316
|
value: function onKeydown(e) {
|
317
317
|
var t;
|
318
|
-
e.key ===
|
318
|
+
e.key === N.ENTER && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), (t = this.submit) == null || t.call(this));
|
319
319
|
}
|
320
320
|
}, {
|
321
321
|
key: "onInput",
|
@@ -365,8 +365,8 @@ var $e = /*#__PURE__*/function () {
|
|
365
365
|
}
|
366
366
|
}]);
|
367
367
|
}();
|
368
|
-
|
369
|
-
var di =
|
368
|
+
Ve.TEXT_INPUT_ID = "text-input";
|
369
|
+
var di = Ve;
|
370
370
|
var Kt = /*#__PURE__*/function () {
|
371
371
|
function Kt() {
|
372
372
|
_classCallCheck(this, Kt);
|
@@ -570,11 +570,11 @@ var le = /*#__PURE__*/function () {
|
|
570
570
|
}
|
571
571
|
}]);
|
572
572
|
}();
|
573
|
-
var
|
574
|
-
function
|
575
|
-
_classCallCheck(this,
|
573
|
+
var ut = /*#__PURE__*/function () {
|
574
|
+
function ut() {
|
575
|
+
_classCallCheck(this, ut);
|
576
576
|
}
|
577
|
-
return _createClass(
|
577
|
+
return _createClass(ut, null, [{
|
578
578
|
key: "colorToHex",
|
579
579
|
value: function colorToHex(e) {
|
580
580
|
var t = document.createElement("div");
|
@@ -587,7 +587,7 @@ var ft = /*#__PURE__*/function () {
|
|
587
587
|
value: function setDots(e, t) {
|
588
588
|
var i, s, r, o;
|
589
589
|
if ((o = (r = (s = (i = t == null ? void 0 : t.loading) == null ? void 0 : i.message) == null ? void 0 : s.styles) == null ? void 0 : r.bubble) != null && o.color) {
|
590
|
-
var a =
|
590
|
+
var a = ut.colorToHex(t.loading.message.styles.bubble.color);
|
591
591
|
e.style.setProperty("--loading-message-color", a), e.style.setProperty("--loading-message-color-fade", "".concat(a, "33"));
|
592
592
|
} else e.style.setProperty("--loading-message-color", "#848484"), e.style.setProperty("--loading-message-color-fade", "#55555533");
|
593
593
|
}
|
@@ -601,15 +601,15 @@ var ft = /*#__PURE__*/function () {
|
|
601
601
|
o = _ref.margin,
|
602
602
|
a = _ref.border;
|
603
603
|
if (i) {
|
604
|
-
var l =
|
604
|
+
var l = ut.colorToHex(i);
|
605
605
|
e.style.setProperty("--loading-history-color", l);
|
606
606
|
} else e.style.setProperty("--loading-history-color", "#dbdbdb");
|
607
607
|
e.style.setProperty("--loading-history-height", r || "57px"), e.style.setProperty("--loading-history-width", s || "57px"), e.style.setProperty("--loading-history-margin", o || "7px"), e.style.setProperty("--loading-history-border", a || "6px");
|
608
608
|
}
|
609
609
|
}]);
|
610
610
|
}();
|
611
|
-
|
612
|
-
var
|
611
|
+
ut.BUBBLE_CLASS = "deep-chat-loading-message-bubble", ut.DOTS_CONTAINER_CLASS = "deep-chat-loading-message-dots-container";
|
612
|
+
var Ae = ut;
|
613
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",
|
614
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==",
|
615
615
|
Y = /*#__PURE__*/function () {
|
@@ -769,7 +769,7 @@ var C = /*#__PURE__*/function () {
|
|
769
769
|
}, {
|
770
770
|
key: "overwriteMessage",
|
771
771
|
value: function overwriteMessage(e, t, i, s, r, o) {
|
772
|
-
var a = C.getLastElementsByClass(t, [C.getRoleClass(s), o], [
|
772
|
+
var a = C.getLastElementsByClass(t, [C.getRoleClass(s), o], [Ae.BUBBLE_CLASS]),
|
773
773
|
l = C.getLastMessage(e, s, r);
|
774
774
|
return l && (l[r] = i), a;
|
775
775
|
}
|
@@ -857,11 +857,11 @@ var C = /*#__PURE__*/function () {
|
|
857
857
|
}();
|
858
858
|
C.AI_ROLE = "ai", C.USER_ROLE = "user", C.EMPTY_MESSAGE_CLASS = "empty-message", C.POSITION_TOP_MESSAGE_CLASS = "deep-chat-top-message", C.POSITION_MIDDLE_MESSAGE_CLASS = "deep-chat-middle-message", C.POSITION_BOTTOM_MESSAGE_CLASS = "deep-chat-bottom-message";
|
859
859
|
var b = C;
|
860
|
-
var
|
861
|
-
function
|
862
|
-
_classCallCheck(this,
|
860
|
+
var Je = /*#__PURE__*/function () {
|
861
|
+
function Je() {
|
862
|
+
_classCallCheck(this, Je);
|
863
863
|
}
|
864
|
-
return _createClass(
|
864
|
+
return _createClass(Je, null, [{
|
865
865
|
key: "mouseUp",
|
866
866
|
value: function mouseUp(e, t) {
|
867
867
|
R.unsetAllCSSMouseStates(e, t), Object.assign(e.style, t["default"]), Object.assign(e.style, t.hover);
|
@@ -884,7 +884,7 @@ var Ze = /*#__PURE__*/function () {
|
|
884
884
|
}, {
|
885
885
|
key: "add",
|
886
886
|
value: function add(e, t) {
|
887
|
-
e.addEventListener("mouseenter",
|
887
|
+
e.addEventListener("mouseenter", Je.mouseEnter.bind(this, e, t)), e.addEventListener("mouseleave", Je.mouseLeave.bind(this, e, t)), e.addEventListener("mousedown", Je.mouseDown.bind(this, e, t)), e.addEventListener("mouseup", Je.mouseUp.bind(this, e, t));
|
888
888
|
}
|
889
889
|
}]);
|
890
890
|
}();
|
@@ -912,11 +912,11 @@ var On = "deep-chat-temporary-message",
|
|
912
912
|
}
|
913
913
|
},
|
914
914
|
Ds = Object.keys(ns);
|
915
|
-
var
|
916
|
-
function
|
917
|
-
_classCallCheck(this,
|
915
|
+
var ke = /*#__PURE__*/function () {
|
916
|
+
function ke() {
|
917
|
+
_classCallCheck(this, ke);
|
918
918
|
}
|
919
|
-
return _createClass(
|
919
|
+
return _createClass(ke, null, [{
|
920
920
|
key: "applySuggestionEvent",
|
921
921
|
value: function applySuggestionEvent(e, t) {
|
922
922
|
setTimeout(function () {
|
@@ -971,13 +971,13 @@ var Re = /*#__PURE__*/function () {
|
|
971
971
|
Ds.forEach(function (r) {
|
972
972
|
var o = i.getElementsByClassName(r);
|
973
973
|
Array.from(o || []).forEach(function (a) {
|
974
|
-
var l =
|
975
|
-
te.applyStylesToElement(a, l),
|
974
|
+
var l = ke.getProcessedStyles(t, a, r);
|
975
|
+
te.applyStylesToElement(a, l), ke.applyEvents(a, r);
|
976
976
|
});
|
977
977
|
});
|
978
978
|
var s = i.getElementsByClassName(Nn);
|
979
979
|
Array.from(s).forEach(function (r) {
|
980
|
-
return
|
980
|
+
return ke.applySuggestionEvent(e, r);
|
981
981
|
});
|
982
982
|
}
|
983
983
|
}]);
|
@@ -990,7 +990,7 @@ var te = /*#__PURE__*/function () {
|
|
990
990
|
key: "applyStylesToElement",
|
991
991
|
value: function applyStylesToElement(e, t) {
|
992
992
|
var i = R.processStateful(t, {}, {});
|
993
|
-
|
993
|
+
Je.add(e, i), Object.assign(e.style, i["default"]);
|
994
994
|
}
|
995
995
|
}, {
|
996
996
|
key: "applyEventsToElement",
|
@@ -1005,7 +1005,7 @@ var te = /*#__PURE__*/function () {
|
|
1005
1005
|
value: function applyClassUtilitiesToElement(e, t) {
|
1006
1006
|
var i = t.events,
|
1007
1007
|
s = t.styles;
|
1008
|
-
i && te.applyEventsToElement(e, i), s && !
|
1008
|
+
i && te.applyEventsToElement(e, i), s && !ke.doesElementContainDeepChatClass(e) && te.applyStylesToElement(e, s);
|
1009
1009
|
}
|
1010
1010
|
}, {
|
1011
1011
|
key: "applyCustomClassUtilities",
|
@@ -1020,7 +1020,7 @@ var te = /*#__PURE__*/function () {
|
|
1020
1020
|
}, {
|
1021
1021
|
key: "apply",
|
1022
1022
|
value: function apply(e, t) {
|
1023
|
-
|
1023
|
+
ke.applyDeepChatUtilities(e, e.htmlClassUtilities, t), te.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
1024
1024
|
}
|
1025
1025
|
}, {
|
1026
1026
|
key: "traverseNodes",
|
@@ -1040,11 +1040,11 @@ var te = /*#__PURE__*/function () {
|
|
1040
1040
|
}
|
1041
1041
|
}]);
|
1042
1042
|
}();
|
1043
|
-
var
|
1044
|
-
function
|
1045
|
-
_classCallCheck(this,
|
1043
|
+
var Fe = /*#__PURE__*/function () {
|
1044
|
+
function Fe() {
|
1045
|
+
_classCallCheck(this, Fe);
|
1046
1046
|
}
|
1047
|
-
return _createClass(
|
1047
|
+
return _createClass(Fe, null, [{
|
1048
1048
|
key: "addElement",
|
1049
1049
|
value: function addElement(e, t) {
|
1050
1050
|
e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
@@ -1057,15 +1057,10 @@ var be = /*#__PURE__*/function () {
|
|
1057
1057
|
}
|
1058
1058
|
}, {
|
1059
1059
|
key: "overwrite",
|
1060
|
-
value: function overwrite(e, t, i) {
|
1061
|
-
i.bubbleElement.innerHTML = t, te.apply(e, i.outerContainer), le.flagHTMLUpdateClass(i.bubbleElement);
|
1062
|
-
}
|
1063
|
-
}, {
|
1064
|
-
key: "overwriteLast",
|
1065
|
-
value: function overwriteLast(e, t, i, s) {
|
1060
|
+
value: function overwrite(e, t, i, s) {
|
1066
1061
|
var r = e.messageToElements,
|
1067
1062
|
o = b.overwriteMessage(r, s, t, i, "html", "html-message");
|
1068
|
-
return o &&
|
1063
|
+
return o && (o.bubbleElement.innerHTML = t, te.apply(e, o.outerContainer), le.flagHTMLUpdateClass(o.bubbleElement)), o;
|
1069
1064
|
}
|
1070
1065
|
// prettier-ignore
|
1071
1066
|
}, {
|
@@ -1074,12 +1069,12 @@ var be = /*#__PURE__*/function () {
|
|
1074
1069
|
var o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;
|
1075
1070
|
var l;
|
1076
1071
|
if (r != null && r.status) {
|
1077
|
-
var c = this.
|
1072
|
+
var c = this.overwrite(e, t, i, s);
|
1078
1073
|
if (c) return c;
|
1079
1074
|
r.status = !1;
|
1080
1075
|
}
|
1081
|
-
var a =
|
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 ||
|
1076
|
+
var a = Fe.createElements(e, t, i, o);
|
1077
|
+
return b.fillEmptyMessageElement(a.bubbleElement, t), te.apply(e, a.outerContainer), le.flagHTMLUpdateClass(a.bubbleElement), e.applyCustomStyles(a, i, !1, (l = e.messageStyles) == null ? void 0 : l.html), o || Fe.addElement(e, a.outerContainer), a;
|
1083
1078
|
}
|
1084
1079
|
}]);
|
1085
1080
|
}();
|
@@ -1125,7 +1120,7 @@ function Hn(n, e) {
|
|
1125
1120
|
i = fn(e);
|
1126
1121
|
return e !== i ? i : e.charCodeAt(0) === 35 && jn.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), mn(t)) ? rs(t) : n;
|
1127
1122
|
}
|
1128
|
-
function
|
1123
|
+
function et(n) {
|
1129
1124
|
return n.indexOf("&") < 0 ? n : n.replace(Un, Hn);
|
1130
1125
|
}
|
1131
1126
|
var qn = /[&<>"]/,
|
@@ -1147,10 +1142,10 @@ g.blockquote_open = function () {
|
|
1147
1142
|
return "<blockquote>\n";
|
1148
1143
|
};
|
1149
1144
|
g.blockquote_close = function (n, e) {
|
1150
|
-
return "</blockquote>" +
|
1145
|
+
return "</blockquote>" + it(n, e);
|
1151
1146
|
};
|
1152
1147
|
g.code = function (n, e) {
|
1153
|
-
return n[e].block ? "<pre><code>" + K(n[e].content) + "</code></pre>" +
|
1148
|
+
return n[e].block ? "<pre><code>" + K(n[e].content) + "</code></pre>" + it(n, e) : "<code>" + K(n[e].content) + "</code>";
|
1154
1149
|
};
|
1155
1150
|
g.fence = function (n, e, t, i, s) {
|
1156
1151
|
var r = n[e],
|
@@ -1162,9 +1157,9 @@ g.fence = function (n, e, t, i, s) {
|
|
1162
1157
|
h;
|
1163
1158
|
if (r.params) {
|
1164
1159
|
if (c = r.params.split(/\s+/g), d = c.join(" "), Fn(s.rules.fence_custom, c[0])) return s.rules.fence_custom[c[0]](n, e, t, i, s);
|
1165
|
-
l = K(
|
1160
|
+
l = K(et(Bt(d))), o = ' class="' + a + l + '"';
|
1166
1161
|
}
|
1167
|
-
return t.highlight ? h = t.highlight.apply(t.highlight, [r.content].concat(c)) || K(r.content) : h = K(r.content), "<pre><code" + o + ">" + h + "</code></pre>" +
|
1162
|
+
return t.highlight ? h = t.highlight.apply(t.highlight, [r.content].concat(c)) || K(r.content) : h = K(r.content), "<pre><code" + o + ">" + h + "</code></pre>" + it(n, e);
|
1168
1163
|
};
|
1169
1164
|
g.fence_custom = {};
|
1170
1165
|
g.heading_open = function (n, e) {
|
@@ -1174,13 +1169,13 @@ g.heading_close = function (n, e) {
|
|
1174
1169
|
return "</h" + n[e].hLevel + ">\n";
|
1175
1170
|
};
|
1176
1171
|
g.hr = function (n, e, t) {
|
1177
|
-
return (t.xhtmlOut ? "<hr />" : "<hr>") +
|
1172
|
+
return (t.xhtmlOut ? "<hr />" : "<hr>") + it(n, e);
|
1178
1173
|
};
|
1179
1174
|
g.bullet_list_open = function () {
|
1180
1175
|
return "<ul>\n";
|
1181
1176
|
};
|
1182
1177
|
g.bullet_list_close = function (n, e) {
|
1183
|
-
return "</ul>" +
|
1178
|
+
return "</ul>" + it(n, e);
|
1184
1179
|
};
|
1185
1180
|
g.list_item_open = function () {
|
1186
1181
|
return "<li>";
|
@@ -1194,17 +1189,17 @@ g.ordered_list_open = function (n, e) {
|
|
1194
1189
|
return "<ol" + i + ">\n";
|
1195
1190
|
};
|
1196
1191
|
g.ordered_list_close = function (n, e) {
|
1197
|
-
return "</ol>" +
|
1192
|
+
return "</ol>" + it(n, e);
|
1198
1193
|
};
|
1199
1194
|
g.paragraph_open = function (n, e) {
|
1200
1195
|
return n[e].tight ? "" : "<p>";
|
1201
1196
|
};
|
1202
1197
|
g.paragraph_close = function (n, e) {
|
1203
1198
|
var t = !(n[e].tight && e && n[e - 1].type === "inline" && !n[e - 1].content);
|
1204
|
-
return (n[e].tight ? "" : "</p>") + (t ?
|
1199
|
+
return (n[e].tight ? "" : "</p>") + (t ? it(n, e) : "");
|
1205
1200
|
};
|
1206
1201
|
g.link_open = function (n, e, t) {
|
1207
|
-
var i = n[e].title ? ' title="' + K(
|
1202
|
+
var i = n[e].title ? ' title="' + K(et(n[e].title)) + '"' : "",
|
1208
1203
|
s = t.linkTarget ? ' target="' + t.linkTarget + '"' : "";
|
1209
1204
|
return '<a href="' + K(n[e].href) + '"' + i + s + ">";
|
1210
1205
|
};
|
@@ -1213,8 +1208,8 @@ g.link_close = function () {
|
|
1213
1208
|
};
|
1214
1209
|
g.image = function (n, e, t) {
|
1215
1210
|
var i = ' src="' + K(n[e].src) + '"',
|
1216
|
-
s = n[e].title ? ' title="' + K(
|
1217
|
-
r = ' alt="' + (n[e].alt ? K(
|
1211
|
+
s = n[e].title ? ' title="' + K(et(n[e].title)) + '"' : "",
|
1212
|
+
r = ' alt="' + (n[e].alt ? K(et(Bt(n[e].alt))) : "") + '"',
|
1218
1213
|
o = t.xhtmlOut ? " /" : "";
|
1219
1214
|
return "<img" + i + r + s + o + ">";
|
1220
1215
|
};
|
@@ -1308,7 +1303,7 @@ g.htmltag = function (n, e) {
|
|
1308
1303
|
return n[e].content;
|
1309
1304
|
};
|
1310
1305
|
g.abbr_open = function (n, e) {
|
1311
|
-
return '<abbr title="' + K(
|
1306
|
+
return '<abbr title="' + K(et(n[e].title)) + '">';
|
1312
1307
|
};
|
1313
1308
|
g.abbr_close = function () {
|
1314
1309
|
return "</abbr>";
|
@@ -1358,7 +1353,7 @@ g.dd_close = function () {
|
|
1358
1353
|
function gn(n, e) {
|
1359
1354
|
return ++e >= n.length - 2 ? e : n[e].type === "paragraph_open" && n[e].tight && n[e + 1].type === "inline" && n[e + 1].content.length === 0 && n[e + 2].type === "paragraph_close" && n[e + 2].tight ? gn(n, e + 2) : e;
|
1360
1355
|
}
|
1361
|
-
var
|
1356
|
+
var it = g.getBreak = function (e, t) {
|
1362
1357
|
return t = gn(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
|
1363
1358
|
};
|
1364
1359
|
function Ss() {
|
@@ -1457,24 +1452,24 @@ function $n(n) {
|
|
1457
1452
|
children: []
|
1458
1453
|
}) : n.block.parse(n.src, n.options, n.env, n.tokens);
|
1459
1454
|
}
|
1460
|
-
function
|
1455
|
+
function st(n, e, t, i, s) {
|
1461
1456
|
this.src = n, this.env = i, this.options = t, this.parser = e, this.tokens = s, this.pos = 0, this.posMax = this.src.length, this.level = 0, this.pending = "", this.pendingLevel = 0, this.cache = [], this.isInLabel = !1, this.linkLevel = 0, this.linkContent = "", this.labelUnmatchedScopes = 0;
|
1462
1457
|
}
|
1463
|
-
|
1458
|
+
st.prototype.pushPending = function () {
|
1464
1459
|
this.tokens.push({
|
1465
1460
|
type: "text",
|
1466
1461
|
content: this.pending,
|
1467
1462
|
level: this.pendingLevel
|
1468
1463
|
}), this.pending = "";
|
1469
1464
|
};
|
1470
|
-
|
1465
|
+
st.prototype.push = function (n) {
|
1471
1466
|
this.pending && this.pushPending(), this.tokens.push(n), this.pendingLevel = this.level;
|
1472
1467
|
};
|
1473
|
-
|
1468
|
+
st.prototype.cacheSet = function (n, e) {
|
1474
1469
|
for (var t = this.cache.length; t <= n; t++) this.cache.push(0);
|
1475
1470
|
this.cache[n] = e;
|
1476
1471
|
};
|
1477
|
-
|
1472
|
+
st.prototype.cacheGet = function (n) {
|
1478
1473
|
return n < this.cache.length ? this.cache[n] : 0;
|
1479
1474
|
};
|
1480
1475
|
function Ut(n, e) {
|
@@ -1498,7 +1493,7 @@ function Ut(n, e) {
|
|
1498
1493
|
}
|
1499
1494
|
function Wn(n, e, t, i) {
|
1500
1495
|
var s, r, o, a, l, c;
|
1501
|
-
if (n.charCodeAt(0) !== 42 || n.charCodeAt(1) !== 91 || n.indexOf("]:") === -1 || (s = new
|
1496
|
+
if (n.charCodeAt(0) !== 42 || n.charCodeAt(1) !== 91 || n.indexOf("]:") === -1 || (s = new st(n, e, t, i, []), r = Ut(s, 1), r < 0 || n.charCodeAt(r + 1) !== 58)) return -1;
|
1502
1497
|
for (a = s.posMax, o = r + 2; o < a && s.src.charCodeAt(o) !== 10; o++);
|
1503
1498
|
return l = n.slice(2, r), c = n.slice(r + 2, o).trim(), c.length === 0 ? -1 : (i.abbreviations || (i.abbreviations = {}), _typeof(i.abbreviations[":" + l]) > "u" && (i.abbreviations[":" + l] = c), o);
|
1504
1499
|
}
|
@@ -1516,7 +1511,7 @@ function Kn(n) {
|
|
1516
1511
|
}
|
1517
1512
|
}
|
1518
1513
|
function os(n) {
|
1519
|
-
var e =
|
1514
|
+
var e = et(n);
|
1520
1515
|
try {
|
1521
1516
|
e = decodeURI(e);
|
1522
1517
|
} catch (_unused2) {}
|
@@ -1571,7 +1566,7 @@ function yn(n) {
|
|
1571
1566
|
}
|
1572
1567
|
function Jn(n, e, t, i) {
|
1573
1568
|
var s, r, o, a, l, c, d, h, u;
|
1574
|
-
if (n.charCodeAt(0) !== 91 || n.indexOf("]:") === -1 || (s = new
|
1569
|
+
if (n.charCodeAt(0) !== 91 || n.indexOf("]:") === -1 || (s = new st(n, e, t, i, []), r = Ut(s, 0), r < 0 || n.charCodeAt(r + 1) !== 58)) return -1;
|
1575
1570
|
for (a = s.posMax, o = r + 2; o < a && (l = s.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
1576
1571
|
if (!bn(s, o)) return -1;
|
1577
1572
|
for (d = s.linkContent, o = s.pos, c = o, o = o + 1; o < a && (l = s.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
@@ -1731,33 +1726,33 @@ var rr = /['"]/,
|
|
1731
1726
|
function js(n, e) {
|
1732
1727
|
return e < 0 || e >= n.length ? !1 : !or.test(n[e]);
|
1733
1728
|
}
|
1734
|
-
function
|
1729
|
+
function lt(n, e, t) {
|
1735
1730
|
return n.substr(0, e) + t + n.substr(e + 1);
|
1736
1731
|
}
|
1737
1732
|
function ar(n) {
|
1738
|
-
var e, t, i, s, r, o, a, l, c, d, h, u, f, m, p, v,
|
1733
|
+
var e, t, i, s, r, o, a, l, c, d, h, u, f, m, p, v, y;
|
1739
1734
|
if (n.options.typographer) {
|
1740
|
-
for (
|
1741
|
-
for (v = n.tokens[p].children,
|
1742
|
-
for (a = v[e].level, f =
|
1743
|
-
|
1735
|
+
for (y = [], p = n.tokens.length - 1; p >= 0; p--) if (n.tokens[p].type === "inline") {
|
1736
|
+
for (v = n.tokens[p].children, y.length = 0, e = 0; e < v.length; e++) if (t = v[e], !(t.type !== "text" || rr.test(t.text))) {
|
1737
|
+
for (a = v[e].level, f = y.length - 1; f >= 0 && !(y[f].level <= a); f--);
|
1738
|
+
y.length = f + 1, i = t.content, r = 0, o = i.length;
|
1744
1739
|
e: for (; r < o && (Bs.lastIndex = r, s = Bs.exec(i), !!s);) {
|
1745
1740
|
if (l = !js(i, s.index - 1), r = s.index + 1, m = s[0] === "'", c = !js(i, r), !c && !l) {
|
1746
|
-
m && (t.content =
|
1741
|
+
m && (t.content = lt(t.content, s.index, Us));
|
1747
1742
|
continue;
|
1748
1743
|
}
|
1749
1744
|
if (h = !c, u = !l, u) {
|
1750
|
-
for (f =
|
1751
|
-
d =
|
1745
|
+
for (f = y.length - 1; f >= 0 && (d = y[f], !(y[f].level < a)); f--) if (d.single === m && y[f].level === a) {
|
1746
|
+
d = y[f], m ? (v[d.token].content = lt(v[d.token].content, d.pos, n.options.quotes[2]), t.content = lt(t.content, s.index, n.options.quotes[3])) : (v[d.token].content = lt(v[d.token].content, d.pos, n.options.quotes[0]), t.content = lt(t.content, s.index, n.options.quotes[1])), y.length = f;
|
1752
1747
|
continue e;
|
1753
1748
|
}
|
1754
1749
|
}
|
1755
|
-
h ?
|
1750
|
+
h ? y.push({
|
1756
1751
|
token: e,
|
1757
1752
|
pos: s.index,
|
1758
1753
|
single: m,
|
1759
1754
|
level: a
|
1760
|
-
}) : u && m && (t.content =
|
1755
|
+
}) : u && m && (t.content = lt(t.content, s.index, Us));
|
1761
1756
|
}
|
1762
1757
|
}
|
1763
1758
|
}
|
@@ -1772,7 +1767,7 @@ En.prototype.process = function (n) {
|
|
1772
1767
|
var e, t, i;
|
1773
1768
|
for (i = this.ruler.getRules(""), e = 0, t = i.length; e < t; e++) i[e](n);
|
1774
1769
|
};
|
1775
|
-
function
|
1770
|
+
function nt(n, e, t, i, s) {
|
1776
1771
|
var r, o, a, l, c, d, h;
|
1777
1772
|
for (this.src = n, this.parser = e, this.options = t, this.env = i, this.tokens = s, this.bMarks = [], this.eMarks = [], this.tShift = [], this.blkIndent = 0, this.line = 0, this.lineMax = 0, this.tight = !1, this.parentType = "root", this.ddIndent = -1, this.level = 0, this.result = "", o = this.src, d = 0, h = !1, a = l = d = 0, c = o.length; l < c; l++) {
|
1778
1773
|
if (r = o.charCodeAt(l), !h) if (r === 32) {
|
@@ -1783,27 +1778,27 @@ function rt(n, e, t, i, s) {
|
|
1783
1778
|
}
|
1784
1779
|
this.bMarks.push(o.length), this.eMarks.push(o.length), this.tShift.push(0), this.lineMax = this.bMarks.length - 1;
|
1785
1780
|
}
|
1786
|
-
|
1781
|
+
nt.prototype.isEmpty = function (e) {
|
1787
1782
|
return this.bMarks[e] + this.tShift[e] >= this.eMarks[e];
|
1788
1783
|
};
|
1789
|
-
|
1784
|
+
nt.prototype.skipEmptyLines = function (e) {
|
1790
1785
|
for (var t = this.lineMax; e < t && !(this.bMarks[e] + this.tShift[e] < this.eMarks[e]); e++);
|
1791
1786
|
return e;
|
1792
1787
|
};
|
1793
|
-
|
1788
|
+
nt.prototype.skipSpaces = function (e) {
|
1794
1789
|
for (var t = this.src.length; e < t && this.src.charCodeAt(e) === 32; e++);
|
1795
1790
|
return e;
|
1796
1791
|
};
|
1797
|
-
|
1792
|
+
nt.prototype.skipChars = function (e, t) {
|
1798
1793
|
for (var i = this.src.length; e < i && this.src.charCodeAt(e) === t; e++);
|
1799
1794
|
return e;
|
1800
1795
|
};
|
1801
|
-
|
1796
|
+
nt.prototype.skipCharsBack = function (e, t, i) {
|
1802
1797
|
if (e <= i) return e;
|
1803
1798
|
for (; e > i;) if (t !== this.src.charCodeAt(--e)) return e + 1;
|
1804
1799
|
return e;
|
1805
1800
|
};
|
1806
|
-
|
1801
|
+
nt.prototype.getLines = function (e, t, i, s) {
|
1807
1802
|
var r,
|
1808
1803
|
o,
|
1809
1804
|
a,
|
@@ -1954,37 +1949,37 @@ function fr(n, e, t, i) {
|
|
1954
1949
|
m,
|
1955
1950
|
p,
|
1956
1951
|
v,
|
1957
|
-
|
1958
|
-
|
1952
|
+
y,
|
1953
|
+
P,
|
1959
1954
|
G,
|
1960
|
-
|
1955
|
+
Ie,
|
1961
1956
|
I,
|
1962
1957
|
Z = !0,
|
1963
1958
|
X,
|
1964
|
-
|
1965
|
-
|
1959
|
+
F,
|
1960
|
+
Ue,
|
1966
1961
|
Tt;
|
1967
1962
|
if ((h = qs(n, e)) >= 0) v = !0;else if ((h = Hs(n, e)) >= 0) v = !1;else return !1;
|
1968
1963
|
if (n.level >= n.options.maxNesting) return !1;
|
1969
1964
|
if (p = n.src.charCodeAt(h - 1), i) return !0;
|
1970
|
-
for (
|
1965
|
+
for (P = n.tokens.length, v ? (d = n.bMarks[e] + n.tShift[e], m = Number(n.src.substr(d, h - d - 1)), n.tokens.push({
|
1971
1966
|
type: "ordered_list_open",
|
1972
1967
|
order: m,
|
1973
|
-
lines:
|
1968
|
+
lines: Ie = [e, 0],
|
1974
1969
|
level: n.level++
|
1975
1970
|
})) : n.tokens.push({
|
1976
1971
|
type: "bullet_list_open",
|
1977
|
-
lines:
|
1972
|
+
lines: Ie = [e, 0],
|
1978
1973
|
level: n.level++
|
1979
|
-
}), s = e, G = !1, X = n.parser.ruler.getRules("list"); s < t && (
|
1974
|
+
}), s = e, G = !1, X = n.parser.ruler.getRules("list"); s < t && (y = n.skipSpaces(h), u = n.eMarks[s], y >= u ? f = 1 : f = y - h, f > 4 && (f = 1), f < 1 && (f = 1), r = h - n.bMarks[s] + f, n.tokens.push({
|
1980
1975
|
type: "list_item_open",
|
1981
1976
|
lines: I = [e, 0],
|
1982
1977
|
level: n.level++
|
1983
|
-
}), a = n.blkIndent, l = n.tight, o = n.tShift[e], c = n.parentType, n.tShift[e] =
|
1978
|
+
}), a = n.blkIndent, l = n.tight, o = n.tShift[e], c = n.parentType, n.tShift[e] = y - n.bMarks[e], n.blkIndent = r, n.tight = !0, n.parentType = "list", n.parser.tokenize(n, e, t, !0), (!n.tight || G) && (Z = !1), G = n.line - e > 1 && n.isEmpty(n.line - 1), n.blkIndent = a, n.tShift[e] = o, n.tight = l, n.parentType = c, n.tokens.push({
|
1984
1979
|
type: "list_item_close",
|
1985
1980
|
level: --n.level
|
1986
|
-
}), s = e = n.line, I[1] = s,
|
1987
|
-
for (Tt = !1,
|
1981
|
+
}), s = e = n.line, I[1] = s, y = n.bMarks[e], !(s >= t || n.isEmpty(s) || n.tShift[s] < n.blkIndent));) {
|
1982
|
+
for (Tt = !1, F = 0, Ue = X.length; F < Ue; F++) if (X[F](n, s, t, !0)) {
|
1988
1983
|
Tt = !0;
|
1989
1984
|
break;
|
1990
1985
|
}
|
@@ -1997,7 +1992,7 @@ function fr(n, e, t, i) {
|
|
1997
1992
|
return n.tokens.push({
|
1998
1993
|
type: v ? "ordered_list_close" : "bullet_list_close",
|
1999
1994
|
level: --n.level
|
2000
|
-
}),
|
1995
|
+
}), Ie[1] = s, n.line = s, Z && ur(n, P), !0;
|
2001
1996
|
}
|
2002
1997
|
function pr(n, e, t, i) {
|
2003
1998
|
var s,
|
@@ -2202,7 +2197,7 @@ function Sr(n, e) {
|
|
2202
2197
|
for (t = e + 2, i = n.tokens.length - 2; t < i; t++) n.tokens[t].level === s && n.tokens[t].type === "paragraph_open" && (n.tokens[t + 2].tight = !0, n.tokens[t].tight = !0, t += 2);
|
2203
2198
|
}
|
2204
2199
|
function _r(n, e, t, i) {
|
2205
|
-
var s, r, o, a, l, c, d, h, u, f, m, p, v,
|
2200
|
+
var s, r, o, a, l, c, d, h, u, f, m, p, v, y;
|
2206
2201
|
if (i) return n.ddIndent < 0 ? !1 : ni(n, e) >= 0;
|
2207
2202
|
if (d = e + 1, n.isEmpty(d) && ++d > t || n.tShift[d] < n.blkIndent || (s = ni(n, d), s < 0) || n.level >= n.options.maxNesting) return !1;
|
2208
2203
|
c = n.tokens.length, n.tokens.push({
|
@@ -2211,7 +2206,7 @@ function _r(n, e, t, i) {
|
|
2211
2206
|
level: n.level++
|
2212
2207
|
}), o = e, r = d;
|
2213
2208
|
e: for (;;) {
|
2214
|
-
for (
|
2209
|
+
for (y = !0, v = !1, n.tokens.push({
|
2215
2210
|
type: "dt_open",
|
2216
2211
|
lines: [o, o],
|
2217
2212
|
level: n.level++
|
@@ -2229,7 +2224,7 @@ function _r(n, e, t, i) {
|
|
2229
2224
|
type: "dd_open",
|
2230
2225
|
lines: a = [d, 0],
|
2231
2226
|
level: n.level++
|
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) && (
|
2227
|
+
}), p = n.tight, u = n.ddIndent, h = n.blkIndent, m = n.tShift[r], f = n.parentType, n.blkIndent = n.ddIndent = n.tShift[r] + 2, n.tShift[r] = s - n.bMarks[r], n.tight = !0, n.parentType = "deflist", n.parser.tokenize(n, r, t, !0), (!n.tight || v) && (y = !1), v = n.line - r > 1 && n.isEmpty(n.line - 1), n.tShift[r] = m, n.tight = p, n.parentType = f, n.blkIndent = h, n.ddIndent = u, n.tokens.push({
|
2233
2228
|
type: "dd_close",
|
2234
2229
|
level: --n.level
|
2235
2230
|
}), a[1] = d = n.line, d >= t || n.tShift[d] < n.blkIndent) break e;
|
@@ -2241,7 +2236,7 @@ function _r(n, e, t, i) {
|
|
2241
2236
|
return n.tokens.push({
|
2242
2237
|
type: "dl_close",
|
2243
2238
|
level: --n.level
|
2244
|
-
}), l[1] = d, n.line = d,
|
2239
|
+
}), l[1] = d, n.line = d, y && Sr(n, c), !0;
|
2245
2240
|
}
|
2246
2241
|
function wr(n, e) {
|
2247
2242
|
var t,
|
@@ -2304,7 +2299,7 @@ _s.prototype.parse = function (n, e, t, i) {
|
|
2304
2299
|
n = n.replace(Ar, " "), n = n.replace(Cr, "\n"), n.indexOf(" ") >= 0 && (n = n.replace(Tr, function (a, l) {
|
2305
2300
|
var c;
|
2306
2301
|
return n.charCodeAt(l) === 10 ? (r = l + 1, o = 0, a) : (c = " ".slice((l - r - o) % 4), o = l - r + 1, c);
|
2307
|
-
})), s = new
|
2302
|
+
})), s = new nt(n, this, e, t, i), this.tokenize(s, s.line, s.lineMax);
|
2308
2303
|
};
|
2309
2304
|
function kr(n) {
|
2310
2305
|
switch (n) {
|
@@ -2796,13 +2791,13 @@ Pi.prototype.tokenize = function (n) {
|
|
2796
2791
|
n.pending && n.pushPending();
|
2797
2792
|
};
|
2798
2793
|
Pi.prototype.parse = function (n, e, t, i) {
|
2799
|
-
var s = new
|
2794
|
+
var s = new st(n, this, e, t, i);
|
2800
2795
|
this.tokenize(s);
|
2801
2796
|
};
|
2802
2797
|
function fo(n) {
|
2803
2798
|
var e = ["vbscript", "javascript", "file", "data"],
|
2804
2799
|
t = n.trim().toLowerCase();
|
2805
|
-
return t =
|
2800
|
+
return t = et(t), !(t.indexOf(":") !== -1 && e.indexOf(t.split(":")[0]) !== -1);
|
2806
2801
|
}
|
2807
2802
|
var po = {
|
2808
2803
|
options: {
|
@@ -2921,34 +2916,34 @@ var po = {
|
|
2921
2916
|
function Sn(n, e, t) {
|
2922
2917
|
this.src = e, this.env = t, this.options = n.options, this.tokens = [], this.inlineMode = !1, this.inline = n.inline, this.block = n.block, this.renderer = n.renderer, this.typographer = n.typographer;
|
2923
2918
|
}
|
2924
|
-
function
|
2919
|
+
function Me(n, e) {
|
2925
2920
|
typeof n != "string" && (e = n, n = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new Pi(), this.block = new _s(), this.core = new En(), this.renderer = new Ss(), this.ruler = new se(), this.options = {}, this.configure(bo[n]), this.set(e || {});
|
2926
2921
|
}
|
2927
|
-
|
2922
|
+
Me.prototype.set = function (n) {
|
2928
2923
|
pn(this.options, n);
|
2929
2924
|
};
|
2930
|
-
|
2925
|
+
Me.prototype.configure = function (n) {
|
2931
2926
|
var e = this;
|
2932
2927
|
if (!n) throw new Error("Wrong `remarkable` preset, check name/content");
|
2933
2928
|
n.options && e.set(n.options), n.components && Object.keys(n.components).forEach(function (t) {
|
2934
2929
|
n.components[t].rules && e[t].ruler.enable(n.components[t].rules, !0);
|
2935
2930
|
});
|
2936
2931
|
};
|
2937
|
-
|
2932
|
+
Me.prototype.use = function (n, e) {
|
2938
2933
|
return n(this, e), this;
|
2939
2934
|
};
|
2940
|
-
|
2935
|
+
Me.prototype.parse = function (n, e) {
|
2941
2936
|
var t = new Sn(this, n, e);
|
2942
2937
|
return this.core.process(t), t.tokens;
|
2943
2938
|
};
|
2944
|
-
|
2939
|
+
Me.prototype.render = function (n, e) {
|
2945
2940
|
return e = e || {}, this.renderer.render(this.parse(n, e), this.options, e);
|
2946
2941
|
};
|
2947
|
-
|
2942
|
+
Me.prototype.parseInline = function (n, e) {
|
2948
2943
|
var t = new Sn(this, n, e);
|
2949
2944
|
return t.inlineMode = !0, this.core.process(t), t.tokens;
|
2950
2945
|
};
|
2951
|
-
|
2946
|
+
Me.prototype.renderInline = function (n, e) {
|
2952
2947
|
return e = e || {}, this.renderer.render(this.parseInline(n, e), this.options, e);
|
2953
2948
|
};
|
2954
2949
|
var jt = /*#__PURE__*/function () {
|
@@ -2959,7 +2954,7 @@ var jt = /*#__PURE__*/function () {
|
|
2959
2954
|
key: "instantiate",
|
2960
2955
|
value: function instantiate() {
|
2961
2956
|
var e = window.hljs;
|
2962
|
-
return e ? new
|
2957
|
+
return e ? new Me({
|
2963
2958
|
highlight: function highlight(t, i) {
|
2964
2959
|
if (i && e.getLanguage(i)) try {
|
2965
2960
|
return e.highlight(i, t).value;
|
@@ -2985,7 +2980,7 @@ var jt = /*#__PURE__*/function () {
|
|
2985
2980
|
// set target to open in a new tab
|
2986
2981
|
typographer: !0
|
2987
2982
|
// Enable smartypants and other sweet transforms
|
2988
|
-
}) : new
|
2983
|
+
}) : new Me({
|
2989
2984
|
breaks: !0,
|
2990
2985
|
linkTarget: "_blank"
|
2991
2986
|
// set target to open in a new tab
|
@@ -3001,11 +2996,11 @@ var jt = /*#__PURE__*/function () {
|
|
3001
2996
|
}
|
3002
2997
|
}]);
|
3003
2998
|
}();
|
3004
|
-
var
|
3005
|
-
function
|
3006
|
-
_classCallCheck(this,
|
2999
|
+
var xe = /*#__PURE__*/function () {
|
3000
|
+
function xe() {
|
3001
|
+
_classCallCheck(this, xe);
|
3007
3002
|
}
|
3008
|
-
return _createClass(
|
3003
|
+
return _createClass(xe, null, [{
|
3009
3004
|
key: "addMessage",
|
3010
3005
|
value:
|
3011
3006
|
// prettier-ignore
|
@@ -3017,7 +3012,7 @@ var Se = /*#__PURE__*/function () {
|
|
3017
3012
|
key: "wrapInLink",
|
3018
3013
|
value: function wrapInLink(e, t, i) {
|
3019
3014
|
var s = document.createElement("a");
|
3020
|
-
return s.href = t, s.download = i ||
|
3015
|
+
return s.href = t, s.download = i || xe.DEFAULT_FILE_NAME, s.target = "_blank", s.appendChild(e), s;
|
3021
3016
|
}
|
3022
3017
|
}, {
|
3023
3018
|
key: "isNonLinkableDataUrl",
|
@@ -3027,7 +3022,7 @@ var Se = /*#__PURE__*/function () {
|
|
3027
3022
|
}, {
|
3028
3023
|
key: "processContent",
|
3029
3024
|
value: function processContent(e, t, i, s) {
|
3030
|
-
return !i ||
|
3025
|
+
return !i || xe.isNonLinkableDataUrl(e, i) ? t : xe.wrapInLink(t, i, s);
|
3031
3026
|
}
|
3032
3027
|
}, {
|
3033
3028
|
key: "waitToLoadThenScroll",
|
@@ -3039,11 +3034,11 @@ var Se = /*#__PURE__*/function () {
|
|
3039
3034
|
}, {
|
3040
3035
|
key: "scrollDownOnImageLoad",
|
3041
3036
|
value: function scrollDownOnImageLoad(e, t) {
|
3042
|
-
if (e.startsWith("data"))
|
3037
|
+
if (e.startsWith("data")) xe.waitToLoadThenScroll(t);else try {
|
3043
3038
|
fetch(e, {
|
3044
3039
|
mode: "no-cors"
|
3045
3040
|
})["catch"](function () {})["finally"](function () {
|
3046
|
-
|
3041
|
+
xe.waitToLoadThenScroll(t);
|
3047
3042
|
});
|
3048
3043
|
} catch (_unused5) {
|
3049
3044
|
t.scrollTop = t.scrollHeight;
|
@@ -3081,7 +3076,7 @@ var Se = /*#__PURE__*/function () {
|
|
3081
3076
|
value: function isImageFile(e) {
|
3082
3077
|
var t = e.type,
|
3083
3078
|
i = e.src;
|
3084
|
-
return t === "image" || (i == null ? void 0 : i.startsWith("data:image")) || i &&
|
3079
|
+
return t === "image" || (i == null ? void 0 : i.startsWith("data:image")) || i && xe.isImageFileExtension(i);
|
3085
3080
|
}
|
3086
3081
|
}, {
|
3087
3082
|
key: "isImageFileExtension",
|
@@ -3090,8 +3085,8 @@ var Se = /*#__PURE__*/function () {
|
|
3090
3085
|
}
|
3091
3086
|
}]);
|
3092
3087
|
}();
|
3093
|
-
|
3094
|
-
var
|
3088
|
+
xe.DEFAULT_FILE_NAME = "file";
|
3089
|
+
var U = xe;
|
3095
3090
|
var hi = /*#__PURE__*/function () {
|
3096
3091
|
function hi() {
|
3097
3092
|
_classCallCheck(this, hi);
|
@@ -3105,7 +3100,7 @@ var hi = /*#__PURE__*/function () {
|
|
3105
3100
|
isHistory: i,
|
3106
3101
|
isInitial: i
|
3107
3102
|
}));
|
3108
|
-
|
3103
|
+
U.reAddFileRefToObject(t, s), (r = e.onMessage) == null || r.call(e, s), e.dispatchEvent(new CustomEvent("message", {
|
3109
3104
|
detail: s
|
3110
3105
|
})), le.fireOnNewMessage(e, s);
|
3111
3106
|
}
|
@@ -3133,11 +3128,11 @@ var hi = /*#__PURE__*/function () {
|
|
3133
3128
|
}
|
3134
3129
|
}]);
|
3135
3130
|
}();
|
3136
|
-
var
|
3137
|
-
function
|
3138
|
-
_classCallCheck(this,
|
3131
|
+
var B = /*#__PURE__*/function () {
|
3132
|
+
function B() {
|
3133
|
+
_classCallCheck(this, B);
|
3139
3134
|
}
|
3140
|
-
return _createClass(
|
3135
|
+
return _createClass(B, null, [{
|
3141
3136
|
key: "generateLoadingRingElement",
|
3142
3137
|
value: function generateLoadingRingElement() {
|
3143
3138
|
var e = document.createElement("div");
|
@@ -3146,25 +3141,25 @@ var F = /*#__PURE__*/function () {
|
|
3146
3141
|
}, {
|
3147
3142
|
key: "apply",
|
3148
3143
|
value: function apply(e, t, i) {
|
3149
|
-
|
3144
|
+
Ae.setRing(t.bubbleElement, i == null ? void 0 : i.bubble), i != null && i.bubble && (i = JSON.parse(JSON.stringify(i)), delete i.bubble), e.applyCustomStyles(t, "history", !1, i);
|
3150
3145
|
}
|
3151
3146
|
}, {
|
3152
3147
|
key: "addLoadHistoryMessage",
|
3153
3148
|
value: function addLoadHistoryMessage(e, t) {
|
3154
3149
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
3155
3150
|
var o, a, l, c, d, h, u, f;
|
3156
|
-
e.bubbleElement.classList.add(
|
3157
|
-
var s = i ?
|
3151
|
+
e.bubbleElement.classList.add(B.CLASS);
|
3152
|
+
var s = i ? B.FULL_VIEW_CLASS : B.SMALL_CLASS;
|
3158
3153
|
e.outerContainer.classList.add(s);
|
3159
3154
|
var r = i ? (c = (l = (a = (o = t.messageStyles) == null ? void 0 : o.loading) == null ? void 0 : a.history) == null ? void 0 : l.full) == null ? void 0 : c.styles : (f = (u = (h = (d = t.messageStyles) == null ? void 0 : d.loading) == null ? void 0 : h.history) == null ? void 0 : u.small) == null ? void 0 : f.styles;
|
3160
|
-
|
3155
|
+
B.apply(t, e, r), t.elementRef.prepend(e.outerContainer);
|
3161
3156
|
}
|
3162
3157
|
}, {
|
3163
3158
|
key: "createDefaultElements",
|
3164
3159
|
value: function createDefaultElements(e) {
|
3165
3160
|
var t = e.createMessageElements("", b.AI_ROLE),
|
3166
3161
|
i = t.bubbleElement,
|
3167
|
-
s =
|
3162
|
+
s = B.generateLoadingRingElement();
|
3168
3163
|
return i.appendChild(s), t;
|
3169
3164
|
}
|
3170
3165
|
}, {
|
@@ -3173,25 +3168,25 @@ var F = /*#__PURE__*/function () {
|
|
3173
3168
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
3174
3169
|
var r, o, a, l;
|
3175
3170
|
var i = (l = (a = (o = (r = e.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.history) == null ? void 0 : a.full) == null ? void 0 : l.html,
|
3176
|
-
s = i ?
|
3177
|
-
return
|
3171
|
+
s = i ? Fe.createElements(e, i, b.AI_ROLE, !0) : B.createDefaultElements(e);
|
3172
|
+
return B.addLoadHistoryMessage(s, e, t), s;
|
3178
3173
|
}
|
3179
3174
|
}, {
|
3180
3175
|
key: "changeFullViewToSmall",
|
3181
3176
|
value: function changeFullViewToSmall(e, t) {
|
3182
3177
|
var i, s, r, o, a, l, c, d;
|
3183
|
-
if (t != null && t.outerContainer.classList.contains(
|
3184
|
-
t.outerContainer.classList.replace(
|
3178
|
+
if (t != null && t.outerContainer.classList.contains(B.FULL_VIEW_CLASS)) {
|
3179
|
+
t.outerContainer.classList.replace(B.FULL_VIEW_CLASS, B.SMALL_CLASS);
|
3185
3180
|
var h = (o = (r = (s = (i = e.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.history) == null ? void 0 : r.small) == null ? void 0 : o.styles;
|
3186
|
-
h &&
|
3181
|
+
h && B.apply(e, t, h);
|
3187
3182
|
var u = (d = (c = (l = (a = e.messageStyles) == null ? void 0 : a.loading) == null ? void 0 : l.history) == null ? void 0 : c.small) == null ? void 0 : d.html;
|
3188
3183
|
u && (t.bubbleElement.innerHTML = u);
|
3189
3184
|
}
|
3190
3185
|
}
|
3191
3186
|
}]);
|
3192
3187
|
}();
|
3193
|
-
|
3194
|
-
var
|
3188
|
+
B.CLASS = "loading-history-message", B.FULL_VIEW_CLASS = "loading-history-message-full-view", B.SMALL_CLASS = "loading-history-message-small";
|
3189
|
+
var Ye = B;
|
3195
3190
|
var q = /*#__PURE__*/function () {
|
3196
3191
|
function q() {
|
3197
3192
|
_classCallCheck(this, q);
|
@@ -3241,15 +3236,15 @@ var q = /*#__PURE__*/function () {
|
|
3241
3236
|
}
|
3242
3237
|
}]);
|
3243
3238
|
}();
|
3244
|
-
var
|
3245
|
-
function
|
3239
|
+
var De = /*#__PURE__*/function () {
|
3240
|
+
function De(e) {
|
3246
3241
|
var _this3 = this;
|
3247
|
-
_classCallCheck(this,
|
3248
|
-
this.messageElementRefs = [], this.htmlClassUtilities = {}, this.messageToElements = [], this.textElementsToText = [], this.
|
3242
|
+
_classCallCheck(this, De);
|
3243
|
+
this.messageElementRefs = [], this.htmlClassUtilities = {}, this.messageToElements = [], this.textElementsToText = [], this.elementRef = De.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = jt.createNew(), this._avatars = e.avatars, this._names = e.names, this._onMessage = hi.onMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(function () {
|
3249
3244
|
_this3.submitUserMessage = e.submitUserMessage;
|
3250
3245
|
});
|
3251
3246
|
}
|
3252
|
-
return _createClass(
|
3247
|
+
return _createClass(De, [{
|
3253
3248
|
key: "addNewTextMessage",
|
3254
3249
|
value: function addNewTextMessage(e, t, i) {
|
3255
3250
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
@@ -3307,7 +3302,7 @@ var Be = /*#__PURE__*/function () {
|
|
3307
3302
|
var r;
|
3308
3303
|
(r = this._introPanel) == null || r.hide();
|
3309
3304
|
var s = this.messageElementRefs[this.messageElementRefs.length - 1];
|
3310
|
-
return
|
3305
|
+
return Ye.changeFullViewToSmall(this, s), De.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), s.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t, i);
|
3311
3306
|
}
|
3312
3307
|
// this can be tested by having an ai message, then a temp ai message with html that submits new user message:
|
3313
3308
|
// https://github.com/OvidijusParsiunas/deep-chat/issues/258
|
@@ -3315,7 +3310,7 @@ var Be = /*#__PURE__*/function () {
|
|
3315
3310
|
}, {
|
3316
3311
|
key: "revealRoleElementsIfTempRemoved",
|
3317
3312
|
value: function revealRoleElementsIfTempRemoved(e, t) {
|
3318
|
-
if ((this._avatars || this._names) &&
|
3313
|
+
if ((this._avatars || this._names) && ke.isElementTemporary(e)) {
|
3319
3314
|
var i = this.messageElementRefs[this.messageElementRefs.length - 2];
|
3320
3315
|
i && this.messageToElements.length > 0 && !e.bubbleElement.classList.contains(b.getRoleClass(t)) && b.revealRoleElements(i.innerContainer, this._avatars, this._names);
|
3321
3316
|
}
|
@@ -3324,7 +3319,7 @@ var Be = /*#__PURE__*/function () {
|
|
3324
3319
|
key: "createMessageElements",
|
3325
3320
|
value: function createMessageElements(e, t) {
|
3326
3321
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
3327
|
-
var s =
|
3322
|
+
var s = De.createBaseElements(t),
|
3328
3323
|
r = s.outerContainer,
|
3329
3324
|
o = s.innerContainer,
|
3330
3325
|
a = s.bubbleElement;
|
@@ -3396,7 +3391,7 @@ var Be = /*#__PURE__*/function () {
|
|
3396
3391
|
}, {
|
3397
3392
|
key: "isTemporaryElement",
|
3398
3393
|
value: function isTemporaryElement(e) {
|
3399
|
-
return
|
3394
|
+
return De.isLoadingMessage(e) || ke.isElementTemporary(e);
|
3400
3395
|
}
|
3401
3396
|
}, {
|
3402
3397
|
key: "createBaseElements",
|
@@ -3427,17 +3422,16 @@ var Be = /*#__PURE__*/function () {
|
|
3427
3422
|
}, {
|
3428
3423
|
key: "isLoadingMessage",
|
3429
3424
|
value: function isLoadingMessage(e) {
|
3430
|
-
return e == null ? void 0 : e.bubbleElement.classList.contains(
|
3425
|
+
return e == null ? void 0 : e.bubbleElement.classList.contains(Ae.BUBBLE_CLASS);
|
3431
3426
|
}
|
3432
3427
|
}]);
|
3433
3428
|
}();
|
3434
|
-
var
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
this._fileAdded = !1, this._streamedContent = "", this._streamType = "", this._hasStreamEnded = !1, this._messages = e;
|
3429
|
+
var ft = /*#__PURE__*/function () {
|
3430
|
+
function ft(e) {
|
3431
|
+
_classCallCheck(this, ft);
|
3432
|
+
this._fileAdded = !1, this._streamType = "", this._hasStreamEnded = !1, this._messages = e;
|
3439
3433
|
}
|
3440
|
-
return _createClass(
|
3434
|
+
return _createClass(ft, [{
|
3441
3435
|
key: "upsertStreamedMessage",
|
3442
3436
|
value: function upsertStreamedMessage(e) {
|
3443
3437
|
var r;
|
@@ -3446,7 +3440,7 @@ var _e = /*#__PURE__*/function () {
|
|
3446
3440
|
var t = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.html) || "",
|
3447
3441
|
i = J.isScrollbarAtBottomOfElement(this._messages.elementRef),
|
3448
3442
|
s = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
|
3449
|
-
if (!this._elements && this.
|
3443
|
+
if (!this._elements && !this._message) this.setInitialState(s, t, e == null ? void 0 : e.role);else {
|
3450
3444
|
if (this._streamType !== s) return console.error(M.INVALID_STREAM_EVENT_MIX);
|
3451
3445
|
this.updateBasedOnType(t, s, (r = this._elements) == null ? void 0 : r.bubbleElement, e == null ? void 0 : e.overwrite);
|
3452
3446
|
}
|
@@ -3456,9 +3450,9 @@ var _e = /*#__PURE__*/function () {
|
|
3456
3450
|
key: "setInitialState",
|
3457
3451
|
value: function setInitialState(e, t, i) {
|
3458
3452
|
var _i8;
|
3459
|
-
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) :
|
3453
|
+
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : Fe.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(ft.MESSAGE_CLASS), this._activeMessageRole = i, this._message = _defineProperty({
|
3460
3454
|
role: this._activeMessageRole
|
3461
|
-
}, e,
|
3455
|
+
}, e, t), this._messages.messageToElements.push([this._message, [this._elements]]);
|
3462
3456
|
}
|
3463
3457
|
}, {
|
3464
3458
|
key: "updateBasedOnType",
|
@@ -3469,24 +3463,24 @@ var _e = /*#__PURE__*/function () {
|
|
3469
3463
|
}, {
|
3470
3464
|
key: "updateText",
|
3471
3465
|
value: function updateText(e, t, i) {
|
3472
|
-
this.
|
3466
|
+
this._message && (this._message.text = i ? e : this._message.text + e, this._messages.textElementsToText[this._messages.textElementsToText.length - 1][1] = this._message.text, this._messages.renderText(t, this._message.text));
|
3473
3467
|
}
|
3474
3468
|
}, {
|
3475
3469
|
key: "updateHTML",
|
3476
3470
|
value: function updateHTML(e, t, i) {
|
3477
|
-
if (i) this.
|
3471
|
+
if (this._message) if (i) this._message.html = e, t.innerHTML = e;else {
|
3478
3472
|
var s = document.createElement("span");
|
3479
|
-
s.innerHTML = e, t.appendChild(s), this.
|
3473
|
+
s.innerHTML = e, t.appendChild(s), this._message.html = (t == null ? void 0 : t.innerHTML) || "";
|
3480
3474
|
}
|
3481
3475
|
}
|
3482
3476
|
}, {
|
3483
3477
|
key: "finaliseStreamedMessage",
|
3484
3478
|
value: function finaliseStreamedMessage() {
|
3485
|
-
var t
|
3479
|
+
var t;
|
3486
3480
|
var e = this._messages.textElementsToText;
|
3487
|
-
if (!this._endStreamAfterOperation && !(this._fileAdded && !this._elements)) {
|
3481
|
+
if (!(this._endStreamAfterOperation || !this._message) && !(this._fileAdded && !this._elements)) {
|
3488
3482
|
if (!this._elements) throw Error(M.NO_VALID_STREAM_EVENTS_SENT);
|
3489
|
-
(t = this._elements.bubbleElement) != null && t.classList.contains(
|
3483
|
+
(t = this._elements.bubbleElement) != null && t.classList.contains(ft.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._message.text || "", this._messages.textToSpeech && bt.speak(this._message.text || "", this._messages.textToSpeech)) : this._streamType === "html" && this._elements && te.apply(this._messages, this._elements.outerContainer), this._elements.bubbleElement.classList.remove(ft.MESSAGE_CLASS), this._message && this._messages.sendClientUpdate(De.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
|
3490
3484
|
}
|
3491
3485
|
}
|
3492
3486
|
}, {
|
@@ -3497,7 +3491,7 @@ var _e = /*#__PURE__*/function () {
|
|
3497
3491
|
}, {
|
3498
3492
|
key: "newMessage",
|
3499
3493
|
value: function newMessage() {
|
3500
|
-
this.finaliseStreamedMessage(), this._elements = void 0, this.
|
3494
|
+
this.finaliseStreamedMessage(), this._elements = void 0, delete this._message, this._fileAdded = !1, this._hasStreamEnded = !1, this._activeMessageRole = void 0;
|
3501
3495
|
}
|
3502
3496
|
// prettier-ignore
|
3503
3497
|
}, {
|
@@ -3531,13 +3525,13 @@ var _e = /*#__PURE__*/function () {
|
|
3531
3525
|
}()
|
3532
3526
|
}]);
|
3533
3527
|
}();
|
3534
|
-
|
3535
|
-
var
|
3536
|
-
var
|
3537
|
-
function
|
3538
|
-
_classCallCheck(this,
|
3528
|
+
ft.MESSAGE_CLASS = "streamed-message";
|
3529
|
+
var be = ft;
|
3530
|
+
var $e = /*#__PURE__*/function () {
|
3531
|
+
function $e() {
|
3532
|
+
_classCallCheck(this, $e);
|
3539
3533
|
}
|
3540
|
-
return _createClass(
|
3534
|
+
return _createClass($e, null, [{
|
3541
3535
|
key: "tempRemoveContentHeader",
|
3542
3536
|
value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
|
3543
3537
|
// prettier-ignore
|
@@ -3553,8 +3547,8 @@ var We = /*#__PURE__*/function () {
|
|
3553
3547
|
}
|
3554
3548
|
throw new Error("Request settings have not been set up");
|
3555
3549
|
case 2:
|
3556
|
-
s = e.headers[
|
3557
|
-
delete e.headers[
|
3550
|
+
s = e.headers[$e.CONTENT_TYPE];
|
3551
|
+
delete e.headers[$e.CONTENT_TYPE];
|
3558
3552
|
_context2.prev = 4;
|
3559
3553
|
_context2.next = 7;
|
3560
3554
|
return t(i);
|
@@ -3565,9 +3559,9 @@ var We = /*#__PURE__*/function () {
|
|
3565
3559
|
case 10:
|
3566
3560
|
_context2.prev = 10;
|
3567
3561
|
_context2.t0 = _context2["catch"](4);
|
3568
|
-
throw e.headers[
|
3562
|
+
throw e.headers[$e.CONTENT_TYPE] = s, _context2.t0;
|
3569
3563
|
case 13:
|
3570
|
-
return _context2.abrupt("return", (e.headers[
|
3564
|
+
return _context2.abrupt("return", (e.headers[$e.CONTENT_TYPE] = s, r));
|
3571
3565
|
case 14:
|
3572
3566
|
case "end":
|
3573
3567
|
return _context2.stop();
|
@@ -3660,8 +3654,8 @@ var We = /*#__PURE__*/function () {
|
|
3660
3654
|
}
|
3661
3655
|
}]);
|
3662
3656
|
}();
|
3663
|
-
|
3664
|
-
var
|
3657
|
+
$e.CONTENT_TYPE = "Content-Type";
|
3658
|
+
var E = $e;
|
3665
3659
|
function vo(_x12, _x13) {
|
3666
3660
|
return _vo.apply(this, arguments);
|
3667
3661
|
}
|
@@ -3786,21 +3780,21 @@ function wo(n, e) {
|
|
3786
3780
|
}
|
3787
3781
|
l || document.addEventListener("visibilitychange", p);
|
3788
3782
|
var v = _o,
|
3789
|
-
|
3790
|
-
function
|
3791
|
-
document.removeEventListener("visibilitychange", p), window.clearTimeout(
|
3783
|
+
y = 0;
|
3784
|
+
function P() {
|
3785
|
+
document.removeEventListener("visibilitychange", p), window.clearTimeout(y), m.abort();
|
3792
3786
|
}
|
3793
3787
|
t == null || t.addEventListener("abort", function () {
|
3794
|
-
|
3788
|
+
P(), h();
|
3795
3789
|
});
|
3796
3790
|
var G = c !== null && c !== void 0 ? c : window.fetch,
|
3797
|
-
|
3791
|
+
Ie = s !== null && s !== void 0 ? s : To;
|
3798
3792
|
function I() {
|
3799
3793
|
return _I.apply(this, arguments);
|
3800
3794
|
}
|
3801
3795
|
function _I() {
|
3802
3796
|
_I = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
3803
|
-
var Z, X,
|
3797
|
+
var Z, X, F;
|
3804
3798
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
3805
3799
|
while (1) switch (_context4.prev = _context4.next) {
|
3806
3800
|
case 0:
|
@@ -3814,17 +3808,17 @@ function wo(n, e) {
|
|
3814
3808
|
case 4:
|
3815
3809
|
X = _context4.sent;
|
3816
3810
|
_context4.next = 7;
|
3817
|
-
return
|
3811
|
+
return Ie(X);
|
3818
3812
|
case 7:
|
3819
3813
|
_context4.next = 9;
|
3820
|
-
return vo(X.body, yo(Eo(function (
|
3821
|
-
|
3822
|
-
}, function (
|
3823
|
-
v =
|
3814
|
+
return vo(X.body, yo(Eo(function (F) {
|
3815
|
+
F ? f[Ws] = F : delete f[Ws];
|
3816
|
+
}, function (F) {
|
3817
|
+
v = F;
|
3824
3818
|
}, r)));
|
3825
3819
|
case 9:
|
3826
3820
|
o == null || o();
|
3827
|
-
|
3821
|
+
P();
|
3828
3822
|
h();
|
3829
3823
|
_context4.next = 17;
|
3830
3824
|
break;
|
@@ -3832,10 +3826,10 @@ function wo(n, e) {
|
|
3832
3826
|
_context4.prev = 14;
|
3833
3827
|
_context4.t0 = _context4["catch"](1);
|
3834
3828
|
if (!m.signal.aborted) try {
|
3835
|
-
|
3836
|
-
window.clearTimeout(
|
3837
|
-
} catch (
|
3838
|
-
|
3829
|
+
F = (Z = a == null ? void 0 : a(_context4.t0)) !== null && Z !== void 0 ? Z : v;
|
3830
|
+
window.clearTimeout(y), y = window.setTimeout(I, F);
|
3831
|
+
} catch (F) {
|
3832
|
+
P(), u(F);
|
3839
3833
|
}
|
3840
3834
|
case 17:
|
3841
3835
|
case "end":
|
@@ -3865,12 +3859,12 @@ var A = /*#__PURE__*/function () {
|
|
3865
3859
|
r,
|
3866
3860
|
p,
|
3867
3861
|
v,
|
3868
|
-
|
3869
|
-
|
3862
|
+
y,
|
3863
|
+
P,
|
3870
3864
|
G,
|
3871
|
-
|
3865
|
+
Ie,
|
3872
3866
|
o,
|
3873
|
-
_yield$
|
3867
|
+
_yield$E$processReque,
|
3874
3868
|
a,
|
3875
3869
|
l,
|
3876
3870
|
c,
|
@@ -3891,12 +3885,12 @@ var A = /*#__PURE__*/function () {
|
|
3891
3885
|
headers: (p = e.connectSettings) == null ? void 0 : p.headers
|
3892
3886
|
};
|
3893
3887
|
_context7.next = 5;
|
3894
|
-
return
|
3888
|
+
return E.processRequestInterceptor(e.deepChat, o);
|
3895
3889
|
case 5:
|
3896
|
-
_yield$
|
3897
|
-
a = _yield$
|
3898
|
-
l = _yield$
|
3899
|
-
c = _yield$
|
3890
|
+
_yield$E$processReque = _context7.sent;
|
3891
|
+
a = _yield$E$processReque.body;
|
3892
|
+
l = _yield$E$processReque.headers;
|
3893
|
+
c = _yield$E$processReque.error;
|
3900
3894
|
_e$streamHandlers = e.streamHandlers;
|
3901
3895
|
d = _e$streamHandlers.onOpen;
|
3902
3896
|
h = _e$streamHandlers.onClose;
|
@@ -3905,25 +3899,25 @@ var A = /*#__PURE__*/function () {
|
|
3905
3899
|
_context7.next = 15;
|
3906
3900
|
break;
|
3907
3901
|
}
|
3908
|
-
return _context7.abrupt("return",
|
3902
|
+
return _context7.abrupt("return", E.onInterceptorError(i, c, h));
|
3909
3903
|
case 15:
|
3910
3904
|
if (!((v = e.connectSettings) != null && v.handler)) {
|
3911
3905
|
_context7.next = 17;
|
3912
3906
|
break;
|
3913
3907
|
}
|
3914
|
-
return _context7.abrupt("return",
|
3908
|
+
return _context7.abrupt("return", Te.stream(e, a, i));
|
3915
3909
|
case 17:
|
3916
|
-
if (!(((
|
3910
|
+
if (!(((y = e.connectSettings) == null ? void 0 : y.url) === ve.URL)) {
|
3917
3911
|
_context7.next = 19;
|
3918
3912
|
break;
|
3919
3913
|
}
|
3920
|
-
return _context7.abrupt("return",
|
3914
|
+
return _context7.abrupt("return", ve.requestStream(i, e.streamHandlers));
|
3921
3915
|
case 19:
|
3922
|
-
f = new
|
3923
|
-
return _context7.abrupt("return", (wo(((
|
3916
|
+
f = new be(i), m = E.fetch.bind(this, e, l, s);
|
3917
|
+
return _context7.abrupt("return", (wo(((P = e.connectSettings) == null ? void 0 : P.url) || e.url || "", {
|
3924
3918
|
method: ((G = e.connectSettings) == null ? void 0 : G.method) || "POST",
|
3925
3919
|
headers: l,
|
3926
|
-
credentials: (
|
3920
|
+
credentials: (Ie = e.connectSettings) == null ? void 0 : Ie.credentials,
|
3927
3921
|
body: s ? JSON.stringify(a) : a,
|
3928
3922
|
openWhenHidden: !0,
|
3929
3923
|
// keep stream open when browser tab not open
|
@@ -3939,7 +3933,7 @@ var A = /*#__PURE__*/function () {
|
|
3939
3933
|
return _context5.abrupt("return", d());
|
3940
3934
|
case 2:
|
3941
3935
|
_context5.next = 4;
|
3942
|
-
return
|
3936
|
+
return E.processResponseByType(I);
|
3943
3937
|
case 4:
|
3944
3938
|
throw _context5.sent;
|
3945
3939
|
case 5:
|
@@ -3951,7 +3945,7 @@ var A = /*#__PURE__*/function () {
|
|
3951
3945
|
},
|
3952
3946
|
onmessage: function onmessage(I) {
|
3953
3947
|
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
3954
|
-
var Z, X,
|
3948
|
+
var Z, X, F, Ue, Tt;
|
3955
3949
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
3956
3950
|
while (1) switch (_context6.prev = _context6.next) {
|
3957
3951
|
case 0:
|
@@ -3960,25 +3954,25 @@ var A = /*#__PURE__*/function () {
|
|
3960
3954
|
break;
|
3961
3955
|
}
|
3962
3956
|
try {
|
3963
|
-
|
3957
|
+
Ue = JSON.parse(I.data);
|
3964
3958
|
} catch (_unused6) {
|
3965
|
-
|
3959
|
+
Ue = {};
|
3966
3960
|
}
|
3967
3961
|
_context6.next = 4;
|
3968
|
-
return (X = (Z = e.deepChat).responseInterceptor) == null ? void 0 : X.call(Z,
|
3962
|
+
return (X = (Z = e.deepChat).responseInterceptor) == null ? void 0 : X.call(Z, Ue);
|
3969
3963
|
case 4:
|
3970
3964
|
_context6.t0 = _context6.sent;
|
3971
3965
|
if (_context6.t0) {
|
3972
3966
|
_context6.next = 7;
|
3973
3967
|
break;
|
3974
3968
|
}
|
3975
|
-
_context6.t0 =
|
3969
|
+
_context6.t0 = Ue;
|
3976
3970
|
case 7:
|
3977
3971
|
Tt = _context6.t0;
|
3978
|
-
(
|
3979
|
-
e.asyncCallInProgress &&
|
3980
|
-
})["catch"](function (
|
3981
|
-
return
|
3972
|
+
(F = e.extractResultData) == null || F.call(e, Tt, m, a).then(function (je) {
|
3973
|
+
e.asyncCallInProgress && je && je.text !== "" ? (A.simulate(i, e.streamHandlers, je), h(), e.asyncCallInProgress = !1) : A.upsertWFiles(i, f.upsertStreamedMessage.bind(f), f, je);
|
3974
|
+
})["catch"](function (je) {
|
3975
|
+
return E.displayError(i, je);
|
3982
3976
|
});
|
3983
3977
|
case 9:
|
3984
3978
|
case "end":
|
@@ -4001,9 +3995,9 @@ var A = /*#__PURE__*/function () {
|
|
4001
3995
|
})["catch"](function (I) {
|
4002
3996
|
var Z;
|
4003
3997
|
i.isLastMessageError() || (Z = e.extractResultData) == null || Z.call(e, I).then(function () {
|
4004
|
-
|
3998
|
+
E.displayError(i, I);
|
4005
3999
|
})["catch"](function (X) {
|
4006
|
-
|
4000
|
+
E.displayError(i, X);
|
4007
4001
|
});
|
4008
4002
|
}), f));
|
4009
4003
|
case 21:
|
@@ -4027,12 +4021,12 @@ var A = /*#__PURE__*/function () {
|
|
4027
4021
|
}, i), !1), i.text) {
|
4028
4022
|
t.onOpen();
|
4029
4023
|
var r = i.text.split("");
|
4030
|
-
A.populateMessages(r, new
|
4024
|
+
A.populateMessages(r, new be(e), s, "text");
|
4031
4025
|
}
|
4032
4026
|
if (i.html) {
|
4033
4027
|
t.onOpen();
|
4034
4028
|
var _r2 = te.splitHTML(i.html);
|
4035
|
-
_r2.length === 0 && (_r2 = i.html.split("")), A.populateMessages(_r2, new
|
4029
|
+
_r2.length === 0 && (_r2 = i.html.split("")), A.populateMessages(_r2, new be(e), s, "html");
|
4036
4030
|
}
|
4037
4031
|
}
|
4038
4032
|
// prettier-ignore
|
@@ -4080,11 +4074,11 @@ var A = /*#__PURE__*/function () {
|
|
4080
4074
|
}
|
4081
4075
|
}]);
|
4082
4076
|
}();
|
4083
|
-
var
|
4084
|
-
function
|
4085
|
-
_classCallCheck(this,
|
4077
|
+
var We = /*#__PURE__*/function () {
|
4078
|
+
function We() {
|
4079
|
+
_classCallCheck(this, We);
|
4086
4080
|
}
|
4087
|
-
return _createClass(
|
4081
|
+
return _createClass(We, null, [{
|
4088
4082
|
key: "generateResponse",
|
4089
4083
|
value: function generateResponse(e) {
|
4090
4084
|
var t = e[e.length - 1][0];
|
@@ -4109,15 +4103,15 @@ var Ke = /*#__PURE__*/function () {
|
|
4109
4103
|
value: function getResponse(_ref2) {
|
4110
4104
|
var e = _ref2.customDemoResponse,
|
4111
4105
|
t = _ref2.messageToElements;
|
4112
|
-
return e ?
|
4113
|
-
text:
|
4106
|
+
return e ? We.getCustomResponse(e, t[t.length - 1][0]) : {
|
4107
|
+
text: We.generateResponse(t)
|
4114
4108
|
};
|
4115
4109
|
}
|
4116
4110
|
// timeout is used to simulate a timeout for a response to come back
|
4117
4111
|
}, {
|
4118
4112
|
key: "request",
|
4119
4113
|
value: function request(e, t) {
|
4120
|
-
var i =
|
4114
|
+
var i = We.getResponse(t);
|
4121
4115
|
setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
4122
4116
|
var r, o, s;
|
4123
4117
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
@@ -4147,22 +4141,22 @@ var Ke = /*#__PURE__*/function () {
|
|
4147
4141
|
key: "requestStream",
|
4148
4142
|
value: function requestStream(e, t) {
|
4149
4143
|
setTimeout(function () {
|
4150
|
-
var i =
|
4144
|
+
var i = We.getResponse(e);
|
4151
4145
|
A.simulate(e, t, i);
|
4152
4146
|
}, 400);
|
4153
4147
|
}
|
4154
4148
|
}]);
|
4155
4149
|
}();
|
4156
|
-
|
4157
|
-
var
|
4158
|
-
var
|
4159
|
-
function
|
4160
|
-
_classCallCheck(this,
|
4150
|
+
We.URL = "deep-chat-demo";
|
4151
|
+
var ve = We;
|
4152
|
+
var j = /*#__PURE__*/function () {
|
4153
|
+
function j() {
|
4154
|
+
_classCallCheck(this, j);
|
4161
4155
|
}
|
4162
|
-
return _createClass(
|
4156
|
+
return _createClass(j, null, [{
|
4163
4157
|
key: "setup",
|
4164
4158
|
value: function setup(e) {
|
4165
|
-
e.connectSettings.url !==
|
4159
|
+
e.connectSettings.url !== ve.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
4166
4160
|
}
|
4167
4161
|
}, {
|
4168
4162
|
key: "isElementPresentInDOM",
|
@@ -4174,21 +4168,21 @@ var U = /*#__PURE__*/function () {
|
|
4174
4168
|
}, {
|
4175
4169
|
key: "createConnection",
|
4176
4170
|
value: function createConnection(e, t) {
|
4177
|
-
if (!
|
4171
|
+
if (!j.isElementPresentInDOM(e.deepChat)) return;
|
4178
4172
|
var i = e.connectSettings.websocket;
|
4179
4173
|
if (i) {
|
4180
|
-
if (e.connectSettings.handler) return
|
4174
|
+
if (e.connectSettings.handler) return Te.websocket(e, t);
|
4181
4175
|
try {
|
4182
4176
|
var s = typeof i != "boolean" ? i : void 0,
|
4183
4177
|
r = new WebSocket(e.connectSettings.url || "", s);
|
4184
4178
|
e.websocket = r, e.websocket.onopen = function () {
|
4185
4179
|
var o, a;
|
4186
|
-
t.removeError(), e.websocket && _typeof(e.websocket) == "object" &&
|
4180
|
+
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && j.assignListeners(e, r, t), (a = (o = e.deepChat)._validationHandler) == null || a.call(o);
|
4187
4181
|
}, e.websocket.onerror = function (o) {
|
4188
|
-
console.error(o),
|
4182
|
+
console.error(o), j.retryConnection(e, t);
|
4189
4183
|
};
|
4190
4184
|
} catch (s) {
|
4191
|
-
console.error(s),
|
4185
|
+
console.error(s), j.retryConnection(e, t);
|
4192
4186
|
}
|
4193
4187
|
}
|
4194
4188
|
}
|
@@ -4196,8 +4190,8 @@ var U = /*#__PURE__*/function () {
|
|
4196
4190
|
key: "retryConnection",
|
4197
4191
|
value: function retryConnection(e, t) {
|
4198
4192
|
var i, s;
|
4199
|
-
(s = (i = e.deepChat)._validationHandler) == null || s.call(i),
|
4200
|
-
|
4193
|
+
(s = (i = e.deepChat)._validationHandler) == null || s.call(i), j.isElementPresentInDOM(e.deepChat) && (e.websocket = "pending", t.isLastMessageError() || t.addNewErrorMessage("service", "Connection error"), setTimeout(function () {
|
4194
|
+
j.createConnection(e, t);
|
4201
4195
|
}, 5e3));
|
4202
4196
|
}
|
4203
4197
|
}, {
|
@@ -4239,7 +4233,7 @@ var U = /*#__PURE__*/function () {
|
|
4239
4233
|
throw Error(M.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
4240
4234
|
case 14:
|
4241
4235
|
if (A.isSimulation(e.stream)) {
|
4242
|
-
h =
|
4236
|
+
h = j.stream.bind(_this6, e, i, s), u = s[l.role || b.AI_ROLE];
|
4243
4237
|
A.upsertWFiles(i, h, u, d);
|
4244
4238
|
} else i.addNewMessage(d);
|
4245
4239
|
_context9.next = 20;
|
@@ -4247,7 +4241,7 @@ var U = /*#__PURE__*/function () {
|
|
4247
4241
|
case 17:
|
4248
4242
|
_context9.prev = 17;
|
4249
4243
|
_context9.t1 = _context9["catch"](1);
|
4250
|
-
|
4244
|
+
E.displayError(i, _context9.t1, "Error in server message");
|
4251
4245
|
case 20:
|
4252
4246
|
case "end":
|
4253
4247
|
return _context9.stop();
|
@@ -4258,7 +4252,7 @@ var U = /*#__PURE__*/function () {
|
|
4258
4252
|
return _ref4.apply(this, arguments);
|
4259
4253
|
};
|
4260
4254
|
}(), t.onclose = function () {
|
4261
|
-
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(),
|
4255
|
+
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(), j.createConnection(e, i);
|
4262
4256
|
};
|
4263
4257
|
}
|
4264
4258
|
}, {
|
@@ -4270,7 +4264,7 @@ var U = /*#__PURE__*/function () {
|
|
4270
4264
|
h,
|
4271
4265
|
r,
|
4272
4266
|
o,
|
4273
|
-
_yield$
|
4267
|
+
_yield$E$processReque2,
|
4274
4268
|
a,
|
4275
4269
|
l,
|
4276
4270
|
c,
|
@@ -4291,29 +4285,29 @@ var U = /*#__PURE__*/function () {
|
|
4291
4285
|
headers: (d = e.connectSettings) == null ? void 0 : d.headers
|
4292
4286
|
};
|
4293
4287
|
_context10.next = 7;
|
4294
|
-
return
|
4288
|
+
return E.processRequestInterceptor(e.deepChat, o);
|
4295
4289
|
case 7:
|
4296
|
-
_yield$
|
4297
|
-
a = _yield$
|
4298
|
-
l = _yield$
|
4290
|
+
_yield$E$processReque2 = _context10.sent;
|
4291
|
+
a = _yield$E$processReque2.body;
|
4292
|
+
l = _yield$E$processReque2.error;
|
4299
4293
|
if (!l) {
|
4300
4294
|
_context10.next = 12;
|
4301
4295
|
break;
|
4302
4296
|
}
|
4303
4297
|
return _context10.abrupt("return", i.addNewErrorMessage("service", l));
|
4304
4298
|
case 12:
|
4305
|
-
if (
|
4299
|
+
if (j.isWebSocket(r)) {
|
4306
4300
|
_context10.next = 14;
|
4307
4301
|
break;
|
4308
4302
|
}
|
4309
4303
|
return _context10.abrupt("return", r.newUserMessage.listener(a));
|
4310
4304
|
case 14:
|
4311
4305
|
c = s ? JSON.stringify(a) : a;
|
4312
|
-
if (!(((h = e.connectSettings) == null ? void 0 : h.url) ===
|
4306
|
+
if (!(((h = e.connectSettings) == null ? void 0 : h.url) === ve.URL)) {
|
4313
4307
|
_context10.next = 17;
|
4314
4308
|
break;
|
4315
4309
|
}
|
4316
|
-
return _context10.abrupt("return",
|
4310
|
+
return _context10.abrupt("return", ve.request(e, i));
|
4317
4311
|
case 17:
|
4318
4312
|
r.readyState === void 0 || r.readyState !== r.OPEN ? (console.error("Connection is not open"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error")) : (r.send(JSON.stringify(c)), e.completionsHandlers.onFinish());
|
4319
4313
|
case 18:
|
@@ -4330,7 +4324,7 @@ var U = /*#__PURE__*/function () {
|
|
4330
4324
|
}, {
|
4331
4325
|
key: "canSendMessage",
|
4332
4326
|
value: function canSendMessage(e) {
|
4333
|
-
return e ? e === "pending" ? !1 :
|
4327
|
+
return e ? e === "pending" ? !1 : j.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
|
4334
4328
|
}
|
4335
4329
|
// if false then it is the internal websocket handler
|
4336
4330
|
}, {
|
@@ -4347,16 +4341,16 @@ var U = /*#__PURE__*/function () {
|
|
4347
4341
|
var _i$o;
|
4348
4342
|
var o = s.role || b.AI_ROLE,
|
4349
4343
|
a = i[o];
|
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
|
4344
|
+
s.text === r || s.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new be(t), i[o].upsertStreamedMessage(s));
|
4351
4345
|
} else A.simulate(t, e.streamHandlers, s);
|
4352
4346
|
}
|
4353
4347
|
}]);
|
4354
4348
|
}();
|
4355
|
-
var
|
4356
|
-
function
|
4357
|
-
_classCallCheck(this,
|
4349
|
+
var Te = /*#__PURE__*/function () {
|
4350
|
+
function Te() {
|
4351
|
+
_classCallCheck(this, Te);
|
4358
4352
|
}
|
4359
|
-
return _createClass(
|
4353
|
+
return _createClass(Te, null, [{
|
4360
4354
|
key: "request",
|
4361
4355
|
value: function () {
|
4362
4356
|
var _request2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, i) {
|
@@ -4389,7 +4383,7 @@ var Ae = /*#__PURE__*/function () {
|
|
4389
4383
|
_context11.t0 = c;
|
4390
4384
|
case 8:
|
4391
4385
|
d = _context11.t0;
|
4392
|
-
|
4386
|
+
E.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : A.isSimulatable(e.stream, d) ? A.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(M.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
|
4393
4387
|
case 10:
|
4394
4388
|
case "end":
|
4395
4389
|
return _context11.stop();
|
@@ -4399,7 +4393,7 @@ var Ae = /*#__PURE__*/function () {
|
|
4399
4393
|
return function r(_x24) {
|
4400
4394
|
return _ref5.apply(this, arguments);
|
4401
4395
|
};
|
4402
|
-
}(), o =
|
4396
|
+
}(), o = Te.generateOptionalSignals();
|
4403
4397
|
(l = (a = e.connectSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
|
4404
4398
|
onResponse: r
|
4405
4399
|
}));
|
@@ -4419,7 +4413,7 @@ var Ae = /*#__PURE__*/function () {
|
|
4419
4413
|
value: function attemptToFinaliseStream(e, t) {
|
4420
4414
|
try {
|
4421
4415
|
var i = t.messageElementRefs[t.messageElementRefs.length - 1];
|
4422
|
-
|
4416
|
+
De.isLoadingMessage(i) ? t.removeLastMessage() : e.finaliseStreamedMessage();
|
4423
4417
|
} catch (i) {
|
4424
4418
|
console.error(i), t.addNewErrorMessage("service", i);
|
4425
4419
|
}
|
@@ -4431,12 +4425,12 @@ var Ae = /*#__PURE__*/function () {
|
|
4431
4425
|
var h, u;
|
4432
4426
|
var s = !0,
|
4433
4427
|
r = !1;
|
4434
|
-
var o = new
|
4428
|
+
var o = new be(i),
|
4435
4429
|
a = function a() {
|
4436
4430
|
r || !s || (e.streamHandlers.onOpen(), r = !0);
|
4437
4431
|
},
|
4438
4432
|
l = function l() {
|
4439
|
-
s && (
|
4433
|
+
s && (Te.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1);
|
4440
4434
|
},
|
4441
4435
|
c = /*#__PURE__*/function () {
|
4442
4436
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(f) {
|
@@ -4461,7 +4455,7 @@ var Ae = /*#__PURE__*/function () {
|
|
4461
4455
|
_context13.t0 = f;
|
4462
4456
|
case 7:
|
4463
4457
|
m = _context13.t0;
|
4464
|
-
|
4458
|
+
E.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), s = !1) : A.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, m) : console.error(M.INVALID_RESPONSE(f, "server", !!e.deepChat.responseInterceptor, m));
|
4465
4459
|
case 9:
|
4466
4460
|
case "end":
|
4467
4461
|
return _context13.stop();
|
@@ -4473,9 +4467,9 @@ var Ae = /*#__PURE__*/function () {
|
|
4473
4467
|
};
|
4474
4468
|
}();
|
4475
4469
|
e.streamHandlers.abortStream.abort = function () {
|
4476
|
-
|
4470
|
+
Te.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1;
|
4477
4471
|
};
|
4478
|
-
var d =
|
4472
|
+
var d = Te.generateOptionalSignals();
|
4479
4473
|
(u = (h = e.connectSettings).handler) == null || u.call(h, t, _objectSpread(_objectSpread({}, d), {}, {
|
4480
4474
|
onOpen: a,
|
4481
4475
|
onResponse: c,
|
@@ -4526,8 +4520,8 @@ var Ae = /*#__PURE__*/function () {
|
|
4526
4520
|
_context14.t0 = d;
|
4527
4521
|
case 7:
|
4528
4522
|
h = _context14.t0;
|
4529
|
-
if (!
|
4530
|
-
m =
|
4523
|
+
if (!E.validateResponseFormat(h)) console.error(M.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message");else if (typeof h.error == "string") console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error);else if (A.isSimulation(e.stream)) {
|
4524
|
+
m = j.stream.bind(_this7, e, t, i.roleToStream), p = i.roleToStream[d.role || b.AI_ROLE];
|
4531
4525
|
A.upsertWFiles(t, m, p, d);
|
4532
4526
|
} else t.addNewMessage(h);
|
4533
4527
|
case 9:
|
@@ -4540,7 +4534,7 @@ var Ae = /*#__PURE__*/function () {
|
|
4540
4534
|
return _ref7.apply(this, arguments);
|
4541
4535
|
};
|
4542
4536
|
}(),
|
4543
|
-
a =
|
4537
|
+
a = Te.generateOptionalSignals();
|
4544
4538
|
(c = (l = e.connectSettings).handler) == null || c.call(l, void 0, _objectSpread(_objectSpread({}, a), {}, {
|
4545
4539
|
onOpen: s,
|
4546
4540
|
onResponse: o,
|
@@ -4578,7 +4572,7 @@ var T = /*#__PURE__*/function () {
|
|
4578
4572
|
f,
|
4579
4573
|
m,
|
4580
4574
|
r,
|
4581
|
-
_yield$
|
4575
|
+
_yield$E$processReque3,
|
4582
4576
|
o,
|
4583
4577
|
a,
|
4584
4578
|
l,
|
@@ -4595,40 +4589,40 @@ var T = /*#__PURE__*/function () {
|
|
4595
4589
|
headers: (u = e.connectSettings) == null ? void 0 : u.headers
|
4596
4590
|
};
|
4597
4591
|
_context16.next = 4;
|
4598
|
-
return
|
4592
|
+
return E.processRequestInterceptor(e.deepChat, r);
|
4599
4593
|
case 4:
|
4600
|
-
_yield$
|
4601
|
-
o = _yield$
|
4602
|
-
a = _yield$
|
4603
|
-
l = _yield$
|
4594
|
+
_yield$E$processReque3 = _context16.sent;
|
4595
|
+
o = _yield$E$processReque3.body;
|
4596
|
+
a = _yield$E$processReque3.headers;
|
4597
|
+
l = _yield$E$processReque3.error;
|
4604
4598
|
c = e.completionsHandlers.onFinish;
|
4605
4599
|
if (!l) {
|
4606
4600
|
_context16.next = 11;
|
4607
4601
|
break;
|
4608
4602
|
}
|
4609
|
-
return _context16.abrupt("return",
|
4603
|
+
return _context16.abrupt("return", E.onInterceptorError(i, l, c));
|
4610
4604
|
case 11:
|
4611
4605
|
if (!((f = e.connectSettings) != null && f.handler)) {
|
4612
4606
|
_context16.next = 13;
|
4613
4607
|
break;
|
4614
4608
|
}
|
4615
|
-
return _context16.abrupt("return",
|
4609
|
+
return _context16.abrupt("return", Te.request(e, o, i));
|
4616
4610
|
case 13:
|
4617
|
-
if (!(((m = e.connectSettings) == null ? void 0 : m.url) ===
|
4611
|
+
if (!(((m = e.connectSettings) == null ? void 0 : m.url) === ve.URL)) {
|
4618
4612
|
_context16.next = 15;
|
4619
4613
|
break;
|
4620
4614
|
}
|
4621
|
-
return _context16.abrupt("return",
|
4615
|
+
return _context16.abrupt("return", ve.request(e, i));
|
4622
4616
|
case 15:
|
4623
4617
|
d = !0;
|
4624
|
-
h =
|
4618
|
+
h = E.fetch.bind(this, e, a, s);
|
4625
4619
|
h(o).then(function (p) {
|
4626
4620
|
return d = !!p.ok, p;
|
4627
4621
|
}).then(function (p) {
|
4628
|
-
return
|
4622
|
+
return E.processResponseByType(p);
|
4629
4623
|
}).then(/*#__PURE__*/function () {
|
4630
4624
|
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(p) {
|
4631
|
-
var
|
4625
|
+
var P, G, v, y;
|
4632
4626
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
4633
4627
|
while (1) switch (_context15.prev = _context15.next) {
|
4634
4628
|
case 0:
|
@@ -4639,7 +4633,7 @@ var T = /*#__PURE__*/function () {
|
|
4639
4633
|
return _context15.abrupt("return");
|
4640
4634
|
case 2:
|
4641
4635
|
_context15.next = 4;
|
4642
|
-
return (G = (
|
4636
|
+
return (G = (P = e.deepChat).responseInterceptor) == null ? void 0 : G.call(P, p);
|
4643
4637
|
case 4:
|
4644
4638
|
_context15.t0 = _context15.sent;
|
4645
4639
|
if (_context15.t0) {
|
@@ -4652,20 +4646,20 @@ var T = /*#__PURE__*/function () {
|
|
4652
4646
|
_context15.next = 10;
|
4653
4647
|
return e.extractResultData(v, h, o);
|
4654
4648
|
case 10:
|
4655
|
-
|
4649
|
+
y = _context15.sent;
|
4656
4650
|
if (d) {
|
4657
4651
|
_context15.next = 13;
|
4658
4652
|
break;
|
4659
4653
|
}
|
4660
4654
|
throw p;
|
4661
4655
|
case 13:
|
4662
|
-
if (!(!
|
4656
|
+
if (!(!y || _typeof(y) != "object")) {
|
4663
4657
|
_context15.next = 15;
|
4664
4658
|
break;
|
4665
4659
|
}
|
4666
4660
|
throw Error(M.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, v));
|
4667
4661
|
case 15:
|
4668
|
-
|
4662
|
+
y.makingAnotherRequest || (A.isSimulatable(e.stream, y) ? A.simulate(i, e.streamHandlers, y) : (i.addNewMessage(y), c()));
|
4669
4663
|
case 16:
|
4670
4664
|
case "end":
|
4671
4665
|
return _context15.stop();
|
@@ -4676,7 +4670,7 @@ var T = /*#__PURE__*/function () {
|
|
4676
4670
|
return _ref8.apply(this, arguments);
|
4677
4671
|
};
|
4678
4672
|
}())["catch"](function (p) {
|
4679
|
-
|
4673
|
+
E.displayError(i, p), c();
|
4680
4674
|
});
|
4681
4675
|
case 18:
|
4682
4676
|
case "end":
|
@@ -4736,7 +4730,7 @@ var T = /*#__PURE__*/function () {
|
|
4736
4730
|
return _ref9.apply(this, arguments);
|
4737
4731
|
};
|
4738
4732
|
}())["catch"](function (o) {
|
4739
|
-
|
4733
|
+
E.displayError(s, o), r();
|
4740
4734
|
});
|
4741
4735
|
}
|
4742
4736
|
// prettier-ignore
|
@@ -4749,7 +4743,7 @@ var T = /*#__PURE__*/function () {
|
|
4749
4743
|
m,
|
4750
4744
|
p,
|
4751
4745
|
r,
|
4752
|
-
_yield$
|
4746
|
+
_yield$E$processReque4,
|
4753
4747
|
o,
|
4754
4748
|
a,
|
4755
4749
|
l,
|
@@ -4767,17 +4761,17 @@ var T = /*#__PURE__*/function () {
|
|
4767
4761
|
headers: (f = e.connectSettings) == null ? void 0 : f.headers
|
4768
4762
|
};
|
4769
4763
|
_context18.next = 4;
|
4770
|
-
return
|
4764
|
+
return E.processRequestInterceptor(e.deepChat, r);
|
4771
4765
|
case 4:
|
4772
|
-
_yield$
|
4773
|
-
o = _yield$
|
4774
|
-
a = _yield$
|
4775
|
-
l = _yield$
|
4766
|
+
_yield$E$processReque4 = _context18.sent;
|
4767
|
+
o = _yield$E$processReque4.body;
|
4768
|
+
a = _yield$E$processReque4.headers;
|
4769
|
+
l = _yield$E$processReque4.error;
|
4776
4770
|
if (!l) {
|
4777
4771
|
_context18.next = 10;
|
4778
4772
|
break;
|
4779
4773
|
}
|
4780
|
-
return _context18.abrupt("return",
|
4774
|
+
return _context18.abrupt("return", E.onInterceptorError(i, l));
|
4781
4775
|
case 10:
|
4782
4776
|
c = ((m = e.connectSettings) == null ? void 0 : m.url) || e.url || "", d = ((p = e.connectSettings) == null ? void 0 : p.method) || "POST", h = s ? JSON.stringify(o) : o, u = {
|
4783
4777
|
method: d,
|
@@ -4805,7 +4799,7 @@ var T = /*#__PURE__*/function () {
|
|
4805
4799
|
headers: i,
|
4806
4800
|
body: c || null
|
4807
4801
|
}).then(function (d) {
|
4808
|
-
return
|
4802
|
+
return E.processResponseByType(d);
|
4809
4803
|
}).then(function (d) {
|
4810
4804
|
l(d, e, r, o);
|
4811
4805
|
})["catch"](function (d) {
|
@@ -4828,7 +4822,7 @@ var pt = /*#__PURE__*/function () {
|
|
4828
4822
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
4829
4823
|
while (1) switch (_context19.prev = _context19.next) {
|
4830
4824
|
case 0:
|
4831
|
-
t =
|
4825
|
+
t = Ye.addMessage(this._messages);
|
4832
4826
|
_context19.next = 3;
|
4833
4827
|
return e();
|
4834
4828
|
case 3:
|
@@ -4897,7 +4891,7 @@ var pt = /*#__PURE__*/function () {
|
|
4897
4891
|
break;
|
4898
4892
|
}
|
4899
4893
|
_this10._isLoading = !0;
|
4900
|
-
t =
|
4894
|
+
t = Ye.addMessage(_this10._messages, !1);
|
4901
4895
|
_context20.prev = 3;
|
4902
4896
|
_context20.next = 6;
|
4903
4897
|
return e(_this10._index++);
|
@@ -4945,7 +4939,7 @@ var pt = /*#__PURE__*/function () {
|
|
4945
4939
|
while (1) switch (_context22.prev = _context22.next) {
|
4946
4940
|
case 0:
|
4947
4941
|
this._isLoading = !0;
|
4948
|
-
t =
|
4942
|
+
t = Ye.addMessage(this._messages);
|
4949
4943
|
_context22.prev = 2;
|
4950
4944
|
_context22.next = 5;
|
4951
4945
|
return e(this._index++);
|
@@ -5047,11 +5041,11 @@ var St = /*#__PURE__*/function () {
|
|
5047
5041
|
}
|
5048
5042
|
}]);
|
5049
5043
|
}();
|
5050
|
-
var
|
5051
|
-
function
|
5052
|
-
_classCallCheck(this,
|
5044
|
+
var O = /*#__PURE__*/function () {
|
5045
|
+
function O() {
|
5046
|
+
_classCallCheck(this, O);
|
5053
5047
|
}
|
5054
|
-
return _createClass(
|
5048
|
+
return _createClass(O, null, [{
|
5055
5049
|
key: "parseConfig",
|
5056
5050
|
value:
|
5057
5051
|
// prettier-ignore
|
@@ -5081,7 +5075,7 @@ var P = /*#__PURE__*/function () {
|
|
5081
5075
|
var s = {
|
5082
5076
|
acceptedFormats: ""
|
5083
5077
|
};
|
5084
|
-
e.fileTypes.mixedFiles =
|
5078
|
+
e.fileTypes.mixedFiles = O.parseConfig(e.connectSettings, s, t, i);
|
5085
5079
|
}
|
5086
5080
|
}
|
5087
5081
|
// needs to be set after audio to overwrite maxNumberOfFiles
|
@@ -5094,7 +5088,7 @@ var P = /*#__PURE__*/function () {
|
|
5094
5088
|
var o = _objectSpread({
|
5095
5089
|
acceptedFormats: "audio/*"
|
5096
5090
|
}, ((a = e.fileTypes.audio) == null ? void 0 : a.files) || {});
|
5097
|
-
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio =
|
5091
|
+
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = O.parseConfig(e.connectSettings, o, t, i), _typeof(i) == "object" && i.files && ((_l$files = (l = e.recordAudio).files) !== null && _l$files !== void 0 ? _l$files : l.files = {}, e.recordAudio.files.format = (c = i.files) == null ? void 0 : c.format, e.recordAudio.files.maxDurationSeconds = (d = i.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_u$maxNumberOfFiles = (u = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _u$maxNumberOfFiles !== void 0 ? _u$maxNumberOfFiles : u.maxNumberOfFiles = i.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = O.parseConfig(e.connectSettings, o, t, i)));
|
5098
5092
|
}
|
5099
5093
|
// prettier-ignore
|
5100
5094
|
}, {
|
@@ -5104,7 +5098,7 @@ var P = /*#__PURE__*/function () {
|
|
5104
5098
|
var o = _objectSpread({
|
5105
5099
|
acceptedFormats: "audio/*"
|
5106
5100
|
}, (s == null ? void 0 : s.files) || {});
|
5107
|
-
e.fileTypes.audio =
|
5101
|
+
e.fileTypes.audio = O.parseConfig(e.connectSettings, o, t, i);
|
5108
5102
|
}
|
5109
5103
|
// prettier-ignore
|
5110
5104
|
}, {
|
@@ -5114,7 +5108,7 @@ var P = /*#__PURE__*/function () {
|
|
5114
5108
|
var o = _objectSpread({
|
5115
5109
|
acceptedFormats: "image/gif"
|
5116
5110
|
}, (s == null ? void 0 : s.files) || {});
|
5117
|
-
e.fileTypes.gifs =
|
5111
|
+
e.fileTypes.gifs = O.parseConfig(e.connectSettings, o, t, i);
|
5118
5112
|
}
|
5119
5113
|
// needs to be set after images to overwrite maxNumberOfFiles
|
5120
5114
|
// prettier-ignore
|
@@ -5126,7 +5120,7 @@ var P = /*#__PURE__*/function () {
|
|
5126
5120
|
var o = _objectSpread({
|
5127
5121
|
acceptedFormats: "image/*"
|
5128
5122
|
}, ((a = e.fileTypes.images) == null ? void 0 : a.files) || {});
|
5129
|
-
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.camera =
|
5123
|
+
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.camera = O.parseConfig(e.connectSettings, o, t, i), _typeof(i) == "object" && (e.camera.modalContainerStyle = i.modalContainerStyle, i.files && ((_l$files2 = (l = e.camera).files) !== null && _l$files2 !== void 0 ? _l$files2 : l.files = {}, e.camera.files.format = (c = i.files) == null ? void 0 : c.format, e.camera.files.dimensions = (d = i.files) == null ? void 0 : d.dimensions))) : s || (e.fileTypes.images = O.parseConfig(e.connectSettings, o, t, i)));
|
5130
5124
|
}
|
5131
5125
|
// prettier-ignore
|
5132
5126
|
}, {
|
@@ -5136,7 +5130,7 @@ var P = /*#__PURE__*/function () {
|
|
5136
5130
|
var o = _objectSpread({
|
5137
5131
|
acceptedFormats: "image/*"
|
5138
5132
|
}, (s == null ? void 0 : s.files) || {});
|
5139
|
-
e.fileTypes.images =
|
5133
|
+
e.fileTypes.images = O.parseConfig(e.connectSettings, o, t, i);
|
5140
5134
|
}
|
5141
5135
|
// default for direct service
|
5142
5136
|
}, {
|
@@ -5149,20 +5143,20 @@ var P = /*#__PURE__*/function () {
|
|
5149
5143
|
}, {
|
5150
5144
|
key: "set",
|
5151
5145
|
value: function set(e, t, i) {
|
5152
|
-
|
5146
|
+
O.populateDefaultFileIO(i == null ? void 0 : i.audio, ".4a,.mp3,.webm,.mp4,.mpga,.wav,.mpeg,.m4a"), O.populateDefaultFileIO(i == null ? void 0 : i.images, ".png,.jpg");
|
5153
5147
|
var s = jt.createNew();
|
5154
|
-
|
5148
|
+
O.processImagesConfig(t, s, e.images, i == null ? void 0 : i.images), O.processCamera(t, s, e.camera, e.images), O.processGifConfig(t, s, e.gifs, i == null ? void 0 : i.gifs), O.processAudioConfig(t, s, e.audio, i == null ? void 0 : i.audio), O.processMicrophone(t, s, e.microphone, e.audio), O.processMixedFiles(t, s, e.mixedFiles);
|
5155
5149
|
}
|
5156
5150
|
}]);
|
5157
5151
|
}();
|
5158
|
-
var
|
5159
|
-
function
|
5152
|
+
var tt = /*#__PURE__*/function () {
|
5153
|
+
function tt(e, t, i) {
|
5160
5154
|
var _a$url;
|
5161
|
-
_classCallCheck(this,
|
5155
|
+
_classCallCheck(this, tt);
|
5162
5156
|
var s, r, o, a, l;
|
5163
|
-
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage =
|
5157
|
+
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = tt.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (s = e.connect) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (r = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : r.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, O.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = ve.URL), this.connectSettings.websocket && j.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || le.checkForStream(this.deepChat), e.loadHistory && Ht.addErrorPrefix(this);
|
5164
5158
|
}
|
5165
|
-
return _createClass(
|
5159
|
+
return _createClass(tt, [{
|
5166
5160
|
key: "verifyKey",
|
5167
5161
|
value: function verifyKey(e, t) {}
|
5168
5162
|
}, {
|
@@ -5235,7 +5229,7 @@ var it = /*#__PURE__*/function () {
|
|
5235
5229
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
5236
5230
|
while (1) switch (_context26.prev = _context26.next) {
|
5237
5231
|
case 0:
|
5238
|
-
s =
|
5232
|
+
s = tt.createCustomFormDataBody(this.rawBody, t, i), r = this.connectSettings, o = this.getServiceIOByType(i[0]);
|
5239
5233
|
this.connectSettings = (o == null ? void 0 : o.connect) || this.connectSettings;
|
5240
5234
|
_context26.next = 4;
|
5241
5235
|
return this.request(s, e, !1);
|
@@ -5294,7 +5288,7 @@ var it = /*#__PURE__*/function () {
|
|
5294
5288
|
s = _objectSpread({
|
5295
5289
|
messages: i
|
5296
5290
|
}, this.rawBody);
|
5297
|
-
|
5291
|
+
j.sendWebsocket(this, s, t, !1);
|
5298
5292
|
} else this.callServiceAPI(t, i, e.files);
|
5299
5293
|
case 4:
|
5300
5294
|
case "end":
|
@@ -5326,7 +5320,7 @@ var it = /*#__PURE__*/function () {
|
|
5326
5320
|
}
|
5327
5321
|
return _context29.abrupt("return", le.handleResponseProperty(e));
|
5328
5322
|
case 4:
|
5329
|
-
if (!
|
5323
|
+
if (!E.validateResponseFormat(e)) {
|
5330
5324
|
_context29.next = 6;
|
5331
5325
|
break;
|
5332
5326
|
}
|
@@ -5375,7 +5369,7 @@ var it = /*#__PURE__*/function () {
|
|
5375
5369
|
}
|
5376
5370
|
}]);
|
5377
5371
|
}();
|
5378
|
-
var z = /*#__PURE__*/function (
|
5372
|
+
var z = /*#__PURE__*/function (_tt) {
|
5379
5373
|
// prettier-ignore
|
5380
5374
|
function z(e, t, i, s, r) {
|
5381
5375
|
var _this13;
|
@@ -5384,7 +5378,7 @@ var z = /*#__PURE__*/function (_it) {
|
|
5384
5378
|
_this13 = _callSuper(this, z, [e, r]), _this13.insertKeyPlaceholderText = "API Key", _this13.keyHelpUrl = "", Object.assign(_this13.rawBody, (o = e.connect) == null ? void 0 : o.additionalBodyProps), _this13.keyVerificationDetails = t, _this13.buildHeadersFunc = i, s && _this13.setApiKeyProperties(s), _this13.connectSettings = _this13.buildConnectSettings(_this13.key || "", e.connect);
|
5385
5379
|
return _this13;
|
5386
5380
|
}
|
5387
|
-
_inherits(z,
|
5381
|
+
_inherits(z, _tt);
|
5388
5382
|
return _createClass(z, [{
|
5389
5383
|
key: "setApiKeyProperties",
|
5390
5384
|
value: function setApiKeyProperties(e) {
|
@@ -5421,7 +5415,7 @@ var z = /*#__PURE__*/function (_it) {
|
|
5421
5415
|
return !0;
|
5422
5416
|
}
|
5423
5417
|
}]);
|
5424
|
-
}(
|
5418
|
+
}(tt);
|
5425
5419
|
var ui = /*#__PURE__*/function () {
|
5426
5420
|
function ui() {
|
5427
5421
|
_classCallCheck(this, ui);
|
@@ -5440,19 +5434,19 @@ var ui = /*#__PURE__*/function () {
|
|
5440
5434
|
}
|
5441
5435
|
}]);
|
5442
5436
|
}();
|
5443
|
-
var
|
5437
|
+
var Se = /*#__PURE__*/function (_HTMLElement) {
|
5444
5438
|
// If this is not working, try using propertyName directly
|
5445
|
-
function
|
5439
|
+
function Se() {
|
5446
5440
|
var _this14;
|
5447
|
-
_classCallCheck(this,
|
5448
|
-
_this14 = _callSuper(this,
|
5449
|
-
var t =
|
5441
|
+
_classCallCheck(this, Se);
|
5442
|
+
_this14 = _callSuper(this, Se), _this14._waitingToRender_ = !1, _this14._propUpdated_ = !1, Object.keys(Se._attributeToProperty_).forEach(function (e) {
|
5443
|
+
var t = Se._attributeToProperty_[e];
|
5450
5444
|
_this14.constructPropertyAccessors(t), _this14.hasOwnProperty(e) || _this14.constructPropertyAccessors(t, e);
|
5451
5445
|
});
|
5452
5446
|
return _this14;
|
5453
5447
|
}
|
5454
|
-
_inherits(
|
5455
|
-
return _createClass(
|
5448
|
+
_inherits(Se, _HTMLElement);
|
5449
|
+
return _createClass(Se, [{
|
5456
5450
|
key: "constructPropertyAccessors",
|
5457
5451
|
value:
|
5458
5452
|
// need to be called here as accessors need to be set for the class instance
|
@@ -5471,8 +5465,8 @@ var we = /*#__PURE__*/function (_HTMLElement) {
|
|
5471
5465
|
key: "attributeChangedCallback",
|
5472
5466
|
value: function attributeChangedCallback(e, t, i) {
|
5473
5467
|
if (t === i) return;
|
5474
|
-
var s =
|
5475
|
-
r =
|
5468
|
+
var s = Se._attributes_[e](i),
|
5469
|
+
r = Se._attributeToProperty_[e];
|
5476
5470
|
this[r] = s;
|
5477
5471
|
}
|
5478
5472
|
}, {
|
@@ -5481,12 +5475,12 @@ var we = /*#__PURE__*/function (_HTMLElement) {
|
|
5481
5475
|
}], [{
|
5482
5476
|
key: "observedAttributes",
|
5483
5477
|
get: function get() {
|
5484
|
-
return Object.keys(
|
5478
|
+
return Object.keys(Se._attributes_) || [];
|
5485
5479
|
}
|
5486
5480
|
}]);
|
5487
5481
|
}(/*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
5488
|
-
|
5489
|
-
var ls =
|
5482
|
+
Se._attributes_ = {}, Se._attributeToProperty_ = {};
|
5483
|
+
var ls = Se;
|
5490
5484
|
var Co = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path d=\"\n\t\t\tM669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536\n\t\t\tc-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764\n\t\t\tc59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033\n\t\t\tl-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888\n\t\t\tc0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541\n\t\t\tc103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174\n\t\t\tc31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763\n\t\t\tc-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z\n\t\t\tM599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897\n\t\t\tc0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854\n\t\t\tc-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513\n\t\t\tL638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z\"\n\t\t\t/>\n</svg>\n",
|
5491
5485
|
Ao = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path id=\"path6686\" inkscape:connector-curvature=\"0\" d=\"M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612\n\t\t\tc-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612\n\t\t\tC699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.904,73.557\n\t\t\tc-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763\n\t\t\tc59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557\n\t\t\tc103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179\n\t\t\tc31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764\n\t\t\tc-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769\n\t\t\tc156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02\n\t\t\tC317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z\"/>\n</svg>\n";
|
5492
5486
|
var ie = /*#__PURE__*/function () {
|
@@ -5500,16 +5494,16 @@ var ie = /*#__PURE__*/function () {
|
|
5500
5494
|
}
|
5501
5495
|
}]);
|
5502
5496
|
}();
|
5503
|
-
var
|
5504
|
-
function
|
5505
|
-
_classCallCheck(this,
|
5497
|
+
var Pe = /*#__PURE__*/function () {
|
5498
|
+
function Pe() {
|
5499
|
+
_classCallCheck(this, Pe);
|
5506
5500
|
}
|
5507
|
-
return _createClass(
|
5501
|
+
return _createClass(Pe, null, [{
|
5508
5502
|
key: "changeVisibility",
|
5509
5503
|
value:
|
5510
5504
|
// prettier-ignore
|
5511
5505
|
function changeVisibility(e, t, i, s) {
|
5512
|
-
s.target.id ===
|
5506
|
+
s.target.id === Pe.VISIBLE_ICON_ID ? (t.style.display = "none", i.style.display = "block", e.type = "password") : (t.style.display = "block", i.style.display = "none", e.type = "text");
|
5513
5507
|
}
|
5514
5508
|
}, {
|
5515
5509
|
key: "createIconElement",
|
@@ -5523,15 +5517,15 @@ var Ne = /*#__PURE__*/function () {
|
|
5523
5517
|
value: function create(e) {
|
5524
5518
|
var t = document.createElement("div");
|
5525
5519
|
t.id = "visibility-icon-container";
|
5526
|
-
var i =
|
5520
|
+
var i = Pe.createIconElement(Ao, Pe.VISIBLE_ICON_ID);
|
5527
5521
|
i.style.display = "none", t.appendChild(i);
|
5528
|
-
var s =
|
5529
|
-
return t.appendChild(s), t.onclick =
|
5522
|
+
var s = Pe.createIconElement(Co, "not-visible-icon");
|
5523
|
+
return t.appendChild(s), t.onclick = Pe.changeVisibility.bind(this, e, i, s), t;
|
5530
5524
|
}
|
5531
5525
|
}]);
|
5532
5526
|
}();
|
5533
|
-
|
5534
|
-
var cs =
|
5527
|
+
Pe.VISIBLE_ICON_ID = "visible-icon";
|
5528
|
+
var cs = Pe;
|
5535
5529
|
var H = /*#__PURE__*/function () {
|
5536
5530
|
function H() {
|
5537
5531
|
_classCallCheck(this, H);
|
@@ -5604,7 +5598,7 @@ var H = /*#__PURE__*/function () {
|
|
5604
5598
|
},
|
5605
5599
|
a = H.verifyKey.bind(this, e, o, r);
|
5606
5600
|
t.onclick = a, e.onkeydown = function (l) {
|
5607
|
-
!e.classList.contains("loading") && l.key ===
|
5601
|
+
!e.classList.contains("loading") && l.key === N.ENTER && a();
|
5608
5602
|
};
|
5609
5603
|
}
|
5610
5604
|
}, {
|
@@ -5851,7 +5845,7 @@ var Ks = {
|
|
5851
5845
|
}],
|
5852
5846
|
use_web_worker: !0
|
5853
5847
|
},
|
5854
|
-
w = /*#__PURE__*/function (
|
5848
|
+
w = /*#__PURE__*/function (_tt2) {
|
5855
5849
|
function w(e) {
|
5856
5850
|
var _this15;
|
5857
5851
|
_classCallCheck(this, w);
|
@@ -5860,7 +5854,7 @@ var Ks = {
|
|
5860
5854
|
return _this15;
|
5861
5855
|
}
|
5862
5856
|
// need ref of messages object as web model exhibits unique behaviour to manipulate chat
|
5863
|
-
_inherits(w,
|
5857
|
+
_inherits(w, _tt2);
|
5864
5858
|
return _createClass(w, [{
|
5865
5859
|
key: "setUpMessages",
|
5866
5860
|
value: function setUpMessages(e) {
|
@@ -6140,7 +6134,7 @@ var Ks = {
|
|
6140
6134
|
this.streamHandlers.abortStream.abort = function () {
|
6141
6135
|
i.interruptGenerate();
|
6142
6136
|
}, this.streamHandlers.onOpen();
|
6143
|
-
s = new
|
6137
|
+
s = new be(e);
|
6144
6138
|
_context36.next = 4;
|
6145
6139
|
return i.generate(t, /*#__PURE__*/function () {
|
6146
6140
|
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(r, o) {
|
@@ -6225,30 +6219,30 @@ var Ks = {
|
|
6225
6219
|
key: "generateResp",
|
6226
6220
|
value: function () {
|
6227
6221
|
var _generateResp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t, i) {
|
6228
|
-
var s, _yield$
|
6222
|
+
var s, _yield$E$processReque5, r, o, a, l, c;
|
6229
6223
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
6230
6224
|
while (1) switch (_context38.prev = _context38.next) {
|
6231
6225
|
case 0:
|
6232
6226
|
s = t[t.length - 1].text;
|
6233
6227
|
_context38.next = 3;
|
6234
|
-
return
|
6228
|
+
return E.processRequestInterceptor(this.deepChat, {
|
6235
6229
|
body: {
|
6236
6230
|
text: s
|
6237
6231
|
}
|
6238
6232
|
});
|
6239
6233
|
case 3:
|
6240
|
-
_yield$
|
6241
|
-
r = _yield$
|
6242
|
-
o = _yield$
|
6234
|
+
_yield$E$processReque5 = _context38.sent;
|
6235
|
+
r = _yield$E$processReque5.body;
|
6236
|
+
o = _yield$E$processReque5.error;
|
6243
6237
|
a = !!this.stream;
|
6244
6238
|
try {
|
6245
|
-
if (o)
|
6239
|
+
if (o) E.displayError(e, new Error(o)), (a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish)();else if (!r || !r.text) {
|
6246
6240
|
l = M.INVALID_MODEL_REQUEST({
|
6247
6241
|
body: r
|
6248
6242
|
}, !1);
|
6249
6243
|
console.error(l);
|
6250
6244
|
c = a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish;
|
6251
|
-
|
6245
|
+
E.onInterceptorError(e, l, c);
|
6252
6246
|
} else this.generateRespByType(e, r.text, !!this.stream, i);
|
6253
6247
|
} catch (l) {
|
6254
6248
|
this.unloadChat(l);
|
@@ -6343,7 +6337,7 @@ var Ks = {
|
|
6343
6337
|
_context40.next = 11;
|
6344
6338
|
break;
|
6345
6339
|
}
|
6346
|
-
|
6340
|
+
E.displayError(t, new Error(s.error));
|
6347
6341
|
return _context40.abrupt("return");
|
6348
6342
|
case 11:
|
6349
6343
|
if (!(!s || !s.text)) {
|
@@ -6351,7 +6345,7 @@ var Ks = {
|
|
6351
6345
|
break;
|
6352
6346
|
}
|
6353
6347
|
o = M.INVALID_MODEL_RESPONSE(i, !!e.responseInterceptor, s);
|
6354
|
-
|
6348
|
+
E.displayError(t, new Error(o));
|
6355
6349
|
return _context40.abrupt("return");
|
6356
6350
|
case 15:
|
6357
6351
|
return _context40.abrupt("return", s);
|
@@ -6383,7 +6377,7 @@ var Ks = {
|
|
6383
6377
|
});
|
6384
6378
|
}
|
6385
6379
|
}]);
|
6386
|
-
}(
|
6380
|
+
}(tt);
|
6387
6381
|
w.GENERIC_ERROR = "Error, please check the [troubleshooting](https://deepchat.dev/docs/webModel#troubleshooting) section of documentation for help.", w.MULTIPLE_MODELS_ERROR = "Cannot run multiple web models", w.WEB_LLM_NOT_FOUND_ERROR = "WebLLM module not found", w.DEFAULT_MODEL = "Llama-2-7b-chat-hf-q4f32_1", w.MODULE_SEARCH_LIMIT_S = 5;
|
6388
6382
|
var qt = w;
|
6389
6383
|
var pi = /*#__PURE__*/function () {
|
@@ -6467,8 +6461,8 @@ var Nt = /*#__PURE__*/function (_z) {
|
|
6467
6461
|
}]);
|
6468
6462
|
}(z);
|
6469
6463
|
Nt.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
6470
|
-
var
|
6471
|
-
var Jt = /*#__PURE__*/function (
|
6464
|
+
var Re = Nt;
|
6465
|
+
var Jt = /*#__PURE__*/function (_Re) {
|
6472
6466
|
// prettier-ignore
|
6473
6467
|
function Jt(e, t, i, s, r, o) {
|
6474
6468
|
var _this22;
|
@@ -6476,7 +6470,7 @@ var Jt = /*#__PURE__*/function (_Le) {
|
|
6476
6470
|
_this22 = _callSuper(this, Jt, [e, t, i, s, r, o]), _this22.isTextInputDisabled = !0, _this22.canSendMessage = Jt.canSendFile;
|
6477
6471
|
return _this22;
|
6478
6472
|
}
|
6479
|
-
_inherits(Jt,
|
6473
|
+
_inherits(Jt, _Re);
|
6480
6474
|
return _createClass(Jt, [{
|
6481
6475
|
key: "preprocessBody",
|
6482
6476
|
value: function preprocessBody(e, t, i) {
|
@@ -6520,7 +6514,7 @@ var Jt = /*#__PURE__*/function (_Le) {
|
|
6520
6514
|
return !!(t != null && t[0]);
|
6521
6515
|
}
|
6522
6516
|
}]);
|
6523
|
-
}(
|
6517
|
+
}(Re);
|
6524
6518
|
var ko = /*#__PURE__*/function (_Jt) {
|
6525
6519
|
// prettier-ignore
|
6526
6520
|
function ko(e) {
|
@@ -6621,11 +6615,11 @@ var Mo = /*#__PURE__*/function (_Jt2) {
|
|
6621
6615
|
}]);
|
6622
6616
|
}(Jt);
|
6623
6617
|
var Zt = "data:image/png;base64,";
|
6624
|
-
var
|
6625
|
-
function
|
6626
|
-
_classCallCheck(this,
|
6618
|
+
var ye = /*#__PURE__*/function () {
|
6619
|
+
function ye() {
|
6620
|
+
_classCallCheck(this, ye);
|
6627
6621
|
}
|
6628
|
-
return _createClass(
|
6622
|
+
return _createClass(ye, null, [{
|
6629
6623
|
key: "buildHeaders",
|
6630
6624
|
value: function buildHeaders(e) {
|
6631
6625
|
return {
|
@@ -6645,7 +6639,7 @@ var Ee = /*#__PURE__*/function () {
|
|
6645
6639
|
return {
|
6646
6640
|
url: "https://api.stability.ai/v1/engines/list",
|
6647
6641
|
method: "GET",
|
6648
|
-
handleVerificationResult:
|
6642
|
+
handleVerificationResult: ye.handleVerificationResult
|
6649
6643
|
};
|
6650
6644
|
}
|
6651
6645
|
}]);
|
@@ -6676,7 +6670,7 @@ var mi = /*#__PURE__*/function (_Oi) {
|
|
6676
6670
|
}
|
6677
6671
|
}
|
6678
6672
|
};
|
6679
|
-
_this24 = _callSuper(this, mi, [e,
|
6673
|
+
_this24 = _callSuper(this, mi, [e, ye.buildKeyVerificationDetails(), ye.buildHeaders, i, s]), _this24.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this24.textInputPlaceholderText = "Describe image changes", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Upscale</b></div>\n <p>Upload an image to generate a new one with higher resolution.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6680
6674
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
6681
6675
|
_typeof(r) == "object" && (r.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), mi.cleanConfig(r), Object.assign(_this24.rawBody, r)), _this24.canSendMessage = mi.canSendFileMessage;
|
6682
6676
|
return _this24;
|
@@ -6712,7 +6706,7 @@ var mi = /*#__PURE__*/function (_Oi) {
|
|
6712
6706
|
throw new Error("Image was not found");
|
6713
6707
|
case 4:
|
6714
6708
|
s = this.createFormDataBody(this.rawBody, i[0]);
|
6715
|
-
|
6709
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
6716
6710
|
case 6:
|
6717
6711
|
case "end":
|
6718
6712
|
return _context45.stop();
|
@@ -6783,7 +6777,7 @@ var gi = /*#__PURE__*/function (_Oi2) {
|
|
6783
6777
|
}
|
6784
6778
|
}
|
6785
6779
|
};
|
6786
|
-
_this25 = _callSuper(this, gi, [e,
|
6780
|
+
_this25 = _callSuper(this, gi, [e, ye.buildKeyVerificationDetails(), ye.buildHeaders, i, s]), _this25.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this25._maskSource = "MASK_IMAGE_WHITE", _this25.textInputPlaceholderText = "Describe image changes", _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Masking</b></div>\n <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6787
6781
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
6788
6782
|
_typeof(r) == "object" && (r.engine_id && (_this25.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this25._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this25._maskSource = r.mask_source), gi.cleanConfig(r), Object.assign(_this25.rawBody, r)), _this25.canSendMessage = gi.canSendFileTextMessage;
|
6789
6783
|
return _this25;
|
@@ -6819,7 +6813,7 @@ var gi = /*#__PURE__*/function (_Oi2) {
|
|
6819
6813
|
throw new Error("Image was not found");
|
6820
6814
|
case 4:
|
6821
6815
|
s = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], i[1], s);
|
6822
|
-
|
6816
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
6823
6817
|
case 6:
|
6824
6818
|
case "end":
|
6825
6819
|
return _context47.stop();
|
@@ -6923,7 +6917,7 @@ var Ro = /*#__PURE__*/function (_Jt3) {
|
|
6923
6917
|
}()
|
6924
6918
|
}]);
|
6925
6919
|
}(Jt);
|
6926
|
-
var Io = /*#__PURE__*/function (
|
6920
|
+
var Io = /*#__PURE__*/function (_Re2) {
|
6927
6921
|
function Io(e) {
|
6928
6922
|
_classCallCheck(this, Io);
|
6929
6923
|
var s, r, o;
|
@@ -6931,7 +6925,7 @@ var Io = /*#__PURE__*/function (_Le2) {
|
|
6931
6925
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6932
6926
|
return _callSuper(this, Io, [e, "Once upon a time", "gpt2", t, i]);
|
6933
6927
|
}
|
6934
|
-
_inherits(Io,
|
6928
|
+
_inherits(Io, _Re2);
|
6935
6929
|
return _createClass(Io, [{
|
6936
6930
|
key: "extractResultData",
|
6937
6931
|
value: function () {
|
@@ -6961,8 +6955,8 @@ var Io = /*#__PURE__*/function (_Le2) {
|
|
6961
6955
|
return extractResultData;
|
6962
6956
|
}()
|
6963
6957
|
}]);
|
6964
|
-
}(
|
6965
|
-
var Lo = /*#__PURE__*/function (
|
6958
|
+
}(Re);
|
6959
|
+
var Lo = /*#__PURE__*/function (_Re3) {
|
6966
6960
|
function Lo(e) {
|
6967
6961
|
var _this26;
|
6968
6962
|
_classCallCheck(this, Lo);
|
@@ -6972,7 +6966,7 @@ var Lo = /*#__PURE__*/function (_Le3) {
|
|
6972
6966
|
_this26 = _callSuper(this, Lo, [e, "Ask a question", "bert-large-uncased-whole-word-masking-finetuned-squad", t, i]), _this26.permittedErrorPrefixes = ["Authorization header", "Error in"], _this26.context = t.context;
|
6973
6967
|
return _this26;
|
6974
6968
|
}
|
6975
|
-
_inherits(Lo,
|
6969
|
+
_inherits(Lo, _Re3);
|
6976
6970
|
return _createClass(Lo, [{
|
6977
6971
|
key: "preprocessBody",
|
6978
6972
|
value: function preprocessBody(e, t) {
|
@@ -7015,8 +7009,8 @@ var Lo = /*#__PURE__*/function (_Le3) {
|
|
7015
7009
|
return extractResultData;
|
7016
7010
|
}()
|
7017
7011
|
}]);
|
7018
|
-
}(
|
7019
|
-
var Po = /*#__PURE__*/function (
|
7012
|
+
}(Re);
|
7013
|
+
var Po = /*#__PURE__*/function (_Re4) {
|
7020
7014
|
function Po(e) {
|
7021
7015
|
_classCallCheck(this, Po);
|
7022
7016
|
var s, r, o;
|
@@ -7024,7 +7018,7 @@ var Po = /*#__PURE__*/function (_Le4) {
|
|
7024
7018
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7025
7019
|
return _callSuper(this, Po, [e, "Insert text to summarize", "facebook/bart-large-cnn", t, i]);
|
7026
7020
|
}
|
7027
|
-
_inherits(Po,
|
7021
|
+
_inherits(Po, _Re4);
|
7028
7022
|
return _createClass(Po, [{
|
7029
7023
|
key: "extractResultData",
|
7030
7024
|
value: function () {
|
@@ -7054,8 +7048,8 @@ var Po = /*#__PURE__*/function (_Le4) {
|
|
7054
7048
|
return extractResultData;
|
7055
7049
|
}()
|
7056
7050
|
}]);
|
7057
|
-
}(
|
7058
|
-
var Oo = /*#__PURE__*/function (
|
7051
|
+
}(Re);
|
7052
|
+
var Oo = /*#__PURE__*/function (_Re5) {
|
7059
7053
|
function Oo(e) {
|
7060
7054
|
var _this27$maxMessages;
|
7061
7055
|
var _this27;
|
@@ -7067,7 +7061,7 @@ var Oo = /*#__PURE__*/function (_Le5) {
|
|
7067
7061
|
return _this27;
|
7068
7062
|
}
|
7069
7063
|
// prettier-ignore
|
7070
|
-
_inherits(Oo,
|
7064
|
+
_inherits(Oo, _Re5);
|
7071
7065
|
return _createClass(Oo, [{
|
7072
7066
|
key: "processMessages",
|
7073
7067
|
value: function processMessages(e) {
|
@@ -7136,7 +7130,7 @@ var Oo = /*#__PURE__*/function (_Le5) {
|
|
7136
7130
|
return extractResultData;
|
7137
7131
|
}()
|
7138
7132
|
}]);
|
7139
|
-
}(
|
7133
|
+
}(Re);
|
7140
7134
|
var bi = /*#__PURE__*/function (_Oi3) {
|
7141
7135
|
function bi(e) {
|
7142
7136
|
var _this28;
|
@@ -7152,7 +7146,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
|
|
7152
7146
|
}
|
7153
7147
|
}
|
7154
7148
|
};
|
7155
|
-
_this28 = _callSuper(this, bi, [e,
|
7149
|
+
_this28 = _callSuper(this, bi, [e, ye.buildKeyVerificationDetails(), ye.buildHeaders, i, s]), _this28.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this28.textInputPlaceholderText = "Describe image changes", _this28.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Image to Image</b></div>\n <p>Upload an image to create a new one with the changes you have described.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
7156
7150
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
7157
7151
|
_typeof(r) == "object" && (r.engine_id && (_this28.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this28._imageWeight = r.weight), bi.cleanConfig(r), Object.assign(_this28.rawBody, r)), _this28.canSendMessage = bi.canSendFileTextMessage;
|
7158
7152
|
return _this28;
|
@@ -7188,7 +7182,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
|
|
7188
7182
|
throw new Error("Image was not found");
|
7189
7183
|
case 4:
|
7190
7184
|
s = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], s);
|
7191
|
-
|
7185
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
7192
7186
|
case 6:
|
7193
7187
|
case "end":
|
7194
7188
|
return _context54.stop();
|
@@ -7244,7 +7238,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
|
|
7244
7238
|
}
|
7245
7239
|
}]);
|
7246
7240
|
}(Oi);
|
7247
|
-
var No = /*#__PURE__*/function (
|
7241
|
+
var No = /*#__PURE__*/function (_Re6) {
|
7248
7242
|
function No(e) {
|
7249
7243
|
_classCallCheck(this, No);
|
7250
7244
|
var s, r, o;
|
@@ -7252,7 +7246,7 @@ var No = /*#__PURE__*/function (_Le6) {
|
|
7252
7246
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7253
7247
|
return _callSuper(this, No, [e, "Insert text to translate", "Helsinki-NLP/opus-tatoeba-en-ja", t, i]);
|
7254
7248
|
}
|
7255
|
-
_inherits(No,
|
7249
|
+
_inherits(No, _Re6);
|
7256
7250
|
return _createClass(No, [{
|
7257
7251
|
key: "extractResultData",
|
7258
7252
|
value: function () {
|
@@ -7282,7 +7276,7 @@ var No = /*#__PURE__*/function (_Le6) {
|
|
7282
7276
|
return extractResultData;
|
7283
7277
|
}()
|
7284
7278
|
}]);
|
7285
|
-
}(
|
7279
|
+
}(Re);
|
7286
7280
|
var vi = /*#__PURE__*/function (_Oi4) {
|
7287
7281
|
function vi(e) {
|
7288
7282
|
var _this29;
|
@@ -7290,7 +7284,7 @@ var vi = /*#__PURE__*/function (_Oi4) {
|
|
7290
7284
|
var r;
|
7291
7285
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7292
7286
|
i = t.stabilityAI;
|
7293
|
-
_this29 = _callSuper(this, vi, [e,
|
7287
|
+
_this29 = _callSuper(this, vi, [e, ye.buildKeyVerificationDetails(), ye.buildHeaders, i]), _this29.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this29.textInputPlaceholderText = "Describe an image", _this29.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Text to Image</b></div>\n <p>Insert text to generate an image.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
7294
7288
|
var s = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
7295
7289
|
_typeof(s) == "object" && (s.engine_id && (_this29.url = "https://api.stability.ai/v1/generation/".concat(s.engine_id, "/text-to-image")), s.weight !== void 0 && s.weight !== null && (_this29._imageWeight = s.weight), vi.cleanConfig(s), Object.assign(_this29.rawBody, s)), _this29.canSendMessage = vi.canSendTextMessage;
|
7296
7290
|
return _this29;
|
@@ -7376,7 +7370,7 @@ var vi = /*#__PURE__*/function (_Oi4) {
|
|
7376
7370
|
}
|
7377
7371
|
}]);
|
7378
7372
|
}(Oi);
|
7379
|
-
var Do = /*#__PURE__*/function (
|
7373
|
+
var Do = /*#__PURE__*/function (_Re7) {
|
7380
7374
|
function Do(e) {
|
7381
7375
|
var _this30;
|
7382
7376
|
_classCallCheck(this, Do);
|
@@ -7386,7 +7380,7 @@ var Do = /*#__PURE__*/function (_Le7) {
|
|
7386
7380
|
_this30 = _callSuper(this, Do, [e, "The goal of life is [MASK].", "bert-base-uncased", t, i]), _this30.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>Insert a sentence with the word [MASK] and the model will try to fill it for you. E.g. I want [MASK].</p>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this30.permittedErrorPrefixes = ["Authorization header", "No mask_token"];
|
7387
7381
|
return _this30;
|
7388
7382
|
}
|
7389
|
-
_inherits(Do,
|
7383
|
+
_inherits(Do, _Re7);
|
7390
7384
|
return _createClass(Do, [{
|
7391
7385
|
key: "extractResultData",
|
7392
7386
|
value: function () {
|
@@ -7416,7 +7410,7 @@ var Do = /*#__PURE__*/function (_Le7) {
|
|
7416
7410
|
return extractResultData;
|
7417
7411
|
}()
|
7418
7412
|
}]);
|
7419
|
-
}(
|
7413
|
+
}(Re);
|
7420
7414
|
var L = /*#__PURE__*/function () {
|
7421
7415
|
function L() {
|
7422
7416
|
_classCallCheck(this, L);
|
@@ -7459,8 +7453,8 @@ var L = /*#__PURE__*/function () {
|
|
7459
7453
|
s = _args60.length > 3 && _args60[3] !== undefined ? _args60[3] : !0;
|
7460
7454
|
e.connectSettings.method = i;
|
7461
7455
|
_context60.next = 4;
|
7462
|
-
return
|
7463
|
-
return
|
7456
|
+
return E.fetch(e, e.connectSettings.headers, s, t).then(function (o) {
|
7457
|
+
return E.processResponseByType(o);
|
7464
7458
|
});
|
7465
7459
|
case 4:
|
7466
7460
|
r = _context60.sent;
|
@@ -7504,8 +7498,8 @@ var ee = /*#__PURE__*/function () {
|
|
7504
7498
|
return _context62.abrupt("return");
|
7505
7499
|
case 3:
|
7506
7500
|
e.url = s;
|
7507
|
-
o = r[
|
7508
|
-
delete r[
|
7501
|
+
o = r[E.CONTENT_TYPE];
|
7502
|
+
delete r[E.CONTENT_TYPE];
|
7509
7503
|
a = i.map(/*#__PURE__*/function () {
|
7510
7504
|
var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(l) {
|
7511
7505
|
var c;
|
@@ -7536,11 +7530,11 @@ var ee = /*#__PURE__*/function () {
|
|
7536
7530
|
name: c.filename
|
7537
7531
|
};
|
7538
7532
|
});
|
7539
|
-
return _context62.abrupt("return", (r[
|
7533
|
+
return _context62.abrupt("return", (r[E.CONTENT_TYPE] = o, l));
|
7540
7534
|
case 14:
|
7541
7535
|
_context62.prev = 14;
|
7542
7536
|
_context62.t0 = _context62["catch"](7);
|
7543
|
-
throw r[
|
7537
|
+
throw r[E.CONTENT_TYPE] = o, E.displayError(t, _context62.t0), e.completionsHandlers.onFinish(), _context62.t0;
|
7544
7538
|
case 17:
|
7545
7539
|
case "end":
|
7546
7540
|
return _context62.stop();
|
@@ -7798,13 +7792,13 @@ var ee = /*#__PURE__*/function () {
|
|
7798
7792
|
}]);
|
7799
7793
|
}();
|
7800
7794
|
ee.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", ee.FUNCTION_TOOL_RESP_ERROR = "Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.";
|
7801
|
-
var
|
7802
|
-
var
|
7795
|
+
var Ee = ee;
|
7796
|
+
var Oe = /*#__PURE__*/function (_z3) {
|
7803
7797
|
// prettier-ignore
|
7804
|
-
function
|
7798
|
+
function Oe(e, t, i, s, r, o) {
|
7805
7799
|
var _this31;
|
7806
|
-
_classCallCheck(this,
|
7807
|
-
if (_this31 = _callSuper(this,
|
7800
|
+
_classCallCheck(this, Oe);
|
7801
|
+
if (_this31 = _callSuper(this, Oe, [e, s, r, o]), _this31.insertKeyPlaceholderText = "OpenAI API Key", _this31.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this31.url = "", _this31.permittedErrorPrefixes = ["Incorrect", "Please send text", Ht.FAILED_ERROR_MESSAGE], _this31.shouldFetchHistory = !1, _this31.searchedForThreadId = !1, _this31.config = {}, _this31.newAssistantDetails = {
|
7808
7802
|
model: "gpt-4"
|
7809
7803
|
}, _this31.waitingForStreamResponse = !1, _this31.isSSEStream = !1, _this31.urlSegments = i, _typeof(t) == "object") {
|
7810
7804
|
_this31.config = t;
|
@@ -7812,13 +7806,13 @@ var De = /*#__PURE__*/function (_z3) {
|
|
7812
7806
|
a = _this31$config.new_assistant,
|
7813
7807
|
l = _this31$config.thread_id,
|
7814
7808
|
c = _this31$config.load_thread_history;
|
7815
|
-
Object.assign(_this31.newAssistantDetails, a), l && (_this31.sessionId = l), c && (_this31.shouldFetchHistory = !0)
|
7809
|
+
Object.assign(_this31.newAssistantDetails, a), l && (_this31.sessionId = l), c && (_this31.shouldFetchHistory = !0);
|
7816
7810
|
}
|
7817
7811
|
_this31.maxMessages = 1, _this31.isSSEStream = !!(_this31.stream && (_typeof(_this31.stream) != "object" || !_this31.stream.simulation));
|
7818
7812
|
return _assertThisInitialized(_this31);
|
7819
7813
|
}
|
7820
|
-
_inherits(
|
7821
|
-
return _createClass(
|
7814
|
+
_inherits(Oe, _z3);
|
7815
|
+
return _createClass(Oe, [{
|
7822
7816
|
key: "fetchHistoryFunc",
|
7823
7817
|
value: function () {
|
7824
7818
|
var _fetchHistoryFunc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee70() {
|
@@ -7867,13 +7861,13 @@ var De = /*#__PURE__*/function (_z3) {
|
|
7867
7861
|
}));
|
7868
7862
|
a === "code_interpreter" || a === "file_search" || a === "images" ? r = a : (console.error("Tool type \"".concat(a, "\" is not valid")), console.error('Expected "code_interpreter" or "file_search" or "images". Going to default to "images"'));
|
7869
7863
|
}
|
7870
|
-
if (r === "file_search") return
|
7871
|
-
if (r === "code_interpreter") return
|
7864
|
+
if (r === "file_search") return Oe.processAttachmentsMessage(s, t, "file_search");
|
7865
|
+
if (r === "code_interpreter") return Oe.processAttachmentsMessage(s, t, "code_interpreter");
|
7872
7866
|
if (t.find(function (_ref19) {
|
7873
7867
|
var a = _ref19.name;
|
7874
|
-
return !
|
7868
|
+
return !U.isImageFileExtension(a);
|
7875
7869
|
})) console.error("The uploaded files contained a non-image file"), console.error('Make sure only images can be uploaded or define a "code_interpreter" or "file_search" value in the "files_tool_type" property'), console.warn('Make sure your existing assistant supports these "tools" or specify them in the "new_assistant" property');else {
|
7876
|
-
var _a2 =
|
7870
|
+
var _a2 = Oe.processImageMessage(s, t);
|
7877
7871
|
if (_a2) return _a2;
|
7878
7872
|
}
|
7879
7873
|
}
|
@@ -7945,7 +7939,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
7945
7939
|
break;
|
7946
7940
|
}
|
7947
7941
|
_context71.next = 16;
|
7948
|
-
return
|
7942
|
+
return Ee.storeFiles(this, e, i, this.urlSegments.storeFiles);
|
7949
7943
|
case 16:
|
7950
7944
|
_context71.t1 = _context71.sent;
|
7951
7945
|
_context71.next = 20;
|
@@ -8028,7 +8022,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8028
8022
|
_context73.next = 6;
|
8029
8023
|
break;
|
8030
8024
|
}
|
8031
|
-
throw e.error.message.startsWith(
|
8025
|
+
throw e.error.message.startsWith(Ee.FILES_WITH_TEXT_ERROR) ? Error("Please send text with your file(s)") : e.error.message;
|
8032
8026
|
case 6:
|
8033
8027
|
_context73.next = 8;
|
8034
8028
|
return this.assignThreadAndRun(e);
|
@@ -8112,7 +8106,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8112
8106
|
case 9:
|
8113
8107
|
i = _context75.sent;
|
8114
8108
|
case 10:
|
8115
|
-
return _context75.abrupt("return",
|
8109
|
+
return _context75.abrupt("return", Ee.processAPIMessages(this, i, t, this.urlSegments));
|
8116
8110
|
case 11:
|
8117
8111
|
case "end":
|
8118
8112
|
return _context75.stop();
|
@@ -8139,7 +8133,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8139
8133
|
break;
|
8140
8134
|
}
|
8141
8135
|
return _context76.abrupt("return", {
|
8142
|
-
timeoutMS:
|
8136
|
+
timeoutMS: Oe.POLLING_TIMEOUT_MS
|
8143
8137
|
});
|
8144
8138
|
case 3:
|
8145
8139
|
if (!(t === "completed" && this.messages)) {
|
@@ -8193,7 +8187,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8193
8187
|
return _regeneratorRuntime().wrap(function _callee77$(_context77) {
|
8194
8188
|
while (1) switch (_context77.prev = _context77.next) {
|
8195
8189
|
case 0:
|
8196
|
-
if (this.
|
8190
|
+
if (this.functionHandler) {
|
8197
8191
|
_context77.next = 2;
|
8198
8192
|
break;
|
8199
8193
|
}
|
@@ -8206,14 +8200,14 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8206
8200
|
};
|
8207
8201
|
});
|
8208
8202
|
_context77.next = 5;
|
8209
|
-
return this.
|
8203
|
+
return this.functionHandler(t);
|
8210
8204
|
case 5:
|
8211
8205
|
i = _context77.sent;
|
8212
8206
|
if (!(!Array.isArray(i) || e.length !== i.length)) {
|
8213
8207
|
_context77.next = 8;
|
8214
8208
|
break;
|
8215
8209
|
}
|
8216
|
-
throw Error(
|
8210
|
+
throw Error(Ee.FUNCTION_TOOL_RESP_ERROR);
|
8217
8211
|
case 8:
|
8218
8212
|
_context77.next = 10;
|
8219
8213
|
return Promise.all(i);
|
@@ -8225,7 +8219,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8225
8219
|
_context77.next = 13;
|
8226
8220
|
break;
|
8227
8221
|
}
|
8228
|
-
throw Error(
|
8222
|
+
throw Error(Ee.FUNCTION_TOOL_RESP_ERROR);
|
8229
8223
|
case 13:
|
8230
8224
|
r = s.map(function (l, c) {
|
8231
8225
|
return {
|
@@ -8252,7 +8246,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8252
8246
|
}, "POST");
|
8253
8247
|
case 22:
|
8254
8248
|
return _context77.abrupt("return", {
|
8255
|
-
timeoutMS:
|
8249
|
+
timeoutMS: Oe.POLLING_TIMEOUT_MS
|
8256
8250
|
});
|
8257
8251
|
case 23:
|
8258
8252
|
case "end":
|
@@ -8330,7 +8324,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8330
8324
|
}
|
8331
8325
|
l = e.content.find(function (d) {
|
8332
8326
|
return !!d.text;
|
8333
|
-
}) || e.content[0], c =
|
8327
|
+
}) || e.content[0], c = Ee.getFilesAndText.bind(this, this, {
|
8334
8328
|
role: "assistant",
|
8335
8329
|
content: e.content
|
8336
8330
|
}, this.urlSegments, l);
|
@@ -8354,7 +8348,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8354
8348
|
break;
|
8355
8349
|
}
|
8356
8350
|
_context79.next = 11;
|
8357
|
-
return
|
8351
|
+
return Ee.processStreamMessages(this, e.delta.content, this.urlSegments);
|
8358
8352
|
case 11:
|
8359
8353
|
_l = _context79.sent;
|
8360
8354
|
return _context79.abrupt("return", {
|
@@ -8409,7 +8403,7 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8409
8403
|
key: "processImageMessage",
|
8410
8404
|
value: function processImageMessage(e, t) {
|
8411
8405
|
var i = t == null ? void 0 : t.filter(function (s) {
|
8412
|
-
return
|
8406
|
+
return U.isImageFileExtension(s.name);
|
8413
8407
|
}).map(function (s) {
|
8414
8408
|
return {
|
8415
8409
|
type: "image_file",
|
@@ -8447,8 +8441,8 @@ var De = /*#__PURE__*/function (_z3) {
|
|
8447
8441
|
}
|
8448
8442
|
}]);
|
8449
8443
|
}(z);
|
8450
|
-
|
8451
|
-
var yi =
|
8444
|
+
Oe.POLLING_TIMEOUT_MS = 800;
|
8445
|
+
var yi = Oe;
|
8452
8446
|
var Ii = /*#__PURE__*/function (_yi) {
|
8453
8447
|
function Ii(e) {
|
8454
8448
|
var _o$headers2, _a$OpenAIBeta;
|
@@ -8460,8 +8454,9 @@ var Ii = /*#__PURE__*/function (_yi) {
|
|
8460
8454
|
s = (r = t.openAI) == null ? void 0 : r.assistant;
|
8461
8455
|
if (_this34 = _callSuper(this, Ii, [e, s, Ii.URL_SEGMENTS, L.buildKeyVerificationDetails(), L.buildHeaders, i]), (_o$headers2 = (o = _this34.connectSettings).headers) !== null && _o$headers2 !== void 0 ? _o$headers2 : o.headers = {}, (_a$OpenAIBeta = (a = _this34.connectSettings.headers)["OpenAI-Beta"]) !== null && _a$OpenAIBeta !== void 0 ? _a$OpenAIBeta : a["OpenAI-Beta"] = "assistants=v2", _this34.shouldFetchHistory && _this34.sessionId && (_this34.fetchHistory = _this34.fetchHistoryFunc.bind(_assertThisInitialized(_this34))), _typeof(s) == "object") {
|
8462
8456
|
var _ref22 = (c = (l = e.directConnection) == null ? void 0 : l.openAI) == null ? void 0 : c.assistant,
|
8463
|
-
d = _ref22.function_handler
|
8464
|
-
|
8457
|
+
d = _ref22.function_handler,
|
8458
|
+
h = _ref22.files_tool_type;
|
8459
|
+
d && (_this34.functionHandler = d), h && (_this34.filesToolType = h);
|
8465
8460
|
}
|
8466
8461
|
return _assertThisInitialized(_this34);
|
8467
8462
|
}
|
@@ -8633,10 +8628,10 @@ Ls.URL_DETAILS_ERROR_MESSAGE = "Please define the Azure URL Details. [More Infor
|
|
8633
8628
|
var oe = Ls;
|
8634
8629
|
var mt = /*#__PURE__*/function (_yi2) {
|
8635
8630
|
function mt(e) {
|
8636
|
-
var
|
8631
|
+
var _v$headers;
|
8637
8632
|
var _this36;
|
8638
8633
|
_classCallCheck(this, mt);
|
8639
|
-
var c, d, h, u, f, m, p;
|
8634
|
+
var c, d, h, u, f, m, p, v;
|
8640
8635
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8641
8636
|
i = t.azure,
|
8642
8637
|
s = (c = t.azure) == null ? void 0 : c.openAI,
|
@@ -8653,12 +8648,13 @@ var mt = /*#__PURE__*/function (_yi2) {
|
|
8653
8648
|
getFilesPrefix: "".concat(o, "files/"),
|
8654
8649
|
getFilesPostfix: "/content".concat(a)
|
8655
8650
|
};
|
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
|
-
|
8659
|
-
|
8651
|
+
if (_this36 = _callSuper(this, mt, [e, s == null ? void 0 : s.assistant, l, oe.buildKeyVerificationDetails(r), oe.buildHeaders, i]), _this36.permittedErrorPrefixes = [oe.URL_DETAILS_ERROR_MESSAGE], _this36.insertKeyPlaceholderText = "Azure OpenAI API Key", _this36.keyHelpUrl = "https://learn.microsoft.com/en-us/answers/questions/1193991/how-to-get-the-value-of-openai-api-key", _this36.isTextInputDisabled = !1, _typeof(s == null ? void 0 : s.assistant) == "object") {
|
8652
|
+
var _ref23 = (p = (m = (f = e.directConnection) == null ? void 0 : f.azure) == null ? void 0 : m.openAI) == null ? void 0 : p.assistant,
|
8653
|
+
y = _ref23.function_handler,
|
8654
|
+
P = _ref23.files_tool_type;
|
8655
|
+
y && (_this36.functionHandler = y), P && (_this36.filesToolType = P);
|
8660
8656
|
}
|
8661
|
-
oe.validateURLDetails(r) ? (
|
8657
|
+
oe.validateURLDetails(r) ? (_v$headers = (v = _this36.connectSettings).headers) !== null && _v$headers !== void 0 ? _v$headers : v.headers = {} : (_this36.isTextInputDisabled = !0, _this36.canSendMessage = function () {
|
8662
8658
|
return !1;
|
8663
8659
|
}, setTimeout(function () {
|
8664
8660
|
e.addMessage({
|
@@ -8895,7 +8891,7 @@ var de = /*#__PURE__*/function (_z6) {
|
|
8895
8891
|
case 4:
|
8896
8892
|
this.url = this.connectSettings.url || this._service_url;
|
8897
8893
|
s = this.preprocessBody(this.rawBody, t), r = de.createFormDataBody(s, i[0]);
|
8898
|
-
|
8894
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
8899
8895
|
case 7:
|
8900
8896
|
case "end":
|
8901
8897
|
return _context87.stop();
|
@@ -9435,26 +9431,26 @@ var _n = /*#__PURE__*/function (_z9) {
|
|
9435
9431
|
_inherits(_n, _z9);
|
9436
9432
|
return _createClass(_n);
|
9437
9433
|
}(z);
|
9438
|
-
var
|
9434
|
+
var Ke = /*#__PURE__*/function (_n2) {
|
9439
9435
|
// prettier-ignore
|
9440
|
-
function
|
9436
|
+
function Ke(e) {
|
9441
9437
|
var _a$lang, _l$name, _c$gender;
|
9442
9438
|
var _this43;
|
9443
|
-
_classCallCheck(this,
|
9439
|
+
_classCallCheck(this, Ke);
|
9444
9440
|
var s, r, o, a, l, c;
|
9445
9441
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.textToSpeech,
|
9446
9442
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
9447
|
-
_this43 = _callSuper(this,
|
9443
|
+
_this43 = _callSuper(this, Ke, [e, ae.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i]), _this43.permittedErrorPrefixes = [Ke.REGION_ERROR_MESSAGE], _this43.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(Ke.HELP_LINK, "\">here</a> for more info.\n </p>"), _this43.isTextInputDisabled = !1, _this43.url = "", t.region ? (Object.assign(_this43.rawBody, t), (_a$lang = (a = _this43.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this43.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this43.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this43.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1")) : (_this43.isTextInputDisabled = !0, _this43.canSendMessage = function () {
|
9448
9444
|
return !1;
|
9449
9445
|
}, setTimeout(function () {
|
9450
9446
|
e.addMessage({
|
9451
|
-
error:
|
9447
|
+
error: Ke.REGION_ERROR_MESSAGE
|
9452
9448
|
});
|
9453
9449
|
}));
|
9454
9450
|
return _this43;
|
9455
9451
|
}
|
9456
|
-
_inherits(
|
9457
|
-
return _createClass(
|
9452
|
+
_inherits(Ke, _n2);
|
9453
|
+
return _createClass(Ke, [{
|
9458
9454
|
key: "preprocessBody",
|
9459
9455
|
value: function preprocessBody(e, t) {
|
9460
9456
|
var i = t[t.length - 1].text;
|
@@ -9518,16 +9514,16 @@ var Je = /*#__PURE__*/function (_n2) {
|
|
9518
9514
|
}()
|
9519
9515
|
}]);
|
9520
9516
|
}(_n);
|
9521
|
-
|
9517
|
+
Ke.HELP_LINK =
|
9522
9518
|
// eslint-disable-next-line max-len
|
9523
|
-
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest",
|
9519
|
+
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest", Ke.REGION_ERROR_MESSAGE =
|
9524
9520
|
// eslint-disable-next-line max-len
|
9525
9521
|
"Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#TextToSpeech)";
|
9526
|
-
var ms =
|
9527
|
-
var
|
9528
|
-
function
|
9522
|
+
var ms = Ke;
|
9523
|
+
var Ne = /*#__PURE__*/function (_n3) {
|
9524
|
+
function Ne(e) {
|
9529
9525
|
var _this44;
|
9530
|
-
_classCallCheck(this,
|
9526
|
+
_classCallCheck(this, Ne);
|
9531
9527
|
var r, o, a;
|
9532
9528
|
var t = (o = (r = e.directConnection) == null ? void 0 : r.azure) == null ? void 0 : o.speechToText,
|
9533
9529
|
i = (a = e.directConnection) == null ? void 0 : a.azure,
|
@@ -9538,21 +9534,21 @@ var Fe = /*#__PURE__*/function (_n3) {
|
|
9538
9534
|
}
|
9539
9535
|
}
|
9540
9536
|
};
|
9541
|
-
if (_this44 = _callSuper(this,
|
9537
|
+
if (_this44 = _callSuper(this, Ne, [e, ae.buildSpeechToTextHeaders, t.region, i, s]), _this44.permittedErrorPrefixes = [Ne.REGION_ERROR_MESSAGE], _this44.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(Ne.HELP_LINK, "\">here</a> for more info.\n </p>"), _this44.url = "", _this44.isTextInputDisabled = !0, _this44.textInputPlaceholderText = "Upload an audio file", !t.region) _this44.isTextInputDisabled = !0, _this44.canSendMessage = function () {
|
9542
9538
|
return !1;
|
9543
9539
|
}, setTimeout(function () {
|
9544
9540
|
e.addMessage({
|
9545
|
-
error:
|
9541
|
+
error: Ne.REGION_ERROR_MESSAGE
|
9546
9542
|
});
|
9547
9543
|
});else {
|
9548
|
-
_this44.canSendMessage =
|
9544
|
+
_this44.canSendMessage = Ne.canFileSendMessage;
|
9549
9545
|
var l = t.lang || "en-US";
|
9550
9546
|
_this44.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(l, "&format=detailed"), _this44.recordAudio = void 0;
|
9551
9547
|
}
|
9552
9548
|
return _assertThisInitialized(_this44);
|
9553
9549
|
}
|
9554
|
-
_inherits(
|
9555
|
-
return _createClass(
|
9550
|
+
_inherits(Ne, _n3);
|
9551
|
+
return _createClass(Ne, [{
|
9556
9552
|
key: "callServiceAPI",
|
9557
9553
|
value: function () {
|
9558
9554
|
var _callServiceAPI17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t, i) {
|
@@ -9618,12 +9614,12 @@ var Fe = /*#__PURE__*/function (_n3) {
|
|
9618
9614
|
}
|
9619
9615
|
}]);
|
9620
9616
|
}(_n);
|
9621
|
-
|
9617
|
+
Ne.HELP_LINK =
|
9622
9618
|
// eslint-disable-next-line max-len
|
9623
|
-
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest",
|
9619
|
+
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest", Ne.REGION_ERROR_MESSAGE =
|
9624
9620
|
// eslint-disable-next-line max-len
|
9625
9621
|
"Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#SpeechToText)";
|
9626
|
-
var gs =
|
9622
|
+
var gs = Ne;
|
9627
9623
|
var jo = /*#__PURE__*/function (_z10) {
|
9628
9624
|
// prettier-ignore
|
9629
9625
|
function jo(e) {
|
@@ -9910,7 +9906,7 @@ var vt = /*#__PURE__*/function (_z11) {
|
|
9910
9906
|
_context104.prev = 17;
|
9911
9907
|
_context104.next = 20;
|
9912
9908
|
return t == null ? void 0 : t(s).then(function (f) {
|
9913
|
-
return
|
9909
|
+
return E.processResponseByType(f);
|
9914
9910
|
});
|
9915
9911
|
case 20:
|
9916
9912
|
_u = _context104.sent;
|
@@ -10062,7 +10058,7 @@ var he = /*#__PURE__*/function (_z12) {
|
|
10062
10058
|
var l = this.preprocessBody(this.rawBody, r);
|
10063
10059
|
s = he.createFormDataBody(l, i[0], i[1]);
|
10064
10060
|
} else this.url = he.IMAGE_VARIATIONS_URL, s = he.createFormDataBody(this.rawBody, i[0]);
|
10065
|
-
|
10061
|
+
E.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
10066
10062
|
}
|
10067
10063
|
}, {
|
10068
10064
|
key: "callServiceAPI",
|
@@ -10399,7 +10395,7 @@ var zo = /*#__PURE__*/function () {
|
|
10399
10395
|
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new bi(e) : t.stabilityAI.imageToImageUpscale ? new mi(e) : t.stabilityAI.imageToImageMasking ? new gi(e) : new vi(e);
|
10400
10396
|
if (t.mistral) return new qo(e);
|
10401
10397
|
}
|
10402
|
-
return i && (!s || !i.stream) ? new
|
10398
|
+
return i && (!s || !i.stream) ? new tt(e) : new tt(e, void 0, s || !0);
|
10403
10399
|
}
|
10404
10400
|
}]);
|
10405
10401
|
}();
|
@@ -10489,15 +10485,15 @@ var Go = /*#__PURE__*/function () {
|
|
10489
10485
|
}]);
|
10490
10486
|
}();
|
10491
10487
|
var Vo = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n\t viewBox=\"50 30 420 450\" xml:space=\"preserve\">\n<g filter=\"brightness(0) saturate(100%) invert(16%) sepia(0%) saturate(1942%) hue-rotate(215deg) brightness(99%) contrast(93%)\">\n\t<g>\n\t\t<path d=\"M447.933,103.629c-0.034-3.076-1.224-6.09-3.485-8.352L352.683,3.511c-0.004-0.004-0.007-0.005-0.011-0.008\n\t\t\tC350.505,1.338,347.511,0,344.206,0H89.278C75.361,0,64.04,11.32,64.04,25.237v461.525c0,13.916,11.32,25.237,25.237,25.237\n\t\t\th333.444c13.916,0,25.237-11.32,25.237-25.237V103.753C447.96,103.709,447.937,103.672,447.933,103.629z M356.194,40.931\n\t\t\tl50.834,50.834h-49.572c-0.695,0-1.262-0.567-1.262-1.262V40.931z M423.983,486.763c0,0.695-0.566,1.261-1.261,1.261H89.278\n\t\t\tc-0.695,0-1.261-0.566-1.261-1.261V25.237c0-0.695,0.566-1.261,1.261-1.261h242.94v66.527c0,13.916,11.322,25.239,25.239,25.239\n\t\t\th66.527V486.763z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,164.014H149.912c-6.62,0-11.988,5.367-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,169.381,368.707,164.014,362.088,164.014z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,236.353H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,241.721,368.707,236.353,362.088,236.353z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,308.691H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C374.076,314.06,368.707,308.691,362.088,308.691z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M256,381.031H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988H256\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C267.988,386.398,262.62,381.031,256,381.031z\"/>\n\t</g>\n</g>\n</svg>";
|
10492
|
-
var
|
10493
|
-
function
|
10494
|
-
_classCallCheck(this,
|
10488
|
+
var Le = /*#__PURE__*/function () {
|
10489
|
+
function Le() {
|
10490
|
+
_classCallCheck(this, Le);
|
10495
10491
|
}
|
10496
|
-
return _createClass(
|
10492
|
+
return _createClass(Le, null, [{
|
10497
10493
|
key: "createImage",
|
10498
10494
|
value: function createImage(e, t, i) {
|
10499
10495
|
var s = new Image();
|
10500
|
-
return s.src = e.src, i ||
|
10496
|
+
return s.src = e.src, i || U.scrollDownOnImageLoad(s.src, t), U.processContent("image", s, s.src, e.name);
|
10501
10497
|
}
|
10502
10498
|
// WORK - image still does not scroll down when loaded
|
10503
10499
|
}, {
|
@@ -10508,8 +10504,8 @@ var Oe = /*#__PURE__*/function () {
|
|
10508
10504
|
return _regeneratorRuntime().wrap(function _callee111$(_context111) {
|
10509
10505
|
while (1) switch (_context111.prev = _context111.next) {
|
10510
10506
|
case 0:
|
10511
|
-
r =
|
10512
|
-
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("image-message"),
|
10507
|
+
r = Le.createImage(t, e.elementRef, s), o = e.createNewMessageElement("", i);
|
10508
|
+
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("image-message"), U.addMessage(e, o, "image", i, s);
|
10513
10509
|
case 2:
|
10514
10510
|
case "end":
|
10515
10511
|
return _context111.stop();
|
@@ -10530,9 +10526,9 @@ var Oe = /*#__PURE__*/function () {
|
|
10530
10526
|
}, {
|
10531
10527
|
key: "addNewAudioMessage",
|
10532
10528
|
value: function addNewAudioMessage(e, t, i, s) {
|
10533
|
-
var r =
|
10529
|
+
var r = Le.createAudioElement(t, i),
|
10534
10530
|
o = e.createMessageElementsOnOrientation("", i, s);
|
10535
|
-
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"),
|
10531
|
+
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"), U.addMessage(e, o, "audio", i, s);
|
10536
10532
|
}
|
10537
10533
|
}, {
|
10538
10534
|
key: "createAnyFile",
|
@@ -10544,26 +10540,26 @@ var Oe = /*#__PURE__*/function () {
|
|
10544
10540
|
var s = ie.createSVGElement(Vo);
|
10545
10541
|
s.classList.add("any-file-message-icon"), i.appendChild(s);
|
10546
10542
|
var r = document.createElement("div");
|
10547
|
-
return r.classList.add("any-file-message-text"), r.textContent = e.name ||
|
10543
|
+
return r.classList.add("any-file-message-text"), r.textContent = e.name || U.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), U.processContent("any", t, e.src, r.textContent);
|
10548
10544
|
}
|
10549
10545
|
}, {
|
10550
10546
|
key: "addNewAnyFileMessage",
|
10551
10547
|
value: function addNewAnyFileMessage(e, t, i, s) {
|
10552
10548
|
var r = e.createMessageElementsOnOrientation("", i, s),
|
10553
|
-
o =
|
10554
|
-
r.bubbleElement.classList.add("any-file-message-bubble"), r.bubbleElement.appendChild(o),
|
10549
|
+
o = Le.createAnyFile(t);
|
10550
|
+
r.bubbleElement.classList.add("any-file-message-bubble"), r.bubbleElement.appendChild(o), U.addMessage(e, r, "file", i, s);
|
10555
10551
|
}
|
10556
10552
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
10557
10553
|
}, {
|
10558
10554
|
key: "addMessages",
|
10559
10555
|
value: function addMessages(e, t, i, s) {
|
10560
10556
|
t.forEach(function (r) {
|
10561
|
-
r.ref && (r =
|
10557
|
+
r.ref && (r = U.removeFileRef(r)), U.isAudioFile(r) ? Le.addNewAudioMessage(e, r, i, s) : U.isImageFile(r) ? Le.addNewImageMessage(e, r, i, s) : Le.addNewAnyFileMessage(e, r, i, s);
|
10562
10558
|
});
|
10563
10559
|
}
|
10564
10560
|
}]);
|
10565
10561
|
}();
|
10566
|
-
var me = /*#__PURE__*/function (
|
10562
|
+
var me = /*#__PURE__*/function (_De) {
|
10567
10563
|
function me(e, t, i) {
|
10568
10564
|
var _this52;
|
10569
10565
|
_classCallCheck(this, me);
|
@@ -10582,12 +10578,12 @@ var me = /*#__PURE__*/function (_Be) {
|
|
10582
10578
|
_this52.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
|
10583
10579
|
sendUpdate: !!d
|
10584
10580
|
}), !d);
|
10585
|
-
},
|
10581
|
+
}, t.isWebModel() && t.setUpMessages(_this52), o && _this52.prepareDemo(o), e.textToSpeech && bt.processConfig(e.textToSpeech, function (c) {
|
10586
10582
|
_this52.textToSpeech = c;
|
10587
10583
|
});
|
10588
10584
|
return _this52;
|
10589
10585
|
}
|
10590
|
-
_inherits(me,
|
10586
|
+
_inherits(me, _De);
|
10591
10587
|
return _createClass(me, [{
|
10592
10588
|
key: "prepareDemo",
|
10593
10589
|
value: function prepareDemo(e) {
|
@@ -10620,7 +10616,7 @@ var me = /*#__PURE__*/function (_Be) {
|
|
10620
10616
|
value: function addIntroductoryMessage(e) {
|
10621
10617
|
var i;
|
10622
10618
|
var t;
|
10623
|
-
e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t =
|
10619
|
+
e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t = Fe.add(this, e.html, b.AI_ROLE, this.messageElementRefs)), t && (this.applyCustomStyles(t, b.AI_ROLE, !1, (i = this.messageStyles) == null ? void 0 : i.intro), t.outerContainer.classList.add("deep-chat-intro"));
|
10624
10620
|
}
|
10625
10621
|
}, {
|
10626
10622
|
key: "removeIntroductoryMessage",
|
@@ -10645,12 +10641,9 @@ var me = /*#__PURE__*/function (_Be) {
|
|
10645
10641
|
r = {
|
10646
10642
|
status: e.overwrite
|
10647
10643
|
};
|
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) &&
|
10649
|
-
var o =
|
10650
|
-
|
10651
|
-
var a = [o, s];
|
10652
|
-
b.updateRefArr(this.htmlElementsToMessage, a, i);
|
10653
|
-
}
|
10644
|
+
if (!e.ignoreText && s.text !== void 0 && e.text !== null && (this.addNewTextMessage(s.text, s.role, r, i), !t && this.textToSpeech && s.role !== b.USER_ROLE && bt.speak(s.text, this.textToSpeech)), s.files && Array.isArray(s.files) && Le.addMessages(this, s.files, s.role, i), s.html !== void 0 && s.html !== null) {
|
10645
|
+
var o = Fe.add(this, s.html, s.role, this.messageElementRefs, r, i);
|
10646
|
+
ke.isElementTemporary(o) && delete s.html;
|
10654
10647
|
}
|
10655
10648
|
return this.isValidMessageContent(s) && !i && this.updateStateOnMessage(s, e.overwrite, e.sendUpdate, t), s;
|
10656
10649
|
}
|
@@ -10676,7 +10669,7 @@ var me = /*#__PURE__*/function (_Be) {
|
|
10676
10669
|
value: function removeMessageOnError() {
|
10677
10670
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
10678
10671
|
t = e == null ? void 0 : e.bubbleElement;
|
10679
|
-
(t != null && t.classList.contains(
|
10672
|
+
(t != null && t.classList.contains(be.MESSAGE_CLASS) && t.textContent === "" || me.isTemporaryElement(e)) && this.removeLastMessage();
|
10680
10673
|
}
|
10681
10674
|
// prettier-ignore
|
10682
10675
|
}, {
|
@@ -10721,9 +10714,9 @@ var me = /*#__PURE__*/function (_Be) {
|
|
10721
10714
|
value: function addDefaultLoadingMessage() {
|
10722
10715
|
var e = this.createMessageElements("", b.AI_ROLE),
|
10723
10716
|
t = e.bubbleElement;
|
10724
|
-
e.bubbleElement.classList.add(
|
10717
|
+
e.bubbleElement.classList.add(Ae.DOTS_CONTAINER_CLASS);
|
10725
10718
|
var i = document.createElement("div");
|
10726
|
-
return i.classList.add("loading-message-dots"), t.appendChild(i),
|
10719
|
+
return i.classList.add("loading-message-dots"), t.appendChild(i), Ae.setDots(t, this.messageStyles), e;
|
10727
10720
|
}
|
10728
10721
|
}, {
|
10729
10722
|
key: "addLoadingMessage",
|
@@ -10731,8 +10724,8 @@ var me = /*#__PURE__*/function (_Be) {
|
|
10731
10724
|
var i, s, r, o, a, l;
|
10732
10725
|
if (!this._displayLoadingMessage) return;
|
10733
10726
|
var e = (r = (s = (i = this.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.message) == null ? void 0 : r.html,
|
10734
|
-
t = e ?
|
10735
|
-
this.elementRef.appendChild(t.outerContainer), t.bubbleElement.classList.add(
|
10727
|
+
t = e ? Fe.createElements(this, e, b.AI_ROLE, !1) : this.addDefaultLoadingMessage();
|
10728
|
+
this.elementRef.appendChild(t.outerContainer), t.bubbleElement.classList.add(Ae.BUBBLE_CLASS), this.applyCustomStyles(t, b.AI_ROLE, !1, (l = (a = (o = this.messageStyles) == null ? void 0 : o.loading) == null ? void 0 : a.message) == null ? void 0 : l.styles), J.scrollToBottom(this.elementRef);
|
10736
10729
|
}
|
10737
10730
|
}, {
|
10738
10731
|
key: "populateIntroPanel",
|
@@ -10749,7 +10742,7 @@ var me = /*#__PURE__*/function (_Be) {
|
|
10749
10742
|
return _context112.abrupt("return", Promise.all((e || []).map(function (t) {
|
10750
10743
|
return new Promise(function (i) {
|
10751
10744
|
if (!t.type || t.type === "any") {
|
10752
|
-
var s = t.file.name ||
|
10745
|
+
var s = t.file.name || U.DEFAULT_FILE_NAME;
|
10753
10746
|
i({
|
10754
10747
|
name: s,
|
10755
10748
|
type: "any",
|
@@ -10782,7 +10775,6 @@ var me = /*#__PURE__*/function (_Be) {
|
|
10782
10775
|
key: "clearMessages",
|
10783
10776
|
value:
|
10784
10777
|
// WORK - update all message classes to use deep-chat prefix
|
10785
|
-
// WORK - should retain the messages objects
|
10786
10778
|
function clearMessages(e, t) {
|
10787
10779
|
var _this$messageToElemen;
|
10788
10780
|
var o, a;
|
@@ -10805,19 +10797,6 @@ var me = /*#__PURE__*/function (_Be) {
|
|
10805
10797
|
});
|
10806
10798
|
(_this$messageToElemen = this.messageToElements).splice.apply(_this$messageToElemen, [0, this.messageToElements.length].concat(_toConsumableArray(r))), t !== !1 && ((o = this._introPanel) != null && o._elementRef && this._introPanel.display(), this.addIntroductoryMessages()), this.textElementsToText = s, (a = this._onClearMessages) == null || a.call(this), delete e.sessionId;
|
10807
10799
|
}
|
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");
|
10820
|
-
}
|
10821
10800
|
}], [{
|
10822
10801
|
key: "getDisplayLoadingMessage",
|
10823
10802
|
value: function getDisplayLoadingMessage(e, t) {
|
@@ -10837,15 +10816,15 @@ var me = /*#__PURE__*/function (_Be) {
|
|
10837
10816
|
}, {
|
10838
10817
|
key: "isActiveElement",
|
10839
10818
|
value: function isActiveElement(e) {
|
10840
|
-
return e.contains(
|
10819
|
+
return e.contains(Ae.BUBBLE_CLASS) || e.contains(Ye.CLASS) || e.contains(be.MESSAGE_CLASS);
|
10841
10820
|
}
|
10842
10821
|
}]);
|
10843
|
-
}(
|
10844
|
-
var
|
10845
|
-
function
|
10846
|
-
_classCallCheck(this,
|
10822
|
+
}(De);
|
10823
|
+
var D = /*#__PURE__*/function () {
|
10824
|
+
function D() {
|
10825
|
+
_classCallCheck(this, D);
|
10847
10826
|
}
|
10848
|
-
return _createClass(
|
10827
|
+
return _createClass(D, null, [{
|
10849
10828
|
key: "adjustInputPadding",
|
10850
10829
|
value: function adjustInputPadding(e, t) {
|
10851
10830
|
t["inside-left"].length > 0 && e.classList.add("text-input-inner-left-adjustment"), t["inside-right"].length > 0 && e.classList.add("text-input-inner-right-adjustment");
|
@@ -10853,7 +10832,7 @@ var N = /*#__PURE__*/function () {
|
|
10853
10832
|
}, {
|
10854
10833
|
key: "adjustForOutsideButton",
|
10855
10834
|
value: function adjustForOutsideButton(e, t, i) {
|
10856
|
-
i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(
|
10835
|
+
i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(D.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(D.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : i["outside-left"].length === 0 && i["outside-right"].length > 0 && (e[3].classList.add(D.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(D.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
|
10857
10836
|
}
|
10858
10837
|
// when submit is the only button
|
10859
10838
|
// when submit button is outside by itself - we increase the height for a better look
|
@@ -10861,10 +10840,10 @@ var N = /*#__PURE__*/function () {
|
|
10861
10840
|
key: "adjustOutsideSubmit",
|
10862
10841
|
value: function adjustOutsideSubmit(e, t, i) {
|
10863
10842
|
if (!(i["inside-left"].length > 0 || i["inside-right"].length > 0)) {
|
10864
|
-
if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(
|
10843
|
+
if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(D.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(D.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), i["outside-left"].map(function (s) {
|
10865
10844
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
10866
10845
|
});
|
10867
|
-
if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(
|
10846
|
+
if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(D.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(D.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), i["outside-right"].map(function (s) {
|
10868
10847
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
10869
10848
|
});
|
10870
10849
|
}
|
@@ -10872,12 +10851,12 @@ var N = /*#__PURE__*/function () {
|
|
10872
10851
|
}, {
|
10873
10852
|
key: "set",
|
10874
10853
|
value: function set(e, t, i, s) {
|
10875
|
-
!!
|
10854
|
+
!!D.adjustOutsideSubmit(t, i, s) || D.adjustForOutsideButton(t, i, s), D.adjustInputPadding(e, s);
|
10876
10855
|
}
|
10877
10856
|
}]);
|
10878
10857
|
}();
|
10879
|
-
|
10880
|
-
var ys =
|
10858
|
+
D.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment", D.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment", D.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS = "text-input-container-left-small-adjustment", D.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS = "text-input-container-right-small-adjustment";
|
10859
|
+
var ys = D;
|
10881
10860
|
var _t = /*#__PURE__*/function () {
|
10882
10861
|
function _t() {
|
10883
10862
|
_classCallCheck(this, _t);
|
@@ -11063,14 +11042,14 @@ var zt = /*#__PURE__*/function () {
|
|
11063
11042
|
}
|
11064
11043
|
}]);
|
11065
11044
|
}();
|
11066
|
-
var
|
11067
|
-
function
|
11068
|
-
_classCallCheck(this,
|
11045
|
+
var He = /*#__PURE__*/function () {
|
11046
|
+
function He() {
|
11047
|
+
_classCallCheck(this, He);
|
11069
11048
|
}
|
11070
|
-
return _createClass(
|
11049
|
+
return _createClass(He, null, [{
|
11071
11050
|
key: "addItemEvents",
|
11072
11051
|
value: function addItemEvents(e, t, i, s) {
|
11073
|
-
|
11052
|
+
Je.add(t, s), t.addEventListener("click", function () {
|
11074
11053
|
i.click();
|
11075
11054
|
}), t.addEventListener("mouseenter", function (r) {
|
11076
11055
|
e.highlightedItem = r.target;
|
@@ -11094,7 +11073,7 @@ var qe = /*#__PURE__*/function () {
|
|
11094
11073
|
key: "populateItem",
|
11095
11074
|
value: function populateItem(e, t, i, s) {
|
11096
11075
|
var r = e.children[0];
|
11097
|
-
r.classList.contains("text-button") ? t.appendChild(
|
11076
|
+
r.classList.contains("text-button") ? t.appendChild(He.createItemText(r.textContent, s == null ? void 0 : s.text)) : (t.appendChild(He.createItemIcon(e, s == null ? void 0 : s.iconContainer)), t.appendChild(He.createItemText(i, s == null ? void 0 : s.text)));
|
11098
11077
|
}
|
11099
11078
|
// prettier-ignore
|
11100
11079
|
}, {
|
@@ -11104,13 +11083,13 @@ var qe = /*#__PURE__*/function () {
|
|
11104
11083
|
var s = t.elementRef,
|
11105
11084
|
r = t.dropupText,
|
11106
11085
|
o = document.createElement("div");
|
11107
|
-
Object.assign(o.style, (l = i == null ? void 0 : i.item) == null ? void 0 : l["default"]),
|
11086
|
+
Object.assign(o.style, (l = i == null ? void 0 : i.item) == null ? void 0 : l["default"]), He.populateItem(s, o, r, i), o.classList.add("dropup-menu-item");
|
11108
11087
|
var a = R.processStateful((i == null ? void 0 : i.item) || {}, {
|
11109
11088
|
backgroundColor: "#f3f3f3"
|
11110
11089
|
}, {
|
11111
11090
|
backgroundColor: "#ebebeb"
|
11112
11091
|
});
|
11113
|
-
return
|
11092
|
+
return He.addItemEvents(e, o, s, a), o;
|
11114
11093
|
}
|
11115
11094
|
}]);
|
11116
11095
|
}();
|
@@ -11141,7 +11120,7 @@ var ks = /*#__PURE__*/function () {
|
|
11141
11120
|
}, {
|
11142
11121
|
key: "addItem",
|
11143
11122
|
value: function addItem(e) {
|
11144
|
-
var t =
|
11123
|
+
var t = He.createItem(this, e, this._styles);
|
11145
11124
|
this.elementRef.appendChild(t);
|
11146
11125
|
}
|
11147
11126
|
// prettier-ignore
|
@@ -11161,7 +11140,7 @@ var ks = /*#__PURE__*/function () {
|
|
11161
11140
|
key: "windowKeyDown",
|
11162
11141
|
value: function windowKeyDown(e, t) {
|
11163
11142
|
var i, s, r;
|
11164
|
-
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key ===
|
11143
|
+
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key === N.ESCAPE ? (this.close(), (i = this.highlightedItem) == null || i.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === N.ENTER ? ((s = this.highlightedItem) == null || s.click(), (r = this.highlightedItem) == null || r.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === N.ARROW_DOWN ? zt.focusSiblingItem(this.highlightedItem || this.elementRef.children[this.elementRef.children.length - 1], this.elementRef, !0) : t.key === N.ARROW_UP && zt.focusSiblingItem(this.highlightedItem || this.elementRef.children[0], this.elementRef, !1));
|
11165
11144
|
}
|
11166
11145
|
}], [{
|
11167
11146
|
key: "createElement",
|
@@ -11420,26 +11399,26 @@ var wn = {},
|
|
11420
11399
|
Ni = {},
|
11421
11400
|
Di = {},
|
11422
11401
|
Yt = {},
|
11423
|
-
|
11424
|
-
Object.defineProperty(
|
11402
|
+
rt = {};
|
11403
|
+
Object.defineProperty(rt, "__esModule", {
|
11425
11404
|
value: !0
|
11426
11405
|
});
|
11427
|
-
|
11428
|
-
var
|
11429
|
-
function
|
11430
|
-
_classCallCheck(this,
|
11406
|
+
rt.Text = void 0;
|
11407
|
+
var Be = /*#__PURE__*/function () {
|
11408
|
+
function Be() {
|
11409
|
+
_classCallCheck(this, Be);
|
11431
11410
|
}
|
11432
|
-
return _createClass(
|
11411
|
+
return _createClass(Be, null, [{
|
11433
11412
|
key: "capitalize",
|
11434
11413
|
value: function capitalize(e) {
|
11435
|
-
return e.replace(
|
11414
|
+
return e.replace(Be.FIRST_CHAR_REGEX, function (t) {
|
11436
11415
|
return t.toUpperCase();
|
11437
11416
|
});
|
11438
11417
|
}
|
11439
11418
|
}, {
|
11440
11419
|
key: "lineBreak",
|
11441
11420
|
value: function lineBreak(e) {
|
11442
|
-
return e.replace(
|
11421
|
+
return e.replace(Be.DOUBLE_LINE, "<p></p>").replace(Be.ONE_LINE, "<br>");
|
11443
11422
|
}
|
11444
11423
|
}, {
|
11445
11424
|
key: "isCharDefined",
|
@@ -11454,15 +11433,15 @@ var Ue = /*#__PURE__*/function () {
|
|
11454
11433
|
}
|
11455
11434
|
}]);
|
11456
11435
|
}();
|
11457
|
-
|
11458
|
-
|
11459
|
-
|
11460
|
-
|
11436
|
+
rt.Text = Be;
|
11437
|
+
Be.FIRST_CHAR_REGEX = /\S/;
|
11438
|
+
Be.DOUBLE_LINE = /\n\n/g;
|
11439
|
+
Be.ONE_LINE = /\n/g;
|
11461
11440
|
Object.defineProperty(Yt, "__esModule", {
|
11462
11441
|
value: !0
|
11463
11442
|
});
|
11464
11443
|
Yt.Translate = void 0;
|
11465
|
-
var Qo =
|
11444
|
+
var Qo = rt;
|
11466
11445
|
var ea = /*#__PURE__*/function () {
|
11467
11446
|
function ea() {
|
11468
11447
|
_classCallCheck(this, ea);
|
@@ -11642,11 +11621,11 @@ var Ms = /*#__PURE__*/function () {
|
|
11642
11621
|
}]);
|
11643
11622
|
}();
|
11644
11623
|
ti.AutoScroll = Ms;
|
11645
|
-
var
|
11646
|
-
Object.defineProperty(
|
11624
|
+
var ot = {};
|
11625
|
+
Object.defineProperty(ot, "__esModule", {
|
11647
11626
|
value: !0
|
11648
11627
|
});
|
11649
|
-
|
11628
|
+
ot.Elements = void 0;
|
11650
11629
|
var sa = /*#__PURE__*/function () {
|
11651
11630
|
function sa() {
|
11652
11631
|
_classCallCheck(this, sa);
|
@@ -11693,12 +11672,12 @@ var sa = /*#__PURE__*/function () {
|
|
11693
11672
|
}
|
11694
11673
|
}]);
|
11695
11674
|
}();
|
11696
|
-
|
11697
|
-
var
|
11698
|
-
Object.defineProperty(
|
11675
|
+
ot.Elements = sa;
|
11676
|
+
var at = {};
|
11677
|
+
Object.defineProperty(at, "__esModule", {
|
11699
11678
|
value: !0
|
11700
11679
|
});
|
11701
|
-
|
11680
|
+
at.Cursor = void 0;
|
11702
11681
|
var Lt = /*#__PURE__*/function () {
|
11703
11682
|
function Lt() {
|
11704
11683
|
_classCallCheck(this, Lt);
|
@@ -11779,16 +11758,16 @@ var Lt = /*#__PURE__*/function () {
|
|
11779
11758
|
}
|
11780
11759
|
}]);
|
11781
11760
|
}();
|
11782
|
-
|
11761
|
+
at.Cursor = Lt;
|
11783
11762
|
Object.defineProperty(ei, "__esModule", {
|
11784
11763
|
value: !0
|
11785
11764
|
});
|
11786
11765
|
ei.CommandUtils = void 0;
|
11787
11766
|
var Xs = ti,
|
11788
|
-
na =
|
11767
|
+
na = ot,
|
11789
11768
|
ra = wt,
|
11790
|
-
Ys =
|
11791
|
-
Qs =
|
11769
|
+
Ys = at,
|
11770
|
+
Qs = rt;
|
11792
11771
|
var ne = /*#__PURE__*/function () {
|
11793
11772
|
function ne() {
|
11794
11773
|
_classCallCheck(this, ne);
|
@@ -11889,8 +11868,8 @@ Object.defineProperty(Ui, "__esModule", {
|
|
11889
11868
|
value: !0
|
11890
11869
|
});
|
11891
11870
|
Ui.Highlight = void 0;
|
11892
|
-
var oa =
|
11893
|
-
Ct =
|
11871
|
+
var oa = ot,
|
11872
|
+
Ct = at;
|
11894
11873
|
var _i = /*#__PURE__*/function () {
|
11895
11874
|
function _i() {
|
11896
11875
|
_classCallCheck(this, _i);
|
@@ -11945,9 +11924,9 @@ Object.defineProperty(ji, "__esModule", {
|
|
11945
11924
|
value: !0
|
11946
11925
|
});
|
11947
11926
|
ji.Padding = void 0;
|
11948
|
-
var aa =
|
11949
|
-
en =
|
11950
|
-
|
11927
|
+
var aa = ot,
|
11928
|
+
en = at,
|
11929
|
+
ct = rt;
|
11951
11930
|
var wi = /*#__PURE__*/function () {
|
11952
11931
|
function wi() {
|
11953
11932
|
_classCallCheck(this, wi);
|
@@ -11960,11 +11939,11 @@ var wi = /*#__PURE__*/function () {
|
|
11960
11939
|
r = t.value[s - 1],
|
11961
11940
|
o = t.selectionEnd === null ? s : t.selectionEnd,
|
11962
11941
|
a = t.value[o];
|
11963
|
-
|
11942
|
+
ct.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), ct.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
|
11964
11943
|
return;
|
11965
11944
|
}
|
11966
11945
|
var i = t.value[t.value.length - 1];
|
11967
|
-
|
11946
|
+
ct.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
|
11968
11947
|
}
|
11969
11948
|
}, {
|
11970
11949
|
key: "setStateForGenericElement",
|
@@ -11977,12 +11956,12 @@ var wi = /*#__PURE__*/function () {
|
|
11977
11956
|
c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
|
11978
11957
|
d = en.Cursor.getGenericElementCursorOffset(t, a, !1),
|
11979
11958
|
h = (s = t.textContent) === null || s === void 0 ? void 0 : s[d];
|
11980
|
-
|
11959
|
+
ct.Text.isCharDefined(c) && (e.startPadding = " "), ct.Text.isCharDefined(h) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
|
11981
11960
|
return;
|
11982
11961
|
}
|
11983
11962
|
}
|
11984
11963
|
var o = t.innerText.charAt(t.innerText.length - 1);
|
11985
|
-
|
11964
|
+
ct.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
|
11986
11965
|
}
|
11987
11966
|
}, {
|
11988
11967
|
key: "setState",
|
@@ -12015,11 +11994,11 @@ var tn = Fi,
|
|
12015
11994
|
sn = ei,
|
12016
11995
|
oi = ti,
|
12017
11996
|
Yi = Ui,
|
12018
|
-
pe =
|
11997
|
+
pe = ot,
|
12019
11998
|
Qi = ji,
|
12020
11999
|
nn = wt,
|
12021
|
-
rn =
|
12022
|
-
es =
|
12000
|
+
rn = at,
|
12001
|
+
es = rt;
|
12023
12002
|
var ca = /*#__PURE__*/function () {
|
12024
12003
|
function ca() {
|
12025
12004
|
_classCallCheck(this, ca);
|
@@ -12562,21 +12541,21 @@ var hn = Ni,
|
|
12562
12541
|
ma = ei,
|
12563
12542
|
ce = Hi,
|
12564
12543
|
ga = qi;
|
12565
|
-
var
|
12566
|
-
function
|
12567
|
-
_classCallCheck(this,
|
12544
|
+
var dt = /*#__PURE__*/function () {
|
12545
|
+
function dt() {
|
12546
|
+
_classCallCheck(this, dt);
|
12568
12547
|
}
|
12569
|
-
return _createClass(
|
12548
|
+
return _createClass(dt, null, [{
|
12570
12549
|
key: "toggle",
|
12571
12550
|
value: function toggle(e, t) {
|
12572
12551
|
var i, s;
|
12573
12552
|
var r = e.toLocaleLowerCase().trim();
|
12574
|
-
!((i = ce.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ?
|
12553
|
+
!((i = ce.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? dt.startWebSpeech(t) : r === "azure" ? dt.startAzure(t) : (console.error("service not found - must be either 'webspeech' or 'azure'"), (s = t == null ? void 0 : t.onError) === null || s === void 0 || s.call(t, "service not found - must be either 'webspeech' or 'azure'"));
|
12575
12554
|
}
|
12576
12555
|
}, {
|
12577
12556
|
key: "startWebSpeech",
|
12578
12557
|
value: function startWebSpeech(e) {
|
12579
|
-
|
12558
|
+
dt.stop() || (ce.GlobalState.service = new hn.WebSpeech(), ce.GlobalState.service.start(e));
|
12580
12559
|
}
|
12581
12560
|
}, {
|
12582
12561
|
key: "isWebSpeechSupported",
|
@@ -12587,7 +12566,7 @@ var ht = /*#__PURE__*/function () {
|
|
12587
12566
|
key: "startAzure",
|
12588
12567
|
value: function startAzure(e) {
|
12589
12568
|
var t;
|
12590
|
-
|
12569
|
+
dt.stop() || !((t = ce.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (ce.GlobalState.service = new ga.Azure(), ce.GlobalState.service.start(e));
|
12591
12570
|
}
|
12592
12571
|
}, {
|
12593
12572
|
key: "stop",
|
@@ -12602,7 +12581,7 @@ var ht = /*#__PURE__*/function () {
|
|
12602
12581
|
}
|
12603
12582
|
}]);
|
12604
12583
|
}();
|
12605
|
-
var ai = wn["default"] =
|
12584
|
+
var ai = wn["default"] = dt;
|
12606
12585
|
var ba = /*#__PURE__*/function () {
|
12607
12586
|
function ba(e, t) {
|
12608
12587
|
_classCallCheck(this, ba);
|
@@ -12748,32 +12727,32 @@ var Ft = /*#__PURE__*/function (_Gt) {
|
|
12748
12727
|
}(Gt);
|
12749
12728
|
Ft.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
12750
12729
|
var $t = Ft;
|
12751
|
-
var
|
12730
|
+
var Ce = /*#__PURE__*/function () {
|
12752
12731
|
// prettier-ignore
|
12753
|
-
function
|
12732
|
+
function Ce(e, t, i, s) {
|
12754
12733
|
var _this65 = this;
|
12755
|
-
_classCallCheck(this,
|
12734
|
+
_classCallCheck(this, Ce);
|
12756
12735
|
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = s, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
|
12757
12736
|
_this65._validationHandler = e._validationHandler;
|
12758
12737
|
});
|
12759
12738
|
}
|
12760
|
-
return _createClass(
|
12739
|
+
return _createClass(Ce, [{
|
12761
12740
|
key: "attemptAddFile",
|
12762
12741
|
value: function attemptAddFile(e, t) {
|
12763
|
-
return
|
12742
|
+
return Ce.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
|
12764
12743
|
}
|
12765
12744
|
}, {
|
12766
12745
|
key: "addAttachmentBasedOnType",
|
12767
12746
|
value: function addAttachmentBasedOnType(e, t, i) {
|
12768
|
-
var s =
|
12747
|
+
var s = Ce.getTypeFromBlob(e);
|
12769
12748
|
if (s === "image") {
|
12770
|
-
var r =
|
12749
|
+
var r = Ce.createImageAttachment(t);
|
12771
12750
|
this.addFileAttachment(e, "image", r, i);
|
12772
12751
|
} else if (s === "audio") {
|
12773
12752
|
var _r3 = Wt.createAudioAttachment(t);
|
12774
12753
|
this.addFileAttachment(e, "audio", _r3, i);
|
12775
12754
|
} else {
|
12776
|
-
var _r4 =
|
12755
|
+
var _r4 = Ce.createAnyFileAttachment(e.name);
|
12777
12756
|
this.addFileAttachment(e, "any", _r4, i);
|
12778
12757
|
}
|
12779
12758
|
}
|
@@ -12781,7 +12760,7 @@ var ke = /*#__PURE__*/function () {
|
|
12781
12760
|
key: "addFileAttachment",
|
12782
12761
|
value: function addFileAttachment(e, t, i, s) {
|
12783
12762
|
var a;
|
12784
|
-
var r =
|
12763
|
+
var r = Ce.createContainer(i);
|
12785
12764
|
if (this._attachments.length >= this._fileCountLimit) {
|
12786
12765
|
var l = this._attachments[this._attachments.length - 1].removeButton;
|
12787
12766
|
l == null || l.click();
|
@@ -12883,19 +12862,19 @@ var ke = /*#__PURE__*/function () {
|
|
12883
12862
|
}();
|
12884
12863
|
var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
|
12885
12864
|
un = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
|
12886
|
-
|
12865
|
+
_e = /*#__PURE__*/function (_Ce) {
|
12887
12866
|
// prettier-ignore
|
12888
|
-
function
|
12889
|
-
_classCallCheck(this,
|
12890
|
-
return _callSuper(this,
|
12867
|
+
function _e(e, t, i, s) {
|
12868
|
+
_classCallCheck(this, _e);
|
12869
|
+
return _callSuper(this, _e, [e, t, i, s]);
|
12891
12870
|
}
|
12892
|
-
_inherits(
|
12893
|
-
return _createClass(
|
12871
|
+
_inherits(_e, _Ce);
|
12872
|
+
return _createClass(_e, [{
|
12894
12873
|
key: "createTimer",
|
12895
12874
|
value: function createTimer(e, t) {
|
12896
12875
|
var _this66 = this;
|
12897
12876
|
var i = 0;
|
12898
|
-
var s = t !== void 0 && t <
|
12877
|
+
var s = t !== void 0 && t < _e.TIMER_LIMIT_S ? t : _e.TIMER_LIMIT_S;
|
12899
12878
|
return setInterval(function () {
|
12900
12879
|
var a;
|
12901
12880
|
i += 1, i === s && ((a = _this66.stopPlaceholderCallback) == null || a.call(_this66), _this66.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -12907,7 +12886,7 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12907
12886
|
}, {
|
12908
12887
|
key: "createPlaceholderAudioAttachment",
|
12909
12888
|
value: function createPlaceholderAudioAttachment(e) {
|
12910
|
-
var t =
|
12889
|
+
var t = _e.createAudioContainer(),
|
12911
12890
|
i = document.createElement("div");
|
12912
12891
|
i.classList.add("audio-placeholder-text-3-digits");
|
12913
12892
|
var s = document.createElement("div");
|
@@ -12944,7 +12923,7 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12944
12923
|
key: "completePlaceholderAttachment",
|
12945
12924
|
value: function completePlaceholderAttachment(e, t) {
|
12946
12925
|
var i = this._activePlaceholderAttachment;
|
12947
|
-
i && (i.file = e,
|
12926
|
+
i && (i.file = e, _e.addAudioElements(i.attachmentContainerElement.children[0], t), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
12948
12927
|
}
|
12949
12928
|
}, {
|
12950
12929
|
key: "removePlaceholderAttachment",
|
@@ -12984,8 +12963,8 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12984
12963
|
}, {
|
12985
12964
|
key: "createAudioAttachment",
|
12986
12965
|
value: function createAudioAttachment(e) {
|
12987
|
-
var t =
|
12988
|
-
return
|
12966
|
+
var t = _e.createAudioContainer();
|
12967
|
+
return _e.addAudioElements(t, e), t;
|
12989
12968
|
}
|
12990
12969
|
}, {
|
12991
12970
|
key: "stopAttachmentPlayback",
|
@@ -12994,9 +12973,9 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12994
12973
|
(s = (i = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : i[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
|
12995
12974
|
}
|
12996
12975
|
}]);
|
12997
|
-
}(
|
12998
|
-
|
12999
|
-
var Wt =
|
12976
|
+
}(Ce);
|
12977
|
+
_e.TIMER_LIMIT_S = 5999;
|
12978
|
+
var Wt = _e;
|
13000
12979
|
var ya = /*#__PURE__*/function () {
|
13001
12980
|
function ya() {
|
13002
12981
|
_classCallCheck(this, ya);
|
@@ -13006,7 +12985,7 @@ var ya = /*#__PURE__*/function () {
|
|
13006
12985
|
value:
|
13007
12986
|
// prettier-ignore
|
13008
12987
|
function create(e, t, i, s, r) {
|
13009
|
-
return r === "audio" ? new Wt(e, t, i, s) : new
|
12988
|
+
return r === "audio" ? new Wt(e, t, i, s) : new Ce(e, t, i, s);
|
13010
12989
|
}
|
13011
12990
|
}]);
|
13012
12991
|
}();
|
@@ -13167,7 +13146,7 @@ var ue = /*#__PURE__*/function () {
|
|
13167
13146
|
key: "windowKeyDown",
|
13168
13147
|
value: function windowKeyDown(e, t) {
|
13169
13148
|
var i, s;
|
13170
|
-
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key ===
|
13149
|
+
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key === N.ESCAPE ? (this.close(), (i = this.extensionCloseCallback) == null || i.call(this)) : t.key === N.ENTER && (this.close(), (s = this.extensionCloseCallback) == null || s.call(this)));
|
13171
13150
|
}
|
13172
13151
|
}], [{
|
13173
13152
|
key: "createContainer",
|
@@ -13220,19 +13199,19 @@ var ue = /*#__PURE__*/function () {
|
|
13220
13199
|
}]);
|
13221
13200
|
}();
|
13222
13201
|
ue.MODAL_CLOSE_TIMEOUT_MS = 190;
|
13223
|
-
var
|
13202
|
+
var Ze = ue;
|
13224
13203
|
var Pt = /*#__PURE__*/function (_Xt3) {
|
13225
13204
|
// prettier-ignore
|
13226
13205
|
function Pt(e, t, i, s, r, o) {
|
13227
13206
|
var _this71;
|
13228
13207
|
_classCallCheck(this, Pt);
|
13229
|
-
var h, u, f, m, p, v,
|
13208
|
+
var h, u, f, m, p, v, y, P, G;
|
13230
13209
|
var a = (h = i == null ? void 0 : i.button) == null ? void 0 : h.position,
|
13231
13210
|
l = ((m = (f = (u = i == null ? void 0 : i.button) == null ? void 0 : u.styles) == null ? void 0 : f.text) == null ? void 0 : m.content) || o;
|
13232
13211
|
_this71 = _callSuper(this, Pt, [Pt.createButtonElement(), a, i.button, l]);
|
13233
13212
|
var c = a === "dropup-menu",
|
13234
13213
|
d = _this71.createInnerElements(s, r, _this71._customStyles, c);
|
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 = ((
|
13214
|
+
_this71._inputElement = Pt.createInputElement((p = i == null ? void 0 : i.files) == null ? void 0 : p.acceptedFormats), _this71.addClickEvent(e, i), _this71.elementRef.replaceChildren(d.styles), _this71.reapplyStateStyle("styles"), _this71._fileAttachmentsType = t, _this71._openModalOnce = ((y = (v = i.files) == null ? void 0 : v.infoModal) == null ? void 0 : y.openModalOnce) === !1 || (G = (P = i.files) == null ? void 0 : P.infoModal) == null ? void 0 : G.openModalOnce;
|
13236
13215
|
return _this71;
|
13237
13216
|
}
|
13238
13217
|
_inherits(Pt, _Xt3);
|
@@ -13259,7 +13238,7 @@ var Pt = /*#__PURE__*/function (_Xt3) {
|
|
13259
13238
|
key: "addClickEvent",
|
13260
13239
|
value: function addClickEvent(e, t) {
|
13261
13240
|
var i = this.triggerImportPrompt.bind(this, this._inputElement),
|
13262
|
-
s =
|
13241
|
+
s = Ze.createTextModalFunc(e, t, i);
|
13263
13242
|
this.elementRef.onclick = this.click.bind(this, s);
|
13264
13243
|
}
|
13265
13244
|
}, {
|
@@ -13287,15 +13266,15 @@ var Pt = /*#__PURE__*/function (_Xt3) {
|
|
13287
13266
|
}
|
13288
13267
|
}]);
|
13289
13268
|
}(Xt);
|
13290
|
-
var
|
13291
|
-
function
|
13292
|
-
_classCallCheck(this,
|
13269
|
+
var we = /*#__PURE__*/function () {
|
13270
|
+
function we() {
|
13271
|
+
_classCallCheck(this, we);
|
13293
13272
|
}
|
13294
|
-
return _createClass(
|
13273
|
+
return _createClass(we, null, [{
|
13295
13274
|
key: "create",
|
13296
13275
|
value: function create(e, t, i) {
|
13297
|
-
var s =
|
13298
|
-
|
13276
|
+
var s = we.createElement(i);
|
13277
|
+
we.addEvents(s, e, t), e.appendChild(s);
|
13299
13278
|
}
|
13300
13279
|
}, {
|
13301
13280
|
key: "createElement",
|
@@ -13307,13 +13286,13 @@ var Ce = /*#__PURE__*/function () {
|
|
13307
13286
|
key: "addEvents",
|
13308
13287
|
value: function addEvents(e, t, i) {
|
13309
13288
|
t.ondragenter = function (s) {
|
13310
|
-
s.preventDefault(),
|
13289
|
+
s.preventDefault(), we.display(e);
|
13311
13290
|
}, e.ondragleave = function (s) {
|
13312
|
-
s.preventDefault(),
|
13291
|
+
s.preventDefault(), we.hide(e);
|
13313
13292
|
}, e.ondragover = function (s) {
|
13314
13293
|
s.preventDefault();
|
13315
13294
|
}, e.ondrop = function (s) {
|
13316
|
-
s.preventDefault(),
|
13295
|
+
s.preventDefault(), we.uploadFile(i, s), we.hide(e);
|
13317
13296
|
};
|
13318
13297
|
}
|
13319
13298
|
}, {
|
@@ -13340,11 +13319,11 @@ var Ce = /*#__PURE__*/function () {
|
|
13340
13319
|
}
|
13341
13320
|
}]);
|
13342
13321
|
}();
|
13343
|
-
var
|
13344
|
-
function
|
13345
|
-
_classCallCheck(this,
|
13322
|
+
var qe = /*#__PURE__*/function () {
|
13323
|
+
function qe() {
|
13324
|
+
_classCallCheck(this, qe);
|
13346
13325
|
}
|
13347
|
-
return _createClass(
|
13326
|
+
return _createClass(qe, null, [{
|
13348
13327
|
key: "validate",
|
13349
13328
|
value:
|
13350
13329
|
// prettier-ignore
|
@@ -13368,7 +13347,7 @@ var ze = /*#__PURE__*/function () {
|
|
13368
13347
|
o = i.getAllFileData(), a = o == null ? void 0 : o.map(function (l) {
|
13369
13348
|
return l.file;
|
13370
13349
|
});
|
13371
|
-
return _context119.abrupt("return",
|
13350
|
+
return _context119.abrupt("return", qe.validate(e, s, r, a));
|
13372
13351
|
case 5:
|
13373
13352
|
case "end":
|
13374
13353
|
return _context119.stop();
|
@@ -13391,7 +13370,7 @@ var ze = /*#__PURE__*/function () {
|
|
13391
13370
|
s = (r = t.files) == null ? void 0 : r.map(function (o) {
|
13392
13371
|
return o.file;
|
13393
13372
|
});
|
13394
|
-
return _context120.abrupt("return",
|
13373
|
+
return _context120.abrupt("return", qe.validate(e, i, t.text, s, !0));
|
13395
13374
|
case 2:
|
13396
13375
|
case "end":
|
13397
13376
|
return _context120.stop();
|
@@ -13406,7 +13385,7 @@ var ze = /*#__PURE__*/function () {
|
|
13406
13385
|
}, {
|
13407
13386
|
key: "validateWebsocket",
|
13408
13387
|
value: function validateWebsocket(e, t) {
|
13409
|
-
return e.websocket && !
|
13388
|
+
return e.websocket && !j.canSendMessage(e.websocket) ? (t.changeToDisabledIcon(), !1) : !0;
|
13410
13389
|
}
|
13411
13390
|
// prettier-ignore
|
13412
13391
|
}, {
|
@@ -13419,14 +13398,14 @@ var ze = /*#__PURE__*/function () {
|
|
13419
13398
|
return _regeneratorRuntime().wrap(function _callee121$(_context121) {
|
13420
13399
|
while (1) switch (_context121.prev = _context121.next) {
|
13421
13400
|
case 0:
|
13422
|
-
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !
|
13401
|
+
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !qe.validateWebsocket(t, r))) {
|
13423
13402
|
_context121.next = 2;
|
13424
13403
|
break;
|
13425
13404
|
}
|
13426
13405
|
return _context121.abrupt("return", !1);
|
13427
13406
|
case 2:
|
13428
13407
|
l = o || t.canSendMessage;
|
13429
|
-
return _context121.abrupt("return", l ? a ?
|
13408
|
+
return _context121.abrupt("return", l ? a ? qe.useValidationFuncProgrammatic(l, a, r) : qe.useValidationFunc(l, i, s, r) : null);
|
13430
13409
|
case 4:
|
13431
13410
|
case "end":
|
13432
13411
|
return _context121.stop();
|
@@ -13553,11 +13532,11 @@ var $ = /*#__PURE__*/function () {
|
|
13553
13532
|
}
|
13554
13533
|
}]);
|
13555
13534
|
}();
|
13556
|
-
var
|
13557
|
-
function
|
13558
|
-
_classCallCheck(this,
|
13535
|
+
var Xe = /*#__PURE__*/function () {
|
13536
|
+
function Xe() {
|
13537
|
+
_classCallCheck(this, Xe);
|
13559
13538
|
}
|
13560
|
-
return _createClass(
|
13539
|
+
return _createClass(Xe, null, [{
|
13561
13540
|
key: "resetSubmit",
|
13562
13541
|
value: function resetSubmit(e, t) {
|
13563
13542
|
t ? e.unsetCustomStateStyles(["loading", "submit"]) : e.unsetCustomStateStyles(["stop", "loading", "submit"]), e.reapplyStateStyle("submit");
|
@@ -13573,13 +13552,13 @@ var Ye = /*#__PURE__*/function () {
|
|
13573
13552
|
}, {
|
13574
13553
|
key: "setUpDisabledButton",
|
13575
13554
|
value: function setUpDisabledButton(e) {
|
13576
|
-
$.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), $.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), $.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), $.setPropertyValueIfDoesNotExist(e.disabled, ["svg", "styles", "default", "filter"], "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"),
|
13555
|
+
$.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), $.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), $.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), $.setPropertyValueIfDoesNotExist(e.disabled, ["svg", "styles", "default", "filter"], "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"), Xe.overwriteDefaultStyleWithSubmit(e, "disabled");
|
13577
13556
|
}
|
13578
13557
|
}, {
|
13579
13558
|
key: "process",
|
13580
13559
|
value: function process(e) {
|
13581
13560
|
var t = JSON.parse(JSON.stringify(e || {}));
|
13582
|
-
return
|
13561
|
+
return Xe.overwriteDefaultStyleWithSubmit(t, "loading"), Xe.overwriteDefaultStyleWithSubmit(t, "stop"), e != null && e.alwaysEnabled || Xe.setUpDisabledButton(t), t;
|
13583
13562
|
}
|
13584
13563
|
}]);
|
13585
13564
|
}();
|
@@ -13588,7 +13567,7 @@ var k = /*#__PURE__*/function (_Xt4) {
|
|
13588
13567
|
function k(e, t, i, s, r, o) {
|
13589
13568
|
var _this76;
|
13590
13569
|
_classCallCheck(this, k);
|
13591
|
-
var a =
|
13570
|
+
var a = Xe.process(e.submitButtonStyles);
|
13592
13571
|
_this76 = _callSuper(this, k, [k.createButtonContainerElement(), a == null ? void 0 : a.position, a]), _this76._isSVGLoadingIconOverriden = !1, _this76.status = {
|
13593
13572
|
requestInProgress: !1,
|
13594
13573
|
loadingActive: !1
|
@@ -13719,7 +13698,7 @@ var k = /*#__PURE__*/function (_Xt4) {
|
|
13719
13698
|
e.files && (t.files = Array.from(e.files).map(function (i) {
|
13720
13699
|
return {
|
13721
13700
|
file: i,
|
13722
|
-
type:
|
13701
|
+
type: Ce.getTypeFromBlob(i)
|
13723
13702
|
};
|
13724
13703
|
})), setTimeout(function () {
|
13725
13704
|
return _this78.attemptSubmit(t, !0);
|
@@ -13845,7 +13824,7 @@ var k = /*#__PURE__*/function (_Xt4) {
|
|
13845
13824
|
key: "changeToSubmitIcon",
|
13846
13825
|
value: function changeToSubmitIcon() {
|
13847
13826
|
var _this79 = this;
|
13848
|
-
this.elementRef.classList.contains(k.SUBMIT_CLASS) || (this.elementRef.classList.remove(k.LOADING_CLASS, k.DISABLED_CLASS), this.elementRef.classList.add(k.SUBMIT_CLASS), this.elementRef.replaceChildren(this._innerElements.submit),
|
13827
|
+
this.elementRef.classList.contains(k.SUBMIT_CLASS) || (this.elementRef.classList.remove(k.LOADING_CLASS, k.DISABLED_CLASS), this.elementRef.classList.add(k.SUBMIT_CLASS), this.elementRef.replaceChildren(this._innerElements.submit), Xe.resetSubmit(this, this.status.loadingActive), this.elementRef.onclick = function () {
|
13849
13828
|
var e;
|
13850
13829
|
_this79.submitFromInput(), (e = _this79._microphoneButton) != null && e.isActive && $t.toggleSpeechAfterSubmit(_this79._microphoneButton.elementRef, !!_this79._stopSTTAfterSubmit);
|
13851
13830
|
});
|
@@ -13895,7 +13874,7 @@ var Sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
13895
13874
|
_a = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>capture</title>\n <path d=\"M0 16q0 3.264 1.28 6.208t3.392 5.12 5.12 3.424 6.208 1.248 6.208-1.248 5.12-3.424 3.392-5.12 1.28-6.208-1.28-6.208-3.392-5.12-5.088-3.392-6.24-1.28q-3.264 0-6.208 1.28t-5.12 3.392-3.392 5.12-1.28 6.208zM4 16q0-3.264 1.6-6.016t4.384-4.352 6.016-1.632 6.016 1.632 4.384 4.352 1.6 6.016-1.6 6.048-4.384 4.352-6.016 1.6-6.016-1.6-4.384-4.352-1.6-6.048z\"></path>\n</svg>\n",
|
13896
13875
|
wa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z\"/>\n</svg>",
|
13897
13876
|
Ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M4.89163 13.2687L9.16582 17.5427L18.7085 8\" stroke=\"#000000\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>";
|
13898
|
-
var Rs = /*#__PURE__*/function (
|
13877
|
+
var Rs = /*#__PURE__*/function (_Ze) {
|
13899
13878
|
// prettier-ignore
|
13900
13879
|
function Rs(e, t, i, s) {
|
13901
13880
|
var _this80;
|
@@ -13907,15 +13886,15 @@ var Rs = /*#__PURE__*/function (_Xe) {
|
|
13907
13886
|
_this80._captureButton = r, _this80._submitButton = o, _this80._captureIcon = _this80._captureButton.children[0], _this80._refreshIcon = ie.createSVGElement(Sa), _this80._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (s == null ? void 0 : s.format) === "jpeg" && (_this80._format = "image/jpeg"), s != null && s.dimensions && (_this80._dimensions = s.dimensions), _this80._contentRef.appendChild(_this80._canvas), _this80.extensionCloseCallback = _this80.stop;
|
13908
13887
|
return _this80;
|
13909
13888
|
}
|
13910
|
-
_inherits(Rs,
|
13889
|
+
_inherits(Rs, _Ze);
|
13911
13890
|
return _createClass(Rs, [{
|
13912
13891
|
key: "addButtonsAndTheirEvents",
|
13913
13892
|
value: function addButtonsAndTheirEvents(e) {
|
13914
|
-
var t =
|
13893
|
+
var t = Ze.createSVGButton(_a);
|
13915
13894
|
t.classList.add("modal-svg-camera-button"), t.children[0].classList.add("modal-svg-camera-icon");
|
13916
13895
|
var i = this.addCloseButton(wa, !0);
|
13917
13896
|
i.classList.add("modal-svg-close-button"), i.children[0].classList.add("modal-svg-close-icon");
|
13918
|
-
var s =
|
13897
|
+
var s = Ze.createSVGButton(Ta);
|
13919
13898
|
return s.classList.add("modal-svg-submit-button"), this.addButtons(t, s), this.addButtonEvents(t, i, s, e), {
|
13920
13899
|
captureButton: t,
|
13921
13900
|
submitButton: s
|
@@ -13943,7 +13922,7 @@ var Rs = /*#__PURE__*/function (_Xe) {
|
|
13943
13922
|
_this82._captureButton.replaceChildren(_this82._captureIcon), _this82._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
|
13944
13923
|
var e = _this82._canvas.getContext("2d");
|
13945
13924
|
e == null || e.clearRect(0, 0, _this82._canvas.width, _this82._canvas.height);
|
13946
|
-
},
|
13925
|
+
}, Ze.MODAL_CLOSE_TIMEOUT_MS);
|
13947
13926
|
}
|
13948
13927
|
}, {
|
13949
13928
|
key: "start",
|
@@ -14007,7 +13986,7 @@ var Rs = /*#__PURE__*/function (_Xe) {
|
|
14007
13986
|
return r.openCameraModal.bind(r, r);
|
14008
13987
|
}
|
14009
13988
|
}]);
|
14010
|
-
}(
|
13989
|
+
}(Ze);
|
14011
13990
|
var Ca = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M29 7h-4.599l-2.401-4h-12l-2.4 4h-4.6c-1 0-3 1-3 2.969v16.031c0 1.657 1.5 3 2.792 3h26.271c1.313 0 2.938-1.406 2.938-2.968v-16.032c0-1-1-3-3-3zM30 26.032c0 0.395-0.639 0.947-0.937 0.969h-26.265c-0.232-0.019-0.797-0.47-0.797-1v-16.031c0-0.634 0.851-0.953 1-0.969h5.732l2.4-4h9.802l1.785 3.030 0.55 0.97h5.731c0.705 0 0.99 0.921 1 1v16.032zM16 10c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7-3.134-7-7-7zM16 22c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z\"></path>\n</svg>";
|
14012
13991
|
var ki = /*#__PURE__*/function (_Xt5) {
|
14013
13992
|
function ki(e, t, i) {
|
@@ -14064,7 +14043,7 @@ var Ot = /*#__PURE__*/function () {
|
|
14064
14043
|
button: new $t(e, a, t.addNewErrorMessage.bind(t))
|
14065
14044
|
});
|
14066
14045
|
var l = new Es(e, a, t, i, o, r);
|
14067
|
-
a.submit = l.submitFromInput.bind(l),
|
14046
|
+
a.submit = l.submitFromInput.bind(l), qe.attach(e, i, a, o, l), e.submitUserMessage = l.programmaticSubmit.bind(l), r.submit = {
|
14068
14047
|
button: l
|
14069
14048
|
}, Ot.addElements(this.elementRef, a, r, s, o, e.dropupStyles);
|
14070
14049
|
}
|
@@ -14087,7 +14066,7 @@ var Ot = /*#__PURE__*/function () {
|
|
14087
14066
|
button: new Ea(_d, t.recordAudio)
|
14088
14067
|
};
|
14089
14068
|
}
|
14090
|
-
return
|
14069
|
+
return we.isEnabled(r, e.dragAndDrop) && we.create(i, r, e.dragAndDrop), r;
|
14091
14070
|
}
|
14092
14071
|
// prettier-ignore
|
14093
14072
|
}], [{
|
@@ -14137,7 +14116,7 @@ var Is = /*#__PURE__*/function () {
|
|
14137
14116
|
var s = document.createElement("div");
|
14138
14117
|
s.id = "chat-view";
|
14139
14118
|
var r = new me(e, t, i);
|
14140
|
-
t.websocket &&
|
14119
|
+
t.websocket && j.createConnection(t, r);
|
14141
14120
|
var o = new Ot(e, r, t, s);
|
14142
14121
|
return J.addElements(s, r.elementRef, o.elementRef), s;
|
14143
14122
|
}
|
@@ -14155,11 +14134,11 @@ var ka = Object.defineProperty,
|
|
14155
14134
|
for (var s = void 0, r = n.length - 1, o; r >= 0; r--) (o = n[r]) && (s = o(e, t, s) || s);
|
14156
14135
|
return s && ka(e, t, s), s;
|
14157
14136
|
};
|
14158
|
-
var
|
14159
|
-
function
|
14137
|
+
var x = /*#__PURE__*/function (_ls) {
|
14138
|
+
function x() {
|
14160
14139
|
var _this85;
|
14161
|
-
_classCallCheck(this,
|
14162
|
-
_this85 = _callSuper(this,
|
14140
|
+
_classCallCheck(this, x);
|
14141
|
+
_this85 = _callSuper(this, x), _this85.getMessages = function () {
|
14163
14142
|
return [];
|
14164
14143
|
}, _this85.submitUserMessage = function () {
|
14165
14144
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
@@ -14167,15 +14146,15 @@ var E = /*#__PURE__*/function (_ls) {
|
|
14167
14146
|
return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
|
14168
14147
|
}, _this85.focusInput = function () {
|
14169
14148
|
return Kt.focusFromParentElement(_this85._elementRef);
|
14170
|
-
}, _this85.refreshMessages = function () {}, _this85.clearMessages = function () {}, _this85.scrollToBottom = function () {}, _this85.disableSubmitButton = function () {}, _this85.setPlaceholderText = function () {}, _this85.
|
14149
|
+
}, _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({
|
14171
14150
|
mode: "open"
|
14172
14151
|
}).appendChild(_this85._elementRef), kt.apply(Aa, _this85.shadowRoot), setTimeout(function () {
|
14173
14152
|
_this85._hasBeenRendered || _this85.onRender();
|
14174
14153
|
}, 20);
|
14175
14154
|
return _this85;
|
14176
14155
|
}
|
14177
|
-
_inherits(
|
14178
|
-
return _createClass(
|
14156
|
+
_inherits(x, _ls);
|
14157
|
+
return _createClass(x, [{
|
14179
14158
|
key: "changeToChatView",
|
14180
14159
|
value: function changeToChatView() {
|
14181
14160
|
this._activeService && (this._activeService.validateKeyProperty = !1), this.onRender();
|
@@ -14194,44 +14173,44 @@ var E = /*#__PURE__*/function (_ls) {
|
|
14194
14173
|
}
|
14195
14174
|
}]);
|
14196
14175
|
}(ls);
|
14197
|
-
_([S("object")],
|
14198
|
-
_([S("object")],
|
14199
|
-
_([S("object")],
|
14200
|
-
_([S("object")],
|
14201
|
-
_([S("function")],
|
14202
|
-
_([S("function")],
|
14203
|
-
_([S("function")],
|
14204
|
-
_([S("function")],
|
14205
|
-
_([S("object")],
|
14206
|
-
_([S("object")],
|
14207
|
-
_([S("object")],
|
14208
|
-
_([S("object")],
|
14209
|
-
_([S("object")],
|
14210
|
-
_([S("object")],
|
14211
|
-
_([S("string")],
|
14212
|
-
_([S("array")],
|
14213
|
-
_([S("object")],
|
14214
|
-
_([S("object")],
|
14215
|
-
_([S("object")],
|
14216
|
-
_([S("boolean")],
|
14217
|
-
_([S("object")],
|
14218
|
-
_([S("object")],
|
14219
|
-
_([S("object")],
|
14220
|
-
_([S("object")],
|
14221
|
-
_([S("object")],
|
14222
|
-
_([S("object")],
|
14223
|
-
_([S("object")],
|
14224
|
-
_([S("object")],
|
14225
|
-
_([S("object")],
|
14226
|
-
_([S("object")],
|
14227
|
-
_([S("object")],
|
14228
|
-
_([S("object")],
|
14229
|
-
_([S("object")],
|
14230
|
-
_([S("function")],
|
14231
|
-
_([S("function")],
|
14232
|
-
_([S("function")],
|
14233
|
-
_([S("function")],
|
14234
|
-
_([S("object")],
|
14235
|
-
_([S("object")],
|
14236
|
-
customElements.define("deep-chat",
|
14237
|
-
export {
|
14176
|
+
_([S("object")], x.prototype, "connect");
|
14177
|
+
_([S("object")], x.prototype, "directConnection");
|
14178
|
+
_([S("object")], x.prototype, "webModel");
|
14179
|
+
_([S("object")], x.prototype, "requestBodyLimits");
|
14180
|
+
_([S("function")], x.prototype, "requestInterceptor");
|
14181
|
+
_([S("function")], x.prototype, "responseInterceptor");
|
14182
|
+
_([S("function")], x.prototype, "validateInput");
|
14183
|
+
_([S("function")], x.prototype, "loadHistory");
|
14184
|
+
_([S("object")], x.prototype, "chatStyle");
|
14185
|
+
_([S("object")], x.prototype, "attachmentContainerStyle");
|
14186
|
+
_([S("object")], x.prototype, "dropupStyles");
|
14187
|
+
_([S("object")], x.prototype, "inputAreaStyle");
|
14188
|
+
_([S("object")], x.prototype, "textInput");
|
14189
|
+
_([S("object")], x.prototype, "submitButtonStyles");
|
14190
|
+
_([S("string")], x.prototype, "auxiliaryStyle");
|
14191
|
+
_([S("array")], x.prototype, "history");
|
14192
|
+
_([S("object")], x.prototype, "introMessage");
|
14193
|
+
_([S("object")], x.prototype, "avatars");
|
14194
|
+
_([S("object")], x.prototype, "names");
|
14195
|
+
_([S("boolean")], x.prototype, "displayLoadingBubble");
|
14196
|
+
_([S("object")], x.prototype, "errorMessages");
|
14197
|
+
_([S("object")], x.prototype, "messageStyles");
|
14198
|
+
_([S("object")], x.prototype, "textToSpeech");
|
14199
|
+
_([S("object")], x.prototype, "speechToText");
|
14200
|
+
_([S("object")], x.prototype, "images");
|
14201
|
+
_([S("object")], x.prototype, "gifs");
|
14202
|
+
_([S("object")], x.prototype, "camera");
|
14203
|
+
_([S("object")], x.prototype, "audio");
|
14204
|
+
_([S("object")], x.prototype, "microphone");
|
14205
|
+
_([S("object")], x.prototype, "mixedFiles");
|
14206
|
+
_([S("object")], x.prototype, "dragAndDrop");
|
14207
|
+
_([S("object")], x.prototype, "introPanelStyle");
|
14208
|
+
_([S("object")], x.prototype, "htmlClassUtilities");
|
14209
|
+
_([S("function")], x.prototype, "onMessage");
|
14210
|
+
_([S("function")], x.prototype, "onClearMessages");
|
14211
|
+
_([S("function")], x.prototype, "onComponentRender");
|
14212
|
+
_([S("function")], x.prototype, "onError");
|
14213
|
+
_([S("object")], x.prototype, "demo");
|
14214
|
+
_([S("object")], x.prototype, "_insertKeyViewStyles");
|
14215
|
+
customElements.define("deep-chat", x);
|
14216
|
+
export { x as DeepChat };
|