@epam/ai-dial-chat-shared 1.3.0-dev.98 → 1.3.0-rc.1

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.
Files changed (155) hide show
  1. package/components/ActionMenu/ActionMenu.d.ts +26 -0
  2. package/components/ActionMenu/ActionMenu.d.ts.map +1 -0
  3. package/components/ActionMenu/ActionMenu.js +50 -0
  4. package/components/ConfirmationDialog/ConfirmationDialog.d.ts +6 -1
  5. package/components/ConfirmationDialog/ConfirmationDialog.d.ts.map +1 -1
  6. package/components/ConfirmationDialog/ConfirmationDialog.js +11 -9
  7. package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.module.scss.js +5 -4
  8. package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.js +2 -2
  9. package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.module.scss.js +3 -2
  10. package/components/ConfirmationView/ConfirmationFooter.d.ts.map +1 -1
  11. package/components/ConfirmationView/ConfirmationFooter.js +24 -25
  12. package/components/ConfirmationView/ConfirmationView.d.ts +2 -0
  13. package/components/ConfirmationView/ConfirmationView.d.ts.map +1 -1
  14. package/components/ConfirmationView/ConfirmationView.js +12 -12
  15. package/components/ConfirmationView/ConfirmationView.module.scss.js +6 -5
  16. package/components/DeleteConfirmationDrawer/DeleteConfirmationDrawer.d.ts +31 -0
  17. package/components/DeleteConfirmationDrawer/DeleteConfirmationDrawer.d.ts.map +1 -0
  18. package/components/DeleteConfirmationDrawer/DeleteConfirmationDrawer.js +36 -0
  19. package/components/DeleteConfirmationView/DeleteConfirmationView.d.ts +3 -0
  20. package/components/DeleteConfirmationView/DeleteConfirmationView.d.ts.map +1 -1
  21. package/components/DeleteConfirmationView/DeleteConfirmationView.js +36 -27
  22. package/components/DeleteConfirmationView/DeleteConfirmationView.module.scss.js +5 -4
  23. package/components/DeploymentIcon/DeploymentIcon.module.scss.js +3 -2
  24. package/components/EntityHeader/EntityHeader.js +1 -1
  25. package/components/InitialsAvatar/InitialsAvatar.d.ts +3 -0
  26. package/components/InitialsAvatar/InitialsAvatar.d.ts.map +1 -1
  27. package/components/InitialsAvatar/InitialsAvatar.js +4 -3
  28. package/components/ItemHeader/ItemHeader.module.scss.js +5 -4
  29. package/components/MarkdownRenderer/CodeBlock/CodeBlock.d.ts +6 -2
  30. package/components/MarkdownRenderer/CodeBlock/CodeBlock.d.ts.map +1 -1
  31. package/components/MarkdownRenderer/CodeBlock/CodeBlock.js +58 -58
  32. package/components/MarkdownRenderer/CodeBlock/CodeBlock.module.scss.js +9 -8
  33. package/components/MarkdownRenderer/CodeBlock/syntax-theme.d.ts.map +1 -1
  34. package/components/MarkdownRenderer/MarkdownRenderer.d.ts +6 -0
  35. package/components/MarkdownRenderer/MarkdownRenderer.d.ts.map +1 -1
  36. package/components/MarkdownRenderer/MarkdownRenderer.js +29 -24
  37. package/components/MarkdownRenderer/MarkdownRenderer.module.scss.js +9 -8
  38. package/components/MarkdownRenderer/Math/MarkdownMathBlock.module.scss.js +5 -4
  39. package/components/MarkdownRenderer/PlainTextRenderer.js +1 -1
  40. package/components/MarkdownRenderer/Table/MarkdownTable.d.ts +4 -0
  41. package/components/MarkdownRenderer/Table/MarkdownTable.d.ts.map +1 -1
  42. package/components/MarkdownRenderer/Table/MarkdownTable.js +68 -63
  43. package/components/MarkdownRenderer/Table/MarkdownTable.module.scss.js +15 -13
  44. package/components/MarkdownRenderer/Table/TableHeader.module.scss.js +3 -2
  45. package/components/MarkdownRenderer/markdown-whitespace.js +2 -6
  46. package/components/NewVersionAlert/NewVersionAlert.d.ts +27 -0
  47. package/components/NewVersionAlert/NewVersionAlert.d.ts.map +1 -0
  48. package/components/NewVersionAlert/NewVersionAlert.js +28 -0
  49. package/components/NewVersionAlert/NewVersionAlert.module.scss.js +4 -0
  50. package/components/NotificationStack/NotificationStack.d.ts +48 -0
  51. package/components/NotificationStack/NotificationStack.d.ts.map +1 -0
  52. package/components/NotificationStack/NotificationStack.js +111 -0
  53. package/components/PanelEmptyState/PanelEmptyState.d.ts +12 -2
  54. package/components/PanelEmptyState/PanelEmptyState.d.ts.map +1 -1
  55. package/components/PanelEmptyState/PanelEmptyState.js +19 -9
  56. package/components/PanelEmptyState/PanelEmptyState.module.scss.js +6 -2
  57. package/components/ResourceSummary/ResourceSummary.module.scss.js +5 -4
  58. package/components/TextRefinementField/TextRefinementField.d.ts +4 -2
  59. package/components/TextRefinementField/TextRefinementField.d.ts.map +1 -1
  60. package/components/TextRefinementField/TextRefinementField.js +84 -55
  61. package/components/UnsavedChangesProvider/UnsavedChangesProvider.d.ts +22 -0
  62. package/components/UnsavedChangesProvider/UnsavedChangesProvider.d.ts.map +1 -0
  63. package/components/UnsavedChangesProvider/UnsavedChangesProvider.js +57 -0
  64. package/components/UnsavedChangesProvider/unsaved-changes-context.d.ts +44 -0
  65. package/components/UnsavedChangesProvider/unsaved-changes-context.d.ts.map +1 -0
  66. package/components/UnsavedChangesProvider/unsaved-changes-context.js +13 -0
  67. package/constants/breakpoint.d.ts +6 -0
  68. package/constants/breakpoint.d.ts.map +1 -1
  69. package/constants/breakpoint.js +2 -2
  70. package/conversation-transfer/conversation-transfer-queue.d.ts +16 -0
  71. package/conversation-transfer/conversation-transfer-queue.d.ts.map +1 -0
  72. package/conversation-transfer/conversation-transfer-queue.js +24 -0
  73. package/file-manager/DialFileManagerShell/DialFileManagerShell.d.ts +9 -0
  74. package/file-manager/DialFileManagerShell/DialFileManagerShell.d.ts.map +1 -1
  75. package/file-manager/DialFileManagerShell/DialFileManagerShell.js +330 -269
  76. package/file-manager/DialFileManagerShell/DialFileManagerShell.module.scss.js +8 -0
  77. package/file-manager/FileManagerAttachModal/FileManagerAttachModal.d.ts +23 -0
  78. package/file-manager/FileManagerAttachModal/FileManagerAttachModal.d.ts.map +1 -1
  79. package/file-manager/FileManagerAttachModal/FileManagerAttachModal.js +86 -80
  80. package/file-manager/FileManagerAttachModal/FileManagerAttachModal.module.scss.js +7 -0
  81. package/file-manager/OperationLoaderModal/OperationLoaderModal.d.ts +5 -0
  82. package/file-manager/OperationLoaderModal/OperationLoaderModal.d.ts.map +1 -1
  83. package/file-manager/OperationLoaderModal/OperationLoaderModal.js +25 -20
  84. package/file-manager/OperationLoaderModal/OperationLoaderModal.module.scss.js +4 -0
  85. package/file-manager/file-manager-controller.d.ts +11 -3
  86. package/file-manager/file-manager-controller.d.ts.map +1 -1
  87. package/file-manager/index.d.ts +1 -0
  88. package/file-manager/index.d.ts.map +1 -1
  89. package/file-manager/labels.d.ts +21 -2
  90. package/file-manager/labels.d.ts.map +1 -1
  91. package/file-manager/shell-styles.d.ts +37 -0
  92. package/file-manager/shell-styles.d.ts.map +1 -0
  93. package/file-manager/upload-batch.d.ts +46 -0
  94. package/file-manager/upload-batch.d.ts.map +1 -1
  95. package/file-manager/upload-batch.js +6 -2
  96. package/file-manager/upload-queue.d.ts +44 -4
  97. package/file-manager/upload-queue.d.ts.map +1 -1
  98. package/file-manager/upload-queue.js +45 -13
  99. package/file-manager.js +4 -4
  100. package/hooks/useAvailableHeightCap.js +1 -1
  101. package/hooks/useControlErrorAssociation.d.ts +3 -0
  102. package/hooks/useControlErrorAssociation.d.ts.map +1 -0
  103. package/hooks/useControlErrorAssociation.js +12 -0
  104. package/hooks/useIsMobile.js +1 -1
  105. package/hooks/useIsPhone.d.ts +3 -0
  106. package/hooks/useIsPhone.d.ts.map +1 -0
  107. package/hooks/useIsPhone.js +13 -0
  108. package/hooks/useIsTablet.d.ts +3 -0
  109. package/hooks/useIsTablet.d.ts.map +1 -0
  110. package/hooks/useIsTablet.js +13 -0
  111. package/hooks/useIsTextClipped.d.ts +26 -0
  112. package/hooks/useIsTextClipped.d.ts.map +1 -0
  113. package/hooks/useIsTextClipped.js +25 -0
  114. package/hooks/useIsVerticallyClamped.d.ts +16 -0
  115. package/hooks/useIsVerticallyClamped.d.ts.map +1 -0
  116. package/hooks/useIsVerticallyClamped.js +20 -0
  117. package/hooks/useTextRefinement.d.ts +1 -1
  118. package/hooks/useTextRefinement.d.ts.map +1 -1
  119. package/hooks/useTextRefinement.js +4 -4
  120. package/hooks/useUnsavedChangesGuard.js +1 -5
  121. package/hooks/useUnsavedChangesLeaveConfirmation.d.ts +12 -0
  122. package/hooks/useUnsavedChangesLeaveConfirmation.d.ts.map +1 -0
  123. package/hooks/useUnsavedChangesLeaveConfirmation.js +22 -0
  124. package/hooks/useUnsavedChangesLeaveGuard.d.ts +24 -0
  125. package/hooks/useUnsavedChangesLeaveGuard.d.ts.map +1 -0
  126. package/hooks/useUnsavedChangesLeaveGuard.js +24 -0
  127. package/index.css +2 -2
  128. package/index.d.ts +15 -0
  129. package/index.d.ts.map +1 -1
  130. package/index.js +93 -78
  131. package/models/auth.d.ts +2 -0
  132. package/models/auth.d.ts.map +1 -1
  133. package/models/chat.d.ts +19 -0
  134. package/models/chat.d.ts.map +1 -1
  135. package/models/conversation-classification.d.ts +5 -0
  136. package/models/conversation-classification.d.ts.map +1 -1
  137. package/models/conversation-classification.js +3 -1
  138. package/models/text-refinement.d.ts +6 -2
  139. package/models/text-refinement.d.ts.map +1 -1
  140. package/package.json +10 -17
  141. package/types/mime-type.d.ts +30 -0
  142. package/types/mime-type.d.ts.map +1 -1
  143. package/types/mime-type.js +1 -1
  144. package/utils/dom.d.ts +8 -0
  145. package/utils/dom.d.ts.map +1 -0
  146. package/utils/dom.js +10 -0
  147. package/utils/format-price.js +10 -10
  148. package/utils/inline-segments.js +1 -1
  149. package/utils/latex.d.ts +4 -3
  150. package/utils/latex.d.ts.map +1 -1
  151. package/utils/latex.js +47 -41
  152. package/utils/message-attachment-to-display.js +1 -1
  153. package/utils/mime-type.js +1 -1
  154. package/utils/prompt-variables.js +5 -9
  155. package/utils/syntax-highlighting.js +8 -8
