1import{j as e,L as w,r as o,q as A,B as u}from"./index-uPuoBMhx.js";import{u as F}from"./useQuery-BHFaz3Mh.js";import{f as G,a as L}from"./formatCertificationDate-A7MSDWcZ.js";import{e as P}from"./eventFields-BEdP0ONN.js";import{C as R}from"./CertificationRichText-D70UwurC.js";import{I as D}from"./input-BmSpt0Eh.js";import{g as I,d as B,q as H,i as M,s as v,e as y}from"./applicationFields-Cj3Itfxl.js";import{T as O}from"./textarea-lM6uA-MR.js";import{a as _}from"./certificationApi-DhrpMZNx.js";import{S as U}from"./shield-check-Ds0sNnHc.js";import{C as Y}from"./circle-check-BO0sHK-q.js";function S({event:s,message:a}){return e.jsx("section",{className:"mb-6 space-y-2 rounded-xl border bg-card p-5","aria-label":"Registration event",children:a?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Event registration is unavailable"}),e.jsx("p",{className:"text-sm leading-relaxed",children:a}),e.jsx(w,{to:"/GuideApplication",className:"inline-block text-sm font-medium text-primary underline",children:"Go to the general application"})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-xl font-semibold",children:P(s.name)}),e.jsxs("p",{className:"text-sm",children:["Strategic Envisioning: ",G(s.se_start_date,s.se_end_date)]}),s.lp_date&&e.jsxs("p",{className:"text-sm",children:["Leadership Pipeline: ",L(s.lp_date)]})]})})}function K({data:s,onChange:a}){return e.jsx("div",{className:"grid gap-5 sm:grid-cols-2",children:I.map(([t,r,i])=>e.jsxs("label",{htmlFor:t,className:"grid gap-2 text-sm font-medium",children:[r,e.jsx(D,{id:t,name:t,type:i||"text",value:s[t]||"",onChange:d=>a(t,d.target.value),required:!["address_line2","website_url"].includes(t),maxLength:t==="website_url"?2048:254,placeholder:i==="url"?"https://":void 0})]},t))})}function Q({data:s,onChange:a}){return e.jsx("div",{className:"space-y-7",children:B.map(t=>e.jsxs("fieldset",{className:"space-y-3",children:[e.jsx("legend",{className:"mb-3 font-semibold",children:t.label}),t.options.map(([r,i])=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-lg border p-3 text-sm leading-relaxed has-[:checked]:border-primary has-[:checked]:bg-accent",children:[e.jsx("input",{type:"radio",name:t.key,value:r,checked:s[t.key]===r,onChange:()=>a(t.key,r),required:!0,className:"mt-1 shrink-0 accent-primary"}),i]},r))]},t.key))})}function V({data:s,onChange:a}){return e.jsx("div",{className:"space-y-6",children:H.map(([t,r])=>e.jsxs("label",{htmlFor:t,className:"grid gap-3 text-sm font-medium leading-relaxed",children:[r,e.jsx(O,{id:t,name:t,rows:6,required:!0,maxLength:1e4,value:s[t]||"",onChange:i=>a(t,i.target.value)})]},t))})}function W({step:s,data:a,onChange:t,content:r}){return s===1?e.jsx(K,{data:a,onChange:t}):s===2?e.jsx(Q,{data:a,onChange:t}):s===3?e.jsx(V,{data:a,onChange:t}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-xl border bg-muted/30 p-4 sm:p-6",children:[e.jsx("h3",{className:"text-xl font-semibold",children:r.title}),e.jsxs("p",{className:"mb-4 text-xs text-muted-foreground",children:["Version ",r.version]}),e.jsx(R,{html:r.body_html})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-lg border p-4 text-sm font-medium leading-relaxed",children:[e.jsx("input",{id:"statement_of_faith_affirmed",type:"checkbox",required:!0,checked:a.statement_of_faith_affirmed||!1,onChange:i=>t("statement_of_faith_affirmed",i.target.checked),className:"mt-1 accent-primary"}),"I affirm The Malphurs Group Statement of Faith"]})]})}function ne(){var j,N;const[s,a]=o.useState(0),[t,r]=o.useState({}),[i,d]=o.useState(!1),[h,m]=o.useState(""),[f,g]=o.useState(null),[C]=A(),x=C.get("event"),[q,b]=o.useState(""),l=F({queryKey:["certification-public-faith",x],queryFn:()=>_("public_content",{registration_slug:x}),retry:!1,refetchOnWindowFocus:!1}),p=q||((j=l.data)==null?void 0:j.event_unavailable);o.useEffect(()=>{a(0),r({}),g(null),m(""),b("")},[x]);const E=(c,n)=>r(k=>({...k,[c]:n})),T=async c=>{if(c.preventDefault(),m(""),s<3){a(s+1),window.scrollTo({top:0});return}d(!0);try{const n=await _("submit",{...t,registration_slug:x,statement_of_faith_version:l.data.content.version});n.event_unavailable?b(n.event_unavailable):g(n),window.scrollTo({top:0})}catch(n){m(y(n))}finally{d(!1)}};return e.jsx("main",{className:"min-h-screen bg-background px-4 py-8 text-foreground sm:py-12",children:e.jsxs("div",{className:"mx-auto max-w-3xl",children:[e.jsxs("header",{className:"mb-8 border-b-4 border-primary pb-6",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-2 text-sm font-semibold text-primary",children:[e.jsx(U,{className:"h-6 w-6"}),"THE MALPHURS GROUP"]}),e.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Healthy Churches Global"}),e.jsx("h1",{className:"mt-3 text-3xl font-bold sm:text-4xl",children:"Guide Certification Application"}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Phase 1: Share your calling, experience, and vision for serving churches."})]}),!p&&((N=l.data)==null?void 0:N.event)&&e.jsx(S,{event:l.data.event}),p?e.jsx(S,{message:p}):f?e.jsxs("section",{className:"rounded-2xl border bg-card p-6 sm:p-8",children:[e.jsx(Y,{className:"mb-4 h-10 w-10 text-primary"}),e.jsx("h2",{className:"text-2xl font-bold",children:"Application received"}),e.jsxs("p",{className:"mt-4 leading-relaxed",children:["Thank you for applying, ",t.first_name,". Our team will review your Phase 1 application and contact you at ",t.email," with the next steps."]}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:f.confirmation_sent?"A confirmation email has been requested. Please check your inbox and spam folder.":"Your application is saved. The confirmation email could not be completed, but our team can still review your application."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mb-4 text-sm",children:["Already Strategic Envisioning certified? ",e.jsx(w,{to:"/GuideHubDashboard",className:"font-medium text-primary underline",children:"Sign in to add Leadership Pipeline certification."})]}),e.jsx("p",{className:"mb-8 text-sm leading-7 text-muted-foreground",children:M}),e.jsx("ol",{"aria-label":"Application steps",className:"mb-6 grid grid-cols-2 gap-3 sm:grid-cols-4",children:v.map((c,n)=>e.jsxs("li",{"aria-current":n===s?"step":void 0,className:n===s?"rounded-xl bg-primary p-3 text-primary-foreground":"rounded-xl bg-muted p-3 text-muted-foreground",children:[e.jsxs("span",{className:"mb-1 block text-xs font-bold",children:["STEP ",n+1]}),e.jsx("span",{className:"text-xs font-medium",children:c})]},c))}),l.isLoading?e.jsx("p",{role:"status",className:"p-6",children:"Loading application..."}):l.error?e.jsxs("div",{role:"alert",className:"space-y-4 rounded-xl border p-6",children:[e.jsx("p",{children:y(l.error)}),e.jsx(u,{onClick:()=>l.refetch(),children:"Try again"})]}):e.jsxs("form",{onSubmit:T,className:"rounded-2xl border bg-card p-5 shadow-sm sm:p-8",children:[e.jsx("h2",{className:"mb-2 text-xl font-bold",children:v[s]}),e.jsx("p",{className:"mb-6 text-xs text-muted-foreground",children:"All fields are required unless marked optional."}),e.jsx("fieldset",{disabled:i,children:e.jsx(W,{step:s,data:t,onChange:E,content:l.data.content})}),h&&e.jsx("p",{role:"alert",className:"mt-5 text-sm text-destructive",children:h}),e.jsxs("div",{className:"mt-8 flex items-center justify-between gap-3 border-t pt-5",children:[e.jsx(u,{type:"button",variant:"outline",disabled:s===0||i,onClick:()=>{a(s-1),m("")},children:"Back"}),e.jsx(u,{type:"submit",disabled:i,children:i?"Submitting...":s===3?"Submit application":"Continue"})]})]})]}),e.jsxs("footer",{className:"mt-8 text-center text-xs text-muted-foreground",children:["© ",new Date().getFullYear()," The Malphurs Group, Inc."]})]})})}export{ne 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.