@pstdio/ui 0.4.0 → 0.5.0

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 (111) hide show
  1. package/dist/MermaidComponent-DwEDwpo2.js +124 -0
  2. package/dist/MermaidComponent-DwEDwpo2.js.map +1 -0
  3. package/dist/chat-ui.js +609 -505
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/chat-ui/components/chat-input-actions.d.ts +10 -0
  6. package/dist/components/chat-ui/components/chat-panel.d.ts +1 -0
  7. package/dist/components/chat-ui/tool-rendering/apply-patch-renderer.d.ts +2 -0
  8. package/dist/components/chat-ui/tool-rendering/default-renderers.d.ts +8 -7
  9. package/dist/components/chat-ui/tool-rendering/edit-renderer.d.ts +2 -0
  10. package/dist/components/chat-ui/tool-rendering/shared.d.ts +52 -0
  11. package/dist/components/chat-ui/tool-rendering/standard-renderers.d.ts +6 -0
  12. package/dist/components/chat-ui/tool-rendering/todo-write-renderer.d.ts +2 -0
  13. package/dist/components/menu-item.d.ts +2 -1
  14. package/dist/components/resource-context-menu.d.ts +20 -0
  15. package/dist/components/rich-text/prompt-input/plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode.d.ts +2 -1
  16. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockActionsPlugin.d.ts +4 -0
  17. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockPlugin.d.ts +2 -0
  18. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeHighlightingPlugin.d.ts +1 -0
  19. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/should-show-floating-toolbar.d.ts +11 -0
  20. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidComponent.d.ts +6 -0
  21. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidNode.d.ts +23 -0
  22. package/dist/components/rich-text/shared/plugins/MermaidPlugin/index.d.ts +1 -0
  23. package/dist/components/rich-text/utils/markdown.d.ts +1 -0
  24. package/dist/components/session-indicator.d.ts +1 -1
  25. package/dist/components/sidebar-tree/sidebar-tree.types.d.ts +5 -1
  26. package/dist/components/tickets/tag-badge.d.ts +10 -0
  27. package/dist/components/tickets/tag-option-icon.d.ts +2 -0
  28. package/dist/components/tickets/ticket-board.d.ts +2 -0
  29. package/dist/components/tickets/ticket-card.d.ts +10 -0
  30. package/dist/components/tickets/ticket-grouping.d.ts +2 -2
  31. package/dist/components/tickets/ticket-list.d.ts +6 -1
  32. package/dist/components/tickets/tickets-workspace.d.ts +9 -3
  33. package/dist/components/tickets/types.d.ts +22 -5
  34. package/dist/components/tickets/workspace-helpers.d.ts +13 -0
  35. package/dist/get-file-type-icon-Bwqf1WXA.js +101 -0
  36. package/dist/get-file-type-icon-Bwqf1WXA.js.map +1 -0
  37. package/dist/index.d.ts +4 -2
  38. package/dist/index.js +1876 -1642
  39. package/dist/index.js.map +1 -1
  40. package/dist/rich-message-BVRk9BSD.js +1503 -0
  41. package/dist/rich-message-BVRk9BSD.js.map +1 -0
  42. package/dist/rich-text.js +414 -255
  43. package/dist/rich-text.js.map +1 -1
  44. package/dist/style.css +1 -1
  45. package/package.json +3 -1
  46. package/dist/components/attached-panel.utils.test.d.ts +0 -1
  47. package/dist/components/breadcrumb.stories.d.ts +0 -25
  48. package/dist/components/button.stories.d.ts +0 -18
  49. package/dist/components/chat-ui/components/ai-conversation.stories.d.ts +0 -6
  50. package/dist/components/chat-ui/components/ai-message.stories.d.ts +0 -6
  51. package/dist/components/chat-ui/components/ai-response.stories.d.ts +0 -7
  52. package/dist/components/chat-ui/components/attachment-list.stories.d.ts +0 -6
  53. package/dist/components/chat-ui/components/chat-input.stories.d.ts +0 -7
  54. package/dist/components/chat-ui/components/chat-panel-alerts.stories.d.ts +0 -9
  55. package/dist/components/chat-ui/components/chat-panel.stories.d.ts +0 -10
  56. package/dist/components/chat-ui/components/message-parts-renderer.stories.d.ts +0 -9
  57. package/dist/components/chat-ui/components/model-swap-separator.stories.d.ts +0 -6
  58. package/dist/components/chat-ui/components/tool-invocation-timeline.stories.d.ts +0 -6
  59. package/dist/components/chat-ui/components/workspace-hub.stories.d.ts +0 -6
  60. package/dist/components/checkbox.stories.d.ts +0 -15
  61. package/dist/components/column-file-browser.stories.d.ts +0 -15
  62. package/dist/components/data-table/data-table.stories.d.ts +0 -33
  63. package/dist/components/delete-confirmation-modal.stories.d.ts +0 -11
  64. package/dist/components/diff-bubble.stories.d.ts +0 -13
  65. package/dist/components/diff-drawer.stories.d.ts +0 -8
  66. package/dist/components/diff-view-adapter.test.d.ts +0 -1
  67. package/dist/components/drawer-inline.stories.d.ts +0 -8
  68. package/dist/components/empty-state.stories.d.ts +0 -34
  69. package/dist/components/file-selector.stories.d.ts +0 -17
  70. package/dist/components/folder-picker-dialog.stories.d.ts +0 -11
  71. package/dist/components/info-card.stories.d.ts +0 -41
  72. package/dist/components/item-section.stories.d.ts +0 -17
  73. package/dist/components/layout.stories.d.ts +0 -11
  74. package/dist/components/menu-item.stories.d.ts +0 -72
  75. package/dist/components/open-source-notices-screen.stories.d.ts +0 -12
  76. package/dist/components/param-editor-horizontal.stories.d.ts +0 -19
  77. package/dist/components/param-editor.stories.d.ts +0 -24
  78. package/dist/components/properties.stories.d.ts +0 -17
  79. package/dist/components/resource-badge.stories.d.ts +0 -7
  80. package/dist/components/rich-text/collaborative-markdown-editor/collaborative-markdown-editor.stories.d.ts +0 -9
  81. package/dist/components/rich-text/markdown-editor/markdown-editor.stories.d.ts +0 -7
  82. package/dist/components/rich-text/prompt-input/prompt-input.stories.d.ts +0 -8
  83. package/dist/components/rich-text/rich-message/rich-message.stories.d.ts +0 -6
  84. package/dist/components/rich-text/shared/nodes/DataTableNode.stories.d.ts +0 -7
  85. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.d.ts +0 -21
  86. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.test.d.ts +0 -1
  87. package/dist/components/rich-text/shared/transformers/markdown-transformers.test.d.ts +0 -1
  88. package/dist/components/scroll-area.stories.d.ts +0 -7
  89. package/dist/components/searchable-menu.stories.d.ts +0 -8
  90. package/dist/components/session-indicator.stories.d.ts +0 -12
  91. package/dist/components/sidebar/sidebar.store.test.d.ts +0 -1
  92. package/dist/components/sidebar/sidebar.stories.d.ts +0 -11
  93. package/dist/components/sidebar-tree/sidebar-tree-searchable-action-menu.stories.d.ts +0 -6
  94. package/dist/components/sidebar-tree/sidebar-tree.stories.d.ts +0 -13
  95. package/dist/components/slider.stories.d.ts +0 -15
  96. package/dist/components/style-guide.stories.d.ts +0 -23
  97. package/dist/components/switch.stories.d.ts +0 -16
  98. package/dist/components/tickets/display-menu.stories.d.ts +0 -6
  99. package/dist/components/tickets/filter-menu.stories.d.ts +0 -6
  100. package/dist/components/tickets/ticket-board.stories.d.ts +0 -5
  101. package/dist/components/tickets/ticket-card.stories.d.ts +0 -18
  102. package/dist/components/tickets/ticket-grouping.test.d.ts +0 -1
  103. package/dist/components/tickets/ticket-list.stories.d.ts +0 -10
  104. package/dist/components/tickets/tickets-workspace.stories.d.ts +0 -10
  105. package/dist/components/tickets/use-workspace-store.test.d.ts +0 -1
  106. package/dist/components/toaster.stories.d.ts +0 -11
  107. package/dist/components/workspace-badge.stories.d.ts +0 -13
  108. package/dist/get-file-type-icon-CirIyuE8.js +0 -92
  109. package/dist/get-file-type-icon-CirIyuE8.js.map +0 -1
  110. package/dist/rich-message-Bad4GxH2.js +0 -1423
  111. package/dist/rich-message-Bad4GxH2.js.map +0 -1
