1import{j as t}from"./vendor-motion-Bc9XJ73_.js";import{r as h}from"./vendor-react-CWSmzibK.js";import{u as m}from"./index-Bj8jHkTW.js";import{a as F,b as P,c as _,d as O}from"./usePages-C-lz3J32.js";import{f as x}from"./fundraising-D0bxd-iv.js";import{m as C}from"./cms-nWH0DeDL.js";import{P as k,M as H,C as L}from"./MetaEditor-B6VANlqm.js";import{H as B}from"./HeroEditor-syj27n1d.js";import{T as J}from"./TextBlockEditor-dObG_Fll.js";import{S as g,F as l}from"./Field-DfpRZeUm.js";import{A as j}from"./ArrayField-BST3O6j-.js";import{F as M}from"./FAQEditor-evcg_PyF.js";import{S as W,a as q,b as $,c as Q,d as w}from"./select-Cp9MEKJS.js";import"./vendor-query-Ca3ifJmV.js";import"./vendor-radix-D0pYc2g7.js";import"./pages-BidEXGIf.js";import"./client-BvGHaZM9.js";import"./site-D8pwctGf.js";import"./alert-dialog-pE3inVZX.js";import"./arrow-left-CwHGSxqE.js";import"./plus-B_ZkHkH3.js";import"./trash-2-BNNPQ7y5.js";import"./index-Bk4aS46l.js";import"./chevron-down-Dvj6Ob8z.js";function U({value:e,onChange:o,sectionTitle:d,hint:n}){return t.jsxs(g,{title:d,children:[t.jsx(l,{label:"Section title",children:t.jsx("input",{type:"text",value:e.title,onChange:r=>o({...e,title:r.target.value}),className:"form-input w-full"})}),t.jsx(j,{label:"Items",hint:n,value:e.bullets,onChange:r=>o({...e,bullets:r}),newItem:()=>({title:"",description:""}),itemLabel:r=>`Item ${r+1}`,renderItem:(r,a,s)=>t.jsxs("div",{className:"space-y-3",children:[t.jsx(l,{label:"Title",children:t.jsx("input",{type:"text",value:r.title,onChange:c=>s({...r,title:c.target.value}),className:"form-input w-full"})}),t.jsx(l,{label:"Description",children:t.jsx("textarea",{value:r.description,onChange:c=>s({...r,description:c.target.value}),className:"form-input w-full",rows:2})})]})})]})}function V({value:e,onChange:o,sectionTitle:d}){return t.jsxs(g,{title:d,children:[t.jsx(l,{label:"Section title",children:t.jsx("input",{type:"text",value:e.title,onChange:n=>o({...e,title:n.target.value}),className:"form-input w-full"})}),t.jsx(j,{label:"Steps",hint:"Steps are auto-numbered (1, 2, 3â¦) on the page.",value:e.steps,onChange:n=>o({...e,steps:n}),newItem:()=>({title:"",description:""}),itemLabel:n=>`Step ${n+1}`,renderItem:(n,r,a)=>t.jsxs("div",{className:"space-y-3",children:[t.jsx(l,{label:"Title",children:t.jsx("input",{type:"text",value:n.title,onChange:s=>a({...n,title:s.target.value}),className:"form-input w-full"})}),t.jsx(l,{label:"Description",children:t.jsx("textarea",{value:n.description,onChange:s=>a({...n,description:s.target.value}),className:"form-input w-full",rows:2})})]})})]})}const p="fundraising";function b(e,o){return e&&Object.keys(e).length>0?C(x,e):o&&Object.keys(o).length>0?C(x,o):x}function bt(){const{data:e,isLoading:o}=F(p),d=P(),n=_(),r=O(),[a,s]=h.useState(x),[c,y]=h.useState(!1),[S,v]=h.useState(!1);h.useEffect(()=>{!e||c||(s(b(e.draft_content,e.published_content)),y(!0))},[e,c]);const T=h.useMemo(()=>JSON.stringify(b(e==null?void 0:e.draft_content,e==null?void 0:e.published_content)),[e==null?void 0:e.draft_content,e==null?void 0:e.published_content]),D=h.useMemo(()=>JSON.stringify(a),[a]),N=c&&D!==T;if(o||!c)return t.jsx("div",{className:"text-foreground/60",children:"Loading..."});const A=async()=>{try{await d.mutateAsync({slug:p,draft:a}),m.success("Draft saved.")}catch{m.error("Failed to save draft.")}},E=async()=>{try{await n.mutateAsync({slug:p,draft:a}),m.success("Published.")}catch{m.error("Failed to publish.")}},I=async()=>{try{await r.mutateAsync(p),s(b(null,e==null?void 0:e.published_content)),m.success("Draft discarded.")}catch{m.error("Failed to discard draft.")}finally{v(!1)}};return t.jsxs(k,{title:"Edit: Fundraising",publicHref:"/fundraising",hasUnsavedChanges:N,hasDraft:!!(e!=null&&e.draft_content),isSaving:d.isPending,isPublishing:n.isPending,isDiscarding:r.isPending,confirmDiscardOpen:S,onSetConfirmDiscardOpen:v,onSaveDraft:A,onPublish:E,onDiscardDraft:I,children:[t.jsx(H,{value:a.meta,onChange:i=>s({...a,meta:i})}),t.jsx(B,{title:"Hero",showCTAs:!0,value:a.hero,onChange:i=>s({...a,hero:{...a.hero,...i}})}),t.jsx(J,{sectionTitle:"Why submit",value:a.whySubmit,onChange:i=>s({...a,whySubmit:i})}),t.jsx(U,{sectionTitle:"Who this is for",hint:"Each card shows a title + short description, with a fixed icon per position.",value:a.whoThisIsFor,onChange:i=>s({...a,whoThisIsFor:i})}
1),t.jsx(V,{sectionTitle:"How it works",value:a.howItWorks,onChange:i=>s({...a,howItWorks:i})}),t.jsxs(g,{title:"What to submit",children:[t.jsx(l,{label:"Heading",children:t.jsx("input",{type:"text",value:a.whatToSubmit.title,onChange:i=>s({...a,whatToSubmit:{...a.whatToSubmit,title:i.target.value}}),className:"form-input w-full"})}),t.jsx(l,{label:"Subtitle / body",children:t.jsx("textarea",{value:a.whatToSubmit.body,onChange:i=>s({...a,whatToSubmit:{...a.whatToSubmit,body:i.target.value}}),className:"form-input w-full",rows:2})}),t.jsx(j,{label:"Cards",hint:"Designed for 4 cards in a left-to-right staircase. Icons stay locked to position.",value:a.whatToSubmit.cards,onChange:i=>s({...a,whatToSubmit:{...a.whatToSubmit,cards:i}}),newItem:()=>({badge:"Optional",badgeType:"optional",title:"",description:""}),itemLabel:i=>`Card ${i+1}`,renderItem:(i,G,f)=>t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[t.jsx(l,{label:"Badge text",children:t.jsx("input",{type:"text",value:i.badge,onChange:u=>f({...i,badge:u.target.value}),className:"form-input w-full",placeholder:"Optional"})}),t.jsx(l,{label:"Badge style",children:t.jsxs(W,{value:i.badgeType,onValueChange:u=>f({...i,badgeType:u}),children:[t.jsx(q,{className:"form-input",children:t.jsx($,{})}),t.jsxs(Q,{children:[t.jsx(w,{value:"optional",children:"Optional (blue)"}),t.jsx(w,{value:"important",children:"Important (pink)"})]})]})})]}),t.jsx(l,{label:"Title",children:t.jsx("input",{type:"text",value:i.title,onChange:u=>f({...i,title:u.target.value}),className:"form-input w-full"})}),t.jsx(l,{label:"Description",children:t.jsx("textarea",{value:i.description,onChange:u=>f({...i,description:u.target.value}),className:"form-input w-full",rows:2})})]})})]}),t.jsx(M,{sectionTitle:"FAQ",items:a.faq.items,onChange:i=>s({...a,faq:{items:i}}),shape:"qa"}),t.jsxs(g,{title:"Final CTA",children:[t.jsx(l,{label:"Section title",children:t.jsx("input",{type:"text",value:a.finalCTA.title,onChange:i=>s({...a,finalCTA:{...a.finalCTA,title:i.target.value}}),className:"form-input w-full"})}),t.jsx(L,{value:a.finalCTA.cta,onChange:i=>s({...a,finalCTA:{...a.finalCTA,cta:i}}),labelHeading:"Button"})]})]})}export{bt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.