@@ -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 deliberately left as-is: they 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
@@ -1 +1 @@
1
- {"version":3,"file":"latex.d.ts","sourceRoot":"","sources":["../../src/utils/latex.ts"],"names":[],"mappings":"AA0SA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,MAoEjD,CAAC"}
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 = /\$\$([\s\S]*?)\$\$/g, a = /^[ \t]*\r?\n/, o = /\r?\n[ \t]*$/, s = /\d+(?:,\d{3})*(?:\.\d+)?(?:[KMBkmb])?/y, c = /\s|[^a-zA-Z\d]/y, l = /[\^_\\]/y, u = /(?:[<>]|\\(?: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, d = /\\[a-zA-Z]|[\^_]/, f = (i) => {
2
+ var e = /\$\\ce\{/g, t = /\$\\pu\{/g, n = /\$\\\\ce\{[^}]*\}\$/g, r = /\$\\\\pu\{[^}]*\}\$/g, i = /\]\(|:\/\//, a = {
3
+ "[": "]",
4
+ "(": ")"
5
+ }, o = {
6
+ "[": "&#91;",
7
+ "]": "&#93;",
8
+ "(": "&#40;",
9
+ ")": "&#41;"
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
- }, p = (e) => {
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
- }, m = (e, t) => {
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
- }, h = (e, t, n) => (e.lastIndex = n, e.exec(t)), g = /\s/, _ = (e, t) => {
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 && g.test(e[n]);) n++;
30
+ for (; n < e.length && y.test(e[n]);) n++;
23
31
  return n;
24
- }, v = (e) => {
32
+ }, x = (e) => {
25
33
  if (!e.includes("$$")) return e;
26
- let t = p(e), n = [], r = 0, s;
27
- for (i.lastIndex = 0; (s = i.exec(e)) !== null;) {
28
- let i = s.index, c = i + s[0].length, l = s[1];
29
- if (m(i, t)) continue;
30
- let u = e.lastIndexOf("\n", i - 1) + 1;
31
- if (e.slice(u, i).trim() !== "") continue;
32
- let d = e.indexOf("\n", c), f = e.slice(c, d === -1 ? e.length : d);
33
- if (!l.includes("\n") && (f.trim() !== "" || l.trim() === "")) continue;
34
- let p = l.replace(a, "").replace(o, "");
35
- n.push(e.slice(r, i)), n.push(`$$\n${p}\n$$${f.trim() === "" ? "" : "\n"}`), r = c;
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
- }, y = (e, t) => {
39
- let n = h(s, e, t + 1);
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
- }, b = (e, t) => t >= e.length ? !0 : !(!h(c, e, t) || h(l, e, t) || h(u, e, _(e, t))), x = (e, t) => {
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
- if (i > r) {
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
- }, S = (e, t, n, r) => {
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
- }, C = (e, t, n, r) => n !== void 0 && S(e, t, n, r) && d.test(e.slice(t + 1, n)), w = (e) => {
59
- if (!e.includes("$")) return e;
60
- let t = e;
61
- (e.includes("\\ce{") || e.includes("\\pu{")) && (t = f(e)), t = v(t);
62
- let n = p(t), r = x(t, n), i = /* @__PURE__ */ new Map(), a = -1;
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 = y(t, n);
65
- if (o !== -1 && b(t, o) && (a !== -1 || !C(t, n, r[e + 1], i))) {
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 { w as preprocessLaTeX };
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 (!(!e?.startsWith(n) || !t)) return `data:${e};base64,${t}`;
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/")));
@@ -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
- if (n !== -1) return r[t.slice(n + 1).toLowerCase()];
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
- if (n.type === "text" && n.value != null) {
26
- let e = r(n.value);
27
- t.push(...e ?? [n]);
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 = 5e4, t = 2e3, n = (n) => {
3
- if (n.length > e) return !1;
4
- let r = 0;
5
- for (let e = 0; e < n.length; e++) {
6
- let i = n[e];
7
- if (i === "\n" || i === "\r") r = 0;
8
- else if (++r > t) return !1;
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 { n as isSyntaxHighlightingAllowed };
13
+ export { e as isSyntaxHighlightingAllowed };