@chaibuilder/pages 0.16.13 → 0.16.14

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 (83) hide show
  1. package/dist/{2AITGKQY-D1mM4eEh.js → 2AITGKQY-B7xwscsX.js} +2 -2
  2. package/dist/{2AITGKQY-AK2WgbeT.cjs → 2AITGKQY-B9AnRLq_.cjs} +1 -1
  3. package/dist/{NCMVHL6D-BeRsWdGV.js → NCMVHL6D-B1mwht0Q.js} +4 -4
  4. package/dist/{NCMVHL6D-DItDf9IY.cjs → NCMVHL6D-CRMC-wXy.cjs} +1 -1
  5. package/dist/{ZDWCUMSJ-COSBY-at.cjs → ZDWCUMSJ-BqqPEOij.cjs} +1 -1
  6. package/dist/{ZDWCUMSJ-D6caRaY7.js → ZDWCUMSJ-CxKNtXtp.js} +1 -1
  7. package/dist/{add-new-language-page-CQcFi0Tp.cjs → add-new-language-page-D2a6GK-7.cjs} +1 -1
  8. package/dist/{add-new-language-page-nnaUe-qk.js → add-new-language-page-DD0qvJJs.js} +2 -2
  9. package/dist/{add-new-page-DxObnvo_.cjs → add-new-page-01GDCaa4.cjs} +1 -1
  10. package/dist/{add-new-page-Ba1fq6LH.js → add-new-page-CYtuChN1.js} +1 -1
  11. package/dist/ai-panel-content-DfdnvlS8.js +123 -0
  12. package/dist/ai-panel-content-Ouz6pu_0.cjs +1 -0
  13. package/dist/ai-panel-default-lang-Bi2fH1so.js +317 -0
  14. package/dist/ai-panel-default-lang-N1pb8rzQ.cjs +3 -0
  15. package/dist/{ai-panel-other-lang-B4euTuod.js → ai-panel-other-lang-2JPRSyO1.js} +10 -9
  16. package/dist/ai-panel-other-lang-BysU1464.cjs +1 -0
  17. package/dist/ai-prompt-input-DadL_cng.js +1071 -0
  18. package/dist/ai-prompt-input-JeIqWZco.cjs +1 -0
  19. package/dist/{ai-translation-prompt-CVuPbgXw.js → ai-translation-prompt-B0si-R0R.js} +1 -1
  20. package/dist/{ai-translation-prompt-Ip7w2_Ey.cjs → ai-translation-prompt-CQb1L7NM.cjs} +1 -1
  21. package/dist/{delete-page-CbY8q5M3.cjs → delete-page-C8Nt7IYF.cjs} +1 -1
  22. package/dist/{delete-page-SX9X35nA.js → delete-page-_96Di9yN.js} +1 -1
  23. package/dist/{digital-asset-manager-CIMo79Di.cjs → digital-asset-manager-B5FQGtGY.cjs} +1 -1
  24. package/dist/{digital-asset-manager-SAFNO_mx.js → digital-asset-manager-jfnmWRJj.js} +1 -1
  25. package/dist/{duplicate-page-CXK2HcxD.cjs → duplicate-page-BNjfZ7Wd.cjs} +1 -1
  26. package/dist/{duplicate-page-5SwLvmkX.js → duplicate-page-CERjaPIW.js} +9 -9
  27. package/dist/{dynamic-page-selector-Crd3y4Hk.cjs → dynamic-page-selector-Bpz_bvRu.cjs} +1 -1
  28. package/dist/{dynamic-page-selector-DfcuTqRN.js → dynamic-page-selector-XEWV4iCf.js} +1 -1
  29. package/dist/{index-Bz7smSC0.cjs → index-Pdb5tSRL.cjs} +2 -2
  30. package/dist/{index-EnM7J19_.js → index-e9WlBH0R.js} +70 -70
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.js +4 -4
  33. package/dist/{json-diff-viewer-CDwpbuag.js → json-diff-viewer-DyvKomxd.js} +1 -1
  34. package/dist/{json-diff-viewer-D34kDA_c.cjs → json-diff-viewer-H-2DkGza.cjs} +1 -1
  35. package/dist/{lang-panel-CUIeO5bb.js → lang-panel-BWP5A-FD.js} +2 -2
  36. package/dist/{lang-panel-CaFrYllL.cjs → lang-panel-DcZ7u4em.cjs} +1 -1
  37. package/dist/{mark-as-template-D0dLQaIB.js → mark-as-template-1oVraE1x.js} +1 -1
  38. package/dist/{mark-as-template-v182tmN6.cjs → mark-as-template-B_FyVRRO.cjs} +1 -1
  39. package/dist/{no-language-page-content-ByRFD_qA.js → no-language-page-content-CEci_4j7.js} +1 -1
  40. package/dist/{no-language-page-content-Bk4fEx_p.cjs → no-language-page-content-JO4YYUx7.cjs} +1 -1
  41. package/dist/{page-creator-BnvaGZVI.cjs → page-creator-BGgoOA92.cjs} +1 -1
  42. package/dist/{page-creator-Bh0IUGR3.js → page-creator-DJJFl7px.js} +2 -2
  43. package/dist/{page-lock-request-C2b1kqyA.cjs → page-lock-request-BoYzkcyt.cjs} +1 -1
  44. package/dist/{page-lock-request-CaNqxfD6.js → page-lock-request-WzpcD2ZN.js} +6 -6
  45. package/dist/{page-locked-by-dialog--WLDdkw9.js → page-locked-by-dialog-Djvjp2Hx.js} +1 -1
  46. package/dist/{page-locked-by-dialog-90ElC8aG.cjs → page-locked-by-dialog-bvI27OZ6.cjs} +1 -1
  47. package/dist/{page-manager-new-SNRQn7Az.cjs → page-manager-new-CMfGorRQ.cjs} +1 -1
  48. package/dist/{page-manager-new-Bo4-zwfW.js → page-manager-new-DmVX0qLk.js} +14 -14
  49. package/dist/{page-manager-search-and-filter-BETHSa3y.js → page-manager-search-and-filter-DbUoW8Di.js} +1 -1
  50. package/dist/{page-manager-search-and-filter-hyUIHOD_.cjs → page-manager-search-and-filter-Dgh8iyGp.cjs} +1 -1
  51. package/dist/{page-revisions-content-BCMjvZRZ.cjs → page-revisions-content-CwoXXE53.cjs} +1 -1
  52. package/dist/{page-revisions-content-VWthKL7O.js → page-revisions-content-CxEJGxLY.js} +18 -18
  53. package/dist/pages.css +1 -1
  54. package/dist/{publish-pages-content-CaBwfekc.cjs → publish-pages-content-BRu7qwAo.cjs} +1 -1
  55. package/dist/{publish-pages-content-6N7aEcM1.js → publish-pages-content-CfAlmivf.js} +6 -6
  56. package/dist/{save-to-lib-YYBxY7MV.js → save-to-lib-BCaBfh0I.js} +1 -1
  57. package/dist/{save-to-lib-CtGpDkC6.cjs → save-to-lib-DpyJA0y1.cjs} +1 -1
  58. package/dist/{selected-block-display-DdW-DWF1.js → selected-block-display-BmNhvYKu.js} +1 -1
  59. package/dist/{selected-block-display-BEbuJn0l.cjs → selected-block-display-CqnwyGRp.cjs} +1 -1
  60. package/dist/{seo-panel-CqJDhbj-.js → seo-panel-BH8fcGqr.js} +1 -1
  61. package/dist/{seo-panel-B9P7fXjo.cjs → seo-panel-D-nKfsRJ.cjs} +1 -1
  62. package/dist/server.cjs +1 -1
  63. package/dist/server.js +39 -39
  64. package/dist/{shared-json-ld-CyxmC9y5.cjs → shared-json-ld-m_OsVv8h.cjs} +1 -1
  65. package/dist/{shared-json-ld-DxEPILj_.js → shared-json-ld-zTDoJzUv.js} +1 -1
  66. package/dist/{slug-input-j5z5ZQn9.js → slug-input-CumDDlCk.js} +1 -1
  67. package/dist/{slug-input-RNiSrU3p.cjs → slug-input-vzNtu37S.cjs} +1 -1
  68. package/dist/{theme-panel-footer-CCsiDIVl.cjs → theme-panel-footer-CKccBcd9.cjs} +1 -1
  69. package/dist/{theme-panel-footer-DD2yalfG.js → theme-panel-footer-CdUmjB-e.js} +1 -1
  70. package/dist/{unmark-as-template-B2hKhAHn.js → unmark-as-template-6ew-7bf8.js} +1 -1
  71. package/dist/{unmark-as-template-DXjLbqOM.cjs → unmark-as-template-BNFOsxIg.cjs} +1 -1
  72. package/dist/{unpublish-page-BdJScWMX.cjs → unpublish-page-BZQpTpU3.cjs} +1 -1
  73. package/dist/{unpublish-page-BvB1PGSz.js → unpublish-page-BomE76Wg.js} +1 -1
  74. package/dist/{web-preview-BI4jd0O7.cjs → web-preview-C5QTX7bS.cjs} +1 -1
  75. package/dist/{web-preview-CwVpkcwU.js → web-preview-jo8lnpEx.js} +1 -1
  76. package/package.json +1 -1
  77. package/dist/ai-panel-content-B2AgBWqo.cjs +0 -1
  78. package/dist/ai-panel-content-M1UnzG_f.js +0 -54
  79. package/dist/ai-panel-default-lang-CHOFEwmV.js +0 -313
  80. package/dist/ai-panel-default-lang-sy6vkQJh.cjs +0 -3
  81. package/dist/ai-panel-other-lang-BwjSDD3L.cjs +0 -1
  82. package/dist/ai-prompt-input-B_NRADBT.js +0 -988
  83. package/dist/ai-prompt-input-DcyVXcLG.cjs +0 -1
