@pstdio/ui 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +8 -1
  2. package/dist/{MermaidComponent-BVdDqDRU.js → MermaidComponent-X__B6qib.js} +3 -3
  3. package/dist/{MermaidComponent-BVdDqDRU.js.map → MermaidComponent-X__B6qib.js.map} +1 -1
  4. package/dist/activity-timeline-BynMjXSB.js +283 -0
  5. package/dist/activity-timeline-BynMjXSB.js.map +1 -0
  6. package/dist/alert-ubcrW24X.js +33 -0
  7. package/dist/alert-ubcrW24X.js.map +1 -0
  8. package/dist/browser-storage-BinyFNJX.js +40 -0
  9. package/dist/browser-storage-BinyFNJX.js.map +1 -0
  10. package/dist/chat-ui.js +1515 -1429
  11. package/dist/chat-ui.js.map +1 -1
  12. package/dist/components/activity/index.d.ts +1 -3
  13. package/dist/components/chat-ui/components/chat-history-story.d.ts +14 -0
  14. package/dist/components/chat-ui/components/chat-input-history.d.ts +6 -0
  15. package/dist/components/chat-ui/components/chat-input.d.ts +2 -0
  16. package/dist/components/chat-ui/components/chat-panel-composer.d.ts +49 -0
  17. package/dist/components/chat-ui/components/use-chat-input-history.d.ts +16 -0
  18. package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +1 -1
  19. package/dist/components/chat-ui/tool-rendering/shared.d.ts +1 -1
  20. package/dist/components/diff-viewer/code-editor.d.ts +2 -0
  21. package/dist/components/rich-text/index.d.ts +2 -0
  22. package/dist/components/rich-text/markdown-editor/markdown-editor-scrolling.play.d.ts +4 -0
  23. package/dist/components/rich-text/prompt-input/plugins/KeyboardShortcutPlugin.d.ts +3 -1
  24. package/dist/components/rich-text/prompt-input/plugins/keyboard-shortcuts.d.ts +2 -0
  25. package/dist/components/rich-text/prompt-input/prompt-input.d.ts +2 -0
  26. package/dist/components/{activity → rich-text/resource-activity-feed}/resource-activity-feed.d.ts +1 -1
  27. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/should-show-floating-toolbar.d.ts +1 -0
  28. package/dist/data-table.js +6 -6
  29. package/dist/diff.js +524 -522
  30. package/dist/diff.js.map +1 -1
  31. package/dist/{edit-mode-data-table-B8UpWb7i.js → edit-mode-data-table-Nfmfi7bz.js} +23 -22
  32. package/dist/{edit-mode-data-table-B8UpWb7i.js.map → edit-mode-data-table-Nfmfi7bz.js.map} +1 -1
  33. package/dist/index.d.ts +2 -3
  34. package/dist/index.js +1766 -2232
  35. package/dist/index.js.map +1 -1
  36. package/dist/{kanban-renderer-toolbar-DzY6THJY.js → kanban-renderer-toolbar-Buek4icz.js} +34 -33
  37. package/dist/{kanban-renderer-toolbar-DzY6THJY.js.map → kanban-renderer-toolbar-Buek4icz.js.map} +1 -1
  38. package/dist/kanban-renderer.js +31 -30
  39. package/dist/kanban-renderer.js.map +1 -1
  40. package/dist/lazy-markdown-editor-PzIBc9-l.js +42 -0
  41. package/dist/lazy-markdown-editor-PzIBc9-l.js.map +1 -0
  42. package/dist/{list-row-BDoV_iMV.js → list-row-DHzRa9-O.js} +2 -2
  43. package/dist/{list-row-BDoV_iMV.js.map → list-row-DHzRa9-O.js.map} +1 -1
  44. package/dist/{markdown-gNucAjnF.js → markdown-BCfPxNpb.js} +323 -303
  45. package/dist/markdown-BCfPxNpb.js.map +1 -0
  46. package/dist/markdown-editor-CsJ4KNGu.js +1034 -0
  47. package/dist/markdown-editor-CsJ4KNGu.js.map +1 -0
  48. package/dist/{mermaid-renderer-CVnuKs-A.js → mermaid-renderer-D0YP0FmJ.js} +3 -3
  49. package/dist/{mermaid-renderer-CVnuKs-A.js.map → mermaid-renderer-D0YP0FmJ.js.map} +1 -1
  50. package/dist/mermaid.js +1 -1
  51. package/dist/{param-editor-CTx3mDxQ.js → param-editor-CFM2Nf3l.js} +2 -2
  52. package/dist/{param-editor-CTx3mDxQ.js.map → param-editor-CFM2Nf3l.js.map} +1 -1
  53. package/dist/param-editor-field-Bj-AGUY6.js +1728 -0
  54. package/dist/param-editor-field-Bj-AGUY6.js.map +1 -0
  55. package/dist/param-editor.d.ts +2 -0
  56. package/dist/param-editor.js +47 -0
  57. package/dist/param-editor.js.map +1 -0
  58. package/dist/prism-n5gcERyD.js +202 -0
  59. package/dist/prism-n5gcERyD.js.map +1 -0
  60. package/dist/radio-BfjibByI.js +51 -0
  61. package/dist/radio-BfjibByI.js.map +1 -0
  62. package/dist/rich-message-q6Y6QJOq.js +633 -0
  63. package/dist/rich-message-q6Y6QJOq.js.map +1 -0
  64. package/dist/rich-text.js +342 -178
  65. package/dist/rich-text.js.map +1 -1
  66. package/dist/scroll-area-BMbg1WcD.js +91 -0
  67. package/dist/scroll-area-BMbg1WcD.js.map +1 -0
  68. package/dist/slider-DBHjdxsU.js +1092 -0
  69. package/dist/slider-DBHjdxsU.js.map +1 -0
  70. package/dist/style.css +1 -1
  71. package/dist/terminal.js +96 -93
  72. package/dist/terminal.js.map +1 -1
  73. package/dist/theme/recipes/timeline.d.ts +9 -0
  74. package/dist/{theme-Dc7hVvMC.js → theme-AzJH4Om3.js} +10 -1
  75. package/dist/theme-AzJH4Om3.js.map +1 -0
  76. package/dist/{theme-preference-Bpobguh4.js → theme-preference-DxGW1qg-.js} +2 -2
  77. package/dist/{theme-preference-Bpobguh4.js.map → theme-preference-DxGW1qg-.js.map} +1 -1
  78. package/dist/theme.js +1 -1
  79. package/dist/{tree-list-CZvcg3_6.js → tree-list-CPjbGTvs.js} +2 -2
  80. package/dist/{tree-list-CZvcg3_6.js.map → tree-list-CPjbGTvs.js.map} +1 -1
  81. package/dist/{workspace-badge-BR_GgsAG.js → workspace-badge-CuOcmnZc.js} +2 -2
  82. package/dist/{workspace-badge-BR_GgsAG.js.map → workspace-badge-CuOcmnZc.js.map} +1 -1
  83. package/package.json +7 -2
  84. package/dist/browser-storage-DPtOQJx0.js +0 -127
  85. package/dist/browser-storage-DPtOQJx0.js.map +0 -1
  86. package/dist/lazy-markdown-editor-ClZPZuaU.js +0 -235
  87. package/dist/lazy-markdown-editor-ClZPZuaU.js.map +0 -1
  88. package/dist/markdown-editor-CAVqJ9yR.js +0 -1019
  89. package/dist/markdown-editor-CAVqJ9yR.js.map +0 -1
  90. package/dist/markdown-gNucAjnF.js.map +0 -1
  91. package/dist/param-editor-field-DteDEyeU.js +0 -2810
  92. package/dist/param-editor-field-DteDEyeU.js.map +0 -1
  93. package/dist/prompt-input-DNpRL5tI.js +0 -564
  94. package/dist/prompt-input-DNpRL5tI.js.map +0 -1
  95. package/dist/radio-cLMEBBZk.js +0 -76
  96. package/dist/radio-cLMEBBZk.js.map +0 -1
  97. package/dist/rich-message-CuPiKxKX.js +0 -78
  98. package/dist/rich-message-CuPiKxKX.js.map +0 -1
  99. package/dist/theme-Dc7hVvMC.js.map +0 -1
