deep-chat-dev 9.0.269 → 9.0.271
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 +1491 -1360
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts +2 -1
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +706 -665
- package/dist/services/serviceIO.d.ts +1 -0
- package/dist/services/serviceIO.d.ts.map +1 -1
- package/dist/types/stream.d.ts +6 -1
- package/dist/types/stream.d.ts.map +1 -1
- package/dist/types/textInput.d.ts +7 -0
- package/dist/types/textInput.d.ts.map +1 -1
- package/dist/utils/HTTP/stream.d.ts.map +1 -1
- package/dist/utils/events/fireEvents.d.ts +4 -0
- package/dist/utils/events/fireEvents.d.ts.map +1 -1
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/audioFileAttachmentType.d.ts +2 -1
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/audioFileAttachmentType.d.ts.map +1 -1
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/fileAttachmentTypeFactory.d.ts +2 -2
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/fileAttachmentTypeFactory.d.ts.map +1 -1
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/fileAttachmentsType.d.ts +4 -2
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/fileAttachmentsType.d.ts.map +1 -1
- package/dist/views/chat/input/fileAttachments/fileAttachments.d.ts +2 -2
- package/dist/views/chat/input/fileAttachments/fileAttachments.d.ts.map +1 -1
- package/dist/views/chat/input/input.d.ts +1 -0
- package/dist/views/chat/input/input.d.ts.map +1 -1
- package/dist/views/chat/input/textInput/textInput.d.ts +2 -1
- package/dist/views/chat/input/textInput/textInput.d.ts.map +1 -1
- package/dist/views/chat/messages/stream/messageStream.d.ts +1 -1
- package/dist/views/chat/messages/stream/messageStream.d.ts.map +1 -1
- package/dist/views/chat/messages/utils/fileMessageUtils.d.ts +3 -4
- package/dist/views/chat/messages/utils/fileMessageUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/streamWrapper.d.ts +0 -7
- package/dist/types/streamWrapper.d.ts.map +0 -1
package/dist/deepChat.js
CHANGED
@@ -43,11 +43,11 @@ var Hn = /*#__PURE__*/function () {
|
|
43
43
|
}
|
44
44
|
}]);
|
45
45
|
}();
|
46
|
-
var
|
47
|
-
function
|
48
|
-
_classCallCheck(this,
|
46
|
+
var bi = /*#__PURE__*/function () {
|
47
|
+
function bi() {
|
48
|
+
_classCallCheck(this, bi);
|
49
49
|
}
|
50
|
-
return _createClass(
|
50
|
+
return _createClass(bi, null, [{
|
51
51
|
key: "onLoad",
|
52
52
|
value: function onLoad(e) {
|
53
53
|
e.innerHTML = '<div id="loading-validate-key-property"></div>';
|
@@ -61,11 +61,11 @@ var gi = /*#__PURE__*/function () {
|
|
61
61
|
}, {
|
62
62
|
key: "render",
|
63
63
|
value: function render(e, t, i) {
|
64
|
-
var s =
|
64
|
+
var s = bi.createElements(),
|
65
65
|
r = {
|
66
66
|
onSuccess: t,
|
67
67
|
onFail: Hn.render.bind(this, e, "Your 'key' has failed authentication"),
|
68
|
-
onLoad:
|
68
|
+
onLoad: bi.onLoad.bind(this, s)
|
69
69
|
};
|
70
70
|
i.key && i.verifyKey(i.key, r), e.replaceChildren(s);
|
71
71
|
}
|
@@ -156,18 +156,18 @@ var Je = /*#__PURE__*/function () {
|
|
156
156
|
}]);
|
157
157
|
}();
|
158
158
|
Je.FONT_URL = "https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap", Je.DEFAULT_FONT_FAMILY = "'Inter', sans-serif, Avenir, Helvetica, Arial";
|
159
|
-
var
|
160
|
-
var
|
161
|
-
function
|
162
|
-
_classCallCheck(this,
|
159
|
+
var vi = Je;
|
160
|
+
var ut = /*#__PURE__*/function () {
|
161
|
+
function ut() {
|
162
|
+
_classCallCheck(this, ut);
|
163
163
|
}
|
164
|
-
return _createClass(
|
164
|
+
return _createClass(ut, null, [{
|
165
165
|
key: "apply",
|
166
166
|
value: function apply(e, t) {
|
167
167
|
if (t) try {
|
168
|
-
|
168
|
+
ut.applyStyleSheet(e, t);
|
169
169
|
} catch (_unused) {
|
170
|
-
|
170
|
+
ut.addStyleElement(e, t);
|
171
171
|
}
|
172
172
|
}
|
173
173
|
}, {
|
@@ -185,18 +185,18 @@ var ht = /*#__PURE__*/function () {
|
|
185
185
|
}, {
|
186
186
|
key: "applyDefaultStyleToComponent",
|
187
187
|
value: function applyDefaultStyleToComponent(e, t) {
|
188
|
-
t && I.applyToStyleIfNotDefined(e, t), I.applyToStyleIfNotDefined(e,
|
188
|
+
t && I.applyToStyleIfNotDefined(e, t), I.applyToStyleIfNotDefined(e, ut.DEFAULT_COMPONENT_STYLE);
|
189
189
|
}
|
190
190
|
}]);
|
191
191
|
}();
|
192
|
-
|
192
|
+
ut.DEFAULT_COMPONENT_STYLE = {
|
193
193
|
height: "350px",
|
194
194
|
width: "320px",
|
195
195
|
borderTop: "1px solid #cacaca",
|
196
196
|
borderRight: "1px solid #cacaca",
|
197
197
|
borderLeft: "1px solid #cacaca",
|
198
198
|
borderBottom: "1px solid #cacaca",
|
199
|
-
fontFamily:
|
199
|
+
fontFamily: vi.DEFAULT_FONT_FAMILY,
|
200
200
|
fontSize: "0.9rem",
|
201
201
|
backgroundColor: "white",
|
202
202
|
position: "relative",
|
@@ -206,7 +206,7 @@ ht.DEFAULT_COMPONENT_STYLE = {
|
|
206
206
|
// this is also causing the chat to squeeze when there is no space
|
207
207
|
overflow: "hidden"
|
208
208
|
};
|
209
|
-
var
|
209
|
+
var zt = ut;
|
210
210
|
var Wt = /*#__PURE__*/_createClass(function Wt() {
|
211
211
|
_classCallCheck(this, Wt);
|
212
212
|
});
|
@@ -247,7 +247,7 @@ var Xe = /*#__PURE__*/function () {
|
|
247
247
|
value: function onInput(e, t, i) {
|
248
248
|
var s = i.target,
|
249
249
|
r = s.textContent || "";
|
250
|
-
e !== void 0 && r.length > e && (s.textContent = r.substring(0, e),
|
250
|
+
e !== void 0 && r.length > e && (s.textContent = r.substring(0, e), li.focusEndOfInput(s)), t == null || t();
|
251
251
|
}
|
252
252
|
}]);
|
253
253
|
}();
|
@@ -275,7 +275,7 @@ var Ye = /*#__PURE__*/function () {
|
|
275
275
|
this._isComposing = !1;
|
276
276
|
var s = Ye.processConfig(t, e.textInput);
|
277
277
|
this.elementRef = Ye.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 () {
|
278
|
-
Qi.add(_this.inputElementRef, i, _this._config.characterLimit, e._validationHandler);
|
278
|
+
Qi.add(_this.inputElementRef, i, _this._config.characterLimit, e._validationHandler), _this._onInput = t.onInput;
|
279
279
|
});
|
280
280
|
}
|
281
281
|
return _createClass(Ye, [{
|
@@ -283,9 +283,9 @@ var Ye = /*#__PURE__*/function () {
|
|
283
283
|
value:
|
284
284
|
// this also similarly prevents scroll up
|
285
285
|
function clear() {
|
286
|
-
var t;
|
286
|
+
var t, i;
|
287
287
|
var e = window.scrollY;
|
288
|
-
this.inputElementRef.classList.contains("text-input-disabled") || (Object.assign(this.inputElementRef.style, (t = this._config.placeholder) == null ? void 0 : t.style), this.inputElementRef.textContent = "",
|
288
|
+
this.inputElementRef.classList.contains("text-input-disabled") || (Object.assign(this.inputElementRef.style, (t = this._config.placeholder) == null ? void 0 : t.style), this.inputElementRef.textContent = "", li.focusEndOfInput(this.inputElementRef), (i = this._onInput) == null || i.call(this, !1)), Be.IS_CHROMIUM && window.scrollTo({
|
289
289
|
top: e
|
290
290
|
});
|
291
291
|
}
|
@@ -330,8 +330,8 @@ var Ye = /*#__PURE__*/function () {
|
|
330
330
|
}, {
|
331
331
|
key: "onInput",
|
332
332
|
value: function onInput() {
|
333
|
-
var e;
|
334
|
-
this.isTextInputEmpty() ? Object.assign(this.inputElementRef.style, (e = this._config.placeholder) == null ? void 0 : e.style) : this.removePlaceholderStyle();
|
333
|
+
var e, t;
|
334
|
+
this.isTextInputEmpty() ? Object.assign(this.inputElementRef.style, (e = this._config.placeholder) == null ? void 0 : e.style) : this.removePlaceholderStyle(), (t = this._onInput) == null || t.call(this, !0);
|
335
335
|
}
|
336
336
|
}, {
|
337
337
|
key: "setPlaceholderText",
|
@@ -376,12 +376,12 @@ var Ye = /*#__PURE__*/function () {
|
|
376
376
|
}]);
|
377
377
|
}();
|
378
378
|
Ye.TEXT_INPUT_ID = "text-input";
|
379
|
-
var
|
380
|
-
var
|
381
|
-
function
|
382
|
-
_classCallCheck(this,
|
379
|
+
var yi = Ye;
|
380
|
+
var li = /*#__PURE__*/function () {
|
381
|
+
function li() {
|
382
|
+
_classCallCheck(this, li);
|
383
383
|
}
|
384
|
-
return _createClass(
|
384
|
+
return _createClass(li, null, [{
|
385
385
|
key: "focusEndOfInput",
|
386
386
|
value: function focusEndOfInput(e) {
|
387
387
|
var t = document.createRange();
|
@@ -392,8 +392,8 @@ var ai = /*#__PURE__*/function () {
|
|
392
392
|
}, {
|
393
393
|
key: "focusFromParentElement",
|
394
394
|
value: function focusFromParentElement(e) {
|
395
|
-
var t = e.querySelector("#".concat(
|
396
|
-
t && (Be.IS_SAFARI && t.focus(),
|
395
|
+
var t = e.querySelector("#".concat(yi.TEXT_INPUT_ID));
|
396
|
+
t && (Be.IS_SAFARI && t.focus(), li.focusEndOfInput(t));
|
397
397
|
}
|
398
398
|
}]);
|
399
399
|
}();
|
@@ -479,7 +479,7 @@ var Ds = "Make sure the events are using {text: string} or {html: string} format
|
|
479
479
|
}]);
|
480
480
|
}();
|
481
481
|
Bi.CODE_SNIPPET_GENERATION_JUMP = 0.5;
|
482
|
-
var
|
482
|
+
var V = Bi;
|
483
483
|
var Fi = /*#__PURE__*/function () {
|
484
484
|
function Fi() {
|
485
485
|
_classCallCheck(this, Fi);
|
@@ -510,12 +510,12 @@ var Fi = /*#__PURE__*/function () {
|
|
510
510
|
}]);
|
511
511
|
}();
|
512
512
|
Fi.LOAD_VOICES_MS = 200;
|
513
|
-
var
|
514
|
-
var
|
515
|
-
function
|
516
|
-
_classCallCheck(this,
|
513
|
+
var bt = Fi;
|
514
|
+
var ft = /*#__PURE__*/function () {
|
515
|
+
function ft() {
|
516
|
+
_classCallCheck(this, ft);
|
517
517
|
}
|
518
|
-
return _createClass(
|
518
|
+
return _createClass(ft, null, [{
|
519
519
|
key: "colorToHex",
|
520
520
|
value: function colorToHex(e) {
|
521
521
|
var t = document.createElement("div");
|
@@ -528,7 +528,7 @@ var ut = /*#__PURE__*/function () {
|
|
528
528
|
value: function setDots(e, t) {
|
529
529
|
var i, s, r, o;
|
530
530
|
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) {
|
531
|
-
var a =
|
531
|
+
var a = ft.colorToHex(t.loading.message.styles.bubble.color);
|
532
532
|
e.style.setProperty("--loading-message-color", a), e.style.setProperty("--loading-message-color-fade", "".concat(a, "33"));
|
533
533
|
} else e.style.setProperty("--loading-message-color", "#848484"), e.style.setProperty("--loading-message-color-fade", "#55555533");
|
534
534
|
}
|
@@ -542,15 +542,15 @@ var ut = /*#__PURE__*/function () {
|
|
542
542
|
o = _ref.margin,
|
543
543
|
a = _ref.border;
|
544
544
|
if (i) {
|
545
|
-
var l =
|
545
|
+
var l = ft.colorToHex(i);
|
546
546
|
e.style.setProperty("--loading-history-color", l);
|
547
547
|
} else e.style.setProperty("--loading-history-color", "#dbdbdb");
|
548
548
|
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 solid");
|
549
549
|
}
|
550
550
|
}]);
|
551
551
|
}();
|
552
|
-
|
553
|
-
var De =
|
552
|
+
ft.BUBBLE_CLASS = "deep-chat-loading-message-bubble", ft.DOTS_CONTAINER_CLASS = "deep-chat-loading-message-dots-container";
|
553
|
+
var De = ft;
|
554
554
|
var ce = /*#__PURE__*/function () {
|
555
555
|
function ce() {
|
556
556
|
_classCallCheck(this, ce);
|
@@ -614,7 +614,7 @@ var ce = /*#__PURE__*/function () {
|
|
614
614
|
var i;
|
615
615
|
(i = e.files) == null || i.forEach(function (s, r) {
|
616
616
|
var o;
|
617
|
-
s.ref && (o = t.
|
617
|
+
s.ref && (o = t.files) != null && o[r] && (t.files[r].ref = s.ref);
|
618
618
|
});
|
619
619
|
}
|
620
620
|
// the chat does not use the actual file
|
@@ -647,7 +647,7 @@ var ce = /*#__PURE__*/function () {
|
|
647
647
|
}]);
|
648
648
|
}();
|
649
649
|
ce.DEFAULT_FILE_NAME = "file", ce.FILE_BUBBLE_CLASS = "file-message";
|
650
|
-
var
|
650
|
+
var H = ce;
|
651
651
|
var te = /*#__PURE__*/function () {
|
652
652
|
function te() {
|
653
653
|
_classCallCheck(this, te);
|
@@ -858,7 +858,7 @@ var _e = /*#__PURE__*/function () {
|
|
858
858
|
var o = i.getElementsByClassName(r);
|
859
859
|
Array.from(o || []).forEach(function (a) {
|
860
860
|
var l = _e.getProcessedStyles(t, a, r);
|
861
|
-
|
861
|
+
G.applyStylesToElement(a, l), _e.applyEvents(a, r);
|
862
862
|
});
|
863
863
|
});
|
864
864
|
var s = i.getElementsByClassName($n);
|
@@ -868,11 +868,11 @@ var _e = /*#__PURE__*/function () {
|
|
868
868
|
}
|
869
869
|
}]);
|
870
870
|
}();
|
871
|
-
var
|
872
|
-
function
|
873
|
-
_classCallCheck(this,
|
871
|
+
var G = /*#__PURE__*/function () {
|
872
|
+
function G() {
|
873
|
+
_classCallCheck(this, G);
|
874
874
|
}
|
875
|
-
return _createClass(
|
875
|
+
return _createClass(G, null, [{
|
876
876
|
key: "applyStylesToElement",
|
877
877
|
value: function applyStylesToElement(e, t) {
|
878
878
|
var i = I.processStateful(t);
|
@@ -891,7 +891,7 @@ var X = /*#__PURE__*/function () {
|
|
891
891
|
value: function applyClassUtilitiesToElement(e, t) {
|
892
892
|
var i = t.events,
|
893
893
|
s = t.styles;
|
894
|
-
i &&
|
894
|
+
i && G.applyEventsToElement(e, i), s && !_e.doesElementContainDeepChatClass(e) && G.applyStylesToElement(e, s);
|
895
895
|
}
|
896
896
|
}, {
|
897
897
|
key: "applyCustomClassUtilities",
|
@@ -899,20 +899,20 @@ var X = /*#__PURE__*/function () {
|
|
899
899
|
Object.keys(e).forEach(function (i) {
|
900
900
|
var s = t.getElementsByClassName(i);
|
901
901
|
Array.from(s).forEach(function (r) {
|
902
|
-
e[i] &&
|
902
|
+
e[i] && G.applyClassUtilitiesToElement(r, e[i]);
|
903
903
|
});
|
904
904
|
});
|
905
905
|
}
|
906
906
|
}, {
|
907
907
|
key: "apply",
|
908
908
|
value: function apply(e, t) {
|
909
|
-
_e.applyDeepChatUtilities(e, e.htmlClassUtilities, t),
|
909
|
+
_e.applyDeepChatUtilities(e, e.htmlClassUtilities, t), G.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
910
910
|
}
|
911
911
|
}, {
|
912
912
|
key: "traverseNodes",
|
913
913
|
value: function traverseNodes(e, t) {
|
914
914
|
e.nodeType === Node.ELEMENT_NODE && t.push(e.outerHTML), e.childNodes.forEach(function (i) {
|
915
|
-
|
915
|
+
G.traverseNodes(i, t);
|
916
916
|
});
|
917
917
|
}
|
918
918
|
}, {
|
@@ -921,7 +921,7 @@ var X = /*#__PURE__*/function () {
|
|
921
921
|
var i = new DOMParser().parseFromString(e, "text/html"),
|
922
922
|
s = [];
|
923
923
|
return i.body.childNodes.forEach(function (r) {
|
924
|
-
|
924
|
+
G.traverseNodes(r, s);
|
925
925
|
}), s;
|
926
926
|
}
|
927
927
|
}, {
|
@@ -963,7 +963,7 @@ var Le = /*#__PURE__*/function () {
|
|
963
963
|
}, {
|
964
964
|
key: "overwriteElements",
|
965
965
|
value: function overwriteElements(e, t, i) {
|
966
|
-
i.bubbleElement.innerHTML = t,
|
966
|
+
i.bubbleElement.innerHTML = t, G.apply(e, i.outerContainer), te.flagHTMLUpdateClass(i.bubbleElement);
|
967
967
|
}
|
968
968
|
// prettier-ignore
|
969
969
|
}, {
|
@@ -979,7 +979,7 @@ var Le = /*#__PURE__*/function () {
|
|
979
979
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
980
980
|
var o;
|
981
981
|
var r = Le.createElements(e, t, i, s);
|
982
|
-
return y.fillEmptyMessageElement(r.bubbleElement, t),
|
982
|
+
return y.fillEmptyMessageElement(r.bubbleElement, t), G.apply(e, r.outerContainer), te.flagHTMLUpdateClass(r.bubbleElement), e.applyCustomStyles(r, i, !1, (o = e.messageStyles) == null ? void 0 : o.html), r;
|
983
983
|
}
|
984
984
|
}, {
|
985
985
|
key: "add",
|
@@ -990,7 +990,7 @@ var Le = /*#__PURE__*/function () {
|
|
990
990
|
if (a) return a;
|
991
991
|
s.status = !1;
|
992
992
|
}
|
993
|
-
if (r && e.messageElementRefs.length > 0 &&
|
993
|
+
if (r && e.messageElementRefs.length > 0 && G.isTemporaryBasedOnHTML(t)) return;
|
994
994
|
var o = Le.create(e, t, i, r);
|
995
995
|
return r || Le.addElement(e, o.outerContainer), o;
|
996
996
|
}
|
@@ -998,9 +998,9 @@ var Le = /*#__PURE__*/function () {
|
|
998
998
|
}();
|
999
999
|
Le.HTML_BUBBLE_CLASS = "html-message";
|
1000
1000
|
var xe = Le;
|
1001
|
-
var
|
1001
|
+
var ui;
|
1002
1002
|
function _n(n) {
|
1003
|
-
return
|
1003
|
+
return ui = ui || document.createElement("textarea"), ui.innerHTML = "&" + n + ";", ui.value;
|
1004
1004
|
}
|
1005
1005
|
var Jn = Object.prototype.hasOwnProperty;
|
1006
1006
|
function Xn(n, e) {
|
@@ -1021,7 +1021,7 @@ var Yn = /\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;
|
|
1021
1021
|
function Qt(n) {
|
1022
1022
|
return n.indexOf("\\") < 0 ? n : n.replace(Yn, "$1");
|
1023
1023
|
}
|
1024
|
-
function
|
1024
|
+
function An(n) {
|
1025
1025
|
return !(n >= 55296 && n <= 57343 || n >= 64976 && n <= 65007 || (n & 65535) === 65535 || (n & 65535) === 65534 || n >= 0 && n <= 8 || n === 11 || n >= 14 && n <= 31 || n >= 127 && n <= 159 || n > 1114111);
|
1026
1026
|
}
|
1027
1027
|
function ts(n) {
|
@@ -1038,7 +1038,7 @@ var Zn = /&([a-z#][a-z0-9]{1,31});/gi,
|
|
1038
1038
|
function er(n, e) {
|
1039
1039
|
var t = 0,
|
1040
1040
|
i = _n(e);
|
1041
|
-
return e !== i ? i : e.charCodeAt(0) === 35 && Qn.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10),
|
1041
|
+
return e !== i ? i : e.charCodeAt(0) === 35 && Qn.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), An(t)) ? ts(t) : n;
|
1042
1042
|
}
|
1043
1043
|
function nt(n) {
|
1044
1044
|
return n.indexOf("&") < 0 ? n : n.replace(Zn, er);
|
@@ -1270,11 +1270,11 @@ v.dt_close = function () {
|
|
1270
1270
|
v.dd_close = function () {
|
1271
1271
|
return "</dd>\n";
|
1272
1272
|
};
|
1273
|
-
function
|
1274
|
-
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 ?
|
1273
|
+
function wn(n, e) {
|
1274
|
+
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 ? wn(n, e + 2) : e;
|
1275
1275
|
}
|
1276
1276
|
var ot = v.getBreak = function (e, t) {
|
1277
|
-
return t =
|
1277
|
+
return t = wn(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
|
1278
1278
|
};
|
1279
1279
|
function Es() {
|
1280
1280
|
this.rules = xn({}, v), this.getBreak = v.getBreak;
|
@@ -1814,7 +1814,7 @@ function xr(n, e, t, i) {
|
|
1814
1814
|
}), n.parentType = c, d[1] = n.line, h = 0; h < o.length; h++) n.bMarks[h + e] = a[h], n.tShift[h + e] = o[h];
|
1815
1815
|
return n.blkIndent = l, !0;
|
1816
1816
|
}
|
1817
|
-
function
|
1817
|
+
function Ar(n, e, t, i) {
|
1818
1818
|
var s,
|
1819
1819
|
r,
|
1820
1820
|
o,
|
@@ -1849,7 +1849,7 @@ function zs(n, e) {
|
|
1849
1849
|
}
|
1850
1850
|
return i < s && n.src.charCodeAt(i) !== 32 ? -1 : i;
|
1851
1851
|
}
|
1852
|
-
function
|
1852
|
+
function wr(n, e) {
|
1853
1853
|
var t,
|
1854
1854
|
i,
|
1855
1855
|
s = n.level + 2;
|
@@ -1912,7 +1912,7 @@ function Tr(n, e, t, i) {
|
|
1912
1912
|
return n.tokens.push({
|
1913
1913
|
type: g ? "ordered_list_close" : "bullet_list_close",
|
1914
1914
|
level: --n.level
|
1915
|
-
}), He[1] = s, n.line = s, Re &&
|
1915
|
+
}), He[1] = s, n.line = s, Re && wr(n, M), !0;
|
1916
1916
|
}
|
1917
1917
|
function Cr(n, e, t, i) {
|
1918
1918
|
var s,
|
@@ -2103,7 +2103,7 @@ function Pr(n, e, t, i) {
|
|
2103
2103
|
level: --n.level
|
2104
2104
|
}), f[1] = m[1] = l, n.line = l, !0;
|
2105
2105
|
}
|
2106
|
-
function
|
2106
|
+
function fi(n, e) {
|
2107
2107
|
var t,
|
2108
2108
|
i,
|
2109
2109
|
s = n.bMarks[e] + n.tShift[e],
|
@@ -2118,8 +2118,8 @@ function Nr(n, e) {
|
|
2118
2118
|
}
|
2119
2119
|
function Dr(n, e, t, i) {
|
2120
2120
|
var s, r, o, a, l, c, d, u, h, f, m, p, g, b;
|
2121
|
-
if (i) return n.ddIndent < 0 ? !1 :
|
2122
|
-
if (d = e + 1, n.isEmpty(d) && ++d > t || n.tShift[d] < n.blkIndent || (s =
|
2121
|
+
if (i) return n.ddIndent < 0 ? !1 : fi(n, e) >= 0;
|
2122
|
+
if (d = e + 1, n.isEmpty(d) && ++d > t || n.tShift[d] < n.blkIndent || (s = fi(n, d), s < 0) || n.level >= n.options.maxNesting) return !1;
|
2123
2123
|
c = n.tokens.length, n.tokens.push({
|
2124
2124
|
type: "dl_open",
|
2125
2125
|
lines: l = [e, 0],
|
@@ -2148,10 +2148,10 @@ function Dr(n, e, t, i) {
|
|
2148
2148
|
type: "dd_close",
|
2149
2149
|
level: --n.level
|
2150
2150
|
}), a[1] = d = n.line, d >= t || n.tShift[d] < n.blkIndent) break e;
|
2151
|
-
if (s =
|
2151
|
+
if (s = fi(n, d), s < 0) break;
|
2152
2152
|
r = d;
|
2153
2153
|
}
|
2154
|
-
if (d >= t || (o = d, n.isEmpty(o)) || n.tShift[o] < n.blkIndent || (r = o + 1, r >= t) || (n.isEmpty(r) && r++, r >= t) || n.tShift[r] < n.blkIndent || (s =
|
2154
|
+
if (d >= t || (o = d, n.isEmpty(o)) || n.tShift[o] < n.blkIndent || (r = o + 1, r >= t) || (n.isEmpty(r) && r++, r >= t) || n.tShift[r] < n.blkIndent || (s = fi(n, r), s < 0)) break;
|
2155
2155
|
}
|
2156
2156
|
return n.tokens.push({
|
2157
2157
|
type: "dl_close",
|
@@ -2192,11 +2192,11 @@ function Br(n, e) {
|
|
2192
2192
|
level: n.level
|
2193
2193
|
})), !0;
|
2194
2194
|
}
|
2195
|
-
var
|
2195
|
+
var pi = [["code", Sr], ["fences", _r, ["paragraph", "blockquote", "list"]], ["blockquote", xr, ["paragraph", "blockquote", "list"]], ["hr", Ar, ["paragraph", "blockquote", "list"]], ["list", Tr, ["paragraph", "blockquote"]], ["footnote", Cr, ["paragraph"]], ["heading", Rr, ["paragraph", "blockquote"]], ["lheading", Mr], ["htmlblock", Or, ["paragraph", "blockquote"]], ["table", Pr, ["paragraph"]], ["deflist", Dr, ["paragraph"]], ["paragraph", Br]];
|
2196
2196
|
function Ss() {
|
2197
2197
|
this.ruler = new oe();
|
2198
|
-
for (var n = 0; n <
|
2199
|
-
alt: (
|
2198
|
+
for (var n = 0; n < pi.length; n++) this.ruler.push(pi[n][0], pi[n][1], {
|
2199
|
+
alt: (pi[n][2] || []).slice()
|
2200
2200
|
});
|
2201
2201
|
}
|
2202
2202
|
Ss.prototype.tokenize = function (n, e, t) {
|
@@ -2659,8 +2659,8 @@ function _o(n, e) {
|
|
2659
2659
|
}), n.pos += i[0].length, !0);
|
2660
2660
|
}
|
2661
2661
|
var xo = /^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,
|
2662
|
-
|
2663
|
-
function
|
2662
|
+
Ao = /^&([a-z][a-z0-9]{1,31});/i;
|
2663
|
+
function wo(n, e) {
|
2664
2664
|
var t,
|
2665
2665
|
i,
|
2666
2666
|
s,
|
@@ -2669,15 +2669,15 @@ function Ao(n, e) {
|
|
2669
2669
|
if (n.src.charCodeAt(r) !== 38) return !1;
|
2670
2670
|
if (r + 1 < o) {
|
2671
2671
|
if (t = n.src.charCodeAt(r + 1), t === 35) {
|
2672
|
-
if (s = n.src.slice(r).match(xo), s) return e || (i = s[1][0].toLowerCase() === "x" ? parseInt(s[1].slice(1), 16) : parseInt(s[1], 10), n.pending +=
|
2673
|
-
} else if (s = n.src.slice(r).match(
|
2672
|
+
if (s = n.src.slice(r).match(xo), s) return e || (i = s[1][0].toLowerCase() === "x" ? parseInt(s[1].slice(1), 16) : parseInt(s[1], 10), n.pending += An(i) ? ts(i) : ts(65533)), n.pos += s[0].length, !0;
|
2673
|
+
} else if (s = n.src.slice(r).match(Ao), s) {
|
2674
2674
|
var a = _n(s[1]);
|
2675
2675
|
if (s[1] !== a) return e || (n.pending += a), n.pos += s[0].length, !0;
|
2676
2676
|
}
|
2677
2677
|
}
|
2678
2678
|
return e || (n.pending += "&"), n.pos++, !0;
|
2679
2679
|
}
|
2680
|
-
var Zi = [["text", qr], ["newline", zr], ["escape", Gr], ["backticks", Vr], ["del", Kr], ["ins", Wr], ["mark", $r], ["emphasis", Jr], ["sub", Yr], ["sup", Qr], ["links", eo], ["footnote_inline", to], ["footnote_ref", io], ["autolink", oo], ["htmltag", _o], ["entity",
|
2680
|
+
var Zi = [["text", qr], ["newline", zr], ["escape", Gr], ["backticks", Vr], ["del", Kr], ["ins", Wr], ["mark", $r], ["emphasis", Jr], ["sub", Yr], ["sup", Qr], ["links", eo], ["footnote_inline", to], ["footnote_ref", io], ["autolink", oo], ["htmltag", _o], ["entity", wo]];
|
2681
2681
|
function qi() {
|
2682
2682
|
this.ruler = new oe();
|
2683
2683
|
for (var n = 0; n < Zi.length; n++) this.ruler.push(Zi[n][0], Zi[n][1]);
|
@@ -2836,47 +2836,47 @@ var Co = {
|
|
2836
2836
|
function Ln(n, e, t) {
|
2837
2837
|
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;
|
2838
2838
|
}
|
2839
|
-
function
|
2839
|
+
function Ae(n, e) {
|
2840
2840
|
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 qi(), this.block = new Ss(), this.core = new Mn(), this.renderer = new Es(), this.ruler = new oe(), this.options = {}, this.configure(ko[n]), this.set(e || {});
|
2841
2841
|
}
|
2842
|
-
|
2842
|
+
Ae.prototype.set = function (n) {
|
2843
2843
|
xn(this.options, n);
|
2844
2844
|
};
|
2845
|
-
|
2845
|
+
Ae.prototype.configure = function (n) {
|
2846
2846
|
var e = this;
|
2847
2847
|
if (!n) throw new Error("Wrong `remarkable` preset, check name/content");
|
2848
2848
|
n.options && e.set(n.options), n.components && Object.keys(n.components).forEach(function (t) {
|
2849
2849
|
n.components[t].rules && e[t].ruler.enable(n.components[t].rules, !0);
|
2850
2850
|
});
|
2851
2851
|
};
|
2852
|
-
|
2852
|
+
Ae.prototype.use = function (n, e) {
|
2853
2853
|
return n(this, e), this;
|
2854
2854
|
};
|
2855
|
-
|
2855
|
+
Ae.prototype.parse = function (n, e) {
|
2856
2856
|
var t = new Ln(this, n, e);
|
2857
2857
|
return this.core.process(t), t.tokens;
|
2858
2858
|
};
|
2859
|
-
|
2859
|
+
Ae.prototype.render = function (n, e) {
|
2860
2860
|
return e = e || {}, this.renderer.render(this.parse(n, e), this.options, e);
|
2861
2861
|
};
|
2862
|
-
|
2862
|
+
Ae.prototype.parseInline = function (n, e) {
|
2863
2863
|
var t = new Ln(this, n, e);
|
2864
2864
|
return t.inlineMode = !0, this.core.process(t), t.tokens;
|
2865
2865
|
};
|
2866
|
-
|
2866
|
+
Ae.prototype.renderInline = function (n, e) {
|
2867
2867
|
return e = e || {}, this.renderer.render(this.parseInline(n, e), this.options, e);
|
2868
2868
|
};
|
2869
|
-
var
|
2870
|
-
function
|
2871
|
-
_classCallCheck(this,
|
2869
|
+
var pt = /*#__PURE__*/function () {
|
2870
|
+
function pt() {
|
2871
|
+
_classCallCheck(this, pt);
|
2872
2872
|
}
|
2873
|
-
return _createClass(
|
2873
|
+
return _createClass(pt, null, [{
|
2874
2874
|
key: "instantiate",
|
2875
2875
|
value: function instantiate(e) {
|
2876
|
-
if (e) return new
|
2876
|
+
if (e) return new Ae(_objectSpread(_objectSpread({}, pt.DEFAULT_PROPERTIES), e));
|
2877
2877
|
if (window.hljs) {
|
2878
2878
|
var t = window.hljs;
|
2879
|
-
return new
|
2879
|
+
return new Ae({
|
2880
2880
|
highlight: function highlight(i, s) {
|
2881
2881
|
if (s && t.getLanguage(s)) try {
|
2882
2882
|
return t.highlight(i, {
|
@@ -2905,29 +2905,29 @@ var ft = /*#__PURE__*/function () {
|
|
2905
2905
|
typographer: !0
|
2906
2906
|
// Enable smartypants and other sweet transforms
|
2907
2907
|
});
|
2908
|
-
} else return new
|
2908
|
+
} else return new Ae(pt.DEFAULT_PROPERTIES);
|
2909
2909
|
}
|
2910
2910
|
}, {
|
2911
2911
|
key: "createNew",
|
2912
2912
|
value: function createNew(e) {
|
2913
|
-
var t =
|
2913
|
+
var t = pt.instantiate(e);
|
2914
2914
|
return t.inline.validateLink = function () {
|
2915
2915
|
return !0;
|
2916
2916
|
}, t;
|
2917
2917
|
}
|
2918
2918
|
}]);
|
2919
2919
|
}();
|
2920
|
-
|
2920
|
+
pt.DEFAULT_PROPERTIES = {
|
2921
2921
|
breaks: !0,
|
2922
2922
|
linkTarget: "_blank"
|
2923
2923
|
// set target to open in a new tab
|
2924
2924
|
};
|
2925
|
-
var ti =
|
2926
|
-
var
|
2927
|
-
function
|
2928
|
-
_classCallCheck(this,
|
2925
|
+
var ti = pt;
|
2926
|
+
var X = /*#__PURE__*/function () {
|
2927
|
+
function X() {
|
2928
|
+
_classCallCheck(this, X);
|
2929
2929
|
}
|
2930
|
-
return _createClass(
|
2930
|
+
return _createClass(X, null, [{
|
2931
2931
|
key: "applyCustomStylesToElements",
|
2932
2932
|
value: function applyCustomStylesToElements(e, t, i) {
|
2933
2933
|
if (i && (Object.assign(e.outerContainer.style, i.outerContainer), Object.assign(e.innerContainer.style, i.innerContainer), Object.assign(e.bubbleElement.style, i.bubble), t)) {
|
@@ -2939,7 +2939,7 @@ var J = /*#__PURE__*/function () {
|
|
2939
2939
|
}, {
|
2940
2940
|
key: "applySideStyles",
|
2941
2941
|
value: function applySideStyles(e, t, i, s) {
|
2942
|
-
s && (
|
2942
|
+
s && (X.applyCustomStylesToElements(e, i, s.shared), t === y.USER_ROLE ? X.applyCustomStylesToElements(e, i, s.user) : (X.applyCustomStylesToElements(e, i, s.ai), X.applyCustomStylesToElements(e, i, s[t])));
|
2943
2943
|
}
|
2944
2944
|
}, {
|
2945
2945
|
key: "isElementsStyles",
|
@@ -2951,7 +2951,7 @@ var J = /*#__PURE__*/function () {
|
|
2951
2951
|
key: "applyCustomStyles",
|
2952
2952
|
value: function applyCustomStyles(e, t, i, s, r) {
|
2953
2953
|
var o;
|
2954
|
-
r && e["default"] !== r ?
|
2954
|
+
r && e["default"] !== r ? X.isElementsStyles(r) ? (X.applyCustomStylesToElements(t, s, (o = e["default"]) == null ? void 0 : o.shared), X.applyCustomStylesToElements(t, s, r)) : (X.applySideStyles(t, i, s, e["default"]), X.applySideStyles(t, i, s, r)) : X.applySideStyles(t, i, s, e["default"]);
|
2955
2955
|
}
|
2956
2956
|
// prettier-ignore
|
2957
2957
|
}, {
|
@@ -2972,11 +2972,11 @@ var J = /*#__PURE__*/function () {
|
|
2972
2972
|
}
|
2973
2973
|
}]);
|
2974
2974
|
}();
|
2975
|
-
var
|
2976
|
-
function
|
2977
|
-
_classCallCheck(this,
|
2975
|
+
var ii = /*#__PURE__*/function () {
|
2976
|
+
function ii() {
|
2977
|
+
_classCallCheck(this, ii);
|
2978
2978
|
}
|
2979
|
-
return _createClass(
|
2979
|
+
return _createClass(ii, null, [{
|
2980
2980
|
key: "onMessage",
|
2981
2981
|
value: function onMessage(e, t, i) {
|
2982
2982
|
var r;
|
@@ -2985,7 +2985,7 @@ var yi = /*#__PURE__*/function () {
|
|
2985
2985
|
isHistory: i,
|
2986
2986
|
isInitial: i
|
2987
2987
|
}));
|
2988
|
-
|
2988
|
+
H.reAddFileRefToObject(t, s.message), (r = e.onMessage) == null || r.call(e, s), e.dispatchEvent(new CustomEvent("message", {
|
2989
2989
|
detail: s
|
2990
2990
|
})), te.fireOnNewMessage(e, s);
|
2991
2991
|
}
|
@@ -3003,6 +3003,24 @@ var yi = /*#__PURE__*/function () {
|
|
3003
3003
|
detail: e
|
3004
3004
|
}));
|
3005
3005
|
}
|
3006
|
+
}, {
|
3007
|
+
key: "onInput",
|
3008
|
+
value: function onInput(e, t, i) {
|
3009
|
+
var r, o;
|
3010
|
+
var s = JSON.parse(JSON.stringify({
|
3011
|
+
content: t,
|
3012
|
+
isUser: i
|
3013
|
+
}));
|
3014
|
+
t.files && H.reAddFileRefToObject({
|
3015
|
+
files: (r = t.files) == null ? void 0 : r.map(function (a) {
|
3016
|
+
return {
|
3017
|
+
ref: a
|
3018
|
+
};
|
3019
|
+
})
|
3020
|
+
}, s), (o = e.onInput) == null || o.call(e, s), e.dispatchEvent(new CustomEvent("input", {
|
3021
|
+
detail: s
|
3022
|
+
}));
|
3023
|
+
}
|
3006
3024
|
}, {
|
3007
3025
|
key: "onError",
|
3008
3026
|
value: function onError(e, t) {
|
@@ -3201,27 +3219,27 @@ var Me = /*#__PURE__*/function (_In) {
|
|
3201
3219
|
}
|
3202
3220
|
}]);
|
3203
3221
|
}(In);
|
3204
|
-
var
|
3205
|
-
function
|
3222
|
+
var Gt = /*#__PURE__*/function (_In2) {
|
3223
|
+
function Gt(e) {
|
3206
3224
|
var _this4;
|
3207
|
-
_classCallCheck(this,
|
3208
|
-
_this4 = _callSuper(this,
|
3225
|
+
_classCallCheck(this, Gt);
|
3226
|
+
_this4 = _callSuper(this, Gt, ["name"]), _this4._names = e;
|
3209
3227
|
return _this4;
|
3210
3228
|
}
|
3211
|
-
_inherits(
|
3212
|
-
return _createClass(
|
3229
|
+
_inherits(Gt, _In2);
|
3230
|
+
return _createClass(Gt, [{
|
3213
3231
|
key: "addBesideMsg",
|
3214
3232
|
value: function addBesideMsg(e, t) {
|
3215
3233
|
var i = typeof this._names == "boolean" ? {} : this._names,
|
3216
3234
|
s = this.createName(t, i),
|
3217
|
-
r =
|
3235
|
+
r = Gt.getPosition(t, i);
|
3218
3236
|
s.classList.add(r === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(r === "left" ? "beforebegin" : "afterend", s);
|
3219
3237
|
}
|
3220
3238
|
}, {
|
3221
3239
|
key: "createName",
|
3222
3240
|
value: function createName(e, t) {
|
3223
3241
|
var i = document.createElement("div");
|
3224
|
-
return i.classList.add(this.className), i.textContent =
|
3242
|
+
return i.classList.add(this.className), i.textContent = Gt.getNameText(e, t), Gt.applyStyle(i, e, t), i;
|
3225
3243
|
}
|
3226
3244
|
}], [{
|
3227
3245
|
key: "getPosition",
|
@@ -3249,7 +3267,7 @@ var Z = /*#__PURE__*/function () {
|
|
3249
3267
|
var _this5 = this;
|
3250
3268
|
_classCallCheck(this, Z);
|
3251
3269
|
var t;
|
3252
|
-
this.messageElementRefs = [], this.htmlClassUtilities = {}, this.messageToElements = [], this.elementRef = Z.createContainerElement(), this.messageStyles = te.processMessageStyles(e.messageStyles), this._remarkable = ti.createNew(e.remarkable), e.avatars && (this.avatar = new Me(e.avatars)), e.names && (this.name = new
|
3270
|
+
this.messageElementRefs = [], this.htmlClassUtilities = {}, this.messageToElements = [], this.elementRef = Z.createContainerElement(), this.messageStyles = te.processMessageStyles(e.messageStyles), this._remarkable = ti.createNew(e.remarkable), e.avatars && (this.avatar = new Me(e.avatars)), e.names && (this.name = new Gt(e.names)), this._onMessage = ii.onMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), this.focusMode = e.focusMode, this.focusMode || (this._lastGroupMessagesElement = document.createElement("div")), typeof this.focusMode != "boolean" && (t = this.focusMode) != null && t.fade && Ei.setFade(this.elementRef, this.focusMode.fade), setTimeout(function () {
|
3253
3271
|
_this5.submitUserMessage = e.submitUserMessage;
|
3254
3272
|
});
|
3255
3273
|
}
|
@@ -3284,7 +3302,7 @@ var Z = /*#__PURE__*/function () {
|
|
3284
3302
|
var i = this.createNewMessageElement(e, t);
|
3285
3303
|
if (this.appendOuterContainerElemet(i.outerContainer, t), t === "user") {
|
3286
3304
|
var r = typeof this.focusMode != "boolean" && ((s = this.focusMode) == null ? void 0 : s.scroll);
|
3287
|
-
|
3305
|
+
V.scrollToBottom(this.elementRef, r);
|
3288
3306
|
}
|
3289
3307
|
return i;
|
3290
3308
|
}
|
@@ -3302,7 +3320,7 @@ var Z = /*#__PURE__*/function () {
|
|
3302
3320
|
var _this6 = this;
|
3303
3321
|
var i = this.createNewMessageElement(e, t);
|
3304
3322
|
return this.appendOuterContainerElemet(i.outerContainer), setTimeout(function () {
|
3305
|
-
return
|
3323
|
+
return V.scrollToBottom(_this6.elementRef);
|
3306
3324
|
}), i;
|
3307
3325
|
}
|
3308
3326
|
}, {
|
@@ -3381,7 +3399,7 @@ var Z = /*#__PURE__*/function () {
|
|
3381
3399
|
}, {
|
3382
3400
|
key: "applyCustomStyles",
|
3383
3401
|
value: function applyCustomStyles(e, t, i, s) {
|
3384
|
-
e && this.messageStyles &&
|
3402
|
+
e && this.messageStyles && X.applyCustomStyles(this.messageStyles, e, t, i, s);
|
3385
3403
|
}
|
3386
3404
|
}, {
|
3387
3405
|
key: "removeMessage",
|
@@ -3611,7 +3629,7 @@ var S = /*#__PURE__*/function () {
|
|
3611
3629
|
key: "generateMessageBodyElements",
|
3612
3630
|
value: function generateMessageBodyElements(e, t) {
|
3613
3631
|
var i = {};
|
3614
|
-
return e.text && (i.text = S.findMessageElements(t, he.TEXT_BUBBLE_CLASS)), e.html && (i.html = S.findMessageElements(t, xe.HTML_BUBBLE_CLASS)), e.files && (i.files = S.filterdMessageElements(t,
|
3632
|
+
return e.text && (i.text = S.findMessageElements(t, he.TEXT_BUBBLE_CLASS)), e.html && (i.html = S.findMessageElements(t, xe.HTML_BUBBLE_CLASS)), e.files && (i.files = S.filterdMessageElements(t, H.FILE_BUBBLE_CLASS)), i;
|
3615
3633
|
}
|
3616
3634
|
}, {
|
3617
3635
|
key: "generateMessageBody",
|
@@ -3700,27 +3718,29 @@ var pe = /*#__PURE__*/function () {
|
|
3700
3718
|
if ((e == null ? void 0 : e.text) === void 0 && (e == null ? void 0 : e.html) === void 0) return console.error(k.INVALID_STREAM_EVENT);
|
3701
3719
|
e != null && e.custom && this._message && (this._message.custom = e.custom);
|
3702
3720
|
var t = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.html) || "",
|
3703
|
-
i =
|
3721
|
+
i = V.isScrollbarAtBottomOfElement(this._messages.elementRef),
|
3704
3722
|
s = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
|
3705
3723
|
if (!this._elements && !this._message) this.setInitialState(s, t, e == null ? void 0 : e.role);else {
|
3706
3724
|
if (this._streamType !== s) return console.error(k.INVALID_STREAM_EVENT_MIX);
|
3707
3725
|
this.updateBasedOnType(t, s, e == null ? void 0 : e.overwrite);
|
3708
3726
|
}
|
3709
|
-
i &&
|
3727
|
+
i && V.scrollToBottom(this._messages.elementRef);
|
3710
3728
|
}
|
3711
3729
|
}, {
|
3712
3730
|
key: "setInitialState",
|
3713
3731
|
value: function setInitialState(e, t, i) {
|
3714
|
-
|
3732
|
+
var o, a;
|
3733
|
+
this._streamType = e, i !== null && i !== void 0 ? i : i = y.AI_ROLE;
|
3734
|
+
var s = ((o = this._customWrappers) == null ? void 0 : o[i]) || ((a = this._customWrappers) == null ? void 0 : a["default"]),
|
3735
|
+
r = s ? "" : t;
|
3736
|
+
this._elements = e === "text" ? this._messages.addNewTextMessage(r, i) : xe.add(this._messages, r, i), this._elements && (this._elements.bubbleElement.classList.add(pe.MESSAGE_CLASS), this._activeMessageRole = i, this._message = _defineProperty({
|
3715
3737
|
role: this._activeMessageRole
|
3716
|
-
}, e,
|
3738
|
+
}, e, r), this._messages.messageToElements.push([this._message, _defineProperty({}, e, this._elements)]), s && this.setTargetWrapperIfNeeded(this._elements, t, this._streamType, s));
|
3717
3739
|
}
|
3718
3740
|
}, {
|
3719
3741
|
key: "setTargetWrapperIfNeeded",
|
3720
|
-
value: function setTargetWrapperIfNeeded(e, t) {
|
3721
|
-
|
3722
|
-
var i = ((s = this._customWrappers) == null ? void 0 : s[t]) || ((r = this._customWrappers) == null ? void 0 : r["default"]);
|
3723
|
-
i && (e.bubbleElement.innerHTML = i, this._targetWrapper = e.bubbleElement.getElementsByClassName(pe.TARGET_WRAPPER_CLASS)[0]);
|
3742
|
+
value: function setTargetWrapperIfNeeded(e, t, i, s) {
|
3743
|
+
e.bubbleElement.innerHTML = s, this._targetWrapper = e.bubbleElement.getElementsByClassName(pe.TARGET_WRAPPER_CLASS)[0], this._elements && G.apply(this._messages, this._elements.bubbleElement), this.updateBasedOnType(t, i);
|
3724
3744
|
}
|
3725
3745
|
}, {
|
3726
3746
|
key: "updateBasedOnType",
|
@@ -3765,7 +3785,7 @@ var pe = /*#__PURE__*/function () {
|
|
3765
3785
|
var e;
|
3766
3786
|
if (!(this._endStreamAfterOperation || !this._message) && !(this._fileAdded && !this._elements)) {
|
3767
3787
|
if (!this._elements) throw Error(k.NO_VALID_STREAM_EVENTS_SENT);
|
3768
|
-
(e = this._elements.bubbleElement) != null && e.classList.contains(pe.MESSAGE_CLASS) && (this._streamType === "text" ? this._messages.textToSpeech &&
|
3788
|
+
(e = this._elements.bubbleElement) != null && e.classList.contains(pe.MESSAGE_CLASS) && (this._streamType === "text" ? this._messages.textToSpeech && bt.speak(this._message.text || "", this._messages.textToSpeech) : this._streamType === "html" && this._elements && G.apply(this._messages, this._elements.outerContainer), this._elements.bubbleElement.classList.remove(pe.MESSAGE_CLASS), this._message && (this._targetWrapper && (this._message.html = this._elements.bubbleElement.children[0].outerHTML, this._streamType === "text" && delete this._message.text), this._messages.sendClientUpdate(he.createMessageContent(this._message), !1)), this._hasStreamEnded = !0);
|
3769
3789
|
}
|
3770
3790
|
}
|
3771
3791
|
}, {
|
@@ -3811,7 +3831,7 @@ var pe = /*#__PURE__*/function () {
|
|
3811
3831
|
}]);
|
3812
3832
|
}();
|
3813
3833
|
pe.MESSAGE_CLASS = "streamed-message", pe.PARTIAL_RENDER_TEXT_MARK = "\n\n", pe.TARGET_WRAPPER_CLASS = "stream-wrapper";
|
3814
|
-
var
|
3834
|
+
var we = pe;
|
3815
3835
|
var qe = /*#__PURE__*/function () {
|
3816
3836
|
function qe() {
|
3817
3837
|
_classCallCheck(this, qe);
|
@@ -4200,11 +4220,11 @@ function Fo(n) {
|
|
4200
4220
|
var e = n.headers.get("content-type");
|
4201
4221
|
if (!(e != null && e.startsWith(ns))) throw new Error("Expected content-type to be ".concat(ns, ", Actual: ").concat(e));
|
4202
4222
|
}
|
4203
|
-
var
|
4204
|
-
function
|
4205
|
-
_classCallCheck(this,
|
4223
|
+
var w = /*#__PURE__*/function () {
|
4224
|
+
function w() {
|
4225
|
+
_classCallCheck(this, w);
|
4206
4226
|
}
|
4207
|
-
return _createClass(
|
4227
|
+
return _createClass(w, null, [{
|
4208
4228
|
key: "request",
|
4209
4229
|
value: // prettier-ignore
|
4210
4230
|
function () {
|
@@ -4259,13 +4279,13 @@ var A = /*#__PURE__*/function () {
|
|
4259
4279
|
}
|
4260
4280
|
return _context7.abrupt("return", ye.requestStream(i, e));
|
4261
4281
|
case 15:
|
4262
|
-
d = new
|
4282
|
+
d = new we(i, e.stream), u = E.fetch.bind(this, e, l, s), h = {
|
4263
4283
|
method: ((g = e.connectSettings) == null ? void 0 : g.method) || "POST",
|
4264
4284
|
headers: l,
|
4265
4285
|
credentials: (b = e.connectSettings) == null ? void 0 : b.credentials,
|
4266
4286
|
body: s ? JSON.stringify(a) : a
|
4267
4287
|
};
|
4268
|
-
return _context7.abrupt("return", (_typeof(e.stream) == "object" && e.stream.readable ?
|
4288
|
+
return _context7.abrupt("return", (_typeof(e.stream) == "object" && e.stream.readable ? w.handleReadableStream(e, i, d, h, r, u, a) : w.handleEventStream(e, i, d, h, r, u, a), d));
|
4269
4289
|
case 17:
|
4270
4290
|
case "end":
|
4271
4291
|
return _context7.stop();
|
@@ -4316,7 +4336,7 @@ var A = /*#__PURE__*/function () {
|
|
4316
4336
|
_context8.next = 15;
|
4317
4337
|
break;
|
4318
4338
|
}
|
4319
|
-
|
4339
|
+
w.handleClose(e, i, c, r);
|
4320
4340
|
_context8.next = 24;
|
4321
4341
|
break;
|
4322
4342
|
case 15:
|
@@ -4337,7 +4357,7 @@ var A = /*#__PURE__*/function () {
|
|
4337
4357
|
Ee = _typeof(Re) == "object" ? Re : {
|
4338
4358
|
text: ae
|
4339
4359
|
};
|
4340
|
-
|
4360
|
+
w.handleMessage(e, t, i, c, Ee, o, a);
|
4341
4361
|
case 24:
|
4342
4362
|
_context8.next = 5;
|
4343
4363
|
break;
|
@@ -4351,7 +4371,7 @@ var A = /*#__PURE__*/function () {
|
|
4351
4371
|
return _ref5.apply(this, arguments);
|
4352
4372
|
};
|
4353
4373
|
}())["catch"](function (f) {
|
4354
|
-
|
4374
|
+
w.handleError(e, t, f);
|
4355
4375
|
}), d.abort = function () {
|
4356
4376
|
u = !0;
|
4357
4377
|
};
|
@@ -4416,7 +4436,7 @@ var A = /*#__PURE__*/function () {
|
|
4416
4436
|
_context0.t0 = p;
|
4417
4437
|
case 7:
|
4418
4438
|
g = _context0.t0;
|
4419
|
-
|
4439
|
+
w.handleMessage(e, t, i, c, g, o, a);
|
4420
4440
|
case 9:
|
4421
4441
|
case "end":
|
4422
4442
|
return _context0.stop();
|
@@ -4428,11 +4448,11 @@ var A = /*#__PURE__*/function () {
|
|
4428
4448
|
throw c(), h;
|
4429
4449
|
},
|
4430
4450
|
onclose: function onclose() {
|
4431
|
-
|
4451
|
+
w.handleClose(e, i, c, r);
|
4432
4452
|
},
|
4433
4453
|
signal: d.signal
|
4434
4454
|
}))["catch"](function (h) {
|
4435
|
-
|
4455
|
+
w.handleError(e, t, h);
|
4436
4456
|
});
|
4437
4457
|
}
|
4438
4458
|
//prettier-ignore
|
@@ -4441,7 +4461,7 @@ var A = /*#__PURE__*/function () {
|
|
4441
4461
|
value: function handleMessage(e, t, i, s, r, o, a) {
|
4442
4462
|
var l;
|
4443
4463
|
(l = e.extractResultData) == null || l.call(e, r, o, a).then(function (c) {
|
4444
|
-
e.asyncCallInProgress && c && c.text !== "" ? (
|
4464
|
+
e.asyncCallInProgress && c && c.text !== "" ? (w.simulate(t, e.streamHandlers, c), s(), e.asyncCallInProgress = !1) : w.upsertWFiles(t, i.upsertStreamedMessage.bind(i), i, c);
|
4445
4465
|
})["catch"](function (c) {
|
4446
4466
|
return E.displayError(t, c);
|
4447
4467
|
});
|
@@ -4471,7 +4491,7 @@ var A = /*#__PURE__*/function () {
|
|
4471
4491
|
key: "simulate",
|
4472
4492
|
value: function () {
|
4473
4493
|
var _simulate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(e, t, i, s) {
|
4474
|
-
var r, o, _o2, a, _o3;
|
4494
|
+
var r, o, _o2, a, _o3, _a2;
|
4475
4495
|
return _regeneratorRuntime().wrap(function _callee1$(_context1) {
|
4476
4496
|
while (1) switch (_context1.prev = _context1.next) {
|
4477
4497
|
case 0:
|
@@ -4507,13 +4527,15 @@ var A = /*#__PURE__*/function () {
|
|
4507
4527
|
case 10:
|
4508
4528
|
if (i.text) {
|
4509
4529
|
t.onOpen();
|
4510
|
-
_o2 = i.text.split(""), a = new
|
4511
|
-
|
4530
|
+
_o2 = i.text.split(""), a = new we(e, s == null ? void 0 : s.stream);
|
4531
|
+
w.populateMessages(e, _o2, a, r, "text", 0, s);
|
4512
4532
|
}
|
4513
4533
|
if (i.html) {
|
4514
4534
|
t.onOpen();
|
4515
|
-
_o3 =
|
4516
|
-
_o3.length === 0 && (_o3 = i.html.split(""))
|
4535
|
+
_o3 = G.splitHTML(i.html);
|
4536
|
+
_o3.length === 0 && (_o3 = i.html.split(""));
|
4537
|
+
_a2 = new we(e, s == null ? void 0 : s.stream);
|
4538
|
+
w.populateMessages(e, _o3, _a2, r, "html", 0, s);
|
4517
4539
|
}
|
4518
4540
|
i.error && (E.displayError(e, i.error), t.onClose());
|
4519
4541
|
case 13:
|
@@ -4547,12 +4569,12 @@ var A = /*#__PURE__*/function () {
|
|
4547
4569
|
});
|
4548
4570
|
case 4:
|
4549
4571
|
c = _context10.sent;
|
4550
|
-
|
4572
|
+
w.upsertWFiles(e, i.upsertStreamedMessage.bind(i), i, c);
|
4551
4573
|
d = setTimeout(function () {
|
4552
|
-
|
4574
|
+
w.populateMessages(e, t, i, s, r, o + 1, a);
|
4553
4575
|
}, s.simulationInterim || 6);
|
4554
4576
|
s.abortStream.abort = function () {
|
4555
|
-
|
4577
|
+
w.abort(d, i, s.onClose);
|
4556
4578
|
};
|
4557
4579
|
_context10.next = 11;
|
4558
4580
|
break;
|
@@ -4577,7 +4599,7 @@ var A = /*#__PURE__*/function () {
|
|
4577
4599
|
}, {
|
4578
4600
|
key: "isSimulatable",
|
4579
4601
|
value: function isSimulatable(e, t) {
|
4580
|
-
return
|
4602
|
+
return w.isSimulation(e) && t && (t.text || t.html);
|
4581
4603
|
}
|
4582
4604
|
}, {
|
4583
4605
|
key: "abort",
|
@@ -4655,7 +4677,7 @@ var Ze = /*#__PURE__*/function () {
|
|
4655
4677
|
r = Array.isArray(s) ? s : [s], o = r.find(function (a) {
|
4656
4678
|
return typeof a.error == "string";
|
4657
4679
|
});
|
4658
|
-
o ? (t.addNewErrorMessage("service", o.error), e.completionsHandlers.onFinish()) :
|
4680
|
+
o ? (t.addNewErrorMessage("service", o.error), e.completionsHandlers.onFinish()) : w.isSimulatable(e.stream, s) ? w.simulate(t, e.streamHandlers, s) : (r.forEach(function (a) {
|
4659
4681
|
return t.addNewMessage(a);
|
4660
4682
|
}), e.completionsHandlers.onFinish());
|
4661
4683
|
case 7:
|
@@ -4671,18 +4693,18 @@ var Ze = /*#__PURE__*/function () {
|
|
4671
4693
|
value: function requestStream(e, t) {
|
4672
4694
|
setTimeout(function () {
|
4673
4695
|
var i = Ze.getResponse(e);
|
4674
|
-
|
4696
|
+
w.simulate(e, t.streamHandlers, i, t);
|
4675
4697
|
}, 400);
|
4676
4698
|
}
|
4677
4699
|
}]);
|
4678
4700
|
}();
|
4679
4701
|
Ze.URL = "deep-chat-demo";
|
4680
4702
|
var ye = Ze;
|
4681
|
-
var
|
4682
|
-
function
|
4683
|
-
_classCallCheck(this,
|
4703
|
+
var q = /*#__PURE__*/function () {
|
4704
|
+
function q() {
|
4705
|
+
_classCallCheck(this, q);
|
4684
4706
|
}
|
4685
|
-
return _createClass(
|
4707
|
+
return _createClass(q, null, [{
|
4686
4708
|
key: "setup",
|
4687
4709
|
value: function setup(e) {
|
4688
4710
|
e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending";
|
@@ -4697,7 +4719,7 @@ var H = /*#__PURE__*/function () {
|
|
4697
4719
|
}, {
|
4698
4720
|
key: "createConnection",
|
4699
4721
|
value: function createConnection(e, t) {
|
4700
|
-
if (!
|
4722
|
+
if (!q.isElementPresentInDOM(e.deepChat)) return;
|
4701
4723
|
var i = e.connectSettings.websocket;
|
4702
4724
|
if (i) {
|
4703
4725
|
if (e.connectSettings.handler) return ve.websocket(e, t);
|
@@ -4706,12 +4728,12 @@ var H = /*#__PURE__*/function () {
|
|
4706
4728
|
r = new WebSocket(e.connectSettings.url || "", s);
|
4707
4729
|
e.websocket = r, e.websocket.onopen = function () {
|
4708
4730
|
var o, a;
|
4709
|
-
t.removeError(), e.websocket && _typeof(e.websocket) == "object" &&
|
4731
|
+
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && q.assignListeners(e, r, t), (a = (o = e.deepChat)._validationHandler) == null || a.call(o);
|
4710
4732
|
}, e.websocket.onerror = function (o) {
|
4711
|
-
console.error(o),
|
4733
|
+
console.error(o), q.retryConnection(e, t);
|
4712
4734
|
};
|
4713
4735
|
} catch (s) {
|
4714
|
-
console.error(s),
|
4736
|
+
console.error(s), q.retryConnection(e, t);
|
4715
4737
|
}
|
4716
4738
|
}
|
4717
4739
|
}
|
@@ -4719,8 +4741,8 @@ var H = /*#__PURE__*/function () {
|
|
4719
4741
|
key: "retryConnection",
|
4720
4742
|
value: function retryConnection(e, t) {
|
4721
4743
|
var i, s;
|
4722
|
-
(s = (i = e.deepChat)._validationHandler) == null || s.call(i),
|
4723
|
-
|
4744
|
+
(s = (i = e.deepChat)._validationHandler) == null || s.call(i), q.isElementPresentInDOM(e.deepChat) && (e.websocket = "pending", t.isLastMessageError() || t.addNewErrorMessage("service", "Connection error"), setTimeout(function () {
|
4745
|
+
q.createConnection(e, t);
|
4724
4746
|
}, 5e3));
|
4725
4747
|
}
|
4726
4748
|
}, {
|
@@ -4753,12 +4775,12 @@ var H = /*#__PURE__*/function () {
|
|
4753
4775
|
}
|
4754
4776
|
throw Error(k.INVALID_RESPONSE(o, "server", !!e.deepChat.responseInterceptor, a));
|
4755
4777
|
case 8:
|
4756
|
-
if (!
|
4778
|
+
if (!w.isSimulation(e.stream)) {
|
4757
4779
|
_context12.next = 13;
|
4758
4780
|
break;
|
4759
4781
|
}
|
4760
|
-
l =
|
4761
|
-
|
4782
|
+
l = q.stream.bind(_this8, e, i, s), c = s[o.role || y.AI_ROLE];
|
4783
|
+
w.upsertWFiles(i, l, c, a);
|
4762
4784
|
_context12.next = 17;
|
4763
4785
|
break;
|
4764
4786
|
case 13:
|
@@ -4791,7 +4813,7 @@ var H = /*#__PURE__*/function () {
|
|
4791
4813
|
return _ref8.apply(this, arguments);
|
4792
4814
|
};
|
4793
4815
|
}(), t.onclose = function () {
|
4794
|
-
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(),
|
4816
|
+
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(), q.createConnection(e, i);
|
4795
4817
|
};
|
4796
4818
|
}
|
4797
4819
|
}, {
|
@@ -4841,7 +4863,7 @@ var H = /*#__PURE__*/function () {
|
|
4841
4863
|
}
|
4842
4864
|
return _context13.abrupt("return", i.addNewErrorMessage("service", l));
|
4843
4865
|
case 14:
|
4844
|
-
if (
|
4866
|
+
if (q.isWebSocket(r)) {
|
4845
4867
|
_context13.next = 16;
|
4846
4868
|
break;
|
4847
4869
|
}
|
@@ -4863,7 +4885,7 @@ var H = /*#__PURE__*/function () {
|
|
4863
4885
|
}, {
|
4864
4886
|
key: "canSendMessage",
|
4865
4887
|
value: function canSendMessage(e) {
|
4866
|
-
return e ? e === "pending" ? !1 :
|
4888
|
+
return e ? e === "pending" ? !1 : q.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
|
4867
4889
|
}
|
4868
4890
|
// if false then it is the internal websocket handler
|
4869
4891
|
}, {
|
@@ -4880,8 +4902,8 @@ var H = /*#__PURE__*/function () {
|
|
4880
4902
|
var _i$o;
|
4881
4903
|
var o = s.role || y.AI_ROLE,
|
4882
4904
|
a = i[o];
|
4883
|
-
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
|
4884
|
-
} else
|
4905
|
+
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 we(t, e.stream), i[o].upsertStreamedMessage(s));
|
4906
|
+
} else w.simulate(t, e.streamHandlers, s);
|
4885
4907
|
}
|
4886
4908
|
}]);
|
4887
4909
|
}();
|
@@ -4922,7 +4944,7 @@ var ve = /*#__PURE__*/function () {
|
|
4922
4944
|
u = Array.isArray(d) ? d : [d], h = u.find(function (f) {
|
4923
4945
|
return typeof f.error == "string";
|
4924
4946
|
});
|
4925
|
-
h ? (console.error(h.error), i.addNewErrorMessage("service", h.error), e.completionsHandlers.onFinish()) :
|
4947
|
+
h ? (console.error(h.error), i.addNewErrorMessage("service", h.error), e.completionsHandlers.onFinish()) : w.isSimulatable(e.stream, d) ? w.simulate(i, e.streamHandlers, d) : (u.forEach(function (f) {
|
4926
4948
|
return i.addNewMessage(f);
|
4927
4949
|
}), e.completionsHandlers.onFinish());
|
4928
4950
|
}
|
@@ -4967,7 +4989,7 @@ var ve = /*#__PURE__*/function () {
|
|
4967
4989
|
var u, h;
|
4968
4990
|
var s = !0,
|
4969
4991
|
r = !1;
|
4970
|
-
var o = new
|
4992
|
+
var o = new we(i, e.stream),
|
4971
4993
|
a = function a() {
|
4972
4994
|
r || !s || (e.streamHandlers.onOpen(), r = !0);
|
4973
4995
|
},
|
@@ -4993,7 +5015,7 @@ var ve = /*#__PURE__*/function () {
|
|
4993
5015
|
});
|
4994
5016
|
case 4:
|
4995
5017
|
m = _context16.sent;
|
4996
|
-
if (m) m.error ? (ve.streamError(m.error, o, e, i), s = !1) :
|
5018
|
+
if (m) m.error ? (ve.streamError(m.error, o, e, i), s = !1) : w.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, m);else {
|
4997
5019
|
p = k.INVALID_RESPONSE(f, "server", !!e.deepChat.responseInterceptor, m);
|
4998
5020
|
ve.streamError(p, o, e, i), s = !1;
|
4999
5021
|
}
|
@@ -5066,9 +5088,9 @@ var ve = /*#__PURE__*/function () {
|
|
5066
5088
|
h = Array.isArray(u) ? u : [u], f = h.find(function (m) {
|
5067
5089
|
return typeof m.error == "string";
|
5068
5090
|
});
|
5069
|
-
if (f) console.error(f.error), t.isLastMessageError() || t.addNewErrorMessage("service", f.error);else if (
|
5070
|
-
m = u, p =
|
5071
|
-
|
5091
|
+
if (f) console.error(f.error), t.isLastMessageError() || t.addNewErrorMessage("service", f.error);else if (w.isSimulation(e.stream)) {
|
5092
|
+
m = u, p = q.stream.bind(_this9, e, t, i.roleToStream), g = i.roleToStream[m.role || y.AI_ROLE];
|
5093
|
+
w.upsertWFiles(t, p, g, m);
|
5072
5094
|
} else h.forEach(function (m) {
|
5073
5095
|
return t.addNewMessage(m);
|
5074
5096
|
});
|
@@ -5208,7 +5230,7 @@ var R = /*#__PURE__*/function () {
|
|
5208
5230
|
}
|
5209
5231
|
throw Error(k.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, g));
|
5210
5232
|
case 15:
|
5211
|
-
b.makingAnotherRequest || (
|
5233
|
+
b.makingAnotherRequest || (w.isSimulatable(e.stream, b) ? w.simulate(i, e.streamHandlers, b) : ((Array.isArray(b) ? b : [b]).forEach(function (ae) {
|
5212
5234
|
return i.addNewMessage(ae);
|
5213
5235
|
}), c()));
|
5214
5236
|
case 16:
|
@@ -5270,7 +5292,7 @@ var R = /*#__PURE__*/function () {
|
|
5270
5292
|
a = _context20.sent;
|
5271
5293
|
a.timeoutMS ? setTimeout(function () {
|
5272
5294
|
R.executePollRequest(e, t, i, s);
|
5273
|
-
}, a.timeoutMS) :
|
5295
|
+
}, a.timeoutMS) : w.isSimulatable(e.stream, a) ? w.simulate(s, e.streamHandlers, a) : (s.addNewMessage(a), r());
|
5274
5296
|
case 13:
|
5275
5297
|
case "end":
|
5276
5298
|
return _context20.stop();
|
@@ -5381,7 +5403,7 @@ var ze = /*#__PURE__*/function () {
|
|
5381
5403
|
this._messages.removeMessage(t), ze.displayIntroMessages(this._messages.messageElementRefs), i.forEach(function (s) {
|
5382
5404
|
return _this0._messages.addAnyMessage(s, !0);
|
5383
5405
|
}), setTimeout(function () {
|
5384
|
-
return
|
5406
|
+
return V.scrollToBottom(_this0._messages.elementRef);
|
5385
5407
|
}, 0);
|
5386
5408
|
case 5:
|
5387
5409
|
case "end":
|
@@ -5512,7 +5534,7 @@ var ze = /*#__PURE__*/function () {
|
|
5512
5534
|
i = _context25.sent;
|
5513
5535
|
s = this._messages.elementRef.scrollTop;
|
5514
5536
|
this.populateMessages(t, i), s === 0 && setTimeout(function () {
|
5515
|
-
return
|
5537
|
+
return V.scrollToBottom(_this12._messages.elementRef);
|
5516
5538
|
}, 0);
|
5517
5539
|
_context25.next = 13;
|
5518
5540
|
break;
|
@@ -5572,12 +5594,12 @@ var ze = /*#__PURE__*/function () {
|
|
5572
5594
|
}]);
|
5573
5595
|
}();
|
5574
5596
|
ze.FAILED_ERROR_MESSAGE = "Failed to load history";
|
5575
|
-
var
|
5576
|
-
var
|
5577
|
-
function
|
5578
|
-
_classCallCheck(this,
|
5597
|
+
var si = ze;
|
5598
|
+
var yt = /*#__PURE__*/function () {
|
5599
|
+
function yt() {
|
5600
|
+
_classCallCheck(this, yt);
|
5579
5601
|
}
|
5580
|
-
return _createClass(
|
5602
|
+
return _createClass(yt, null, [{
|
5581
5603
|
key: "getCharacterLimitMessages",
|
5582
5604
|
value: function getCharacterLimitMessages(e, t) {
|
5583
5605
|
var r;
|
@@ -5604,7 +5626,7 @@ var vt = /*#__PURE__*/function () {
|
|
5604
5626
|
}, {
|
5605
5627
|
key: "processMessages",
|
5606
5628
|
value: function processMessages(e, t, i) {
|
5607
|
-
return t !== void 0 ? t > 0 && (e =
|
5629
|
+
return t !== void 0 ? t > 0 && (e = yt.getMaxMessages(e, t)) : e = [e[e.length - 1]], e = JSON.parse(JSON.stringify(e)), i === void 0 ? e : yt.getCharacterLimitMessages(e, i);
|
5608
5630
|
}
|
5609
5631
|
}]);
|
5610
5632
|
}();
|
@@ -5721,7 +5743,7 @@ var rt = /*#__PURE__*/function () {
|
|
5721
5743
|
var _a$url;
|
5722
5744
|
_classCallCheck(this, rt);
|
5723
5745
|
var s, r, o, a, l;
|
5724
|
-
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = rt.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, B.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = ye.URL), this.connectSettings.websocket &&
|
5746
|
+
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = rt.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, B.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = ye.URL), this.connectSettings.websocket && q.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || te.checkForStream(this.deepChat), e.loadHistory && si.addErrorPrefix(this);
|
5725
5747
|
}
|
5726
5748
|
return _createClass(rt, [{
|
5727
5749
|
key: "verifyKey",
|
@@ -5747,7 +5769,7 @@ var rt = /*#__PURE__*/function () {
|
|
5747
5769
|
while (1) switch (_context27.prev = _context27.next) {
|
5748
5770
|
case 0:
|
5749
5771
|
i = _args27.length > 2 && _args27[2] !== undefined ? _args27[2] : !0;
|
5750
|
-
return _context27.abrupt("return", this.stream && !
|
5772
|
+
return _context27.abrupt("return", this.stream && !w.isSimulation(this.stream) ? w.request(this, e, t, i) : R.request(this, e, t, i));
|
5751
5773
|
case 2:
|
5752
5774
|
case "end":
|
5753
5775
|
return _context27.stop();
|
@@ -5846,7 +5868,7 @@ var rt = /*#__PURE__*/function () {
|
|
5846
5868
|
}
|
5847
5869
|
throw new Error("Request settings have not been set up");
|
5848
5870
|
case 2:
|
5849
|
-
i =
|
5871
|
+
i = yt.processMessages(t.messageToElements.map(function (_ref13) {
|
5850
5872
|
var _ref14 = _slicedToArray(_ref13, 1),
|
5851
5873
|
s = _ref14[0];
|
5852
5874
|
return s;
|
@@ -5855,7 +5877,7 @@ var rt = /*#__PURE__*/function () {
|
|
5855
5877
|
s = _objectSpread({
|
5856
5878
|
messages: i
|
5857
5879
|
}, this.rawBody);
|
5858
|
-
|
5880
|
+
q.sendWebsocket(this, s, t, !1);
|
5859
5881
|
} else this.callServiceAPI(t, i, e.files);
|
5860
5882
|
case 4:
|
5861
5883
|
case "end":
|
@@ -5935,17 +5957,17 @@ var rt = /*#__PURE__*/function () {
|
|
5935
5957
|
}
|
5936
5958
|
}]);
|
5937
5959
|
}();
|
5938
|
-
var
|
5960
|
+
var K = /*#__PURE__*/function (_rt) {
|
5939
5961
|
// prettier-ignore
|
5940
|
-
function
|
5962
|
+
function K(e, t, i, s, r) {
|
5941
5963
|
var _this13;
|
5942
|
-
_classCallCheck(this,
|
5964
|
+
_classCallCheck(this, K);
|
5943
5965
|
var o;
|
5944
|
-
_this13 = _callSuper(this,
|
5966
|
+
_this13 = _callSuper(this, K, [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);
|
5945
5967
|
return _this13;
|
5946
5968
|
}
|
5947
|
-
_inherits(
|
5948
|
-
return _createClass(
|
5969
|
+
_inherits(K, _rt);
|
5970
|
+
return _createClass(K, [{
|
5949
5971
|
key: "setApiKeyProperties",
|
5950
5972
|
value: function setApiKeyProperties(e) {
|
5951
5973
|
this.key = e.key, e.validateKeyProperty && (this.validateKeyProperty = e.validateKeyProperty);
|
@@ -6092,11 +6114,11 @@ var Ge = /*#__PURE__*/function () {
|
|
6092
6114
|
}();
|
6093
6115
|
Ge.VISIBLE_ICON_ID = "visible-icon";
|
6094
6116
|
var os = Ge;
|
6095
|
-
var
|
6096
|
-
function
|
6097
|
-
_classCallCheck(this,
|
6117
|
+
var W = /*#__PURE__*/function () {
|
6118
|
+
function W() {
|
6119
|
+
_classCallCheck(this, W);
|
6098
6120
|
}
|
6099
|
-
return _createClass(
|
6121
|
+
return _createClass(W, null, [{
|
6100
6122
|
key: "createCautionText",
|
6101
6123
|
value: function createCautionText() {
|
6102
6124
|
var e = document.createElement("a");
|
@@ -6122,13 +6144,13 @@ var K = /*#__PURE__*/function () {
|
|
6122
6144
|
i.id = "insert-key-help-text-container";
|
6123
6145
|
var s = document.createElement("div");
|
6124
6146
|
s.id = "insert-key-help-text-contents";
|
6125
|
-
var r =
|
6147
|
+
var r = W.createFailText();
|
6126
6148
|
if (s.appendChild(r), e) {
|
6127
|
-
var o =
|
6149
|
+
var o = W.createHelpLink(e);
|
6128
6150
|
s.appendChild(o);
|
6129
6151
|
}
|
6130
6152
|
if (t === !0) {
|
6131
|
-
var _o4 =
|
6153
|
+
var _o4 = W.createCautionText();
|
6132
6154
|
s.appendChild(_o4);
|
6133
6155
|
}
|
6134
6156
|
return i.appendChild(s), {
|
@@ -6159,10 +6181,10 @@ var K = /*#__PURE__*/function () {
|
|
6159
6181
|
value: function addVerificationEvents(e, t, i, s, r) {
|
6160
6182
|
var o = {
|
6161
6183
|
onSuccess: s,
|
6162
|
-
onFail:
|
6163
|
-
onLoad:
|
6184
|
+
onFail: W.onFail.bind(this, e, t, i),
|
6185
|
+
onLoad: W.onLoad.bind(this, e, t)
|
6164
6186
|
},
|
6165
|
-
a =
|
6187
|
+
a = W.verifyKey.bind(this, e, o, r);
|
6166
6188
|
t.onclick = a, e.onkeydown = function (l) {
|
6167
6189
|
!e.classList.contains("loading") && l.key === U.ENTER && a();
|
6168
6190
|
};
|
@@ -6184,7 +6206,7 @@ var K = /*#__PURE__*/function () {
|
|
6184
6206
|
var t = document.createElement("div");
|
6185
6207
|
t.id = "insert-key-input-container";
|
6186
6208
|
var i = document.createElement("input");
|
6187
|
-
return i.id = "insert-key-input", i.placeholder = e || "API Key", i.type = "password", i.classList.add("insert-key-input-valid"), i.onfocus =
|
6209
|
+
return i.id = "insert-key-input", i.placeholder = e || "API Key", i.type = "password", i.classList.add("insert-key-input-valid"), i.onfocus = W.onInputFocus, t.appendChild(i), t;
|
6188
6210
|
}
|
6189
6211
|
// prettier-ignore
|
6190
6212
|
}, {
|
@@ -6193,28 +6215,28 @@ var K = /*#__PURE__*/function () {
|
|
6193
6215
|
var d;
|
6194
6216
|
var i = document.createElement("div");
|
6195
6217
|
i.id = "insert-key-contents";
|
6196
|
-
var s =
|
6218
|
+
var s = W.createInput(t.insertKeyPlaceholderText),
|
6197
6219
|
r = s.children[0],
|
6198
6220
|
o = os.create(r);
|
6199
6221
|
s.appendChild(o), i.appendChild(s);
|
6200
|
-
var a =
|
6201
|
-
|
6202
|
-
l =
|
6203
|
-
c =
|
6204
|
-
return i.appendChild(a), i.appendChild(l),
|
6222
|
+
var a = W.createStartButton(),
|
6223
|
+
_W$createHelpTextCont = W.createHelpTextContainer(t.keyHelpUrl, (d = t.deepChat._insertKeyViewStyles) == null ? void 0 : d.displayCautionText),
|
6224
|
+
l = _W$createHelpTextCont.helpTextContainerElement,
|
6225
|
+
c = _W$createHelpTextCont.failTextElement;
|
6226
|
+
return i.appendChild(a), i.appendChild(l), W.addVerificationEvents(r, a, c, e, t), i;
|
6205
6227
|
}
|
6206
6228
|
}, {
|
6207
6229
|
key: "createElements",
|
6208
6230
|
value: function createElements(e, t) {
|
6209
6231
|
var i = document.createElement("div");
|
6210
6232
|
i.id = "insert-key-view";
|
6211
|
-
var s =
|
6233
|
+
var s = W.createContents(e, t);
|
6212
6234
|
return i.appendChild(s), i;
|
6213
6235
|
}
|
6214
6236
|
}, {
|
6215
6237
|
key: "render",
|
6216
6238
|
value: function render(e, t, i) {
|
6217
|
-
var s =
|
6239
|
+
var s = W.createElements(t, i);
|
6218
6240
|
e.replaceChildren(s);
|
6219
6241
|
}
|
6220
6242
|
}]);
|
@@ -6227,7 +6249,7 @@ var se = /*#__PURE__*/function () {
|
|
6227
6249
|
key: "enableButtons",
|
6228
6250
|
value: function enableButtons(e, t) {
|
6229
6251
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
6230
|
-
window.webLLM ? (e && (e.disabled = !1), t && (t.disabled = !1)) : i <
|
6252
|
+
window.webLLM ? (e && (e.disabled = !1), t && (t.disabled = !1)) : i < ni.MODULE_SEARCH_LIMIT_S * 4 && setTimeout(function () {
|
6231
6253
|
return se.enableButtons(e, t, i + 1);
|
6232
6254
|
}, 250);
|
6233
6255
|
}
|
@@ -6452,7 +6474,7 @@ var Xs = {
|
|
6452
6474
|
var t;
|
6453
6475
|
((t = this._webModel.introMessage) == null ? void 0 : t.autoScroll) !== !1 && setTimeout(function () {
|
6454
6476
|
var i, s;
|
6455
|
-
(i = _this18._messages) != null && i.elementRef &&
|
6477
|
+
(i = _this18._messages) != null && i.elementRef && V.scrollToTop((s = _this18._messages) == null ? void 0 : s.elementRef);
|
6456
6478
|
}, e);
|
6457
6479
|
}
|
6458
6480
|
// prettier-ignore
|
@@ -6584,7 +6606,7 @@ var Xs = {
|
|
6584
6606
|
sendUpdate: !1
|
6585
6607
|
}), i && (setTimeout(function () {
|
6586
6608
|
var p;
|
6587
|
-
return
|
6609
|
+
return V.scrollToBottom((p = _this19._messages) == null ? void 0 : p.elementRef);
|
6588
6610
|
}), i = !1);
|
6589
6611
|
};
|
6590
6612
|
T.chat.setInitProgressCallback(s);
|
@@ -6702,7 +6724,7 @@ var Xs = {
|
|
6702
6724
|
this.streamHandlers.abortStream.abort = function () {
|
6703
6725
|
i.interruptGenerate();
|
6704
6726
|
}, this.streamHandlers.onOpen();
|
6705
|
-
s = new
|
6727
|
+
s = new we(e);
|
6706
6728
|
_context39.next = 4;
|
6707
6729
|
return i.generate(t, /*#__PURE__*/function () {
|
6708
6730
|
var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(r, o) {
|
@@ -6959,7 +6981,7 @@ var Xs = {
|
|
6959
6981
|
}]);
|
6960
6982
|
}(rt);
|
6961
6983
|
T.GENERIC_ERROR = "Error, please check the [troubleshooting](https://deepchat.dev/docs/webModel#troubleshooting) section of documentation for help.", T.MULTIPLE_MODELS_ERROR = "Cannot run multiple web models", T.WEB_LLM_NOT_FOUND_ERROR = "WebLLM module not found", T.DEFAULT_MODEL = "Llama-2-7b-chat-hf-q4f32_1", T.MODULE_SEARCH_LIMIT_S = 5;
|
6962
|
-
var
|
6984
|
+
var ni = T;
|
6963
6985
|
var xi = /*#__PURE__*/function () {
|
6964
6986
|
function xi() {
|
6965
6987
|
_classCallCheck(this, xi);
|
@@ -6991,7 +7013,7 @@ var xi = /*#__PURE__*/function () {
|
|
6991
7013
|
}
|
6992
7014
|
}]);
|
6993
7015
|
}();
|
6994
|
-
var Jt = /*#__PURE__*/function (
|
7016
|
+
var Jt = /*#__PURE__*/function (_K) {
|
6995
7017
|
// prettier-ignore
|
6996
7018
|
function Jt(e, t, i, s, r, o) {
|
6997
7019
|
var _this21;
|
@@ -7000,7 +7022,7 @@ var Jt = /*#__PURE__*/function (_V) {
|
|
7000
7022
|
return _this21;
|
7001
7023
|
}
|
7002
7024
|
// prettier-ignore
|
7003
|
-
_inherits(Jt,
|
7025
|
+
_inherits(Jt, _K);
|
7004
7026
|
return _createClass(Jt, [{
|
7005
7027
|
key: "preprocessBody",
|
7006
7028
|
value: function preprocessBody(e, t, i) {
|
@@ -7039,19 +7061,19 @@ var Jt = /*#__PURE__*/function (_V) {
|
|
7039
7061
|
return callServiceAPI;
|
7040
7062
|
}()
|
7041
7063
|
}]);
|
7042
|
-
}(
|
7064
|
+
}(K);
|
7043
7065
|
Jt.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
7044
7066
|
var je = Jt;
|
7045
|
-
var
|
7067
|
+
var ci = /*#__PURE__*/function (_je) {
|
7046
7068
|
// prettier-ignore
|
7047
|
-
function
|
7069
|
+
function ci(e, t, i, s, r, o) {
|
7048
7070
|
var _this22;
|
7049
|
-
_classCallCheck(this,
|
7050
|
-
_this22 = _callSuper(this,
|
7071
|
+
_classCallCheck(this, ci);
|
7072
|
+
_this22 = _callSuper(this, ci, [e, t, i, s, r, o]), _this22.isTextInputDisabled = !0, _this22.canSendMessage = ci.canSendFile;
|
7051
7073
|
return _this22;
|
7052
7074
|
}
|
7053
|
-
_inherits(
|
7054
|
-
return _createClass(
|
7075
|
+
_inherits(ci, _je);
|
7076
|
+
return _createClass(ci, [{
|
7055
7077
|
key: "preprocessBody",
|
7056
7078
|
value: function preprocessBody(e, t, i) {
|
7057
7079
|
return i[0];
|
@@ -7095,7 +7117,7 @@ var li = /*#__PURE__*/function (_je) {
|
|
7095
7117
|
}
|
7096
7118
|
}]);
|
7097
7119
|
}(je);
|
7098
|
-
var Ho = /*#__PURE__*/function (
|
7120
|
+
var Ho = /*#__PURE__*/function (_ci) {
|
7099
7121
|
// prettier-ignore
|
7100
7122
|
function Ho(e) {
|
7101
7123
|
_classCallCheck(this, Ho);
|
@@ -7106,7 +7128,7 @@ var Ho = /*#__PURE__*/function (_li) {
|
|
7106
7128
|
audio: {}
|
7107
7129
|
}]);
|
7108
7130
|
}
|
7109
|
-
_inherits(Ho,
|
7131
|
+
_inherits(Ho, _ci);
|
7110
7132
|
return _createClass(Ho, [{
|
7111
7133
|
key: "extractPollResultData",
|
7112
7134
|
value: function () {
|
@@ -7144,8 +7166,8 @@ var Ho = /*#__PURE__*/function (_li) {
|
|
7144
7166
|
return extractPollResultData;
|
7145
7167
|
}()
|
7146
7168
|
}]);
|
7147
|
-
}(
|
7148
|
-
var qo = /*#__PURE__*/function (
|
7169
|
+
}(ci);
|
7170
|
+
var qo = /*#__PURE__*/function (_ci2) {
|
7149
7171
|
function qo(e) {
|
7150
7172
|
_classCallCheck(this, qo);
|
7151
7173
|
var s, r, o;
|
@@ -7155,7 +7177,7 @@ var qo = /*#__PURE__*/function (_li2) {
|
|
7155
7177
|
images: {}
|
7156
7178
|
}]);
|
7157
7179
|
}
|
7158
|
-
_inherits(qo,
|
7180
|
+
_inherits(qo, _ci2);
|
7159
7181
|
return _createClass(qo, [{
|
7160
7182
|
key: "extractPollResultData",
|
7161
7183
|
value: function () {
|
@@ -7193,8 +7215,8 @@ var qo = /*#__PURE__*/function (_li2) {
|
|
7193
7215
|
return extractPollResultData;
|
7194
7216
|
}()
|
7195
7217
|
}]);
|
7196
|
-
}(
|
7197
|
-
var
|
7218
|
+
}(ci);
|
7219
|
+
var di = "data:image/png;base64,";
|
7198
7220
|
var Ce = /*#__PURE__*/function () {
|
7199
7221
|
function Ce() {
|
7200
7222
|
_classCallCheck(this, Ce);
|
@@ -7224,7 +7246,7 @@ var Ce = /*#__PURE__*/function () {
|
|
7224
7246
|
}
|
7225
7247
|
}]);
|
7226
7248
|
}();
|
7227
|
-
var zi = /*#__PURE__*/function (
|
7249
|
+
var zi = /*#__PURE__*/function (_K2) {
|
7228
7250
|
// prettier-ignore
|
7229
7251
|
function zi(e, t, i, s, r) {
|
7230
7252
|
var _this23;
|
@@ -7232,13 +7254,13 @@ var zi = /*#__PURE__*/function (_V2) {
|
|
7232
7254
|
_this23 = _callSuper(this, zi, [e, t, i, s, r]), _this23.insertKeyPlaceholderText = "Stability AI API Key", _this23.keyHelpUrl = "https://platform.stability.ai/docs/getting-started/authentication", _this23.permittedErrorPrefixes = ["Incorrect", "invalid_"];
|
7233
7255
|
return _this23;
|
7234
7256
|
}
|
7235
|
-
_inherits(zi,
|
7257
|
+
_inherits(zi, _K2);
|
7236
7258
|
return _createClass(zi);
|
7237
|
-
}(
|
7238
|
-
var
|
7239
|
-
function
|
7259
|
+
}(K);
|
7260
|
+
var Ai = /*#__PURE__*/function (_zi) {
|
7261
|
+
function Ai(e) {
|
7240
7262
|
var _this24;
|
7241
|
-
_classCallCheck(this,
|
7263
|
+
_classCallCheck(this, Ai);
|
7242
7264
|
var o;
|
7243
7265
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7244
7266
|
i = t == null ? void 0 : t.stabilityAI,
|
@@ -7250,13 +7272,13 @@ var wi = /*#__PURE__*/function (_zi) {
|
|
7250
7272
|
}
|
7251
7273
|
}
|
7252
7274
|
};
|
7253
|
-
_this24 = _callSuper(this,
|
7275
|
+
_this24 = _callSuper(this, Ai, [e, Ce.buildKeyVerificationDetails(), Ce.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>";
|
7254
7276
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
7255
|
-
_typeof(r) == "object" && (r.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")),
|
7277
|
+
_typeof(r) == "object" && (r.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), Ai.cleanConfig(r), Object.assign(_this24.rawBody, r)), _this24.canSendMessage = Ai.canSendFileMessage;
|
7256
7278
|
return _this24;
|
7257
7279
|
}
|
7258
|
-
_inherits(
|
7259
|
-
return _createClass(
|
7280
|
+
_inherits(Ai, _zi);
|
7281
|
+
return _createClass(Ai, [{
|
7260
7282
|
key: "createFormDataBody",
|
7261
7283
|
value: function createFormDataBody(e, t) {
|
7262
7284
|
var i = new FormData();
|
@@ -7314,7 +7336,7 @@ var wi = /*#__PURE__*/function (_zi) {
|
|
7314
7336
|
return _context49.abrupt("return", {
|
7315
7337
|
files: e.artifacts.map(function (i) {
|
7316
7338
|
return {
|
7317
|
-
src: "".concat(
|
7339
|
+
src: "".concat(di).concat(i.base64),
|
7318
7340
|
type: "image"
|
7319
7341
|
};
|
7320
7342
|
})
|
@@ -7342,10 +7364,10 @@ var wi = /*#__PURE__*/function (_zi) {
|
|
7342
7364
|
}
|
7343
7365
|
}]);
|
7344
7366
|
}(zi);
|
7345
|
-
var
|
7346
|
-
function
|
7367
|
+
var wi = /*#__PURE__*/function (_zi2) {
|
7368
|
+
function wi(e) {
|
7347
7369
|
var _this25;
|
7348
|
-
_classCallCheck(this,
|
7370
|
+
_classCallCheck(this, wi);
|
7349
7371
|
var o;
|
7350
7372
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7351
7373
|
i = t == null ? void 0 : t.stabilityAI,
|
@@ -7357,13 +7379,13 @@ var Ai = /*#__PURE__*/function (_zi2) {
|
|
7357
7379
|
}
|
7358
7380
|
}
|
7359
7381
|
};
|
7360
|
-
_this25 = _callSuper(this,
|
7382
|
+
_this25 = _callSuper(this, wi, [e, Ce.buildKeyVerificationDetails(), Ce.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>";
|
7361
7383
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
7362
|
-
_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),
|
7384
|
+
_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), wi.cleanConfig(r), Object.assign(_this25.rawBody, r)), _this25.canSendMessage = wi.canSendFileTextMessage;
|
7363
7385
|
return _this25;
|
7364
7386
|
}
|
7365
|
-
_inherits(
|
7366
|
-
return _createClass(
|
7387
|
+
_inherits(wi, _zi2);
|
7388
|
+
return _createClass(wi, [{
|
7367
7389
|
key: "createFormDataBody",
|
7368
7390
|
value: function createFormDataBody(e, t, i, s) {
|
7369
7391
|
var r = new FormData();
|
@@ -7421,7 +7443,7 @@ var Ai = /*#__PURE__*/function (_zi2) {
|
|
7421
7443
|
return _context51.abrupt("return", {
|
7422
7444
|
files: e.artifacts.map(function (i) {
|
7423
7445
|
return {
|
7424
|
-
src: "".concat(
|
7446
|
+
src: "".concat(di).concat(i.base64),
|
7425
7447
|
type: "image"
|
7426
7448
|
};
|
7427
7449
|
})
|
@@ -7449,7 +7471,7 @@ var Ai = /*#__PURE__*/function (_zi2) {
|
|
7449
7471
|
}
|
7450
7472
|
}]);
|
7451
7473
|
}(zi);
|
7452
|
-
var zo = /*#__PURE__*/function (
|
7474
|
+
var zo = /*#__PURE__*/function (_ci3) {
|
7453
7475
|
function zo(e) {
|
7454
7476
|
_classCallCheck(this, zo);
|
7455
7477
|
var s, r, o;
|
@@ -7459,7 +7481,7 @@ var zo = /*#__PURE__*/function (_li3) {
|
|
7459
7481
|
audio: {}
|
7460
7482
|
}]);
|
7461
7483
|
}
|
7462
|
-
_inherits(zo,
|
7484
|
+
_inherits(zo, _ci3);
|
7463
7485
|
return _createClass(zo, [{
|
7464
7486
|
key: "extractPollResultData",
|
7465
7487
|
value: function () {
|
@@ -7496,7 +7518,7 @@ var zo = /*#__PURE__*/function (_li3) {
|
|
7496
7518
|
return extractPollResultData;
|
7497
7519
|
}()
|
7498
7520
|
}]);
|
7499
|
-
}(
|
7521
|
+
}(ci);
|
7500
7522
|
var Go = /*#__PURE__*/function (_je2) {
|
7501
7523
|
function Go(e) {
|
7502
7524
|
_classCallCheck(this, Go);
|
@@ -7790,7 +7812,7 @@ var Ti = /*#__PURE__*/function (_zi3) {
|
|
7790
7812
|
return _context58.abrupt("return", {
|
7791
7813
|
files: e.artifacts.map(function (i) {
|
7792
7814
|
return {
|
7793
|
-
src: "".concat(
|
7815
|
+
src: "".concat(di).concat(i.base64),
|
7794
7816
|
type: "image"
|
7795
7817
|
};
|
7796
7818
|
})
|
@@ -7922,7 +7944,7 @@ var Ci = /*#__PURE__*/function (_zi4) {
|
|
7922
7944
|
return _context61.abrupt("return", {
|
7923
7945
|
files: e.artifacts.map(function (i) {
|
7924
7946
|
return {
|
7925
|
-
src: "".concat(
|
7947
|
+
src: "".concat(di).concat(i.base64),
|
7926
7948
|
type: "image"
|
7927
7949
|
};
|
7928
7950
|
})
|
@@ -8375,12 +8397,12 @@ var ne = /*#__PURE__*/function () {
|
|
8375
8397
|
}();
|
8376
8398
|
ne.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", ne.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.";
|
8377
8399
|
var ke = ne;
|
8378
|
-
var Ve = /*#__PURE__*/function (
|
8400
|
+
var Ve = /*#__PURE__*/function (_K3) {
|
8379
8401
|
// prettier-ignore
|
8380
8402
|
function Ve(e, t, i, s, r, o) {
|
8381
8403
|
var _this31;
|
8382
8404
|
_classCallCheck(this, Ve);
|
8383
|
-
if (_this31 = _callSuper(this, Ve, [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",
|
8405
|
+
if (_this31 = _callSuper(this, Ve, [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", si.FAILED_ERROR_MESSAGE], _this31.shouldFetchHistory = !1, _this31._searchedForThreadId = !1, _this31._config = {}, _this31._newAssistantDetails = {
|
8384
8406
|
model: "gpt-4"
|
8385
8407
|
}, _this31._waitingForStreamResponse = !1, _this31._isSSEStream = !1, _this31.urlSegments = i, _typeof(t) == "object") {
|
8386
8408
|
_this31._config = t;
|
@@ -8393,7 +8415,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8393
8415
|
_this31.maxMessages = 1, _this31._isSSEStream = !!(_this31.stream && (_typeof(_this31.stream) != "object" || !_this31.stream.simulation));
|
8394
8416
|
return _this31;
|
8395
8417
|
}
|
8396
|
-
_inherits(Ve,
|
8418
|
+
_inherits(Ve, _K3);
|
8397
8419
|
return _createClass(Ve, [{
|
8398
8420
|
key: "fetchHistoryFunc",
|
8399
8421
|
value: function () {
|
@@ -8433,7 +8455,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8433
8455
|
key: "processMessage",
|
8434
8456
|
value: function processMessage(e, t) {
|
8435
8457
|
var i = this.totalMessagesMaxCharLength || -1,
|
8436
|
-
s =
|
8458
|
+
s = yt.getCharacterLimitMessages(e, i)[0];
|
8437
8459
|
if (t && t.length > 0) {
|
8438
8460
|
var r = this.filesToolType;
|
8439
8461
|
if (typeof this.filesToolType == "function") {
|
@@ -8447,10 +8469,10 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8447
8469
|
if (r === "code_interpreter") return Ve.processAttachmentsMessage(s, t, "code_interpreter");
|
8448
8470
|
if (t.find(function (_ref21) {
|
8449
8471
|
var a = _ref21.name;
|
8450
|
-
return !
|
8472
|
+
return !H.isImageFileExtension(a);
|
8451
8473
|
})) 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 {
|
8452
|
-
var
|
8453
|
-
if (
|
8474
|
+
var _a3 = Ve.processImageMessage(s, t);
|
8475
|
+
if (_a3) return _a3;
|
8454
8476
|
}
|
8455
8477
|
}
|
8456
8478
|
return {
|
@@ -8889,7 +8911,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8889
8911
|
key: "parseStreamResult",
|
8890
8912
|
value: function () {
|
8891
8913
|
var _parseStreamResult = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e) {
|
8892
|
-
var t, i, s, r, o, a, l, c,
|
8914
|
+
var t, i, s, r, o, a, l, c, _a4, _l2;
|
8893
8915
|
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
8894
8916
|
while (1) switch (_context82.prev = _context82.next) {
|
8895
8917
|
case 0:
|
@@ -8922,10 +8944,10 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8922
8944
|
_context82.next = 13;
|
8923
8945
|
break;
|
8924
8946
|
}
|
8925
|
-
|
8947
|
+
_a4 = e.delta.content.find(function (l) {
|
8926
8948
|
return l.text;
|
8927
8949
|
});
|
8928
|
-
if (!((r =
|
8950
|
+
if (!((r = _a4 == null ? void 0 : _a4.text) != null && r.annotations && _a4.text.annotations.length === 0)) {
|
8929
8951
|
_context82.next = 13;
|
8930
8952
|
break;
|
8931
8953
|
}
|
@@ -8967,7 +8989,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8967
8989
|
e.stream = !0;
|
8968
8990
|
this._waitingForStreamResponse = !0;
|
8969
8991
|
_context83.next = 4;
|
8970
|
-
return
|
8992
|
+
return w.request(this, e, this._messages, !0, !0);
|
8971
8993
|
case 4:
|
8972
8994
|
this._messageStream = _context83.sent;
|
8973
8995
|
case 5:
|
@@ -8985,7 +9007,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8985
9007
|
key: "processImageMessage",
|
8986
9008
|
value: function processImageMessage(e, t) {
|
8987
9009
|
var i = t == null ? void 0 : t.filter(function (s) {
|
8988
|
-
return
|
9010
|
+
return H.isImageFileExtension(s.name);
|
8989
9011
|
}).map(function (s) {
|
8990
9012
|
return {
|
8991
9013
|
type: "image_file",
|
@@ -9022,7 +9044,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
9022
9044
|
};
|
9023
9045
|
}
|
9024
9046
|
}]);
|
9025
|
-
}(
|
9047
|
+
}(K);
|
9026
9048
|
Ve.POLLING_TIMEOUT_MS = 500;
|
9027
9049
|
var Ri = Ve;
|
9028
9050
|
var xs = /*#__PURE__*/function (_Ri) {
|
@@ -9095,17 +9117,17 @@ var Mi = /*#__PURE__*/function () {
|
|
9095
9117
|
}
|
9096
9118
|
}]);
|
9097
9119
|
}();
|
9098
|
-
var
|
9099
|
-
function
|
9120
|
+
var As = /*#__PURE__*/function (_K4) {
|
9121
|
+
function As(e, t, i, s, r) {
|
9100
9122
|
var _this35;
|
9101
|
-
_classCallCheck(this,
|
9102
|
-
_this35 = _callSuper(this,
|
9123
|
+
_classCallCheck(this, As);
|
9124
|
+
_this35 = _callSuper(this, As, [e, Mi.buildKeyVerificationDetails(), Mi.buildHeaders, r]), _this35.insertKeyPlaceholderText = "Cohere API Key", _this35.keyHelpUrl = "https://dashboard.cohere.ai/api-keys", _this35.permittedErrorPrefixes = ["invalid"], _this35.url = t, _this35.textInputPlaceholderText = i, s && _typeof(s) == "object" && Object.assign(_this35.rawBody, s);
|
9103
9125
|
return _this35;
|
9104
9126
|
}
|
9105
|
-
_inherits(
|
9106
|
-
return _createClass(
|
9107
|
-
}(
|
9108
|
-
var Xo = /*#__PURE__*/function (
|
9127
|
+
_inherits(As, _K4);
|
9128
|
+
return _createClass(As);
|
9129
|
+
}(K);
|
9130
|
+
var Xo = /*#__PURE__*/function (_As) {
|
9109
9131
|
function Xo(e) {
|
9110
9132
|
_classCallCheck(this, Xo);
|
9111
9133
|
var s, r, o;
|
@@ -9113,7 +9135,7 @@ var Xo = /*#__PURE__*/function (_ws) {
|
|
9113
9135
|
i = (o = e.directConnection) == null ? void 0 : o.cohere;
|
9114
9136
|
return _callSuper(this, Xo, [e, "https://api.cohere.ai/v1/generate", "Once upon a time", t, i]);
|
9115
9137
|
}
|
9116
|
-
_inherits(Xo,
|
9138
|
+
_inherits(Xo, _As);
|
9117
9139
|
return _createClass(Xo, [{
|
9118
9140
|
key: "preprocessBody",
|
9119
9141
|
value: function preprocessBody(e, t) {
|
@@ -9179,7 +9201,7 @@ var Xo = /*#__PURE__*/function (_ws) {
|
|
9179
9201
|
return extractResultData;
|
9180
9202
|
}()
|
9181
9203
|
}]);
|
9182
|
-
}(
|
9204
|
+
}(As);
|
9183
9205
|
var Is = /*#__PURE__*/function () {
|
9184
9206
|
function Is() {
|
9185
9207
|
_classCallCheck(this, Is);
|
@@ -9213,11 +9235,11 @@ var Is = /*#__PURE__*/function () {
|
|
9213
9235
|
}();
|
9214
9236
|
Is.URL_DETAILS_ERROR_MESSAGE = "Please define the Azure URL Details. [More Information](https://deepchat.dev/docs/directConnection/Azure)";
|
9215
9237
|
var ue = Is;
|
9216
|
-
var
|
9217
|
-
function
|
9238
|
+
var mt = /*#__PURE__*/function (_Ri2) {
|
9239
|
+
function mt(e) {
|
9218
9240
|
var _g$headers;
|
9219
9241
|
var _this36;
|
9220
|
-
_classCallCheck(this,
|
9242
|
+
_classCallCheck(this, mt);
|
9221
9243
|
var c, d, u, h, f, m, p, g;
|
9222
9244
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
9223
9245
|
i = t.azure,
|
@@ -9226,16 +9248,16 @@ var pt = /*#__PURE__*/function (_Ri2) {
|
|
9226
9248
|
o = "".concat((d = s == null ? void 0 : s.urlDetails) == null ? void 0 : d.endpoint, "/openai/"),
|
9227
9249
|
a = "?api-version=".concat((u = s == null ? void 0 : s.urlDetails) == null ? void 0 : u.version),
|
9228
9250
|
l = {
|
9229
|
-
threadsPrefix: "".concat(o).concat(
|
9251
|
+
threadsPrefix: "".concat(o).concat(mt.THREAD_RESOURCE),
|
9230
9252
|
threadsPosfix: a,
|
9231
|
-
newAssistantUrl: "".concat(o).concat(
|
9253
|
+
newAssistantUrl: "".concat(o).concat(mt.NEW_ASSISTANT_RESOURCE).concat(a),
|
9232
9254
|
createMessagePostfix: a,
|
9233
9255
|
listMessagesPostfix: "order=desc&api-version=".concat((h = s == null ? void 0 : s.urlDetails) == null ? void 0 : h.version),
|
9234
9256
|
storeFiles: "".concat(o, "files").concat(a),
|
9235
9257
|
getFilesPrefix: "".concat(o, "files/"),
|
9236
9258
|
getFilesPostfix: "/content".concat(a)
|
9237
9259
|
};
|
9238
|
-
if (_this36 = _callSuper(this,
|
9260
|
+
if (_this36 = _callSuper(this, mt, [e, s == null ? void 0 : s.assistant, l, ue.buildKeyVerificationDetails(r), ue.buildHeaders, i]), _this36.permittedErrorPrefixes = [ue.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") {
|
9239
9261
|
var _ref25 = (p = (m = (f = e.directConnection) == null ? void 0 : f.azure) == null ? void 0 : m.openAI) == null ? void 0 : p.assistant,
|
9240
9262
|
b = _ref25.function_handler,
|
9241
9263
|
M = _ref25.files_tool_type;
|
@@ -9250,12 +9272,12 @@ var pt = /*#__PURE__*/function (_Ri2) {
|
|
9250
9272
|
}));
|
9251
9273
|
return _this36;
|
9252
9274
|
}
|
9253
|
-
_inherits(
|
9254
|
-
return _createClass(
|
9275
|
+
_inherits(mt, _Ri2);
|
9276
|
+
return _createClass(mt);
|
9255
9277
|
}(Ri);
|
9256
|
-
|
9257
|
-
var as =
|
9258
|
-
var Yo = /*#__PURE__*/function (
|
9278
|
+
mt.THREAD_RESOURCE = "threads", mt.NEW_ASSISTANT_RESOURCE = "assistants";
|
9279
|
+
var as = mt;
|
9280
|
+
var Yo = /*#__PURE__*/function (_As2) {
|
9259
9281
|
function Yo(e) {
|
9260
9282
|
_classCallCheck(this, Yo);
|
9261
9283
|
var s, r, o;
|
@@ -9263,7 +9285,7 @@ var Yo = /*#__PURE__*/function (_ws2) {
|
|
9263
9285
|
i = (o = e.directConnection) == null ? void 0 : o.cohere;
|
9264
9286
|
return _callSuper(this, Yo, [e, "https://api.cohere.ai/v1/summarize", "Insert text to summarize", t, i]);
|
9265
9287
|
}
|
9266
|
-
_inherits(Yo,
|
9288
|
+
_inherits(Yo, _As2);
|
9267
9289
|
return _createClass(Yo, [{
|
9268
9290
|
key: "preprocessBody",
|
9269
9291
|
value: function preprocessBody(e, t) {
|
@@ -9328,7 +9350,7 @@ var Yo = /*#__PURE__*/function (_ws2) {
|
|
9328
9350
|
return extractResultData;
|
9329
9351
|
}()
|
9330
9352
|
}]);
|
9331
|
-
}(
|
9353
|
+
}(As);
|
9332
9354
|
var N = /*#__PURE__*/function () {
|
9333
9355
|
function N() {
|
9334
9356
|
_classCallCheck(this, N);
|
@@ -9402,11 +9424,11 @@ var On = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg height=\"1.4em\"
|
|
9402
9424
|
}();
|
9403
9425
|
re.INPUT_BUTTON_SVG_TEXT_CLASS = "input-button-svg-text", re.INPUT_BUTTON_INNER_TEXT_CLASS = "text-button", re.INPUT_BUTTON_SVG_CLASS = "input-button-svg";
|
9404
9426
|
var Te = re;
|
9405
|
-
var
|
9406
|
-
function
|
9407
|
-
_classCallCheck(this,
|
9427
|
+
var Vt = /*#__PURE__*/function () {
|
9428
|
+
function Vt() {
|
9429
|
+
_classCallCheck(this, Vt);
|
9408
9430
|
}
|
9409
|
-
return _createClass(
|
9431
|
+
return _createClass(Vt, null, [{
|
9410
9432
|
key: "parseSVGTextElements",
|
9411
9433
|
value: function parseSVGTextElements(e) {
|
9412
9434
|
return {
|
@@ -9429,9 +9451,9 @@ var D = /*#__PURE__*/function () {
|
|
9429
9451
|
value: function unsetAllCSS(e, t) {
|
9430
9452
|
var r, o;
|
9431
9453
|
t.container && I.unsetAllCSSMouseStates(e, t.container);
|
9432
|
-
var
|
9433
|
-
i =
|
9434
|
-
s =
|
9454
|
+
var _Vt$parseSVGTextEleme = Vt.parseSVGTextElements(Array.from(e.children)),
|
9455
|
+
i = _Vt$parseSVGTextEleme.svg,
|
9456
|
+
s = _Vt$parseSVGTextEleme.text;
|
9435
9457
|
(r = t.svg) != null && r.styles && i && I.unsetAllCSSMouseStates(i, t.svg.styles), (o = t.text) != null && o.styles && s && I.unsetAllCSSMouseStates(s, t.text.styles);
|
9436
9458
|
}
|
9437
9459
|
}, {
|
@@ -9439,9 +9461,9 @@ var D = /*#__PURE__*/function () {
|
|
9439
9461
|
value: function unsetActionCSS(e, t) {
|
9440
9462
|
var r, o;
|
9441
9463
|
t.container && I.unsetActivityCSSMouseStates(e, t.container);
|
9442
|
-
var
|
9443
|
-
i =
|
9444
|
-
s =
|
9464
|
+
var _Vt$parseSVGTextEleme2 = Vt.parseSVGTextElements(Array.from(e.children)),
|
9465
|
+
i = _Vt$parseSVGTextEleme2.svg,
|
9466
|
+
s = _Vt$parseSVGTextEleme2.text;
|
9445
9467
|
(r = t.svg) != null && r.styles && i && I.unsetActivityCSSMouseStates(i, t.svg.styles), (o = t.text) != null && o.styles && s && I.unsetActivityCSSMouseStates(s, t.text.styles);
|
9446
9468
|
}
|
9447
9469
|
}, {
|
@@ -9449,9 +9471,9 @@ var D = /*#__PURE__*/function () {
|
|
9449
9471
|
value: function setElementsCSS(e, t, i) {
|
9450
9472
|
var o, a, l, c, d;
|
9451
9473
|
Object.assign(e.style, (o = t.container) == null ? void 0 : o[i]);
|
9452
|
-
var
|
9453
|
-
s =
|
9454
|
-
r =
|
9474
|
+
var _Vt$parseSVGTextEleme3 = Vt.parseSVGTextElements(Array.from(e.children)),
|
9475
|
+
s = _Vt$parseSVGTextEleme3.svg,
|
9476
|
+
r = _Vt$parseSVGTextEleme3.text;
|
9455
9477
|
s && Object.assign(s.style, (l = (a = t.svg) == null ? void 0 : a.styles) == null ? void 0 : l[i]), r && Object.assign(r.style, (d = (c = t.text) == null ? void 0 : c.styles) == null ? void 0 : d[i]);
|
9456
9478
|
}
|
9457
9479
|
}, {
|
@@ -9647,7 +9669,7 @@ ji.SESSION_STARTED = "sts-session-started", ji.SESSION_STOPPED = "sts-session-st
|
|
9647
9669
|
var Li = ji;
|
9648
9670
|
var Pn = "<?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=\"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>",
|
9649
9671
|
ls = "<?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=\"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>",
|
9650
|
-
C = /*#__PURE__*/function (
|
9672
|
+
C = /*#__PURE__*/function (_K5) {
|
9651
9673
|
function C(e) {
|
9652
9674
|
var _l$model;
|
9653
9675
|
var _this38;
|
@@ -9669,7 +9691,7 @@ var Pn = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9669
9691
|
(_l$model = (l = _this38.rawBody).model) !== null && _l$model !== void 0 ? _l$model : l.model = "gpt-4o-realtime-preview-2024-12-17", _this38._avatarConfig = C.buildAvatarConfig(s), _this38._buttonsConfig = C.buildButtonsConfig(s), _this38._avatarEl = C.createAvatar(_this38._avatarConfig), _this38._containerEl = _this38.createContainer(), _this38._deepChat = e;
|
9670
9692
|
return _this38;
|
9671
9693
|
}
|
9672
|
-
_inherits(C,
|
9694
|
+
_inherits(C, _K5);
|
9673
9695
|
return _createClass(C, [{
|
9674
9696
|
key: "setUpView",
|
9675
9697
|
value:
|
@@ -10359,24 +10381,24 @@ var Pn = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10359
10381
|
N.removeAriaDisabled(e.elementRef), e.elementRef.classList.remove(C.UNAVAILABLE);
|
10360
10382
|
}
|
10361
10383
|
}]);
|
10362
|
-
}(
|
10384
|
+
}(K);
|
10363
10385
|
C.BUTTON_DEFAULT = "deep-chat-openai-realtime-button-default", C.BUTTON_LOADING = "deep-chat-openai-realtime-button-loading", C.MICROPHONE_ACTIVE = "deep-chat-openai-realtime-microphone-active", C.UNAVAILABLE = "deep-chat-openai-realtime-button-unavailable";
|
10364
10386
|
var cs = C;
|
10365
|
-
var
|
10366
|
-
function
|
10387
|
+
var gt = /*#__PURE__*/function (_K6) {
|
10388
|
+
function gt(e) {
|
10367
10389
|
var _o$model, _a$voice;
|
10368
10390
|
var _this44;
|
10369
|
-
_classCallCheck(this,
|
10391
|
+
_classCallCheck(this, gt);
|
10370
10392
|
var r, o, a;
|
10371
10393
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
10372
10394
|
i = t == null ? void 0 : t.openAI;
|
10373
|
-
_this44 = _callSuper(this,
|
10395
|
+
_this44 = _callSuper(this, gt, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i]), _this44.insertKeyPlaceholderText = "OpenAI API Key", _this44.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this44.url = "https://api.openai.com/v1/audio/speech", _this44.permittedErrorPrefixes = ["Invalid"], _this44.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Text To Speech</b></div>\n <p>Generate an audio file based on your text input.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/text-to-speech\">here</a> for more information.</p>";
|
10374
10396
|
var s = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.textToSpeech;
|
10375
|
-
_typeof(s) == "object" && Object.assign(_this44.rawBody, s), (_o$model = (o = _this44.rawBody).model) !== null && _o$model !== void 0 ? _o$model : o.model =
|
10397
|
+
_typeof(s) == "object" && Object.assign(_this44.rawBody, s), (_o$model = (o = _this44.rawBody).model) !== null && _o$model !== void 0 ? _o$model : o.model = gt.DEFAULT_MODEL, (_a$voice = (a = _this44.rawBody).voice) !== null && _a$voice !== void 0 ? _a$voice : a.voice = gt.DEFAULT_VOIDE, _this44.textInputPlaceholderText = "Insert text to generate audio", _this44.rawBody.response_format = "mp3";
|
10376
10398
|
return _this44;
|
10377
10399
|
}
|
10378
|
-
_inherits(
|
10379
|
-
return _createClass(
|
10400
|
+
_inherits(gt, _K6);
|
10401
|
+
return _createClass(gt, [{
|
10380
10402
|
key: "preprocessBody",
|
10381
10403
|
value: function preprocessBody(e, t) {
|
10382
10404
|
var r, o;
|
@@ -10456,10 +10478,10 @@ var mt = /*#__PURE__*/function (_V6) {
|
|
10456
10478
|
return extractResultData;
|
10457
10479
|
}()
|
10458
10480
|
}]);
|
10459
|
-
}(
|
10460
|
-
|
10461
|
-
var ds =
|
10462
|
-
var me = /*#__PURE__*/function (
|
10481
|
+
}(K);
|
10482
|
+
gt.DEFAULT_MODEL = "tts-1", gt.DEFAULT_VOIDE = "alloy";
|
10483
|
+
var ds = gt;
|
10484
|
+
var me = /*#__PURE__*/function (_K7) {
|
10463
10485
|
function me(e) {
|
10464
10486
|
var _o$model2;
|
10465
10487
|
var _this45;
|
@@ -10474,7 +10496,7 @@ var me = /*#__PURE__*/function (_V7) {
|
|
10474
10496
|
_typeof(s) == "object" && (_this45.processConfig(s), me.cleanConfig(s), Object.assign(_this45.rawBody, s)), (_o$model2 = (o = _this45.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = me.DEFAULT_MODEL, _this45.rawBody.response_format = "json", _this45.canSendMessage = me.canSendFileMessage;
|
10475
10497
|
return _this45;
|
10476
10498
|
}
|
10477
|
-
_inherits(me,
|
10499
|
+
_inherits(me, _K7);
|
10478
10500
|
return _createClass(me, [{
|
10479
10501
|
key: "processConfig",
|
10480
10502
|
value: function processConfig(e) {
|
@@ -10569,7 +10591,7 @@ var me = /*#__PURE__*/function (_V7) {
|
|
10569
10591
|
}), i;
|
10570
10592
|
}
|
10571
10593
|
}]);
|
10572
|
-
}(
|
10594
|
+
}(K);
|
10573
10595
|
me.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", me.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", me.DEFAULT_MODEL = "whisper-1";
|
10574
10596
|
var hs = me;
|
10575
10597
|
var fe = /*#__PURE__*/function () {
|
@@ -10673,7 +10695,7 @@ var fe = /*#__PURE__*/function () {
|
|
10673
10695
|
}
|
10674
10696
|
}]);
|
10675
10697
|
}();
|
10676
|
-
var Zo = /*#__PURE__*/function (
|
10698
|
+
var Zo = /*#__PURE__*/function (_K8) {
|
10677
10699
|
// prettier-ignore
|
10678
10700
|
function Zo(e, t, i, s, r) {
|
10679
10701
|
var _this46;
|
@@ -10683,9 +10705,9 @@ var Zo = /*#__PURE__*/function (_V8) {
|
|
10683
10705
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this46.permittedErrorPrefixes = ["Access"];
|
10684
10706
|
return _this46;
|
10685
10707
|
}
|
10686
|
-
_inherits(Zo,
|
10708
|
+
_inherits(Zo, _K8);
|
10687
10709
|
return _createClass(Zo);
|
10688
|
-
}(
|
10710
|
+
}(K);
|
10689
10711
|
var Yt = /*#__PURE__*/function (_Zo) {
|
10690
10712
|
function Yt(e) {
|
10691
10713
|
var _a$language;
|
@@ -10849,11 +10871,11 @@ Yt.ENDPOINT_ERROR_MESSAGE =
|
|
10849
10871
|
// eslint-disable-next-line max-len
|
10850
10872
|
"Please define the azure endpoint. [More Information](https://deepchat.dev/docs/directConnection/Azure#Summarization)";
|
10851
10873
|
var us = Yt;
|
10852
|
-
var
|
10853
|
-
function
|
10854
|
-
_classCallCheck(this,
|
10874
|
+
var Kt = /*#__PURE__*/function () {
|
10875
|
+
function Kt() {
|
10876
|
+
_classCallCheck(this, Kt);
|
10855
10877
|
}
|
10856
|
-
return _createClass(
|
10878
|
+
return _createClass(Kt, null, [{
|
10857
10879
|
key: "poll",
|
10858
10880
|
value: function () {
|
10859
10881
|
var _poll2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee103(e, t) {
|
@@ -10949,24 +10971,24 @@ var Vt = /*#__PURE__*/function () {
|
|
10949
10971
|
return {
|
10950
10972
|
url: "https://api.assemblyai.com/v2/upload",
|
10951
10973
|
method: "POST",
|
10952
|
-
handleVerificationResult:
|
10974
|
+
handleVerificationResult: Kt.handleVerificationResult
|
10953
10975
|
};
|
10954
10976
|
}
|
10955
10977
|
}]);
|
10956
10978
|
}();
|
10957
|
-
var
|
10958
|
-
function
|
10979
|
+
var ws = /*#__PURE__*/function (_K9) {
|
10980
|
+
function ws(e) {
|
10959
10981
|
var _this48;
|
10960
|
-
_classCallCheck(this,
|
10982
|
+
_classCallCheck(this, ws);
|
10961
10983
|
var i;
|
10962
10984
|
var t = (i = e.directConnection) == null ? void 0 : i.assemblyAI;
|
10963
|
-
_this48 = _callSuper(this,
|
10985
|
+
_this48 = _callSuper(this, ws, [e, Kt.buildKeyVerificationDetails(), Kt.buildHeaders, t, {
|
10964
10986
|
audio: {}
|
10965
|
-
}]), _this48.insertKeyPlaceholderText = "AssemblyAI API Key", _this48.keyHelpUrl = "https://www.assemblyai.com/app/account", _this48.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>AssemblyAI Audio</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"https://www.assemblyai.com/docs/Guides/transcribing_an_audio_file#get-started\">here</a> for more info.\n </p>", _this48.url = "https://api.assemblyai.com/v2/upload", _this48.isTextInputDisabled = !0, _this48.textInputPlaceholderText = "Upload an audio file", _this48.permittedErrorPrefixes = ["Authentication", "Invalid"], _this48.canSendMessage =
|
10987
|
+
}]), _this48.insertKeyPlaceholderText = "AssemblyAI API Key", _this48.keyHelpUrl = "https://www.assemblyai.com/app/account", _this48.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>AssemblyAI Audio</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"https://www.assemblyai.com/docs/Guides/transcribing_an_audio_file#get-started\">here</a> for more info.\n </p>", _this48.url = "https://api.assemblyai.com/v2/upload", _this48.isTextInputDisabled = !0, _this48.textInputPlaceholderText = "Upload an audio file", _this48.permittedErrorPrefixes = ["Authentication", "Invalid"], _this48.canSendMessage = ws.canFileSendMessage;
|
10966
10988
|
return _this48;
|
10967
10989
|
}
|
10968
|
-
_inherits(
|
10969
|
-
return _createClass(
|
10990
|
+
_inherits(ws, _K9);
|
10991
|
+
return _createClass(ws, [{
|
10970
10992
|
key: "callServiceAPI",
|
10971
10993
|
value: function () {
|
10972
10994
|
var _callServiceAPI13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e, t, i) {
|
@@ -11014,7 +11036,7 @@ var As = /*#__PURE__*/function (_V9) {
|
|
11014
11036
|
case 2:
|
11015
11037
|
t = (r = (s = this.connectSettings) == null ? void 0 : s.headers) == null ? void 0 : r.Authorization;
|
11016
11038
|
_context105.next = 5;
|
11017
|
-
return
|
11039
|
+
return Kt.poll(t, e.upload_url);
|
11018
11040
|
case 5:
|
11019
11041
|
_context105.t0 = _context105.sent.text;
|
11020
11042
|
return _context105.abrupt("return", {
|
@@ -11037,8 +11059,8 @@ var As = /*#__PURE__*/function (_V9) {
|
|
11037
11059
|
return !!(t != null && t[0]);
|
11038
11060
|
}
|
11039
11061
|
}]);
|
11040
|
-
}(
|
11041
|
-
var Nn = /*#__PURE__*/function (
|
11062
|
+
}(K);
|
11063
|
+
var Nn = /*#__PURE__*/function (_K0) {
|
11042
11064
|
// prettier-ignore
|
11043
11065
|
function Nn(e, t, i, s, r) {
|
11044
11066
|
var _this49;
|
@@ -11048,9 +11070,9 @@ var Nn = /*#__PURE__*/function (_V0) {
|
|
11048
11070
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
11049
11071
|
return _this49;
|
11050
11072
|
}
|
11051
|
-
_inherits(Nn,
|
11073
|
+
_inherits(Nn, _K0);
|
11052
11074
|
return _createClass(Nn);
|
11053
|
-
}(
|
11075
|
+
}(K);
|
11054
11076
|
var Qe = /*#__PURE__*/function (_Nn) {
|
11055
11077
|
// prettier-ignore
|
11056
11078
|
function Qe(e) {
|
@@ -11240,7 +11262,7 @@ Ke.HELP_LINK =
|
|
11240
11262
|
// eslint-disable-next-line max-len
|
11241
11263
|
"Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#SpeechToText)";
|
11242
11264
|
var ps = Ke;
|
11243
|
-
var Qo = /*#__PURE__*/function (
|
11265
|
+
var Qo = /*#__PURE__*/function (_K1) {
|
11244
11266
|
// prettier-ignore
|
11245
11267
|
function Qo(e) {
|
11246
11268
|
var _this52;
|
@@ -11253,7 +11275,7 @@ var Qo = /*#__PURE__*/function (_V1) {
|
|
11253
11275
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this52.url = "", _this52.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
|
11254
11276
|
return _this52;
|
11255
11277
|
}
|
11256
|
-
_inherits(Qo,
|
11278
|
+
_inherits(Qo, _K1);
|
11257
11279
|
return _createClass(Qo, [{
|
11258
11280
|
key: "preprocessBody",
|
11259
11281
|
value: function preprocessBody(e) {
|
@@ -11318,30 +11340,30 @@ var Qo = /*#__PURE__*/function (_V1) {
|
|
11318
11340
|
return extractResultData;
|
11319
11341
|
}()
|
11320
11342
|
}]);
|
11321
|
-
}(
|
11322
|
-
var
|
11343
|
+
}(K);
|
11344
|
+
var vt = /*#__PURE__*/function (_K10) {
|
11323
11345
|
// prettier-ignore
|
11324
|
-
function
|
11346
|
+
function vt(e, t, i, s, r) {
|
11325
11347
|
var _this53$maxMessages, _p$model;
|
11326
11348
|
var _this53;
|
11327
|
-
_classCallCheck(this,
|
11349
|
+
_classCallCheck(this, vt);
|
11328
11350
|
var u, h, f, m, p;
|
11329
11351
|
var o = JSON.parse(JSON.stringify(e.directConnection)),
|
11330
11352
|
a = t || L.buildKeyVerificationDetails(),
|
11331
11353
|
l = i || L.buildHeaders,
|
11332
11354
|
c = s || o.openAI;
|
11333
|
-
_this53 = _callSuper(this,
|
11355
|
+
_this53 = _callSuper(this, vt, [e, a, l, c]), _this53.insertKeyPlaceholderText = "OpenAI API Key", _this53.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this53.url = "https://api.openai.com/v1/chat/completions", _this53.permittedErrorPrefixes = ["Incorrect"], _this53.asyncCallInProgress = !1, _this53._systemMessage = vt.generateSystemMessage("You are a helpful assistant.");
|
11334
11356
|
var d = r || ((u = o.openAI) == null ? void 0 : u.chat);
|
11335
11357
|
if (_typeof(d) == "object") {
|
11336
|
-
d.system_prompt && (_this53._systemMessage =
|
11358
|
+
d.system_prompt && (_this53._systemMessage = vt.generateSystemMessage(d.system_prompt));
|
11337
11359
|
var g = (m = (f = (h = e.directConnection) == null ? void 0 : h.openAI) == null ? void 0 : f.chat) == null ? void 0 : m.function_handler;
|
11338
11360
|
g && (_this53._functionHandler = g), _this53.cleanConfig(d), Object.assign(_this53.rawBody, d);
|
11339
11361
|
}
|
11340
11362
|
(_this53$maxMessages = _this53.maxMessages) !== null && _this53$maxMessages !== void 0 ? _this53$maxMessages : _this53.maxMessages = -1, (_p$model = (p = _this53.rawBody).model) !== null && _p$model !== void 0 ? _p$model : p.model = "gpt-4o";
|
11341
11363
|
return _this53;
|
11342
11364
|
}
|
11343
|
-
_inherits(
|
11344
|
-
return _createClass(
|
11365
|
+
_inherits(vt, _K10);
|
11366
|
+
return _createClass(vt, [{
|
11345
11367
|
key: "cleanConfig",
|
11346
11368
|
value: function cleanConfig(e) {
|
11347
11369
|
delete e.system_prompt, delete e.function_handler;
|
@@ -11353,9 +11375,9 @@ var bt = /*#__PURE__*/function (_V10) {
|
|
11353
11375
|
function preprocessBody(e, t) {
|
11354
11376
|
var _i$max_tokens;
|
11355
11377
|
var i = JSON.parse(JSON.stringify(e)),
|
11356
|
-
s =
|
11378
|
+
s = yt.getCharacterLimitMessages(t, this.totalMessagesMaxCharLength ? this.totalMessagesMaxCharLength - this._systemMessage.content.length : -1).map(function (r) {
|
11357
11379
|
return {
|
11358
|
-
content:
|
11380
|
+
content: vt.getContent(r),
|
11359
11381
|
role: r.role === y.USER_ROLE ? "user" : "assistant"
|
11360
11382
|
};
|
11361
11383
|
});
|
@@ -11378,7 +11400,7 @@ var bt = /*#__PURE__*/function (_V10) {
|
|
11378
11400
|
throw new Error("Request settings have not been set up");
|
11379
11401
|
case 2:
|
11380
11402
|
i = this.preprocessBody(this.rawBody, t), s = this.stream;
|
11381
|
-
s && (_typeof(s) != "object" || !s.simulation) || i.stream ? (i.stream = !0,
|
11403
|
+
s && (_typeof(s) != "object" || !s.simulation) || i.stream ? (i.stream = !0, w.request(this, i, e)) : R.request(this, i, e);
|
11382
11404
|
case 4:
|
11383
11405
|
case "end":
|
11384
11406
|
return _context112.stop();
|
@@ -11612,8 +11634,8 @@ var bt = /*#__PURE__*/function (_V10) {
|
|
11612
11634
|
return e.text;
|
11613
11635
|
}
|
11614
11636
|
}]);
|
11615
|
-
}(
|
11616
|
-
var Ts = /*#__PURE__*/function (
|
11637
|
+
}(K);
|
11638
|
+
var Ts = /*#__PURE__*/function (_vt) {
|
11617
11639
|
function Ts(e) {
|
11618
11640
|
var _this55;
|
11619
11641
|
_classCallCheck(this, Ts);
|
@@ -11636,7 +11658,7 @@ var Ts = /*#__PURE__*/function (_bt) {
|
|
11636
11658
|
}));
|
11637
11659
|
return _this55;
|
11638
11660
|
}
|
11639
|
-
_inherits(Ts,
|
11661
|
+
_inherits(Ts, _vt);
|
11640
11662
|
return _createClass(Ts, null, [{
|
11641
11663
|
key: "buildURL",
|
11642
11664
|
value: function buildURL(e) {
|
@@ -11646,8 +11668,8 @@ var Ts = /*#__PURE__*/function (_bt) {
|
|
11646
11668
|
return "".concat(t, "/openai/deployments/").concat(i, "/completions?api-version=").concat(s);
|
11647
11669
|
}
|
11648
11670
|
}]);
|
11649
|
-
}(
|
11650
|
-
var ge = /*#__PURE__*/function (
|
11671
|
+
}(vt);
|
11672
|
+
var ge = /*#__PURE__*/function (_K11) {
|
11651
11673
|
function ge(e) {
|
11652
11674
|
var _this56;
|
11653
11675
|
_classCallCheck(this, ge);
|
@@ -11676,7 +11698,7 @@ var ge = /*#__PURE__*/function (_V11) {
|
|
11676
11698
|
_typeof(r) == "object" && Object.assign(_this56.rawBody, r), _this56.canSendMessage = ge.canFileSendMessage;
|
11677
11699
|
return _this56;
|
11678
11700
|
}
|
11679
|
-
_inherits(ge,
|
11701
|
+
_inherits(ge, _K11);
|
11680
11702
|
return _createClass(ge, [{
|
11681
11703
|
key: "preprocessBody",
|
11682
11704
|
value: function preprocessBody(e, t) {
|
@@ -11758,7 +11780,7 @@ var ge = /*#__PURE__*/function (_V11) {
|
|
11758
11780
|
src: i.url,
|
11759
11781
|
type: "image"
|
11760
11782
|
} : {
|
11761
|
-
src: "".concat(
|
11783
|
+
src: "".concat(di).concat(i.b64_json),
|
11762
11784
|
type: "image"
|
11763
11785
|
};
|
11764
11786
|
})
|
@@ -11796,10 +11818,10 @@ var ge = /*#__PURE__*/function (_V11) {
|
|
11796
11818
|
}), s;
|
11797
11819
|
}
|
11798
11820
|
}]);
|
11799
|
-
}(
|
11821
|
+
}(K);
|
11800
11822
|
ge.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", ge.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", ge.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
11801
11823
|
var ms = ge;
|
11802
|
-
var ea = /*#__PURE__*/function (
|
11824
|
+
var ea = /*#__PURE__*/function (_As3) {
|
11803
11825
|
function ea(e) {
|
11804
11826
|
var _this57$maxMessages;
|
11805
11827
|
var _this57;
|
@@ -11811,7 +11833,7 @@ var ea = /*#__PURE__*/function (_ws3) {
|
|
11811
11833
|
_this57 = _callSuper(this, ea, [e, "https://api.cohere.ai/v1/chat", "Ask me anything!", i, s]), _typeof(i) == "object" && Object.assign(_this57.rawBody, i), (_this57$maxMessages = _this57.maxMessages) !== null && _this57$maxMessages !== void 0 ? _this57$maxMessages : _this57.maxMessages = -1;
|
11812
11834
|
return _this57;
|
11813
11835
|
}
|
11814
|
-
_inherits(ea,
|
11836
|
+
_inherits(ea, _As3);
|
11815
11837
|
return _createClass(ea, [{
|
11816
11838
|
key: "preprocessBody",
|
11817
11839
|
value: function preprocessBody(e, t) {
|
@@ -11881,7 +11903,7 @@ var ea = /*#__PURE__*/function (_ws3) {
|
|
11881
11903
|
return extractResultData;
|
11882
11904
|
}()
|
11883
11905
|
}]);
|
11884
|
-
}(
|
11906
|
+
}(As);
|
11885
11907
|
var Ii = /*#__PURE__*/function () {
|
11886
11908
|
function Ii() {
|
11887
11909
|
_classCallCheck(this, Ii);
|
@@ -11913,7 +11935,7 @@ var Ii = /*#__PURE__*/function () {
|
|
11913
11935
|
}
|
11914
11936
|
}]);
|
11915
11937
|
}();
|
11916
|
-
var ta = /*#__PURE__*/function (
|
11938
|
+
var ta = /*#__PURE__*/function (_K12) {
|
11917
11939
|
function ta(e) {
|
11918
11940
|
var _this58$maxMessages, _s$model;
|
11919
11941
|
var _this58;
|
@@ -11923,7 +11945,7 @@ var ta = /*#__PURE__*/function (_V12) {
|
|
11923
11945
|
_this58 = _callSuper(this, ta, [e, Ii.buildKeyVerificationDetails(), Ii.buildHeaders, i]), _this58.insertKeyPlaceholderText = "Mistral API Key", _this58.keyHelpUrl = "https://console.mistral.ai/api-keys/", _this58.url = "https://api.mistral.ai/v1/chat/completions", _this58.permittedErrorPrefixes = ["invalid"], i && (_this58.cleanConfig(i), Object.assign(_this58.rawBody, i)), (_this58$maxMessages = _this58.maxMessages) !== null && _this58$maxMessages !== void 0 ? _this58$maxMessages : _this58.maxMessages = -1, (_s$model = (s = _this58.rawBody).model) !== null && _s$model !== void 0 ? _s$model : s.model = "open-mistral-7b";
|
11924
11946
|
return _this58;
|
11925
11947
|
}
|
11926
|
-
_inherits(ta,
|
11948
|
+
_inherits(ta, _K12);
|
11927
11949
|
return _createClass(ta, [{
|
11928
11950
|
key: "cleanConfig",
|
11929
11951
|
value: function cleanConfig(e) {
|
@@ -11999,7 +12021,7 @@ var ta = /*#__PURE__*/function (_V12) {
|
|
11999
12021
|
return extractResultData;
|
12000
12022
|
}()
|
12001
12023
|
}]);
|
12002
|
-
}(
|
12024
|
+
}(K);
|
12003
12025
|
var ia = /*#__PURE__*/function () {
|
12004
12026
|
function ia() {
|
12005
12027
|
_classCallCheck(this, ia);
|
@@ -12013,10 +12035,10 @@ var ia = /*#__PURE__*/function () {
|
|
12013
12035
|
i = e.connect,
|
12014
12036
|
s = e.demo,
|
12015
12037
|
r = e.webModel;
|
12016
|
-
if (r) return new
|
12038
|
+
if (r) return new ni(e);
|
12017
12039
|
if (t) {
|
12018
|
-
if (t.openAI) return t.openAI.images ? new ms(e) : t.openAI.speechToText ? new hs(e) : t.openAI.textToSpeech ? new ds(e) : t.openAI.assistant ? new xs(e) : t.openAI.realtime ? new cs(e) : new
|
12019
|
-
if (t.assemblyAI) return new
|
12040
|
+
if (t.openAI) return t.openAI.images ? new ms(e) : t.openAI.speechToText ? new hs(e) : t.openAI.textToSpeech ? new ds(e) : t.openAI.assistant ? new xs(e) : t.openAI.realtime ? new cs(e) : new vt(e);
|
12041
|
+
if (t.assemblyAI) return new ws(e);
|
12020
12042
|
if (t.cohere) return t.cohere.textGeneration ? new Xo(e) : t.cohere.summarization ? new Yo(e) : new ea(e);
|
12021
12043
|
if (t.huggingFace) return t.huggingFace.textGeneration ? new Go(e) : t.huggingFace.summarization ? new Ko(e) : t.huggingFace.translation ? new $o(e) : t.huggingFace.fillMask ? new Jo(e) : t.huggingFace.questionAnswer ? new Vo(e) : t.huggingFace.audioSpeechRecognition ? new zo(e) : t.huggingFace.audioClassification ? new Ho(e) : t.huggingFace.imageClassification ? new qo(e) : new Wo(e);
|
12022
12044
|
if (t.azure) {
|
@@ -12029,7 +12051,7 @@ var ia = /*#__PURE__*/function () {
|
|
12029
12051
|
if (t.azure.summarization) return new us(e);
|
12030
12052
|
if (t.azure.translation) return new Qo(e);
|
12031
12053
|
}
|
12032
|
-
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new Ti(e) : t.stabilityAI.imageToImageUpscale ? new
|
12054
|
+
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new Ti(e) : t.stabilityAI.imageToImageUpscale ? new Ai(e) : t.stabilityAI.imageToImageMasking ? new wi(e) : new Ci(e);
|
12033
12055
|
if (t.mistral) return new ta(e);
|
12034
12056
|
}
|
12035
12057
|
return i && Object.keys(i).length > 0 && !s ? new rt(e) : new rt(e, void 0, s || !0);
|
@@ -12104,23 +12126,23 @@ var Oi = /*#__PURE__*/function () {
|
|
12104
12126
|
}]);
|
12105
12127
|
}();
|
12106
12128
|
var sa = "<?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>",
|
12107
|
-
|
12108
|
-
function
|
12109
|
-
_classCallCheck(this,
|
12129
|
+
J = /*#__PURE__*/function () {
|
12130
|
+
function J() {
|
12131
|
+
_classCallCheck(this, J);
|
12110
12132
|
}
|
12111
|
-
return _createClass(
|
12133
|
+
return _createClass(J, null, [{
|
12112
12134
|
key: "createImage",
|
12113
12135
|
value: function createImage(e, t, i) {
|
12114
12136
|
var s = new Image();
|
12115
|
-
return s.src = e.src, i &&
|
12137
|
+
return s.src = e.src, i && H.scrollDownOnImageLoad(s.src, t), H.processContent("image", s, s.src, e.name);
|
12116
12138
|
}
|
12117
12139
|
// WORK - image still does not scroll down when loaded
|
12118
12140
|
}, {
|
12119
12141
|
key: "createImageMessage",
|
12120
12142
|
value: function createImageMessage(e, t, i, s) {
|
12121
|
-
var r =
|
12143
|
+
var r = J.createImage(t, e.elementRef, !s && !e.focusMode),
|
12122
12144
|
o = e.createNewMessageElement("", i);
|
12123
|
-
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add(
|
12145
|
+
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add(J.IMAGE_BUBBLE_CLASS), {
|
12124
12146
|
type: "image",
|
12125
12147
|
elements: o
|
12126
12148
|
};
|
@@ -12134,9 +12156,9 @@ var sa = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12134
12156
|
}, {
|
12135
12157
|
key: "createNewAudioMessage",
|
12136
12158
|
value: function createNewAudioMessage(e, t, i, s) {
|
12137
|
-
var r =
|
12159
|
+
var r = J.createAudioElement(t, i),
|
12138
12160
|
o = e.createMessageElementsOnOrientation("", i, s);
|
12139
|
-
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add(
|
12161
|
+
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add(J.AUDIO_BUBBLE_CLASS), {
|
12140
12162
|
type: "audio",
|
12141
12163
|
elements: o
|
12142
12164
|
};
|
@@ -12151,14 +12173,14 @@ var sa = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12151
12173
|
var s = Ue.createSVGElement(sa);
|
12152
12174
|
s.classList.add("any-file-message-icon"), i.appendChild(s);
|
12153
12175
|
var r = document.createElement("div");
|
12154
|
-
return r.classList.add("any-file-message-text"), r.textContent = e.name ||
|
12176
|
+
return r.classList.add("any-file-message-text"), r.textContent = e.name || H.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), H.processContent("any", t, e.src, r.textContent);
|
12155
12177
|
}
|
12156
12178
|
}, {
|
12157
12179
|
key: "createNewAnyFileMessage",
|
12158
12180
|
value: function createNewAnyFileMessage(e, t, i, s) {
|
12159
12181
|
var r = e.createMessageElementsOnOrientation("", i, s),
|
12160
|
-
o =
|
12161
|
-
return r.bubbleElement.classList.add(
|
12182
|
+
o = J.createAnyFile(t);
|
12183
|
+
return r.bubbleElement.classList.add(J.ANY_FILE_BUBBLE_CLASS), r.bubbleElement.appendChild(o), {
|
12162
12184
|
type: "file",
|
12163
12185
|
elements: r
|
12164
12186
|
};
|
@@ -12168,23 +12190,23 @@ var sa = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12168
12190
|
value: function createMessages(e, t, i) {
|
12169
12191
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
12170
12192
|
return t.map(function (r) {
|
12171
|
-
return r.ref && (r =
|
12193
|
+
return r.ref && (r = H.removeFileRef(r)), H.isAudioFile(r) ? J.createNewAudioMessage(e, r, i, s) : H.isImageFile(r) ? J.createImageMessage(e, r, i, s) : J.createNewAnyFileMessage(e, r, i, s);
|
12172
12194
|
});
|
12173
12195
|
}
|
12174
12196
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
12175
12197
|
}, {
|
12176
12198
|
key: "addMessages",
|
12177
12199
|
value: function addMessages(e, t, i, s) {
|
12178
|
-
|
12200
|
+
J.createMessages(e, t, i, s).forEach(function (_ref32) {
|
12179
12201
|
var o = _ref32.type,
|
12180
12202
|
a = _ref32.elements;
|
12181
|
-
|
12203
|
+
H.addMessage(e, a, o, i, s);
|
12182
12204
|
});
|
12183
12205
|
}
|
12184
12206
|
}]);
|
12185
12207
|
}();
|
12186
|
-
|
12187
|
-
var Pi =
|
12208
|
+
J.IMAGE_BUBBLE_CLASS = "image-message", J.AUDIO_BUBBLE_CLASS = "audio-message", J.ANY_FILE_BUBBLE_CLASS = "any-file-message";
|
12209
|
+
var Pi = J;
|
12188
12210
|
var le = /*#__PURE__*/function () {
|
12189
12211
|
function le() {
|
12190
12212
|
_classCallCheck(this, le);
|
@@ -12247,7 +12269,7 @@ var le = /*#__PURE__*/function () {
|
|
12247
12269
|
var f = _ref33.type,
|
12248
12270
|
m = _ref33.elements;
|
12249
12271
|
var g;
|
12250
|
-
|
12272
|
+
H.setElementProps(e, m, f, s), (g = d.parentElement) == null || g.insertBefore(m.outerContainer, d), e.messageElementRefs.splice(e.messageElementRefs.length - 1, 1), e.messageElementRefs.splice(c + p, 0, m);
|
12251
12273
|
}), le.removeFilesMessages(e, t), t[1].files = r.map(function (_ref34) {
|
12252
12274
|
var f = _ref34.elements;
|
12253
12275
|
return f;
|
@@ -12317,19 +12339,19 @@ var de = /*#__PURE__*/function (_he) {
|
|
12317
12339
|
var s = t.permittedErrorPrefixes,
|
12318
12340
|
r = t.introPanelMarkUp,
|
12319
12341
|
o = t.demo;
|
12320
|
-
_this59._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this59._onClearMessages =
|
12342
|
+
_this59._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this59._onClearMessages = ii.onClearMessages.bind(_this59, e), _this59._onError = ii.onError.bind(_this59, e), _this59._isLoadingMessageAllowed = de.getDefaultDisplayLoadingMessage(e, t), _typeof(e.displayLoadingBubble) == "object" && e.displayLoadingBubble.toggle && (e.displayLoadingBubble.toggle = _this59.setLoadingToggle.bind(_this59)), _this59._permittedErrorPrefixes = s, _this59.addSetupMessageIfNeeded(e, t) || _this59.populateIntroPanel(i, r, e.introPanelStyle), o && _this59.prepareDemo(te.processDemo(o), e.loadHistory), _this59.addIntroductoryMessages(e, t), new si(e, _this59, t), _this59._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
12321
12343
|
return y.deepCloneMessagesWithReferences(_this59.messageToElements.map(function (_ref35) {
|
12322
12344
|
var _ref36 = _slicedToArray(_ref35, 1),
|
12323
12345
|
c = _ref36[0];
|
12324
12346
|
return c;
|
12325
12347
|
}));
|
12326
|
-
}, e.clearMessages = _this59.clearMessages.bind(_this59, t), e.refreshMessages = _this59.refreshTextMessages.bind(_this59, e.remarkable), e.scrollToBottom =
|
12348
|
+
}, e.clearMessages = _this59.clearMessages.bind(_this59, t), e.refreshMessages = _this59.refreshTextMessages.bind(_this59, e.remarkable), e.scrollToBottom = V.scrollToBottom.bind(_this59, _this59.elementRef), e.addMessage = function (c, d) {
|
12327
12349
|
_this59.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
|
12328
12350
|
sendUpdate: !!d
|
12329
12351
|
}), !d);
|
12330
12352
|
}, e.updateMessage = function (c, d) {
|
12331
12353
|
return le.update(_this59, c, d);
|
12332
|
-
}, t.isWebModel() && t.setUpMessages(_this59), e.textToSpeech &&
|
12354
|
+
}, t.isWebModel() && t.setUpMessages(_this59), e.textToSpeech && bt.processConfig(e.textToSpeech, function (c) {
|
12333
12355
|
_this59.textToSpeech = c;
|
12334
12356
|
});
|
12335
12357
|
return _this59;
|
@@ -12405,7 +12427,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12405
12427
|
value: function tryAddTextMessage(e, t, i) {
|
12406
12428
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
12407
12429
|
var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
|
12408
|
-
!i.ignoreText && e.text !== void 0 && i.text !== null && (this.addNewTextMessage(e.text, e.role, t, r), !s && this.textToSpeech && e.role !== y.USER_ROLE &&
|
12430
|
+
!i.ignoreText && e.text !== void 0 && i.text !== null && (this.addNewTextMessage(e.text, e.role, t, r), !s && this.textToSpeech && e.role !== y.USER_ROLE && bt.speak(e.text, this.textToSpeech));
|
12409
12431
|
}
|
12410
12432
|
}, {
|
12411
12433
|
key: "tryAddFileMessages",
|
@@ -12458,7 +12480,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12458
12480
|
value: function removeMessageOnError() {
|
12459
12481
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
12460
12482
|
t = e == null ? void 0 : e.bubbleElement;
|
12461
|
-
(t != null && t.classList.contains(
|
12483
|
+
(t != null && t.classList.contains(we.MESSAGE_CLASS) && t.textContent === "" || de.isTemporaryElement(e)) && this.removeLastMessage();
|
12462
12484
|
}
|
12463
12485
|
// prettier-ignore
|
12464
12486
|
}, {
|
@@ -12474,9 +12496,9 @@ var de = /*#__PURE__*/function (_he) {
|
|
12474
12496
|
var o = r.bubbleElement,
|
12475
12497
|
a = r.outerContainer;
|
12476
12498
|
o.classList.add(y.ERROR_MESSAGE_TEXT_CLASS), this.renderText(o, s);
|
12477
|
-
var l =
|
12478
|
-
|
12479
|
-
return
|
12499
|
+
var l = X.extractParticularSharedStyles(["fontSize", "fontFamily"], (h = this.messageStyles) == null ? void 0 : h["default"]);
|
12500
|
+
X.applyCustomStylesToElements(r, !1, l), X.applyCustomStylesToElements(r, !1, (f = this.messageStyles) == null ? void 0 : f.error), i || this.appendOuterContainerElemet(a), this.textToSpeech && bt.speak(s, this.textToSpeech), (m = this._onError) == null || m.call(this, s), setTimeout(function () {
|
12501
|
+
return V.scrollToBottom(_this61.elementRef);
|
12480
12502
|
});
|
12481
12503
|
}
|
12482
12504
|
}, {
|
@@ -12519,12 +12541,12 @@ var de = /*#__PURE__*/function (_he) {
|
|
12519
12541
|
if (he.isLoadingMessage(t) || !e && !this._isLoadingMessageAllowed) return;
|
12520
12542
|
var i = (a = (o = (r = this.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.message) == null ? void 0 : a.html,
|
12521
12543
|
s = i ? xe.createElements(this, i, y.AI_ROLE, !1) : this.addDefaultLoadingMessage();
|
12522
|
-
this.appendOuterContainerElemet(s.outerContainer), s.bubbleElement.classList.add(De.BUBBLE_CLASS), this.applyCustomStyles(s, y.AI_ROLE, !1, (d = (c = (l = this.messageStyles) == null ? void 0 : l.loading) == null ? void 0 : c.message) == null ? void 0 : d.styles), this.focusMode ||
|
12544
|
+
this.appendOuterContainerElemet(s.outerContainer), s.bubbleElement.classList.add(De.BUBBLE_CLASS), this.applyCustomStyles(s, y.AI_ROLE, !1, (d = (c = (l = this.messageStyles) == null ? void 0 : l.loading) == null ? void 0 : c.message) == null ? void 0 : d.styles), this.focusMode || V.scrollToBottom(this.elementRef);
|
12523
12545
|
}
|
12524
12546
|
}, {
|
12525
12547
|
key: "populateIntroPanel",
|
12526
12548
|
value: function populateIntroPanel(e, t, i) {
|
12527
|
-
(e || t) && (this._introPanel = new Oi(e, t, i), this._introPanel._elementRef && (
|
12549
|
+
(e || t) && (this._introPanel = new Oi(e, t, i), this._introPanel._elementRef && (G.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
12528
12550
|
}
|
12529
12551
|
}, {
|
12530
12552
|
key: "addMultipleFiles",
|
@@ -12536,7 +12558,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12536
12558
|
return _context122.abrupt("return", (this._hiddenAttachments = t, Promise.all((e || []).map(function (i) {
|
12537
12559
|
return new Promise(function (s) {
|
12538
12560
|
if (!i.type || i.type === "any") {
|
12539
|
-
var r = i.file.name ||
|
12561
|
+
var r = i.file.name || H.DEFAULT_FILE_NAME;
|
12540
12562
|
s({
|
12541
12563
|
name: r,
|
12542
12564
|
type: "any",
|
@@ -12604,7 +12626,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12604
12626
|
}, {
|
12605
12627
|
key: "isActiveElement",
|
12606
12628
|
value: function isActiveElement(e) {
|
12607
|
-
return e ? e.contains(De.BUBBLE_CLASS) || e.contains(Fe.CLASS) || e.contains(
|
12629
|
+
return e ? e.contains(De.BUBBLE_CLASS) || e.contains(Fe.CLASS) || e.contains(we.MESSAGE_CLASS) : !1;
|
12608
12630
|
}
|
12609
12631
|
}]);
|
12610
12632
|
}(he);
|
@@ -12646,11 +12668,11 @@ var j = /*#__PURE__*/function () {
|
|
12646
12668
|
}();
|
12647
12669
|
j.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment", j.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment", j.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS = "text-input-container-left-small-adjustment", j.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS = "text-input-container-right-small-adjustment";
|
12648
12670
|
var bs = j;
|
12649
|
-
var
|
12650
|
-
function
|
12651
|
-
_classCallCheck(this,
|
12671
|
+
var Et = /*#__PURE__*/function () {
|
12672
|
+
function Et() {
|
12673
|
+
_classCallCheck(this, Et);
|
12652
12674
|
}
|
12653
|
-
return _createClass(
|
12675
|
+
return _createClass(Et, null, [{
|
12654
12676
|
key: "create",
|
12655
12677
|
value: function create() {
|
12656
12678
|
return Array.from({
|
@@ -12674,7 +12696,7 @@ var yt = /*#__PURE__*/function () {
|
|
12674
12696
|
key: "addButton",
|
12675
12697
|
value: function addButton(e, t, i) {
|
12676
12698
|
t.classList.add(i);
|
12677
|
-
var s =
|
12699
|
+
var s = Et.getContainerIndex(i);
|
12678
12700
|
e[s].appendChild(t), s === 3 && t.classList.add("outside-right");
|
12679
12701
|
}
|
12680
12702
|
}]);
|
@@ -12805,7 +12827,7 @@ var O = /*#__PURE__*/function (_ct2) {
|
|
12805
12827
|
key: "resetDropupItem",
|
12806
12828
|
value: function resetDropupItem(e) {
|
12807
12829
|
var i, s, r;
|
12808
|
-
this.elementRef =
|
12830
|
+
this.elementRef = G.replaceElementWithNewClone(this.elementRef, this._originalElementRef), this.elementRef.innerHTML = "", ((i = e == null ? void 0 : e.svg) == null ? void 0 : i.content) === "" || this.elementRef.appendChild(Se.createItemIcon(this.svg, (s = this._menuStyles) == null ? void 0 : s.iconContainer)), this.elementRef.appendChild(Se.createItemText(this.dropupText, (r = this._menuStyles) == null ? void 0 : r.text));
|
12809
12831
|
}
|
12810
12832
|
}, {
|
12811
12833
|
key: "assignDropupItemStyle",
|
@@ -12847,12 +12869,12 @@ var O = /*#__PURE__*/function (_ct2) {
|
|
12847
12869
|
var o = (c = (l = s == null ? void 0 : s[t]) == null ? void 0 : l.svg) == null ? void 0 : c.content,
|
12848
12870
|
a = (u = (d = s == null ? void 0 : s[t]) == null ? void 0 : d.text) == null ? void 0 : u.content;
|
12849
12871
|
if (o === void 0 || a === void 0) {
|
12850
|
-
var
|
12851
|
-
h =
|
12852
|
-
f =
|
12853
|
-
|
12854
|
-
m =
|
12855
|
-
p =
|
12872
|
+
var _Vt$parseSVGTextEleme4 = Vt.parseSVGTextElements(i),
|
12873
|
+
h = _Vt$parseSVGTextEleme4.svg,
|
12874
|
+
f = _Vt$parseSVGTextEleme4.text,
|
12875
|
+
_Vt$parseSVGTextEleme5 = Vt.parseSVGTextElements(r),
|
12876
|
+
m = _Vt$parseSVGTextEleme5.svg,
|
12877
|
+
p = _Vt$parseSVGTextEleme5.text,
|
12856
12878
|
g = [];
|
12857
12879
|
O.addToInnerElements(g, o, h, m), O.addToInnerElements(g, a, f, p), r = g;
|
12858
12880
|
}
|
@@ -12887,15 +12909,15 @@ var O = /*#__PURE__*/function (_ct2) {
|
|
12887
12909
|
O.INDICATOR_PREFIX = "custom", O.BUTTON_CLASS = "custom-button", O.DISABLED_CONTAINER_CLASS = "custom-button-container-disabled", O.DEFAULT_CONTAINER_CLASS = "custom-button-container-default", O.ACTIVE_CONTAINER_CLASS = "custom-button-container-active";
|
12888
12910
|
var st = O;
|
12889
12911
|
var oa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M16 0c-8.836 0-16 7.163-16 16s7.163 16 16 16c8.837 0 16-7.163 16-16s-7.163-16-16-16zM16 30.032c-7.72 0-14-6.312-14-14.032s6.28-14 14-14 14 6.28 14 14-6.28 14.032-14 14.032zM23 15h-6v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1v6h-6c-0.552 0-1 0.448-1 1s0.448 1 1 1h6v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6h6c0.552 0 1-0.448 1-1s-0.448-1-1-1z\"></path>\n</svg>";
|
12890
|
-
var
|
12891
|
-
function
|
12892
|
-
_classCallCheck(this,
|
12912
|
+
var ri = /*#__PURE__*/function () {
|
12913
|
+
function ri() {
|
12914
|
+
_classCallCheck(this, ri);
|
12893
12915
|
}
|
12894
|
-
return _createClass(
|
12916
|
+
return _createClass(ri, null, [{
|
12895
12917
|
key: "focusItemWhenOnEdge",
|
12896
12918
|
value: function focusItemWhenOnEdge(e, t) {
|
12897
12919
|
var i = t ? e.children[0] : e.children[e.children.length - 1];
|
12898
|
-
|
12920
|
+
ri.focusSiblingItem(i, e, t, !0);
|
12899
12921
|
}
|
12900
12922
|
// isEdgeItem means is it a start or end item
|
12901
12923
|
// prettier-ignore
|
@@ -12904,7 +12926,7 @@ var ni = /*#__PURE__*/function () {
|
|
12904
12926
|
value: function focusSiblingItem(e, t, i) {
|
12905
12927
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
12906
12928
|
var r = s ? e : e[i ? "nextSibling" : "previousSibling"];
|
12907
|
-
r ? (e.dispatchEvent(new MouseEvent("mouseleave")), r.dispatchEvent(new MouseEvent("mouseenter"))) : (e.dispatchEvent(new MouseEvent("mouseleave")),
|
12929
|
+
r ? (e.dispatchEvent(new MouseEvent("mouseleave")), r.dispatchEvent(new MouseEvent("mouseenter"))) : (e.dispatchEvent(new MouseEvent("mouseleave")), ri.focusItemWhenOnEdge(t, i));
|
12908
12930
|
}
|
12909
12931
|
}]);
|
12910
12932
|
}();
|
@@ -12955,7 +12977,7 @@ var Cs = /*#__PURE__*/function () {
|
|
12955
12977
|
key: "windowKeyDown",
|
12956
12978
|
value: function windowKeyDown(e, t) {
|
12957
12979
|
var i, s, r;
|
12958
|
-
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key === U.ESCAPE ? (this.close(), (i = this.highlightedItem) == null || i.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === U.ENTER ? ((s = this.highlightedItem) == null || s.click(), (r = this.highlightedItem) == null || r.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === U.ARROW_DOWN ?
|
12980
|
+
!e.isConnected && this.keyDownEvent ? window.removeEventListener("keydown", this.keyDownEvent) : this._isOpen && (t.key === U.ESCAPE ? (this.close(), (i = this.highlightedItem) == null || i.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === U.ENTER ? ((s = this.highlightedItem) == null || s.click(), (r = this.highlightedItem) == null || r.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === U.ARROW_DOWN ? ri.focusSiblingItem(this.highlightedItem || this.elementRef.children[this.elementRef.children.length - 1], this.elementRef, !0) : t.key === U.ARROW_UP && ri.focusSiblingItem(this.highlightedItem || this.elementRef.children[0], this.elementRef, !1));
|
12959
12981
|
}
|
12960
12982
|
}], [{
|
12961
12983
|
key: "createElement",
|
@@ -13026,11 +13048,11 @@ var et = /*#__PURE__*/function (_ct3) {
|
|
13026
13048
|
}(ct);
|
13027
13049
|
et.BUTTON_ICON_CLASS = "dropup-button";
|
13028
13050
|
var Ni = et;
|
13029
|
-
var
|
13030
|
-
function
|
13031
|
-
_classCallCheck(this,
|
13051
|
+
var $ = /*#__PURE__*/function () {
|
13052
|
+
function $() {
|
13053
|
+
_classCallCheck(this, $);
|
13032
13054
|
}
|
13033
|
-
return _createClass(
|
13055
|
+
return _createClass($, null, [{
|
13034
13056
|
key: "addToDropup",
|
13035
13057
|
value:
|
13036
13058
|
// prettier-ignore
|
@@ -13047,7 +13069,7 @@ var W = /*#__PURE__*/function () {
|
|
13047
13069
|
return r.addItem(a);
|
13048
13070
|
});
|
13049
13071
|
var o = Ni.getPosition(t, s);
|
13050
|
-
|
13072
|
+
Et.addButton(e, r.buttonContainer, o), t[o].push({});
|
13051
13073
|
}
|
13052
13074
|
}, {
|
13053
13075
|
key: "addToSideContainer",
|
@@ -13055,7 +13077,7 @@ var W = /*#__PURE__*/function () {
|
|
13055
13077
|
["inside-left", "inside-right", "outside-left", "outside-right"].forEach(function (s) {
|
13056
13078
|
var r = s;
|
13057
13079
|
t[r].forEach(function (o) {
|
13058
|
-
|
13080
|
+
Et.addButton(e, o.button.elementRef, r);
|
13059
13081
|
});
|
13060
13082
|
});
|
13061
13083
|
}
|
@@ -13082,12 +13104,12 @@ var W = /*#__PURE__*/function () {
|
|
13082
13104
|
}, {
|
13083
13105
|
key: "generatePositionToButtons",
|
13084
13106
|
value: function generatePositionToButtons(e) {
|
13085
|
-
var t =
|
13107
|
+
var t = $.createPositionsToButtonsObj();
|
13086
13108
|
Object.keys(e).forEach(function (s) {
|
13087
13109
|
var o;
|
13088
13110
|
var r = (o = e[s]) == null ? void 0 : o.button.position;
|
13089
|
-
r &&
|
13090
|
-
}), t["inside-right"].length === 0 && e.submit &&
|
13111
|
+
r && $.setPosition(e, s, t[r]);
|
13112
|
+
}), t["inside-right"].length === 0 && e.submit && $.setPosition(e, "submit", t["inside-right"]), t["outside-right"].length === 0 && (e.submit ? $.setPosition(e, "submit", t["outside-right"]) : e.microphone ? $.setPosition(e, "microphone", t["outside-right"]) : e.camera ? $.setPosition(e, "camera", t["outside-right"]) : e["".concat(st.INDICATOR_PREFIX, "1")] && $.setPosition(e, "".concat(st.INDICATOR_PREFIX, "1"), t["outside-right"])), e.submit && $.setPosition(e, "submit", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]), e.microphone && $.setPosition(e, "microphone", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]);
|
13091
13113
|
var i = Object.keys(e);
|
13092
13114
|
return i.length > 1 || t["dropup-menu"].length > 0 ? (Ys.forEach(function (s) {
|
13093
13115
|
e[s] && t["dropup-menu"].push(_objectSpread(_objectSpread({}, e[s]), {}, {
|
@@ -13098,14 +13120,14 @@ var W = /*#__PURE__*/function () {
|
|
13098
13120
|
r.startsWith(st.INDICATOR_PREFIX) && e[r] && t["dropup-menu"].push(_objectSpread(_objectSpread({}, e[r]), {}, {
|
13099
13121
|
customType: r
|
13100
13122
|
}));
|
13101
|
-
})) : i.length === 1 &&
|
13123
|
+
})) : i.length === 1 && $.setPosition(e, i[0], t["outside-right"].length === 0 ? t["outside-right"] : t["outside-left"]), t;
|
13102
13124
|
}
|
13103
13125
|
// prettier-ignore
|
13104
13126
|
}, {
|
13105
13127
|
key: "addButtons",
|
13106
13128
|
value: function addButtons(e, t, i, s) {
|
13107
|
-
var r =
|
13108
|
-
return
|
13129
|
+
var r = $.generatePositionToButtons(t);
|
13130
|
+
return $.addToSideContainer(e, r), r["dropup-menu"].length > 0 && $.addToDropup(e, r, i, s), r;
|
13109
13131
|
}
|
13110
13132
|
}]);
|
13111
13133
|
}();
|
@@ -13201,17 +13223,17 @@ var Gi = /*#__PURE__*/function (_ct4) {
|
|
13201
13223
|
function ua(n) {
|
13202
13224
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n["default"] : n;
|
13203
13225
|
}
|
13204
|
-
var
|
13205
|
-
Et = {},
|
13226
|
+
var mi = {},
|
13206
13227
|
St = {},
|
13207
13228
|
_t = {},
|
13208
13229
|
xt = {},
|
13230
|
+
At = {},
|
13209
13231
|
Zs;
|
13210
13232
|
function Vi() {
|
13211
|
-
if (Zs) return
|
13212
|
-
Zs = 1, Object.defineProperty(
|
13233
|
+
if (Zs) return At;
|
13234
|
+
Zs = 1, Object.defineProperty(At, "__esModule", {
|
13213
13235
|
value: !0
|
13214
|
-
}),
|
13236
|
+
}), At.Text = void 0;
|
13215
13237
|
var n = /*#__PURE__*/function () {
|
13216
13238
|
function n() {
|
13217
13239
|
_classCallCheck(this, n);
|
@@ -13240,14 +13262,14 @@ function Vi() {
|
|
13240
13262
|
}
|
13241
13263
|
}]);
|
13242
13264
|
}();
|
13243
|
-
return
|
13265
|
+
return At.Text = n, n.FIRST_CHAR_REGEX = /\S/, n.DOUBLE_LINE = /\n\n/g, n.ONE_LINE = /\n/g, At;
|
13244
13266
|
}
|
13245
13267
|
var Qs;
|
13246
13268
|
function Dn() {
|
13247
|
-
if (Qs) return
|
13248
|
-
Qs = 1, Object.defineProperty(
|
13269
|
+
if (Qs) return xt;
|
13270
|
+
Qs = 1, Object.defineProperty(xt, "__esModule", {
|
13249
13271
|
value: !0
|
13250
|
-
}),
|
13272
|
+
}), xt.Translate = void 0;
|
13251
13273
|
var n = Vi();
|
13252
13274
|
var e = /*#__PURE__*/function () {
|
13253
13275
|
function e() {
|
@@ -13262,14 +13284,14 @@ function Dn() {
|
|
13262
13284
|
}
|
13263
13285
|
}]);
|
13264
13286
|
}();
|
13265
|
-
return
|
13287
|
+
return xt.Translate = e, xt;
|
13266
13288
|
}
|
13267
13289
|
var en;
|
13268
13290
|
function fa() {
|
13269
|
-
if (en) return
|
13270
|
-
en = 1, Object.defineProperty(
|
13291
|
+
if (en) return _t;
|
13292
|
+
en = 1, Object.defineProperty(_t, "__esModule", {
|
13271
13293
|
value: !0
|
13272
|
-
}),
|
13294
|
+
}), _t.WebSpeechTranscript = void 0;
|
13273
13295
|
var n = Dn();
|
13274
13296
|
var e = /*#__PURE__*/function () {
|
13275
13297
|
function e() {
|
@@ -13306,7 +13328,7 @@ function fa() {
|
|
13306
13328
|
}
|
13307
13329
|
}]);
|
13308
13330
|
}();
|
13309
|
-
return
|
13331
|
+
return _t.WebSpeechTranscript = e, _t;
|
13310
13332
|
}
|
13311
13333
|
var wt = {},
|
13312
13334
|
tn;
|
@@ -13322,14 +13344,14 @@ function Rs() {
|
|
13322
13344
|
return n._IS_SAFARI === void 0 && (n._IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), n._IS_SAFARI;
|
13323
13345
|
}, wt;
|
13324
13346
|
}
|
13325
|
-
var
|
13326
|
-
|
13347
|
+
var Tt = {},
|
13348
|
+
Ct = {},
|
13327
13349
|
sn;
|
13328
13350
|
function pa() {
|
13329
|
-
if (sn) return
|
13330
|
-
sn = 1, Object.defineProperty(
|
13351
|
+
if (sn) return Ct;
|
13352
|
+
sn = 1, Object.defineProperty(Ct, "__esModule", {
|
13331
13353
|
value: !0
|
13332
|
-
}),
|
13354
|
+
}), Ct.EventListeners = void 0;
|
13333
13355
|
var n = /*#__PURE__*/function () {
|
13334
13356
|
function n() {
|
13335
13357
|
_classCallCheck(this, n);
|
@@ -13372,15 +13394,15 @@ function pa() {
|
|
13372
13394
|
}
|
13373
13395
|
}]);
|
13374
13396
|
}();
|
13375
|
-
return
|
13397
|
+
return Ct.EventListeners = n, n.KEY_DOWN_TIMEOUT = null, Ct;
|
13376
13398
|
}
|
13377
|
-
var
|
13399
|
+
var Rt = {},
|
13378
13400
|
nn;
|
13379
13401
|
function ma() {
|
13380
|
-
if (nn) return
|
13381
|
-
nn = 1, Object.defineProperty(
|
13402
|
+
if (nn) return Rt;
|
13403
|
+
nn = 1, Object.defineProperty(Rt, "__esModule", {
|
13382
13404
|
value: !0
|
13383
|
-
}),
|
13405
|
+
}), Rt.PreResultUtils = void 0;
|
13384
13406
|
var n = /*#__PURE__*/function () {
|
13385
13407
|
function n() {
|
13386
13408
|
_classCallCheck(this, n);
|
@@ -13395,16 +13417,16 @@ function ma() {
|
|
13395
13417
|
}
|
13396
13418
|
}]);
|
13397
13419
|
}();
|
13398
|
-
return
|
13420
|
+
return Rt.PreResultUtils = n, Rt;
|
13399
13421
|
}
|
13400
|
-
var
|
13401
|
-
|
13422
|
+
var Mt = {},
|
13423
|
+
kt = {},
|
13402
13424
|
rn;
|
13403
13425
|
function Bn() {
|
13404
|
-
if (rn) return
|
13405
|
-
rn = 1, Object.defineProperty(
|
13426
|
+
if (rn) return kt;
|
13427
|
+
rn = 1, Object.defineProperty(kt, "__esModule", {
|
13406
13428
|
value: !0
|
13407
|
-
}),
|
13429
|
+
}), kt.AutoScroll = void 0;
|
13408
13430
|
var n = /*#__PURE__*/function () {
|
13409
13431
|
function n() {
|
13410
13432
|
_classCallCheck(this, n);
|
@@ -13440,15 +13462,15 @@ function Bn() {
|
|
13440
13462
|
}
|
13441
13463
|
}]);
|
13442
13464
|
}();
|
13443
|
-
return
|
13465
|
+
return kt.AutoScroll = n, kt;
|
13444
13466
|
}
|
13445
|
-
var
|
13467
|
+
var Lt = {},
|
13446
13468
|
on;
|
13447
13469
|
function Ki() {
|
13448
|
-
if (on) return
|
13449
|
-
on = 1, Object.defineProperty(
|
13470
|
+
if (on) return Lt;
|
13471
|
+
on = 1, Object.defineProperty(Lt, "__esModule", {
|
13450
13472
|
value: !0
|
13451
|
-
}),
|
13473
|
+
}), Lt.Elements = void 0;
|
13452
13474
|
var n = /*#__PURE__*/function () {
|
13453
13475
|
function n() {
|
13454
13476
|
_classCallCheck(this, n);
|
@@ -13495,15 +13517,15 @@ function Ki() {
|
|
13495
13517
|
}
|
13496
13518
|
}]);
|
13497
13519
|
}();
|
13498
|
-
return
|
13520
|
+
return Lt.Elements = n, Lt;
|
13499
13521
|
}
|
13500
|
-
var
|
13522
|
+
var It = {},
|
13501
13523
|
an;
|
13502
13524
|
function Wi() {
|
13503
|
-
if (an) return
|
13504
|
-
an = 1, Object.defineProperty(
|
13525
|
+
if (an) return It;
|
13526
|
+
an = 1, Object.defineProperty(It, "__esModule", {
|
13505
13527
|
value: !0
|
13506
|
-
}),
|
13528
|
+
}), It.Cursor = void 0;
|
13507
13529
|
var n = /*#__PURE__*/function () {
|
13508
13530
|
function n() {
|
13509
13531
|
_classCallCheck(this, n);
|
@@ -13584,14 +13606,14 @@ function Wi() {
|
|
13584
13606
|
}
|
13585
13607
|
}]);
|
13586
13608
|
}();
|
13587
|
-
return
|
13609
|
+
return It.Cursor = n, It;
|
13588
13610
|
}
|
13589
13611
|
var ln;
|
13590
13612
|
function Fn() {
|
13591
|
-
if (ln) return
|
13592
|
-
ln = 1, Object.defineProperty(
|
13613
|
+
if (ln) return Mt;
|
13614
|
+
ln = 1, Object.defineProperty(Mt, "__esModule", {
|
13593
13615
|
value: !0
|
13594
|
-
}),
|
13616
|
+
}), Mt.CommandUtils = void 0;
|
13595
13617
|
var n = Bn(),
|
13596
13618
|
e = Ki(),
|
13597
13619
|
t = Rs(),
|
@@ -13691,15 +13713,15 @@ function Fn() {
|
|
13691
13713
|
}
|
13692
13714
|
}]);
|
13693
13715
|
}();
|
13694
|
-
return
|
13716
|
+
return Mt.CommandUtils = r, Mt;
|
13695
13717
|
}
|
13696
|
-
var
|
13718
|
+
var Ot = {},
|
13697
13719
|
cn;
|
13698
13720
|
function ga() {
|
13699
|
-
if (cn) return
|
13700
|
-
cn = 1, Object.defineProperty(
|
13721
|
+
if (cn) return Ot;
|
13722
|
+
cn = 1, Object.defineProperty(Ot, "__esModule", {
|
13701
13723
|
value: !0
|
13702
|
-
}),
|
13724
|
+
}), Ot.Highlight = void 0;
|
13703
13725
|
var n = Ki(),
|
13704
13726
|
e = Wi();
|
13705
13727
|
var t = /*#__PURE__*/function () {
|
@@ -13750,15 +13772,15 @@ function ga() {
|
|
13750
13772
|
}
|
13751
13773
|
}]);
|
13752
13774
|
}();
|
13753
|
-
return
|
13775
|
+
return Ot.Highlight = t, Ot;
|
13754
13776
|
}
|
13755
|
-
var
|
13777
|
+
var Pt = {},
|
13756
13778
|
dn;
|
13757
13779
|
function ba() {
|
13758
|
-
if (dn) return
|
13759
|
-
dn = 1, Object.defineProperty(
|
13780
|
+
if (dn) return Pt;
|
13781
|
+
dn = 1, Object.defineProperty(Pt, "__esModule", {
|
13760
13782
|
value: !0
|
13761
|
-
}),
|
13783
|
+
}), Pt.Padding = void 0;
|
13762
13784
|
var n = Ki(),
|
13763
13785
|
e = Wi(),
|
13764
13786
|
t = Vi();
|
@@ -13819,14 +13841,14 @@ function ba() {
|
|
13819
13841
|
}
|
13820
13842
|
}]);
|
13821
13843
|
}();
|
13822
|
-
return
|
13844
|
+
return Pt.Padding = i, Pt;
|
13823
13845
|
}
|
13824
13846
|
var hn;
|
13825
13847
|
function Un() {
|
13826
|
-
if (hn) return
|
13827
|
-
hn = 1, Object.defineProperty(
|
13848
|
+
if (hn) return Tt;
|
13849
|
+
hn = 1, Object.defineProperty(Tt, "__esModule", {
|
13828
13850
|
value: !0
|
13829
|
-
}),
|
13851
|
+
}), Tt.Speech = void 0;
|
13830
13852
|
var n = pa(),
|
13831
13853
|
e = ma(),
|
13832
13854
|
t = Fn(),
|
@@ -13945,14 +13967,14 @@ function Un() {
|
|
13945
13967
|
}
|
13946
13968
|
}]);
|
13947
13969
|
}();
|
13948
|
-
return
|
13970
|
+
return Tt.Speech = d, Tt;
|
13949
13971
|
}
|
13950
13972
|
var un;
|
13951
13973
|
function va() {
|
13952
|
-
if (un) return
|
13953
|
-
un = 1, Object.defineProperty(
|
13974
|
+
if (un) return St;
|
13975
|
+
un = 1, Object.defineProperty(St, "__esModule", {
|
13954
13976
|
value: !0
|
13955
|
-
}),
|
13977
|
+
}), St.WebSpeech = void 0;
|
13956
13978
|
var n = fa(),
|
13957
13979
|
e = Rs(),
|
13958
13980
|
t = Un();
|
@@ -14020,15 +14042,15 @@ function va() {
|
|
14020
14042
|
}
|
14021
14043
|
}]);
|
14022
14044
|
}(t.Speech);
|
14023
|
-
return
|
14045
|
+
return St.WebSpeech = i, St;
|
14024
14046
|
}
|
14025
|
-
var
|
14047
|
+
var Nt = {},
|
14026
14048
|
fn;
|
14027
14049
|
function ya() {
|
14028
|
-
if (fn) return
|
14029
|
-
fn = 1, Object.defineProperty(
|
14050
|
+
if (fn) return Nt;
|
14051
|
+
fn = 1, Object.defineProperty(Nt, "__esModule", {
|
14030
14052
|
value: !0
|
14031
|
-
}),
|
14053
|
+
}), Nt.GlobalState = void 0;
|
14032
14054
|
var n = /*#__PURE__*/function () {
|
14033
14055
|
function n() {
|
14034
14056
|
_classCallCheck(this, n);
|
@@ -14042,16 +14064,16 @@ function ya() {
|
|
14042
14064
|
}
|
14043
14065
|
}]);
|
14044
14066
|
}();
|
14045
|
-
return
|
14067
|
+
return Nt.GlobalState = n, n.doubleClickPending = !1, Nt;
|
14046
14068
|
}
|
14047
|
-
var
|
14048
|
-
|
14069
|
+
var Dt = {},
|
14070
|
+
Bt = {},
|
14049
14071
|
pn;
|
14050
14072
|
function Ea() {
|
14051
|
-
if (pn) return
|
14052
|
-
pn = 1, Object.defineProperty(
|
14073
|
+
if (pn) return Bt;
|
14074
|
+
pn = 1, Object.defineProperty(Bt, "__esModule", {
|
14053
14075
|
value: !0
|
14054
|
-
}),
|
14076
|
+
}), Bt.PreventConnectionStop = void 0;
|
14055
14077
|
var n = /*#__PURE__*/function () {
|
14056
14078
|
function n() {
|
14057
14079
|
_classCallCheck(this, n);
|
@@ -14070,22 +14092,22 @@ function Ea() {
|
|
14070
14092
|
}
|
14071
14093
|
}]);
|
14072
14094
|
}();
|
14073
|
-
return
|
14095
|
+
return Bt.PreventConnectionStop = n, Bt;
|
14074
14096
|
}
|
14075
|
-
var
|
14076
|
-
|
14097
|
+
var Ft = {},
|
14098
|
+
Ut = {},
|
14077
14099
|
mn;
|
14078
14100
|
function Sa() {
|
14079
|
-
return mn || (mn = 1, Object.defineProperty(
|
14101
|
+
return mn || (mn = 1, Object.defineProperty(Ut, "__esModule", {
|
14080
14102
|
value: !0
|
14081
|
-
}),
|
14103
|
+
}), Ut.README_URL = void 0, Ut.README_URL = "https://github.com/OvidijusParsiunas/speech-to-element"), Ut;
|
14082
14104
|
}
|
14083
14105
|
var gn;
|
14084
14106
|
function _a() {
|
14085
|
-
if (gn) return
|
14086
|
-
gn = 1, Object.defineProperty(
|
14107
|
+
if (gn) return Ft;
|
14108
|
+
gn = 1, Object.defineProperty(Ft, "__esModule", {
|
14087
14109
|
value: !0
|
14088
|
-
}),
|
14110
|
+
}), Ft.AzureSpeechConfig = void 0;
|
14089
14111
|
var n = Sa();
|
14090
14112
|
var e = /*#__PURE__*/function () {
|
14091
14113
|
function e() {
|
@@ -14154,15 +14176,15 @@ function _a() {
|
|
14154
14176
|
}()
|
14155
14177
|
}]);
|
14156
14178
|
}();
|
14157
|
-
return
|
14179
|
+
return Ft.AzureSpeechConfig = e, Ft;
|
14158
14180
|
}
|
14159
|
-
var
|
14181
|
+
var jt = {},
|
14160
14182
|
bn;
|
14161
14183
|
function xa() {
|
14162
|
-
if (bn) return
|
14163
|
-
bn = 1, Object.defineProperty(
|
14184
|
+
if (bn) return jt;
|
14185
|
+
bn = 1, Object.defineProperty(jt, "__esModule", {
|
14164
14186
|
value: !0
|
14165
|
-
}),
|
14187
|
+
}), jt.StopTimeout = void 0;
|
14166
14188
|
var n = /*#__PURE__*/function () {
|
14167
14189
|
function n() {
|
14168
14190
|
_classCallCheck(this, n);
|
@@ -14186,15 +14208,15 @@ function xa() {
|
|
14186
14208
|
}
|
14187
14209
|
}]);
|
14188
14210
|
}();
|
14189
|
-
return
|
14211
|
+
return jt.StopTimeout = n, n.DEFAULT_MS = 2e4, jt;
|
14190
14212
|
}
|
14191
|
-
var
|
14213
|
+
var Ht = {},
|
14192
14214
|
vn;
|
14193
|
-
function
|
14194
|
-
if (vn) return
|
14195
|
-
vn = 1, Object.defineProperty(
|
14215
|
+
function Aa() {
|
14216
|
+
if (vn) return Ht;
|
14217
|
+
vn = 1, Object.defineProperty(Ht, "__esModule", {
|
14196
14218
|
value: !0
|
14197
|
-
}),
|
14219
|
+
}), Ht.AzureAudioConfig = void 0;
|
14198
14220
|
var n = /*#__PURE__*/function () {
|
14199
14221
|
function n() {
|
14200
14222
|
_classCallCheck(this, n);
|
@@ -14206,15 +14228,15 @@ function wa() {
|
|
14206
14228
|
}
|
14207
14229
|
}]);
|
14208
14230
|
}();
|
14209
|
-
return
|
14231
|
+
return Ht.AzureAudioConfig = n, Ht;
|
14210
14232
|
}
|
14211
|
-
var
|
14233
|
+
var qt = {},
|
14212
14234
|
yn;
|
14213
|
-
function
|
14214
|
-
if (yn) return
|
14215
|
-
yn = 1, Object.defineProperty(
|
14235
|
+
function wa() {
|
14236
|
+
if (yn) return qt;
|
14237
|
+
yn = 1, Object.defineProperty(qt, "__esModule", {
|
14216
14238
|
value: !0
|
14217
|
-
}),
|
14239
|
+
}), qt.AzureTranscript = void 0;
|
14218
14240
|
var n = Dn();
|
14219
14241
|
var e = /*#__PURE__*/function () {
|
14220
14242
|
function e() {
|
@@ -14237,19 +14259,19 @@ function Aa() {
|
|
14237
14259
|
}
|
14238
14260
|
}]);
|
14239
14261
|
}();
|
14240
|
-
return
|
14262
|
+
return qt.AzureTranscript = e, qt;
|
14241
14263
|
}
|
14242
14264
|
var En;
|
14243
14265
|
function Ta() {
|
14244
|
-
if (En) return
|
14245
|
-
En = 1, Object.defineProperty(
|
14266
|
+
if (En) return Dt;
|
14267
|
+
En = 1, Object.defineProperty(Dt, "__esModule", {
|
14246
14268
|
value: !0
|
14247
|
-
}),
|
14269
|
+
}), Dt.Azure = void 0;
|
14248
14270
|
var n = Ea(),
|
14249
14271
|
e = _a(),
|
14250
14272
|
t = xa(),
|
14251
|
-
i =
|
14252
|
-
s =
|
14273
|
+
i = Aa(),
|
14274
|
+
s = wa(),
|
14253
14275
|
r = Un();
|
14254
14276
|
var o = /*#__PURE__*/function (_r$Speech) {
|
14255
14277
|
function o() {
|
@@ -14415,12 +14437,12 @@ function Ta() {
|
|
14415
14437
|
}
|
14416
14438
|
}]);
|
14417
14439
|
}(r.Speech);
|
14418
|
-
return
|
14440
|
+
return Dt.Azure = o, Dt;
|
14419
14441
|
}
|
14420
14442
|
var Sn;
|
14421
14443
|
function Ca() {
|
14422
|
-
if (Sn) return
|
14423
|
-
Sn = 1, Object.defineProperty(
|
14444
|
+
if (Sn) return mi;
|
14445
|
+
Sn = 1, Object.defineProperty(mi, "__esModule", {
|
14424
14446
|
value: !0
|
14425
14447
|
});
|
14426
14448
|
var n = va(),
|
@@ -14467,10 +14489,10 @@ function Ca() {
|
|
14467
14489
|
}
|
14468
14490
|
}]);
|
14469
14491
|
}();
|
14470
|
-
return
|
14492
|
+
return mi["default"] = s, mi;
|
14471
14493
|
}
|
14472
14494
|
var Ra = Ca();
|
14473
|
-
var
|
14495
|
+
var gi = /* @__PURE__ */ua(Ra);
|
14474
14496
|
var Ma = /*#__PURE__*/function () {
|
14475
14497
|
function Ma(e, t) {
|
14476
14498
|
_classCallCheck(this, Ma);
|
@@ -14482,7 +14504,7 @@ var Ma = /*#__PURE__*/function () {
|
|
14482
14504
|
var _this73 = this;
|
14483
14505
|
this._silenceTimeout = setTimeout(function () {
|
14484
14506
|
var i;
|
14485
|
-
(i = e.submit) == null || i.call(e),
|
14507
|
+
(i = e.submit) == null || i.call(e), gi.stop(), _this73._stop || setTimeout(t, oi.MICROPHONE_RESET_TIMEOUT_MS);
|
14486
14508
|
}, this._silenceMS);
|
14487
14509
|
}
|
14488
14510
|
}, {
|
@@ -14511,7 +14533,7 @@ var Zt = /*#__PURE__*/function (_Gi) {
|
|
14511
14533
|
var _this74$processConfig = _this74.processConfiguration(t, e.speechToText),
|
14512
14534
|
r = _this74$processConfig.serviceName,
|
14513
14535
|
o = _this74$processConfig.processedConfig;
|
14514
|
-
if (_this74._addErrorMessage = i, r === "webspeech" && !
|
14536
|
+
if (_this74._addErrorMessage = i, r === "webspeech" && !gi.isWebSpeechSupported()) _this74.changeToUnsupported();else {
|
14515
14537
|
var a = !e.textInput || !e.textInput.disabled;
|
14516
14538
|
_this74.elementRef.onclick = _this74.buttonClick.bind(_this74, t, a, r, o);
|
14517
14539
|
}
|
@@ -14542,7 +14564,7 @@ var Zt = /*#__PURE__*/function (_Gi) {
|
|
14542
14564
|
return d.toLowerCase().includes(a) ? (setTimeout(function () {
|
14543
14565
|
var u;
|
14544
14566
|
return (u = e.submit) == null ? void 0 : u.call(e);
|
14545
|
-
}),
|
14567
|
+
}), gi.endCommandMode(), {
|
14546
14568
|
restart: !0,
|
14547
14569
|
removeNewText: !0
|
14548
14570
|
}) : null;
|
@@ -14556,7 +14578,7 @@ var Zt = /*#__PURE__*/function (_Gi) {
|
|
14556
14578
|
value: function buttonClick(e, t, i, s) {
|
14557
14579
|
var _this75 = this;
|
14558
14580
|
var r = s == null ? void 0 : s.events;
|
14559
|
-
e.removePlaceholderStyle(),
|
14581
|
+
e.removePlaceholderStyle(), gi.toggle(i, _objectSpread({
|
14560
14582
|
insertInCursorLocation: !1,
|
14561
14583
|
element: t ? e.inputElementRef : void 0,
|
14562
14584
|
onError: function onError() {
|
@@ -14615,20 +14637,21 @@ var Zt = /*#__PURE__*/function (_Gi) {
|
|
14615
14637
|
}]);
|
14616
14638
|
}(Gi);
|
14617
14639
|
Zt.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
14618
|
-
var
|
14640
|
+
var oi = Zt;
|
14619
14641
|
var Ne = /*#__PURE__*/function () {
|
14620
14642
|
// prettier-ignore
|
14621
|
-
function Ne(e, t, i, s) {
|
14643
|
+
function Ne(e, t, i, s, r) {
|
14622
14644
|
var _this76 = this;
|
14623
14645
|
_classCallCheck(this, Ne);
|
14624
|
-
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", this._hiddenAttachments = /* @__PURE__ */new Set(),
|
14625
|
-
_this76._validationHandler = e._validationHandler;
|
14646
|
+
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", this._hiddenAttachments = /* @__PURE__ */new Set(), i.maxNumberOfFiles && (this._fileCountLimit = i.maxNumberOfFiles), this._toggleContainerDisplay = s, this._fileAttachmentsContainerRef = r, i.acceptedFormats && (this._acceptedFormat = i.acceptedFormats), setTimeout(function () {
|
14647
|
+
_this76._validationHandler = e._validationHandler, _this76._onInput = t.onInput;
|
14626
14648
|
});
|
14627
14649
|
}
|
14628
14650
|
return _createClass(Ne, [{
|
14629
14651
|
key: "attemptAddFile",
|
14630
14652
|
value: function attemptAddFile(e, t) {
|
14631
|
-
|
14653
|
+
var i;
|
14654
|
+
return Ne.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), (i = this._onInput) == null || i.call(this, !0), !0) : !1;
|
14632
14655
|
}
|
14633
14656
|
}, {
|
14634
14657
|
key: "addAttachmentBasedOnType",
|
@@ -14638,7 +14661,7 @@ var Ne = /*#__PURE__*/function () {
|
|
14638
14661
|
var r = Ne.createImageAttachment(t);
|
14639
14662
|
this.addFileAttachment(e, "image", r, i);
|
14640
14663
|
} else if (s === "audio") {
|
14641
|
-
var _r3 =
|
14664
|
+
var _r3 = ai.createAudioAttachment(t);
|
14642
14665
|
this.addFileAttachment(e, "audio", _r3, i);
|
14643
14666
|
} else {
|
14644
14667
|
var _r4 = Ne.createAnyFileAttachment(e.name);
|
@@ -14673,13 +14696,14 @@ var Ne = /*#__PURE__*/function () {
|
|
14673
14696
|
}
|
14674
14697
|
}, {
|
14675
14698
|
key: "removeAttachment",
|
14676
|
-
value: function removeAttachment(e) {
|
14677
|
-
var
|
14678
|
-
|
14679
|
-
|
14699
|
+
value: function removeAttachment(e, t) {
|
14700
|
+
var r, o;
|
14701
|
+
(r = this._onInput) == null || r.call(this, !!(t != null && t.isTrusted));
|
14702
|
+
var i = this._attachments.findIndex(function (a) {
|
14703
|
+
return a === e;
|
14680
14704
|
}),
|
14681
|
-
|
14682
|
-
this._attachments.splice(
|
14705
|
+
s = this._attachments[i].attachmentContainerElement;
|
14706
|
+
this._attachments.splice(i, 1), ai.stopAttachmentPlayback(s), s.remove(), this._toggleContainerDisplay(!1), (o = this._validationHandler) == null || o.call(this);
|
14683
14707
|
}
|
14684
14708
|
}, {
|
14685
14709
|
key: "getFiles",
|
@@ -14716,9 +14740,10 @@ var Ne = /*#__PURE__*/function () {
|
|
14716
14740
|
key: "readdAttachments",
|
14717
14741
|
value: function readdAttachments() {
|
14718
14742
|
var _this78 = this;
|
14719
|
-
|
14720
|
-
|
14721
|
-
|
14743
|
+
var e;
|
14744
|
+
Array.from(this._hiddenAttachments).forEach(function (t) {
|
14745
|
+
_this78._fileAttachmentsContainerRef.appendChild(t.attachmentContainerElement), _this78._attachments.push(t);
|
14746
|
+
}), (e = this._onInput) == null || e.call(this, !1), this._hiddenAttachments.clear();
|
14722
14747
|
}
|
14723
14748
|
}], [{
|
14724
14749
|
key: "isFileTypeValid",
|
@@ -14770,9 +14795,9 @@ var Ne = /*#__PURE__*/function () {
|
|
14770
14795
|
}();
|
14771
14796
|
var Oe = /*#__PURE__*/function (_Ne) {
|
14772
14797
|
// prettier-ignore
|
14773
|
-
function Oe(e, t, i, s) {
|
14798
|
+
function Oe(e, t, i, s, r) {
|
14774
14799
|
_classCallCheck(this, Oe);
|
14775
|
-
return _callSuper(this, Oe, [e, t, i, s]);
|
14800
|
+
return _callSuper(this, Oe, [e, t, i, s, r]);
|
14776
14801
|
}
|
14777
14802
|
_inherits(Oe, _Ne);
|
14778
14803
|
return _createClass(Oe, [{
|
@@ -14850,7 +14875,7 @@ var Oe = /*#__PURE__*/function (_Ne) {
|
|
14850
14875
|
}, {
|
14851
14876
|
key: "addAudioElements",
|
14852
14877
|
value: function addAudioElements(e, t) {
|
14853
|
-
var i = e.parentElement ?
|
14878
|
+
var i = e.parentElement ? V.cloneElement(e) : e,
|
14854
14879
|
s = document.createElement("audio");
|
14855
14880
|
s.src = t;
|
14856
14881
|
var r = Ue.createSVGElement(Pn);
|
@@ -14881,7 +14906,7 @@ var Oe = /*#__PURE__*/function (_Ne) {
|
|
14881
14906
|
}]);
|
14882
14907
|
}(Ne);
|
14883
14908
|
Oe.TIMER_LIMIT_S = 5999;
|
14884
|
-
var
|
14909
|
+
var ai = Oe;
|
14885
14910
|
var ka = /*#__PURE__*/function () {
|
14886
14911
|
function ka() {
|
14887
14912
|
_classCallCheck(this, ka);
|
@@ -14890,24 +14915,24 @@ var ka = /*#__PURE__*/function () {
|
|
14890
14915
|
key: "create",
|
14891
14916
|
value:
|
14892
14917
|
// prettier-ignore
|
14893
|
-
function create(e, t, i, s, r) {
|
14894
|
-
return
|
14918
|
+
function create(e, t, i, s, r, o) {
|
14919
|
+
return o === "audio" ? new ai(e, t, i, s, r) : new Ne(e, t, i, s, r);
|
14895
14920
|
}
|
14896
14921
|
}]);
|
14897
14922
|
}();
|
14898
|
-
var
|
14899
|
-
function
|
14900
|
-
_classCallCheck(this,
|
14923
|
+
var hi = /*#__PURE__*/function () {
|
14924
|
+
function hi(e, t, i) {
|
14925
|
+
_classCallCheck(this, hi);
|
14901
14926
|
this._fileAttachmentsTypes = [], this.elementRef = this.createAttachmentContainer();
|
14902
14927
|
var s = _typeof(i) == "object" && !!i.displayFileAttachmentContainer;
|
14903
14928
|
this.toggleContainerDisplay(s), e.appendChild(this.elementRef), t && Object.assign(this.elementRef.style, t);
|
14904
14929
|
}
|
14905
14930
|
// prettier-ignore
|
14906
|
-
return _createClass(
|
14931
|
+
return _createClass(hi, [{
|
14907
14932
|
key: "addType",
|
14908
|
-
value: function addType(e, t, i) {
|
14909
|
-
var
|
14910
|
-
return this._fileAttachmentsTypes.push(
|
14933
|
+
value: function addType(e, t, i, s) {
|
14934
|
+
var r = ka.create(e, t, i, this.toggleContainerDisplay.bind(this), this.elementRef, s);
|
14935
|
+
return this._fileAttachmentsTypes.push(r), r;
|
14911
14936
|
}
|
14912
14937
|
}, {
|
14913
14938
|
key: "createAttachmentContainer",
|
@@ -14967,7 +14992,7 @@ var di = /*#__PURE__*/function () {
|
|
14967
14992
|
}, {
|
14968
14993
|
key: "addFilesToAnyType",
|
14969
14994
|
value: function addFilesToAnyType(e) {
|
14970
|
-
|
14995
|
+
hi.addFilesToType(e, this._fileAttachmentsTypes);
|
14971
14996
|
}
|
14972
14997
|
}, {
|
14973
14998
|
key: "hideFiles",
|
@@ -15149,7 +15174,7 @@ var Di = /*#__PURE__*/function (_ct5) {
|
|
15149
15174
|
}, {
|
15150
15175
|
key: "import",
|
15151
15176
|
value: function _import(e) {
|
15152
|
-
|
15177
|
+
hi.addFilesToType(Array.from(e.files || []), [this._fileAttachmentsType]), e.value = "";
|
15153
15178
|
}
|
15154
15179
|
}, {
|
15155
15180
|
key: "addClickEvent",
|
@@ -15298,7 +15323,7 @@ var $e = /*#__PURE__*/function () {
|
|
15298
15323
|
value: function validateWebsocket(e, t) {
|
15299
15324
|
var i = e.websocket,
|
15300
15325
|
s = e.connectSettings;
|
15301
|
-
return i && s.url !== ye.URL && !
|
15326
|
+
return i && s.url !== ye.URL && !q.canSendMessage(i) ? (t.changeToDisabledIcon(), !1) : !0;
|
15302
15327
|
}
|
15303
15328
|
// prettier-ignore
|
15304
15329
|
}, {
|
@@ -15713,7 +15738,7 @@ var P = /*#__PURE__*/function (_ct6) {
|
|
15713
15738
|
var _this92 = this;
|
15714
15739
|
this.elementRef.classList.contains(P.SUBMIT_CLASS) || (this.elementRef.classList.remove(P.LOADING_CLASS, P.DISABLED_CLASS), N.removeAriaAttributes(this.elementRef), this.elementRef.classList.add(P.SUBMIT_CLASS), this.changeElementsByState(this._innerElements.submit), it.resetSubmit(this, this.status.loadingActive), this.elementRef.onclick = function () {
|
15715
15740
|
var e;
|
15716
|
-
_this92.submitFromInput(), (e = _this92._microphoneButton) != null && e.isActive &&
|
15741
|
+
_this92.submitFromInput(), (e = _this92._microphoneButton) != null && e.isActive && oi.toggleSpeechAfterSubmit(_this92._microphoneButton.elementRef, !!_this92._stopSTTAfterSubmit);
|
15717
15742
|
});
|
15718
15743
|
}
|
15719
15744
|
// called every time when user triggers an input via ValidationHandler - hence use class to check if not already present
|
@@ -15790,7 +15815,7 @@ var Ms = /*#__PURE__*/function (_tt) {
|
|
15790
15815
|
_this94.capture();
|
15791
15816
|
}, t.addEventListener("click", this.stop.bind(this)), i.onclick = function () {
|
15792
15817
|
var r = _this94.getFile();
|
15793
|
-
r &&
|
15818
|
+
r && hi.addFilesToType([r], [s]), _this94.stop(), _this94.close();
|
15794
15819
|
};
|
15795
15820
|
}
|
15796
15821
|
}, {
|
@@ -15905,36 +15930,36 @@ var ks = /*#__PURE__*/function (_ct7) {
|
|
15905
15930
|
}
|
15906
15931
|
}]);
|
15907
15932
|
}(ct);
|
15908
|
-
var
|
15909
|
-
function
|
15910
|
-
_classCallCheck(this,
|
15911
|
-
this.elementRef =
|
15933
|
+
var ht = /*#__PURE__*/function () {
|
15934
|
+
function ht(e, t, i, s) {
|
15935
|
+
_classCallCheck(this, ht);
|
15936
|
+
this.elementRef = ht.createPanelElement(e.inputAreaStyle);
|
15912
15937
|
var r = {},
|
15913
15938
|
o = this.createFileUploadComponents(e, i, s, r),
|
15914
|
-
a = new
|
15939
|
+
a = new yi(e, i, o);
|
15915
15940
|
e.speechToText && !r.microphone && (r.microphone = {
|
15916
|
-
button: new
|
15941
|
+
button: new oi(e, a, t.addNewErrorMessage.bind(t))
|
15917
15942
|
});
|
15918
15943
|
var l = new vs(e, a, t, i, o, r);
|
15919
15944
|
a.submit = l.submitFromInput.bind(l), $e.attach(e, i, a, o, l), e.submitUserMessage = l.programmaticSubmit.bind(l), r.submit = {
|
15920
15945
|
button: l
|
15921
|
-
}, e.customButtons && st.add(e, r),
|
15946
|
+
}, e.customButtons && st.add(e, r), ht.addElements(this.elementRef, a, r, s, o, e.dropupStyles), ht.assignOnInput(e, i, o, a);
|
15922
15947
|
}
|
15923
|
-
return _createClass(
|
15948
|
+
return _createClass(ht, [{
|
15924
15949
|
key: "createFileUploadComponents",
|
15925
15950
|
value:
|
15926
15951
|
// prettier-ignore
|
15927
15952
|
function createFileUploadComponents(e, t, i, s) {
|
15928
15953
|
var o, a, l, c;
|
15929
|
-
var r = new
|
15930
|
-
if (
|
15931
|
-
var d = ((a = s.images) == null ? void 0 : a.fileType) || r.addType(e, t.camera.files, "images");
|
15954
|
+
var r = new hi(this.elementRef, e.attachmentContainerStyle, t.demo);
|
15955
|
+
if (ht.createUploadButtons(e, t, t.fileTypes || {}, r, i, s), (o = t.camera) != null && o.files) {
|
15956
|
+
var d = ((a = s.images) == null ? void 0 : a.fileType) || r.addType(e, t, t.camera.files, "images");
|
15932
15957
|
s.camera = {
|
15933
15958
|
button: new ks(i, d, t.camera)
|
15934
15959
|
};
|
15935
15960
|
}
|
15936
15961
|
if ((l = t.recordAudio) != null && l.files) {
|
15937
|
-
var _d = ((c = s.audio) == null ? void 0 : c.fileType) || r.addType(e, t.recordAudio.files, "audio");
|
15962
|
+
var _d = ((c = s.audio) == null ? void 0 : c.fileType) || r.addType(e, t, t.recordAudio.files, "audio");
|
15938
15963
|
s.microphone = {
|
15939
15964
|
button: new La(_d, t.recordAudio)
|
15940
15965
|
};
|
@@ -15950,20 +15975,20 @@ var Kt = /*#__PURE__*/function () {
|
|
15950
15975
|
}
|
15951
15976
|
}, {
|
15952
15977
|
key: "createUploadButtons",
|
15953
|
-
value: function createUploadButtons(e, t, i, s, r) {
|
15954
|
-
Object.keys(
|
15955
|
-
var
|
15956
|
-
|
15957
|
-
if (
|
15958
|
-
var
|
15959
|
-
_ha$
|
15960
|
-
|
15961
|
-
|
15962
|
-
|
15963
|
-
|
15964
|
-
|
15965
|
-
button:
|
15966
|
-
fileType:
|
15978
|
+
value: function createUploadButtons(e, t, i, s, r, o) {
|
15979
|
+
Object.keys(i).forEach(function (a) {
|
15980
|
+
var l = a,
|
15981
|
+
c = i[l];
|
15982
|
+
if (c.files) {
|
15983
|
+
var d = s.addType(e, t, c.files, l),
|
15984
|
+
_ha$l = ha[l],
|
15985
|
+
u = _ha$l.id,
|
15986
|
+
h = _ha$l.svgString,
|
15987
|
+
f = _ha$l.dropupText,
|
15988
|
+
m = new Di(r, d, c, u, h, f);
|
15989
|
+
o[l] = {
|
15990
|
+
button: m,
|
15991
|
+
fileType: d
|
15967
15992
|
};
|
15968
15993
|
}
|
15969
15994
|
});
|
@@ -15972,10 +15997,25 @@ var Kt = /*#__PURE__*/function () {
|
|
15972
15997
|
}, {
|
15973
15998
|
key: "addElements",
|
15974
15999
|
value: function addElements(e, t, i, s, r, o) {
|
15975
|
-
|
15976
|
-
var a =
|
15977
|
-
l =
|
15978
|
-
bs.set(t.inputElementRef, a, r.elementRef, l),
|
16000
|
+
V.addElements(e, t.elementRef);
|
16001
|
+
var a = Et.create(),
|
16002
|
+
l = $.addButtons(a, i, s, o);
|
16003
|
+
bs.set(t.inputElementRef, a, r.elementRef, l), Et.add(e, a);
|
16004
|
+
}
|
16005
|
+
}, {
|
16006
|
+
key: "assignOnInput",
|
16007
|
+
value: function assignOnInput(e, t, i, s) {
|
16008
|
+
t.onInput = function (r) {
|
16009
|
+
setTimeout(function () {
|
16010
|
+
var o = i.getAllFileData(),
|
16011
|
+
l = {
|
16012
|
+
text: s.inputElementRef.innerText.trim()
|
16013
|
+
};
|
16014
|
+
o && (l.files = o.map(function (c) {
|
16015
|
+
return c.file;
|
16016
|
+
})), ii.onInput(e, l, r);
|
16017
|
+
});
|
16018
|
+
};
|
15979
16019
|
}
|
15980
16020
|
}]);
|
15981
16021
|
}();
|
@@ -15989,9 +16029,9 @@ var Ls = /*#__PURE__*/function () {
|
|
15989
16029
|
var s = document.createElement("div");
|
15990
16030
|
s.id = "chat-view";
|
15991
16031
|
var r = new de(e, t, i);
|
15992
|
-
t.websocket &&
|
15993
|
-
var o = new
|
15994
|
-
return
|
16032
|
+
t.websocket && q.createConnection(t, r);
|
16033
|
+
var o = new ht(e, r, t, s);
|
16034
|
+
return V.addElements(s, r.elementRef, o.elementRef), s;
|
15995
16035
|
}
|
15996
16036
|
}, {
|
15997
16037
|
key: "render",
|
@@ -16003,7 +16043,7 @@ var Ls = /*#__PURE__*/function () {
|
|
16003
16043
|
}();
|
16004
16044
|
var Fa = "#validate-property-key-view{height:100%;position:relative;display:flex;justify-content:center;align-items:center;padding:8px}#loading-validate-key-property{display:inline-block;width:50px;height:50px}#loading-validate-key-property:after{content:\" \";display:block;width:38px;height:38px;margin:1px;border-radius:50%;border:5px solid #5fb2ff;border-color:#5fb2ff transparent #5fb2ff transparent;animation:loading-spinner 1.4s linear infinite}#deep-chat-openai-realtime-container{height:100%;width:100%}#deep-chat-openai-realtime-avatar-container{height:60%;width:100%;display:flex;justify-content:center;align-items:center}#deep-chat-openai-realtime-avatar{border-radius:50%;height:110px;border:1px solid rgb(215,215,215);padding:8px;-webkit-user-select:none;user-select:none;margin-top:20px}#deep-chat-openai-realtime-buttons-container{height:40%;display:flex;position:relative}.deep-chat-openai-realtime-button-container{height:100%;width:50%;display:flex;justify-content:center;align-items:center}.deep-chat-openai-realtime-button{width:70px;height:70px;border-radius:50%;display:flex;justify-content:center;align-items:center;cursor:pointer}.deep-chat-openai-realtime-button-default{background-color:#e3e3e3}.deep-chat-openai-realtime-button-default:hover{background-color:#d4d4d4}.deep-chat-openai-realtime-button-default:active{background-color:#c5c5c5}.deep-chat-openai-realtime-button-loading{opacity:.7;pointer-events:none}.deep-chat-openai-realtime-microphone-active{background-color:#ffe7e7}.deep-chat-openai-realtime-microphone-active:hover{background-color:#ffdede}.deep-chat-openai-realtime-microphone-active:active{background-color:#ffd2d2}.deep-chat-openai-realtime-microphone>*{height:30px;width:30px}.deep-chat-openai-realtime-microphone-active>*{filter:brightness(0) saturate(100%) invert(35%) sepia(60%) saturate(1360%) hue-rotate(325deg) brightness(95%) contrast(92%)}.deep-chat-openai-realtime-toggle>*{height:32px;width:32px;padding-left:3px;filter:brightness(0) saturate(100%) invert(22%) sepia(0%) saturate(4537%) hue-rotate(208deg) brightness(105%) contrast(91%)}.deep-chat-openai-realtime-button-unavailable{opacity:.45;pointer-events:none}#deep-chat-openai-realtime-error{color:red;position:absolute;top:calc(50% + 40px);left:50%;transform:translate(-50%,-50%);font-size:17px}#deep-chat-openai-realtime-loading{position:absolute;font-size:15px;top:50%;left:50%;transform:translate(-50%,-50%)}#insert-key-view{height:100%;position:relative}#insert-key-contents{text-align:center;position:absolute;top:44%;left:50%;transform:translate(-50%,-50%);width:82%;display:flex;max-width:700px}#insert-key-title{margin-bottom:15px}#insert-key-input-container{margin-right:2.7em;width:calc(100% - 80px)}#insert-key-input{padding:.3em 1.7em .3em .3em;border-width:1px;border-style:solid;border-radius:3px;width:100%;font-size:inherit}.insert-key-input-valid{border-color:gray}.insert-key-input-invalid{border-color:red}#visibility-icon-container{position:relative;float:right;cursor:pointer;-webkit-user-select:none;user-select:none}.visibility-icon{filter:brightness(0) saturate(100%) invert(63%) sepia(1%) saturate(9%) hue-rotate(43deg) brightness(98%) contrast(92%);position:absolute;right:-1.7em;top:-1.43em}#visible-icon{top:-1.4em}.visibility-icon:hover{filter:unset}.visibility-icon>*{pointer-events:none}#start-button{border:1px solid grey;color:#454545;border-radius:4px;width:3em;display:flex;justify-content:center;align-items:center;cursor:pointer;padding:.28em .3em;-webkit-user-select:none;user-select:none;background-color:#fff}#start-button:hover{background-color:#f2f2f2}#start-button:active{background-color:#d2d2d2}#insert-key-help-text-container{width:100%;position:absolute;margin-top:32px;margin-bottom:20px}#insert-key-help-text-contents{width:100%;position:absolute}#insert-key-input-invalid-text{display:block;margin-top:1em;margin-bottom:.5em;color:red}.insert-key-input-help-text{display:block;margin-top:16px}#loading-key{display:inline-block;width:16px;height:16px}#loading-key:after{content:\" \";display:block;width:11px;height:11px;margin:1px;border-radius:50%;border:2px solid #0084ff;border-color:#0084ff transparent #0084ff transparent;animation:loading-spinner 1.2s linear infinite}#error-view{color:red;font-size:1.2em;line-height:1.3em;margin-top:-5px;text-align:center;height:100%;display:flex;justify-content:center;align-items:center;padding-left:8px;padding-right:8px}@keyframes loading-spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.intro-panel{position:absolute;display:flex;justify-content:center;right:0;bottom:0;left:0;margin:auto;height:fit-content;top:-2.5em}#internal-intro-panel{width:250px;height:min-content;display:block;border-radius:5px;overflow:auto;border:1px solid rgb(203,203,203);padding:10px;max-height:calc(100% - 6.8em)}#internal-intro-panel>p{margin-block-start:.8em;margin-block-end:.8em}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!\n Theme: a11y-dark\n Author: @ericwbailey\n Maintainer: @ericwbailey\n\n Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css\n*/.hljs{background:#2b2b2b;color:#f8f8f2}.hljs-comment,.hljs-quote{color:#d4d0ab}.hljs-deletion,.hljs-name,.hljs-regexp,.hljs-selector-class,.hljs-selector-id,.hljs-tag,.hljs-template-variable,.hljs-variable{color:#ffa07a}.hljs-built_in,.hljs-link,.hljs-literal,.hljs-meta,.hljs-number,.hljs-params,.hljs-type{color:#f5ab35}.hljs-attribute{color:gold}.hljs-addition,.hljs-bullet,.hljs-string,.hljs-symbol{color:#abe338}.hljs-section,.hljs-title{color:#00e0e0}.hljs-keyword,.hljs-selector-tag{color:#dcc6e0}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}@media screen and (-ms-high-contrast: active){.hljs-addition,.hljs-attribute,.hljs-built_in,.hljs-bullet,.hljs-comment,.hljs-link,.hljs-literal,.hljs-meta,.hljs-number,.hljs-params,.hljs-quote,.hljs-string,.hljs-symbol,.hljs-type{color:highlight}.hljs-keyword,.hljs-selector-tag{font-weight:700}}#messages{overflow:auto}.outer-message-container:last-child{margin-bottom:5px}.inner-message-container{display:flex;margin-left:auto;margin-right:auto;width:calc(97.5% - 24px);max-width:100%}.message-bubble{margin-top:10px;word-wrap:break-word;width:fit-content;max-width:60%;border-radius:10px;padding:.42em .55em;height:fit-content;line-height:1.26em}.user-message-text{color:#fff;background-color:#0084ff;margin-right:0;margin-left:auto}.ai-message-text{color:#000;background-color:#e4e6eb;margin-left:0;margin-right:auto}.deep-chat-last-group-messages-active{height:100%}.loading-history-message-full-view{position:absolute;height:70%;width:100%;display:flex;align-items:center}.loading-history-message-small{height:20px;margin-bottom:30px}.loading-history-message-small>div>div{scale:.6}.loading-history-message{margin-top:0;width:100%;max-width:100%;display:flex;justify-content:center;background-color:unset}.loading-history{width:70px}.loading-history div{position:absolute;width:var(--loading-history-width);height:var(--loading-history-height);margin:var(--loading-history-margin);border:var(--loading-history-border);border-radius:50%;animation:loading-spinner 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:var(--loading-history-color) transparent transparent transparent}.loading-history div:nth-child(1){animation-delay:-.45s}.loading-history div:nth-child(2){animation-delay:-.3s}.loading-history div:nth-child(3){animation-delay:-.15s}.html-message{max-width:unset}.error-message-text{margin:14px auto 10px;background-color:#f4c0c0;color:#474747;text-align:center;max-width:95%}.deep-chat-loading-message-dots-container{width:1em;padding:.6em .75em .6em 1.3em}.loading-message-dots{position:relative;width:.45em;height:.45em;border-radius:5px;background-color:var(--loading-message-color);color:var(--loading-message-color);animation:loading-message-dots 1s infinite linear alternate;animation-delay:.5s}.loading-message-dots:before,.loading-message-dots:after{content:\"\";display:inline-block;position:absolute;top:0}.loading-message-dots:before{left:-.7em;width:.45em;height:.45em;border-radius:5px;background-color:var(--loading-message-color);color:var(--loading-message-color);animation:loading-message-dots 1s infinite alternate;animation-delay:0s}.loading-message-dots:after{left:.7em;width:.45em;height:.45em;border-radius:5px;background-color:var(--loading-message-color);color:var(--loading-message-color);animation:loading-message-dots 1s infinite alternate;animation-delay:1s}@keyframes loading-message-dots{0%{background-color:var(--loading-message-color)}50%,to{background-color:var(--loading-message-color-fade)}}.message-bubble>p:first-child,.message-bubble>.partial-render-message>p:first-child,.stream-wrapper>p:first-child{margin-top:0}.message-bubble>p:last-child,.message-bubble>.partial-render-message:last-child>p,.stream-wrapper>p:last-child{margin-bottom:0}pre{overflow:auto;display:block;word-break:break-all;word-wrap:break-word;border-radius:7px;background:#2b2b2b;color:#f8f8f2;margin-top:.8em;margin-bottom:.8em;padding:.6em;font-size:.9em;line-height:1.5em}.image-message{padding:0;display:flex;background-color:#ddd}.image-message>*,.image-message>*>*{width:100%;border-radius:8px;display:flex}.audio-message{width:60%;max-width:300px;height:2.2em;max-height:54px;padding:0;background-color:unset}.audio-player{width:100%;height:100%}.audio-player-safari{height:fit-content;width:40px}.audio-player-safari-left{float:left}.audio-player-safari-right{float:right}.any-file-message{padding:1px}.any-file-message-contents{display:flex}.any-file-message-icon-container{width:1.3em;min-width:1.3em;position:relative;border-radius:4px;margin-left:6px;margin-right:2px}.any-file-message-icon{background-color:#fff;border-radius:4px;position:absolute;width:1em;height:1.25em;padding:1px;margin-top:auto;margin-bottom:auto;top:0;bottom:0}.any-file-message-text{padding-top:5px;overflow-wrap:anywhere;padding-bottom:5px;padding-right:7px}.message-bubble>a{color:inherit}.left-item-position{margin-right:10px}.right-item-position{margin-left:10px}.role-hidden{display:none}.avatar{padding-top:5px;width:1.5em;height:1.5em;border-radius:1px}.avatar-container{margin-top:9px}.name{margin-top:16px;font-size:15px}#drag-and-drop{position:absolute;display:none;z-index:10;height:calc(100% - 10px);width:calc(100% - 10px);background-color:#70c6ff4d;border:5px dashed #6dafff}#file-attachment-container{position:absolute;height:3.6em;width:calc(80% - 4px);top:-2.5em;border-radius:5px;overflow:auto;text-align:left;background-color:#d7d7d73b;padding-left:4px}.file-attachment{width:2.85em;height:2.85em;display:inline-flex;margin-right:.6em;margin-bottom:.44em;margin-top:4px;position:relative;background-color:#fff;border-radius:5px}.image-attachment{width:100%;height:100%;object-fit:cover;border-radius:5px}.border-bound-attachment{width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid #c3c3c3;border-radius:5px;overflow:hidden}.border-bound-attachment-safari{width:calc(100% - 1px);height:calc(100% - 1px)}.audio-attachment-icon-container{cursor:pointer}.audio-attachment-icon-container:hover{background-color:#f8f8f8}.attachment-icon{left:0;right:0;bottom:0;top:2px;margin:auto;position:absolute;width:25px;-webkit-user-select:none;user-select:none}.not-removable-attachment-icon{top:0;right:0;bottom:0;left:0}.play-icon{filter:brightness(0) saturate(100%) invert(17%) sepia(0%) saturate(1392%) hue-rotate(67deg) brightness(98%) contrast(97%)}.stop-icon{filter:brightness(0) saturate(100%) invert(29%) sepia(90%) saturate(1228%) hue-rotate(198deg) brightness(93%) contrast(98%)}.audio-placeholder-text-3-digits{padding-left:.26rem}.audio-placeholder-text-4-digits{padding-left:.1rem}.any-file-attachment{padding:2px 0}.file-attachment-text-container{position:absolute;width:inherit;display:flex;align-items:center;height:100%;top:-1px}.audio-placeholder-text-3-digits-container{padding-top:1px;cursor:default}.any-file-attachment-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding-left:.13em;margin-left:auto;margin-right:auto}.remove-file-attachment-button{height:1.25em;width:1.25em;border:1px solid #cfcfcf;border-radius:25px;background-color:#fff;top:-4px;right:-5px;position:absolute;display:flex;justify-content:center;cursor:pointer;-webkit-user-select:none;user-select:none}.remove-file-attachment-button:hover{background-color:#e4e4e4}.remove-file-attachment-button:active{background-color:#d7d7d7}.x-icon{color:#4e4e4e;top:-.075em;position:relative;font-size:1.05em}.modal{display:none;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:80%;max-width:420px;max-height:80%;margin:auto;top:0;right:0;bottom:0;left:0;z-index:3}.modal-content{border-top:1px solid rgb(217,217,217);border-left:1px solid rgb(217,217,217);border-right:1px solid rgb(217,217,217);border-top-left-radius:inherit;border-top-right-radius:inherit;background-color:#fff;overflow-y:auto;height:fit-content;max-height:calc(100% - 3.3em);width:100%}.modal-content>p{margin-left:1em;margin-right:1em}.modal-content>ul{margin-right:1em}.modal-button-panel{height:3.3em;border:1px solid;border-color:rgb(223,223,223) rgb(217,217,217) rgb(217,217,217);border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;background-color:#fff;text-align:center;justify-content:center;display:flex;width:100%}.modal-button{min-width:2.5em;text-align:center;color:#fff;border-radius:5px;padding:.4em .4em .3em;height:1.25em;background-color:#3279b2;top:0;bottom:0;cursor:pointer;-webkit-user-select:none;user-select:none;margin:auto .31em}.modal-button:hover{background-color:#276da7}.modal-button:active{background-color:#1b5687}.modal-svg-button{padding:0 0 2px;width:2em;height:1.8em}.modal-svg-button-icon{width:100%;height:100%;filter:brightness(0) saturate(100%) invert(100%) sepia(15%) saturate(4%) hue-rotate(346deg) brightness(101%) contrast(102%)}#modal-background-panel{position:absolute;width:100%;height:100%;background-color:#00000042;z-index:2;display:none}.show-modal-background{animation:fadeInBackground .3s ease-in-out}@keyframes fadeInBackground{0%{opacity:0}to{opacity:1}}.show-modal{animation:fadeInModal .3s ease-in-out}@keyframes fadeInModal{0%{opacity:0;scale:.95}to{opacity:1;scale:1}}.hide-modal-background{animation:fadeOutBackground .2s ease-in-out}@keyframes fadeOutBackground{0%{opacity:1}to{opacity:0}}.hide-modal{animation:fadeOutModal .2s ease-in-out}@keyframes fadeOutModal{0%{opacity:1;scale:1}to{opacity:0;scale:.95}}.modal-camera-content{overflow:hidden;text-align:center;border:unset;height:100%;background-color:#2a2a2a;display:flex;justify-content:center}.camera-modal-canvas{max-width:100%;max-height:100%;margin-top:auto;margin-bottom:auto}.modal-svg-submit-button{background-color:green}.modal-svg-submit-button:hover{background-color:#007500}.modal-svg-submit-button:active{background-color:#006500}.modal-svg-submit-disabled{pointer-events:none;background-color:#747474}.modal-svg-close-button{height:1.56em;padding-top:.37em;padding-bottom:0;background-color:#c13e3e}.modal-svg-close-button:hover{background-color:#b43434}.modal-svg-close-button:active{background-color:#972929}.modal-svg-close-icon{width:80%;height:80%}.modal-svg-camera-button{height:1.6em;padding-top:.38em;padding-bottom:0}.modal-svg-camera-icon{height:76%}.modal-svg-refresh-icon{height:105%}.modal-svg-refresh-button{height:1.66em;padding-top:.11em;padding-bottom:.21em}.input-button-container{position:relative;z-index:1}.inside-right{position:absolute;right:calc(10% + .35em);bottom:.85em}.inside-left{position:absolute;left:calc(10% + .35em);bottom:.85em}.outside-left{position:absolute;right:calc(11px - .55em);bottom:.88em}.outside-right{position:absolute;left:calc(11px - .55em);bottom:.88em}#upload-images-icon{position:absolute;pointer-events:none;width:1.45em;height:1.45em;left:.11em;bottom:.08em;filter:brightness(0) saturate(100%) invert(43%) sepia(0%) saturate(740%) hue-rotate(77deg) brightness(99%) contrast(92%)}#upload-gifs-icon{position:absolute;pointer-events:none;width:1.5em;height:1.48em;left:.07em;bottom:.08em;filter:brightness(0) saturate(100%) invert(49%) sepia(0%) saturate(2586%) hue-rotate(12deg) brightness(93%) contrast(90%)}#upload-audio-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.17em;bottom:.2em;filter:brightness(0) saturate(100%) invert(15%) sepia(0%) saturate(337%) hue-rotate(125deg) brightness(91%) contrast(94%);transform:scaleX(.95)}#camera-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.23em;bottom:.2em;filter:brightness(0) saturate(100%) invert(52%) sepia(0%) saturate(161%) hue-rotate(164deg) brightness(91%) contrast(92%);transform:scaleX(.95)}#upload-mixed-files-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.25em;bottom:.2em;filter:brightness(0) saturate(100%) invert(53%) sepia(0%) saturate(36%) hue-rotate(74deg) brightness(98%) contrast(93%);transform:scaleX(.95)}#interim-text{color:gray}#microphone-button{padding-top:.5px}.outer-button-container>#microphone-button{padding-bottom:1px}#microphone-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.25em;bottom:.25em}.default-microphone-icon{filter:brightness(0) saturate(100%) invert(32%) sepia(0%) saturate(924%) hue-rotate(46deg) brightness(95%) contrast(99%)}.active-microphone-icon{filter:brightness(0) saturate(100%) invert(10%) sepia(97%) saturate(7495%) hue-rotate(0deg) brightness(101%) contrast(107%);border-radius:10px}.command-microphone-icon{filter:brightness(0) saturate(100%) invert(42%) sepia(96%) saturate(1067%) hue-rotate(77deg) brightness(99%) contrast(102%)}.unsupported-microphone{display:none}#submit-icon{height:100%;filter:brightness(0) saturate(100%) invert(32%) sepia(0%) saturate(924%) hue-rotate(46deg) brightness(95%) contrast(99%);width:1.21em}#stop-icon{background-color:#acacac;position:absolute;width:.95em;height:.95em;left:.35em;bottom:.35em;border-radius:2px}.submit-button-enlarged{scale:1.1;margin-right:.3em;margin-left:.3em}.loading-submit-button{position:relative;left:calc(-9990px + .275em);width:.22em;height:.22em;border-radius:5px;background-color:#848484;color:#848484;box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484;animation:loading-submit-button 1.5s infinite linear;bottom:-.75em}@keyframes loading-submit-button{0%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}16.667%{box-shadow:9990px -6px #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}33.333%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}50%{box-shadow:9990px 0 #848484,calc(9990px + .44em) -6px 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}66.667%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}83.333%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) -6px 0 0 #848484}to{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}}.input-button{border-radius:4px;cursor:pointer;margin-bottom:.2em;-webkit-user-select:none;user-select:none}.input-button-svg{width:1.65em;height:1.65em}.input-button-svg-text{padding:1px;height:1.65em;display:flex}.input-button-svg-text>svg{padding:.22rem}.input-button-svg-text>div{margin-left:2px}.input-button:hover,.input-button:focus-visible{background-color:#9c9c9c2e}.input-button:active{background-color:#9c9c9c5e}.input-button:active:not(:hover){background-color:transparent}.loading-button{cursor:auto}.loading-button:hover{background-color:unset}.text-button{filter:unset!important;display:flex;justify-content:center;align-items:center;margin-left:4px;margin-right:4px;height:1.6em;width:max-content}#custom-icon{height:100%;width:1.2em}.custom-button-container-default{color:#505050}.custom-button-container-default>.dropup-menu-item-icon{color:unset}.custom-button-container-default>svg{filter:brightness(0) saturate(100%) invert(39%) sepia(1%) saturate(0%) hue-rotate(83deg) brightness(93%) contrast(90%)}.custom-button-container-default>.dropup-menu-item-icon>svg{position:absolute;left:.2em}.custom-button-container-active{background-color:#edf7ff;color:#0285ff}.custom-button-container-active:hover,.custom-button-container-active:focus-visible{background-color:#def0ff}.custom-button-container-active:active{background-color:#d2eaff}.custom-button-container-active>svg{filter:brightness(0) saturate(100%) invert(32%) sepia(34%) saturate(4196%) hue-rotate(196deg) brightness(107%) contrast(104%)}.custom-button-container-disabled{color:#aeaeae;cursor:auto}.custom-button-container-disabled>div{pointer-events:none}.custom-button-container-disabled:hover,.custom-button-container-disabled:focus-visible{background-color:transparent}.custom-button-container-disabled:active{background-color:transparent}.custom-button-container-disabled>svg{filter:brightness(0) saturate(100%) invert(67%) sepia(0%) saturate(818%) hue-rotate(28deg) brightness(102%) contrast(100%)}#text-input-container{background-color:#fff;width:80%;display:flex;border:1px solid #0000001a;border-radius:5px;margin-top:.8em;margin-bottom:.8em;box-shadow:#959da533 0 1px 12px;overflow-y:auto;max-height:200px;position:relative}.text-input-container-left-adjustment{margin-left:1.5em}.text-input-container-right-adjustment{margin-right:1.5em}.text-input-container-left-small-adjustment{margin-left:1.1em}.text-input-container-left-small-adjustment>.outside-left{right:calc(14px - .55em)}.text-input-container-right-small-adjustment{margin-right:1.1em}.text-input-container-right-small-adjustment>.outside-right{left:calc(14px - .55em)}#text-input{text-align:left;outline:none;word-wrap:break-word;line-break:auto}.text-input-styling{padding:.4em .5em;overflow:overlay;width:100%}.text-input-inner-left-adjustment{padding-left:2.2em}.text-input-inner-right-adjustment{padding-right:2em}.text-input-disabled{pointer-events:none;-webkit-user-select:none;user-select:none}[contenteditable]:empty:before{content:attr(deep-chat-placeholder-text);pointer-events:none}[contenteditable][textcolor]:empty:before{color:gray}.outside-right>#dropup-menu,.inside-right>#dropup-menu{right:0}#dropup-icon{position:absolute;pointer-events:none;width:1.16em;height:1.2em;left:.265em;bottom:.43em;filter:brightness(0) saturate(100%) invert(54%) sepia(0%) saturate(724%) hue-rotate(6deg) brightness(92%) contrast(90%)}.dropup-button>*{pointer-events:none}#dropup-menu{background-color:#fff;position:absolute;transform:translateY(-100%);border-radius:5px;z-index:1;top:-.49em;box-shadow:#0003 -1px 2px 10px,#0000001a 0 2px 4px;cursor:pointer;-webkit-user-select:none;user-select:none}.dropup-menu-item{height:1.4em;padding:.28em .84em .28em .35em;display:flex;position:relative}.dropup-menu-item:hover,.dropup-menu-item:focus-visible{background-color:#f3f3f3}.dropup-menu-item:active{background-color:#ebebeb}.dropup-menu-item:active:not(:hover){background-color:transparent}.dropup-menu-item:first-child{padding-top:.49em;border-top-left-radius:inherit;border-top-right-radius:inherit}.dropup-menu-item:last-child{padding-bottom:.45em;border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.dropup-menu-item-icon{width:1.39em;position:relative}.dropup-menu-item-icon>svg{bottom:0!important;top:0!important;margin-bottom:auto;margin-top:auto}#dropup-menu-item-icon-element-custom{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.28em;filter:brightness(0) saturate(100%) invert(15%) sepia(0%) saturate(337%) hue-rotate(125deg) brightness(91%) contrast(94%)}.dropup-menu-item-text{margin-left:.56em;margin-top:.08em;width:max-content}#input{width:100%;display:inline-flex;text-align:center;margin-left:auto;margin-right:auto;margin-top:auto;position:relative;justify-content:center}#chat-view{height:100%;display:grid;grid-template-columns:100%}::-webkit-scrollbar{width:9px;height:9px}::-webkit-scrollbar-thumb{background-color:#d0d0d0;border-radius:5px}::-webkit-scrollbar-track{background-color:#f2f2f2}.deep-chat-web-model-button{margin-top:10px;margin-bottom:5px;margin-left:1px}:host{all:initial;display:table-cell}#container{height:inherit;width:inherit;overflow:hidden}";
|
16005
16045
|
var Ua = Object.defineProperty,
|
16006
|
-
|
16046
|
+
A = function A(n, e, t, i) {
|
16007
16047
|
for (var s = void 0, r = n.length - 1, o; r >= 0; r--) (o = n[r]) && (s = o(e, t, s) || s);
|
16008
16048
|
return s && Ua(e, t, s), s;
|
16009
16049
|
};
|
@@ -16018,10 +16058,10 @@ var _ = /*#__PURE__*/function (_rs) {
|
|
16018
16058
|
}, _this98.addMessage = function () {
|
16019
16059
|
return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
|
16020
16060
|
}, _this98.updateMessage = function () {}, _this98.clearMessages = function () {}, _this98.focusInput = function () {
|
16021
|
-
return
|
16061
|
+
return li.focusFromParentElement(_this98._elementRef);
|
16022
16062
|
}, _this98.refreshMessages = function () {}, _this98.scrollToBottom = function () {}, _this98.disableSubmitButton = function () {}, _this98.setPlaceholderText = function () {}, _this98._hasBeenRendered = !1, _this98._auxiliaryStyleApplied = !1, _this98._elementRef = document.createElement("div"), _this98._elementRef.id = "container", _this98.attachShadow({
|
16023
16063
|
mode: "open"
|
16024
|
-
}).appendChild(_this98._elementRef),
|
16064
|
+
}).appendChild(_this98._elementRef), zt.apply(Fa, _this98.shadowRoot), setTimeout(function () {
|
16025
16065
|
_this98._hasBeenRendered || _this98.onRender();
|
16026
16066
|
}, 20);
|
16027
16067
|
return _this98;
|
@@ -16037,56 +16077,57 @@ var _ = /*#__PURE__*/function (_rs) {
|
|
16037
16077
|
key: "onRender",
|
16038
16078
|
value: function onRender() {
|
16039
16079
|
var _this$_childElement;
|
16040
|
-
|
16080
|
+
vi.attemptAppendStyleSheetToHead(this.style), te.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = ia.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (zt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), zt.applyDefaultStyleToComponent(this.style, this.chatStyle), te.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? bi.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof K) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Ls.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof K && W.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered || ii.onRender(this), this._hasBeenRendered = !0;
|
16041
16081
|
}
|
16042
16082
|
}, {
|
16043
16083
|
key: "disconnectedCallback",
|
16044
16084
|
value: function disconnectedCallback() {
|
16045
|
-
|
16085
|
+
ni.chat = void 0;
|
16046
16086
|
}
|
16047
16087
|
}]);
|
16048
16088
|
}(rs);
|
16049
|
-
|
16050
|
-
|
16051
|
-
|
16052
|
-
|
16053
|
-
|
16054
|
-
|
16055
|
-
|
16056
|
-
|
16057
|
-
|
16058
|
-
|
16059
|
-
|
16060
|
-
|
16061
|
-
|
16062
|
-
|
16063
|
-
|
16064
|
-
|
16065
|
-
|
16066
|
-
|
16067
|
-
|
16068
|
-
|
16069
|
-
|
16070
|
-
|
16071
|
-
|
16072
|
-
|
16073
|
-
|
16074
|
-
|
16075
|
-
|
16076
|
-
|
16077
|
-
|
16078
|
-
|
16079
|
-
|
16080
|
-
|
16081
|
-
|
16082
|
-
|
16083
|
-
|
16084
|
-
|
16085
|
-
|
16086
|
-
|
16087
|
-
|
16088
|
-
|
16089
|
-
|
16090
|
-
|
16089
|
+
A([x("object")], _.prototype, "connect");
|
16090
|
+
A([x("object")], _.prototype, "directConnection");
|
16091
|
+
A([x("object")], _.prototype, "webModel");
|
16092
|
+
A([x("object")], _.prototype, "requestBodyLimits");
|
16093
|
+
A([x("function")], _.prototype, "requestInterceptor");
|
16094
|
+
A([x("function")], _.prototype, "responseInterceptor");
|
16095
|
+
A([x("function")], _.prototype, "validateInput");
|
16096
|
+
A([x("function")], _.prototype, "loadHistory");
|
16097
|
+
A([x("object")], _.prototype, "chatStyle");
|
16098
|
+
A([x("object")], _.prototype, "attachmentContainerStyle");
|
16099
|
+
A([x("object")], _.prototype, "dropupStyles");
|
16100
|
+
A([x("object")], _.prototype, "inputAreaStyle");
|
16101
|
+
A([x("object")], _.prototype, "textInput");
|
16102
|
+
A([x("object")], _.prototype, "submitButtonStyles");
|
16103
|
+
A([x("object")], _.prototype, "customButtons");
|
16104
|
+
A([x("string")], _.prototype, "auxiliaryStyle");
|
16105
|
+
A([x("array")], _.prototype, "history");
|
16106
|
+
A([x("object")], _.prototype, "introMessage");
|
16107
|
+
A([x("object")], _.prototype, "avatars");
|
16108
|
+
A([x("object")], _.prototype, "names");
|
16109
|
+
A([x("object")], _.prototype, "displayLoadingBubble");
|
16110
|
+
A([x("object")], _.prototype, "errorMessages");
|
16111
|
+
A([x("object")], _.prototype, "messageStyles");
|
16112
|
+
A([x("object")], _.prototype, "textToSpeech");
|
16113
|
+
A([x("object")], _.prototype, "speechToText");
|
16114
|
+
A([x("object")], _.prototype, "images");
|
16115
|
+
A([x("object")], _.prototype, "gifs");
|
16116
|
+
A([x("object")], _.prototype, "camera");
|
16117
|
+
A([x("object")], _.prototype, "audio");
|
16118
|
+
A([x("object")], _.prototype, "microphone");
|
16119
|
+
A([x("object")], _.prototype, "mixedFiles");
|
16120
|
+
A([x("object")], _.prototype, "dragAndDrop");
|
16121
|
+
A([x("object")], _.prototype, "introPanelStyle");
|
16122
|
+
A([x("object")], _.prototype, "htmlClassUtilities");
|
16123
|
+
A([x("object")], _.prototype, "remarkable");
|
16124
|
+
A([x("object")], _.prototype, "focusMode");
|
16125
|
+
A([x("function")], _.prototype, "onMessage");
|
16126
|
+
A([x("function")], _.prototype, "onClearMessages");
|
16127
|
+
A([x("function")], _.prototype, "onComponentRender");
|
16128
|
+
A([x("function")], _.prototype, "onInput");
|
16129
|
+
A([x("function")], _.prototype, "onError");
|
16130
|
+
A([x("object")], _.prototype, "demo");
|
16131
|
+
A([x("object")], _.prototype, "_insertKeyViewStyles");
|
16091
16132
|
customElements.define("deep-chat", _);
|
16092
16133
|
export { _ as DeepChat };
|