@pstdio/ui 0.2.1 → 0.2.3

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