@@ -0,0 +1,1503 @@
1
+ import { CodeNode as ue, CodeHighlightNode as Oe, registerCodeHighlighting as ut } from "@lexical/code";
2
+ import { AutoLinkNode as me, $createAutoLinkNode as mt, $isAutoLinkNode as ft, LinkNode as ke } from "@lexical/link";
3
+ import { ListNode as $e, ListItemNode as ve } from "@lexical/list";
4
+ import { CHECK_LIST as ht, TRANSFORMERS as we, $convertFromMarkdownString as Le, $convertToMarkdownString as pt } from "@lexical/markdown";
5
+ import { QuoteNode as Pe, HeadingNode as Me } from "@lexical/rich-text";
6
+ import { jsx as l, jsxs as F, Fragment as Ee } from "react/jsx-runtime";
7
+ import { chakra as le, Box as w, Text as L, Spacer as _t, IconButton as gt, Table as W, Textarea as Et, Tooltip as ee, Flex as fe, Kbd as xt } from "@chakra-ui/react";
8
+ import { DecoratorNode as Y, $applyNodeReplacement as bt, ElementNode as Ae, TextNode as te, $createTextNode as he, $nodesOfType as St, createCommand as I, isHTMLElement as yt, $createParagraphNode as ce, COMMAND_PRIORITY_LOW as De, $getSelection as Tt, $isRangeSelection as Rt, $isElementNode as Nt, KEY_DOWN_COMMAND as Ct, COMMAND_PRIORITY_HIGH as It, $getRoot as Fe } from "lexical";
9
+ import { c as C } from "react/compiler-runtime";
10
+ import { MarkNode as Ot } from "@lexical/mark";
11
+ import { LexicalComposer as He } from "@lexical/react/LexicalComposer";
12
+ import { LexicalErrorBoundary as qe } from "@lexical/react/LexicalErrorBoundary";
13
+ import { HistoryPlugin as kt } from "@lexical/react/LexicalHistoryPlugin";
14
+ import { OnChangePlugin as Be } from "@lexical/react/LexicalOnChangePlugin";
15
+ import { RichTextPlugin as We } from "@lexical/react/LexicalRichTextPlugin";
16
+ import * as $t from "react";
17
+ import { Suspense as Ue, lazy as vt, useEffect as q, useImperativeHandle as wt, useState as Lt, forwardRef as Pt, useRef as Mt } from "react";
18
+ import { useLexicalComposerContext as H } from "@lexical/react/LexicalComposerContext";
19
+ import { $setBlocksType as At } from "@lexical/selection";
20
+ import { addClassNamesToElement as ze, mergeRegister as pe } from "@lexical/utils";
21
+ import { LexicalTypeaheadMenuPlugin as Dt } from "@lexical/react/LexicalTypeaheadMenuPlugin";
22
+ import * as Ft from "react-dom";
23
+ import { ClickableLinkPlugin as Ht } from "@lexical/react/LexicalClickableLinkPlugin";
24
+ import { HorizontalRulePlugin as qt } from "@lexical/react/LexicalHorizontalRulePlugin";
25
+ import { LinkPlugin as Bt } from "@lexical/react/LexicalLinkPlugin";
26
+ import { ListPlugin as Wt } from "@lexical/react/LexicalListPlugin";
27
+ import { TabIndentationPlugin as Ut } from "@lexical/react/LexicalTabIndentationPlugin";
28
+ import { ContentEditable as zt } from "@lexical/react/LexicalContentEditable";
29
+ import { S as Jt, g as jt, T as Kt } from "./get-file-type-icon-Bwqf1WXA.js";
30
+ import Vt from "katex";
31
+ import { TreeView as Xt } from "@lexical/react/LexicalTreeView";
32
+ import { X as Gt } from "lucide-react";
33
+ const Yt = le(zt);
34
+ function Je(n) {
35
+ const e = C(11), {
36
+ onRef: t,
37
+ fullWidth: r,
38
+ padding: o,
39
+ isRichMessage: i,
40
+ scrollable: s
41
+ } = n, c = r === void 0 ? !1 : r, a = i === void 0 ? !1 : i, p = s === void 0 ? !0 : s, u = c ? "100%" : "720px", m = c ? "0" : "auto";
42
+ let h;
43
+ e[0] !== u || e[1] !== m ? (h = /* @__PURE__ */ l(Yt, { "data-testid": "content-editable", height: "fit-content", minH: "100%", width: "100%", maxWidth: u, marginInline: m, textStyle: "paragraph/M/regular", fontSize: "calc(var(--chakra-font-sizes-md) * var(--rich-text-font-scale))", position: "relative", outline: "none" }), e[0] = u, e[1] = m, e[2] = h) : h = e[2];
44
+ let d;
45
+ e[3] !== t || e[4] !== o || e[5] !== h ? (d = /* @__PURE__ */ l(w, { ref: t, width: "100%", minH: "100%", padding: o, children: h }), e[3] = t, e[4] = o, e[5] = h, e[6] = d) : d = e[6];
46
+ const f = d;
47
+ if (!p)
48
+ return f;
49
+ const g = a ? "true" : void 0;
50
+ let _;
51
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = {
52
+ width: "100%",
53
+ minH: "100%"
54
+ }, e[7] = _) : _ = e[7];
55
+ let E;
56
+ return e[8] !== f || e[9] !== g ? (E = /* @__PURE__ */ l(Jt, { className: "rich-text", "data-rich-message": g, height: "100%", minH: "0", position: "relative", contentProps: _, children: f }), e[8] = f, e[9] = g, e[10] = E) : E = e[10], E;
57
+ }
58
+ const Qt = {
59
+ sm: {
60
+ container: {
61
+ height: "20px",
62
+ lineHeight: {
63
+ base: "20px"
64
+ },
65
+ px: "2xs"
66
+ },
67
+ iconSize: 12,
68
+ textStyle: "xs"
69
+ },
70
+ md: {
71
+ container: {
72
+ height: "24px",
73
+ lineHeight: {
74
+ base: "24px"
75
+ },
76
+ px: "xs"
77
+ },
78
+ iconSize: 14,
79
+ textStyle: "sm"
80
+ }
81
+ }, Zt = {
82
+ neutral: {
83
+ color: "color.primary",
84
+ bg: "bg.muted",
85
+ _hover: {
86
+ bg: "bg.emphasized"
87
+ }
88
+ },
89
+ accent: {
90
+ color: "var(--schub-foreground-accent)",
91
+ bg: "var(--schub-accent-subtle)",
92
+ _hover: {
93
+ bg: "var(--schub-accent-subtle)"
94
+ }
95
+ }
96
+ }, en = "md", tn = "neutral", je = (n) => {
97
+ const e = C(39);
98
+ let t, r, o, i, s, c, a;
99
+ e[0] !== n ? ({
100
+ fileName: t,
101
+ onSelect: i,
102
+ onRemove: o,
103
+ size: c,
104
+ tone: a,
105
+ icon: r,
106
+ ...s
107
+ } = n, e[0] = n, e[1] = t, e[2] = r, e[3] = o, e[4] = i, e[5] = s, e[6] = c, e[7] = a) : (t = e[1], r = e[2], o = e[3], i = e[4], s = e[5], c = e[6], a = e[7]);
108
+ const p = c === void 0 ? en : c, u = a === void 0 ? tn : a;
109
+ let m;
110
+ e[8] !== t ? (m = jt(t), e[8] = t, e[9] = m) : m = e[9];
111
+ const h = m, d = Qt[p], f = Zt[u], g = i ? "pointer" : "default";
112
+ let _;
113
+ e[10] !== t || e[11] !== i ? (_ = (O) => {
114
+ O.stopPropagation(), i?.(t);
115
+ }, e[10] = t, e[11] = i, e[12] = _) : _ = e[12];
116
+ let E;
117
+ e[13] !== h || e[14] !== r || e[15] !== d.iconSize ? (E = r ?? /* @__PURE__ */ l(h, { size: d.iconSize }), e[13] = h, e[14] = r, e[15] = d.iconSize, e[16] = E) : E = e[16];
118
+ let T;
119
+ e[17] !== E ? (T = /* @__PURE__ */ l(le.span, { mr: "xs", display: "inline-flex", children: E }), e[17] = E, e[18] = T) : T = e[18];
120
+ let y;
121
+ e[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = {
122
+ base: "14rem"
123
+ }, e[19] = y) : y = e[19];
124
+ let R;
125
+ e[20] !== t || e[21] !== d.textStyle ? (R = /* @__PURE__ */ l(L, { maxW: y, textOverflow: "ellipsis", whiteSpace: "nowrap", overflow: "hidden", textStyle: d.textStyle, children: t }), e[20] = t, e[21] = d.textStyle, e[22] = R) : R = e[22];
126
+ let b;
127
+ e[23] !== t || e[24] !== R ? (b = /* @__PURE__ */ l(Kt, { content: t, children: R }), e[23] = t, e[24] = R, e[25] = b) : b = e[25];
128
+ let N;
129
+ e[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ l(_t, {}), e[26] = N) : N = e[26];
130
+ let S;
131
+ e[27] !== t || e[28] !== o ? (S = o && /* @__PURE__ */ l(gt, { "aria-label": "Remove reference", size: "2xs", ml: "xs", variant: "ghost", _hover: {
132
+ bg: "transparent"
133
+ }, onClick: (O) => {
134
+ O.stopPropagation(), o?.(t);
135
+ }, children: /* @__PURE__ */ l(Gt, { size: 12 }) }), e[27] = t, e[28] = o, e[29] = S) : S = e[29];
136
+ let x;
137
+ return e[30] !== s || e[31] !== d.container || e[32] !== S || e[33] !== g || e[34] !== _ || e[35] !== T || e[36] !== b || e[37] !== f ? (x = /* @__PURE__ */ F(le.span, { display: "flex", flexDirection: "row", alignItems: "center", borderRadius: "xs", gap: "2xs", cursor: g, ...f, ...d.container, onClick: _, ...s, children: [
138
+ T,
139
+ b,
140
+ N,
141
+ S
142
+ ] }), e[30] = s, e[31] = d.container, e[32] = S, e[33] = g, e[34] = _, e[35] = T, e[36] = b, e[37] = f, e[38] = x) : x = e[38], x;
143
+ };
144
+ let re = class ae extends Y {
145
+ __href;
146
+ __label;
147
+ static getType() {
148
+ return "reference-link";
149
+ }
150
+ static clone(e) {
151
+ return new ae(e.__href, e.__label, e.__key);
152
+ }
153
+ constructor(e, t, r) {
154
+ super(r), this.__href = e, this.__label = t;
155
+ }
156
+ createDOM(e, t) {
157
+ return document.createElement("span");
158
+ }
159
+ updateDOM(e, t, r) {
160
+ return !1;
161
+ }
162
+ getTextContent() {
163
+ return `{{link('${this.__label ?? this.__href}')}}`;
164
+ }
165
+ exportJSON() {
166
+ return {
167
+ type: ae.getType(),
168
+ version: 1,
169
+ href: this.__href,
170
+ label: this.__label
171
+ };
172
+ }
173
+ static importJSON(e) {
174
+ return Ke(e.href, e.label);
175
+ }
176
+ decorate(e, t) {
177
+ const r = this.__href, i = r.split("/").pop() || "unknown", s = /^https?:\/\//i.test(r), c = /^#?\$PROJECT\//i.test(r);
178
+ return /* @__PURE__ */ l(w, { width: "fit-content", display: "inline-block", children: /* @__PURE__ */ l(je, { fileName: i, onSelect: () => {
179
+ if (s)
180
+ window.open(r, "_blank", "noopener,noreferrer");
181
+ else if (c) {
182
+ const a = r.replace(/^#?\$PROJECT\//i, ""), p = new CustomEvent("ui:open-project-file", {
183
+ detail: a
184
+ });
185
+ window.dispatchEvent(p);
186
+ } else
187
+ window.location.assign(r);
188
+ } }) });
189
+ }
190
+ };
191
+ function Ke(n, e) {
192
+ return new re(n, e);
193
+ }
194
+ function nn(n) {
195
+ return n instanceof re;
196
+ }
197
+ const xe = /\{\{\s*link\((['"])([^'"\s]+)\1\)\s*\}\}/, rn = {
198
+ dependencies: [re],
199
+ export: (n) => {
200
+ if (nn(n)) {
201
+ const e = n.__href, t = n.__label ?? e;
202
+ return t ? `{{link('${t}')}}` : `{{link('${e}')}}`;
203
+ }
204
+ return null;
205
+ },
206
+ regExp: xe,
207
+ importRegExp: xe,
208
+ replace: (n, e) => {
209
+ const t = e[2], o = /^(https?:\/\/|\/)/i.test(t) ? t : `#${t}`, i = t;
210
+ n.replace(Ke(o, i));
211
+ },
212
+ type: "text-match"
213
+ }, _e = {
214
+ code: "rich-text__code",
215
+ codeHighlight: {
216
+ atrule: "rich-text__tokenAttr",
217
+ attr: "rich-text__tokenAttr",
218
+ boolean: "rich-text__tokenProperty",
219
+ builtin: "rich-text__tokenSelector",
220
+ cdata: "rich-text__tokenComment",
221
+ char: "rich-text__tokenSelector",
222
+ class: "rich-text__tokenFunction",
223
+ "class-name": "rich-text__tokenFunction",
224
+ comment: "rich-text__tokenComment",
225
+ constant: "rich-text__tokenProperty",
226
+ deleted: "rich-text__tokenProperty",
227
+ doctype: "rich-text__tokenComment",
228
+ entity: "rich-text__tokenOperator",
229
+ function: "rich-text__tokenFunction",
230
+ important: "rich-text__tokenVariable",
231
+ inserted: "rich-text__tokenSelector",
232
+ keyword: "rich-text__tokenAttr",
233
+ namespace: "rich-text__tokenVariable",
234
+ number: "rich-text__tokenProperty",
235
+ operator: "rich-text__tokenOperator",
236
+ prolog: "rich-text__tokenComment",
237
+ property: "rich-text__tokenProperty",
238
+ punctuation: "rich-text__tokenPunctuation",
239
+ regex: "rich-text__tokenVariable",
240
+ selector: "rich-text__tokenSelector",
241
+ string: "rich-text__tokenSelector",
242
+ symbol: "rich-text__tokenProperty",
243
+ tag: "rich-text__tokenProperty",
244
+ url: "rich-text__tokenOperator",
245
+ variable: "rich-text__tokenVariable"
246
+ },
247
+ embedBlock: {
248
+ base: "rich-text__embedBlock",
249
+ focus: "rich-text__embedBlockFocus"
250
+ },
251
+ list: {
252
+ checklist: "rich-text__checklist",
253
+ listitem: "rich-text__listItem",
254
+ listitemChecked: "rich-text__listItemChecked",
255
+ listitemUnchecked: "rich-text__listItemUnchecked",
256
+ nested: {
257
+ listitem: "rich-text__nestedListItem"
258
+ },
259
+ olDepth: ["rich-text__ol1", "rich-text__ol2", "rich-text__ol3", "rich-text__ol4", "rich-text__ol5"],
260
+ ol: "rich-text__ol",
261
+ ul: "rich-text__ul"
262
+ },
263
+ heading: {
264
+ h1: "rich-text__h1",
265
+ h2: "rich-text__h2",
266
+ h3: "rich-text__h3"
267
+ },
268
+ paragraph: "rich-text__p",
269
+ text: {
270
+ underline: "rich-text__textUnderline",
271
+ italic: "rich-text__textItalic",
272
+ code: "rich-text__textCode"
273
+ },
274
+ link: "rich-text__link",
275
+ quote: "rich-text__quote",
276
+ reference: "rich-text__reference",
277
+ table: "rich-text__table",
278
+ tableCell: "rich-text__tableCell",
279
+ tableRow: "rich-text__tableRow",
280
+ tableCellHeader: "rich-text__tableCellHeader",
281
+ layoutContainer: "rich-text__layoutContainer",
282
+ layoutItem: "rich-text__layoutItem",
283
+ draggableBlockDemo: {
284
+ row: "rich-text__row",
285
+ content: "rich-text__content"
286
+ }
287
+ }, X = "calc(var(--chakra-font-sizes-sm) * var(--rich-text-font-scale))", on = (n) => n == null ? "-" : typeof n == "string" ? n.length ? n : "-" : typeof n == "number" || typeof n == "boolean" ? String(n).toUpperCase() : n instanceof Date ? n.toISOString() : JSON.stringify(n), lo = (n) => {
288
+ const e = C(6), {
289
+ defaultCode: t,
290
+ isEditable: r,
291
+ showLineNumbers: o,
292
+ disableScroll: i
293
+ } = n, s = t === void 0 ? "" : t, c = r === void 0 ? !1 : r, a = o === void 0 ? !1 : o, p = i === void 0 ? !1 : i;
294
+ if (c) {
295
+ let m;
296
+ return e[0] !== s ? (m = /* @__PURE__ */ l(Et, { defaultValue: s, fontFamily: "mono", fontSize: X, resize: "vertical", minHeight: "100%" }), e[0] = s, e[1] = m) : m = e[1], m;
297
+ }
298
+ let u;
299
+ if (e[2] !== s || e[3] !== p || e[4] !== a) {
300
+ const m = a ? s.split(`
301
+ `) : [s];
302
+ u = /* @__PURE__ */ l(w, { as: "pre", margin: 0, padding: "sm", fontFamily: "mono", fontSize: X, lineHeight: "1.5", overflowY: p ? "hidden" : "auto", background: "bg.muted", borderRadius: "md", width: "100%", children: a ? /* @__PURE__ */ l(w, { as: "code", display: "grid", gridTemplateColumns: "auto 1fr", columnGap: "sm", children: m.map(ln) }) : /* @__PURE__ */ l(w, { as: "code", children: s }) }), e[2] = s, e[3] = p, e[4] = a, e[5] = u;
303
+ } else
304
+ u = e[5];
305
+ return u;
306
+ }, sn = (n) => {
307
+ const e = C(26), {
308
+ data: t,
309
+ fullWidth: r,
310
+ noBorder: o,
311
+ hiddenColumns: i
312
+ } = n, s = r === void 0 ? !1 : r, c = o === void 0 ? !1 : o;
313
+ let a;
314
+ e[0] !== i ? (a = i === void 0 ? [] : i, e[0] = i, e[1] = a) : a = e[1];
315
+ const p = a;
316
+ if (!t.length) {
317
+ const b = c ? "0" : "1px";
318
+ let N;
319
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ l(L, { textStyle: "label/S/regular", fontSize: X, color: "fg.muted", children: "No data" }), e[2] = N) : N = e[2];
320
+ let S;
321
+ return e[3] !== b ? (S = /* @__PURE__ */ l(w, { padding: "sm", borderWidth: b, borderColor: "border.muted", children: N }), e[3] = b, e[4] = S) : S = e[4], S;
322
+ }
323
+ let u;
324
+ e[5] !== p ? (u = new Set(p), e[5] = p, e[6] = u) : u = e[6];
325
+ const m = u;
326
+ let h;
327
+ e[7] !== t[0] ? (h = Object.keys(t[0] ?? {}), e[7] = t[0], e[8] = h) : h = e[8];
328
+ let d;
329
+ e[9] !== m || e[10] !== h ? (d = h.filter((b) => !m.has(b)), e[9] = m, e[10] = h, e[11] = d) : d = e[11];
330
+ const f = d, g = s ? "100%" : "fit-content", _ = c ? "0" : "1px";
331
+ let E;
332
+ e[12] !== f ? (E = /* @__PURE__ */ l(W.Header, { children: /* @__PURE__ */ l(W.Row, { background: "bg.muted", children: f.map(cn) }) }), e[12] = f, e[13] = E) : E = e[13];
333
+ let T;
334
+ if (e[14] !== f || e[15] !== t) {
335
+ let b;
336
+ e[17] !== f ? (b = (N, S) => /* @__PURE__ */ l(W.Row, { children: f.map((x) => /* @__PURE__ */ l(W.Cell, { paddingX: "xs", paddingY: "2xs", children: /* @__PURE__ */ l(L, { textStyle: "paragraph/S/regular", fontSize: X, children: on(N[x]) }) }, `${S}-${x}`)) }, `${S}-${f.join("-")}`), e[17] = f, e[18] = b) : b = e[18], T = t.map(b), e[14] = f, e[15] = t, e[16] = T;
337
+ } else
338
+ T = e[16];
339
+ let y;
340
+ e[19] !== T ? (y = /* @__PURE__ */ l(W.Body, { children: T }), e[19] = T, e[20] = y) : y = e[20];
341
+ let R;
342
+ return e[21] !== y || e[22] !== g || e[23] !== _ || e[24] !== E ? (R = /* @__PURE__ */ l(W.ScrollArea, { overflowX: "auto", maxWidth: "100%", children: /* @__PURE__ */ F(W.Root, { size: "sm", width: g, borderWidth: _, borderColor: "border.muted", children: [
343
+ E,
344
+ y
345
+ ] }) }), e[21] = y, e[22] = g, e[23] = _, e[24] = E, e[25] = R) : R = e[25], R;
346
+ };
347
+ function ln(n, e) {
348
+ return /* @__PURE__ */ F(w, { as: "span", display: "contents", children: [
349
+ /* @__PURE__ */ l(L, { as: "span", color: "fg.muted", textAlign: "right", fontSize: "inherit", children: e + 1 }),
350
+ /* @__PURE__ */ l(L, { as: "span", fontSize: "inherit", children: n.length ? n : " " })
351
+ ] }, `${e}-${n}`);
352
+ }
353
+ function cn(n) {
354
+ return /* @__PURE__ */ l(W.ColumnHeader, { textTransform: "none", paddingX: "xs", paddingY: "2xs", children: /* @__PURE__ */ l(L, { textStyle: "label/S/medium", fontSize: X, children: n }) }, n);
355
+ }
356
+ class z extends Y {
357
+ __data;
358
+ static getType() {
359
+ return "data_table";
360
+ }
361
+ static clone(e) {
362
+ return new z(e.__data, e.__key);
363
+ }
364
+ constructor(e, t) {
365
+ super(t), this.__data = e;
366
+ }
367
+ getData() {
368
+ return this.__data;
369
+ }
370
+ createDOM() {
371
+ return document.createElement("div");
372
+ }
373
+ updateDOM() {
374
+ return !1;
375
+ }
376
+ decorate() {
377
+ return /* @__PURE__ */ l(sn, { fullWidth: !0, isReadOnly: !0, data: this.__data });
378
+ }
379
+ exportJSON() {
380
+ return {
381
+ type: "data_table",
382
+ version: 1,
383
+ data: this.__data
384
+ };
385
+ }
386
+ static importJSON(e) {
387
+ return new z(e.data);
388
+ }
389
+ getTextContent() {
390
+ if (!this.__data.length) return "";
391
+ const e = Object.keys(this.__data[0]), t = e.join(" | "), r = e.map(() => "---").join(" | "), o = this.__data.map((i) => e.map((s) => String(i[s] || "")).join(" | "));
392
+ return [t, r, ...o].join(`
393
+ `);
394
+ }
395
+ }
396
+ function be(n) {
397
+ return new z(n);
398
+ }
399
+ function Se(n) {
400
+ return n instanceof z;
401
+ }
402
+ const an = $t.lazy(() => import("./EquationComponent-DeDYHvqY.js"));
403
+ function ye(n) {
404
+ let e = n.getAttribute("data-lexical-equation");
405
+ const t = n.getAttribute("data-lexical-inline") === "true";
406
+ return e = atob(e || ""), e ? {
407
+ node: oe(e, t)
408
+ } : null;
409
+ }
410
+ class U extends Y {
411
+ __equation;
412
+ __inline;
413
+ static getType() {
414
+ return "equation";
415
+ }
416
+ static clone(e) {
417
+ return new U(e.__equation, e.__inline, e.__key);
418
+ }
419
+ constructor(e, t, r) {
420
+ super(r), this.__equation = e, this.__inline = t ?? !1;
421
+ }
422
+ static importJSON(e) {
423
+ return oe(e.equation, e.inline);
424
+ }
425
+ exportJSON() {
426
+ return {
427
+ equation: this.getEquation(),
428
+ inline: this.__inline,
429
+ type: "equation",
430
+ version: 1
431
+ };
432
+ }
433
+ createDOM(e) {
434
+ const t = document.createElement(this.__inline ? "span" : "div");
435
+ return t.className = "editor-equation", t;
436
+ }
437
+ exportDOM() {
438
+ const e = document.createElement(this.__inline ? "span" : "div"), t = btoa(this.__equation);
439
+ return e.setAttribute("data-lexical-equation", t), e.setAttribute("data-lexical-inline", `${this.__inline}`), Vt.render(this.__equation, e, {
440
+ displayMode: !this.__inline,
441
+ // true === block display //
442
+ errorColor: "#cc0000",
443
+ output: "html",
444
+ strict: "warn",
445
+ throwOnError: !1,
446
+ trust: !1
447
+ }), {
448
+ element: e
449
+ };
450
+ }
451
+ static importDOM() {
452
+ return {
453
+ div: (e) => e.hasAttribute("data-lexical-equation") ? {
454
+ conversion: ye,
455
+ priority: 2
456
+ } : null,
457
+ span: (e) => e.hasAttribute("data-lexical-equation") ? {
458
+ conversion: ye,
459
+ priority: 1
460
+ } : null
461
+ };
462
+ }
463
+ updateDOM(e) {
464
+ return this.__inline !== e.__inline;
465
+ }
466
+ getTextContent() {
467
+ return this.__equation;
468
+ }
469
+ getEquation() {
470
+ return this.__equation;
471
+ }
472
+ setEquation(e) {
473
+ const t = this.getWritable();
474
+ t.__equation = e;
475
+ }
476
+ isInline() {
477
+ return this.__inline;
478
+ }
479
+ decorate() {
480
+ return /* @__PURE__ */ l(Ue, { fallback: null, children: /* @__PURE__ */ l(an, { equation: this.__equation, inline: this.__inline }) });
481
+ }
482
+ }
483
+ function oe(n = "", e = !1) {
484
+ const t = new U(n, e);
485
+ return bt(t);
486
+ }
487
+ function Ve(n) {
488
+ return n instanceof U;
489
+ }
490
+ const Xe = {
491
+ dependencies: [U],
492
+ export: (n) => Ve(n) && n.isInline() ? `\\( ${n.getEquation().trim()} \\)` : null,
493
+ importRegExp: /\\\((.*?)\\\)/,
494
+ regExp: /\\\((.*?)\\\)/,
495
+ replace: (n, e) => {
496
+ const t = oe(e[1].trim(), !0);
497
+ n.replace(t);
498
+ },
499
+ type: "text-match"
500
+ }, Ge = {
501
+ dependencies: [U],
502
+ regExpStart: /\\\[/,
503
+ regExpEnd: /\\]/,
504
+ export: (n) => Ve(n) && !n.isInline() ? `\\[ ${n.getEquation().trim()} \\]` : null,
505
+ replace: (n, e, t, r, o) => o ? (n.append(oe(o.join(" "), !1)), !0) : !1,
506
+ type: "multiline-element"
507
+ };
508
+ function dn() {
509
+ return null;
510
+ }
511
+ class K extends Ae {
512
+ static getType() {
513
+ return "hr";
514
+ }
515
+ static clone(e) {
516
+ return new K(e?.__key);
517
+ }
518
+ static importJSON(e) {
519
+ return Ye();
520
+ }
521
+ exportJSON() {
522
+ return {
523
+ ...super.exportJSON()
524
+ };
525
+ }
526
+ createDOM(e, t) {
527
+ const r = document.createElement("hr");
528
+ return r.style = "margin: 2rem 0;", r;
529
+ }
530
+ updateDOM(e, t, r) {
531
+ return !1;
532
+ }
533
+ decorate(e) {
534
+ return null;
535
+ }
536
+ }
537
+ function Ye() {
538
+ return new K();
539
+ }
540
+ function un(n) {
541
+ return n instanceof K;
542
+ }
543
+ const mn = vt(() => import("./MermaidComponent-DwEDwpo2.js"));
544
+ class J extends Y {
545
+ __code;
546
+ static getType() {
547
+ return "mermaid";
548
+ }
549
+ static clone(e) {
550
+ return new J(e.__code, e.__key);
551
+ }
552
+ constructor(e, t) {
553
+ super(t), this.__code = e;
554
+ }
555
+ createDOM() {
556
+ return document.createElement("div");
557
+ }
558
+ updateDOM() {
559
+ return !1;
560
+ }
561
+ static importJSON(e) {
562
+ return new J(e.code);
563
+ }
564
+ exportJSON() {
565
+ return {
566
+ type: "mermaid",
567
+ code: this.__code,
568
+ version: 1
569
+ };
570
+ }
571
+ getTextContent() {
572
+ return `\`\`\`mermaid
573
+ ${this.__code}
574
+ \`\`\``;
575
+ }
576
+ getCode() {
577
+ return this.__code;
578
+ }
579
+ setCode(e) {
580
+ const t = this.getWritable();
581
+ t.__code = e;
582
+ }
583
+ decorate() {
584
+ return /* @__PURE__ */ l(Ue, { fallback: null, children: /* @__PURE__ */ l(mn, { code: this.__code, nodeKey: this.__key }) });
585
+ }
586
+ }
587
+ function co(n) {
588
+ return n instanceof J;
589
+ }
590
+ const fn = {
591
+ dependencies: [K],
592
+ export: (n) => un(n) ? "***" : null,
593
+ regExp: /^(---|\*\*\*|___)\s?$/,
594
+ replace: (n) => {
595
+ const e = Ye();
596
+ n.replace(e);
597
+ },
598
+ type: "element"
599
+ }, hn = {
600
+ dependencies: [],
601
+ export: (n, e) => {
602
+ if (Se(n)) {
603
+ const t = n.getData();
604
+ if (!t.length) return "";
605
+ const r = Object.keys(t[0]), o = r.join(" | "), i = r.map(() => "---").join(" | "), s = t.map((c) => r.map((a) => String(c[a] || "")).join(" | "));
606
+ return [`| ${o} |`, `| ${i} |`, ...s.map((c) => `| ${c} |`)].join(`
607
+ `);
608
+ }
609
+ return null;
610
+ },
611
+ regExp: /^\s*(\|.+\|)\s*$/,
612
+ replace: (n, e, t, r) => {
613
+ const o = n.getPreviousSibling();
614
+ if (/^\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)*\|?$/gm.test(t[0])) {
615
+ n.remove();
616
+ return;
617
+ }
618
+ const s = t[0].split("|").slice(1, -1).map((c) => c.trim());
619
+ if (o?.getType() === "data_table" && Se(o)) {
620
+ const c = o.getData(), a = {}, p = c.length === 1 && Object.values(c[0]).every((d) => d === ""), u = c.length > 0 ? Object.keys(c[0]) : s.map((d, f) => `col_${f}`);
621
+ s.forEach((d, f) => {
622
+ const g = u[f] || `col_${f}`;
623
+ a[g] = d;
624
+ });
625
+ const m = p ? [a] : [...c, a], h = be(m);
626
+ o.replace(h), n.remove();
627
+ } else {
628
+ const c = {};
629
+ s.forEach((p, u) => {
630
+ c[p || `col_${u}`] = "";
631
+ });
632
+ const a = be([c]);
633
+ n.replace(a);
634
+ }
635
+ },
636
+ type: "element"
637
+ }, pn = {
638
+ dependencies: [te],
639
+ export: (n, e) => {
640
+ if (n instanceof te) {
641
+ let t = n.getTextContent();
642
+ if (n.hasFormat("bold"))
643
+ t = `**${t}**`;
644
+ else if (n.hasFormat("italic"))
645
+ t = `*${t}*`;
646
+ else if (n.hasFormat("underline"))
647
+ t = `<ins>${t}</ins>`;
648
+ else
649
+ return null;
650
+ return t;
651
+ }
652
+ return null;
653
+ },
654
+ regExp: /<ins>(.*)<\/ins>/,
655
+ importRegExp: /<ins>(.*)<\/ins>/,
656
+ replace: (n, e) => {
657
+ const t = he(e[1]);
658
+ t.toggleFormat("underline"), n.replace(t);
659
+ },
660
+ type: "text-match"
661
+ }, _n = {
662
+ dependencies: [te],
663
+ export: (n, e) => null,
664
+ regExp: /<u>(.*)<\/u>/,
665
+ importRegExp: /<u>(.*)<\/u>/,
666
+ replace: (n, e) => {
667
+ const t = he(e[1]);
668
+ t.toggleFormat("underline"), n.replace(t);
669
+ },
670
+ type: "text-match"
671
+ }, Te = /https?:\/\/[^\s<>"']*[^\s<>"'.,:;"')\]}]/, gn = {
672
+ dependencies: [me],
673
+ export: (n, e) => ft(n) ? e(n) : null,
674
+ regExp: Te,
675
+ importRegExp: Te,
676
+ replace: (n, e) => {
677
+ const t = e[0], r = mt(t), o = he(t);
678
+ o.setFormat(n.getFormat()), r.append(o), n.replace(r);
679
+ },
680
+ type: "text-match"
681
+ }, Qe = [hn, fn, pn, _n, gn], ao = [Pe, ke, me, z, Me, $e, ve, ue, Oe, J, U, K, re], uo = [ht, ...we, ...Qe, Xe, Ge, rn], mo = _e;
682
+ function En(n) {
683
+ return n.trim().toLowerCase() === "mermaid";
684
+ }
685
+ function xn(n) {
686
+ const e = n.getLanguage() ?? "plaintext";
687
+ return En(e) ? (n.replace(new J(n.getTextContent())), !0) : !1;
688
+ }
689
+ function bn() {
690
+ const n = C(3), [e] = H();
691
+ let t, r;
692
+ return n[0] !== e ? (t = () => {
693
+ e.update(Sn);
694
+ }, r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), q(t, r), null;
695
+ }
696
+ function Sn() {
697
+ const n = St(ue);
698
+ for (const e of n)
699
+ xn(e);
700
+ }
701
+ function yn() {
702
+ const n = C(3), [e] = H();
703
+ let t, r;
704
+ return n[0] !== e ? (t = () => ut(e), r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), q(t, r), null;
705
+ }
706
+ function Ze(n) {
707
+ const e = C(4), {
708
+ isEditable: t
709
+ } = n, [r] = H();
710
+ let o, i;
711
+ return e[0] !== r || e[1] !== t ? (o = () => {
712
+ r.setEditable(t);
713
+ }, i = [t, r], e[0] = r, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), q(o, i), null;
714
+ }
715
+ function et() {
716
+ const n = C(2), [e] = H();
717
+ let t;
718
+ return n[0] !== e ? (t = /* @__PURE__ */ l(w, { fontSize: "xs", color: "fg.muted", padding: "4", children: /* @__PURE__ */ l(Xt, { treeTypeButtonClassName: "debug-treetype-button", timeTravelButtonClassName: "debug-timetravel-button", timeTravelPanelButtonClassName: "debug-timetravel-button", timeTravelPanelClassName: "debug-timetravel-panel", timeTravelPanelSliderClassName: "debug-timetravel-slider", viewClassName: "tree-view-output", editor: e }) }), n[0] = e, n[1] = t) : t = n[1], t;
719
+ }
720
+ const Tn = /^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/, Rn = /^```/, Nn = /^([ \t]*)((?:[-*+])|(?:\d+\.))\s+/, Cn = /^([ \t]+)/;
721
+ function Re(n) {
722
+ let e = 0;
723
+ for (const t of n)
724
+ e += t === " " ? 4 : 1;
725
+ return e;
726
+ }
727
+ function se(n, e, t) {
728
+ return e === t && !n.includes(" ") ? n : " ".repeat(e);
729
+ }
730
+ function tt(n) {
731
+ const e = n.split(`
732
+ `);
733
+ let t = !1;
734
+ const r = [];
735
+ return e.map((o) => {
736
+ if (Rn.test(o.trimStart()))
737
+ return t = !t, o;
738
+ if (t) return o;
739
+ const i = o.match(Nn);
740
+ if (!i) {
741
+ const m = o.match(Cn);
742
+ if (!m)
743
+ return o.trim() !== "" && (r.length = 0), o;
744
+ const h = Re(m[1]), d = [...r].reverse().find((_) => _.sourceIndentWidth < h);
745
+ if (!d) return o;
746
+ const f = h + (d.normalizedIndentWidth - d.sourceIndentWidth), g = se(m[1], f, h);
747
+ return g === m[1] ? o : `${g}${o.slice(m[1].length)}`;
748
+ }
749
+ const s = Re(i[1]);
750
+ for (; r.length && r.at(-1).sourceIndentWidth > s; )
751
+ r.pop();
752
+ const c = r.at(-1);
753
+ if (c?.sourceIndentWidth === s)
754
+ return `${se(i[1], c.normalizedIndentWidth, s)}${o.slice(i[1].length)}`;
755
+ const a = r.at(-1), p = s - (a?.sourceIndentWidth ?? 0), u = a && p === 2 && !i[1].includes(" ") ? (a?.normalizedIndentWidth ?? 0) + 4 : s;
756
+ return r.push({
757
+ normalizedIndentWidth: u,
758
+ sourceIndentWidth: s
759
+ }), `${se(i[1], u, s)}${o.slice(i[1].length)}`;
760
+ }).join(`
761
+ `);
762
+ }
763
+ function In(n) {
764
+ const e = n.match(Tn);
765
+ return e ? {
766
+ frontmatter: e[0],
767
+ body: n.slice(e[0].length)
768
+ } : {
769
+ frontmatter: "",
770
+ body: n
771
+ };
772
+ }
773
+ const On = "UPLOAD_FILE", kn = "OPEN_CONTEXT", $n = "RUN_PROMPT", vn = "UPDATE_FORMAT", wn = "UPDATE_BEHAVIOR", Ln = "INSERT_PROMPT", Pn = "RENAME_PROMPT", Mn = "DUPLICATE_PROMPT", An = "DELETE_PROMPT", Dn = "DELETE_REFERENCES", Fn = "RENAME_REFERENCES", Hn = "INSERT_REFERENCE", qn = "INSERT_BLOCK";
774
+ I(On);
775
+ I(kn);
776
+ I($n);
777
+ I(vn);
778
+ I(wn);
779
+ I(Ln);
780
+ I(Pn);
781
+ I(Mn);
782
+ I(An);
783
+ I(Dn);
784
+ I(Fn);
785
+ const nt = I(Hn), Bn = I(qn), Wn = "INSERT_NEW_FILE_PLACEHOLDER", Un = "INSERT_NEW_TEXT_PLACEHOLDER", zn = "INSERT_PLACEHOLDER_REFERENCE";
786
+ I(Wn);
787
+ I(Un);
788
+ I(zn);
789
+ function Jn(n) {
790
+ const e = ne();
791
+ return n.style !== null && e.setFormat(n.style.textAlign), {
792
+ node: e
793
+ };
794
+ }
795
+ class Q extends Ae {
796
+ static getType() {
797
+ return "comment";
798
+ }
799
+ static clone(e) {
800
+ return new Q(e.__key);
801
+ }
802
+ createDOM(e) {
803
+ const t = document.createElement("blockquote");
804
+ return ze(t, e.theme.comment), t;
805
+ }
806
+ updateDOM() {
807
+ return !1;
808
+ }
809
+ static importDOM() {
810
+ return {
811
+ blockquote: () => ({
812
+ conversion: Jn,
813
+ priority: 0
814
+ })
815
+ };
816
+ }
817
+ exportDOM(e) {
818
+ const {
819
+ element: t
820
+ } = super.exportDOM(e);
821
+ if (t && yt(t)) {
822
+ this.isEmpty() && t.append(document.createElement("br"));
823
+ const r = this.getFormatType();
824
+ t.style.textAlign = r;
825
+ const o = this.getDirection();
826
+ o && (t.dir = o);
827
+ }
828
+ return {
829
+ element: t
830
+ };
831
+ }
832
+ static importJSON(e) {
833
+ const t = ne();
834
+ return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
835
+ }
836
+ exportJSON() {
837
+ return {
838
+ ...super.exportJSON(),
839
+ type: "comment"
840
+ };
841
+ }
842
+ getTextContent() {
843
+ return `{{! ${super.getTextContent().replace(/([{}])/g, "\\$1")} }}`;
844
+ }
845
+ // mutation
846
+ insertNewAfter(e, t) {
847
+ const r = ce(), o = this.getDirection();
848
+ return r.setDirection(o), this.insertAfter(r, t), r;
849
+ }
850
+ collapseAtStart() {
851
+ const e = ce();
852
+ return this.getChildren().forEach((r) => {
853
+ e.append(r);
854
+ }), this.replace(e), !0;
855
+ }
856
+ }
857
+ function ne() {
858
+ return new Q();
859
+ }
860
+ const jn = (n, e) => {
861
+ const t = Tt(), r = ne();
862
+ if (e) {
863
+ e.getParent()?.replace(r, !0), e.remove(), r.selectEnd();
864
+ return;
865
+ }
866
+ Rt(t) && At(t, ne);
867
+ };
868
+ function Kn() {
869
+ const n = C(3), [e] = H();
870
+ let t, r;
871
+ return n[0] !== e ? (t = () => pe(e.registerCommand(Bn, Vn, De)), r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), q(t, r), null;
872
+ }
873
+ function Vn(n) {
874
+ const {
875
+ optionId: e,
876
+ nodeToReplace: t
877
+ } = n;
878
+ return jn(e, t), !1;
879
+ }
880
+ const Xn = () => {
881
+ const n = C(3), [e] = H();
882
+ let t, r;
883
+ n[0] !== e ? (t = () => pe(e.registerNodeTransform(Q, (o) => {
884
+ const s = o.getChildren().filter(Gn);
885
+ s.length > 0 && e.update(() => {
886
+ s.forEach(Yn);
887
+ });
888
+ })), r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), q(t, r);
889
+ };
890
+ function Gn(n) {
891
+ return n.getType() === "comment";
892
+ }
893
+ function Yn(n) {
894
+ n.replace(ce(), !0);
895
+ }
896
+ function Qn() {
897
+ return Xn(), Kn(), null;
898
+ }
899
+ const Zn = (n) => {
900
+ let e = "";
901
+ const t = n.getChildren(), r = t.length;
902
+ for (let o = 0; o < r; o++) {
903
+ const i = t[o];
904
+ e += i.getTextContent(), Nt(i) && o !== r - 1 && !i.isInline() && (e += `
905
+ `);
906
+ }
907
+ return e;
908
+ }, er = (n) => n.type !== "reference" ? null : `#${n.name ?? n.referenceId ?? ""}`, tr = (n) => n.type === "paragraph" && !!n.children?.length, rt = (n) => {
909
+ if (n.type === "comment")
910
+ return "";
911
+ const e = er(n);
912
+ if (e !== null)
913
+ return e;
914
+ let t = typeof n.text == "string" ? n.text : "";
915
+ const r = n.children;
916
+ if (!Array.isArray(r)) return t;
917
+ const o = r.length;
918
+ for (let i = 0; i < o; i += 1) {
919
+ const s = r[i];
920
+ if (s.type === "comment") {
921
+ i !== o - 1 && (t += `
922
+ `);
923
+ continue;
924
+ }
925
+ t += rt(s), tr(s) && (t += `
926
+ `);
927
+ }
928
+ return t;
929
+ }, ot = (n) => {
930
+ try {
931
+ const e = JSON.parse(n);
932
+ return rt(e.root ?? {});
933
+ } catch {
934
+ return "";
935
+ }
936
+ }, nr = {
937
+ root: {
938
+ direction: "ltr",
939
+ format: "",
940
+ indent: 0,
941
+ type: "root",
942
+ version: 1,
943
+ children: [{
944
+ type: "paragraph",
945
+ version: 1,
946
+ format: "",
947
+ indent: 0,
948
+ textFormat: void 0,
949
+ direction: null,
950
+ children: []
951
+ }]
952
+ }
953
+ };
954
+ function rr(n = "") {
955
+ return n.trim() ? {
956
+ root: {
957
+ direction: "ltr",
958
+ format: "",
959
+ indent: 0,
960
+ type: "root",
961
+ version: 1,
962
+ children: n.split(/\r?\n/).map((r) => ({
963
+ type: "paragraph",
964
+ version: 1,
965
+ format: "",
966
+ indent: 0,
967
+ textFormat: void 0,
968
+ direction: null,
969
+ children: r ? [{
970
+ type: "text",
971
+ version: 1,
972
+ text: r,
973
+ format: "",
974
+ detail: 0,
975
+ mode: "normal",
976
+ style: ""
977
+ }] : []
978
+ }))
979
+ }
980
+ } : JSON.parse(JSON.stringify(nr));
981
+ }
982
+ function or(n) {
983
+ const e = C(4), {
984
+ editorRef: t,
985
+ previousTextRef: r
986
+ } = n, [o] = H();
987
+ let i, s;
988
+ return e[0] !== o || e[1] !== r ? (i = () => ({
989
+ setEditorValue: (c) => {
990
+ const a = o.parseEditorState(JSON.stringify(rr(c)));
991
+ o.setEditorState(a), r.current = ot(c), o.focus(void 0, {
992
+ defaultSelection: "rootEnd"
993
+ });
994
+ }
995
+ }), s = [o, r], e[0] = o, e[1] = r, e[2] = i, e[3] = s) : (i = e[2], s = e[3]), wt(t, i, s), null;
996
+ }
997
+ const ir = (n) => n.key !== "Enter" ? !1 : !n.ctrlKey && !n.metaKey && !n.shiftKey && !n.altKey;
998
+ function sr(n) {
999
+ const e = C(4), {
1000
+ onSubmit: t
1001
+ } = n, [r] = H();
1002
+ let o, i;
1003
+ return e[0] !== r || e[1] !== t ? (o = () => r.registerCommand(Ct, (s) => ir(s) ? (s.preventDefault(), t?.(), !0) : !1, It), i = [r, t], e[0] = r, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), q(o, i), null;
1004
+ }
1005
+ const Ne = ["table", "connector"], lr = (n) => n.sort((r, o) => Ne.indexOf(r.group) - Ne.indexOf(o.group)).map((r, o) => ({
1006
+ ...r,
1007
+ index: o
1008
+ })).reduce((r, o) => {
1009
+ const i = r[o.group] ?? [];
1010
+ return i.push(o), r[o.group] = i, r;
1011
+ }, {});
1012
+ function Ce(n) {
1013
+ const e = C(22), {
1014
+ id: t,
1015
+ isSelected: r,
1016
+ onClick: o,
1017
+ onMouseEnter: i,
1018
+ setRefElement: s,
1019
+ secondaryLabel: c,
1020
+ primaryLabel: a,
1021
+ tabIndex: p
1022
+ } = n, u = p === void 0 ? -1 : p, m = r ? "bg.active" : "transparent", h = r ? "bg.active" : "bg.hover";
1023
+ let d;
1024
+ e[0] !== h ? (d = {
1025
+ bg: h
1026
+ }, e[0] = h, e[1] = d) : d = e[1];
1027
+ let f;
1028
+ e[2] !== a ? (f = /* @__PURE__ */ l(ee.Trigger, { children: /* @__PURE__ */ l(L, { mt: "1px", lineClamp: 1, textOverflow: "ellipsis", textStyle: "label/M/regular", children: a }) }), e[2] = a, e[3] = f) : f = e[3];
1029
+ let g;
1030
+ e[4] !== a ? (g = /* @__PURE__ */ l(ee.Positioner, { children: /* @__PURE__ */ l(ee.Content, { children: a }) }), e[4] = a, e[5] = g) : g = e[5];
1031
+ let _;
1032
+ e[6] !== f || e[7] !== g ? (_ = /* @__PURE__ */ F(ee.Root, { children: [
1033
+ f,
1034
+ g
1035
+ ] }), e[6] = f, e[7] = g, e[8] = _) : _ = e[8];
1036
+ let E;
1037
+ e[9] !== c ? (E = c && /* @__PURE__ */ l(L, { lineClamp: 2, textOverflow: "ellipsis", textStyle: "label/S/regular", color: "fg.muted", children: c }), e[9] = c, e[10] = E) : E = e[10];
1038
+ let T;
1039
+ return e[11] !== t || e[12] !== r || e[13] !== o || e[14] !== i || e[15] !== s || e[16] !== m || e[17] !== d || e[18] !== _ || e[19] !== E || e[20] !== u ? (T = /* @__PURE__ */ F(fe, { direction: "column", cursor: "pointer", gap: "2xs", padding: "2xs", paddingX: "sm", bg: m, _hover: d, tabIndex: u, ref: s, role: "option", "aria-selected": r, id: t, onMouseEnter: i, onClick: o, children: [
1040
+ _,
1041
+ E
1042
+ ] }), e[11] = t, e[12] = r, e[13] = o, e[14] = i, e[15] = s, e[16] = m, e[17] = d, e[18] = _, e[19] = E, e[20] = u, e[21] = T) : T = e[21], T;
1043
+ }
1044
+ const cr = (n) => {
1045
+ const e = C(12), {
1046
+ options: t,
1047
+ selectedIndex: r,
1048
+ onSelectItem: o,
1049
+ onMouseEnterItem: i
1050
+ } = n, {
1051
+ table: s,
1052
+ connector: c
1053
+ } = lr(t), a = s === void 0 ? [] : s, p = c === void 0 ? [] : c, u = [...a, ...p].length;
1054
+ let m, h;
1055
+ e[0] !== r ? (m = () => {
1056
+ document.getElementById(`typeahead-item-${r}`)?.scrollIntoView({
1057
+ behavior: "instant",
1058
+ block: "nearest"
1059
+ });
1060
+ }, h = [r], e[0] = r, e[1] = m, e[2] = h) : (m = e[1], h = e[2]), q(m, h);
1061
+ const d = w, f = "1000", g = "absolute", _ = "modal", E = "auto", T = "24rem";
1062
+ let y;
1063
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = {
1064
+ base: "100vw",
1065
+ md: "264px"
1066
+ }, e[3] = y) : y = e[3];
1067
+ let R;
1068
+ e[4] !== u ? (R = !u && /* @__PURE__ */ l(L, { children: "No results" }), e[4] = u, e[5] = R) : R = e[5];
1069
+ const b = !!a.length && /* @__PURE__ */ F(Ee, { children: [
1070
+ /* @__PURE__ */ l(L, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Tables" }),
1071
+ /* @__PURE__ */ l(w, { children: a.map((x) => /* @__PURE__ */ l(Ce, { id: `typeahead-item-${x.index}`, isSelected: r === x.index, onClick: () => o(x, x.index), onMouseEnter: () => i(x.index), primaryLabel: x.name, secondaryLabel: x.description, setRefElement: x.setRefElement, tabIndex: -1 }, x.id)) })
1072
+ ] }), N = !!p.length && /* @__PURE__ */ F(Ee, { children: [
1073
+ /* @__PURE__ */ l(L, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Data Sources" }),
1074
+ /* @__PURE__ */ l(w, { children: p.map((x) => /* @__PURE__ */ l(Ce, { id: `typeahead-item-${x.index}`, isSelected: r === x.index, onClick: () => o(x, x.index), onMouseEnter: () => i(x.index), primaryLabel: x.name, secondaryLabel: x.description, setRefElement: x.setRefElement, tabIndex: -1 }, x.id)) })
1075
+ ] });
1076
+ let S;
1077
+ return e[6] !== d || e[7] !== R || e[8] !== b || e[9] !== N || e[10] !== y ? (S = /* @__PURE__ */ F(d, { zIndex: f, position: g, layerStyle: _, overflow: E, maxHeight: T, minWidth: y, children: [
1078
+ R,
1079
+ b,
1080
+ N
1081
+ ] }), e[6] = d, e[7] = R, e[8] = b, e[9] = N, e[10] = y, e[11] = S) : S = e[11], S;
1082
+ }, ar = (n, e) => n.filter((t) => t.name.replace(/ /g, "_").toLowerCase().includes(e.toLowerCase()));
1083
+ function dr(n, e = []) {
1084
+ const t = e.map((r, o) => ({
1085
+ id: r.resourceId,
1086
+ key: r.resourceId,
1087
+ index: o,
1088
+ group: r.resourceType,
1089
+ name: r.name,
1090
+ description: r.description,
1091
+ setRefElement: () => {
1092
+ }
1093
+ }));
1094
+ return n == null || n === "" ? t : ar(t, n);
1095
+ }
1096
+ const it = "\\.\\-<>_:", ge = ["#"].join(""), st = `[^${ge}${it}\\s]`, ur = `(?:[${it}]|)`, lt = 75, mr = new RegExp(`(^|\\s|\\()([${ge}]((?:${st}${ur}){0,${lt}}))$`), fr = new RegExp(`(^|\\s|\\()([${ge}]((?:${st}){0,${lt}}))$`);
1097
+ function hr(n, e) {
1098
+ let t = mr.exec(n);
1099
+ if (t === null && (t = fr.exec(n)), t !== null) {
1100
+ const r = t[1], o = t[3];
1101
+ if (o.length >= e)
1102
+ return {
1103
+ leadOffset: t.index + r.length,
1104
+ matchingString: o,
1105
+ replaceableString: t[2]
1106
+ };
1107
+ }
1108
+ return null;
1109
+ }
1110
+ const pr = 20;
1111
+ function _r(n) {
1112
+ const e = C(9), {
1113
+ items: t
1114
+ } = n;
1115
+ let r;
1116
+ e[0] !== t ? (r = t === void 0 ? [] : t, e[0] = t, e[1] = r) : r = e[1];
1117
+ const o = r, [i, s] = Lt(null), [c] = H(), a = dr(i, o);
1118
+ let p;
1119
+ e[2] !== c ? (p = (g, _, E) => {
1120
+ c.update(() => {
1121
+ _ && (c.dispatchCommand(nt, {
1122
+ resourceId: g.id,
1123
+ resourceType: g.group,
1124
+ name: g.name,
1125
+ nodeToReplace: _
1126
+ }), E());
1127
+ });
1128
+ }, e[2] = c, e[3] = p) : p = e[3];
1129
+ const u = p, m = Er;
1130
+ let h;
1131
+ e[4] !== a ? (h = a.slice(0, pr), e[4] = a, e[5] = h) : h = e[5];
1132
+ const d = h;
1133
+ let f;
1134
+ return e[6] !== d || e[7] !== u ? (f = /* @__PURE__ */ l(Dt, { onQueryChange: s, onSelectOption: u, triggerFn: m, options: d, menuRenderFn: gr }), e[6] = d, e[7] = u, e[8] = f) : f = e[8], f;
1135
+ }
1136
+ function gr(n, e) {
1137
+ const {
1138
+ options: t,
1139
+ selectedIndex: r,
1140
+ selectOptionAndCleanUp: o,
1141
+ setHighlightedIndex: i
1142
+ } = e;
1143
+ return n.current ? Ft.createPortal(/* @__PURE__ */ l(cr, { options: t, selectedIndex: r, onSelectItem: (s, c) => {
1144
+ i(c), o(s);
1145
+ }, onMouseEnterItem: (s) => {
1146
+ i(s);
1147
+ } }), n.current) : null;
1148
+ }
1149
+ function Er(n) {
1150
+ return hr(n, 0);
1151
+ }
1152
+ class G extends te {
1153
+ __referenceId;
1154
+ __name;
1155
+ static getType() {
1156
+ return "reference";
1157
+ }
1158
+ static clone(e) {
1159
+ return new G(e.__referenceId, e.__name, e.__key);
1160
+ }
1161
+ constructor(e, t, r) {
1162
+ super(t, r), this.__referenceId = e, this.__name = t;
1163
+ }
1164
+ isKeyboardSelectable() {
1165
+ return !1;
1166
+ }
1167
+ canBeEmpty() {
1168
+ return !1;
1169
+ }
1170
+ canInsertTextAfter() {
1171
+ return !1;
1172
+ }
1173
+ canInsertTextBefore() {
1174
+ return !1;
1175
+ }
1176
+ createDOM(e) {
1177
+ const t = document.createElement("span");
1178
+ return ze(t, e.theme.reference), t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, t;
1179
+ }
1180
+ updateDOM(e, t) {
1181
+ return (e.__name !== this.__name || e.__referenceId !== this.__referenceId) && (t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`), !1;
1182
+ }
1183
+ exportDOM(e) {
1184
+ const t = document.createElement("span");
1185
+ return t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, {
1186
+ element: t
1187
+ };
1188
+ }
1189
+ static importDOM() {
1190
+ return {
1191
+ span: (e) => !e.hasAttribute("data-reference-id") || !e.hasAttribute("data-name") ? null : {
1192
+ conversion: xr,
1193
+ priority: 1
1194
+ }
1195
+ };
1196
+ }
1197
+ static importJSON(e) {
1198
+ return new G(e.referenceId, e.name);
1199
+ }
1200
+ exportJSON() {
1201
+ return {
1202
+ ...super.exportJSON(),
1203
+ type: "reference",
1204
+ referenceId: this.__referenceId,
1205
+ name: this.__name
1206
+ };
1207
+ }
1208
+ getTextContent() {
1209
+ return `#${this.__name}`;
1210
+ }
1211
+ }
1212
+ function xr(n) {
1213
+ const e = n.getAttribute("data-reference-id"), t = n.getAttribute("data-name");
1214
+ return !e || !t ? null : {
1215
+ node: ct(e, t)
1216
+ };
1217
+ }
1218
+ function ct(n, e) {
1219
+ return new G(n, e);
1220
+ }
1221
+ const br = (n, e, t) => {
1222
+ const r = ct(e, t);
1223
+ if (n) {
1224
+ n?.replace(r), n.remove(), r.selectEnd();
1225
+ return;
1226
+ }
1227
+ };
1228
+ function Sr(n) {
1229
+ const e = C(4), {
1230
+ onAddReference: t
1231
+ } = n, [r] = H();
1232
+ let o, i;
1233
+ return e[0] !== r || e[1] !== t ? (o = () => pe(r.registerCommand(nt, (s) => {
1234
+ const {
1235
+ resourceId: c,
1236
+ resourceType: a,
1237
+ name: p,
1238
+ nodeToReplace: u
1239
+ } = s;
1240
+ return r.update(() => {
1241
+ br(u, c, p);
1242
+ }), t?.(c, a), !0;
1243
+ }, De)), i = [r, t], e[0] = r, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), q(o, i), null;
1244
+ }
1245
+ const yr = {
1246
+ ..._e,
1247
+ // Override paragraph class to remove margins specifically for prompt input
1248
+ paragraph: "rich-text__p rich-text__p--no-margin"
1249
+ }, Tr = [Q, Ot, G], Rr = (n, e) => {
1250
+ const t = C(39), {
1251
+ defaultState: r,
1252
+ debug: o,
1253
+ isEditable: i,
1254
+ placeholder: s
1255
+ } = n, c = o === void 0 ? !1 : o, a = i === void 0 ? !0 : i, {
1256
+ onChange: p,
1257
+ onError: u,
1258
+ onSubmit: m,
1259
+ references: h,
1260
+ onAddReference: d
1261
+ } = n, f = u === void 0 ? Nr : u;
1262
+ let g;
1263
+ t[0] !== h ? (g = h === void 0 ? [] : h, t[0] = h, t[1] = g) : g = t[1];
1264
+ const _ = g;
1265
+ let E;
1266
+ t[2] !== r || t[3] !== a || t[4] !== f ? (E = {
1267
+ namespace: "PROMPT_EDITOR",
1268
+ nodes: Tr,
1269
+ editorState: r,
1270
+ editable: a,
1271
+ onError: f,
1272
+ theme: yr
1273
+ }, t[2] = r, t[3] = a, t[4] = f, t[5] = E) : E = t[5];
1274
+ const T = E;
1275
+ let y;
1276
+ t[6] !== r ? (y = ot(r), t[6] = r, t[7] = y) : y = t[7];
1277
+ const R = Mt(y);
1278
+ let b;
1279
+ t[8] !== s ? (b = s ?? /* @__PURE__ */ F(L, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: [
1280
+ "Type your query here or press ",
1281
+ /* @__PURE__ */ l(xt, { color: "fg.subtle", children: "#" }),
1282
+ " to add a reference."
1283
+ ] }), t[8] = s, t[9] = b) : b = t[9];
1284
+ const N = b;
1285
+ let S;
1286
+ t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ l(kt, {}), t[10] = S) : S = t[10];
1287
+ let x;
1288
+ t[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ l(Je, { fullWidth: !0 }), t[11] = x) : x = t[11];
1289
+ let O;
1290
+ t[12] !== N ? (O = /* @__PURE__ */ l(We, { contentEditable: x, placeholder: N, ErrorBoundary: qe }), t[12] = N, t[13] = O) : O = t[13];
1291
+ let P;
1292
+ t[14] !== p ? (P = /* @__PURE__ */ l(Be, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (Z) => {
1293
+ Z.read(() => {
1294
+ const dt = Fe(), ie = Zn(dt);
1295
+ ie !== R.current && (R.current = ie, p?.(ie, Z.toJSON()));
1296
+ });
1297
+ } }), t[14] = p, t[15] = P) : P = t[15];
1298
+ let M;
1299
+ t[16] !== e ? (M = /* @__PURE__ */ l(or, { editorRef: e, previousTextRef: R }), t[16] = e, t[17] = M) : M = t[17];
1300
+ let k;
1301
+ t[18] !== a ? (k = /* @__PURE__ */ l(Ze, { isEditable: a }), t[18] = a, t[19] = k) : k = t[19];
1302
+ let A;
1303
+ t[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ l(Qn, {}), t[20] = A) : A = t[20];
1304
+ let $;
1305
+ t[21] !== m ? ($ = /* @__PURE__ */ l(sr, { onSubmit: m }), t[21] = m, t[22] = $) : $ = t[22];
1306
+ let v;
1307
+ t[23] !== _ ? (v = /* @__PURE__ */ l(_r, { items: _ }), t[23] = _, t[24] = v) : v = t[24];
1308
+ let D;
1309
+ t[25] !== d ? (D = /* @__PURE__ */ l(Sr, { onAddReference: d }), t[25] = d, t[26] = D) : D = t[26];
1310
+ let B;
1311
+ t[27] !== c ? (B = c ? /* @__PURE__ */ l(et, {}) : "", t[27] = c, t[28] = B) : B = t[28];
1312
+ let V;
1313
+ return t[29] !== T || t[30] !== O || t[31] !== P || t[32] !== M || t[33] !== k || t[34] !== $ || t[35] !== v || t[36] !== D || t[37] !== B ? (V = /* @__PURE__ */ l(fe, { direction: "column", justifyContent: "space-between", width: "100%", position: "relative", children: /* @__PURE__ */ F(He, { initialConfig: T, children: [
1314
+ S,
1315
+ O,
1316
+ P,
1317
+ M,
1318
+ k,
1319
+ A,
1320
+ $,
1321
+ v,
1322
+ D,
1323
+ B
1324
+ ] }) }), t[29] = T, t[30] = O, t[31] = P, t[32] = M, t[33] = k, t[34] = $, t[35] = v, t[36] = D, t[37] = B, t[38] = V) : V = t[38], V;
1325
+ }, fo = Pt(Rr);
1326
+ function Nr() {
1327
+ }
1328
+ function Cr(n) {
1329
+ const e = C(5), {
1330
+ value: t,
1331
+ onUpdate: r
1332
+ } = n, [o] = H();
1333
+ let i, s;
1334
+ return e[0] !== o || e[1] !== r || e[2] !== t ? (i = () => {
1335
+ o && o.update(() => r(t), {
1336
+ tag: "history-merge"
1337
+ });
1338
+ }, s = [t, o, r], e[0] = o, e[1] = r, e[2] = t, e[3] = i, e[4] = s) : (i = e[3], s = e[4]), q(i, s), null;
1339
+ }
1340
+ class j extends Y {
1341
+ __href;
1342
+ __label;
1343
+ static getType() {
1344
+ return "reference-link";
1345
+ }
1346
+ static clone(e) {
1347
+ return new j(e.__href, e.__label, e.__key);
1348
+ }
1349
+ constructor(e, t, r) {
1350
+ super(r), this.__href = e, this.__label = t;
1351
+ }
1352
+ createDOM(e, t) {
1353
+ return document.createElement("span");
1354
+ }
1355
+ updateDOM(e, t, r) {
1356
+ return !1;
1357
+ }
1358
+ getTextContent() {
1359
+ return `{{link('${this.__label ?? this.__href}')}}`;
1360
+ }
1361
+ exportJSON() {
1362
+ return {
1363
+ type: j.getType(),
1364
+ version: 1,
1365
+ href: this.__href,
1366
+ label: this.__label
1367
+ };
1368
+ }
1369
+ static importJSON(e) {
1370
+ return at(e.href, e.label);
1371
+ }
1372
+ decorate(e, t) {
1373
+ const r = this.__href, i = r.split("/").pop() || "unknown", s = /^https?:\/\//i.test(r), c = /^#?\$PROJECT\//i.test(r);
1374
+ return /* @__PURE__ */ l(w, { width: "fit-content", display: "inline-block", children: /* @__PURE__ */ l(je, { fileName: i, onSelect: () => {
1375
+ if (s)
1376
+ window.open(r, "_blank", "noopener,noreferrer");
1377
+ else if (c) {
1378
+ const a = r.replace(/^#?\$PROJECT\//i, ""), p = new CustomEvent("ui:open-project-file", {
1379
+ detail: a
1380
+ });
1381
+ window.dispatchEvent(p);
1382
+ } else
1383
+ window.location.assign(r);
1384
+ } }) });
1385
+ }
1386
+ }
1387
+ function at(n, e) {
1388
+ return new j(n, e);
1389
+ }
1390
+ function Ir(n) {
1391
+ return n instanceof j;
1392
+ }
1393
+ const Ie = /\{\{\s*link\((['"])([^'"\s]+)\1\)\s*\}\}/, Or = {
1394
+ dependencies: [j],
1395
+ export: (n) => {
1396
+ if (Ir(n)) {
1397
+ const e = n.__href, t = n.__label ?? e;
1398
+ return t ? `{{link('${t}')}}` : `{{link('${e}')}}`;
1399
+ }
1400
+ return null;
1401
+ },
1402
+ regExp: Ie,
1403
+ importRegExp: Ie,
1404
+ replace: (n, e) => {
1405
+ const t = e[2], o = /^(https?:\/\/|\/)/i.test(t) ? t : `#${t}`, i = t;
1406
+ n.replace(at(o, i));
1407
+ },
1408
+ type: "text-match"
1409
+ }, de = [...we, ...Qe, Xe, Ge, Or];
1410
+ function ho(n) {
1411
+ const e = C(37), {
1412
+ debug: t,
1413
+ defaultState: r,
1414
+ fullWidth: o,
1415
+ isEditable: i,
1416
+ onChange: s
1417
+ } = n, c = t === void 0 ? !1 : t, a = r === void 0 ? "" : r, p = o === void 0 ? !1 : o, u = i === void 0 ? !1 : i;
1418
+ let m;
1419
+ e[0] !== a ? (m = In(a), e[0] = a, e[1] = m) : m = e[1];
1420
+ const {
1421
+ frontmatter: h,
1422
+ body: d
1423
+ } = m, f = u && !!s;
1424
+ let g;
1425
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = [Pe, ke, me, z, Me, $e, ve, ue, Oe, J, U, K, j], e[2] = g) : g = e[2];
1426
+ let _;
1427
+ e[3] !== d ? (_ = () => Le(tt(d), de, void 0, !1), e[3] = d, e[4] = _) : _ = e[4];
1428
+ let E;
1429
+ e[5] !== u || e[6] !== _ ? (E = {
1430
+ namespace: "RICH_MESSAGE",
1431
+ nodes: g,
1432
+ editorState: _,
1433
+ onError: $r,
1434
+ editable: u,
1435
+ theme: _e
1436
+ }, e[5] = u, e[6] = _, e[7] = E) : E = e[7];
1437
+ const T = E;
1438
+ let y;
1439
+ e[8] !== d ? (y = /* @__PURE__ */ l(Cr, { value: d, onUpdate: kr }), e[8] = d, e[9] = y) : y = e[9];
1440
+ let R, b, N;
1441
+ e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ l(Bt, {}), R = /* @__PURE__ */ l(Ht, { newTab: !0 }), b = /* @__PURE__ */ l(Wt, {}), e[10] = R, e[11] = b, e[12] = N) : (R = e[10], b = e[11], N = e[12]);
1442
+ let S;
1443
+ e[13] !== u ? (S = u ? /* @__PURE__ */ l(Ut, { maxIndent: 7 }) : null, e[13] = u, e[14] = S) : S = e[14];
1444
+ let x, O, P, M;
1445
+ e[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ l(qt, {}), O = /* @__PURE__ */ l(yn, {}), P = /* @__PURE__ */ l(bn, {}), M = /* @__PURE__ */ l(dn, {}), e[15] = x, e[16] = O, e[17] = P, e[18] = M) : (x = e[15], O = e[16], P = e[17], M = e[18]);
1446
+ let k;
1447
+ e[19] !== p ? (k = /* @__PURE__ */ l(We, { contentEditable: /* @__PURE__ */ l(Je, { fullWidth: p, isRichMessage: !0 }), ErrorBoundary: qe }), e[19] = p, e[20] = k) : k = e[20];
1448
+ let A;
1449
+ e[21] !== h || e[22] !== s || e[23] !== f ? (A = f ? /* @__PURE__ */ l(Be, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (B) => {
1450
+ B.read(() => {
1451
+ const V = Fe(), Z = pt(de, V);
1452
+ s?.(h + Z);
1453
+ });
1454
+ } }) : null, e[21] = h, e[22] = s, e[23] = f, e[24] = A) : A = e[24];
1455
+ let $;
1456
+ e[25] !== u ? ($ = /* @__PURE__ */ l(Ze, { isEditable: u }), e[25] = u, e[26] = $) : $ = e[26];
1457
+ let v;
1458
+ e[27] !== c ? (v = c && /* @__PURE__ */ l(et, {}), e[27] = c, e[28] = v) : v = e[28];
1459
+ let D;
1460
+ return e[29] !== T || e[30] !== S || e[31] !== k || e[32] !== A || e[33] !== $ || e[34] !== v || e[35] !== y ? (D = /* @__PURE__ */ l(fe, { className: "rich-text", "data-rich-message": "true", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "hidden", children: /* @__PURE__ */ F(He, { initialConfig: T, children: [
1461
+ y,
1462
+ N,
1463
+ R,
1464
+ b,
1465
+ S,
1466
+ x,
1467
+ O,
1468
+ P,
1469
+ M,
1470
+ k,
1471
+ A,
1472
+ $,
1473
+ v
1474
+ ] }) }), e[29] = T, e[30] = S, e[31] = k, e[32] = A, e[33] = $, e[34] = v, e[35] = y, e[36] = D) : D = e[36], D;
1475
+ }
1476
+ function kr(n) {
1477
+ Le(tt(n), de, void 0, !1);
1478
+ }
1479
+ function $r(n) {
1480
+ return console.error(n);
1481
+ }
1482
+ export {
1483
+ co as $,
1484
+ yn as C,
1485
+ lo as D,
1486
+ dn as E,
1487
+ bn as I,
1488
+ fo as P,
1489
+ ho as R,
1490
+ Ze as T,
1491
+ ao as a,
1492
+ Je as b,
1493
+ uo as c,
1494
+ et as d,
1495
+ mo as e,
1496
+ sn as f,
1497
+ rr as g,
1498
+ ot as h,
1499
+ je as i,
1500
+ tt as n,
1501
+ In as s
1502
+ };
1503
+ //# sourceMappingURL=rich-message-BVRk9BSD.js.map