@epam/ai-dial-chat-shared 1.3.0-dev.98 → 1.4.0-dev.5
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/components/ActionMenu/ActionMenu.d.ts +26 -0
- package/components/ActionMenu/ActionMenu.d.ts.map +1 -0
- package/components/ActionMenu/ActionMenu.js +50 -0
- package/components/ConfirmationDialog/ConfirmationDialog.d.ts +6 -1
- package/components/ConfirmationDialog/ConfirmationDialog.d.ts.map +1 -1
- package/components/ConfirmationDialog/ConfirmationDialog.js +11 -9
- package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.module.scss.js +5 -4
- package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.js +2 -2
- package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.module.scss.js +3 -2
- package/components/ConfirmationView/ConfirmationFooter.d.ts.map +1 -1
- package/components/ConfirmationView/ConfirmationFooter.js +24 -25
- package/components/ConfirmationView/ConfirmationView.d.ts +2 -0
- package/components/ConfirmationView/ConfirmationView.d.ts.map +1 -1
- package/components/ConfirmationView/ConfirmationView.js +12 -12
- package/components/ConfirmationView/ConfirmationView.module.scss.js +6 -5
- package/components/DeleteConfirmationDrawer/DeleteConfirmationDrawer.d.ts +31 -0
- package/components/DeleteConfirmationDrawer/DeleteConfirmationDrawer.d.ts.map +1 -0
- package/components/DeleteConfirmationDrawer/DeleteConfirmationDrawer.js +36 -0
- package/components/DeleteConfirmationView/DeleteConfirmationView.d.ts +3 -0
- package/components/DeleteConfirmationView/DeleteConfirmationView.d.ts.map +1 -1
- package/components/DeleteConfirmationView/DeleteConfirmationView.js +36 -27
- package/components/DeleteConfirmationView/DeleteConfirmationView.module.scss.js +5 -4
- package/components/DeploymentIcon/DeploymentIcon.module.scss.js +3 -2
- package/components/EntityHeader/EntityHeader.js +1 -1
- package/components/InitialsAvatar/InitialsAvatar.d.ts +3 -0
- package/components/InitialsAvatar/InitialsAvatar.d.ts.map +1 -1
- package/components/InitialsAvatar/InitialsAvatar.js +4 -3
- package/components/ItemHeader/ItemHeader.module.scss.js +5 -4
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.d.ts +6 -2
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.js +58 -58
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.module.scss.js +9 -8
- package/components/MarkdownRenderer/CodeBlock/syntax-theme.d.ts.map +1 -1
- package/components/MarkdownRenderer/MarkdownRenderer.d.ts +6 -0
- package/components/MarkdownRenderer/MarkdownRenderer.d.ts.map +1 -1
- package/components/MarkdownRenderer/MarkdownRenderer.js +29 -24
- package/components/MarkdownRenderer/MarkdownRenderer.module.scss.js +9 -8
- package/components/MarkdownRenderer/Math/MarkdownMathBlock.module.scss.js +5 -4
- package/components/MarkdownRenderer/PlainTextRenderer.js +1 -1
- package/components/MarkdownRenderer/Table/MarkdownTable.d.ts +4 -0
- package/components/MarkdownRenderer/Table/MarkdownTable.d.ts.map +1 -1
- package/components/MarkdownRenderer/Table/MarkdownTable.js +68 -63
- package/components/MarkdownRenderer/Table/MarkdownTable.module.scss.js +15 -13
- package/components/MarkdownRenderer/Table/TableHeader.module.scss.js +3 -2
- package/components/MarkdownRenderer/markdown-whitespace.js +2 -6
- package/components/NewVersionAlert/NewVersionAlert.d.ts +27 -0
- package/components/NewVersionAlert/NewVersionAlert.d.ts.map +1 -0
- package/components/NewVersionAlert/NewVersionAlert.js +28 -0
- package/components/NewVersionAlert/NewVersionAlert.module.scss.js +4 -0
- package/components/NotificationStack/NotificationStack.d.ts +48 -0
- package/components/NotificationStack/NotificationStack.d.ts.map +1 -0
- package/components/NotificationStack/NotificationStack.js +111 -0
- package/components/PanelEmptyState/PanelEmptyState.d.ts +12 -2
- package/components/PanelEmptyState/PanelEmptyState.d.ts.map +1 -1
- package/components/PanelEmptyState/PanelEmptyState.js +19 -9
- package/components/PanelEmptyState/PanelEmptyState.module.scss.js +6 -2
- package/components/ResourceSummary/ResourceSummary.module.scss.js +5 -4
- package/components/TextRefinementField/TextRefinementField.d.ts +4 -2
- package/components/TextRefinementField/TextRefinementField.d.ts.map +1 -1
- package/components/TextRefinementField/TextRefinementField.js +84 -55
- package/components/UnsavedChangesProvider/UnsavedChangesProvider.d.ts +22 -0
- package/components/UnsavedChangesProvider/UnsavedChangesProvider.d.ts.map +1 -0
- package/components/UnsavedChangesProvider/UnsavedChangesProvider.js +57 -0
- package/components/UnsavedChangesProvider/unsaved-changes-context.d.ts +44 -0
- package/components/UnsavedChangesProvider/unsaved-changes-context.d.ts.map +1 -0
- package/components/UnsavedChangesProvider/unsaved-changes-context.js +13 -0
- package/constants/breakpoint.d.ts +6 -0
- package/constants/breakpoint.d.ts.map +1 -1
- package/constants/breakpoint.js +2 -2
- package/conversation-transfer/conversation-transfer-queue.d.ts +16 -0
- package/conversation-transfer/conversation-transfer-queue.d.ts.map +1 -0
- package/conversation-transfer/conversation-transfer-queue.js +24 -0
- package/file-manager/DialFileManagerShell/DialFileManagerShell.d.ts +9 -0
- package/file-manager/DialFileManagerShell/DialFileManagerShell.d.ts.map +1 -1
- package/file-manager/DialFileManagerShell/DialFileManagerShell.js +330 -269
- package/file-manager/DialFileManagerShell/DialFileManagerShell.module.scss.js +8 -0
- package/file-manager/FileManagerAttachModal/FileManagerAttachModal.d.ts +7 -0
- package/file-manager/FileManagerAttachModal/FileManagerAttachModal.d.ts.map +1 -1
- package/file-manager/FileManagerAttachModal/FileManagerAttachModal.js +85 -80
- package/file-manager/FileManagerAttachModal/FileManagerAttachModal.module.scss.js +7 -0
- package/file-manager/OperationLoaderModal/OperationLoaderModal.d.ts +5 -0
- package/file-manager/OperationLoaderModal/OperationLoaderModal.d.ts.map +1 -1
- package/file-manager/OperationLoaderModal/OperationLoaderModal.js +25 -20
- package/file-manager/OperationLoaderModal/OperationLoaderModal.module.scss.js +4 -0
- package/file-manager/file-manager-controller.d.ts +11 -3
- package/file-manager/file-manager-controller.d.ts.map +1 -1
- package/file-manager/index.d.ts +1 -0
- package/file-manager/index.d.ts.map +1 -1
- package/file-manager/labels.d.ts +21 -2
- package/file-manager/labels.d.ts.map +1 -1
- package/file-manager/shell-styles.d.ts +37 -0
- package/file-manager/shell-styles.d.ts.map +1 -0
- package/file-manager/upload-batch.d.ts +46 -0
- package/file-manager/upload-batch.d.ts.map +1 -1
- package/file-manager/upload-batch.js +6 -2
- package/file-manager/upload-queue.d.ts +44 -4
- package/file-manager/upload-queue.d.ts.map +1 -1
- package/file-manager/upload-queue.js +45 -13
- package/file-manager.js +4 -4
- package/hooks/useAvailableHeightCap.js +1 -1
- package/hooks/useControlErrorAssociation.d.ts +3 -0
- package/hooks/useControlErrorAssociation.d.ts.map +1 -0
- package/hooks/useControlErrorAssociation.js +12 -0
- package/hooks/useIsMobile.js +1 -1
- package/hooks/useIsPhone.d.ts +3 -0
- package/hooks/useIsPhone.d.ts.map +1 -0
- package/hooks/useIsPhone.js +13 -0
- package/hooks/useIsTablet.d.ts +3 -0
- package/hooks/useIsTablet.d.ts.map +1 -0
- package/hooks/useIsTablet.js +13 -0
- package/hooks/useIsTextClipped.d.ts +26 -0
- package/hooks/useIsTextClipped.d.ts.map +1 -0
- package/hooks/useIsTextClipped.js +25 -0
- package/hooks/useIsVerticallyClamped.d.ts +16 -0
- package/hooks/useIsVerticallyClamped.d.ts.map +1 -0
- package/hooks/useIsVerticallyClamped.js +20 -0
- package/hooks/useTextRefinement.d.ts +1 -1
- package/hooks/useTextRefinement.d.ts.map +1 -1
- package/hooks/useTextRefinement.js +4 -4
- package/hooks/useUnsavedChangesGuard.js +1 -5
- package/hooks/useUnsavedChangesLeaveConfirmation.d.ts +12 -0
- package/hooks/useUnsavedChangesLeaveConfirmation.d.ts.map +1 -0
- package/hooks/useUnsavedChangesLeaveConfirmation.js +22 -0
- package/hooks/useUnsavedChangesLeaveGuard.d.ts +24 -0
- package/hooks/useUnsavedChangesLeaveGuard.d.ts.map +1 -0
- package/hooks/useUnsavedChangesLeaveGuard.js +24 -0
- package/index.css +2 -2
- package/index.d.ts +15 -0
- package/index.d.ts.map +1 -1
- package/index.js +93 -78
- package/models/auth.d.ts +2 -0
- package/models/auth.d.ts.map +1 -1
- package/models/chat.d.ts +19 -0
- package/models/chat.d.ts.map +1 -1
- package/models/conversation-classification.d.ts +5 -0
- package/models/conversation-classification.d.ts.map +1 -1
- package/models/conversation-classification.js +3 -1
- package/models/text-refinement.d.ts +6 -2
- package/models/text-refinement.d.ts.map +1 -1
- package/package.json +10 -17
- package/types/mime-type.d.ts +30 -0
- package/types/mime-type.d.ts.map +1 -1
- package/types/mime-type.js +1 -1
- package/utils/dom.d.ts +8 -0
- package/utils/dom.d.ts.map +1 -0
- package/utils/dom.js +10 -0
- package/utils/format-price.js +10 -10
- package/utils/inline-segments.js +1 -1
- package/utils/latex.d.ts +4 -3
- package/utils/latex.d.ts.map +1 -1
- package/utils/latex.js +47 -41
- package/utils/message-attachment-to-display.js +1 -1
- package/utils/mime-type.js +1 -1
- package/utils/prompt-variables.js +5 -9
- package/utils/syntax-highlighting.js +8 -8
package/utils/inline-segments.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/utils/inline-segments.ts
|
|
2
|
-
var e = "", t = "", n = RegExp(`${e}(\\d+)${t}`, "g"), r = RegExp(`${encodeURI(e)}(\\d+)${encodeURI(t)}`, "gi"), i = "dial-inline-segment", a = new Set([
|
|
2
|
+
var e = "", t = "", n = RegExp(`${e}(\\d+)${t}`, "g"), r = RegExp(`${encodeURI(e)}(\\d+)${encodeURI(t)}`, "gi"), i = "dial-inline-segment", a = /* @__PURE__ */ new Set([
|
|
3
3
|
"code",
|
|
4
4
|
"pre",
|
|
5
5
|
"a"
|
package/utils/latex.d.ts
CHANGED
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
* open, not against the few characters after the amount: `$1 - \frac{3}{p} < 1$` reads as
|
|
14
14
|
* a price for one character and as LaTeX for the rest of the line.
|
|
15
15
|
*
|
|
16
|
-
* The `\(...\)`/`\[...\]` delimiters LLMs commonly emit are
|
|
17
|
-
* recognized directly by `micromark-extension-llm-math`, which the consuming app's bundler
|
|
18
|
-
* config aliases in place of the default `micromark-extension-math` used by `remark-math`.
|
|
16
|
+
* The `\(...\)`/`\[...\]` delimiters LLMs commonly emit are left as-is around a formula: they
|
|
17
|
+
* are recognized directly by `micromark-extension-llm-math`, which the consuming app's bundler
|
|
18
|
+
* config aliases in place of the default `micromark-extension-math` used by `remark-math`. A
|
|
19
|
+
* pair wrapping a link or a URL is escaped prose and is turned back into literal brackets.
|
|
19
20
|
*/
|
|
20
21
|
export declare const preprocessLaTeX: (content: string) => string;
|
|
21
22
|
//# sourceMappingURL=latex.d.ts.map
|
package/utils/latex.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latex.d.ts","sourceRoot":"","sources":["../../src/utils/latex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"latex.d.ts","sourceRoot":"","sources":["../../src/utils/latex.ts"],"names":[],"mappings":"AAuWA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,MAoEjD,CAAC"}
|
package/utils/latex.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
//#region src/utils/latex.ts
|
|
2
|
-
var e = /\$\\ce\{/g, t = /\$\\pu\{/g, n = /\$\\\\ce\{[^}]*\}\$/g, r = /\$\\\\pu\{[^}]*\}\$/g, i =
|
|
2
|
+
var e = /\$\\ce\{/g, t = /\$\\pu\{/g, n = /\$\\\\ce\{[^}]*\}\$/g, r = /\$\\\\pu\{[^}]*\}\$/g, i = /\]\(|:\/\//, a = {
|
|
3
|
+
"[": "]",
|
|
4
|
+
"(": ")"
|
|
5
|
+
}, o = {
|
|
6
|
+
"[": "[",
|
|
7
|
+
"]": "]",
|
|
8
|
+
"(": "(",
|
|
9
|
+
")": ")"
|
|
10
|
+
}, s = /\$\$([\s\S]*?)\$\$/g, c = /^[ \t]*\r?\n/, l = /\r?\n[ \t]*$/, u = /\d+(?:,\d{3})*(?:\.\d+)?(?:[KMBkmb])?/y, d = /\s|[^a-zA-Z\d]/y, f = /[\^_\\]/y, p = /(?:[<>]|\\(?:le|leq|ll|ge|geq|gg|ne|neq|approx|equiv|sim|simeq|cong|in|notin|subset|subseteq|supset|supseteq|to|rightarrow|leftarrow|mapsto|implies|iff)\b)/y, m = /\\[a-zA-Z]|[\^_]/, h = (i) => {
|
|
3
11
|
let a = i.replace(e, "$\\\\ce{");
|
|
4
12
|
return a = a.replace(t, "$\\\\pu{"), a = a.replace(n, (e) => `$${e}$`), a = a.replace(r, (e) => `$${e}$`), a;
|
|
5
|
-
},
|
|
13
|
+
}, g = (e) => {
|
|
6
14
|
let t = [], n = -1, r = -1;
|
|
7
15
|
for (let i = 0; i < e.length; i++) {
|
|
8
16
|
let a = e[i];
|
|
9
17
|
a === "`" && i + 2 < e.length && e[i + 1] === "`" && e[i + 2] === "`" ? r === -1 ? (r = i, i += 2) : (t.push([r, i + 2]), r = -1, i += 2) : a === "`" && r === -1 && (n === -1 ? n = i : (t.push([n, i]), n = -1));
|
|
10
18
|
}
|
|
11
19
|
return t;
|
|
12
|
-
},
|
|
20
|
+
}, _ = (e, t) => {
|
|
13
21
|
let n = 0, r = t.length - 1;
|
|
14
22
|
for (; n <= r;) {
|
|
15
23
|
let i = Math.floor((n + r) / 2), [a, o] = t[i];
|
|
@@ -17,60 +25,58 @@ var e = /\$\\ce\{/g, t = /\$\\pu\{/g, n = /\$\\\\ce\{[^}]*\}\$/g, r = /\$\\\\pu\
|
|
|
17
25
|
e < a ? r = i - 1 : n = i + 1;
|
|
18
26
|
}
|
|
19
27
|
return !1;
|
|
20
|
-
},
|
|
28
|
+
}, v = (e, t, n) => (e.lastIndex = n, e.exec(t)), y = /\s/, b = (e, t) => {
|
|
21
29
|
let n = t;
|
|
22
|
-
for (; n < e.length &&
|
|
30
|
+
for (; n < e.length && y.test(e[n]);) n++;
|
|
23
31
|
return n;
|
|
24
|
-
},
|
|
32
|
+
}, x = (e) => {
|
|
25
33
|
if (!e.includes("$$")) return e;
|
|
26
|
-
let t =
|
|
27
|
-
for (
|
|
28
|
-
let
|
|
29
|
-
if (
|
|
30
|
-
let u = e.lastIndexOf("\n",
|
|
31
|
-
if (e.slice(u,
|
|
32
|
-
let d = e.indexOf("\n",
|
|
33
|
-
if (!
|
|
34
|
-
let p =
|
|
35
|
-
n.push(e.slice(r,
|
|
34
|
+
let t = g(e), n = [], r = 0, i;
|
|
35
|
+
for (s.lastIndex = 0; (i = s.exec(e)) !== null;) {
|
|
36
|
+
let a = i.index, o = a + i[0].length, s = i[1];
|
|
37
|
+
if (_(a, t)) continue;
|
|
38
|
+
let u = e.lastIndexOf("\n", a - 1) + 1;
|
|
39
|
+
if (e.slice(u, a).trim() !== "") continue;
|
|
40
|
+
let d = e.indexOf("\n", o), f = e.slice(o, d === -1 ? e.length : d);
|
|
41
|
+
if (!s.includes("\n") && (f.trim() !== "" || s.trim() === "")) continue;
|
|
42
|
+
let p = s.replace(c, "").replace(l, "");
|
|
43
|
+
n.push(e.slice(r, a)), n.push(`$$\n${p}\n$$${f.trim() === "" ? "" : "\n"}`), r = o;
|
|
36
44
|
}
|
|
37
45
|
return n.push(e.substring(r)), n.join("");
|
|
38
|
-
},
|
|
39
|
-
|
|
46
|
+
}, S = (e) => {
|
|
47
|
+
if (!e.includes("\\[") && !e.includes("\\(")) return e;
|
|
48
|
+
let t = g(e), n = [], r = 0;
|
|
49
|
+
for (let s = 0; s < e.length - 1; s++) {
|
|
50
|
+
let c = e[s + 1], l = a[c];
|
|
51
|
+
if (e[s] !== "\\" || l == null || s > 0 && e[s - 1] === "\\" || _(s, t)) continue;
|
|
52
|
+
let u = e.indexOf(`\\${l}`, s + 2);
|
|
53
|
+
u !== -1 && i.test(e.slice(s + 2, u)) && (n.push(e.slice(r, s), o[c], e.slice(s + 2, u), o[l]), r = u + 2, s = u + 1);
|
|
54
|
+
}
|
|
55
|
+
return r === 0 ? e : (n.push(e.substring(r)), n.join(""));
|
|
56
|
+
}, C = (e, t) => {
|
|
57
|
+
let n = v(u, e, t + 1);
|
|
40
58
|
return n ? t + 1 + n[0].length : -1;
|
|
41
|
-
},
|
|
59
|
+
}, w = (e, t) => t >= e.length || !(!v(d, e, t) || v(f, e, t) || v(p, e, b(e, t))), T = (e, t) => {
|
|
42
60
|
let n = [];
|
|
43
61
|
for (let r = 0; r < e.length; r++) {
|
|
44
62
|
if (e[r] !== "$") continue;
|
|
45
63
|
let i = r;
|
|
46
64
|
for (; i + 1 < e.length && e[i + 1] === "$";) i++;
|
|
47
|
-
|
|
48
|
-
r = i;
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
r > 0 && e[r - 1] === "\\" || m(r, t) || n.push(r);
|
|
65
|
+
i > r ? r = i : r > 0 && e[r - 1] === "\\" || _(r, t) || n.push(r);
|
|
52
66
|
}
|
|
53
67
|
return n;
|
|
54
|
-
},
|
|
68
|
+
}, E = (e, t, n, r) => {
|
|
55
69
|
if (n <= t + 1 || e[n - 1] === "`") return !1;
|
|
56
70
|
for (let i = t + 1; i < n; i++) if (e[i] === "\n" || e[i] === "$" && !(e[i - 1] === "\\" || r.has(i))) return !1;
|
|
57
71
|
return !0;
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
(
|
|
62
|
-
let n =
|
|
72
|
+
}, D = (e, t, n, r) => n !== void 0 && E(e, t, n, r) && m.test(e.slice(t + 1, n)), O = (e) => {
|
|
73
|
+
let t = S(e);
|
|
74
|
+
if (!t.includes("$")) return t;
|
|
75
|
+
(t.includes("\\ce{") || t.includes("\\pu{")) && (t = h(t)), t = x(t);
|
|
76
|
+
let n = g(t), r = T(t, n), i = /* @__PURE__ */ new Map(), a = -1;
|
|
63
77
|
for (let e = 0; e < r.length; e++) {
|
|
64
|
-
let n = r[e], o =
|
|
65
|
-
|
|
66
|
-
i.set(n, "\\$"), a === -1 && r[e + 1] === o && (i.set(o, "\\$"), e++);
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (a === -1) {
|
|
70
|
-
a = n;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
S(t, a, n, i) ? (i.set(a, "$$"), i.set(n, "$$"), a = -1) : a = n;
|
|
78
|
+
let n = r[e], o = C(t, n);
|
|
79
|
+
o !== -1 && w(t, o) && (a !== -1 || !D(t, n, r[e + 1], i)) ? (i.set(n, "\\$"), a === -1 && r[e + 1] === o && (i.set(o, "\\$"), e++)) : a === -1 ? a = n : E(t, a, n, i) ? (i.set(a, "$$"), i.set(n, "$$"), a = -1) : a = n;
|
|
74
80
|
}
|
|
75
81
|
if (i.size === 0) return t;
|
|
76
82
|
let o = [], s = 0;
|
|
@@ -78,4 +84,4 @@ var e = /\$\\ce\{/g, t = /\$\\pu\{/g, n = /\$\\\\ce\{[^}]*\}\$/g, r = /\$\\\\pu\
|
|
|
78
84
|
return o.push(t.substring(s)), o.join("");
|
|
79
85
|
};
|
|
80
86
|
//#endregion
|
|
81
|
-
export {
|
|
87
|
+
export { O as preprocessLaTeX };
|
|
@@ -3,7 +3,7 @@ import { AttachmentType as t } from "../types/attachment.js";
|
|
|
3
3
|
import { getAttachmentTypeFromMime as n, inferMimeTypeFromPath as r } from "./mime-type.js";
|
|
4
4
|
//#region src/utils/message-attachment-to-display.ts
|
|
5
5
|
var i = (e, t, n) => {
|
|
6
|
-
if (
|
|
6
|
+
if (e?.startsWith(n) && t) return `data:${e};base64,${t}`;
|
|
7
7
|
}, a = (a, o = {}) => {
|
|
8
8
|
let s = n(a.type), c = s === t.Image, l = s === t.Audio, u = a.url && a.reference_url && !a.reference_type, d = a.url ?? a.data ?? a.title, f = (a.url == null && a.reference_url != null ? a.reference_type ?? r(a.reference_url) : void 0) ?? a.type ?? "", p;
|
|
9
9
|
c && (a.url ? p = o.resolvePreviewUrl?.(a) ?? a.url : a.data && (p = i(a.type, a.data, "image/")));
|
package/utils/mime-type.js
CHANGED
|
@@ -71,7 +71,7 @@ var r = {
|
|
|
71
71
|
return n[t] ?? t;
|
|
72
72
|
}, o = (e) => e.split(/[?#]/)[0], s = (e) => {
|
|
73
73
|
let t = o(e), n = t.lastIndexOf(".");
|
|
74
|
-
|
|
74
|
+
return n === -1 ? void 0 : r[t.slice(n + 1).toLowerCase()];
|
|
75
75
|
}, c = (t) => t?.startsWith("image/") ? e.Image : t?.startsWith("audio/") ? e.Audio : e.File;
|
|
76
76
|
//#endregion
|
|
77
77
|
export { c as getAttachmentTypeFromMime, i as getBaseMimeType, s as inferMimeTypeFromPath, a as normalizeMimeType, o as stripUrlQueryAndFragment };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/utils/prompt-variables.ts
|
|
2
|
-
var e = /\{\{([^{}]+)\}\}/g, t = "cat-prompt-variable", n = new Set(["code", "pre"]), r = (n) => {
|
|
2
|
+
var e = /\{\{([^{}]+)\}\}/g, t = "cat-prompt-variable", n = /* @__PURE__ */ new Set(["code", "pre"]), r = (n) => {
|
|
3
3
|
e.lastIndex = 0;
|
|
4
4
|
let r = [], i = 0, a = e.exec(n);
|
|
5
5
|
for (; a != null;) a.index > i && r.push({
|
|
@@ -21,14 +21,10 @@ var e = /\{\{([^{}]+)\}\}/g, t = "cat-prompt-variable", n = new Set(["code", "pr
|
|
|
21
21
|
}, i = (e) => {
|
|
22
22
|
if (e.children == null || e.tagName != null && n.has(e.tagName)) return;
|
|
23
23
|
let t = [];
|
|
24
|
-
for (let n of e.children) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
i(n), t.push(n);
|
|
31
|
-
}
|
|
24
|
+
for (let n of e.children) if (n.type === "text" && n.value != null) {
|
|
25
|
+
let e = r(n.value);
|
|
26
|
+
t.push(...e ?? [n]);
|
|
27
|
+
} else i(n), t.push(n);
|
|
32
28
|
e.children = t;
|
|
33
29
|
}, a = () => (e) => {
|
|
34
30
|
i(e);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//#region src/utils/syntax-highlighting.ts
|
|
2
|
-
var e =
|
|
3
|
-
if (
|
|
4
|
-
let
|
|
5
|
-
for (let
|
|
6
|
-
let
|
|
7
|
-
if (
|
|
8
|
-
else if (++
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
if (e.length > 5e4) return !1;
|
|
4
|
+
let t = 0;
|
|
5
|
+
for (let n = 0; n < e.length; n++) {
|
|
6
|
+
let r = e[n];
|
|
7
|
+
if (r === "\n" || r === "\r") t = 0;
|
|
8
|
+
else if (++t > 2e3) return !1;
|
|
9
9
|
}
|
|
10
10
|
return !0;
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
|
-
export {
|
|
13
|
+
export { e as isSyntaxHighlightingAllowed };
|