@@ -0,0 +1,633 @@
1
+ import { jsx as c, jsxs as R, Fragment as te } from "react/jsx-runtime";
2
+ import { c as C } from "react/compiler-runtime";
3
+ import { Tooltip as W, Text as D, Flex as Y, Box as ne, Kbd as Te } from "@chakra-ui/react";
4
+ import { MarkNode as Re } from "@lexical/mark";
5
+ import { LexicalComposer as ce } from "@lexical/react/LexicalComposer";
6
+ import { LexicalErrorBoundary as le } from "@lexical/react/LexicalErrorBoundary";
7
+ import { HistoryPlugin as Oe } from "@lexical/react/LexicalHistoryPlugin";
8
+ import { OnChangePlugin as ae } from "@lexical/react/LexicalOnChangePlugin";
9
+ import { RichTextPlugin as de } from "@lexical/react/LexicalRichTextPlugin";
10
+ import { createCommand as ue, ElementNode as Me, isHTMLElement as $e, $createParagraphNode as X, COMMAND_PRIORITY_LOW as me, $getSelection as Ne, $isRangeSelection as Pe, $isElementNode as Ae, $getRoot as z, KEY_DOWN_COMMAND as we, COMMAND_PRIORITY_HIGH as Le, TextNode as ke, $addUpdateTag as re } from "lexical";
11
+ import { useEffect as B, useImperativeHandle as ve, useState as De, forwardRef as Be, useRef as fe } from "react";
12
+ import { t as Fe, b as pe, T as ge, h as he, s as Ke, f as oe, M as He, e as Je, a as Ue, C as Ge, I as We, E as Ve } from "./markdown-BCfPxNpb.js";
13
+ import { useLexicalComposerContext as M } from "@lexical/react/LexicalComposerContext";
14
+ import { $setBlocksType as je } from "@lexical/selection";
15
+ import { addClassNamesToElement as xe, mergeRegister as Q } from "@lexical/utils";
16
+ import { LexicalTypeaheadMenuPlugin as qe } from "@lexical/react/LexicalTypeaheadMenuPlugin";
17
+ import * as Xe from "react-dom";
18
+ import { S as Ye } from "./scroll-area-BMbg1WcD.js";
19
+ import { ClickableLinkPlugin as ze } from "@lexical/react/LexicalClickableLinkPlugin";
20
+ import { HorizontalRulePlugin as Qe } from "@lexical/react/LexicalHorizontalRulePlugin";
21
+ import { LinkPlugin as Ze } from "@lexical/react/LexicalLinkPlugin";
22
+ import { ListPlugin as et } from "@lexical/react/LexicalListPlugin";
23
+ import { TabIndentationPlugin as tt } from "@lexical/react/LexicalTabIndentationPlugin";
24
+ const nt = "INSERT_REFERENCE", rt = "INSERT_BLOCK", ye = ue(nt), ot = ue(rt);
25
+ function it(n) {
26
+ const e = V();
27
+ return n.style !== null && e.setFormat(n.style.textAlign), {
28
+ node: e
29
+ };
30
+ }
31
+ class K extends Me {
32
+ static getType() {
33
+ return "comment";
34
+ }
35
+ static clone(e) {
36
+ return new K(e.__key);
37
+ }
38
+ createDOM(e) {
39
+ const t = document.createElement("blockquote");
40
+ return xe(t, e.theme.comment), t;
41
+ }
42
+ updateDOM() {
43
+ return !1;
44
+ }
45
+ static importDOM() {
46
+ return {
47
+ blockquote: () => ({
48
+ conversion: it,
49
+ priority: 0
50
+ })
51
+ };
52
+ }
53
+ exportDOM(e) {
54
+ const {
55
+ element: t
56
+ } = super.exportDOM(e);
57
+ if (t && $e(t)) {
58
+ this.isEmpty() && t.append(document.createElement("br"));
59
+ const r = this.getFormatType();
60
+ t.style.textAlign = r;
61
+ const o = this.getDirection();
62
+ o && (t.dir = o);
63
+ }
64
+ return {
65
+ element: t
66
+ };
67
+ }
68
+ static importJSON(e) {
69
+ const t = V();
70
+ return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
71
+ }
72
+ exportJSON() {
73
+ return {
74
+ ...super.exportJSON(),
75
+ type: "comment"
76
+ };
77
+ }
78
+ getTextContent() {
79
+ return `{{! ${super.getTextContent().replace(/([{}])/g, "\\$1")} }}`;
80
+ }
81
+ // mutation
82
+ insertNewAfter(e, t) {
83
+ const r = X(), o = this.getDirection();
84
+ return r.setDirection(o), this.insertAfter(r, t), r;
85
+ }
86
+ collapseAtStart() {
87
+ const e = X();
88
+ return this.getChildren().forEach((r) => {
89
+ e.append(r);
90
+ }), this.replace(e), !0;
91
+ }
92
+ }
93
+ function V() {
94
+ return new K();
95
+ }
96
+ const st = (n, e) => {
97
+ const t = Ne(), r = V();
98
+ if (e) {
99
+ e.getParent()?.replace(r, !0), e.remove(), r.selectEnd();
100
+ return;
101
+ }
102
+ Pe(t) && je(t, V);
103
+ };
104
+ function ct() {
105
+ const n = C(3), [e] = M();
106
+ let t, r;
107
+ return n[0] !== e ? (t = () => Q(e.registerCommand(ot, lt, me)), r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), B(t, r), null;
108
+ }
109
+ function lt(n) {
110
+ const {
111
+ optionId: e,
112
+ nodeToReplace: t
113
+ } = n;
114
+ return st(e, t), !1;
115
+ }
116
+ const at = () => {
117
+ const n = C(3), [e] = M();
118
+ let t, r;
119
+ n[0] !== e ? (t = () => Q(e.registerNodeTransform(K, (o) => {
120
+ const s = o.getChildren().filter(dt);
121
+ s.length > 0 && e.update(() => {
122
+ s.forEach(ut);
123
+ });
124
+ })), r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), B(t, r);
125
+ };
126
+ function dt(n) {
127
+ return n.getType() === "comment";
128
+ }
129
+ function ut(n) {
130
+ n.replace(X(), !0);
131
+ }
132
+ function mt() {
133
+ return at(), ct(), null;
134
+ }
135
+ const ft = (n) => {
136
+ let e = "";
137
+ const t = n.getChildren(), r = t.length;
138
+ for (let o = 0; o < r; o++) {
139
+ const i = t[o];
140
+ e += i.getTextContent(), Ae(i) && o !== r - 1 && !i.isInline() && (e += `
141
+ `);
142
+ }
143
+ return e;
144
+ }, pt = (n) => n.type !== "reference" ? null : `#${n.name ?? n.referenceId ?? ""}`, gt = (n) => n.type === "paragraph" && !!n.children?.length, _e = (n) => {
145
+ if (n.type === "comment")
146
+ return "";
147
+ const e = pt(n);
148
+ if (e !== null)
149
+ return e;
150
+ let t = typeof n.text == "string" ? n.text : "";
151
+ const r = n.children;
152
+ if (!Array.isArray(r)) return t;
153
+ const o = r.length;
154
+ for (let i = 0; i < o; i += 1) {
155
+ const s = r[i];
156
+ if (s.type === "comment") {
157
+ i !== o - 1 && (t += `
158
+ `);
159
+ continue;
160
+ }
161
+ t += _e(s), gt(s) && (t += `
162
+ `);
163
+ }
164
+ return t;
165
+ }, ht = (n) => {
166
+ try {
167
+ const e = JSON.parse(n);
168
+ return _e(e.root ?? {});
169
+ } catch {
170
+ return "";
171
+ }
172
+ }, xt = {
173
+ root: {
174
+ direction: "ltr",
175
+ format: "",
176
+ indent: 0,
177
+ type: "root",
178
+ version: 1,
179
+ children: [{
180
+ type: "paragraph",
181
+ version: 1,
182
+ format: "",
183
+ indent: 0,
184
+ textFormat: void 0,
185
+ direction: null,
186
+ children: []
187
+ }]
188
+ }
189
+ };
190
+ function yt(n = "") {
191
+ return n.trim() ? {
192
+ root: {
193
+ direction: "ltr",
194
+ format: "",
195
+ indent: 0,
196
+ type: "root",
197
+ version: 1,
198
+ children: n.split(/\r?\n/).map((r) => ({
199
+ type: "paragraph",
200
+ version: 1,
201
+ format: "",
202
+ indent: 0,
203
+ textFormat: void 0,
204
+ direction: null,
205
+ children: r ? [{
206
+ type: "text",
207
+ version: 1,
208
+ text: r,
209
+ format: "",
210
+ detail: 0,
211
+ mode: "normal",
212
+ style: ""
213
+ }] : []
214
+ }))
215
+ }
216
+ } : JSON.parse(JSON.stringify(xt));
217
+ }
218
+ function _t(n) {
219
+ const e = C(4), {
220
+ editorRef: t,
221
+ previousTextRef: r
222
+ } = n, [o] = M();
223
+ let i, s;
224
+ return e[0] !== o || e[1] !== r ? (i = () => ({
225
+ setEditorValue: (a) => {
226
+ const l = o.parseEditorState(JSON.stringify(yt(a)), Et);
227
+ o.setEditorState(l), r.current = a, o.focus();
228
+ }
229
+ }), s = [o, r], e[0] = o, e[1] = r, e[2] = i, e[3] = s) : (i = e[2], s = e[3]), ve(t, i, s), null;
230
+ }
231
+ function Et() {
232
+ z().selectEnd();
233
+ }
234
+ const bt = (n) => n.key !== "Enter" ? !1 : !n.ctrlKey && !n.metaKey && !n.shiftKey && !n.altKey, St = (n) => n.key === "ArrowUp" && !n.ctrlKey && !n.metaKey && !n.shiftKey && !n.altKey, Ct = (n) => n.key === "ArrowDown" && !n.ctrlKey && !n.metaKey && !n.shiftKey && !n.altKey;
235
+ function It(n) {
236
+ const e = C(6), {
237
+ onSubmit: t,
238
+ onRecallPrevious: r,
239
+ onRecallNext: o
240
+ } = n, [i] = M();
241
+ let s, a;
242
+ return e[0] !== i || e[1] !== o || e[2] !== r || e[3] !== t ? (s = () => i.registerCommand(we, (l) => bt(l) ? (l.preventDefault(), t?.(), !0) : St(l) && r?.() || Ct(l) && o?.() ? (l.preventDefault(), !0) : !1, Le), a = [i, t, r, o], e[0] = i, e[1] = o, e[2] = r, e[3] = t, e[4] = s, e[5] = a) : (s = e[4], a = e[5]), B(s, a), null;
243
+ }
244
+ const ie = ["table", "connector"], Tt = (n) => n.sort((r, o) => ie.indexOf(r.group) - ie.indexOf(o.group)).map((r, o) => ({
245
+ ...r,
246
+ index: o
247
+ })).reduce((r, o) => {
248
+ const i = r[o.group] ?? [];
249
+ return i.push(o), r[o.group] = i, r;
250
+ }, {});
251
+ function se(n) {
252
+ const e = C(22), {
253
+ id: t,
254
+ isSelected: r,
255
+ onClick: o,
256
+ onMouseEnter: i,
257
+ setRefElement: s,
258
+ secondaryLabel: a,
259
+ primaryLabel: l,
260
+ tabIndex: g
261
+ } = n, f = g === void 0 ? -1 : g, y = r ? "bg.active" : "transparent", d = r ? "bg.active" : "bg.hover";
262
+ let m;
263
+ e[0] !== d ? (m = {
264
+ bg: d
265
+ }, e[0] = d, e[1] = m) : m = e[1];
266
+ let p;
267
+ e[2] !== l ? (p = /* @__PURE__ */ c(W.Trigger, { children: /* @__PURE__ */ c(D, { mt: "1px", lineClamp: 1, textOverflow: "ellipsis", textStyle: "label/M/regular", children: l }) }), e[2] = l, e[3] = p) : p = e[3];
268
+ let h;
269
+ e[4] !== l ? (h = /* @__PURE__ */ c(W.Positioner, { children: /* @__PURE__ */ c(W.Content, { children: l }) }), e[4] = l, e[5] = h) : h = e[5];
270
+ let x;
271
+ e[6] !== p || e[7] !== h ? (x = /* @__PURE__ */ R(W.Root, { children: [
272
+ p,
273
+ h
274
+ ] }), e[6] = p, e[7] = h, e[8] = x) : x = e[8];
275
+ let _;
276
+ e[9] !== a ? (_ = a && /* @__PURE__ */ c(D, { lineClamp: 2, textOverflow: "ellipsis", textStyle: "label/S/regular", color: "fg.muted", children: a }), e[9] = a, e[10] = _) : _ = e[10];
277
+ let b;
278
+ return e[11] !== t || e[12] !== r || e[13] !== o || e[14] !== i || e[15] !== s || e[16] !== y || e[17] !== m || e[18] !== x || e[19] !== _ || e[20] !== f ? (b = /* @__PURE__ */ R(Y, { direction: "column", cursor: "pointer", gap: "2xs", padding: "2xs", paddingX: "sm", bg: y, _hover: m, tabIndex: f, ref: s, role: "option", "aria-selected": r, id: t, onMouseEnter: i, onClick: o, children: [
279
+ x,
280
+ _
281
+ ] }), e[11] = t, e[12] = r, e[13] = o, e[14] = i, e[15] = s, e[16] = y, e[17] = m, e[18] = x, e[19] = _, e[20] = f, e[21] = b) : b = e[21], b;
282
+ }
283
+ const Rt = (n) => {
284
+ const e = C(12), {
285
+ options: t,
286
+ selectedIndex: r,
287
+ onSelectItem: o,
288
+ onMouseEnterItem: i
289
+ } = n, {
290
+ table: s,
291
+ connector: a
292
+ } = Tt(t), l = s === void 0 ? [] : s, g = a === void 0 ? [] : a, f = [...l, ...g].length;
293
+ let y, d;
294
+ e[0] !== r ? (y = () => {
295
+ document.getElementById(`typeahead-item-${r}`)?.scrollIntoView({
296
+ behavior: "instant",
297
+ block: "nearest"
298
+ });
299
+ }, d = [r], e[0] = r, e[1] = y, e[2] = d) : (y = e[1], d = e[2]), B(y, d);
300
+ const m = Ye, p = "1000", h = "absolute", x = "modal", _ = "24rem", b = !1;
301
+ let E;
302
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = {
303
+ base: "100vw",
304
+ md: "264px"
305
+ }, e[3] = E) : E = e[3];
306
+ let S;
307
+ e[4] !== f ? (S = !f && /* @__PURE__ */ c(D, { children: "No results" }), e[4] = f, e[5] = S) : S = e[5];
308
+ const T = !!l.length && /* @__PURE__ */ R(te, { children: [
309
+ /* @__PURE__ */ c(D, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Tables" }),
310
+ /* @__PURE__ */ c(ne, { children: l.map((u) => /* @__PURE__ */ c(se, { id: `typeahead-item-${u.index}`, isSelected: r === u.index, onClick: () => o(u, u.index), onMouseEnter: () => i(u.index), primaryLabel: u.name, secondaryLabel: u.description, setRefElement: u.setRefElement, tabIndex: -1 }, u.id)) })
311
+ ] }), O = !!g.length && /* @__PURE__ */ R(te, { children: [
312
+ /* @__PURE__ */ c(D, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Data Sources" }),
313
+ /* @__PURE__ */ c(ne, { children: g.map((u) => /* @__PURE__ */ c(se, { id: `typeahead-item-${u.index}`, isSelected: r === u.index, onClick: () => o(u, u.index), onMouseEnter: () => i(u.index), primaryLabel: u.name, secondaryLabel: u.description, setRefElement: u.setRefElement, tabIndex: -1 }, u.id)) })
314
+ ] });
315
+ let I;
316
+ return e[6] !== m || e[7] !== S || e[8] !== T || e[9] !== O || e[10] !== E ? (I = /* @__PURE__ */ R(m, { zIndex: p, position: h, layerStyle: x, maxHeight: _, showHorizontalScrollbar: b, minWidth: E, children: [
317
+ S,
318
+ T,
319
+ O
320
+ ] }), e[6] = m, e[7] = S, e[8] = T, e[9] = O, e[10] = E, e[11] = I) : I = e[11], I;
321
+ }, Ot = (n, e) => n.filter((t) => t.name.replace(/ /g, "_").toLowerCase().includes(e.toLowerCase()));
322
+ function Mt(n, e = []) {
323
+ const t = e.map((r, o) => ({
324
+ id: r.resourceId,
325
+ key: r.resourceId,
326
+ index: o,
327
+ group: r.resourceType,
328
+ name: r.name,
329
+ description: r.description,
330
+ setRefElement: () => {
331
+ }
332
+ }));
333
+ return n == null || n === "" ? t : Ot(t, n);
334
+ }
335
+ const Ee = "\\.\\-<>_:", Z = ["#"].join(""), be = `[^${Z}${Ee}\\s]`, $t = `(?:[${Ee}]|)`, Se = 75, Nt = new RegExp(`(^|\\s|\\()([${Z}]((?:${be}${$t}){0,${Se}}))$`), Pt = new RegExp(`(^|\\s|\\()([${Z}]((?:${be}){0,${Se}}))$`);
336
+ function At(n, e) {
337
+ let t = Nt.exec(n);
338
+ if (t === null && (t = Pt.exec(n)), t !== null) {
339
+ const r = t[1], o = t[3];
340
+ if (o.length >= e)
341
+ return {
342
+ leadOffset: t.index + r.length,
343
+ matchingString: o,
344
+ replaceableString: t[2]
345
+ };
346
+ }
347
+ return null;
348
+ }
349
+ const wt = 20;
350
+ function Lt(n) {
351
+ const e = C(9), {
352
+ items: t
353
+ } = n;
354
+ let r;
355
+ e[0] !== t ? (r = t === void 0 ? [] : t, e[0] = t, e[1] = r) : r = e[1];
356
+ const o = r, [i, s] = De(null), [a] = M(), l = Mt(i, o);
357
+ let g;
358
+ e[2] !== a ? (g = (h, x, _) => {
359
+ a.update(() => {
360
+ x && (a.dispatchCommand(ye, {
361
+ resourceId: h.id,
362
+ resourceType: h.group,
363
+ name: h.name,
364
+ nodeToReplace: x
365
+ }), _());
366
+ });
367
+ }, e[2] = a, e[3] = g) : g = e[3];
368
+ const f = g, y = vt;
369
+ let d;
370
+ e[4] !== l ? (d = l.slice(0, wt), e[4] = l, e[5] = d) : d = e[5];
371
+ const m = d;
372
+ let p;
373
+ return e[6] !== m || e[7] !== f ? (p = /* @__PURE__ */ c(qe, { onQueryChange: s, onSelectOption: f, triggerFn: y, options: m, menuRenderFn: kt }), e[6] = m, e[7] = f, e[8] = p) : p = e[8], p;
374
+ }
375
+ function kt(n, e) {
376
+ const {
377
+ options: t,
378
+ selectedIndex: r,
379
+ selectOptionAndCleanUp: o,
380
+ setHighlightedIndex: i
381
+ } = e;
382
+ return n.current ? Xe.createPortal(/* @__PURE__ */ c(Rt, { options: t, selectedIndex: r, onSelectItem: (s, a) => {
383
+ i(a), o(s);
384
+ }, onMouseEnterItem: (s) => {
385
+ i(s);
386
+ } }), n.current) : null;
387
+ }
388
+ function vt(n) {
389
+ return At(n, 0);
390
+ }
391
+ class F extends ke {
392
+ __referenceId;
393
+ __name;
394
+ static getType() {
395
+ return "reference";
396
+ }
397
+ static clone(e) {
398
+ return new F(e.__referenceId, e.__name, e.__key);
399
+ }
400
+ constructor(e, t, r) {
401
+ super(t, r), this.__referenceId = e, this.__name = t;
402
+ }
403
+ isKeyboardSelectable() {
404
+ return !1;
405
+ }
406
+ canBeEmpty() {
407
+ return !1;
408
+ }
409
+ canInsertTextAfter() {
410
+ return !1;
411
+ }
412
+ canInsertTextBefore() {
413
+ return !1;
414
+ }
415
+ createDOM(e) {
416
+ const t = document.createElement("span");
417
+ return xe(t, e.theme.reference), t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, t;
418
+ }
419
+ updateDOM(e, t) {
420
+ 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;
421
+ }
422
+ exportDOM(e) {
423
+ const t = document.createElement("span");
424
+ return t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, {
425
+ element: t
426
+ };
427
+ }
428
+ static importDOM() {
429
+ return {
430
+ span: (e) => !e.hasAttribute("data-reference-id") || !e.hasAttribute("data-name") ? null : {
431
+ conversion: Dt,
432
+ priority: 1
433
+ }
434
+ };
435
+ }
436
+ static importJSON(e) {
437
+ return new F(e.referenceId, e.name);
438
+ }
439
+ exportJSON() {
440
+ return {
441
+ ...super.exportJSON(),
442
+ type: "reference",
443
+ referenceId: this.__referenceId,
444
+ name: this.__name
445
+ };
446
+ }
447
+ getTextContent() {
448
+ return `#${this.__name}`;
449
+ }
450
+ }
451
+ function Dt(n) {
452
+ const e = n.getAttribute("data-reference-id"), t = n.getAttribute("data-name");
453
+ return !e || !t ? null : {
454
+ node: Ce(e, t)
455
+ };
456
+ }
457
+ function Ce(n, e) {
458
+ return new F(n, e);
459
+ }
460
+ const Bt = (n, e, t) => {
461
+ const r = Ce(e, t);
462
+ if (n) {
463
+ n?.replace(r), n.remove(), r.selectEnd();
464
+ return;
465
+ }
466
+ };
467
+ function Ft(n) {
468
+ const e = C(4), {
469
+ onAddReference: t
470
+ } = n, [r] = M();
471
+ let o, i;
472
+ return e[0] !== r || e[1] !== t ? (o = () => Q(r.registerCommand(ye, (s) => {
473
+ const {
474
+ resourceId: a,
475
+ resourceType: l,
476
+ name: g,
477
+ nodeToReplace: f
478
+ } = s;
479
+ return r.update(() => {
480
+ Bt(f, a, g);
481
+ }), t?.(a, l), !0;
482
+ }, me)), i = [r, t], e[0] = r, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), B(o, i), null;
483
+ }
484
+ const Kt = {
485
+ ...Fe,
486
+ // Override paragraph class to remove margins specifically for prompt input
487
+ paragraph: "rich-text__p rich-text__p--no-margin"
488
+ }, Ht = [K, Re, F], Jt = (n, e) => {
489
+ const t = C(41), {
490
+ defaultState: r,
491
+ debug: o,
492
+ isEditable: i,
493
+ placeholder: s
494
+ } = n, a = o === void 0 ? !1 : o, l = i === void 0 ? !0 : i, {
495
+ onChange: g,
496
+ onError: f,
497
+ onSubmit: y,
498
+ onRecallPrevious: d,
499
+ onRecallNext: m,
500
+ references: p,
501
+ onAddReference: h
502
+ } = n, x = f === void 0 ? Ut : f;
503
+ let _;
504
+ t[0] !== p ? (_ = p === void 0 ? [] : p, t[0] = p, t[1] = _) : _ = t[1];
505
+ const b = _;
506
+ let E;
507
+ t[2] !== r || t[3] !== l || t[4] !== x ? (E = {
508
+ namespace: "PROMPT_EDITOR",
509
+ nodes: Ht,
510
+ editorState: r,
511
+ editable: l,
512
+ onError: x,
513
+ theme: Kt
514
+ }, t[2] = r, t[3] = l, t[4] = x, t[5] = E) : E = t[5];
515
+ const S = E;
516
+ let T;
517
+ t[6] !== r ? (T = ht(r), t[6] = r, t[7] = T) : T = t[7];
518
+ const O = fe(T);
519
+ let I;
520
+ t[8] !== s ? (I = s ?? /* @__PURE__ */ R(D, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: [
521
+ "Type your query here or press ",
522
+ /* @__PURE__ */ c(Te, { color: "fg.subtle", children: "#" }),
523
+ " to add a reference."
524
+ ] }), t[8] = s, t[9] = I) : I = t[9];
525
+ const u = I;
526
+ let H;
527
+ t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ c(Oe, {}), t[10] = H) : H = t[10];
528
+ let J;
529
+ t[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (J = /* @__PURE__ */ c(pe, { fullWidth: !0 }), t[11] = J) : J = t[11];
530
+ let $;
531
+ t[12] !== u ? ($ = /* @__PURE__ */ c(de, { contentEditable: J, placeholder: u, ErrorBoundary: le }), t[12] = u, t[13] = $) : $ = t[13];
532
+ let N;
533
+ t[14] !== g ? (N = /* @__PURE__ */ c(ae, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (ee) => {
534
+ ee.read(() => {
535
+ const Ie = z(), j = ft(Ie);
536
+ j !== O.current && (O.current = j, g?.(j, ee.toJSON()));
537
+ });
538
+ } }), t[14] = g, t[15] = N) : N = t[15];
539
+ let P;
540
+ t[16] !== e ? (P = /* @__PURE__ */ c(_t, { editorRef: e, previousTextRef: O }), t[16] = e, t[17] = P) : P = t[17];
541
+ let A;
542
+ t[18] !== l ? (A = /* @__PURE__ */ c(ge, { isEditable: l }), t[18] = l, t[19] = A) : A = t[19];
543
+ let U;
544
+ t[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ c(mt, {}), t[20] = U) : U = t[20];
545
+ let w;
546
+ t[21] !== m || t[22] !== d || t[23] !== y ? (w = /* @__PURE__ */ c(It, { onSubmit: y, onRecallPrevious: d, onRecallNext: m }), t[21] = m, t[22] = d, t[23] = y, t[24] = w) : w = t[24];
547
+ let L;
548
+ t[25] !== b ? (L = /* @__PURE__ */ c(Lt, { items: b }), t[25] = b, t[26] = L) : L = t[26];
549
+ let k;
550
+ t[27] !== h ? (k = /* @__PURE__ */ c(Ft, { onAddReference: h }), t[27] = h, t[28] = k) : k = t[28];
551
+ let v;
552
+ t[29] !== a ? (v = a ? /* @__PURE__ */ c(he, {}) : "", t[29] = a, t[30] = v) : v = t[30];
553
+ let G;
554
+ return t[31] !== S || t[32] !== $ || t[33] !== N || t[34] !== P || t[35] !== A || t[36] !== w || t[37] !== L || t[38] !== k || t[39] !== v ? (G = /* @__PURE__ */ c(Y, { direction: "column", justifyContent: "space-between", width: "100%", position: "relative", children: /* @__PURE__ */ R(ce, { initialConfig: S, children: [
555
+ H,
556
+ $,
557
+ N,
558
+ P,
559
+ A,
560
+ U,
561
+ w,
562
+ L,
563
+ k,
564
+ v
565
+ ] }) }), t[31] = S, t[32] = $, t[33] = N, t[34] = P, t[35] = A, t[36] = w, t[37] = L, t[38] = k, t[39] = v, t[40] = G) : G = t[40], G;
566
+ }, pn = Be(Jt);
567
+ function Ut() {
568
+ }
569
+ function Gt(n) {
570
+ const e = C(5), {
571
+ value: t,
572
+ onUpdate: r
573
+ } = n, [o] = M();
574
+ let i, s;
575
+ return e[0] !== o || e[1] !== r || e[2] !== t ? (i = () => {
576
+ o && o.update(() => r(t), {
577
+ tag: "history-merge"
578
+ });
579
+ }, 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]), B(i, s), null;
580
+ }
581
+ const q = "markdown-source-import";
582
+ function gn(n) {
583
+ const {
584
+ debug: e = !1,
585
+ defaultState: t = "",
586
+ fullWidth: r = !1,
587
+ isEditable: o = !1,
588
+ resolveMarkdownUrl: i,
589
+ onChange: s
590
+ } = n, {
591
+ frontmatter: a,
592
+ body: l
593
+ } = Ke(t), g = o && !!s, f = fe(null);
594
+ return f.current ??= oe(l, i), /* @__PURE__ */ c(Y, { className: "rich-text", "data-rich-message": "true", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "hidden", children: /* @__PURE__ */ c(He, { resolver: i, children: /* @__PURE__ */ R(ce, { initialConfig: {
595
+ namespace: "RICH_MESSAGE",
596
+ nodes: Ue,
597
+ editorState: () => {
598
+ re(q), f.current?.importToLexical();
599
+ },
600
+ onError: (d) => console.error(d),
601
+ editable: o,
602
+ theme: Je
603
+ }, children: [
604
+ /* @__PURE__ */ c(Gt, { value: l, onUpdate: (d) => {
605
+ const m = oe(d, i);
606
+ f.current = m, re(q), m.importToLexical();
607
+ } }),
608
+ /* @__PURE__ */ c(Ze, {}),
609
+ /* @__PURE__ */ c(ze, { newTab: !0 }),
610
+ /* @__PURE__ */ c(et, {}),
611
+ o ? /* @__PURE__ */ c(tt, { maxIndent: 7 }) : null,
612
+ /* @__PURE__ */ c(Qe, {}),
613
+ /* @__PURE__ */ c(Ge, {}),
614
+ /* @__PURE__ */ c(We, {}),
615
+ /* @__PURE__ */ c(Ve, {}),
616
+ /* @__PURE__ */ c(de, { contentEditable: /* @__PURE__ */ c(pe, { fullWidth: r, isRichMessage: !0 }), ErrorBoundary: le }),
617
+ g ? /* @__PURE__ */ c(ae, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (d, m, p) => {
618
+ p.has(q) || d.read(() => {
619
+ const h = z(), x = f.current?.exportFromLexical(h) ?? "";
620
+ s?.(a + x);
621
+ });
622
+ } }) : null,
623
+ /* @__PURE__ */ c(ge, { isEditable: o }),
624
+ e && /* @__PURE__ */ c(he, {})
625
+ ] }) }) });
626
+ }
627
+ export {
628
+ pn as P,
629
+ gn as R,
630
+ ht as a,
631
+ yt as g
632
+ };
633
+ //# sourceMappingURL=rich-message-q6Y6QJOq.js.map