@pstdio/ui 0.4.0 → 0.5.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 (134) hide show
  1. package/dist/MermaidComponent-x3aKzNXm.js +124 -0
  2. package/dist/MermaidComponent-x3aKzNXm.js.map +1 -0
  3. package/dist/chat-ui.js +1364 -795
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/chat-ui/agent-types.d.ts +4 -0
  6. package/dist/components/chat-ui/components/chat-input-actions.d.ts +10 -0
  7. package/dist/components/chat-ui/components/chat-input-question-prompt.d.ts +33 -0
  8. package/dist/components/chat-ui/components/chat-input.d.ts +3 -1
  9. package/dist/components/chat-ui/components/chat-panel-sticky-user-message.d.ts +9 -0
  10. package/dist/components/chat-ui/components/chat-panel.d.ts +4 -1
  11. package/dist/components/chat-ui/components/message-parts-renderer.d.ts +1 -0
  12. package/dist/components/chat-ui/components/timeline-tool-blocks.d.ts +14 -0
  13. package/dist/components/chat-ui/components/timeline.d.ts +22 -0
  14. package/dist/components/chat-ui/components/tool-invocation-timeline.d.ts +2 -1
  15. package/dist/components/chat-ui/index.d.ts +1 -0
  16. package/dist/components/chat-ui/tool-rendering/apply-patch-renderer.d.ts +2 -0
  17. package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +2 -2
  18. package/dist/components/chat-ui/tool-rendering/default-renderers.d.ts +10 -7
  19. package/dist/components/chat-ui/tool-rendering/edit-renderer.d.ts +2 -0
  20. package/dist/components/chat-ui/tool-rendering/question-renderer.d.ts +10 -0
  21. package/dist/components/chat-ui/tool-rendering/shared.d.ts +52 -0
  22. package/dist/components/chat-ui/tool-rendering/standard-renderers.d.ts +6 -0
  23. package/dist/components/chat-ui/tool-rendering/todowrite-renderer.d.ts +10 -0
  24. package/dist/components/chat-ui/utils/get-icon.d.ts +2 -0
  25. package/dist/components/chat-ui/utils/tool-name.d.ts +2 -0
  26. package/dist/components/menu-item.d.ts +2 -1
  27. package/dist/components/radio.d.ts +8 -0
  28. package/dist/components/resource-context-menu.d.ts +20 -0
  29. package/dist/components/rich-text/prompt-input/plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode.d.ts +2 -1
  30. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockActionsPlugin.d.ts +4 -0
  31. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockPlugin.d.ts +2 -0
  32. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeHighlightingPlugin.d.ts +1 -0
  33. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/should-show-floating-toolbar.d.ts +11 -0
  34. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidComponent.d.ts +6 -0
  35. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidNode.d.ts +23 -0
  36. package/dist/components/rich-text/shared/plugins/MermaidPlugin/index.d.ts +1 -0
  37. package/dist/components/rich-text/utils/markdown.d.ts +1 -0
  38. package/dist/components/session-indicator.d.ts +1 -1
  39. package/dist/components/sidebar-tree/sidebar-tree.types.d.ts +5 -1
  40. package/dist/components/tickets/tag-badge.d.ts +10 -0
  41. package/dist/components/tickets/tag-option-icon.d.ts +2 -0
  42. package/dist/components/tickets/ticket-board.d.ts +8 -2
  43. package/dist/components/tickets/ticket-card.d.ts +10 -0
  44. package/dist/components/tickets/ticket-grouping.d.ts +2 -2
  45. package/dist/components/tickets/ticket-list.d.ts +9 -1
  46. package/dist/components/tickets/tickets-workspace.d.ts +11 -3
  47. package/dist/components/tickets/types.d.ts +22 -5
  48. package/dist/components/tickets/workspace-helpers.d.ts +18 -0
  49. package/dist/get-file-type-icon-Bwqf1WXA.js +101 -0
  50. package/dist/get-file-type-icon-Bwqf1WXA.js.map +1 -0
  51. package/dist/index.d.ts +6 -2
  52. package/dist/index.js +1886 -1583
  53. package/dist/index.js.map +1 -1
  54. package/dist/radio-C42qncrD.js +236 -0
  55. package/dist/radio-C42qncrD.js.map +1 -0
  56. package/dist/rich-message-CoXTd5kw.js +1512 -0
  57. package/dist/rich-message-CoXTd5kw.js.map +1 -0
  58. package/dist/rich-text.js +414 -255
  59. package/dist/rich-text.js.map +1 -1
  60. package/dist/style.css +1 -1
  61. package/dist/theme/recipes/button.d.ts +6 -0
  62. package/dist/{theme-D0VvFB1Y.js → theme-BLGUwVOD.js} +7 -1
  63. package/dist/theme-BLGUwVOD.js.map +1 -0
  64. package/dist/theme.js +1 -1
  65. package/package.json +3 -1
  66. package/dist/components/attached-panel.utils.test.d.ts +0 -1
  67. package/dist/components/breadcrumb.stories.d.ts +0 -25
  68. package/dist/components/button.stories.d.ts +0 -18
  69. package/dist/components/chat-ui/components/ai-conversation.stories.d.ts +0 -6
  70. package/dist/components/chat-ui/components/ai-message.stories.d.ts +0 -6
  71. package/dist/components/chat-ui/components/ai-response.stories.d.ts +0 -7
  72. package/dist/components/chat-ui/components/attachment-list.stories.d.ts +0 -6
  73. package/dist/components/chat-ui/components/chat-input.stories.d.ts +0 -7
  74. package/dist/components/chat-ui/components/chat-panel-alerts.stories.d.ts +0 -9
  75. package/dist/components/chat-ui/components/chat-panel.stories.d.ts +0 -10
  76. package/dist/components/chat-ui/components/message-parts-renderer.stories.d.ts +0 -9
  77. package/dist/components/chat-ui/components/model-swap-separator.stories.d.ts +0 -6
  78. package/dist/components/chat-ui/components/tool-invocation-timeline.stories.d.ts +0 -6
  79. package/dist/components/chat-ui/components/workspace-hub.stories.d.ts +0 -6
  80. package/dist/components/checkbox.stories.d.ts +0 -15
  81. package/dist/components/column-file-browser.stories.d.ts +0 -15
  82. package/dist/components/data-table/data-table.stories.d.ts +0 -33
  83. package/dist/components/delete-confirmation-modal.stories.d.ts +0 -11
  84. package/dist/components/diff-bubble.stories.d.ts +0 -13
  85. package/dist/components/diff-drawer.stories.d.ts +0 -8
  86. package/dist/components/diff-view-adapter.test.d.ts +0 -1
  87. package/dist/components/drawer-inline.stories.d.ts +0 -8
  88. package/dist/components/empty-state.stories.d.ts +0 -34
  89. package/dist/components/file-selector.stories.d.ts +0 -17
  90. package/dist/components/folder-picker-dialog.stories.d.ts +0 -11
  91. package/dist/components/info-card.stories.d.ts +0 -41
  92. package/dist/components/item-section.stories.d.ts +0 -17
  93. package/dist/components/layout.stories.d.ts +0 -11
  94. package/dist/components/menu-item.stories.d.ts +0 -72
  95. package/dist/components/open-source-notices-screen.stories.d.ts +0 -12
  96. package/dist/components/param-editor-horizontal.stories.d.ts +0 -19
  97. package/dist/components/param-editor.stories.d.ts +0 -24
  98. package/dist/components/properties.stories.d.ts +0 -17
  99. package/dist/components/resource-badge.stories.d.ts +0 -7
  100. package/dist/components/rich-text/collaborative-markdown-editor/collaborative-markdown-editor.stories.d.ts +0 -9
  101. package/dist/components/rich-text/markdown-editor/markdown-editor.stories.d.ts +0 -7
  102. package/dist/components/rich-text/prompt-input/prompt-input.stories.d.ts +0 -8
  103. package/dist/components/rich-text/rich-message/rich-message.stories.d.ts +0 -6
  104. package/dist/components/rich-text/shared/nodes/DataTableNode.stories.d.ts +0 -7
  105. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.d.ts +0 -21
  106. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.test.d.ts +0 -1
  107. package/dist/components/rich-text/shared/transformers/markdown-transformers.test.d.ts +0 -1
  108. package/dist/components/scroll-area.stories.d.ts +0 -7
  109. package/dist/components/searchable-menu.stories.d.ts +0 -8
  110. package/dist/components/session-indicator.stories.d.ts +0 -12
  111. package/dist/components/sidebar/sidebar.store.test.d.ts +0 -1
  112. package/dist/components/sidebar/sidebar.stories.d.ts +0 -11
  113. package/dist/components/sidebar-tree/sidebar-tree-searchable-action-menu.stories.d.ts +0 -6
  114. package/dist/components/sidebar-tree/sidebar-tree.stories.d.ts +0 -13
  115. package/dist/components/slider.stories.d.ts +0 -15
  116. package/dist/components/style-guide.stories.d.ts +0 -23
  117. package/dist/components/switch.stories.d.ts +0 -16
  118. package/dist/components/tickets/display-menu.stories.d.ts +0 -6
  119. package/dist/components/tickets/filter-menu.stories.d.ts +0 -6
  120. package/dist/components/tickets/ticket-board.stories.d.ts +0 -5
  121. package/dist/components/tickets/ticket-card.stories.d.ts +0 -18
  122. package/dist/components/tickets/ticket-grouping.test.d.ts +0 -1
  123. package/dist/components/tickets/ticket-list.stories.d.ts +0 -10
  124. package/dist/components/tickets/tickets-workspace.stories.d.ts +0 -10
  125. package/dist/components/tickets/use-workspace-store.test.d.ts +0 -1
  126. package/dist/components/toaster.stories.d.ts +0 -11
  127. package/dist/components/workspace-badge.stories.d.ts +0 -13
  128. package/dist/empty-state-yGspgiPl.js +0 -185
  129. package/dist/empty-state-yGspgiPl.js.map +0 -1
  130. package/dist/get-file-type-icon-CirIyuE8.js +0 -92
  131. package/dist/get-file-type-icon-CirIyuE8.js.map +0 -1
  132. package/dist/rich-message-Bad4GxH2.js +0 -1423
  133. package/dist/rich-message-Bad4GxH2.js.map +0 -1
  134. package/dist/theme-D0VvFB1Y.js.map +0 -1
