deep-chat-dev 9.0.112 → 9.0.114
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 +2894 -2875
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +842 -814
- package/dist/services/openAI/openAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/utils/openAIAssistantFiles.d.ts +5 -12
- package/dist/services/openAI/utils/openAIAssistantFiles.d.ts.map +1 -1
- package/dist/services/openAI/utils/openAIUtils.d.ts +0 -2
- package/dist/services/openAI/utils/openAIUtils.d.ts.map +1 -1
- package/dist/views/chat/messages/fileMessageUtils.d.ts +2 -2
- package/dist/views/chat/messages/fileMessageUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -186,11 +186,11 @@ var wi = zn;
|
|
186
186
|
var R = /* @__PURE__ */function (s) {
|
187
187
|
return s.ESCAPE = "Escape", s.ENTER = "Enter", s.TAB = "Tab", s.ARROW_UP = "ArrowUp", s.ARROW_DOWN = "ArrowDown", s.ARROW_RIGHT = "ArrowRight", s.ARROW_LEFT = "ArrowLeft", s.BACKSPACE = "Backspace", s.DELETE = "Delete", s.META = "Meta", s.CONTROL = "Control", s;
|
188
188
|
}(R || {});
|
189
|
-
var
|
190
|
-
_classCallCheck(this,
|
189
|
+
var be = /*#__PURE__*/_createClass(function be() {
|
190
|
+
_classCallCheck(this, be);
|
191
191
|
});
|
192
|
-
|
193
|
-
|
192
|
+
be.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
193
|
+
be.IS_CHROMIUM = window.chrome;
|
194
194
|
var Un = /*#__PURE__*/function () {
|
195
195
|
function rt() {
|
196
196
|
_classCallCheck(this, rt);
|
@@ -241,28 +241,28 @@ var xs = /*#__PURE__*/function () {
|
|
241
241
|
return xs;
|
242
242
|
}();
|
243
243
|
var qn = /*#__PURE__*/function () {
|
244
|
-
function
|
244
|
+
function He(e, t) {
|
245
245
|
var _this = this;
|
246
|
-
_classCallCheck(this,
|
246
|
+
_classCallCheck(this, He);
|
247
247
|
var n;
|
248
|
-
var i =
|
249
|
-
this.elementRef =
|
248
|
+
var i = He.processConfig(t, e.textInput);
|
249
|
+
this.elementRef = He.createContainerElement((n = i == null ? void 0 : i.styles) == null ? void 0 : n.container), this.inputElementRef = this.createInputElement(i), this._config = i, this.elementRef.appendChild(this.inputElementRef), setTimeout(function () {
|
250
250
|
var r;
|
251
251
|
ys.add(_this.inputElementRef, (r = e.textInput) == null ? void 0 : r.characterLimit, e._validationHandler);
|
252
252
|
});
|
253
253
|
}
|
254
|
-
_createClass(
|
254
|
+
_createClass(He, [{
|
255
255
|
key: "createInputElement",
|
256
256
|
value: function createInputElement(e) {
|
257
257
|
var i, n, r;
|
258
258
|
var t = document.createElement("div");
|
259
|
-
return t.id =
|
259
|
+
return t.id = He.TEXT_INPUT_ID, t.classList.add("text-input-styling", "text-input-placeholder"), t.innerText = ((i = e == null ? void 0 : e.placeholder) == null ? void 0 : i.text) || "Ask me anything!", be.IS_CHROMIUM && He.preventAutomaticScrollUpOnNewLine(t), typeof (e == null ? void 0 : e.disabled) == "boolean" && e.disabled === !0 ? (t.contentEditable = "false", t.classList.add("text-input-disabled")) : (t.contentEditable = "true", this.addEventListeners(t, e)), Object.assign(t.style, (n = e == null ? void 0 : e.styles) == null ? void 0 : n.text), Object.assign(t.style, (r = e == null ? void 0 : e.placeholder) == null ? void 0 : r.style), t;
|
260
260
|
}
|
261
261
|
}, {
|
262
262
|
key: "removeTextIfPlaceholder",
|
263
263
|
value: function removeTextIfPlaceholder() {
|
264
264
|
var e, t, i, n;
|
265
|
-
this.inputElementRef.classList.contains("text-input-placeholder") && !this.inputElementRef.classList.contains("text-input-disabled") && ((e = this._config.placeholder) != null && e.style && (T.unsetStyle(this.inputElementRef, (t = this._config.placeholder) == null ? void 0 : t.style), Object.assign(this.inputElementRef.style, (n = (i = this._config) == null ? void 0 : i.styles) == null ? void 0 : n.text)),
|
265
|
+
this.inputElementRef.classList.contains("text-input-placeholder") && !this.inputElementRef.classList.contains("text-input-disabled") && ((e = this._config.placeholder) != null && e.style && (T.unsetStyle(this.inputElementRef, (t = this._config.placeholder) == null ? void 0 : t.style), Object.assign(this.inputElementRef.style, (n = (i = this._config) == null ? void 0 : i.styles) == null ? void 0 : n.text)), He.clear(this.inputElementRef), this.inputElementRef.classList.remove("text-input-placeholder"));
|
266
266
|
}
|
267
267
|
}, {
|
268
268
|
key: "addEventListeners",
|
@@ -274,7 +274,7 @@ var qn = /*#__PURE__*/function () {
|
|
274
274
|
key: "onFocus",
|
275
275
|
value: function onFocus(e) {
|
276
276
|
var _this2 = this;
|
277
|
-
|
277
|
+
be.IS_SAFARI ? setTimeout(function () {
|
278
278
|
_this2.removeTextIfPlaceholder();
|
279
279
|
}) : this.removeTextIfPlaceholder(), Object.assign(this.elementRef.style, e);
|
280
280
|
}
|
@@ -318,7 +318,7 @@ var qn = /*#__PURE__*/function () {
|
|
318
318
|
key: "clear",
|
319
319
|
value: function clear(e) {
|
320
320
|
var t = window.scrollY;
|
321
|
-
e.classList.contains("text-input-disabled") || (e.textContent = ""),
|
321
|
+
e.classList.contains("text-input-disabled") || (e.textContent = ""), be.IS_CHROMIUM && window.scrollTo({
|
322
322
|
top: t
|
323
323
|
});
|
324
324
|
}
|
@@ -334,7 +334,7 @@ var qn = /*#__PURE__*/function () {
|
|
334
334
|
return t.id = "text-input-container", Object.assign(t.style, e), t;
|
335
335
|
}
|
336
336
|
}]);
|
337
|
-
return
|
337
|
+
return He;
|
338
338
|
}();
|
339
339
|
qn.TEXT_INPUT_ID = "text-input";
|
340
340
|
var Hi = qn;
|
@@ -468,11 +468,11 @@ var Vn = /*#__PURE__*/function () {
|
|
468
468
|
}();
|
469
469
|
Vn.LOAD_VOICES_MS = 200;
|
470
470
|
var jt = Vn;
|
471
|
-
var
|
472
|
-
function
|
473
|
-
_classCallCheck(this,
|
471
|
+
var Le = /*#__PURE__*/function () {
|
472
|
+
function Le() {
|
473
|
+
_classCallCheck(this, Le);
|
474
474
|
}
|
475
|
-
_createClass(
|
475
|
+
_createClass(Le, null, [{
|
476
476
|
key: "checkForContainerStyles",
|
477
477
|
value: function checkForContainerStyles(e, t) {
|
478
478
|
var i = e.containerStyle;
|
@@ -510,13 +510,13 @@ var Ie = /*#__PURE__*/function () {
|
|
510
510
|
(t = e.children[0]) != null && t.classList.contains("deep-chat-update-message") && (console.error('The "deep-chat-update-message" html class is deprecated since version 1.4.4.'), console.error("Please change to using {..., overwrite: true} object: https://deepchat.dev/docs/connect#Response"));
|
511
511
|
}
|
512
512
|
}]);
|
513
|
-
return
|
513
|
+
return Le;
|
514
514
|
}();
|
515
515
|
var ii = /*#__PURE__*/function () {
|
516
|
-
function
|
517
|
-
_classCallCheck(this,
|
516
|
+
function Se() {
|
517
|
+
_classCallCheck(this, Se);
|
518
518
|
}
|
519
|
-
_createClass(
|
519
|
+
_createClass(Se, null, [{
|
520
520
|
key: "getLastElementsByClass",
|
521
521
|
value: function getLastElementsByClass(e, t, i) {
|
522
522
|
var _loop = function _loop() {
|
@@ -557,8 +557,8 @@ var ii = /*#__PURE__*/function () {
|
|
557
557
|
}, {
|
558
558
|
key: "overwriteMessage",
|
559
559
|
value: function overwriteMessage(e, t, i, n, r, o) {
|
560
|
-
var a =
|
561
|
-
l =
|
560
|
+
var a = Se.getLastElementsByClass(t, [Se.getRoleClass(n), o], ["loading-message-text"]),
|
561
|
+
l = Se.getLastMessage(e, n, r);
|
562
562
|
return l && (l[r] = i), a;
|
563
563
|
}
|
564
564
|
}, {
|
@@ -570,18 +570,18 @@ var ii = /*#__PURE__*/function () {
|
|
570
570
|
}, {
|
571
571
|
key: "fillEmptyMessageElement",
|
572
572
|
value: function fillEmptyMessageElement(e, t) {
|
573
|
-
t.trim().length === 0 && (e.classList.add(
|
573
|
+
t.trim().length === 0 && (e.classList.add(Se.EMPTY_MESSAGE_CLASS), e.innerHTML = '<div style="color:#00000000">.</div>');
|
574
574
|
}
|
575
575
|
}, {
|
576
576
|
key: "unfillEmptyMessageElement",
|
577
577
|
value: function unfillEmptyMessageElement(e, t) {
|
578
|
-
e.classList.contains(
|
578
|
+
e.classList.contains(Se.EMPTY_MESSAGE_CLASS) && t.trim().length > 0 && e.replaceChildren();
|
579
579
|
}
|
580
580
|
}, {
|
581
581
|
key: "getLastMessageBubbleElement",
|
582
582
|
value: function getLastMessageBubbleElement(e) {
|
583
583
|
var t, i, n;
|
584
|
-
return Array.from(((n = (i = (t =
|
584
|
+
return Array.from(((n = (i = (t = Se.getLastMessageElement(e)) == null ? void 0 : t.children) == null ? void 0 : i[0]) == null ? void 0 : n.children) || []).find(function (r) {
|
585
585
|
return r.classList.contains("message-bubble");
|
586
586
|
});
|
587
587
|
}
|
@@ -591,17 +591,17 @@ var ii = /*#__PURE__*/function () {
|
|
591
591
|
return e.children[e.children.length - 1];
|
592
592
|
}
|
593
593
|
}]);
|
594
|
-
return
|
594
|
+
return Se;
|
595
595
|
}();
|
596
596
|
ii.AI_ROLE = "ai";
|
597
597
|
ii.USER_ROLE = "user";
|
598
598
|
ii.EMPTY_MESSAGE_CLASS = "empty-message";
|
599
599
|
var v = ii;
|
600
|
-
var
|
601
|
-
function
|
602
|
-
_classCallCheck(this,
|
600
|
+
var Ae = /*#__PURE__*/function () {
|
601
|
+
function Ae() {
|
602
|
+
_classCallCheck(this, Ae);
|
603
603
|
}
|
604
|
-
_createClass(
|
604
|
+
_createClass(Ae, null, [{
|
605
605
|
key: "mouseUp",
|
606
606
|
value: function mouseUp(e, t) {
|
607
607
|
T.unsetAllCSSMouseStates(e, t), Object.assign(e.style, t["default"]), Object.assign(e.style, t.hover);
|
@@ -624,10 +624,10 @@ var Ce = /*#__PURE__*/function () {
|
|
624
624
|
}, {
|
625
625
|
key: "add",
|
626
626
|
value: function add(e, t) {
|
627
|
-
e.addEventListener("mouseenter",
|
627
|
+
e.addEventListener("mouseenter", Ae.mouseEnter.bind(this, e, t)), e.addEventListener("mouseleave", Ae.mouseLeave.bind(this, e, t)), e.addEventListener("mousedown", Ae.mouseDown.bind(this, e, t)), e.addEventListener("mouseup", Ae.mouseUp.bind(this, e, t));
|
628
628
|
}
|
629
629
|
}]);
|
630
|
-
return
|
630
|
+
return Ae;
|
631
631
|
}();
|
632
632
|
var Ms = "deep-chat-temporary-message",
|
633
633
|
Ts = "deep-chat-suggestion-button",
|
@@ -653,11 +653,11 @@ var Ms = "deep-chat-temporary-message",
|
|
653
653
|
}
|
654
654
|
},
|
655
655
|
cn = Object.keys(Oi);
|
656
|
-
var
|
657
|
-
function
|
658
|
-
_classCallCheck(this,
|
656
|
+
var ve = /*#__PURE__*/function () {
|
657
|
+
function ve() {
|
658
|
+
_classCallCheck(this, ve);
|
659
659
|
}
|
660
|
-
_createClass(
|
660
|
+
_createClass(ve, null, [{
|
661
661
|
key: "applySuggestionEvent",
|
662
662
|
value: function applySuggestionEvent(e, t) {
|
663
663
|
setTimeout(function () {
|
@@ -712,17 +712,17 @@ var be = /*#__PURE__*/function () {
|
|
712
712
|
cn.forEach(function (r) {
|
713
713
|
var o = i.getElementsByClassName(r);
|
714
714
|
Array.from(o || []).forEach(function (a) {
|
715
|
-
var l =
|
716
|
-
se.applyStylesToElement(a, l),
|
715
|
+
var l = ve.getProcessedStyles(t, a, r);
|
716
|
+
se.applyStylesToElement(a, l), ve.applyEvents(a, r);
|
717
717
|
});
|
718
718
|
});
|
719
719
|
var n = i.getElementsByClassName(Ts);
|
720
720
|
Array.from(n).forEach(function (r) {
|
721
|
-
return
|
721
|
+
return ve.applySuggestionEvent(e, r);
|
722
722
|
});
|
723
723
|
}
|
724
724
|
}]);
|
725
|
-
return
|
725
|
+
return ve;
|
726
726
|
}();
|
727
727
|
var se = /*#__PURE__*/function () {
|
728
728
|
function se() {
|
@@ -732,7 +732,7 @@ var se = /*#__PURE__*/function () {
|
|
732
732
|
key: "applyStylesToElement",
|
733
733
|
value: function applyStylesToElement(e, t) {
|
734
734
|
var i = T.processStateful(t, {}, {});
|
735
|
-
|
735
|
+
Ae.add(e, i), Object.assign(e.style, i["default"]);
|
736
736
|
}
|
737
737
|
}, {
|
738
738
|
key: "applyEventsToElement",
|
@@ -747,7 +747,7 @@ var se = /*#__PURE__*/function () {
|
|
747
747
|
value: function applyClassUtilitiesToElement(e, t) {
|
748
748
|
var i = t.events,
|
749
749
|
n = t.styles;
|
750
|
-
i && se.applyEventsToElement(e, i), n && !
|
750
|
+
i && se.applyEventsToElement(e, i), n && !ve.doesElementContainDeepChatClass(e) && se.applyStylesToElement(e, n);
|
751
751
|
}
|
752
752
|
}, {
|
753
753
|
key: "applyCustomClassUtilities",
|
@@ -762,7 +762,7 @@ var se = /*#__PURE__*/function () {
|
|
762
762
|
}, {
|
763
763
|
key: "apply",
|
764
764
|
value: function apply(e, t) {
|
765
|
-
|
765
|
+
ve.applyDeepChatUtilities(e, e.htmlClassUtilities, t), se.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
766
766
|
}
|
767
767
|
}]);
|
768
768
|
return se;
|
@@ -787,7 +787,7 @@ var Xe = /*#__PURE__*/function () {
|
|
787
787
|
value: function overwrite(e, t, i, n) {
|
788
788
|
var r = e.messages,
|
789
789
|
o = v.overwriteMessage(r, n, t, i, "html", "html-message");
|
790
|
-
return o && (o.bubbleElement.innerHTML = t, se.apply(e, o.outerContainer),
|
790
|
+
return o && (o.bubbleElement.innerHTML = t, se.apply(e, o.outerContainer), Le.flagHTMLUpdateClass(o.bubbleElement)), o;
|
791
791
|
}
|
792
792
|
// prettier-ignore
|
793
793
|
}, {
|
@@ -800,7 +800,7 @@ var Xe = /*#__PURE__*/function () {
|
|
800
800
|
r.status = !1;
|
801
801
|
}
|
802
802
|
var o = Xe.createElements(e, t, i);
|
803
|
-
return v.fillEmptyMessageElement(o.bubbleElement, t), se.apply(e, o.outerContainer),
|
803
|
+
return v.fillEmptyMessageElement(o.bubbleElement, t), se.apply(e, o.outerContainer), Le.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html), Xe.addElement(e, o.outerContainer), o;
|
804
804
|
}
|
805
805
|
}]);
|
806
806
|
return Xe;
|
@@ -847,7 +847,7 @@ function Rs(s, e) {
|
|
847
847
|
i = Kn(e);
|
848
848
|
return e !== i ? i : e.charCodeAt(0) === 35 && Ls.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), $n(t)) ? Pi(t) : s;
|
849
849
|
}
|
850
|
-
function
|
850
|
+
function Re(s) {
|
851
851
|
return s.indexOf("&") < 0 ? s : s.replace(Is, Rs);
|
852
852
|
}
|
853
853
|
var Ns = /[&<>"]/,
|
@@ -869,10 +869,10 @@ m.blockquote_open = function () {
|
|
869
869
|
return "<blockquote>\n";
|
870
870
|
};
|
871
871
|
m.blockquote_close = function (s, e) {
|
872
|
-
return "</blockquote>" +
|
872
|
+
return "</blockquote>" + Oe(s, e);
|
873
873
|
};
|
874
874
|
m.code = function (s, e) {
|
875
|
-
return s[e].block ? "<pre><code>" + z(s[e].content) + "</code></pre>" +
|
875
|
+
return s[e].block ? "<pre><code>" + z(s[e].content) + "</code></pre>" + Oe(s, e) : "<code>" + z(s[e].content) + "</code>";
|
876
876
|
};
|
877
877
|
m.fence = function (s, e, t, i, n) {
|
878
878
|
var r = s[e],
|
@@ -884,9 +884,9 @@ m.fence = function (s, e, t, i, n) {
|
|
884
884
|
u;
|
885
885
|
if (r.params) {
|
886
886
|
if (c = r.params.split(/\s+/g), d = c.join(" "), As(n.rules.fence_custom, c[0])) return n.rules.fence_custom[c[0]](s, e, t, i, n);
|
887
|
-
l = z(
|
887
|
+
l = z(Re(gt(d))), o = ' class="' + a + l + '"';
|
888
888
|
}
|
889
|
-
return t.highlight ? u = t.highlight.apply(t.highlight, [r.content].concat(c)) || z(r.content) : u = z(r.content), "<pre><code" + o + ">" + u + "</code></pre>" +
|
889
|
+
return t.highlight ? u = t.highlight.apply(t.highlight, [r.content].concat(c)) || z(r.content) : u = z(r.content), "<pre><code" + o + ">" + u + "</code></pre>" + Oe(s, e);
|
890
890
|
};
|
891
891
|
m.fence_custom = {};
|
892
892
|
m.heading_open = function (s, e) {
|
@@ -896,13 +896,13 @@ m.heading_close = function (s, e) {
|
|
896
896
|
return "</h" + s[e].hLevel + ">\n";
|
897
897
|
};
|
898
898
|
m.hr = function (s, e, t) {
|
899
|
-
return (t.xhtmlOut ? "<hr />" : "<hr>") +
|
899
|
+
return (t.xhtmlOut ? "<hr />" : "<hr>") + Oe(s, e);
|
900
900
|
};
|
901
901
|
m.bullet_list_open = function () {
|
902
902
|
return "<ul>\n";
|
903
903
|
};
|
904
904
|
m.bullet_list_close = function (s, e) {
|
905
|
-
return "</ul>" +
|
905
|
+
return "</ul>" + Oe(s, e);
|
906
906
|
};
|
907
907
|
m.list_item_open = function () {
|
908
908
|
return "<li>";
|
@@ -916,17 +916,17 @@ m.ordered_list_open = function (s, e) {
|
|
916
916
|
return "<ol" + i + ">\n";
|
917
917
|
};
|
918
918
|
m.ordered_list_close = function (s, e) {
|
919
|
-
return "</ol>" +
|
919
|
+
return "</ol>" + Oe(s, e);
|
920
920
|
};
|
921
921
|
m.paragraph_open = function (s, e) {
|
922
922
|
return s[e].tight ? "" : "<p>";
|
923
923
|
};
|
924
924
|
m.paragraph_close = function (s, e) {
|
925
925
|
var t = !(s[e].tight && e && s[e - 1].type === "inline" && !s[e - 1].content);
|
926
|
-
return (s[e].tight ? "" : "</p>") + (t ?
|
926
|
+
return (s[e].tight ? "" : "</p>") + (t ? Oe(s, e) : "");
|
927
927
|
};
|
928
928
|
m.link_open = function (s, e, t) {
|
929
|
-
var i = s[e].title ? ' title="' + z(
|
929
|
+
var i = s[e].title ? ' title="' + z(Re(s[e].title)) + '"' : "",
|
930
930
|
n = t.linkTarget ? ' target="' + t.linkTarget + '"' : "";
|
931
931
|
return '<a href="' + z(s[e].href) + '"' + i + n + ">";
|
932
932
|
};
|
@@ -935,8 +935,8 @@ m.link_close = function () {
|
|
935
935
|
};
|
936
936
|
m.image = function (s, e, t) {
|
937
937
|
var i = ' src="' + z(s[e].src) + '"',
|
938
|
-
n = s[e].title ? ' title="' + z(
|
939
|
-
r = ' alt="' + (s[e].alt ? z(
|
938
|
+
n = s[e].title ? ' title="' + z(Re(s[e].title)) + '"' : "",
|
939
|
+
r = ' alt="' + (s[e].alt ? z(Re(gt(s[e].alt))) : "") + '"',
|
940
940
|
o = t.xhtmlOut ? " /" : "";
|
941
941
|
return "<img" + i + r + n + o + ">";
|
942
942
|
};
|
@@ -1030,7 +1030,7 @@ m.htmltag = function (s, e) {
|
|
1030
1030
|
return s[e].content;
|
1031
1031
|
};
|
1032
1032
|
m.abbr_open = function (s, e) {
|
1033
|
-
return '<abbr title="' + z(
|
1033
|
+
return '<abbr title="' + z(Re(s[e].title)) + '">';
|
1034
1034
|
};
|
1035
1035
|
m.abbr_close = function () {
|
1036
1036
|
return "</abbr>";
|
@@ -1080,7 +1080,7 @@ m.dd_close = function () {
|
|
1080
1080
|
function Yn(s, e) {
|
1081
1081
|
return ++e >= s.length - 2 ? e : s[e].type === "paragraph_open" && s[e].tight && s[e + 1].type === "inline" && s[e + 1].content.length === 0 && s[e + 2].type === "paragraph_close" && s[e + 2].tight ? Yn(s, e + 2) : e;
|
1082
1082
|
}
|
1083
|
-
var
|
1083
|
+
var Oe = m.getBreak = function (e, t) {
|
1084
1084
|
return t = Yn(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
|
1085
1085
|
};
|
1086
1086
|
function Vi() {
|
@@ -1179,24 +1179,24 @@ function js(s) {
|
|
1179
1179
|
children: []
|
1180
1180
|
}) : s.block.parse(s.src, s.options, s.env, s.tokens);
|
1181
1181
|
}
|
1182
|
-
function
|
1182
|
+
function Pe(s, e, t, i, n) {
|
1183
1183
|
this.src = s, this.env = i, this.options = t, this.parser = e, this.tokens = n, this.pos = 0, this.posMax = this.src.length, this.level = 0, this.pending = "", this.pendingLevel = 0, this.cache = [], this.isInLabel = !1, this.linkLevel = 0, this.linkContent = "", this.labelUnmatchedScopes = 0;
|
1184
1184
|
}
|
1185
|
-
|
1185
|
+
Pe.prototype.pushPending = function () {
|
1186
1186
|
this.tokens.push({
|
1187
1187
|
type: "text",
|
1188
1188
|
content: this.pending,
|
1189
1189
|
level: this.pendingLevel
|
1190
1190
|
}), this.pending = "";
|
1191
1191
|
};
|
1192
|
-
|
1192
|
+
Pe.prototype.push = function (s) {
|
1193
1193
|
this.pending && this.pushPending(), this.tokens.push(s), this.pendingLevel = this.level;
|
1194
1194
|
};
|
1195
|
-
|
1195
|
+
Pe.prototype.cacheSet = function (s, e) {
|
1196
1196
|
for (var t = this.cache.length; t <= s; t++) this.cache.push(0);
|
1197
1197
|
this.cache[s] = e;
|
1198
1198
|
};
|
1199
|
-
|
1199
|
+
Pe.prototype.cacheGet = function (s) {
|
1200
1200
|
return s < this.cache.length ? this.cache[s] : 0;
|
1201
1201
|
};
|
1202
1202
|
function bt(s, e) {
|
@@ -1220,7 +1220,7 @@ function bt(s, e) {
|
|
1220
1220
|
}
|
1221
1221
|
function Fs(s, e, t, i) {
|
1222
1222
|
var n, r, o, a, l, c;
|
1223
|
-
if (s.charCodeAt(0) !== 42 || s.charCodeAt(1) !== 91 || s.indexOf("]:") === -1 || (n = new
|
1223
|
+
if (s.charCodeAt(0) !== 42 || s.charCodeAt(1) !== 91 || s.indexOf("]:") === -1 || (n = new Pe(s, e, t, i, []), r = bt(n, 1), r < 0 || s.charCodeAt(r + 1) !== 58)) return -1;
|
1224
1224
|
for (a = n.posMax, o = r + 2; o < a && n.src.charCodeAt(o) !== 10; o++);
|
1225
1225
|
return l = s.slice(2, r), c = s.slice(r + 2, o).trim(), c.length === 0 ? -1 : (i.abbreviations || (i.abbreviations = {}), _typeof(i.abbreviations[":" + l]) > "u" && (i.abbreviations[":" + l] = c), o);
|
1226
1226
|
}
|
@@ -1238,7 +1238,7 @@ function Bs(s) {
|
|
1238
1238
|
}
|
1239
1239
|
}
|
1240
1240
|
function Di(s) {
|
1241
|
-
var e =
|
1241
|
+
var e = Re(s);
|
1242
1242
|
try {
|
1243
1243
|
e = decodeURI(e);
|
1244
1244
|
} catch (_unused2) {}
|
@@ -1293,7 +1293,7 @@ function Qn(s) {
|
|
1293
1293
|
}
|
1294
1294
|
function zs(s, e, t, i) {
|
1295
1295
|
var n, r, o, a, l, c, d, u, p;
|
1296
|
-
if (s.charCodeAt(0) !== 91 || s.indexOf("]:") === -1 || (n = new
|
1296
|
+
if (s.charCodeAt(0) !== 91 || s.indexOf("]:") === -1 || (n = new Pe(s, e, t, i, []), r = bt(n, 0), r < 0 || s.charCodeAt(r + 1) !== 58)) return -1;
|
1297
1297
|
for (a = n.posMax, o = r + 2; o < a && (l = n.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
1298
1298
|
if (!Zn(n, o)) return -1;
|
1299
1299
|
for (d = n.linkContent, o = n.pos, c = o, o = o + 1; o < a && (l = n.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
@@ -1453,7 +1453,7 @@ var Ys = /['"]/,
|
|
1453
1453
|
function pn(s, e) {
|
1454
1454
|
return e < 0 || e >= s.length ? !1 : !Zs.test(s[e]);
|
1455
1455
|
}
|
1456
|
-
function
|
1456
|
+
function Ue(s, e, t) {
|
1457
1457
|
return s.substr(0, e) + t + s.substr(e + 1);
|
1458
1458
|
}
|
1459
1459
|
function Xs(s) {
|
@@ -1465,12 +1465,12 @@ function Xs(s) {
|
|
1465
1465
|
w.length = h + 1, i = t.content, r = 0, o = i.length;
|
1466
1466
|
e: for (; r < o && (un.lastIndex = r, n = un.exec(i), !!n);) {
|
1467
1467
|
if (l = !pn(i, n.index - 1), r = n.index + 1, g = n[0] === "'", c = !pn(i, r), !c && !l) {
|
1468
|
-
g && (t.content =
|
1468
|
+
g && (t.content = Ue(t.content, n.index, hn));
|
1469
1469
|
continue;
|
1470
1470
|
}
|
1471
1471
|
if (u = !c, p = !l, p) {
|
1472
1472
|
for (h = w.length - 1; h >= 0 && (d = w[h], !(w[h].level < a)); h--) if (d.single === g && w[h].level === a) {
|
1473
|
-
d = w[h], g ? (S[d.token].content =
|
1473
|
+
d = w[h], g ? (S[d.token].content = Ue(S[d.token].content, d.pos, s.options.quotes[2]), t.content = Ue(t.content, n.index, s.options.quotes[3])) : (S[d.token].content = Ue(S[d.token].content, d.pos, s.options.quotes[0]), t.content = Ue(t.content, n.index, s.options.quotes[1])), w.length = h;
|
1474
1474
|
continue e;
|
1475
1475
|
}
|
1476
1476
|
}
|
@@ -1479,7 +1479,7 @@ function Xs(s) {
|
|
1479
1479
|
pos: n.index,
|
1480
1480
|
single: g,
|
1481
1481
|
level: a
|
1482
|
-
}) : p && g && (t.content =
|
1482
|
+
}) : p && g && (t.content = Ue(t.content, n.index, hn));
|
1483
1483
|
}
|
1484
1484
|
}
|
1485
1485
|
}
|
@@ -1494,7 +1494,7 @@ es.prototype.process = function (s) {
|
|
1494
1494
|
var e, t, i;
|
1495
1495
|
for (i = this.ruler.getRules(""), e = 0, t = i.length; e < t; e++) i[e](s);
|
1496
1496
|
};
|
1497
|
-
function
|
1497
|
+
function De(s, e, t, i, n) {
|
1498
1498
|
var r, o, a, l, c, d, u;
|
1499
1499
|
for (this.src = s, this.parser = e, this.options = t, this.env = i, this.tokens = n, this.bMarks = [], this.eMarks = [], this.tShift = [], this.blkIndent = 0, this.line = 0, this.lineMax = 0, this.tight = !1, this.parentType = "root", this.ddIndent = -1, this.level = 0, this.result = "", o = this.src, d = 0, u = !1, a = l = d = 0, c = o.length; l < c; l++) {
|
1500
1500
|
if (r = o.charCodeAt(l), !u) if (r === 32) {
|
@@ -1505,27 +1505,27 @@ function Pe(s, e, t, i, n) {
|
|
1505
1505
|
}
|
1506
1506
|
this.bMarks.push(o.length), this.eMarks.push(o.length), this.tShift.push(0), this.lineMax = this.bMarks.length - 1;
|
1507
1507
|
}
|
1508
|
-
|
1508
|
+
De.prototype.isEmpty = function (e) {
|
1509
1509
|
return this.bMarks[e] + this.tShift[e] >= this.eMarks[e];
|
1510
1510
|
};
|
1511
|
-
|
1511
|
+
De.prototype.skipEmptyLines = function (e) {
|
1512
1512
|
for (var t = this.lineMax; e < t && !(this.bMarks[e] + this.tShift[e] < this.eMarks[e]); e++);
|
1513
1513
|
return e;
|
1514
1514
|
};
|
1515
|
-
|
1515
|
+
De.prototype.skipSpaces = function (e) {
|
1516
1516
|
for (var t = this.src.length; e < t && this.src.charCodeAt(e) === 32; e++);
|
1517
1517
|
return e;
|
1518
1518
|
};
|
1519
|
-
|
1519
|
+
De.prototype.skipChars = function (e, t) {
|
1520
1520
|
for (var i = this.src.length; e < i && this.src.charCodeAt(e) === t; e++);
|
1521
1521
|
return e;
|
1522
1522
|
};
|
1523
|
-
|
1523
|
+
De.prototype.skipCharsBack = function (e, t, i) {
|
1524
1524
|
if (e <= i) return e;
|
1525
1525
|
for (; e > i;) if (t !== this.src.charCodeAt(--e)) return e + 1;
|
1526
1526
|
return e;
|
1527
1527
|
};
|
1528
|
-
|
1528
|
+
De.prototype.getLines = function (e, t, i, n) {
|
1529
1529
|
var r,
|
1530
1530
|
o,
|
1531
1531
|
a,
|
@@ -1684,7 +1684,7 @@ function sr(s, e, t, i) {
|
|
1684
1684
|
oe = !0,
|
1685
1685
|
q,
|
1686
1686
|
O,
|
1687
|
-
|
1687
|
+
Ee,
|
1688
1688
|
Si;
|
1689
1689
|
if ((u = mn(s, e)) >= 0) S = !0;else if ((u = fn(s, e)) >= 0) S = !1;else return !1;
|
1690
1690
|
if (s.level >= s.options.maxNesting) return !1;
|
@@ -1706,7 +1706,7 @@ function sr(s, e, t, i) {
|
|
1706
1706
|
type: "list_item_close",
|
1707
1707
|
level: --s.level
|
1708
1708
|
}), n = e = s.line, Q[1] = n, w = s.bMarks[e], !(n >= t || s.isEmpty(n) || s.tShift[n] < s.blkIndent));) {
|
1709
|
-
for (Si = !1, O = 0,
|
1709
|
+
for (Si = !1, O = 0, Ee = q.length; O < Ee; O++) if (q[O](s, n, t, !0)) {
|
1710
1710
|
Si = !0;
|
1711
1711
|
break;
|
1712
1712
|
}
|
@@ -2026,7 +2026,7 @@ Wi.prototype.parse = function (s, e, t, i) {
|
|
2026
2026
|
s = s.replace(vr, " "), s = s.replace(br, "\n"), s.indexOf(" ") >= 0 && (s = s.replace(gr, function (a, l) {
|
2027
2027
|
var c;
|
2028
2028
|
return s.charCodeAt(l) === 10 ? (r = l + 1, o = 0, a) : (c = " ".slice((l - r - o) % 4), o = l - r + 1, c);
|
2029
|
-
})), n = new
|
2029
|
+
})), n = new De(s, this, e, t, i), this.tokenize(n, n.line, n.lineMax);
|
2030
2030
|
};
|
2031
2031
|
function yr(s) {
|
2032
2032
|
switch (s) {
|
@@ -2518,13 +2518,13 @@ si.prototype.tokenize = function (s) {
|
|
2518
2518
|
s.pending && s.pushPending();
|
2519
2519
|
};
|
2520
2520
|
si.prototype.parse = function (s, e, t, i) {
|
2521
|
-
var n = new
|
2521
|
+
var n = new Pe(s, this, e, t, i);
|
2522
2522
|
this.tokenize(n);
|
2523
2523
|
};
|
2524
2524
|
function no(s) {
|
2525
2525
|
var e = ["vbscript", "javascript", "file", "data"],
|
2526
2526
|
t = s.trim().toLowerCase();
|
2527
|
-
return t =
|
2527
|
+
return t = Re(t), !(t.indexOf(":") !== -1 && e.indexOf(t.split(":")[0]) !== -1);
|
2528
2528
|
}
|
2529
2529
|
var so = {
|
2530
2530
|
options: {
|
@@ -2727,10 +2727,10 @@ var vt = /*#__PURE__*/function () {
|
|
2727
2727
|
return vt;
|
2728
2728
|
}();
|
2729
2729
|
var ns = /*#__PURE__*/function () {
|
2730
|
-
function
|
2731
|
-
_classCallCheck(this,
|
2730
|
+
function Ge() {
|
2731
|
+
_classCallCheck(this, Ge);
|
2732
2732
|
}
|
2733
|
-
_createClass(
|
2733
|
+
_createClass(Ge, null, [{
|
2734
2734
|
key: "addMessage",
|
2735
2735
|
value: function addMessage(e, t, i, n) {
|
2736
2736
|
var r;
|
@@ -2740,17 +2740,17 @@ var ns = /*#__PURE__*/function () {
|
|
2740
2740
|
key: "wrapInLink",
|
2741
2741
|
value: function wrapInLink(e, t, i) {
|
2742
2742
|
var n = document.createElement("a");
|
2743
|
-
return n.href = t, n.download = i ||
|
2743
|
+
return n.href = t, n.download = i || Ge.DEFAULT_FILE_NAME, n.target = "_blank", n.appendChild(e), n;
|
2744
2744
|
}
|
2745
2745
|
}, {
|
2746
2746
|
key: "isNonLinkableDataUrl",
|
2747
2747
|
value: function isNonLinkableDataUrl(e, t) {
|
2748
|
-
return
|
2748
|
+
return !t.startsWith("data") || e === "image" ? !1 : e === "any" && t.startsWith("data:text/javascript") || !t.startsWith("data:image");
|
2749
2749
|
}
|
2750
2750
|
}, {
|
2751
2751
|
key: "processContent",
|
2752
2752
|
value: function processContent(e, t, i, n) {
|
2753
|
-
return !
|
2753
|
+
return !i || Ge.isNonLinkableDataUrl(e, i) ? t : Ge.wrapInLink(t, i, n);
|
2754
2754
|
}
|
2755
2755
|
}, {
|
2756
2756
|
key: "waitToLoadThenScroll",
|
@@ -2762,11 +2762,11 @@ var ns = /*#__PURE__*/function () {
|
|
2762
2762
|
}, {
|
2763
2763
|
key: "scrollDownOnImageLoad",
|
2764
2764
|
value: function scrollDownOnImageLoad(e, t) {
|
2765
|
-
if (e.startsWith("data"))
|
2765
|
+
if (e.startsWith("data")) Ge.waitToLoadThenScroll(t);else try {
|
2766
2766
|
fetch(e, {
|
2767
2767
|
mode: "no-cors"
|
2768
2768
|
})["catch"](function () {})["finally"](function () {
|
2769
|
-
|
2769
|
+
Ge.waitToLoadThenScroll(t);
|
2770
2770
|
});
|
2771
2771
|
} catch (_unused5) {
|
2772
2772
|
t.scrollTop = t.scrollHeight;
|
@@ -2792,7 +2792,7 @@ var ns = /*#__PURE__*/function () {
|
|
2792
2792
|
return delete t.ref, t;
|
2793
2793
|
}
|
2794
2794
|
}]);
|
2795
|
-
return
|
2795
|
+
return Ge;
|
2796
2796
|
}();
|
2797
2797
|
ns.DEFAULT_FILE_NAME = "file";
|
2798
2798
|
var ne = ns;
|
@@ -2934,11 +2934,11 @@ var ce = /*#__PURE__*/function () {
|
|
2934
2934
|
}]);
|
2935
2935
|
return ce;
|
2936
2936
|
}();
|
2937
|
-
var
|
2938
|
-
function
|
2939
|
-
_classCallCheck(this,
|
2937
|
+
var Ke = /*#__PURE__*/function () {
|
2938
|
+
function Ke() {
|
2939
|
+
_classCallCheck(this, Ke);
|
2940
2940
|
}
|
2941
|
-
_createClass(
|
2941
|
+
_createClass(Ke, null, [{
|
2942
2942
|
key: "getPosition",
|
2943
2943
|
value: function getPosition(e, t) {
|
2944
2944
|
var _i5, _i6, _i7;
|
@@ -2962,28 +2962,28 @@ var We = /*#__PURE__*/function () {
|
|
2962
2962
|
key: "createName",
|
2963
2963
|
value: function createName(e, t) {
|
2964
2964
|
var i = document.createElement("div");
|
2965
|
-
return i.classList.add("name"), i.textContent =
|
2965
|
+
return i.classList.add("name"), i.textContent = Ke.getNameText(e, t), Ke.applyStyle(i, e, t), i;
|
2966
2966
|
}
|
2967
2967
|
}, {
|
2968
2968
|
key: "add",
|
2969
2969
|
value: function add(e, t, i) {
|
2970
2970
|
var n = typeof i == "boolean" ? {} : i,
|
2971
|
-
r =
|
2972
|
-
o =
|
2971
|
+
r = Ke.createName(t, n),
|
2972
|
+
o = Ke.getPosition(t, n);
|
2973
2973
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
2974
2974
|
}
|
2975
2975
|
}]);
|
2976
|
-
return
|
2976
|
+
return Ke;
|
2977
2977
|
}();
|
2978
|
-
var
|
2979
|
-
function
|
2978
|
+
var $e = /*#__PURE__*/function () {
|
2979
|
+
function $e(e) {
|
2980
2980
|
var _this3 = this;
|
2981
|
-
_classCallCheck(this,
|
2982
|
-
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef =
|
2981
|
+
_classCallCheck(this, $e);
|
2982
|
+
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef = $e.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = vt.createNew(), this._avatars = e.avatars, this._names = e.names, this._onNewMessage = Bt.onNewMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(function () {
|
2983
2983
|
_this3.submitUserMessage = e.submitUserMessage;
|
2984
2984
|
});
|
2985
2985
|
}
|
2986
|
-
_createClass(
|
2986
|
+
_createClass($e, [{
|
2987
2987
|
key: "addNewTextMessage",
|
2988
2988
|
value: function addNewTextMessage(e, t, i) {
|
2989
2989
|
if (i != null && i.status) {
|
@@ -3020,12 +3020,12 @@ var Je = /*#__PURE__*/function () {
|
|
3020
3020
|
var n;
|
3021
3021
|
(n = this._introPanel) == null || n.hide();
|
3022
3022
|
var i = this.messageElementRefs[this.messageElementRefs.length - 1];
|
3023
|
-
return
|
3023
|
+
return $e.isTemporaryElement(i) && (i.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t);
|
3024
3024
|
}
|
3025
3025
|
}, {
|
3026
3026
|
key: "createMessageElements",
|
3027
3027
|
value: function createMessageElements(e, t) {
|
3028
|
-
var i =
|
3028
|
+
var i = $e.createBaseElements(),
|
3029
3029
|
n = i.outerContainer,
|
3030
3030
|
r = i.innerContainer,
|
3031
3031
|
o = i.bubbleElement;
|
@@ -3036,7 +3036,7 @@ var Je = /*#__PURE__*/function () {
|
|
3036
3036
|
value:
|
3037
3037
|
// prettier-ignore
|
3038
3038
|
function addInnerContainerElements(e, t, i) {
|
3039
|
-
return e.classList.add("message-bubble", v.getRoleClass(i), i === v.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), this._avatars && ce.add(e, i, this._avatars), this._names &&
|
3039
|
+
return e.classList.add("message-bubble", v.getRoleClass(i), i === v.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), this._avatars && ce.add(e, i, this._avatars), this._names && Ke.add(e, i, this._names), {
|
3040
3040
|
bubbleElement: e
|
3041
3041
|
};
|
3042
3042
|
}
|
@@ -3081,7 +3081,7 @@ var Je = /*#__PURE__*/function () {
|
|
3081
3081
|
}, {
|
3082
3082
|
key: "isTemporaryElement",
|
3083
3083
|
value: function isTemporaryElement(e) {
|
3084
|
-
return (e == null ? void 0 : e.bubbleElement.classList.contains("loading-message-text")) ||
|
3084
|
+
return (e == null ? void 0 : e.bubbleElement.classList.contains("loading-message-text")) || ve.isElementTemporary(e);
|
3085
3085
|
}
|
3086
3086
|
}, {
|
3087
3087
|
key: "createBaseElements",
|
@@ -3110,7 +3110,7 @@ var Je = /*#__PURE__*/function () {
|
|
3110
3110
|
return t && (a.text = t), i && (a.files = i), n && (a.html = n), !t && !i && !n && (a.text = ""), r && (a._sessionId = r), a;
|
3111
3111
|
}
|
3112
3112
|
}]);
|
3113
|
-
return
|
3113
|
+
return $e;
|
3114
3114
|
}();
|
3115
3115
|
var Ji = /*#__PURE__*/function () {
|
3116
3116
|
// used for extracting at end and for isStreaming
|
@@ -3171,7 +3171,7 @@ var Ji = /*#__PURE__*/function () {
|
|
3171
3171
|
var n = {
|
3172
3172
|
role: this._activeMessageRole || v.AI_ROLE
|
3173
3173
|
};
|
3174
|
-
this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, n.text = this._streamedContent, this._messages.textToSpeech && jt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === ot.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((o = v.getLastMessageBubbleElement(t)) == null ? void 0 : o.innerHTML) || ""), this._elements && se.apply(this._messages, this._elements.outerContainer), n.html = this._streamedContent), n && (this._messages.messages.push(n), this._messages.sendClientUpdate(
|
3174
|
+
this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, n.text = this._streamedContent, this._messages.textToSpeech && jt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === ot.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((o = v.getLastMessageBubbleElement(t)) == null ? void 0 : o.innerHTML) || ""), this._elements && se.apply(this._messages, this._elements.outerContainer), n.html = this._streamedContent), n && (this._messages.messages.push(n), this._messages.sendClientUpdate($e.createMessageContent(n), !1)), this._hasStreamEnded = !0;
|
3175
3175
|
}
|
3176
3176
|
}]);
|
3177
3177
|
return ot;
|
@@ -3313,29 +3313,29 @@ function uo(_x10, _x11) {
|
|
3313
3313
|
return _uo.apply(this, arguments);
|
3314
3314
|
}
|
3315
3315
|
function _uo() {
|
3316
|
-
_uo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3316
|
+
_uo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(s, e) {
|
3317
3317
|
var t, i;
|
3318
|
-
return _regeneratorRuntime().wrap(function
|
3319
|
-
while (1) switch (
|
3318
|
+
return _regeneratorRuntime().wrap(function _callee106$(_context106) {
|
3319
|
+
while (1) switch (_context106.prev = _context106.next) {
|
3320
3320
|
case 0:
|
3321
3321
|
t = s.getReader();
|
3322
3322
|
case 1:
|
3323
|
-
|
3323
|
+
_context106.next = 3;
|
3324
3324
|
return t.read();
|
3325
3325
|
case 3:
|
3326
|
-
if ((i =
|
3327
|
-
|
3326
|
+
if ((i = _context106.sent).done) {
|
3327
|
+
_context106.next = 7;
|
3328
3328
|
break;
|
3329
3329
|
}
|
3330
3330
|
e(i.value);
|
3331
3331
|
case 5:
|
3332
|
-
|
3332
|
+
_context106.next = 1;
|
3333
3333
|
break;
|
3334
3334
|
case 7:
|
3335
3335
|
case "end":
|
3336
|
-
return
|
3336
|
+
return _context106.stop();
|
3337
3337
|
}
|
3338
|
-
},
|
3338
|
+
}, _callee106);
|
3339
3339
|
}));
|
3340
3340
|
return _uo.apply(this, arguments);
|
3341
3341
|
}
|
@@ -3572,7 +3572,7 @@ var rs = /*#__PURE__*/function () {
|
|
3572
3572
|
return lt;
|
3573
3573
|
}();
|
3574
3574
|
rs.URL = "deep-chat-demo";
|
3575
|
-
var
|
3575
|
+
var ye = rs;
|
3576
3576
|
var I = /*#__PURE__*/function () {
|
3577
3577
|
function I() {
|
3578
3578
|
_classCallCheck(this, I);
|
@@ -3629,13 +3629,13 @@ var I = /*#__PURE__*/function () {
|
|
3629
3629
|
_context7.next = 16;
|
3630
3630
|
break;
|
3631
3631
|
}
|
3632
|
-
return _context7.abrupt("return",
|
3632
|
+
return _context7.abrupt("return", Ie.stream(e, o, i));
|
3633
3633
|
case 16:
|
3634
|
-
if (!(((f = e.requestSettings) == null ? void 0 : f.url) ===
|
3634
|
+
if (!(((f = e.requestSettings) == null ? void 0 : f.url) === ye.URL)) {
|
3635
3635
|
_context7.next = 18;
|
3636
3636
|
break;
|
3637
3637
|
}
|
3638
|
-
return _context7.abrupt("return",
|
3638
|
+
return _context7.abrupt("return", ye.requestStream(i, e.streamHandlers));
|
3639
3639
|
case 18:
|
3640
3640
|
p = new Qe(i);
|
3641
3641
|
bo(((S = e.requestSettings) == null ? void 0 : S.url) || e.url || "", {
|
@@ -3693,10 +3693,10 @@ var I = /*#__PURE__*/function () {
|
|
3693
3693
|
_context6.t0 = q;
|
3694
3694
|
case 7:
|
3695
3695
|
O = _context6.t0;
|
3696
|
-
(oe = e.extractResultData) == null || oe.call(e, O).then(function (
|
3697
|
-
p.upsertStreamedMessage(
|
3698
|
-
})["catch"](function (
|
3699
|
-
return E.displayError(i,
|
3696
|
+
(oe = e.extractResultData) == null || oe.call(e, O).then(function (Ee) {
|
3697
|
+
p.upsertStreamedMessage(Ee);
|
3698
|
+
})["catch"](function (Ee) {
|
3699
|
+
return E.displayError(i, Ee);
|
3700
3700
|
});
|
3701
3701
|
case 9:
|
3702
3702
|
case "end":
|
@@ -3774,11 +3774,11 @@ var I = /*#__PURE__*/function () {
|
|
3774
3774
|
}]);
|
3775
3775
|
return I;
|
3776
3776
|
}();
|
3777
|
-
var
|
3778
|
-
function
|
3779
|
-
_classCallCheck(this,
|
3777
|
+
var Ie = /*#__PURE__*/function () {
|
3778
|
+
function Ie() {
|
3779
|
+
_classCallCheck(this, Ie);
|
3780
3780
|
}
|
3781
|
-
_createClass(
|
3781
|
+
_createClass(Ie, null, [{
|
3782
3782
|
key: "request",
|
3783
3783
|
value: function () {
|
3784
3784
|
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(e, t, i) {
|
@@ -3821,7 +3821,7 @@ var ke = /*#__PURE__*/function () {
|
|
3821
3821
|
return function r(_x18) {
|
3822
3822
|
return _ref2.apply(this, arguments);
|
3823
3823
|
};
|
3824
|
-
}(), o =
|
3824
|
+
}(), o = Ie.generateOptionalSignals();
|
3825
3825
|
(l = (a = e.requestSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
|
3826
3826
|
onResponse: r
|
3827
3827
|
}));
|
@@ -3855,7 +3855,7 @@ var ke = /*#__PURE__*/function () {
|
|
3855
3855
|
e.streamHandlers.abortStream.abort = function () {
|
3856
3856
|
o.finaliseStreamedMessage(), e.streamHandlers.onClose(), n = !1;
|
3857
3857
|
};
|
3858
|
-
var d =
|
3858
|
+
var d = Ie.generateOptionalSignals();
|
3859
3859
|
(p = (u = e.requestSettings).handler) == null || p.call(u, t, _objectSpread(_objectSpread({}, d), {}, {
|
3860
3860
|
onOpen: a,
|
3861
3861
|
onResponse: c,
|
@@ -3915,7 +3915,7 @@ var ke = /*#__PURE__*/function () {
|
|
3915
3915
|
return _ref3.apply(this, arguments);
|
3916
3916
|
};
|
3917
3917
|
}(),
|
3918
|
-
a =
|
3918
|
+
a = Ie.generateOptionalSignals();
|
3919
3919
|
(c = (l = e.requestSettings).handler) == null || c.call(l, void 0, _objectSpread(_objectSpread({}, a), {}, {
|
3920
3920
|
onOpen: n,
|
3921
3921
|
onResponse: o,
|
@@ -3938,7 +3938,7 @@ var ke = /*#__PURE__*/function () {
|
|
3938
3938
|
};
|
3939
3939
|
}
|
3940
3940
|
}]);
|
3941
|
-
return
|
3941
|
+
return Ie;
|
3942
3942
|
}();
|
3943
3943
|
var _ = /*#__PURE__*/function () {
|
3944
3944
|
function _() {
|
@@ -3988,13 +3988,13 @@ var _ = /*#__PURE__*/function () {
|
|
3988
3988
|
_context12.next = 13;
|
3989
3989
|
break;
|
3990
3990
|
}
|
3991
|
-
return _context12.abrupt("return",
|
3991
|
+
return _context12.abrupt("return", Ie.request(e, o, i));
|
3992
3992
|
case 13:
|
3993
|
-
if (!(((g = e.requestSettings) == null ? void 0 : g.url) ===
|
3993
|
+
if (!(((g = e.requestSettings) == null ? void 0 : g.url) === ye.URL)) {
|
3994
3994
|
_context12.next = 15;
|
3995
3995
|
break;
|
3996
3996
|
}
|
3997
|
-
return _context12.abrupt("return",
|
3997
|
+
return _context12.abrupt("return", ye.request(e, i));
|
3998
3998
|
case 15:
|
3999
3999
|
d = !0;
|
4000
4000
|
u = E.fetch.bind(this, e, a, n);
|
@@ -4235,7 +4235,7 @@ var Y = /*#__PURE__*/function () {
|
|
4235
4235
|
_createClass(Y, null, [{
|
4236
4236
|
key: "setup",
|
4237
4237
|
value: function setup(e) {
|
4238
|
-
e.requestSettings.url !==
|
4238
|
+
e.requestSettings.url !== ye.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
4239
4239
|
}
|
4240
4240
|
}, {
|
4241
4241
|
key: "createConnection",
|
@@ -4243,7 +4243,7 @@ var Y = /*#__PURE__*/function () {
|
|
4243
4243
|
if (!document.body.contains(e.deepChat)) return;
|
4244
4244
|
var i = e.requestSettings.websocket;
|
4245
4245
|
if (i) {
|
4246
|
-
if (e.requestSettings.handler) return
|
4246
|
+
if (e.requestSettings.handler) return Ie.websocket(e, t);
|
4247
4247
|
try {
|
4248
4248
|
var n = typeof i != "boolean" ? i : void 0,
|
4249
4249
|
r = new WebSocket(e.requestSettings.url || "", n);
|
@@ -4370,11 +4370,11 @@ var Y = /*#__PURE__*/function () {
|
|
4370
4370
|
return _context16.abrupt("return", r.newUserMessage.listener(a));
|
4371
4371
|
case 14:
|
4372
4372
|
c = n ? JSON.stringify(a) : a;
|
4373
|
-
if (!(((u = e.requestSettings) == null ? void 0 : u.url) ===
|
4373
|
+
if (!(((u = e.requestSettings) == null ? void 0 : u.url) === ye.URL)) {
|
4374
4374
|
_context16.next = 17;
|
4375
4375
|
break;
|
4376
4376
|
}
|
4377
|
-
return _context16.abrupt("return",
|
4377
|
+
return _context16.abrupt("return", ye.request(e, i));
|
4378
4378
|
case 17:
|
4379
4379
|
r.readyState === void 0 || r.readyState !== r.OPEN ? (console.error("Connection is not open"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error")) : (r.send(JSON.stringify(c)), e.completionsHandlers.onFinish());
|
4380
4380
|
case 18:
|
@@ -4510,14 +4510,14 @@ var L = /*#__PURE__*/function () {
|
|
4510
4510
|
}]);
|
4511
4511
|
return L;
|
4512
4512
|
}();
|
4513
|
-
var
|
4514
|
-
function
|
4513
|
+
var Ne = /*#__PURE__*/function () {
|
4514
|
+
function Ne(e, t, i) {
|
4515
4515
|
var _a$url;
|
4516
|
-
_classCallCheck(this,
|
4516
|
+
_classCallCheck(this, Ne);
|
4517
4517
|
var n, r, o, a;
|
4518
|
-
this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage =
|
4518
|
+
this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage = Ne.canSendMessage, this.requestSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (n = e.request) == null ? void 0 : n.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, L.set(e, this, t), e.request && (this.requestSettings = e.request), this.demo && ((_a$url = (a = this.requestSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = ye.URL), this.requestSettings.websocket && Y.setup(this);
|
4519
4519
|
}
|
4520
|
-
_createClass(
|
4520
|
+
_createClass(Ne, [{
|
4521
4521
|
key: "verifyKey",
|
4522
4522
|
value: function verifyKey(e, t) {}
|
4523
4523
|
}, {
|
@@ -4592,7 +4592,7 @@ var Re = /*#__PURE__*/function () {
|
|
4592
4592
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
4593
4593
|
while (1) switch (_context19.prev = _context19.next) {
|
4594
4594
|
case 0:
|
4595
|
-
n =
|
4595
|
+
n = Ne.createCustomFormDataBody(this.rawBody, t, i), r = this.requestSettings, o = this.getServiceIOByType(i[0]);
|
4596
4596
|
this.requestSettings = (o == null ? void 0 : o.request) || this.requestSettings;
|
4597
4597
|
_context19.next = 4;
|
4598
4598
|
return this.request(n, e, !1);
|
@@ -4677,7 +4677,7 @@ var Re = /*#__PURE__*/function () {
|
|
4677
4677
|
_context22.next = 4;
|
4678
4678
|
break;
|
4679
4679
|
}
|
4680
|
-
return _context22.abrupt("return",
|
4680
|
+
return _context22.abrupt("return", Le.handleResponseProperty(e));
|
4681
4681
|
case 4:
|
4682
4682
|
if (!E.validateResponseFormat(e)) {
|
4683
4683
|
_context22.next = 6;
|
@@ -4727,10 +4727,10 @@ var Re = /*#__PURE__*/function () {
|
|
4727
4727
|
return o.text && (delete o.files, n.append("message".concat(r += 1), JSON.stringify(o))), n;
|
4728
4728
|
}
|
4729
4729
|
}]);
|
4730
|
-
return
|
4730
|
+
return Ne;
|
4731
4731
|
}();
|
4732
|
-
var U = /*#__PURE__*/function (
|
4733
|
-
_inherits(U,
|
4732
|
+
var U = /*#__PURE__*/function (_Ne) {
|
4733
|
+
_inherits(U, _Ne);
|
4734
4734
|
var _super = _createSuper(U);
|
4735
4735
|
// prettier-ignore
|
4736
4736
|
function U(e, t, i, n, r) {
|
@@ -4777,7 +4777,7 @@ var U = /*#__PURE__*/function (_Re) {
|
|
4777
4777
|
}
|
4778
4778
|
}]);
|
4779
4779
|
return U;
|
4780
|
-
}(
|
4780
|
+
}(Ne);
|
4781
4781
|
var zt = /*#__PURE__*/function () {
|
4782
4782
|
function zt() {
|
4783
4783
|
_classCallCheck(this, zt);
|
@@ -4798,19 +4798,19 @@ var zt = /*#__PURE__*/function () {
|
|
4798
4798
|
return zt;
|
4799
4799
|
}();
|
4800
4800
|
var $i = /*#__PURE__*/function (_HTMLElement) {
|
4801
|
-
_inherits(
|
4802
|
-
var _super2 = _createSuper(
|
4801
|
+
_inherits(Ve, _HTMLElement);
|
4802
|
+
var _super2 = _createSuper(Ve);
|
4803
4803
|
// If this is not working, try using propertyName directly
|
4804
|
-
function
|
4804
|
+
function Ve() {
|
4805
4805
|
var _this7;
|
4806
|
-
_classCallCheck(this,
|
4807
|
-
_this7 = _super2.call(this), _this7._waitingToRender_ = !1, _this7._propUpdated_ = !1, Object.keys(
|
4808
|
-
var t =
|
4806
|
+
_classCallCheck(this, Ve);
|
4807
|
+
_this7 = _super2.call(this), _this7._waitingToRender_ = !1, _this7._propUpdated_ = !1, Object.keys(Ve._attributeToProperty_).forEach(function (e) {
|
4808
|
+
var t = Ve._attributeToProperty_[e];
|
4809
4809
|
_this7.constructPropertyAccessors(t), _this7.hasOwnProperty(e) || _this7.constructPropertyAccessors(t, e);
|
4810
4810
|
});
|
4811
4811
|
return _this7;
|
4812
4812
|
}
|
4813
|
-
_createClass(
|
4813
|
+
_createClass(Ve, [{
|
4814
4814
|
key: "constructPropertyAccessors",
|
4815
4815
|
value:
|
4816
4816
|
// need to be called here as accessors need to be set for the class instance
|
@@ -4829,8 +4829,8 @@ var $i = /*#__PURE__*/function (_HTMLElement) {
|
|
4829
4829
|
key: "attributeChangedCallback",
|
4830
4830
|
value: function attributeChangedCallback(e, t, i) {
|
4831
4831
|
if (t === i) return;
|
4832
|
-
var n =
|
4833
|
-
r =
|
4832
|
+
var n = Ve._attributes_[e](i),
|
4833
|
+
r = Ve._attributeToProperty_[e];
|
4834
4834
|
this[r] = n;
|
4835
4835
|
}
|
4836
4836
|
}, {
|
@@ -4839,10 +4839,10 @@ var $i = /*#__PURE__*/function (_HTMLElement) {
|
|
4839
4839
|
}], [{
|
4840
4840
|
key: "observedAttributes",
|
4841
4841
|
get: function get() {
|
4842
|
-
return Object.keys(
|
4842
|
+
return Object.keys(Ve._attributes_) || [];
|
4843
4843
|
}
|
4844
4844
|
}]);
|
4845
|
-
return
|
4845
|
+
return Ve;
|
4846
4846
|
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
4847
4847
|
$i._attributes_ = {};
|
4848
4848
|
$i._attributeToProperty_ = {};
|
@@ -4862,15 +4862,15 @@ var H = /*#__PURE__*/function () {
|
|
4862
4862
|
return H;
|
4863
4863
|
}();
|
4864
4864
|
var os = /*#__PURE__*/function () {
|
4865
|
-
function
|
4866
|
-
_classCallCheck(this,
|
4865
|
+
function We() {
|
4866
|
+
_classCallCheck(this, We);
|
4867
4867
|
}
|
4868
|
-
_createClass(
|
4868
|
+
_createClass(We, null, [{
|
4869
4869
|
key: "changeVisibility",
|
4870
4870
|
value:
|
4871
4871
|
// prettier-ignore
|
4872
4872
|
function changeVisibility(e, t, i, n) {
|
4873
|
-
n.target.id ===
|
4873
|
+
n.target.id === We.VISIBLE_ICON_ID ? (t.style.display = "none", i.style.display = "block", e.type = "password") : (t.style.display = "block", i.style.display = "none", e.type = "text");
|
4874
4874
|
}
|
4875
4875
|
}, {
|
4876
4876
|
key: "createIconElement",
|
@@ -4884,13 +4884,13 @@ var os = /*#__PURE__*/function () {
|
|
4884
4884
|
value: function create(e) {
|
4885
4885
|
var t = document.createElement("div");
|
4886
4886
|
t.id = "visibility-icon-container";
|
4887
|
-
var i =
|
4887
|
+
var i = We.createIconElement(Eo, We.VISIBLE_ICON_ID);
|
4888
4888
|
i.style.display = "none", t.appendChild(i);
|
4889
|
-
var n =
|
4890
|
-
return t.appendChild(n), t.onclick =
|
4889
|
+
var n = We.createIconElement(xo, "not-visible-icon");
|
4890
|
+
return t.appendChild(n), t.onclick = We.changeVisibility.bind(this, e, i, n), t;
|
4891
4891
|
}
|
4892
4892
|
}]);
|
4893
|
-
return
|
4893
|
+
return We;
|
4894
4894
|
}();
|
4895
4895
|
os.VISIBLE_ICON_ID = "visible-icon";
|
4896
4896
|
var So = os;
|
@@ -5160,8 +5160,8 @@ var Sn = {
|
|
5160
5160
|
}],
|
5161
5161
|
use_web_worker: !0
|
5162
5162
|
},
|
5163
|
-
it = /*#__PURE__*/function (
|
5164
|
-
_inherits(M,
|
5163
|
+
it = /*#__PURE__*/function (_Ne2) {
|
5164
|
+
_inherits(M, _Ne2);
|
5165
5165
|
var _super3 = _createSuper(M);
|
5166
5166
|
function M(e) {
|
5167
5167
|
var _this8;
|
@@ -5694,7 +5694,7 @@ var Sn = {
|
|
5694
5694
|
}
|
5695
5695
|
}]);
|
5696
5696
|
return M;
|
5697
|
-
}(
|
5697
|
+
}(Ne);
|
5698
5698
|
it.GENERIC_ERROR = "Error, please check the [troubleshooting](https://deepchat.dev/docs/webModel#troubleshooting) section of documentation for help.";
|
5699
5699
|
it.MULTIPLE_MODELS_ERROR = "Cannot run multiple web models";
|
5700
5700
|
it.WEB_LLM_NOT_FOUND_ERROR = "WebLLM module not found";
|
@@ -5785,9 +5785,9 @@ var as = /*#__PURE__*/function (_U) {
|
|
5785
5785
|
return Fi;
|
5786
5786
|
}(U);
|
5787
5787
|
as.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
5788
|
-
var
|
5789
|
-
var wt = /*#__PURE__*/function (
|
5790
|
-
_inherits(wt,
|
5788
|
+
var je = as;
|
5789
|
+
var wt = /*#__PURE__*/function (_je) {
|
5790
|
+
_inherits(wt, _je);
|
5791
5791
|
var _super5 = _createSuper(wt);
|
5792
5792
|
// prettier-ignore
|
5793
5793
|
function wt(e, t, i, n, r, o) {
|
@@ -5840,7 +5840,7 @@ var wt = /*#__PURE__*/function (_De) {
|
|
5840
5840
|
}
|
5841
5841
|
}]);
|
5842
5842
|
return wt;
|
5843
|
-
}(
|
5843
|
+
}(je);
|
5844
5844
|
var wo = /*#__PURE__*/function (_wt) {
|
5845
5845
|
_inherits(wo, _wt);
|
5846
5846
|
var _super6 = _createSuper(wo);
|
@@ -6255,8 +6255,8 @@ var Mo = /*#__PURE__*/function (_wt3) {
|
|
6255
6255
|
}]);
|
6256
6256
|
return Mo;
|
6257
6257
|
}(wt);
|
6258
|
-
var To = /*#__PURE__*/function (
|
6259
|
-
_inherits(To,
|
6258
|
+
var To = /*#__PURE__*/function (_je2) {
|
6259
|
+
_inherits(To, _je2);
|
6260
6260
|
var _super12 = _createSuper(To);
|
6261
6261
|
function To(e) {
|
6262
6262
|
_classCallCheck(this, To);
|
@@ -6294,9 +6294,9 @@ var To = /*#__PURE__*/function (_De2) {
|
|
6294
6294
|
}()
|
6295
6295
|
}]);
|
6296
6296
|
return To;
|
6297
|
-
}(
|
6298
|
-
var Co = /*#__PURE__*/function (
|
6299
|
-
_inherits(Co,
|
6297
|
+
}(je);
|
6298
|
+
var Co = /*#__PURE__*/function (_je3) {
|
6299
|
+
_inherits(Co, _je3);
|
6300
6300
|
var _super13 = _createSuper(Co);
|
6301
6301
|
function Co(e) {
|
6302
6302
|
var _this19;
|
@@ -6350,9 +6350,9 @@ var Co = /*#__PURE__*/function (_De3) {
|
|
6350
6350
|
}()
|
6351
6351
|
}]);
|
6352
6352
|
return Co;
|
6353
|
-
}(
|
6354
|
-
var Ao = /*#__PURE__*/function (
|
6355
|
-
_inherits(Ao,
|
6353
|
+
}(je);
|
6354
|
+
var Ao = /*#__PURE__*/function (_je4) {
|
6355
|
+
_inherits(Ao, _je4);
|
6356
6356
|
var _super14 = _createSuper(Ao);
|
6357
6357
|
function Ao(e) {
|
6358
6358
|
_classCallCheck(this, Ao);
|
@@ -6390,9 +6390,9 @@ var Ao = /*#__PURE__*/function (_De4) {
|
|
6390
6390
|
}()
|
6391
6391
|
}]);
|
6392
6392
|
return Ao;
|
6393
|
-
}(
|
6394
|
-
var ko = /*#__PURE__*/function (
|
6395
|
-
_inherits(ko,
|
6393
|
+
}(je);
|
6394
|
+
var ko = /*#__PURE__*/function (_je5) {
|
6395
|
+
_inherits(ko, _je5);
|
6396
6396
|
var _super15 = _createSuper(ko);
|
6397
6397
|
function ko(e) {
|
6398
6398
|
var _this20$maxMessages;
|
@@ -6474,7 +6474,7 @@ var ko = /*#__PURE__*/function (_De5) {
|
|
6474
6474
|
}()
|
6475
6475
|
}]);
|
6476
6476
|
return ko;
|
6477
|
-
}(
|
6477
|
+
}(je);
|
6478
6478
|
var Gt = /*#__PURE__*/function (_ri3) {
|
6479
6479
|
_inherits(Gt, _ri3);
|
6480
6480
|
var _super16 = _createSuper(Gt);
|
@@ -6584,8 +6584,8 @@ var Gt = /*#__PURE__*/function (_ri3) {
|
|
6584
6584
|
}]);
|
6585
6585
|
return Gt;
|
6586
6586
|
}(ri);
|
6587
|
-
var Io = /*#__PURE__*/function (
|
6588
|
-
_inherits(Io,
|
6587
|
+
var Io = /*#__PURE__*/function (_je6) {
|
6588
|
+
_inherits(Io, _je6);
|
6589
6589
|
var _super17 = _createSuper(Io);
|
6590
6590
|
function Io(e) {
|
6591
6591
|
_classCallCheck(this, Io);
|
@@ -6623,7 +6623,7 @@ var Io = /*#__PURE__*/function (_De6) {
|
|
6623
6623
|
}()
|
6624
6624
|
}]);
|
6625
6625
|
return Io;
|
6626
|
-
}(
|
6626
|
+
}(je);
|
6627
6627
|
var Vt = /*#__PURE__*/function (_ri4) {
|
6628
6628
|
_inherits(Vt, _ri4);
|
6629
6629
|
var _super18 = _createSuper(Vt);
|
@@ -6719,8 +6719,8 @@ var Vt = /*#__PURE__*/function (_ri4) {
|
|
6719
6719
|
}]);
|
6720
6720
|
return Vt;
|
6721
6721
|
}(ri);
|
6722
|
-
var Lo = /*#__PURE__*/function (
|
6723
|
-
_inherits(Lo,
|
6722
|
+
var Lo = /*#__PURE__*/function (_je7) {
|
6723
|
+
_inherits(Lo, _je7);
|
6724
6724
|
var _super19 = _createSuper(Lo);
|
6725
6725
|
function Lo(e) {
|
6726
6726
|
var _this23;
|
@@ -6760,7 +6760,7 @@ var Lo = /*#__PURE__*/function (_De7) {
|
|
6760
6760
|
}()
|
6761
6761
|
}]);
|
6762
6762
|
return Lo;
|
6763
|
-
}(
|
6763
|
+
}(je);
|
6764
6764
|
var Wt = /*#__PURE__*/function () {
|
6765
6765
|
function Wt() {
|
6766
6766
|
_classCallCheck(this, Wt);
|
@@ -6988,99 +6988,39 @@ var N = /*#__PURE__*/function () {
|
|
6988
6988
|
handleVerificationResult: N.handleVerificationResult
|
6989
6989
|
};
|
6990
6990
|
}
|
6991
|
-
|
6992
|
-
key: "storeFiles",
|
6993
|
-
value: function () {
|
6994
|
-
var _storeFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t, i) {
|
6995
|
-
var n, r, o, a;
|
6996
|
-
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
6997
|
-
while (1) switch (_context58.prev = _context58.next) {
|
6998
|
-
case 0:
|
6999
|
-
n = e.requestSettings.headers;
|
7000
|
-
if (n) {
|
7001
|
-
_context58.next = 3;
|
7002
|
-
break;
|
7003
|
-
}
|
7004
|
-
return _context58.abrupt("return");
|
7005
|
-
case 3:
|
7006
|
-
e.url = "https://api.openai.com/v1/files";
|
7007
|
-
r = n[E.CONTENT_TYPE];
|
7008
|
-
delete n[E.CONTENT_TYPE];
|
7009
|
-
o = i.map( /*#__PURE__*/function () {
|
7010
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(a) {
|
7011
|
-
var l;
|
7012
|
-
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
7013
|
-
while (1) switch (_context57.prev = _context57.next) {
|
7014
|
-
case 0:
|
7015
|
-
l = new FormData();
|
7016
|
-
return _context57.abrupt("return", (l.append("purpose", "assistants"), l.append("file", a), new Promise(function (c) {
|
7017
|
-
c(N.directFetch(e, l, "POST", !1));
|
7018
|
-
})));
|
7019
|
-
case 2:
|
7020
|
-
case "end":
|
7021
|
-
return _context57.stop();
|
7022
|
-
}
|
7023
|
-
}, _callee57);
|
7024
|
-
}));
|
7025
|
-
return function (_x109) {
|
7026
|
-
return _ref8.apply(this, arguments);
|
7027
|
-
};
|
7028
|
-
}());
|
7029
|
-
_context58.prev = 7;
|
7030
|
-
_context58.next = 10;
|
7031
|
-
return Promise.all(o);
|
7032
|
-
case 10:
|
7033
|
-
a = _context58.sent.map(function (l) {
|
7034
|
-
return l.id;
|
7035
|
-
});
|
7036
|
-
return _context58.abrupt("return", (n[E.CONTENT_TYPE] = r, a));
|
7037
|
-
case 14:
|
7038
|
-
_context58.prev = 14;
|
7039
|
-
_context58.t0 = _context58["catch"](7);
|
7040
|
-
throw n[E.CONTENT_TYPE] = r, E.displayError(t, _context58.t0), e.completionsHandlers.onFinish(), _context58.t0;
|
7041
|
-
case 17:
|
7042
|
-
case "end":
|
7043
|
-
return _context58.stop();
|
7044
|
-
}
|
7045
|
-
}, _callee58, null, [[7, 14]]);
|
7046
|
-
}));
|
7047
|
-
function storeFiles(_x106, _x107, _x108) {
|
7048
|
-
return _storeFiles.apply(this, arguments);
|
7049
|
-
}
|
7050
|
-
return storeFiles;
|
7051
|
-
}() // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6991
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
7052
6992
|
}, {
|
7053
6993
|
key: "directFetch",
|
7054
6994
|
value: function () {
|
7055
|
-
var _directFetch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6995
|
+
var _directFetch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e, t, i) {
|
7056
6996
|
var n,
|
7057
6997
|
r,
|
7058
|
-
|
7059
|
-
return _regeneratorRuntime().wrap(function
|
7060
|
-
while (1) switch (
|
6998
|
+
_args57 = arguments;
|
6999
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
7000
|
+
while (1) switch (_context57.prev = _context57.next) {
|
7061
7001
|
case 0:
|
7062
|
-
n =
|
7002
|
+
n = _args57.length > 3 && _args57[3] !== undefined ? _args57[3] : !0;
|
7063
7003
|
e.requestSettings.method = i;
|
7064
|
-
|
7004
|
+
_context57.next = 4;
|
7065
7005
|
return E.fetch(e, e.requestSettings.headers, n, t).then(function (o) {
|
7066
7006
|
return E.processResponseByType(o);
|
7067
7007
|
});
|
7068
7008
|
case 4:
|
7069
|
-
r =
|
7009
|
+
r = _context57.sent;
|
7070
7010
|
if (!r.error) {
|
7071
|
-
|
7011
|
+
_context57.next = 7;
|
7072
7012
|
break;
|
7073
7013
|
}
|
7074
7014
|
throw r.error.message;
|
7075
7015
|
case 7:
|
7076
|
-
return
|
7016
|
+
return _context57.abrupt("return", r);
|
7077
7017
|
case 8:
|
7078
7018
|
case "end":
|
7079
|
-
return
|
7019
|
+
return _context57.stop();
|
7080
7020
|
}
|
7081
|
-
},
|
7021
|
+
}, _callee57);
|
7082
7022
|
}));
|
7083
|
-
function directFetch(
|
7023
|
+
function directFetch(_x106, _x107, _x108) {
|
7084
7024
|
return _directFetch.apply(this, arguments);
|
7085
7025
|
}
|
7086
7026
|
return directFetch;
|
@@ -7114,13 +7054,13 @@ var Xi = /*#__PURE__*/function (_U4) {
|
|
7114
7054
|
}, {
|
7115
7055
|
key: "callServiceAPI",
|
7116
7056
|
value: function () {
|
7117
|
-
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7057
|
+
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t) {
|
7118
7058
|
var n, i;
|
7119
|
-
return _regeneratorRuntime().wrap(function
|
7120
|
-
while (1) switch (
|
7059
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
7060
|
+
while (1) switch (_context58.prev = _context58.next) {
|
7121
7061
|
case 0:
|
7122
7062
|
if ((n = this.requestSettings) != null && n.headers) {
|
7123
|
-
|
7063
|
+
_context58.next = 2;
|
7124
7064
|
break;
|
7125
7065
|
}
|
7126
7066
|
throw new Error("Request settings have not been set up");
|
@@ -7130,11 +7070,11 @@ var Xi = /*#__PURE__*/function (_U4) {
|
|
7130
7070
|
_.request(this, i, e);
|
7131
7071
|
case 5:
|
7132
7072
|
case "end":
|
7133
|
-
return
|
7073
|
+
return _context58.stop();
|
7134
7074
|
}
|
7135
|
-
},
|
7075
|
+
}, _callee58, this);
|
7136
7076
|
}));
|
7137
|
-
function callServiceAPI(
|
7077
|
+
function callServiceAPI(_x109, _x110) {
|
7138
7078
|
return _callServiceAPI11.apply(this, arguments);
|
7139
7079
|
}
|
7140
7080
|
return callServiceAPI;
|
@@ -7142,15 +7082,15 @@ var Xi = /*#__PURE__*/function (_U4) {
|
|
7142
7082
|
}, {
|
7143
7083
|
key: "extractResultData",
|
7144
7084
|
value: function () {
|
7145
|
-
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7146
|
-
return _regeneratorRuntime().wrap(function
|
7147
|
-
while (1) switch (
|
7085
|
+
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
|
7086
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
7087
|
+
while (1) switch (_context59.prev = _context59.next) {
|
7148
7088
|
case 0:
|
7149
7089
|
if (!(e instanceof Blob)) {
|
7150
|
-
|
7090
|
+
_context59.next = 2;
|
7151
7091
|
break;
|
7152
7092
|
}
|
7153
|
-
return
|
7093
|
+
return _context59.abrupt("return", new Promise(function (t) {
|
7154
7094
|
var i = new FileReader();
|
7155
7095
|
i.readAsDataURL(e), i.onload = function (n) {
|
7156
7096
|
t({
|
@@ -7163,21 +7103,21 @@ var Xi = /*#__PURE__*/function (_U4) {
|
|
7163
7103
|
}));
|
7164
7104
|
case 2:
|
7165
7105
|
if (!e.error) {
|
7166
|
-
|
7106
|
+
_context59.next = 4;
|
7167
7107
|
break;
|
7168
7108
|
}
|
7169
7109
|
throw e.error.message;
|
7170
7110
|
case 4:
|
7171
|
-
return
|
7111
|
+
return _context59.abrupt("return", {
|
7172
7112
|
error: "error"
|
7173
7113
|
});
|
7174
7114
|
case 5:
|
7175
7115
|
case "end":
|
7176
|
-
return
|
7116
|
+
return _context59.stop();
|
7177
7117
|
}
|
7178
|
-
},
|
7118
|
+
}, _callee59);
|
7179
7119
|
}));
|
7180
|
-
function extractResultData(
|
7120
|
+
function extractResultData(_x111) {
|
7181
7121
|
return _extractResultData14.apply(this, arguments);
|
7182
7122
|
}
|
7183
7123
|
return extractResultData;
|
@@ -7189,26 +7129,26 @@ Xi.DEFAULT_MODEL = "tts-1";
|
|
7189
7129
|
Xi.DEFAULT_VOIDE = "alloy";
|
7190
7130
|
var Oo = Xi;
|
7191
7131
|
var oi = /*#__PURE__*/function (_U5) {
|
7192
|
-
_inherits(
|
7193
|
-
var _super24 = _createSuper(
|
7194
|
-
function
|
7132
|
+
_inherits(we, _U5);
|
7133
|
+
var _super24 = _createSuper(we);
|
7134
|
+
function we(e) {
|
7195
7135
|
var _o$model2;
|
7196
7136
|
var _this26;
|
7197
|
-
_classCallCheck(this,
|
7137
|
+
_classCallCheck(this, we);
|
7198
7138
|
var r, o;
|
7199
7139
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7200
7140
|
i = t == null ? void 0 : t.openAI;
|
7201
7141
|
_this26 = _super24.call(this, e, N.buildKeyVerificationDetails(), N.buildHeaders, i, {
|
7202
7142
|
audio: {}
|
7203
|
-
}), _this26.insertKeyPlaceholderText = "OpenAI API Key", _this26.getKeyLink = "https://platform.openai.com/account/api-keys", _this26.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this26.url = "", _this26.permittedErrorPrefixes = ["Invalid"], _this26.textInputPlaceholderText = "Upload an audio file", _this26._service_url =
|
7143
|
+
}), _this26.insertKeyPlaceholderText = "OpenAI API Key", _this26.getKeyLink = "https://platform.openai.com/account/api-keys", _this26.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this26.url = "", _this26.permittedErrorPrefixes = ["Invalid"], _this26.textInputPlaceholderText = "Upload an audio file", _this26._service_url = we.AUDIO_TRANSCRIPTIONS_URL;
|
7204
7144
|
var n = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
7205
|
-
_typeof(n) == "object" && (_this26.processConfig(n),
|
7145
|
+
_typeof(n) == "object" && (_this26.processConfig(n), we.cleanConfig(n), Object.assign(_this26.rawBody, n)), (_o$model2 = (o = _this26.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = we.DEFAULT_MODEL, _this26.rawBody.response_format = "json", _this26.canSendMessage = we.canSendFileMessage;
|
7206
7146
|
return _this26;
|
7207
7147
|
}
|
7208
|
-
_createClass(
|
7148
|
+
_createClass(we, [{
|
7209
7149
|
key: "processConfig",
|
7210
7150
|
value: function processConfig(e) {
|
7211
|
-
e != null && e.type && e.type === "translation" && (this._service_url =
|
7151
|
+
e != null && e.type && e.type === "translation" && (this._service_url = we.AUDIO_TRANSLATIONS_URL, delete e.language);
|
7212
7152
|
}
|
7213
7153
|
}, {
|
7214
7154
|
key: "preprocessBody",
|
@@ -7222,33 +7162,33 @@ var oi = /*#__PURE__*/function (_U5) {
|
|
7222
7162
|
}, {
|
7223
7163
|
key: "callServiceAPI",
|
7224
7164
|
value: function () {
|
7225
|
-
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7165
|
+
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t, i) {
|
7226
7166
|
var o, n, r;
|
7227
|
-
return _regeneratorRuntime().wrap(function
|
7228
|
-
while (1) switch (
|
7167
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
7168
|
+
while (1) switch (_context60.prev = _context60.next) {
|
7229
7169
|
case 0:
|
7230
7170
|
if ((o = this.requestSettings) != null && o.headers) {
|
7231
|
-
|
7171
|
+
_context60.next = 2;
|
7232
7172
|
break;
|
7233
7173
|
}
|
7234
7174
|
throw new Error("Request settings have not been set up");
|
7235
7175
|
case 2:
|
7236
7176
|
if (i != null && i[0]) {
|
7237
|
-
|
7177
|
+
_context60.next = 4;
|
7238
7178
|
break;
|
7239
7179
|
}
|
7240
7180
|
throw new Error("No file was added");
|
7241
7181
|
case 4:
|
7242
7182
|
this.url = this.requestSettings.url || this._service_url;
|
7243
|
-
n = this.preprocessBody(this.rawBody, t), r =
|
7183
|
+
n = this.preprocessBody(this.rawBody, t), r = we.createFormDataBody(n, i[0]);
|
7244
7184
|
E.tempRemoveContentHeader(this.requestSettings, _.request.bind(this, this, r, e), !1);
|
7245
7185
|
case 7:
|
7246
7186
|
case "end":
|
7247
|
-
return
|
7187
|
+
return _context60.stop();
|
7248
7188
|
}
|
7249
|
-
},
|
7189
|
+
}, _callee60, this);
|
7250
7190
|
}));
|
7251
|
-
function callServiceAPI(
|
7191
|
+
function callServiceAPI(_x112, _x113, _x114) {
|
7252
7192
|
return _callServiceAPI12.apply(this, arguments);
|
7253
7193
|
}
|
7254
7194
|
return callServiceAPI;
|
@@ -7256,26 +7196,26 @@ var oi = /*#__PURE__*/function (_U5) {
|
|
7256
7196
|
}, {
|
7257
7197
|
key: "extractResultData",
|
7258
7198
|
value: function () {
|
7259
|
-
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7260
|
-
return _regeneratorRuntime().wrap(function
|
7261
|
-
while (1) switch (
|
7199
|
+
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
|
7200
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
7201
|
+
while (1) switch (_context61.prev = _context61.next) {
|
7262
7202
|
case 0:
|
7263
7203
|
if (!e.error) {
|
7264
|
-
|
7204
|
+
_context61.next = 2;
|
7265
7205
|
break;
|
7266
7206
|
}
|
7267
7207
|
throw e.error.message;
|
7268
7208
|
case 2:
|
7269
|
-
return
|
7209
|
+
return _context61.abrupt("return", {
|
7270
7210
|
text: e.text
|
7271
7211
|
});
|
7272
7212
|
case 3:
|
7273
7213
|
case "end":
|
7274
|
-
return
|
7214
|
+
return _context61.stop();
|
7275
7215
|
}
|
7276
|
-
},
|
7216
|
+
}, _callee61);
|
7277
7217
|
}));
|
7278
|
-
function extractResultData(
|
7218
|
+
function extractResultData(_x115) {
|
7279
7219
|
return _extractResultData15.apply(this, arguments);
|
7280
7220
|
}
|
7281
7221
|
return extractResultData;
|
@@ -7299,7 +7239,7 @@ var oi = /*#__PURE__*/function (_U5) {
|
|
7299
7239
|
}), i;
|
7300
7240
|
}
|
7301
7241
|
}]);
|
7302
|
-
return
|
7242
|
+
return we;
|
7303
7243
|
}(U);
|
7304
7244
|
oi.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
|
7305
7245
|
oi.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
|
@@ -7454,13 +7394,13 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7454
7394
|
}, {
|
7455
7395
|
key: "callServiceAPI",
|
7456
7396
|
value: function () {
|
7457
|
-
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7397
|
+
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t) {
|
7458
7398
|
var i;
|
7459
|
-
return _regeneratorRuntime().wrap(function
|
7460
|
-
while (1) switch (
|
7399
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
7400
|
+
while (1) switch (_context62.prev = _context62.next) {
|
7461
7401
|
case 0:
|
7462
7402
|
if (this.requestSettings) {
|
7463
|
-
|
7403
|
+
_context62.next = 2;
|
7464
7404
|
break;
|
7465
7405
|
}
|
7466
7406
|
throw new Error("Request settings have not been set up");
|
@@ -7469,11 +7409,11 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7469
7409
|
_.request(this, i, e), this.messages = e;
|
7470
7410
|
case 4:
|
7471
7411
|
case "end":
|
7472
|
-
return
|
7412
|
+
return _context62.stop();
|
7473
7413
|
}
|
7474
|
-
},
|
7414
|
+
}, _callee62, this);
|
7475
7415
|
}));
|
7476
|
-
function callServiceAPI(
|
7416
|
+
function callServiceAPI(_x116, _x117) {
|
7477
7417
|
return _callServiceAPI13.apply(this, arguments);
|
7478
7418
|
}
|
7479
7419
|
return callServiceAPI;
|
@@ -7481,13 +7421,13 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7481
7421
|
}, {
|
7482
7422
|
key: "extractResultData",
|
7483
7423
|
value: function () {
|
7484
|
-
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7424
|
+
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
|
7485
7425
|
var t, _i9, n;
|
7486
|
-
return _regeneratorRuntime().wrap(function
|
7487
|
-
while (1) switch (
|
7426
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
7427
|
+
while (1) switch (_context63.prev = _context63.next) {
|
7488
7428
|
case 0:
|
7489
7429
|
if (!e.error) {
|
7490
|
-
|
7430
|
+
_context63.next = 2;
|
7491
7431
|
break;
|
7492
7432
|
}
|
7493
7433
|
throw e.error.message;
|
@@ -7499,16 +7439,16 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7499
7439
|
};
|
7500
7440
|
_.executePollRequest(this, _i9, n, this.messages);
|
7501
7441
|
}
|
7502
|
-
return
|
7442
|
+
return _context63.abrupt("return", {
|
7503
7443
|
makingAnotherRequest: !0
|
7504
7444
|
});
|
7505
7445
|
case 4:
|
7506
7446
|
case "end":
|
7507
|
-
return
|
7447
|
+
return _context63.stop();
|
7508
7448
|
}
|
7509
|
-
},
|
7449
|
+
}, _callee63, this);
|
7510
7450
|
}));
|
7511
|
-
function extractResultData(
|
7451
|
+
function extractResultData(_x118) {
|
7512
7452
|
return _extractResultData16.apply(this, arguments);
|
7513
7453
|
}
|
7514
7454
|
return extractResultData;
|
@@ -7516,33 +7456,33 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7516
7456
|
}, {
|
7517
7457
|
key: "extractPollResultData",
|
7518
7458
|
value: function () {
|
7519
|
-
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7459
|
+
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
|
7520
7460
|
var t, _iterator, _step, _i10;
|
7521
|
-
return _regeneratorRuntime().wrap(function
|
7522
|
-
while (1) switch (
|
7461
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
7462
|
+
while (1) switch (_context64.prev = _context64.next) {
|
7523
7463
|
case 0:
|
7524
7464
|
if (!e.error) {
|
7525
|
-
|
7465
|
+
_context64.next = 2;
|
7526
7466
|
break;
|
7527
7467
|
}
|
7528
7468
|
throw e.error;
|
7529
7469
|
case 2:
|
7530
7470
|
if (!(e.status === "running")) {
|
7531
|
-
|
7471
|
+
_context64.next = 4;
|
7532
7472
|
break;
|
7533
7473
|
}
|
7534
|
-
return
|
7474
|
+
return _context64.abrupt("return", {
|
7535
7475
|
timeoutMS: 2e3
|
7536
7476
|
});
|
7537
7477
|
case 4:
|
7538
7478
|
if (!(e.errors.length > 0)) {
|
7539
|
-
|
7479
|
+
_context64.next = 6;
|
7540
7480
|
break;
|
7541
7481
|
}
|
7542
7482
|
throw e.errors[0];
|
7543
7483
|
case 6:
|
7544
7484
|
if (!(e.tasks.items[0].results.errors.length > 0)) {
|
7545
|
-
|
7485
|
+
_context64.next = 8;
|
7546
7486
|
break;
|
7547
7487
|
}
|
7548
7488
|
throw e.tasks.items[0].results.errors[0];
|
@@ -7559,16 +7499,16 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7559
7499
|
} finally {
|
7560
7500
|
_iterator.f();
|
7561
7501
|
}
|
7562
|
-
return
|
7502
|
+
return _context64.abrupt("return", {
|
7563
7503
|
text: t || ""
|
7564
7504
|
});
|
7565
7505
|
case 12:
|
7566
7506
|
case "end":
|
7567
|
-
return
|
7507
|
+
return _context64.stop();
|
7568
7508
|
}
|
7569
|
-
},
|
7509
|
+
}, _callee64);
|
7570
7510
|
}));
|
7571
|
-
function extractPollResultData(
|
7511
|
+
function extractPollResultData(_x119) {
|
7572
7512
|
return _extractPollResultData4.apply(this, arguments);
|
7573
7513
|
}
|
7574
7514
|
return extractPollResultData;
|
@@ -7583,17 +7523,17 @@ var ut = /*#__PURE__*/function () {
|
|
7583
7523
|
_createClass(ut, null, [{
|
7584
7524
|
key: "poll",
|
7585
7525
|
value: function () {
|
7586
|
-
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7526
|
+
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e, t) {
|
7587
7527
|
var i, a, l, d;
|
7588
|
-
return _regeneratorRuntime().wrap(function
|
7589
|
-
while (1) switch (
|
7528
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
7529
|
+
while (1) switch (_context65.prev = _context65.next) {
|
7590
7530
|
case 0:
|
7591
7531
|
i = {
|
7592
7532
|
authorization: e,
|
7593
7533
|
"content-type": "application/json"
|
7594
7534
|
};
|
7595
|
-
|
7596
|
-
|
7535
|
+
_context65.t0 = "https://api.assemblyai.com/v2/transcript/";
|
7536
|
+
_context65.next = 4;
|
7597
7537
|
return fetch("https://api.assemblyai.com/v2/transcript", {
|
7598
7538
|
method: "POST",
|
7599
7539
|
body: JSON.stringify({
|
@@ -7602,55 +7542,55 @@ var ut = /*#__PURE__*/function () {
|
|
7602
7542
|
headers: i
|
7603
7543
|
});
|
7604
7544
|
case 4:
|
7605
|
-
|
7606
|
-
return
|
7545
|
+
_context65.next = 6;
|
7546
|
+
return _context65.sent.json();
|
7607
7547
|
case 6:
|
7608
|
-
|
7609
|
-
a =
|
7548
|
+
_context65.t1 = _context65.sent.id;
|
7549
|
+
a = _context65.t0.concat.call(_context65.t0, _context65.t1);
|
7610
7550
|
case 8:
|
7611
7551
|
if (l) {
|
7612
|
-
|
7552
|
+
_context65.next = 24;
|
7613
7553
|
break;
|
7614
7554
|
}
|
7615
|
-
|
7555
|
+
_context65.next = 11;
|
7616
7556
|
return fetch(a, {
|
7617
7557
|
headers: i
|
7618
7558
|
});
|
7619
7559
|
case 11:
|
7620
|
-
|
7621
|
-
return
|
7560
|
+
_context65.next = 13;
|
7561
|
+
return _context65.sent.json();
|
7622
7562
|
case 13:
|
7623
|
-
d =
|
7563
|
+
d = _context65.sent;
|
7624
7564
|
if (!(d.status === "completed")) {
|
7625
|
-
|
7565
|
+
_context65.next = 18;
|
7626
7566
|
break;
|
7627
7567
|
}
|
7628
7568
|
l = d;
|
7629
|
-
|
7569
|
+
_context65.next = 22;
|
7630
7570
|
break;
|
7631
7571
|
case 18:
|
7632
7572
|
if (!(d.status === "error")) {
|
7633
|
-
|
7573
|
+
_context65.next = 20;
|
7634
7574
|
break;
|
7635
7575
|
}
|
7636
7576
|
throw new Error("Transcription failed: ".concat(d.error));
|
7637
7577
|
case 20:
|
7638
|
-
|
7578
|
+
_context65.next = 22;
|
7639
7579
|
return new Promise(function (u) {
|
7640
7580
|
return setTimeout(u, 3e3);
|
7641
7581
|
});
|
7642
7582
|
case 22:
|
7643
|
-
|
7583
|
+
_context65.next = 8;
|
7644
7584
|
break;
|
7645
7585
|
case 24:
|
7646
|
-
return
|
7586
|
+
return _context65.abrupt("return", l);
|
7647
7587
|
case 25:
|
7648
7588
|
case "end":
|
7649
|
-
return
|
7589
|
+
return _context65.stop();
|
7650
7590
|
}
|
7651
|
-
},
|
7591
|
+
}, _callee65);
|
7652
7592
|
}));
|
7653
|
-
function poll(
|
7593
|
+
function poll(_x120, _x121) {
|
7654
7594
|
return _poll2.apply(this, arguments);
|
7655
7595
|
}
|
7656
7596
|
return poll;
|
@@ -7698,19 +7638,19 @@ var Qi = /*#__PURE__*/function (_U7) {
|
|
7698
7638
|
_createClass(Qi, [{
|
7699
7639
|
key: "callServiceAPI",
|
7700
7640
|
value: function () {
|
7701
|
-
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7641
|
+
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t, i) {
|
7702
7642
|
var n;
|
7703
|
-
return _regeneratorRuntime().wrap(function
|
7704
|
-
while (1) switch (
|
7643
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
7644
|
+
while (1) switch (_context66.prev = _context66.next) {
|
7705
7645
|
case 0:
|
7706
7646
|
if ((n = this.requestSettings) != null && n.headers) {
|
7707
|
-
|
7647
|
+
_context66.next = 2;
|
7708
7648
|
break;
|
7709
7649
|
}
|
7710
7650
|
throw new Error("Request settings have not been set up");
|
7711
7651
|
case 2:
|
7712
7652
|
if (i != null && i[0]) {
|
7713
|
-
|
7653
|
+
_context66.next = 4;
|
7714
7654
|
break;
|
7715
7655
|
}
|
7716
7656
|
throw new Error("No file was added");
|
@@ -7718,11 +7658,11 @@ var Qi = /*#__PURE__*/function (_U7) {
|
|
7718
7658
|
_.request(this, i[0], e, !1);
|
7719
7659
|
case 5:
|
7720
7660
|
case "end":
|
7721
|
-
return
|
7661
|
+
return _context66.stop();
|
7722
7662
|
}
|
7723
|
-
},
|
7663
|
+
}, _callee66, this);
|
7724
7664
|
}));
|
7725
|
-
function callServiceAPI(
|
7665
|
+
function callServiceAPI(_x122, _x123, _x124) {
|
7726
7666
|
return _callServiceAPI14.apply(this, arguments);
|
7727
7667
|
}
|
7728
7668
|
return callServiceAPI;
|
@@ -7730,32 +7670,32 @@ var Qi = /*#__PURE__*/function (_U7) {
|
|
7730
7670
|
}, {
|
7731
7671
|
key: "extractResultData",
|
7732
7672
|
value: function () {
|
7733
|
-
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7673
|
+
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e) {
|
7734
7674
|
var n, r, t;
|
7735
|
-
return _regeneratorRuntime().wrap(function
|
7736
|
-
while (1) switch (
|
7675
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
7676
|
+
while (1) switch (_context67.prev = _context67.next) {
|
7737
7677
|
case 0:
|
7738
7678
|
if (!e.error) {
|
7739
|
-
|
7679
|
+
_context67.next = 2;
|
7740
7680
|
break;
|
7741
7681
|
}
|
7742
7682
|
throw e.error;
|
7743
7683
|
case 2:
|
7744
7684
|
t = (r = (n = this.requestSettings) == null ? void 0 : n.headers) == null ? void 0 : r.Authorization;
|
7745
|
-
|
7685
|
+
_context67.next = 5;
|
7746
7686
|
return ut.poll(t, e.upload_url);
|
7747
7687
|
case 5:
|
7748
|
-
|
7749
|
-
return
|
7750
|
-
text:
|
7688
|
+
_context67.t0 = _context67.sent.text;
|
7689
|
+
return _context67.abrupt("return", {
|
7690
|
+
text: _context67.t0
|
7751
7691
|
});
|
7752
7692
|
case 7:
|
7753
7693
|
case "end":
|
7754
|
-
return
|
7694
|
+
return _context67.stop();
|
7755
7695
|
}
|
7756
|
-
},
|
7696
|
+
}, _callee67, this);
|
7757
7697
|
}));
|
7758
|
-
function extractResultData(
|
7698
|
+
function extractResultData(_x125) {
|
7759
7699
|
return _extractResultData17.apply(this, arguments);
|
7760
7700
|
}
|
7761
7701
|
return extractResultData;
|
@@ -7805,13 +7745,13 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7805
7745
|
}, {
|
7806
7746
|
key: "callServiceAPI",
|
7807
7747
|
value: function () {
|
7808
|
-
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7748
|
+
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e, t) {
|
7809
7749
|
var i;
|
7810
|
-
return _regeneratorRuntime().wrap(function
|
7811
|
-
while (1) switch (
|
7750
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
7751
|
+
while (1) switch (_context68.prev = _context68.next) {
|
7812
7752
|
case 0:
|
7813
7753
|
if (this.requestSettings) {
|
7814
|
-
|
7754
|
+
_context68.next = 2;
|
7815
7755
|
break;
|
7816
7756
|
}
|
7817
7757
|
throw new Error("Request settings have not been set up");
|
@@ -7820,11 +7760,11 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7820
7760
|
_.request(this, i, e, !1);
|
7821
7761
|
case 4:
|
7822
7762
|
case "end":
|
7823
|
-
return
|
7763
|
+
return _context68.stop();
|
7824
7764
|
}
|
7825
|
-
},
|
7765
|
+
}, _callee68, this);
|
7826
7766
|
}));
|
7827
|
-
function callServiceAPI(
|
7767
|
+
function callServiceAPI(_x126, _x127) {
|
7828
7768
|
return _callServiceAPI15.apply(this, arguments);
|
7829
7769
|
}
|
7830
7770
|
return callServiceAPI;
|
@@ -7832,11 +7772,11 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7832
7772
|
}, {
|
7833
7773
|
key: "extractResultData",
|
7834
7774
|
value: function () {
|
7835
|
-
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7836
|
-
return _regeneratorRuntime().wrap(function
|
7837
|
-
while (1) switch (
|
7775
|
+
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e) {
|
7776
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
7777
|
+
while (1) switch (_context69.prev = _context69.next) {
|
7838
7778
|
case 0:
|
7839
|
-
return
|
7779
|
+
return _context69.abrupt("return", new Promise(function (t) {
|
7840
7780
|
var i = new FileReader();
|
7841
7781
|
i.readAsDataURL(e), i.onload = function (n) {
|
7842
7782
|
t({
|
@@ -7849,11 +7789,11 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7849
7789
|
}));
|
7850
7790
|
case 1:
|
7851
7791
|
case "end":
|
7852
|
-
return
|
7792
|
+
return _context69.stop();
|
7853
7793
|
}
|
7854
|
-
},
|
7794
|
+
}, _callee69);
|
7855
7795
|
}));
|
7856
|
-
function extractResultData(
|
7796
|
+
function extractResultData(_x128) {
|
7857
7797
|
return _extractResultData18.apply(this, arguments);
|
7858
7798
|
}
|
7859
7799
|
return extractResultData;
|
@@ -7889,19 +7829,19 @@ var us = /*#__PURE__*/function (_ls2) {
|
|
7889
7829
|
_createClass(zi, [{
|
7890
7830
|
key: "callServiceAPI",
|
7891
7831
|
value: function () {
|
7892
|
-
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7832
|
+
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t, i) {
|
7893
7833
|
var n, r;
|
7894
|
-
return _regeneratorRuntime().wrap(function
|
7895
|
-
while (1) switch (
|
7834
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
7835
|
+
while (1) switch (_context70.prev = _context70.next) {
|
7896
7836
|
case 0:
|
7897
7837
|
if ((n = this.requestSettings) != null && n.headers) {
|
7898
|
-
|
7838
|
+
_context70.next = 2;
|
7899
7839
|
break;
|
7900
7840
|
}
|
7901
7841
|
throw new Error("Request settings have not been set up");
|
7902
7842
|
case 2:
|
7903
7843
|
if (i != null && i[0]) {
|
7904
|
-
|
7844
|
+
_context70.next = 4;
|
7905
7845
|
break;
|
7906
7846
|
}
|
7907
7847
|
throw new Error("No file was added");
|
@@ -7909,11 +7849,11 @@ var us = /*#__PURE__*/function (_ls2) {
|
|
7909
7849
|
(r = this.requestSettings) != null && r.headers && (this.requestSettings.headers["Content-Type"] = i[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), _.request(this, i[0], e, !1);
|
7910
7850
|
case 5:
|
7911
7851
|
case "end":
|
7912
|
-
return
|
7852
|
+
return _context70.stop();
|
7913
7853
|
}
|
7914
|
-
},
|
7854
|
+
}, _callee70, this);
|
7915
7855
|
}));
|
7916
|
-
function callServiceAPI(
|
7856
|
+
function callServiceAPI(_x129, _x130, _x131) {
|
7917
7857
|
return _callServiceAPI16.apply(this, arguments);
|
7918
7858
|
}
|
7919
7859
|
return callServiceAPI;
|
@@ -7921,26 +7861,26 @@ var us = /*#__PURE__*/function (_ls2) {
|
|
7921
7861
|
}, {
|
7922
7862
|
key: "extractResultData",
|
7923
7863
|
value: function () {
|
7924
|
-
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7925
|
-
return _regeneratorRuntime().wrap(function
|
7926
|
-
while (1) switch (
|
7864
|
+
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e) {
|
7865
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
7866
|
+
while (1) switch (_context71.prev = _context71.next) {
|
7927
7867
|
case 0:
|
7928
7868
|
if (!e.error) {
|
7929
|
-
|
7869
|
+
_context71.next = 2;
|
7930
7870
|
break;
|
7931
7871
|
}
|
7932
7872
|
throw e.error;
|
7933
7873
|
case 2:
|
7934
|
-
return
|
7874
|
+
return _context71.abrupt("return", {
|
7935
7875
|
text: e.DisplayText || ""
|
7936
7876
|
});
|
7937
7877
|
case 3:
|
7938
7878
|
case "end":
|
7939
|
-
return
|
7879
|
+
return _context71.stop();
|
7940
7880
|
}
|
7941
|
-
},
|
7881
|
+
}, _callee71);
|
7942
7882
|
}));
|
7943
|
-
function extractResultData(
|
7883
|
+
function extractResultData(_x132) {
|
7944
7884
|
return _extractResultData19.apply(this, arguments);
|
7945
7885
|
}
|
7946
7886
|
return extractResultData;
|
@@ -7983,13 +7923,13 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
7983
7923
|
}, {
|
7984
7924
|
key: "callServiceAPI",
|
7985
7925
|
value: function () {
|
7986
|
-
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7926
|
+
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e, t) {
|
7987
7927
|
var i;
|
7988
|
-
return _regeneratorRuntime().wrap(function
|
7989
|
-
while (1) switch (
|
7928
|
+
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
7929
|
+
while (1) switch (_context72.prev = _context72.next) {
|
7990
7930
|
case 0:
|
7991
7931
|
if (this.requestSettings) {
|
7992
|
-
|
7932
|
+
_context72.next = 2;
|
7993
7933
|
break;
|
7994
7934
|
}
|
7995
7935
|
throw new Error("Request settings have not been set up");
|
@@ -7998,11 +7938,11 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
7998
7938
|
_.request(this, i, e);
|
7999
7939
|
case 4:
|
8000
7940
|
case "end":
|
8001
|
-
return
|
7941
|
+
return _context72.stop();
|
8002
7942
|
}
|
8003
|
-
},
|
7943
|
+
}, _callee72, this);
|
8004
7944
|
}));
|
8005
|
-
function callServiceAPI(
|
7945
|
+
function callServiceAPI(_x133, _x134) {
|
8006
7946
|
return _callServiceAPI17.apply(this, arguments);
|
8007
7947
|
}
|
8008
7948
|
return callServiceAPI;
|
@@ -8010,27 +7950,27 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
8010
7950
|
}, {
|
8011
7951
|
key: "extractResultData",
|
8012
7952
|
value: function () {
|
8013
|
-
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7953
|
+
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(e) {
|
8014
7954
|
var t;
|
8015
|
-
return _regeneratorRuntime().wrap(function
|
8016
|
-
while (1) switch (
|
7955
|
+
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
7956
|
+
while (1) switch (_context73.prev = _context73.next) {
|
8017
7957
|
case 0:
|
8018
7958
|
if (!Array.isArray(e)) {
|
8019
|
-
|
7959
|
+
_context73.next = 2;
|
8020
7960
|
break;
|
8021
7961
|
}
|
8022
|
-
return
|
7962
|
+
return _context73.abrupt("return", {
|
8023
7963
|
text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
|
8024
7964
|
});
|
8025
7965
|
case 2:
|
8026
7966
|
throw e.error;
|
8027
7967
|
case 3:
|
8028
7968
|
case "end":
|
8029
|
-
return
|
7969
|
+
return _context73.stop();
|
8030
7970
|
}
|
8031
|
-
},
|
7971
|
+
}, _callee73);
|
8032
7972
|
}));
|
8033
|
-
function extractResultData(
|
7973
|
+
function extractResultData(_x135) {
|
8034
7974
|
return _extractResultData20.apply(this, arguments);
|
8035
7975
|
}
|
8036
7976
|
return extractResultData;
|
@@ -8038,15 +7978,76 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
8038
7978
|
}]);
|
8039
7979
|
return zo;
|
8040
7980
|
}(U);
|
8041
|
-
var
|
8042
|
-
function
|
8043
|
-
_classCallCheck(this,
|
7981
|
+
var ge = /*#__PURE__*/function () {
|
7982
|
+
function ge() {
|
7983
|
+
_classCallCheck(this, ge);
|
8044
7984
|
}
|
8045
|
-
_createClass(
|
7985
|
+
_createClass(ge, null, [{
|
7986
|
+
key: "storeFiles",
|
7987
|
+
value: function () {
|
7988
|
+
var _storeFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(e, t, i) {
|
7989
|
+
var n, r, o, a;
|
7990
|
+
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
7991
|
+
while (1) switch (_context75.prev = _context75.next) {
|
7992
|
+
case 0:
|
7993
|
+
n = e.requestSettings.headers;
|
7994
|
+
if (n) {
|
7995
|
+
_context75.next = 3;
|
7996
|
+
break;
|
7997
|
+
}
|
7998
|
+
return _context75.abrupt("return");
|
7999
|
+
case 3:
|
8000
|
+
e.url = "https://api.openai.com/v1/files";
|
8001
|
+
r = n[E.CONTENT_TYPE];
|
8002
|
+
delete n[E.CONTENT_TYPE];
|
8003
|
+
o = i.map( /*#__PURE__*/function () {
|
8004
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(a) {
|
8005
|
+
var l;
|
8006
|
+
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
8007
|
+
while (1) switch (_context74.prev = _context74.next) {
|
8008
|
+
case 0:
|
8009
|
+
l = new FormData();
|
8010
|
+
return _context74.abrupt("return", (l.append("purpose", "assistants"), l.append("file", a), new Promise(function (c) {
|
8011
|
+
c(N.directFetch(e, l, "POST", !1));
|
8012
|
+
})));
|
8013
|
+
case 2:
|
8014
|
+
case "end":
|
8015
|
+
return _context74.stop();
|
8016
|
+
}
|
8017
|
+
}, _callee74);
|
8018
|
+
}));
|
8019
|
+
return function (_x139) {
|
8020
|
+
return _ref8.apply(this, arguments);
|
8021
|
+
};
|
8022
|
+
}());
|
8023
|
+
_context75.prev = 7;
|
8024
|
+
_context75.next = 10;
|
8025
|
+
return Promise.all(o);
|
8026
|
+
case 10:
|
8027
|
+
a = _context75.sent.map(function (l) {
|
8028
|
+
return l.id;
|
8029
|
+
});
|
8030
|
+
return _context75.abrupt("return", (n[E.CONTENT_TYPE] = r, a));
|
8031
|
+
case 14:
|
8032
|
+
_context75.prev = 14;
|
8033
|
+
_context75.t0 = _context75["catch"](7);
|
8034
|
+
throw n[E.CONTENT_TYPE] = r, E.displayError(t, _context75.t0), e.completionsHandlers.onFinish(), _context75.t0;
|
8035
|
+
case 17:
|
8036
|
+
case "end":
|
8037
|
+
return _context75.stop();
|
8038
|
+
}
|
8039
|
+
}, _callee75, null, [[7, 14]]);
|
8040
|
+
}));
|
8041
|
+
function storeFiles(_x136, _x137, _x138) {
|
8042
|
+
return _storeFiles.apply(this, arguments);
|
8043
|
+
}
|
8044
|
+
return storeFiles;
|
8045
|
+
}()
|
8046
|
+
}, {
|
8046
8047
|
key: "getType",
|
8047
8048
|
value: function getType(e, t) {
|
8048
8049
|
var i = e[t].path;
|
8049
|
-
return i.endsWith("png") ? "image" : "any";
|
8050
|
+
return !i || i.endsWith("png") ? "image" : "any";
|
8050
8051
|
}
|
8051
8052
|
}, {
|
8052
8053
|
key: "getFiles",
|
@@ -8072,7 +8073,7 @@ var $e = /*#__PURE__*/function () {
|
|
8072
8073
|
l({
|
8073
8074
|
src: d.target.result,
|
8074
8075
|
name: t[a].name,
|
8075
|
-
type:
|
8076
|
+
type: ge.getType(t, a)
|
8076
8077
|
});
|
8077
8078
|
};
|
8078
8079
|
});
|
@@ -8110,9 +8111,11 @@ var $e = /*#__PURE__*/function () {
|
|
8110
8111
|
l.text && l.text.startsWith("sandbox:") && (c = l.file_path) != null && c.file_id && i.push({
|
8111
8112
|
path: l.text,
|
8112
8113
|
fileId: l.file_path.file_id,
|
8113
|
-
name:
|
8114
|
+
name: ge.getFileName(l.text)
|
8114
8115
|
});
|
8115
8116
|
});
|
8117
|
+
}), t != null && t.image_file && i.push({
|
8118
|
+
fileId: t.image_file.file_id
|
8116
8119
|
}), i;
|
8117
8120
|
}
|
8118
8121
|
}, {
|
@@ -8129,12 +8132,14 @@ var $e = /*#__PURE__*/function () {
|
|
8129
8132
|
break;
|
8130
8133
|
}
|
8131
8134
|
_context77.next = 4;
|
8132
|
-
return
|
8135
|
+
return ge.getFiles(e, t);
|
8133
8136
|
case 4:
|
8134
8137
|
n = _context77.sent;
|
8135
8138
|
(r = i == null ? void 0 : i.text) != null && r.value && n.forEach(function (a, l) {
|
8136
|
-
var
|
8137
|
-
|
8139
|
+
var d;
|
8140
|
+
if (!a.src) return;
|
8141
|
+
var c = t[l].path;
|
8142
|
+
(d = i == null ? void 0 : i.text) != null && d.value && c && (i.text.value = i.text.value.replace(c, a.src));
|
8138
8143
|
});
|
8139
8144
|
case 6:
|
8140
8145
|
return _context77.abrupt("return", {
|
@@ -8152,8 +8157,32 @@ var $e = /*#__PURE__*/function () {
|
|
8152
8157
|
}
|
8153
8158
|
return getFilesAndNewText;
|
8154
8159
|
}()
|
8160
|
+
}, {
|
8161
|
+
key: "getFilesAndText",
|
8162
|
+
value: function () {
|
8163
|
+
var _getFilesAndText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(e, t, i) {
|
8164
|
+
var n;
|
8165
|
+
return _regeneratorRuntime().wrap(function _callee78$(_context78) {
|
8166
|
+
while (1) switch (_context78.prev = _context78.next) {
|
8167
|
+
case 0:
|
8168
|
+
n = ge.getFileDetails(t, i);
|
8169
|
+
_context78.next = 3;
|
8170
|
+
return ge.getFilesAndNewText(e, n, i);
|
8171
|
+
case 3:
|
8172
|
+
return _context78.abrupt("return", _context78.sent);
|
8173
|
+
case 4:
|
8174
|
+
case "end":
|
8175
|
+
return _context78.stop();
|
8176
|
+
}
|
8177
|
+
}, _callee78);
|
8178
|
+
}));
|
8179
|
+
function getFilesAndText(_x145, _x146, _x147) {
|
8180
|
+
return _getFilesAndText.apply(this, arguments);
|
8181
|
+
}
|
8182
|
+
return getFilesAndText;
|
8183
|
+
}()
|
8155
8184
|
}]);
|
8156
|
-
return
|
8185
|
+
return ge;
|
8157
8186
|
}();
|
8158
8187
|
var en = /*#__PURE__*/function (_U10) {
|
8159
8188
|
_inherits(ae, _U10);
|
@@ -8212,40 +8241,40 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8212
8241
|
}, {
|
8213
8242
|
key: "callServiceAPI",
|
8214
8243
|
value: function () {
|
8215
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8244
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(e, t, i) {
|
8216
8245
|
var n;
|
8217
|
-
return _regeneratorRuntime().wrap(function
|
8218
|
-
while (1) switch (
|
8246
|
+
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
8247
|
+
while (1) switch (_context79.prev = _context79.next) {
|
8219
8248
|
case 0:
|
8220
8249
|
if (this.requestSettings) {
|
8221
|
-
|
8250
|
+
_context79.next = 2;
|
8222
8251
|
break;
|
8223
8252
|
}
|
8224
8253
|
throw new Error("Request settings have not been set up");
|
8225
8254
|
case 2:
|
8226
8255
|
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messages);
|
8227
8256
|
if (!i) {
|
8228
|
-
|
8257
|
+
_context79.next = 9;
|
8229
8258
|
break;
|
8230
8259
|
}
|
8231
|
-
|
8232
|
-
return
|
8260
|
+
_context79.next = 6;
|
8261
|
+
return ge.storeFiles(this, e, i);
|
8233
8262
|
case 6:
|
8234
|
-
|
8235
|
-
|
8263
|
+
_context79.t0 = _context79.sent;
|
8264
|
+
_context79.next = 10;
|
8236
8265
|
break;
|
8237
8266
|
case 9:
|
8238
|
-
|
8267
|
+
_context79.t0 = void 0;
|
8239
8268
|
case 10:
|
8240
|
-
n =
|
8269
|
+
n = _context79.t0;
|
8241
8270
|
this.requestSettings.method = "POST", this.callService(e, t, n);
|
8242
8271
|
case 12:
|
8243
8272
|
case "end":
|
8244
|
-
return
|
8273
|
+
return _context79.stop();
|
8245
8274
|
}
|
8246
|
-
},
|
8275
|
+
}, _callee79, this);
|
8247
8276
|
}));
|
8248
|
-
function callServiceAPI(
|
8277
|
+
function callServiceAPI(_x148, _x149, _x150) {
|
8249
8278
|
return _callServiceAPI18.apply(this, arguments);
|
8250
8279
|
}
|
8251
8280
|
return callServiceAPI;
|
@@ -8261,34 +8290,34 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8261
8290
|
}, {
|
8262
8291
|
key: "extractResultData",
|
8263
8292
|
value: function () {
|
8264
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8293
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(e) {
|
8265
8294
|
var n, t, i;
|
8266
|
-
return _regeneratorRuntime().wrap(function
|
8267
|
-
while (1) switch (
|
8295
|
+
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
8296
|
+
while (1) switch (_context80.prev = _context80.next) {
|
8268
8297
|
case 0:
|
8269
8298
|
if (!e.error) {
|
8270
|
-
|
8299
|
+
_context80.next = 2;
|
8271
8300
|
break;
|
8272
8301
|
}
|
8273
8302
|
throw e.error.message;
|
8274
8303
|
case 2:
|
8275
|
-
|
8304
|
+
_context80.next = 4;
|
8276
8305
|
return this.assignThreadAndRun(e);
|
8277
8306
|
case 4:
|
8278
8307
|
t = "".concat(ae.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id), i = {
|
8279
8308
|
method: "GET",
|
8280
8309
|
headers: (n = this.requestSettings) == null ? void 0 : n.headers
|
8281
8310
|
};
|
8282
|
-
return
|
8311
|
+
return _context80.abrupt("return", (_.executePollRequest(this, t, i, this.messages), {
|
8283
8312
|
makingAnotherRequest: !0
|
8284
8313
|
}));
|
8285
8314
|
case 6:
|
8286
8315
|
case "end":
|
8287
|
-
return
|
8316
|
+
return _context80.stop();
|
8288
8317
|
}
|
8289
|
-
},
|
8318
|
+
}, _callee80, this);
|
8290
8319
|
}));
|
8291
|
-
function extractResultData(
|
8320
|
+
function extractResultData(_x151) {
|
8292
8321
|
return _extractResultData21.apply(this, arguments);
|
8293
8322
|
}
|
8294
8323
|
return extractResultData;
|
@@ -8296,32 +8325,32 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8296
8325
|
}, {
|
8297
8326
|
key: "assignThreadAndRun",
|
8298
8327
|
value: function () {
|
8299
|
-
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8328
|
+
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(e) {
|
8300
8329
|
var t;
|
8301
|
-
return _regeneratorRuntime().wrap(function
|
8302
|
-
while (1) switch (
|
8330
|
+
return _regeneratorRuntime().wrap(function _callee81$(_context81) {
|
8331
|
+
while (1) switch (_context81.prev = _context81.next) {
|
8303
8332
|
case 0:
|
8304
8333
|
if (!this.sessionId) {
|
8305
|
-
|
8334
|
+
_context81.next = 8;
|
8306
8335
|
break;
|
8307
8336
|
}
|
8308
8337
|
this.url = "".concat(ae.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8309
|
-
|
8338
|
+
_context81.next = 4;
|
8310
8339
|
return N.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
|
8311
8340
|
case 4:
|
8312
|
-
t =
|
8341
|
+
t = _context81.sent;
|
8313
8342
|
this.run_id = t.id;
|
8314
|
-
|
8343
|
+
_context81.next = 9;
|
8315
8344
|
break;
|
8316
8345
|
case 8:
|
8317
8346
|
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && (this.messages.messages[this.messages.messages.length - 1]._sessionId = this.sessionId);
|
8318
8347
|
case 9:
|
8319
8348
|
case "end":
|
8320
|
-
return
|
8349
|
+
return _context81.stop();
|
8321
8350
|
}
|
8322
|
-
},
|
8351
|
+
}, _callee81, this);
|
8323
8352
|
}));
|
8324
|
-
function assignThreadAndRun(
|
8353
|
+
function assignThreadAndRun(_x152) {
|
8325
8354
|
return _assignThreadAndRun.apply(this, arguments);
|
8326
8355
|
}
|
8327
8356
|
return assignThreadAndRun;
|
@@ -8329,63 +8358,62 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8329
8358
|
}, {
|
8330
8359
|
key: "extractPollResultData",
|
8331
8360
|
value: function () {
|
8332
|
-
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8333
|
-
var r, t, i, a, l,
|
8334
|
-
return _regeneratorRuntime().wrap(function
|
8335
|
-
while (1) switch (
|
8361
|
+
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e) {
|
8362
|
+
var r, t, i, a, l, _yield$ge$getFilesAnd, c, d, n;
|
8363
|
+
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
8364
|
+
while (1) switch (_context82.prev = _context82.next) {
|
8336
8365
|
case 0:
|
8337
8366
|
t = e.status, i = e.required_action;
|
8338
8367
|
if (!(t === "queued" || t === "in_progress")) {
|
8339
|
-
|
8368
|
+
_context82.next = 3;
|
8340
8369
|
break;
|
8341
8370
|
}
|
8342
|
-
return
|
8371
|
+
return _context82.abrupt("return", {
|
8343
8372
|
timeoutMS: ae.POLLING_TIMEOUT_MS
|
8344
8373
|
});
|
8345
8374
|
case 3:
|
8346
8375
|
if (!(t === "completed" && this.messages)) {
|
8347
|
-
|
8376
|
+
_context82.next = 15;
|
8348
8377
|
break;
|
8349
8378
|
}
|
8350
8379
|
this.url = "".concat(ae.THREAD_PREFIX, "/").concat(e.thread_id, "/messages");
|
8351
|
-
|
8380
|
+
_context82.next = 7;
|
8352
8381
|
return N.directFetch(this, {}, "GET");
|
8353
8382
|
case 7:
|
8354
|
-
a =
|
8355
|
-
l = a.content.find(function (
|
8356
|
-
return !!
|
8383
|
+
a = _context82.sent.data[0];
|
8384
|
+
l = a.content.find(function (u) {
|
8385
|
+
return !!u.text || !!u.image_file;
|
8357
8386
|
});
|
8358
|
-
|
8359
|
-
|
8360
|
-
|
8361
|
-
|
8362
|
-
_yield
|
8363
|
-
d = _yield
|
8364
|
-
|
8365
|
-
|
8366
|
-
text: d,
|
8387
|
+
_context82.next = 11;
|
8388
|
+
return ge.getFilesAndText(this, a, l);
|
8389
|
+
case 11:
|
8390
|
+
_yield$ge$getFilesAnd = _context82.sent;
|
8391
|
+
c = _yield$ge$getFilesAnd.text;
|
8392
|
+
d = _yield$ge$getFilesAnd.files;
|
8393
|
+
return _context82.abrupt("return", {
|
8394
|
+
text: c,
|
8367
8395
|
_sessionId: this.sessionId,
|
8368
|
-
files:
|
8396
|
+
files: d
|
8369
8397
|
});
|
8370
|
-
case
|
8398
|
+
case 15:
|
8371
8399
|
n = (r = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : r.tool_calls;
|
8372
8400
|
if (!(t === "requires_action" && n)) {
|
8373
|
-
|
8401
|
+
_context82.next = 20;
|
8374
8402
|
break;
|
8375
8403
|
}
|
8376
|
-
|
8404
|
+
_context82.next = 19;
|
8377
8405
|
return this.handleTools(n);
|
8406
|
+
case 19:
|
8407
|
+
return _context82.abrupt("return", _context82.sent);
|
8378
8408
|
case 20:
|
8379
|
-
return _context81.abrupt("return", _context81.sent);
|
8380
|
-
case 21:
|
8381
8409
|
throw Error("Thread run status: ".concat(t));
|
8382
|
-
case
|
8410
|
+
case 21:
|
8383
8411
|
case "end":
|
8384
|
-
return
|
8412
|
+
return _context82.stop();
|
8385
8413
|
}
|
8386
|
-
},
|
8414
|
+
}, _callee82, this);
|
8387
8415
|
}));
|
8388
|
-
function extractPollResultData(
|
8416
|
+
function extractPollResultData(_x153) {
|
8389
8417
|
return _extractPollResultData5.apply(this, arguments);
|
8390
8418
|
}
|
8391
8419
|
return extractPollResultData;
|
@@ -8393,13 +8421,13 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8393
8421
|
}, {
|
8394
8422
|
key: "handleTools",
|
8395
8423
|
value: function () {
|
8396
|
-
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8424
|
+
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(e) {
|
8397
8425
|
var t, i, n;
|
8398
|
-
return _regeneratorRuntime().wrap(function
|
8399
|
-
while (1) switch (
|
8426
|
+
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
8427
|
+
while (1) switch (_context83.prev = _context83.next) {
|
8400
8428
|
case 0:
|
8401
8429
|
if (this._functionHandler) {
|
8402
|
-
|
8430
|
+
_context83.next = 2;
|
8403
8431
|
break;
|
8404
8432
|
}
|
8405
8433
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.");
|
@@ -8410,14 +8438,14 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8410
8438
|
arguments: r["function"].arguments
|
8411
8439
|
};
|
8412
8440
|
});
|
8413
|
-
|
8441
|
+
_context83.next = 5;
|
8414
8442
|
return this._functionHandler(t);
|
8415
8443
|
case 5:
|
8416
|
-
i =
|
8444
|
+
i = _context83.sent;
|
8417
8445
|
if (!(!Array.isArray(i) || i.find(function (r) {
|
8418
8446
|
return typeof r != "string";
|
8419
8447
|
}) || e.length !== i.length)) {
|
8420
|
-
|
8448
|
+
_context83.next = 8;
|
8421
8449
|
break;
|
8422
8450
|
}
|
8423
8451
|
throw Error("Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.");
|
@@ -8429,21 +8457,21 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8429
8457
|
};
|
8430
8458
|
});
|
8431
8459
|
this.url = "".concat(ae.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id, "/submit_tool_outputs");
|
8432
|
-
|
8460
|
+
_context83.next = 12;
|
8433
8461
|
return N.directFetch(this, {
|
8434
8462
|
tool_outputs: n
|
8435
8463
|
}, "POST");
|
8436
8464
|
case 12:
|
8437
|
-
return
|
8465
|
+
return _context83.abrupt("return", {
|
8438
8466
|
timeoutMS: ae.POLLING_TIMEOUT_MS
|
8439
8467
|
});
|
8440
8468
|
case 13:
|
8441
8469
|
case "end":
|
8442
|
-
return
|
8470
|
+
return _context83.stop();
|
8443
8471
|
}
|
8444
|
-
},
|
8472
|
+
}, _callee83, this);
|
8445
8473
|
}));
|
8446
|
-
function handleTools(
|
8474
|
+
function handleTools(_x154) {
|
8447
8475
|
return _handleTools.apply(this, arguments);
|
8448
8476
|
}
|
8449
8477
|
return handleTools;
|
@@ -8455,11 +8483,11 @@ en.THREAD_PREFIX = "https://api.openai.com/v1/threads";
|
|
8455
8483
|
en.POLLING_TIMEOUT_MS = 800;
|
8456
8484
|
var Uo = en;
|
8457
8485
|
var ai = /*#__PURE__*/function (_U11) {
|
8458
|
-
_inherits(
|
8459
|
-
var _super33 = _createSuper(
|
8460
|
-
function
|
8486
|
+
_inherits(_e, _U11);
|
8487
|
+
var _super33 = _createSuper(_e);
|
8488
|
+
function _e(e) {
|
8461
8489
|
var _this35;
|
8462
|
-
_classCallCheck(this,
|
8490
|
+
_classCallCheck(this, _e);
|
8463
8491
|
var o;
|
8464
8492
|
var t = e.directConnection,
|
8465
8493
|
i = t == null ? void 0 : t.openAI,
|
@@ -8482,10 +8510,10 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8482
8510
|
}
|
8483
8511
|
};
|
8484
8512
|
}
|
8485
|
-
_typeof(r) == "object" && Object.assign(_this35.rawBody, r), _this35.canSendMessage =
|
8513
|
+
_typeof(r) == "object" && Object.assign(_this35.rawBody, r), _this35.canSendMessage = _e.canFileSendMessage;
|
8486
8514
|
return _this35;
|
8487
8515
|
}
|
8488
|
-
_createClass(
|
8516
|
+
_createClass(_e, [{
|
8489
8517
|
key: "preprocessBody",
|
8490
8518
|
value: function preprocessBody(e, t) {
|
8491
8519
|
var i = JSON.parse(JSON.stringify(e));
|
@@ -8499,50 +8527,50 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8499
8527
|
var n;
|
8500
8528
|
var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
|
8501
8529
|
if (i[1] || r && r !== "") {
|
8502
|
-
this.url =
|
8530
|
+
this.url = _e.IMAGE_EDIT_URL;
|
8503
8531
|
var l = this.preprocessBody(this.rawBody, r);
|
8504
|
-
n =
|
8505
|
-
} else this.url =
|
8532
|
+
n = _e.createFormDataBody(l, i[0], i[1]);
|
8533
|
+
} else this.url = _e.IMAGE_VARIATIONS_URL, n = _e.createFormDataBody(this.rawBody, i[0]);
|
8506
8534
|
E.tempRemoveContentHeader(this.requestSettings, _.request.bind(this, this, n, e), !1);
|
8507
8535
|
}
|
8508
8536
|
}, {
|
8509
8537
|
key: "callServiceAPI",
|
8510
8538
|
value: function () {
|
8511
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8539
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84(e, t, i) {
|
8512
8540
|
var n, r;
|
8513
|
-
return _regeneratorRuntime().wrap(function
|
8514
|
-
while (1) switch (
|
8541
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
8542
|
+
while (1) switch (_context84.prev = _context84.next) {
|
8515
8543
|
case 0:
|
8516
8544
|
if ((n = this.requestSettings) != null && n.headers) {
|
8517
|
-
|
8545
|
+
_context84.next = 2;
|
8518
8546
|
break;
|
8519
8547
|
}
|
8520
8548
|
throw new Error("Request settings have not been set up");
|
8521
8549
|
case 2:
|
8522
8550
|
if (!(i != null && i[0])) {
|
8523
|
-
|
8551
|
+
_context84.next = 6;
|
8524
8552
|
break;
|
8525
8553
|
}
|
8526
8554
|
this.callApiWithImage(e, t, i);
|
8527
|
-
|
8555
|
+
_context84.next = 11;
|
8528
8556
|
break;
|
8529
8557
|
case 6:
|
8530
8558
|
if (this.requestSettings) {
|
8531
|
-
|
8559
|
+
_context84.next = 8;
|
8532
8560
|
break;
|
8533
8561
|
}
|
8534
8562
|
throw new Error("Request settings have not been set up");
|
8535
8563
|
case 8:
|
8536
|
-
this.url =
|
8564
|
+
this.url = _e.IMAGE_GENERATION_URL;
|
8537
8565
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
8538
8566
|
_.request(this, r, e);
|
8539
8567
|
case 11:
|
8540
8568
|
case "end":
|
8541
|
-
return
|
8569
|
+
return _context84.stop();
|
8542
8570
|
}
|
8543
|
-
},
|
8571
|
+
}, _callee84, this);
|
8544
8572
|
}));
|
8545
|
-
function callServiceAPI(
|
8573
|
+
function callServiceAPI(_x155, _x156, _x157) {
|
8546
8574
|
return _callServiceAPI19.apply(this, arguments);
|
8547
8575
|
}
|
8548
8576
|
return callServiceAPI;
|
@@ -8550,17 +8578,17 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8550
8578
|
}, {
|
8551
8579
|
key: "extractResultData",
|
8552
8580
|
value: function () {
|
8553
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8554
|
-
return _regeneratorRuntime().wrap(function
|
8555
|
-
while (1) switch (
|
8581
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(e) {
|
8582
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
8583
|
+
while (1) switch (_context85.prev = _context85.next) {
|
8556
8584
|
case 0:
|
8557
8585
|
if (!e.error) {
|
8558
|
-
|
8586
|
+
_context85.next = 2;
|
8559
8587
|
break;
|
8560
8588
|
}
|
8561
8589
|
throw e.error.message;
|
8562
8590
|
case 2:
|
8563
|
-
return
|
8591
|
+
return _context85.abrupt("return", {
|
8564
8592
|
files: e.data.map(function (i) {
|
8565
8593
|
return i.url ? {
|
8566
8594
|
src: i.url,
|
@@ -8573,11 +8601,11 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8573
8601
|
});
|
8574
8602
|
case 3:
|
8575
8603
|
case "end":
|
8576
|
-
return
|
8604
|
+
return _context85.stop();
|
8577
8605
|
}
|
8578
|
-
},
|
8606
|
+
}, _callee85);
|
8579
8607
|
}));
|
8580
|
-
function extractResultData(
|
8608
|
+
function extractResultData(_x158) {
|
8581
8609
|
return _extractResultData22.apply(this, arguments);
|
8582
8610
|
}
|
8583
8611
|
return extractResultData;
|
@@ -8604,7 +8632,7 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8604
8632
|
}), n;
|
8605
8633
|
}
|
8606
8634
|
}]);
|
8607
|
-
return
|
8635
|
+
return _e;
|
8608
8636
|
}(U);
|
8609
8637
|
ai.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
|
8610
8638
|
ai.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
|
@@ -8656,13 +8684,13 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8656
8684
|
}, {
|
8657
8685
|
key: "callServiceAPI",
|
8658
8686
|
value: function () {
|
8659
|
-
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8687
|
+
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(e, t) {
|
8660
8688
|
var i, n;
|
8661
|
-
return _regeneratorRuntime().wrap(function
|
8662
|
-
while (1) switch (
|
8689
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
8690
|
+
while (1) switch (_context86.prev = _context86.next) {
|
8663
8691
|
case 0:
|
8664
8692
|
if (this.requestSettings) {
|
8665
|
-
|
8693
|
+
_context86.next = 2;
|
8666
8694
|
break;
|
8667
8695
|
}
|
8668
8696
|
throw new Error("Request settings have not been set up");
|
@@ -8671,11 +8699,11 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8671
8699
|
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, I.request(this, i, e)) : _.request(this, i, e);
|
8672
8700
|
case 4:
|
8673
8701
|
case "end":
|
8674
|
-
return
|
8702
|
+
return _context86.stop();
|
8675
8703
|
}
|
8676
|
-
},
|
8704
|
+
}, _callee86, this);
|
8677
8705
|
}));
|
8678
|
-
function callServiceAPI(
|
8706
|
+
function callServiceAPI(_x159, _x160) {
|
8679
8707
|
return _callServiceAPI20.apply(this, arguments);
|
8680
8708
|
}
|
8681
8709
|
return callServiceAPI;
|
@@ -8683,17 +8711,17 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8683
8711
|
}, {
|
8684
8712
|
key: "extractResultData",
|
8685
8713
|
value: function () {
|
8686
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8687
|
-
return _regeneratorRuntime().wrap(function
|
8688
|
-
while (1) switch (
|
8714
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e, t, i) {
|
8715
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
8716
|
+
while (1) switch (_context87.prev = _context87.next) {
|
8689
8717
|
case 0:
|
8690
8718
|
if (!e.error) {
|
8691
|
-
|
8719
|
+
_context87.next = 2;
|
8692
8720
|
break;
|
8693
8721
|
}
|
8694
8722
|
throw e.error.message;
|
8695
8723
|
case 2:
|
8696
|
-
return
|
8724
|
+
return _context87.abrupt("return", e.choices[0].delta ? {
|
8697
8725
|
text: e.choices[0].delta.content || ""
|
8698
8726
|
} : e.choices[0].message ? e.choices[0].message.tool_calls ? this.handleTools(e.choices[0].message, t, i) : {
|
8699
8727
|
text: e.choices[0].message.content
|
@@ -8702,11 +8730,11 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8702
8730
|
});
|
8703
8731
|
case 3:
|
8704
8732
|
case "end":
|
8705
|
-
return
|
8733
|
+
return _context87.stop();
|
8706
8734
|
}
|
8707
|
-
},
|
8735
|
+
}, _callee87, this);
|
8708
8736
|
}));
|
8709
|
-
function extractResultData(
|
8737
|
+
function extractResultData(_x161, _x162, _x163) {
|
8710
8738
|
return _extractResultData23.apply(this, arguments);
|
8711
8739
|
}
|
8712
8740
|
return extractResultData;
|
@@ -8714,13 +8742,13 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8714
8742
|
}, {
|
8715
8743
|
key: "handleTools",
|
8716
8744
|
value: function () {
|
8717
|
-
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8745
|
+
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88(e, t, i) {
|
8718
8746
|
var a, n, r, o, l;
|
8719
|
-
return _regeneratorRuntime().wrap(function
|
8720
|
-
while (1) switch (
|
8747
|
+
return _regeneratorRuntime().wrap(function _callee88$(_context88) {
|
8748
|
+
while (1) switch (_context88.prev = _context88.next) {
|
8721
8749
|
case 0:
|
8722
8750
|
if (!(!e.tool_calls || !t || !i || !this._functionHandler)) {
|
8723
|
-
|
8751
|
+
_context88.next = 2;
|
8724
8752
|
break;
|
8725
8753
|
}
|
8726
8754
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");
|
@@ -8732,22 +8760,22 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8732
8760
|
arguments: l["function"].arguments
|
8733
8761
|
};
|
8734
8762
|
});
|
8735
|
-
|
8763
|
+
_context88.next = 6;
|
8736
8764
|
return (a = this._functionHandler) == null ? void 0 : a.call(this, r);
|
8737
8765
|
case 6:
|
8738
|
-
o =
|
8766
|
+
o = _context88.sent;
|
8739
8767
|
if (!o.text) {
|
8740
|
-
|
8768
|
+
_context88.next = 9;
|
8741
8769
|
break;
|
8742
8770
|
}
|
8743
|
-
return
|
8771
|
+
return _context88.abrupt("return", {
|
8744
8772
|
text: o.text
|
8745
8773
|
});
|
8746
8774
|
case 9:
|
8747
8775
|
if (!(n.messages.push(e), Array.isArray(o) && !o.find(function (l) {
|
8748
8776
|
return typeof l != "string";
|
8749
8777
|
}) || r.length === o.length)) {
|
8750
|
-
|
8778
|
+
_context88.next = 17;
|
8751
8779
|
break;
|
8752
8780
|
}
|
8753
8781
|
o.forEach(function (c, d) {
|
@@ -8760,30 +8788,30 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8760
8788
|
content: c.response
|
8761
8789
|
});
|
8762
8790
|
}), delete n.tools, delete n.tool_choice;
|
8763
|
-
|
8791
|
+
_context88.next = 13;
|
8764
8792
|
return t == null ? void 0 : t(n).then(function (c) {
|
8765
8793
|
return E.processResponseByType(c);
|
8766
8794
|
});
|
8767
8795
|
case 13:
|
8768
|
-
l =
|
8796
|
+
l = _context88.sent;
|
8769
8797
|
if (!l.error) {
|
8770
|
-
|
8798
|
+
_context88.next = 16;
|
8771
8799
|
break;
|
8772
8800
|
}
|
8773
8801
|
throw l.error.message;
|
8774
8802
|
case 16:
|
8775
|
-
return
|
8803
|
+
return _context88.abrupt("return", {
|
8776
8804
|
text: l.choices[0].message.content || ""
|
8777
8805
|
});
|
8778
8806
|
case 17:
|
8779
8807
|
throw Error("Response object must either be {response: string}[] for each individual function or {text: string} for a direct response, see https://deepchat.dev/docs/directConnection/OpenAI#FunctionHandler.");
|
8780
8808
|
case 18:
|
8781
8809
|
case "end":
|
8782
|
-
return
|
8810
|
+
return _context88.stop();
|
8783
8811
|
}
|
8784
|
-
},
|
8812
|
+
}, _callee88, this);
|
8785
8813
|
}));
|
8786
|
-
function handleTools(
|
8814
|
+
function handleTools(_x164, _x165, _x166) {
|
8787
8815
|
return _handleTools2.apply(this, arguments);
|
8788
8816
|
}
|
8789
8817
|
return handleTools;
|
@@ -8849,13 +8877,13 @@ var Ho = /*#__PURE__*/function (_Zi3) {
|
|
8849
8877
|
}, {
|
8850
8878
|
key: "callServiceAPI",
|
8851
8879
|
value: function () {
|
8852
|
-
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8880
|
+
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89(e, t) {
|
8853
8881
|
var i;
|
8854
|
-
return _regeneratorRuntime().wrap(function
|
8855
|
-
while (1) switch (
|
8882
|
+
return _regeneratorRuntime().wrap(function _callee89$(_context89) {
|
8883
|
+
while (1) switch (_context89.prev = _context89.next) {
|
8856
8884
|
case 0:
|
8857
8885
|
if (this.requestSettings) {
|
8858
|
-
|
8886
|
+
_context89.next = 2;
|
8859
8887
|
break;
|
8860
8888
|
}
|
8861
8889
|
throw new Error("Request settings have not been set up");
|
@@ -8864,11 +8892,11 @@ var Ho = /*#__PURE__*/function (_Zi3) {
|
|
8864
8892
|
_.request(this, i, e);
|
8865
8893
|
case 4:
|
8866
8894
|
case "end":
|
8867
|
-
return
|
8895
|
+
return _context89.stop();
|
8868
8896
|
}
|
8869
|
-
},
|
8897
|
+
}, _callee89, this);
|
8870
8898
|
}));
|
8871
|
-
function callServiceAPI(
|
8899
|
+
function callServiceAPI(_x167, _x168) {
|
8872
8900
|
return _callServiceAPI21.apply(this, arguments);
|
8873
8901
|
}
|
8874
8902
|
return callServiceAPI;
|
@@ -8876,26 +8904,26 @@ var Ho = /*#__PURE__*/function (_Zi3) {
|
|
8876
8904
|
}, {
|
8877
8905
|
key: "extractResultData",
|
8878
8906
|
value: function () {
|
8879
|
-
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8880
|
-
return _regeneratorRuntime().wrap(function
|
8881
|
-
while (1) switch (
|
8907
|
+
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e) {
|
8908
|
+
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
8909
|
+
while (1) switch (_context90.prev = _context90.next) {
|
8882
8910
|
case 0:
|
8883
8911
|
if (!e.message) {
|
8884
|
-
|
8912
|
+
_context90.next = 2;
|
8885
8913
|
break;
|
8886
8914
|
}
|
8887
8915
|
throw e.message;
|
8888
8916
|
case 2:
|
8889
|
-
return
|
8917
|
+
return _context90.abrupt("return", {
|
8890
8918
|
text: e.text
|
8891
8919
|
});
|
8892
8920
|
case 3:
|
8893
8921
|
case "end":
|
8894
|
-
return
|
8922
|
+
return _context90.stop();
|
8895
8923
|
}
|
8896
|
-
},
|
8924
|
+
}, _callee90);
|
8897
8925
|
}));
|
8898
|
-
function extractResultData(
|
8926
|
+
function extractResultData(_x169) {
|
8899
8927
|
return _extractResultData24.apply(this, arguments);
|
8900
8928
|
}
|
8901
8929
|
return extractResultData;
|
@@ -8930,7 +8958,7 @@ var Go = /*#__PURE__*/function () {
|
|
8930
8958
|
}
|
8931
8959
|
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new Gt(e) : t.stabilityAI.imageToImageUpscale ? new qt(e) : t.stabilityAI.imageToImageMasking ? new Ht(e) : new Vt(e);
|
8932
8960
|
}
|
8933
|
-
return i ? new
|
8961
|
+
return i ? new Ne(e) : new Ne(e, void 0, n || !0);
|
8934
8962
|
}
|
8935
8963
|
}]);
|
8936
8964
|
return Go;
|
@@ -9054,7 +9082,7 @@ var Wo = /*#__PURE__*/function () {
|
|
9054
9082
|
key: "getText",
|
9055
9083
|
value: function getText(e, t) {
|
9056
9084
|
var i, n;
|
9057
|
-
if (!e.directConnection && !e.request && !e.webModel && !e.demo) return "Connect to any API using the [request](https://deepchat.dev/docs/connect#Request)\n property or a popular service via\n [directConnection](https://deepchat.dev/docs/directConnection/#directConnection).\n \n Host AI entirely on your browser via a [webModel](
|
9085
|
+
if (!e.directConnection && !e.request && !e.webModel && !e.demo) return "Connect to any API using the [request](https://deepchat.dev/docs/connect#Request)\n property or a popular service via\n [directConnection](https://deepchat.dev/docs/directConnection/#directConnection).\n \n Host AI entirely on your browser via a [webModel](https://deepchat.dev/docs/webModel).\n \n To get started checkout the [Start](https://deepchat.dev/start) page and\n live code [examples](https://deepchat.dev/examples/frameworks).\n \n To remove this message set the [demo](https://deepchat.dev/docs/demo#demo) property to true.";
|
9058
9086
|
if (e.directConnection) {
|
9059
9087
|
if (!t.isDirectConnection()) return "Please define a valid service inside\n the [directConnection](https://deepchat.dev/docs/directConnection/#directConnection) object.";
|
9060
9088
|
var r = (i = e.directConnection.openAI) == null ? void 0 : i.chat;
|
@@ -9076,26 +9104,26 @@ var fe = /*#__PURE__*/function () {
|
|
9076
9104
|
key: "createImage",
|
9077
9105
|
value: function createImage(e, t) {
|
9078
9106
|
var i = new Image();
|
9079
|
-
return i.src = e.src, ne.scrollDownOnImageLoad(i.src, t), ne.processContent(i, i.src, e.name);
|
9107
|
+
return i.src = e.src, ne.scrollDownOnImageLoad(i.src, t), ne.processContent("image", i, i.src, e.name);
|
9080
9108
|
}
|
9081
9109
|
// WORK - image still does not scroll down when loaded
|
9082
9110
|
}, {
|
9083
9111
|
key: "addNewImageMessage",
|
9084
9112
|
value: function () {
|
9085
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9113
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e, t, i) {
|
9086
9114
|
var n, r;
|
9087
|
-
return _regeneratorRuntime().wrap(function
|
9088
|
-
while (1) switch (
|
9115
|
+
return _regeneratorRuntime().wrap(function _callee91$(_context91) {
|
9116
|
+
while (1) switch (_context91.prev = _context91.next) {
|
9089
9117
|
case 0:
|
9090
9118
|
n = fe.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
|
9091
9119
|
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), ne.addMessage(e, r, "image", i);
|
9092
9120
|
case 2:
|
9093
9121
|
case "end":
|
9094
|
-
return
|
9122
|
+
return _context91.stop();
|
9095
9123
|
}
|
9096
|
-
},
|
9124
|
+
}, _callee91);
|
9097
9125
|
}));
|
9098
|
-
function addNewImageMessage(
|
9126
|
+
function addNewImageMessage(_x170, _x171, _x172) {
|
9099
9127
|
return _addNewImageMessage.apply(this, arguments);
|
9100
9128
|
}
|
9101
9129
|
return addNewImageMessage;
|
@@ -9104,7 +9132,7 @@ var fe = /*#__PURE__*/function () {
|
|
9104
9132
|
key: "createAudioElement",
|
9105
9133
|
value: function createAudioElement(e, t) {
|
9106
9134
|
var i = document.createElement("audio");
|
9107
|
-
return i.src = e.src, i.classList.add("audio-player"), i.controls = !0,
|
9135
|
+
return i.src = e.src, i.classList.add("audio-player"), i.controls = !0, be.IS_SAFARI && (i.classList.add("audio-player-safari"), i.classList.add(t === v.USER_ROLE ? "audio-player-safari-right" : "audio-player-safari-left")), i;
|
9108
9136
|
}
|
9109
9137
|
}, {
|
9110
9138
|
key: "addNewAudioMessage",
|
@@ -9123,7 +9151,7 @@ var fe = /*#__PURE__*/function () {
|
|
9123
9151
|
var n = H.createSVGElement(Ko);
|
9124
9152
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
9125
9153
|
var r = document.createElement("div");
|
9126
|
-
return r.classList.add("any-file-message-text"), r.textContent = e.name || ne.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), ne.processContent(t, e.src, r.textContent
|
9154
|
+
return r.classList.add("any-file-message-text"), r.textContent = e.name || ne.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), ne.processContent("any", t, e.src, r.textContent);
|
9127
9155
|
}
|
9128
9156
|
}, {
|
9129
9157
|
key: "addNewAnyFileMessage",
|
@@ -9144,8 +9172,8 @@ var fe = /*#__PURE__*/function () {
|
|
9144
9172
|
}]);
|
9145
9173
|
return fe;
|
9146
9174
|
}();
|
9147
|
-
var me = /*#__PURE__*/function (
|
9148
|
-
_inherits(me,
|
9175
|
+
var me = /*#__PURE__*/function (_$e) {
|
9176
|
+
_inherits(me, _$e);
|
9149
9177
|
var _super36 = _createSuper(me);
|
9150
9178
|
function me(e, t, i) {
|
9151
9179
|
var _this38;
|
@@ -9205,7 +9233,7 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9205
9233
|
value: function populateInitialMessages(e) {
|
9206
9234
|
var _this39 = this;
|
9207
9235
|
e.forEach(function (t) {
|
9208
|
-
|
9236
|
+
Le.processInitialMessageFile(t), _this39.addNewMessage(t, !0);
|
9209
9237
|
}), setTimeout(function () {
|
9210
9238
|
return Z.scrollToBottom(_this39.elementRef);
|
9211
9239
|
}, 0);
|
@@ -9221,7 +9249,7 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9221
9249
|
};
|
9222
9250
|
if (!e.ignoreText && i.text !== void 0 && e.text !== null && (this.addNewTextMessage(i.text, i.role, n), !t && this.textToSpeech && i.role !== v.USER_ROLE && jt.speak(i.text, this.textToSpeech)), i.files && Array.isArray(i.files) && fe.addMessages(this, i.files, i.role), i.html !== void 0 && i.html !== null) {
|
9223
9251
|
var r = Xe.add(this, i.html, i.role, this.messageElementRefs, n);
|
9224
|
-
|
9252
|
+
ve.isElementTemporary(r) && delete i.html;
|
9225
9253
|
}
|
9226
9254
|
this.isValidMessageContent(i) && this.updateStateOnMessage(i, e.overwrite, e.sendUpdate, t);
|
9227
9255
|
}
|
@@ -9305,11 +9333,11 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9305
9333
|
}, {
|
9306
9334
|
key: "addMultipleFiles",
|
9307
9335
|
value: function () {
|
9308
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9309
|
-
return _regeneratorRuntime().wrap(function
|
9310
|
-
while (1) switch (
|
9336
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e) {
|
9337
|
+
return _regeneratorRuntime().wrap(function _callee92$(_context92) {
|
9338
|
+
while (1) switch (_context92.prev = _context92.next) {
|
9311
9339
|
case 0:
|
9312
|
-
return
|
9340
|
+
return _context92.abrupt("return", Promise.all((e || []).map(function (t) {
|
9313
9341
|
return new Promise(function (i) {
|
9314
9342
|
if (!t.type || t.type === "any") {
|
9315
9343
|
var n = t.file.name || ne.DEFAULT_FILE_NAME;
|
@@ -9332,11 +9360,11 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9332
9360
|
})));
|
9333
9361
|
case 1:
|
9334
9362
|
case "end":
|
9335
|
-
return
|
9363
|
+
return _context92.stop();
|
9336
9364
|
}
|
9337
|
-
},
|
9365
|
+
}, _callee92);
|
9338
9366
|
}));
|
9339
|
-
function addMultipleFiles(
|
9367
|
+
function addMultipleFiles(_x173) {
|
9340
9368
|
return _addMultipleFiles.apply(this, arguments);
|
9341
9369
|
}
|
9342
9370
|
return addMultipleFiles;
|
@@ -9368,7 +9396,7 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9368
9396
|
}
|
9369
9397
|
}]);
|
9370
9398
|
return me;
|
9371
|
-
}(
|
9399
|
+
}($e);
|
9372
9400
|
var Mt = /*#__PURE__*/function () {
|
9373
9401
|
function K() {
|
9374
9402
|
_classCallCheck(this, K);
|
@@ -9604,14 +9632,14 @@ var yt = /*#__PURE__*/function () {
|
|
9604
9632
|
}]);
|
9605
9633
|
return yt;
|
9606
9634
|
}();
|
9607
|
-
var
|
9608
|
-
function
|
9609
|
-
_classCallCheck(this,
|
9635
|
+
var Te = /*#__PURE__*/function () {
|
9636
|
+
function Te() {
|
9637
|
+
_classCallCheck(this, Te);
|
9610
9638
|
}
|
9611
|
-
_createClass(
|
9639
|
+
_createClass(Te, null, [{
|
9612
9640
|
key: "addItemEvents",
|
9613
9641
|
value: function addItemEvents(e, t, i, n) {
|
9614
|
-
|
9642
|
+
Ae.add(t, n), t.addEventListener("click", function () {
|
9615
9643
|
i.click();
|
9616
9644
|
}), t.addEventListener("mouseenter", function (r) {
|
9617
9645
|
e.highlightedItem = r.target;
|
@@ -9635,7 +9663,7 @@ var Me = /*#__PURE__*/function () {
|
|
9635
9663
|
key: "populateItem",
|
9636
9664
|
value: function populateItem(e, t, i, n) {
|
9637
9665
|
var r = e.children[0];
|
9638
|
-
r.classList.contains("text-button") ? t.appendChild(
|
9666
|
+
r.classList.contains("text-button") ? t.appendChild(Te.createItemText(r.textContent, n == null ? void 0 : n.text)) : (t.appendChild(Te.createItemIcon(e, n == null ? void 0 : n.iconContainer)), t.appendChild(Te.createItemText(i, n == null ? void 0 : n.text)));
|
9639
9667
|
}
|
9640
9668
|
// prettier-ignore
|
9641
9669
|
}, {
|
@@ -9645,16 +9673,16 @@ var Me = /*#__PURE__*/function () {
|
|
9645
9673
|
var n = t.elementRef,
|
9646
9674
|
r = t.dropupText,
|
9647
9675
|
o = document.createElement("div");
|
9648
|
-
Object.assign(o.style, (l = i == null ? void 0 : i.item) == null ? void 0 : l["default"]),
|
9676
|
+
Object.assign(o.style, (l = i == null ? void 0 : i.item) == null ? void 0 : l["default"]), Te.populateItem(n, o, r, i), o.classList.add("dropup-menu-item");
|
9649
9677
|
var a = T.processStateful((i == null ? void 0 : i.item) || {}, {
|
9650
9678
|
backgroundColor: "#f3f3f3"
|
9651
9679
|
}, {
|
9652
9680
|
backgroundColor: "#ebebeb"
|
9653
9681
|
});
|
9654
|
-
return
|
9682
|
+
return Te.addItemEvents(e, o, n, a), o;
|
9655
9683
|
}
|
9656
9684
|
}]);
|
9657
|
-
return
|
9685
|
+
return Te;
|
9658
9686
|
}();
|
9659
9687
|
var nn = /*#__PURE__*/function () {
|
9660
9688
|
function nn(e, t) {
|
@@ -9683,7 +9711,7 @@ var nn = /*#__PURE__*/function () {
|
|
9683
9711
|
}, {
|
9684
9712
|
key: "addItem",
|
9685
9713
|
value: function addItem(e) {
|
9686
|
-
var t =
|
9714
|
+
var t = Te.createItem(this, e, this._styles);
|
9687
9715
|
this.elementRef.appendChild(t);
|
9688
9716
|
}
|
9689
9717
|
// prettier-ignore
|
@@ -10005,7 +10033,7 @@ var ue = /*#__PURE__*/function () {
|
|
10005
10033
|
key: "createAnyFileAttachment",
|
10006
10034
|
value: function createAnyFileAttachment(e) {
|
10007
10035
|
var t = document.createElement("div");
|
10008
|
-
t.classList.add("border-bound-attachment"),
|
10036
|
+
t.classList.add("border-bound-attachment"), be.IS_SAFARI && t.classList.add("border-bound-attachment-safari");
|
10009
10037
|
var i = document.createElement("div");
|
10010
10038
|
i.classList.add("any-file-attachment-text");
|
10011
10039
|
var n = document.createElement("div");
|
@@ -10023,19 +10051,19 @@ var ue = /*#__PURE__*/function () {
|
|
10023
10051
|
var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
|
10024
10052
|
_n = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
|
10025
10053
|
fs = /*#__PURE__*/function (_ue) {
|
10026
|
-
_inherits(
|
10027
|
-
var _super38 = _createSuper(
|
10054
|
+
_inherits(Me, _ue);
|
10055
|
+
var _super38 = _createSuper(Me);
|
10028
10056
|
// prettier-ignore
|
10029
|
-
function
|
10030
|
-
_classCallCheck(this,
|
10057
|
+
function Me(e, t, i, n) {
|
10058
|
+
_classCallCheck(this, Me);
|
10031
10059
|
return _super38.call(this, e, t, i, n);
|
10032
10060
|
}
|
10033
|
-
_createClass(
|
10061
|
+
_createClass(Me, [{
|
10034
10062
|
key: "createTimer",
|
10035
10063
|
value: function createTimer(e, t) {
|
10036
10064
|
var _this44 = this;
|
10037
10065
|
var i = 0;
|
10038
|
-
var n = t !== void 0 && t <
|
10066
|
+
var n = t !== void 0 && t < Me.TIMER_LIMIT_S ? t : Me.TIMER_LIMIT_S;
|
10039
10067
|
return setInterval(function () {
|
10040
10068
|
var a;
|
10041
10069
|
i += 1, i === n && ((a = _this44.stopPlaceholderCallback) == null || a.call(_this44), _this44.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -10047,7 +10075,7 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10047
10075
|
}, {
|
10048
10076
|
key: "createPlaceholderAudioAttachment",
|
10049
10077
|
value: function createPlaceholderAudioAttachment(e) {
|
10050
|
-
var t =
|
10078
|
+
var t = Me.createAudioContainer(),
|
10051
10079
|
i = document.createElement("div");
|
10052
10080
|
i.classList.add("audio-placeholder-text-3-digits");
|
10053
10081
|
var n = document.createElement("div");
|
@@ -10084,7 +10112,7 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10084
10112
|
key: "completePlaceholderAttachment",
|
10085
10113
|
value: function completePlaceholderAttachment(e, t) {
|
10086
10114
|
var i = this._activePlaceholderAttachment;
|
10087
|
-
i && (i.file = e,
|
10115
|
+
i && (i.file = e, Me.addAudioElements(i.attachmentContainerElement.children[0], t), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
10088
10116
|
}
|
10089
10117
|
}, {
|
10090
10118
|
key: "removePlaceholderAttachment",
|
@@ -10100,7 +10128,7 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10100
10128
|
key: "createAudioContainer",
|
10101
10129
|
value: function createAudioContainer() {
|
10102
10130
|
var e = document.createElement("div");
|
10103
|
-
return e.classList.add("border-bound-attachment", "audio-attachment-icon-container"),
|
10131
|
+
return e.classList.add("border-bound-attachment", "audio-attachment-icon-container"), be.IS_SAFARI && e.classList.add("border-bound-attachment-safari"), e;
|
10104
10132
|
}
|
10105
10133
|
}, {
|
10106
10134
|
key: "addAudioElements",
|
@@ -10124,8 +10152,8 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10124
10152
|
}, {
|
10125
10153
|
key: "createAudioAttachment",
|
10126
10154
|
value: function createAudioAttachment(e) {
|
10127
|
-
var t =
|
10128
|
-
return
|
10155
|
+
var t = Me.createAudioContainer();
|
10156
|
+
return Me.addAudioElements(t, e), t;
|
10129
10157
|
}
|
10130
10158
|
}, {
|
10131
10159
|
key: "stopAttachmentPlayback",
|
@@ -10134,7 +10162,7 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10134
10162
|
(n = (i = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : i[0]) != null && n.classList.contains("stop-icon") && e.children[0].click();
|
10135
10163
|
}
|
10136
10164
|
}]);
|
10137
|
-
return
|
10165
|
+
return Me;
|
10138
10166
|
}(ue);
|
10139
10167
|
fs.TIMER_LIMIT_S = 5999;
|
10140
10168
|
var qi = fs;
|
@@ -10188,33 +10216,33 @@ var Ct = /*#__PURE__*/function () {
|
|
10188
10216
|
}, {
|
10189
10217
|
key: "completePlaceholders",
|
10190
10218
|
value: function () {
|
10191
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10192
|
-
return _regeneratorRuntime().wrap(function
|
10193
|
-
while (1) switch (
|
10219
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94() {
|
10220
|
+
return _regeneratorRuntime().wrap(function _callee94$(_context94) {
|
10221
|
+
while (1) switch (_context94.prev = _context94.next) {
|
10194
10222
|
case 0:
|
10195
|
-
|
10223
|
+
_context94.next = 2;
|
10196
10224
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
10197
|
-
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10225
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e) {
|
10198
10226
|
var t;
|
10199
|
-
return _regeneratorRuntime().wrap(function
|
10200
|
-
while (1) switch (
|
10227
|
+
return _regeneratorRuntime().wrap(function _callee93$(_context93) {
|
10228
|
+
while (1) switch (_context93.prev = _context93.next) {
|
10201
10229
|
case 0:
|
10202
|
-
return
|
10230
|
+
return _context93.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
10203
10231
|
case 1:
|
10204
10232
|
case "end":
|
10205
|
-
return
|
10233
|
+
return _context93.stop();
|
10206
10234
|
}
|
10207
|
-
},
|
10235
|
+
}, _callee93);
|
10208
10236
|
}));
|
10209
|
-
return function (
|
10237
|
+
return function (_x174) {
|
10210
10238
|
return _ref12.apply(this, arguments);
|
10211
10239
|
};
|
10212
10240
|
}()));
|
10213
10241
|
case 2:
|
10214
10242
|
case "end":
|
10215
|
-
return
|
10243
|
+
return _context94.stop();
|
10216
10244
|
}
|
10217
|
-
},
|
10245
|
+
}, _callee94, this);
|
10218
10246
|
}));
|
10219
10247
|
function completePlaceholders() {
|
10220
10248
|
return _completePlaceholders.apply(this, arguments);
|
@@ -10488,11 +10516,11 @@ var de = /*#__PURE__*/function () {
|
|
10488
10516
|
}]);
|
10489
10517
|
return de;
|
10490
10518
|
}();
|
10491
|
-
var
|
10492
|
-
function
|
10493
|
-
_classCallCheck(this,
|
10519
|
+
var Ce = /*#__PURE__*/function () {
|
10520
|
+
function Ce() {
|
10521
|
+
_classCallCheck(this, Ce);
|
10494
10522
|
}
|
10495
|
-
_createClass(
|
10523
|
+
_createClass(Ce, null, [{
|
10496
10524
|
key: "validate",
|
10497
10525
|
value:
|
10498
10526
|
// prettier-ignore
|
@@ -10504,26 +10532,26 @@ var Te = /*#__PURE__*/function () {
|
|
10504
10532
|
}, {
|
10505
10533
|
key: "useValidationFunc",
|
10506
10534
|
value: function () {
|
10507
|
-
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10535
|
+
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95(e, t, i, n) {
|
10508
10536
|
var r, o, a, l;
|
10509
|
-
return _regeneratorRuntime().wrap(function
|
10510
|
-
while (1) switch (
|
10537
|
+
return _regeneratorRuntime().wrap(function _callee95$(_context95) {
|
10538
|
+
while (1) switch (_context95.prev = _context95.next) {
|
10511
10539
|
case 0:
|
10512
10540
|
r = t.inputElementRef, o = r.classList.contains("text-input-placeholder") ? "" : r.textContent;
|
10513
|
-
|
10541
|
+
_context95.next = 3;
|
10514
10542
|
return i.completePlaceholders();
|
10515
10543
|
case 3:
|
10516
10544
|
a = i.getAllFileData(), l = a == null ? void 0 : a.map(function (c) {
|
10517
10545
|
return c.file;
|
10518
10546
|
});
|
10519
|
-
return
|
10547
|
+
return _context95.abrupt("return", Ce.validate(e, n, o, l));
|
10520
10548
|
case 5:
|
10521
10549
|
case "end":
|
10522
|
-
return
|
10550
|
+
return _context95.stop();
|
10523
10551
|
}
|
10524
|
-
},
|
10552
|
+
}, _callee95);
|
10525
10553
|
}));
|
10526
|
-
function useValidationFunc(
|
10554
|
+
function useValidationFunc(_x175, _x176, _x177, _x178) {
|
10527
10555
|
return _useValidationFunc.apply(this, arguments);
|
10528
10556
|
}
|
10529
10557
|
return useValidationFunc;
|
@@ -10531,22 +10559,22 @@ var Te = /*#__PURE__*/function () {
|
|
10531
10559
|
}, {
|
10532
10560
|
key: "useValidationFuncProgrammatic",
|
10533
10561
|
value: function () {
|
10534
|
-
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10562
|
+
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e, t, i) {
|
10535
10563
|
var r, n;
|
10536
|
-
return _regeneratorRuntime().wrap(function
|
10537
|
-
while (1) switch (
|
10564
|
+
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
10565
|
+
while (1) switch (_context96.prev = _context96.next) {
|
10538
10566
|
case 0:
|
10539
10567
|
n = (r = t.files) == null ? void 0 : r.map(function (o) {
|
10540
10568
|
return o.file;
|
10541
10569
|
});
|
10542
|
-
return
|
10570
|
+
return _context96.abrupt("return", Ce.validate(e, i, t.text, n, !0));
|
10543
10571
|
case 2:
|
10544
10572
|
case "end":
|
10545
|
-
return
|
10573
|
+
return _context96.stop();
|
10546
10574
|
}
|
10547
|
-
},
|
10575
|
+
}, _callee96);
|
10548
10576
|
}));
|
10549
|
-
function useValidationFuncProgrammatic(
|
10577
|
+
function useValidationFuncProgrammatic(_x179, _x180, _x181) {
|
10550
10578
|
return _useValidationFuncProgrammatic.apply(this, arguments);
|
10551
10579
|
}
|
10552
10580
|
return useValidationFuncProgrammatic;
|
@@ -10560,34 +10588,34 @@ var Te = /*#__PURE__*/function () {
|
|
10560
10588
|
}, {
|
10561
10589
|
key: "attach",
|
10562
10590
|
value: function attach(e, t, i, n, r) {
|
10563
|
-
var o = e.validateInput ||
|
10591
|
+
var o = e.validateInput || Le.processValidateInput(e);
|
10564
10592
|
e._validationHandler = /*#__PURE__*/function () {
|
10565
|
-
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10593
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(a) {
|
10566
10594
|
var l;
|
10567
|
-
return _regeneratorRuntime().wrap(function
|
10568
|
-
while (1) switch (
|
10595
|
+
return _regeneratorRuntime().wrap(function _callee97$(_context97) {
|
10596
|
+
while (1) switch (_context97.prev = _context97.next) {
|
10569
10597
|
case 0:
|
10570
|
-
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !
|
10571
|
-
|
10598
|
+
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !Ce.validateWebsocket(t, r))) {
|
10599
|
+
_context97.next = 2;
|
10572
10600
|
break;
|
10573
10601
|
}
|
10574
|
-
return
|
10602
|
+
return _context97.abrupt("return", !1);
|
10575
10603
|
case 2:
|
10576
10604
|
l = o || t.canSendMessage;
|
10577
|
-
return
|
10605
|
+
return _context97.abrupt("return", l ? a ? Ce.useValidationFuncProgrammatic(l, a, r) : Ce.useValidationFunc(l, i, n, r) : null);
|
10578
10606
|
case 4:
|
10579
10607
|
case "end":
|
10580
|
-
return
|
10608
|
+
return _context97.stop();
|
10581
10609
|
}
|
10582
|
-
},
|
10610
|
+
}, _callee97);
|
10583
10611
|
}));
|
10584
|
-
return function (
|
10612
|
+
return function (_x182) {
|
10585
10613
|
return _ref13.apply(this, arguments);
|
10586
10614
|
};
|
10587
10615
|
}();
|
10588
10616
|
}
|
10589
10617
|
}]);
|
10590
|
-
return
|
10618
|
+
return Ce;
|
10591
10619
|
}();
|
10592
10620
|
var na = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg height=\"1.4em\" width=\"1.4em\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n\t viewBox=\"0 0 490.9 490.9\" xml:space=\"preserve\">\n\t<g>\n\t\t<g>\n\t\t\t<path d=\"M245.5,322.9c53,0,96.2-43.2,96.2-96.2V96.2c0-53-43.2-96.2-96.2-96.2s-96.2,43.2-96.2,96.2v130.5\n\t\t\t\tC149.3,279.8,192.5,322.9,245.5,322.9z M173.8,96.2c0-39.5,32.2-71.7,71.7-71.7s71.7,32.2,71.7,71.7v130.5\n\t\t\t\tc0,39.5-32.2,71.7-71.7,71.7s-71.7-32.2-71.7-71.7V96.2z\"/>\n\t\t\t<path d=\"M94.4,214.5c-6.8,0-12.3,5.5-12.3,12.3c0,85.9,66.7,156.6,151.1,162.8v76.7h-63.9c-6.8,0-12.3,5.5-12.3,12.3\n\t\t\t\ts5.5,12.3,12.3,12.3h152.3c6.8,0,12.3-5.5,12.3-12.3s-5.5-12.3-12.3-12.3h-63.9v-76.7c84.4-6.3,151.1-76.9,151.1-162.8\n\t\t\t\tc0-6.8-5.5-12.3-12.3-12.3s-12.3,5.5-12.3,12.3c0,76.6-62.3,138.9-138.9,138.9s-138.9-62.3-138.9-138.9\n\t\t\t\tC106.6,220,101.2,214.5,94.4,214.5z\"/>\n\t\t</g>\n\t</g>\n</svg>\n";
|
10593
10621
|
var xt = /*#__PURE__*/function (_Tt3) {
|
@@ -10671,26 +10699,26 @@ var gs = {},
|
|
10671
10699
|
li = {},
|
10672
10700
|
ci = {},
|
10673
10701
|
At = {},
|
10674
|
-
|
10675
|
-
Object.defineProperty(
|
10702
|
+
Fe = {};
|
10703
|
+
Object.defineProperty(Fe, "__esModule", {
|
10676
10704
|
value: !0
|
10677
10705
|
});
|
10678
|
-
|
10679
|
-
var
|
10680
|
-
function
|
10681
|
-
_classCallCheck(this,
|
10706
|
+
Fe.Text = void 0;
|
10707
|
+
var xe = /*#__PURE__*/function () {
|
10708
|
+
function xe() {
|
10709
|
+
_classCallCheck(this, xe);
|
10682
10710
|
}
|
10683
|
-
_createClass(
|
10711
|
+
_createClass(xe, null, [{
|
10684
10712
|
key: "capitalize",
|
10685
10713
|
value: function capitalize(e) {
|
10686
|
-
return e.replace(
|
10714
|
+
return e.replace(xe.FIRST_CHAR_REGEX, function (t) {
|
10687
10715
|
return t.toUpperCase();
|
10688
10716
|
});
|
10689
10717
|
}
|
10690
10718
|
}, {
|
10691
10719
|
key: "lineBreak",
|
10692
10720
|
value: function lineBreak(e) {
|
10693
|
-
return e.replace(
|
10721
|
+
return e.replace(xe.DOUBLE_LINE, "<p></p>").replace(xe.ONE_LINE, "<br>");
|
10694
10722
|
}
|
10695
10723
|
}, {
|
10696
10724
|
key: "isCharDefined",
|
@@ -10704,17 +10732,17 @@ var ye = /*#__PURE__*/function () {
|
|
10704
10732
|
return e.split(/(\W+)/);
|
10705
10733
|
}
|
10706
10734
|
}]);
|
10707
|
-
return
|
10735
|
+
return xe;
|
10708
10736
|
}();
|
10709
|
-
|
10710
|
-
|
10711
|
-
|
10712
|
-
|
10737
|
+
Fe.Text = xe;
|
10738
|
+
xe.FIRST_CHAR_REGEX = /\S/;
|
10739
|
+
xe.DOUBLE_LINE = /\n\n/g;
|
10740
|
+
xe.ONE_LINE = /\n/g;
|
10713
10741
|
Object.defineProperty(At, "__esModule", {
|
10714
10742
|
value: !0
|
10715
10743
|
});
|
10716
10744
|
At.Translate = void 0;
|
10717
|
-
var sa =
|
10745
|
+
var sa = Fe;
|
10718
10746
|
var ra = /*#__PURE__*/function () {
|
10719
10747
|
function ra() {
|
10720
10748
|
_classCallCheck(this, ra);
|
@@ -10899,11 +10927,11 @@ var sn = /*#__PURE__*/function () {
|
|
10899
10927
|
return sn;
|
10900
10928
|
}();
|
10901
10929
|
Lt.AutoScroll = sn;
|
10902
|
-
var
|
10903
|
-
Object.defineProperty(
|
10930
|
+
var Be = {};
|
10931
|
+
Object.defineProperty(Be, "__esModule", {
|
10904
10932
|
value: !0
|
10905
10933
|
});
|
10906
|
-
|
10934
|
+
Be.Elements = void 0;
|
10907
10935
|
var la = /*#__PURE__*/function () {
|
10908
10936
|
function la() {
|
10909
10937
|
_classCallCheck(this, la);
|
@@ -10951,12 +10979,12 @@ var la = /*#__PURE__*/function () {
|
|
10951
10979
|
}]);
|
10952
10980
|
return la;
|
10953
10981
|
}();
|
10954
|
-
|
10955
|
-
var
|
10956
|
-
Object.defineProperty(
|
10982
|
+
Be.Elements = la;
|
10983
|
+
var ze = {};
|
10984
|
+
Object.defineProperty(ze, "__esModule", {
|
10957
10985
|
value: !0
|
10958
10986
|
});
|
10959
|
-
|
10987
|
+
ze.Cursor = void 0;
|
10960
10988
|
var ft = /*#__PURE__*/function () {
|
10961
10989
|
function ft() {
|
10962
10990
|
_classCallCheck(this, ft);
|
@@ -11038,16 +11066,16 @@ var ft = /*#__PURE__*/function () {
|
|
11038
11066
|
}]);
|
11039
11067
|
return ft;
|
11040
11068
|
}();
|
11041
|
-
|
11069
|
+
ze.Cursor = ft;
|
11042
11070
|
Object.defineProperty(It, "__esModule", {
|
11043
11071
|
value: !0
|
11044
11072
|
});
|
11045
11073
|
It.CommandUtils = void 0;
|
11046
11074
|
var Tn = Lt,
|
11047
|
-
ca =
|
11075
|
+
ca = Be,
|
11048
11076
|
da = nt,
|
11049
|
-
Cn =
|
11050
|
-
An =
|
11077
|
+
Cn = ze,
|
11078
|
+
An = Fe;
|
11051
11079
|
var J = /*#__PURE__*/function () {
|
11052
11080
|
function J() {
|
11053
11081
|
_classCallCheck(this, J);
|
@@ -11149,8 +11177,8 @@ Object.defineProperty(hi, "__esModule", {
|
|
11149
11177
|
value: !0
|
11150
11178
|
});
|
11151
11179
|
hi.Highlight = void 0;
|
11152
|
-
var ua =
|
11153
|
-
st =
|
11180
|
+
var ua = Be,
|
11181
|
+
st = ze;
|
11154
11182
|
var Jt = /*#__PURE__*/function () {
|
11155
11183
|
function Jt() {
|
11156
11184
|
_classCallCheck(this, Jt);
|
@@ -11206,9 +11234,9 @@ Object.defineProperty(pi, "__esModule", {
|
|
11206
11234
|
value: !0
|
11207
11235
|
});
|
11208
11236
|
pi.Padding = void 0;
|
11209
|
-
var ha =
|
11210
|
-
kn =
|
11211
|
-
|
11237
|
+
var ha = Be,
|
11238
|
+
kn = ze,
|
11239
|
+
qe = Fe;
|
11212
11240
|
var $t = /*#__PURE__*/function () {
|
11213
11241
|
function $t() {
|
11214
11242
|
_classCallCheck(this, $t);
|
@@ -11221,11 +11249,11 @@ var $t = /*#__PURE__*/function () {
|
|
11221
11249
|
r = t.value[n - 1],
|
11222
11250
|
o = t.selectionEnd === null ? n : t.selectionEnd,
|
11223
11251
|
a = t.value[o];
|
11224
|
-
|
11252
|
+
qe.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), qe.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
|
11225
11253
|
return;
|
11226
11254
|
}
|
11227
11255
|
var i = t.value[t.value.length - 1];
|
11228
|
-
|
11256
|
+
qe.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
|
11229
11257
|
}
|
11230
11258
|
}, {
|
11231
11259
|
key: "setStateForGenericElement",
|
@@ -11238,12 +11266,12 @@ var $t = /*#__PURE__*/function () {
|
|
11238
11266
|
c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
|
11239
11267
|
d = kn.Cursor.getGenericElementCursorOffset(t, a, !1),
|
11240
11268
|
u = (n = t.textContent) === null || n === void 0 ? void 0 : n[d];
|
11241
|
-
|
11269
|
+
qe.Text.isCharDefined(c) && (e.startPadding = " "), qe.Text.isCharDefined(u) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
|
11242
11270
|
return;
|
11243
11271
|
}
|
11244
11272
|
}
|
11245
11273
|
var o = t.innerText.charAt(t.innerText.length - 1);
|
11246
|
-
|
11274
|
+
qe.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
|
11247
11275
|
}
|
11248
11276
|
}, {
|
11249
11277
|
key: "setState",
|
@@ -11277,11 +11305,11 @@ var In = di,
|
|
11277
11305
|
Ln = It,
|
11278
11306
|
Pt = Lt,
|
11279
11307
|
Ai = hi,
|
11280
|
-
ie =
|
11308
|
+
ie = Be,
|
11281
11309
|
ki = pi,
|
11282
11310
|
Rn = nt,
|
11283
|
-
Nn =
|
11284
|
-
Ii =
|
11311
|
+
Nn = ze,
|
11312
|
+
Ii = Fe;
|
11285
11313
|
var fa = /*#__PURE__*/function () {
|
11286
11314
|
function fa() {
|
11287
11315
|
_classCallCheck(this, fa);
|
@@ -11537,26 +11565,26 @@ var Zt = /*#__PURE__*/function () {
|
|
11537
11565
|
}, {
|
11538
11566
|
key: "getNewSpeechConfig",
|
11539
11567
|
value: function () {
|
11540
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11541
|
-
return _regeneratorRuntime().wrap(function
|
11542
|
-
while (1) switch (
|
11568
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(e, t) {
|
11569
|
+
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
11570
|
+
while (1) switch (_context98.prev = _context98.next) {
|
11543
11571
|
case 0:
|
11544
11572
|
if (!t.region) {
|
11545
|
-
|
11573
|
+
_context98.next = 2;
|
11546
11574
|
break;
|
11547
11575
|
}
|
11548
|
-
return
|
11576
|
+
return _context98.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (i) {
|
11549
11577
|
return t.region ? e.fromAuthorizationToken((i == null ? void 0 : i.trim()) || "", t.region.trim()) : null;
|
11550
11578
|
})["catch"](function (i) {
|
11551
11579
|
return console.error(i), null;
|
11552
11580
|
}) : null);
|
11553
11581
|
case 2:
|
11554
11582
|
case "end":
|
11555
|
-
return
|
11583
|
+
return _context98.stop();
|
11556
11584
|
}
|
11557
|
-
},
|
11585
|
+
}, _callee98);
|
11558
11586
|
}));
|
11559
|
-
function getNewSpeechConfig(
|
11587
|
+
function getNewSpeechConfig(_x183, _x184) {
|
11560
11588
|
return _getNewSpeechConfig.apply(this, arguments);
|
11561
11589
|
}
|
11562
11590
|
return getNewSpeechConfig;
|
@@ -11569,23 +11597,23 @@ var Zt = /*#__PURE__*/function () {
|
|
11569
11597
|
}, {
|
11570
11598
|
key: "get",
|
11571
11599
|
value: function () {
|
11572
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11600
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e, t) {
|
11573
11601
|
var i;
|
11574
|
-
return _regeneratorRuntime().wrap(function
|
11575
|
-
while (1) switch (
|
11602
|
+
return _regeneratorRuntime().wrap(function _callee99$(_context99) {
|
11603
|
+
while (1) switch (_context99.prev = _context99.next) {
|
11576
11604
|
case 0:
|
11577
|
-
|
11605
|
+
_context99.next = 2;
|
11578
11606
|
return Zt.getNewSpeechConfig(e, t);
|
11579
11607
|
case 2:
|
11580
|
-
i =
|
11581
|
-
return
|
11608
|
+
i = _context99.sent;
|
11609
|
+
return _context99.abrupt("return", (i && Zt.process(i, t), i));
|
11582
11610
|
case 4:
|
11583
11611
|
case "end":
|
11584
|
-
return
|
11612
|
+
return _context99.stop();
|
11585
11613
|
}
|
11586
|
-
},
|
11614
|
+
}, _callee99);
|
11587
11615
|
}));
|
11588
|
-
function get(
|
11616
|
+
function get(_x185, _x186) {
|
11589
11617
|
return _get.apply(this, arguments);
|
11590
11618
|
}
|
11591
11619
|
return get;
|
@@ -11675,28 +11703,28 @@ var Xt = /*#__PURE__*/function (_ya$Speech) {
|
|
11675
11703
|
}, {
|
11676
11704
|
key: "startAsync",
|
11677
11705
|
value: function () {
|
11678
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11706
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e) {
|
11679
11707
|
var t;
|
11680
|
-
return _regeneratorRuntime().wrap(function
|
11681
|
-
while (1) switch (
|
11708
|
+
return _regeneratorRuntime().wrap(function _callee100$(_context100) {
|
11709
|
+
while (1) switch (_context100.prev = _context100.next) {
|
11682
11710
|
case 0:
|
11683
|
-
|
11684
|
-
if (!
|
11685
|
-
|
11711
|
+
_context100.t0 = this.validate(e);
|
11712
|
+
if (!_context100.t0) {
|
11713
|
+
_context100.next = 6;
|
11686
11714
|
break;
|
11687
11715
|
}
|
11688
|
-
|
11716
|
+
_context100.next = 4;
|
11689
11717
|
return this.instantiateService(e);
|
11690
11718
|
case 4:
|
11691
11719
|
this._translations = e == null ? void 0 : e.translations;
|
11692
11720
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
11693
11721
|
case 6:
|
11694
11722
|
case "end":
|
11695
|
-
return
|
11723
|
+
return _context100.stop();
|
11696
11724
|
}
|
11697
|
-
},
|
11725
|
+
}, _callee100, this);
|
11698
11726
|
}));
|
11699
|
-
function startAsync(
|
11727
|
+
function startAsync(_x187) {
|
11700
11728
|
return _startAsync.apply(this, arguments);
|
11701
11729
|
}
|
11702
11730
|
return startAsync;
|
@@ -11709,28 +11737,28 @@ var Xt = /*#__PURE__*/function (_ya$Speech) {
|
|
11709
11737
|
}, {
|
11710
11738
|
key: "instantiateService",
|
11711
11739
|
value: function () {
|
11712
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11740
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e) {
|
11713
11741
|
var t, i, n, r;
|
11714
|
-
return _regeneratorRuntime().wrap(function
|
11715
|
-
while (1) switch (
|
11742
|
+
return _regeneratorRuntime().wrap(function _callee101$(_context101) {
|
11743
|
+
while (1) switch (_context101.prev = _context101.next) {
|
11716
11744
|
case 0:
|
11717
11745
|
t = Xt.getAPI();
|
11718
11746
|
i = t.AudioConfig.fromDefaultMicrophoneInput();
|
11719
|
-
|
11747
|
+
_context101.next = 4;
|
11720
11748
|
return jn.AzureSpeechConfig.get(t.SpeechConfig, e);
|
11721
11749
|
case 4:
|
11722
|
-
n =
|
11750
|
+
n = _context101.sent;
|
11723
11751
|
if (n) {
|
11724
11752
|
r = new t.SpeechRecognizer(n, i);
|
11725
11753
|
this.setEvents(r), this._service = r, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
11726
11754
|
} else this.error("Unable to contact Azure server");
|
11727
11755
|
case 6:
|
11728
11756
|
case "end":
|
11729
|
-
return
|
11757
|
+
return _context101.stop();
|
11730
11758
|
}
|
11731
|
-
},
|
11759
|
+
}, _callee101, this);
|
11732
11760
|
}));
|
11733
|
-
function instantiateService(
|
11761
|
+
function instantiateService(_x188) {
|
11734
11762
|
return _instantiateService.apply(this, arguments);
|
11735
11763
|
}
|
11736
11764
|
return instantiateService;
|
@@ -11834,21 +11862,21 @@ var Bn = li,
|
|
11834
11862
|
xa = It,
|
11835
11863
|
ee = fi,
|
11836
11864
|
Ea = mi;
|
11837
|
-
var
|
11838
|
-
function
|
11839
|
-
_classCallCheck(this,
|
11865
|
+
var Je = /*#__PURE__*/function () {
|
11866
|
+
function Je() {
|
11867
|
+
_classCallCheck(this, Je);
|
11840
11868
|
}
|
11841
|
-
_createClass(
|
11869
|
+
_createClass(Je, null, [{
|
11842
11870
|
key: "toggle",
|
11843
11871
|
value: function toggle(e, t) {
|
11844
11872
|
var i, n;
|
11845
11873
|
var r = e.toLocaleLowerCase().trim();
|
11846
|
-
!((i = ee.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ?
|
11874
|
+
!((i = ee.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? Je.startWebSpeech(t) : r === "azure" ? Je.startAzure(t) : (console.error("service not found - must be either 'webspeech' or 'azure'"), (n = t == null ? void 0 : t.onError) === null || n === void 0 || n.call(t, "service not found - must be either 'webspeech' or 'azure'"));
|
11847
11875
|
}
|
11848
11876
|
}, {
|
11849
11877
|
key: "startWebSpeech",
|
11850
11878
|
value: function startWebSpeech(e) {
|
11851
|
-
|
11879
|
+
Je.stop() || (ee.GlobalState.service = new Bn.WebSpeech(), ee.GlobalState.service.start(e));
|
11852
11880
|
}
|
11853
11881
|
}, {
|
11854
11882
|
key: "isWebSpeechSupported",
|
@@ -11859,7 +11887,7 @@ var Ke = /*#__PURE__*/function () {
|
|
11859
11887
|
key: "startAzure",
|
11860
11888
|
value: function startAzure(e) {
|
11861
11889
|
var t;
|
11862
|
-
|
11890
|
+
Je.stop() || !((t = ee.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (ee.GlobalState.service = new Ea.Azure(), ee.GlobalState.service.start(e));
|
11863
11891
|
}
|
11864
11892
|
}, {
|
11865
11893
|
key: "stop",
|
@@ -11873,9 +11901,9 @@ var Ke = /*#__PURE__*/function () {
|
|
11873
11901
|
ee.GlobalState.service && xa.CommandUtils.toggleCommandModeOff(ee.GlobalState.service);
|
11874
11902
|
}
|
11875
11903
|
}]);
|
11876
|
-
return
|
11904
|
+
return Je;
|
11877
11905
|
}();
|
11878
|
-
var Ni = gs["default"] =
|
11906
|
+
var Ni = gs["default"] = Je;
|
11879
11907
|
var Qt = /*#__PURE__*/function (_xt) {
|
11880
11908
|
_inherits(Qt, _xt);
|
11881
11909
|
var _super43 = _createSuper(Qt);
|
@@ -12069,11 +12097,11 @@ var B = /*#__PURE__*/function () {
|
|
12069
12097
|
}]);
|
12070
12098
|
return B;
|
12071
12099
|
}();
|
12072
|
-
var
|
12073
|
-
function
|
12074
|
-
_classCallCheck(this,
|
12100
|
+
var ke = /*#__PURE__*/function () {
|
12101
|
+
function ke() {
|
12102
|
+
_classCallCheck(this, ke);
|
12075
12103
|
}
|
12076
|
-
_createClass(
|
12104
|
+
_createClass(ke, null, [{
|
12077
12105
|
key: "resetSubmit",
|
12078
12106
|
value: function resetSubmit(e, t) {
|
12079
12107
|
t ? e.unsetCustomStateStyles(["loading", "submit"]) : e.unsetCustomStateStyles(["stop", "loading", "submit"]), e.reapplyStateStyle("submit");
|
@@ -12089,16 +12117,16 @@ var Ae = /*#__PURE__*/function () {
|
|
12089
12117
|
}, {
|
12090
12118
|
key: "setUpDisabledButton",
|
12091
12119
|
value: function setUpDisabledButton(e) {
|
12092
|
-
B.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), B.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), B.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), B.setPropertyValueIfDoesNotExist(e.disabled, ["svg", "styles", "default", "filter"], "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"),
|
12120
|
+
B.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), B.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), B.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), B.setPropertyValueIfDoesNotExist(e.disabled, ["svg", "styles", "default", "filter"], "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"), ke.overwriteDefaultStyleWithSubmit(e, "disabled");
|
12093
12121
|
}
|
12094
12122
|
}, {
|
12095
12123
|
key: "process",
|
12096
12124
|
value: function process(e) {
|
12097
12125
|
var t = JSON.parse(JSON.stringify(e || {}));
|
12098
|
-
return
|
12126
|
+
return ke.overwriteDefaultStyleWithSubmit(t, "loading"), ke.overwriteDefaultStyleWithSubmit(t, "stop"), e != null && e.alwaysEnabled || ke.setUpDisabledButton(t), t;
|
12099
12127
|
}
|
12100
12128
|
}]);
|
12101
|
-
return
|
12129
|
+
return ke;
|
12102
12130
|
}();
|
12103
12131
|
var Ei = /*#__PURE__*/function (_Tt4) {
|
12104
12132
|
_inherits(k, _Tt4);
|
@@ -12107,7 +12135,7 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12107
12135
|
function k(e, t, i, n, r) {
|
12108
12136
|
var _this60;
|
12109
12137
|
_classCallCheck(this, k);
|
12110
|
-
var o =
|
12138
|
+
var o = ke.process(e.submitButtonStyles);
|
12111
12139
|
_this60 = _super45.call(this, k.createButtonContainerElement(), o == null ? void 0 : o.position, o), _this60._isSVGLoadingIconOverriden = !1, _this60.status = {
|
12112
12140
|
requestInProgress: !1,
|
12113
12141
|
loadingActive: !1
|
@@ -12172,12 +12200,12 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12172
12200
|
}, {
|
12173
12201
|
key: "submitFromInput",
|
12174
12202
|
value: function () {
|
12175
|
-
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12203
|
+
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102() {
|
12176
12204
|
var t, e, _i18;
|
12177
|
-
return _regeneratorRuntime().wrap(function
|
12178
|
-
while (1) switch (
|
12205
|
+
return _regeneratorRuntime().wrap(function _callee102$(_context102) {
|
12206
|
+
while (1) switch (_context102.prev = _context102.next) {
|
12179
12207
|
case 0:
|
12180
|
-
|
12208
|
+
_context102.next = 2;
|
12181
12209
|
return this._fileAttachments.completePlaceholders();
|
12182
12210
|
case 2:
|
12183
12211
|
e = this._fileAttachments.getAllFileData();
|
@@ -12193,9 +12221,9 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12193
12221
|
}
|
12194
12222
|
case 4:
|
12195
12223
|
case "end":
|
12196
|
-
return
|
12224
|
+
return _context102.stop();
|
12197
12225
|
}
|
12198
|
-
},
|
12226
|
+
}, _callee102, this);
|
12199
12227
|
}));
|
12200
12228
|
function submitFromInput() {
|
12201
12229
|
return _submitFromInput.apply(this, arguments);
|
@@ -12205,13 +12233,13 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12205
12233
|
}, {
|
12206
12234
|
key: "programmaticSubmit",
|
12207
12235
|
value: function () {
|
12208
|
-
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12236
|
+
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103(e) {
|
12209
12237
|
var _this61 = this;
|
12210
12238
|
var t;
|
12211
|
-
return _regeneratorRuntime().wrap(function
|
12212
|
-
while (1) switch (
|
12239
|
+
return _regeneratorRuntime().wrap(function _callee103$(_context103) {
|
12240
|
+
while (1) switch (_context103.prev = _context103.next) {
|
12213
12241
|
case 0:
|
12214
|
-
typeof e == "string" && (e =
|
12242
|
+
typeof e == "string" && (e = Le.processSubmitUserMessage(e));
|
12215
12243
|
t = {
|
12216
12244
|
text: e.text
|
12217
12245
|
};
|
@@ -12225,11 +12253,11 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12225
12253
|
});
|
12226
12254
|
case 3:
|
12227
12255
|
case "end":
|
12228
|
-
return
|
12256
|
+
return _context103.stop();
|
12229
12257
|
}
|
12230
|
-
},
|
12258
|
+
}, _callee103);
|
12231
12259
|
}));
|
12232
|
-
function programmaticSubmit(
|
12260
|
+
function programmaticSubmit(_x189) {
|
12233
12261
|
return _programmaticSubmit.apply(this, arguments);
|
12234
12262
|
}
|
12235
12263
|
return programmaticSubmit;
|
@@ -12237,31 +12265,31 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12237
12265
|
}, {
|
12238
12266
|
key: "attemptSubmit",
|
12239
12267
|
value: function () {
|
12240
|
-
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12268
|
+
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e) {
|
12241
12269
|
var t,
|
12242
12270
|
r,
|
12243
12271
|
o,
|
12244
12272
|
a,
|
12245
12273
|
i,
|
12246
12274
|
n,
|
12247
|
-
|
12248
|
-
return _regeneratorRuntime().wrap(function
|
12249
|
-
while (1) switch (
|
12275
|
+
_args104 = arguments;
|
12276
|
+
return _regeneratorRuntime().wrap(function _callee104$(_context104) {
|
12277
|
+
while (1) switch (_context104.prev = _context104.next) {
|
12250
12278
|
case 0:
|
12251
|
-
t =
|
12252
|
-
|
12279
|
+
t = _args104.length > 1 && _args104[1] !== undefined ? _args104[1] : !1;
|
12280
|
+
_context104.next = 3;
|
12253
12281
|
return (r = this._validationHandler) == null ? void 0 : r.call(this, t ? e : void 0);
|
12254
12282
|
case 3:
|
12255
|
-
|
12256
|
-
|
12257
|
-
if (!(
|
12258
|
-
|
12283
|
+
_context104.t0 = _context104.sent;
|
12284
|
+
_context104.t1 = !1;
|
12285
|
+
if (!(_context104.t0 === _context104.t1)) {
|
12286
|
+
_context104.next = 7;
|
12259
12287
|
break;
|
12260
12288
|
}
|
12261
|
-
return
|
12289
|
+
return _context104.abrupt("return");
|
12262
12290
|
case 7:
|
12263
12291
|
this.changeToLoadingIcon();
|
12264
|
-
|
12292
|
+
_context104.next = 10;
|
12265
12293
|
return this.addNewMessage(e);
|
12266
12294
|
case 10:
|
12267
12295
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
@@ -12272,17 +12300,17 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12272
12300
|
text: e.text === "" ? void 0 : e.text,
|
12273
12301
|
files: i
|
12274
12302
|
};
|
12275
|
-
|
12303
|
+
_context104.next = 15;
|
12276
12304
|
return this._serviceIO.callAPI(n, this._messages);
|
12277
12305
|
case 15:
|
12278
12306
|
(a = this._fileAttachments) == null || a.removeAllFiles();
|
12279
12307
|
case 16:
|
12280
12308
|
case "end":
|
12281
|
-
return
|
12309
|
+
return _context104.stop();
|
12282
12310
|
}
|
12283
|
-
},
|
12311
|
+
}, _callee104, this);
|
12284
12312
|
}));
|
12285
|
-
function attemptSubmit(
|
12313
|
+
function attemptSubmit(_x190) {
|
12286
12314
|
return _attemptSubmit.apply(this, arguments);
|
12287
12315
|
}
|
12288
12316
|
return attemptSubmit;
|
@@ -12290,35 +12318,35 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12290
12318
|
}, {
|
12291
12319
|
key: "addNewMessage",
|
12292
12320
|
value: function () {
|
12293
|
-
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12321
|
+
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(_ref14) {
|
12294
12322
|
var e, t, i;
|
12295
|
-
return _regeneratorRuntime().wrap(function
|
12296
|
-
while (1) switch (
|
12323
|
+
return _regeneratorRuntime().wrap(function _callee105$(_context105) {
|
12324
|
+
while (1) switch (_context105.prev = _context105.next) {
|
12297
12325
|
case 0:
|
12298
12326
|
e = _ref14.text, t = _ref14.files;
|
12299
12327
|
i = {
|
12300
12328
|
role: v.USER_ROLE
|
12301
12329
|
};
|
12302
12330
|
e && (i.text = e);
|
12303
|
-
|
12304
|
-
if (!
|
12305
|
-
|
12331
|
+
_context105.t0 = t;
|
12332
|
+
if (!_context105.t0) {
|
12333
|
+
_context105.next = 8;
|
12306
12334
|
break;
|
12307
12335
|
}
|
12308
|
-
|
12336
|
+
_context105.next = 7;
|
12309
12337
|
return this._messages.addMultipleFiles(t);
|
12310
12338
|
case 7:
|
12311
|
-
i.files =
|
12339
|
+
i.files = _context105.sent;
|
12312
12340
|
case 8:
|
12313
12341
|
this._serviceIO.sessionId && (i._sessionId = this._serviceIO.sessionId);
|
12314
12342
|
Object.keys(i).length > 0 && this._messages.addNewMessage(i);
|
12315
12343
|
case 10:
|
12316
12344
|
case "end":
|
12317
|
-
return
|
12345
|
+
return _context105.stop();
|
12318
12346
|
}
|
12319
|
-
},
|
12347
|
+
}, _callee105, this);
|
12320
12348
|
}));
|
12321
|
-
function addNewMessage(
|
12349
|
+
function addNewMessage(_x191) {
|
12322
12350
|
return _addNewMessage.apply(this, arguments);
|
12323
12351
|
}
|
12324
12352
|
return addNewMessage;
|
@@ -12344,7 +12372,7 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12344
12372
|
}, {
|
12345
12373
|
key: "changeToSubmitIcon",
|
12346
12374
|
value: function changeToSubmitIcon() {
|
12347
|
-
this.elementRef.classList.contains(k.SUBMIT_CLASS) || (this.elementRef.classList.remove(k.LOADING_CLASS, k.DISABLED_CLASS), this.elementRef.classList.add(k.SUBMIT_CLASS), this.elementRef.replaceChildren(this._innerElements.submit),
|
12375
|
+
this.elementRef.classList.contains(k.SUBMIT_CLASS) || (this.elementRef.classList.remove(k.LOADING_CLASS, k.DISABLED_CLASS), this.elementRef.classList.add(k.SUBMIT_CLASS), this.elementRef.replaceChildren(this._innerElements.submit), ke.resetSubmit(this, this.status.loadingActive), this.elementRef.onclick = this.submitFromInput.bind(this));
|
12348
12376
|
}
|
12349
12377
|
// called every time when user triggers an input via ValidationHandler - hence use class to check if not already present
|
12350
12378
|
}, {
|
@@ -12568,7 +12596,7 @@ var mt = /*#__PURE__*/function () {
|
|
12568
12596
|
button: new Qt(e, r, t.addNewErrorMessage.bind(t))
|
12569
12597
|
});
|
12570
12598
|
var l = new _a(e, r.inputElementRef, t, i, a);
|
12571
|
-
r.submit = l.submitFromInput.bind(l),
|
12599
|
+
r.submit = l.submitFromInput.bind(l), Ce.attach(e, i, r, a, l), e.submitUserMessage = l.programmaticSubmit.bind(l), o.submit = {
|
12572
12600
|
button: l
|
12573
12601
|
}, mt.addElements(this.elementRef, r, o, n, a, e.dropupStyles);
|
12574
12602
|
}
|
@@ -12693,7 +12721,7 @@ var b = /*#__PURE__*/function (_yo) {
|
|
12693
12721
|
key: "onRender",
|
12694
12722
|
value: function onRender() {
|
12695
12723
|
var _this$_childElement;
|
12696
|
-
(!this._activeService || this._activeService.demo) && (this._activeService = Go.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (wi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), wi.applyDefaultStyleToComponent(this.style, this.chatStyle),
|
12724
|
+
(!this._activeService || this._activeService.demo) && (this._activeService = Go.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (wi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), wi.applyDefaultStyleToComponent(this.style, this.chatStyle), Le.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateConfigKey ? Ft.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof U) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], on.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof U && P.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Bt.onRender(this);
|
12697
12725
|
}
|
12698
12726
|
}, {
|
12699
12727
|
key: "disconnectedCallback",
|