@chaibuilder/pages 0.15.24 → 0.16.1
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-wLnL_T-W.cjs → 2AITGKQY-CD9A6oc6.cjs} +1 -1
- package/dist/{2AITGKQY-B6ojx8vV.js → 2AITGKQY-Z1XcJ6Q7.js} +2 -2
- package/dist/{NCMVHL6D-DGH2CRR6.cjs → NCMVHL6D-CkpM-3og.cjs} +1 -1
- package/dist/{NCMVHL6D-vsNnIwmV.js → NCMVHL6D-DoK0XoIo.js} +4 -4
- package/dist/{ZDWCUMSJ-3BnFdOH2.cjs → ZDWCUMSJ-D32swpGV.cjs} +1 -1
- package/dist/{ZDWCUMSJ-CoYx1TP5.js → ZDWCUMSJ-hGXNxbOK.js} +1 -1
- package/dist/{add-new-language-page-d0-cAxlt.js → add-new-language-page-BZPoqdX-.js} +2 -2
- package/dist/{add-new-language-page-VDZSKD95.cjs → add-new-language-page-D65TpIwK.cjs} +1 -1
- package/dist/{add-new-page-D4IkZL8h.cjs → add-new-page-CQ0aj4RJ.cjs} +1 -1
- package/dist/{add-new-page-Bcoxw6U5.js → add-new-page-DK25Y0zS.js} +1 -1
- package/dist/ai-panel-content-BSGJqnTM.cjs +1 -0
- package/dist/ai-panel-content-DYRZnMgV.js +52 -0
- package/dist/ai-panel-default-lang-BOZrL5Xe.cjs +1 -0
- package/dist/ai-panel-default-lang-DZUqC79y.js +173 -0
- package/dist/ai-panel-message-bubble-Bl-aUeU4.cjs +1 -0
- package/dist/ai-panel-message-bubble-DPAaAMAZ.js +38 -0
- package/dist/ai-panel-other-lang-CCyiE6ha.js +145 -0
- package/dist/ai-panel-other-lang-CNtlT5dM.cjs +1 -0
- package/dist/ai-panel-quick-prompts-DeS7L1f0.cjs +1 -0
- package/dist/ai-panel-quick-prompts-Ds0Ndz7g.js +46 -0
- package/dist/ai-prompt-input-Ch_PLEPN.js +133 -0
- package/dist/ai-prompt-input-Zg6lN1Lo.cjs +1 -0
- package/dist/ai-translation-prompt-BUFjo_om.cjs +1 -0
- package/dist/ai-translation-prompt-BiJ5B_an.js +28 -0
- package/dist/{delete-page-KS6p6b8f.js → delete-page-B95T2Prd.js} +1 -1
- package/dist/{delete-page-DeKAD4Ld.cjs → delete-page-BSop1jNg.cjs} +1 -1
- package/dist/{digital-asset-manager-Dfe9SS09.js → digital-asset-manager-BQNSwfKs.js} +1 -1
- package/dist/{digital-asset-manager-C9gYL2SF.cjs → digital-asset-manager-Bn58WzM6.cjs} +1 -1
- package/dist/{duplicate-page-CKr-HNs-.cjs → duplicate-page-BLxkSiug.cjs} +1 -1
- package/dist/{duplicate-page-vCgYnw4H.js → duplicate-page-CrzzObAj.js} +9 -9
- package/dist/{dynamic-page-selector-A4fqWqZZ.js → dynamic-page-selector-D6wQnNfH.js} +1 -1
- package/dist/{dynamic-page-selector-C7w3TOdK.cjs → dynamic-page-selector-D8UZ63LW.cjs} +1 -1
- package/dist/index-W0r4o5Ro.cjs +5 -0
- package/dist/{index-NSqs69Op.js → index-yhKyIbgs.js} +1035 -1031
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +7 -7
- package/dist/{json-diff-viewer-7TGemUrn.js → json-diff-viewer-ISJS7lHK.js} +1 -1
- package/dist/{json-diff-viewer-nLLX6kJK.cjs → json-diff-viewer-ZeJ3Rp2y.cjs} +1 -1
- package/dist/{lang-panel-C6KxjKn_.js → lang-panel-Bj11IL7k.js} +33 -33
- package/dist/{lang-panel-dc9uBMtE.cjs → lang-panel-DqN_J3vz.cjs} +1 -1
- package/dist/{mark-as-template-CJ9SiEBl.cjs → mark-as-template-CcwAAdrd.cjs} +1 -1
- package/dist/{mark-as-template-CRUOQ_FZ.js → mark-as-template-CmCCMaQg.js} +1 -1
- package/dist/{no-language-page-content--8a37nsW.cjs → no-language-page-content-BXm1k1Aa.cjs} +1 -1
- package/dist/{no-language-page-content-ByHFQjkV.js → no-language-page-content-Cme-zo4R.js} +1 -1
- package/dist/{page-creator-CzUQicdh.cjs → page-creator-ByhjXyHP.cjs} +1 -1
- package/dist/{page-creator-J_CNgdj5.js → page-creator-Zbv4d4H8.js} +2 -2
- package/dist/{page-lock-request-BE9-Oego.cjs → page-lock-request-Cln-EE6Z.cjs} +1 -1
- package/dist/{page-lock-request-CD93n5pq.js → page-lock-request-DDQJb8IA.js} +10 -10
- package/dist/{page-locked-by-dialog-1Lm9dcT6.cjs → page-locked-by-dialog-BIXYITEu.cjs} +1 -1
- package/dist/{page-locked-by-dialog-noDLCQWF.js → page-locked-by-dialog-Csn56a3n.js} +1 -1
- package/dist/{page-manager-new-BoTBCqZF.cjs → page-manager-new-BJaTBpih.cjs} +1 -1
- package/dist/{page-manager-new-D-U4B9y9.js → page-manager-new-BrRxZDfT.js} +67 -67
- package/dist/{page-manager-search-and-filter-BJmETYq-.cjs → page-manager-search-and-filter-Bk3PUjha.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-h-YzJVcH.js → page-manager-search-and-filter-_Hvk3bU3.js} +1 -1
- package/dist/{page-revisions-content-C7DXjFls.js → page-revisions-content-B6fRCBX_.js} +10 -10
- package/dist/{page-revisions-content-BNBb2qYh.cjs → page-revisions-content-C_Ha3tFu.cjs} +1 -1
- package/dist/prompt-helper-Csgu8Rfb.js +187 -0
- package/dist/prompt-helper-DgI1lgGV.cjs +51 -0
- package/dist/{publish-pages-content-DAKh_sSW.js → publish-pages-content-CFEIxKQD.js} +2 -2
- package/dist/{publish-pages-content-DsOVOiBD.cjs → publish-pages-content-DQDNxwHD.cjs} +1 -1
- package/dist/{save-to-lib-BR1Qhw3Q.cjs → save-to-lib-Bl22umTa.cjs} +1 -1
- package/dist/{save-to-lib-BPR_--qN.js → save-to-lib-YyYkF6c6.js} +1 -1
- package/dist/{seo-panel-C7XC-XRg.js → seo-panel-BZlMea1L.js} +1 -1
- package/dist/{seo-panel-CUqtdGoF.cjs → seo-panel-BhxikAkG.cjs} +1 -1
- package/dist/server.cjs +241 -1
- package/dist/server.d.ts +50 -6
- package/dist/server.js +10327 -290
- package/dist/{shared-json-ld-CDffP4G3.cjs → shared-json-ld-BfkH76U3.cjs} +1 -1
- package/dist/{shared-json-ld-0JD8sokD.js → shared-json-ld-E4Ckwlbr.js} +41 -41
- package/dist/{slug-input-BYH90lv1.cjs → slug-input--VmQG0S1.cjs} +1 -1
- package/dist/{slug-input-CvIDihGn.js → slug-input-CKKkqGj4.js} +1 -1
- package/dist/{theme-panel-footer-DPpLzCDu.js → theme-panel-footer-2ERfMsET.js} +1 -1
- package/dist/{theme-panel-footer-CUSfduTK.cjs → theme-panel-footer-CagxEZEO.cjs} +1 -1
- package/dist/{unmark-as-template-CjqRfFDL.js → unmark-as-template-BJ5CTNAe.js} +1 -1
- package/dist/{unmark-as-template-Bxw4t_Xi.cjs → unmark-as-template-CeWpo9wD.cjs} +1 -1
- package/dist/{unpublish-page-BjiB3d7l.cjs → unpublish-page-DmZSVxFj.cjs} +1 -1
- package/dist/{unpublish-page-CKKU1St1.js → unpublish-page-DvOWVBIf.js} +1 -1
- package/dist/{web-preview-D0OpieXz.js → web-preview-DTkIggV7.js} +1 -1
- package/dist/{web-preview-CNMYCWxW.cjs → web-preview-DlSKpPUZ.cjs} +1 -1
- package/package.json +3 -3
- package/dist/ai-panel-content-Cn3SA_Sr.cjs +0 -46
- package/dist/ai-panel-content-qmOJKjkE.js +0 -524
- package/dist/index-LfuCMBwI.cjs +0 -5
|
@@ -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 { w as Vn, x as jn, y as K, z as sr, C as H, v as y, D as W, E as oe, S as R, s as O, F as $e, G as Ce, H as G, I as A, J as He, K as ft, M as ve, P as Ro, N as V, O as $s, Q as P, R as wt, U as un, V as k, W as T, X as Cs, Y as Kt, Z as Ss, _ as ks, $ as Cn, a0 as Es, a1 as Ds, a2 as Ms, a3 as Nt, a4 as As, a5 as Ts, a6 as Fs, a7 as ar, a8 as Hr, a9 as qs, aa as _t, ab as Ko, ac as Ur, ad as Is, ae as Os, af as Kn, ag as Ls, ah as Ps, ai as _s } from "./index-yhKyIbgs.js";
|
|
5
5
|
var zs = (e) => e != null, Rs = (e) => e.filter(zs);
|
|
6
6
|
function Ks(e) {
|
|
7
7
|
return (...t) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
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 { b as xn, c as vn, d as Sn, e as pn, f as Nn, g as Z, h as Fn, i as wn, L as A } from "./index-
|
|
2
|
+
import { p as fn, r as gn, S as mn } from "./slug-input-CKKkqGj4.js";
|
|
3
|
+
import { b as xn, c as vn, d as Sn, e as pn, f as Nn, g as Z, h as Fn, i as wn, L as A } from "./index-yhKyIbgs.js";
|
|
4
4
|
import { useLanguages as An, useTranslation as T, useSidebarActivePanel as Cn } from "@chaibuilder/sdk";
|
|
5
5
|
import { Dialog as En, DialogContent as $n, DialogHeader as Dn, DialogTitle as Ln, DialogDescription as Tn, Label as I, Input as Un, Alert as H, DialogFooter as kn, Button as Rn } from "@chaibuilder/sdk/ui";
|
|
6
6
|
import { filter as Wn, find as Bn, startsWith as In } from "lodash-es";
|
|
@@ -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--VmQG0S1.cjs"),f=require("./index-W0r4o5Ro.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 +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-ByhjXyHP.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-Zbv4d4H8.js")), C = ({
|
|
6
6
|
addEditPage: o,
|
|
7
7
|
setAddEditPage: i,
|
|
8
8
|
closePanel: t
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("./index-W0r4o5Ro.cjs"),b=require("@chaibuilder/sdk"),y=require("@chaibuilder/sdk/ui"),C=require("lucide-react"),n=require("react"),N=require("sonner"),k=n.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-default-lang-BOZrL5Xe.cjs"))),A=n.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-other-lang-CNtlT5dM.cjs"))),z=()=>{const{t:r}=b.useTranslation(),[m,o]=n.useState(""),[t,l]=n.useState([]),[a,c]=n.useState(!1),[i,u]=n.useState(null),[p,d]=n.useState(null),{selectedLang:f,fallbackLang:P}=b.useLanguages(),S=j.useBuilderFetch(),[q]=j.useSearchParams(),v=q.get("page"),w=(t==null?void 0:t.filter(s=>s.role==="user").length)>=4,L=(t==null?void 0:t.filter(s=>s.role==="user").length)>=10;n.useEffect(()=>{l([])},[f,v]);const x=()=>{l([]),o(""),d(null),u(null),c(!1)},g={t:r,fetch:S,input:m,messages:t,setInput:o,isLoading:a,handleStop:()=>{i&&(i.abort(),u(null)),c(!1),o(""),d(null),l(s=>{const h=s[s.length-1];return h&&h.role==="assistant"&&!h.content.trim()?s.slice(0,-1):s}),N.toast.info(r("Generation stopped"))},handleReset:x,setMessages:l,setIsLoading:c,currentBlock:p,fallbackLang:P,abortController:i,setCurrentBlock:d,setAbortController:u,forceNewConversation:L,suggestNewConversation:w};return e.jsxs(e.Fragment,{children:[a&&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 bg-white",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("p",{className:"text-xs text-gray-500",children:r("Your conversation will not be saved")}),(t==null?void 0:t.length)>0&&e.jsx(y.Button,{variant:"outline",size:"icon",onClick:x,className:"h-6 w-6",disabled:a,children:e.jsx(C.Plus,{})})]}),e.jsx(n.Suspense,{fallback:e.jsx("div",{children:"Loading AI Panel..."}),children:f?e.jsx(A,{...g,selectedLang:f}):e.jsx(k,{...g})})]})]})};exports.default=z;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsxs as h, Fragment as A, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { q as S, i as j } from "./index-yhKyIbgs.js";
|
|
3
|
+
import { useTranslation as y, useLanguages as B } from "@chaibuilder/sdk";
|
|
4
|
+
import { Button as F } from "@chaibuilder/sdk/ui";
|
|
5
|
+
import { Plus as z } from "lucide-react";
|
|
6
|
+
import { lazy as x, useState as l, useEffect as I, Suspense as M } from "react";
|
|
7
|
+
import { toast as q } from "sonner";
|
|
8
|
+
const D = x(() => import("./ai-panel-default-lang-DZUqC79y.js")), E = x(() => import("./ai-panel-other-lang-CCyiE6ha.js")), Q = () => {
|
|
9
|
+
const { t: s } = y(), [b, r] = l(""), [e, o] = l([]), [a, i] = l(!1), [c, u] = l(null), [w, f] = l(null), { selectedLang: d, fallbackLang: L } = B(), P = S(), [C] = j(), N = C.get("page"), v = (e == null ? void 0 : e.filter((t) => t.role === "user").length) >= 4, k = (e == null ? void 0 : e.filter((t) => t.role === "user").length) >= 10;
|
|
10
|
+
I(() => {
|
|
11
|
+
o([]);
|
|
12
|
+
}, [d, N]);
|
|
13
|
+
const p = () => {
|
|
14
|
+
o([]), r(""), f(null), u(null), i(!1);
|
|
15
|
+
}, g = {
|
|
16
|
+
t: s,
|
|
17
|
+
fetch: P,
|
|
18
|
+
input: b,
|
|
19
|
+
messages: e,
|
|
20
|
+
setInput: r,
|
|
21
|
+
isLoading: a,
|
|
22
|
+
handleStop: () => {
|
|
23
|
+
c && (c.abort(), u(null)), i(!1), r(""), f(null), o((t) => {
|
|
24
|
+
const m = t[t.length - 1];
|
|
25
|
+
return m && m.role === "assistant" && !m.content.trim() ? t.slice(0, -1) : t;
|
|
26
|
+
}), q.info(s("Generation stopped"));
|
|
27
|
+
},
|
|
28
|
+
handleReset: p,
|
|
29
|
+
setMessages: o,
|
|
30
|
+
setIsLoading: i,
|
|
31
|
+
currentBlock: w,
|
|
32
|
+
fallbackLang: L,
|
|
33
|
+
abortController: c,
|
|
34
|
+
setCurrentBlock: f,
|
|
35
|
+
setAbortController: u,
|
|
36
|
+
forceNewConversation: k,
|
|
37
|
+
suggestNewConversation: v
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ h(A, { children: [
|
|
40
|
+
a && /* @__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" }),
|
|
41
|
+
/* @__PURE__ */ h("div", { className: "flex h-full w-full flex-col bg-white", children: [
|
|
42
|
+
/* @__PURE__ */ h("div", { className: "flex w-full items-center justify-between", children: [
|
|
43
|
+
/* @__PURE__ */ n("p", { className: "text-xs text-gray-500", children: s("Your conversation will not be saved") }),
|
|
44
|
+
(e == null ? void 0 : e.length) > 0 && /* @__PURE__ */ n(F, { variant: "outline", size: "icon", onClick: p, className: "h-6 w-6", disabled: a, children: /* @__PURE__ */ n(z, {}) })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ n(M, { fallback: /* @__PURE__ */ n("div", { children: "Loading AI Panel..." }), children: d ? /* @__PURE__ */ n(E, { ...g, selectedLang: d }) : /* @__PURE__ */ n(D, { ...g }) })
|
|
47
|
+
] })
|
|
48
|
+
] });
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
Q as default
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),h=require("@chaibuilder/sdk"),F=require("lucide-react"),d=require("react"),X=require("sonner"),Y=require("./prompt-helper-DgI1lgGV.cjs");function Z(n){if(!n)return"";let e=n.trim();return e=e.replace(/^```html\n?/i,""),e=e.replace(/^```\n?/,""),e=e.replace(/\n?```$/,""),e=e.trim(),e}function ee(n){if(!n)return"";const e=Z(n);return e.length===0||!e.includes("<")||!e.includes(">")?"":e}const te=n=>{const e=document.getElementById("canvas-iframe");if(!e)return null;const l=e==null?void 0:e.contentDocument;if(!l)return null;const s=l.querySelector(`[data-block-id="${n}"]`);if(!s)return null;if(n==="canvas"){const a=l.createElement("div");return a.style.height="100vh",s.appendChild(a),a}return s},ne=d.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-message-bubble-Bl-aUeU4.cjs"))),re=d.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-Zg6lN1Lo.cjs"))),oe=({t:n,fetch:e,input:l,messages:s,setInput:a,isLoading:m,setMessages:v,handleReset:T,handleStop:_,setIsLoading:k,currentBlock:D,fallbackLang:M,setCurrentBlock:R,setAbortController:E,forceNewConversation:j,suggestNewConversation:z})=>{const q=d.useRef(null),{addPredefinedBlock:V}=h.useAddBlock(),O=h.useReplaceBlock(),f=h.useSelectedBlock(),U=h.useBlocksHtmlForAi(),W=h.useHtmlToBlocks(),$=()=>{var o;(o=q.current)==null||o.scrollIntoView({behavior:"smooth"})};d.useEffect(()=>{$()},[s,m]);const C=async(o,x,A)=>{var B;if(!o||m)return;const r=f;R(f);const H=U();if(f&&!H){X.toast.error(n("Something went wrong. Please try again."));return}const N={id:Date.now().toString(),role:"user",content:Y.getUserPrompt({language:M,userInput:x||o,currentHtml:f?H:""}),userMessage:o},P={id:Date.now().toString(),role:"assistant",content:""};v(i=>[...i,N,P]),k(!0);const K=new AbortController;E(K);try{const i={messages:[...s,N].map(w=>({role:w.role,content:w.content}))};A&&(i.image=A);const b=await e({body:{action:"ASK_AI",data:i},streamResponse:!0});if(!b.ok)throw new Error(n("Failed to get AI response"));const p=(B=b.body)==null?void 0:B.getReader(),L=new TextDecoder;let y="";if(!p)throw new Error(n("Response body is not readable"));const u=te(r?r==null?void 0:r._id:"canvas");for(;;){const{done:w,value:J}=await p.read();if(w){u&&!r&&u.remove();break}const Q=L.decode(J,{stream:!0});if(y+=Q,u){u.innerHTML=y;const g=u.getBoundingClientRect(),c=document.getElementById("canvas-iframe"),I=c==null?void 0:c.contentWindow;I&&(g.top>=0&&g.bottom<=I.innerHeight||u.scrollIntoView({behavior:"smooth",block:"nearest"}))}v(g=>g.map(c=>c.id===P.id?{...c,content:y}:c))}const G=ee(y),S=W(G);r!=null&&r._id?(console.log("Editing block",r==null?void 0:r._id,S),O(r==null?void 0:r._id,S)):V([...S],r==null?void 0:r._parent,-1)}catch(i){if(i.name!=="AbortError"){const b={id:(Date.now()+1).toString(),role:"assistant",content:n("Sorry, I encountered an error. Please try again.")};v(p=>[...p,b])}}finally{a(""),k(!1),R(null),E(null)}};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto py-4",children:[s.length===0&&t.jsx("div",{className:"flex-1 space-y-3 overflow-y-auto py-4",children:t.jsxs("div",{className:"mx-auto mt-8 text-center text-gray-500",children:[t.jsx(F.Bot,{size:48,className:"mx-auto mb-4 text-gray-300"}),t.jsx("p",{className:"mx-auto max-w-[75%] text-sm",children:n("Start a conversation with the AI assistant to generate and update your sections")})]})}),s.map((o,x)=>o.role!=="system"&&t.jsx(d.Suspense,{fallback:t.jsx("div",{children:"Loading..."}),children:t.jsx(ne,{message:o,isUser:o.role==="user",isLoading:o.role==="assistant"&&m&&x===s.length-1})},x)),z&&!m&&t.jsx("button",{onClick:T,className:"flex w-full items-center justify-center gap-2 rounded-lg border border-blue-200 bg-blue-50 p-1.5 text-left transition-colors hover:bg-blue-100",children:t.jsx("div",{className:"flex flex-col",children:t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-blue-700",children:[t.jsx(F.Plus,{className:"h-4 w-4 capitalize text-blue-600"}),n(j?"Start":"New")," ",n("Conversation")," ",!j&&t.jsx("span",{className:"text-[10px] font-extralight text-blue-600",children:n("For best results")})]})})}),t.jsx("div",{ref:q})]}),!j&&t.jsx("div",{className:"border-gray-200 pb-2",children:t.jsx(d.Suspense,{fallback:t.jsx("div",{children:"Loading..."}),children:t.jsx(re,{input:l,setInput:a,onSend:C,onStop:_,isLoading:m,selectedLang:"",currentBlock:f||D,disabled:(l==null?void 0:l.length)===0})})})]})};exports.default=oe;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { jsxs as w, Fragment as X, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useAddBlock as Y, useReplaceBlock as Z, useSelectedBlock as ee, useBlocksHtmlForAi as te, useHtmlToBlocks as re } from "@chaibuilder/sdk";
|
|
3
|
+
import { Bot as ne, Plus as oe } from "lucide-react";
|
|
4
|
+
import { lazy as _, useRef as le, useEffect as se, Suspense as T } from "react";
|
|
5
|
+
import { toast as ae } from "sonner";
|
|
6
|
+
import { a as ce } from "./prompt-helper-Csgu8Rfb.js";
|
|
7
|
+
function ie(t) {
|
|
8
|
+
if (!t) return "";
|
|
9
|
+
let e = t.trim();
|
|
10
|
+
return e = e.replace(/^```html\n?/i, ""), e = e.replace(/^```\n?/, ""), e = e.replace(/\n?```$/, ""), e = e.trim(), e;
|
|
11
|
+
}
|
|
12
|
+
function de(t) {
|
|
13
|
+
if (!t) return "";
|
|
14
|
+
const e = ie(t);
|
|
15
|
+
return e.length === 0 || !e.includes("<") || !e.includes(">") ? "" : e;
|
|
16
|
+
}
|
|
17
|
+
const ue = (t) => {
|
|
18
|
+
const e = document.getElementById("canvas-iframe");
|
|
19
|
+
if (!e) return null;
|
|
20
|
+
const s = e == null ? void 0 : e.contentDocument;
|
|
21
|
+
if (!s) return null;
|
|
22
|
+
const l = s.querySelector(`[data-block-id="${t}"]`);
|
|
23
|
+
if (!l) return null;
|
|
24
|
+
if (t === "canvas") {
|
|
25
|
+
const c = s.createElement("div");
|
|
26
|
+
return c.style.height = "100vh", l.appendChild(c), c;
|
|
27
|
+
}
|
|
28
|
+
return l;
|
|
29
|
+
}, me = _(() => import("./ai-panel-message-bubble-DPAaAMAZ.js")), fe = _(() => import("./ai-prompt-input-Ch_PLEPN.js")), ve = ({
|
|
30
|
+
t,
|
|
31
|
+
fetch: e,
|
|
32
|
+
input: s,
|
|
33
|
+
messages: l,
|
|
34
|
+
setInput: c,
|
|
35
|
+
isLoading: u,
|
|
36
|
+
setMessages: g,
|
|
37
|
+
handleReset: D,
|
|
38
|
+
handleStop: j,
|
|
39
|
+
setIsLoading: k,
|
|
40
|
+
currentBlock: M,
|
|
41
|
+
fallbackLang: V,
|
|
42
|
+
setCurrentBlock: E,
|
|
43
|
+
setAbortController: A,
|
|
44
|
+
forceNewConversation: v,
|
|
45
|
+
suggestNewConversation: z
|
|
46
|
+
}) => {
|
|
47
|
+
const N = le(null), { addPredefinedBlock: q } = Y(), U = Z(), m = ee(), W = te(), $ = re(), C = () => {
|
|
48
|
+
var o;
|
|
49
|
+
(o = N.current) == null || o.scrollIntoView({ behavior: "smooth" });
|
|
50
|
+
};
|
|
51
|
+
se(() => {
|
|
52
|
+
C();
|
|
53
|
+
}, [l, u]);
|
|
54
|
+
const K = async (o, f, B) => {
|
|
55
|
+
var F;
|
|
56
|
+
if (!o || u) return;
|
|
57
|
+
const r = m;
|
|
58
|
+
E(m);
|
|
59
|
+
const H = W();
|
|
60
|
+
if (m && !H) {
|
|
61
|
+
ae.error(t("Something went wrong. Please try again."));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const I = {
|
|
65
|
+
id: Date.now().toString(),
|
|
66
|
+
role: "user",
|
|
67
|
+
content: ce({
|
|
68
|
+
language: V,
|
|
69
|
+
userInput: f || o,
|
|
70
|
+
currentHtml: m ? H : ""
|
|
71
|
+
}),
|
|
72
|
+
userMessage: o
|
|
73
|
+
}, R = { id: Date.now().toString(), role: "assistant", content: "" };
|
|
74
|
+
g((i) => [...i, I, R]), k(!0);
|
|
75
|
+
const L = new AbortController();
|
|
76
|
+
A(L);
|
|
77
|
+
try {
|
|
78
|
+
const i = {
|
|
79
|
+
messages: [...l, I].map((x) => ({
|
|
80
|
+
role: x.role,
|
|
81
|
+
content: x.content
|
|
82
|
+
}))
|
|
83
|
+
};
|
|
84
|
+
B && (i.image = B);
|
|
85
|
+
const h = await e({ body: { action: "ASK_AI", data: i }, streamResponse: !0 });
|
|
86
|
+
if (!h.ok)
|
|
87
|
+
throw new Error(t("Failed to get AI response"));
|
|
88
|
+
const p = (F = h.body) == null ? void 0 : F.getReader(), O = new TextDecoder();
|
|
89
|
+
let b = "";
|
|
90
|
+
if (!p) throw new Error(t("Response body is not readable"));
|
|
91
|
+
const d = ue(r ? r == null ? void 0 : r._id : "canvas");
|
|
92
|
+
for (; ; ) {
|
|
93
|
+
const { done: x, value: J } = await p.read();
|
|
94
|
+
if (x) {
|
|
95
|
+
d && !r && d.remove();
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
const Q = O.decode(J, { stream: !0 });
|
|
99
|
+
if (b += Q, d) {
|
|
100
|
+
d.innerHTML = b;
|
|
101
|
+
const y = d.getBoundingClientRect(), a = document.getElementById("canvas-iframe"), P = a == null ? void 0 : a.contentWindow;
|
|
102
|
+
P && (y.top >= 0 && y.bottom <= P.innerHeight || d.scrollIntoView({ behavior: "smooth", block: "nearest" }));
|
|
103
|
+
}
|
|
104
|
+
g(
|
|
105
|
+
(y) => y.map((a) => a.id === R.id ? { ...a, content: b } : a)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
const G = de(b), S = $(G);
|
|
109
|
+
r != null && r._id ? (console.log("Editing block", r == null ? void 0 : r._id, S), U(r == null ? void 0 : r._id, S)) : q([...S], r == null ? void 0 : r._parent, -1);
|
|
110
|
+
} catch (i) {
|
|
111
|
+
if (i.name !== "AbortError") {
|
|
112
|
+
const h = {
|
|
113
|
+
id: (Date.now() + 1).toString(),
|
|
114
|
+
role: "assistant",
|
|
115
|
+
content: t("Sorry, I encountered an error. Please try again.")
|
|
116
|
+
};
|
|
117
|
+
g((p) => [...p, h]);
|
|
118
|
+
}
|
|
119
|
+
} finally {
|
|
120
|
+
c(""), k(!1), E(null), A(null);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
return /* @__PURE__ */ w(X, { children: [
|
|
124
|
+
/* @__PURE__ */ w("div", { className: "flex-1 space-y-3 overflow-y-auto py-4", children: [
|
|
125
|
+
l.length === 0 && /* @__PURE__ */ n("div", { className: "flex-1 space-y-3 overflow-y-auto py-4", children: /* @__PURE__ */ w("div", { className: "mx-auto mt-8 text-center text-gray-500", children: [
|
|
126
|
+
/* @__PURE__ */ n(ne, { size: 48, className: "mx-auto mb-4 text-gray-300" }),
|
|
127
|
+
/* @__PURE__ */ n("p", { className: "mx-auto max-w-[75%] text-sm", children: t("Start a conversation with the AI assistant to generate and update your sections") })
|
|
128
|
+
] }) }),
|
|
129
|
+
l.map(
|
|
130
|
+
(o, f) => o.role !== "system" && /* @__PURE__ */ n(T, { fallback: /* @__PURE__ */ n("div", { children: "Loading..." }), children: /* @__PURE__ */ n(
|
|
131
|
+
me,
|
|
132
|
+
{
|
|
133
|
+
message: o,
|
|
134
|
+
isUser: o.role === "user",
|
|
135
|
+
isLoading: o.role === "assistant" && u && f === l.length - 1
|
|
136
|
+
}
|
|
137
|
+
) }, f)
|
|
138
|
+
),
|
|
139
|
+
z && !u && /* @__PURE__ */ n(
|
|
140
|
+
"button",
|
|
141
|
+
{
|
|
142
|
+
onClick: D,
|
|
143
|
+
className: "flex w-full items-center justify-center gap-2 rounded-lg border border-blue-200 bg-blue-50 p-1.5 text-left transition-colors hover:bg-blue-100",
|
|
144
|
+
children: /* @__PURE__ */ n("div", { className: "flex flex-col", children: /* @__PURE__ */ w("span", { className: "flex items-center gap-1 text-xs font-medium text-blue-700", children: [
|
|
145
|
+
/* @__PURE__ */ n(oe, { className: "h-4 w-4 capitalize text-blue-600" }),
|
|
146
|
+
t(v ? "Start" : "New"),
|
|
147
|
+
" ",
|
|
148
|
+
t("Conversation"),
|
|
149
|
+
" ",
|
|
150
|
+
!v && /* @__PURE__ */ n("span", { className: "text-[10px] font-extralight text-blue-600", children: t("For best results") })
|
|
151
|
+
] }) })
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ n("div", { ref: N })
|
|
155
|
+
] }),
|
|
156
|
+
!v && /* @__PURE__ */ n("div", { className: "border-gray-200 pb-2", children: /* @__PURE__ */ n(T, { fallback: /* @__PURE__ */ n("div", { children: "Loading..." }), children: /* @__PURE__ */ n(
|
|
157
|
+
fe,
|
|
158
|
+
{
|
|
159
|
+
input: s,
|
|
160
|
+
setInput: c,
|
|
161
|
+
onSend: K,
|
|
162
|
+
onStop: j,
|
|
163
|
+
isLoading: u,
|
|
164
|
+
selectedLang: "",
|
|
165
|
+
currentBlock: m || M,
|
|
166
|
+
disabled: (s == null ? void 0 : s.length) === 0
|
|
167
|
+
}
|
|
168
|
+
) }) })
|
|
169
|
+
] });
|
|
170
|
+
};
|
|
171
|
+
export {
|
|
172
|
+
ve as default
|
|
173
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("@chaibuilder/sdk"),r=require("lucide-react"),a=({message:t})=>{var l;const{t:s}=n.useTranslation();return((l=t==null?void 0:t.content)==null?void 0:l.length)<10?e.jsx("div",{className:"relative z-50 mb-3 flex w-full flex-col gap-2 overflow-hidden",children:e.jsxs("div",{className:"flex w-max items-center justify-center gap-1 rounded-md p-1 px-2 text-xs font-medium text-blue-500",children:[e.jsx(r.Loader,{className:"h-3 w-3 animate-spin"})," ",s("Processing")]})}):e.jsx("div",{className:"relative z-50 mb-3 flex w-full flex-col gap-2 overflow-hidden",children:e.jsxs("div",{className:"flex w-max items-center justify-center gap-1 rounded-md p-1 px-2 text-xs font-medium text-blue-500",children:[e.jsx(r.Loader,{className:"h-3 w-3 animate-spin"})," ",s("Generating")]})})},d=({message:t,isUser:s,isLoading:l})=>{const{t:i}=n.useTranslation();return s?e.jsx("div",{className:"relative mb-3 flex w-full justify-end overflow-hidden",children:e.jsx("div",{className:"flex max-w-[95%] flex-row-reverse rounded-lg rounded-br-sm bg-blue-500 px-2 py-1.5 text-xs text-white",children:t.userMessage})}):l?e.jsx(a,{message:t}):e.jsx("div",{className:`relative mb-3 flex w-full overflow-hidden ${s?"justify-end":l?"max-h-48 min-h-24 justify-start":"max-h-16"}`,children:e.jsxs("div",{className:"flex w-max items-center justify-center gap-1 rounded-md p-1 px-2 text-xs font-medium text-green-500",children:[e.jsx(r.CheckCircle,{className:"h-3 w-3"})," ",i("Completed")]})})};exports.default=d;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as a } from "@chaibuilder/sdk";
|
|
3
|
+
import { CheckCircle as d, Loader as i } from "lucide-react";
|
|
4
|
+
const m = ({ message: t }) => {
|
|
5
|
+
var r;
|
|
6
|
+
const { t: l } = a();
|
|
7
|
+
return ((r = t == null ? void 0 : t.content) == null ? void 0 : r.length) < 10 ? /* @__PURE__ */ e("div", { className: "relative z-50 mb-3 flex w-full flex-col gap-2 overflow-hidden", children: /* @__PURE__ */ n("div", { className: "flex w-max items-center justify-center gap-1 rounded-md p-1 px-2 text-xs font-medium text-blue-500", children: [
|
|
8
|
+
/* @__PURE__ */ e(i, { className: "h-3 w-3 animate-spin" }),
|
|
9
|
+
" ",
|
|
10
|
+
l("Processing")
|
|
11
|
+
] }) }) : /* @__PURE__ */ e("div", { className: "relative z-50 mb-3 flex w-full flex-col gap-2 overflow-hidden", children: /* @__PURE__ */ n("div", { className: "flex w-max items-center justify-center gap-1 rounded-md p-1 px-2 text-xs font-medium text-blue-500", children: [
|
|
12
|
+
/* @__PURE__ */ e(i, { className: "h-3 w-3 animate-spin" }),
|
|
13
|
+
" ",
|
|
14
|
+
l("Generating")
|
|
15
|
+
] }) });
|
|
16
|
+
}, o = ({ message: t, isUser: l, isLoading: r }) => {
|
|
17
|
+
const { t: s } = a();
|
|
18
|
+
return l ? /* @__PURE__ */ e("div", { className: "relative mb-3 flex w-full justify-end overflow-hidden", children: /* @__PURE__ */ e(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: "flex max-w-[95%] flex-row-reverse rounded-lg rounded-br-sm bg-blue-500 px-2 py-1.5 text-xs text-white",
|
|
22
|
+
children: t.userMessage
|
|
23
|
+
}
|
|
24
|
+
) }) : r ? /* @__PURE__ */ e(m, { message: t }) : /* @__PURE__ */ e(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: `relative mb-3 flex w-full overflow-hidden ${l ? "justify-end" : r ? "max-h-48 min-h-24 justify-start" : "max-h-16"}`,
|
|
28
|
+
children: /* @__PURE__ */ n("div", { className: "flex w-max items-center justify-center gap-1 rounded-md p-1 px-2 text-xs font-medium text-green-500", children: [
|
|
29
|
+
/* @__PURE__ */ e(d, { className: "h-3 w-3" }),
|
|
30
|
+
" ",
|
|
31
|
+
s("Completed")
|
|
32
|
+
] })
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
o as default
|
|
38
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { jsxs as a, Fragment as V, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { aj as W } from "./index-yhKyIbgs.js";
|
|
3
|
+
import { useTranslation as G, useSelectedBlock as H, useI18nBlocks as L, useStreamMultipleBlocksProps as Q } from "@chaibuilder/sdk";
|
|
4
|
+
import { Bot as X, InfoIcon as Y, Plus as Z } from "lucide-react";
|
|
5
|
+
import { lazy as x, useRef as $, useEffect as ee, Suspense as f } from "react";
|
|
6
|
+
import { g as te } from "./prompt-helper-Csgu8Rfb.js";
|
|
7
|
+
const se = x(() => import("./ai-panel-message-bubble-DPAaAMAZ.js")), ae = x(() => import("./ai-translation-prompt-BiJ5B_an.js")), re = x(() => import("./ai-prompt-input-Ch_PLEPN.js")), ue = ({
|
|
8
|
+
fetch: E,
|
|
9
|
+
input: l,
|
|
10
|
+
messages: c,
|
|
11
|
+
setInput: b,
|
|
12
|
+
isLoading: r,
|
|
13
|
+
handleStop: P,
|
|
14
|
+
handleReset: j,
|
|
15
|
+
setMessages: g,
|
|
16
|
+
setIsLoading: d,
|
|
17
|
+
selectedLang: i,
|
|
18
|
+
currentBlock: I,
|
|
19
|
+
fallbackLang: O,
|
|
20
|
+
abortController: u,
|
|
21
|
+
setAbortController: R,
|
|
22
|
+
forceNewConversation: m,
|
|
23
|
+
suggestNewConversation: D
|
|
24
|
+
}) => {
|
|
25
|
+
const { t: s } = G(), p = $(null), y = H(), w = L(), F = Q(), M = () => {
|
|
26
|
+
var t;
|
|
27
|
+
(t = p.current) == null || t.scrollIntoView({ behavior: "smooth" });
|
|
28
|
+
};
|
|
29
|
+
ee(() => {
|
|
30
|
+
M();
|
|
31
|
+
}, [c, r]);
|
|
32
|
+
const N = async (t, o) => {
|
|
33
|
+
var T;
|
|
34
|
+
const v = (t == null ? void 0 : t.toLowerCase()) === "translate", k = {
|
|
35
|
+
id: Date.now().toString(),
|
|
36
|
+
role: "user",
|
|
37
|
+
content: te({
|
|
38
|
+
fallbackLang: O,
|
|
39
|
+
userInput: o || t,
|
|
40
|
+
language: i,
|
|
41
|
+
blocks: v ? w() : w(i)
|
|
42
|
+
}),
|
|
43
|
+
userMessage: o || t || s("Translate the content")
|
|
44
|
+
};
|
|
45
|
+
d(!0);
|
|
46
|
+
const z = new AbortController();
|
|
47
|
+
R(z);
|
|
48
|
+
const U = { id: Date.now().toString(), role: "assistant", content: "" };
|
|
49
|
+
g((S) => [...S, k, U]), d(!0);
|
|
50
|
+
try {
|
|
51
|
+
const B = await E({ body: { action: "ASK_AI", data: {
|
|
52
|
+
messages: [k],
|
|
53
|
+
initiator: v ? "TRANSLATE_CONTENT" : "UPDATE_CONTENT"
|
|
54
|
+
} }, streamResponse: !0 });
|
|
55
|
+
if (!B.ok)
|
|
56
|
+
throw new Error(s("Failed to get AI response"));
|
|
57
|
+
const A = (T = B.body) == null ? void 0 : T.getReader(), _ = new TextDecoder();
|
|
58
|
+
let n = "";
|
|
59
|
+
if (!A) throw new Error(s("Response body is not readable"));
|
|
60
|
+
for (; ; ) {
|
|
61
|
+
const { done: C, value: J } = await A.read();
|
|
62
|
+
if (C)
|
|
63
|
+
break;
|
|
64
|
+
const K = _.decode(J, { stream: !0 });
|
|
65
|
+
n += K, g((h) => (h[h.length - 1].content = n, [...h]));
|
|
66
|
+
}
|
|
67
|
+
const q = JSON.parse(n == null ? void 0 : n.replace("```json", "").replace("```", ""));
|
|
68
|
+
F(q);
|
|
69
|
+
} catch {
|
|
70
|
+
u == null || u.abort();
|
|
71
|
+
} finally {
|
|
72
|
+
d(!1), b("");
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return /* @__PURE__ */ a(V, { children: [
|
|
76
|
+
/* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e(f, { fallback: /* @__PURE__ */ e("div", { children: s("Loading...") }), children: /* @__PURE__ */ e(
|
|
77
|
+
ae,
|
|
78
|
+
{
|
|
79
|
+
isLoading: r,
|
|
80
|
+
selectedBlock: y,
|
|
81
|
+
selectedLang: i,
|
|
82
|
+
onClick: N
|
|
83
|
+
}
|
|
84
|
+
) }) }),
|
|
85
|
+
/* @__PURE__ */ a("div", { className: "flex-1 space-y-3 overflow-y-auto py-4", children: [
|
|
86
|
+
c.length === 0 && /* @__PURE__ */ a("div", { className: "flex-1 space-y-3 overflow-y-auto py-4", children: [
|
|
87
|
+
/* @__PURE__ */ a("div", { className: "mx-auto mt-8 text-center text-gray-500", children: [
|
|
88
|
+
/* @__PURE__ */ e(X, { size: 48, className: "mx-auto mb-4 text-gray-300" }),
|
|
89
|
+
/* @__PURE__ */ e("p", { className: "mx-auto max-w-[75%] text-sm", children: s("Start a conversation with the AI assistant to translate/edit your content") })
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ a("div", { className: "relative rounded-lg border px-3 py-2 text-sm text-muted-foreground", children: [
|
|
92
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
93
|
+
/* @__PURE__ */ e(Y, { className: "h-3 w-3" }),
|
|
94
|
+
/* @__PURE__ */ e("span", { className: "text-xs", children: s(
|
|
95
|
+
"Only content can be edited in secondary languages. To edit layout, styles and more, switch to the default language."
|
|
96
|
+
) })
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ e("div", { className: "mt-1", children: /* @__PURE__ */ e(W, { showAdd: !1, variant: "outline", goToDefaultLang: !0 }) })
|
|
99
|
+
] })
|
|
100
|
+
] }),
|
|
101
|
+
c.map(
|
|
102
|
+
(t, o) => t.role !== "system" && /* @__PURE__ */ e(f, { fallback: /* @__PURE__ */ e("div", { children: s("Loading...") }), children: /* @__PURE__ */ e(
|
|
103
|
+
se,
|
|
104
|
+
{
|
|
105
|
+
message: t,
|
|
106
|
+
isUser: t.role === "user",
|
|
107
|
+
isLoading: t.role === "assistant" && r && o === c.length - 1
|
|
108
|
+
}
|
|
109
|
+
) }, o)
|
|
110
|
+
),
|
|
111
|
+
D && !r && /* @__PURE__ */ e(
|
|
112
|
+
"button",
|
|
113
|
+
{
|
|
114
|
+
onClick: j,
|
|
115
|
+
className: "flex w-full items-center justify-center gap-2 rounded-lg border border-blue-200 bg-blue-50 p-1.5 text-left transition-colors hover:bg-blue-100",
|
|
116
|
+
children: /* @__PURE__ */ e("div", { className: "flex flex-col", children: /* @__PURE__ */ a("span", { className: "flex items-center gap-1 text-xs font-medium text-blue-700", children: [
|
|
117
|
+
/* @__PURE__ */ e(Z, { className: "h-4 w-4 capitalize text-blue-600" }),
|
|
118
|
+
m ? s("Start ") : "",
|
|
119
|
+
" ",
|
|
120
|
+
s("New Conversation"),
|
|
121
|
+
" ",
|
|
122
|
+
!m && /* @__PURE__ */ e("span", { className: "text-[10px] font-extralight text-blue-600", children: s("For best results") })
|
|
123
|
+
] }) })
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ e("div", { ref: p })
|
|
127
|
+
] }),
|
|
128
|
+
!m && /* @__PURE__ */ e("div", { className: "border-gray-200 pb-2", children: /* @__PURE__ */ e(f, { fallback: /* @__PURE__ */ e("div", { children: s("Loading...") }), children: /* @__PURE__ */ e(
|
|
129
|
+
re,
|
|
130
|
+
{
|
|
131
|
+
input: l,
|
|
132
|
+
setInput: b,
|
|
133
|
+
onSend: N,
|
|
134
|
+
onStop: P,
|
|
135
|
+
isLoading: r,
|
|
136
|
+
selectedLang: i,
|
|
137
|
+
currentBlock: y || I,
|
|
138
|
+
disabled: (l == null ? void 0 : l.length) === 0
|
|
139
|
+
}
|
|
140
|
+
) }) })
|
|
141
|
+
] });
|
|
142
|
+
};
|
|
143
|
+
export {
|
|
144
|
+
ue as default
|
|
145
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),K=require("./index-W0r4o5Ro.cjs"),d=require("@chaibuilder/sdk"),j=require("lucide-react"),r=require("react"),V=require("./prompt-helper-DgI1lgGV.cjs"),W=r.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-message-bubble-Bl-aUeU4.cjs"))),G=r.lazy(()=>Promise.resolve().then(()=>require("./ai-translation-prompt-BUFjo_om.cjs"))),L=r.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-Zg6lN1Lo.cjs"))),Q=({fetch:P,input:o,messages:c,setInput:b,isLoading:n,handleStop:q,handleReset:A,setMessages:f,setIsLoading:u,selectedLang:i,currentBlock:R,fallbackLang:E,abortController:x,setAbortController:O,forceNewConversation:h,suggestNewConversation:I})=>{const{t}=d.useTranslation(),y=r.useRef(null),g=d.useSelectedBlock(),p=d.useI18nBlocks(),z=d.useStreamMultipleBlocksProps(),D=()=>{var s;(s=y.current)==null||s.scrollIntoView({behavior:"smooth"})};r.useEffect(()=>{D()},[c,n]);const v=async(s,a)=>{var k;const w=(s==null?void 0:s.toLowerCase())==="translate",N={id:Date.now().toString(),role:"user",content:V.getTranslationUserPrompt({fallbackLang:E,userInput:a||s,language:i,blocks:w?p():p(i)}),userMessage:a||s||t("Translate the content")};u(!0);const M=new AbortController;O(M);const F={id:Date.now().toString(),role:"assistant",content:""};f(S=>[...S,N,F]),u(!0);try{const T=await P({body:{action:"ASK_AI",data:{messages:[N],initiator:w?"TRANSLATE_CONTENT":"UPDATE_CONTENT"}},streamResponse:!0});if(!T.ok)throw new Error(t("Failed to get AI response"));const B=(k=T.body)==null?void 0:k.getReader(),U=new TextDecoder;let l="";if(!B)throw new Error(t("Response body is not readable"));for(;;){const{done:C,value:H}=await B.read();if(C)break;const J=U.decode(H,{stream:!0});l+=J,f(m=>(m[m.length-1].content=l,[...m]))}const _=JSON.parse(l==null?void 0:l.replace("```json","").replace("```",""));z(_)}catch{x==null||x.abort()}finally{u(!1),b("")}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(r.Suspense,{fallback:e.jsx("div",{children:t("Loading...")}),children:e.jsx(G,{isLoading:n,selectedBlock:g,selectedLang:i,onClick:v})})}),e.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto py-4",children:[c.length===0&&e.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto py-4",children:[e.jsxs("div",{className:"mx-auto mt-8 text-center text-gray-500",children:[e.jsx(j.Bot,{size:48,className:"mx-auto mb-4 text-gray-300"}),e.jsx("p",{className:"mx-auto max-w-[75%] text-sm",children:t("Start a conversation with the AI assistant to translate/edit your content")})]}),e.jsxs("div",{className:"relative rounded-lg border px-3 py-2 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j.InfoIcon,{className:"h-3 w-3"}),e.jsx("span",{className:"text-xs",children:t("Only content can be edited in secondary languages. To edit layout, styles and more, switch to the default language.")})]}),e.jsx("div",{className:"mt-1",children:e.jsx(K.LanguageSwitcher,{showAdd:!1,variant:"outline",goToDefaultLang:!0})})]})]}),c.map((s,a)=>s.role!=="system"&&e.jsx(r.Suspense,{fallback:e.jsx("div",{children:t("Loading...")}),children:e.jsx(W,{message:s,isUser:s.role==="user",isLoading:s.role==="assistant"&&n&&a===c.length-1})},a)),I&&!n&&e.jsx("button",{onClick:A,className:"flex w-full items-center justify-center gap-2 rounded-lg border border-blue-200 bg-blue-50 p-1.5 text-left transition-colors hover:bg-blue-100",children:e.jsx("div",{className:"flex flex-col",children:e.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-blue-700",children:[e.jsx(j.Plus,{className:"h-4 w-4 capitalize text-blue-600"}),h?t("Start "):""," ",t("New Conversation")," ",!h&&e.jsx("span",{className:"text-[10px] font-extralight text-blue-600",children:t("For best results")})]})})}),e.jsx("div",{ref:y})]}),!h&&e.jsx("div",{className:"border-gray-200 pb-2",children:e.jsx(r.Suspense,{fallback:e.jsx("div",{children:t("Loading...")}),children:e.jsx(L,{input:o,setInput:b,onSend:v,onStop:q,isLoading:n,selectedLang:i,currentBlock:g||R,disabled:(o==null?void 0:o.length)===0})})})]})};exports.default=Q;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("@chaibuilder/sdk"),m=require("lucide-react"),x=require("react"),r=require("./prompt-helper-DgI1lgGV.cjs"),u=({onSelect:p,currentBlock:s,selectedLang:a})=>{const{t}=l.useTranslation(),[i,o]=x.useState(!1),c=a?r.LANGUAGE_CONTENT_ACTIONS:s?r.UPDATE_ACTIONS:r.ADD_NEW_SECTIONS;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{onClick:()=>o(!i),className:l.mergeClasses("flex h-6 w-full cursor-pointer items-center justify-between gap-2 px-2",s?"bg-green-50/80 text-green-500 hover:bg-green-50":"bg-primary/5 text-primary hover:bg-primary/10"),children:[e.jsx("span",{className:"truncate whitespace-nowrap text-xs font-medium leading-none",children:s?e.jsxs("span",{children:[e.jsx("span",{className:"font-extralight",children:t(a?"Edit Content:":"Edit:")})," ",s._name||s._type]}):t("Quick Prompts")}),e.jsx(m.ChevronsUpDown,{className:"h-3 w-3"})]}),i&&e.jsx("div",{className:"max-h-60 w-full overflow-y-auto bg-white px-1 pb-1",children:c.map((n,d)=>e.jsx("div",{className:"flex cursor-pointer items-center gap-x-1 p-1 text-xs leading-none hover:text-blue-700",onClick:()=>{p(`${t(a||s?"Update":"Add New")} ${n.label}`,n.prompt),o(!1)},children:e.jsxs("span",{className:"truncate whitespace-nowrap",children:[s?null:e.jsx("span",{className:"font-thin text-muted-foreground",children:t("Add New")})," ",n.label]})},d))})]})};exports.default=u;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs as s, Fragment as d, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as h, mergeClasses as c } from "@chaibuilder/sdk";
|
|
3
|
+
import { ChevronsUpDown as f } from "lucide-react";
|
|
4
|
+
import { useState as x } from "react";
|
|
5
|
+
import { L as N, U as w, A as g } from "./prompt-helper-Csgu8Rfb.js";
|
|
6
|
+
const E = ({ onSelect: p, currentBlock: e, selectedLang: r }) => {
|
|
7
|
+
const { t } = h(), [o, i] = x(!1), l = r ? N : e ? w : g;
|
|
8
|
+
return /* @__PURE__ */ s(d, { children: [
|
|
9
|
+
/* @__PURE__ */ s(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
onClick: () => i(!o),
|
|
13
|
+
className: c(
|
|
14
|
+
"flex h-6 w-full cursor-pointer items-center justify-between gap-2 px-2",
|
|
15
|
+
e ? "bg-green-50/80 text-green-500 hover:bg-green-50" : "bg-primary/5 text-primary hover:bg-primary/10"
|
|
16
|
+
),
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ a("span", { className: "truncate whitespace-nowrap text-xs font-medium leading-none", children: e ? /* @__PURE__ */ s("span", { children: [
|
|
19
|
+
/* @__PURE__ */ a("span", { className: "font-extralight", children: t(r ? "Edit Content:" : "Edit:") }),
|
|
20
|
+
" ",
|
|
21
|
+
e._name || e._type
|
|
22
|
+
] }) : t("Quick Prompts") }),
|
|
23
|
+
/* @__PURE__ */ a(f, { className: "h-3 w-3" })
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
o && /* @__PURE__ */ a("div", { className: "max-h-60 w-full overflow-y-auto bg-white px-1 pb-1", children: l.map((n, m) => /* @__PURE__ */ a(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: "flex cursor-pointer items-center gap-x-1 p-1 text-xs leading-none hover:text-blue-700",
|
|
31
|
+
onClick: () => {
|
|
32
|
+
p(`${t(r || e ? "Update" : "Add New")} ${n.label}`, n.prompt), i(!1);
|
|
33
|
+
},
|
|
34
|
+
children: /* @__PURE__ */ s("span", { className: "truncate whitespace-nowrap", children: [
|
|
35
|
+
e ? null : /* @__PURE__ */ a("span", { className: "font-thin text-muted-foreground", children: t("Add New") }),
|
|
36
|
+
" ",
|
|
37
|
+
n.label
|
|
38
|
+
] })
|
|
39
|
+
},
|
|
40
|
+
m
|
|
41
|
+
)) })
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
E as default
|
|
46
|
+
};
|