@chaibuilder/pages 0.16.13 → 0.16.15
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/{2AITGKQY-D1mM4eEh.js → 2AITGKQY-2rt9M99C.js} +5 -5
- package/dist/{2AITGKQY-AK2WgbeT.cjs → 2AITGKQY-Cs6RBSPQ.cjs} +1 -1
- package/dist/{NCMVHL6D-DItDf9IY.cjs → NCMVHL6D-CsC6nsSQ.cjs} +1 -1
- package/dist/{NCMVHL6D-BeRsWdGV.js → NCMVHL6D-vUfYKc6i.js} +2 -2
- package/dist/{ZDWCUMSJ-COSBY-at.cjs → ZDWCUMSJ-B2OZjsr6.cjs} +1 -1
- package/dist/{ZDWCUMSJ-D6caRaY7.js → ZDWCUMSJ-CzEWKlEU.js} +1 -1
- package/dist/active-in-another-tab-B0N5S-Bh.js +34 -0
- package/dist/active-in-another-tab-BK3cZf-x.cjs +1 -0
- package/dist/{add-new-language-page-CQcFi0Tp.cjs → add-new-language-page-Dt1j-8Zg.cjs} +1 -1
- package/dist/{add-new-language-page-nnaUe-qk.js → add-new-language-page-YlqcCdlK.js} +20 -20
- package/dist/{add-new-page-DxObnvo_.cjs → add-new-page-DqhQUQBz.cjs} +1 -1
- package/dist/{add-new-page-Ba1fq6LH.js → add-new-page-aYomeid4.js} +1 -1
- package/dist/ai-panel-content-C6cH9rrC.js +123 -0
- package/dist/ai-panel-content-MOZmNIKP.cjs +1 -0
- package/dist/ai-panel-default-lang-BZHkFsox.js +317 -0
- package/dist/ai-panel-default-lang-DOk_Q0IO.cjs +3 -0
- package/dist/{ai-panel-other-lang-B4euTuod.js → ai-panel-other-lang-D2A46FTg.js} +10 -9
- package/dist/ai-panel-other-lang-qHrdvAMa.cjs +1 -0
- package/dist/ai-prompt-input-BZSjjNJd.cjs +1 -0
- package/dist/ai-prompt-input-C6gDvvLQ.js +1071 -0
- package/dist/{ai-translation-prompt-Ip7w2_Ey.cjs → ai-translation-prompt-BqXo2CLp.cjs} +1 -1
- package/dist/{ai-translation-prompt-CVuPbgXw.js → ai-translation-prompt-DTR0wbGt.js} +1 -1
- package/dist/continue-editing-in-this-client-C3T6Jzhi.cjs +1 -0
- package/dist/continue-editing-in-this-client-D2S1yCOM.js +24 -0
- package/dist/delete-page-BF1k60U2.js +70 -0
- package/dist/delete-page-x0DWKzsR.cjs +1 -0
- package/dist/{digital-asset-manager-CIMo79Di.cjs → digital-asset-manager-BmlFt2T_.cjs} +1 -1
- package/dist/{digital-asset-manager-SAFNO_mx.js → digital-asset-manager-C8udwDBW.js} +1 -1
- package/dist/{duplicate-page-CXK2HcxD.cjs → duplicate-page-Dt_QZkTk.cjs} +1 -1
- package/dist/{duplicate-page-5SwLvmkX.js → duplicate-page-u_6vUVo1.js} +7 -7
- package/dist/{dynamic-page-selector-Crd3y4Hk.cjs → dynamic-page-selector-Cgs_Y_Kl.cjs} +1 -1
- package/dist/{dynamic-page-selector-DfcuTqRN.js → dynamic-page-selector-DxBHmglP.js} +1 -1
- package/dist/index-BeWL6Sj6.cjs +5 -0
- package/dist/index-DI2Rwk5v.js +4820 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -34
- package/dist/index.js +21 -22
- package/dist/{json-diff-viewer-D34kDA_c.cjs → json-diff-viewer-D2g0Yab2.cjs} +1 -1
- package/dist/{json-diff-viewer-CDwpbuag.js → json-diff-viewer-QdUwk7yF.js} +6 -6
- package/dist/{lang-panel-CUIeO5bb.js → lang-panel-B8OD0GiA.js} +24 -24
- package/dist/{lang-panel-CaFrYllL.cjs → lang-panel-M2Zb01lF.cjs} +1 -1
- package/dist/{mark-as-template-D0dLQaIB.js → mark-as-template-CJ1mlxYT.js} +7 -7
- package/dist/{mark-as-template-v182tmN6.cjs → mark-as-template-DONU52b1.cjs} +1 -1
- package/dist/{no-language-page-content-Bk4fEx_p.cjs → no-language-page-content-DD9Ok2Ku.cjs} +1 -1
- package/dist/{no-language-page-content-ByRFD_qA.js → no-language-page-content-Dtm37LTJ.js} +1 -1
- package/dist/no-language-page-dialog-D3dvenZ7.cjs +1 -0
- package/dist/no-language-page-dialog-Dj_z2_hF.js +10 -0
- package/dist/{page-creator-Bh0IUGR3.js → page-creator-DIMFISo4.js} +52 -52
- package/dist/{page-creator-BnvaGZVI.cjs → page-creator-DTC66ujU.cjs} +1 -1
- package/dist/page-lock-CI6BYvF_.cjs +1 -0
- package/dist/page-lock-DUlNr3os.js +30 -0
- package/dist/page-locked-dialog-BKwULMV7.js +133 -0
- package/dist/page-locked-dialog-DorIbva0.cjs +1 -0
- package/dist/page-manager-new-lNVrLOJp.cjs +1 -0
- package/dist/page-manager-new-znvqI9_L.js +354 -0
- package/dist/{page-manager-search-and-filter-BETHSa3y.js → page-manager-search-and-filter-C-_w7N27.js} +1 -1
- package/dist/{page-manager-search-and-filter-hyUIHOD_.cjs → page-manager-search-and-filter-pe0q0qnZ.cjs} +1 -1
- package/dist/{page-revisions-content-BCMjvZRZ.cjs → page-revisions-content-Caaj5TEI.cjs} +1 -1
- package/dist/{page-revisions-content-VWthKL7O.js → page-revisions-content-CyLjyxNU.js} +16 -16
- package/dist/pages.css +1 -1
- package/dist/publish-pages-content-Bih1W9C4.js +178 -0
- package/dist/publish-pages-content-D5beVcQI.cjs +1 -0
- package/dist/{save-to-lib-YYBxY7MV.js → save-to-lib-BwpkJcT2.js} +1 -1
- package/dist/{save-to-lib-CtGpDkC6.cjs → save-to-lib-DPAERsi4.cjs} +1 -1
- package/dist/{selected-block-display-DdW-DWF1.js → selected-block-display-GXSf3y2s.js} +1 -1
- package/dist/{selected-block-display-BEbuJn0l.cjs → selected-block-display-s99Y91qI.cjs} +1 -1
- package/dist/{seo-panel-CqJDhbj-.js → seo-panel-BurZA566.js} +61 -61
- package/dist/{seo-panel-B9P7fXjo.cjs → seo-panel-BxUfalVy.cjs} +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +39 -39
- package/dist/{shared-json-ld-CyxmC9y5.cjs → shared-json-ld-BYAdrPeC.cjs} +1 -1
- package/dist/{shared-json-ld-DxEPILj_.js → shared-json-ld-DHWdJvQd.js} +39 -39
- package/dist/{slug-input-RNiSrU3p.cjs → slug-input-CR2B1kDJ.cjs} +1 -1
- package/dist/{slug-input-j5z5ZQn9.js → slug-input-Z_ny7bgX.js} +1 -1
- package/dist/take-over-request-CnEpToCM.cjs +1 -0
- package/dist/take-over-request-DF2JsIes.js +63 -0
- package/dist/{theme-panel-footer-DD2yalfG.js → theme-panel-footer-5mxFeEua.js} +4 -4
- package/dist/{theme-panel-footer-CCsiDIVl.cjs → theme-panel-footer-C2CjHoBu.cjs} +1 -1
- package/dist/{unmark-as-template-DXjLbqOM.cjs → unmark-as-template-Dn90g1eh.cjs} +1 -1
- package/dist/{unmark-as-template-B2hKhAHn.js → unmark-as-template-JRRUYTOY.js} +1 -1
- package/dist/{unpublish-page-BdJScWMX.cjs → unpublish-page-C3C_rTRd.cjs} +1 -1
- package/dist/{unpublish-page-BvB1PGSz.js → unpublish-page-FZ8rbi7u.js} +9 -9
- package/dist/{web-preview-CwVpkcwU.js → web-preview-CGBKG162.js} +1 -1
- package/dist/{web-preview-BI4jd0O7.cjs → web-preview-NdxC92Fk.cjs} +1 -1
- package/package.json +3 -3
- package/dist/ai-panel-content-B2AgBWqo.cjs +0 -1
- package/dist/ai-panel-content-M1UnzG_f.js +0 -54
- package/dist/ai-panel-default-lang-CHOFEwmV.js +0 -313
- package/dist/ai-panel-default-lang-sy6vkQJh.cjs +0 -3
- package/dist/ai-panel-other-lang-BwjSDD3L.cjs +0 -1
- package/dist/ai-prompt-input-B_NRADBT.js +0 -988
- package/dist/ai-prompt-input-DcyVXcLG.cjs +0 -1
- package/dist/delete-page-CbY8q5M3.cjs +0 -1
- package/dist/delete-page-SX9X35nA.js +0 -40
- package/dist/index-Bz7smSC0.cjs +0 -5
- package/dist/index-EnM7J19_.js +0 -4960
- package/dist/page-lock-request-C2b1kqyA.cjs +0 -1
- package/dist/page-lock-request-CaNqxfD6.js +0 -75
- package/dist/page-locked-by-dialog--WLDdkw9.js +0 -68
- package/dist/page-locked-by-dialog-90ElC8aG.cjs +0 -1
- package/dist/page-manager-new-Bo4-zwfW.js +0 -354
- package/dist/page-manager-new-SNRQn7Az.cjs +0 -1
- package/dist/publish-pages-content-6N7aEcM1.js +0 -178
- package/dist/publish-pages-content-CaBwfekc.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var xs = Object.defineProperty;
|
|
2
2
|
var ws = (e, t, n) => t in e ? xs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var _e = (e, t, n) => ws(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import {
|
|
4
|
+
import { y as Vn, z as jn, C as K, D as sr, F as H, x as y, G as W, H as oe, S as R, w as O, I as $e, J as Ce, K as G, M as A, N as He, O as ft, Q as ve, R as Ro, U as V, V as $s, W as P, X as wt, Y as un, Z as k, _ as T, $ as Cs, a0 as Kt, a1 as Ss, a2 as ks, a3 as Cn, a4 as Es, a5 as Ds, a6 as Ms, a7 as Nt, a8 as As, a9 as Ts, aa as Fs, ab as ar, ac as Hr, ad as qs, ae as _t, af as Ko, ag as Ur, ah as Is, ai as Os, aj as Kn, ak as Ls, al as Ps, am as _s } from "./index-DI2Rwk5v.js";
|
|
5
5
|
var zs = (e) => e != null, Rs = (e) => e.filter(zs);
|
|
6
6
|
function Ks(e) {
|
|
7
7
|
return (...t) => {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as r } from "@chaibuilder/sdk";
|
|
3
|
+
import { Card as i, CardHeader as o, CardTitle as l, CardContent as c, CardFooter as d, Button as m } from "@chaibuilder/sdk/ui";
|
|
4
|
+
import { TableIcon as h, Edit as u } from "lucide-react";
|
|
5
|
+
import { an as N, a as p, B as T, E as f, P as E } from "./index-DI2Rwk5v.js";
|
|
6
|
+
const S = () => {
|
|
7
|
+
const n = N(), { setPageStatus: s } = p(), { t } = r();
|
|
8
|
+
return /* @__PURE__ */ e(T, { children: /* @__PURE__ */ a(i, { className: "mx-auto w-full max-w-md", children: [
|
|
9
|
+
/* @__PURE__ */ e(o, { className: "space-y-1", children: /* @__PURE__ */ a(l, { className: "flex items-center gap-2 text-xl font-medium", children: [
|
|
10
|
+
/* @__PURE__ */ e(h, { className: "h-6 w-6 text-green-500" }),
|
|
11
|
+
/* @__PURE__ */ e("span", { children: t("Active in Another Tab") })
|
|
12
|
+
] }) }),
|
|
13
|
+
/* @__PURE__ */ e(c, { className: "space-y-4", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t(
|
|
14
|
+
"This page is currently being edited in another tab. You can continue editing here, which will close the editor in the other tab."
|
|
15
|
+
) }) }),
|
|
16
|
+
/* @__PURE__ */ e(d, { className: "flex justify-end gap-2", children: /* @__PURE__ */ a(
|
|
17
|
+
m,
|
|
18
|
+
{
|
|
19
|
+
variant: "default",
|
|
20
|
+
onClick: () => {
|
|
21
|
+
n(f.CONTINUE_EDITING_IN_THIS_TAB_REQUEST), s(E.CHECKING);
|
|
22
|
+
},
|
|
23
|
+
className: "gap-2",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ e(u, { className: "h-4 w-4" }),
|
|
26
|
+
t("Continue Editing Here")
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
) })
|
|
30
|
+
] }) });
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
S as default
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("@chaibuilder/sdk"),t=require("@chaibuilder/sdk/ui"),a=require("lucide-react"),s=require("./index-BeWL6Sj6.cjs"),l=()=>{const i=s.useSendRealtimeEvent(),{setPageStatus:r}=s.usePageLockStatus(),{t:n}=c.useTranslation();return e.jsx(s.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-xl font-medium",children:[e.jsx(a.TableIcon,{className:"h-6 w-6 text-green-500"}),e.jsx("span",{children:n("Active in Another Tab")})]})}),e.jsx(t.CardContent,{className:"space-y-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:n("This page is currently being edited in another tab. You can continue editing here, which will close the editor in the other tab.")})}),e.jsx(t.CardFooter,{className:"flex justify-end gap-2",children:e.jsxs(t.Button,{variant:"default",onClick:()=>{i(s.EVENT.CONTINUE_EDITING_IN_THIS_TAB_REQUEST),r(s.PAGE_STATUS.CHECKING)},className:"gap-2",children:[e.jsx(a.Edit,{className:"h-4 w-4"}),n("Continue Editing Here")]})})]})})};exports.default=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),V=require("./slug-input-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),V=require("./slug-input-CR2B1kDJ.cjs"),f=require("./index-BeWL6Sj6.cjs"),w=require("@chaibuilder/sdk"),S=require("@chaibuilder/sdk/ui"),Y=require("lodash-es"),is=require("lucide-react"),N=require("react"),X=({edit:c,lang:h,languages:a,name:u,setLang:t,setName:i,primaryPageObject:o})=>{const{t:s}=w.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(S.Label,{htmlFor:"lang",children:s("Language")}),e.jsxs("select",{value:c?"":h,disabled:c||!a.length,onChange:l=>{const x=l.target.value;t(x),!c&&(Y.startsWith(u,o==null?void 0:o.name)||u.length===0)&&i(`${o==null?void 0:o.name} - ${f.LANGUAGES[x]}`)},className:"col-span-3 flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("option",{value:"",disabled:!0,children:c?f.LANGUAGES[h]||h:a.length?s("Choose language"):s("All available language page is created.")}),a.map(l=>e.jsx("option",{value:l,children:f.LANGUAGES[l]||l},l))]})]})},Z=({lang:c,name:h,setName:a,parentHasSelectedLanguagePage:u})=>{const{t}=w.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(S.Label,{htmlFor:"name",children:t("Page Name")}),e.jsx(S.Input,{id:"name",value:c?h:"",onChange:i=>a(i.target.value),required:!0,placeholder:t(c?"Enter page name":"Choose language to add slug"),disabled:!u||!c})]})},ds=({dynamic:c,isNonSlugPageType:h,isRootPage:a,lang:u,useLanguagePrefix:t,setUseLanguagePrefix:i,isHomePage:o,parentSlug:s,parentHasSelectedLanguagePage:l,slug:x,setSlug:d,setIsSlugValid:m,getSlug:g})=>{const{t:r}=w.useTranslation();return h?null:e.jsxs("div",{className:"space-y-1",children:[a&&u&&e.jsxs("div",{className:"flex items-center space-x-2 pb-1",children:[e.jsx("input",{type:"checkbox",id:"useLanguagePrefix",checked:t,onChange:A=>i(A.target.checked),className:"rounded border-gray-300"}),e.jsxs(S.Label,{htmlFor:"useLanguagePrefix",className:"text-sm font-normal leading-tight",children:["Add language code (",e.jsxs("span",{className:"font-mono text-gray-900",children:["/",u]}),") as slug prefix"]})]}),e.jsx(S.Label,{htmlFor:"slug",children:r("Slug")}),c?e.jsx(S.Alert,{variant:"default",className:"p-2 text-xs font-medium italic text-muted-foreground",children:r("This page will use dynamic slug as defined in primary page")}):e.jsx(V.SlugInput,{disabled:!u||!l,value:x,onChange:d,placeholder:r(u?o&&t?"Leave empty for home page":"Enter page slug":"Choose language to add slug"),parentSlug:s,onValidationChange:m,fullSlug:g()})]})},_=({parentHasSelectedLanguagePage:c,name:h,lang:a,slug:u,edit:t,id:i,primaryPageObject:o,pages:s,isNonSlugPageType:l,isHomePage:x,useLanguagePrefix:d,isSlugValid:m,isPending:g})=>{const{t:r}=w.useTranslation(),A=g||!h||!a||s.some(v=>(t?v.id!==i:!0)&&v.parent===(o==null?void 0:o.id)&&v.lang===a)||!l&&!(x&&d)&&(!m||!u);return e.jsx(S.DialogFooter,{children:c?e.jsxs(e.Fragment,{children:[e.jsx(S.Button,{type:"submit",disabled:A&&!o.dynamic,children:g?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"loader mr-2"}),r(t?"Updating...":"Adding...")]}):r(t?"Update":"Add new language page")}),s.some(v=>(t?v.id!==i:!0)&&v.parent===(o==null?void 0:o.id)&&v.lang===a)&&e.jsx("p",{className:"mt-2 text-xs text-red-500",children:r("A page for this language already exists.")})]}):a&&e.jsx(S.Alert,{variant:"destructive",children:e.jsxs("p",{className:"mx-auto w-5/6 text-center",children:[r("You need to create the")," ",e.jsx("span",{className:"font-medium",children:f.LANGUAGES[a]})," ",r("page in the parent to add here.")]})})})},cs=({onSubmit:c,edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s,parentHasSelectedLanguagePage:l,id:x,pages:d,isNonSlugPageType:m,isHomePage:g,useLanguagePrefix:r,slug:A,isSlugValid:v,isPending:E})=>e.jsxs("form",{onSubmit:c,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(X,{edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s}),e.jsx(Z,{lang:a,name:t,setName:o,parentHasSelectedLanguagePage:l})]}),e.jsx(_,{parentHasSelectedLanguagePage:l,name:t,lang:a,slug:A,edit:h,id:x,primaryPageObject:s,pages:d,isNonSlugPageType:m,isHomePage:g,useLanguagePrefix:r,isSlugValid:v,isPending:E})]}),rs=({loading:c,onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,isNonSlugPageType:d,isRootPage:m,useLanguagePrefix:g,setUseLanguagePrefix:r,isHomePage:A,parentSlug:v,slug:E,setSlug:C,isSlugValid:T,setIsSlugValid:R,getSlug:M,isPending:$,id:D,pages:L})=>c?e.jsx("div",{className:"flex h-80 items-center justify-center",children:e.jsx(is.Loader,{className:"animate-spin"})}):d?e.jsx(cs,{onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,id:D,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:g,slug:E,isSlugValid:T,isPending:$}):e.jsxs("form",{onSubmit:h,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(X,{edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l}),e.jsx(Z,{lang:u,name:i,setName:s,parentHasSelectedLanguagePage:x}),e.jsx(ds,{dynamic:l==null?void 0:l.dynamic,isNonSlugPageType:d,isRootPage:m,lang:u,useLanguagePrefix:g,setUseLanguagePrefix:r,isHomePage:A,parentSlug:v,parentHasSelectedLanguagePage:x,slug:E,setSlug:C,isSlugValid:T,setIsSlugValid:R,getSlug:M})]}),e.jsx(_,{parentHasSelectedLanguagePage:x,name:i,lang:u,slug:E,edit:a,id:D,primaryPageObject:l,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:g,isSlugValid:T,isPending:$})]}),hs=({id:c,isOpen:h,onClose:a,primaryPage:u,edit:t=!1,preselectedLang:i})=>{const{data:o=[]}=f.useWebsitePages(),s=N.useMemo(()=>o.find(n=>n.id===u),[o,u]),[l,x]=N.useState(""),[d,m]=N.useState(""),[g,r]=N.useState(""),[A,v]=N.useState(!0),[E,C]=N.useState(!0),{mutate:T,isPending:R}=f.useCreatePage(),{mutate:M,isPending:$}=f.useUpdatePage(),D=R||$,{data:L,isFetching:H}=f.useWebsiteSetting(),j=f.useFallbackLang(),{data:G,isFetching:b}=f.useLanguagePages(u),{data:F=[],isFetching:y}=f.useLanguagePages(s==null?void 0:s.parent),{data:z=[],isFetching:P}=f.usePageTypes(),{setSelectedLang:O}=w.useLanguages(),{t:I}=w.useTranslation(),[,ss]=f.useSearchParams(),[,es]=w.useSidebarActivePanel(),ns=H||b||y||P,U=N.useMemo(()=>Y.filter(L==null?void 0:L.languages,n=>!Y.find(G,{lang:n})),[L,G]),W=N.useMemo(()=>z.find(n=>n.key===(s==null?void 0:s.pageType)),[z,s==null?void 0:s.pageType]),J=!(W!=null&&W.hasSlug),B=(s==null?void 0:s.slug)==="/";N.useEffect(()=>{if(!t&&s&&i&&(m(i),x(`${s.name} - ${f.LANGUAGES[i]}`)),!t||!s)return;const n=G==null?void 0:G.find(us=>us.id===c);if(!n)return;x(n.name),m(n.lang);const p=n.slug||"",{initSlug:k,prefix:as}=V.parseSlugForEdit(p,s);r(k),C(as)},[t,c,G,s,i]),N.useEffect(()=>{if(i)m(i);else if((U==null?void 0:U.length)===1&&!t){const n=U[0];if(!n||!f.LANGUAGES[n])return;m(n),(!l||l===(s==null?void 0:s.name))&&x(`${s==null?void 0:s.name} - ${f.LANGUAGES[n]}`)}},[i,U,t,l,s]);const{parentSlug:K,isRootPage:q}=N.useMemo(()=>{if(B||!d)return{parentSlug:void 0,isRootPage:!(s!=null&&s.parent)};if(!(s!=null&&s.parent))return{parentSlug:E?`/${d}`:void 0,isRootPage:!0};const n=F==null?void 0:F.find(p=>p.lang===d);return{parentSlug:n==null?void 0:n.slug,isRootPage:!1}},[s==null?void 0:s.parent,F,E,d,B]),ts=N.useMemo(()=>q?!0:!!(F!=null&&F.some(n=>(n==null?void 0:n.lang)===d)),[d,F,q]),Q=()=>{let n="";return q?n=`/${E?[d,g].filter(Boolean).join("/"):g}`:n=`${V.removeSlugExtension(K)}/${g}`,n.replace(/\/{2,}/g,"/").replace(/\/$/,"")},os=n=>{const p=new URLSearchParams(window.location.search);j&&n===j?p.delete("lang"):p.set("lang",n),ss(p),window.dispatchEvent(new PopStateEvent("popstate"))},ls=n=>{n.preventDefault();const p={name:l,lang:d,primaryPage:s==null?void 0:s.id,slug:J?"":Q(),pageType:s==null?void 0:s.pageType,...t&&{id:c}},k=()=>{!t&&d&&(O(d),os(d)),es("outline"),a()};t?M(p,{onSuccess:k}):T(p,{onSuccess:k})};return e.jsx(S.Dialog,{open:h,onOpenChange:a,children:h&&e.jsxs(S.DialogContent,{className:"text-slate-600 sm:max-w-[425px]",children:[e.jsxs(S.DialogHeader,{children:[e.jsx(S.DialogTitle,{children:I(t?"Edit language":"Add new language page")}),e.jsx(S.DialogDescription,{className:"font-light",children:I("Enter the details for the language")})]}),e.jsx(rs,{id:c,pages:o,loading:ns,onSubmit:ls,edit:t,lang:d,languages:U,name:l,setLang:m,setName:x,primaryPageObject:s,parentHasSelectedLanguagePage:ts,isNonSlugPageType:J,isRootPage:q,useLanguagePrefix:E,setUseLanguagePrefix:C,isHomePage:B,parentSlug:K,slug:g,setSlug:r,isSlugValid:A,setIsSlugValid:v,getSlug:Q,isPending:D})]})})};exports.default=hs;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as t, jsxs as g, Fragment as hn } from "react/jsx-runtime";
|
|
2
|
-
import { p as fn, r as gn, S as mn } from "./slug-input-
|
|
3
|
-
import {
|
|
4
|
-
import { useLanguages as An, useTranslation as
|
|
5
|
-
import { Dialog as En, DialogContent as $n, DialogHeader as Dn, DialogTitle as Ln, DialogDescription as
|
|
2
|
+
import { p as fn, r as gn, S as mn } from "./slug-input-Z_ny7bgX.js";
|
|
3
|
+
import { g as xn, h as vn, i as Sn, j as pn, k as Nn, l as Z, m as Fn, c as wn, L as A } from "./index-DI2Rwk5v.js";
|
|
4
|
+
import { useLanguages as An, useTranslation as k, useSidebarActivePanel as Cn } from "@chaibuilder/sdk";
|
|
5
|
+
import { Dialog as En, DialogContent as $n, DialogHeader as Dn, DialogTitle as Ln, DialogDescription as kn, Label as I, Input as Tn, Alert as H, DialogFooter as Un, Button as Rn } from "@chaibuilder/sdk/ui";
|
|
6
6
|
import { filter as Wn, find as Bn, startsWith as In } from "lodash-es";
|
|
7
7
|
import { Loader as Gn } from "lucide-react";
|
|
8
8
|
import { useMemo as D, useState as L, useEffect as _ } from "react";
|
|
@@ -15,7 +15,7 @@ const b = ({
|
|
|
15
15
|
setName: d,
|
|
16
16
|
primaryPageObject: o
|
|
17
17
|
}) => {
|
|
18
|
-
const { t: n } =
|
|
18
|
+
const { t: n } = k();
|
|
19
19
|
return /* @__PURE__ */ g("div", { className: "space-y-1", children: [
|
|
20
20
|
/* @__PURE__ */ t(I, { htmlFor: "lang", children: n("Language") }),
|
|
21
21
|
/* @__PURE__ */ g(
|
|
@@ -36,11 +36,11 @@ const b = ({
|
|
|
36
36
|
)
|
|
37
37
|
] });
|
|
38
38
|
}, y = ({ lang: c, name: h, setName: a, parentHasSelectedLanguagePage: i }) => {
|
|
39
|
-
const { t: s } =
|
|
39
|
+
const { t: s } = k();
|
|
40
40
|
return /* @__PURE__ */ g("div", { className: "space-y-1", children: [
|
|
41
41
|
/* @__PURE__ */ t(I, { htmlFor: "name", children: s("Page Name") }),
|
|
42
42
|
/* @__PURE__ */ t(
|
|
43
|
-
|
|
43
|
+
Tn,
|
|
44
44
|
{
|
|
45
45
|
id: "name",
|
|
46
46
|
value: c ? h : "",
|
|
@@ -66,7 +66,7 @@ const b = ({
|
|
|
66
66
|
setIsSlugValid: x,
|
|
67
67
|
getSlug: m
|
|
68
68
|
}) => {
|
|
69
|
-
const { t: r } =
|
|
69
|
+
const { t: r } = k();
|
|
70
70
|
return h ? null : /* @__PURE__ */ g("div", { className: "space-y-1", children: [
|
|
71
71
|
a && i && /* @__PURE__ */ g("div", { className: "flex items-center space-x-2 pb-1", children: [
|
|
72
72
|
/* @__PURE__ */ t(
|
|
@@ -117,8 +117,8 @@ const b = ({
|
|
|
117
117
|
isSlugValid: x,
|
|
118
118
|
isPending: m
|
|
119
119
|
}) => {
|
|
120
|
-
const { t: r } =
|
|
121
|
-
return /* @__PURE__ */ t(
|
|
120
|
+
const { t: r } = k(), S = m || !h || !a || n.some((v) => (s ? v.id !== d : !0) && v.parent === (o == null ? void 0 : o.id) && v.lang === a) || !l && !(f && u) && (!x || !i);
|
|
121
|
+
return /* @__PURE__ */ t(Un, { children: c ? /* @__PURE__ */ g(hn, { children: [
|
|
122
122
|
/* @__PURE__ */ t(Rn, { type: "submit", disabled: S && !o.dynamic, children: m ? /* @__PURE__ */ g("span", { className: "flex items-center gap-2", children: [
|
|
123
123
|
/* @__PURE__ */ t("span", { className: "loader mr-2" }),
|
|
124
124
|
r(s ? "Updating..." : "Adding...")
|
|
@@ -211,11 +211,11 @@ const b = ({
|
|
|
211
211
|
isHomePage: S,
|
|
212
212
|
parentSlug: v,
|
|
213
213
|
slug: p,
|
|
214
|
-
setSlug:
|
|
214
|
+
setSlug: T,
|
|
215
215
|
isSlugValid: $,
|
|
216
216
|
setIsSlugValid: G,
|
|
217
217
|
getSlug: q,
|
|
218
|
-
isPending:
|
|
218
|
+
isPending: U,
|
|
219
219
|
id: R,
|
|
220
220
|
pages: w
|
|
221
221
|
}) => c ? /* @__PURE__ */ t("div", { className: "flex h-80 items-center justify-center", children: /* @__PURE__ */ t(Gn, { className: "animate-spin" }) }) : u ? /* @__PURE__ */ t(
|
|
@@ -237,7 +237,7 @@ const b = ({
|
|
|
237
237
|
useLanguagePrefix: m,
|
|
238
238
|
slug: p,
|
|
239
239
|
isSlugValid: $,
|
|
240
|
-
isPending:
|
|
240
|
+
isPending: U
|
|
241
241
|
}
|
|
242
242
|
) : /* @__PURE__ */ g("form", { onSubmit: h, children: [
|
|
243
243
|
/* @__PURE__ */ g("div", { className: "grid gap-4 py-4", children: [
|
|
@@ -275,7 +275,7 @@ const b = ({
|
|
|
275
275
|
parentSlug: v,
|
|
276
276
|
parentHasSelectedLanguagePage: f,
|
|
277
277
|
slug: p,
|
|
278
|
-
setSlug:
|
|
278
|
+
setSlug: T,
|
|
279
279
|
isSlugValid: $,
|
|
280
280
|
setIsSlugValid: G,
|
|
281
281
|
getSlug: q
|
|
@@ -297,7 +297,7 @@ const b = ({
|
|
|
297
297
|
isHomePage: S,
|
|
298
298
|
useLanguagePrefix: m,
|
|
299
299
|
isSlugValid: $,
|
|
300
|
-
isPending:
|
|
300
|
+
isPending: U
|
|
301
301
|
}
|
|
302
302
|
)
|
|
303
303
|
] }), Hn = ({
|
|
@@ -308,9 +308,9 @@ const b = ({
|
|
|
308
308
|
edit: s = !1,
|
|
309
309
|
preselectedLang: d
|
|
310
310
|
}) => {
|
|
311
|
-
const { data: o = [] } = xn(), n = D(() => o.find((e) => e.id === i), [o, i]), [l, f] = L(""), [u, x] = L(""), [m, r] = L(""), [S, v] = L(!0), [p,
|
|
311
|
+
const { data: o = [] } = xn(), n = D(() => o.find((e) => e.id === i), [o, i]), [l, f] = L(""), [u, x] = L(""), [m, r] = L(""), [S, v] = L(!0), [p, T] = L(!0), { mutate: $, isPending: G } = vn(), { mutate: q, isPending: U } = Sn(), R = G || U, { data: w, isFetching: j } = pn(), z = Nn(), { data: C, isFetching: O } = Z(i), { data: F = [], isFetching: nn } = Z(
|
|
312
312
|
n == null ? void 0 : n.parent
|
|
313
|
-
), { data: J = [], isFetching: en } = Fn(), { setSelectedLang: sn } = An(), { t: M } =
|
|
313
|
+
), { data: J = [], isFetching: en } = Fn(), { setSelectedLang: sn } = An(), { t: M } = k(), [, tn] = wn(), [, on] = Cn(), ln = j || O || nn || en, E = D(() => Wn(w == null ? void 0 : w.languages, (e) => !Bn(C, { lang: e })), [w, C]), V = D(
|
|
314
314
|
() => J.find((e) => e.key === (n == null ? void 0 : n.pageType)),
|
|
315
315
|
[J, n == null ? void 0 : n.pageType]
|
|
316
316
|
), K = !(V != null && V.hasSlug), Y = (n == null ? void 0 : n.slug) === "/";
|
|
@@ -320,7 +320,7 @@ const b = ({
|
|
|
320
320
|
if (!e) return;
|
|
321
321
|
f(e.name), x(e.lang);
|
|
322
322
|
const N = e.slug || "", { initSlug: B, prefix: cn } = fn(N, n);
|
|
323
|
-
r(B),
|
|
323
|
+
r(B), T(cn);
|
|
324
324
|
}, [s, c, C, n, d]), _(() => {
|
|
325
325
|
if (d)
|
|
326
326
|
x(d);
|
|
@@ -363,7 +363,7 @@ const b = ({
|
|
|
363
363
|
return /* @__PURE__ */ t(En, { open: h, onOpenChange: a, children: h && /* @__PURE__ */ g($n, { className: "text-slate-600 sm:max-w-[425px]", children: [
|
|
364
364
|
/* @__PURE__ */ g(Dn, { children: [
|
|
365
365
|
/* @__PURE__ */ t(Ln, { children: M(s ? "Edit language" : "Add new language page") }),
|
|
366
|
-
/* @__PURE__ */ t(
|
|
366
|
+
/* @__PURE__ */ t(kn, { className: "font-light", children: M("Enter the details for the language") })
|
|
367
367
|
] }),
|
|
368
368
|
/* @__PURE__ */ t(
|
|
369
369
|
Vn,
|
|
@@ -383,7 +383,7 @@ const b = ({
|
|
|
383
383
|
isNonSlugPageType: K,
|
|
384
384
|
isRootPage: W,
|
|
385
385
|
useLanguagePrefix: p,
|
|
386
|
-
setUseLanguagePrefix:
|
|
386
|
+
setUseLanguagePrefix: T,
|
|
387
387
|
isHomePage: Y,
|
|
388
388
|
parentSlug: Q,
|
|
389
389
|
slug: m,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("@chaibuilder/sdk"),n=require("@chaibuilder/sdk/ui"),t=require("react"),u=t.lazy(()=>Promise.resolve().then(()=>require("./page-creator-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("@chaibuilder/sdk"),n=require("@chaibuilder/sdk/ui"),t=require("react"),u=t.lazy(()=>Promise.resolve().then(()=>require("./page-creator-DTC66ujU.cjs"))),x=({addEditPage:s,setAddEditPage:r,closePanel:c})=>{const{t:o}=a.useTranslation(),i=!!(s!=null&&s.id),l=!!s;return e.jsx(n.Dialog,{open:l,onOpenChange:()=>r(void 0),children:l&&e.jsxs(n.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(n.DialogHeader,{children:[e.jsxs(n.DialogTitle,{children:[o(i?"Edit":"Add New")," "]}),e.jsx(n.DialogDescription,{children:o(i?"Update your page name":"Enter details to create a new page")})]}),e.jsx(t.Suspense,{fallback:e.jsx("div",{className:"min-h-40"}),children:e.jsx(u,{closePanel:c,addEditPage:s,close:()=>r(void 0)})})]})})};exports.default=x;
|
|
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTranslation as a } from "@chaibuilder/sdk";
|
|
3
3
|
import { Dialog as c, DialogContent as m, DialogHeader as p, DialogTitle as h, DialogDescription as f } from "@chaibuilder/sdk/ui";
|
|
4
4
|
import { lazy as D, Suspense as u } from "react";
|
|
5
|
-
const x = D(() => import("./page-creator-
|
|
5
|
+
const x = D(() => import("./page-creator-DIMFISo4.js")), C = ({
|
|
6
6
|
addEditPage: o,
|
|
7
7
|
setAddEditPage: i,
|
|
8
8
|
closePanel: t
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsxs as g, Fragment as k, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { at as A, c as F } from "./index-DI2Rwk5v.js";
|
|
3
|
+
import { useTranslation as G, useLanguages as B } from "@chaibuilder/sdk";
|
|
4
|
+
import { Button as I } from "@chaibuilder/sdk/ui";
|
|
5
|
+
import { Plus as _ } from "lucide-react";
|
|
6
|
+
import { lazy as C, useState as i, useEffect as z, Suspense as O } from "react";
|
|
7
|
+
import { toast as T } from "sonner";
|
|
8
|
+
const v = [
|
|
9
|
+
{
|
|
10
|
+
id: "google/gemini-2.5-flash",
|
|
11
|
+
name: "Gemini 2.5 Flash",
|
|
12
|
+
provider: "google",
|
|
13
|
+
description: "0.5x Credits",
|
|
14
|
+
multiplier: 0.5
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "google/gemini-2.5-flash-pro",
|
|
18
|
+
name: "Gemini 2.5 Flash Pro",
|
|
19
|
+
provider: "google",
|
|
20
|
+
description: "1.25x Credits",
|
|
21
|
+
multiplier: 1.25
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "google/gemini-3-pro",
|
|
25
|
+
name: "Gemini 3 Pro",
|
|
26
|
+
provider: "google",
|
|
27
|
+
description: "2.5x Credits",
|
|
28
|
+
multiplier: 2.5
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "openai/gpt-5",
|
|
32
|
+
name: "GPT-5",
|
|
33
|
+
provider: "openai",
|
|
34
|
+
description: "2x Credits",
|
|
35
|
+
multiplier: 2
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "anthropic/claude-haiku-4.5",
|
|
39
|
+
name: "Claude Haiku 4.5",
|
|
40
|
+
provider: "anthropic",
|
|
41
|
+
description: "1x Credits",
|
|
42
|
+
multiplier: 1
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "anthropic/claude-sonnet-4",
|
|
46
|
+
name: "Claude Sonnet 4",
|
|
47
|
+
provider: "anthropic",
|
|
48
|
+
description: "3x Credits",
|
|
49
|
+
multiplier: 3
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "anthropic/claude-sonnet-4.5",
|
|
53
|
+
name: "Claude Sonnet 4.5",
|
|
54
|
+
provider: "anthropic",
|
|
55
|
+
description: "3x Credits",
|
|
56
|
+
multiplier: 3
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "openai/gpt-4.1",
|
|
60
|
+
name: "GPT-4.1",
|
|
61
|
+
provider: "openai",
|
|
62
|
+
description: "2x Credits",
|
|
63
|
+
multiplier: 2
|
|
64
|
+
}
|
|
65
|
+
], X = (o) => v.find((s) => s.id === o), D = () => v[0], E = C(() => import("./ai-panel-default-lang-BZHkFsox.js")), R = C(() => import("./ai-panel-other-lang-D2A46FTg.js")), H = () => {
|
|
66
|
+
const { t: o } = G(), [s, a] = i(""), [e, l] = i([]), [c, d] = i(!1), [u, p] = i(null), [P, m] = i(null), [b, S] = i(D().id), { selectedLang: f, fallbackLang: w } = B(), L = A(), [M] = F(), y = M.get("page"), N = (e == null ? void 0 : e.filter((t) => t.role === "user").length) >= 4, j = (e == null ? void 0 : e.filter((t) => t.role === "user").length) >= 10;
|
|
67
|
+
z(() => {
|
|
68
|
+
l([]);
|
|
69
|
+
}, [f, y]);
|
|
70
|
+
const h = () => {
|
|
71
|
+
l([]), a(""), m(null), p(null), d(!1);
|
|
72
|
+
}, x = {
|
|
73
|
+
t: o,
|
|
74
|
+
fetch: L,
|
|
75
|
+
input: s,
|
|
76
|
+
messages: e,
|
|
77
|
+
setInput: a,
|
|
78
|
+
isLoading: c,
|
|
79
|
+
handleStop: () => {
|
|
80
|
+
u && (u.abort(), p(null)), d(!1), a(""), m(null), l((t) => {
|
|
81
|
+
const r = t[t.length - 1];
|
|
82
|
+
return r && r.role === "assistant" && r.isReasoning && r.isStreaming ? t.slice(0, -1) : t;
|
|
83
|
+
}), T.info(o("Generation stopped"));
|
|
84
|
+
},
|
|
85
|
+
handleReset: h,
|
|
86
|
+
setMessages: l,
|
|
87
|
+
setIsLoading: d,
|
|
88
|
+
currentBlock: P,
|
|
89
|
+
fallbackLang: w,
|
|
90
|
+
abortController: u,
|
|
91
|
+
setCurrentBlock: m,
|
|
92
|
+
setAbortController: p,
|
|
93
|
+
forceNewConversation: j,
|
|
94
|
+
suggestNewConversation: N,
|
|
95
|
+
selectedModel: b,
|
|
96
|
+
onModelChange: S
|
|
97
|
+
};
|
|
98
|
+
return /* @__PURE__ */ g(k, { children: [
|
|
99
|
+
c && /* @__PURE__ */ n("div", { className: "fixed inset-0 left-0 top-0 z-40 flex h-screen w-screen flex-col items-center justify-center bg-transparent" }),
|
|
100
|
+
/* @__PURE__ */ g("div", { className: "flex h-full w-full flex-col", children: [
|
|
101
|
+
/* @__PURE__ */ g("div", { className: "flex w-full items-center justify-between", children: [
|
|
102
|
+
/* @__PURE__ */ n("p", { className: "text-xs text-gray-500", children: o("Your conversation will not be saved") }),
|
|
103
|
+
(e == null ? void 0 : e.length) > 0 && /* @__PURE__ */ n(I, { variant: "outline", size: "icon", onClick: h, className: "h-6 w-6", disabled: c, children: /* @__PURE__ */ n(_, {}) })
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ n(
|
|
106
|
+
O,
|
|
107
|
+
{
|
|
108
|
+
fallback: /* @__PURE__ */ n("div", { className: "flex h-full w-full items-center justify-center text-xs", children: "Loading AI Panel" }),
|
|
109
|
+
children: f ? /* @__PURE__ */ n(R, { ...x, selectedLang: f }) : /* @__PURE__ */ n(E, { ...x })
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] })
|
|
113
|
+
] });
|
|
114
|
+
}, Z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
115
|
+
__proto__: null,
|
|
116
|
+
default: H
|
|
117
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
118
|
+
export {
|
|
119
|
+
v as A,
|
|
120
|
+
X as a,
|
|
121
|
+
Z as b,
|
|
122
|
+
D as g
|
|
123
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),C=require("./index-BeWL6Sj6.cjs"),S=require("@chaibuilder/sdk"),N=require("@chaibuilder/sdk/ui"),A=require("lucide-react"),n=require("react"),I=require("sonner"),h=[{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",provider:"google",description:"0.5x Credits",multiplier:.5},{id:"google/gemini-2.5-flash-pro",name:"Gemini 2.5 Flash Pro",provider:"google",description:"1.25x Credits",multiplier:1.25},{id:"google/gemini-3-pro",name:"Gemini 3 Pro",provider:"google",description:"2.5x Credits",multiplier:2.5},{id:"openai/gpt-5",name:"GPT-5",provider:"openai",description:"2x Credits",multiplier:2},{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",provider:"anthropic",description:"1x Credits",multiplier:1},{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",provider:"anthropic",description:"3x Credits",multiplier:3},{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",provider:"anthropic",description:"3x Credits",multiplier:3},{id:"openai/gpt-4.1",name:"GPT-4.1",provider:"openai",description:"2x Credits",multiplier:2}],B=s=>h.find(r=>r.id===s),j=()=>h[0],F=n.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-default-lang-DOk_Q0IO.cjs"))),G=n.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-other-lang-qHrdvAMa.cjs"))),_=()=>{const{t:s}=S.useTranslation(),[r,a]=n.useState(""),[t,o]=n.useState([]),[c,d]=n.useState(!1),[u,p]=n.useState(null),[v,g]=n.useState(null),[P,b]=n.useState(j().id),{selectedLang:f,fallbackLang:M}=S.useLanguages(),y=C.useBuilderFetch(),[L]=C.useSearchParams(),q=L.get("page"),w=(t==null?void 0:t.filter(i=>i.role==="user").length)>=4,k=(t==null?void 0:t.filter(i=>i.role==="user").length)>=10;n.useEffect(()=>{o([])},[f,q]);const m=()=>{o([]),a(""),g(null),p(null),d(!1)},x={t:s,fetch:y,input:r,messages:t,setInput:a,isLoading:c,handleStop:()=>{u&&(u.abort(),p(null)),d(!1),a(""),g(null),o(i=>{const l=i[i.length-1];return l&&l.role==="assistant"&&l.isReasoning&&l.isStreaming?i.slice(0,-1):i}),I.toast.info(s("Generation stopped"))},handleReset:m,setMessages:o,setIsLoading:d,currentBlock:v,fallbackLang:M,abortController:u,setCurrentBlock:g,setAbortController:p,forceNewConversation:k,suggestNewConversation:w,selectedModel:P,onModelChange:b};return e.jsxs(e.Fragment,{children:[c&&e.jsx("div",{className:"fixed inset-0 left-0 top-0 z-40 flex h-screen w-screen flex-col items-center justify-center bg-transparent"}),e.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("p",{className:"text-xs text-gray-500",children:s("Your conversation will not be saved")}),(t==null?void 0:t.length)>0&&e.jsx(N.Button,{variant:"outline",size:"icon",onClick:m,className:"h-6 w-6",disabled:c,children:e.jsx(A.Plus,{})})]}),e.jsx(n.Suspense,{fallback:e.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs",children:"Loading AI Panel"}),children:f?e.jsx(G,{...x,selectedLang:f}):e.jsx(F,{...x})})]})]})},z=Object.freeze(Object.defineProperty({__proto__:null,default:_},Symbol.toStringTag,{value:"Module"}));exports.AI_MODELS=h;exports.aiPanelContent=z;exports.getDefaultModel=j;exports.getModelById=B;
|