function s(){const{data:s=[],isLoading:y}=h(),[A,k]=e.useState(null),I=t(),{data:N,isLoading:C}=i({queryKey:["fleekdash_ai_uninstall_setting"],queryFn:async()=>{const s=await r.get("/wp-json/fleekdash/v1/ai/uninstall-setting");return!!s.success&&s.value}}),{mutate:S,isPending:_}=l({mutationFn:async s=>{const e=await r.post("/wp-json/fleekdash/v1/ai/uninstall-setting",{value:s});if(!e.success)throw new Error(e.message||o("Failed to save setting"));return e},onSuccess:()=>{I.invalidateQueries({queryKey:["fleekdash_ai_uninstall_setting"]}),c(o("Setting saved successfully"),{id:"ai-settings-uninstall-flag-saved"})},onError:s=>{d(s.message||o("Failed to save setting"),{id:"ai-settings-uninstall-flag-error",translate:!1})}});if(y)return a.jsx(n,{cardCount:2,title:o("AI Assistant"),fieldRows:4});const P=s.find(s=>s.id===A);return a.jsx(x,{featureKey:"ai_assistant",skeleton:a.jsx(n,{cardCount:2,title:o("AI Assistant"),fieldRows:4}),fallback:a.jsx("div",{className:"flex flex-col gap-6",children:a.jsxs(m,{children:[a.jsxs(j,{children:[a.jsx(g,{children:o("AI Assistant")}),a.jsx(p,{children:o("AI Assistant is an experimental feature available in Pro Business plan and higher. Enable it in Labs to get early access.")})]}),a.jsx(v,{className:"flex flex-col gap-4",children:a.jsx(w,{variant:"default",onClick:()=>{globalThis.location.hash="#/settings/labs"},children:o("Go to Labs Settings")})})]})}),children:a.jsxs("div",{className:"flex flex-col gap-6",children:[a.jsxs(m,{children:[a.jsxs(j,{children:[a.jsx(g,{children:o("AI Assistant")}),a.jsx(p,{children:o("Configure and manage your AI providers. Use the switch to activate a provider, then click Settings to configure its credentials.")})]}),a.jsx(v,{className:"flex flex-col gap-6",children:a.jsxs("div",{children:[a.jsx("h4",{className:"mb-3 text-sm font-medium",children:o("Available Providers")}),a.jsx(u,{onProviderSelect:s=>{k(s)}})]})})]}),A&&P&&a.jsxs(m,{children:[a.jsxs(j,{children:[a.jsx(g,{children:o("%s Settings",P.name)}),a.jsx(p,{children:o("Configure API credentials and settings for %s.",P.name)})]}),a.jsx(v,{children:a.jsx(f,{providerId:A,onSave:()=>{k(null)}})})]}),a.jsxs(m,{children:[a.jsxs(j,{children:[a.jsx(g,{children:o("Uninstall Settings")}),a.jsx(p,{children:o("Configure what happens to AI-generated posts when the plugin is uninstalled.")})]}),a.jsx(v,{className:"flex flex-col gap-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("label",{htmlFor:"delete-drafts-on-uninstall",className:"text-card-foreground text-sm font-medium",children:o("Delete pending and drafts AI posts on uninstall")}),a.jsx("p",{className:"text-muted-foreground text-sm",children:o("Published posts and other statuses will be preserved.")})]}),C?a.jsx("div",{className:"skeleton-bg h-6 w-11 shrink-0 rounded-full"}):a.jsx(b,{id:"delete-drafts-on-uninstall",checked:N??!1,onCheckedChange:s=>{S(s)},disabled:_})]})})]})]})})}import{r as e,j as a}from"./vendor-react.DHNfi5sm.js";import{a as n}from"./index.BOeCgwIT.js";import{c as t,a as i,d as l}from"./vendor-tanstack.B8CEPVlN.js";import{f as r,c as d,i as o,e as c,R as x}from"./platform-core.tlhrBXt0.js";import{I as h,P as u,J as f}from"./domain-comments.oqQR67kI.js";import{y as m,z as j,E as g,F as p,G as v,q as b,B as w}from"./vendor-design-system.Cz5A3ECO.js";export{s as AISettings};
//# sourceMappingURL=ai-settings.BkI7ypJB.js.map