@@ -0,0 +1,1512 @@
1
+ import { CodeNode as ue, CodeHighlightNode as Ie, registerCodeHighlighting as ut } from "@lexical/code";
2
+ import { AutoLinkNode as me, $createAutoLinkNode as mt, $isAutoLinkNode as ft, LinkNode as Oe } from "@lexical/link";
3
+ import { ListNode as ke, ListItemNode as $e } from "@lexical/list";
4
+ import { CHECK_LIST as ht, TRANSFORMERS as ve, $convertFromMarkdownString as we, $convertToMarkdownString as pt } from "@lexical/markdown";
5
+ import { QuoteNode as Pe, HeadingNode as Le } from "@lexical/rich-text";
6
+ import { jsx as l, jsxs as F, Fragment as Ee } from "react/jsx-runtime";
7
+ import { chakra as se, Box as w, Text as P, Spacer as _t, IconButton as gt, Table as B, 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 Me, TextNode as te, $createTextNode as he, $nodesOfType as St, createCommand as I, isHTMLElement as yt, $createParagraphNode as le, COMMAND_PRIORITY_LOW as Ae, $getSelection as Tt, $isRangeSelection as Rt, $isElementNode as Nt, KEY_DOWN_COMMAND as Ct, COMMAND_PRIORITY_HIGH as It, $getRoot as De } from "lexical";
9
+ import { c as C } from "react/compiler-runtime";
10
+ import { MarkNode as Ot } from "@lexical/mark";
11
+ import { LexicalComposer as Fe } from "@lexical/react/LexicalComposer";
12
+ import { LexicalErrorBoundary as He } from "@lexical/react/LexicalErrorBoundary";
13
+ import { HistoryPlugin as kt } from "@lexical/react/LexicalHistoryPlugin";
14
+ import { OnChangePlugin as qe } from "@lexical/react/LexicalOnChangePlugin";
15
+ import { RichTextPlugin as ze } from "@lexical/react/LexicalRichTextPlugin";
16
+ import * as $t from "react";
17
+ import { Suspense as Be, lazy as vt, useEffect as q, useImperativeHandle as wt, useState as Pt, forwardRef as Lt, 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 We, 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 zt } from "@lexical/react/LexicalLinkPlugin";
26
+ import { ListPlugin as Bt } from "@lexical/react/LexicalListPlugin";
27
+ import { TabIndentationPlugin as Wt } from "@lexical/react/LexicalTabIndentationPlugin";
28
+ import { ContentEditable as Ut } 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 = se(Ut);
34
+ function Ue(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, h = s === void 0 ? !0 : s, u = c ? "100%" : "720px", p = c ? "0" : "auto";
42
+ let f;
43
+ e[0] !== u || e[1] !== p ? (f = /* @__PURE__ */ l(Yt, { "data-testid": "content-editable", height: "fit-content", minH: "100%", width: "100%", maxWidth: u, marginInline: p, 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] = p, e[2] = f) : f = e[2];
44
+ let d;
45
+ e[3] !== t || e[4] !== o || e[5] !== f ? (d = /* @__PURE__ */ l(w, { ref: t, width: "100%", minH: "100%", padding: o, children: f }), e[3] = t, e[4] = o, e[5] = f, e[6] = d) : d = e[6];
46
+ const m = d;
47
+ if (!h)
48
+ return m;
49
+ const x = a ? "true" : void 0;
50
+ let g;
51
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = {
52
+ width: "100%",
53
+ minH: "100%"
54
+ }, e[7] = g) : g = e[7];
55
+ let _;
56
+ return e[8] !== m || e[9] !== x ? (_ = /* @__PURE__ */ l(Jt, { className: "rich-text", "data-rich-message": x, height: "100%", minH: "0", position: "relative", contentProps: g, children: m }), e[8] = m, e[9] = x, e[10] = _) : _ = e[10], _;
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 h = c === void 0 ? en : c, u = a === void 0 ? tn : a;
109
+ let p;
110
+ e[8] !== t ? (p = jt(t), e[8] = t, e[9] = p) : p = e[9];
111
+ const f = p, d = Qt[h], m = Zt[u], x = i ? "pointer" : "default";
112
+ let g;
113
+ e[10] !== t || e[11] !== i ? (g = (O) => {
114
+ O.stopPropagation(), i?.(t);
115
+ }, e[10] = t, e[11] = i, e[12] = g) : g = e[12];
116
+ let _;
117
+ e[13] !== f || e[14] !== r || e[15] !== d.iconSize ? (_ = r ?? /* @__PURE__ */ l(f, { size: d.iconSize }), e[13] = f, e[14] = r, e[15] = d.iconSize, e[16] = _) : _ = e[16];
118
+ let T;
119
+ e[17] !== _ ? (T = /* @__PURE__ */ l(se.span, { mr: "xs", display: "inline-flex", children: _ }), e[17] = _, 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(P, { 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 E;
137
+ return e[30] !== s || e[31] !== d.container || e[32] !== S || e[33] !== x || e[34] !== g || e[35] !== T || e[36] !== b || e[37] !== m ? (E = /* @__PURE__ */ F(se.span, { display: "flex", flexDirection: "row", alignItems: "center", borderRadius: "xs", gap: "2xs", cursor: x, ...m, ...d.container, onClick: g, ...s, children: [
138
+ T,
139
+ b,
140
+ N,
141
+ S
142
+ ] }), e[30] = s, e[31] = d.container, e[32] = S, e[33] = x, e[34] = g, e[35] = T, e[36] = b, e[37] = m, e[38] = E) : E = e[38], E;
143
+ };
144
+ let re = class ce extends Y {
145
+ __href;
146
+ __label;
147
+ static getType() {
148
+ return "reference-link";
149
+ }
150
+ static clone(e) {
151
+ return new ce(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: ce.getType(),
168
+ version: 1,
169
+ href: this.__href,
170
+ label: this.__label
171
+ };
172
+ }
173
+ static importJSON(e) {
174
+ return je(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, ""), h = new CustomEvent("ui:open-project-file", {
183
+ detail: a
184
+ });
185
+ window.dispatchEvent(h);
186
+ } else
187
+ window.location.assign(r);
188
+ } }) });
189
+ }
190
+ };
191
+ function je(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(je(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), mo = (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, h = i === void 0 ? !1 : i;
294
+ if (c) {
295
+ let p;
296
+ return e[0] !== s ? (p = /* @__PURE__ */ l(Et, { defaultValue: s, fontFamily: "mono", fontSize: X, resize: "vertical", minHeight: "100%" }), e[0] = s, e[1] = p) : p = e[1], p;
297
+ }
298
+ let u;
299
+ if (e[2] !== s || e[3] !== h || e[4] !== a) {
300
+ const p = a ? s.split(`
301
+ `) : [s];
302
+ u = /* @__PURE__ */ l(w, { as: "pre", margin: 0, padding: "sm", fontFamily: "mono", fontSize: X, lineHeight: "1.5", overflowY: h ? "hidden" : "auto", background: "bg.muted", borderRadius: "md", width: "100%", children: a ? /* @__PURE__ */ l(w, { as: "code", display: "grid", gridTemplateColumns: "auto 1fr", columnGap: "sm", children: p.map(ln) }) : /* @__PURE__ */ l(w, { as: "code", children: s }) }), e[2] = s, e[3] = h, 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 h = 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(P, { 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] !== h ? (u = new Set(h), e[5] = h, e[6] = u) : u = e[6];
325
+ const p = u;
326
+ let f;
327
+ e[7] !== t[0] ? (f = Object.keys(t[0] ?? {}), e[7] = t[0], e[8] = f) : f = e[8];
328
+ let d;
329
+ e[9] !== p || e[10] !== f ? (d = f.filter((b) => !p.has(b)), e[9] = p, e[10] = f, e[11] = d) : d = e[11];
330
+ const m = d, x = s ? "100%" : "fit-content", g = c ? "0" : "1px";
331
+ let _;
332
+ e[12] !== m ? (_ = /* @__PURE__ */ l(B.Header, { children: /* @__PURE__ */ l(B.Row, { background: "bg.muted", children: m.map(cn) }) }), e[12] = m, e[13] = _) : _ = e[13];
333
+ let T;
334
+ if (e[14] !== m || e[15] !== t) {
335
+ let b;
336
+ e[17] !== m ? (b = (N, S) => /* @__PURE__ */ l(B.Row, { children: m.map((E) => /* @__PURE__ */ l(B.Cell, { paddingX: "xs", paddingY: "2xs", children: /* @__PURE__ */ l(P, { textStyle: "paragraph/S/regular", fontSize: X, children: on(N[E]) }) }, `${S}-${E}`)) }, `${S}-${m.join("-")}`), e[17] = m, e[18] = b) : b = e[18], T = t.map(b), e[14] = m, e[15] = t, e[16] = T;
337
+ } else
338
+ T = e[16];
339
+ let y;
340
+ e[19] !== T ? (y = /* @__PURE__ */ l(B.Body, { children: T }), e[19] = T, e[20] = y) : y = e[20];
341
+ let R;
342
+ return e[21] !== y || e[22] !== x || e[23] !== g || e[24] !== _ ? (R = /* @__PURE__ */ l(B.ScrollArea, { overflowX: "auto", maxWidth: "100%", children: /* @__PURE__ */ F(B.Root, { size: "sm", width: x, borderWidth: g, borderColor: "border.muted", children: [
343
+ _,
344
+ y
345
+ ] }) }), e[21] = y, e[22] = x, e[23] = g, e[24] = _, 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(P, { as: "span", color: "fg.muted", textAlign: "right", fontSize: "inherit", children: e + 1 }),
350
+ /* @__PURE__ */ l(P, { as: "span", fontSize: "inherit", children: n.length ? n : " " })
351
+ ] }, `${e}-${n}`);
352
+ }
353
+ function cn(n) {
354
+ return /* @__PURE__ */ l(B.ColumnHeader, { textTransform: "none", paddingX: "xs", paddingY: "2xs", children: /* @__PURE__ */ l(P, { textStyle: "label/S/medium", fontSize: X, children: n }) }, n);
355
+ }
356
+ class U extends Y {
357
+ __data;
358
+ static getType() {
359
+ return "data_table";
360
+ }
361
+ static clone(e) {
362
+ return new U(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 U(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 U(n);
398
+ }
399
+ function Se(n) {
400
+ return n instanceof U;
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 W extends Y {
411
+ __equation;
412
+ __inline;
413
+ static getType() {
414
+ return "equation";
415
+ }
416
+ static clone(e) {
417
+ return new W(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(Be, { fallback: null, children: /* @__PURE__ */ l(an, { equation: this.__equation, inline: this.__inline }) });
481
+ }
482
+ }
483
+ function oe(n = "", e = !1) {
484
+ const t = new W(n, e);
485
+ return bt(t);
486
+ }
487
+ function Ke(n) {
488
+ return n instanceof W;
489
+ }
490
+ const Ve = {
491
+ dependencies: [W],
492
+ export: (n) => Ke(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
+ }, Xe = {
501
+ dependencies: [W],
502
+ regExpStart: /\\\[/,
503
+ regExpEnd: /\\]/,
504
+ export: (n) => Ke(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 Me {
512
+ static getType() {
513
+ return "hr";
514
+ }
515
+ static clone(e) {
516
+ return new K(e?.__key);
517
+ }
518
+ static importJSON(e) {
519
+ return Ge();
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 Ge() {
538
+ return new K();
539
+ }
540
+ function un(n) {
541
+ return n instanceof K;
542
+ }
543
+ const mn = vt(() => import("./MermaidComponent-x3aKzNXm.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(Be, { fallback: null, children: /* @__PURE__ */ l(mn, { code: this.__code, nodeKey: this.__key }) });
585
+ }
586
+ }
587
+ function fo(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 = Ge();
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 = {}, h = c.length === 1 && Object.values(c[0]).every((d) => d === ""), u = c.length > 0 ? Object.keys(c[0]) : s.map((d, m) => `col_${m}`);
621
+ s.forEach((d, m) => {
622
+ const x = u[m] || `col_${m}`;
623
+ a[x] = d;
624
+ });
625
+ const p = h ? [a] : [...c, a], f = be(p);
626
+ o.replace(f), n.remove();
627
+ } else {
628
+ const c = {};
629
+ s.forEach((h, u) => {
630
+ c[h || `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
+ }, Ye = [hn, fn, pn, _n, gn], ho = [Pe, Oe, me, U, Le, ke, $e, ue, Ie, J, W, K, re], po = [ht, ...ve, ...Ye, Ve, Xe, rn], _o = _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 Qe(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 Ze() {
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 et(n) {
722
+ let e = 0;
723
+ for (const t of n)
724
+ e += t === " " ? 4 : 1;
725
+ return e;
726
+ }
727
+ function In(n, e) {
728
+ return [...n].reverse().find((t) => t.sourceIndentWidth < e);
729
+ }
730
+ function ae(n, e, t) {
731
+ return e === t && !n.includes(" ") ? n : " ".repeat(e);
732
+ }
733
+ function On(n, e) {
734
+ const t = n.match(Cn);
735
+ if (!t)
736
+ return n.trim() !== "" && (e.length = 0), n;
737
+ const r = et(t[1]), o = In(e, r);
738
+ if (!o) return n;
739
+ const i = r + (o.normalizedIndentWidth - o.sourceIndentWidth), s = ae(t[1], i, r);
740
+ return s === t[1] ? n : `${s}${n.slice(t[1].length)}`;
741
+ }
742
+ function kn(n, e, t) {
743
+ const r = et(e[1]);
744
+ for (; t.length && t.at(-1).sourceIndentWidth > r; )
745
+ t.pop();
746
+ const o = t.at(-1);
747
+ if (o?.sourceIndentWidth === r)
748
+ return `${ae(e[1], o.normalizedIndentWidth, r)}${n.slice(e[1].length)}`;
749
+ const i = t.at(-1), s = r - (i?.sourceIndentWidth ?? 0);
750
+ let c = r;
751
+ return i && s === 2 && !e[1].includes(" ") && (c = i.normalizedIndentWidth + 4), t.push({
752
+ normalizedIndentWidth: c,
753
+ sourceIndentWidth: r
754
+ }), `${ae(e[1], c, r)}${n.slice(e[1].length)}`;
755
+ }
756
+ function $n(n, e) {
757
+ if (Rn.test(n.trimStart()))
758
+ return e.isInCodeFence = !e.isInCodeFence, n;
759
+ if (e.isInCodeFence) return n;
760
+ const t = n.match(Nn);
761
+ return t ? kn(n, t, e.activeListIndents) : On(n, e.activeListIndents);
762
+ }
763
+ function tt(n) {
764
+ const e = n.split(`
765
+ `), t = {
766
+ isInCodeFence: !1,
767
+ activeListIndents: []
768
+ };
769
+ return e.map((r) => $n(r, t)).join(`
770
+ `);
771
+ }
772
+ function vn(n) {
773
+ const e = n.match(Tn);
774
+ return e ? {
775
+ frontmatter: e[0],
776
+ body: n.slice(e[0].length)
777
+ } : {
778
+ frontmatter: "",
779
+ body: n
780
+ };
781
+ }
782
+ const wn = "UPLOAD_FILE", Pn = "OPEN_CONTEXT", Ln = "RUN_PROMPT", Mn = "UPDATE_FORMAT", An = "UPDATE_BEHAVIOR", Dn = "INSERT_PROMPT", Fn = "RENAME_PROMPT", Hn = "DUPLICATE_PROMPT", qn = "DELETE_PROMPT", zn = "DELETE_REFERENCES", Bn = "RENAME_REFERENCES", Wn = "INSERT_REFERENCE", Un = "INSERT_BLOCK";
783
+ I(wn);
784
+ I(Pn);
785
+ I(Ln);
786
+ I(Mn);
787
+ I(An);
788
+ I(Dn);
789
+ I(Fn);
790
+ I(Hn);
791
+ I(qn);
792
+ I(zn);
793
+ I(Bn);
794
+ const nt = I(Wn), Jn = I(Un), jn = "INSERT_NEW_FILE_PLACEHOLDER", Kn = "INSERT_NEW_TEXT_PLACEHOLDER", Vn = "INSERT_PLACEHOLDER_REFERENCE";
795
+ I(jn);
796
+ I(Kn);
797
+ I(Vn);
798
+ function Xn(n) {
799
+ const e = ne();
800
+ return n.style !== null && e.setFormat(n.style.textAlign), {
801
+ node: e
802
+ };
803
+ }
804
+ class Q extends Me {
805
+ static getType() {
806
+ return "comment";
807
+ }
808
+ static clone(e) {
809
+ return new Q(e.__key);
810
+ }
811
+ createDOM(e) {
812
+ const t = document.createElement("blockquote");
813
+ return We(t, e.theme.comment), t;
814
+ }
815
+ updateDOM() {
816
+ return !1;
817
+ }
818
+ static importDOM() {
819
+ return {
820
+ blockquote: () => ({
821
+ conversion: Xn,
822
+ priority: 0
823
+ })
824
+ };
825
+ }
826
+ exportDOM(e) {
827
+ const {
828
+ element: t
829
+ } = super.exportDOM(e);
830
+ if (t && yt(t)) {
831
+ this.isEmpty() && t.append(document.createElement("br"));
832
+ const r = this.getFormatType();
833
+ t.style.textAlign = r;
834
+ const o = this.getDirection();
835
+ o && (t.dir = o);
836
+ }
837
+ return {
838
+ element: t
839
+ };
840
+ }
841
+ static importJSON(e) {
842
+ const t = ne();
843
+ return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
844
+ }
845
+ exportJSON() {
846
+ return {
847
+ ...super.exportJSON(),
848
+ type: "comment"
849
+ };
850
+ }
851
+ getTextContent() {
852
+ return `{{! ${super.getTextContent().replace(/([{}])/g, "\\$1")} }}`;
853
+ }
854
+ // mutation
855
+ insertNewAfter(e, t) {
856
+ const r = le(), o = this.getDirection();
857
+ return r.setDirection(o), this.insertAfter(r, t), r;
858
+ }
859
+ collapseAtStart() {
860
+ const e = le();
861
+ return this.getChildren().forEach((r) => {
862
+ e.append(r);
863
+ }), this.replace(e), !0;
864
+ }
865
+ }
866
+ function ne() {
867
+ return new Q();
868
+ }
869
+ const Gn = (n, e) => {
870
+ const t = Tt(), r = ne();
871
+ if (e) {
872
+ e.getParent()?.replace(r, !0), e.remove(), r.selectEnd();
873
+ return;
874
+ }
875
+ Rt(t) && At(t, ne);
876
+ };
877
+ function Yn() {
878
+ const n = C(3), [e] = H();
879
+ let t, r;
880
+ return n[0] !== e ? (t = () => pe(e.registerCommand(Jn, Qn, Ae)), r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), q(t, r), null;
881
+ }
882
+ function Qn(n) {
883
+ const {
884
+ optionId: e,
885
+ nodeToReplace: t
886
+ } = n;
887
+ return Gn(e, t), !1;
888
+ }
889
+ const Zn = () => {
890
+ const n = C(3), [e] = H();
891
+ let t, r;
892
+ n[0] !== e ? (t = () => pe(e.registerNodeTransform(Q, (o) => {
893
+ const s = o.getChildren().filter(er);
894
+ s.length > 0 && e.update(() => {
895
+ s.forEach(tr);
896
+ });
897
+ })), r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), q(t, r);
898
+ };
899
+ function er(n) {
900
+ return n.getType() === "comment";
901
+ }
902
+ function tr(n) {
903
+ n.replace(le(), !0);
904
+ }
905
+ function nr() {
906
+ return Zn(), Yn(), null;
907
+ }
908
+ const rr = (n) => {
909
+ let e = "";
910
+ const t = n.getChildren(), r = t.length;
911
+ for (let o = 0; o < r; o++) {
912
+ const i = t[o];
913
+ e += i.getTextContent(), Nt(i) && o !== r - 1 && !i.isInline() && (e += `
914
+ `);
915
+ }
916
+ return e;
917
+ }, or = (n) => n.type !== "reference" ? null : `#${n.name ?? n.referenceId ?? ""}`, ir = (n) => n.type === "paragraph" && !!n.children?.length, rt = (n) => {
918
+ if (n.type === "comment")
919
+ return "";
920
+ const e = or(n);
921
+ if (e !== null)
922
+ return e;
923
+ let t = typeof n.text == "string" ? n.text : "";
924
+ const r = n.children;
925
+ if (!Array.isArray(r)) return t;
926
+ const o = r.length;
927
+ for (let i = 0; i < o; i += 1) {
928
+ const s = r[i];
929
+ if (s.type === "comment") {
930
+ i !== o - 1 && (t += `
931
+ `);
932
+ continue;
933
+ }
934
+ t += rt(s), ir(s) && (t += `
935
+ `);
936
+ }
937
+ return t;
938
+ }, ot = (n) => {
939
+ try {
940
+ const e = JSON.parse(n);
941
+ return rt(e.root ?? {});
942
+ } catch {
943
+ return "";
944
+ }
945
+ }, sr = {
946
+ root: {
947
+ direction: "ltr",
948
+ format: "",
949
+ indent: 0,
950
+ type: "root",
951
+ version: 1,
952
+ children: [{
953
+ type: "paragraph",
954
+ version: 1,
955
+ format: "",
956
+ indent: 0,
957
+ textFormat: void 0,
958
+ direction: null,
959
+ children: []
960
+ }]
961
+ }
962
+ };
963
+ function lr(n = "") {
964
+ return n.trim() ? {
965
+ root: {
966
+ direction: "ltr",
967
+ format: "",
968
+ indent: 0,
969
+ type: "root",
970
+ version: 1,
971
+ children: n.split(/\r?\n/).map((r) => ({
972
+ type: "paragraph",
973
+ version: 1,
974
+ format: "",
975
+ indent: 0,
976
+ textFormat: void 0,
977
+ direction: null,
978
+ children: r ? [{
979
+ type: "text",
980
+ version: 1,
981
+ text: r,
982
+ format: "",
983
+ detail: 0,
984
+ mode: "normal",
985
+ style: ""
986
+ }] : []
987
+ }))
988
+ }
989
+ } : JSON.parse(JSON.stringify(sr));
990
+ }
991
+ function cr(n) {
992
+ const e = C(4), {
993
+ editorRef: t,
994
+ previousTextRef: r
995
+ } = n, [o] = H();
996
+ let i, s;
997
+ return e[0] !== o || e[1] !== r ? (i = () => ({
998
+ setEditorValue: (c) => {
999
+ const a = o.parseEditorState(JSON.stringify(lr(c)));
1000
+ o.setEditorState(a), r.current = ot(c), o.focus(void 0, {
1001
+ defaultSelection: "rootEnd"
1002
+ });
1003
+ }
1004
+ }), 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;
1005
+ }
1006
+ const ar = (n) => n.key !== "Enter" ? !1 : !n.ctrlKey && !n.metaKey && !n.shiftKey && !n.altKey;
1007
+ function dr(n) {
1008
+ const e = C(4), {
1009
+ onSubmit: t
1010
+ } = n, [r] = H();
1011
+ let o, i;
1012
+ return e[0] !== r || e[1] !== t ? (o = () => r.registerCommand(Ct, (s) => ar(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;
1013
+ }
1014
+ const Re = ["table", "connector"], ur = (n) => n.sort((r, o) => Re.indexOf(r.group) - Re.indexOf(o.group)).map((r, o) => ({
1015
+ ...r,
1016
+ index: o
1017
+ })).reduce((r, o) => {
1018
+ const i = r[o.group] ?? [];
1019
+ return i.push(o), r[o.group] = i, r;
1020
+ }, {});
1021
+ function Ne(n) {
1022
+ const e = C(22), {
1023
+ id: t,
1024
+ isSelected: r,
1025
+ onClick: o,
1026
+ onMouseEnter: i,
1027
+ setRefElement: s,
1028
+ secondaryLabel: c,
1029
+ primaryLabel: a,
1030
+ tabIndex: h
1031
+ } = n, u = h === void 0 ? -1 : h, p = r ? "bg.active" : "transparent", f = r ? "bg.active" : "bg.hover";
1032
+ let d;
1033
+ e[0] !== f ? (d = {
1034
+ bg: f
1035
+ }, e[0] = f, e[1] = d) : d = e[1];
1036
+ let m;
1037
+ e[2] !== a ? (m = /* @__PURE__ */ l(ee.Trigger, { children: /* @__PURE__ */ l(P, { mt: "1px", lineClamp: 1, textOverflow: "ellipsis", textStyle: "label/M/regular", children: a }) }), e[2] = a, e[3] = m) : m = e[3];
1038
+ let x;
1039
+ e[4] !== a ? (x = /* @__PURE__ */ l(ee.Positioner, { children: /* @__PURE__ */ l(ee.Content, { children: a }) }), e[4] = a, e[5] = x) : x = e[5];
1040
+ let g;
1041
+ e[6] !== m || e[7] !== x ? (g = /* @__PURE__ */ F(ee.Root, { children: [
1042
+ m,
1043
+ x
1044
+ ] }), e[6] = m, e[7] = x, e[8] = g) : g = e[8];
1045
+ let _;
1046
+ e[9] !== c ? (_ = c && /* @__PURE__ */ l(P, { lineClamp: 2, textOverflow: "ellipsis", textStyle: "label/S/regular", color: "fg.muted", children: c }), e[9] = c, e[10] = _) : _ = e[10];
1047
+ let T;
1048
+ return e[11] !== t || e[12] !== r || e[13] !== o || e[14] !== i || e[15] !== s || e[16] !== p || e[17] !== d || e[18] !== g || e[19] !== _ || e[20] !== u ? (T = /* @__PURE__ */ F(fe, { direction: "column", cursor: "pointer", gap: "2xs", padding: "2xs", paddingX: "sm", bg: p, _hover: d, tabIndex: u, ref: s, role: "option", "aria-selected": r, id: t, onMouseEnter: i, onClick: o, children: [
1049
+ g,
1050
+ _
1051
+ ] }), e[11] = t, e[12] = r, e[13] = o, e[14] = i, e[15] = s, e[16] = p, e[17] = d, e[18] = g, e[19] = _, e[20] = u, e[21] = T) : T = e[21], T;
1052
+ }
1053
+ const mr = (n) => {
1054
+ const e = C(12), {
1055
+ options: t,
1056
+ selectedIndex: r,
1057
+ onSelectItem: o,
1058
+ onMouseEnterItem: i
1059
+ } = n, {
1060
+ table: s,
1061
+ connector: c
1062
+ } = ur(t), a = s === void 0 ? [] : s, h = c === void 0 ? [] : c, u = [...a, ...h].length;
1063
+ let p, f;
1064
+ e[0] !== r ? (p = () => {
1065
+ document.getElementById(`typeahead-item-${r}`)?.scrollIntoView({
1066
+ behavior: "instant",
1067
+ block: "nearest"
1068
+ });
1069
+ }, f = [r], e[0] = r, e[1] = p, e[2] = f) : (p = e[1], f = e[2]), q(p, f);
1070
+ const d = w, m = "1000", x = "absolute", g = "modal", _ = "auto", T = "24rem";
1071
+ let y;
1072
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = {
1073
+ base: "100vw",
1074
+ md: "264px"
1075
+ }, e[3] = y) : y = e[3];
1076
+ let R;
1077
+ e[4] !== u ? (R = !u && /* @__PURE__ */ l(P, { children: "No results" }), e[4] = u, e[5] = R) : R = e[5];
1078
+ const b = !!a.length && /* @__PURE__ */ F(Ee, { children: [
1079
+ /* @__PURE__ */ l(P, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Tables" }),
1080
+ /* @__PURE__ */ l(w, { children: a.map((E) => /* @__PURE__ */ l(Ne, { id: `typeahead-item-${E.index}`, isSelected: r === E.index, onClick: () => o(E, E.index), onMouseEnter: () => i(E.index), primaryLabel: E.name, secondaryLabel: E.description, setRefElement: E.setRefElement, tabIndex: -1 }, E.id)) })
1081
+ ] }), N = !!h.length && /* @__PURE__ */ F(Ee, { children: [
1082
+ /* @__PURE__ */ l(P, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Data Sources" }),
1083
+ /* @__PURE__ */ l(w, { children: h.map((E) => /* @__PURE__ */ l(Ne, { id: `typeahead-item-${E.index}`, isSelected: r === E.index, onClick: () => o(E, E.index), onMouseEnter: () => i(E.index), primaryLabel: E.name, secondaryLabel: E.description, setRefElement: E.setRefElement, tabIndex: -1 }, E.id)) })
1084
+ ] });
1085
+ let S;
1086
+ return e[6] !== d || e[7] !== R || e[8] !== b || e[9] !== N || e[10] !== y ? (S = /* @__PURE__ */ F(d, { zIndex: m, position: x, layerStyle: g, overflow: _, maxHeight: T, minWidth: y, children: [
1087
+ R,
1088
+ b,
1089
+ N
1090
+ ] }), e[6] = d, e[7] = R, e[8] = b, e[9] = N, e[10] = y, e[11] = S) : S = e[11], S;
1091
+ }, fr = (n, e) => n.filter((t) => t.name.replace(/ /g, "_").toLowerCase().includes(e.toLowerCase()));
1092
+ function hr(n, e = []) {
1093
+ const t = e.map((r, o) => ({
1094
+ id: r.resourceId,
1095
+ key: r.resourceId,
1096
+ index: o,
1097
+ group: r.resourceType,
1098
+ name: r.name,
1099
+ description: r.description,
1100
+ setRefElement: () => {
1101
+ }
1102
+ }));
1103
+ return n == null || n === "" ? t : fr(t, n);
1104
+ }
1105
+ const it = "\\.\\-<>_:", ge = ["#"].join(""), st = `[^${ge}${it}\\s]`, pr = `(?:[${it}]|)`, lt = 75, _r = new RegExp(`(^|\\s|\\()([${ge}]((?:${st}${pr}){0,${lt}}))$`), gr = new RegExp(`(^|\\s|\\()([${ge}]((?:${st}){0,${lt}}))$`);
1106
+ function Er(n, e) {
1107
+ let t = _r.exec(n);
1108
+ if (t === null && (t = gr.exec(n)), t !== null) {
1109
+ const r = t[1], o = t[3];
1110
+ if (o.length >= e)
1111
+ return {
1112
+ leadOffset: t.index + r.length,
1113
+ matchingString: o,
1114
+ replaceableString: t[2]
1115
+ };
1116
+ }
1117
+ return null;
1118
+ }
1119
+ const xr = 20;
1120
+ function br(n) {
1121
+ const e = C(9), {
1122
+ items: t
1123
+ } = n;
1124
+ let r;
1125
+ e[0] !== t ? (r = t === void 0 ? [] : t, e[0] = t, e[1] = r) : r = e[1];
1126
+ const o = r, [i, s] = Pt(null), [c] = H(), a = hr(i, o);
1127
+ let h;
1128
+ e[2] !== c ? (h = (x, g, _) => {
1129
+ c.update(() => {
1130
+ g && (c.dispatchCommand(nt, {
1131
+ resourceId: x.id,
1132
+ resourceType: x.group,
1133
+ name: x.name,
1134
+ nodeToReplace: g
1135
+ }), _());
1136
+ });
1137
+ }, e[2] = c, e[3] = h) : h = e[3];
1138
+ const u = h, p = yr;
1139
+ let f;
1140
+ e[4] !== a ? (f = a.slice(0, xr), e[4] = a, e[5] = f) : f = e[5];
1141
+ const d = f;
1142
+ let m;
1143
+ return e[6] !== d || e[7] !== u ? (m = /* @__PURE__ */ l(Dt, { onQueryChange: s, onSelectOption: u, triggerFn: p, options: d, menuRenderFn: Sr }), e[6] = d, e[7] = u, e[8] = m) : m = e[8], m;
1144
+ }
1145
+ function Sr(n, e) {
1146
+ const {
1147
+ options: t,
1148
+ selectedIndex: r,
1149
+ selectOptionAndCleanUp: o,
1150
+ setHighlightedIndex: i
1151
+ } = e;
1152
+ return n.current ? Ft.createPortal(/* @__PURE__ */ l(mr, { options: t, selectedIndex: r, onSelectItem: (s, c) => {
1153
+ i(c), o(s);
1154
+ }, onMouseEnterItem: (s) => {
1155
+ i(s);
1156
+ } }), n.current) : null;
1157
+ }
1158
+ function yr(n) {
1159
+ return Er(n, 0);
1160
+ }
1161
+ class G extends te {
1162
+ __referenceId;
1163
+ __name;
1164
+ static getType() {
1165
+ return "reference";
1166
+ }
1167
+ static clone(e) {
1168
+ return new G(e.__referenceId, e.__name, e.__key);
1169
+ }
1170
+ constructor(e, t, r) {
1171
+ super(t, r), this.__referenceId = e, this.__name = t;
1172
+ }
1173
+ isKeyboardSelectable() {
1174
+ return !1;
1175
+ }
1176
+ canBeEmpty() {
1177
+ return !1;
1178
+ }
1179
+ canInsertTextAfter() {
1180
+ return !1;
1181
+ }
1182
+ canInsertTextBefore() {
1183
+ return !1;
1184
+ }
1185
+ createDOM(e) {
1186
+ const t = document.createElement("span");
1187
+ return We(t, e.theme.reference), t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, t;
1188
+ }
1189
+ updateDOM(e, t) {
1190
+ 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;
1191
+ }
1192
+ exportDOM(e) {
1193
+ const t = document.createElement("span");
1194
+ return t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, {
1195
+ element: t
1196
+ };
1197
+ }
1198
+ static importDOM() {
1199
+ return {
1200
+ span: (e) => !e.hasAttribute("data-reference-id") || !e.hasAttribute("data-name") ? null : {
1201
+ conversion: Tr,
1202
+ priority: 1
1203
+ }
1204
+ };
1205
+ }
1206
+ static importJSON(e) {
1207
+ return new G(e.referenceId, e.name);
1208
+ }
1209
+ exportJSON() {
1210
+ return {
1211
+ ...super.exportJSON(),
1212
+ type: "reference",
1213
+ referenceId: this.__referenceId,
1214
+ name: this.__name
1215
+ };
1216
+ }
1217
+ getTextContent() {
1218
+ return `#${this.__name}`;
1219
+ }
1220
+ }
1221
+ function Tr(n) {
1222
+ const e = n.getAttribute("data-reference-id"), t = n.getAttribute("data-name");
1223
+ return !e || !t ? null : {
1224
+ node: ct(e, t)
1225
+ };
1226
+ }
1227
+ function ct(n, e) {
1228
+ return new G(n, e);
1229
+ }
1230
+ const Rr = (n, e, t) => {
1231
+ const r = ct(e, t);
1232
+ if (n) {
1233
+ n?.replace(r), n.remove(), r.selectEnd();
1234
+ return;
1235
+ }
1236
+ };
1237
+ function Nr(n) {
1238
+ const e = C(4), {
1239
+ onAddReference: t
1240
+ } = n, [r] = H();
1241
+ let o, i;
1242
+ return e[0] !== r || e[1] !== t ? (o = () => pe(r.registerCommand(nt, (s) => {
1243
+ const {
1244
+ resourceId: c,
1245
+ resourceType: a,
1246
+ name: h,
1247
+ nodeToReplace: u
1248
+ } = s;
1249
+ return r.update(() => {
1250
+ Rr(u, c, h);
1251
+ }), t?.(c, a), !0;
1252
+ }, Ae)), 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;
1253
+ }
1254
+ const Cr = {
1255
+ ..._e,
1256
+ // Override paragraph class to remove margins specifically for prompt input
1257
+ paragraph: "rich-text__p rich-text__p--no-margin"
1258
+ }, Ir = [Q, Ot, G], Or = (n, e) => {
1259
+ const t = C(39), {
1260
+ defaultState: r,
1261
+ debug: o,
1262
+ isEditable: i,
1263
+ placeholder: s
1264
+ } = n, c = o === void 0 ? !1 : o, a = i === void 0 ? !0 : i, {
1265
+ onChange: h,
1266
+ onError: u,
1267
+ onSubmit: p,
1268
+ references: f,
1269
+ onAddReference: d
1270
+ } = n, m = u === void 0 ? kr : u;
1271
+ let x;
1272
+ t[0] !== f ? (x = f === void 0 ? [] : f, t[0] = f, t[1] = x) : x = t[1];
1273
+ const g = x;
1274
+ let _;
1275
+ t[2] !== r || t[3] !== a || t[4] !== m ? (_ = {
1276
+ namespace: "PROMPT_EDITOR",
1277
+ nodes: Ir,
1278
+ editorState: r,
1279
+ editable: a,
1280
+ onError: m,
1281
+ theme: Cr
1282
+ }, t[2] = r, t[3] = a, t[4] = m, t[5] = _) : _ = t[5];
1283
+ const T = _;
1284
+ let y;
1285
+ t[6] !== r ? (y = ot(r), t[6] = r, t[7] = y) : y = t[7];
1286
+ const R = Mt(y);
1287
+ let b;
1288
+ t[8] !== s ? (b = s ?? /* @__PURE__ */ F(P, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: [
1289
+ "Type your query here or press ",
1290
+ /* @__PURE__ */ l(xt, { color: "fg.subtle", children: "#" }),
1291
+ " to add a reference."
1292
+ ] }), t[8] = s, t[9] = b) : b = t[9];
1293
+ const N = b;
1294
+ let S;
1295
+ t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ l(kt, {}), t[10] = S) : S = t[10];
1296
+ let E;
1297
+ t[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ l(Ue, { fullWidth: !0 }), t[11] = E) : E = t[11];
1298
+ let O;
1299
+ t[12] !== N ? (O = /* @__PURE__ */ l(ze, { contentEditable: E, placeholder: N, ErrorBoundary: He }), t[12] = N, t[13] = O) : O = t[13];
1300
+ let L;
1301
+ t[14] !== h ? (L = /* @__PURE__ */ l(qe, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (Z) => {
1302
+ Z.read(() => {
1303
+ const dt = De(), ie = rr(dt);
1304
+ ie !== R.current && (R.current = ie, h?.(ie, Z.toJSON()));
1305
+ });
1306
+ } }), t[14] = h, t[15] = L) : L = t[15];
1307
+ let M;
1308
+ t[16] !== e ? (M = /* @__PURE__ */ l(cr, { editorRef: e, previousTextRef: R }), t[16] = e, t[17] = M) : M = t[17];
1309
+ let k;
1310
+ t[18] !== a ? (k = /* @__PURE__ */ l(Qe, { isEditable: a }), t[18] = a, t[19] = k) : k = t[19];
1311
+ let A;
1312
+ t[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ l(nr, {}), t[20] = A) : A = t[20];
1313
+ let $;
1314
+ t[21] !== p ? ($ = /* @__PURE__ */ l(dr, { onSubmit: p }), t[21] = p, t[22] = $) : $ = t[22];
1315
+ let v;
1316
+ t[23] !== g ? (v = /* @__PURE__ */ l(br, { items: g }), t[23] = g, t[24] = v) : v = t[24];
1317
+ let D;
1318
+ t[25] !== d ? (D = /* @__PURE__ */ l(Nr, { onAddReference: d }), t[25] = d, t[26] = D) : D = t[26];
1319
+ let z;
1320
+ t[27] !== c ? (z = c ? /* @__PURE__ */ l(Ze, {}) : "", t[27] = c, t[28] = z) : z = t[28];
1321
+ let V;
1322
+ return t[29] !== T || t[30] !== O || t[31] !== L || t[32] !== M || t[33] !== k || t[34] !== $ || t[35] !== v || t[36] !== D || t[37] !== z ? (V = /* @__PURE__ */ l(fe, { direction: "column", justifyContent: "space-between", width: "100%", position: "relative", children: /* @__PURE__ */ F(Fe, { initialConfig: T, children: [
1323
+ S,
1324
+ O,
1325
+ L,
1326
+ M,
1327
+ k,
1328
+ A,
1329
+ $,
1330
+ v,
1331
+ D,
1332
+ z
1333
+ ] }) }), t[29] = T, t[30] = O, t[31] = L, t[32] = M, t[33] = k, t[34] = $, t[35] = v, t[36] = D, t[37] = z, t[38] = V) : V = t[38], V;
1334
+ }, go = Lt(Or);
1335
+ function kr() {
1336
+ }
1337
+ function $r(n) {
1338
+ const e = C(5), {
1339
+ value: t,
1340
+ onUpdate: r
1341
+ } = n, [o] = H();
1342
+ let i, s;
1343
+ return e[0] !== o || e[1] !== r || e[2] !== t ? (i = () => {
1344
+ o && o.update(() => r(t), {
1345
+ tag: "history-merge"
1346
+ });
1347
+ }, 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;
1348
+ }
1349
+ class j extends Y {
1350
+ __href;
1351
+ __label;
1352
+ static getType() {
1353
+ return "reference-link";
1354
+ }
1355
+ static clone(e) {
1356
+ return new j(e.__href, e.__label, e.__key);
1357
+ }
1358
+ constructor(e, t, r) {
1359
+ super(r), this.__href = e, this.__label = t;
1360
+ }
1361
+ createDOM(e, t) {
1362
+ return document.createElement("span");
1363
+ }
1364
+ updateDOM(e, t, r) {
1365
+ return !1;
1366
+ }
1367
+ getTextContent() {
1368
+ return `{{link('${this.__label ?? this.__href}')}}`;
1369
+ }
1370
+ exportJSON() {
1371
+ return {
1372
+ type: j.getType(),
1373
+ version: 1,
1374
+ href: this.__href,
1375
+ label: this.__label
1376
+ };
1377
+ }
1378
+ static importJSON(e) {
1379
+ return at(e.href, e.label);
1380
+ }
1381
+ decorate(e, t) {
1382
+ const r = this.__href, i = r.split("/").pop() || "unknown", s = /^https?:\/\//i.test(r), c = /^#?\$PROJECT\//i.test(r);
1383
+ return /* @__PURE__ */ l(w, { width: "fit-content", display: "inline-block", children: /* @__PURE__ */ l(Je, { fileName: i, onSelect: () => {
1384
+ if (s)
1385
+ window.open(r, "_blank", "noopener,noreferrer");
1386
+ else if (c) {
1387
+ const a = r.replace(/^#?\$PROJECT\//i, ""), h = new CustomEvent("ui:open-project-file", {
1388
+ detail: a
1389
+ });
1390
+ window.dispatchEvent(h);
1391
+ } else
1392
+ window.location.assign(r);
1393
+ } }) });
1394
+ }
1395
+ }
1396
+ function at(n, e) {
1397
+ return new j(n, e);
1398
+ }
1399
+ function vr(n) {
1400
+ return n instanceof j;
1401
+ }
1402
+ const Ce = /\{\{\s*link\((['"])([^'"\s]+)\1\)\s*\}\}/, wr = {
1403
+ dependencies: [j],
1404
+ export: (n) => {
1405
+ if (vr(n)) {
1406
+ const e = n.__href, t = n.__label ?? e;
1407
+ return t ? `{{link('${t}')}}` : `{{link('${e}')}}`;
1408
+ }
1409
+ return null;
1410
+ },
1411
+ regExp: Ce,
1412
+ importRegExp: Ce,
1413
+ replace: (n, e) => {
1414
+ const t = e[2], o = /^(https?:\/\/|\/)/i.test(t) ? t : `#${t}`, i = t;
1415
+ n.replace(at(o, i));
1416
+ },
1417
+ type: "text-match"
1418
+ }, de = [...ve, ...Ye, Ve, Xe, wr];
1419
+ function Eo(n) {
1420
+ const e = C(37), {
1421
+ debug: t,
1422
+ defaultState: r,
1423
+ fullWidth: o,
1424
+ isEditable: i,
1425
+ onChange: s
1426
+ } = n, c = t === void 0 ? !1 : t, a = r === void 0 ? "" : r, h = o === void 0 ? !1 : o, u = i === void 0 ? !1 : i;
1427
+ let p;
1428
+ e[0] !== a ? (p = vn(a), e[0] = a, e[1] = p) : p = e[1];
1429
+ const {
1430
+ frontmatter: f,
1431
+ body: d
1432
+ } = p, m = u && !!s;
1433
+ let x;
1434
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = [Pe, Oe, me, U, Le, ke, $e, ue, Ie, J, W, K, j], e[2] = x) : x = e[2];
1435
+ let g;
1436
+ e[3] !== d ? (g = () => we(tt(d), de, void 0, !1), e[3] = d, e[4] = g) : g = e[4];
1437
+ let _;
1438
+ e[5] !== u || e[6] !== g ? (_ = {
1439
+ namespace: "RICH_MESSAGE",
1440
+ nodes: x,
1441
+ editorState: g,
1442
+ onError: Lr,
1443
+ editable: u,
1444
+ theme: _e
1445
+ }, e[5] = u, e[6] = g, e[7] = _) : _ = e[7];
1446
+ const T = _;
1447
+ let y;
1448
+ e[8] !== d ? (y = /* @__PURE__ */ l($r, { value: d, onUpdate: Pr }), e[8] = d, e[9] = y) : y = e[9];
1449
+ let R, b, N;
1450
+ e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ l(zt, {}), R = /* @__PURE__ */ l(Ht, { newTab: !0 }), b = /* @__PURE__ */ l(Bt, {}), e[10] = R, e[11] = b, e[12] = N) : (R = e[10], b = e[11], N = e[12]);
1451
+ let S;
1452
+ e[13] !== u ? (S = u ? /* @__PURE__ */ l(Wt, { maxIndent: 7 }) : null, e[13] = u, e[14] = S) : S = e[14];
1453
+ let E, O, L, M;
1454
+ e[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ l(qt, {}), O = /* @__PURE__ */ l(yn, {}), L = /* @__PURE__ */ l(bn, {}), M = /* @__PURE__ */ l(dn, {}), e[15] = E, e[16] = O, e[17] = L, e[18] = M) : (E = e[15], O = e[16], L = e[17], M = e[18]);
1455
+ let k;
1456
+ e[19] !== h ? (k = /* @__PURE__ */ l(ze, { contentEditable: /* @__PURE__ */ l(Ue, { fullWidth: h, isRichMessage: !0 }), ErrorBoundary: He }), e[19] = h, e[20] = k) : k = e[20];
1457
+ let A;
1458
+ e[21] !== f || e[22] !== s || e[23] !== m ? (A = m ? /* @__PURE__ */ l(qe, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (z) => {
1459
+ z.read(() => {
1460
+ const V = De(), Z = pt(de, V);
1461
+ s?.(f + Z);
1462
+ });
1463
+ } }) : null, e[21] = f, e[22] = s, e[23] = m, e[24] = A) : A = e[24];
1464
+ let $;
1465
+ e[25] !== u ? ($ = /* @__PURE__ */ l(Qe, { isEditable: u }), e[25] = u, e[26] = $) : $ = e[26];
1466
+ let v;
1467
+ e[27] !== c ? (v = c && /* @__PURE__ */ l(Ze, {}), e[27] = c, e[28] = v) : v = e[28];
1468
+ let D;
1469
+ 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(Fe, { initialConfig: T, children: [
1470
+ y,
1471
+ N,
1472
+ R,
1473
+ b,
1474
+ S,
1475
+ E,
1476
+ O,
1477
+ L,
1478
+ M,
1479
+ k,
1480
+ A,
1481
+ $,
1482
+ v
1483
+ ] }) }), 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;
1484
+ }
1485
+ function Pr(n) {
1486
+ we(tt(n), de, void 0, !1);
1487
+ }
1488
+ function Lr(n) {
1489
+ return console.error(n);
1490
+ }
1491
+ export {
1492
+ fo as $,
1493
+ yn as C,
1494
+ mo as D,
1495
+ dn as E,
1496
+ bn as I,
1497
+ go as P,
1498
+ Eo as R,
1499
+ Qe as T,
1500
+ ho as a,
1501
+ Ue as b,
1502
+ po as c,
1503
+ Ze as d,
1504
+ _o as e,
1505
+ sn as f,
1506
+ lr as g,
1507
+ ot as h,
1508
+ Je as i,
1509
+ tt as n,
1510
+ vn as s
1511
+ };
1512
+ //# sourceMappingURL=rich-message-CoXTd5kw.js.map