deep-chat-dev 9.0.89 → 9.0.91
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 +7909 -7841
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts +3 -1
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +847 -833
- package/dist/types/demo.d.ts +2 -1
- package/dist/types/demo.d.ts.map +1 -1
- package/dist/types/error.d.ts +11 -0
- package/dist/types/error.d.ts.map +1 -0
- package/dist/types/messages.d.ts +0 -9
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/utils/events/fireEvents.d.ts +1 -0
- package/dist/utils/events/fireEvents.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts +2 -1
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/dist/webModel/webModel.d.ts +2 -0
- package/dist/webModel/webModel.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -182,7 +182,7 @@ On.DEFAULT_COMPONENT_STYLE = {
|
|
182
182
|
// this is also causing the chat to squeeze when there is no space
|
183
183
|
overflow: "hidden"
|
184
184
|
};
|
185
|
-
var
|
185
|
+
var vi = On;
|
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 || {});
|
@@ -218,7 +218,7 @@ var Nn = /*#__PURE__*/function () {
|
|
218
218
|
value: function onInput(e, t, i) {
|
219
219
|
var n = i.target,
|
220
220
|
r = n.textContent || "";
|
221
|
-
e !== void 0 && r.length > e && (n.textContent = r.substring(0, e),
|
221
|
+
e !== void 0 && r.length > e && (n.textContent = r.substring(0, e), $t.focusEndOfInput(n)), t == null || t();
|
222
222
|
}
|
223
223
|
}]);
|
224
224
|
return tt;
|
@@ -241,28 +241,28 @@ var ps = /*#__PURE__*/function () {
|
|
241
241
|
return ps;
|
242
242
|
}();
|
243
243
|
var Pn = /*#__PURE__*/function () {
|
244
|
-
function
|
244
|
+
function qe(e, t) {
|
245
245
|
var _this = this;
|
246
|
-
_classCallCheck(this,
|
246
|
+
_classCallCheck(this, qe);
|
247
247
|
var n;
|
248
|
-
var i =
|
249
|
-
this.elementRef =
|
248
|
+
var i = qe.processConfig(t, e.textInput);
|
249
|
+
this.elementRef = qe.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
|
hs.add(_this.inputElementRef, (r = e.textInput) == null ? void 0 : r.characterLimit, e._validationHandler);
|
252
252
|
});
|
253
253
|
}
|
254
|
-
_createClass(
|
254
|
+
_createClass(qe, [{
|
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 = qe.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!", me.IS_CHROMIUM && qe.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 && (M.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 && (M.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)), qe.clear(this.inputElementRef), this.inputElementRef.classList.remove("text-input-placeholder"));
|
266
266
|
}
|
267
267
|
}, {
|
268
268
|
key: "addEventListeners",
|
@@ -334,15 +334,15 @@ var Pn = /*#__PURE__*/function () {
|
|
334
334
|
return t.id = "text-input-container", Object.assign(t.style, e), t;
|
335
335
|
}
|
336
336
|
}]);
|
337
|
-
return
|
337
|
+
return qe;
|
338
338
|
}();
|
339
339
|
Pn.TEXT_INPUT_ID = "text-input";
|
340
|
-
var
|
341
|
-
var
|
342
|
-
function
|
343
|
-
_classCallCheck(this,
|
340
|
+
var Fi = Pn;
|
341
|
+
var $t = /*#__PURE__*/function () {
|
342
|
+
function $t() {
|
343
|
+
_classCallCheck(this, $t);
|
344
344
|
}
|
345
|
-
_createClass(
|
345
|
+
_createClass($t, null, [{
|
346
346
|
key: "focusEndOfInput",
|
347
347
|
value: function focusEndOfInput(e) {
|
348
348
|
var t = document.createRange();
|
@@ -353,11 +353,11 @@ var Yt = /*#__PURE__*/function () {
|
|
353
353
|
}, {
|
354
354
|
key: "focusFromParentElement",
|
355
355
|
value: function focusFromParentElement(e) {
|
356
|
-
var t = e.querySelector("#".concat(
|
357
|
-
t &&
|
356
|
+
var t = e.querySelector("#".concat(Fi.TEXT_INPUT_ID));
|
357
|
+
t && $t.focusEndOfInput(t);
|
358
358
|
}
|
359
359
|
}]);
|
360
|
-
return
|
360
|
+
return $t;
|
361
361
|
}();
|
362
362
|
function tn(s) {
|
363
363
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
@@ -492,7 +492,7 @@ var Ae = /*#__PURE__*/function () {
|
|
492
492
|
}]);
|
493
493
|
return Ae;
|
494
494
|
}();
|
495
|
-
var
|
495
|
+
var Zt = /*#__PURE__*/function () {
|
496
496
|
function ye() {
|
497
497
|
_classCallCheck(this, ye);
|
498
498
|
}
|
@@ -573,10 +573,10 @@ var $t = /*#__PURE__*/function () {
|
|
573
573
|
}]);
|
574
574
|
return ye;
|
575
575
|
}();
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
var
|
576
|
+
Zt.AI_ROLE = "ai";
|
577
|
+
Zt.USER_ROLE = "user";
|
578
|
+
Zt.EMPTY_MESSAGE_CLASS = "empty-message";
|
579
|
+
var x = Zt;
|
580
580
|
var Me = /*#__PURE__*/function () {
|
581
581
|
function Me() {
|
582
582
|
_classCallCheck(this, Me);
|
@@ -611,7 +611,7 @@ var Me = /*#__PURE__*/function () {
|
|
611
611
|
}();
|
612
612
|
var gs = "deep-chat-temporary-message",
|
613
613
|
bs = "deep-chat-suggestion-button",
|
614
|
-
|
614
|
+
ki = {
|
615
615
|
"deep-chat-button": {
|
616
616
|
styles: {
|
617
617
|
"default": {
|
@@ -632,7 +632,7 @@ var gs = "deep-chat-temporary-message",
|
|
632
632
|
}
|
633
633
|
}
|
634
634
|
},
|
635
|
-
nn = Object.keys(
|
635
|
+
nn = Object.keys(ki);
|
636
636
|
var ge = /*#__PURE__*/function () {
|
637
637
|
function ge() {
|
638
638
|
_classCallCheck(this, ge);
|
@@ -665,7 +665,7 @@ var ge = /*#__PURE__*/function () {
|
|
665
665
|
}, {
|
666
666
|
key: "applyEvents",
|
667
667
|
value: function applyEvents(e, t) {
|
668
|
-
var i =
|
668
|
+
var i = ki[t].events;
|
669
669
|
Object.keys(i || []).forEach(function (n) {
|
670
670
|
e.addEventListener(n, i == null ? void 0 : i[n]);
|
671
671
|
});
|
@@ -678,7 +678,7 @@ var ge = /*#__PURE__*/function () {
|
|
678
678
|
var c = (d = e[l]) == null ? void 0 : d.styles;
|
679
679
|
return c && e[l].styles && a.push(c), a;
|
680
680
|
}, []),
|
681
|
-
r =
|
681
|
+
r = ki[i].styles;
|
682
682
|
if (r) {
|
683
683
|
var a = JSON.parse(JSON.stringify(r));
|
684
684
|
a["default"] && M.overwriteDefaultWithAlreadyApplied(a, t), n.unshift(a);
|
@@ -747,11 +747,11 @@ var se = /*#__PURE__*/function () {
|
|
747
747
|
}]);
|
748
748
|
return se;
|
749
749
|
}();
|
750
|
-
var
|
751
|
-
function
|
752
|
-
_classCallCheck(this,
|
750
|
+
var Ye = /*#__PURE__*/function () {
|
751
|
+
function Ye() {
|
752
|
+
_classCallCheck(this, Ye);
|
753
753
|
}
|
754
|
-
_createClass(
|
754
|
+
_createClass(Ye, null, [{
|
755
755
|
key: "addElement",
|
756
756
|
value: function addElement(e, t) {
|
757
757
|
e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
@@ -766,7 +766,7 @@ var Je = /*#__PURE__*/function () {
|
|
766
766
|
key: "overwrite",
|
767
767
|
value: function overwrite(e, t, i, n) {
|
768
768
|
var r = e.messages,
|
769
|
-
o =
|
769
|
+
o = x.overwriteMessage(r, n, t, i, "html", "html-message");
|
770
770
|
return o && (o.bubbleElement.innerHTML = t, se.apply(e, o.outerContainer), Ae.flagHTMLUpdateClass(o.bubbleElement)), o;
|
771
771
|
}
|
772
772
|
}, {
|
@@ -778,11 +778,11 @@ var Je = /*#__PURE__*/function () {
|
|
778
778
|
var l = this.overwrite(e, t, i, n);
|
779
779
|
if (l) return l;
|
780
780
|
}
|
781
|
-
var o =
|
782
|
-
return
|
781
|
+
var o = Ye.createElements(e, t, i);
|
782
|
+
return x.fillEmptyMessageElement(o.bubbleElement, t), se.apply(e, o.outerContainer), Ae.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html), Ye.addElement(e, o.outerContainer), o;
|
783
783
|
}
|
784
784
|
}]);
|
785
|
-
return
|
785
|
+
return Ye;
|
786
786
|
}();
|
787
787
|
var Tt;
|
788
788
|
function zn(s) {
|
@@ -810,7 +810,7 @@ function ht(s) {
|
|
810
810
|
function Un(s) {
|
811
811
|
return !(s >= 55296 && s <= 57343 || s >= 64976 && s <= 65007 || (s & 65535) === 65535 || (s & 65535) === 65534 || s >= 0 && s <= 8 || s === 11 || s >= 14 && s <= 31 || s >= 127 && s <= 159 || s > 1114111);
|
812
812
|
}
|
813
|
-
function
|
813
|
+
function Ii(s) {
|
814
814
|
if (s > 65535) {
|
815
815
|
s -= 65536;
|
816
816
|
var e = 55296 + (s >> 10),
|
@@ -824,7 +824,7 @@ var Es = /&([a-z#][a-z0-9]{1,31});/gi,
|
|
824
824
|
function ws(s, e) {
|
825
825
|
var t = 0,
|
826
826
|
i = zn(e);
|
827
|
-
return e !== i ? i : e.charCodeAt(0) === 35 && Ss.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), Un(t)) ?
|
827
|
+
return e !== i ? i : e.charCodeAt(0) === 35 && Ss.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), Un(t)) ? Ii(t) : s;
|
828
828
|
}
|
829
829
|
function ke(s) {
|
830
830
|
return s.indexOf("&") < 0 ? s : s.replace(Es, ws);
|
@@ -1062,14 +1062,14 @@ function Hn(s, e) {
|
|
1062
1062
|
var Le = f.getBreak = function (e, t) {
|
1063
1063
|
return t = Hn(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
|
1064
1064
|
};
|
1065
|
-
function
|
1065
|
+
function zi() {
|
1066
1066
|
this.rules = qn({}, f), this.getBreak = f.getBreak;
|
1067
1067
|
}
|
1068
|
-
|
1068
|
+
zi.prototype.renderInline = function (s, e, t) {
|
1069
1069
|
for (var i = this.rules, n = s.length, r = 0, o = ""; n--;) o += i[s[r].type](s, r++, e, t, this);
|
1070
1070
|
return o;
|
1071
1071
|
};
|
1072
|
-
|
1072
|
+
zi.prototype.render = function (s, e, t) {
|
1073
1073
|
for (var i = this.rules, n = s.length, r = -1, o = ""; ++r < n;) s[r].type === "inline" ? o += this.renderInline(s[r].children, e, t) : o += i[s[r].type](s, r, e, t, this);
|
1074
1074
|
return o;
|
1075
1075
|
};
|
@@ -1216,7 +1216,7 @@ function Is(s) {
|
|
1216
1216
|
}
|
1217
1217
|
}
|
1218
1218
|
}
|
1219
|
-
function
|
1219
|
+
function Li(s) {
|
1220
1220
|
var e = ke(s);
|
1221
1221
|
try {
|
1222
1222
|
e = decodeURI(e);
|
@@ -1232,7 +1232,7 @@ function Gn(s, e) {
|
|
1232
1232
|
if (s.src.charCodeAt(e) === 60) {
|
1233
1233
|
for (e++; e < o;) {
|
1234
1234
|
if (t = s.src.charCodeAt(e), t === 10) return !1;
|
1235
|
-
if (t === 62) return n =
|
1235
|
+
if (t === 62) return n = Li(ht(s.src.slice(r + 1, e))), s.parser.validateLink(n) ? (s.pos = e + 1, s.linkContent = n, !0) : !1;
|
1236
1236
|
if (t === 92 && e + 1 < o) {
|
1237
1237
|
e += 2;
|
1238
1238
|
continue;
|
@@ -1271,13 +1271,13 @@ function Wn(s) {
|
|
1271
1271
|
return s.trim().replace(/\s+/g, " ").toUpperCase();
|
1272
1272
|
}
|
1273
1273
|
function Ls(s, e, t, i) {
|
1274
|
-
var n, r, o, a, l, c, d, u,
|
1274
|
+
var n, r, o, a, l, c, d, u, h;
|
1275
1275
|
if (s.charCodeAt(0) !== 91 || s.indexOf("]:") === -1 || (n = new Re(s, e, t, i, []), r = pt(n, 0), r < 0 || s.charCodeAt(r + 1) !== 58)) return -1;
|
1276
1276
|
for (a = n.posMax, o = r + 2; o < a && (l = n.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
1277
1277
|
if (!Gn(n, o)) return -1;
|
1278
1278
|
for (d = n.linkContent, o = n.pos, c = o, o = o + 1; o < a && (l = n.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
1279
1279
|
for (o < a && c !== o && Vn(n, o) ? (u = n.linkContent, o = n.pos) : (u = "", o = c); o < a && n.src.charCodeAt(o) === 32;) o++;
|
1280
|
-
return o < a && n.src.charCodeAt(o) !== 10 ? -1 : (
|
1280
|
+
return o < a && n.src.charCodeAt(o) !== 10 ? -1 : (h = Wn(s.slice(1, r)), _typeof(i.references[h]) > "u" && (i.references[h] = {
|
1281
1281
|
title: u,
|
1282
1282
|
href: d
|
1283
1283
|
}), o);
|
@@ -1314,9 +1314,9 @@ function Ns(s) {
|
|
1314
1314
|
c,
|
1315
1315
|
d = 0,
|
1316
1316
|
u = !1,
|
1317
|
-
|
1318
|
-
if (s.env.footnotes && (s.tokens = s.tokens.filter(function (
|
1319
|
-
return
|
1317
|
+
h = {};
|
1318
|
+
if (s.env.footnotes && (s.tokens = s.tokens.filter(function (p) {
|
1319
|
+
return p.type === "footnote_reference_open" ? (u = !0, l = [], c = p.label, !1) : p.type === "footnote_reference_close" ? (u = !1, h[":" + c] = l, !1) : (u && l.push(p), !u);
|
1320
1320
|
}), !!s.env.footnotes.list)) {
|
1321
1321
|
for (o = s.env.footnotes.list, s.tokens.push({
|
1322
1322
|
type: "footnote_block_open",
|
@@ -1339,7 +1339,7 @@ function Ns(s) {
|
|
1339
1339
|
type: "paragraph_close",
|
1340
1340
|
tight: !1,
|
1341
1341
|
level: --d
|
1342
|
-
})) : o[e].label && (a =
|
1342
|
+
})) : o[e].label && (a = h[":" + o[e].label]), s.tokens = s.tokens.concat(a), s.tokens[s.tokens.length - 1].type === "paragraph_close" ? r = s.tokens.pop() : r = null, n = o[e].count > 0 ? o[e].count : 1, i = 0; i < n; i++) s.tokens.push({
|
1343
1343
|
type: "footnote_anchor",
|
1344
1344
|
id: e,
|
1345
1345
|
subId: i,
|
@@ -1357,7 +1357,7 @@ function Ns(s) {
|
|
1357
1357
|
}
|
1358
1358
|
}
|
1359
1359
|
var sn = " \n()[]'\".,!?-";
|
1360
|
-
function
|
1360
|
+
function yi(s) {
|
1361
1361
|
return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1");
|
1362
1362
|
}
|
1363
1363
|
function Ps(s) {
|
@@ -1372,15 +1372,15 @@ function Ps(s) {
|
|
1372
1372
|
c,
|
1373
1373
|
d,
|
1374
1374
|
u,
|
1375
|
-
|
1376
|
-
|
1375
|
+
h,
|
1376
|
+
p = s.tokens;
|
1377
1377
|
if (s.env.abbreviations) {
|
1378
|
-
for (s.env.abbrRegExp || (
|
1378
|
+
for (s.env.abbrRegExp || (h = "(^|[" + sn.split("").map(yi).join("") + "])(" + Object.keys(s.env.abbreviations).map(function (g) {
|
1379
1379
|
return g.substr(1);
|
1380
1380
|
}).sort(function (g, m) {
|
1381
1381
|
return m.length - g.length;
|
1382
|
-
}).map(
|
1383
|
-
for (n =
|
1382
|
+
}).map(yi).join("|") + ")($|[" + sn.split("").map(yi).join("") + "])", s.env.abbrRegExp = new RegExp(h, "g")), d = s.env.abbrRegExp, t = 0, i = p.length; t < i; t++) if (p[t].type === "inline") {
|
1383
|
+
for (n = p[t].children, e = n.length - 1; e >= 0; e--) if (r = n[e], r.type === "text") {
|
1384
1384
|
for (l = 0, o = r.content, d.lastIndex = 0, c = r.level, a = []; u = d.exec(o);) d.lastIndex > l && a.push({
|
1385
1385
|
type: "text",
|
1386
1386
|
content: o.slice(l, u.index + u[1].length),
|
@@ -1401,7 +1401,7 @@ function Ps(s) {
|
|
1401
1401
|
type: "text",
|
1402
1402
|
content: o.slice(l),
|
1403
1403
|
level: c
|
1404
|
-
}),
|
1404
|
+
}), p[t].children = n = [].concat(n.slice(0, e), a, n.slice(e + 1)));
|
1405
1405
|
}
|
1406
1406
|
}
|
1407
1407
|
}
|
@@ -1432,24 +1432,24 @@ var qs = /['"]/,
|
|
1432
1432
|
function an(s, e) {
|
1433
1433
|
return e < 0 || e >= s.length ? !1 : !Us.test(s[e]);
|
1434
1434
|
}
|
1435
|
-
function
|
1435
|
+
function Fe(s, e, t) {
|
1436
1436
|
return s.substr(0, e) + t + s.substr(e + 1);
|
1437
1437
|
}
|
1438
1438
|
function Hs(s) {
|
1439
|
-
var e, t, i, n, r, o, a, l, c, d, u,
|
1439
|
+
var e, t, i, n, r, o, a, l, c, d, u, h, p, g, m, E, S;
|
1440
1440
|
if (s.options.typographer) {
|
1441
1441
|
for (S = [], m = s.tokens.length - 1; m >= 0; m--) if (s.tokens[m].type === "inline") {
|
1442
1442
|
for (E = s.tokens[m].children, S.length = 0, e = 0; e < E.length; e++) if (t = E[e], !(t.type !== "text" || qs.test(t.text))) {
|
1443
|
-
for (a = E[e].level,
|
1444
|
-
S.length =
|
1443
|
+
for (a = E[e].level, p = S.length - 1; p >= 0 && !(S[p].level <= a); p--);
|
1444
|
+
S.length = p + 1, i = t.content, r = 0, o = i.length;
|
1445
1445
|
e: for (; r < o && (rn.lastIndex = r, n = rn.exec(i), !!n);) {
|
1446
1446
|
if (l = !an(i, n.index - 1), r = n.index + 1, g = n[0] === "'", c = !an(i, r), !c && !l) {
|
1447
|
-
g && (t.content =
|
1447
|
+
g && (t.content = Fe(t.content, n.index, on));
|
1448
1448
|
continue;
|
1449
1449
|
}
|
1450
|
-
if (u = !c,
|
1451
|
-
for (
|
1452
|
-
d = S[
|
1450
|
+
if (u = !c, h = !l, h) {
|
1451
|
+
for (p = S.length - 1; p >= 0 && (d = S[p], !(S[p].level < a)); p--) if (d.single === g && S[p].level === a) {
|
1452
|
+
d = S[p], g ? (E[d.token].content = Fe(E[d.token].content, d.pos, s.options.quotes[2]), t.content = Fe(t.content, n.index, s.options.quotes[3])) : (E[d.token].content = Fe(E[d.token].content, d.pos, s.options.quotes[0]), t.content = Fe(t.content, n.index, s.options.quotes[1])), S.length = p;
|
1453
1453
|
continue e;
|
1454
1454
|
}
|
1455
1455
|
}
|
@@ -1458,16 +1458,16 @@ function Hs(s) {
|
|
1458
1458
|
pos: n.index,
|
1459
1459
|
single: g,
|
1460
1460
|
level: a
|
1461
|
-
}) :
|
1461
|
+
}) : h && g && (t.content = Fe(t.content, n.index, on));
|
1462
1462
|
}
|
1463
1463
|
}
|
1464
1464
|
}
|
1465
1465
|
}
|
1466
1466
|
}
|
1467
|
-
var
|
1467
|
+
var xi = [["block", As], ["abbr", Is], ["references", Rs], ["inline", Os], ["footnote_tail", Ns], ["abbr2", Ps], ["replacements", zs], ["smartquotes", Hs]];
|
1468
1468
|
function Kn() {
|
1469
1469
|
this.options = {}, this.ruler = new H();
|
1470
|
-
for (var s = 0; s <
|
1470
|
+
for (var s = 0; s < xi.length; s++) this.ruler.push(xi[s][0], xi[s][1]);
|
1471
1471
|
}
|
1472
1472
|
Kn.prototype.process = function (s) {
|
1473
1473
|
var e, t, i;
|
@@ -1570,8 +1570,8 @@ function Ws(s, e, t, i) {
|
|
1570
1570
|
c,
|
1571
1571
|
d,
|
1572
1572
|
u,
|
1573
|
-
p,
|
1574
1573
|
h,
|
1574
|
+
p,
|
1575
1575
|
g,
|
1576
1576
|
m = s.bMarks[e] + s.tShift[e],
|
1577
1577
|
E = s.eMarks[e];
|
@@ -1583,7 +1583,7 @@ function Ws(s, e, t, i) {
|
|
1583
1583
|
continue;
|
1584
1584
|
}
|
1585
1585
|
if (r) break;
|
1586
|
-
for (g = !1,
|
1586
|
+
for (g = !1, h = 0, p = u.length; h < p; h++) if (u[h](s, n, t, !0)) {
|
1587
1587
|
g = !0;
|
1588
1588
|
break;
|
1589
1589
|
}
|
@@ -1597,7 +1597,7 @@ function Ws(s, e, t, i) {
|
|
1597
1597
|
}), s.parser.tokenize(s, e, n), s.tokens.push({
|
1598
1598
|
type: "blockquote_close",
|
1599
1599
|
level: --s.level
|
1600
|
-
}), s.parentType = c, d[1] = s.line,
|
1600
|
+
}), s.parentType = c, d[1] = s.line, h = 0; h < o.length; h++) s.bMarks[h + e] = a[h], s.tShift[h + e] = o[h];
|
1601
1601
|
return s.blkIndent = l, !0;
|
1602
1602
|
}
|
1603
1603
|
function Ks(s, e, t, i) {
|
@@ -1650,21 +1650,21 @@ function Ys(s, e, t, i) {
|
|
1650
1650
|
c,
|
1651
1651
|
d,
|
1652
1652
|
u,
|
1653
|
-
p,
|
1654
1653
|
h,
|
1654
|
+
p,
|
1655
1655
|
g,
|
1656
1656
|
m,
|
1657
1657
|
E,
|
1658
1658
|
S,
|
1659
1659
|
G,
|
1660
|
-
|
1660
|
+
A,
|
1661
1661
|
V,
|
1662
1662
|
Q,
|
1663
1663
|
ee = !0,
|
1664
1664
|
he,
|
1665
1665
|
q,
|
1666
1666
|
en,
|
1667
|
-
|
1667
|
+
bi;
|
1668
1668
|
if ((u = cn(s, e)) >= 0) E = !0;else if ((u = ln(s, e)) >= 0) E = !1;else return !1;
|
1669
1669
|
if (s.level >= s.options.maxNesting) return !1;
|
1670
1670
|
if (m = s.src.charCodeAt(u - 1), i) return !0;
|
@@ -1677,19 +1677,19 @@ function Ys(s, e, t, i) {
|
|
1677
1677
|
type: "bullet_list_open",
|
1678
1678
|
lines: V = [e, 0],
|
1679
1679
|
level: s.level++
|
1680
|
-
}), n = e,
|
1680
|
+
}), n = e, A = !1, he = s.parser.ruler.getRules("list"); n < t && (S = s.skipSpaces(u), h = s.eMarks[n], S >= h ? p = 1 : p = S - u, p > 4 && (p = 1), p < 1 && (p = 1), r = u - s.bMarks[n] + p, s.tokens.push({
|
1681
1681
|
type: "list_item_open",
|
1682
1682
|
lines: Q = [e, 0],
|
1683
1683
|
level: s.level++
|
1684
|
-
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = S - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight ||
|
1684
|
+
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = S - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight || A) && (ee = !1), A = s.line - e > 1 && s.isEmpty(s.line - 1), s.blkIndent = a, s.tShift[e] = o, s.tight = l, s.parentType = c, s.tokens.push({
|
1685
1685
|
type: "list_item_close",
|
1686
1686
|
level: --s.level
|
1687
1687
|
}), n = e = s.line, Q[1] = n, S = s.bMarks[e], !(n >= t || s.isEmpty(n) || s.tShift[n] < s.blkIndent));) {
|
1688
|
-
for (
|
1689
|
-
|
1688
|
+
for (bi = !1, q = 0, en = he.length; q < en; q++) if (he[q](s, n, t, !0)) {
|
1689
|
+
bi = !0;
|
1690
1690
|
break;
|
1691
1691
|
}
|
1692
|
-
if (
|
1692
|
+
if (bi) break;
|
1693
1693
|
if (E) {
|
1694
1694
|
if (u = cn(s, n), u < 0) break;
|
1695
1695
|
} else if (u = ln(s, n), u < 0) break;
|
@@ -1804,27 +1804,27 @@ function ir(s, e, t, i) {
|
|
1804
1804
|
content: s.getLines(e, o, 0, !0)
|
1805
1805
|
}), !0;
|
1806
1806
|
}
|
1807
|
-
function
|
1807
|
+
function Ei(s, e) {
|
1808
1808
|
var t = s.bMarks[e] + s.blkIndent,
|
1809
1809
|
i = s.eMarks[e];
|
1810
1810
|
return s.src.substr(t, i - t);
|
1811
1811
|
}
|
1812
1812
|
function nr(s, e, t, i) {
|
1813
|
-
var n, r, o, a, l, c, d, u,
|
1814
|
-
if (e + 2 > t || (l = e + 1, s.tShift[l] < s.blkIndent) || (o = s.bMarks[l] + s.tShift[l], o >= s.eMarks[l]) || (n = s.src.charCodeAt(o), n !== 124 && n !== 45 && n !== 58) || (r =
|
1813
|
+
var n, r, o, a, l, c, d, u, h, p, g;
|
1814
|
+
if (e + 2 > t || (l = e + 1, s.tShift[l] < s.blkIndent) || (o = s.bMarks[l] + s.tShift[l], o >= s.eMarks[l]) || (n = s.src.charCodeAt(o), n !== 124 && n !== 45 && n !== 58) || (r = Ei(s, e + 1), !/^[-:| ]+$/.test(r)) || (c = r.split("|"), c <= 2)) return !1;
|
1815
1815
|
for (u = [], a = 0; a < c.length; a++) {
|
1816
|
-
if (
|
1816
|
+
if (h = c[a].trim(), !h) {
|
1817
1817
|
if (a === 0 || a === c.length - 1) continue;
|
1818
1818
|
return !1;
|
1819
1819
|
}
|
1820
|
-
if (!/^:?-+:?$/.test(
|
1821
|
-
|
1820
|
+
if (!/^:?-+:?$/.test(h)) return !1;
|
1821
|
+
h.charCodeAt(h.length - 1) === 58 ? u.push(h.charCodeAt(0) === 58 ? "center" : "right") : h.charCodeAt(0) === 58 ? u.push("left") : u.push("");
|
1822
1822
|
}
|
1823
|
-
if (r =
|
1823
|
+
if (r = Ei(s, e).trim(), r.indexOf("|") === -1 || (c = r.replace(/^\||\|$/g, "").split("|"), u.length !== c.length)) return !1;
|
1824
1824
|
if (i) return !0;
|
1825
1825
|
for (s.tokens.push({
|
1826
1826
|
type: "table_open",
|
1827
|
-
lines:
|
1827
|
+
lines: p = [e, 0],
|
1828
1828
|
level: s.level++
|
1829
1829
|
}), s.tokens.push({
|
1830
1830
|
type: "thead_open",
|
@@ -1859,7 +1859,7 @@ function nr(s, e, t, i) {
|
|
1859
1859
|
type: "tbody_open",
|
1860
1860
|
lines: g = [e + 2, 0],
|
1861
1861
|
level: s.level++
|
1862
|
-
}), l = e + 2; l < t && !(s.tShift[l] < s.blkIndent || (r =
|
1862
|
+
}), l = e + 2; l < t && !(s.tShift[l] < s.blkIndent || (r = Ei(s, l).trim(), r.indexOf("|") === -1)); l++) {
|
1863
1863
|
for (c = r.replace(/^\||\|$/g, "").split("|"), s.tokens.push({
|
1864
1864
|
type: "tr_open",
|
1865
1865
|
level: s.level++
|
@@ -1887,7 +1887,7 @@ function nr(s, e, t, i) {
|
|
1887
1887
|
}), s.tokens.push({
|
1888
1888
|
type: "table_close",
|
1889
1889
|
level: --s.level
|
1890
|
-
}),
|
1890
|
+
}), p[1] = g[1] = l, s.line = l, !0;
|
1891
1891
|
}
|
1892
1892
|
function Ct(s, e) {
|
1893
1893
|
var t,
|
@@ -1903,7 +1903,7 @@ function sr(s, e) {
|
|
1903
1903
|
for (t = e + 2, i = s.tokens.length - 2; t < i; t++) s.tokens[t].level === n && s.tokens[t].type === "paragraph_open" && (s.tokens[t + 2].tight = !0, s.tokens[t].tight = !0, t += 2);
|
1904
1904
|
}
|
1905
1905
|
function rr(s, e, t, i) {
|
1906
|
-
var n, r, o, a, l, c, d, u,
|
1906
|
+
var n, r, o, a, l, c, d, u, h, p, g, m, E, S;
|
1907
1907
|
if (i) return s.ddIndent < 0 ? !1 : Ct(s, e) >= 0;
|
1908
1908
|
if (d = e + 1, s.isEmpty(d) && ++d > t || s.tShift[d] < s.blkIndent || (n = Ct(s, d), n < 0) || s.level >= s.options.maxNesting) return !1;
|
1909
1909
|
c = s.tokens.length, s.tokens.push({
|
@@ -1930,7 +1930,7 @@ function rr(s, e, t, i) {
|
|
1930
1930
|
type: "dd_open",
|
1931
1931
|
lines: a = [d, 0],
|
1932
1932
|
level: s.level++
|
1933
|
-
}), m = s.tight,
|
1933
|
+
}), m = s.tight, h = s.ddIndent, u = s.blkIndent, g = s.tShift[r], p = s.parentType, s.blkIndent = s.ddIndent = s.tShift[r] + 2, s.tShift[r] = n - s.bMarks[r], s.tight = !0, s.parentType = "deflist", s.parser.tokenize(s, r, t, !0), (!s.tight || E) && (S = !1), E = s.line - r > 1 && s.isEmpty(s.line - 1), s.tShift[r] = g, s.tight = m, s.parentType = p, s.blkIndent = u, s.ddIndent = h, s.tokens.push({
|
1934
1934
|
type: "dd_close",
|
1935
1935
|
level: --s.level
|
1936
1936
|
}), a[1] = d = s.line, d >= t || s.tShift[d] < s.blkIndent) break e;
|
@@ -1979,13 +1979,13 @@ function or(s, e) {
|
|
1979
1979
|
})), !0;
|
1980
1980
|
}
|
1981
1981
|
var At = [["code", Gs], ["fences", Vs, ["paragraph", "blockquote", "list"]], ["blockquote", Ws, ["paragraph", "blockquote", "list"]], ["hr", Ks, ["paragraph", "blockquote", "list"]], ["list", Ys, ["paragraph", "blockquote"]], ["footnote", $s, ["paragraph"]], ["heading", Zs, ["paragraph", "blockquote"]], ["lheading", Xs], ["htmlblock", ir, ["paragraph", "blockquote"]], ["table", nr, ["paragraph"]], ["deflist", rr, ["paragraph"]], ["paragraph", or]];
|
1982
|
-
function
|
1982
|
+
function qi() {
|
1983
1983
|
this.ruler = new H();
|
1984
1984
|
for (var s = 0; s < At.length; s++) this.ruler.push(At[s][0], At[s][1], {
|
1985
1985
|
alt: (At[s][2] || []).slice()
|
1986
1986
|
});
|
1987
1987
|
}
|
1988
|
-
|
1988
|
+
qi.prototype.tokenize = function (s, e, t) {
|
1989
1989
|
for (var i = this.ruler.getRules(""), n = i.length, r = e, o = !1, a, l; r < t && (s.line = r = s.skipEmptyLines(r), !(r >= t || s.tShift[r] < s.blkIndent));) {
|
1990
1990
|
for (l = 0; l < n && (a = i[l](s, r, t, !1), !a); l++);
|
1991
1991
|
if (s.tight = !o, s.isEmpty(s.line - 1) && (o = !0), r = s.line, r < t && s.isEmpty(r)) {
|
@@ -1997,7 +1997,7 @@ zi.prototype.tokenize = function (s, e, t) {
|
|
1997
1997
|
var ar = /[\n\t]/g,
|
1998
1998
|
lr = /\r[\n\u0085]|[\u2424\u2028\u0085]/g,
|
1999
1999
|
cr = /\u00a0/g;
|
2000
|
-
|
2000
|
+
qi.prototype.parse = function (s, e, t, i) {
|
2001
2001
|
var n,
|
2002
2002
|
r = 0,
|
2003
2003
|
o = 0;
|
@@ -2065,10 +2065,10 @@ function hr(s, e) {
|
|
2065
2065
|
for (n++; n < i && s.src.charCodeAt(n) === 32;) n++;
|
2066
2066
|
return s.pos = n, !0;
|
2067
2067
|
}
|
2068
|
-
var
|
2069
|
-
for (var dn = 0; dn < 256; dn++)
|
2068
|
+
var Ui = [];
|
2069
|
+
for (var dn = 0; dn < 256; dn++) Ui.push(0);
|
2070
2070
|
"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function (s) {
|
2071
|
-
|
2071
|
+
Ui[s.charCodeAt(0)] = 1;
|
2072
2072
|
});
|
2073
2073
|
function pr(s, e) {
|
2074
2074
|
var t,
|
@@ -2076,7 +2076,7 @@ function pr(s, e) {
|
|
2076
2076
|
n = s.posMax;
|
2077
2077
|
if (s.src.charCodeAt(i) !== 92) return !1;
|
2078
2078
|
if (i++, i < n) {
|
2079
|
-
if (t = s.src.charCodeAt(i), t < 256 &&
|
2079
|
+
if (t = s.src.charCodeAt(i), t < 256 && Ui[t] !== 0) return e || (s.pending += s.src[i]), s.pos += 2, !0;
|
2080
2080
|
if (t === 10) {
|
2081
2081
|
for (e || s.push({
|
2082
2082
|
type: "hardbreak",
|
@@ -2307,21 +2307,21 @@ function wr(s, e) {
|
|
2307
2307
|
c,
|
2308
2308
|
d = !1,
|
2309
2309
|
u = s.pos,
|
2310
|
-
|
2311
|
-
|
2312
|
-
g = s.src.charCodeAt(
|
2313
|
-
if (g === 33 && (d = !0, g = s.src.charCodeAt(++
|
2314
|
-
if (a = i + 1, a <
|
2315
|
-
for (a++; a <
|
2316
|
-
if (a >=
|
2317
|
-
for (
|
2318
|
-
if (a <
|
2319
|
-
if (a >=
|
2310
|
+
h = s.posMax,
|
2311
|
+
p = s.pos,
|
2312
|
+
g = s.src.charCodeAt(p);
|
2313
|
+
if (g === 33 && (d = !0, g = s.src.charCodeAt(++p)), g !== 91 || s.level >= s.options.maxNesting || (t = p + 1, i = pt(s, p), i < 0)) return !1;
|
2314
|
+
if (a = i + 1, a < h && s.src.charCodeAt(a) === 40) {
|
2315
|
+
for (a++; a < h && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
2316
|
+
if (a >= h) return !1;
|
2317
|
+
for (p = a, Gn(s, a) ? (r = s.linkContent, a = s.pos) : r = "", p = a; a < h && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
2318
|
+
if (a < h && p !== a && Vn(s, a)) for (o = s.linkContent, a = s.pos; a < h && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);else o = "";
|
2319
|
+
if (a >= h || s.src.charCodeAt(a) !== 41) return s.pos = u, !1;
|
2320
2320
|
a++;
|
2321
2321
|
} else {
|
2322
2322
|
if (s.linkLevel > 0) return !1;
|
2323
|
-
for (; a <
|
2324
|
-
if (a <
|
2323
|
+
for (; a < h && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
2324
|
+
if (a < h && s.src.charCodeAt(a) === 91 && (p = a + 1, a = pt(s, a), a >= 0 ? n = s.src.slice(p, a++) : a = p - 1), n || (_typeof(n) > "u" && (a = i + 1), n = s.src.slice(t, i)), l = s.env.references[Wn(n)], !l) return s.pos = u, !1;
|
2325
2325
|
r = l.href, o = l.title;
|
2326
2326
|
}
|
2327
2327
|
return e || (s.pos = t, s.posMax = i, d ? s.push({
|
@@ -2338,7 +2338,7 @@ function wr(s, e) {
|
|
2338
2338
|
}), s.linkLevel++, s.parser.tokenize(s), s.linkLevel--, s.push({
|
2339
2339
|
type: "link_close",
|
2340
2340
|
level: --s.level
|
2341
|
-
}))), s.pos = a, s.posMax =
|
2341
|
+
}))), s.pos = a, s.posMax = h, !0;
|
2342
2342
|
}
|
2343
2343
|
function _r(s, e) {
|
2344
2344
|
var t,
|
@@ -2387,7 +2387,7 @@ function kr(s, e) {
|
|
2387
2387
|
r,
|
2388
2388
|
o,
|
2389
2389
|
a = s.pos;
|
2390
|
-
return s.src.charCodeAt(a) !== 60 || (t = s.src.slice(a), t.indexOf(">") < 0) ? !1 : (i = t.match(Ar), i ? Tr.indexOf(i[1].toLowerCase()) < 0 || (r = i[0].slice(1, -1), o =
|
2390
|
+
return s.src.charCodeAt(a) !== 60 || (t = s.src.slice(a), t.indexOf(">") < 0) ? !1 : (i = t.match(Ar), i ? Tr.indexOf(i[1].toLowerCase()) < 0 || (r = i[0].slice(1, -1), o = Li(r), !s.parser.validateLink(r)) ? !1 : (e || (s.push({
|
2391
2391
|
type: "link_open",
|
2392
2392
|
href: o,
|
2393
2393
|
level: s.level
|
@@ -2398,7 +2398,7 @@ function kr(s, e) {
|
|
2398
2398
|
}), s.push({
|
2399
2399
|
type: "link_close",
|
2400
2400
|
level: s.level
|
2401
|
-
})), s.pos += i[0].length, !0) : (n = t.match(Cr), n ? (r = n[0].slice(1, -1), o =
|
2401
|
+
})), s.pos += i[0].length, !0) : (n = t.match(Cr), n ? (r = n[0].slice(1, -1), o = Li("mailto:" + r), s.parser.validateLink(o) ? (e || (s.push({
|
2402
2402
|
type: "link_open",
|
2403
2403
|
href: o,
|
2404
2404
|
level: s.level
|
@@ -2411,7 +2411,7 @@ function kr(s, e) {
|
|
2411
2411
|
level: s.level
|
2412
2412
|
})), s.pos += n[0].length, !0) : !1) : !1));
|
2413
2413
|
}
|
2414
|
-
function
|
2414
|
+
function Xt(s, e) {
|
2415
2415
|
return s = s.source, e = e || "", function t(i, n) {
|
2416
2416
|
return i ? (n = n.source || n, s = s.replace(i, n), t) : new RegExp(s, e);
|
2417
2417
|
};
|
@@ -2420,15 +2420,15 @@ var Ir = /[a-zA-Z_:][a-zA-Z0-9:._-]*/,
|
|
2420
2420
|
Lr = /[^"'=<>`\x00-\x20]+/,
|
2421
2421
|
Rr = /'[^']*'/,
|
2422
2422
|
Or = /"[^"]*"/,
|
2423
|
-
Nr =
|
2424
|
-
Pr =
|
2425
|
-
Dr =
|
2423
|
+
Nr = Xt(/(?:unquoted|single_quoted|double_quoted)/)("unquoted", Lr)("single_quoted", Rr)("double_quoted", Or)(),
|
2424
|
+
Pr = Xt(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name", Ir)("attr_value", Nr)(),
|
2425
|
+
Dr = Xt(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute", Pr)(),
|
2426
2426
|
jr = /<\/[A-Za-z][A-Za-z0-9]*\s*>/,
|
2427
2427
|
Br = /<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,
|
2428
2428
|
Fr = /<[?].*?[?]>/,
|
2429
2429
|
zr = /<![A-Z]+\s+[^>]*>/,
|
2430
2430
|
qr = /<!\[CDATA\[[\s\S]*?\]\]>/,
|
2431
|
-
Ur =
|
2431
|
+
Ur = Xt(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag", Dr)("close_tag", jr)("comment", Br)("processing", Fr)("declaration", zr)("cdata", qr)();
|
2432
2432
|
function Hr(s) {
|
2433
2433
|
var e = s | 32;
|
2434
2434
|
return e >= 97 && e <= 122;
|
@@ -2455,7 +2455,7 @@ function Kr(s, e) {
|
|
2455
2455
|
if (s.src.charCodeAt(r) !== 38) return !1;
|
2456
2456
|
if (r + 1 < o) {
|
2457
2457
|
if (t = s.src.charCodeAt(r + 1), t === 35) {
|
2458
|
-
if (n = s.src.slice(r).match(Vr), n) return e || (i = n[1][0].toLowerCase() === "x" ? parseInt(n[1].slice(1), 16) : parseInt(n[1], 10), s.pending += Un(i) ?
|
2458
|
+
if (n = s.src.slice(r).match(Vr), n) return e || (i = n[1][0].toLowerCase() === "x" ? parseInt(n[1].slice(1), 16) : parseInt(n[1], 10), s.pending += Un(i) ? Ii(i) : Ii(65533)), s.pos += n[0].length, !0;
|
2459
2459
|
} else if (n = s.src.slice(r).match(Wr), n) {
|
2460
2460
|
var a = zn(n[1]);
|
2461
2461
|
if (n[1] !== a) return e || (s.pending += a), s.pos += n[0].length, !0;
|
@@ -2463,13 +2463,13 @@ function Kr(s, e) {
|
|
2463
2463
|
}
|
2464
2464
|
return e || (s.pending += "&"), s.pos++, !0;
|
2465
2465
|
}
|
2466
|
-
var
|
2467
|
-
function
|
2466
|
+
var Si = [["text", ur], ["newline", hr], ["escape", pr], ["backticks", fr], ["del", mr], ["ins", gr], ["mark", br], ["emphasis", vr], ["sub", xr], ["sup", Sr], ["links", wr], ["footnote_inline", _r], ["footnote_ref", Mr], ["autolink", kr], ["htmltag", Gr], ["entity", Kr]];
|
2467
|
+
function Qt() {
|
2468
2468
|
this.ruler = new H();
|
2469
|
-
for (var s = 0; s <
|
2469
|
+
for (var s = 0; s < Si.length; s++) this.ruler.push(Si[s][0], Si[s][1]);
|
2470
2470
|
this.validateLink = Jr;
|
2471
2471
|
}
|
2472
|
-
|
2472
|
+
Qt.prototype.skipToken = function (s) {
|
2473
2473
|
var e = this.ruler.getRules(""),
|
2474
2474
|
t = e.length,
|
2475
2475
|
i = s.pos,
|
@@ -2485,7 +2485,7 @@ Xt.prototype.skipToken = function (s) {
|
|
2485
2485
|
}
|
2486
2486
|
s.pos++, s.cacheSet(i, s.pos);
|
2487
2487
|
};
|
2488
|
-
|
2488
|
+
Qt.prototype.tokenize = function (s) {
|
2489
2489
|
for (var e = this.ruler.getRules(""), t = e.length, i = s.posMax, n, r; s.pos < i;) {
|
2490
2490
|
for (r = 0; r < t && (n = e[r](s, !1), !n); r++);
|
2491
2491
|
if (n) {
|
@@ -2496,7 +2496,7 @@ Xt.prototype.tokenize = function (s) {
|
|
2496
2496
|
}
|
2497
2497
|
s.pending && s.pushPending();
|
2498
2498
|
};
|
2499
|
-
|
2499
|
+
Qt.prototype.parse = function (s, e, t, i) {
|
2500
2500
|
var n = new Re(s, this, e, t, i);
|
2501
2501
|
this.tokenize(n);
|
2502
2502
|
};
|
@@ -2626,7 +2626,7 @@ function Yn(s, e, t) {
|
|
2626
2626
|
this.src = e, this.env = t, this.options = s.options, this.tokens = [], this.inlineMode = !1, this.inline = s.inline, this.block = s.block, this.renderer = s.renderer, this.typographer = s.typographer;
|
2627
2627
|
}
|
2628
2628
|
function ue(s, e) {
|
2629
|
-
typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new
|
2629
|
+
typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new Qt(), this.block = new qi(), this.core = new Kn(), this.renderer = new zi(), this.ruler = new H(), this.options = {}, this.configure(Xr[s]), this.set(e || {});
|
2630
2630
|
}
|
2631
2631
|
ue.prototype.set = function (s) {
|
2632
2632
|
qn(this.options, s);
|
@@ -2655,11 +2655,11 @@ ue.prototype.parseInline = function (s, e) {
|
|
2655
2655
|
ue.prototype.renderInline = function (s, e) {
|
2656
2656
|
return e = e || {}, this.renderer.render(this.parseInline(s, e), this.options, e);
|
2657
2657
|
};
|
2658
|
-
var
|
2659
|
-
function
|
2660
|
-
_classCallCheck(this,
|
2658
|
+
var Ri = /*#__PURE__*/function () {
|
2659
|
+
function Ri() {
|
2660
|
+
_classCallCheck(this, Ri);
|
2661
2661
|
}
|
2662
|
-
_createClass(
|
2662
|
+
_createClass(Ri, null, [{
|
2663
2663
|
key: "createNew",
|
2664
2664
|
value: function createNew() {
|
2665
2665
|
var e = window.hljs;
|
@@ -2698,7 +2698,7 @@ var Li = /*#__PURE__*/function () {
|
|
2698
2698
|
});
|
2699
2699
|
}
|
2700
2700
|
}]);
|
2701
|
-
return
|
2701
|
+
return Ri;
|
2702
2702
|
}();
|
2703
2703
|
var $n = /*#__PURE__*/function () {
|
2704
2704
|
function Rt() {
|
@@ -2765,11 +2765,11 @@ var $n = /*#__PURE__*/function () {
|
|
2765
2765
|
}();
|
2766
2766
|
$n.DEFAULT_FILE_NAME = "file";
|
2767
2767
|
var ie = $n;
|
2768
|
-
var
|
2769
|
-
function
|
2770
|
-
_classCallCheck(this,
|
2768
|
+
var Nt = /*#__PURE__*/function () {
|
2769
|
+
function Nt() {
|
2770
|
+
_classCallCheck(this, Nt);
|
2771
2771
|
}
|
2772
|
-
_createClass(
|
2772
|
+
_createClass(Nt, null, [{
|
2773
2773
|
key: "onNewMessage",
|
2774
2774
|
value: function onNewMessage(e, t, i) {
|
2775
2775
|
var n = JSON.parse(JSON.stringify({
|
@@ -2790,8 +2790,15 @@ var Ui = /*#__PURE__*/function () {
|
|
2790
2790
|
value: function onRender(e) {
|
2791
2791
|
e.onComponentRender(), e.dispatchEvent(new CustomEvent("render"));
|
2792
2792
|
}
|
2793
|
+
}, {
|
2794
|
+
key: "onError",
|
2795
|
+
value: function onError(e, t) {
|
2796
|
+
e.onError(t), e.dispatchEvent(new CustomEvent("error", {
|
2797
|
+
detail: t
|
2798
|
+
}));
|
2799
|
+
}
|
2793
2800
|
}]);
|
2794
|
-
return
|
2801
|
+
return Nt;
|
2795
2802
|
}();
|
2796
2803
|
var P = /*#__PURE__*/function () {
|
2797
2804
|
function P() {
|
@@ -2809,7 +2816,7 @@ var P = /*#__PURE__*/function () {
|
|
2809
2816
|
}, {
|
2810
2817
|
key: "applySideStyles",
|
2811
2818
|
value: function applySideStyles(e, t, i, n) {
|
2812
|
-
n && (P.applyCustomStylesToElements(e, i, n.shared), t ===
|
2819
|
+
n && (P.applyCustomStylesToElements(e, i, n.shared), t === x.USER_ROLE ? P.applyCustomStylesToElements(e, i, n.user) : (P.applyCustomStylesToElements(e, i, n.ai), P.applyCustomStylesToElements(e, i, n[t])));
|
2813
2820
|
}
|
2814
2821
|
}, {
|
2815
2822
|
key: "isMessageSideStyles",
|
@@ -2858,7 +2865,7 @@ var le = /*#__PURE__*/function () {
|
|
2858
2865
|
key: "applyCustomStyles",
|
2859
2866
|
value: function applyCustomStyles(e, t, i, n) {
|
2860
2867
|
var r, o, a, l;
|
2861
|
-
if ((r = i["default"]) != null && r.styles && le.applyCustomStylesToElements(e, t, i["default"].styles), n ===
|
2868
|
+
if ((r = i["default"]) != null && r.styles && le.applyCustomStylesToElements(e, t, i["default"].styles), n === x.USER_ROLE) (o = i.user) != null && o.styles && le.applyCustomStylesToElements(e, t, i.user.styles);else {
|
2862
2869
|
(a = i.ai) != null && a.styles && le.applyCustomStylesToElements(e, t, i.ai.styles);
|
2863
2870
|
var c = (l = i[n]) == null ? void 0 : l.styles;
|
2864
2871
|
c && le.applyCustomStylesToElements(e, t, c);
|
@@ -2869,7 +2876,7 @@ var le = /*#__PURE__*/function () {
|
|
2869
2876
|
value: function createAvatar(e, t) {
|
2870
2877
|
var r, o, a, l, c;
|
2871
2878
|
var i = document.createElement("img");
|
2872
|
-
e ===
|
2879
|
+
e === x.USER_ROLE ? i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || eo : i.src = ((a = t == null ? void 0 : t[e]) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t.ai) == null ? void 0 : l.src) || ((c = t == null ? void 0 : t["default"]) == null ? void 0 : c.src) || Qr, i.classList.add("avatar");
|
2873
2880
|
var n = document.createElement("div");
|
2874
2881
|
return n.classList.add("avatar-container"), n.appendChild(i), t && le.applyCustomStyles(n, i, t, e), n;
|
2875
2882
|
}
|
@@ -2879,7 +2886,7 @@ var le = /*#__PURE__*/function () {
|
|
2879
2886
|
var _i2, _i3, _i4;
|
2880
2887
|
var n, r, o, a, l, c;
|
2881
2888
|
var i = (r = (n = t == null ? void 0 : t[e]) == null ? void 0 : n.styles) == null ? void 0 : r.position;
|
2882
|
-
return e !==
|
2889
|
+
return e !== x.USER_ROLE && ((_i2 = i) !== null && _i2 !== void 0 ? _i2 : i = (a = (o = t == null ? void 0 : t.ai) == null ? void 0 : o.styles) == null ? void 0 : a.position), (_i3 = i) !== null && _i3 !== void 0 ? _i3 : i = (c = (l = t == null ? void 0 : t["default"]) == null ? void 0 : l.styles) == null ? void 0 : c.position, (_i4 = i) !== null && _i4 !== void 0 ? _i4 : i = e === x.USER_ROLE ? "right" : "left", i;
|
2883
2890
|
}
|
2884
2891
|
}, {
|
2885
2892
|
key: "add",
|
@@ -2892,56 +2899,56 @@ var le = /*#__PURE__*/function () {
|
|
2892
2899
|
}]);
|
2893
2900
|
return le;
|
2894
2901
|
}();
|
2895
|
-
var
|
2896
|
-
function
|
2897
|
-
_classCallCheck(this,
|
2902
|
+
var Ge = /*#__PURE__*/function () {
|
2903
|
+
function Ge() {
|
2904
|
+
_classCallCheck(this, Ge);
|
2898
2905
|
}
|
2899
|
-
_createClass(
|
2906
|
+
_createClass(Ge, null, [{
|
2900
2907
|
key: "getPosition",
|
2901
2908
|
value: function getPosition(e, t) {
|
2902
2909
|
var _i5, _i6, _i7;
|
2903
2910
|
var n, r, o;
|
2904
2911
|
var i = (n = t == null ? void 0 : t[e]) == null ? void 0 : n.position;
|
2905
|
-
return e !==
|
2912
|
+
return e !== x.USER_ROLE && ((_i5 = i) !== null && _i5 !== void 0 ? _i5 : i = (r = t == null ? void 0 : t.ai) == null ? void 0 : r.position), (_i6 = i) !== null && _i6 !== void 0 ? _i6 : i = (o = t == null ? void 0 : t["default"]) == null ? void 0 : o.position, (_i7 = i) !== null && _i7 !== void 0 ? _i7 : i = e === x.USER_ROLE ? "right" : "left", i;
|
2906
2913
|
}
|
2907
2914
|
}, {
|
2908
2915
|
key: "applyStyle",
|
2909
2916
|
value: function applyStyle(e, t, i) {
|
2910
2917
|
var n, r, o, a;
|
2911
|
-
Object.assign(e.style, (n = i["default"]) == null ? void 0 : n.style), t ===
|
2918
|
+
Object.assign(e.style, (n = i["default"]) == null ? void 0 : n.style), t === x.USER_ROLE ? Object.assign(e.style, (r = i.user) == null ? void 0 : r.style) : (Object.assign(e.style, (o = i.ai) == null ? void 0 : o.style), Object.assign(e.style, (a = i[t]) == null ? void 0 : a.style));
|
2912
2919
|
}
|
2913
2920
|
}, {
|
2914
2921
|
key: "getNameText",
|
2915
2922
|
value: function getNameText(e, t) {
|
2916
2923
|
var i, n, r, o, a, l;
|
2917
|
-
return e ===
|
2924
|
+
return e === x.USER_ROLE ? ((i = t.user) == null ? void 0 : i.text) || ((n = t["default"]) == null ? void 0 : n.text) || "User" : e === x.AI_ROLE ? ((r = t.ai) == null ? void 0 : r.text) || ((o = t["default"]) == null ? void 0 : o.text) || "AI" : ((a = t[e]) == null ? void 0 : a.text) || ((l = t["default"]) == null ? void 0 : l.text) || e;
|
2918
2925
|
}
|
2919
2926
|
}, {
|
2920
2927
|
key: "createName",
|
2921
2928
|
value: function createName(e, t) {
|
2922
2929
|
var i = document.createElement("div");
|
2923
|
-
return i.classList.add("name"), i.textContent =
|
2930
|
+
return i.classList.add("name"), i.textContent = Ge.getNameText(e, t), Ge.applyStyle(i, e, t), i;
|
2924
2931
|
}
|
2925
2932
|
}, {
|
2926
2933
|
key: "add",
|
2927
2934
|
value: function add(e, t, i) {
|
2928
2935
|
var n = typeof i == "boolean" ? {} : i,
|
2929
|
-
r =
|
2930
|
-
o =
|
2936
|
+
r = Ge.createName(t, n),
|
2937
|
+
o = Ge.getPosition(t, n);
|
2931
2938
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
2932
2939
|
}
|
2933
2940
|
}]);
|
2934
|
-
return
|
2941
|
+
return Ge;
|
2935
2942
|
}();
|
2936
|
-
var
|
2937
|
-
function
|
2943
|
+
var We = /*#__PURE__*/function () {
|
2944
|
+
function We(e) {
|
2938
2945
|
var _this3 = this;
|
2939
|
-
_classCallCheck(this,
|
2940
|
-
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef =
|
2946
|
+
_classCallCheck(this, We);
|
2947
|
+
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef = We.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = Ri.createNew(), this._avatars = e.avatars, this._names = e.names, this._onNewMessage = Nt.onNewMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(function () {
|
2941
2948
|
_this3.submitUserMessage = e.submitUserMessage;
|
2942
2949
|
});
|
2943
2950
|
}
|
2944
|
-
_createClass(
|
2951
|
+
_createClass(We, [{
|
2945
2952
|
key: "addNewTextMessage",
|
2946
2953
|
value: function addNewTextMessage(e, t) {
|
2947
2954
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
@@ -2950,15 +2957,15 @@ var Ve = /*#__PURE__*/function () {
|
|
2950
2957
|
if (r) return r;
|
2951
2958
|
}
|
2952
2959
|
var n = this.createAndAppendNewMessageElement(e, t);
|
2953
|
-
return n.bubbleElement.classList.add("text-message"), this.applyCustomStyles(n, t, !1),
|
2960
|
+
return n.bubbleElement.classList.add("text-message"), this.applyCustomStyles(n, t, !1), x.fillEmptyMessageElement(n.bubbleElement, e), this.textElementsToText.push([n, e]), n;
|
2954
2961
|
}
|
2955
2962
|
}, {
|
2956
2963
|
key: "overwriteText",
|
2957
2964
|
value: function overwriteText(e, t, i) {
|
2958
|
-
var n =
|
2965
|
+
var n = x.overwriteMessage(this.messages, i, t, e, "text", "text-message");
|
2959
2966
|
if (n) {
|
2960
2967
|
this.renderText(n.bubbleElement, t);
|
2961
|
-
var r =
|
2968
|
+
var r = x.getLastTextToElement(this.textElementsToText, n);
|
2962
2969
|
r && (r[1] = t);
|
2963
2970
|
}
|
2964
2971
|
return n;
|
@@ -2978,12 +2985,12 @@ var Ve = /*#__PURE__*/function () {
|
|
2978
2985
|
var n;
|
2979
2986
|
(n = this._introPanel) == null || n.hide();
|
2980
2987
|
var i = this.messageElementRefs[this.messageElementRefs.length - 1];
|
2981
|
-
return
|
2988
|
+
return We.isTemporaryElement(i) && (i.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t);
|
2982
2989
|
}
|
2983
2990
|
}, {
|
2984
2991
|
key: "createMessageElements",
|
2985
2992
|
value: function createMessageElements(e, t) {
|
2986
|
-
var i =
|
2993
|
+
var i = We.createBaseElements(),
|
2987
2994
|
n = i.outerContainer,
|
2988
2995
|
r = i.innerContainer,
|
2989
2996
|
o = i.bubbleElement;
|
@@ -2994,7 +3001,7 @@ var Ve = /*#__PURE__*/function () {
|
|
2994
3001
|
value:
|
2995
3002
|
// prettier-ignore
|
2996
3003
|
function addInnerContainerElements(e, t, i) {
|
2997
|
-
return e.classList.add("message-bubble",
|
3004
|
+
return e.classList.add("message-bubble", x.getRoleClass(i), i === x.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), this._avatars && le.add(e, i, this._avatars), this._names && Ge.add(e, i, this._names), {
|
2998
3005
|
bubbleElement: e
|
2999
3006
|
};
|
3000
3007
|
}
|
@@ -3021,7 +3028,7 @@ var Ve = /*#__PURE__*/function () {
|
|
3021
3028
|
key: "refreshTextMessages",
|
3022
3029
|
value: function refreshTextMessages() {
|
3023
3030
|
var _this5 = this;
|
3024
|
-
this._remarkable =
|
3031
|
+
this._remarkable = Ri.createNew(), this.textElementsToText.forEach(function (e) {
|
3025
3032
|
_this5.renderText(e[0].bubbleElement, e[1]);
|
3026
3033
|
});
|
3027
3034
|
}
|
@@ -3058,12 +3065,12 @@ var Ve = /*#__PURE__*/function () {
|
|
3058
3065
|
r = e._sessionId,
|
3059
3066
|
o = e.role,
|
3060
3067
|
a = {
|
3061
|
-
role: o ||
|
3068
|
+
role: o || x.AI_ROLE
|
3062
3069
|
};
|
3063
3070
|
return t && (a.text = t), i && (a.files = i), n && (a.html = n), !t && !i && !n && (a.text = ""), r && (a._sessionId = r), a;
|
3064
3071
|
}
|
3065
3072
|
}]);
|
3066
|
-
return
|
3073
|
+
return We;
|
3067
3074
|
}();
|
3068
3075
|
var Hi = /*#__PURE__*/function () {
|
3069
3076
|
// used for extracting at end and for isStreaming
|
@@ -3090,13 +3097,13 @@ var Hi = /*#__PURE__*/function () {
|
|
3090
3097
|
key: "setInitialState",
|
3091
3098
|
value: function setInitialState(e, t, i) {
|
3092
3099
|
var _i8;
|
3093
|
-
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i =
|
3100
|
+
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = x.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : Ye.add(this._messages, t, i, this._messages.messageElementRefs), this._activeMessageContent = this._messages.messages[this._messages.messages.length - 1], this._elements.bubbleElement.classList.add(it.MESSAGE_CLASS), this._streamedContent = t;
|
3094
3101
|
}
|
3095
3102
|
}, {
|
3096
3103
|
key: "updateBasedOnType",
|
3097
3104
|
value: function updateBasedOnType(e, t, i) {
|
3098
3105
|
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
3099
|
-
|
3106
|
+
x.unfillEmptyMessageElement(i, e), (t === "text" ? this.updateText : this.updateHTML).bind(this)(e, i, n);
|
3100
3107
|
}
|
3101
3108
|
}, {
|
3102
3109
|
key: "updateText",
|
@@ -3118,14 +3125,14 @@ var Hi = /*#__PURE__*/function () {
|
|
3118
3125
|
var _this$_messages = this._messages,
|
3119
3126
|
e = _this$_messages.textElementsToText,
|
3120
3127
|
t = _this$_messages.elementRef;
|
3121
|
-
(i =
|
3128
|
+
(i = x.getLastMessageBubbleElement(t)) != null && i.classList.contains(it.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._activeMessageContent && (this._activeMessageContent.text = this._streamedContent), this._messages.textToSpeech && Lt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === it.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((n = x.getLastMessageBubbleElement(this._messages.elementRef)) == null ? void 0 : n.innerHTML) || ""), this._elements && se.apply(this._messages, this._elements.outerContainer), this._activeMessageContent && (this._activeMessageContent.html = this._streamedContent)), this._activeMessageContent && this._messages.sendClientUpdate(We.createMessageContent(this._activeMessageContent), !1), this._hasStreamEnded = !0);
|
3122
3129
|
}
|
3123
3130
|
}]);
|
3124
3131
|
return it;
|
3125
3132
|
}();
|
3126
3133
|
Hi.MESSAGE_CLASS = "streamed-message";
|
3127
3134
|
Hi.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3128
|
-
var
|
3135
|
+
var $e = Hi;
|
3129
3136
|
var Zn = /*#__PURE__*/function () {
|
3130
3137
|
function nt() {
|
3131
3138
|
_classCallCheck(this, nt);
|
@@ -3353,7 +3360,7 @@ var ro = globalThis && globalThis.__rest || function (s, e) {
|
|
3353
3360
|
if (s != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, i = Object.getOwnPropertySymbols(s); n < i.length; n++) e.indexOf(i[n]) < 0 && Object.prototype.propertyIsEnumerable.call(s, i[n]) && (t[i[n]] = s[i[n]]);
|
3354
3361
|
return t;
|
3355
3362
|
};
|
3356
|
-
var
|
3363
|
+
var Oi = "text/event-stream",
|
3357
3364
|
oo = 1e3,
|
3358
3365
|
fn = "last-event-id";
|
3359
3366
|
function ao(s, e) {
|
@@ -3366,9 +3373,9 @@ function ao(s, e) {
|
|
3366
3373
|
l = e.openWhenHidden,
|
3367
3374
|
c = e.fetch,
|
3368
3375
|
d = ro(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
3369
|
-
return new Promise(function (u,
|
3370
|
-
var
|
3371
|
-
|
3376
|
+
return new Promise(function (u, h) {
|
3377
|
+
var p = Object.assign({}, i);
|
3378
|
+
p.accept || (p.accept = Oi);
|
3372
3379
|
var g;
|
3373
3380
|
function m() {
|
3374
3381
|
g.abort(), document.hidden || Q();
|
@@ -3382,7 +3389,7 @@ function ao(s, e) {
|
|
3382
3389
|
t == null || t.addEventListener("abort", function () {
|
3383
3390
|
G(), u();
|
3384
3391
|
});
|
3385
|
-
var
|
3392
|
+
var A = c !== null && c !== void 0 ? c : window.fetch,
|
3386
3393
|
V = n !== null && n !== void 0 ? n : lo;
|
3387
3394
|
function Q() {
|
3388
3395
|
return _Q.apply(this, arguments);
|
@@ -3396,8 +3403,8 @@ function ao(s, e) {
|
|
3396
3403
|
g = new AbortController();
|
3397
3404
|
_context3.prev = 1;
|
3398
3405
|
_context3.next = 4;
|
3399
|
-
return
|
3400
|
-
headers:
|
3406
|
+
return A(s, Object.assign(Object.assign({}, d), {
|
3407
|
+
headers: p,
|
3401
3408
|
signal: g.signal
|
3402
3409
|
}));
|
3403
3410
|
case 4:
|
@@ -3407,7 +3414,7 @@ function ao(s, e) {
|
|
3407
3414
|
case 7:
|
3408
3415
|
_context3.next = 9;
|
3409
3416
|
return to(he.body, io(no(function (q) {
|
3410
|
-
q ?
|
3417
|
+
q ? p[fn] = q : delete p[fn];
|
3411
3418
|
}, function (q) {
|
3412
3419
|
E = q;
|
3413
3420
|
}, r)));
|
@@ -3424,7 +3431,7 @@ function ao(s, e) {
|
|
3424
3431
|
q = (ee = a == null ? void 0 : a(_context3.t0)) !== null && ee !== void 0 ? ee : E;
|
3425
3432
|
window.clearTimeout(S), S = window.setTimeout(Q, q);
|
3426
3433
|
} catch (q) {
|
3427
|
-
G(),
|
3434
|
+
G(), h(q);
|
3428
3435
|
}
|
3429
3436
|
case 17:
|
3430
3437
|
case "end":
|
@@ -3439,7 +3446,7 @@ function ao(s, e) {
|
|
3439
3446
|
}
|
3440
3447
|
function lo(s) {
|
3441
3448
|
var e = s.headers.get("content-type");
|
3442
|
-
if (!(e != null && e.startsWith(
|
3449
|
+
if (!(e != null && e.startsWith(Oi))) throw new Error("Expected content-type to be ".concat(Oi, ", Actual: ").concat(e));
|
3443
3450
|
}
|
3444
3451
|
var Xn = /*#__PURE__*/function () {
|
3445
3452
|
function st() {
|
@@ -3493,7 +3500,7 @@ var Xn = /*#__PURE__*/function () {
|
|
3493
3500
|
_context4.t0 = i;
|
3494
3501
|
case 5:
|
3495
3502
|
n = _context4.t0;
|
3496
|
-
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) :
|
3503
|
+
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) : C.isSimulation(e.deepChat.stream) ? C.simulate(t, e.streamHandlers, n) : (t.addNewMessage(n), e.completionsHandlers.onFinish());
|
3497
3504
|
case 7:
|
3498
3505
|
case "end":
|
3499
3506
|
return _context4.stop();
|
@@ -3507,7 +3514,7 @@ var Xn = /*#__PURE__*/function () {
|
|
3507
3514
|
value: function requestStream(e, t) {
|
3508
3515
|
setTimeout(function () {
|
3509
3516
|
var i = st.getResponse(e);
|
3510
|
-
|
3517
|
+
C.simulate(e, t, i);
|
3511
3518
|
}, 400);
|
3512
3519
|
}
|
3513
3520
|
}]);
|
@@ -3515,17 +3522,17 @@ var Xn = /*#__PURE__*/function () {
|
|
3515
3522
|
}();
|
3516
3523
|
Xn.URL = "deep-chat-demo";
|
3517
3524
|
var be = Xn;
|
3518
|
-
var
|
3519
|
-
function
|
3520
|
-
_classCallCheck(this,
|
3525
|
+
var C = /*#__PURE__*/function () {
|
3526
|
+
function C() {
|
3527
|
+
_classCallCheck(this, C);
|
3521
3528
|
}
|
3522
|
-
_createClass(
|
3529
|
+
_createClass(C, null, [{
|
3523
3530
|
key: "request",
|
3524
3531
|
value: // prettier-ignore
|
3525
3532
|
function () {
|
3526
3533
|
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e, t, i) {
|
3527
3534
|
var n,
|
3528
|
-
|
3535
|
+
p,
|
3529
3536
|
g,
|
3530
3537
|
m,
|
3531
3538
|
E,
|
@@ -3540,7 +3547,7 @@ var T = /*#__PURE__*/function () {
|
|
3540
3547
|
c,
|
3541
3548
|
d,
|
3542
3549
|
u,
|
3543
|
-
|
3550
|
+
h,
|
3544
3551
|
_args6 = arguments;
|
3545
3552
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
3546
3553
|
while (1) switch (_context6.prev = _context6.next) {
|
@@ -3548,7 +3555,7 @@ var T = /*#__PURE__*/function () {
|
|
3548
3555
|
n = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : !0;
|
3549
3556
|
r = {
|
3550
3557
|
body: t,
|
3551
|
-
headers: (
|
3558
|
+
headers: (p = e.requestSettings) == null ? void 0 : p.headers
|
3552
3559
|
};
|
3553
3560
|
_context6.next = 4;
|
3554
3561
|
return _.processRequestInterceptor(e.deepChat, r);
|
@@ -3565,7 +3572,7 @@ var T = /*#__PURE__*/function () {
|
|
3565
3572
|
_context6.next = 14;
|
3566
3573
|
break;
|
3567
3574
|
}
|
3568
|
-
return _context6.abrupt("return",
|
3575
|
+
return _context6.abrupt("return", C.onInterceptorError(i, l, d));
|
3569
3576
|
case 14:
|
3570
3577
|
if (!((g = e.requestSettings) != null && g.handler)) {
|
3571
3578
|
_context6.next = 16;
|
@@ -3579,7 +3586,7 @@ var T = /*#__PURE__*/function () {
|
|
3579
3586
|
}
|
3580
3587
|
return _context6.abrupt("return", be.requestStream(i, e.streamHandlers));
|
3581
3588
|
case 18:
|
3582
|
-
|
3589
|
+
h = new $e(i);
|
3583
3590
|
ao(((E = e.requestSettings) == null ? void 0 : E.url) || e.url || "", {
|
3584
3591
|
method: ((S = e.requestSettings) == null ? void 0 : S.method) || "POST",
|
3585
3592
|
headers: a,
|
@@ -3587,19 +3594,19 @@ var T = /*#__PURE__*/function () {
|
|
3587
3594
|
body: n ? JSON.stringify(o) : o,
|
3588
3595
|
openWhenHidden: !0,
|
3589
3596
|
// keep stream open when browser tab not open
|
3590
|
-
onopen: function onopen(
|
3597
|
+
onopen: function onopen(A) {
|
3591
3598
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
3592
3599
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
3593
3600
|
while (1) switch (_context5.prev = _context5.next) {
|
3594
3601
|
case 0:
|
3595
|
-
if (!
|
3602
|
+
if (!A.ok) {
|
3596
3603
|
_context5.next = 2;
|
3597
3604
|
break;
|
3598
3605
|
}
|
3599
3606
|
return _context5.abrupt("return", c());
|
3600
3607
|
case 2:
|
3601
3608
|
_context5.next = 4;
|
3602
|
-
return _.processResponseByType(
|
3609
|
+
return _.processResponseByType(A);
|
3603
3610
|
case 4:
|
3604
3611
|
throw _context5.sent;
|
3605
3612
|
case 5:
|
@@ -3609,28 +3616,28 @@ var T = /*#__PURE__*/function () {
|
|
3609
3616
|
}, _callee5);
|
3610
3617
|
}))();
|
3611
3618
|
},
|
3612
|
-
onmessage: function onmessage(
|
3619
|
+
onmessage: function onmessage(A) {
|
3613
3620
|
var V;
|
3614
|
-
if (JSON.stringify(
|
3615
|
-
var Q = JSON.parse(
|
3621
|
+
if (JSON.stringify(A.data) !== JSON.stringify("[DONE]")) {
|
3622
|
+
var Q = JSON.parse(A.data);
|
3616
3623
|
(V = e.extractResultData) == null || V.call(e, Q).then(function (ee) {
|
3617
|
-
|
3624
|
+
h.upsertStreamedMessage(ee);
|
3618
3625
|
})["catch"](function (ee) {
|
3619
3626
|
return _.displayError(i, ee);
|
3620
3627
|
});
|
3621
3628
|
}
|
3622
3629
|
},
|
3623
|
-
onerror: function onerror(
|
3624
|
-
throw d(),
|
3630
|
+
onerror: function onerror(A) {
|
3631
|
+
throw d(), A;
|
3625
3632
|
},
|
3626
3633
|
onclose: function onclose() {
|
3627
|
-
|
3634
|
+
h.finaliseStreamedMessage(), d();
|
3628
3635
|
},
|
3629
3636
|
signal: u.signal
|
3630
|
-
})["catch"](function (
|
3637
|
+
})["catch"](function (A) {
|
3631
3638
|
var V;
|
3632
|
-
(V = e.extractResultData) == null || V.call(e,
|
3633
|
-
_.displayError(i,
|
3639
|
+
(V = e.extractResultData) == null || V.call(e, A).then(function () {
|
3640
|
+
_.displayError(i, A);
|
3634
3641
|
})["catch"](function (Q) {
|
3635
3642
|
_.displayError(i, Q);
|
3636
3643
|
});
|
@@ -3661,7 +3668,7 @@ var T = /*#__PURE__*/function () {
|
|
3661
3668
|
}, i), !1), i.text) {
|
3662
3669
|
t.onOpen();
|
3663
3670
|
var r = i.text.split("");
|
3664
|
-
|
3671
|
+
C.populateMessages(r, new $e(e), n);
|
3665
3672
|
}
|
3666
3673
|
}
|
3667
3674
|
}, {
|
@@ -3674,10 +3681,10 @@ var T = /*#__PURE__*/function () {
|
|
3674
3681
|
text: r
|
3675
3682
|
});
|
3676
3683
|
var o = setTimeout(function () {
|
3677
|
-
|
3684
|
+
C.populateMessages(e, t, i, n + 1);
|
3678
3685
|
}, i.simulationInterim || 6);
|
3679
3686
|
i.abortStream.abort = function () {
|
3680
|
-
|
3687
|
+
C.abort(o, t, i.onClose);
|
3681
3688
|
};
|
3682
3689
|
} else t.finaliseStreamedMessage(), i.onClose();
|
3683
3690
|
}
|
@@ -3692,7 +3699,7 @@ var T = /*#__PURE__*/function () {
|
|
3692
3699
|
clearTimeout(e), t.finaliseStreamedMessage(), i();
|
3693
3700
|
}
|
3694
3701
|
}]);
|
3695
|
-
return
|
3702
|
+
return C;
|
3696
3703
|
}();
|
3697
3704
|
var Ce = /*#__PURE__*/function () {
|
3698
3705
|
function Ce() {
|
@@ -3709,7 +3716,7 @@ var Ce = /*#__PURE__*/function () {
|
|
3709
3716
|
n = !0;
|
3710
3717
|
r = /*#__PURE__*/function () {
|
3711
3718
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(c) {
|
3712
|
-
var u,
|
3719
|
+
var u, h, d;
|
3713
3720
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
3714
3721
|
while (1) switch (_context7.prev = _context7.next) {
|
3715
3722
|
case 0:
|
@@ -3721,7 +3728,7 @@ var Ce = /*#__PURE__*/function () {
|
|
3721
3728
|
case 2:
|
3722
3729
|
n = !1;
|
3723
3730
|
_context7.next = 5;
|
3724
|
-
return (
|
3731
|
+
return (h = (u = e.deepChat).responseInterceptor) == null ? void 0 : h.call(u, c);
|
3725
3732
|
case 5:
|
3726
3733
|
_context7.t0 = _context7.sent;
|
3727
3734
|
if (_context7.t0) {
|
@@ -3731,7 +3738,7 @@ var Ce = /*#__PURE__*/function () {
|
|
3731
3738
|
_context7.t0 = c;
|
3732
3739
|
case 8:
|
3733
3740
|
d = _context7.t0;
|
3734
|
-
_.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) :
|
3741
|
+
_.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : C.isSimulation(e.deepChat.stream) ? C.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(I.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
|
3735
3742
|
case 10:
|
3736
3743
|
case "end":
|
3737
3744
|
return _context7.stop();
|
@@ -3759,24 +3766,24 @@ var Ce = /*#__PURE__*/function () {
|
|
3759
3766
|
}, {
|
3760
3767
|
key: "stream",
|
3761
3768
|
value: function stream(e, t, i) {
|
3762
|
-
var u,
|
3769
|
+
var u, h;
|
3763
3770
|
var n = !0,
|
3764
3771
|
r = !1;
|
3765
|
-
var o = new
|
3772
|
+
var o = new $e(i),
|
3766
3773
|
a = function a() {
|
3767
3774
|
r || !n || (e.streamHandlers.onOpen(), r = !0);
|
3768
3775
|
},
|
3769
3776
|
l = function l() {
|
3770
3777
|
n && (o.finaliseStreamedMessage(), e.streamHandlers.onClose(), n = !1);
|
3771
3778
|
},
|
3772
|
-
c = function c(
|
3773
|
-
n && (!
|
3779
|
+
c = function c(p) {
|
3780
|
+
n && (!p || _typeof(p) != "object" || typeof p.error != "string" && typeof p.html != "string" && typeof p.text != "string" ? console.error(I.INVALID_RESPONSE(p, "server", !1)) : p.error ? (console.error(p.error), o.finaliseStreamedMessage(), e.streamHandlers.onClose(), i.addNewErrorMessage("service", p.error), n = !1) : o.upsertStreamedMessage(p));
|
3774
3781
|
};
|
3775
3782
|
e.streamHandlers.abortStream.abort = function () {
|
3776
3783
|
o.finaliseStreamedMessage(), e.streamHandlers.onClose(), n = !1;
|
3777
3784
|
};
|
3778
3785
|
var d = Ce.generateOptionalSignals();
|
3779
|
-
(
|
3786
|
+
(h = (u = e.requestSettings).handler) == null || h.call(u, t, _objectSpread(_objectSpread({}, d), {}, {
|
3780
3787
|
onOpen: a,
|
3781
3788
|
onResponse: c,
|
3782
3789
|
onClose: l,
|
@@ -3803,7 +3810,7 @@ var Ce = /*#__PURE__*/function () {
|
|
3803
3810
|
},
|
3804
3811
|
o = /*#__PURE__*/function () {
|
3805
3812
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(d) {
|
3806
|
-
var
|
3813
|
+
var h, p, u;
|
3807
3814
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
3808
3815
|
while (1) switch (_context9.prev = _context9.next) {
|
3809
3816
|
case 0:
|
@@ -3814,7 +3821,7 @@ var Ce = /*#__PURE__*/function () {
|
|
3814
3821
|
return _context9.abrupt("return");
|
3815
3822
|
case 2:
|
3816
3823
|
_context9.next = 4;
|
3817
|
-
return (
|
3824
|
+
return (p = (h = e.deepChat).responseInterceptor) == null ? void 0 : p.call(h, d);
|
3818
3825
|
case 4:
|
3819
3826
|
_context9.t0 = _context9.sent;
|
3820
3827
|
if (_context9.t0) {
|
@@ -3824,7 +3831,7 @@ var Ce = /*#__PURE__*/function () {
|
|
3824
3831
|
_context9.t0 = d;
|
3825
3832
|
case 7:
|
3826
3833
|
u = _context9.t0;
|
3827
|
-
_.validateResponseFormat(u) ? typeof u.error == "string" ? (console.error(u.error), t.isLastMessageError() || t.addNewErrorMessage("service", u.error)) : e.deepChat.stream ?
|
3834
|
+
_.validateResponseFormat(u) ? typeof u.error == "string" ? (console.error(u.error), t.isLastMessageError() || t.addNewErrorMessage("service", u.error)) : e.deepChat.stream ? C.simulate(t, e.streamHandlers, u) : t.addNewMessage(u) : (console.error(I.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, u)), t.addNewErrorMessage("service", "Error in server message"));
|
3828
3835
|
case 9:
|
3829
3836
|
case "end":
|
3830
3837
|
return _context9.stop();
|
@@ -3870,8 +3877,8 @@ var w = /*#__PURE__*/function () {
|
|
3870
3877
|
function () {
|
3871
3878
|
var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(e, t, i) {
|
3872
3879
|
var n,
|
3873
|
-
p,
|
3874
3880
|
h,
|
3881
|
+
p,
|
3875
3882
|
g,
|
3876
3883
|
r,
|
3877
3884
|
_yield$_$processReque2,
|
@@ -3888,7 +3895,7 @@ var w = /*#__PURE__*/function () {
|
|
3888
3895
|
n = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : !0;
|
3889
3896
|
r = {
|
3890
3897
|
body: t,
|
3891
|
-
headers: (
|
3898
|
+
headers: (h = e.requestSettings) == null ? void 0 : h.headers
|
3892
3899
|
};
|
3893
3900
|
_context11.next = 4;
|
3894
3901
|
return _.processRequestInterceptor(e.deepChat, r);
|
@@ -3904,7 +3911,7 @@ var w = /*#__PURE__*/function () {
|
|
3904
3911
|
}
|
3905
3912
|
return _context11.abrupt("return", w.onInterceptorError(i, l, c));
|
3906
3913
|
case 11:
|
3907
|
-
if (!((
|
3914
|
+
if (!((p = e.requestSettings) != null && p.handler)) {
|
3908
3915
|
_context11.next = 13;
|
3909
3916
|
break;
|
3910
3917
|
}
|
@@ -3924,7 +3931,7 @@ var w = /*#__PURE__*/function () {
|
|
3924
3931
|
return _.processResponseByType(m);
|
3925
3932
|
}).then( /*#__PURE__*/function () {
|
3926
3933
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(m) {
|
3927
|
-
var G,
|
3934
|
+
var G, A, E, S;
|
3928
3935
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
3929
3936
|
while (1) switch (_context10.prev = _context10.next) {
|
3930
3937
|
case 0:
|
@@ -3935,7 +3942,7 @@ var w = /*#__PURE__*/function () {
|
|
3935
3942
|
return _context10.abrupt("return");
|
3936
3943
|
case 2:
|
3937
3944
|
_context10.next = 4;
|
3938
|
-
return (
|
3945
|
+
return (A = (G = e.deepChat).responseInterceptor) == null ? void 0 : A.call(G, m);
|
3939
3946
|
case 4:
|
3940
3947
|
_context10.t0 = _context10.sent;
|
3941
3948
|
if (_context10.t0) {
|
@@ -3961,7 +3968,7 @@ var w = /*#__PURE__*/function () {
|
|
3961
3968
|
}
|
3962
3969
|
throw Error(I.INVALID_RESPONSE(m, "response", !!e.deepChat.responseInterceptor, E));
|
3963
3970
|
case 15:
|
3964
|
-
S.makingAnotherRequest || (
|
3971
|
+
S.makingAnotherRequest || (C.isSimulation(e.deepChat.stream) ? C.simulate(i, e.streamHandlers, S) : (i.addNewMessage(S), c()));
|
3965
3972
|
case 16:
|
3966
3973
|
case "end":
|
3967
3974
|
return _context10.stop();
|
@@ -4021,7 +4028,7 @@ var w = /*#__PURE__*/function () {
|
|
4021
4028
|
a = _context12.sent;
|
4022
4029
|
a.timeoutMS ? setTimeout(function () {
|
4023
4030
|
w.executePollRequest(e, t, i, n);
|
4024
|
-
}, a.timeoutMS) :
|
4031
|
+
}, a.timeoutMS) : C.isSimulation(e.deepChat.stream) ? C.simulate(n, e.streamHandlers, a) : (n.addNewMessage(a), r());
|
4025
4032
|
case 13:
|
4026
4033
|
case "end":
|
4027
4034
|
return _context12.stop();
|
@@ -4041,7 +4048,7 @@ var w = /*#__PURE__*/function () {
|
|
4041
4048
|
value: function () {
|
4042
4049
|
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, i) {
|
4043
4050
|
var n,
|
4044
|
-
|
4051
|
+
p,
|
4045
4052
|
g,
|
4046
4053
|
m,
|
4047
4054
|
r,
|
@@ -4052,7 +4059,7 @@ var w = /*#__PURE__*/function () {
|
|
4052
4059
|
c,
|
4053
4060
|
d,
|
4054
4061
|
u,
|
4055
|
-
|
4062
|
+
h,
|
4056
4063
|
_args13 = arguments;
|
4057
4064
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
4058
4065
|
while (1) switch (_context13.prev = _context13.next) {
|
@@ -4060,7 +4067,7 @@ var w = /*#__PURE__*/function () {
|
|
4060
4067
|
n = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : !0;
|
4061
4068
|
r = {
|
4062
4069
|
body: t,
|
4063
|
-
headers: (
|
4070
|
+
headers: (p = e.requestSettings) == null ? void 0 : p.headers
|
4064
4071
|
};
|
4065
4072
|
_context13.next = 4;
|
4066
4073
|
return _.processRequestInterceptor(e.deepChat, r);
|
@@ -4075,12 +4082,12 @@ var w = /*#__PURE__*/function () {
|
|
4075
4082
|
}
|
4076
4083
|
return _context13.abrupt("return", w.onInterceptorError(i, l));
|
4077
4084
|
case 10:
|
4078
|
-
c = ((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", u = n ? JSON.stringify(o) : o,
|
4085
|
+
c = ((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", u = n ? JSON.stringify(o) : o, h = {
|
4079
4086
|
method: d,
|
4080
4087
|
body: u,
|
4081
4088
|
headers: a
|
4082
4089
|
};
|
4083
|
-
e.requestSettings.credentials && (
|
4090
|
+
e.requestSettings.credentials && (h.credentials = e.requestSettings.credentials), w.executePollRequest(e, c, h, i);
|
4084
4091
|
case 12:
|
4085
4092
|
case "end":
|
4086
4093
|
return _context13.stop();
|
@@ -4117,11 +4124,11 @@ var w = /*#__PURE__*/function () {
|
|
4117
4124
|
}]);
|
4118
4125
|
return w;
|
4119
4126
|
}();
|
4120
|
-
var
|
4121
|
-
function
|
4122
|
-
_classCallCheck(this,
|
4127
|
+
var Ze = /*#__PURE__*/function () {
|
4128
|
+
function Ze() {
|
4129
|
+
_classCallCheck(this, Ze);
|
4123
4130
|
}
|
4124
|
-
_createClass(
|
4131
|
+
_createClass(Ze, null, [{
|
4125
4132
|
key: "getCharacterLimitMessages",
|
4126
4133
|
value: function getCharacterLimitMessages(e, t) {
|
4127
4134
|
var r;
|
@@ -4149,10 +4156,10 @@ var $e = /*#__PURE__*/function () {
|
|
4149
4156
|
}, {
|
4150
4157
|
key: "processMessages",
|
4151
4158
|
value: function processMessages(e, t, i) {
|
4152
|
-
return t !== void 0 ? t > 0 && (e =
|
4159
|
+
return t !== void 0 ? t > 0 && (e = Ze.getMaxMessages(e, t)) : e = [e[e.length - 1]], e = JSON.parse(JSON.stringify(e)), i === void 0 ? e : Ze.getCharacterLimitMessages(e, i);
|
4153
4160
|
}
|
4154
4161
|
}]);
|
4155
|
-
return
|
4162
|
+
return Ze;
|
4156
4163
|
}();
|
4157
4164
|
var Y = /*#__PURE__*/function () {
|
4158
4165
|
function Y() {
|
@@ -4228,7 +4235,7 @@ var Y = /*#__PURE__*/function () {
|
|
4228
4235
|
}
|
4229
4236
|
throw Error(I.INVALID_RESPONSE(a, "server", !!e.deepChat.responseInterceptor, l));
|
4230
4237
|
case 14:
|
4231
|
-
|
4238
|
+
C.isSimulation(e.deepChat.stream) ? C.simulate(i, e.streamHandlers, c) : i.addNewMessage(c);
|
4232
4239
|
_context14.next = 20;
|
4233
4240
|
break;
|
4234
4241
|
case 17:
|
@@ -4369,12 +4376,12 @@ var L = /*#__PURE__*/function () {
|
|
4369
4376
|
}, {
|
4370
4377
|
key: "processMicrophone",
|
4371
4378
|
value: function processMicrophone(e, t, i, n) {
|
4372
|
-
var _l$files,
|
4373
|
-
var a, l, c, d, u,
|
4379
|
+
var _l$files, _h$maxNumberOfFiles;
|
4380
|
+
var a, l, c, d, u, h;
|
4374
4381
|
var o = _objectSpread({
|
4375
4382
|
acceptedFormats: "audio/*"
|
4376
4383
|
}, ((a = e.fileTypes.audio) == null ? void 0 : a.files) || {});
|
4377
|
-
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = L.parseConfig(e.requestSettings, o, t, i), _typeof(i) == "object" && i.files && ((_l$files = (l = e.recordAudio).files) !== null && _l$files !== void 0 ? _l$files : l.files = {}, e.recordAudio.files.format = (c = i.files) == null ? void 0 : c.format, e.recordAudio.files.maxDurationSeconds = (d = i.files) == null ? void 0 : d.maxDurationSeconds, (u = e.fileTypes.audio) != null && u.files && ((
|
4384
|
+
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = L.parseConfig(e.requestSettings, o, t, i), _typeof(i) == "object" && i.files && ((_l$files = (l = e.recordAudio).files) !== null && _l$files !== void 0 ? _l$files : l.files = {}, e.recordAudio.files.format = (c = i.files) == null ? void 0 : c.format, e.recordAudio.files.maxDurationSeconds = (d = i.files) == null ? void 0 : d.maxDurationSeconds, (u = e.fileTypes.audio) != null && u.files && ((_h$maxNumberOfFiles = (h = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _h$maxNumberOfFiles !== void 0 ? _h$maxNumberOfFiles : h.maxNumberOfFiles = i.files.maxNumberOfFiles))) : n || (e.fileTypes.audio = L.parseConfig(e.requestSettings, o, t, i)));
|
4378
4385
|
}
|
4379
4386
|
// prettier-ignore
|
4380
4387
|
}, {
|
@@ -4430,7 +4437,7 @@ var L = /*#__PURE__*/function () {
|
|
4430
4437
|
key: "set",
|
4431
4438
|
value: function set(e, t, i) {
|
4432
4439
|
L.populateDefaultFileIO(i == null ? void 0 : i.audio, ".4a,.mp3,.webm,.mp4,.mpga,.wav,.mpeg,.m4a"), L.populateDefaultFileIO(i == null ? void 0 : i.images, ".png,.jpg");
|
4433
|
-
var n =
|
4440
|
+
var n = Ri.createNew();
|
4434
4441
|
L.processImagesConfig(t, n, e.images, i == null ? void 0 : i.images), L.processCamera(t, n, e.camera, e.images), L.processGifConfig(t, n, e.gifs, i == null ? void 0 : i.gifs), L.processAudioConfig(t, n, e.audio, i == null ? void 0 : i.audio), L.processMicrophone(t, n, e.microphone, e.audio), L.processMixedFiles(t, n, e.mixedFiles);
|
4435
4442
|
}
|
4436
4443
|
}]);
|
@@ -4469,7 +4476,7 @@ var Ie = /*#__PURE__*/function () {
|
|
4469
4476
|
case 0:
|
4470
4477
|
i = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : !0;
|
4471
4478
|
n = this.deepChat.stream;
|
4472
|
-
return _context16.abrupt("return", n && !
|
4479
|
+
return _context16.abrupt("return", n && !C.isSimulation(n) ? C.request(this, e, t) : w.request(this, e, t, i));
|
4473
4480
|
case 3:
|
4474
4481
|
case "end":
|
4475
4482
|
return _context16.stop();
|
@@ -4568,7 +4575,7 @@ var Ie = /*#__PURE__*/function () {
|
|
4568
4575
|
}
|
4569
4576
|
throw new Error("Request settings have not been set up");
|
4570
4577
|
case 2:
|
4571
|
-
i =
|
4578
|
+
i = Ze.processMessages(t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
|
4572
4579
|
if (this.requestSettings.websocket) {
|
4573
4580
|
n = _objectSpread({
|
4574
4581
|
messages: i
|
@@ -4694,39 +4701,39 @@ var z = /*#__PURE__*/function (_Ie) {
|
|
4694
4701
|
}]);
|
4695
4702
|
return z;
|
4696
4703
|
}(Ie);
|
4697
|
-
var
|
4698
|
-
function
|
4699
|
-
_classCallCheck(this,
|
4704
|
+
var Pt = /*#__PURE__*/function () {
|
4705
|
+
function Pt() {
|
4706
|
+
_classCallCheck(this, Pt);
|
4700
4707
|
}
|
4701
|
-
_createClass(
|
4708
|
+
_createClass(Pt, null, [{
|
4702
4709
|
key: "waitForPropertiesToBeUpdatedBeforeRender",
|
4703
4710
|
value: function waitForPropertiesToBeUpdatedBeforeRender(e) {
|
4704
4711
|
e._propUpdated_ = !1, setTimeout(function () {
|
4705
|
-
e._propUpdated_ ?
|
4712
|
+
e._propUpdated_ ? Pt.waitForPropertiesToBeUpdatedBeforeRender(e) : (e._waitingToRender_ = !1, e.onRender());
|
4706
4713
|
});
|
4707
4714
|
}
|
4708
4715
|
}, {
|
4709
4716
|
key: "attemptRender",
|
4710
4717
|
value: function attemptRender(e) {
|
4711
|
-
e._propUpdated_ = !0, e._waitingToRender_ || (e._waitingToRender_ = !0,
|
4718
|
+
e._propUpdated_ = !0, e._waitingToRender_ || (e._waitingToRender_ = !0, Pt.waitForPropertiesToBeUpdatedBeforeRender(e));
|
4712
4719
|
}
|
4713
4720
|
}]);
|
4714
|
-
return
|
4721
|
+
return Pt;
|
4715
4722
|
}();
|
4716
4723
|
var Gi = /*#__PURE__*/function (_HTMLElement) {
|
4717
|
-
_inherits(
|
4718
|
-
var _super2 = _createSuper(
|
4724
|
+
_inherits(Ue, _HTMLElement);
|
4725
|
+
var _super2 = _createSuper(Ue);
|
4719
4726
|
// If this is not working, try using propertyName directly
|
4720
|
-
function
|
4727
|
+
function Ue() {
|
4721
4728
|
var _this7;
|
4722
|
-
_classCallCheck(this,
|
4723
|
-
_this7 = _super2.call(this), _this7._waitingToRender_ = !1, _this7._propUpdated_ = !1, Object.keys(
|
4724
|
-
var t =
|
4729
|
+
_classCallCheck(this, Ue);
|
4730
|
+
_this7 = _super2.call(this), _this7._waitingToRender_ = !1, _this7._propUpdated_ = !1, Object.keys(Ue._attributeToProperty_).forEach(function (e) {
|
4731
|
+
var t = Ue._attributeToProperty_[e];
|
4725
4732
|
_this7.constructPropertyAccessors(t), _this7.hasOwnProperty(e) || _this7.constructPropertyAccessors(t, e);
|
4726
4733
|
});
|
4727
4734
|
return _this7;
|
4728
4735
|
}
|
4729
|
-
_createClass(
|
4736
|
+
_createClass(Ue, [{
|
4730
4737
|
key: "constructPropertyAccessors",
|
4731
4738
|
value:
|
4732
4739
|
// need to be called here as accessors need to be set for the class instance
|
@@ -4737,7 +4744,7 @@ var Gi = /*#__PURE__*/function (_HTMLElement) {
|
|
4737
4744
|
return i;
|
4738
4745
|
},
|
4739
4746
|
set: function set(o) {
|
4740
|
-
i = o, t ? this[e] = o :
|
4747
|
+
i = o, t ? this[e] = o : Pt.attemptRender(this);
|
4741
4748
|
}
|
4742
4749
|
});
|
4743
4750
|
}
|
@@ -4745,8 +4752,8 @@ var Gi = /*#__PURE__*/function (_HTMLElement) {
|
|
4745
4752
|
key: "attributeChangedCallback",
|
4746
4753
|
value: function attributeChangedCallback(e, t, i) {
|
4747
4754
|
if (t === i) return;
|
4748
|
-
var n =
|
4749
|
-
r =
|
4755
|
+
var n = Ue._attributes_[e](i),
|
4756
|
+
r = Ue._attributeToProperty_[e];
|
4750
4757
|
this[r] = n;
|
4751
4758
|
}
|
4752
4759
|
}, {
|
@@ -4755,10 +4762,10 @@ var Gi = /*#__PURE__*/function (_HTMLElement) {
|
|
4755
4762
|
}], [{
|
4756
4763
|
key: "observedAttributes",
|
4757
4764
|
get: function get() {
|
4758
|
-
return Object.keys(
|
4765
|
+
return Object.keys(Ue._attributes_) || [];
|
4759
4766
|
}
|
4760
4767
|
}]);
|
4761
|
-
return
|
4768
|
+
return Ue;
|
4762
4769
|
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
4763
4770
|
Gi._attributes_ = {};
|
4764
4771
|
Gi._attributeToProperty_ = {};
|
@@ -4778,15 +4785,15 @@ var U = /*#__PURE__*/function () {
|
|
4778
4785
|
return U;
|
4779
4786
|
}();
|
4780
4787
|
var Qn = /*#__PURE__*/function () {
|
4781
|
-
function
|
4782
|
-
_classCallCheck(this,
|
4788
|
+
function He() {
|
4789
|
+
_classCallCheck(this, He);
|
4783
4790
|
}
|
4784
|
-
_createClass(
|
4791
|
+
_createClass(He, null, [{
|
4785
4792
|
key: "changeVisibility",
|
4786
4793
|
value:
|
4787
4794
|
// prettier-ignore
|
4788
4795
|
function changeVisibility(e, t, i, n) {
|
4789
|
-
n.target.id ===
|
4796
|
+
n.target.id === He.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");
|
4790
4797
|
}
|
4791
4798
|
}, {
|
4792
4799
|
key: "createIconElement",
|
@@ -4800,13 +4807,13 @@ var Qn = /*#__PURE__*/function () {
|
|
4800
4807
|
value: function create(e) {
|
4801
4808
|
var t = document.createElement("div");
|
4802
4809
|
t.id = "visibility-icon-container";
|
4803
|
-
var i =
|
4810
|
+
var i = He.createIconElement(ho, He.VISIBLE_ICON_ID);
|
4804
4811
|
i.style.display = "none", t.appendChild(i);
|
4805
|
-
var n =
|
4806
|
-
return t.appendChild(n), t.onclick =
|
4812
|
+
var n = He.createIconElement(uo, "not-visible-icon");
|
4813
|
+
return t.appendChild(n), t.onclick = He.changeVisibility.bind(this, e, i, n), t;
|
4807
4814
|
}
|
4808
4815
|
}]);
|
4809
|
-
return
|
4816
|
+
return He;
|
4810
4817
|
}();
|
4811
4818
|
Qn.VISIBLE_ICON_ID = "visible-icon";
|
4812
4819
|
var po = Qn;
|
@@ -4938,11 +4945,11 @@ var N = /*#__PURE__*/function () {
|
|
4938
4945
|
}]);
|
4939
4946
|
return N;
|
4940
4947
|
}();
|
4941
|
-
var
|
4942
|
-
function
|
4943
|
-
_classCallCheck(this,
|
4948
|
+
var Dt = /*#__PURE__*/function () {
|
4949
|
+
function Dt() {
|
4950
|
+
_classCallCheck(this, Dt);
|
4944
4951
|
}
|
4945
|
-
_createClass(
|
4952
|
+
_createClass(Dt, null, [{
|
4946
4953
|
key: "buildHeaders",
|
4947
4954
|
value: function buildHeaders(e) {
|
4948
4955
|
return {
|
@@ -4964,24 +4971,24 @@ var Pt = /*#__PURE__*/function () {
|
|
4964
4971
|
return {
|
4965
4972
|
url: "https://api-inference.huggingface.co/models/gpt2",
|
4966
4973
|
method: "POST",
|
4967
|
-
handleVerificationResult:
|
4974
|
+
handleVerificationResult: Dt.handleVerificationResult
|
4968
4975
|
};
|
4969
4976
|
}
|
4970
4977
|
}]);
|
4971
|
-
return
|
4978
|
+
return Dt;
|
4972
4979
|
}();
|
4973
4980
|
var es = /*#__PURE__*/function (_z) {
|
4974
|
-
_inherits(
|
4975
|
-
var _super3 = _createSuper(
|
4981
|
+
_inherits(Ni, _z);
|
4982
|
+
var _super3 = _createSuper(Ni);
|
4976
4983
|
// prettier-ignore
|
4977
|
-
function
|
4984
|
+
function Ni(e, t, i, n, r, o) {
|
4978
4985
|
var _this8;
|
4979
|
-
_classCallCheck(this,
|
4980
|
-
_this8 = _super3.call(this, e,
|
4986
|
+
_classCallCheck(this, Ni);
|
4987
|
+
_this8 = _super3.call(this, e, Dt.buildKeyVerificationDetails(), Dt.buildHeaders, r, o), _this8.insertKeyPlaceholderText = "Hugging Face Token", _this8.getKeyLink = "https://huggingface.co/settings/tokens", _this8.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this8.permittedErrorPrefixes = ["Authorization header"], _this8.url = "".concat(Ni.URL_PREFIX).concat(i), _this8.textInputPlaceholderText = t, _typeof(n) == "object" && (n.model && (_this8.url = "".concat(Ni.URL_PREFIX).concat(n.model)), n.options && (_this8.rawBody.options = n.options), n.parameters && (_this8.rawBody.parameters = n.parameters));
|
4981
4988
|
return _this8;
|
4982
4989
|
}
|
4983
4990
|
// prettier-ignore
|
4984
|
-
_createClass(
|
4991
|
+
_createClass(Ni, [{
|
4985
4992
|
key: "preprocessBody",
|
4986
4993
|
value: function preprocessBody(e, t, i) {
|
4987
4994
|
var _n$options;
|
@@ -5019,7 +5026,7 @@ var es = /*#__PURE__*/function (_z) {
|
|
5019
5026
|
return callServiceAPI;
|
5020
5027
|
}()
|
5021
5028
|
}]);
|
5022
|
-
return
|
5029
|
+
return Ni;
|
5023
5030
|
}(z);
|
5024
5031
|
es.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
5025
5032
|
var Ne = es;
|
@@ -5212,24 +5219,24 @@ var re = /*#__PURE__*/function () {
|
|
5212
5219
|
}]);
|
5213
5220
|
return re;
|
5214
5221
|
}();
|
5215
|
-
var
|
5216
|
-
_inherits(
|
5217
|
-
var _super7 = _createSuper(
|
5222
|
+
var ei = /*#__PURE__*/function (_z2) {
|
5223
|
+
_inherits(ei, _z2);
|
5224
|
+
var _super7 = _createSuper(ei);
|
5218
5225
|
// prettier-ignore
|
5219
|
-
function
|
5226
|
+
function ei(e, t, i, n, r) {
|
5220
5227
|
var _this10;
|
5221
|
-
_classCallCheck(this,
|
5228
|
+
_classCallCheck(this, ei);
|
5222
5229
|
_this10 = _super7.call(this, e, t, i, n, r), _this10.insertKeyPlaceholderText = "Stability AI API Key", _this10.getKeyLink = "https://platform.stability.ai/docs/getting-started/authentication", _this10.permittedErrorPrefixes = ["Incorrect", "invalid_"];
|
5223
5230
|
return _this10;
|
5224
5231
|
}
|
5225
|
-
return _createClass(
|
5232
|
+
return _createClass(ei);
|
5226
5233
|
}(z);
|
5227
|
-
var
|
5228
|
-
_inherits(
|
5229
|
-
var _super8 = _createSuper(
|
5230
|
-
function
|
5234
|
+
var jt = /*#__PURE__*/function (_ei) {
|
5235
|
+
_inherits(jt, _ei);
|
5236
|
+
var _super8 = _createSuper(jt);
|
5237
|
+
function jt(e) {
|
5231
5238
|
var _this11;
|
5232
|
-
_classCallCheck(this,
|
5239
|
+
_classCallCheck(this, jt);
|
5233
5240
|
var o;
|
5234
5241
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
5235
5242
|
i = t == null ? void 0 : t.stabilityAI,
|
@@ -5243,10 +5250,10 @@ var Dt = /*#__PURE__*/function (_Qt) {
|
|
5243
5250
|
};
|
5244
5251
|
_this11 = _super8.call(this, e, re.buildKeyVerificationDetails(), re.buildHeaders, i, n), _this11.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this11.textInputPlaceholderText = "Describe image changes", _this11.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Upscale</b></div>\n <p>Upload an image to generate a new one with higher resolution.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
5245
5252
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
5246
|
-
_typeof(r) == "object" && (r.engine_id && (_this11.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")),
|
5253
|
+
_typeof(r) == "object" && (r.engine_id && (_this11.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), jt.cleanConfig(r), Object.assign(_this11.rawBody, r)), _this11.canSendMessage = jt.canSendFileMessage;
|
5247
5254
|
return _this11;
|
5248
5255
|
}
|
5249
|
-
_createClass(
|
5256
|
+
_createClass(jt, [{
|
5250
5257
|
key: "createFormDataBody",
|
5251
5258
|
value: function createFormDataBody(e, t) {
|
5252
5259
|
var i = new FormData();
|
@@ -5331,14 +5338,14 @@ var Dt = /*#__PURE__*/function (_Qt) {
|
|
5331
5338
|
return !!(t != null && t[0]);
|
5332
5339
|
}
|
5333
5340
|
}]);
|
5334
|
-
return
|
5335
|
-
}(
|
5336
|
-
var
|
5337
|
-
_inherits(
|
5338
|
-
var _super9 = _createSuper(
|
5339
|
-
function
|
5341
|
+
return jt;
|
5342
|
+
}(ei);
|
5343
|
+
var Bt = /*#__PURE__*/function (_ei2) {
|
5344
|
+
_inherits(Bt, _ei2);
|
5345
|
+
var _super9 = _createSuper(Bt);
|
5346
|
+
function Bt(e) {
|
5340
5347
|
var _this12;
|
5341
|
-
_classCallCheck(this,
|
5348
|
+
_classCallCheck(this, Bt);
|
5342
5349
|
var o;
|
5343
5350
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
5344
5351
|
i = t == null ? void 0 : t.stabilityAI,
|
@@ -5352,10 +5359,10 @@ var jt = /*#__PURE__*/function (_Qt2) {
|
|
5352
5359
|
};
|
5353
5360
|
_this12 = _super9.call(this, e, re.buildKeyVerificationDetails(), re.buildHeaders, i, n), _this12.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this12._maskSource = "MASK_IMAGE_WHITE", _this12.textInputPlaceholderText = "Describe image changes", _this12.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Masking</b></div>\n <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
5354
5361
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
5355
|
-
_typeof(r) == "object" && (r.engine_id && (_this12.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this12._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this12._maskSource = r.mask_source),
|
5362
|
+
_typeof(r) == "object" && (r.engine_id && (_this12.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this12._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this12._maskSource = r.mask_source), Bt.cleanConfig(r), Object.assign(_this12.rawBody, r)), _this12.canSendMessage = Bt.canSendFileTextMessage;
|
5356
5363
|
return _this12;
|
5357
5364
|
}
|
5358
|
-
_createClass(
|
5365
|
+
_createClass(Bt, [{
|
5359
5366
|
key: "createFormDataBody",
|
5360
5367
|
value: function createFormDataBody(e, t, i, n) {
|
5361
5368
|
var r = new FormData();
|
@@ -5440,8 +5447,8 @@ var jt = /*#__PURE__*/function (_Qt2) {
|
|
5440
5447
|
return !!(t != null && t[0]) && !!(e && e.trim() !== "");
|
5441
5448
|
}
|
5442
5449
|
}]);
|
5443
|
-
return
|
5444
|
-
}(
|
5450
|
+
return Bt;
|
5451
|
+
}(ei);
|
5445
5452
|
var go = /*#__PURE__*/function (_bt3) {
|
5446
5453
|
_inherits(go, _bt3);
|
5447
5454
|
var _super10 = _createSuper(go);
|
@@ -5712,12 +5719,12 @@ var xo = /*#__PURE__*/function (_Ne5) {
|
|
5712
5719
|
}]);
|
5713
5720
|
return xo;
|
5714
5721
|
}(Ne);
|
5715
|
-
var
|
5716
|
-
_inherits(
|
5717
|
-
var _super15 = _createSuper(
|
5718
|
-
function
|
5722
|
+
var Ft = /*#__PURE__*/function (_ei3) {
|
5723
|
+
_inherits(Ft, _ei3);
|
5724
|
+
var _super15 = _createSuper(Ft);
|
5725
|
+
function Ft(e) {
|
5719
5726
|
var _this15;
|
5720
|
-
_classCallCheck(this,
|
5727
|
+
_classCallCheck(this, Ft);
|
5721
5728
|
var o;
|
5722
5729
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
5723
5730
|
i = t.stabilityAI,
|
@@ -5731,10 +5738,10 @@ var Bt = /*#__PURE__*/function (_Qt3) {
|
|
5731
5738
|
};
|
5732
5739
|
_this15 = _super15.call(this, e, re.buildKeyVerificationDetails(), re.buildHeaders, i, n), _this15.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this15.textInputPlaceholderText = "Describe image changes", _this15.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Image to Image</b></div>\n <p>Upload an image to create a new one with the changes you have described.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
5733
5740
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
5734
|
-
_typeof(r) == "object" && (r.engine_id && (_this15.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this15._imageWeight = r.weight),
|
5741
|
+
_typeof(r) == "object" && (r.engine_id && (_this15.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this15._imageWeight = r.weight), Ft.cleanConfig(r), Object.assign(_this15.rawBody, r)), _this15.canSendMessage = Ft.canSendFileTextMessage;
|
5735
5742
|
return _this15;
|
5736
5743
|
}
|
5737
|
-
_createClass(
|
5744
|
+
_createClass(Ft, [{
|
5738
5745
|
key: "createFormDataBody",
|
5739
5746
|
value: function createFormDataBody(e, t, i) {
|
5740
5747
|
var n = new FormData();
|
@@ -5819,8 +5826,8 @@ var Bt = /*#__PURE__*/function (_Qt3) {
|
|
5819
5826
|
return !!(t != null && t[0]) && !!(e && e.trim() !== "");
|
5820
5827
|
}
|
5821
5828
|
}]);
|
5822
|
-
return
|
5823
|
-
}(
|
5829
|
+
return Ft;
|
5830
|
+
}(ei);
|
5824
5831
|
var Eo = /*#__PURE__*/function (_Ne6) {
|
5825
5832
|
_inherits(Eo, _Ne6);
|
5826
5833
|
var _super16 = _createSuper(Eo);
|
@@ -5861,21 +5868,21 @@ var Eo = /*#__PURE__*/function (_Ne6) {
|
|
5861
5868
|
}]);
|
5862
5869
|
return Eo;
|
5863
5870
|
}(Ne);
|
5864
|
-
var
|
5865
|
-
_inherits(
|
5866
|
-
var _super17 = _createSuper(
|
5867
|
-
function
|
5871
|
+
var zt = /*#__PURE__*/function (_ei4) {
|
5872
|
+
_inherits(zt, _ei4);
|
5873
|
+
var _super17 = _createSuper(zt);
|
5874
|
+
function zt(e) {
|
5868
5875
|
var _this16;
|
5869
|
-
_classCallCheck(this,
|
5876
|
+
_classCallCheck(this, zt);
|
5870
5877
|
var r;
|
5871
5878
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
5872
5879
|
i = t.stabilityAI;
|
5873
5880
|
_this16 = _super17.call(this, e, re.buildKeyVerificationDetails(), re.buildHeaders, i), _this16.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this16.textInputPlaceholderText = "Describe an image", _this16.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Text to Image</b></div>\n <p>Insert text to generate an image.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
5874
5881
|
var n = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
5875
|
-
_typeof(n) == "object" && (n.engine_id && (_this16.url = "https://api.stability.ai/v1/generation/".concat(n.engine_id, "/text-to-image")), n.weight !== void 0 && n.weight !== null && (_this16._imageWeight = n.weight),
|
5882
|
+
_typeof(n) == "object" && (n.engine_id && (_this16.url = "https://api.stability.ai/v1/generation/".concat(n.engine_id, "/text-to-image")), n.weight !== void 0 && n.weight !== null && (_this16._imageWeight = n.weight), zt.cleanConfig(n), Object.assign(_this16.rawBody, n)), _this16.canSendMessage = zt.canSendTextMessage;
|
5876
5883
|
return _this16;
|
5877
5884
|
}
|
5878
|
-
_createClass(
|
5885
|
+
_createClass(zt, [{
|
5879
5886
|
key: "preprocessBody",
|
5880
5887
|
value: function preprocessBody(e, t) {
|
5881
5888
|
var i = JSON.parse(JSON.stringify(e)),
|
@@ -5954,8 +5961,8 @@ var Ft = /*#__PURE__*/function (_Qt4) {
|
|
5954
5961
|
return !!(e && e.trim() !== "");
|
5955
5962
|
}
|
5956
5963
|
}]);
|
5957
|
-
return
|
5958
|
-
}(
|
5964
|
+
return zt;
|
5965
|
+
}(ei);
|
5959
5966
|
var So = /*#__PURE__*/function (_Ne7) {
|
5960
5967
|
_inherits(So, _Ne7);
|
5961
5968
|
var _super18 = _createSuper(So);
|
@@ -5998,11 +6005,11 @@ var So = /*#__PURE__*/function (_Ne7) {
|
|
5998
6005
|
}]);
|
5999
6006
|
return So;
|
6000
6007
|
}(Ne);
|
6001
|
-
var
|
6002
|
-
function
|
6003
|
-
_classCallCheck(this,
|
6008
|
+
var qt = /*#__PURE__*/function () {
|
6009
|
+
function qt() {
|
6010
|
+
_classCallCheck(this, qt);
|
6004
6011
|
}
|
6005
|
-
_createClass(
|
6012
|
+
_createClass(qt, null, [{
|
6006
6013
|
key: "buildHeaders",
|
6007
6014
|
value: function buildHeaders(e) {
|
6008
6015
|
return {
|
@@ -6024,14 +6031,14 @@ var zt = /*#__PURE__*/function () {
|
|
6024
6031
|
return {
|
6025
6032
|
url: "https://api.cohere.ai/v1/generate",
|
6026
6033
|
method: "POST",
|
6027
|
-
handleVerificationResult:
|
6034
|
+
handleVerificationResult: qt.handleVerificationResult,
|
6028
6035
|
body: JSON.stringify({
|
6029
6036
|
prompt: ""
|
6030
6037
|
})
|
6031
6038
|
};
|
6032
6039
|
}
|
6033
6040
|
}]);
|
6034
|
-
return
|
6041
|
+
return qt;
|
6035
6042
|
}();
|
6036
6043
|
var Vi = /*#__PURE__*/function (_z3) {
|
6037
6044
|
_inherits(Vi, _z3);
|
@@ -6039,7 +6046,7 @@ var Vi = /*#__PURE__*/function (_z3) {
|
|
6039
6046
|
function Vi(e, t, i, n, r) {
|
6040
6047
|
var _this18;
|
6041
6048
|
_classCallCheck(this, Vi);
|
6042
|
-
_this18 = _super19.call(this, e,
|
6049
|
+
_this18 = _super19.call(this, e, qt.buildKeyVerificationDetails(), qt.buildHeaders, r), _this18.insertKeyPlaceholderText = "Cohere API Key", _this18.getKeyLink = "https://dashboard.cohere.ai/api-keys", _this18.permittedErrorPrefixes = ["invalid"], _this18.url = t, _this18.textInputPlaceholderText = i, n && _typeof(n) == "object" && Object.assign(_this18.rawBody, n);
|
6043
6050
|
return _this18;
|
6044
6051
|
}
|
6045
6052
|
return _createClass(Vi);
|
@@ -6326,21 +6333,21 @@ var O = /*#__PURE__*/function () {
|
|
6326
6333
|
return O;
|
6327
6334
|
}();
|
6328
6335
|
var Wi = /*#__PURE__*/function (_z4) {
|
6329
|
-
_inherits(
|
6330
|
-
var _super22 = _createSuper(
|
6331
|
-
function
|
6336
|
+
_inherits(Pi, _z4);
|
6337
|
+
var _super22 = _createSuper(Pi);
|
6338
|
+
function Pi(e) {
|
6332
6339
|
var _o$model, _a$voice;
|
6333
6340
|
var _this19;
|
6334
|
-
_classCallCheck(this,
|
6341
|
+
_classCallCheck(this, Pi);
|
6335
6342
|
var r, o, a;
|
6336
6343
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
6337
6344
|
i = t == null ? void 0 : t.openAI;
|
6338
6345
|
_this19 = _super22.call(this, e, O.buildKeyVerificationDetails(), O.buildHeaders, i), _this19.insertKeyPlaceholderText = "OpenAI API Key", _this19.getKeyLink = "https://platform.openai.com/account/api-keys", _this19.url = "https://api.openai.com/v1/audio/speech", _this19.permittedErrorPrefixes = ["Invalid"], _this19.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Text To Speech</b></div>\n <p>Generate an audio file based on your text input.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/text-to-speech\">here</a> for more information.</p>";
|
6339
6346
|
var n = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.textToSpeech;
|
6340
|
-
_typeof(n) == "object" && Object.assign(_this19.rawBody, n), (_o$model = (o = _this19.rawBody).model) !== null && _o$model !== void 0 ? _o$model : o.model =
|
6347
|
+
_typeof(n) == "object" && Object.assign(_this19.rawBody, n), (_o$model = (o = _this19.rawBody).model) !== null && _o$model !== void 0 ? _o$model : o.model = Pi.DEFAULT_MODEL, (_a$voice = (a = _this19.rawBody).voice) !== null && _a$voice !== void 0 ? _a$voice : a.voice = Pi.DEFAULT_VOIDE, _this19.textInputPlaceholderText = "Insert text to generate audio", _this19.rawBody.response_format = "mp3";
|
6341
6348
|
return _this19;
|
6342
6349
|
}
|
6343
|
-
_createClass(
|
6350
|
+
_createClass(Pi, [{
|
6344
6351
|
key: "preprocessBody",
|
6345
6352
|
value: function preprocessBody(e, t) {
|
6346
6353
|
var r, o;
|
@@ -6420,12 +6427,12 @@ var Wi = /*#__PURE__*/function (_z4) {
|
|
6420
6427
|
return extractResultData;
|
6421
6428
|
}()
|
6422
6429
|
}]);
|
6423
|
-
return
|
6430
|
+
return Pi;
|
6424
6431
|
}(z);
|
6425
6432
|
Wi.DEFAULT_MODEL = "tts-1";
|
6426
6433
|
Wi.DEFAULT_VOIDE = "alloy";
|
6427
6434
|
var Mo = Wi;
|
6428
|
-
var
|
6435
|
+
var ti = /*#__PURE__*/function (_z5) {
|
6429
6436
|
_inherits(xe, _z5);
|
6430
6437
|
var _super23 = _createSuper(xe);
|
6431
6438
|
function xe(e) {
|
@@ -6538,10 +6545,10 @@ var ei = /*#__PURE__*/function (_z5) {
|
|
6538
6545
|
}]);
|
6539
6546
|
return xe;
|
6540
6547
|
}(z);
|
6541
|
-
|
6542
|
-
|
6543
|
-
|
6544
|
-
var To =
|
6548
|
+
ti.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
|
6549
|
+
ti.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
|
6550
|
+
ti.DEFAULT_MODEL = "whisper-1";
|
6551
|
+
var To = ti;
|
6545
6552
|
var $ = /*#__PURE__*/function () {
|
6546
6553
|
function $() {
|
6547
6554
|
_classCallCheck(this, $);
|
@@ -7103,11 +7110,11 @@ is.HELP_LINK =
|
|
7103
7110
|
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
|
7104
7111
|
var ko = is;
|
7105
7112
|
var ss = /*#__PURE__*/function (_ts2) {
|
7106
|
-
_inherits(
|
7107
|
-
var _super29 = _createSuper(
|
7108
|
-
function
|
7113
|
+
_inherits(Di, _ts2);
|
7114
|
+
var _super29 = _createSuper(Di);
|
7115
|
+
function Di(e) {
|
7109
7116
|
var _this26;
|
7110
|
-
_classCallCheck(this,
|
7117
|
+
_classCallCheck(this, Di);
|
7111
7118
|
var o, a, l;
|
7112
7119
|
var t = (a = (o = e.directConnection) == null ? void 0 : o.azure) == null ? void 0 : a.speechToText,
|
7113
7120
|
i = (l = e.directConnection) == null ? void 0 : l.azure,
|
@@ -7118,12 +7125,12 @@ var ss = /*#__PURE__*/function (_ts2) {
|
|
7118
7125
|
}
|
7119
7126
|
}
|
7120
7127
|
};
|
7121
|
-
_this26 = _super29.call(this, e, $.buildSpeechToTextHeaders, t.region, i, n), _this26.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(
|
7128
|
+
_this26 = _super29.call(this, e, $.buildSpeechToTextHeaders, t.region, i, n), _this26.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(Di.HELP_LINK, "\">here</a> for more info.\n </p>"), _this26.url = "", _this26.isTextInputDisabled = !0, _this26.textInputPlaceholderText = "Upload an audio file", _this26.canSendMessage = Di.canFileSendMessage;
|
7122
7129
|
var r = t.lang || "en-US";
|
7123
7130
|
_this26.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(r, "&format=detailed"), _this26.recordAudio = void 0;
|
7124
7131
|
return _this26;
|
7125
7132
|
}
|
7126
|
-
_createClass(
|
7133
|
+
_createClass(Di, [{
|
7127
7134
|
key: "callServiceAPI",
|
7128
7135
|
value: function () {
|
7129
7136
|
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t, i) {
|
@@ -7188,7 +7195,7 @@ var ss = /*#__PURE__*/function (_ts2) {
|
|
7188
7195
|
return !!(t != null && t[0]);
|
7189
7196
|
}
|
7190
7197
|
}]);
|
7191
|
-
return
|
7198
|
+
return Di;
|
7192
7199
|
}(ts);
|
7193
7200
|
ss.HELP_LINK =
|
7194
7201
|
// eslint-disable-next-line max-len
|
@@ -7300,10 +7307,10 @@ var Ji = /*#__PURE__*/function (_z10) {
|
|
7300
7307
|
key: "processMessages",
|
7301
7308
|
value: function processMessages(e, t) {
|
7302
7309
|
var i = this.totalMessagesMaxCharLength || -1;
|
7303
|
-
return
|
7310
|
+
return Ze.getCharacterLimitMessages(e, i).map(function (n) {
|
7304
7311
|
return {
|
7305
7312
|
content: n.text || "",
|
7306
|
-
role: n.role ===
|
7313
|
+
role: n.role === x.USER_ROLE ? "user" : "assistant",
|
7307
7314
|
file_ids: t
|
7308
7315
|
};
|
7309
7316
|
});
|
@@ -7566,7 +7573,7 @@ var Ji = /*#__PURE__*/function (_z10) {
|
|
7566
7573
|
Ji.THREAD_PREFIX = "https://api.openai.com/v1/threads";
|
7567
7574
|
Ji.POLLING_TIMEOUT_MS = 800;
|
7568
7575
|
var Ro = Ji;
|
7569
|
-
var
|
7576
|
+
var ii = /*#__PURE__*/function (_z11) {
|
7570
7577
|
_inherits(Ee, _z11);
|
7571
7578
|
var _super32 = _createSuper(Ee);
|
7572
7579
|
function Ee(e) {
|
@@ -7718,10 +7725,10 @@ var ti = /*#__PURE__*/function (_z11) {
|
|
7718
7725
|
}]);
|
7719
7726
|
return Ee;
|
7720
7727
|
}(z);
|
7721
|
-
|
7722
|
-
|
7723
|
-
|
7724
|
-
var Oo =
|
7728
|
+
ii.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
|
7729
|
+
ii.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
|
7730
|
+
ii.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
7731
|
+
var Oo = ii;
|
7725
7732
|
var lt = /*#__PURE__*/function (_z12) {
|
7726
7733
|
_inherits(lt, _z12);
|
7727
7734
|
var _super33 = _createSuper(lt);
|
@@ -7755,10 +7762,10 @@ var lt = /*#__PURE__*/function (_z12) {
|
|
7755
7762
|
function preprocessBody(e, t) {
|
7756
7763
|
var _i$max_tokens;
|
7757
7764
|
var i = JSON.parse(JSON.stringify(e)),
|
7758
|
-
n =
|
7765
|
+
n = Ze.getCharacterLimitMessages(t, this.totalMessagesMaxCharLength ? this.totalMessagesMaxCharLength - this._systemMessage.content.length : -1).map(function (r) {
|
7759
7766
|
return {
|
7760
7767
|
content: lt.getContent(r),
|
7761
|
-
role: r.role ===
|
7768
|
+
role: r.role === x.USER_ROLE ? "user" : "assistant"
|
7762
7769
|
};
|
7763
7770
|
});
|
7764
7771
|
return t.find(function (r) {
|
@@ -7780,7 +7787,7 @@ var lt = /*#__PURE__*/function (_z12) {
|
|
7780
7787
|
throw new Error("Request settings have not been set up");
|
7781
7788
|
case 2:
|
7782
7789
|
i = this.preprocessBody(this.rawBody, t), n = this.deepChat.stream;
|
7783
|
-
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0,
|
7790
|
+
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, C.request(this, i, e)) : w.request(this, i, e);
|
7784
7791
|
case 4:
|
7785
7792
|
case "end":
|
7786
7793
|
return _context71.stop();
|
@@ -7863,8 +7870,8 @@ var lt = /*#__PURE__*/function (_z12) {
|
|
7863
7870
|
break;
|
7864
7871
|
}
|
7865
7872
|
o.forEach(function (c, d) {
|
7866
|
-
var
|
7867
|
-
var u = (
|
7873
|
+
var h;
|
7874
|
+
var u = (h = e.tool_calls) == null ? void 0 : h[d];
|
7868
7875
|
n == null || n.messages.push({
|
7869
7876
|
role: "tool",
|
7870
7877
|
tool_call_id: u == null ? void 0 : u.id,
|
@@ -8111,28 +8118,23 @@ var mn = {
|
|
8111
8118
|
},
|
8112
8119
|
use_web_worker: !0
|
8113
8120
|
},
|
8114
|
-
|
8115
|
-
_inherits(
|
8116
|
-
var _super35 = _createSuper(
|
8117
|
-
function
|
8121
|
+
Pe = /*#__PURE__*/function (_Ie2) {
|
8122
|
+
_inherits(T, _Ie2);
|
8123
|
+
var _super35 = _createSuper(T);
|
8124
|
+
function T(e) {
|
8118
8125
|
var _this32;
|
8119
|
-
_classCallCheck(this,
|
8120
|
-
_this32 = _super35.call(this, e), _this32._isModelLoaded = !1, _this32._isModelLoading = !1, _this32._loadOnFirstMessage = !1, _this32.permittedErrorPrefixes = [
|
8126
|
+
_classCallCheck(this, T);
|
8127
|
+
_this32 = _super35.call(this, e), _this32._isModelLoaded = !1, _this32._isModelLoading = !1, _this32._loadOnFirstMessage = !1, _this32.permittedErrorPrefixes = [T.MULTIPLE_MODELS_ERROR, T.WEB_LLM_NOT_FOUND_ERROR, T.GENERIC_ERROR], _this32.webModel = {}, _typeof(e.webModel) == "object" && (_this32.webModel = e.webModel), _this32.findModelInWindow(e), _this32.canSendMessage = _this32.canSubmit.bind(_assertThisInitialized(_this32));
|
8121
8128
|
return _this32;
|
8122
8129
|
}
|
8123
|
-
_createClass(
|
8130
|
+
_createClass(T, [{
|
8124
8131
|
key: "findModelInWindow",
|
8125
8132
|
value: function findModelInWindow(e) {
|
8126
8133
|
var _this33 = this;
|
8127
8134
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
8128
8135
|
var i;
|
8129
|
-
|
8130
|
-
|
8131
|
-
this.configureInit(n), setTimeout(function () {
|
8132
|
-
console.log("call"), console.log(_this33._downloadButton), console.log(n), _this33._downloadButton && n && (_this33._downloadButton.disabled = !1);
|
8133
|
-
}, 10);
|
8134
|
-
} else t > 5 ? ((i = this.addMessage) == null || i.call(this, {
|
8135
|
-
error: A.WEB_LLM_NOT_FOUND_ERROR,
|
8136
|
+
window.webLLM ? this.configureInit(this.shouldAddInitialMessage(e.introMessage)) : t > T.MODULE_SEARCH_LIMIT_S ? ((i = this.addMessage) == null || i.call(this, {
|
8137
|
+
error: T.WEB_LLM_NOT_FOUND_ERROR,
|
8136
8138
|
sendUpdate: !1
|
8137
8139
|
}), console.error("The WebLLM module is either not in the project or not been attached to the window object. Please see the following guide:"), console.error("Hello World")) : setTimeout(function () {
|
8138
8140
|
_this33.findModelInWindow(e, t + 1);
|
@@ -8152,18 +8154,27 @@ var mn = {
|
|
8152
8154
|
t = _ref10.introMessage;
|
8153
8155
|
if (!this.shouldAddInitialMessage(t) || !e) return;
|
8154
8156
|
var i = this.webModel.introMessage,
|
8155
|
-
n = (i == null ? void 0 : i.downloadClass) ||
|
8157
|
+
n = (i == null ? void 0 : i.downloadClass) || T.DOWNLOAD_BUTTON_CLASS,
|
8156
8158
|
r = "\n Download a web model that will run entirely on your browser.\n <br/> <button disabled style=\"margin-top: 10px; margin-bottom: 5px; margin-left: 1px\"\n class=\"".concat(n, " deep-chat-button\">Download</button>"),
|
8157
8159
|
o = (i == null ? void 0 : i.html) || "<div>".concat(r, "</div>");
|
8158
8160
|
return setTimeout(function () {
|
8159
8161
|
var a;
|
8160
|
-
_this34._downloadButton = (a = e.children[0]) == null ? void 0 : a.getElementsByClassName(n)[0], _this34._downloadButton && (_this34._downloadButton.onclick = _this34.init.bind(_this34));
|
8162
|
+
_this34._downloadButton = (a = e.children[0]) == null ? void 0 : a.getElementsByClassName(n)[0], _this34._downloadButton && (_this34._downloadButton.onclick = _this34.init.bind(_this34), _this34.enableButton(_this34._downloadButton));
|
8161
8163
|
}), {
|
8162
|
-
role:
|
8164
|
+
role: x.AI_ROLE,
|
8163
8165
|
html: o,
|
8164
8166
|
sendUpdate: !1
|
8165
8167
|
};
|
8166
8168
|
}
|
8169
|
+
}, {
|
8170
|
+
key: "enableButton",
|
8171
|
+
value: function enableButton(e) {
|
8172
|
+
var _this35 = this;
|
8173
|
+
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
8174
|
+
window.webLLM ? e.disabled = !1 : t < T.MODULE_SEARCH_LIMIT_S * 4 && setTimeout(function () {
|
8175
|
+
return _this35.enableButton(e, t + 1);
|
8176
|
+
}, 250);
|
8177
|
+
}
|
8167
8178
|
}, {
|
8168
8179
|
key: "configureInit",
|
8169
8180
|
value: function () {
|
@@ -8228,11 +8239,11 @@ var mn = {
|
|
8228
8239
|
key: "attemptToCreateChat",
|
8229
8240
|
value: function attemptToCreateChat() {
|
8230
8241
|
var t;
|
8231
|
-
if (
|
8242
|
+
if (T.chat) {
|
8232
8243
|
(t = this.addMessage) == null || t.call(this, {
|
8233
|
-
error:
|
8244
|
+
error: T.MULTIPLE_MODELS_ERROR,
|
8234
8245
|
sendUpdate: !1
|
8235
|
-
}), console.error(
|
8246
|
+
}), console.error(T.MULTIPLE_MODELS_ERROR);
|
8236
8247
|
return;
|
8237
8248
|
}
|
8238
8249
|
if (this._isModelLoaded || this._isModelLoading) return;
|
@@ -8242,7 +8253,7 @@ var mn = {
|
|
8242
8253
|
}, {
|
8243
8254
|
key: "getConfig",
|
8244
8255
|
value: function getConfig() {
|
8245
|
-
var e =
|
8256
|
+
var e = T.DEFAULT_MODEL;
|
8246
8257
|
this.webModel.model && (e = this.webModel.model);
|
8247
8258
|
var t = JSON.parse(JSON.stringify(mn));
|
8248
8259
|
if (this.webModel.modelUrl) {
|
@@ -8264,25 +8275,25 @@ var mn = {
|
|
8264
8275
|
key: "loadModel",
|
8265
8276
|
value: function () {
|
8266
8277
|
var _loadModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(e) {
|
8267
|
-
var
|
8278
|
+
var _this36 = this;
|
8268
8279
|
var i, t, _this$getConfig, n, r;
|
8269
8280
|
return _regeneratorRuntime().wrap(function _callee78$(_context78) {
|
8270
8281
|
while (1) switch (_context78.prev = _context78.next) {
|
8271
8282
|
case 0:
|
8272
|
-
|
8283
|
+
T.chat = e, this._isModelLoading = !0;
|
8273
8284
|
t = function t(n) {
|
8274
8285
|
var r;
|
8275
|
-
(r =
|
8286
|
+
(r = _this36.addMessage) == null || r.call(_this36, {
|
8276
8287
|
html: "<div>".concat(n.text, "</div>"),
|
8277
8288
|
overwrite: !0,
|
8278
8289
|
sendUpdate: !1
|
8279
8290
|
});
|
8280
8291
|
};
|
8281
|
-
|
8292
|
+
T.chat.setInitProgressCallback(t);
|
8282
8293
|
_context78.prev = 3;
|
8283
8294
|
_this$getConfig = this.getConfig(), n = _this$getConfig.model, r = _this$getConfig.pConfig;
|
8284
8295
|
_context78.next = 7;
|
8285
|
-
return
|
8296
|
+
return T.chat.reload(n, {
|
8286
8297
|
conv_config: {
|
8287
8298
|
system: "keep responses to one sentence"
|
8288
8299
|
}
|
@@ -8373,7 +8384,7 @@ var mn = {
|
|
8373
8384
|
this.streamHandlers.abortStream.abort = function () {
|
8374
8385
|
i.interruptGenerate();
|
8375
8386
|
}, this.streamHandlers.onOpen();
|
8376
|
-
n = new
|
8387
|
+
n = new $e(e);
|
8377
8388
|
_context81.next = 4;
|
8378
8389
|
return i.generate(t, function (r, o) {
|
8379
8390
|
n.upsertStreamedMessage({
|
@@ -8423,7 +8434,7 @@ var mn = {
|
|
8423
8434
|
case 6:
|
8424
8435
|
return _context82.abrupt("return");
|
8425
8436
|
case 7:
|
8426
|
-
!
|
8437
|
+
!T.chat || this._isModelLoading || (e.addLoadingMessage(), this.generateResp(e, t, T.chat));
|
8427
8438
|
case 8:
|
8428
8439
|
case "end":
|
8429
8440
|
return _context82.stop();
|
@@ -8444,21 +8455,21 @@ var mn = {
|
|
8444
8455
|
while (1) switch (_context83.prev = _context83.next) {
|
8445
8456
|
case 0:
|
8446
8457
|
(t = this.addMessage) == null || t.call(this, {
|
8447
|
-
error:
|
8458
|
+
error: T.GENERIC_ERROR,
|
8448
8459
|
sendUpdate: !1
|
8449
8460
|
});
|
8450
8461
|
console.error(e);
|
8451
8462
|
this._isModelLoaded = !1;
|
8452
8463
|
this._isModelLoading = !1;
|
8453
|
-
_context83.t0 =
|
8464
|
+
_context83.t0 = T.chat;
|
8454
8465
|
if (!_context83.t0) {
|
8455
8466
|
_context83.next = 9;
|
8456
8467
|
break;
|
8457
8468
|
}
|
8458
8469
|
_context83.next = 8;
|
8459
|
-
return
|
8470
|
+
return T.chat.unload();
|
8460
8471
|
case 8:
|
8461
|
-
|
8472
|
+
T.chat = void 0;
|
8462
8473
|
case 9:
|
8463
8474
|
case "end":
|
8464
8475
|
return _context83.stop();
|
@@ -8476,14 +8487,15 @@ var mn = {
|
|
8476
8487
|
return !0;
|
8477
8488
|
}
|
8478
8489
|
}]);
|
8479
|
-
return
|
8490
|
+
return T;
|
8480
8491
|
}(Ie);
|
8481
|
-
|
8482
|
-
|
8483
|
-
|
8484
|
-
|
8485
|
-
|
8486
|
-
|
8492
|
+
Pe.DOWNLOAD_BUTTON_CLASS = "deep-chat-download-button";
|
8493
|
+
Pe.GENERIC_ERROR = "ERROR. Your browser may not support this model. Please check the following setup [instructions](https://webllm.mlc.ai/#instructions).";
|
8494
|
+
Pe.MULTIPLE_MODELS_ERROR = "Cannot run multiple web models";
|
8495
|
+
Pe.WEB_LLM_NOT_FOUND_ERROR = "WebLLM module not found";
|
8496
|
+
Pe.DEFAULT_MODEL = "Llama-2-7b-chat-hf-q4f32_1";
|
8497
|
+
Pe.MODULE_SEARCH_LIMIT_S = 5;
|
8498
|
+
var Po = Pe;
|
8487
8499
|
var Do = /*#__PURE__*/function () {
|
8488
8500
|
function Do() {
|
8489
8501
|
_classCallCheck(this, Do);
|
@@ -8507,7 +8519,7 @@ var Do = /*#__PURE__*/function () {
|
|
8507
8519
|
if (t.azure.summarization) return new Ao(e);
|
8508
8520
|
if (t.azure.translation) return new Lo(e);
|
8509
8521
|
}
|
8510
|
-
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new
|
8522
|
+
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new Ft(e) : t.stabilityAI.imageToImageUpscale ? new jt(e) : t.stabilityAI.imageToImageMasking ? new Bt(e) : new zt(e);
|
8511
8523
|
}
|
8512
8524
|
return i ? new Ie(e) : new Ie(e, void 0, n || !0);
|
8513
8525
|
}
|
@@ -8515,22 +8527,22 @@ var Do = /*#__PURE__*/function () {
|
|
8515
8527
|
return Do;
|
8516
8528
|
}();
|
8517
8529
|
var rs = /*#__PURE__*/function () {
|
8518
|
-
function
|
8519
|
-
_classCallCheck(this,
|
8530
|
+
function ji() {
|
8531
|
+
_classCallCheck(this, ji);
|
8520
8532
|
}
|
8521
|
-
_createClass(
|
8533
|
+
_createClass(ji, null, [{
|
8522
8534
|
key: "appendStyleSheetToHead",
|
8523
8535
|
value: function appendStyleSheetToHead() {
|
8524
8536
|
var e = document.getElementsByTagName("head")[0];
|
8525
8537
|
if (!Array.from(e.getElementsByTagName("link")).some(function (i) {
|
8526
|
-
return i.getAttribute("href") ===
|
8538
|
+
return i.getAttribute("href") === ji.FONT_URL;
|
8527
8539
|
})) {
|
8528
8540
|
var i = document.createElement("link");
|
8529
|
-
i.rel = "stylesheet", i.href =
|
8541
|
+
i.rel = "stylesheet", i.href = ji.FONT_URL, e.appendChild(i);
|
8530
8542
|
}
|
8531
8543
|
}
|
8532
8544
|
}]);
|
8533
|
-
return
|
8545
|
+
return ji;
|
8534
8546
|
}();
|
8535
8547
|
rs.FONT_URL = "https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap";
|
8536
8548
|
var jo = rs;
|
@@ -8557,7 +8569,7 @@ os.attibutes = {
|
|
8557
8569
|
return new Function("return ".concat(s))();
|
8558
8570
|
}
|
8559
8571
|
};
|
8560
|
-
function
|
8572
|
+
function v(s) {
|
8561
8573
|
return function (e, t) {
|
8562
8574
|
Object.defineProperty(e, t, {});
|
8563
8575
|
var i = e.constructor,
|
@@ -8589,21 +8601,21 @@ var Yi = /*#__PURE__*/function () {
|
|
8589
8601
|
}]);
|
8590
8602
|
return Yi;
|
8591
8603
|
}();
|
8592
|
-
var
|
8593
|
-
function
|
8594
|
-
_classCallCheck(this,
|
8604
|
+
var Ut = /*#__PURE__*/function () {
|
8605
|
+
function Ut(e, t, i) {
|
8606
|
+
_classCallCheck(this, Ut);
|
8595
8607
|
this._isDisplayed = !1, e ? (this._elementRef = this.createIntroPanelWithChild(e, i), this._isDisplayed = !0) : t && (this._elementRef = this.createInternalIntroPanel(t, i), this._isDisplayed = !0);
|
8596
8608
|
}
|
8597
|
-
_createClass(
|
8609
|
+
_createClass(Ut, [{
|
8598
8610
|
key: "createIntroPanelWithChild",
|
8599
8611
|
value: function createIntroPanelWithChild(e, t) {
|
8600
|
-
var i =
|
8612
|
+
var i = Ut.createIntroPanel(t);
|
8601
8613
|
return e.style.display === "none" && (e.style.display = "block"), i.appendChild(e), i;
|
8602
8614
|
}
|
8603
8615
|
}, {
|
8604
8616
|
key: "createInternalIntroPanel",
|
8605
8617
|
value: function createInternalIntroPanel(e, t) {
|
8606
|
-
var i =
|
8618
|
+
var i = Ut.createIntroPanel(t);
|
8607
8619
|
return i.id = "internal-intro-panel", i.innerHTML = e, i;
|
8608
8620
|
}
|
8609
8621
|
}, {
|
@@ -8623,7 +8635,7 @@ var qt = /*#__PURE__*/function () {
|
|
8623
8635
|
return t.classList.add("intro-panel"), Object.assign(t.style, e), t;
|
8624
8636
|
}
|
8625
8637
|
}]);
|
8626
|
-
return
|
8638
|
+
return Ut;
|
8627
8639
|
}();
|
8628
8640
|
var Bo = /*#__PURE__*/function () {
|
8629
8641
|
function Bo() {
|
@@ -8684,7 +8696,7 @@ var pe = /*#__PURE__*/function () {
|
|
8684
8696
|
key: "createAudioElement",
|
8685
8697
|
value: function createAudioElement(e, t) {
|
8686
8698
|
var i = document.createElement("audio");
|
8687
|
-
return i.src = e.src, i.classList.add("audio-player"), i.controls = !0, me.IS_SAFARI && (i.classList.add("audio-player-safari"), i.classList.add(t ===
|
8699
|
+
return i.src = e.src, i.classList.add("audio-player"), i.controls = !0, me.IS_SAFARI && (i.classList.add("audio-player-safari"), i.classList.add(t === x.USER_ROLE ? "audio-player-safari-right" : "audio-player-safari-left")), i;
|
8688
8700
|
}
|
8689
8701
|
}, {
|
8690
8702
|
key: "addNewAudioMessage",
|
@@ -8724,27 +8736,27 @@ var pe = /*#__PURE__*/function () {
|
|
8724
8736
|
}]);
|
8725
8737
|
return pe;
|
8726
8738
|
}();
|
8727
|
-
var fe = /*#__PURE__*/function (
|
8728
|
-
_inherits(fe,
|
8739
|
+
var fe = /*#__PURE__*/function (_We) {
|
8740
|
+
_inherits(fe, _We);
|
8729
8741
|
var _super36 = _createSuper(fe);
|
8730
8742
|
function fe(e, t, i) {
|
8731
|
-
var
|
8743
|
+
var _this37;
|
8732
8744
|
_classCallCheck(this, fe);
|
8733
8745
|
var a, l;
|
8734
|
-
|
8746
|
+
_this37 = _super36.call(this, e);
|
8735
8747
|
var n = t.permittedErrorPrefixes,
|
8736
8748
|
r = t.introPanelMarkUp,
|
8737
8749
|
o = t.demo;
|
8738
|
-
|
8739
|
-
return JSON.parse(JSON.stringify(
|
8740
|
-
}, e.clearMessages =
|
8741
|
-
|
8750
|
+
_this37._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this37._onClearMessages = Nt.onClearMessages.bind(_assertThisInitialized(_this37), e), _this37._onError = Nt.onError.bind(_assertThisInitialized(_this37), e), _this37._displayLoadingMessage = fe.getDisplayLoadingMessage(e, t), _this37._permittedErrorPrefixes = n, _this37.addSetupMessageIfNeeded(e, t), _this37.populateIntroPanel(i, r, e.introPanelStyle), _this37.addIntroductoryMessage(e, t), e.initialMessages && _this37.populateInitialMessages(e.initialMessages), _this37._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
8751
|
+
return JSON.parse(JSON.stringify(_this37.messages));
|
8752
|
+
}, e.clearMessages = _this37.clearMessages.bind(_assertThisInitialized(_this37), t), e.refreshMessages = _this37.refreshTextMessages.bind(_assertThisInitialized(_this37)), e.scrollToBottom = ne.scrollToBottom.bind(_assertThisInitialized(_this37), _this37.elementRef), e.addMessage = function (c, d) {
|
8753
|
+
_this37.addNewMessage(_objectSpread(_objectSpread({}, c), {}, {
|
8742
8754
|
sendUpdate: !!d
|
8743
8755
|
}), !d);
|
8744
|
-
}, t.addMessage =
|
8745
|
-
|
8756
|
+
}, t.addMessage = _this37.addIOMessage.bind(_assertThisInitialized(_this37)), o && _this37.prepareDemo(o), e.textToSpeech && Lt.processConfig(e.textToSpeech, function (c) {
|
8757
|
+
_this37.textToSpeech = c;
|
8746
8758
|
});
|
8747
|
-
return
|
8759
|
+
return _this37;
|
8748
8760
|
}
|
8749
8761
|
_createClass(fe, [{
|
8750
8762
|
key: "prepareDemo",
|
@@ -8756,33 +8768,35 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8756
8768
|
value: function addSetupMessageIfNeeded(e, t) {
|
8757
8769
|
var i = Bo.getText(e, t);
|
8758
8770
|
if (i) {
|
8759
|
-
var n = this.createAndAppendNewMessageElement(i,
|
8760
|
-
this.applyCustomStyles(n,
|
8771
|
+
var n = this.createAndAppendNewMessageElement(i, x.AI_ROLE);
|
8772
|
+
this.applyCustomStyles(n, x.AI_ROLE, !1);
|
8761
8773
|
}
|
8762
8774
|
}
|
8763
8775
|
}, {
|
8764
8776
|
key: "addIntroductoryMessage",
|
8765
8777
|
value: function addIntroductoryMessage(e, t) {
|
8766
|
-
var
|
8767
|
-
var
|
8768
|
-
|
8769
|
-
|
8770
|
-
|
8771
|
-
|
8772
|
-
|
8773
|
-
|
8774
|
-
|
8778
|
+
var _i10;
|
8779
|
+
var n, r;
|
8780
|
+
e != null && e.shadowRoot && t && (this._introMessage = e.introMessage);
|
8781
|
+
var i = this._introMessage;
|
8782
|
+
if (e && t != null && t.isWebModel() && ((_i10 = i) !== null && _i10 !== void 0 ? _i10 : i = t.getIntroMessage(e)), i) {
|
8783
|
+
if (i != null && i.text) {
|
8784
|
+
var o = this.createAndAppendNewMessageElement(i.text, x.AI_ROLE);
|
8785
|
+
this.applyCustomStyles(o, x.AI_ROLE, !1, (n = this.messageStyles) == null ? void 0 : n.intro);
|
8786
|
+
} else if (i != null && i.html) {
|
8787
|
+
var _o3 = Ye.add(this, i.html, x.AI_ROLE, this.messageElementRefs);
|
8788
|
+
this.applyCustomStyles(_o3, x.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.intro);
|
8775
8789
|
}
|
8776
8790
|
}
|
8777
8791
|
}
|
8778
8792
|
}, {
|
8779
8793
|
key: "populateInitialMessages",
|
8780
8794
|
value: function populateInitialMessages(e) {
|
8781
|
-
var
|
8795
|
+
var _this38 = this;
|
8782
8796
|
e.forEach(function (t) {
|
8783
|
-
Ae.processInitialMessageFile(t),
|
8797
|
+
Ae.processInitialMessageFile(t), _this38.addNewMessage(t, !0);
|
8784
8798
|
}), setTimeout(function () {
|
8785
|
-
return ne.scrollToBottom(
|
8799
|
+
return ne.scrollToBottom(_this38.elementRef);
|
8786
8800
|
});
|
8787
8801
|
}
|
8788
8802
|
// this should not be activated by streamed messages
|
@@ -8791,8 +8805,8 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8791
8805
|
value: function addNewMessage(e) {
|
8792
8806
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
8793
8807
|
var i = fe.createMessageContent(e);
|
8794
|
-
if (!e.ignoreText && i.text !== void 0 && e.text !== null && (this.addNewTextMessage(i.text, i.role, e.overwrite), !t && this.textToSpeech && i.role !==
|
8795
|
-
var n =
|
8808
|
+
if (!e.ignoreText && i.text !== void 0 && e.text !== null && (this.addNewTextMessage(i.text, i.role, e.overwrite), !t && this.textToSpeech && i.role !== x.USER_ROLE && Lt.speak(i.text, this.textToSpeech)), i.files && Array.isArray(i.files) && pe.addMessages(this, i.files, i.role), i.html !== void 0 && i.html !== null) {
|
8809
|
+
var n = Ye.add(this, i.html, i.role, this.messageElementRefs, e.overwrite);
|
8796
8810
|
ge.isElementTemporary(n) && delete i.html;
|
8797
8811
|
}
|
8798
8812
|
this.updateStateOnMessage(i, e.overwrite, e.sendUpdate, t);
|
@@ -8810,13 +8824,13 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8810
8824
|
value: function removeMessageOnError() {
|
8811
8825
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
8812
8826
|
t = e == null ? void 0 : e.bubbleElement;
|
8813
|
-
(t != null && t.classList.contains(
|
8827
|
+
(t != null && t.classList.contains($e.MESSAGE_CLASS) && t.textContent === "" || fe.isTemporaryElement(e)) && (e.outerContainer.remove(), this.messageElementRefs.pop());
|
8814
8828
|
}
|
8815
8829
|
// prettier-ignore
|
8816
8830
|
}, {
|
8817
8831
|
key: "addNewErrorMessage",
|
8818
8832
|
value: function addNewErrorMessage(e, t) {
|
8819
|
-
var l, c, d, u;
|
8833
|
+
var l, c, d, u, h;
|
8820
8834
|
this.removeMessageOnError();
|
8821
8835
|
var i = fe.createBaseElements(),
|
8822
8836
|
n = i.outerContainer,
|
@@ -8825,7 +8839,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8825
8839
|
var o = this.getPermittedMessage(t) || ((l = this._errorMessageOverrides) == null ? void 0 : l[e]) || ((c = this._errorMessageOverrides) == null ? void 0 : c["default"]) || "Error, please try again.";
|
8826
8840
|
this.renderText(r, o);
|
8827
8841
|
var a = P.extractParticularSharedStyles(["fontSize", "fontFamily"], (d = this.messageStyles) == null ? void 0 : d["default"]);
|
8828
|
-
P.applyCustomStylesToElements(i, !1, a), P.applyCustomStylesToElements(i, !1, (u = this.messageStyles) == null ? void 0 : u.error), this.elementRef.appendChild(n), ne.scrollToBottom(this.elementRef), this.textToSpeech && Lt.speak(o, this.textToSpeech);
|
8842
|
+
P.applyCustomStylesToElements(i, !1, a), P.applyCustomStylesToElements(i, !1, (u = this.messageStyles) == null ? void 0 : u.error), this.elementRef.appendChild(n), ne.scrollToBottom(this.elementRef), this.textToSpeech && Lt.speak(o, this.textToSpeech), (h = this._onError) == null || h.call(this, o);
|
8829
8843
|
}
|
8830
8844
|
}, {
|
8831
8845
|
key: "getPermittedMessage",
|
@@ -8845,29 +8859,29 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8845
8859
|
key: "isLastMessageError",
|
8846
8860
|
value: function isLastMessageError() {
|
8847
8861
|
var e;
|
8848
|
-
return (e =
|
8862
|
+
return (e = x.getLastMessageBubbleElement(this.elementRef)) == null ? void 0 : e.classList.contains("error-message-text");
|
8849
8863
|
}
|
8850
8864
|
}, {
|
8851
8865
|
key: "removeError",
|
8852
8866
|
value: function removeError() {
|
8853
|
-
this.isLastMessageError() &&
|
8867
|
+
this.isLastMessageError() && x.getLastMessageElement(this.elementRef).remove();
|
8854
8868
|
}
|
8855
8869
|
}, {
|
8856
8870
|
key: "addLoadingMessage",
|
8857
8871
|
value: function addLoadingMessage() {
|
8858
8872
|
var r;
|
8859
8873
|
if (!this._displayLoadingMessage) return;
|
8860
|
-
var e = this.createMessageElements("",
|
8874
|
+
var e = this.createMessageElements("", x.AI_ROLE),
|
8861
8875
|
t = e.outerContainer,
|
8862
8876
|
i = e.bubbleElement;
|
8863
8877
|
i.classList.add("loading-message-text");
|
8864
8878
|
var n = document.createElement("div");
|
8865
|
-
n.classList.add("dots-flashing"), i.appendChild(n), this.applyCustomStyles(e,
|
8879
|
+
n.classList.add("dots-flashing"), i.appendChild(n), this.applyCustomStyles(e, x.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.loading), Yi.set(i, this.messageStyles), this.elementRef.appendChild(t), ne.scrollToBottom(this.elementRef);
|
8866
8880
|
}
|
8867
8881
|
}, {
|
8868
8882
|
key: "populateIntroPanel",
|
8869
8883
|
value: function populateIntroPanel(e, t, i) {
|
8870
|
-
(e || t) && (this._introPanel = new
|
8884
|
+
(e || t) && (this._introPanel = new Ut(e, t, i), this._introPanel._elementRef && (se.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
8871
8885
|
}
|
8872
8886
|
}, {
|
8873
8887
|
key: "addMultipleFiles",
|
@@ -8918,11 +8932,10 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8918
8932
|
key: "clearMessages",
|
8919
8933
|
value: function clearMessages(e, t) {
|
8920
8934
|
var n, r;
|
8921
|
-
console.log("messages cleared");
|
8922
8935
|
var i = [];
|
8923
8936
|
this.messageElementRefs.forEach(function (o) {
|
8924
8937
|
var a = o.bubbleElement.classList;
|
8925
|
-
a.contains("loading-message-text") || a.contains(
|
8938
|
+
a.contains("loading-message-text") || a.contains($e.MESSAGE_CLASS) ? i.push(o) : o.outerContainer.remove();
|
8926
8939
|
}), Array.from(this.elementRef.children).forEach(function (o) {
|
8927
8940
|
var l;
|
8928
8941
|
var a = (l = o.children[0]) == null ? void 0 : l.children[0];
|
@@ -8942,7 +8955,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8942
8955
|
}
|
8943
8956
|
}]);
|
8944
8957
|
return fe;
|
8945
|
-
}(
|
8958
|
+
}(We);
|
8946
8959
|
var yt = /*#__PURE__*/function () {
|
8947
8960
|
function W() {
|
8948
8961
|
_classCallCheck(this, W);
|
@@ -8984,11 +8997,11 @@ yt.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment
|
|
8984
8997
|
yt.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS = "text-input-container-left-small-adjustment";
|
8985
8998
|
yt.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS = "text-input-container-right-small-adjustment";
|
8986
8999
|
var zo = yt;
|
8987
|
-
var
|
8988
|
-
function
|
8989
|
-
_classCallCheck(this,
|
9000
|
+
var Xe = /*#__PURE__*/function () {
|
9001
|
+
function Xe() {
|
9002
|
+
_classCallCheck(this, Xe);
|
8990
9003
|
}
|
8991
|
-
_createClass(
|
9004
|
+
_createClass(Xe, null, [{
|
8992
9005
|
key: "create",
|
8993
9006
|
value: function create() {
|
8994
9007
|
return Array.from({
|
@@ -9012,11 +9025,11 @@ var Ze = /*#__PURE__*/function () {
|
|
9012
9025
|
key: "addButton",
|
9013
9026
|
value: function addButton(e, t, i) {
|
9014
9027
|
t.classList.add(i);
|
9015
|
-
var n =
|
9028
|
+
var n = Xe.getContainerIndex(i);
|
9016
9029
|
e[n].appendChild(t), n === 3 && t.classList.add("outside-right");
|
9017
9030
|
}
|
9018
9031
|
}]);
|
9019
|
-
return
|
9032
|
+
return Xe;
|
9020
9033
|
}();
|
9021
9034
|
var gn = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "microphone"];
|
9022
9035
|
var D = /*#__PURE__*/function () {
|
@@ -9232,11 +9245,11 @@ var we = /*#__PURE__*/function () {
|
|
9232
9245
|
}();
|
9233
9246
|
var $i = /*#__PURE__*/function () {
|
9234
9247
|
function $i(e, t) {
|
9235
|
-
var
|
9248
|
+
var _this39 = this;
|
9236
9249
|
_classCallCheck(this, $i);
|
9237
9250
|
var i;
|
9238
9251
|
this._isOpen = !0, this._styles = t, this.elementRef = $i.createElement((i = this._styles) == null ? void 0 : i.container), this.close(), setTimeout(function () {
|
9239
|
-
return
|
9252
|
+
return _this39.addWindowEvents(e);
|
9240
9253
|
});
|
9241
9254
|
}
|
9242
9255
|
_createClass($i, [{
|
@@ -9264,13 +9277,13 @@ var $i = /*#__PURE__*/function () {
|
|
9264
9277
|
}, {
|
9265
9278
|
key: "addWindowEvents",
|
9266
9279
|
value: function addWindowEvents(e) {
|
9267
|
-
var
|
9280
|
+
var _this40 = this;
|
9268
9281
|
window.addEventListener("click", function (t) {
|
9269
9282
|
var i;
|
9270
|
-
e.parentElement !== ((i = t.target.shadowRoot) == null ? void 0 : i.children[0]) &&
|
9283
|
+
e.parentElement !== ((i = t.target.shadowRoot) == null ? void 0 : i.children[0]) && _this40.close();
|
9271
9284
|
}), window.addEventListener("keydown", function (t) {
|
9272
9285
|
var i, n, r;
|
9273
|
-
|
9286
|
+
_this40._isOpen && (t.key === R.ESCAPE ? (_this40.close(), (i = _this40.highlightedItem) == null || i.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === R.ENTER ? ((n = _this40.highlightedItem) == null || n.click(), (r = _this40.highlightedItem) == null || r.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === R.ARROW_DOWN ? ft.focusSiblingItem(_this40.highlightedItem || _this40.elementRef.children[_this40.elementRef.children.length - 1], _this40.elementRef, !0) : t.key === R.ARROW_UP && ft.focusSiblingItem(_this40.highlightedItem || _this40.elementRef.children[0], _this40.elementRef, !1));
|
9274
9287
|
});
|
9275
9288
|
}
|
9276
9289
|
}], [{
|
@@ -9282,25 +9295,25 @@ var $i = /*#__PURE__*/function () {
|
|
9282
9295
|
}]);
|
9283
9296
|
return $i;
|
9284
9297
|
}();
|
9285
|
-
var
|
9286
|
-
_inherits(
|
9287
|
-
var _super37 = _createSuper(
|
9288
|
-
function
|
9289
|
-
var
|
9290
|
-
_classCallCheck(this,
|
9298
|
+
var Ke = /*#__PURE__*/function (_xt) {
|
9299
|
+
_inherits(Ke, _xt);
|
9300
|
+
var _super37 = _createSuper(Ke);
|
9301
|
+
function Ke(e, t) {
|
9302
|
+
var _this41;
|
9303
|
+
_classCallCheck(this, Ke);
|
9291
9304
|
var n;
|
9292
|
-
|
9305
|
+
_this41 = _super37.call(this, Ke.createButtonElement(), void 0, {
|
9293
9306
|
styles: (n = t == null ? void 0 : t.button) == null ? void 0 : n.styles
|
9294
9307
|
});
|
9295
|
-
var i =
|
9296
|
-
|
9297
|
-
return
|
9308
|
+
var i = _this41.createInnerElements(_this41._customStyles);
|
9309
|
+
_this41._menu = new $i(e, t == null ? void 0 : t.menu), _this41.addClickEvent(), _this41.buttonContainer = Ke.createButtonContainer(), _this41.elementRef.appendChild(i.styles), _this41.buttonContainer.appendChild(_this41.elementRef), _this41.elementRef.classList.add("dropup-icon", "upload-file-button"), _this41.buttonContainer.appendChild(_this41._menu.elementRef), _this41.reapplyStateStyle("styles"), _this41.addContainerEvents(e);
|
9310
|
+
return _this41;
|
9298
9311
|
}
|
9299
|
-
_createClass(
|
9312
|
+
_createClass(Ke, [{
|
9300
9313
|
key: "createInnerElements",
|
9301
9314
|
value: function createInnerElements(e) {
|
9302
9315
|
return {
|
9303
|
-
styles: this.createInnerElement(
|
9316
|
+
styles: this.createInnerElement(Ke.createSVGIconElement(), "styles", e)
|
9304
9317
|
};
|
9305
9318
|
}
|
9306
9319
|
}, {
|
@@ -9321,9 +9334,9 @@ var We = /*#__PURE__*/function (_xt) {
|
|
9321
9334
|
}, {
|
9322
9335
|
key: "addContainerEvents",
|
9323
9336
|
value: function addContainerEvents(e) {
|
9324
|
-
var
|
9337
|
+
var _this42 = this;
|
9325
9338
|
e.addEventListener("click", function (t) {
|
9326
|
-
t.target.classList.contains("dropup-icon") ||
|
9339
|
+
t.target.classList.contains("dropup-icon") || _this42._menu.close();
|
9327
9340
|
});
|
9328
9341
|
}
|
9329
9342
|
}], [{
|
@@ -9351,7 +9364,7 @@ var We = /*#__PURE__*/function (_xt) {
|
|
9351
9364
|
return (i = t == null ? void 0 : t.button) != null && i.position ? (n = t == null ? void 0 : t.button) == null ? void 0 : n.position : e["outside-left"].length > 0 && e["outside-right"].length === 0 ? "outside-right" : "outside-left";
|
9352
9365
|
}
|
9353
9366
|
}]);
|
9354
|
-
return
|
9367
|
+
return Ke;
|
9355
9368
|
}(xt);
|
9356
9369
|
var j = /*#__PURE__*/function () {
|
9357
9370
|
function j() {
|
@@ -9362,7 +9375,7 @@ var j = /*#__PURE__*/function () {
|
|
9362
9375
|
value:
|
9363
9376
|
// prettier-ignore
|
9364
9377
|
function addToDropup(e, t, i, n) {
|
9365
|
-
var r = new
|
9378
|
+
var r = new Ke(i, n);
|
9366
9379
|
gn.forEach(function (a) {
|
9367
9380
|
var l = t["dropup-menu"].findIndex(function (d) {
|
9368
9381
|
return d.buttonType === a;
|
@@ -9370,8 +9383,8 @@ var j = /*#__PURE__*/function () {
|
|
9370
9383
|
c = t["dropup-menu"][l];
|
9371
9384
|
c && (r.addItem(c.button), t["dropup-menu"].splice(l, 1));
|
9372
9385
|
});
|
9373
|
-
var o =
|
9374
|
-
|
9386
|
+
var o = Ke.getPosition(t, n);
|
9387
|
+
Xe.addButton(e, r.buttonContainer, o), t[o].push({});
|
9375
9388
|
}
|
9376
9389
|
}, {
|
9377
9390
|
key: "addToSideContainer",
|
@@ -9379,7 +9392,7 @@ var j = /*#__PURE__*/function () {
|
|
9379
9392
|
["inside-left", "inside-right", "outside-left", "outside-right"].forEach(function (n) {
|
9380
9393
|
var r = n;
|
9381
9394
|
t[r].forEach(function (o) {
|
9382
|
-
|
9395
|
+
Xe.addButton(e, o.button.elementRef, r);
|
9383
9396
|
});
|
9384
9397
|
});
|
9385
9398
|
}
|
@@ -9458,10 +9471,10 @@ var Uo = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\"
|
|
9458
9471
|
var de = /*#__PURE__*/function () {
|
9459
9472
|
// prettier-ignore
|
9460
9473
|
function de(e, t, i, n) {
|
9461
|
-
var
|
9474
|
+
var _this43 = this;
|
9462
9475
|
_classCallCheck(this, de);
|
9463
9476
|
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = n, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
|
9464
|
-
|
9477
|
+
_this43._validationHandler = e._validationHandler;
|
9465
9478
|
});
|
9466
9479
|
}
|
9467
9480
|
_createClass(de, [{
|
@@ -9477,7 +9490,7 @@ var de = /*#__PURE__*/function () {
|
|
9477
9490
|
var r = de.createImageAttachment(t);
|
9478
9491
|
this.addFileAttachment(e, "image", r, i);
|
9479
9492
|
} else if (n === "audio") {
|
9480
|
-
var _r2 =
|
9493
|
+
var _r2 = Bi.createAudioAttachment(t);
|
9481
9494
|
this.addFileAttachment(e, "audio", _r2, i);
|
9482
9495
|
} else {
|
9483
9496
|
var _r3 = de.createAnyFileAttachment(e.name);
|
@@ -9518,7 +9531,7 @@ var de = /*#__PURE__*/function () {
|
|
9518
9531
|
return r === e;
|
9519
9532
|
}),
|
9520
9533
|
i = this._attachments[t].attachmentContainerElement;
|
9521
|
-
this._attachments.splice(t, 1),
|
9534
|
+
this._attachments.splice(t, 1), Bi.stopAttachmentPlayback(i), i.remove(), this._toggleContainerDisplay(!1), (n = this._validationHandler) == null || n.call(this);
|
9522
9535
|
}
|
9523
9536
|
}, {
|
9524
9537
|
key: "getFiles",
|
@@ -9602,12 +9615,12 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9602
9615
|
_createClass(Se, [{
|
9603
9616
|
key: "createTimer",
|
9604
9617
|
value: function createTimer(e, t) {
|
9605
|
-
var
|
9618
|
+
var _this44 = this;
|
9606
9619
|
var i = 0;
|
9607
9620
|
var n = t !== void 0 && t < Se.TIMER_LIMIT_S ? t : Se.TIMER_LIMIT_S;
|
9608
9621
|
return setInterval(function () {
|
9609
9622
|
var a;
|
9610
|
-
i += 1, i === n && ((a =
|
9623
|
+
i += 1, i === n && ((a = _this44.stopPlaceholderCallback) == null || a.call(_this44), _this44.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
9611
9624
|
var r = Math.floor(i / 60),
|
9612
9625
|
o = (i % 60).toString().padStart(2, "0");
|
9613
9626
|
e.textContent = "".concat(r, ":").concat(o);
|
@@ -9627,7 +9640,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9627
9640
|
}, {
|
9628
9641
|
key: "addPlaceholderAudioAttachmentEvents",
|
9629
9642
|
value: function addPlaceholderAudioAttachmentEvents(e, t, i) {
|
9630
|
-
var
|
9643
|
+
var _this45 = this;
|
9631
9644
|
var n = function n() {
|
9632
9645
|
return e.replaceChildren(t);
|
9633
9646
|
};
|
@@ -9638,7 +9651,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9638
9651
|
e.addEventListener("mouseleave", r);
|
9639
9652
|
var o = function o() {
|
9640
9653
|
var a;
|
9641
|
-
return (a =
|
9654
|
+
return (a = _this45.stopPlaceholderCallback) == null ? void 0 : a.call(_this45);
|
9642
9655
|
};
|
9643
9656
|
e.addEventListener("click", o);
|
9644
9657
|
}
|
@@ -9706,7 +9719,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9706
9719
|
return Se;
|
9707
9720
|
}(de);
|
9708
9721
|
as.TIMER_LIMIT_S = 5999;
|
9709
|
-
var
|
9722
|
+
var Bi = as;
|
9710
9723
|
var Jo = /*#__PURE__*/function () {
|
9711
9724
|
function Jo() {
|
9712
9725
|
_classCallCheck(this, Jo);
|
@@ -9716,7 +9729,7 @@ var Jo = /*#__PURE__*/function () {
|
|
9716
9729
|
value:
|
9717
9730
|
// prettier-ignore
|
9718
9731
|
function create(e, t, i, n, r) {
|
9719
|
-
return r === "audio" ? new
|
9732
|
+
return r === "audio" ? new Bi(e, t, i, n) : new de(e, t, i, n);
|
9720
9733
|
}
|
9721
9734
|
}]);
|
9722
9735
|
return Jo;
|
@@ -9833,20 +9846,20 @@ var ls = /*#__PURE__*/function () {
|
|
9833
9846
|
}, {
|
9834
9847
|
key: "addButtons",
|
9835
9848
|
value: function addButtons() {
|
9836
|
-
var
|
9849
|
+
var _this46 = this;
|
9837
9850
|
for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
9838
9851
|
e[_key2] = arguments[_key2];
|
9839
9852
|
}
|
9840
9853
|
e.forEach(function (t) {
|
9841
|
-
return
|
9854
|
+
return _this46._buttonPanel.appendChild(t);
|
9842
9855
|
});
|
9843
9856
|
}
|
9844
9857
|
}, {
|
9845
9858
|
key: "close",
|
9846
9859
|
value: function close() {
|
9847
|
-
var
|
9860
|
+
var _this47 = this;
|
9848
9861
|
this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
|
9849
|
-
|
9862
|
+
_this47._elementRef.style.display = "none", _this47._backgroundPanelRef.style.display = "none";
|
9850
9863
|
}, ae.MODAL_CLOSE_TIMEOUT_MS);
|
9851
9864
|
}
|
9852
9865
|
}, {
|
@@ -9862,10 +9875,10 @@ var ls = /*#__PURE__*/function () {
|
|
9862
9875
|
}, {
|
9863
9876
|
key: "addCloseButton",
|
9864
9877
|
value: function addCloseButton(e, t, i) {
|
9865
|
-
var
|
9878
|
+
var _this48 = this;
|
9866
9879
|
var n = t ? ae.createSVGButton(e) : ae.createTextButton(e);
|
9867
9880
|
return this.addButtons(n), n.onclick = function () {
|
9868
|
-
|
9881
|
+
_this48.close(), setTimeout(function () {
|
9869
9882
|
i == null || i();
|
9870
9883
|
}, 140);
|
9871
9884
|
}, n;
|
@@ -9873,10 +9886,10 @@ var ls = /*#__PURE__*/function () {
|
|
9873
9886
|
}, {
|
9874
9887
|
key: "addWindowEvents",
|
9875
9888
|
value: function addWindowEvents() {
|
9876
|
-
var
|
9889
|
+
var _this49 = this;
|
9877
9890
|
window.addEventListener("keydown", function (e) {
|
9878
9891
|
var t, i;
|
9879
|
-
|
9892
|
+
_this49._isOpen && (e.key === R.ESCAPE ? (_this49.close(), (t = _this49.extensionCloseCallback) == null || t.call(_this49)) : e.key === R.ENTER && (_this49.close(), (i = _this49.extensionCloseCallback) == null || i.call(_this49)));
|
9880
9893
|
});
|
9881
9894
|
}
|
9882
9895
|
}], [{
|
@@ -9937,13 +9950,13 @@ var ct = /*#__PURE__*/function (_xt2) {
|
|
9937
9950
|
var _super39 = _createSuper(ct);
|
9938
9951
|
// prettier-ignore
|
9939
9952
|
function ct(e, t, i, n, r, o) {
|
9940
|
-
var
|
9953
|
+
var _this50;
|
9941
9954
|
_classCallCheck(this, ct);
|
9942
|
-
var l, c, d, u,
|
9943
|
-
|
9944
|
-
var a =
|
9945
|
-
|
9946
|
-
return
|
9955
|
+
var l, c, d, u, h, p;
|
9956
|
+
_this50 = _super39.call(this, ct.createButtonElement(), (l = i.button) == null ? void 0 : l.position, i.button, o);
|
9957
|
+
var a = _this50.createInnerElements(n, r, _this50._customStyles);
|
9958
|
+
_this50._inputElement = ct.createInputElement((c = i == null ? void 0 : i.files) == null ? void 0 : c.acceptedFormats), _this50.addClickEvent(e, i), _this50.elementRef.replaceChildren(a.styles), _this50.reapplyStateStyle("styles"), _this50._fileAttachmentsType = t, _this50._openModalOnce = ((u = (d = i.files) == null ? void 0 : d.infoModal) == null ? void 0 : u.openModalOnce) === !1 || (p = (h = i.files) == null ? void 0 : h.infoModal) == null ? void 0 : p.openModalOnce;
|
9959
|
+
return _this50;
|
9947
9960
|
}
|
9948
9961
|
_createClass(ct, [{
|
9949
9962
|
key: "createInnerElements",
|
@@ -10161,10 +10174,10 @@ var mt = /*#__PURE__*/function (_xt3) {
|
|
10161
10174
|
_inherits(mt, _xt3);
|
10162
10175
|
var _super40 = _createSuper(mt);
|
10163
10176
|
function mt(e) {
|
10164
|
-
var
|
10177
|
+
var _this51;
|
10165
10178
|
_classCallCheck(this, mt);
|
10166
|
-
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"),
|
10167
|
-
return
|
10179
|
+
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this51 = _super40.call(this, mt.createMicrophoneElement(), e == null ? void 0 : e.position, e), _this51.isActive = !1, _this51._innerElements = _this51.createInnerElements(_this51._customStyles), _this51.changeToDefault();
|
10180
|
+
return _this51;
|
10168
10181
|
}
|
10169
10182
|
_createClass(mt, [{
|
10170
10183
|
key: "createInnerElements",
|
@@ -10235,14 +10248,14 @@ var mt = /*#__PURE__*/function (_xt3) {
|
|
10235
10248
|
return mt;
|
10236
10249
|
}(xt);
|
10237
10250
|
var cs = {},
|
10238
|
-
ii = {},
|
10239
10251
|
ni = {},
|
10252
|
+
si = {},
|
10240
10253
|
St = {},
|
10241
|
-
|
10242
|
-
Object.defineProperty(
|
10254
|
+
De = {};
|
10255
|
+
Object.defineProperty(De, "__esModule", {
|
10243
10256
|
value: !0
|
10244
10257
|
});
|
10245
|
-
|
10258
|
+
De.Text = void 0;
|
10246
10259
|
var ve = /*#__PURE__*/function () {
|
10247
10260
|
function ve() {
|
10248
10261
|
_classCallCheck(this, ve);
|
@@ -10273,7 +10286,7 @@ var ve = /*#__PURE__*/function () {
|
|
10273
10286
|
}]);
|
10274
10287
|
return ve;
|
10275
10288
|
}();
|
10276
|
-
|
10289
|
+
De.Text = ve;
|
10277
10290
|
ve.FIRST_CHAR_REGEX = /\S/;
|
10278
10291
|
ve.DOUBLE_LINE = /\n\n/g;
|
10279
10292
|
ve.ONE_LINE = /\n/g;
|
@@ -10281,7 +10294,7 @@ Object.defineProperty(St, "__esModule", {
|
|
10281
10294
|
value: !0
|
10282
10295
|
});
|
10283
10296
|
St.Translate = void 0;
|
10284
|
-
var $o =
|
10297
|
+
var $o = De;
|
10285
10298
|
var Zo = /*#__PURE__*/function () {
|
10286
10299
|
function Zo() {
|
10287
10300
|
_classCallCheck(this, Zo);
|
@@ -10297,10 +10310,10 @@ var Zo = /*#__PURE__*/function () {
|
|
10297
10310
|
return Zo;
|
10298
10311
|
}();
|
10299
10312
|
St.Translate = Zo;
|
10300
|
-
Object.defineProperty(
|
10313
|
+
Object.defineProperty(si, "__esModule", {
|
10301
10314
|
value: !0
|
10302
10315
|
});
|
10303
|
-
|
10316
|
+
si.WebSpeechTranscript = void 0;
|
10304
10317
|
var vn = St;
|
10305
10318
|
var Xo = /*#__PURE__*/function () {
|
10306
10319
|
function Xo() {
|
@@ -10338,7 +10351,7 @@ var Xo = /*#__PURE__*/function () {
|
|
10338
10351
|
}]);
|
10339
10352
|
return Xo;
|
10340
10353
|
}();
|
10341
|
-
|
10354
|
+
si.WebSpeechTranscript = Xo;
|
10342
10355
|
var Qe = {};
|
10343
10356
|
Object.defineProperty(Qe, "__esModule", {
|
10344
10357
|
value: !0
|
@@ -10352,11 +10365,11 @@ ot.IS_SAFARI = function () {
|
|
10352
10365
|
return ot._IS_SAFARI === void 0 && (ot._IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), ot._IS_SAFARI;
|
10353
10366
|
};
|
10354
10367
|
var wt = {},
|
10355
|
-
|
10356
|
-
Object.defineProperty(
|
10368
|
+
ri = {};
|
10369
|
+
Object.defineProperty(ri, "__esModule", {
|
10357
10370
|
value: !0
|
10358
10371
|
});
|
10359
|
-
|
10372
|
+
ri.EventListeners = void 0;
|
10360
10373
|
var J = /*#__PURE__*/function () {
|
10361
10374
|
function J() {
|
10362
10375
|
_classCallCheck(this, J);
|
@@ -10371,9 +10384,9 @@ var J = /*#__PURE__*/function () {
|
|
10371
10384
|
}, {
|
10372
10385
|
key: "keyDownWindow",
|
10373
10386
|
value: function keyDownWindow(e) {
|
10374
|
-
var
|
10387
|
+
var _this52 = this;
|
10375
10388
|
e.element && J.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (J.KEY_DOWN_TIMEOUT !== null && clearTimeout(J.KEY_DOWN_TIMEOUT), J.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
10376
|
-
J.KEY_DOWN_TIMEOUT = null,
|
10389
|
+
J.KEY_DOWN_TIMEOUT = null, _this52.resetRecording(e);
|
10377
10390
|
}, 500));
|
10378
10391
|
}
|
10379
10392
|
}, {
|
@@ -10400,13 +10413,13 @@ var J = /*#__PURE__*/function () {
|
|
10400
10413
|
}]);
|
10401
10414
|
return J;
|
10402
10415
|
}();
|
10403
|
-
|
10416
|
+
ri.EventListeners = J;
|
10404
10417
|
J.KEY_DOWN_TIMEOUT = null;
|
10405
|
-
var
|
10406
|
-
Object.defineProperty(
|
10418
|
+
var oi = {};
|
10419
|
+
Object.defineProperty(oi, "__esModule", {
|
10407
10420
|
value: !0
|
10408
10421
|
});
|
10409
|
-
|
10422
|
+
oi.PreResultUtils = void 0;
|
10410
10423
|
var Qo = /*#__PURE__*/function () {
|
10411
10424
|
function Qo() {
|
10412
10425
|
_classCallCheck(this, Qo);
|
@@ -10422,7 +10435,7 @@ var Qo = /*#__PURE__*/function () {
|
|
10422
10435
|
}]);
|
10423
10436
|
return Qo;
|
10424
10437
|
}();
|
10425
|
-
|
10438
|
+
oi.PreResultUtils = Qo;
|
10426
10439
|
var _t = {},
|
10427
10440
|
Mt = {};
|
10428
10441
|
Object.defineProperty(Mt, "__esModule", {
|
@@ -10466,11 +10479,11 @@ var Zi = /*#__PURE__*/function () {
|
|
10466
10479
|
return Zi;
|
10467
10480
|
}();
|
10468
10481
|
Mt.AutoScroll = Zi;
|
10469
|
-
var
|
10470
|
-
Object.defineProperty(
|
10482
|
+
var je = {};
|
10483
|
+
Object.defineProperty(je, "__esModule", {
|
10471
10484
|
value: !0
|
10472
10485
|
});
|
10473
|
-
|
10486
|
+
je.Elements = void 0;
|
10474
10487
|
var ea = /*#__PURE__*/function () {
|
10475
10488
|
function ea() {
|
10476
10489
|
_classCallCheck(this, ea);
|
@@ -10518,12 +10531,12 @@ var ea = /*#__PURE__*/function () {
|
|
10518
10531
|
}]);
|
10519
10532
|
return ea;
|
10520
10533
|
}();
|
10521
|
-
|
10522
|
-
var
|
10523
|
-
Object.defineProperty(
|
10534
|
+
je.Elements = ea;
|
10535
|
+
var Be = {};
|
10536
|
+
Object.defineProperty(Be, "__esModule", {
|
10524
10537
|
value: !0
|
10525
10538
|
});
|
10526
|
-
|
10539
|
+
Be.Cursor = void 0;
|
10527
10540
|
var dt = /*#__PURE__*/function () {
|
10528
10541
|
function dt() {
|
10529
10542
|
_classCallCheck(this, dt);
|
@@ -10541,10 +10554,10 @@ var dt = /*#__PURE__*/function () {
|
|
10541
10554
|
i += a;
|
10542
10555
|
} else if (o.textContent !== null) {
|
10543
10556
|
if (i + o.textContent.length > t) {
|
10544
|
-
var
|
10545
|
-
|
10557
|
+
var _a2 = document.createRange();
|
10558
|
+
_a2.setStart(o, t - i), _a2.collapse(!0);
|
10546
10559
|
var l = window.getSelection();
|
10547
|
-
return l == null || l.removeAllRanges(), l == null || l.addRange(
|
10560
|
+
return l == null || l.removeAllRanges(), l == null || l.addRange(_a2), e.focus(), -1;
|
10548
10561
|
}
|
10549
10562
|
i += o.textContent.length, n += o.textContent.length;
|
10550
10563
|
}
|
@@ -10605,16 +10618,16 @@ var dt = /*#__PURE__*/function () {
|
|
10605
10618
|
}]);
|
10606
10619
|
return dt;
|
10607
10620
|
}();
|
10608
|
-
|
10621
|
+
Be.Cursor = dt;
|
10609
10622
|
Object.defineProperty(_t, "__esModule", {
|
10610
10623
|
value: !0
|
10611
10624
|
});
|
10612
10625
|
_t.CommandUtils = void 0;
|
10613
10626
|
var yn = Mt,
|
10614
|
-
ta =
|
10627
|
+
ta = je,
|
10615
10628
|
ia = Qe,
|
10616
|
-
xn =
|
10617
|
-
En =
|
10629
|
+
xn = Be,
|
10630
|
+
En = De;
|
10618
10631
|
var K = /*#__PURE__*/function () {
|
10619
10632
|
function K() {
|
10620
10633
|
_classCallCheck(this, K);
|
@@ -10678,31 +10691,31 @@ var K = /*#__PURE__*/function () {
|
|
10678
10691
|
if (!c || !n || !i) return;
|
10679
10692
|
var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
|
10680
10693
|
u = En.Text.breakupIntoWordsArr(d),
|
10681
|
-
|
10682
|
-
if (c.commandMode &&
|
10694
|
+
h = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? K.checkIfMatchesWord : K.checkIfMatchesSubstring;
|
10695
|
+
if (c.commandMode && h(c.commandMode, d, u)) return e.setInterimColorToFinal(), setTimeout(function () {
|
10683
10696
|
return K.toggleCommandModeOn(e);
|
10684
10697
|
}), {
|
10685
10698
|
doNotProcessTranscription: !1
|
10686
10699
|
};
|
10687
10700
|
if (!(c.commandMode && !e.isWaitingForCommand)) {
|
10688
|
-
if (c.stop &&
|
10701
|
+
if (c.stop && h(c.stop, d, u)) return K.toggleCommandModeOff(e), setTimeout(function () {
|
10689
10702
|
return e.stop();
|
10690
10703
|
}), {
|
10691
10704
|
doNotProcessTranscription: !1
|
10692
10705
|
};
|
10693
|
-
if (c.pause &&
|
10694
|
-
var
|
10695
|
-
e.isPaused = !0, (
|
10706
|
+
if (c.pause && h(c.pause, d, u)) return K.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
10707
|
+
var p;
|
10708
|
+
e.isPaused = !0, (p = e.onPauseTrigger) === null || p === void 0 || p.call(e, !0);
|
10696
10709
|
}), {
|
10697
10710
|
doNotProcessTranscription: !1
|
10698
10711
|
};
|
10699
|
-
if (c.resume &&
|
10712
|
+
if (c.resume && h(c.resume, d, u)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1), K.toggleCommandModeOff(e), e.resetRecording(i), {
|
10700
10713
|
doNotProcessTranscription: !0
|
10701
10714
|
};
|
10702
|
-
if (c.reset &&
|
10715
|
+
if (c.reset && h(c.reset, d, u)) return r !== void 0 && K.setText(e, i, r, n), {
|
10703
10716
|
doNotProcessTranscription: !0
|
10704
10717
|
};
|
10705
|
-
if (c.removeAllText &&
|
10718
|
+
if (c.removeAllText && h(c.removeAllText, d, u)) return K.setText(e, i, "", n), {
|
10706
10719
|
doNotProcessTranscription: !0
|
10707
10720
|
};
|
10708
10721
|
}
|
@@ -10711,18 +10724,18 @@ var K = /*#__PURE__*/function () {
|
|
10711
10724
|
return K;
|
10712
10725
|
}();
|
10713
10726
|
_t.CommandUtils = K;
|
10714
|
-
var
|
10715
|
-
Object.defineProperty(
|
10727
|
+
var ai = {};
|
10728
|
+
Object.defineProperty(ai, "__esModule", {
|
10716
10729
|
value: !0
|
10717
10730
|
});
|
10718
|
-
|
10719
|
-
var na =
|
10720
|
-
et =
|
10721
|
-
var
|
10722
|
-
function
|
10723
|
-
_classCallCheck(this,
|
10731
|
+
ai.Highlight = void 0;
|
10732
|
+
var na = je,
|
10733
|
+
et = Be;
|
10734
|
+
var Ht = /*#__PURE__*/function () {
|
10735
|
+
function Ht() {
|
10736
|
+
_classCallCheck(this, Ht);
|
10724
10737
|
}
|
10725
|
-
_createClass(
|
10738
|
+
_createClass(Ht, null, [{
|
10726
10739
|
key: "setStateForPrimitive",
|
10727
10740
|
value: function setStateForPrimitive(e, t) {
|
10728
10741
|
var i, n;
|
@@ -10741,7 +10754,7 @@ var Ut = /*#__PURE__*/function () {
|
|
10741
10754
|
}, {
|
10742
10755
|
key: "setState",
|
10743
10756
|
value: function setState(e, t) {
|
10744
|
-
document.activeElement === t && (na.Elements.isPrimitiveElement(t) ?
|
10757
|
+
document.activeElement === t && (na.Elements.isPrimitiveElement(t) ? Ht.setStateForPrimitive(e, t) : Ht.setStateForGeneric(e, t));
|
10745
10758
|
}
|
10746
10759
|
}, {
|
10747
10760
|
key: "removeForGeneric",
|
@@ -10765,22 +10778,22 @@ var Ut = /*#__PURE__*/function () {
|
|
10765
10778
|
e.isHighlighted = !1;
|
10766
10779
|
}
|
10767
10780
|
}]);
|
10768
|
-
return
|
10781
|
+
return Ht;
|
10769
10782
|
}();
|
10770
|
-
|
10771
|
-
var
|
10772
|
-
Object.defineProperty(
|
10783
|
+
ai.Highlight = Ht;
|
10784
|
+
var li = {};
|
10785
|
+
Object.defineProperty(li, "__esModule", {
|
10773
10786
|
value: !0
|
10774
10787
|
});
|
10775
|
-
|
10776
|
-
var sa =
|
10777
|
-
Sn =
|
10778
|
-
|
10779
|
-
var
|
10780
|
-
function
|
10781
|
-
_classCallCheck(this,
|
10788
|
+
li.Padding = void 0;
|
10789
|
+
var sa = je,
|
10790
|
+
Sn = Be,
|
10791
|
+
ze = De;
|
10792
|
+
var Gt = /*#__PURE__*/function () {
|
10793
|
+
function Gt() {
|
10794
|
+
_classCallCheck(this, Gt);
|
10782
10795
|
}
|
10783
|
-
_createClass(
|
10796
|
+
_createClass(Gt, null, [{
|
10784
10797
|
key: "setStateForPrimitiveElement",
|
10785
10798
|
value: function setStateForPrimitiveElement(e, t) {
|
10786
10799
|
if (document.activeElement === t && t.selectionStart !== null) {
|
@@ -10788,11 +10801,11 @@ var Ht = /*#__PURE__*/function () {
|
|
10788
10801
|
r = t.value[n - 1],
|
10789
10802
|
o = t.selectionEnd === null ? n : t.selectionEnd,
|
10790
10803
|
a = t.value[o];
|
10791
|
-
|
10804
|
+
ze.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), ze.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
|
10792
10805
|
return;
|
10793
10806
|
}
|
10794
10807
|
var i = t.value[t.value.length - 1];
|
10795
|
-
|
10808
|
+
ze.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
|
10796
10809
|
}
|
10797
10810
|
}, {
|
10798
10811
|
key: "setStateForGenericElement",
|
@@ -10805,17 +10818,17 @@ var Ht = /*#__PURE__*/function () {
|
|
10805
10818
|
c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
|
10806
10819
|
d = Sn.Cursor.getGenericElementCursorOffset(t, a, !1),
|
10807
10820
|
u = (n = t.textContent) === null || n === void 0 ? void 0 : n[d];
|
10808
|
-
|
10821
|
+
ze.Text.isCharDefined(c) && (e.startPadding = " "), ze.Text.isCharDefined(u) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
|
10809
10822
|
return;
|
10810
10823
|
}
|
10811
10824
|
}
|
10812
10825
|
var o = t.innerText.charAt(t.innerText.length - 1);
|
10813
|
-
|
10826
|
+
ze.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
|
10814
10827
|
}
|
10815
10828
|
}, {
|
10816
10829
|
key: "setState",
|
10817
10830
|
value: function setState(e, t) {
|
10818
|
-
sa.Elements.isPrimitiveElement(t) ?
|
10831
|
+
sa.Elements.isPrimitiveElement(t) ? Gt.setStateForPrimitiveElement(e, t) : Gt.setStateForGenericElement(e, t);
|
10819
10832
|
}
|
10820
10833
|
}, {
|
10821
10834
|
key: "adjustStateAfterRecodingPrimitiveElement",
|
@@ -10832,23 +10845,23 @@ var Ht = /*#__PURE__*/function () {
|
|
10832
10845
|
e.numberOfSpacesBeforeNewText === 1 && (e.startPadding = e.startPadding.substring(0, e.startPadding.length - 1), e.numberOfSpacesBeforeNewText = 0), e.numberOfSpacesAfterNewText === 1 && (e.endPadding = e.endPadding.substring(1), e.numberOfSpacesAfterNewText = 0);
|
10833
10846
|
}
|
10834
10847
|
}]);
|
10835
|
-
return
|
10848
|
+
return Gt;
|
10836
10849
|
}();
|
10837
|
-
|
10850
|
+
li.Padding = Gt;
|
10838
10851
|
Object.defineProperty(wt, "__esModule", {
|
10839
10852
|
value: !0
|
10840
10853
|
});
|
10841
10854
|
wt.Speech = void 0;
|
10842
|
-
var wn =
|
10843
|
-
ra =
|
10855
|
+
var wn = ri,
|
10856
|
+
ra = oi,
|
10844
10857
|
_n = _t,
|
10845
10858
|
kt = Mt,
|
10846
|
-
Si = oi,
|
10847
|
-
te = De,
|
10848
10859
|
wi = ai,
|
10860
|
+
te = je,
|
10861
|
+
_i = li,
|
10849
10862
|
Mn = Qe,
|
10850
|
-
Tn =
|
10851
|
-
|
10863
|
+
Tn = Be,
|
10864
|
+
Mi = De;
|
10852
10865
|
var oa = /*#__PURE__*/function () {
|
10853
10866
|
function oa() {
|
10854
10867
|
_classCallCheck(this, oa);
|
@@ -10870,7 +10883,7 @@ var oa = /*#__PURE__*/function () {
|
|
10870
10883
|
}, {
|
10871
10884
|
key: "prepare",
|
10872
10885
|
value: function prepare(e) {
|
10873
|
-
|
10886
|
+
_i.Padding.setState(this, e), wi.Highlight.setState(this, e), this.isTargetInShadow = te.Elements.isInsideShadowDOM(e), te.Elements.isPrimitiveElement(e) ? (this._primitiveElement = e, this._originalText = this._primitiveElement.value) : (this._genericElement = e, this._originalText = this._genericElement.textContent);
|
10874
10887
|
}
|
10875
10888
|
// there was an attempt to optimize this by not having to restart the service and just reset state:
|
10876
10889
|
// unfortunately it did not work because the service would still continue firing the intermediate and final results
|
@@ -10885,7 +10898,7 @@ var oa = /*#__PURE__*/function () {
|
|
10885
10898
|
key: "updateElements",
|
10886
10899
|
value: function updateElements(e, t, i) {
|
10887
10900
|
var n;
|
10888
|
-
var r =
|
10901
|
+
var r = Mi.Text.capitalize(t);
|
10889
10902
|
if (this.finalTranscript === r && e === "") return;
|
10890
10903
|
ra.PreResultUtils.process(this, i, e === "", this._onPreResult, this._options) && (e = "", i = "");
|
10891
10904
|
var o = this.commands && _n.CommandUtils.execCommand(this, i, this._options, this._primitiveElement || this._genericElement, this._originalText);
|
@@ -10903,7 +10916,7 @@ var oa = /*#__PURE__*/function () {
|
|
10903
10916
|
}, {
|
10904
10917
|
key: "updatePrimitiveElement",
|
10905
10918
|
value: function updatePrimitiveElement(e, t, i) {
|
10906
|
-
this.isHighlighted &&
|
10919
|
+
this.isHighlighted && wi.Highlight.removeForPrimitive(this, e), this.primitiveTextRecorded || _i.Padding.adjustStateAfterRecodingPrimitiveElement(this, e), i && _i.Padding.adjustSateForNoTextPrimitiveElement(this);
|
10907
10920
|
var n = this.startPadding + this.finalTranscript + t;
|
10908
10921
|
if (e.value = n + this.endPadding, !this.isTargetInShadow) {
|
10909
10922
|
var r = n.length + this.numberOfSpacesAfterNewText;
|
@@ -10914,12 +10927,12 @@ var oa = /*#__PURE__*/function () {
|
|
10914
10927
|
}, {
|
10915
10928
|
key: "updateGenericElement",
|
10916
10929
|
value: function updateGenericElement(e, t, i) {
|
10917
|
-
this.isHighlighted &&
|
10918
|
-
var n = (i ? "" : this.startPadding) +
|
10930
|
+
this.isHighlighted && wi.Highlight.removeForGeneric(this, e), this.spansPopulated || te.Elements.appendSpans(this, e);
|
10931
|
+
var n = (i ? "" : this.startPadding) + Mi.Text.lineBreak(this.finalTranscript);
|
10919
10932
|
this.finalSpan.innerHTML = n;
|
10920
10933
|
var r = kt.AutoScroll.isRequired(this.autoScroll, e);
|
10921
10934
|
kt.AutoScroll.changeStateIfNeeded(this, r);
|
10922
|
-
var o =
|
10935
|
+
var o = Mi.Text.lineBreak(t) + (i ? "" : this.endPadding);
|
10923
10936
|
this.interimSpan.innerHTML = o, Mn.Browser.IS_SAFARI() && this.insertInCursorLocation && Tn.Cursor.setOffsetForSafariGeneric(e, n.length + o.length), r && kt.AutoScroll.scrollGeneric(this, e), i && (this.scrollingSpan.innerHTML = "");
|
10924
10937
|
}
|
10925
10938
|
}, {
|
@@ -10959,21 +10972,21 @@ var oa = /*#__PURE__*/function () {
|
|
10959
10972
|
return oa;
|
10960
10973
|
}();
|
10961
10974
|
wt.Speech = oa;
|
10962
|
-
Object.defineProperty(
|
10975
|
+
Object.defineProperty(ni, "__esModule", {
|
10963
10976
|
value: !0
|
10964
10977
|
});
|
10965
|
-
|
10966
|
-
var Cn =
|
10978
|
+
ni.WebSpeech = void 0;
|
10979
|
+
var Cn = si,
|
10967
10980
|
An = Qe,
|
10968
10981
|
aa = wt;
|
10969
|
-
var
|
10970
|
-
_inherits(
|
10971
|
-
var _super41 = _createSuper(
|
10972
|
-
function
|
10973
|
-
_classCallCheck(this,
|
10982
|
+
var Vt = /*#__PURE__*/function (_aa$Speech) {
|
10983
|
+
_inherits(Vt, _aa$Speech);
|
10984
|
+
var _super41 = _createSuper(Vt);
|
10985
|
+
function Vt() {
|
10986
|
+
_classCallCheck(this, Vt);
|
10974
10987
|
return _super41.call(this);
|
10975
10988
|
}
|
10976
|
-
_createClass(
|
10989
|
+
_createClass(Vt, [{
|
10977
10990
|
key: "start",
|
10978
10991
|
value: function start(e) {
|
10979
10992
|
var t;
|
@@ -10982,34 +10995,34 @@ var Gt = /*#__PURE__*/function (_aa$Speech) {
|
|
10982
10995
|
}, {
|
10983
10996
|
key: "validate",
|
10984
10997
|
value: function validate() {
|
10985
|
-
return
|
10998
|
+
return Vt.getAPI() ? !0 : (this.error("Speech Recognition is unsupported"), !1);
|
10986
10999
|
}
|
10987
11000
|
}, {
|
10988
11001
|
key: "instantiateService",
|
10989
11002
|
value: function instantiateService(e) {
|
10990
11003
|
var t, i;
|
10991
|
-
var n =
|
11004
|
+
var n = Vt.getAPI();
|
10992
11005
|
this._service = new n(), this._service.continuous = !0, this._service.interimResults = (t = e == null ? void 0 : e.displayInterimResults) !== null && t !== void 0 ? t : !0, this._service.lang = ((i = e == null ? void 0 : e.language) === null || i === void 0 ? void 0 : i.trim()) || "en-US", this.setEvents();
|
10993
11006
|
}
|
10994
11007
|
}, {
|
10995
11008
|
key: "setEvents",
|
10996
11009
|
value: function setEvents() {
|
10997
|
-
var
|
11010
|
+
var _this53 = this;
|
10998
11011
|
this._service && (this._service.onstart = function () {
|
10999
|
-
|
11012
|
+
_this53.setStateOnStart();
|
11000
11013
|
}, this._service.onerror = function (e) {
|
11001
|
-
An.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" &&
|
11014
|
+
An.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" && _this53.isRestarting || e.error !== "no-speech" && _this53.error(e.message || e.error);
|
11002
11015
|
}, this._service.onaudioend = function () {
|
11003
|
-
|
11016
|
+
_this53.setStateOnStop();
|
11004
11017
|
}, this._service.onend = function () {
|
11005
|
-
|
11018
|
+
_this53._stopping = !1;
|
11006
11019
|
}, this._service.onresult = function (e) {
|
11007
|
-
if (_typeof(e.results) > "u" &&
|
11008
|
-
var
|
11009
|
-
t =
|
11010
|
-
i =
|
11011
|
-
n =
|
11012
|
-
|
11020
|
+
if (_typeof(e.results) > "u" && _this53._service) _this53._service.onend = null, _this53._service.stop();else if (_this53._extractText && !_this53._stopping) {
|
11021
|
+
var _this53$_extractText = _this53._extractText(e, _this53.finalTranscript, _this53._translations),
|
11022
|
+
t = _this53$_extractText.interimTranscript,
|
11023
|
+
i = _this53$_extractText.finalTranscript,
|
11024
|
+
n = _this53$_extractText.newText;
|
11025
|
+
_this53.updateElements(t, i, n);
|
11013
11026
|
}
|
11014
11027
|
});
|
11015
11028
|
}
|
@@ -11030,36 +11043,36 @@ var Gt = /*#__PURE__*/function (_aa$Speech) {
|
|
11030
11043
|
return window.webkitSpeechRecognition || window.SpeechRecognition;
|
11031
11044
|
}
|
11032
11045
|
}]);
|
11033
|
-
return
|
11046
|
+
return Vt;
|
11034
11047
|
}(aa.Speech);
|
11035
|
-
|
11036
|
-
var
|
11037
|
-
Object.defineProperty(
|
11048
|
+
ni.WebSpeech = Vt;
|
11049
|
+
var ci = {};
|
11050
|
+
Object.defineProperty(ci, "__esModule", {
|
11038
11051
|
value: !0
|
11039
11052
|
});
|
11040
|
-
|
11041
|
-
var
|
11042
|
-
function
|
11043
|
-
_classCallCheck(this,
|
11053
|
+
ci.GlobalState = void 0;
|
11054
|
+
var Je = /*#__PURE__*/function () {
|
11055
|
+
function Je() {
|
11056
|
+
_classCallCheck(this, Je);
|
11044
11057
|
}
|
11045
|
-
_createClass(
|
11058
|
+
_createClass(Je, null, [{
|
11046
11059
|
key: "doubleClickDetector",
|
11047
11060
|
value: function doubleClickDetector() {
|
11048
|
-
return
|
11049
|
-
|
11061
|
+
return Je.doubleClickPending ? !0 : (Je.doubleClickPending = !0, setTimeout(function () {
|
11062
|
+
Je.doubleClickPending = !1;
|
11050
11063
|
}, 300), !1);
|
11051
11064
|
}
|
11052
11065
|
}]);
|
11053
|
-
return
|
11066
|
+
return Je;
|
11054
11067
|
}();
|
11055
|
-
|
11056
|
-
|
11057
|
-
var
|
11058
|
-
|
11059
|
-
Object.defineProperty(
|
11068
|
+
ci.GlobalState = Je;
|
11069
|
+
Je.doubleClickPending = !1;
|
11070
|
+
var di = {},
|
11071
|
+
ui = {};
|
11072
|
+
Object.defineProperty(ui, "__esModule", {
|
11060
11073
|
value: !0
|
11061
11074
|
});
|
11062
|
-
|
11075
|
+
ui.PreventConnectionStop = void 0;
|
11063
11076
|
var la = /*#__PURE__*/function () {
|
11064
11077
|
function la() {
|
11065
11078
|
_classCallCheck(this, la);
|
@@ -11079,27 +11092,27 @@ var la = /*#__PURE__*/function () {
|
|
11079
11092
|
}]);
|
11080
11093
|
return la;
|
11081
11094
|
}();
|
11082
|
-
|
11083
|
-
var
|
11084
|
-
|
11085
|
-
Object.defineProperty(
|
11095
|
+
ui.PreventConnectionStop = la;
|
11096
|
+
var hi = {},
|
11097
|
+
pi = {};
|
11098
|
+
Object.defineProperty(pi, "__esModule", {
|
11086
11099
|
value: !0
|
11087
11100
|
});
|
11088
|
-
|
11089
|
-
|
11090
|
-
Object.defineProperty(
|
11101
|
+
pi.README_URL = void 0;
|
11102
|
+
pi.README_URL = "https://github.com/OvidijusParsiunas/speech-to-element";
|
11103
|
+
Object.defineProperty(hi, "__esModule", {
|
11091
11104
|
value: !0
|
11092
11105
|
});
|
11093
|
-
|
11094
|
-
var
|
11095
|
-
var
|
11096
|
-
function
|
11097
|
-
_classCallCheck(this,
|
11106
|
+
hi.AzureSpeechConfig = void 0;
|
11107
|
+
var Ti = pi;
|
11108
|
+
var Wt = /*#__PURE__*/function () {
|
11109
|
+
function Wt() {
|
11110
|
+
_classCallCheck(this, Wt);
|
11098
11111
|
}
|
11099
|
-
_createClass(
|
11112
|
+
_createClass(Wt, null, [{
|
11100
11113
|
key: "validateOptions",
|
11101
11114
|
value: function validateOptions(e, t) {
|
11102
|
-
return t ? !t.subscriptionKey && !t.token && !t.retrieveToken ? (e("Please define a 'subscriptionKey', 'token' or 'retrieveToken' property - more info: ".concat(
|
11115
|
+
return t ? !t.subscriptionKey && !t.token && !t.retrieveToken ? (e("Please define a 'subscriptionKey', 'token' or 'retrieveToken' property - more info: ".concat(Ti.README_URL)), !1) : t.region ? !0 : (e("Please define a 'region' property - more info: ".concat(Ti.README_URL)), !1) : (e("Please provide subscription details - more info: ".concat(Ti.README_URL)), !1);
|
11103
11116
|
}
|
11104
11117
|
}, {
|
11105
11118
|
key: "getNewSpeechConfig",
|
@@ -11142,10 +11155,10 @@ var Vt = /*#__PURE__*/function () {
|
|
11142
11155
|
while (1) switch (_context92.prev = _context92.next) {
|
11143
11156
|
case 0:
|
11144
11157
|
_context92.next = 2;
|
11145
|
-
return
|
11158
|
+
return Wt.getNewSpeechConfig(e, t);
|
11146
11159
|
case 2:
|
11147
11160
|
i = _context92.sent;
|
11148
|
-
return _context92.abrupt("return", (i &&
|
11161
|
+
return _context92.abrupt("return", (i && Wt.process(i, t), i));
|
11149
11162
|
case 4:
|
11150
11163
|
case "end":
|
11151
11164
|
return _context92.stop();
|
@@ -11158,14 +11171,14 @@ var Vt = /*#__PURE__*/function () {
|
|
11158
11171
|
return get;
|
11159
11172
|
}()
|
11160
11173
|
}]);
|
11161
|
-
return
|
11174
|
+
return Wt;
|
11162
11175
|
}();
|
11163
|
-
|
11164
|
-
var
|
11165
|
-
Object.defineProperty(
|
11176
|
+
hi.AzureSpeechConfig = Wt;
|
11177
|
+
var fi = {};
|
11178
|
+
Object.defineProperty(fi, "__esModule", {
|
11166
11179
|
value: !0
|
11167
11180
|
});
|
11168
|
-
|
11181
|
+
fi.StopTimeout = void 0;
|
11169
11182
|
var gt = /*#__PURE__*/function () {
|
11170
11183
|
function gt() {
|
11171
11184
|
_classCallCheck(this, gt);
|
@@ -11185,13 +11198,13 @@ var gt = /*#__PURE__*/function () {
|
|
11185
11198
|
}]);
|
11186
11199
|
return gt;
|
11187
11200
|
}();
|
11188
|
-
|
11201
|
+
fi.StopTimeout = gt;
|
11189
11202
|
gt.DEFAULT_MS = 2e4;
|
11190
|
-
var
|
11191
|
-
Object.defineProperty(
|
11203
|
+
var mi = {};
|
11204
|
+
Object.defineProperty(mi, "__esModule", {
|
11192
11205
|
value: !0
|
11193
11206
|
});
|
11194
|
-
|
11207
|
+
mi.AzureTranscript = void 0;
|
11195
11208
|
var ca = St;
|
11196
11209
|
var da = /*#__PURE__*/function () {
|
11197
11210
|
function da() {
|
@@ -11215,29 +11228,29 @@ var da = /*#__PURE__*/function () {
|
|
11215
11228
|
}]);
|
11216
11229
|
return da;
|
11217
11230
|
}();
|
11218
|
-
|
11219
|
-
Object.defineProperty(
|
11231
|
+
mi.AzureTranscript = da;
|
11232
|
+
Object.defineProperty(di, "__esModule", {
|
11220
11233
|
value: !0
|
11221
11234
|
});
|
11222
|
-
|
11223
|
-
var kn =
|
11224
|
-
In =
|
11225
|
-
|
11226
|
-
Ln =
|
11235
|
+
di.Azure = void 0;
|
11236
|
+
var kn = ui,
|
11237
|
+
In = hi,
|
11238
|
+
Ci = fi,
|
11239
|
+
Ln = mi,
|
11227
11240
|
ua = wt;
|
11228
|
-
var
|
11229
|
-
_inherits(
|
11230
|
-
var _super42 = _createSuper(
|
11231
|
-
function
|
11232
|
-
var
|
11233
|
-
_classCallCheck(this,
|
11234
|
-
|
11235
|
-
return
|
11241
|
+
var Kt = /*#__PURE__*/function (_ua$Speech) {
|
11242
|
+
_inherits(Kt, _ua$Speech);
|
11243
|
+
var _super42 = _createSuper(Kt);
|
11244
|
+
function Kt() {
|
11245
|
+
var _this54;
|
11246
|
+
_classCallCheck(this, Kt);
|
11247
|
+
_this54 = _super42.apply(this, arguments), _this54._newTextPadding = "";
|
11248
|
+
return _this54;
|
11236
11249
|
}
|
11237
|
-
_createClass(
|
11250
|
+
_createClass(Kt, [{
|
11238
11251
|
key: "start",
|
11239
11252
|
value: function start(e, t) {
|
11240
|
-
this._newTextPadding = "", this.stopTimeout === void 0 &&
|
11253
|
+
this._newTextPadding = "", this.stopTimeout === void 0 && Ci.StopTimeout.reset(this, e == null ? void 0 : e.stopAfterSilenceMs), this.prepareBeforeStart(e), this.startAsync(e), t || kn.PreventConnectionStop.applyPrevention(this);
|
11241
11254
|
}
|
11242
11255
|
}, {
|
11243
11256
|
key: "startAsync",
|
@@ -11271,7 +11284,7 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11271
11284
|
}, {
|
11272
11285
|
key: "validate",
|
11273
11286
|
value: function validate(e) {
|
11274
|
-
return
|
11287
|
+
return Kt.getAPI() ? In.AzureSpeechConfig.validateOptions(this.error.bind(this), e) : (this.moduleNotFound(), !1);
|
11275
11288
|
}
|
11276
11289
|
}, {
|
11277
11290
|
key: "instantiateService",
|
@@ -11281,7 +11294,7 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11281
11294
|
return _regeneratorRuntime().wrap(function _callee94$(_context94) {
|
11282
11295
|
while (1) switch (_context94.prev = _context94.next) {
|
11283
11296
|
case 0:
|
11284
|
-
t =
|
11297
|
+
t = Kt.getAPI();
|
11285
11298
|
i = t.AudioConfig.fromDefaultMicrophoneInput();
|
11286
11299
|
_context94.next = 4;
|
11287
11300
|
return In.AzureSpeechConfig.get(t.SpeechConfig, e);
|
@@ -11316,7 +11329,7 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11316
11329
|
i = _Ln$AzureTranscript$e.interimTranscript,
|
11317
11330
|
n = _Ln$AzureTranscript$e.finalTranscript,
|
11318
11331
|
r = _Ln$AzureTranscript$e.newText;
|
11319
|
-
|
11332
|
+
Ci.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(i, n, r);
|
11320
11333
|
}
|
11321
11334
|
// WORK - huge opportunity to fix this in the repo!!!!!
|
11322
11335
|
// function onRecognized(sender, recognitionEventArgs) {
|
@@ -11337,7 +11350,7 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11337
11350
|
n = _Ln$AzureTranscript$e2.interimTranscript,
|
11338
11351
|
r = _Ln$AzureTranscript$e2.finalTranscript,
|
11339
11352
|
o = _Ln$AzureTranscript$e2.newText;
|
11340
|
-
|
11353
|
+
Ci.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(n, r, o), r !== "" && (this._newTextPadding = " ");
|
11341
11354
|
}
|
11342
11355
|
break;
|
11343
11356
|
}
|
@@ -11360,12 +11373,12 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11360
11373
|
}, {
|
11361
11374
|
key: "retrieveTokenInterval",
|
11362
11375
|
value: function retrieveTokenInterval(e) {
|
11363
|
-
var
|
11376
|
+
var _this55 = this;
|
11364
11377
|
this._retrieveTokenInterval = setInterval(function () {
|
11365
11378
|
e == null || e().then(function (t) {
|
11366
|
-
|
11379
|
+
_this55._service && (_this55._service.authorizationToken = (t == null ? void 0 : t.trim()) || "");
|
11367
11380
|
})["catch"](function (t) {
|
11368
|
-
|
11381
|
+
_this55.error(t);
|
11369
11382
|
});
|
11370
11383
|
}, 1e4);
|
11371
11384
|
}
|
@@ -11391,31 +11404,31 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11391
11404
|
return window.SpeechSDK;
|
11392
11405
|
}
|
11393
11406
|
}]);
|
11394
|
-
return
|
11407
|
+
return Kt;
|
11395
11408
|
}(ua.Speech);
|
11396
|
-
|
11409
|
+
di.Azure = Kt;
|
11397
11410
|
Object.defineProperty(cs, "__esModule", {
|
11398
11411
|
value: !0
|
11399
11412
|
});
|
11400
|
-
var Rn =
|
11413
|
+
var Rn = ni,
|
11401
11414
|
ha = _t,
|
11402
|
-
Z =
|
11403
|
-
pa =
|
11404
|
-
var
|
11405
|
-
function
|
11406
|
-
_classCallCheck(this,
|
11415
|
+
Z = ci,
|
11416
|
+
pa = di;
|
11417
|
+
var Ve = /*#__PURE__*/function () {
|
11418
|
+
function Ve() {
|
11419
|
+
_classCallCheck(this, Ve);
|
11407
11420
|
}
|
11408
|
-
_createClass(
|
11421
|
+
_createClass(Ve, null, [{
|
11409
11422
|
key: "toggle",
|
11410
11423
|
value: function toggle(e, t) {
|
11411
11424
|
var i, n;
|
11412
11425
|
var r = e.toLocaleLowerCase().trim();
|
11413
|
-
!((i = Z.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ?
|
11426
|
+
!((i = Z.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? Ve.startWebSpeech(t) : r === "azure" ? Ve.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'"));
|
11414
11427
|
}
|
11415
11428
|
}, {
|
11416
11429
|
key: "startWebSpeech",
|
11417
11430
|
value: function startWebSpeech(e) {
|
11418
|
-
|
11431
|
+
Ve.stop() || (Z.GlobalState.service = new Rn.WebSpeech(), Z.GlobalState.service.start(e));
|
11419
11432
|
}
|
11420
11433
|
}, {
|
11421
11434
|
key: "isWebSpeechSupported",
|
@@ -11426,7 +11439,7 @@ var Ge = /*#__PURE__*/function () {
|
|
11426
11439
|
key: "startAzure",
|
11427
11440
|
value: function startAzure(e) {
|
11428
11441
|
var t;
|
11429
|
-
|
11442
|
+
Ve.stop() || !((t = Z.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (Z.GlobalState.service = new pa.Azure(), Z.GlobalState.service.start(e));
|
11430
11443
|
}
|
11431
11444
|
}, {
|
11432
11445
|
key: "stop",
|
@@ -11440,31 +11453,31 @@ var Ge = /*#__PURE__*/function () {
|
|
11440
11453
|
Z.GlobalState.service && ha.CommandUtils.toggleCommandModeOff(Z.GlobalState.service);
|
11441
11454
|
}
|
11442
11455
|
}]);
|
11443
|
-
return
|
11456
|
+
return Ve;
|
11444
11457
|
}();
|
11445
|
-
var
|
11446
|
-
var
|
11447
|
-
_inherits(
|
11448
|
-
var _super43 = _createSuper(
|
11449
|
-
function
|
11450
|
-
var
|
11451
|
-
_classCallCheck(this,
|
11458
|
+
var Ai = cs["default"] = Ve;
|
11459
|
+
var Jt = /*#__PURE__*/function (_mt) {
|
11460
|
+
_inherits(Jt, _mt);
|
11461
|
+
var _super43 = _createSuper(Jt);
|
11462
|
+
function Jt(e, t, i) {
|
11463
|
+
var _this56;
|
11464
|
+
_classCallCheck(this, Jt);
|
11452
11465
|
var o;
|
11453
|
-
|
11454
|
-
var
|
11455
|
-
n =
|
11456
|
-
r =
|
11457
|
-
if (
|
11466
|
+
_this56 = _super43.call(this, _typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {});
|
11467
|
+
var _Jt$processConfigurat = Jt.processConfiguration(t, e.speechToText),
|
11468
|
+
n = _Jt$processConfigurat.serviceName,
|
11469
|
+
r = _Jt$processConfigurat.processedConfig;
|
11470
|
+
if (_this56._addErrorMessage = i, n === "webspeech" && !Ai.isWebSpeechSupported()) _this56.changeToUnsupported();else {
|
11458
11471
|
var a = !e.textInput || !e.textInput.disabled;
|
11459
|
-
|
11472
|
+
_this56.elementRef.onclick = _this56.buttonClick.bind(_assertThisInitialized(_this56), t, a, n, r);
|
11460
11473
|
}
|
11461
|
-
return
|
11474
|
+
return _this56;
|
11462
11475
|
}
|
11463
11476
|
// prettier-ignore
|
11464
|
-
_createClass(
|
11477
|
+
_createClass(Jt, [{
|
11465
11478
|
key: "buttonClick",
|
11466
11479
|
value: function buttonClick(e, t, i, n) {
|
11467
|
-
e.removeTextIfPlaceholder(),
|
11480
|
+
e.removeTextIfPlaceholder(), Ai.toggle(i, _objectSpread({
|
11468
11481
|
insertInCursorLocation: !1,
|
11469
11482
|
element: t ? e.inputElementRef : void 0,
|
11470
11483
|
onError: this.onError.bind(this),
|
@@ -11502,12 +11515,12 @@ var Kt = /*#__PURE__*/function (_mt) {
|
|
11502
11515
|
return d.toLowerCase().includes(a) ? (setTimeout(function () {
|
11503
11516
|
var u;
|
11504
11517
|
return (u = e.submit) == null ? void 0 : u.call(e);
|
11505
|
-
}),
|
11518
|
+
}), Ai.endCommandMode(), {
|
11506
11519
|
restart: !0,
|
11507
11520
|
removeNewText: !0
|
11508
11521
|
}) : null;
|
11509
11522
|
}), {
|
11510
|
-
serviceName:
|
11523
|
+
serviceName: Jt.getServiceName(i),
|
11511
11524
|
processedConfig: o
|
11512
11525
|
};
|
11513
11526
|
}
|
@@ -11517,7 +11530,7 @@ var Kt = /*#__PURE__*/function (_mt) {
|
|
11517
11530
|
return e.webSpeech ? "webspeech" : e.azure ? "azure" : "webspeech";
|
11518
11531
|
}
|
11519
11532
|
}]);
|
11520
|
-
return
|
11533
|
+
return Jt;
|
11521
11534
|
}(mt);
|
11522
11535
|
var ds = /*#__PURE__*/function () {
|
11523
11536
|
function ds() {
|
@@ -11539,11 +11552,11 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11539
11552
|
_inherits(fa, _mt2);
|
11540
11553
|
var _super44 = _createSuper(fa);
|
11541
11554
|
function fa(e, t) {
|
11542
|
-
var
|
11555
|
+
var _this57;
|
11543
11556
|
_classCallCheck(this, fa);
|
11544
11557
|
var i, n;
|
11545
|
-
|
11546
|
-
return
|
11558
|
+
_this57 = _super44.call(this, t.button), _this57._waitingForBrowserApproval = !1, _this57._audioType = e, _this57._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this57._maxDurationSeconds = (n = t.files) == null ? void 0 : n.maxDurationSeconds, _this57.elementRef.onclick = _this57.buttonClick.bind(_assertThisInitialized(_this57));
|
11559
|
+
return _this57;
|
11547
11560
|
}
|
11548
11561
|
_createClass(fa, [{
|
11549
11562
|
key: "buttonClick",
|
@@ -11553,10 +11566,10 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11553
11566
|
}, {
|
11554
11567
|
key: "stop",
|
11555
11568
|
value: function stop() {
|
11556
|
-
var
|
11569
|
+
var _this58 = this;
|
11557
11570
|
return new Promise(function (e) {
|
11558
11571
|
var t, i;
|
11559
|
-
|
11572
|
+
_this58.changeToDefault(), (t = _this58._mediaRecorder) == null || t.stop(), (i = _this58._mediaStream) == null || i.getTracks().forEach(function (n) {
|
11560
11573
|
return n.stop();
|
11561
11574
|
}), setTimeout(function () {
|
11562
11575
|
e();
|
@@ -11566,23 +11579,23 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11566
11579
|
}, {
|
11567
11580
|
key: "record",
|
11568
11581
|
value: function record() {
|
11569
|
-
var
|
11582
|
+
var _this59 = this;
|
11570
11583
|
navigator.mediaDevices.getUserMedia({
|
11571
11584
|
audio: !0
|
11572
11585
|
}).then(function (e) {
|
11573
|
-
|
11574
|
-
|
11575
|
-
}),
|
11586
|
+
_this59.changeToActive(), _this59._mediaRecorder = new MediaRecorder(e), _this59._audioType.addPlaceholderAttachment(_this59.stop.bind(_this59), _this59._maxDurationSeconds), _this59._mediaStream = e, _this59._mediaRecorder.addEventListener("dataavailable", function (t) {
|
11587
|
+
_this59.createFile(t);
|
11588
|
+
}), _this59._mediaRecorder.start();
|
11576
11589
|
})["catch"](function (e) {
|
11577
|
-
console.error(e),
|
11590
|
+
console.error(e), _this59.stop();
|
11578
11591
|
})["finally"](function () {
|
11579
|
-
|
11592
|
+
_this59._waitingForBrowserApproval = !1;
|
11580
11593
|
});
|
11581
11594
|
}
|
11582
11595
|
}, {
|
11583
11596
|
key: "createFile",
|
11584
11597
|
value: function createFile(e) {
|
11585
|
-
var
|
11598
|
+
var _this60 = this;
|
11586
11599
|
var t = new Blob([e.data], {
|
11587
11600
|
type: "audio/".concat(this._extension)
|
11588
11601
|
}),
|
@@ -11592,7 +11605,7 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11592
11605
|
}),
|
11593
11606
|
r = new FileReader();
|
11594
11607
|
r.readAsDataURL(n), r.onload = function (o) {
|
11595
|
-
|
11608
|
+
_this60._audioType.completePlaceholderAttachment(n, o.target.result);
|
11596
11609
|
};
|
11597
11610
|
}
|
11598
11611
|
}]);
|
@@ -11667,24 +11680,24 @@ var Te = /*#__PURE__*/function () {
|
|
11667
11680
|
}]);
|
11668
11681
|
return Te;
|
11669
11682
|
}();
|
11670
|
-
var
|
11683
|
+
var gi = /*#__PURE__*/function (_xt4) {
|
11671
11684
|
_inherits(k, _xt4);
|
11672
11685
|
var _super45 = _createSuper(k);
|
11673
11686
|
// prettier-ignore
|
11674
11687
|
function k(e, t, i, n, r) {
|
11675
|
-
var
|
11688
|
+
var _this61;
|
11676
11689
|
_classCallCheck(this, k);
|
11677
11690
|
var o = Te.process(e.submitButtonStyles);
|
11678
|
-
|
11691
|
+
_this61 = _super45.call(this, k.createButtonContainerElement(), o == null ? void 0 : o.position, o), _this61._isSVGLoadingIconOverriden = !1, _this61.status = {
|
11679
11692
|
requestInProgress: !1,
|
11680
11693
|
loadingActive: !1
|
11681
|
-
},
|
11694
|
+
}, _this61._messages = i, _this61._inputElementRef = t, _this61._fileAttachments = r, _this61._innerElements = _this61.createInnerElements(), _this61._abortStream = new AbortController(), _this61._stopClicked = {
|
11682
11695
|
listener: function listener() {}
|
11683
|
-
},
|
11696
|
+
}, _this61._serviceIO = n, _this61._alwaysEnabled = !!(o != null && o.alwaysEnabled), e.disableSubmitButton = _this61.disableSubmitButton.bind(_assertThisInitialized(_this61), n), _this61.attemptOverwriteLoadingStyle(e), setTimeout(function () {
|
11684
11697
|
var a;
|
11685
|
-
|
11698
|
+
_this61._validationHandler = e._validationHandler, _this61.assignHandlers(_this61._validationHandler), (a = _this61._validationHandler) == null || a.call(_assertThisInitialized(_this61));
|
11686
11699
|
});
|
11687
|
-
return
|
11700
|
+
return _this61;
|
11688
11701
|
}
|
11689
11702
|
// prettier-ignore
|
11690
11703
|
_createClass(k, [{
|
@@ -11773,7 +11786,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11773
11786
|
key: "programmaticSubmit",
|
11774
11787
|
value: function () {
|
11775
11788
|
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e) {
|
11776
|
-
var
|
11789
|
+
var _this62 = this;
|
11777
11790
|
var t;
|
11778
11791
|
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
11779
11792
|
while (1) switch (_context96.prev = _context96.next) {
|
@@ -11788,7 +11801,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11788
11801
|
type: de.getTypeFromBlob(i)
|
11789
11802
|
};
|
11790
11803
|
})), setTimeout(function () {
|
11791
|
-
return
|
11804
|
+
return _this62.attemptSubmit(t, !0);
|
11792
11805
|
});
|
11793
11806
|
case 3:
|
11794
11807
|
case "end":
|
@@ -11832,7 +11845,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11832
11845
|
return this.addNewMessage(e);
|
11833
11846
|
case 10:
|
11834
11847
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
11835
|
-
|
11848
|
+
Fi.clear(this._inputElementRef);
|
11836
11849
|
i = (o = e.files) == null ? void 0 : o.map(function (l) {
|
11837
11850
|
return l.file;
|
11838
11851
|
}), n = {
|
@@ -11864,7 +11877,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11864
11877
|
case 0:
|
11865
11878
|
e = _ref13.text, t = _ref13.files;
|
11866
11879
|
i = {
|
11867
|
-
role:
|
11880
|
+
role: x.USER_ROLE
|
11868
11881
|
};
|
11869
11882
|
e && (i.text = e);
|
11870
11883
|
_context98.t0 = t;
|
@@ -11953,10 +11966,10 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11953
11966
|
}]);
|
11954
11967
|
return k;
|
11955
11968
|
}(xt);
|
11956
|
-
|
11957
|
-
|
11958
|
-
|
11959
|
-
var ga =
|
11969
|
+
gi.SUBMIT_CLASS = "submit-button";
|
11970
|
+
gi.LOADING_CLASS = "loading-button";
|
11971
|
+
gi.DISABLED_CLASS = "disabled-button";
|
11972
|
+
var ga = gi;
|
11960
11973
|
var ba = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M27.1 14.313V5.396L24.158 8.34c-2.33-2.325-5.033-3.503-8.11-3.503C9.902 4.837 4.901 9.847 4.899 16c.001 6.152 5.003 11.158 11.15 11.16 4.276 0 9.369-2.227 10.836-8.478l.028-.122h-3.23l-.022.068c-1.078 3.242-4.138 5.421-7.613 5.421a8 8 0 0 1-5.691-2.359A7.993 7.993 0 0 1 8 16.001c0-4.438 3.611-8.049 8.05-8.049 2.069 0 3.638.58 5.924 2.573l-3.792 3.789H27.1z\"/>\n</svg>\n",
|
11961
11974
|
va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>capture</title>\n <path d=\"M0 16q0 3.264 1.28 6.208t3.392 5.12 5.12 3.424 6.208 1.248 6.208-1.248 5.12-3.424 3.392-5.12 1.28-6.208-1.28-6.208-3.392-5.12-5.088-3.392-6.24-1.28q-3.264 0-6.208 1.28t-5.12 3.392-3.392 5.12-1.28 6.208zM4 16q0-3.264 1.6-6.016t4.384-4.352 6.016-1.632 6.016 1.632 4.384 4.352 1.6 6.016-1.6 6.048-4.384 4.352-6.016 1.6-6.016-1.6-4.384-4.352-1.6-6.048z\"></path>\n</svg>\n",
|
11962
11975
|
ya = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z\"/>\n</svg>",
|
@@ -11966,14 +11979,14 @@ var Xi = /*#__PURE__*/function (_rt) {
|
|
11966
11979
|
var _super46 = _createSuper(Xi);
|
11967
11980
|
// prettier-ignore
|
11968
11981
|
function Xi(e, t, i, n) {
|
11969
|
-
var
|
11982
|
+
var _this63;
|
11970
11983
|
_classCallCheck(this, Xi);
|
11971
|
-
|
11972
|
-
var
|
11973
|
-
r =
|
11974
|
-
o =
|
11975
|
-
|
11976
|
-
return
|
11984
|
+
_this63 = _super46.call(this, e, ["modal-content", "modal-camera-content"], i), _this63._stopped = !1, _this63._format = "image/png", _this63._canvas = document.createElement("canvas"), _this63._canvas.classList.add("camera-modal-canvas");
|
11985
|
+
var _this63$addButtonsAnd = _this63.addButtonsAndTheirEvents(t),
|
11986
|
+
r = _this63$addButtonsAnd.captureButton,
|
11987
|
+
o = _this63$addButtonsAnd.submitButton;
|
11988
|
+
_this63._captureButton = r, _this63._submitButton = o, _this63._captureIcon = _this63._captureButton.children[0], _this63._refreshIcon = U.createSVGElement(ba), _this63._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this63._format = "image/jpeg"), n != null && n.dimensions && (_this63._dimensions = n.dimensions), _this63._contentRef.appendChild(_this63._canvas), _this63.extensionCloseCallback = _this63.stop;
|
11989
|
+
return _this63;
|
11977
11990
|
}
|
11978
11991
|
_createClass(Xi, [{
|
11979
11992
|
key: "addButtonsAndTheirEvents",
|
@@ -11992,38 +12005,38 @@ var Xi = /*#__PURE__*/function (_rt) {
|
|
11992
12005
|
}, {
|
11993
12006
|
key: "addButtonEvents",
|
11994
12007
|
value: function addButtonEvents(e, t, i, n) {
|
11995
|
-
var
|
12008
|
+
var _this64 = this;
|
11996
12009
|
e.onclick = function () {
|
11997
|
-
|
12010
|
+
_this64.capture();
|
11998
12011
|
}, t.addEventListener("click", this.stop.bind(this)), i.onclick = function () {
|
11999
|
-
var r =
|
12000
|
-
r && Et.addFilesToType([r], [n]),
|
12012
|
+
var r = _this64.getFile();
|
12013
|
+
r && Et.addFilesToType([r], [n]), _this64.stop(), _this64.close();
|
12001
12014
|
};
|
12002
12015
|
}
|
12003
12016
|
}, {
|
12004
12017
|
key: "stop",
|
12005
12018
|
value: function stop() {
|
12006
|
-
var
|
12019
|
+
var _this65 = this;
|
12007
12020
|
this._mediaStream && this._mediaStream.getTracks().forEach(function (e) {
|
12008
12021
|
return e.stop();
|
12009
12022
|
}), this._stopped = !0, setTimeout(function () {
|
12010
|
-
|
12011
|
-
var e =
|
12012
|
-
e == null || e.clearRect(0, 0,
|
12023
|
+
_this65._captureButton.replaceChildren(_this65._captureIcon), _this65._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
|
12024
|
+
var e = _this65._canvas.getContext("2d");
|
12025
|
+
e == null || e.clearRect(0, 0, _this65._canvas.width, _this65._canvas.height);
|
12013
12026
|
}, rt.MODAL_CLOSE_TIMEOUT_MS);
|
12014
12027
|
}
|
12015
12028
|
}, {
|
12016
12029
|
key: "start",
|
12017
12030
|
value: function start() {
|
12018
|
-
var
|
12031
|
+
var _this66 = this;
|
12019
12032
|
this._dataURL = void 0, this._submitButton.classList.add("modal-svg-submit-disabled"), this._stopped = !1, navigator.mediaDevices.getUserMedia({
|
12020
12033
|
video: this._dimensions || !0
|
12021
12034
|
}).then(function (e) {
|
12022
|
-
if (
|
12035
|
+
if (_this66._mediaStream = e, !_this66.isOpen()) return _this66.stop();
|
12023
12036
|
var t = document.createElement("video");
|
12024
|
-
t.srcObject = e, t.play(), requestAnimationFrame(
|
12037
|
+
t.srcObject = e, t.play(), requestAnimationFrame(_this66.updateCanvas.bind(_this66, t, _this66._canvas));
|
12025
12038
|
})["catch"](function (e) {
|
12026
|
-
console.error(e),
|
12039
|
+
console.error(e), _this66.stop(), _this66.close();
|
12027
12040
|
});
|
12028
12041
|
}
|
12029
12042
|
}, {
|
@@ -12077,23 +12090,23 @@ var Xi = /*#__PURE__*/function (_rt) {
|
|
12077
12090
|
return Xi;
|
12078
12091
|
}(rt);
|
12079
12092
|
var Ea = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M29 7h-4.599l-2.401-4h-12l-2.4 4h-4.6c-1 0-3 1-3 2.969v16.031c0 1.657 1.5 3 2.792 3h26.271c1.313 0 2.938-1.406 2.938-2.968v-16.032c0-1-1-3-3-3zM30 26.032c0 0.395-0.639 0.947-0.937 0.969h-26.265c-0.232-0.019-0.797-0.47-0.797-1v-16.031c0-0.634 0.851-0.953 1-0.969h5.732l2.4-4h9.802l1.785 3.030 0.55 0.97h5.731c0.705 0 0.99 0.921 1 1v16.032zM16 10c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7-3.134-7-7-7zM16 22c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z\"></path>\n</svg>";
|
12080
|
-
var
|
12081
|
-
_inherits(
|
12082
|
-
var _super47 = _createSuper(
|
12083
|
-
function
|
12084
|
-
var
|
12085
|
-
_classCallCheck(this,
|
12093
|
+
var Yt = /*#__PURE__*/function (_xt5) {
|
12094
|
+
_inherits(Yt, _xt5);
|
12095
|
+
var _super47 = _createSuper(Yt);
|
12096
|
+
function Yt(e, t, i) {
|
12097
|
+
var _this67;
|
12098
|
+
_classCallCheck(this, Yt);
|
12086
12099
|
var r;
|
12087
|
-
|
12088
|
-
var n =
|
12089
|
-
i &&
|
12090
|
-
return
|
12100
|
+
_this67 = _super47.call(this, Yt.createButtonElement(), (r = i == null ? void 0 : i.button) == null ? void 0 : r.position, (i == null ? void 0 : i.button) || {}, "Photo");
|
12101
|
+
var n = _this67.createInnerElements(_this67._customStyles);
|
12102
|
+
i && _this67.addClickEvent(e, t, i.modalContainerStyle, i.files), _this67.elementRef.classList.add("upload-file-button"), _this67.elementRef.appendChild(n.styles), _this67.reapplyStateStyle("styles");
|
12103
|
+
return _this67;
|
12091
12104
|
}
|
12092
|
-
_createClass(
|
12105
|
+
_createClass(Yt, [{
|
12093
12106
|
key: "createInnerElements",
|
12094
12107
|
value: function createInnerElements(e) {
|
12095
12108
|
return {
|
12096
|
-
styles: this.createInnerElement(
|
12109
|
+
styles: this.createInnerElement(Yt.createSVGIconElement(), "styles", e)
|
12097
12110
|
};
|
12098
12111
|
}
|
12099
12112
|
}, {
|
@@ -12122,18 +12135,18 @@ var Jt = /*#__PURE__*/function (_xt5) {
|
|
12122
12135
|
return e.id = "camera-icon", e;
|
12123
12136
|
}
|
12124
12137
|
}]);
|
12125
|
-
return
|
12138
|
+
return Yt;
|
12126
12139
|
}(xt);
|
12127
12140
|
var ut = /*#__PURE__*/function () {
|
12128
12141
|
// prettier-ignore
|
12129
12142
|
function ut(e, t, i, n) {
|
12130
12143
|
_classCallCheck(this, ut);
|
12131
12144
|
this.elementRef = ut.createPanelElement(e.inputAreaStyle);
|
12132
|
-
var r = new
|
12145
|
+
var r = new Fi(e, i),
|
12133
12146
|
o = {},
|
12134
12147
|
a = this.createFileUploadComponents(e, i, n, o);
|
12135
12148
|
e.speechToText && !o.microphone && (o.microphone = {
|
12136
|
-
button: new
|
12149
|
+
button: new Jt(e, r, t.addNewErrorMessage.bind(t))
|
12137
12150
|
});
|
12138
12151
|
var l = new ga(e, r.inputElementRef, t, i, a);
|
12139
12152
|
r.submit = l.submitFromInput.bind(l), _e.attach(e, i, r, a, l), e.submitUserMessage = l.programmaticSubmit.bind(l), o.submit = {
|
@@ -12150,7 +12163,7 @@ var ut = /*#__PURE__*/function () {
|
|
12150
12163
|
if (ut.createUploadButtons(e, t.fileTypes || {}, r, i, n), (o = t.camera) != null && o.files) {
|
12151
12164
|
var d = ((a = n.images) == null ? void 0 : a.fileType) || r.addType(e, t.camera.files, "images");
|
12152
12165
|
n.camera = {
|
12153
|
-
button: new
|
12166
|
+
button: new Yt(i, d, t.camera)
|
12154
12167
|
};
|
12155
12168
|
}
|
12156
12169
|
if ((l = t.recordAudio) != null && l.files) {
|
@@ -12179,10 +12192,10 @@ var ut = /*#__PURE__*/function () {
|
|
12179
12192
|
_Wo$a = Wo[a],
|
12180
12193
|
d = _Wo$a.id,
|
12181
12194
|
u = _Wo$a.svgString,
|
12182
|
-
|
12183
|
-
|
12195
|
+
h = _Wo$a.dropupText,
|
12196
|
+
p = new ct(n, c, l, d, u, h);
|
12184
12197
|
r[a] = {
|
12185
|
-
button:
|
12198
|
+
button: p,
|
12186
12199
|
fileType: c
|
12187
12200
|
};
|
12188
12201
|
}
|
@@ -12193,9 +12206,9 @@ var ut = /*#__PURE__*/function () {
|
|
12193
12206
|
key: "addElements",
|
12194
12207
|
value: function addElements(e, t, i, n, r, o) {
|
12195
12208
|
ne.addElements(e, t.elementRef);
|
12196
|
-
var a =
|
12209
|
+
var a = Xe.create(),
|
12197
12210
|
l = j.addButtons(a, i, n, o);
|
12198
|
-
zo.set(t.inputElementRef, a, r.elementRef, l),
|
12211
|
+
zo.set(t.inputElementRef, a, r.elementRef, l), Xe.add(e, a);
|
12199
12212
|
}
|
12200
12213
|
}]);
|
12201
12214
|
return ut;
|
@@ -12226,7 +12239,7 @@ var Qi = /*#__PURE__*/function () {
|
|
12226
12239
|
var Sa = "#validate-property-key-view{height:100%;position:relative;display:flex;justify-content:center;align-items:center;padding:8px}#large-loading-ring{display:inline-block;width:50px;height:50px}#large-loading-ring:after{content:\" \";display:block;width:38px;height:38px;margin:1px;border-radius:50%;border:5px solid #5fb2ff;border-color:#5fb2ff transparent #5fb2ff transparent;animation:large-loading-ring 1.4s linear infinite}@keyframes large-loading-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}#insert-key-view{height:100%;position:relative}#insert-key-contents{text-align:center;position:absolute;top:44%;left:50%;transform:translate(-50%,-50%);width:82%;display:flex;max-width:700px}#insert-key-title{margin-bottom:15px}#insert-key-input-container{margin-right:2.7em;width:calc(100% - 80px)}#insert-key-input{padding:.3em 1.7em .3em .3em;border-width:1px;border-style:solid;border-radius:3px;width:100%;font-size:inherit}.insert-key-input-valid{border-color:gray}.insert-key-input-invalid{border-color:red}#visibility-icon-container{position:relative;float:right;cursor:pointer;-webkit-user-select:none;user-select:none}.visibility-icon{filter:brightness(0) saturate(100%) invert(63%) sepia(1%) saturate(9%) hue-rotate(43deg) brightness(98%) contrast(92%);position:absolute;right:-1.7em;top:-1.43em}#visible-icon{top:-1.4em}.visibility-icon:hover{filter:unset}.visibility-icon>*{pointer-events:none}#start-button{border:1px solid grey;color:#454545;border-radius:4px;width:3em;display:flex;justify-content:center;align-items:center;cursor:pointer;padding:.28em .3em;-webkit-user-select:none;user-select:none;background-color:#fff}#start-button:hover{background-color:#f2f2f2}#start-button:active{background-color:#d2d2d2}#insert-key-help-text-container{width:100%;position:absolute;margin-top:32px;margin-bottom:20px}#insert-key-help-text-contents{width:100%;position:absolute}#insert-key-input-invalid-text{display:block;margin-top:1em;margin-bottom:.5em;color:red}.insert-key-input-help-text{display:block;margin-top:16px}#loading-ring{display:inline-block;width:16px;height:16px}#loading-ring:after{content:\" \";display:block;width:11px;height:11px;margin:1px;border-radius:50%;border:2px solid #0084ff;border-color:#0084ff transparent #0084ff transparent;animation:loading-ring 1.2s linear infinite}@keyframes loading-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}#error-view{color:red;font-size:1.2em;line-height:1.3em;margin-top:-5px;text-align:center;height:100%;display:flex;justify-content:center;align-items:center;padding-left:8px;padding-right:8px}.intro-panel{position:absolute;display:flex;justify-content:center;right:0;bottom:0;left:0;margin:auto;height:fit-content;top:-2.5em}#internal-intro-panel{width:250px;height:min-content;display:block;border-radius:5px;overflow:auto;border:1px solid rgb(203,203,203);padding:10px;max-height:calc(100% - 6.8em)}#internal-intro-panel>p{margin-block-start:.8em;margin-block-end:.8em}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!\n Theme: a11y-dark\n Author: @ericwbailey\n Maintainer: @ericwbailey\n\n Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css\n*/.hljs{background:#2b2b2b;color:#f8f8f2}.hljs-comment,.hljs-quote{color:#d4d0ab}.hljs-deletion,.hljs-name,.hljs-regexp,.hljs-selector-class,.hljs-selector-id,.hljs-tag,.hljs-template-variable,.hljs-variable{color:#ffa07a}.hljs-built_in,.hljs-link,.hljs-literal,.hljs-meta,.hljs-number,.hljs-params,.hljs-type{color:#f5ab35}.hljs-attribute{color:gold}.hljs-addition,.hljs-bullet,.hljs-string,.hljs-symbol{color:#abe338}.hljs-section,.hljs-title{color:#00e0e0}.hljs-keyword,.hljs-selector-tag{color:#dcc6e0}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}@media screen and (-ms-high-contrast: active){.hljs-addition,.hljs-attribute,.hljs-built_in,.hljs-bullet,.hljs-comment,.hljs-link,.hljs-literal,.hljs-meta,.hljs-number,.hljs-params,.hljs-quote,.hljs-string,.hljs-symbol,.hljs-type{color:highlight}.hljs-keyword,.hljs-selector-tag{font-weight:700}}#messages{overflow:auto}.outer-message-container:last-child{margin-bottom:5px}.inner-message-container{display:flex;margin-left:auto;margin-right:auto;width:calc(97.5% - 24px);max-width:100%}.message-bubble{margin-top:10px;word-wrap:break-word;width:fit-content;max-width:60%;border-radius:10px;padding:.42em .55em;height:fit-content;line-height:1.26em}.user-message-text{color:#fff;background-color:#0084ff;margin-right:0;margin-left:auto}.ai-message-text{color:#000;background-color:#e4e6eb;margin-left:0;margin-right:auto}.html-message{max-width:unset}.error-message-text{margin:14px auto 10px;background-color:#f4c0c0;color:#474747;text-align:center;max-width:95%}.loading-message-text{width:1em;padding:.6em .75em .6em 1.3em}.message-bubble>p:first-child{margin-top:0}.message-bubble>p:last-child{margin-bottom:0}pre{overflow:auto;display:block;word-break:break-all;word-wrap:break-word;border-radius:7px;background:#2b2b2b;color:#f8f8f2;margin-top:.8em;margin-bottom:.8em;padding:.6em;font-size:.9em;line-height:1.5em}.image-message{padding:0;display:flex;background-color:#ddd}.image-message>*,.image-message>*>*{width:100%;border-radius:8px;display:flex}.audio-message{width:60%;max-width:300px;height:2.2em;max-height:54px;padding:0;background-color:unset}.audio-player{width:100%;height:100%}.audio-player-safari{height:fit-content;width:40px}.audio-player-safari-left{float:left}.audio-player-safari-right{float:right}.any-file-message-bubble{padding:1px}.any-file-message-contents{display:flex}.any-file-message-icon-container{width:1.3em;min-width:1.3em;position:relative;border-radius:4px;margin-left:6px;margin-right:2px}.any-file-message-icon{background-color:#fff;border-radius:4px;position:absolute;width:1em;height:1.25em;padding:1px;margin-top:auto;margin-bottom:auto;top:0;bottom:0}.any-file-message-text{padding-top:5px;overflow-wrap:anywhere;padding-bottom:5px;padding-right:7px}.message-bubble>a{color:inherit}.left-item-position{margin-right:10px}.right-item-position{margin-left:10px}.avatar{padding-top:5px;width:1.5em;height:1.5em;border-radius:1px}.avatar-container{margin-top:9px}.name{margin-top:16px;font-size:15px}#drag-and-drop{position:absolute;display:none;z-index:10;height:calc(100% - 10px);width:calc(100% - 10px);background-color:#70c6ff4d;border:5px dashed #6dafff}#file-attachment-container{position:absolute;height:3.6em;width:calc(80% - 4px);top:-2.5em;border-radius:5px;overflow:auto;text-align:left;background-color:#d7d7d73b;padding-left:4px}.file-attachment{width:2.85em;height:2.85em;display:inline-flex;margin-right:.6em;margin-bottom:.44em;margin-top:4px;position:relative;background-color:#fff;border-radius:5px}.image-attachment{width:100%;height:100%;object-fit:cover;border-radius:5px}.border-bound-attachment{width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid #c3c3c3;border-radius:5px;overflow:hidden}.border-bound-attachment-safari{width:calc(100% - 1px);height:calc(100% - 1px)}.audio-attachment-icon-container{cursor:pointer}.audio-attachment-icon-container:hover{background-color:#f8f8f8}.attachment-icon{left:0;right:0;bottom:0;top:2px;margin:auto;position:absolute;width:25px;-webkit-user-select:none;user-select:none}.not-removable-attachment-icon{top:0;right:0;bottom:0;left:0}.play-icon{filter:brightness(0) saturate(100%) invert(17%) sepia(0%) saturate(1392%) hue-rotate(67deg) brightness(98%) contrast(97%)}.stop-icon{filter:brightness(0) saturate(100%) invert(29%) sepia(90%) saturate(1228%) hue-rotate(198deg) brightness(93%) contrast(98%)}.audio-placeholder-text-3-digits{padding-left:.26rem}.audio-placeholder-text-4-digits{padding-left:.1rem}.any-file-attachment{padding:2px 0}.file-attachment-text-container{position:absolute;width:inherit;display:flex;align-items:center;height:100%;top:-1px}.audio-placeholder-text-3-digits-container{padding-top:1px;cursor:default}.any-file-attachment-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding-left:.13em;margin-left:auto;margin-right:auto}.remove-file-attachment-button{height:1.25em;width:1.25em;border:1px solid #cfcfcf;border-radius:25px;background-color:#fff;top:-4px;right:-5px;position:absolute;display:flex;justify-content:center;cursor:pointer;-webkit-user-select:none;user-select:none}.remove-file-attachment-button:hover{background-color:#e4e4e4}.remove-file-attachment-button:active{background-color:#d7d7d7}.x-icon{color:#4e4e4e;top:-.075em;position:relative;font-size:1.05em}.modal{display:none;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:80%;max-width:420px;max-height:80%;margin:auto;top:0;right:0;bottom:0;left:0;z-index:2}.modal-content{border-top:1px solid rgb(217,217,217);border-left:1px solid rgb(217,217,217);border-right:1px solid rgb(217,217,217);border-top-left-radius:inherit;border-top-right-radius:inherit;background-color:#fff;overflow-y:auto;height:fit-content;max-height:calc(100% - 3.3em);width:100%}.modal-content>p{margin-left:1em;margin-right:1em}.modal-content>ul{margin-right:1em}.modal-button-panel{height:3.3em;border:1px solid;border-color:rgb(223,223,223) rgb(217,217,217) rgb(217,217,217);border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;background-color:#fff;text-align:center;justify-content:center;display:flex;width:100%}.modal-button{min-width:2.5em;text-align:center;color:#fff;border-radius:5px;padding:.4em .4em .3em;height:1.25em;background-color:#3279b2;top:0;bottom:0;cursor:pointer;-webkit-user-select:none;user-select:none;margin:auto .31em}.modal-button:hover{background-color:#276da7}.modal-button:active{background-color:#1b5687}.modal-svg-button{padding:0 0 2px;width:2em;height:1.8em}.modal-svg-button-icon{width:100%;height:100%;filter:brightness(0) saturate(100%) invert(100%) sepia(15%) saturate(4%) hue-rotate(346deg) brightness(101%) contrast(102%)}#modal-background-panel{position:absolute;width:100%;height:100%;background-color:#00000042;z-index:1;display:none}.show-modal-background{animation:fadeInBackground .3s ease-in-out}@keyframes fadeInBackground{0%{opacity:0}to{opacity:1}}.show-modal{animation:fadeInModal .3s ease-in-out}@keyframes fadeInModal{0%{opacity:0;scale:.95}to{opacity:1;scale:1}}.hide-modal-background{animation:fadeOutBackground .2s ease-in-out}@keyframes fadeOutBackground{0%{opacity:1}to{opacity:0}}.hide-modal{animation:fadeOutModal .2s ease-in-out}@keyframes fadeOutModal{0%{opacity:1;scale:1}to{opacity:0;scale:.95}}.modal-camera-content{overflow:hidden;text-align:center;border:unset;height:100%;background-color:#2a2a2a;display:flex;justify-content:center}.camera-modal-canvas{max-width:100%;max-height:100%;margin-top:auto;margin-bottom:auto}.modal-svg-submit-button{background-color:green}.modal-svg-submit-button:hover{background-color:#007500}.modal-svg-submit-button:active{background-color:#006500}.modal-svg-submit-disabled{pointer-events:none;background-color:#747474}.modal-svg-close-button{height:1.56em;padding-top:.37em;padding-bottom:0;background-color:#c13e3e}.modal-svg-close-button:hover{background-color:#b43434}.modal-svg-close-button:active{background-color:#972929}.modal-svg-close-icon{width:80%;height:80%}.modal-svg-camera-button{height:1.6em;padding-top:.38em;padding-bottom:0}.modal-svg-camera-icon{height:76%}.modal-svg-refresh-icon{height:105%}.modal-svg-refresh-button{height:1.66em;padding-top:.11em;padding-bottom:.21em}.input-button-container{position:relative;z-index:1}.inside-right{position:absolute;right:calc(10% + .35em);bottom:.85em}.inside-left{position:absolute;left:calc(10% + .35em);bottom:.85em}.outside-left{position:absolute;right:calc(11px - .55em);bottom:.88em}.outside-right{position:absolute;left:calc(11px - .55em);bottom:.88em}#upload-images-icon{position:absolute;pointer-events:none;width:1.45em;height:1.45em;left:.11em;bottom:.08em;filter:brightness(0) saturate(100%) invert(43%) sepia(0%) saturate(740%) hue-rotate(77deg) brightness(99%) contrast(92%)}#upload-gifs-icon{position:absolute;pointer-events:none;width:1.5em;height:1.48em;left:.07em;bottom:.08em;filter:brightness(0) saturate(100%) invert(49%) sepia(0%) saturate(2586%) hue-rotate(12deg) brightness(93%) contrast(90%)}#upload-audio-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.17em;bottom:.2em;filter:brightness(0) saturate(100%) invert(15%) sepia(0%) saturate(337%) hue-rotate(125deg) brightness(91%) contrast(94%);transform:scaleX(.95)}#camera-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.23em;bottom:.2em;filter:brightness(0) saturate(100%) invert(52%) sepia(0%) saturate(161%) hue-rotate(164deg) brightness(91%) contrast(92%);transform:scaleX(.95)}#upload-mixed-files-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.25em;bottom:.2em;filter:brightness(0) saturate(100%) invert(53%) sepia(0%) saturate(36%) hue-rotate(74deg) brightness(98%) contrast(93%);transform:scaleX(.95)}#interim-text{color:gray}#microphone-button{padding-top:.5px}.outer-button-container>#microphone-button{padding-bottom:1px}#microphone-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.25em;bottom:.25em}.default-microphone-icon{filter:brightness(0) saturate(100%) invert(32%) sepia(0%) saturate(924%) hue-rotate(46deg) brightness(95%) contrast(99%)}.active-microphone-icon{filter:brightness(0) saturate(100%) invert(10%) sepia(97%) saturate(7495%) hue-rotate(0deg) brightness(101%) contrast(107%);border-radius:10px}.command-microphone-icon{filter:brightness(0) saturate(100%) invert(42%) sepia(96%) saturate(1067%) hue-rotate(77deg) brightness(99%) contrast(102%)}.unsupported-microphone{display:none}#submit-icon{height:100%;filter:brightness(0) saturate(100%) invert(32%) sepia(0%) saturate(924%) hue-rotate(46deg) brightness(95%) contrast(99%);width:1.21em}#stop-icon{background-color:#acacac;position:absolute;width:.95em;height:.95em;left:.35em;bottom:.35em;border-radius:2px}.submit-button-enlarged{scale:1.1;margin-right:.3em;margin-left:.3em}.dots-jumping{position:relative;left:calc(-9990px + .275em);width:.22em;height:.22em;border-radius:5px;background-color:#848484;color:#848484;box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484;animation:dots-jumping 1.5s infinite linear;bottom:-.7em}@keyframes dots-jumping{0%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}16.667%{box-shadow:9990px -6px #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}33.333%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}50%{box-shadow:9990px 0 #848484,calc(9990px + .44em) -6px 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}66.667%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}83.333%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) -6px 0 0 #848484}to{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}}.dots-flashing{position:relative;width:.45em;height:.45em;border-radius:5px;background-color:var(--message-dots-color);color:var(--message-dots-color);animation:dots-flashing 1s infinite linear alternate;animation-delay:.5s}.dots-flashing:before,.dots-flashing:after{content:\"\";display:inline-block;position:absolute;top:0}.dots-flashing:before{left:-.7em;width:.45em;height:.45em;border-radius:5px;background-color:var(--message-dots-color);color:var(--message-dots-color);animation:dots-flashing 1s infinite alternate;animation-delay:0s}.dots-flashing:after{left:.7em;width:.45em;height:.45em;border-radius:5px;background-color:var(--message-dots-color);color:var(--message-dots-color);animation:dots-flashing 1s infinite alternate;animation-delay:1s}@keyframes dots-flashing{0%{background-color:var(--message-dots-color)}50%,to{background-color:var(--message-dots-color-fade)}}.input-button{border-radius:4px;cursor:pointer;margin-bottom:.2em;-webkit-user-select:none;user-select:none}.input-button-svg{width:1.65em;height:1.65em}.input-button:hover{background-color:#9c9c9c2e}.input-button:active{background-color:#9c9c9c5e}.loading-button{cursor:auto}.loading-button:hover{background-color:unset}.text-button{filter:unset!important;display:flex;justify-content:center;align-items:center;margin-left:4px;margin-right:4px;height:1.6em}#text-input-container{background-color:#fff;width:80%;display:flex;border:1px solid #0000001a;border-radius:5px;margin-top:.8em;margin-bottom:.8em;box-shadow:#959da533 0 1px 12px;overflow-y:auto;max-height:200px;position:relative}.text-input-container-left-adjustment{margin-left:1.5em}.text-input-container-right-adjustment{margin-right:1.5em}.text-input-container-left-small-adjustment{margin-left:1.1em}.text-input-container-left-small-adjustment>.outside-left{right:calc(14px - .55em)}.text-input-container-right-small-adjustment{margin-right:1.1em}.text-input-container-right-small-adjustment>.outside-right{left:calc(14px - .55em)}#text-input{text-align:left;outline:none;word-wrap:break-word;line-break:auto}.text-input-styling{padding:.4em .5em;overflow:overlay;width:100%}.text-input-inner-left-adjustment{padding-left:2.2em}.text-input-inner-right-adjustment{padding-right:2em}.text-input-disabled{pointer-events:none;-webkit-user-select:none;user-select:none}.text-input-placeholder{color:gray}.outside-right>#dropup-menu,.inside-right>#dropup-menu{right:0}#dropup-icon{position:absolute;pointer-events:none;width:1.16em;height:1.2em;left:.265em;bottom:.43em;filter:brightness(0) saturate(100%) invert(54%) sepia(0%) saturate(724%) hue-rotate(6deg) brightness(92%) contrast(90%)}#dropup-menu{background-color:#fff;position:absolute;transform:translateY(-100%);border-radius:5px;z-index:1;top:-.49em;box-shadow:#0003 -1px 2px 10px,#0000001a 0 2px 4px;cursor:pointer;-webkit-user-select:none;user-select:none}.dropup-menu-item{height:1.4em;padding:.28em .84em .28em .35em;display:flex;position:relative}.dropup-menu-item:first-child{padding-top:.49em;border-top-left-radius:inherit;border-top-right-radius:inherit}.dropup-menu-item:last-child{padding-bottom:.45em;border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.dropup-menu-item-icon{width:1.39em;position:relative;margin-right:.56em}.dropup-menu-item-icon>svg{bottom:0!important;top:0!important;margin-bottom:auto;margin-top:auto}.dropup-menu-item-text{margin-top:.08em;width:max-content}#input{width:100%;display:inline-flex;text-align:center;margin-left:auto;margin-right:auto;margin-top:auto;position:relative;justify-content:center}#chat-view{height:100%;display:grid;grid-template-columns:100%}::-webkit-scrollbar{width:9px;height:9px}::-webkit-scrollbar-thumb{background-color:#d0d0d0;border-radius:5px}::-webkit-scrollbar-track{background-color:#f2f2f2}:host{all:initial;display:table-cell}#container{height:inherit;width:inherit;overflow:hidden}\n";
|
12227
12240
|
var wa = Object.defineProperty,
|
12228
12241
|
_a = Object.getOwnPropertyDescriptor,
|
12229
|
-
|
12242
|
+
y = function y(s, e, t, i) {
|
12230
12243
|
for (var n = i > 1 ? void 0 : i ? _a(e, t) : e, r = s.length - 1, o; r >= 0; r--) (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
|
12231
12244
|
return i && n && wa(e, t, n), n;
|
12232
12245
|
};
|
@@ -12234,22 +12247,22 @@ var b = /*#__PURE__*/function (_co) {
|
|
12234
12247
|
_inherits(b, _co);
|
12235
12248
|
var _super48 = _createSuper(b);
|
12236
12249
|
function b() {
|
12237
|
-
var
|
12250
|
+
var _this68;
|
12238
12251
|
_classCallCheck(this, b);
|
12239
|
-
|
12252
|
+
_this68 = _super48.call(this), _this68.getMessages = function () {
|
12240
12253
|
return [];
|
12241
|
-
},
|
12254
|
+
}, _this68.submitUserMessage = function () {
|
12242
12255
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
12243
|
-
},
|
12256
|
+
}, _this68.addMessage = function () {
|
12244
12257
|
return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
|
12245
|
-
},
|
12246
|
-
return
|
12247
|
-
},
|
12258
|
+
}, _this68.focusInput = function () {
|
12259
|
+
return $t.focusFromParentElement(_this68._elementRef);
|
12260
|
+
}, _this68.refreshMessages = function () {}, _this68.clearMessages = function () {}, _this68.scrollToBottom = function () {}, _this68.disableSubmitButton = function () {}, _this68.onNewMessage = function () {}, _this68.onClearMessages = function () {}, _this68.onComponentRender = function () {}, _this68.onError = function () {}, _this68._hasBeenRendered = !1, _this68._auxiliaryStyleApplied = !1, jo.appendStyleSheetToHead(), _this68._elementRef = document.createElement("div"), _this68._elementRef.id = "container", _this68.attachShadow({
|
12248
12261
|
mode: "open"
|
12249
|
-
}).appendChild(
|
12250
|
-
|
12262
|
+
}).appendChild(_this68._elementRef), vi.apply(Sa, _this68.shadowRoot), setTimeout(function () {
|
12263
|
+
_this68._hasBeenRendered || _this68.onRender();
|
12251
12264
|
}, 20);
|
12252
|
-
return
|
12265
|
+
return _this68;
|
12253
12266
|
}
|
12254
12267
|
_createClass(b, [{
|
12255
12268
|
key: "changeToChatView",
|
@@ -12261,48 +12274,49 @@ var b = /*#__PURE__*/function (_co) {
|
|
12261
12274
|
key: "onRender",
|
12262
12275
|
value: function onRender() {
|
12263
12276
|
var _this$_activeService, _this$_childElement;
|
12264
|
-
(_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = Do.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (
|
12277
|
+
(_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = Do.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (vi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), vi.applyDefaultStyleToComponent(this.style, this.chatStyle), Ae.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateConfigKey ? Ot.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof z) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Qi.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof z && N.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Nt.onRender(this));
|
12265
12278
|
}
|
12266
12279
|
}]);
|
12267
12280
|
return b;
|
12268
12281
|
}(co);
|
12269
|
-
|
12270
|
-
|
12271
|
-
|
12272
|
-
|
12273
|
-
|
12274
|
-
|
12275
|
-
|
12276
|
-
|
12277
|
-
|
12278
|
-
|
12279
|
-
|
12280
|
-
|
12281
|
-
|
12282
|
-
|
12283
|
-
|
12284
|
-
|
12285
|
-
|
12286
|
-
|
12287
|
-
|
12288
|
-
|
12289
|
-
|
12290
|
-
|
12291
|
-
|
12292
|
-
|
12293
|
-
|
12294
|
-
|
12295
|
-
|
12296
|
-
|
12297
|
-
|
12298
|
-
|
12299
|
-
|
12300
|
-
|
12301
|
-
|
12302
|
-
|
12303
|
-
|
12304
|
-
|
12305
|
-
|
12306
|
-
|
12282
|
+
y([v("object")], b.prototype, "directConnection", 2);
|
12283
|
+
y([v("object")], b.prototype, "request", 2);
|
12284
|
+
y([v("object")], b.prototype, "webModel", 2);
|
12285
|
+
y([v("object")], b.prototype, "stream", 2);
|
12286
|
+
y([v("object")], b.prototype, "requestBodyLimits", 2);
|
12287
|
+
y([v("function")], b.prototype, "requestInterceptor", 2);
|
12288
|
+
y([v("function")], b.prototype, "responseInterceptor", 2);
|
12289
|
+
y([v("function")], b.prototype, "validateInput", 2);
|
12290
|
+
y([v("object")], b.prototype, "chatStyle", 2);
|
12291
|
+
y([v("object")], b.prototype, "attachmentContainerStyle", 2);
|
12292
|
+
y([v("object")], b.prototype, "dropupStyles", 2);
|
12293
|
+
y([v("object")], b.prototype, "inputAreaStyle", 2);
|
12294
|
+
y([v("object")], b.prototype, "textInput", 2);
|
12295
|
+
y([v("object")], b.prototype, "submitButtonStyles", 2);
|
12296
|
+
y([v("string")], b.prototype, "auxiliaryStyle", 2);
|
12297
|
+
y([v("array")], b.prototype, "initialMessages", 2);
|
12298
|
+
y([v("object")], b.prototype, "introMessage", 2);
|
12299
|
+
y([v("object")], b.prototype, "avatars", 2);
|
12300
|
+
y([v("object")], b.prototype, "names", 2);
|
12301
|
+
y([v("boolean")], b.prototype, "displayLoadingBubble", 2);
|
12302
|
+
y([v("object")], b.prototype, "errorMessages", 2);
|
12303
|
+
y([v("object")], b.prototype, "messageStyles", 2);
|
12304
|
+
y([v("object")], b.prototype, "textToSpeech", 2);
|
12305
|
+
y([v("object")], b.prototype, "speechToText", 2);
|
12306
|
+
y([v("object")], b.prototype, "images", 2);
|
12307
|
+
y([v("object")], b.prototype, "gifs", 2);
|
12308
|
+
y([v("object")], b.prototype, "camera", 2);
|
12309
|
+
y([v("object")], b.prototype, "audio", 2);
|
12310
|
+
y([v("object")], b.prototype, "microphone", 2);
|
12311
|
+
y([v("object")], b.prototype, "mixedFiles", 2);
|
12312
|
+
y([v("object")], b.prototype, "dragAndDrop", 2);
|
12313
|
+
y([v("object")], b.prototype, "introPanelStyle", 2);
|
12314
|
+
y([v("object")], b.prototype, "htmlClassUtilities", 2);
|
12315
|
+
y([v("function")], b.prototype, "onNewMessage", 2);
|
12316
|
+
y([v("function")], b.prototype, "onClearMessages", 2);
|
12317
|
+
y([v("function")], b.prototype, "onComponentRender", 2);
|
12318
|
+
y([v("function")], b.prototype, "onError", 2);
|
12319
|
+
y([v("object")], b.prototype, "demo", 2);
|
12320
|
+
y([v("object")], b.prototype, "_insertKeyViewStyles", 2);
|
12307
12321
|
customElements.define("deep-chat", b);
|
12308
12322
|
export { b as DeepChat };
|