@@ -0,0 +1,1071 @@
1
+ import { jsx as t, jsxs as c, Fragment as Ce } from "react/jsx-runtime";
2
+ import { j as s, B as $ } from "./selected-block-display-BmNhvYKu.js";
3
+ import * as p from "react";
4
+ import { createContext as X, Fragment as Te, useRef as B, useEffect as j, useState as A, useCallback as V, useMemo as Pe, Children as Le, useContext as Y } from "react";
5
+ import { Command as D } from "cmdk";
6
+ import { X as Ae, Search as Me, ChevronRight as je, Check as ae, Circle as _e, ChevronDown as ne, ChevronUp as Ue, PaperclipIcon as Oe, XIcon as oe, ImageIcon as Be, PlusIcon as Fe, MicIcon as Ge, CornerDownLeftIcon as Ee, Loader2Icon as Ve, SquareIcon as He, Cpu as We, Paperclip as qe, GlobeIcon as Ke, Square as $e, Send as Xe } from "lucide-react";
7
+ import * as C from "@radix-ui/react-dialog";
8
+ import * as w from "@radix-ui/react-dropdown-menu";
9
+ import * as H from "@radix-ui/react-hover-card";
10
+ import { cva as re } from "class-variance-authority";
11
+ import * as S from "@radix-ui/react-select";
12
+ import { useTranslation as Ye } from "@chaibuilder/sdk";
13
+ import { a as Je, g as K, A as Qe } from "./ai-panel-content-DfdnvlS8.js";
14
+ const Ze = C.Root, et = C.Trigger, tt = C.Portal, se = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
15
+ C.Overlay,
16
+ {
17
+ ref: n,
18
+ className: s(
19
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
20
+ e
21
+ ),
22
+ ...a
23
+ }
24
+ ));
25
+ se.displayName = C.Overlay.displayName;
26
+ const ie = p.forwardRef(({ className: e, children: a, ...n }, o) => /* @__PURE__ */ c(tt, { children: [
27
+ /* @__PURE__ */ t(se, {}),
28
+ /* @__PURE__ */ c(
29
+ C.Content,
30
+ {
31
+ ref: o,
32
+ className: s(
33
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
34
+ e
35
+ ),
36
+ ...n,
37
+ children: [
38
+ a,
39
+ /* @__PURE__ */ c(C.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
40
+ /* @__PURE__ */ t(Ae, { className: "h-4 w-4" }),
41
+ /* @__PURE__ */ t("span", { className: "sr-only", children: "Close" })
42
+ ] })
43
+ ]
44
+ }
45
+ )
46
+ ] }));
47
+ ie.displayName = C.Content.displayName;
48
+ const le = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
49
+ C.Title,
50
+ {
51
+ ref: n,
52
+ className: s(
53
+ "text-lg font-semibold leading-none tracking-tight",
54
+ e
55
+ ),
56
+ ...a
57
+ }
58
+ ));
59
+ le.displayName = C.Title.displayName;
60
+ const at = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
61
+ C.Description,
62
+ {
63
+ ref: n,
64
+ className: s("text-sm text-muted-foreground", e),
65
+ ...a
66
+ }
67
+ ));
68
+ at.displayName = C.Description.displayName;
69
+ const de = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
70
+ D,
71
+ {
72
+ ref: n,
73
+ className: s(
74
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
75
+ e
76
+ ),
77
+ ...a
78
+ }
79
+ ));
80
+ de.displayName = D.displayName;
81
+ const ce = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ c("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
82
+ /* @__PURE__ */ t(Me, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
83
+ /* @__PURE__ */ t(
84
+ D.Input,
85
+ {
86
+ ref: n,
87
+ className: s(
88
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
89
+ e
90
+ ),
91
+ ...a
92
+ }
93
+ )
94
+ ] }));
95
+ ce.displayName = D.Input.displayName;
96
+ const ue = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
97
+ D.List,
98
+ {
99
+ ref: n,
100
+ className: s("max-h-[300px] overflow-y-auto overflow-x-hidden", e),
101
+ ...a
102
+ }
103
+ ));
104
+ ue.displayName = D.List.displayName;
105
+ const nt = p.forwardRef((e, a) => /* @__PURE__ */ t(
106
+ D.Empty,
107
+ {
108
+ ref: a,
109
+ className: "py-6 text-center text-sm",
110
+ ...e
111
+ }
112
+ ));
113
+ nt.displayName = D.Empty.displayName;
114
+ const me = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
115
+ D.Group,
116
+ {
117
+ ref: n,
118
+ className: s(
119
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
120
+ e
121
+ ),
122
+ ...a
123
+ }
124
+ ));
125
+ me.displayName = D.Group.displayName;
126
+ const ot = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
127
+ D.Separator,
128
+ {
129
+ ref: n,
130
+ className: s("-mx-1 h-px bg-border", e),
131
+ ...a
132
+ }
133
+ ));
134
+ ot.displayName = D.Separator.displayName;
135
+ const pe = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
136
+ D.Item,
137
+ {
138
+ ref: n,
139
+ className: s(
140
+ "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
141
+ e
142
+ ),
143
+ ...a
144
+ }
145
+ ));
146
+ pe.displayName = D.Item.displayName;
147
+ const rt = w.Root, st = w.Trigger, it = p.forwardRef(({ className: e, inset: a, children: n, ...o }, l) => /* @__PURE__ */ c(
148
+ w.SubTrigger,
149
+ {
150
+ ref: l,
151
+ className: s(
152
+ "flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
153
+ a && "pl-8",
154
+ e
155
+ ),
156
+ ...o,
157
+ children: [
158
+ n,
159
+ /* @__PURE__ */ t(je, { className: "ml-auto" })
160
+ ]
161
+ }
162
+ ));
163
+ it.displayName = w.SubTrigger.displayName;
164
+ const lt = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
165
+ w.SubContent,
166
+ {
167
+ ref: n,
168
+ className: s(
169
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
170
+ e
171
+ ),
172
+ ...a
173
+ }
174
+ ));
175
+ lt.displayName = w.SubContent.displayName;
176
+ const fe = p.forwardRef(({ className: e, sideOffset: a = 4, ...n }, o) => /* @__PURE__ */ t(w.Portal, { children: /* @__PURE__ */ t(
177
+ w.Content,
178
+ {
179
+ ref: o,
180
+ sideOffset: a,
181
+ className: s(
182
+ "z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
183
+ e
184
+ ),
185
+ ...n
186
+ }
187
+ ) }));
188
+ fe.displayName = w.Content.displayName;
189
+ const ge = p.forwardRef(({ className: e, inset: a, ...n }, o) => /* @__PURE__ */ t(
190
+ w.Item,
191
+ {
192
+ ref: o,
193
+ className: s(
194
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
195
+ a && "pl-8",
196
+ e
197
+ ),
198
+ ...n
199
+ }
200
+ ));
201
+ ge.displayName = w.Item.displayName;
202
+ const dt = p.forwardRef(({ className: e, children: a, checked: n, ...o }, l) => /* @__PURE__ */ c(
203
+ w.CheckboxItem,
204
+ {
205
+ ref: l,
206
+ className: s(
207
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
208
+ e
209
+ ),
210
+ checked: n,
211
+ ...o,
212
+ children: [
213
+ /* @__PURE__ */ t("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(w.ItemIndicator, { children: /* @__PURE__ */ t(ae, { className: "h-4 w-4" }) }) }),
214
+ a
215
+ ]
216
+ }
217
+ ));
218
+ dt.displayName = w.CheckboxItem.displayName;
219
+ const ct = p.forwardRef(({ className: e, children: a, ...n }, o) => /* @__PURE__ */ c(
220
+ w.RadioItem,
221
+ {
222
+ ref: o,
223
+ className: s(
224
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
225
+ e
226
+ ),
227
+ ...n,
228
+ children: [
229
+ /* @__PURE__ */ t("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(w.ItemIndicator, { children: /* @__PURE__ */ t(_e, { className: "h-2 w-2 fill-current" }) }) }),
230
+ a
231
+ ]
232
+ }
233
+ ));
234
+ ct.displayName = w.RadioItem.displayName;
235
+ const ut = p.forwardRef(({ className: e, inset: a, ...n }, o) => /* @__PURE__ */ t(
236
+ w.Label,
237
+ {
238
+ ref: o,
239
+ className: s(
240
+ "px-2 py-1.5 text-sm font-semibold",
241
+ a && "pl-8",
242
+ e
243
+ ),
244
+ ...n
245
+ }
246
+ ));
247
+ ut.displayName = w.Label.displayName;
248
+ const mt = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
249
+ w.Separator,
250
+ {
251
+ ref: n,
252
+ className: s("-mx-1 my-1 h-px bg-muted", e),
253
+ ...a
254
+ }
255
+ ));
256
+ mt.displayName = w.Separator.displayName;
257
+ const pt = H.Root, ft = H.Trigger, he = p.forwardRef(({ className: e, align: a = "center", sideOffset: n = 4, ...o }, l) => /* @__PURE__ */ t(
258
+ H.Content,
259
+ {
260
+ ref: l,
261
+ align: a,
262
+ sideOffset: n,
263
+ className: s(
264
+ "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-hover-card-content-transform-origin]",
265
+ e
266
+ ),
267
+ ...o
268
+ }
269
+ ));
270
+ he.displayName = H.Content.displayName;
271
+ const gt = p.forwardRef(
272
+ ({ className: e, type: a, ...n }, o) => /* @__PURE__ */ t(
273
+ "input",
274
+ {
275
+ type: a,
276
+ className: s(
277
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
278
+ e
279
+ ),
280
+ ref: o,
281
+ ...n
282
+ }
283
+ )
284
+ );
285
+ gt.displayName = "Input";
286
+ const be = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
287
+ "textarea",
288
+ {
289
+ className: s(
290
+ "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
291
+ e
292
+ ),
293
+ ref: n,
294
+ ...a
295
+ }
296
+ ));
297
+ be.displayName = "Textarea";
298
+ function ht({ className: e, ...a }) {
299
+ return /* @__PURE__ */ t(
300
+ "div",
301
+ {
302
+ "data-slot": "input-group",
303
+ role: "group",
304
+ className: s(
305
+ "group/input-group border-input dark:bg-input/30 shadow-xs relative flex w-full items-center rounded-md border outline-none transition-[color,box-shadow]",
306
+ "h-9 has-[>textarea]:h-auto",
307
+ // Variants based on alignment.
308
+ "has-[>[data-align=inline-start]]:[&>input]:pl-2",
309
+ "has-[>[data-align=inline-end]]:[&>input]:pr-2",
310
+ "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
311
+ "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
312
+ // Focus state.
313
+ "has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]:focus-visible]:ring-1",
314
+ // Error state.
315
+ "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
316
+ e
317
+ ),
318
+ ...a
319
+ }
320
+ );
321
+ }
322
+ const bt = re(
323
+ "text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
324
+ {
325
+ variants: {
326
+ align: {
327
+ "inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
328
+ "inline-end": "order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]",
329
+ "block-start": "[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5",
330
+ "block-end": "[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5"
331
+ }
332
+ },
333
+ defaultVariants: {
334
+ align: "inline-start"
335
+ }
336
+ }
337
+ );
338
+ function ve({
339
+ className: e,
340
+ align: a = "inline-start",
341
+ ...n
342
+ }) {
343
+ return /* @__PURE__ */ t(
344
+ "div",
345
+ {
346
+ role: "group",
347
+ "data-slot": "input-group-addon",
348
+ "data-align": a,
349
+ className: s(bt({ align: a }), e),
350
+ onClick: (o) => {
351
+ var l, h;
352
+ o.target.closest("button") || (h = (l = o.currentTarget.parentElement) == null ? void 0 : l.querySelector("input")) == null || h.focus();
353
+ },
354
+ ...n
355
+ }
356
+ );
357
+ }
358
+ const vt = re(
359
+ "flex items-center gap-2 text-sm shadow-none",
360
+ {
361
+ variants: {
362
+ size: {
363
+ xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
364
+ sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
365
+ "icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
366
+ "icon-sm": "size-8 p-0 has-[>svg]:p-0"
367
+ }
368
+ },
369
+ defaultVariants: {
370
+ size: "xs"
371
+ }
372
+ }
373
+ );
374
+ function xe({
375
+ className: e,
376
+ type: a = "button",
377
+ variant: n = "ghost",
378
+ size: o = "xs",
379
+ ...l
380
+ }) {
381
+ return /* @__PURE__ */ t(
382
+ $,
383
+ {
384
+ type: a,
385
+ "data-size": o,
386
+ variant: n,
387
+ className: s(vt({ size: o }), e),
388
+ ...l
389
+ }
390
+ );
391
+ }
392
+ function xt({
393
+ className: e,
394
+ ...a
395
+ }) {
396
+ return /* @__PURE__ */ t(
397
+ be,
398
+ {
399
+ "data-slot": "input-group-control",
400
+ className: s(
401
+ "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
402
+ e
403
+ ),
404
+ ...a
405
+ }
406
+ );
407
+ }
408
+ const yt = p.forwardRef(({ className: e, children: a, ...n }, o) => /* @__PURE__ */ c(
409
+ S.Trigger,
410
+ {
411
+ ref: o,
412
+ className: s(
413
+ "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
414
+ e
415
+ ),
416
+ ...n,
417
+ children: [
418
+ a,
419
+ /* @__PURE__ */ t(S.Icon, { asChild: !0, children: /* @__PURE__ */ t(ne, { className: "h-4 w-4 opacity-50" }) })
420
+ ]
421
+ }
422
+ ));
423
+ yt.displayName = S.Trigger.displayName;
424
+ const ye = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
425
+ S.ScrollUpButton,
426
+ {
427
+ ref: n,
428
+ className: s(
429
+ "flex cursor-default items-center justify-center py-1",
430
+ e
431
+ ),
432
+ ...a,
433
+ children: /* @__PURE__ */ t(Ue, { className: "h-4 w-4" })
434
+ }
435
+ ));
436
+ ye.displayName = S.ScrollUpButton.displayName;
437
+ const Ne = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
438
+ S.ScrollDownButton,
439
+ {
440
+ ref: n,
441
+ className: s(
442
+ "flex cursor-default items-center justify-center py-1",
443
+ e
444
+ ),
445
+ ...a,
446
+ children: /* @__PURE__ */ t(ne, { className: "h-4 w-4" })
447
+ }
448
+ ));
449
+ Ne.displayName = S.ScrollDownButton.displayName;
450
+ const Nt = p.forwardRef(({ className: e, children: a, position: n = "popper", ...o }, l) => /* @__PURE__ */ t(S.Portal, { children: /* @__PURE__ */ c(
451
+ S.Content,
452
+ {
453
+ ref: l,
454
+ className: s(
455
+ "relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
456
+ n === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
457
+ e
458
+ ),
459
+ position: n,
460
+ ...o,
461
+ children: [
462
+ /* @__PURE__ */ t(ye, {}),
463
+ /* @__PURE__ */ t(
464
+ S.Viewport,
465
+ {
466
+ className: s(
467
+ "p-1",
468
+ n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
469
+ ),
470
+ children: a
471
+ }
472
+ ),
473
+ /* @__PURE__ */ t(Ne, {})
474
+ ]
475
+ }
476
+ ) }));
477
+ Nt.displayName = S.Content.displayName;
478
+ const wt = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
479
+ S.Label,
480
+ {
481
+ ref: n,
482
+ className: s("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
483
+ ...a
484
+ }
485
+ ));
486
+ wt.displayName = S.Label.displayName;
487
+ const It = p.forwardRef(({ className: e, children: a, ...n }, o) => /* @__PURE__ */ c(
488
+ S.Item,
489
+ {
490
+ ref: o,
491
+ className: s(
492
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
493
+ e
494
+ ),
495
+ ...n,
496
+ children: [
497
+ /* @__PURE__ */ t("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(S.ItemIndicator, { children: /* @__PURE__ */ t(ae, { className: "h-4 w-4" }) }) }),
498
+ /* @__PURE__ */ t(S.ItemText, { children: a })
499
+ ]
500
+ }
501
+ ));
502
+ It.displayName = S.Item.displayName;
503
+ const St = p.forwardRef(({ className: e, ...a }, n) => /* @__PURE__ */ t(
504
+ S.Separator,
505
+ {
506
+ ref: n,
507
+ className: s("-mx-1 my-1 h-px bg-muted", e),
508
+ ...a
509
+ }
510
+ ));
511
+ St.displayName = S.Separator.displayName;
512
+ const kt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
513
+ let Rt = (e = 21) => {
514
+ let a = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
515
+ for (; e--; )
516
+ a += kt[n[e] & 63];
517
+ return a;
518
+ };
519
+ const Dt = X(null), zt = X(null), we = () => Y(Dt), Ct = () => Y(zt), Ie = X(null), W = () => {
520
+ const e = Ct(), a = Y(Ie), n = e ?? a;
521
+ if (!n)
522
+ throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");
523
+ return n;
524
+ };
525
+ function Tt({ data: e, className: a, ...n }) {
526
+ var v;
527
+ const o = W(), l = e.filename || "", u = ((v = e.mediaType) != null && v.startsWith("image/") && e.url ? "image" : "file") === "image", y = l || (u ? "Image" : "Attachment");
528
+ return /* @__PURE__ */ c(Vt, { children: [
529
+ /* @__PURE__ */ t(ft, { asChild: !0, children: /* @__PURE__ */ c(
530
+ "div",
531
+ {
532
+ className: s(
533
+ "group relative flex h-8 cursor-default select-none items-center gap-1.5 rounded-md border border-border px-1.5 text-sm font-medium transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
534
+ a
535
+ ),
536
+ ...n,
537
+ children: [
538
+ /* @__PURE__ */ c("div", { className: "relative size-5 shrink-0", children: [
539
+ /* @__PURE__ */ t("div", { className: "absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0", children: u ? /* @__PURE__ */ t(
540
+ "img",
541
+ {
542
+ alt: l || "attachment",
543
+ className: "size-5 object-cover",
544
+ height: 20,
545
+ src: e.url,
546
+ width: 20
547
+ }
548
+ ) : /* @__PURE__ */ t("div", { className: "flex size-5 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ t(Oe, { className: "size-3" }) }) }),
549
+ /* @__PURE__ */ c(
550
+ $,
551
+ {
552
+ "aria-label": "Remove attachment",
553
+ className: "absolute inset-0 size-5 cursor-pointer rounded p-0 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 [&>svg]:size-2.5",
554
+ onClick: (R) => {
555
+ R.stopPropagation(), o.remove(e.id);
556
+ },
557
+ type: "button",
558
+ variant: "ghost",
559
+ children: [
560
+ /* @__PURE__ */ t(oe, {}),
561
+ /* @__PURE__ */ t("span", { className: "sr-only", children: "Remove" })
562
+ ]
563
+ }
564
+ )
565
+ ] }),
566
+ /* @__PURE__ */ t("span", { className: "flex-1 truncate", children: y })
567
+ ]
568
+ },
569
+ e.id
570
+ ) }),
571
+ /* @__PURE__ */ t(Ht, { className: "w-auto p-2", children: /* @__PURE__ */ c("div", { className: "w-auto space-y-3", children: [
572
+ u && /* @__PURE__ */ t("div", { className: "flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border", children: /* @__PURE__ */ t(
573
+ "img",
574
+ {
575
+ alt: l || "attachment preview",
576
+ className: "max-h-full max-w-full object-contain",
577
+ height: 384,
578
+ src: e.url,
579
+ width: 448
580
+ }
581
+ ) }),
582
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-2.5", children: /* @__PURE__ */ c("div", { className: "min-w-0 flex-1 space-y-1 px-0.5", children: [
583
+ /* @__PURE__ */ t("h4", { className: "truncate text-sm font-semibold leading-none", children: l || (u ? "Image" : "Attachment") }),
584
+ e.mediaType && /* @__PURE__ */ t("p", { className: "truncate font-mono text-xs text-muted-foreground", children: e.mediaType })
585
+ ] }) })
586
+ ] }) })
587
+ ] });
588
+ }
589
+ function Pt({ children: e, className: a, ...n }) {
590
+ const o = W();
591
+ return o.files.length ? /* @__PURE__ */ t("div", { className: s("flex flex-wrap items-center gap-2 p-3", a), ...n, children: o.files.map((l) => /* @__PURE__ */ t(Te, { children: e(l) }, l.id)) }) : null;
592
+ }
593
+ const Lt = ({
594
+ label: e = "Add photos or files",
595
+ ...a
596
+ }) => {
597
+ const n = W();
598
+ return /* @__PURE__ */ c(
599
+ ge,
600
+ {
601
+ ...a,
602
+ onSelect: (o) => {
603
+ o.preventDefault(), n.openFileDialog();
604
+ },
605
+ children: [
606
+ /* @__PURE__ */ t(Be, { className: "mr-2 size-4" }),
607
+ " ",
608
+ e
609
+ ]
610
+ }
611
+ );
612
+ }, At = ({
613
+ className: e,
614
+ accept: a,
615
+ multiple: n,
616
+ globalDrop: o,
617
+ syncHiddenInput: l,
618
+ maxFiles: h,
619
+ maxFileSize: u,
620
+ onError: y,
621
+ onSubmit: v,
622
+ children: R,
623
+ ...P
624
+ }) => {
625
+ const r = we(), d = !!r, m = B(null), T = B(null), k = B(null);
626
+ j(() => {
627
+ var N;
628
+ const i = (N = T.current) == null ? void 0 : N.closest("form");
629
+ i instanceof HTMLFormElement && (k.current = i);
630
+ }, []);
631
+ const [z, _] = A([]), x = d ? r.attachments.files : z, M = V(() => {
632
+ var i;
633
+ (i = m.current) == null || i.click();
634
+ }, []), F = V(
635
+ (i) => !a || a.trim() === "" ? !0 : a.includes("image/*") ? i.type.startsWith("image/") : !0,
636
+ [a]
637
+ ), G = V(
638
+ (i) => {
639
+ const N = Array.from(i), b = N.filter((I) => F(I));
640
+ if (N.length && b.length === 0) {
641
+ y == null || y({
642
+ code: "accept",
643
+ message: "No files match the accepted types."
644
+ });
645
+ return;
646
+ }
647
+ const g = (I) => u ? I.size <= u : !0, f = b.filter(g);
648
+ if (b.length > 0 && f.length === 0) {
649
+ y == null || y({
650
+ code: "max_file_size",
651
+ message: "All files exceed the maximum size."
652
+ });
653
+ return;
654
+ }
655
+ _((I) => {
656
+ const U = typeof h == "number" ? Math.max(0, h - I.length) : void 0, ze = typeof U == "number" ? f.slice(0, U) : f;
657
+ typeof U == "number" && f.length > U && (y == null || y({
658
+ code: "max_files",
659
+ message: "Too many files. Some were not added."
660
+ }));
661
+ const ee = [];
662
+ for (const q of ze)
663
+ ee.push({
664
+ id: Rt(),
665
+ type: "file",
666
+ url: URL.createObjectURL(q),
667
+ mediaType: q.type,
668
+ filename: q.name
669
+ });
670
+ return I.concat(ee);
671
+ });
672
+ },
673
+ [F, h, u, y]
674
+ ), L = d ? (i) => r.attachments.add(i) : G, O = d ? (i) => r.attachments.remove(i) : (i) => _((N) => {
675
+ const b = N.find((g) => g.id === i);
676
+ return b != null && b.url && URL.revokeObjectURL(b.url), N.filter((g) => g.id !== i);
677
+ }), E = d ? () => r.attachments.clear() : () => _((i) => {
678
+ for (const N of i)
679
+ N.url && URL.revokeObjectURL(N.url);
680
+ return [];
681
+ }), Q = d ? () => r.attachments.openFileDialog() : M;
682
+ j(() => {
683
+ d && r.__registerFileInput(m, () => {
684
+ var i;
685
+ return (i = m.current) == null ? void 0 : i.click();
686
+ });
687
+ }, [d, r]), j(() => {
688
+ l && m.current && x.length === 0 && (m.current.value = "");
689
+ }, [x, l]), j(() => {
690
+ const i = k.current;
691
+ if (!i) return;
692
+ const N = (g) => {
693
+ var f, I;
694
+ (I = (f = g.dataTransfer) == null ? void 0 : f.types) != null && I.includes("Files") && g.preventDefault();
695
+ }, b = (g) => {
696
+ var f, I, U;
697
+ (I = (f = g.dataTransfer) == null ? void 0 : f.types) != null && I.includes("Files") && g.preventDefault(), (U = g.dataTransfer) != null && U.files && g.dataTransfer.files.length > 0 && L(g.dataTransfer.files);
698
+ };
699
+ return i.addEventListener("dragover", N), i.addEventListener("drop", b), () => {
700
+ i.removeEventListener("dragover", N), i.removeEventListener("drop", b);
701
+ };
702
+ }, [L]), j(() => {
703
+ if (!o) return;
704
+ const i = (b) => {
705
+ var g, f;
706
+ (f = (g = b.dataTransfer) == null ? void 0 : g.types) != null && f.includes("Files") && b.preventDefault();
707
+ }, N = (b) => {
708
+ var g, f, I;
709
+ (f = (g = b.dataTransfer) == null ? void 0 : g.types) != null && f.includes("Files") && b.preventDefault(), (I = b.dataTransfer) != null && I.files && b.dataTransfer.files.length > 0 && L(b.dataTransfer.files);
710
+ };
711
+ return document.addEventListener("dragover", i), document.addEventListener("drop", N), () => {
712
+ document.removeEventListener("dragover", i), document.removeEventListener("drop", N);
713
+ };
714
+ }, [L, o]), j(
715
+ () => () => {
716
+ if (!d)
717
+ for (const i of x)
718
+ i.url && URL.revokeObjectURL(i.url);
719
+ },
720
+ [d, x]
721
+ );
722
+ const Se = (i) => {
723
+ i.currentTarget.files && L(i.currentTarget.files);
724
+ }, ke = async (i) => {
725
+ const b = await (await fetch(i)).blob();
726
+ return new Promise((g, f) => {
727
+ const I = new FileReader();
728
+ I.onloadend = () => g(I.result), I.onerror = f, I.readAsDataURL(b);
729
+ });
730
+ }, Re = Pe(
731
+ () => ({
732
+ files: x.map((i) => ({ ...i, id: i.id })),
733
+ add: L,
734
+ remove: O,
735
+ clear: E,
736
+ openFileDialog: Q,
737
+ fileInputRef: m
738
+ }),
739
+ [x, L, O, E, Q]
740
+ ), De = (i) => {
741
+ i.preventDefault();
742
+ const N = i.currentTarget, b = d ? r.textInput.value : new FormData(N).get("message") || "";
743
+ d || N.reset(), Promise.all(
744
+ x.map(async ({ id: g, ...f }) => f.url && f.url.startsWith("blob:") ? {
745
+ ...f,
746
+ url: await ke(f.url)
747
+ } : f)
748
+ ).then((g) => {
749
+ try {
750
+ const f = v({ text: b, files: g }, i);
751
+ f instanceof Promise ? f.then(() => {
752
+ E(), d && r.textInput.clear();
753
+ }).catch(() => {
754
+ }) : (E(), d && r.textInput.clear());
755
+ } catch {
756
+ }
757
+ });
758
+ }, Z = /* @__PURE__ */ c(Ce, { children: [
759
+ /* @__PURE__ */ t("span", { "aria-hidden": "true", className: "hidden", ref: T }),
760
+ /* @__PURE__ */ t(
761
+ "input",
762
+ {
763
+ accept: a,
764
+ "aria-label": "Upload files",
765
+ className: "hidden",
766
+ multiple: n,
767
+ onChange: Se,
768
+ ref: m,
769
+ title: "Upload files",
770
+ type: "file"
771
+ }
772
+ ),
773
+ /* @__PURE__ */ t("form", { className: s("w-full", e), onSubmit: De, ...P, children: /* @__PURE__ */ t(ht, { className: "overflow-hidden", children: R }) })
774
+ ] });
775
+ return d ? Z : /* @__PURE__ */ t(Ie.Provider, { value: Re, children: Z });
776
+ }, Mt = ({
777
+ onChange: e,
778
+ className: a,
779
+ placeholder: n = "What would you like to know?",
780
+ ...o
781
+ }) => {
782
+ const l = we(), h = W(), [u, y] = A(!1), v = (r) => {
783
+ if (r.key === "Enter") {
784
+ if (u || r.nativeEvent.isComposing || r.shiftKey)
785
+ return;
786
+ r.preventDefault();
787
+ const d = r.currentTarget.form, m = d == null ? void 0 : d.querySelector('button[type="submit"]');
788
+ if (m != null && m.disabled)
789
+ return;
790
+ d == null || d.requestSubmit();
791
+ }
792
+ if (r.key === "Backspace" && r.currentTarget.value === "" && h.files.length > 0) {
793
+ r.preventDefault();
794
+ const d = h.files.at(-1);
795
+ d && h.remove(d.id);
796
+ }
797
+ }, R = (r) => {
798
+ var T;
799
+ const d = (T = r.clipboardData) == null ? void 0 : T.items;
800
+ if (!d)
801
+ return;
802
+ const m = [];
803
+ for (const k of d)
804
+ if (k.kind === "file") {
805
+ const z = k.getAsFile();
806
+ z && m.push(z);
807
+ }
808
+ m.length > 0 && (r.preventDefault(), h.add(m));
809
+ }, P = l ? {
810
+ value: l.textInput.value,
811
+ onChange: (r) => {
812
+ l.textInput.setInput(r.currentTarget.value), e == null || e(r);
813
+ }
814
+ } : {
815
+ onChange: e
816
+ };
817
+ return /* @__PURE__ */ t(
818
+ xt,
819
+ {
820
+ className: s("field-sizing-content max-h-48 min-h-16", a),
821
+ name: "message",
822
+ onCompositionEnd: () => y(!1),
823
+ onCompositionStart: () => y(!0),
824
+ onKeyDown: v,
825
+ onPaste: R,
826
+ placeholder: n,
827
+ ...o,
828
+ ...P
829
+ }
830
+ );
831
+ }, jt = ({ className: e, ...a }) => /* @__PURE__ */ t(ve, { align: "block-end", className: s("order-first flex-wrap gap-1", e), ...a }), _t = ({ className: e, ...a }) => /* @__PURE__ */ t(ve, { align: "block-end", className: s("justify-between gap-1", e), ...a }), Ut = ({ className: e, ...a }) => /* @__PURE__ */ t("div", { className: s("flex items-center gap-1", e), ...a }), J = ({ variant: e = "ghost", className: a, size: n, ...o }) => {
832
+ const l = n ?? (Le.count(o.children) > 1 ? "sm" : "icon-sm");
833
+ return /* @__PURE__ */ t(xe, { className: s(a), size: l, type: "button", variant: e, ...o });
834
+ }, Ot = (e) => /* @__PURE__ */ t(rt, { ...e }), Bt = ({ className: e, children: a, ...n }) => /* @__PURE__ */ t(st, { asChild: !0, children: /* @__PURE__ */ t(J, { className: e, ...n, children: a ?? /* @__PURE__ */ t(Fe, { className: "size-4" }) }) }), Ft = ({ className: e, ...a }) => /* @__PURE__ */ t(fe, { align: "start", className: s(e), ...a }), Gt = ({
835
+ className: e,
836
+ variant: a = "default",
837
+ size: n = "icon-sm",
838
+ status: o,
839
+ children: l,
840
+ ...h
841
+ }) => {
842
+ let u = /* @__PURE__ */ t(Ee, { className: "size-4" });
843
+ return o === "submitted" ? u = /* @__PURE__ */ t(Ve, { className: "size-4 animate-spin" }) : o === "streaming" ? u = /* @__PURE__ */ t(He, { className: "size-4" }) : o === "error" && (u = /* @__PURE__ */ t(oe, { className: "size-4" })), /* @__PURE__ */ t(
844
+ xe,
845
+ {
846
+ "aria-label": "Submit",
847
+ className: s(e),
848
+ size: n,
849
+ type: "submit",
850
+ variant: a,
851
+ ...h,
852
+ children: l ?? u
853
+ }
854
+ );
855
+ }, Et = ({
856
+ className: e,
857
+ textareaRef: a,
858
+ onTranscriptionChange: n,
859
+ ...o
860
+ }) => {
861
+ const [l, h] = A(!1), [u, y] = A(null), v = B(null);
862
+ j(() => {
863
+ if (typeof window < "u" && ("SpeechRecognition" in window || "webkitSpeechRecognition" in window)) {
864
+ const P = window.SpeechRecognition || window.webkitSpeechRecognition, r = new P();
865
+ r.continuous = !0, r.interimResults = !0, r.lang = "en-US", r.onstart = () => {
866
+ h(!0);
867
+ }, r.onend = () => {
868
+ h(!1);
869
+ }, r.onresult = (d) => {
870
+ var T;
871
+ let m = "";
872
+ for (let k = d.resultIndex; k < d.results.length; k++) {
873
+ const z = d.results[k];
874
+ z.isFinal && (m += ((T = z[0]) == null ? void 0 : T.transcript) ?? "");
875
+ }
876
+ if (m && (a != null && a.current)) {
877
+ const k = a.current, z = k.value, _ = z + (z ? " " : "") + m;
878
+ k.value = _, k.dispatchEvent(new Event("input", { bubbles: !0 })), n == null || n(_);
879
+ }
880
+ }, r.onerror = (d) => {
881
+ console.error("Speech recognition error:", d.error), h(!1);
882
+ }, v.current = r, y(r);
883
+ }
884
+ return () => {
885
+ v.current && v.current.stop();
886
+ };
887
+ }, [a, n]);
888
+ const R = V(() => {
889
+ u && (l ? u.stop() : u.start());
890
+ }, [u, l]);
891
+ return /* @__PURE__ */ t(
892
+ J,
893
+ {
894
+ className: s(
895
+ "relative transition-all duration-200",
896
+ l && "animate-pulse bg-accent text-accent-foreground",
897
+ e
898
+ ),
899
+ disabled: !u,
900
+ onClick: R,
901
+ ...o,
902
+ children: /* @__PURE__ */ t(Ge, { className: "size-4" })
903
+ }
904
+ );
905
+ }, Vt = ({ openDelay: e = 0, closeDelay: a = 0, ...n }) => /* @__PURE__ */ t(pt, { closeDelay: a, openDelay: e, ...n }), Ht = ({ align: e = "start", ...a }) => /* @__PURE__ */ t(he, { align: e, ...a }), Wt = (e) => /* @__PURE__ */ t(Ze, { ...e }), qt = (e) => /* @__PURE__ */ t(et, { ...e }), Kt = ({
906
+ className: e,
907
+ children: a,
908
+ title: n = "Model Selector",
909
+ ...o
910
+ }) => /* @__PURE__ */ c(ie, { className: s("p-0", e), ...o, children: [
911
+ /* @__PURE__ */ t(le, { className: "sr-only", children: n }),
912
+ /* @__PURE__ */ t(de, { className: "**:data-[slot=command-input-wrapper]:h-auto", children: a })
913
+ ] }), $t = ({
914
+ className: e,
915
+ ...a
916
+ }) => /* @__PURE__ */ t(ce, { className: s("h-auto py-3.5", e), ...a }), Xt = (e) => /* @__PURE__ */ t(ue, { ...e }), Yt = (e) => /* @__PURE__ */ t(me, { ...e }), Jt = (e) => /* @__PURE__ */ t(pe, { ...e }), Qt = ({
917
+ provider: e,
918
+ className: a,
919
+ ...n
920
+ }) => /* @__PURE__ */ t(
921
+ "img",
922
+ {
923
+ ...n,
924
+ alt: `${e} logo`,
925
+ className: s("size-3 dark:invert", a),
926
+ height: 12,
927
+ src: `https://models.dev/logos/${e}.svg`,
928
+ width: 12
929
+ }
930
+ ), Zt = ({
931
+ className: e,
932
+ ...a
933
+ }) => /* @__PURE__ */ t("span", { className: s("flex-1 truncate text-left", e), ...a }), ea = ({
934
+ selectedModel: e,
935
+ onModelChange: a,
936
+ disabled: n = !1
937
+ }) => {
938
+ const [o, l] = A(!1), [h, u] = A(""), y = Je(e) || K(), R = Qe.filter(
939
+ (r) => r.name.toLowerCase().includes(h.toLowerCase()) || r.provider.toLowerCase().includes(h.toLowerCase())
940
+ ).reduce(
941
+ (r, d) => (r[d.provider] || (r[d.provider] = []), r[d.provider].push(d), r),
942
+ {}
943
+ ), P = (r) => {
944
+ a(r), l(!1), u("");
945
+ };
946
+ return /* @__PURE__ */ c(Wt, { open: o, onOpenChange: l, children: [
947
+ /* @__PURE__ */ t(qt, { asChild: !0, children: /* @__PURE__ */ c($, { variant: "outline", size: "sm", disabled: n, className: "h-8 gap-1 px-2 text-xs", children: [
948
+ /* @__PURE__ */ t(We, { size: 14 }),
949
+ /* @__PURE__ */ t("span", { className: "max-w-20 truncate", children: y.name })
950
+ ] }) }),
951
+ /* @__PURE__ */ c(Kt, { className: "w-96 p-0", children: [
952
+ /* @__PURE__ */ t($t, { placeholder: "Search models...", value: h, onValueChange: u }),
953
+ /* @__PURE__ */ t(Xt, { children: Object.entries(R).map(([r, d]) => /* @__PURE__ */ t(Yt, { heading: r.charAt(0).toUpperCase() + r.slice(1), children: d.map((m) => /* @__PURE__ */ c(
954
+ Jt,
955
+ {
956
+ value: m.id,
957
+ onSelect: () => P(m.id),
958
+ className: "flex cursor-pointer items-center gap-2 p-2",
959
+ children: [
960
+ /* @__PURE__ */ t(Qt, { provider: m.provider }),
961
+ /* @__PURE__ */ c("div", { className: "flex flex-1 flex-col", children: [
962
+ /* @__PURE__ */ t(Zt, { children: m.name }),
963
+ /* @__PURE__ */ t("span", { className: "text-xs text-muted-foreground", children: m.description })
964
+ ] }),
965
+ e === m.id && /* @__PURE__ */ t("div", { className: "h-2 w-2 rounded-full bg-blue-500" })
966
+ ]
967
+ },
968
+ m.id
969
+ )) }, r)) })
970
+ ] })
971
+ ] });
972
+ }, te = "chai-ai-selected-model", da = ({
973
+ input: e,
974
+ setInput: a,
975
+ onSend: n,
976
+ onStop: o,
977
+ isLoading: l,
978
+ disabled: h,
979
+ selectedLang: u,
980
+ selectedModel: y = K().id,
981
+ onModelChange: v
982
+ }) => {
983
+ const { t: R } = Ye(), [P, r] = A(y), [d, m] = A(null), T = B(null), [k, z] = A(!1);
984
+ return j(() => {
985
+ if (!u) {
986
+ const x = localStorage.getItem(te);
987
+ if (x)
988
+ r(x), v == null || v(x);
989
+ else {
990
+ const M = K().id;
991
+ r(M), v == null || v(M);
992
+ }
993
+ }
994
+ }, [u, v]), /* @__PURE__ */ t("div", { className: "relative", children: /* @__PURE__ */ t("div", { className: "border-gray-20 rounded-lg border", children: /* @__PURE__ */ c(At, { onSubmit: (x) => {
995
+ var G;
996
+ const M = x.files.find((L) => {
997
+ var O;
998
+ return (O = L.mediaType) == null ? void 0 : O.startsWith("image/");
999
+ }), F = (M == null ? void 0 : M.url) || d;
1000
+ n((G = x.text) == null ? void 0 : G.trim(), void 0, F, P), m(null);
1001
+ }, accept: "image/*", className: "flex h-auto w-full flex-col", children: [
1002
+ /* @__PURE__ */ t(jt, { className: "p-0", children: /* @__PURE__ */ t(Pt, { className: "pb-0", children: (x) => /* @__PURE__ */ t(Tt, { className: "text-xs", data: x }) }) }),
1003
+ /* @__PURE__ */ t(
1004
+ Mt,
1005
+ {
1006
+ ref: T,
1007
+ value: e,
1008
+ onChange: (x) => a(x.target.value),
1009
+ placeholder: R(u ? "Ask to update content" : "Ask me anything..."),
1010
+ disabled: l,
1011
+ className: "max-h-[200px] min-h-[60px] w-full",
1012
+ rows: 3
1013
+ }
1014
+ ),
1015
+ /* @__PURE__ */ c(_t, { children: [
1016
+ u ? /* @__PURE__ */ t("div", {}) : /* @__PURE__ */ c(Ut, { children: [
1017
+ /* @__PURE__ */ c(Ot, { children: [
1018
+ /* @__PURE__ */ t(Bt, { disabled: l, children: /* @__PURE__ */ t(qe, { size: 16 }) }),
1019
+ /* @__PURE__ */ t(Ft, { children: /* @__PURE__ */ t(Lt, {}) })
1020
+ ] }),
1021
+ /* @__PURE__ */ t(
1022
+ Et,
1023
+ {
1024
+ textareaRef: T,
1025
+ onTranscriptionChange: a,
1026
+ disabled: l
1027
+ }
1028
+ ),
1029
+ /* @__PURE__ */ t(
1030
+ ea,
1031
+ {
1032
+ selectedModel: P,
1033
+ onModelChange: (x) => {
1034
+ r(x), v == null || v(x), localStorage.setItem(te, x);
1035
+ },
1036
+ disabled: l
1037
+ }
1038
+ ),
1039
+ /* @__PURE__ */ c(
1040
+ J,
1041
+ {
1042
+ className: "hidden",
1043
+ size: "sm",
1044
+ onClick: () => z(!k),
1045
+ variant: k ? "default" : "ghost",
1046
+ children: [
1047
+ /* @__PURE__ */ t(Ke, { size: 16 }),
1048
+ /* @__PURE__ */ t("span", { children: "Search" })
1049
+ ]
1050
+ }
1051
+ )
1052
+ ] }),
1053
+ l ? /* @__PURE__ */ c(
1054
+ "button",
1055
+ {
1056
+ onClick: o,
1057
+ className: "z-50 flex items-center gap-x-1 rounded-md bg-red-500 p-1.5 text-white transition-colors hover:bg-red-600",
1058
+ title: R("Stop generation"),
1059
+ children: [
1060
+ /* @__PURE__ */ t($e, { size: 16 }),
1061
+ " ",
1062
+ /* @__PURE__ */ t("span", { className: "text-xs", children: R("Stop") })
1063
+ ]
1064
+ }
1065
+ ) : /* @__PURE__ */ t(Gt, { disabled: !e.trim() || h, children: /* @__PURE__ */ t(Xe, { size: 16 }) })
1066
+ ] })
1067
+ ] }) }) });
1068
+ };
1069
+ export {
1070
+ da as default
1071
+ };