@chaibuilder/sdk 4.0.0-beta.3 → 4.0.0-beta.4
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-BnsZi3K3.cjs → 2SSKDMRQ-CopJgtZb.cjs} +1 -1
- package/dist/{2SSKDMRQ-CnSDkQcy.js → 2SSKDMRQ-Difo_1pg.js} +2 -2
- package/dist/{AP7HFJJL-CymCmW14.js → AP7HFJJL-BPuPBqj4.js} +1 -1
- package/dist/{AP7HFJJL-B31839PG.cjs → AP7HFJJL-DYxDgaOs.cjs} +1 -1
- package/dist/{IconPicker-B1rWC-Ex.js → IconPicker-B2-oriq2.js} +8 -7
- package/dist/IconPicker-C0oycHbs.cjs +1 -0
- package/dist/{WDYDFRGG-BxhOCHc3.cjs → WDYDFRGG-DbejaRPK.cjs} +1 -1
- package/dist/{WDYDFRGG-BUVnbAci.js → WDYDFRGG-KK8pkcW1.js} +2 -2
- package/dist/{actions-registery-YnFmU21O.cjs → actions-registery-JdxhXhT6.cjs} +1 -1
- package/dist/{actions-registery-CZ1w0NKa.js → actions-registery-y_ENc8zj.js} +2 -2
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/active-in-another-tab-Cu_ASKtx.cjs +1 -0
- package/dist/active-in-another-tab-DkR2HWI4.js +35 -0
- package/dist/add-new-language-page-BXuwluuU.cjs +1 -0
- package/dist/{add-new-language-page-WmlCnytQ.js → add-new-language-page-CBY0RR6q.js} +54 -53
- package/dist/{add-new-page-soZ8GAkN.cjs → add-new-page-C_PzKby8.cjs} +1 -1
- package/dist/{add-new-page-VW2wAYZp.js → add-new-page-DJLJFLAd.js} +2 -2
- package/dist/{ai-panel-content-D_o7Q_A-.js → ai-panel-content--YM01Aly.js} +12 -11
- package/dist/ai-panel-content-rRmJdH7L.cjs +1 -0
- package/dist/{ai-panel-default-lang-DnElspF0.js → ai-panel-default-lang-BZl0tPYo.js} +40 -40
- package/dist/{ai-panel-default-lang-COYaxNwn.cjs → ai-panel-default-lang-D2zhXvKP.cjs} +2 -2
- package/dist/{ai-panel-other-lang-Dp0E9_Hx.js → ai-panel-other-lang-Bfjk2CYZ.js} +8 -8
- package/dist/{ai-panel-other-lang-CkynNlAU.cjs → ai-panel-other-lang-Y4bEKHoG.cjs} +1 -1
- package/dist/{ai-prompt-input-Bhc0ds7X.js → ai-prompt-input-DueQYNf-.js} +68 -67
- package/dist/ai-prompt-input-N9PcYCFa.cjs +1 -0
- package/dist/{ai-translation-prompt-CZ55HQmo.js → ai-translation-prompt-B36F3d7K.js} +2 -2
- package/dist/ai-translation-prompt-IAdWMNZb.cjs +1 -0
- package/dist/{apply-binding-6iwlED02.js → apply-binding-BvWfJCSZ.js} +204 -196
- package/dist/apply-binding-IsUf6UWJ.cjs +1 -0
- package/dist/{code-display-DhD_RBcg.js → code-display-Ck81Id9K.js} +1 -1
- package/dist/code-display-DloSPyPr.cjs +1 -0
- package/dist/{code-editor-DRIAnNbb.js → code-editor-Bb7JumZy.js} +11 -10
- package/dist/code-editor-DQB8lAOk.cjs +1 -0
- package/dist/{continue-editing-in-this-client-CS2aQ7yY.js → continue-editing-in-this-client-Dm9cCj7K.js} +10 -9
- package/dist/continue-editing-in-this-client-DmGFLHXw.cjs +1 -0
- package/dist/core-Dr7QYemB.js +56 -0
- package/dist/core-Y0lXLwkq.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/core.js +41 -39
- package/dist/{css-import-modal-Byg6wV0O.js → css-import-modal-9P_0uNa4.js} +5 -3
- package/dist/css-import-modal-Rh1QAVxo.cjs +13 -0
- package/dist/{delete-design-token-DkVs1oBf.cjs → delete-design-token-BG8yHcS5.cjs} +1 -1
- package/dist/{delete-design-token-BRZZiWtQ.js → delete-design-token-COvR4G1S.js} +1 -1
- package/dist/{delete-page-BzyX9TN-.js → delete-page-CNucxe4P.js} +11 -10
- package/dist/delete-page-DAvEjHwF.cjs +1 -0
- package/dist/design-token-usage-CXglXgcJ.cjs +1 -0
- package/dist/{design-token-usage-xQs6SlaJ.js → design-token-usage-MNYsFlPG.js} +14 -13
- package/dist/digital-asset-manager-CB5MRBcW.cjs +1 -0
- package/dist/{digital-asset-manager-DbtwzxRz.js → digital-asset-manager-CqCWBO0s.js} +6 -5
- package/dist/{duplicate-page-BR7Dlo9d.js → duplicate-page-BknLfqr0.js} +19 -18
- package/dist/duplicate-page-DzZByALW.cjs +1 -0
- package/dist/{dynamic-page-selector-Cb5r_W8s.js → dynamic-page-selector-DoW7OyUB.js} +15 -14
- package/dist/dynamic-page-selector-WA007Sni.cjs +1 -0
- package/dist/get-chai-builder-tailwind-config-BFePCEIS.cjs +1 -0
- package/dist/{get-chai-builder-tailwind-config-DjoVOuAf.js → get-chai-builder-tailwind-config-BXf_xLHk.js} +5 -5
- package/dist/{get-chai-builder-theme-Dl72X7cz.cjs → get-chai-builder-theme-BApShjRz.cjs} +1 -1
- package/dist/{get-chai-builder-theme-BYtp20KD.js → get-chai-builder-theme-DDVRJQ6Z.js} +1 -1
- package/dist/{image-editor-DV8kUKhl.js → image-editor-CQnNtak2.js} +1 -1
- package/dist/{image-editor-G-K28aTS.cjs → image-editor-CqwaVxO2.cjs} +1 -1
- package/dist/index-C0-pgg_p.cjs +5 -0
- package/dist/index-C99FhuF1.cjs +160 -0
- package/dist/{index-ZuacEL1j.js → index-Dno42B0a.js} +672 -670
- package/dist/{index-Ct7ElCGK.js → index-rAcNbjk_.js} +3744 -3920
- package/dist/{json-diff-viewer-D7z4zNvv.cjs → json-diff-viewer-CLuUHiPU.cjs} +3 -3
- package/dist/{json-diff-viewer-krslPepD.js → json-diff-viewer-CMvGUvJ2.js} +5 -4
- package/dist/{lang-panel-BwIewMyw.js → lang-panel-CnwTb05j.js} +15 -14
- package/dist/lang-panel-fDCYm5Jm.cjs +1 -0
- package/dist/{manage-design-tokens-Caz_20VK.js → manage-design-tokens-BsSZE9Vs.js} +12 -11
- package/dist/manage-design-tokens-BvH5KTJX.cjs +1 -0
- package/dist/mark-as-template-CpWEBJGd.cjs +1 -0
- package/dist/{mark-as-template-D295ZQtU.js → mark-as-template-DBLshWb5.js} +17 -16
- package/dist/{nested-path-selector-content-CKYYK-C5.js → nested-path-selector-content-6OBJ8LG8.js} +24 -23
- package/dist/nested-path-selector-content-C2sD9dkq.cjs +1 -0
- package/dist/no-language-page-content-BvPDdccK.cjs +1 -0
- package/dist/{no-language-page-content-BvqRBP6y.js → no-language-page-content-CzENgtnu.js} +10 -9
- package/dist/{no-language-page-dialog-PjNqTUpl.js → no-language-page-dialog-CbYI2cVg.js} +2 -2
- package/dist/{no-language-page-dialog-BcEoqyQB.cjs → no-language-page-dialog-CgW4yJBC.cjs} +1 -1
- package/dist/{page-creator-DiOITEMw.js → page-creator-Cc83uQqw.js} +113 -112
- package/dist/page-creator-g8GqgcKH.cjs +1 -0
- package/dist/{page-lock-Bfbs6RgL.js → page-lock-BJUkyxdh.js} +2 -2
- package/dist/{page-lock-BdYmCks0.cjs → page-lock-CT7SmQqp.cjs} +1 -1
- package/dist/page-locked-dialog-Co5b9XIZ.cjs +1 -0
- package/dist/{page-locked-dialog-B6MKTRfY.js → page-locked-dialog-DsEbWRed.js} +18 -15
- package/dist/{page-manager-new-CzX22g2n.js → page-manager-new-5rFP5DyQ.js} +30 -29
- package/dist/page-manager-new-BOkJImo2.cjs +1 -0
- package/dist/page-manager-search-and-filter-Bfm0j1gg.cjs +1 -0
- package/dist/{page-manager-search-and-filter-CM0UMb6U.js → page-manager-search-and-filter-zq-LfhQ1.js} +13 -12
- package/dist/{page-revisions-content-NH9JK4Ey.js → page-revisions-content-D38G2tJM.js} +34 -31
- package/dist/page-revisions-content-ag-MHBGr.cjs +1 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +4 -4
- package/dist/pages.js +1 -1
- package/dist/{plugin-C6rgJDNQ.cjs → plugin-BGlQf0iy.cjs} +1 -1
- package/dist/{plugin-3ZKK6RXm.js → plugin-C-ht41UZ.js} +1 -1
- package/dist/publish-pages-content-BiX-GMLw.cjs +1 -0
- package/dist/{publish-pages-content-D9aixMN5.js → publish-pages-content-CS7f41Ac.js} +66 -65
- package/dist/register-chai-top-bar-BqwKw4uy.cjs +1 -0
- package/dist/register-chai-top-bar-ESJHs5s-.js +237 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +2 -2
- package/dist/render.js +87 -80
- package/dist/rte-widget-modal-BKNx2wln.cjs +1 -0
- package/dist/{rte-widget-modal-DOJEXLIf.js → rte-widget-modal-D6Zik0Ta.js} +15 -14
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +168 -4
- package/dist/runtime.js +68 -38
- package/dist/{save-to-lib-eiOc_SSN.js → save-to-lib-WwOzbgiF.js} +39 -38
- package/dist/save-to-lib-ffjCZYJ5.cjs +1 -0
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CBFePS19.js → selected-block-display-B1SG_UXw.js} +37 -36
- package/dist/selected-block-display-BOgnQRLF.cjs +16 -0
- package/dist/{seo-panel-C1-iMOR1.js → seo-panel-BkOgRoWd.js} +12 -11
- package/dist/seo-panel-FjS1UF_y.cjs +2 -0
- package/dist/{shared-json-ld-B4PxAM_0.js → shared-json-ld-uka9TOgA.js} +68 -67
- package/dist/shared-json-ld-yJkXjENy.cjs +1 -0
- package/dist/slug-input-Cyd6NR6J.cjs +1 -0
- package/dist/{slug-input-AwNJs9im.js → slug-input-DHLmUNrH.js} +9 -8
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.d.ts +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-C4FeDtN_.js → take-over-request-Ca0X-qyf.js} +17 -16
- package/dist/take-over-request-CmpJVe9T.cjs +1 -0
- package/dist/{theme-panel-footer-uBQqSJXm.js → theme-panel-footer-BUXIu252.js} +11 -10
- package/dist/theme-panel-footer-CKO9YYwZ.cjs +1 -0
- package/dist/{translation-warning-modal-B64YqlbI.js → translation-warning-modal-DrpFeI83.js} +9 -8
- package/dist/translation-warning-modal-pSZVKcNW.cjs +1 -0
- package/dist/{unmark-as-template-CZ9sQp_P.js → unmark-as-template-BMqgelv-.js} +11 -10
- package/dist/unmark-as-template-DF1Ms4VN.cjs +1 -0
- package/dist/unpublish-page-BJ0Bsvt2.js +28 -0
- package/dist/unpublish-page-Bsq2yEqQ.cjs +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +4 -1
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +46 -46
- package/dist/{web-preview-Djy6WIyj.js → web-preview-D6h1L2nV.js} +2 -2
- package/dist/web-preview-kres0aG7.cjs +1 -0
- package/package.json +4 -2
- package/dist/IconPicker-DREyo007.cjs +0 -1
- package/dist/active-in-another-tab-B47YjQGN.cjs +0 -1
- package/dist/active-in-another-tab-CyjngVA6.js +0 -34
- package/dist/add-new-language-page-88xzrUy8.cjs +0 -1
- package/dist/ai-panel-content-7zCil042.cjs +0 -1
- package/dist/ai-prompt-input-CThbVp0_.cjs +0 -1
- package/dist/ai-translation-prompt-C2kJQFDX.cjs +0 -1
- package/dist/apply-binding-KKp5PnpZ.cjs +0 -1
- package/dist/code-display-BnqzqzoP.cjs +0 -1
- package/dist/code-editor-o3___nu2.cjs +0 -1
- package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +0 -1
- package/dist/core-BoRDjj4h.cjs +0 -1
- package/dist/core-yvI6kCyw.js +0 -56
- package/dist/css-import-modal-CyqkXWCO.cjs +0 -13
- package/dist/delete-page-DxX7PFIE.cjs +0 -1
- package/dist/design-token-usage-CAHzEGgJ.cjs +0 -1
- package/dist/digital-asset-manager--uO8Agia.cjs +0 -1
- package/dist/duplicate-page-CaNAbXwV.cjs +0 -1
- package/dist/dynamic-page-selector-Cxk_gjni.cjs +0 -1
- package/dist/get-chai-builder-tailwind-config-B9rCyiQo.cjs +0 -1
- package/dist/index-DF5DEvqb.cjs +0 -160
- package/dist/index-WQwzsC7A.cjs +0 -5
- package/dist/lang-panel-DT96k1xg.cjs +0 -1
- package/dist/manage-design-tokens-CrmLe7UT.cjs +0 -1
- package/dist/mark-as-template-W3LmpiqN.cjs +0 -1
- package/dist/nested-path-selector-content-CoS_d3dc.cjs +0 -1
- package/dist/no-language-page-content-DkfeMl90.cjs +0 -1
- package/dist/page-creator-C4gc5NSC.cjs +0 -1
- package/dist/page-locked-dialog-B1FAtK92.cjs +0 -1
- package/dist/page-manager-new-CHDueBDk.cjs +0 -1
- package/dist/page-manager-search-and-filter-DkkRIH86.cjs +0 -1
- package/dist/page-revisions-content-ChY-4f2V.cjs +0 -1
- package/dist/publish-pages-content-x-JuSFJ9.cjs +0 -1
- package/dist/rte-widget-modal-BaHIuEjF.cjs +0 -1
- package/dist/save-to-lib-Cgpxw8-g.cjs +0 -1
- package/dist/selected-block-display-BgRY82CT.cjs +0 -16
- package/dist/seo-panel-DfAb8U7W.cjs +0 -2
- package/dist/shared-json-ld-DzG398hr.cjs +0 -1
- package/dist/slug-input-C_ijLQ_X.cjs +0 -1
- package/dist/take-over-request-BNxcjY2j.cjs +0 -1
- package/dist/theme-panel-footer-Cq9pljro.cjs +0 -1
- package/dist/translation-warning-modal-BZAcwM2_.cjs +0 -1
- package/dist/unmark-as-template-EVvk0vmp.cjs +0 -1
- package/dist/unpublish-page-D4VwOlxc.js +0 -27
- package/dist/unpublish-page-bdSmwAVQ.cjs +0 -1
- package/dist/web-preview-Cio70gk5.cjs +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as e, jsxs as w, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { E as N, B as E } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
3
|
+
import { T as le, av as ce, r as ue, s as de, t as pe, v as me, aw as fe, ax as he, D as ge, ay as ve, d as be, f as xe, C as we, i as Ne, j as Ie, l as ye, m as Se } from "./index-rAcNbjk_.js";
|
|
4
|
+
import { cva as Y } from "class-variance-authority";
|
|
5
|
+
import { PaperclipIcon as ke, XIcon as J, PlusIcon as De, ImageIcon as ze, MicIcon as Pe, CornerDownLeftIcon as Te, Loader2Icon as Ae, SquareIcon as Le, Cpu as Ce, Paperclip as Re, GlobeIcon as Me, Square as je, Send as Ue } from "lucide-react";
|
|
4
6
|
import { nanoid as Oe } from "nanoid";
|
|
5
|
-
import { useContext as
|
|
6
|
-
import {
|
|
7
|
-
import { useTranslation as _e } from "react-i18next";
|
|
7
|
+
import { useContext as V, useRef as M, useEffect as A, useState as P, useCallback as F, useMemo as Fe, createContext as W, Fragment as Ge, startTransition as Be, Children as _e } from "react";
|
|
8
|
+
import { useTranslation as Ee } from "react-i18next";
|
|
8
9
|
import { a as Ve, g as _, A as We } from "./models-D95ZYr_x.js";
|
|
9
|
-
function
|
|
10
|
+
function He({ className: t, ...n }) {
|
|
10
11
|
return /* @__PURE__ */ e(
|
|
11
12
|
"div",
|
|
12
13
|
{
|
|
@@ -30,7 +31,7 @@ function Ee({ className: t, ...n }) {
|
|
|
30
31
|
}
|
|
31
32
|
);
|
|
32
33
|
}
|
|
33
|
-
const
|
|
34
|
+
const qe = Y(
|
|
34
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",
|
|
35
36
|
{
|
|
36
37
|
variants: {
|
|
@@ -57,7 +58,7 @@ function Q({
|
|
|
57
58
|
role: "group",
|
|
58
59
|
"data-slot": "input-group-addon",
|
|
59
60
|
"data-align": n,
|
|
60
|
-
className: N(
|
|
61
|
+
className: N(qe({ align: n }), t),
|
|
61
62
|
onClick: (l) => {
|
|
62
63
|
var i, p;
|
|
63
64
|
l.target.closest("button") || (p = (i = l.currentTarget.parentElement) == null ? void 0 : i.querySelector("input")) == null || p.focus();
|
|
@@ -66,7 +67,7 @@ function Q({
|
|
|
66
67
|
}
|
|
67
68
|
);
|
|
68
69
|
}
|
|
69
|
-
const
|
|
70
|
+
const Ke = Y("flex items-center gap-2 text-sm shadow-none", {
|
|
70
71
|
variants: {
|
|
71
72
|
size: {
|
|
72
73
|
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
|
|
@@ -87,17 +88,17 @@ function Z({
|
|
|
87
88
|
...i
|
|
88
89
|
}) {
|
|
89
90
|
return /* @__PURE__ */ e(
|
|
90
|
-
|
|
91
|
+
E,
|
|
91
92
|
{
|
|
92
93
|
type: n,
|
|
93
94
|
"data-size": l,
|
|
94
95
|
variant: o,
|
|
95
|
-
className: N(
|
|
96
|
+
className: N(Ke({ size: l }), t),
|
|
96
97
|
...i
|
|
97
98
|
}
|
|
98
99
|
);
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function $e({ className: t, ...n }) {
|
|
101
102
|
return /* @__PURE__ */ e(
|
|
102
103
|
le,
|
|
103
104
|
{
|
|
@@ -110,16 +111,16 @@ function Ke({ className: t, ...n }) {
|
|
|
110
111
|
}
|
|
111
112
|
);
|
|
112
113
|
}
|
|
113
|
-
const
|
|
114
|
-
const t =
|
|
114
|
+
const Xe = W(null), Ye = W(null), ee = () => V(Xe), Je = () => V(Ye), te = W(null), G = () => {
|
|
115
|
+
const t = Je(), n = V(te), o = t ?? n;
|
|
115
116
|
if (!o)
|
|
116
117
|
throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");
|
|
117
118
|
return o;
|
|
118
119
|
};
|
|
119
|
-
function
|
|
120
|
+
function Qe({ data: t, className: n, ...o }) {
|
|
120
121
|
var f;
|
|
121
122
|
const l = G(), i = t.filename || "", u = ((f = t.mediaType) != null && f.startsWith("image/") && t.url ? "image" : "file") === "image", g = i || (u ? "Image" : "Attachment");
|
|
122
|
-
return /* @__PURE__ */ w(
|
|
123
|
+
return /* @__PURE__ */ w(dt, { children: [
|
|
123
124
|
/* @__PURE__ */ e(ce, { asChild: !0, children: /* @__PURE__ */ w(
|
|
124
125
|
"div",
|
|
125
126
|
{
|
|
@@ -141,7 +142,7 @@ function Je({ data: t, className: n, ...o }) {
|
|
|
141
142
|
}
|
|
142
143
|
) : /* @__PURE__ */ e("div", { className: "flex size-5 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ e(ke, { className: "size-3" }) }) }),
|
|
143
144
|
/* @__PURE__ */ w(
|
|
144
|
-
|
|
145
|
+
E,
|
|
145
146
|
{
|
|
146
147
|
"aria-label": "Remove attachment",
|
|
147
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",
|
|
@@ -151,7 +152,7 @@ function Je({ data: t, className: n, ...o }) {
|
|
|
151
152
|
type: "button",
|
|
152
153
|
variant: "ghost",
|
|
153
154
|
children: [
|
|
154
|
-
/* @__PURE__ */ e(
|
|
155
|
+
/* @__PURE__ */ e(J, {}),
|
|
155
156
|
/* @__PURE__ */ e("span", { className: "sr-only", children: "Remove" })
|
|
156
157
|
]
|
|
157
158
|
}
|
|
@@ -162,7 +163,7 @@ function Je({ data: t, className: n, ...o }) {
|
|
|
162
163
|
},
|
|
163
164
|
t.id
|
|
164
165
|
) }),
|
|
165
|
-
/* @__PURE__ */ e(
|
|
166
|
+
/* @__PURE__ */ e(pt, { className: "w-auto p-2", children: /* @__PURE__ */ w("div", { className: "w-auto space-y-3", children: [
|
|
166
167
|
u && /* @__PURE__ */ e("div", { className: "flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border", children: /* @__PURE__ */ e(
|
|
167
168
|
"img",
|
|
168
169
|
{
|
|
@@ -180,11 +181,11 @@ function Je({ data: t, className: n, ...o }) {
|
|
|
180
181
|
] }) })
|
|
181
182
|
] });
|
|
182
183
|
}
|
|
183
|
-
function
|
|
184
|
+
function Ze({ children: t, className: n, ...o }) {
|
|
184
185
|
const l = G();
|
|
185
186
|
return l.files.length ? /* @__PURE__ */ e("div", { className: N("flex flex-wrap items-center gap-2 p-3", n), ...o, children: l.files.map((i) => /* @__PURE__ */ e(Ge, { children: t(i) }, i.id)) }) : null;
|
|
186
187
|
}
|
|
187
|
-
const
|
|
188
|
+
const et = ({
|
|
188
189
|
label: t = "Add photos or files",
|
|
189
190
|
...n
|
|
190
191
|
}) => {
|
|
@@ -203,7 +204,7 @@ const Ze = ({
|
|
|
203
204
|
]
|
|
204
205
|
}
|
|
205
206
|
);
|
|
206
|
-
},
|
|
207
|
+
}, tt = ({
|
|
207
208
|
className: t,
|
|
208
209
|
accept: n,
|
|
209
210
|
multiple: o,
|
|
@@ -222,7 +223,7 @@ const Ze = ({
|
|
|
222
223
|
const r = (v = k.current) == null ? void 0 : v.closest("form");
|
|
223
224
|
r instanceof HTMLFormElement && (I.current = r);
|
|
224
225
|
}, []);
|
|
225
|
-
const [S,
|
|
226
|
+
const [S, L] = P([]), h = a ? s.attachments.files : S, T = F(() => {
|
|
226
227
|
var r;
|
|
227
228
|
(r = d.current) == null || r.click();
|
|
228
229
|
}, []), j = F(
|
|
@@ -246,9 +247,9 @@ const Ze = ({
|
|
|
246
247
|
});
|
|
247
248
|
return;
|
|
248
249
|
}
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
typeof
|
|
250
|
+
L((x) => {
|
|
251
|
+
const C = typeof p == "number" ? Math.max(0, p - x.length) : void 0, oe = typeof C == "number" ? b.slice(0, C) : b;
|
|
252
|
+
typeof C == "number" && b.length > C && (g == null || g({
|
|
252
253
|
code: "max_files",
|
|
253
254
|
message: "Too many files. Some were not added."
|
|
254
255
|
}));
|
|
@@ -265,10 +266,10 @@ const Ze = ({
|
|
|
265
266
|
});
|
|
266
267
|
},
|
|
267
268
|
[j, p, u, g]
|
|
268
|
-
), z = a ? (r) => s.attachments.add(r) : U, R = a ? (r) => s.attachments.remove(r) : (r) =>
|
|
269
|
+
), z = a ? (r) => s.attachments.add(r) : U, R = a ? (r) => s.attachments.remove(r) : (r) => L((v) => {
|
|
269
270
|
const m = v.find((c) => c.id === r);
|
|
270
271
|
return m != null && m.url && URL.revokeObjectURL(m.url), v.filter((c) => c.id !== r);
|
|
271
|
-
}), O = a ? () => s.attachments.clear() : () =>
|
|
272
|
+
}), O = a ? () => s.attachments.clear() : () => L((r) => {
|
|
272
273
|
for (const v of r)
|
|
273
274
|
v.url && URL.revokeObjectURL(v.url);
|
|
274
275
|
return [];
|
|
@@ -287,8 +288,8 @@ const Ze = ({
|
|
|
287
288
|
var b, x;
|
|
288
289
|
(x = (b = c.dataTransfer) == null ? void 0 : b.types) != null && x.includes("Files") && c.preventDefault();
|
|
289
290
|
}, m = (c) => {
|
|
290
|
-
var b, x,
|
|
291
|
-
(x = (b = c.dataTransfer) == null ? void 0 : b.types) != null && x.includes("Files") && c.preventDefault(), (
|
|
291
|
+
var b, x, C;
|
|
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 && z(c.dataTransfer.files);
|
|
292
293
|
};
|
|
293
294
|
return r.addEventListener("dragover", v), r.addEventListener("drop", m), () => {
|
|
294
295
|
r.removeEventListener("dragover", v), r.removeEventListener("drop", m);
|
|
@@ -364,10 +365,10 @@ const Ze = ({
|
|
|
364
365
|
type: "file"
|
|
365
366
|
}
|
|
366
367
|
),
|
|
367
|
-
/* @__PURE__ */ e("form", { className: N("w-full", t), onSubmit: ae, ...D, children: /* @__PURE__ */ e(
|
|
368
|
+
/* @__PURE__ */ e("form", { className: N("w-full", t), onSubmit: ae, ...D, children: /* @__PURE__ */ e(He, { className: "overflow-hidden", children: y }) })
|
|
368
369
|
] });
|
|
369
370
|
return a ? K : /* @__PURE__ */ e(te.Provider, { value: re, children: K });
|
|
370
|
-
},
|
|
371
|
+
}, nt = ({
|
|
371
372
|
onChange: t,
|
|
372
373
|
className: n,
|
|
373
374
|
placeholder: o = "What would you like to know?",
|
|
@@ -409,7 +410,7 @@ const Ze = ({
|
|
|
409
410
|
onChange: t
|
|
410
411
|
};
|
|
411
412
|
return /* @__PURE__ */ e(
|
|
412
|
-
|
|
413
|
+
$e,
|
|
413
414
|
{
|
|
414
415
|
className: N("field-sizing-content max-h-48 min-h-16", n),
|
|
415
416
|
name: "message",
|
|
@@ -422,10 +423,10 @@ const Ze = ({
|
|
|
422
423
|
...D
|
|
423
424
|
}
|
|
424
425
|
);
|
|
425
|
-
},
|
|
426
|
-
const i = o ?? (
|
|
426
|
+
}, st = ({ className: t, ...n }) => /* @__PURE__ */ e(Q, { align: "block-end", className: N("order-first flex-wrap gap-1", t), ...n }), rt = ({ className: t, ...n }) => /* @__PURE__ */ e(Q, { align: "block-end", className: N("justify-between gap-1", t), ...n }), at = ({ className: t, ...n }) => /* @__PURE__ */ e("div", { className: N("flex items-center gap-1", t), ...n }), H = ({ variant: t = "ghost", className: n, size: o, ...l }) => {
|
|
427
|
+
const i = o ?? (_e.count(l.children) > 1 ? "sm" : "icon-sm");
|
|
427
428
|
return /* @__PURE__ */ e(Z, { className: N(n), size: i, type: "button", variant: t, ...l });
|
|
428
|
-
},
|
|
429
|
+
}, ot = (t) => /* @__PURE__ */ e(ue, { ...t }), it = ({ className: t, children: n, ...o }) => /* @__PURE__ */ e(de, { asChild: !0, children: /* @__PURE__ */ e(H, { className: t, ...o, children: n ?? /* @__PURE__ */ e(De, { className: "size-4" }) }) }), lt = ({ className: t, ...n }) => /* @__PURE__ */ e(pe, { align: "start", className: N(t), ...n }), ct = ({
|
|
429
430
|
className: t,
|
|
430
431
|
variant: n = "default",
|
|
431
432
|
size: o = "icon-sm",
|
|
@@ -434,7 +435,7 @@ const Ze = ({
|
|
|
434
435
|
...p
|
|
435
436
|
}) => {
|
|
436
437
|
let u = /* @__PURE__ */ e(Te, { className: "size-4" });
|
|
437
|
-
return l === "submitted" ? u = /* @__PURE__ */ e(Ae, { className: "size-4 animate-spin" }) : l === "streaming" ? u = /* @__PURE__ */ e(
|
|
438
|
+
return l === "submitted" ? u = /* @__PURE__ */ e(Ae, { className: "size-4 animate-spin" }) : l === "streaming" ? u = /* @__PURE__ */ e(Le, { className: "size-4" }) : l === "error" && (u = /* @__PURE__ */ e(J, { className: "size-4" })), /* @__PURE__ */ e(
|
|
438
439
|
Z,
|
|
439
440
|
{
|
|
440
441
|
"aria-label": "Submit",
|
|
@@ -446,7 +447,7 @@ const Ze = ({
|
|
|
446
447
|
children: i ?? u
|
|
447
448
|
}
|
|
448
449
|
);
|
|
449
|
-
},
|
|
450
|
+
}, ut = ({
|
|
450
451
|
className: t,
|
|
451
452
|
textareaRef: n,
|
|
452
453
|
onTranscriptionChange: o,
|
|
@@ -468,12 +469,12 @@ const Ze = ({
|
|
|
468
469
|
S.isFinal && (d += ((k = S[0]) == null ? void 0 : k.transcript) ?? "");
|
|
469
470
|
}
|
|
470
471
|
if (d && (n != null && n.current)) {
|
|
471
|
-
const I = n.current, S = I.value,
|
|
472
|
-
I.value =
|
|
472
|
+
const I = n.current, S = I.value, L = S + (S ? " " : "") + d;
|
|
473
|
+
I.value = L, I.dispatchEvent(new Event("input", { bubbles: !0 })), o == null || o(L);
|
|
473
474
|
}
|
|
474
475
|
}, s.onerror = (a) => {
|
|
475
476
|
console.error("Speech recognition error:", a.error), p(!1);
|
|
476
|
-
}, f.current = s, g(s);
|
|
477
|
+
}, f.current = s, Be(() => g(s));
|
|
477
478
|
}
|
|
478
479
|
return () => {
|
|
479
480
|
f.current && f.current.stop();
|
|
@@ -496,7 +497,7 @@ const Ze = ({
|
|
|
496
497
|
children: /* @__PURE__ */ e(Pe, { className: "size-4" })
|
|
497
498
|
}
|
|
498
499
|
);
|
|
499
|
-
},
|
|
500
|
+
}, dt = ({ openDelay: t = 0, closeDelay: n = 0, ...o }) => /* @__PURE__ */ e(fe, { closeDelay: n, openDelay: t, ...o }), pt = ({ align: t = "start", ...n }) => /* @__PURE__ */ e(he, { align: t, ...n }), mt = (t) => /* @__PURE__ */ e(ge, { ...t }), ft = (t) => /* @__PURE__ */ e(ve, { ...t }), ht = ({
|
|
500
501
|
className: t,
|
|
501
502
|
children: n,
|
|
502
503
|
title: o = "Model Selector",
|
|
@@ -504,7 +505,7 @@ const Ze = ({
|
|
|
504
505
|
}) => /* @__PURE__ */ w(be, { className: N("p-0", t), ...l, children: [
|
|
505
506
|
/* @__PURE__ */ e(xe, { className: "sr-only", children: o }),
|
|
506
507
|
/* @__PURE__ */ e(we, { className: "**:data-[slot=command-input-wrapper]:h-auto", children: n })
|
|
507
|
-
] }),
|
|
508
|
+
] }), gt = ({ className: t, ...n }) => /* @__PURE__ */ e(Ne, { className: N("h-auto py-3.5", t), ...n }), vt = (t) => /* @__PURE__ */ e(Ie, { ...t }), bt = (t) => /* @__PURE__ */ e(ye, { ...t }), xt = (t) => /* @__PURE__ */ e(Se, { ...t }), wt = ({ provider: t, className: n, ...o }) => /* @__PURE__ */ e(
|
|
508
509
|
"img",
|
|
509
510
|
{
|
|
510
511
|
...o,
|
|
@@ -514,7 +515,7 @@ const Ze = ({
|
|
|
514
515
|
src: `https://models.dev/logos/${t}.svg`,
|
|
515
516
|
width: 12
|
|
516
517
|
}
|
|
517
|
-
),
|
|
518
|
+
), Nt = ({ className: t, ...n }) => /* @__PURE__ */ e("span", { className: N("flex-1 truncate text-left", t), ...n }), It = ({
|
|
518
519
|
selectedModel: t,
|
|
519
520
|
onModelChange: n,
|
|
520
521
|
disabled: o = !1
|
|
@@ -527,23 +528,23 @@ const Ze = ({
|
|
|
527
528
|
), D = (s) => {
|
|
528
529
|
n(s), i(!1), u("");
|
|
529
530
|
};
|
|
530
|
-
return /* @__PURE__ */ w(
|
|
531
|
-
/* @__PURE__ */ e(
|
|
532
|
-
/* @__PURE__ */ e(
|
|
531
|
+
return /* @__PURE__ */ w(mt, { open: l, onOpenChange: i, children: [
|
|
532
|
+
/* @__PURE__ */ e(ft, { asChild: !0, children: /* @__PURE__ */ w(E, { variant: "outline", size: "sm", disabled: o, className: "h-8 gap-1 px-2 text-xs", children: [
|
|
533
|
+
/* @__PURE__ */ e(Ce, { size: 14 }),
|
|
533
534
|
/* @__PURE__ */ e("span", { className: "max-w-20 truncate", children: g.name })
|
|
534
535
|
] }) }),
|
|
535
|
-
/* @__PURE__ */ w(
|
|
536
|
-
/* @__PURE__ */ e(
|
|
537
|
-
/* @__PURE__ */ e(
|
|
538
|
-
|
|
536
|
+
/* @__PURE__ */ w(ht, { className: "w-96 p-0", children: [
|
|
537
|
+
/* @__PURE__ */ e(gt, { placeholder: "Search models...", value: p, onValueChange: u }),
|
|
538
|
+
/* @__PURE__ */ e(vt, { children: Object.entries(y).map(([s, a]) => /* @__PURE__ */ e(bt, { heading: s.charAt(0).toUpperCase() + s.slice(1), children: a.map((d) => /* @__PURE__ */ w(
|
|
539
|
+
xt,
|
|
539
540
|
{
|
|
540
541
|
value: d.id,
|
|
541
542
|
onSelect: () => D(d.id),
|
|
542
543
|
className: "flex cursor-pointer items-center gap-2 p-2",
|
|
543
544
|
children: [
|
|
544
|
-
/* @__PURE__ */ e(
|
|
545
|
+
/* @__PURE__ */ e(wt, { provider: d.provider }),
|
|
545
546
|
/* @__PURE__ */ w("div", { className: "flex flex-1 flex-col", children: [
|
|
546
|
-
/* @__PURE__ */ e(
|
|
547
|
+
/* @__PURE__ */ e(Nt, { children: d.name }),
|
|
547
548
|
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: d.description })
|
|
548
549
|
] }),
|
|
549
550
|
t === d.id && /* @__PURE__ */ e("div", { className: "h-2 w-2 rounded-full bg-blue-500" })
|
|
@@ -553,7 +554,7 @@ const Ze = ({
|
|
|
553
554
|
)) }, s)) })
|
|
554
555
|
] })
|
|
555
556
|
] });
|
|
556
|
-
}, X = "chai-ai-selected-model",
|
|
557
|
+
}, X = "chai-ai-selected-model", Ct = ({
|
|
557
558
|
input: t,
|
|
558
559
|
setInput: n,
|
|
559
560
|
onSend: o,
|
|
@@ -564,7 +565,7 @@ const Ze = ({
|
|
|
564
565
|
selectedModel: g = _().id,
|
|
565
566
|
onModelChange: f
|
|
566
567
|
}) => {
|
|
567
|
-
const { t: y } =
|
|
568
|
+
const { t: y } = Ee(), [D, s] = P(g), [a, d] = P(null), k = M(null), [I, S] = P(!1);
|
|
568
569
|
return A(() => {
|
|
569
570
|
if (!u) {
|
|
570
571
|
const h = localStorage.getItem(X);
|
|
@@ -575,7 +576,7 @@ const Ze = ({
|
|
|
575
576
|
s(T), f == null || f(T);
|
|
576
577
|
}
|
|
577
578
|
}
|
|
578
|
-
}, [u, f]), /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e("div", { className: "border-gray-20 rounded-lg border", children: /* @__PURE__ */ w(
|
|
579
|
+
}, [u, f]), /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e("div", { className: "border-gray-20 rounded-lg border", children: /* @__PURE__ */ w(tt, { onSubmit: (h) => {
|
|
579
580
|
var U;
|
|
580
581
|
const T = h.files.find((z) => {
|
|
581
582
|
var R;
|
|
@@ -583,9 +584,9 @@ const Ze = ({
|
|
|
583
584
|
}), j = (T == null ? void 0 : T.url) || a;
|
|
584
585
|
o((U = h.text) == null ? void 0 : U.trim(), void 0, j, D), d(null);
|
|
585
586
|
}, accept: "image/*", className: "flex h-auto w-full flex-col", children: [
|
|
586
|
-
/* @__PURE__ */ e(
|
|
587
|
+
/* @__PURE__ */ e(st, { className: "p-0", children: /* @__PURE__ */ e(Ze, { className: "pb-0", children: (h) => /* @__PURE__ */ e(Qe, { className: "text-xs", data: h }) }) }),
|
|
587
588
|
/* @__PURE__ */ e(
|
|
588
|
-
|
|
589
|
+
nt,
|
|
589
590
|
{
|
|
590
591
|
ref: k,
|
|
591
592
|
value: t,
|
|
@@ -596,14 +597,14 @@ const Ze = ({
|
|
|
596
597
|
rows: 3
|
|
597
598
|
}
|
|
598
599
|
),
|
|
599
|
-
/* @__PURE__ */ w(
|
|
600
|
-
u ? /* @__PURE__ */ e("div", {}) : /* @__PURE__ */ w(
|
|
601
|
-
/* @__PURE__ */ w(
|
|
602
|
-
/* @__PURE__ */ e(
|
|
603
|
-
/* @__PURE__ */ e(
|
|
600
|
+
/* @__PURE__ */ w(rt, { children: [
|
|
601
|
+
u ? /* @__PURE__ */ e("div", {}) : /* @__PURE__ */ w(at, { children: [
|
|
602
|
+
/* @__PURE__ */ w(ot, { children: [
|
|
603
|
+
/* @__PURE__ */ e(it, { disabled: i, children: /* @__PURE__ */ e(Re, { size: 16 }) }),
|
|
604
|
+
/* @__PURE__ */ e(lt, { children: /* @__PURE__ */ e(et, {}) })
|
|
604
605
|
] }),
|
|
605
606
|
/* @__PURE__ */ e(
|
|
606
|
-
|
|
607
|
+
ut,
|
|
607
608
|
{
|
|
608
609
|
textareaRef: k,
|
|
609
610
|
onTranscriptionChange: n,
|
|
@@ -611,7 +612,7 @@ const Ze = ({
|
|
|
611
612
|
}
|
|
612
613
|
),
|
|
613
614
|
/* @__PURE__ */ e(
|
|
614
|
-
|
|
615
|
+
It,
|
|
615
616
|
{
|
|
616
617
|
selectedModel: D,
|
|
617
618
|
onModelChange: (h) => {
|
|
@@ -646,10 +647,10 @@ const Ze = ({
|
|
|
646
647
|
/* @__PURE__ */ e("span", { className: "text-xs", children: y("Stop") })
|
|
647
648
|
]
|
|
648
649
|
}
|
|
649
|
-
) : /* @__PURE__ */ e(
|
|
650
|
+
) : /* @__PURE__ */ e(ct, { disabled: !t.trim() || p, children: /* @__PURE__ */ e(Ue, { size: 16 }) })
|
|
650
651
|
] })
|
|
651
652
|
] }) }) });
|
|
652
653
|
};
|
|
653
654
|
export {
|
|
654
|
-
|
|
655
|
+
Ct as default
|
|
655
656
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("./register-chai-top-bar-BqwKw4uy.cjs"),N=require("./index-C99FhuF1.cjs"),W=require("class-variance-authority"),S=require("lucide-react"),te=require("nanoid"),c=require("react"),se=require("react-i18next"),R=require("./models-5gOsRC56.cjs");function ne({className:t,...s}){return e.jsx("div",{"data-slot":"input-group",role:"group",className:g.cn("group/input-group shadow-xs relative flex w-full items-center rounded-md border border-input outline-none transition-[color,box-shadow] dark:bg-input/30","h-9 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot=input-group-control]:focus-visible]:ring-ring","has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",t),...s})}const re=W.cva("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",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]","block-start":"[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5","block-end":"[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function H({className:t,align:s="inline-start",...o}){return e.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":s,className:g.cn(re({align:s}),t),onClick:l=>{var i,m;l.target.closest("button")||(m=(i=l.currentTarget.parentElement)==null?void 0:i.querySelector("input"))==null||m.focus()},...o})}const ae=W.cva("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",sm:"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function K({className:t,type:s="button",variant:o="ghost",size:l="xs",...i}){return e.jsx(g.Button,{type:s,"data-size":l,variant:o,className:g.cn(ae({size:l}),t),...i})}function oe({className:t,...s}){return e.jsx(N.Textarea,{"data-slot":"input-group-control",className:g.cn("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",t),...s})}const ie=c.createContext(null),ce=c.createContext(null),X=()=>c.useContext(ie),le=()=>c.useContext(ce),$=c.createContext(null),q=()=>{const t=le(),s=c.useContext($),o=t??s;if(!o)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return o};function ue({data:t,className:s,...o}){var h;const l=q(),i=t.filename||"",d=((h=t.mediaType)!=null&&h.startsWith("image/")&&t.url?"image":"file")==="image",v=i||(d?"Image":"Attachment");return e.jsxs(Ie,{children:[e.jsx(N.HoverCardTrigger,{asChild:!0,children:e.jsxs("div",{className:g.cn("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",s),...o,children:[e.jsxs("div",{className:"relative size-5 shrink-0",children:[e.jsx("div",{className:"absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0",children:d?e.jsx("img",{alt:i||"attachment",className:"size-5 object-cover",height:20,src:t.url,width:20}):e.jsx("div",{className:"flex size-5 items-center justify-center text-muted-foreground",children:e.jsx(S.PaperclipIcon,{className:"size-3"})})}),e.jsxs(g.Button,{"aria-label":"Remove attachment",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",onClick:y=>{y.stopPropagation(),l.remove(t.id)},type:"button",variant:"ghost",children:[e.jsx(S.XIcon,{}),e.jsx("span",{className:"sr-only",children:"Remove"})]})]}),e.jsx("span",{className:"flex-1 truncate",children:v})]},t.id)}),e.jsx(ye,{className:"w-auto p-2",children:e.jsxs("div",{className:"w-auto space-y-3",children:[d&&e.jsx("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:e.jsx("img",{alt:i||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:t.url,width:448})}),e.jsx("div",{className:"flex items-center gap-2.5",children:e.jsxs("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[e.jsx("h4",{className:"truncate text-sm font-semibold leading-none",children:i||(d?"Image":"Attachment")}),t.mediaType&&e.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:t.mediaType})]})})]})})]})}function de({children:t,className:s,...o}){const l=q();return l.files.length?e.jsx("div",{className:g.cn("flex flex-wrap items-center gap-2 p-3",s),...o,children:l.files.map(i=>e.jsx(c.Fragment,{children:t(i)},i.id))}):null}const pe=({label:t="Add photos or files",...s})=>{const o=q();return e.jsxs(N.DropdownMenuItem,{...s,onSelect:l=>{l.preventDefault(),o.openFileDialog()},children:[e.jsx(S.ImageIcon,{className:"mr-2 size-4"})," ",t]})},me=({className:t,accept:s,multiple:o,globalDrop:l,syncHiddenInput:i,maxFiles:m,maxFileSize:d,onError:v,onSubmit:h,children:y,...P})=>{const n=X(),a=!!n,p=c.useRef(null),D=c.useRef(null),I=c.useRef(null);c.useEffect(()=>{var j;const r=(j=D.current)==null?void 0:j.closest("form");r instanceof HTMLFormElement&&(I.current=r)},[]);const[k,z]=c.useState([]),x=a?n.attachments.files:k,C=c.useCallback(()=>{var r;(r=p.current)==null||r.click()},[]),M=c.useCallback(r=>!s||s.trim()===""?!0:s.includes("image/*")?r.type.startsWith("image/"):!0,[s]),U=c.useCallback(r=>{const j=Array.from(r),f=j.filter(w=>M(w));if(j.length&&f.length===0){v==null||v({code:"accept",message:"No files match the accepted types."});return}const u=w=>d?w.size<=d:!0,b=f.filter(u);if(f.length>0&&b.length===0){v==null||v({code:"max_file_size",message:"All files exceed the maximum size."});return}z(w=>{const A=typeof m=="number"?Math.max(0,m-w.length):void 0,ee=typeof A=="number"?b.slice(0,A):b;typeof A=="number"&&b.length>A&&(v==null||v({code:"max_files",message:"Too many files. Some were not added."}));const V=[];for(const E of ee)V.push({id:te.nanoid(),type:"file",url:URL.createObjectURL(E),mediaType:E.type,filename:E.name});return w.concat(V)})},[M,m,d,v]),T=a?r=>n.attachments.add(r):U,L=a?r=>n.attachments.remove(r):r=>z(j=>{const f=j.find(u=>u.id===r);return f!=null&&f.url&&URL.revokeObjectURL(f.url),j.filter(u=>u.id!==r)}),O=a?()=>n.attachments.clear():()=>z(r=>{for(const j of r)j.url&&URL.revokeObjectURL(j.url);return[]}),B=a?()=>n.attachments.openFileDialog():C;c.useEffect(()=>{a&&n.__registerFileInput(p,()=>{var r;return(r=p.current)==null?void 0:r.click()})},[a,n]),c.useEffect(()=>{i&&p.current&&x.length===0&&(p.current.value="")},[x,i]),c.useEffect(()=>{const r=I.current;if(!r)return;const j=u=>{var b,w;(w=(b=u.dataTransfer)==null?void 0:b.types)!=null&&w.includes("Files")&&u.preventDefault()},f=u=>{var b,w,A;(w=(b=u.dataTransfer)==null?void 0:b.types)!=null&&w.includes("Files")&&u.preventDefault(),(A=u.dataTransfer)!=null&&A.files&&u.dataTransfer.files.length>0&&T(u.dataTransfer.files)};return r.addEventListener("dragover",j),r.addEventListener("drop",f),()=>{r.removeEventListener("dragover",j),r.removeEventListener("drop",f)}},[T]),c.useEffect(()=>{if(!l)return;const r=f=>{var u,b;(b=(u=f.dataTransfer)==null?void 0:u.types)!=null&&b.includes("Files")&&f.preventDefault()},j=f=>{var u,b,w;(b=(u=f.dataTransfer)==null?void 0:u.types)!=null&&b.includes("Files")&&f.preventDefault(),(w=f.dataTransfer)!=null&&w.files&&f.dataTransfer.files.length>0&&T(f.dataTransfer.files)};return document.addEventListener("dragover",r),document.addEventListener("drop",j),()=>{document.removeEventListener("dragover",r),document.removeEventListener("drop",j)}},[T,l]),c.useEffect(()=>()=>{if(!a)for(const r of x)r.url&&URL.revokeObjectURL(r.url)},[a,x]);const Y=r=>{r.currentTarget.files&&T(r.currentTarget.files)},J=async r=>{const f=await(await fetch(r)).blob();return new Promise((u,b)=>{const w=new FileReader;w.onloadend=()=>u(w.result),w.onerror=b,w.readAsDataURL(f)})},Q=c.useMemo(()=>({files:x.map(r=>({...r,id:r.id})),add:T,remove:L,clear:O,openFileDialog:B,fileInputRef:p}),[x,T,L,O,B]),Z=r=>{r.preventDefault();const j=r.currentTarget,f=a?n.textInput.value:new FormData(j).get("message")||"";a||j.reset(),Promise.all(x.map(async({...u})=>u.url&&u.url.startsWith("blob:")?{...u,url:await J(u.url)}:u)).then(u=>{try{const b=h({text:f,files:u},r);b instanceof Promise?b.then(()=>{O(),a&&n.textInput.clear()}).catch(()=>{}):(O(),a&&n.textInput.clear())}catch{}})},G=e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",className:"hidden",ref:D}),e.jsx("input",{accept:s,"aria-label":"Upload files",className:"hidden",multiple:o,onChange:Y,ref:p,title:"Upload files",type:"file"}),e.jsx("form",{className:g.cn("w-full",t),onSubmit:Z,...P,children:e.jsx(ne,{className:"overflow-hidden",children:y})})]});return a?G:e.jsx($.Provider,{value:Q,children:G})},fe=({onChange:t,className:s,placeholder:o="What would you like to know?",...l})=>{const i=X(),m=q(),[d,v]=c.useState(!1),h=n=>{if(n.key==="Enter"){if(d||n.nativeEvent.isComposing||n.shiftKey)return;n.preventDefault();const a=n.currentTarget.form,p=a==null?void 0:a.querySelector('button[type="submit"]');if(p!=null&&p.disabled)return;a==null||a.requestSubmit()}if(n.key==="Backspace"&&n.currentTarget.value===""&&m.files.length>0){n.preventDefault();const a=m.files.at(-1);a&&m.remove(a.id)}},y=n=>{var D;const a=(D=n.clipboardData)==null?void 0:D.items;if(!a)return;const p=[];for(const I of a)if(I.kind==="file"){const k=I.getAsFile();k&&p.push(k)}p.length>0&&(n.preventDefault(),m.add(p))},P=i?{value:i.textInput.value,onChange:n=>{i.textInput.setInput(n.currentTarget.value),t==null||t(n)}}:{onChange:t};return e.jsx(oe,{className:g.cn("field-sizing-content max-h-48 min-h-16",s),name:"message",onCompositionEnd:()=>v(!1),onCompositionStart:()=>v(!0),onKeyDown:h,onPaste:y,placeholder:o,...l,...P})},he=({className:t,...s})=>e.jsx(H,{align:"block-end",className:g.cn("order-first flex-wrap gap-1",t),...s}),xe=({className:t,...s})=>e.jsx(H,{align:"block-end",className:g.cn("justify-between gap-1",t),...s}),ge=({className:t,...s})=>e.jsx("div",{className:g.cn("flex items-center gap-1",t),...s}),F=({variant:t="ghost",className:s,size:o,...l})=>{const i=o??(c.Children.count(l.children)>1?"sm":"icon-sm");return e.jsx(K,{className:g.cn(s),size:i,type:"button",variant:t,...l})},ve=t=>e.jsx(N.DropdownMenu,{...t}),je=({className:t,children:s,...o})=>e.jsx(N.DropdownMenuTrigger,{asChild:!0,children:e.jsx(F,{className:t,...o,children:s??e.jsx(S.PlusIcon,{className:"size-4"})})}),be=({className:t,...s})=>e.jsx(N.DropdownMenuContent,{align:"start",className:g.cn(t),...s}),we=({className:t,variant:s="default",size:o="icon-sm",status:l,children:i,...m})=>{let d=e.jsx(S.CornerDownLeftIcon,{className:"size-4"});return l==="submitted"?d=e.jsx(S.Loader2Icon,{className:"size-4 animate-spin"}):l==="streaming"?d=e.jsx(S.SquareIcon,{className:"size-4"}):l==="error"&&(d=e.jsx(S.XIcon,{className:"size-4"})),e.jsx(K,{"aria-label":"Submit",className:g.cn(t),size:o,type:"submit",variant:s,...m,children:i??d})},Ne=({className:t,textareaRef:s,onTranscriptionChange:o,...l})=>{const[i,m]=c.useState(!1),[d,v]=c.useState(null),h=c.useRef(null);c.useEffect(()=>{if(typeof window<"u"&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)){const P=window.SpeechRecognition||window.webkitSpeechRecognition,n=new P;n.continuous=!0,n.interimResults=!0,n.lang="en-US",n.onstart=()=>{m(!0)},n.onend=()=>{m(!1)},n.onresult=a=>{var D;let p="";for(let I=a.resultIndex;I<a.results.length;I++){const k=a.results[I];k.isFinal&&(p+=((D=k[0])==null?void 0:D.transcript)??"")}if(p&&(s!=null&&s.current)){const I=s.current,k=I.value,z=k+(k?" ":"")+p;I.value=z,I.dispatchEvent(new Event("input",{bubbles:!0})),o==null||o(z)}},n.onerror=a=>{console.error("Speech recognition error:",a.error),m(!1)},h.current=n,c.startTransition(()=>v(n))}return()=>{h.current&&h.current.stop()}},[s,o]);const y=c.useCallback(()=>{d&&(i?d.stop():d.start())},[d,i]);return e.jsx(F,{className:g.cn("relative transition-all duration-200",i&&"animate-pulse bg-accent text-accent-foreground",t),disabled:!d,onClick:y,...l,children:e.jsx(S.MicIcon,{className:"size-4"})})},Ie=({openDelay:t=0,closeDelay:s=0,...o})=>e.jsx(N.HoverCard,{closeDelay:s,openDelay:t,...o}),ye=({align:t="start",...s})=>e.jsx(N.HoverCardContent,{align:t,...s}),Se=t=>e.jsx(N.Dialog,{...t}),ke=t=>e.jsx(N.DialogTrigger,{...t}),De=({className:t,children:s,title:o="Model Selector",...l})=>e.jsxs(N.DialogContent,{className:g.cn("p-0",t),...l,children:[e.jsx(N.DialogTitle,{className:"sr-only",children:o}),e.jsx(N.Command,{className:"**:data-[slot=command-input-wrapper]:h-auto",children:s})]}),Pe=({className:t,...s})=>e.jsx(N.CommandInput,{className:g.cn("h-auto py-3.5",t),...s}),Te=t=>e.jsx(N.CommandList,{...t}),ze=t=>e.jsx(N.CommandGroup,{...t}),Ce=t=>e.jsx(N.CommandItem,{...t}),Ae=({provider:t,className:s,...o})=>e.jsx("img",{...o,alt:`${t} logo`,className:g.cn("size-3 dark:invert",s),height:12,src:`https://models.dev/logos/${t}.svg`,width:12}),Le=({className:t,...s})=>e.jsx("span",{className:g.cn("flex-1 truncate text-left",t),...s}),Re=({selectedModel:t,onModelChange:s,disabled:o=!1})=>{const[l,i]=c.useState(!1),[m,d]=c.useState(""),v=R.getModelById(t)||R.getDefaultModel(),y=R.AI_MODELS.filter(n=>n.name.toLowerCase().includes(m.toLowerCase())||n.provider.toLowerCase().includes(m.toLowerCase())).reduce((n,a)=>(n[a.provider]||(n[a.provider]=[]),n[a.provider].push(a),n),{}),P=n=>{s(n),i(!1),d("")};return e.jsxs(Se,{open:l,onOpenChange:i,children:[e.jsx(ke,{asChild:!0,children:e.jsxs(g.Button,{variant:"outline",size:"sm",disabled:o,className:"h-8 gap-1 px-2 text-xs",children:[e.jsx(S.Cpu,{size:14}),e.jsx("span",{className:"max-w-20 truncate",children:v.name})]})}),e.jsxs(De,{className:"w-96 p-0",children:[e.jsx(Pe,{placeholder:"Search models...",value:m,onValueChange:d}),e.jsx(Te,{children:Object.entries(y).map(([n,a])=>e.jsx(ze,{heading:n.charAt(0).toUpperCase()+n.slice(1),children:a.map(p=>e.jsxs(Ce,{value:p.id,onSelect:()=>P(p.id),className:"flex cursor-pointer items-center gap-2 p-2",children:[e.jsx(Ae,{provider:p.provider}),e.jsxs("div",{className:"flex flex-1 flex-col",children:[e.jsx(Le,{children:p.name}),e.jsx("span",{className:"text-xs text-muted-foreground",children:p.description})]}),t===p.id&&e.jsx("div",{className:"h-2 w-2 rounded-full bg-blue-500"})]},p.id))},n))})]})]})},_="chai-ai-selected-model",Me=({input:t,setInput:s,onSend:o,onStop:l,isLoading:i,disabled:m,selectedLang:d,selectedModel:v=R.getDefaultModel().id,onModelChange:h})=>{const{t:y}=se.useTranslation(),[P,n]=c.useState(v),[a,p]=c.useState(null),D=c.useRef(null),[I,k]=c.useState(!1);c.useEffect(()=>{if(!d){const x=localStorage.getItem(_);if(x)n(x),h==null||h(x);else{const C=R.getDefaultModel().id;n(C),h==null||h(C)}}},[d,h]);const z=x=>{var U;const C=x.files.find(T=>{var L;return(L=T.mediaType)==null?void 0:L.startsWith("image/")}),M=(C==null?void 0:C.url)||a;o((U=x.text)==null?void 0:U.trim(),void 0,M,P),p(null)};return e.jsx("div",{className:"relative",children:e.jsx("div",{className:"border-gray-20 rounded-lg border",children:e.jsxs(me,{onSubmit:z,accept:"image/*",className:"flex h-auto w-full flex-col",children:[e.jsx(he,{className:"p-0",children:e.jsx(de,{className:"pb-0",children:x=>e.jsx(ue,{className:"text-xs",data:x})})}),e.jsx(fe,{ref:D,value:t,onChange:x=>s(x.target.value),placeholder:y(d?"Ask to update content":"Ask me anything..."),disabled:i,className:"max-h-[200px] min-h-[60px] w-full",rows:3}),e.jsxs(xe,{children:[d?e.jsx("div",{}):e.jsxs(ge,{children:[e.jsxs(ve,{children:[e.jsx(je,{disabled:i,children:e.jsx(S.Paperclip,{size:16})}),e.jsx(be,{children:e.jsx(pe,{})})]}),e.jsx(Ne,{textareaRef:D,onTranscriptionChange:s,disabled:i}),e.jsx(Re,{selectedModel:P,onModelChange:x=>{n(x),h==null||h(x),localStorage.setItem(_,x)},disabled:i}),e.jsxs(F,{className:"hidden",size:"sm",onClick:()=>k(!I),variant:I?"default":"ghost",children:[e.jsx(S.GlobeIcon,{size:16}),e.jsx("span",{children:"Search"})]})]}),i?e.jsxs("button",{onClick:l,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",title:y("Stop generation"),children:[e.jsx(S.Square,{size:16})," ",e.jsx("span",{className:"text-xs",children:y("Stop")})]}):e.jsx(we,{disabled:!t.trim()||m,children:e.jsx(S.Send,{size:16})})]})]})})})};exports.default=Me;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
|
-
import { B as r } from "./
|
|
3
|
-
import { L as i } from "./index-
|
|
2
|
+
import { B as r } from "./register-chai-top-bar-ESJHs5s-.js";
|
|
3
|
+
import { L as i } from "./index-Dno42B0a.js";
|
|
4
4
|
import { ArrowRight as c } from "lucide-react";
|
|
5
5
|
import { useTranslation as m } from "react-i18next";
|
|
6
6
|
const u = ({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("./register-chai-top-bar-BqwKw4uy.cjs"),i=require("./index-C0-pgg_p.cjs"),c=require("lucide-react"),o=require("react-i18next"),x=({selectedLang:s,isLoading:n,selectedBlock:a,onClick:l})=>{const{t}=o.useTranslation();return e.jsx("div",{className:"flex flex-col gap-2",children:e.jsx("div",{className:`flex flex-col gap-2 ${n?"pointer-events-none opacity-50":""}`,children:a?e.jsx(r.Button,{variant:"outline",className:"h-auto",onClick:()=>l("TRANSLATE"),children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("p",{className:"text-left text-xs font-thin",children:t("Quick Action:")}),e.jsxs("span",{className:"flex items-center gap-x-2 text-sm font-medium",children:[t("Translate Content")," ",t("to")," ",i.LANGUAGES[s]," ",e.jsx(c.ArrowRight,{className:"h-4 w-4"})]})]})}):null})})};exports.default=x;
|