@chaibuilder/sdk 4.0.0-beta.47 → 4.0.0-beta.49
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.
- package/dist/{2SSKDMRQ-CVHl6i14.cjs → 2SSKDMRQ-CjvuNdPo.cjs} +1 -1
- package/dist/{2SSKDMRQ-D9rlRpnI.js → 2SSKDMRQ-Dvf9zadl.js} +2 -2
- package/dist/{AP7HFJJL-D18sv0Wh.cjs → AP7HFJJL-DYFttFoI.cjs} +1 -1
- package/dist/{AP7HFJJL-CBrphwP9.js → AP7HFJJL-q4dJdyFs.js} +1 -1
- package/dist/{IconPicker-CSewv0kY.js → IconPicker-Bf163F7t.js} +1 -1
- package/dist/{IconPicker-CxEGCcVZ.cjs → IconPicker-JWhYq2Gp.cjs} +1 -1
- package/dist/{WDYDFRGG-C0G8c0hR.cjs → WDYDFRGG-BEksfGMC.cjs} +1 -1
- package/dist/{WDYDFRGG-BCmjXFs0.js → WDYDFRGG-O9GIrtX0.js} +2 -2
- package/dist/{actions-registery-BQ31lpix.cjs → actions-registery-BHbZHkE3.cjs} +11 -3
- package/dist/{actions-registery-B1VeX52Y.js → actions-registery-gJb_wq2F.js} +25 -13
- package/dist/actions.cjs +1 -1
- package/dist/actions.d.ts +10 -3
- package/dist/actions.js +6 -4
- package/dist/{active-in-another-tab-BhbPijx9.js → active-in-another-tab-B4Ur0JP7.js} +2 -2
- package/dist/{active-in-another-tab-CMmhCRma.cjs → active-in-another-tab-BPdx4lWh.cjs} +1 -1
- package/dist/{add-new-language-page-ChQgjFwb.cjs → add-new-language-page-BfUp5Ua2.cjs} +1 -1
- package/dist/{add-new-language-page-C0sayTSF.js → add-new-language-page-CRR93tLq.js} +3 -3
- package/dist/{add-new-page-DLf5Tfb7.cjs → add-new-page-B8NGK6WS.cjs} +1 -1
- package/dist/{add-new-page-DLKzuaNM.js → add-new-page-Ppy5-y5j.js} +2 -2
- package/dist/ai-panel-default-lang-BXYQye3N.js +333 -0
- package/dist/ai-panel-default-lang-VhgmHFoQ.cjs +3 -0
- package/dist/ai-panel-other-lang-DaCf-cq4.js +148 -0
- package/dist/ai-panel-other-lang-Ds0EXeUC.cjs +1 -0
- package/dist/{ai-prompt-input-DNb1FKXQ.js → ai-prompt-input-7iWk72w5.js} +253 -258
- package/dist/ai-prompt-input-nZ5_Dm7X.cjs +1 -0
- package/dist/{ai-translation-prompt-B2MfzTjb.js → ai-translation-prompt-1OUs1P7n.js} +1 -1
- package/dist/{ai-translation-prompt-CL3yk8K1.cjs → ai-translation-prompt-B16cK-1Q.cjs} +1 -1
- package/dist/{change-password-modal-CbMifP62.js → change-password-modal-CdvJR1Ln.js} +10 -10
- package/dist/{change-password-modal-D_NFPZxI.cjs → change-password-modal-D5eXjiYq.cjs} +1 -1
- package/dist/{code-editor-53rOkfhX.js → code-editor-CyLjDiEp.js} +1 -1
- package/dist/{code-editor-CCsljULB.cjs → code-editor-SWbfFj1E.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-hB4O3CHJ.js → continue-editing-in-this-client-BrSvK-Ay.js} +2 -2
- package/dist/{continue-editing-in-this-client-3QLL7tQH.cjs → continue-editing-in-this-client-Cmi-GkYZ.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{css-import-modal-Bmi3LrEJ.cjs → css-import-modal-Bdwgd05S.cjs} +1 -1
- package/dist/{css-import-modal-DCivkVh2.js → css-import-modal-Be47CBJn.js} +1 -1
- package/dist/{delete-page-BW2NxLZu.js → delete-page-C99K2qzS.js} +15 -15
- package/dist/{delete-page-CxVfKrBz.cjs → delete-page-DLohaU-U.cjs} +1 -1
- package/dist/{design-token-usage-WTVjf9c-.js → design-token-usage-D1lWCJ3L.js} +1 -1
- package/dist/{design-token-usage-5jsa9ojN.cjs → design-token-usage-eY2wQ0l3.cjs} +1 -1
- package/dist/{digital-asset-manager-dNK-BYdI.js → digital-asset-manager-BZMb6sC7.js} +3 -3
- package/dist/{digital-asset-manager-DlFCWUP4.cjs → digital-asset-manager-Z5aJxkq0.cjs} +1 -1
- package/dist/{duplicate-page-BbB2anQO.js → duplicate-page-CDc2X0eW.js} +12 -12
- package/dist/{duplicate-page-0o6G-oY_.cjs → duplicate-page-D5Gtvqdv.cjs} +1 -1
- package/dist/{dynamic-page-selector-Ds3MqxTF.cjs → dynamic-page-selector-DZHhX008.cjs} +1 -1
- package/dist/{dynamic-page-selector-rFO8457w.js → dynamic-page-selector-DvNBXo6o.js} +2 -2
- package/dist/{image-editor-BnVkes6Q.js → image-editor-BBvvi9Vm.js} +1 -1
- package/dist/{image-editor-DqItmbk1.cjs → image-editor-DwhTYkVR.cjs} +1 -1
- package/dist/index-BVwFJWDq.cjs +5 -0
- package/dist/{index-DTNHTRZu.cjs → index-DCJDQs1a.cjs} +8 -8
- package/dist/{index-BYjniKhj.js → index-LBTm1Jmk.js} +838 -806
- package/dist/{index-B7HAfx-2.js → index-OuHV9Ann.js} +16 -9
- package/dist/{json-diff-viewer-B4rnFiN_.cjs → json-diff-viewer-Cb1CmRqP.cjs} +1 -1
- package/dist/{json-diff-viewer-CKlyO9eW.js → json-diff-viewer-DG6qMOBS.js} +6 -6
- package/dist/{lang-panel-YT96E5Xj.js → lang-panel-B3USOxGq.js} +9 -9
- package/dist/{lang-panel-DiVz4Cay.cjs → lang-panel-DxoJ0v4y.cjs} +1 -1
- package/dist/{manage-design-tokens-LwImeKaK.js → manage-design-tokens-6YGIctip.js} +2 -2
- package/dist/{manage-design-tokens-modal-BEElCTcN.cjs → manage-design-tokens-modal-BSSCXH8Y.cjs} +1 -1
- package/dist/{manage-design-tokens-modal-DFVcoyra.js → manage-design-tokens-modal-CzsnN49F.js} +2 -2
- package/dist/{manage-design-tokens-BwrIc6dS.cjs → manage-design-tokens-udLBvkHA.cjs} +1 -1
- package/dist/{mark-as-template-DtDkh6jB.cjs → mark-as-template-B9yLcasI.cjs} +1 -1
- package/dist/{mark-as-template-D2Hpz0IE.js → mark-as-template-CP_F9ZQ4.js} +2 -2
- package/dist/{models-D0RH2u4C.cjs → models-CQaC3EBW.cjs} +1 -1
- package/dist/{models-BCu-p_QK.js → models-DZ9C6CvE.js} +4 -5
- package/dist/{nested-path-selector-content-TqjBbNys.js → nested-path-selector-content-DmtCI3q9.js} +1 -1
- package/dist/{nested-path-selector-content-CJfN8Hhw.cjs → nested-path-selector-content-aTdu-o0e.cjs} +1 -1
- package/dist/{no-language-page-content-CcD-fgMa.cjs → no-language-page-content-C-MCdPXt.cjs} +1 -1
- package/dist/{no-language-page-content-Ce3wniZT.js → no-language-page-content-D8t5dfgh.js} +2 -2
- package/dist/{no-language-page-dialog-CU1zXsYv.js → no-language-page-dialog-C_fHI2zI.js} +2 -2
- package/dist/{no-language-page-dialog-B7fhPdob.cjs → no-language-page-dialog-D4QIAHnE.cjs} +1 -1
- package/dist/{page-creator-C7XEqUx_.cjs → page-creator-Cz_ah-qE.cjs} +1 -1
- package/dist/{page-creator-wg3uymVG.js → page-creator-DKEkuGCO.js} +33 -33
- package/dist/{page-lock-BuVma3e5.js → page-lock-CwZKJ4IE.js} +2 -2
- package/dist/{page-lock-CINb2air.cjs → page-lock-DdCvtA-I.cjs} +1 -1
- package/dist/{page-locked-dialog-s-3ROcy0.cjs → page-locked-dialog-CrTDBoC4.cjs} +1 -1
- package/dist/{page-locked-dialog-C7_1gjO5.js → page-locked-dialog-DqLlooUz.js} +11 -11
- package/dist/{page-manager-new-CKWSLVrb.cjs → page-manager-new-ah6QYar2.cjs} +1 -1
- package/dist/{page-manager-new-zlobCGqL.js → page-manager-new-ttsrxdW9.js} +42 -42
- package/dist/{page-manager-search-and-filter-BaOsl_5u.cjs → page-manager-search-and-filter-D7AupT6_.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-BU_iNmHy.js → page-manager-search-and-filter-bsqZ6wnI.js} +2 -2
- package/dist/{page-revisions-content-BmaNPNoS.cjs → page-revisions-content-B6hsIla7.cjs} +1 -1
- package/dist/{page-revisions-content-D6l_d2jW.js → page-revisions-content-C5O8_Fms.js} +16 -16
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +66 -1
- package/dist/pages.js +19 -19
- package/dist/{publish-pages-content-2LG6JOrm.cjs → publish-pages-content-BrajJUcP.cjs} +1 -1
- package/dist/{publish-pages-content-CQteRtBA.js → publish-pages-content-KZVMHT6V.js} +32 -32
- package/dist/{rte-widget-modal-KzT2hLFt.cjs → rte-widget-modal-CiTwsXTr.cjs} +1 -1
- package/dist/{rte-widget-modal-CFk0Izg5.js → rte-widget-modal-IU8JzPuZ.js} +1 -1
- package/dist/{save-to-lib-D1V3bNZX.js → save-to-lib-DMnv7ENo.js} +50 -50
- package/dist/{save-to-lib-D82Vrekv.cjs → save-to-lib-Dc700Aop.cjs} +1 -1
- package/dist/{selected-block-display-BHx9N14K.cjs → selected-block-display-CAFEOrLV.cjs} +1 -1
- package/dist/{selected-block-display-BbUH5RaW.js → selected-block-display-CidmQ-wz.js} +2 -2
- package/dist/{seo-panel-CyBmGg6k.js → seo-panel-Br8gxDxu.js} +148 -158
- package/dist/{seo-panel-CPsjZLtL.cjs → seo-panel-CMY-adM-.cjs} +2 -2
- package/dist/{shared-json-ld-DyU9wqrE.cjs → shared-json-ld-CMH-eRUq.cjs} +1 -1
- package/dist/{shared-json-ld-SGykyppC.js → shared-json-ld-uvMmwCYp.js} +26 -26
- package/dist/{slug-input-BzpnOdXG.cjs → slug-input-CiHC5l3r.cjs} +1 -1
- package/dist/{slug-input-DpMI4nEB.js → slug-input-DLWTMTsO.js} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-wTVLAotu.cjs → take-over-request-IRLgF1dG.cjs} +1 -1
- package/dist/{take-over-request-D97Fg-xB.js → take-over-request-KdR1_h_K.js} +5 -5
- package/dist/{translation-warning-modal-Xk6oYGFS.cjs → translation-warning-modal-CLZ9tC1F.cjs} +1 -1
- package/dist/{translation-warning-modal-Du-CnfyH.js → translation-warning-modal-CzNt6LDO.js} +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/{unmark-as-template-BHk2F0ck.js → unmark-as-template-C5ovsEBP.js} +2 -2
- package/dist/{unmark-as-template-BRnMhh7n.cjs → unmark-as-template-F7TdgWjI.cjs} +1 -1
- package/dist/{unpublish-page-BOEjCHLB.js → unpublish-page-0fR1o0b7.js} +8 -8
- package/dist/{unpublish-page-Bu75lH33.cjs → unpublish-page-CUr8Xub6.cjs} +1 -1
- package/dist/{unpublished-partials-modal-C0_0qNvV.js → unpublished-partials-modal-BhNAub_z.js} +1 -1
- package/dist/{unpublished-partials-modal-BS_GddEG.cjs → unpublished-partials-modal-Cv5R9-hi.cjs} +1 -1
- package/dist/{web-preview-DcOhTGup.cjs → web-preview-CuMYekVJ.cjs} +1 -1
- package/dist/{web-preview-C3bbIF6T.js → web-preview-D9pXonAv.js} +1 -1
- package/package.json +1 -1
- package/dist/ai-panel-default-lang-DsGjoITc.cjs +0 -3
- package/dist/ai-panel-default-lang-Dy_4L5pH.js +0 -317
- package/dist/ai-panel-other-lang-1RYtb71B.js +0 -132
- package/dist/ai-panel-other-lang-CL3coL7Z.cjs +0 -1
- package/dist/ai-prompt-input-BhTL_-mT.cjs +0 -1
- package/dist/index-BeGLwvqs.cjs +0 -5
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { E as y, B as
|
|
3
|
-
import { T as le, aB as ce, v as ue, w as de, x as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { PaperclipIcon as Se, XIcon as
|
|
1
|
+
import { jsx as e, jsxs as N, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
+
import { E as y, B as E } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
+
import { T as le, aB as ce, v as ue, w as de, x as me, y as pe, aC as fe, aD as he, D as ge, aE as ve, e as be, g as xe, C as we, j as Ne, l as ye, m as Ie } from "./index-OuHV9Ann.js";
|
|
4
|
+
import { cva as X } from "class-variance-authority";
|
|
5
|
+
import { PaperclipIcon as Se, XIcon as Y, PlusIcon as ke, ImageIcon as ze, MicIcon as De, CornerDownLeftIcon as Pe, Loader2Icon as Te, SquareIcon as Ae, Cpu as Le, Paperclip as Ce, GlobeIcon as Re, Square as je, Send as Me } from "lucide-react";
|
|
6
6
|
import { nanoid as Ue } from "nanoid";
|
|
7
|
-
import { useContext as W, useRef as
|
|
7
|
+
import { useContext as W, useRef as F, useEffect as A, useState as L, useCallback as O, useMemo as Fe, createContext as _, Fragment as Oe, startTransition as Ge, Children as Be } from "react";
|
|
8
8
|
import { useTranslation as Ee } from "react-i18next";
|
|
9
|
-
import {
|
|
10
|
-
function
|
|
9
|
+
import { l as J } from "./index-LBTm1Jmk.js";
|
|
10
|
+
function We({ className: t, ...n }) {
|
|
11
11
|
return /* @__PURE__ */ e(
|
|
12
12
|
"div",
|
|
13
13
|
{
|
|
@@ -31,7 +31,7 @@ function He({ className: t, ...n }) {
|
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const _e = X(
|
|
35
35
|
"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",
|
|
36
36
|
{
|
|
37
37
|
variants: {
|
|
@@ -58,16 +58,16 @@ function Q({
|
|
|
58
58
|
role: "group",
|
|
59
59
|
"data-slot": "input-group-addon",
|
|
60
60
|
"data-align": n,
|
|
61
|
-
className: y(
|
|
61
|
+
className: y(_e({ align: n }), t),
|
|
62
62
|
onClick: (l) => {
|
|
63
|
-
var o,
|
|
64
|
-
l.target.closest("button") || (
|
|
63
|
+
var o, d;
|
|
64
|
+
l.target.closest("button") || (d = (o = l.currentTarget.parentElement) == null ? void 0 : o.querySelector("input")) == null || d.focus();
|
|
65
65
|
},
|
|
66
66
|
...a
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const He = X("flex items-center gap-2 text-sm shadow-none", {
|
|
71
71
|
variants: {
|
|
72
72
|
size: {
|
|
73
73
|
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
|
|
@@ -88,17 +88,17 @@ function Z({
|
|
|
88
88
|
...o
|
|
89
89
|
}) {
|
|
90
90
|
return /* @__PURE__ */ e(
|
|
91
|
-
|
|
91
|
+
E,
|
|
92
92
|
{
|
|
93
93
|
type: n,
|
|
94
94
|
"data-size": l,
|
|
95
95
|
variant: a,
|
|
96
|
-
className: y(
|
|
96
|
+
className: y(He({ size: l }), t),
|
|
97
97
|
...o
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function Ve({ className: t, ...n }) {
|
|
102
102
|
return /* @__PURE__ */ e(
|
|
103
103
|
le,
|
|
104
104
|
{
|
|
@@ -111,17 +111,17 @@ function Ke({ className: t, ...n }) {
|
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
const t =
|
|
114
|
+
const qe = _(null), Ke = _(null), ee = () => W(qe), $e = () => W(Ke), te = _(null), G = () => {
|
|
115
|
+
const t = $e(), n = W(te), a = t ?? n;
|
|
116
116
|
if (!a)
|
|
117
117
|
throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");
|
|
118
118
|
return a;
|
|
119
119
|
};
|
|
120
|
-
function
|
|
121
|
-
var
|
|
122
|
-
const l = G(), o = t.filename || "",
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
/* @__PURE__ */ e(ce, { asChild: !0, children: /* @__PURE__ */
|
|
120
|
+
function Xe({ data: t, className: n, ...a }) {
|
|
121
|
+
var f;
|
|
122
|
+
const l = G(), o = t.filename || "", u = ((f = t.mediaType) != null && f.startsWith("image/") && t.url ? "image" : "file") === "image", g = o || (u ? "Image" : "Attachment");
|
|
123
|
+
return /* @__PURE__ */ N(lt, { children: [
|
|
124
|
+
/* @__PURE__ */ e(ce, { asChild: !0, children: /* @__PURE__ */ N(
|
|
125
125
|
"div",
|
|
126
126
|
{
|
|
127
127
|
className: y(
|
|
@@ -130,8 +130,8 @@ function Je({ data: t, className: n, ...a }) {
|
|
|
130
130
|
),
|
|
131
131
|
...a,
|
|
132
132
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */ e("div", { className: "absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0", children:
|
|
133
|
+
/* @__PURE__ */ N("div", { className: "relative size-5 shrink-0", children: [
|
|
134
|
+
/* @__PURE__ */ e("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__ */ e(
|
|
135
135
|
"img",
|
|
136
136
|
{
|
|
137
137
|
alt: o || "attachment",
|
|
@@ -141,30 +141,30 @@ function Je({ data: t, className: n, ...a }) {
|
|
|
141
141
|
width: 20
|
|
142
142
|
}
|
|
143
143
|
) : /* @__PURE__ */ e("div", { className: "flex size-5 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ e(Se, { className: "size-3" }) }) }),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
144
|
+
/* @__PURE__ */ N(
|
|
145
|
+
E,
|
|
146
146
|
{
|
|
147
147
|
"aria-label": "Remove attachment",
|
|
148
148
|
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",
|
|
149
|
-
onClick: (
|
|
150
|
-
|
|
149
|
+
onClick: (m) => {
|
|
150
|
+
m.stopPropagation(), l.remove(t.id);
|
|
151
151
|
},
|
|
152
152
|
type: "button",
|
|
153
153
|
variant: "ghost",
|
|
154
154
|
children: [
|
|
155
|
-
/* @__PURE__ */ e(
|
|
155
|
+
/* @__PURE__ */ e(Y, {}),
|
|
156
156
|
/* @__PURE__ */ e("span", { className: "sr-only", children: "Remove" })
|
|
157
157
|
]
|
|
158
158
|
}
|
|
159
159
|
)
|
|
160
160
|
] }),
|
|
161
|
-
/* @__PURE__ */ e("span", { className: "flex-1 truncate", children:
|
|
161
|
+
/* @__PURE__ */ e("span", { className: "flex-1 truncate", children: g })
|
|
162
162
|
]
|
|
163
163
|
},
|
|
164
164
|
t.id
|
|
165
165
|
) }),
|
|
166
|
-
/* @__PURE__ */ e(
|
|
167
|
-
|
|
166
|
+
/* @__PURE__ */ e(ct, { className: "w-auto p-2", children: /* @__PURE__ */ N("div", { className: "w-auto space-y-3", children: [
|
|
167
|
+
u && /* @__PURE__ */ e("div", { className: "flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border", children: /* @__PURE__ */ e(
|
|
168
168
|
"img",
|
|
169
169
|
{
|
|
170
170
|
alt: o || "attachment preview",
|
|
@@ -174,184 +174,184 @@ function Je({ data: t, className: n, ...a }) {
|
|
|
174
174
|
width: 448
|
|
175
175
|
}
|
|
176
176
|
) }),
|
|
177
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2.5", children: /* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */ e("h4", { className: "truncate text-sm font-semibold leading-none", children: o || (
|
|
177
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2.5", children: /* @__PURE__ */ N("div", { className: "min-w-0 flex-1 space-y-1 px-0.5", children: [
|
|
178
|
+
/* @__PURE__ */ e("h4", { className: "truncate text-sm font-semibold leading-none", children: o || (u ? "Image" : "Attachment") }),
|
|
179
179
|
t.mediaType && /* @__PURE__ */ e("p", { className: "truncate font-mono text-xs text-muted-foreground", children: t.mediaType })
|
|
180
180
|
] }) })
|
|
181
181
|
] }) })
|
|
182
182
|
] });
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function Ye({ children: t, className: n, ...a }) {
|
|
185
185
|
const l = G();
|
|
186
|
-
return l.files.length ? /* @__PURE__ */ e("div", { className: y("flex flex-wrap items-center gap-2 p-3", n), ...a, children: l.files.map((o) => /* @__PURE__ */ e(
|
|
186
|
+
return l.files.length ? /* @__PURE__ */ e("div", { className: y("flex flex-wrap items-center gap-2 p-3", n), ...a, children: l.files.map((o) => /* @__PURE__ */ e(Oe, { children: t(o) }, o.id)) }) : null;
|
|
187
187
|
}
|
|
188
|
-
const
|
|
188
|
+
const Je = ({
|
|
189
189
|
label: t = "Add photos or files",
|
|
190
190
|
...n
|
|
191
191
|
}) => {
|
|
192
192
|
const a = G();
|
|
193
|
-
return /* @__PURE__ */
|
|
194
|
-
|
|
193
|
+
return /* @__PURE__ */ N(
|
|
194
|
+
pe,
|
|
195
195
|
{
|
|
196
196
|
...n,
|
|
197
197
|
onSelect: (l) => {
|
|
198
198
|
l.preventDefault(), a.openFileDialog();
|
|
199
199
|
},
|
|
200
200
|
children: [
|
|
201
|
-
/* @__PURE__ */ e(
|
|
201
|
+
/* @__PURE__ */ e(ze, { className: "mr-2 size-4" }),
|
|
202
202
|
" ",
|
|
203
203
|
t
|
|
204
204
|
]
|
|
205
205
|
}
|
|
206
206
|
);
|
|
207
|
-
},
|
|
207
|
+
}, Qe = ({
|
|
208
208
|
className: t,
|
|
209
209
|
accept: n,
|
|
210
210
|
multiple: a,
|
|
211
211
|
globalDrop: l,
|
|
212
212
|
syncHiddenInput: o,
|
|
213
|
-
maxFiles:
|
|
214
|
-
maxFileSize:
|
|
215
|
-
onError:
|
|
216
|
-
onSubmit:
|
|
217
|
-
children:
|
|
213
|
+
maxFiles: d,
|
|
214
|
+
maxFileSize: u,
|
|
215
|
+
onError: g,
|
|
216
|
+
onSubmit: f,
|
|
217
|
+
children: m,
|
|
218
218
|
...I
|
|
219
219
|
}) => {
|
|
220
|
-
const
|
|
221
|
-
|
|
220
|
+
const s = ee(), i = !!s, h = F(null), z = F(null), S = F(null);
|
|
221
|
+
A(() => {
|
|
222
222
|
var v;
|
|
223
|
-
const
|
|
224
|
-
|
|
223
|
+
const r = (v = z.current) == null ? void 0 : v.closest("form");
|
|
224
|
+
r instanceof HTMLFormElement && (S.current = r);
|
|
225
225
|
}, []);
|
|
226
|
-
const [k,
|
|
227
|
-
var
|
|
228
|
-
(
|
|
229
|
-
}, []),
|
|
230
|
-
(
|
|
226
|
+
const [k, D] = L([]), P = i ? s.attachments.files : k, V = O(() => {
|
|
227
|
+
var r;
|
|
228
|
+
(r = h.current) == null || r.click();
|
|
229
|
+
}, []), w = O(
|
|
230
|
+
(r) => !n || n.trim() === "" ? !0 : n.includes("image/*") ? r.type.startsWith("image/") : !0,
|
|
231
231
|
[n]
|
|
232
|
-
),
|
|
233
|
-
(
|
|
234
|
-
const v = Array.from(
|
|
232
|
+
), j = O(
|
|
233
|
+
(r) => {
|
|
234
|
+
const v = Array.from(r), p = v.filter((x) => w(x));
|
|
235
235
|
if (v.length && p.length === 0) {
|
|
236
|
-
|
|
236
|
+
g == null || g({
|
|
237
237
|
code: "accept",
|
|
238
238
|
message: "No files match the accepted types."
|
|
239
239
|
});
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
|
-
const
|
|
242
|
+
const c = (x) => u ? x.size <= u : !0, b = p.filter(c);
|
|
243
243
|
if (p.length > 0 && b.length === 0) {
|
|
244
|
-
|
|
244
|
+
g == null || g({
|
|
245
245
|
code: "max_file_size",
|
|
246
246
|
message: "All files exceed the maximum size."
|
|
247
247
|
});
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
const C = typeof
|
|
252
|
-
typeof C == "number" && b.length > C && (
|
|
250
|
+
D((x) => {
|
|
251
|
+
const C = typeof d == "number" ? Math.max(0, d - x.length) : void 0, oe = typeof C == "number" ? b.slice(0, C) : b;
|
|
252
|
+
typeof C == "number" && b.length > C && (g == null || g({
|
|
253
253
|
code: "max_files",
|
|
254
254
|
message: "Too many files. Some were not added."
|
|
255
255
|
}));
|
|
256
|
-
const
|
|
256
|
+
const K = [];
|
|
257
257
|
for (const B of oe)
|
|
258
|
-
|
|
258
|
+
K.push({
|
|
259
259
|
id: Ue(),
|
|
260
260
|
type: "file",
|
|
261
261
|
url: URL.createObjectURL(B),
|
|
262
262
|
mediaType: B.type,
|
|
263
263
|
filename: B.name
|
|
264
264
|
});
|
|
265
|
-
return x.concat(
|
|
265
|
+
return x.concat(K);
|
|
266
266
|
});
|
|
267
267
|
},
|
|
268
|
-
[
|
|
269
|
-
),
|
|
270
|
-
const p = v.find((
|
|
271
|
-
return p != null && p.url && URL.revokeObjectURL(p.url), v.filter((
|
|
272
|
-
}),
|
|
273
|
-
for (const v of
|
|
268
|
+
[w, d, u, g]
|
|
269
|
+
), T = i ? (r) => s.attachments.add(r) : j, M = i ? (r) => s.attachments.remove(r) : (r) => D((v) => {
|
|
270
|
+
const p = v.find((c) => c.id === r);
|
|
271
|
+
return p != null && p.url && URL.revokeObjectURL(p.url), v.filter((c) => c.id !== r);
|
|
272
|
+
}), R = i ? () => s.attachments.clear() : () => D((r) => {
|
|
273
|
+
for (const v of r)
|
|
274
274
|
v.url && URL.revokeObjectURL(v.url);
|
|
275
275
|
return [];
|
|
276
|
-
}),
|
|
277
|
-
|
|
278
|
-
i &&
|
|
279
|
-
var
|
|
280
|
-
return (
|
|
276
|
+
}), U = i ? () => s.attachments.openFileDialog() : V;
|
|
277
|
+
A(() => {
|
|
278
|
+
i && s.__registerFileInput(h, () => {
|
|
279
|
+
var r;
|
|
280
|
+
return (r = h.current) == null ? void 0 : r.click();
|
|
281
281
|
});
|
|
282
|
-
}, [i,
|
|
283
|
-
o &&
|
|
284
|
-
}, [
|
|
285
|
-
const
|
|
286
|
-
if (!
|
|
287
|
-
const v = (
|
|
282
|
+
}, [i, s]), A(() => {
|
|
283
|
+
o && h.current && P.length === 0 && (h.current.value = "");
|
|
284
|
+
}, [P, o]), A(() => {
|
|
285
|
+
const r = S.current;
|
|
286
|
+
if (!r) return;
|
|
287
|
+
const v = (c) => {
|
|
288
288
|
var b, x;
|
|
289
|
-
(x = (b =
|
|
290
|
-
}, p = (
|
|
289
|
+
(x = (b = c.dataTransfer) == null ? void 0 : b.types) != null && x.includes("Files") && c.preventDefault();
|
|
290
|
+
}, p = (c) => {
|
|
291
291
|
var b, x, C;
|
|
292
|
-
(x = (b =
|
|
292
|
+
(x = (b = c.dataTransfer) == null ? void 0 : b.types) != null && x.includes("Files") && c.preventDefault(), (C = c.dataTransfer) != null && C.files && c.dataTransfer.files.length > 0 && T(c.dataTransfer.files);
|
|
293
293
|
};
|
|
294
|
-
return
|
|
295
|
-
|
|
294
|
+
return r.addEventListener("dragover", v), r.addEventListener("drop", p), () => {
|
|
295
|
+
r.removeEventListener("dragover", v), r.removeEventListener("drop", p);
|
|
296
296
|
};
|
|
297
|
-
}, [
|
|
297
|
+
}, [T]), A(() => {
|
|
298
298
|
if (!l) return;
|
|
299
|
-
const
|
|
300
|
-
var
|
|
301
|
-
(b = (
|
|
299
|
+
const r = (p) => {
|
|
300
|
+
var c, b;
|
|
301
|
+
(b = (c = p.dataTransfer) == null ? void 0 : c.types) != null && b.includes("Files") && p.preventDefault();
|
|
302
302
|
}, v = (p) => {
|
|
303
|
-
var
|
|
304
|
-
(b = (
|
|
303
|
+
var c, b, x;
|
|
304
|
+
(b = (c = p.dataTransfer) == null ? void 0 : c.types) != null && b.includes("Files") && p.preventDefault(), (x = p.dataTransfer) != null && x.files && p.dataTransfer.files.length > 0 && T(p.dataTransfer.files);
|
|
305
305
|
};
|
|
306
|
-
return document.addEventListener("dragover",
|
|
307
|
-
document.removeEventListener("dragover",
|
|
306
|
+
return document.addEventListener("dragover", r), document.addEventListener("drop", v), () => {
|
|
307
|
+
document.removeEventListener("dragover", r), document.removeEventListener("drop", v);
|
|
308
308
|
};
|
|
309
|
-
}, [
|
|
309
|
+
}, [T, l]), A(
|
|
310
310
|
() => () => {
|
|
311
311
|
if (!i)
|
|
312
|
-
for (const
|
|
313
|
-
|
|
312
|
+
for (const r of P)
|
|
313
|
+
r.url && URL.revokeObjectURL(r.url);
|
|
314
314
|
},
|
|
315
|
-
[i,
|
|
315
|
+
[i, P]
|
|
316
316
|
);
|
|
317
|
-
const ne = (
|
|
318
|
-
|
|
319
|
-
}, se = async (
|
|
320
|
-
const p = await (await fetch(
|
|
321
|
-
return new Promise((
|
|
317
|
+
const ne = (r) => {
|
|
318
|
+
r.currentTarget.files && T(r.currentTarget.files);
|
|
319
|
+
}, se = async (r) => {
|
|
320
|
+
const p = await (await fetch(r)).blob();
|
|
321
|
+
return new Promise((c, b) => {
|
|
322
322
|
const x = new FileReader();
|
|
323
|
-
x.onloadend = () =>
|
|
323
|
+
x.onloadend = () => c(x.result), x.onerror = b, x.readAsDataURL(p);
|
|
324
324
|
});
|
|
325
|
-
}, re =
|
|
325
|
+
}, re = Fe(
|
|
326
326
|
() => ({
|
|
327
|
-
files:
|
|
328
|
-
add:
|
|
329
|
-
remove:
|
|
330
|
-
clear:
|
|
331
|
-
openFileDialog:
|
|
332
|
-
fileInputRef:
|
|
327
|
+
files: P.map((r) => ({ ...r, id: r.id })),
|
|
328
|
+
add: T,
|
|
329
|
+
remove: M,
|
|
330
|
+
clear: R,
|
|
331
|
+
openFileDialog: U,
|
|
332
|
+
fileInputRef: h
|
|
333
333
|
}),
|
|
334
|
-
[
|
|
335
|
-
), ae = (
|
|
336
|
-
|
|
337
|
-
const v =
|
|
334
|
+
[P, T, M, R, U]
|
|
335
|
+
), ae = (r) => {
|
|
336
|
+
r.preventDefault();
|
|
337
|
+
const v = r.currentTarget, p = i ? s.textInput.value : new FormData(v).get("message") || "";
|
|
338
338
|
i || v.reset(), Promise.all(
|
|
339
|
-
|
|
340
|
-
...
|
|
341
|
-
url: await se(
|
|
342
|
-
} :
|
|
343
|
-
).then((
|
|
339
|
+
P.map(async ({ ...c }) => c.url && c.url.startsWith("blob:") ? {
|
|
340
|
+
...c,
|
|
341
|
+
url: await se(c.url)
|
|
342
|
+
} : c)
|
|
343
|
+
).then((c) => {
|
|
344
344
|
try {
|
|
345
|
-
const b =
|
|
345
|
+
const b = f({ text: p, files: c }, r);
|
|
346
346
|
b instanceof Promise ? b.then(() => {
|
|
347
|
-
|
|
347
|
+
R(), i && s.textInput.clear();
|
|
348
348
|
}).catch(() => {
|
|
349
|
-
}) : (
|
|
349
|
+
}) : (R(), i && s.textInput.clear());
|
|
350
350
|
} catch {
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
|
-
},
|
|
354
|
-
/* @__PURE__ */ e("span", { "aria-hidden": "true", className: "hidden", ref:
|
|
353
|
+
}, q = /* @__PURE__ */ N(ie, { children: [
|
|
354
|
+
/* @__PURE__ */ e("span", { "aria-hidden": "true", className: "hidden", ref: z }),
|
|
355
355
|
/* @__PURE__ */ e(
|
|
356
356
|
"input",
|
|
357
357
|
{
|
|
@@ -360,82 +360,82 @@ const Ze = ({
|
|
|
360
360
|
className: "hidden",
|
|
361
361
|
multiple: a,
|
|
362
362
|
onChange: ne,
|
|
363
|
-
ref:
|
|
363
|
+
ref: h,
|
|
364
364
|
title: "Upload files",
|
|
365
365
|
type: "file"
|
|
366
366
|
}
|
|
367
367
|
),
|
|
368
|
-
/* @__PURE__ */ e("form", { className: y("w-full", t), onSubmit: ae, ...I, children: /* @__PURE__ */ e(
|
|
368
|
+
/* @__PURE__ */ e("form", { className: y("w-full", t), onSubmit: ae, ...I, children: /* @__PURE__ */ e(We, { className: "overflow-hidden", children: m }) })
|
|
369
369
|
] });
|
|
370
|
-
return i ?
|
|
371
|
-
},
|
|
370
|
+
return i ? q : /* @__PURE__ */ e(te.Provider, { value: re, children: q });
|
|
371
|
+
}, Ze = ({
|
|
372
372
|
onChange: t,
|
|
373
373
|
className: n,
|
|
374
374
|
placeholder: a = "What would you like to know?",
|
|
375
375
|
...l
|
|
376
376
|
}) => {
|
|
377
|
-
const o = ee(),
|
|
378
|
-
if (
|
|
379
|
-
if (
|
|
377
|
+
const o = ee(), d = G(), [u, g] = L(!1), f = (s) => {
|
|
378
|
+
if (s.key === "Enter") {
|
|
379
|
+
if (u || s.nativeEvent.isComposing || s.shiftKey)
|
|
380
380
|
return;
|
|
381
|
-
|
|
382
|
-
const i =
|
|
383
|
-
if (
|
|
381
|
+
s.preventDefault();
|
|
382
|
+
const i = s.currentTarget.form, h = i == null ? void 0 : i.querySelector('button[type="submit"]');
|
|
383
|
+
if (h != null && h.disabled)
|
|
384
384
|
return;
|
|
385
385
|
i == null || i.requestSubmit();
|
|
386
386
|
}
|
|
387
|
-
if (
|
|
388
|
-
|
|
389
|
-
const i =
|
|
390
|
-
i &&
|
|
387
|
+
if (s.key === "Backspace" && s.currentTarget.value === "" && d.files.length > 0) {
|
|
388
|
+
s.preventDefault();
|
|
389
|
+
const i = d.files.at(-1);
|
|
390
|
+
i && d.remove(i.id);
|
|
391
391
|
}
|
|
392
|
-
},
|
|
393
|
-
var
|
|
394
|
-
const i = (
|
|
392
|
+
}, m = (s) => {
|
|
393
|
+
var z;
|
|
394
|
+
const i = (z = s.clipboardData) == null ? void 0 : z.items;
|
|
395
395
|
if (!i)
|
|
396
396
|
return;
|
|
397
|
-
const
|
|
397
|
+
const h = [];
|
|
398
398
|
for (const S of i)
|
|
399
399
|
if (S.kind === "file") {
|
|
400
400
|
const k = S.getAsFile();
|
|
401
|
-
k &&
|
|
401
|
+
k && h.push(k);
|
|
402
402
|
}
|
|
403
|
-
|
|
403
|
+
h.length > 0 && (s.preventDefault(), d.add(h));
|
|
404
404
|
}, I = o ? {
|
|
405
405
|
value: o.textInput.value,
|
|
406
|
-
onChange: (
|
|
407
|
-
o.textInput.setInput(
|
|
406
|
+
onChange: (s) => {
|
|
407
|
+
o.textInput.setInput(s.currentTarget.value), t == null || t(s);
|
|
408
408
|
}
|
|
409
409
|
} : {
|
|
410
410
|
onChange: t
|
|
411
411
|
};
|
|
412
412
|
return /* @__PURE__ */ e(
|
|
413
|
-
|
|
413
|
+
Ve,
|
|
414
414
|
{
|
|
415
415
|
className: y("field-sizing-content max-h-48 min-h-16", n),
|
|
416
416
|
name: "message",
|
|
417
|
-
onCompositionEnd: () =>
|
|
418
|
-
onCompositionStart: () =>
|
|
419
|
-
onKeyDown:
|
|
420
|
-
onPaste:
|
|
417
|
+
onCompositionEnd: () => g(!1),
|
|
418
|
+
onCompositionStart: () => g(!0),
|
|
419
|
+
onKeyDown: f,
|
|
420
|
+
onPaste: m,
|
|
421
421
|
placeholder: a,
|
|
422
422
|
...l,
|
|
423
423
|
...I
|
|
424
424
|
}
|
|
425
425
|
);
|
|
426
|
-
},
|
|
426
|
+
}, et = ({ className: t, ...n }) => /* @__PURE__ */ e(Q, { align: "block-end", className: y("order-first flex-wrap gap-1", t), ...n }), tt = ({ className: t, ...n }) => /* @__PURE__ */ e(Q, { align: "block-end", className: y("justify-between gap-1", t), ...n }), nt = ({ className: t, ...n }) => /* @__PURE__ */ e("div", { className: y("flex items-center gap-1", t), ...n }), H = ({ variant: t = "ghost", className: n, size: a, ...l }) => {
|
|
427
427
|
const o = a ?? (Be.count(l.children) > 1 ? "sm" : "icon-sm");
|
|
428
428
|
return /* @__PURE__ */ e(Z, { className: y(n), size: o, type: "button", variant: t, ...l });
|
|
429
|
-
},
|
|
429
|
+
}, st = (t) => /* @__PURE__ */ e(ue, { ...t }), rt = ({ className: t, children: n, ...a }) => /* @__PURE__ */ e(de, { asChild: !0, children: /* @__PURE__ */ e(H, { className: t, ...a, children: n ?? /* @__PURE__ */ e(ke, { className: "size-4" }) }) }), at = ({ className: t, ...n }) => /* @__PURE__ */ e(me, { align: "start", className: y(t), ...n }), ot = ({
|
|
430
430
|
className: t,
|
|
431
431
|
variant: n = "default",
|
|
432
432
|
size: a = "icon-sm",
|
|
433
433
|
status: l,
|
|
434
434
|
children: o,
|
|
435
|
-
...
|
|
435
|
+
...d
|
|
436
436
|
}) => {
|
|
437
|
-
let
|
|
438
|
-
return l === "submitted" ?
|
|
437
|
+
let u = /* @__PURE__ */ e(Pe, { className: "size-4" });
|
|
438
|
+
return l === "submitted" ? u = /* @__PURE__ */ e(Te, { className: "size-4 animate-spin" }) : l === "streaming" ? u = /* @__PURE__ */ e(Ae, { className: "size-4" }) : l === "error" && (u = /* @__PURE__ */ e(Y, { className: "size-4" })), /* @__PURE__ */ e(
|
|
439
439
|
Z,
|
|
440
440
|
{
|
|
441
441
|
"aria-label": "Submit",
|
|
@@ -443,69 +443,69 @@ const Ze = ({
|
|
|
443
443
|
size: a,
|
|
444
444
|
type: "submit",
|
|
445
445
|
variant: n,
|
|
446
|
-
...
|
|
447
|
-
children: o ??
|
|
446
|
+
...d,
|
|
447
|
+
children: o ?? u
|
|
448
448
|
}
|
|
449
449
|
);
|
|
450
|
-
},
|
|
450
|
+
}, it = ({
|
|
451
451
|
className: t,
|
|
452
452
|
textareaRef: n,
|
|
453
453
|
onTranscriptionChange: a,
|
|
454
454
|
...l
|
|
455
455
|
}) => {
|
|
456
|
-
const [o,
|
|
457
|
-
|
|
456
|
+
const [o, d] = L(!1), [u, g] = L(null), f = F(null);
|
|
457
|
+
A(() => {
|
|
458
458
|
if (typeof window < "u" && ("SpeechRecognition" in window || "webkitSpeechRecognition" in window)) {
|
|
459
|
-
const I = window.SpeechRecognition || window.webkitSpeechRecognition,
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
},
|
|
463
|
-
|
|
464
|
-
},
|
|
465
|
-
var
|
|
466
|
-
let
|
|
459
|
+
const I = window.SpeechRecognition || window.webkitSpeechRecognition, s = new I();
|
|
460
|
+
s.continuous = !0, s.interimResults = !0, s.lang = "en-US", s.onstart = () => {
|
|
461
|
+
d(!0);
|
|
462
|
+
}, s.onend = () => {
|
|
463
|
+
d(!1);
|
|
464
|
+
}, s.onresult = (i) => {
|
|
465
|
+
var z;
|
|
466
|
+
let h = "";
|
|
467
467
|
for (let S = i.resultIndex; S < i.results.length; S++) {
|
|
468
468
|
const k = i.results[S];
|
|
469
|
-
k.isFinal && (
|
|
469
|
+
k.isFinal && (h += ((z = k[0]) == null ? void 0 : z.transcript) ?? "");
|
|
470
470
|
}
|
|
471
|
-
if (
|
|
472
|
-
const S = n.current, k = S.value,
|
|
473
|
-
S.value =
|
|
471
|
+
if (h && (n != null && n.current)) {
|
|
472
|
+
const S = n.current, k = S.value, D = k + (k ? " " : "") + h;
|
|
473
|
+
S.value = D, S.dispatchEvent(new Event("input", { bubbles: !0 })), a == null || a(D);
|
|
474
474
|
}
|
|
475
|
-
},
|
|
476
|
-
console.error("Speech recognition error:", i.error),
|
|
477
|
-
},
|
|
475
|
+
}, s.onerror = (i) => {
|
|
476
|
+
console.error("Speech recognition error:", i.error), d(!1);
|
|
477
|
+
}, f.current = s, Ge(() => g(s));
|
|
478
478
|
}
|
|
479
479
|
return () => {
|
|
480
|
-
|
|
480
|
+
f.current && f.current.stop();
|
|
481
481
|
};
|
|
482
482
|
}, [n, a]);
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
}, [
|
|
483
|
+
const m = O(() => {
|
|
484
|
+
u && (o ? u.stop() : u.start());
|
|
485
|
+
}, [u, o]);
|
|
486
486
|
return /* @__PURE__ */ e(
|
|
487
|
-
|
|
487
|
+
H,
|
|
488
488
|
{
|
|
489
489
|
className: y(
|
|
490
490
|
"relative transition-all duration-200",
|
|
491
491
|
o && "animate-pulse bg-accent text-accent-foreground",
|
|
492
492
|
t
|
|
493
493
|
),
|
|
494
|
-
disabled: !
|
|
495
|
-
onClick:
|
|
494
|
+
disabled: !u,
|
|
495
|
+
onClick: m,
|
|
496
496
|
...l,
|
|
497
|
-
children: /* @__PURE__ */ e(
|
|
497
|
+
children: /* @__PURE__ */ e(De, { className: "size-4" })
|
|
498
498
|
}
|
|
499
499
|
);
|
|
500
|
-
},
|
|
500
|
+
}, lt = ({ openDelay: t = 0, closeDelay: n = 0, ...a }) => /* @__PURE__ */ e(fe, { closeDelay: n, openDelay: t, ...a }), ct = ({ align: t = "start", ...n }) => /* @__PURE__ */ e(he, { align: t, ...n }), ut = (t) => /* @__PURE__ */ e(ge, { ...t }), dt = (t) => /* @__PURE__ */ e(ve, { ...t }), mt = ({
|
|
501
501
|
className: t,
|
|
502
502
|
children: n,
|
|
503
503
|
title: a = "Model Selector",
|
|
504
504
|
...l
|
|
505
|
-
}) => /* @__PURE__ */
|
|
505
|
+
}) => /* @__PURE__ */ N(be, { className: y("p-0", t), ...l, children: [
|
|
506
506
|
/* @__PURE__ */ e(xe, { className: "sr-only", children: a }),
|
|
507
507
|
/* @__PURE__ */ e(we, { className: "**:data-[slot=command-input-wrapper]:h-auto", children: n })
|
|
508
|
-
] }),
|
|
508
|
+
] }), pt = (t) => /* @__PURE__ */ e(Ne, { ...t }), ft = (t) => /* @__PURE__ */ e(ye, { ...t }), ht = (t) => /* @__PURE__ */ e(Ie, { ...t }), gt = ({ provider: t, className: n, ...a }) => /* @__PURE__ */ e(
|
|
509
509
|
"img",
|
|
510
510
|
{
|
|
511
511
|
...a,
|
|
@@ -515,117 +515,112 @@ const Ze = ({
|
|
|
515
515
|
src: `https://models.dev/logos/${t}.svg`,
|
|
516
516
|
width: 12
|
|
517
517
|
}
|
|
518
|
-
),
|
|
518
|
+
), vt = ({ className: t, ...n }) => /* @__PURE__ */ e("span", { className: y("flex-1 truncate text-left", t), ...n }), bt = ({
|
|
519
519
|
selectedModel: t,
|
|
520
520
|
onModelChange: n,
|
|
521
521
|
disabled: a = !1
|
|
522
522
|
}) => {
|
|
523
|
-
const [l, o] =
|
|
524
|
-
(
|
|
523
|
+
const [l, o] = L(!1), { models: d } = J(), u = d.find((m) => m.id === t) || d[0], g = d.reduce(
|
|
524
|
+
(m, I) => (m[I.provider] || (m[I.provider] = []), m[I.provider].push(I), m),
|
|
525
525
|
{}
|
|
526
|
-
),
|
|
527
|
-
n(
|
|
526
|
+
), f = (m) => {
|
|
527
|
+
n(m), o(!1);
|
|
528
528
|
};
|
|
529
|
-
return /* @__PURE__ */
|
|
530
|
-
/* @__PURE__ */ e(
|
|
529
|
+
return /* @__PURE__ */ N(ut, { open: l, onOpenChange: o, children: [
|
|
530
|
+
/* @__PURE__ */ e(dt, { asChild: !0, children: /* @__PURE__ */ N(E, { variant: "outline", size: "sm", disabled: a, className: "h-8 gap-1 px-2 text-xs", children: [
|
|
531
531
|
/* @__PURE__ */ e(Le, { size: 14 }),
|
|
532
|
-
/* @__PURE__ */ e("span", { className: "max-w-20 truncate", children:
|
|
532
|
+
/* @__PURE__ */ e("span", { className: "max-w-20 truncate", children: u.name })
|
|
533
533
|
] }) }),
|
|
534
|
-
/* @__PURE__ */
|
|
534
|
+
/* @__PURE__ */ N(mt, { className: "w-96 p-0", children: [
|
|
535
535
|
/* @__PURE__ */ e("h3", { className: "mt-2 px-2 py-2 font-semibold", children: "Models" }),
|
|
536
|
-
/* @__PURE__ */ e(
|
|
537
|
-
|
|
536
|
+
/* @__PURE__ */ e(pt, { children: Object.entries(g).map(([m, I]) => /* @__PURE__ */ e(ft, { heading: m.charAt(0).toUpperCase() + m.slice(1), children: I.map((s) => /* @__PURE__ */ N(
|
|
537
|
+
ht,
|
|
538
538
|
{
|
|
539
|
-
value:
|
|
540
|
-
onSelect: () =>
|
|
539
|
+
value: s.id,
|
|
540
|
+
onSelect: () => f(s.id),
|
|
541
541
|
className: "flex cursor-pointer items-center gap-2 p-2",
|
|
542
542
|
children: [
|
|
543
|
-
/* @__PURE__ */ e(
|
|
544
|
-
/* @__PURE__ */
|
|
545
|
-
/* @__PURE__ */ e(
|
|
546
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children:
|
|
543
|
+
/* @__PURE__ */ e(gt, { provider: s.provider }),
|
|
544
|
+
/* @__PURE__ */ N("div", { className: "flex flex-1 items-center justify-between", children: [
|
|
545
|
+
/* @__PURE__ */ e(vt, { children: s.name }),
|
|
546
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: s.description })
|
|
547
547
|
] }),
|
|
548
|
-
t ===
|
|
548
|
+
t === s.id && /* @__PURE__ */ e("div", { className: "h-2 w-2 rounded-full bg-blue-500" })
|
|
549
549
|
]
|
|
550
550
|
},
|
|
551
|
-
|
|
552
|
-
)) },
|
|
551
|
+
s.id
|
|
552
|
+
)) }, m)) })
|
|
553
553
|
] })
|
|
554
554
|
] });
|
|
555
|
-
},
|
|
555
|
+
}, $ = "chai-ai-selected-model", Pt = ({
|
|
556
556
|
input: t,
|
|
557
557
|
setInput: n,
|
|
558
558
|
onSend: a,
|
|
559
559
|
onStop: l,
|
|
560
560
|
isLoading: o,
|
|
561
|
-
disabled:
|
|
562
|
-
selectedLang:
|
|
563
|
-
selectedModel:
|
|
564
|
-
onModelChange:
|
|
561
|
+
disabled: d,
|
|
562
|
+
selectedLang: u,
|
|
563
|
+
selectedModel: g,
|
|
564
|
+
onModelChange: f
|
|
565
565
|
}) => {
|
|
566
|
-
const { t:
|
|
567
|
-
return
|
|
568
|
-
if (!
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
r(f), c == null || c(f);
|
|
572
|
-
else {
|
|
573
|
-
const P = E().id;
|
|
574
|
-
r(P), c == null || c(P);
|
|
575
|
-
}
|
|
566
|
+
const { t: m } = Ee(), { models: I } = J(), s = I.find((w) => w.id === "google/gemini-3-flash") || I[0], [i, h] = L(g || s.id), [z, S] = L(null), k = F(null), [D, P] = L(!1);
|
|
567
|
+
return A(() => {
|
|
568
|
+
if (!u) {
|
|
569
|
+
const w = localStorage.getItem($);
|
|
570
|
+
w ? (h(w), f == null || f(w)) : (h(s.id), f == null || f(s.id));
|
|
576
571
|
}
|
|
577
|
-
}, [
|
|
578
|
-
var
|
|
579
|
-
const
|
|
580
|
-
var
|
|
581
|
-
return (
|
|
582
|
-
}),
|
|
583
|
-
a((
|
|
572
|
+
}, [u, f, s.id]), /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e("div", { className: "border-gray-20 rounded-lg border", children: /* @__PURE__ */ N(Qe, { onSubmit: (w) => {
|
|
573
|
+
var M;
|
|
574
|
+
const j = w.files.find((R) => {
|
|
575
|
+
var U;
|
|
576
|
+
return (U = R.mediaType) == null ? void 0 : U.startsWith("image/");
|
|
577
|
+
}), T = (j == null ? void 0 : j.url) || z;
|
|
578
|
+
a((M = w.text) == null ? void 0 : M.trim(), void 0, T, i), S(null);
|
|
584
579
|
}, accept: "image/*", className: "flex h-auto w-full flex-col", children: [
|
|
585
|
-
/* @__PURE__ */ e(
|
|
580
|
+
/* @__PURE__ */ e(et, { className: "p-0", children: /* @__PURE__ */ e(Ye, { className: "pb-0", children: (w) => /* @__PURE__ */ e(Xe, { className: "text-xs", data: w }) }) }),
|
|
586
581
|
/* @__PURE__ */ e(
|
|
587
|
-
|
|
582
|
+
Ze,
|
|
588
583
|
{
|
|
589
|
-
ref:
|
|
584
|
+
ref: k,
|
|
590
585
|
value: t,
|
|
591
|
-
onChange: (
|
|
592
|
-
placeholder:
|
|
586
|
+
onChange: (w) => n(w.target.value),
|
|
587
|
+
placeholder: m(u ? "Ask to update content" : "Ask me anything..."),
|
|
593
588
|
disabled: o,
|
|
594
589
|
className: "max-h-[200px] min-h-[60px] w-full",
|
|
595
590
|
rows: 3
|
|
596
591
|
}
|
|
597
592
|
),
|
|
598
|
-
/* @__PURE__ */
|
|
599
|
-
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
/* @__PURE__ */ e(
|
|
602
|
-
/* @__PURE__ */ e(
|
|
593
|
+
/* @__PURE__ */ N(tt, { children: [
|
|
594
|
+
u ? /* @__PURE__ */ e("div", {}) : /* @__PURE__ */ N(nt, { children: [
|
|
595
|
+
/* @__PURE__ */ N(st, { children: [
|
|
596
|
+
/* @__PURE__ */ e(rt, { disabled: o, children: /* @__PURE__ */ e(Ce, { size: 16 }) }),
|
|
597
|
+
/* @__PURE__ */ e(at, { children: /* @__PURE__ */ e(Je, {}) })
|
|
603
598
|
] }),
|
|
604
599
|
/* @__PURE__ */ e(
|
|
605
|
-
|
|
600
|
+
it,
|
|
606
601
|
{
|
|
607
|
-
textareaRef:
|
|
602
|
+
textareaRef: k,
|
|
608
603
|
onTranscriptionChange: n,
|
|
609
604
|
disabled: o
|
|
610
605
|
}
|
|
611
606
|
),
|
|
612
607
|
/* @__PURE__ */ e(
|
|
613
|
-
|
|
608
|
+
bt,
|
|
614
609
|
{
|
|
615
|
-
selectedModel:
|
|
616
|
-
onModelChange: (
|
|
617
|
-
|
|
610
|
+
selectedModel: i,
|
|
611
|
+
onModelChange: (w) => {
|
|
612
|
+
h(w), f == null || f(w), localStorage.setItem($, w);
|
|
618
613
|
},
|
|
619
614
|
disabled: o
|
|
620
615
|
}
|
|
621
616
|
),
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
|
|
617
|
+
/* @__PURE__ */ N(
|
|
618
|
+
H,
|
|
624
619
|
{
|
|
625
620
|
className: "hidden",
|
|
626
621
|
size: "sm",
|
|
627
|
-
onClick: () =>
|
|
628
|
-
variant:
|
|
622
|
+
onClick: () => P(!D),
|
|
623
|
+
variant: D ? "default" : "ghost",
|
|
629
624
|
children: [
|
|
630
625
|
/* @__PURE__ */ e(Re, { size: 16 }),
|
|
631
626
|
/* @__PURE__ */ e("span", { children: "Search" })
|
|
@@ -638,13 +633,13 @@ const Ze = ({
|
|
|
638
633
|
{
|
|
639
634
|
onClick: l,
|
|
640
635
|
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",
|
|
641
|
-
title:
|
|
642
|
-
children: /* @__PURE__ */ e(
|
|
636
|
+
title: m("Stop generation"),
|
|
637
|
+
children: /* @__PURE__ */ e(je, { size: 16 })
|
|
643
638
|
}
|
|
644
|
-
) : /* @__PURE__ */ e(
|
|
639
|
+
) : /* @__PURE__ */ e(ot, { disabled: !t.trim() || d, children: /* @__PURE__ */ e(Me, { size: 16 }) })
|
|
645
640
|
] })
|
|
646
641
|
] }) }) });
|
|
647
642
|
};
|
|
648
643
|
export {
|
|
649
|
-
|
|
644
|
+
Pt as default
|
|
650
645
|
};
|