1import{e as Ge}from"/chunks/chunk-VVJW6CFG.js";import{a as te,b as V}from"/chunks/chunk-JVTGIE5R.js";import{b as c}from"/chunks/chunk-EMYZJ3CO.js";import{$c as $e,Aa as Ue,C as he,Cc as We,Db as ne,F as Le,Fa as qe,Kb as le,Ld as ae,T as Ae,Tb as _e,U as pe,V as Re,W as Te,Z as ue,Za as re,a as ce,ba as ye,bb as we,db as ze,eb as Ne,fa as ve,fc as je,hc as de,j as xe,kb as Be,kd as Ye,la as Me,pa as Oe,sb as He,ud as Se}from"/chunks/chunk-7D6JWMYP.js";import{a as fe}from"/chunks/chunk-KSHSDDWD.js";import{a as ge}from"/chunks/chunk-OZVZR6NZ.js";import{a as be}from"/chunks/chunk-JPS2GHJJ.js";import{a as at}from"/chunks/chunk-KKLKKPCO.js";import{a as Fe}from"/chunks/chunk-YBGV3UF5.js";import{d as Q}from"/chunks/chunk-WUWNOZPZ.js";var Je=[{id:"pmu-full-name",label:"Full Name",type:"text",enabled:!0,required:!0,colSpan:2},{id:"pmu-email",label:"Email Address",type:"email",enabled:!0,required:!0,colSpan:2},{id:"pmu-phone",label:"Phone Number",type:"tel",enabled:!0,required:!1,colSpan:2},{id:"pmu-dob",label:"Date of Birth",type:"date",enabled:!0,required:!1,colSpan:1}],ot=[{id:"pmu-address",label:"Home Address",type:"address",enabled:!0,required:!1,colSpan:3},{id:"pmu-state",label:"State",type:"text",enabled:!0,required:!1,colSpan:1},{id:"pmu-zip",label:"ZIP Code",type:"text",enabled:!0,required:!1,colSpan:1}],ke={id:"pmu-contact-pref",label:"Preferred Contact Method",type:"radio",options:["Email","Phone Call","Text Message","WhatsApp"],enabled:!0,required:!1,colSpan:3},Ce={id:"pmu-notes",label:"Additional Notes or Questions",type:"textarea",placeholder:"Anything else we should know before your appointment\u2026",enabled:!0,required:!1,colSpan:3},Pe={id:"pmu-referral-source",label:"Referral Code (if any)",type:"text",placeholder:"Enter your referral code",enabled:!0,required:!1,colSpan:1},Ie={id:"pmu-consent",label:"Data Consent",type:"consent",placeholder:"I consent to PlusMORE collecting and securely storing the information provided in this intake form for the purpose of delivering the requested service.",enabled:!0,required:!0,colSpan:3};function U(t,a,u){return{id:t,label:a,type:"step",enabled:!0,description:u}}function it(t){return{intakeTitle:t||"Personal Tax Service Intake",fields:[U("step-identity","Personal Information","Tell us about yourself so we can prepare your return accurately."),...Je,...ot,U("step-filing","Filing Details","Help us understand your filing situation."),{id:"pmu-filing-status",label:"Filing Status",type:"radio",options:["Single","Married Filing Jointly","Married Filing Separately","Head of Household","Qualifying Widow(er)"],enabled:!0,required:!0,colSpan:3},{id:"pmu-spouse-name",label:"Spouse's Full Name",type:"text",placeholder:"Spouse's full legal name",enabled:!0,required:!1,colSpan:2,conditionalOn:{fieldId:"pmu-filing-status",values:["Married Filing Jointly"]}},{id:"pmu-spouse-dob",label:"Spouse's Date of Birth",type:"date",enabled:!0,required:!1,colSpan:2,conditionalOn:{fieldId:"pmu-filing-status",values:["Married Filing Jointly"]}},{id:"pmu-tax-year",label:"Tax Year",type:"radio",options:["2024","2023","2022","2021","Other"],enabled:!0,required:!0,colSpan:3},U("step-income","Income & Employment","Provide your employment and income details."),{id:"pmu-employment",label:"Employment Status",type:"radio",options:["W-2 Employee","Self-Employed / 1099","Both W-2 and 1099","Unemployed","Retired"],enabled:!0,required:!0,colSpan:3},{id:"pmu-income",label:"Approximate Annual Income",type:"currency",placeholder:"0.00",enabled:!0,required:!1,colSpan:1},{id:"pmu-has-tips",label:"Do you receive tips?",type:"yesno",enabled:!0,required:!1,colSpan:2,conditionalOn:{fieldId:"pmu-employment",values:["W-2 Employee","Both W-2 and 1099"]}},{id:"pmu-work-type",label:"Type of Work (Self-Employed)",type:"text",placeholder:"e.g. Uber driver, freelancer, consultant\u2026",enabled:!0,required:!1,colSpan:2,conditionalOn:{fieldId:"pmu-employment",values:["
1Self-Employed / 1099","Both W-2 and 1099"]}},{id:"pmu-mileage",label:"Do you have a mileage log?",type:"yesno",enabled:!0,required:!1,colSpan:2,conditionalOn:{fieldId:"pmu-employment",values:["Self-Employed / 1099","Both W-2 and 1099"]}},{id:"pmu-mile-total",label:"Total Miles Driven",type:"number",placeholder:"0",enabled:!0,required:!1,colSpan:1,conditionalOn:{fieldId:"pmu-mileage",value:"Yes"}},{id:"pmu-mile-biz",label:"Business Miles",type:"number",placeholder:"0",enabled:!0,required:!1,colSpan:1,conditionalOn:{fieldId:"pmu-mileage",value:"Yes"}},{id:"pmu-has-equip",label:"Did you purchase equipment for work?",type:"yesno",enabled:!0,required:!1,colSpan:2,conditionalOn:{fieldId:"pmu-employment",values:["Self-Employed / 1099","Both W-2 and 1099"]}},{id:"pmu-has-expenses",label:"Do you have other business expenses?",type:"yesno",enabled:!0,required:!1,colSpan:2,conditionalOn:{fieldId:"pmu-employment",values:["Self-Employed / 1099","Both W-2 and 1099"]}},{id:"pmu-overtime",label:"Did you receive overtime pay?",type:"yesno",enabled:!0,required:!1,colSpan:2,conditionalOn:{fieldId:"pmu-employment",value:"W-2 Employee"}},U("step-dependents","Dependents & Deductions","Tell us about dependents and other deductions."),{id:"pmu-dep-count",label:"Number of Dependents",type:"number",placeholder:"0",enabled:!0,required:!1,colSpan:1},{id:"pmu-dep-summary",label:"Dependents (Name, DOB, Relationship)",type:"textarea",placeholder:"e.g. Jane Doe, 01/15/2018, Daughter",enabled:!0,required:!1,colSpan:3},U("step-docs","Documents","Upload supporting documents."),{id:"pmu-doc-w2",label:"W-2 Form(s)",type:"file",enabled:!0,required:!1,colSpan:3,conditionalOn:{fieldId:"pmu-employment",values:["W-2 Employee","Both W-2 and 1099"]}},{id:"pmu-doc-1099",label:"1099 Form(s)",type:"file",enabled:!0,required:!1,colSpan:3,conditionalOn:{fieldId:"pmu-employment",values:["
1Self-Employed / 1099","Both W-2 and 1099"]}},{id:"pmu-doc-id",label:"Government-Issued ID",type:"file",enabled:!0,required:!0,colSpan:3},U("step-finalize","Final Details"),ke,Pe,Ce,Ie]}}function st(t){return{intakeTitle:t||"Business Service Intake",fields:[U("step-identity","Contact Information"),...Je,U("step-biz","Business Details","Tell us about your business."),{id:"pmu-biz-name",label:"Business Name",type:"text",placeholder:"Legal business name",enabled:!0,required:!0,colSpan:2},{id:"pmu-biz-registered",label:"Is the business registered?",type:"yesno",enabled:!0,required:!1,colSpan:2},{id:"pmu-biz-ein",label:"Do you have an EIN?",type:"yesno",enabled:!0,required:!1,colSpan:2,conditionalOn:{fieldId:"pmu-biz-registered",value:"Yes"}},{id:"pmu-biz-type",label:"Business Structure",type:"radio",options:["Sole Proprietor","LLC","S-Corp","C-Corp","Partnership","Other"],enabled:!0,required:!1,colSpan:3},{id:"pmu-biz-work",label:"Describe your business / industry",type:"textarea",placeholder:"What does your business do?",enabled:!0,required:!1,colSpan:3},{id:"pmu-biz-income",label:"Approximate Annual Revenue",type:"currency",placeholder:"0.00",enabled:!0,required:!1,colSpan:1},U("step-service","Service Goals"),{id:"pmu-service-goals",label:"What do you need help with?",type:"textarea",placeholder:"Describe your goals or the specific service you are looking for\u2026",enabled:!0,required:!0,colSpan:3},U("step-docs","Documents"),{id:"pmu-biz-doc",label:"Supporting Documents",type:"file",enabled:!0,required:!1,colSpan:3},U("step-finalize","Final Details"),ke,Pe,Ce,Ie]}}function oe(t,a){return{intakeTitle:t||`${a} Service Intake`,fields:[U("ep-step-identity","Personal Information"),{id:"ep-full-name",label:"Full Name",type:"text",enabled:!0,required:!0,colSpan:2},{id:"ep-email",label:"Email Address",type:"email",enabled:!0,required:!0,colSpan:2},{id:"ep-phone",label:"Phone Number",type:"tel",enabled:!0,required:!1,colSpan:2},{id:"ep-dob",label:"Date of Birth",type:"date",enabled:!0,required:!1,colSpan:1},{id:"ep-state",label:"State",type:"text",enabled:!0,required:!1,colSpan:1},U("ep-step-service","Service Request"),{id:"ep-service-goal",label:"What are you looking for?",type:"textarea",placeholder:"Describe your goals or what you need help with\u2026",enabled:!0,required:!0,colSpan:3},{id:"ep-urgency",label:"How soon do you need this?",type:"radio",options:["ASAP","Within 1\u20132 weeks","Within a month","Just exploring options"],enabled:!0,required:!1,colSpan:3},U("ep-step-docs","Documents (optional)"),{id:"ep-doc",label:"Attach a relevant document",type:"file",enabled:!0,required:!1,colSpan:3},U("ep-step-final","Final Details"),{...ke,id:"ep-contact-pref"},{...Pe,id:"ep-ref-code"},{...Ce,id:"ep-notes"},Ie]}}async function wt(t,a){try{let{data:u}=await fe.get(`/projects/${ge.PMU_CONFIGS}/nodes`),n=(Array.isArray(u?.payload?.nodes)?u.payload.nodes:[]).find(o=>(o.fieldValues??{})["/attributes/@pmuSvcId"]===t);if(n){let o=n.fieldValues,x=o["/attributes/@pmuTitle"]||a||"Service Intake",m=o["/attributes/@pmuData"]||"",I=m==="__note__"?o["/attributes/note"]||"[]":m||"[]",v=JSON.parse(I);if(Array.isArray(v)&&v.length>0)return{intakeTitle:x,fields:v}}}catch{}try{let{data:u}=await fe.get(`/projects/${ge.SERVICES}/nodes/${t}`),i=u?.payload?.node?.fieldValues??{},n=i["/attributes/@sCat"],o=typeof n=="object"&&n!==null?n.optionId??"":String(n??""),x=i["/attributes/@sName"]||a||"";
1return o==="cat-personal"?it(x):o==="cat-business"?st(x):o==="cat-legal"?oe(x,"Legal"):o==="cat-marketing"?oe(x,"Marketing"):o==="cat-financing"?oe(x,"Financing"):o==="cat-realestate"?oe(x,"Real Estate"):oe(x,"Service")}catch{return oe(a??"","Service")}}var w=Q(Fe()),Ve=Q(at());var O=Q(Fe());var D=Q(ce());function lt(t){let a=[];return t.house_number&&a.push(t.house_number),t.road&&a.push(t.road),a.join(" ")}function dt(t){return t.city??t.town??t.village??t.suburb??""}function ct(t){let a=lt(t.address),u=dt(t.address),i=t.address.state??"",n=t.address.postcode??"",o=t.address.country??"",m=[a,u,i,n].filter(Boolean).join(", ")||t.display_name;return{id:t.place_id,displayName:m,streetLine:a,city:u,state:i,zip:n,country:o}}function me({value:t,onChange:a,onSelect:u,placeholder:i="Start typing an address\u2026",className:n,inputClassName:o,disabled:x,error:m}){let[I,v]=(0,O.useState)(t),[h,p]=(0,O.useState)([]),[y,N]=(0,O.useState)(!1),[q,z]=(0,O.useState)(!1),[M,A]=(0,O.useState)(-1),R=(0,O.useRef)(null),W=(0,O.useRef)(null),B=(0,O.useRef)(null),$=(0,O.useRef)(null);(0,O.useEffect)(()=>{v(t)},[t]),(0,O.useEffect)(()=>{let s=b=>{B.current&&!B.current.contains(b.target)&&N(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);let d=(0,O.useCallback)(async s=>{if(s.trim().length<4){p([]),N(!1);return}W.current?.abort();let b=new AbortController;W.current=b,z(!0);try{let g=new URLSearchParams({q:s,format:"json",addressdetails:"1",limit:"5",countrycodes:"us","accept-language":"en"}),L=await fetch(`https://nominatim.openstreetmap.org/search?${g.toString()}`,{signal:b.signal,headers:{"Accept-Language":"en"}});if(!L.ok)throw new Error("Network error");let T=(await L.json()).map(ct);p(T),N(T.length>0),A(-1)}catch(g){if(g instanceof Error&&g.name==="AbortError")return;p([]),N(!1)}finally{z(!1)}},[]),P=s=>{v(s),a(s),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>d(s),350)},F=s=>{v(s.streetLine||s.displayName),a(s.streetLine||s.displayName),p([]),N(!1),u(s),$.current?.blur()},H=s=>{!y||h.length===0||(s.key==="ArrowDown"?(s.preventDefault(),A(b=>Math.min(b+1,h.length-1))):s.key==="ArrowUp"?(s.preventDefault(),A(b=>Math.max(b-1,-1))):s.key==="Enter"&&M>=0?(s.preventDefault(),F(h[M])):s.key==="Escape"&&(N(!1),A(-1)))},J=()=>{v(""),a(""),p([]),N(!1),$.current?.focus()},K="w-full bg-white/5 border rounded-xl px-3 py-2.5 text-sm text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:ring-2 focus:ring-primary/50 transition-all pr-16",X=m?"border-red-500/50":"border-white/10 focus:border-primary/30";return(0,D.jsxs)("div",{ref:B,className:c("relative",n),children:[(0,D.jsxs)("div",{className:"relative",children:[(0,D.jsx)(le,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/60 pointer-events-none"}),(0,D.jsx)("input",{ref:$,type:"text",value:I,onChange:s=>P(s.target.value),onKeyDown:H,onFocus:()=>{h.length>0&&N(!0)},placeholder:i,disabled:x,autoComplete:"off",className:c(K,X,"pl-9",o,x&&"pointer-events-none opacity-60")}),(0,D.jsxs)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1.5",children:[q&&(0,D.jsx)(ne,{className:"w-3.5 h-3.5 animate-spin text-muted-foreground"}),I&&!q&&!x&&(0,D.jsx)("button",{type:"button",onClick:J,className:"text-muted-foreground/60 hover:text-foreground transition-colors p-0.5 rounded",children:(0,D.jsx)(ae,{className:"w-3.5 h-3.5"})})]})]}),y&&h.length>0&&(0,D.jsxs)("div",{className:c("absolute z-[300] left-0 right-0 mt-1.5 rounded-xl border border-white/10","bg-zinc-900 shadow-2xl shadow-black/60 overflow-hidden"),children:[(0,D.jsx)("p",{className:"px-3 pt-2.5 pb-1 text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/60",children:"Address suggestions"}),(0,D.jsx)("ul",{role:"listbox",children:h.map((s,b)=>(0,D.jsxs)("li",{role:"option","aria-selected":b===M,onMouseEnter:()=>A(b),onMouseDown:g=>{g.preventDefault(),F(s)},className:c("flex items-start gap-2.5 px-3 py-2.5 cursor-pointer transition-colors text-sm",b===M?"bg-primary/15 text-foreground":"text-foreground
1/80 hover:bg-white/5"),children:[(0,D.jsx)(le,{className:c("w-3.5 h-3.5 mt-0.5 shrink-0",b===M?"text-primary":"text-muted-foreground/50")}),(0,D.jsxs)("div",{className:"min-w-0",children:[(0,D.jsx)("p",{className:"font-medium truncate leading-tight",children:s.streetLine||s.city||s.displayName}),(0,D.jsx)("p",{className:"text-[11px] text-muted-foreground truncate",children:[s.city,s.state,s.zip].filter(Boolean).join(", ")})]})]},s.id))}),(0,D.jsx)("div",{className:"px-3 py-2 border-t border-white/5 flex items-center gap-1",children:(0,D.jsx)("span",{className:"text-[10px] text-muted-foreground/40",children:"Powered by OpenStreetMap"})})]})]})}var e=Q(ce()),pt=new Set(["radio","select","multiselect","checkboxgroup","yesno","checkbox"]);function ut({field:t,allFields:a,onChange:u,onClose:i}){let n=a.filter(p=>p.id!==t.id&&pt.has(p.type)),o=t.conditionalOn,x=a.find(p=>p.id===o?.fieldId),m=x?.type==="yesno"?["Yes","No"]:x?.options??[],I=o?.values??(o?.value?[o.value]:[]),v=(p,y)=>{if(!p){u({...t,conditionalOn:void 0});return}u({...t,conditionalOn:{fieldId:p,values:y,value:y[0]??""}})},h=()=>u({...t,conditionalOn:void 0});return(0,e.jsx)(V.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.18,ease:"easeInOut"},className:"overflow-hidden",children:(0,e.jsxs)("div",{className:"mt-1 px-3 py-2.5 rounded-xl border border-amber-500/20 bg-amber-500/[0.04] flex flex-col gap-2",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(re,{className:"w-3 h-3 text-amber-400 shrink-0"}),(0,e.jsx)("span",{className:"text-[10px] font-semibold text-amber-400 uppercase tracking-widest",children:"Show only if"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[o?.fieldId&&(0,e.jsx)("button",{type:"button",onClick:h,className:"text-[10px] text-red-400/70 hover:text-red-400 transition-colors",children:"Clear"}),(0,e.jsx)("button",{type:"button",onClick:i,className:"p-0.5 rounded hover:bg-white/10 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:(0,e.jsx)(ae,{className:"w-3 h-3"})})]})]}),n.length===0?(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground/50 italic",children:"Add a radio, dropdown, yes/no, or checkbox field first to enable conditions."}):(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxs)("div",{className:"relative shrink-0",children:[(0,e.jsxs)("select",{value:o?.fieldId??"",onChange:p=>{let y=p.target.value;y?v(y,[]):h()},className:"appearance-none border border-white/10 rounded-lg pl-2.5 pr-6 py-1 text-[11px] text-foreground focus:outline-none focus:ring-1 focus:ring-amber-500/40 max-w-[160px]",style:{colorScheme:"dark",backgroundColor:"#27272a",color:"inherit"},children:[(0,e.jsx)("option",{value:"",style:{backgroundColor:"#27272a"},children:"\u2014 choose field \u2014"}),n.map(p=>(0,e.jsx)("option",{value:p.id,style:{backgroundColor:"#27272a"},children:p.label},p.id))]}),(0,e.jsx)(pe,{className:"absolute right-1.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground/60 pointer-events-none"})]}),o?.fieldId&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground/50 shrink-0",children:"equals"}),o?.fieldId&&m.length>0&&(0,e.jsx)("div",{className:"flex flex-wrap gap-1",children:m.map(p=>{let y=I.includes(p);return(0,e.jsxs)("button",{type:"button",onClick:()=>{let N=y?I.filter(q=>q!==p):[...I,p];v(o.fieldId,N)},className:c("flex items-center gap-1 px-2 py-0.5 rounded-full border text-[10px] font-medium transition-all",y?"bg-amber-500/20 border-amber-500/40 text-amber-300":"bg-white/5 border-white/10 text-muted-foreground hover:border-white/25 hover:text-foreground"),children:[y&&(0,e.jsx)("svg",{viewBox:"0 0 8 6",className:"w-2 h-2 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("polyline",{points:"1,3 3,5 7,1"})}),p]},p)})}),o?.fieldId&&m.length===0&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground
1/40 italic",children:"No options on that field yet."})]}),o?.fieldId&&I.length>0&&(0,e.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[(0,e.jsx)(re,{className:"w-2.5 h-2.5 text-amber-400 shrink-0"}),(0,e.jsxs)("p",{className:"text-[10px] text-amber-300 leading-snug",children:["Shown when"," ",(0,e.jsx)("span",{className:"font-semibold",children:x?.label})," ","is"," ",I.map((p,y)=>(0,e.jsxs)("span",{children:[y>0&&(0,e.jsx)("span",{className:"text-amber-400/60",children:" or "}),(0,e.jsxs)("span",{className:"font-semibold",children:['"',p,'"']})]},p))]})]}),o?.fieldId&&I.length===0&&(0,e.jsxs)("p",{className:"text-[10px] text-amber-400/60 flex items-center gap-1",children:[(0,e.jsx)(ue,{className:"w-3 h-3 shrink-0"}),"Pick at least one value to activate the condition."]})]})})}function Xe(t,a){if(!t.conditionalOn)return!0;let{fieldId:u,value:i,values:n}=t.conditionalOn,o=a[u]??"";return n?n.includes(o):i!==void 0?o===i:!0}function mt(t){let a=[],u={header:null,fields:[],startIdx:0},i=0;for(let n of t)n.type==="step"?((u.fields.length>0||u.header)&&a.push(u),u={header:n,fields:[],startIdx:i}):u.fields.push(n),i++;return(u.fields.length>0||u.header)&&a.push(u),a}var et=[{value:"text",label:"Text (Single-line)"},{value:"textarea",label:"Text (Multi-line)"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"tel",label:"Phone"},{value:"date",label:"Date"},{value:"currency",label:"Currency"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"address",label:"Address"},{value:"conditional",label:"Conditional"},{value:"multicondition",label:"Multiple Conditional"},{value:"select",label:"Dropdown (Single-select)"},{value:"multiselect",label:"Multi-select Dropdown"},{value:"checkbox",label:"Checkbox"},{value:"checkboxgroup",label:"Checkbox Group"},{value:"radio",label:"Radio Buttons"},{value:"yesno",label:"Toggle (Yes/No)"},{value:"rating",label:"Star Rating"},{value:"file",label:"File Upload"},{value:"imageupload",label:"Image Upload"},{value:"signature",label:"Signature"},{value:"hidden",label:"Hidden Field"},{value:"readonly",label:"Read-only Display"},{value:"calculated",label:"Calculated Field"},{value:"sectionheader",label:"Section Header"},{value:"instruction",label:"Instruction / Help Text"},{value:"divider",label:"Divider / Spacer"},{value:"step",label:"Progress Step / Page Break"},{value:"terms",label:"Terms Acceptance"},{value:"consent",label:"Consent / Disclosure"},{value:"captcha",label:"Captcha / Anti-bot"}],Ee=[{value:1,label:"\xBC",tip:"25% width"},{value:2,label:"\xBD",tip:"50% width"},{value:3,label:"\xBE",tip:"75% width"},{value:4,label:"\u2B1B",tip:"Full width"}];function bt(t){switch(t){case 1:return"col-span-1";case 2:return"col-span-2";case 3:return"col-span-3";default:return"col-span-4"}}var gt={"pmu-city":"auto-filled: city","ep-city":"auto-filled: city","pmu-state":"auto-filled: state","ep-state":"auto-filled: state","pmu-zip":"auto-filled: zip","pmu-zipcode":"auto-filled: zip","ep-zip":"auto-filled: zip"},ft=t=>t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-_.]/g,"").slice(0,64);function Ze({field:t,anchorRef:a,onChange:u,onDelete:i,onDuplicate:n,onClose:o,onMoveToStep:x,availableSteps:m,allFieldIds:I=[],allFields:v=[]}){let h=r=>u({...t,...r}),[p,y]=(0,w.useState)(t.id),[N,q]=(0,w.useState)(!1);(0,w.useEffect)(()=>{y(t.id)},[t.id]);let z=p!==t.id&&I.filter(r=>r!==t.id).includes(p),A=p.trim()===""?"ID cannot be empty":z?"ID already in use":null,R=gt[p],W=()=>{let r=ft(p);if(!r||z){y(t.id);return}r!==t.id&&(u({...t,id:r}),y(r))},B=()=>{navigator.clipboard.writeText(t.id).then(()=>{q(!0),setTimeout(()=>q(!1),1800)})},d=new Set(["step","sectionheader","divider","instruction","captcha"]).has(t.type),P=t.type==="step",F=t.type==="instruction"||t.type==="readonly",H=t.type==="calculated",J=["radio","select","multiselect","checkboxgroup"].includes(t.type),K=m?.filter(r=>!r.isCurrent)??[],X=320,s=500,b=(0,w.useRef)(null),[g,L]=(0,w.useState)(null),Y=(0,w.useRef)(!1),T=(0,w.useRef)(null);(0,w.useEffect)(()=>{let r=()=>{if(Y.current||!a.current)return;let S=a.current.getBoundingClientRect(),_=window.innerHeight-S.bottom-8,k=S.top-8,l=_>=Math.min(s,200)?S.bottom+6:k>=Math.min(s,200)?S.top-Math.min(s,k)-6:S.bottom+6,f=Math.max(8,Math.min(S.left,window.innerWidth-X-8));L({top:l,left:f})};return r(),window.addEventListener("scroll",r,!0),window.addEventListener("resize",r),()=>{window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",r)}},[a]);let Z=r=>{if(!g)return;r.preventDefault();let S={mx:r.clientX,my:r.clientY,px:g.left,py:g.top};T.current=S;let _=l=>{let f=l.clientX-S.mx,E=l.clientY-S.my;if(!Y.current&&(Math.abs(f)>3||Math.abs(E)>3)&&(Y.current=!0),!Y.current)return;let G=Math.max(8,Math.min(S.px+f,window.innerWidth-X-8)),j=Math.max(8,Math.min(S.py+E,window.innerHeight-80));L({top:j,left:G})},k=()=>{T.current=null,window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",k)};window.addEventListener("pointermove",_),window.addEventListener("pointerup",k)};if((0,w.useEffect)(()=>{let r=_=>{let k=_.target;a.current?.contains(k)||b.current?.contains(k)||o()},S=setTimeout(()=>document.addEventListener("mousedown",r),80);return()=>{clearTimeout(S),document.removeEventListener("mousedown",r)}},[a,o]),!g)return null;let ee=(0,e.jsxs)(V.div,{ref:b,initial:{opacity:0,y:-6,scale:.98}
1,animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.97},transition:{duration:.15},style:{position:"fixed",top:g.top,left:g.left,width:X,maxHeight:s,zIndex:9999},className:"bg-zinc-900 border border-white/15 rounded-xl shadow-2xl shadow-black/60 overflow-hidden flex flex-col",onClick:r=>r.stopPropagation(),onMouseDown:r=>r.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-white/[0.04] border-b border-white/10 select-none shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 flex-1 cursor-grab active:cursor-grabbing py-0.5",onPointerDown:Z,children:[(0,e.jsx)(we,{className:"w-3.5 h-3.5 text-muted-foreground/40"}),(0,e.jsx)("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Edit Field"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",onPointerDown:r=>r.stopPropagation(),children:[(0,e.jsx)("button",{onClick:n,className:"p-1 rounded hover:bg-white/10 text-muted-foreground transition-colors",title:"Duplicate",children:(0,e.jsx)(Oe,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{onClick:i,className:"p-1 rounded hover:bg-red-500/20 text-muted-foreground hover:text-red-400 transition-colors",title:"Delete",children:(0,e.jsx)(Ye,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{onClick:o,className:"p-1 rounded hover:bg-white/10 text-muted-foreground transition-colors",children:(0,e.jsx)(ae,{className:"w-3.5 h-3.5"})})]})]}),(0,e.jsxs)("div",{className:"p-3 space-y-2.5 overflow-y-auto flex-1",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Label"}),(0,e.jsx)("input",{value:t.label,onChange:r=>h({label:r.target.value}),className:"w-full bg-white/5 border border-white/10 rounded-lg px-2.5 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50"})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,e.jsxs)("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[(0,e.jsx)(ze,{className:"w-3 h-3"})," Field ID"]}),R&&(0,e.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-emerald-500/10 border border-emerald-500/20 text-emerald-400",children:R})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("input",{value:p,onChange:r=>y(r.target.value.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-_.]/g,"").slice(0,64)),onBlur:W,onKeyDown:r=>r.key==="Enter"&&W(),spellCheck:!1,className:c("flex-1 bg-white/5 border rounded-lg px-2.5 py-1.5 text-xs font-mono text-foreground focus:outline-none focus:ring-1 transition-colors",A?"border-red-500/50 focus:ring-red-500/40":"border-white/10 focus:ring-primary/50")}),(0,e.jsx)("button",{type:"button",onClick:B,title:"Copy Field ID",className:"p-1.5 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 text-muted-foreground hover:text-foreground transition-colors shrink-0",children:N?(0,e.jsx)(Ae,{className:"w-3 h-3 text-emerald-400"}):(0,e.jsx)(Me,{className:"w-3 h-3"})})]}),A&&(0,e.jsxs)("p",{className:"text-[10px] text-red-400 mt-0.5 flex items-center gap-1",children:[(0,e.jsx)(ue,{className:"w-3 h-3"})," ",A]}),!A&&(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground/40 mt-0.5",children:"Used for address auto-fill and conditional logic."})]}),d&&(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:P?"Subtitle":"Description"}),(0,e.jsx)("input",{value:t.description??"",onChange:r=>h({description:r.target.value}),placeholder:P?"Step subtitle\u2026":"Short description\u2026",className:"w-full bg-white/5 border border-white/10 rounded-lg px-2.5 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50"})]}),F&&(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Content"}),(0,e.jsx)("textarea",{rows:3,value:t.content??"",onChange:r=>h({content:r.target.value}),placeholder:"Enter display text\u2026",className:"w-full bg-white/5 border border-white/10 rounded-lg px-2.5 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50 resize-none"})]}),H&&(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Formula"}),(0,e.jsx)("input",{value:t.formula??"",onChange:r=>h({formula:r.target.value}),placeholder:"e.g. fieldA + fieldB",className:"w-full bg-white/5 border border-white/10 rounded-lg px-2.5 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-1 focus:ring-primary/50"})]}
1),!d&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Type"}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("select",{value:t.type,onChange:r=>h({type:r.target.value}),className:"appearance-none w-full border border-white/10 rounded-lg pl-2.5 pr-7 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50",style:{colorScheme:"dark",backgroundColor:"#27272a",color:"inherit"},children:et.map(r=>(0,e.jsx)("option",{value:r.value,style:{backgroundColor:"#27272a",color:"inherit"},children:r.label},r.value))}),(0,e.jsx)(pe,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground pointer-events-none"})]})]}),!["calculated","readonly","hidden","rating","signature","captcha","checkbox","checkboxgroup"].includes(t.type)&&(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:t.type==="consent"||t.type==="terms"?"Agreement Text":"Placeholder"}),(0,e.jsx)("input",{value:t.placeholder??"",onChange:r=>h({placeholder:r.target.value}),placeholder:"Hint text\u2026",className:"w-full bg-white/5 border border-white/10 rounded-lg px-2.5 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50"})]}),J&&(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Options (one per line)"}),(0,e.jsx)("textarea",{rows:4,value:(t.options??[]).join(` 2`),onChange:r=>h({options:r.target.value.split(` 3`)}),placeholder:`Option A 4Option B 5Option C`,className:"w-full bg-white/5 border border-white/10 rounded-lg px-2.5 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50 resize-none font-mono"})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,e.jsx)("label",{className:"text-[10px] text-muted-foreground",children:"Width"}),(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:Ee.find(r=>r.value===(t.colSpan??4))?.tip??"Full width"})]}),(0,e.jsx)("div",{className:"flex gap-0.5 h-7 rounded-lg overflow-hidden border border-white/10",children:Ee.map(r=>{let S=(t.colSpan??4)===r.value;return(0,e.jsx)("button",{title:r.tip,onClick:()=>h({colSpan:r.value}),style:{flex:r.value},className:c("flex items-center justify-center text-[11px] font-semibold transition-all",S?"bg-primary/30 text-primary border-r border-primary/20":"bg-white/[0.03] text-muted-foreground/50 hover:bg-white/10 hover:text-muted-foreground border-r border-white/5",r.value===4&&"border-r-0"),children:r.label},r.value)})}),(0,e.jsx)("div",{className:"mt-1.5 h-1 rounded-full bg-white/5 overflow-hidden",children:(0,e.jsx)("div",{className:"h-full bg-primary/40 rounded-full transition-all duration-200",style:{width:`${(t.colSpan??4)/4*100}%`}})}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground/40 mt-1",children:"Drag the right edge of any field card to resize manually."})]}),!["hidden","readonly","calculated"].includes(t.type)&&(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("button",{onClick:()=>h({required:!t.required}),className:c("flex-1 py-1 rounded-lg text-[11px] border transition-colors",t.required?"bg-red-500/15 border-red-500/20 text-red-400":"bg-white/5 border-white/10 text-muted-foreground hover:border-white/20"),children:t.required?"Required":"Optional"}),(0,e.jsx)("button",{onClick:()=>h({enabled:!t.enabled}),className:c("flex-1 py-1 rounded-lg text-[11px] border transition-colors",t.enabled!==!1?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-white/5 border-white/10 text-muted-foreground"),children:t.enabled!==!1?"Visible":"Hidden"})]})]}),!d&&(0,e.jsxs)("div",{className:"pt-1 border-t border-white/10 flex items-center gap-1.5",children:[(0,e.jsx)(re,{className:"w-3 h-3 text-amber-400/60 shrink-0"}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground/50",children:t.conditionalOn?.fieldId?(0,e.jsxs)(e.Fragment,{children:["Condition active \u2014 click ",(0,e.jsx)("span",{className:"text-amber-400 font-semibold",children:"If"})," on the field card to edit it."]}):(0,e.jsxs)(e.Fragment,{children:["Use the ",(0,e.jsx)("span",{className:"text-amber-400 font-semibold",children:"If"})," button on the field card to set a condition."]})})]}),x&&m&&m.length>1&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 pt-1 border-t border-white/10",children:[(0,e.jsx)(xe,{className:"w-3 h-3 text-muted-foreground"}),(0,e.jsx)("label",{className:"text-[10px] text-muted-foreground uppercase tracking-widest font-semibold",children:"Move to"})]}),(0,e.jsx)("div",{className:"flex flex-col gap-1",children:m.map(r=>(0,e.jsxs)("button",{disabled:r.isCurrent,onClick:()=>{x(r.stepIdx),o()},className:c("flex items-center gap-2 w-full px-2.5 py-1.5 rounded-lg border text-left transition-all group",r.isCurrent?"bg-white/5 border-white/10 text-muted-foreground
5/40 cursor-default":"bg-white/5 border-white/10 text-muted-foreground hover:bg-primary/10 hover:border-primary/30 hover:text-primary"),children:[(0,e.jsx)("span",{className:c("w-4 h-4 rounded-md flex items-center justify-center text-[9px] font-bold shrink-0 transition-colors",r.isCurrent?"bg-white/10":"bg-white/10 group-hover:bg-primary/20"),children:r.stepIdx+1}),(0,e.jsx)("span",{className:"text-[11px] truncate flex-1",children:r.label}),r.isCurrent&&(0,e.jsx)("span",{className:"text-[9px] text-muted-foreground/40 shrink-0",children:"current"}),!r.isCurrent&&(0,e.jsx)(xe,{className:"w-3 h-3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]},r.stepIdx))})]})]})]});return(0,Ve.createPortal)(ee,document.body)}function Ke({value:t,placeholder:a,builderMode:u,accept:i,icon:n,hint:o,onValueChange:x}){let[m,I]=(0,w.useState)(!1),[v,h]=(0,w.useState)(!1),p=(0,w.useRef)(null),y=(0,w.useRef)(0);function N(d){if(!d)return"";if(d.startsWith("data:"))return`Uploaded (${d.slice(5,d.indexOf(";")).split("/")[1]?.toUpperCase()??"FILE"})`;let P=d.split("/").pop()?.split("?")[0]?.replace(/\.md$/i,"")??"";return P?decodeURIComponent(P):"Uploaded file"}function q(d){return!d.type||i==="*/*"?!0:i==="image/*"?d.type.startsWith("image/"):i.split(",").some(P=>P.trim()===d.type)}async function z(d){I(!0);try{let{uploadFile:P}=await import("/chunks/upload-YSCOM65D.js"),F=await P(d);x(F.url)}catch{be.error(`Upload failed: ${d.name}`)}finally{I(!1)}}function M(d){let P=d.target.files?.[0];P&&z(P),d.target.value=""}function A(d){d.preventDefault(),y.current+=1,y.current===1&&h(!0)}function R(d){d.preventDefault(),d.dataTransfer.dropEffect="copy"}function W(d){d.preventDefault(),y.current-=1,y.current===0&&h(!1)}function B(d){if(d.preventDefault(),y.current=0,h(!1),m)return;let F=Array.from(d.dataTransfer.items??[]).find(H=>H.kind==="file"&&q(H))?.getAsFile();F?z(F):be.error("File type not accepted for this field.")}let $={onDragEnter:A,onDragOver:R,onDragLeave:W,onDrop:B};if(u)return(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 border-2 border-dashed rounded-xl py-5 border-white/10 opacity-60 pointer-events-none select-none",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:n}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:a??"File upload"}),o&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:o})]});if(t){let d=N(t),P=t.startsWith("data:image")||/\.(jpe?g|png|gif|webp|svg|bmp|avif)(\.md)?$/i.test(t);return(0,e.jsxs)("div",{className:c("relative flex flex-col gap-2 rounded-xl transition-all duration-150",v&&"ring-2 ring-primary/50 ring-offset-1 ring-offset-transparent"),...$,children:[(0,e.jsx)(te,{children:v&&(0,e.jsx)(V.div,{initial:{opacity:0}
5,animate:{opacity:1},exit:{opacity:0},transition:{duration:.12},className:"absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-primary/10 border-2 border-primary/50 pointer-events-none",children:(0,e.jsx)("span",{className:"text-xs font-semibold text-primary",children:"Drop to replace"})})}),P&&(0,e.jsx)("div",{className:"relative w-full max-h-40 rounded-xl overflow-hidden border border-white/10 bg-black/20 flex items-center justify-center",children:(0,e.jsx)("img",{src:t,alt:d,className:"max-h-40 max-w-full object-contain"})}),(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-emerald-500/30 bg-emerald-500/8 px-3 py-2",children:[(0,e.jsx)(ye,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),(0,e.jsx)("span",{className:"text-xs text-emerald-300 flex-1 truncate",children:d}),(0,e.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,e.jsx)("button",{type:"button",title:"Replace file",onClick:()=>p.current?.click(),disabled:m,className:"p-1 rounded-lg text-muted-foreground hover:text-foreground hover:bg-white/8 transition-colors disabled:opacity-40",children:m?(0,e.jsx)(ne,{className:"w-3.5 h-3.5 animate-spin"}):(0,e.jsx)(Se,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{type:"button",title:"Remove file",onClick:()=>x(""),disabled:m,className:"p-1 rounded-lg text-red-400/60 hover:text-red-400 hover:bg-red-500/10 transition-colors disabled:opacity-40",children:(0,e.jsx)(ae,{className:"w-3.5 h-3.5"})})]})]}),(0,e.jsx)("input",{ref:p,type:"file",accept:i,className:"sr-only",onChange:M})]})}return(0,e.jsxs)("label",{className:c("flex flex-col items-center justify-center gap-2 border-2 border-dashed rounded-xl py-5 transition-all duration-150 cursor-pointer select-none",m&&"pointer-events-none border-primary/40 bg-primary/5",!m&&v&&"border-primary/70 bg-primary/8 scale-[1.01]",!m&&!v&&"border-white/10 hover:border-white/25 hover:bg-white/3"),...m?{}:$,children:[(0,e.jsx)(V.span,{animate:v&&!m?{scale:1.2}:{scale:1},transition:{type:"spring",stiffness:400,damping:20},className:c("transition-colors",m||v?"text-primary":"text-muted-foreground"),children:m?(0,e.jsx)(ne,{className:"w-5 h-5 animate-spin"}):n}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:m?"Uploading\u2026":v?"Drop to upload":a??"Click or drag file here"}),o&&!m&&!v&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:o}),!m&&(0,e.jsx)("input",{ref:p,type:"file",accept:i,className:"sr-only",onChange:M})]})}function Qe({field:t,value:a="",error:u,onValueChange:i,builderMode:n,isSelected:o,onSelect:x,onFieldChange:m,onDelete:I,onDuplicate:v,onCloseEditor:h,onMoveToStep:p,availableSteps:y,isChecked:N,onCheckToggle:q,allFieldIds:z,allFields:M,onAddressSelect:A}){let R=(0,w.useRef)(null),W=(0,w.useRef)(null),[B,$]=(0,w.useState)(!1),[d,P]=(0,w.useState)(""),[F,H]=(0,w.useState)(""),[J,K]=(0,w.useState)(""),X=(0,w.useRef)(0),s=(0,w.useRef)(4),b=(0,w.useCallback)(S=>{S.preventDefault(),S.stopPropagation(),X.current=S.clientX,s.current=t.colSpan??4;let _=l=>{let E=(W.current?.parentElement?.getBoundingClientRect().width??600)/4,G=Math.round((l.clientX-X.current)/E),j=Math.max(1,Math.min(4,s.current+G));j!==(t.colSpan??4)&&m?.({...t,colSpan:j})},k=()=>{window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",k)};window.addEventListener("pointermove",_),window.addEventListener("pointerup",k)},[t,m]),g="w-full bg-white/5 border rounded-xl px-3 py-2.5 text-sm text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:ring-2 focus:ring-primary/50 transition-all",L=u?"border-red-500/50":"border-white/10",Y=()=>{if(t.type==="textarea")return(0,e.jsx)("textarea",{rows:3,placeholder:t.placeholder,value:n?"":a,readOnly:n,onChange:l=>i?.(t.id,l.target.value),className:c(g,L,"resize-none")});if(t.type==="yesno"||t.type==="radio"){let l=t.type==="yesno"?["Yes","No"]:t.options??["Option A","Option B"];return(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:l.map(f=>{let E=!n&&a===f;return(0,e.jsx)("button",{type:"button",onClick:n?void 0:()=>i?.(t.id,E?"":f),className:c("px-3 py-1.5 rounded-lg text-sm border transition-all",E?"bg-primary/20 border-primary/50 text-primary":"bg-white/5 border-white/10 text-muted-foreground hover:border-white/20",n&&"cursor-default pointer-events-none"),children:f},f)})})}if(t.type==="checkboxgroup"){let l=t.options??["Choice A","Choice B"],f=n?new Set:new Set((a||"").split(",").filter(
5Boolean));return(0,e.jsx)("div",{className:"flex flex-col gap-2",children:l.map(E=>{let G=f.has(E);return(0,e.jsxs)("label",{className:c("flex items-center gap-2.5 cursor-pointer",n&&"cursor-default pointer-events-none"),children:[(0,e.jsx)("input",{type:"checkbox",checked:G,onChange:()=>{let j=new Set(f);G?j.delete(E):j.add(E),i?.(t.id,[...j].join(","))},className:"accent-primary w-4 h-4"}),(0,e.jsx)("span",{className:"text-sm text-foreground",children:E})]},E)})})}if(t.type==="checkbox"){let l=!n&&a==="true";return(0,e.jsxs)("label",{className:c("flex items-center gap-2.5 cursor-pointer",n&&"cursor-default pointer-events-none"),children:[(0,e.jsx)("input",{type:"checkbox",checked:l,onChange:f=>i?.(t.id,f.target.checked?"true":""),className:"accent-primary w-4 h-4"}),(0,e.jsx)("span",{className:"text-sm text-foreground",children:t.placeholder??t.label})]})}if(t.type==="consent"){let l=!n&&a==="agreed";return(0,e.jsxs)("label",{className:c("flex gap-3 items-start p-3 rounded-xl border transition-all",l?"border-emerald-500/40 bg-emerald-500/5":"border-white/10 bg-white/5",n&&"cursor-default"),children:[(0,e.jsx)("input",{type:"checkbox",checked:l,readOnly:n,onChange:f=>i?.(t.id,f.target.checked?"agreed":""),className:"mt-0.5 accent-emerald-500"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:t.placeholder??"I consent to the collection and use of my data for the purpose of delivering the requested service."})]})}if(t.type==="terms"){let l=!n&&a==="agreed";return(0,e.jsxs)("label",{className:c("flex gap-3 items-start p-3 rounded-xl border transition-all",l?"border-blue-500/40 bg-blue-500/5":"border-white/10 bg-white/5",n&&"cursor-default"),children:[(0,e.jsx)("input",{type:"checkbox",checked:l,readOnly:n,onChange:f=>i?.(t.id,f.target.checked?"agreed":""),className:"mt-0.5 accent-blue-500"}),(0,e.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,e.jsx)(qe,{className:"w-3.5 h-3.5 text-blue-400 shrink-0 mt-0.5"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground leading-relaxed",children:t.placeholder??"I agree to the Terms & Conditions and Privacy Policy."})]})]})}if(t.type==="file")return(0,e.jsx)(Ke,{value:a,placeholder:t.placeholder,builderMode:n,accept:"*/*",icon:(0,e.jsx)(Se,{className:"w-5 h-5"}),onValueChange:l=>i?.(t.id,l)});if(t.type==="imageupload")return(0,e.jsx)(Ke,{value:a,placeholder:t.placeholder,builderMode:n,accept:"image/*",icon:(0,e.jsx)(Be,{className:"w-5 h-5"}),hint:"PNG, JPG, GIF, WEBP",onValueChange:l=>i?.(t.id,l)});if(t.type==="signature")return(0,e.jsxs)("div",{className:c("flex flex-col items-center justify-center border-2 border-dashed rounded-xl py-6 gap-2 transition-all border-white/10",n&&"pointer-events-none"),children:[(0,e.jsx)(je,{className:"w-5 h-5 text-muted-foreground"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Sign here"}),a&&!n&&(0,e.jsx)("span",{className:"text-[10px] text-emerald-400",children:"\u2713 Signed"}),!n&&(0,e.jsx)("button",{type:"button",onClick:()=>i?.(t.id,"signed"),className:"px-3 py-1 rounded-lg bg-primary/10 border border-primary/20 text-primary text-xs hover:bg-primary/20 transition-colors",children:a?"Re-sign":"Click to sign"})]});if(t.type==="currency")return(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,e.jsx)("input",{type:"number",min:"0",step:"0.01",placeholder:t.placeholder??"0.00",value:n?"":a,readOnly:n,onChange:l=>i?.(t.id,l.target.value),className:c(g,L,"pl-7",n&&"pointer-events-none")})]});if(t.type==="address"){if(n)return(0,e.jsxs)("div",{className:"flex flex-col gap-2 pointer-events-none",children:[(0,e.jsxs)("div",{className:c("flex items-center gap-2 px-3 py-2.5 rounded-xl border",L,"bg-white/5"),children:[(0,e.jsx)(le,{className:"w-4 h-4 text-muted-foreground/50 shrink-0"}),(0,e.jsx)("span",{className:"text-sm text-muted-foreground/50",children:t.placeholder??"Street address (autocomplete)"})]}),(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,e.jsx)("div",{className:c("px-3 py-2.5 rounded-xl border text-sm text-muted-foreground
5/40",L,"bg-white/5"),children:"City"}),(0,e.jsx)("div",{className:c("px-3 py-2.5 rounded-xl border text-sm text-muted-foreground/40",L,"bg-white/5"),children:"ZIP / Postal"})]})]});let l=C=>{i?.(t.id,C.streetLine||C.displayName),P(C.city),H(C.state),K(C.zip);let ie=["pmu-city","ep-city",`${t.id}-city`],rt=["pmu-state","ep-state",`${t.id}-state`],nt=["pmu-zip","pmu-zipcode","ep-zip",`${t.id}-zip`];ie.forEach(se=>i?.(se,C.city)),rt.forEach(se=>i?.(se,C.state)),nt.forEach(se=>i?.(se,C.zip))},f=C=>{i?.(t.id,C),C||(P(""),H(""),K(""))},E=C=>{P(C),["pmu-city","ep-city",`${t.id}-city`].forEach(ie=>i?.(ie,C))},G=C=>{H(C),["pmu-state","ep-state",`${t.id}-state`].forEach(ie=>i?.(ie,C))},j=!!(d||F||J),De=C=>c(g,"text-sm transition-all duration-200 pr-3",C?"text-foreground bg-primary/5 border-primary/25 hover:border-primary/40 focus:border-primary/60 focus:bg-primary/8 focus:ring-primary/40":"text-muted-foreground/50 italic border-white/10 hover:border-white/20"),tt=C=>c(g,"text-sm transition-all duration-200 cursor-default select-all",C?"text-foreground/70 bg-white/[0.03] border-white/10":"text-muted-foreground/40 italic border-white/10");return(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,e.jsx)(me,{value:a,onChange:f,onSelect:l,placeholder:t.placeholder??"Start typing a street address\u2026",error:!!u}),(0,e.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,e.jsxs)("div",{className:"relative group col-span-1",children:[(0,e.jsx)("input",{type:"text",placeholder:"City",value:d,onChange:C=>E(C.target.value),className:De(!!d)}),d&&(0,e.jsx)(de,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-primary/30 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity pointer-events-none"})]}),(0,e.jsxs)("div",{className:"relative group col-span-1",children:[(0,e.jsx)("input",{type:"text",placeholder:"State",value:F,onChange:C=>G(C.target.value),className:De(!!F)}),F&&(0,e.jsx)(de,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-primary/30 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity pointer-events-none"})]}),(0,e.jsx)("div",{className:"relative col-span-1",children:(0,e.jsx)("input",{type:"text",placeholder:"ZIP",readOnly:!0,value:J,title:"ZIP is filled from address selection",className:tt(!!J)})})]}),j?(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground/40 pl-0.5 leading-snug",children:"City and State are editable \u2014 correct them if needed"}):(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground/40 pl-0.5 leading-snug",children:"City, State & ZIP fill automatically when you pick an address"})]})}if(t.type==="select"){let l=t.options??["Option A","Option B","Option C"];return(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("select",{value:n?"":a,disabled:n,onChange:f=>i?.(t.id,f.target.value),className:c(g,L,"appearance-none pr-8",n&&"pointer-events-none"),style:{colorScheme:"dark",backgroundColor:"hsl(var(--card))",color:"hsl(var(--foreground))"},children:[(0,e.jsx)("option",{value:"",style:{backgroundColor:"hsl(var(--card))",color:"hsl(var(--foreground))"},children:t.placeholder??"\u2014 Select \u2014"}),l.map(f=>(0,e.jsx)("option",{value:f,style:{backgroundColor:"hsl(var(--card))",color:"hsl(var(--foreground))"},children:f},f))]}),(0,e.jsx)(pe,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"})]})}if(t.type==="multiselect"){let l=t.options??["Option A","Option B","Option C"],f=n?new Set:new Set((a||"").split(",").filter(Boolean));return(0,e.jsx)("div",{className:c("flex flex-col gap-1 p-2 rounded-xl border bg-white/5",L,n&&"pointer-events-none"),children:l.map(E=>{let G=f.has(E);return(0,e.jsxs)("label",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg hover:bg-white/5 cursor-pointer transition-colors",children:[(0,e.jsx)("input",{type:"checkbox",checked:G,onChange:()=>{let j=new Set(f);G?j.delete(E):j.add(E),i?.(t.id,[...j].join(","))},className:"accent-primary w-4 h-4"}),(0,e.jsx)("span",{className:"text-sm text-foreground",children:E})]},E)})})}if(t.type==="hidden")return n?(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-zinc-500/10 border border-zinc-500/20",children:[(0,e.jsx)(Ue,{className:"w-3.5 h-3.5 text-zinc-400"}),(0,e.jsx)("span",{className:"text-xs text-zinc-400 italic",children:"Hidden field \u2014 not shown to users"})]}):(0,e.jsx)("input",{type:"hidden",value:a,onChange:l=>i?.(t.id,l.target.value)});if(t.type==="readonly")return(0,e.jsx)("div",{className:"px-3 py-2.5 rounded-xl border border-white/10 bg-white/[0.02] text-sm text-foreground
5/70",children:t.content??t.placeholder??"Read-only text will appear here."});if(t.type==="calculated")return(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 rounded-xl border border-cyan-500/20 bg-cyan-500/5",children:[(0,e.jsx)(Le,{className:"w-4 h-4 text-cyan-400 shrink-0"}),(0,e.jsx)("span",{className:"text-xs text-cyan-400/80 font-mono",children:t.formula?`= ${t.formula}`:"Formula not set"})]});if(t.type==="conditional"||t.type==="multicondition")return(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-yellow-500/20 bg-yellow-500/5",children:[(0,e.jsx)(re,{className:"w-3.5 h-3.5 text-yellow-400"}),(0,e.jsxs)("span",{className:"text-xs text-yellow-400",children:[t.type==="multicondition"?"Multiple conditions":"Conditional logic"," \u2014 configure in field settings"]})]});if(t.type==="rating"){let l=n?0:parseInt(a||"0");return(0,e.jsx)("div",{className:"flex gap-1",children:[1,2,3,4,5].map(f=>(0,e.jsx)("button",{type:"button",onClick:n?void 0:()=>i?.(t.id,String(f===l?0:f)),className:c("transition-colors",n&&"cursor-default pointer-events-none"),children:(0,e.jsx)($e,{className:c("w-6 h-6",f<=l?"fill-yellow-400 text-yellow-400":"text-white/20")})},f))})}if(t.type==="captcha")return(0,e.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border border-rose-500/20 bg-rose-500/5",children:[(0,e.jsx)(he,{className:"w-5 h-5 text-rose-400 shrink-0"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-xs font-medium text-rose-400",children:"reCAPTCHA / Anti-bot verification"}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:"Shown at form submission"})]})]});if(t.type==="sectionheader")return(0,e.jsxs)("div",{className:"pt-2 pb-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(Ne,{className:"w-4 h-4 text-primary/70 shrink-0"}),(0,e.jsx)("span",{className:"text-sm font-semibold text-foreground",children:t.label})]}),t.description&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 ml-6",children:t.description})]});if(t.type==="instruction")return(0,e.jsxs)("div",{className:"flex gap-2.5 px-3 py-2.5 rounded-xl border border-blue-500/15 bg-blue-500/5",children:[(0,e.jsx)(ve,{className:"w-4 h-4 text-blue-400 shrink-0 mt-0.5"}),(0,e.jsx)("p",{className:"text-xs text-blue-300/80 leading-relaxed",children:t.content??t.description??"Enter your help text here\u2026"})]});if(t.type==="divider")return(0,e.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,e.jsx)("div",{className:"flex-1 h-px bg-white/10"}),t.label&&t.label!=="Divider"&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground/50 uppercase tracking-widest px-1",children:t.label}),(0,e.jsx)("div",{className:"flex-1 h-px bg-white/10"})]});let S={email:"email",tel:"tel",number:"number",date:"date",datetime:"datetime-local",time:"time",url:"url",password:"password"};if(t.type==="text"&&/address/i.test(t.label)&&!n)return(0,e.jsx)(me,{value:a,onChange:l=>i?.(t.id,l),onSelect:l=>{i?.(t.id,l.streetLine||l.displayName),A?.(l)},placeholder:t.placeholder??"Start typing an address\u2026",error:!!u});let k=Ge(t.label,t.type);return k&&!n?(0,e.jsx)("input",{type:"text",inputMode:"numeric",placeholder:t.placeholder??k.placeholder,value:a,maxLength:k.maxLength,onChange:l=>i?.(t.id,k.mask(l.target.value)),className:c(g,L,"font-mono tracking-wider")}):(0,e.jsx)("input",{type:S[t.type]??"text",placeholder:t.placeholder,value:n?"":a,readOnly:n,onChange:l=>i?.(t.id,l.target.value),className:c(g,L,n&&"pointer-events-none")})},T=new Set(["step","sectionheader","divider","instruction","captcha"]),Z={step:(0,e.jsx)(We,{className:"w-3.5 h-3.5"}),sectionheader:(0,e.jsx)(Ne,{className:"w-3.5 h-3.5"}),divider:(0,e.jsx)(_e,{className:"w-3.5 h-3.5"}),instruction:(0,e.jsx)(ve,{className:"w-3.5 h-3.5"}),captcha:(0,e.jsx)(he,{className:"w-3.5 h-3.5"})},ee={step:"border-primary/20 bg-primary/5 text-primary",sectionheader:"border-violet-500/20 bg-violet-500/5 text-violet-400",divider:"border-white/10 bg-white/[0.02] text-muted-foreground",instruction:"border-blue-500/20 bg-blue-500/5 text-blue-400",captcha:"border-rose-500/20 bg-rose-500/5 text-rose-400"};
5if(T.has(t.type)){if(n){let S=Z[t.type]??(0,e.jsx)(He,{className:"w-3.5 h-3.5"}),_=ee[t.type]??"border-primary/20 bg-primary/5 text-primary";return(0,e.jsxs)("div",{ref:R,className:c("flex items-center gap-3 px-3 py-2.5 rounded-xl border",_),children:[(0,e.jsx)("span",{className:"shrink-0",children:S}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("span",{className:"text-xs font-bold uppercase tracking-widest truncate block",children:t.label}),t.description&&(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground truncate block",children:t.description}),t.content&&(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground/70 truncate block italic",children:t.content})]}),(0,e.jsxs)("button",{onClick:x,className:c("flex items-center gap-1 px-2 py-1 rounded-lg border text-[11px] font-medium transition-all shrink-0",o?"bg-primary/20 border-primary/50 text-primary":"bg-white/5 border-white/10 text-muted-foreground hover:border-primary/40 hover:text-primary"),children:[(0,e.jsx)(de,{className:"w-3 h-3"})," Edit"]}),(0,e.jsx)(te,{children:o&&m&&I&&v&&(0,e.jsx)(Ze,{field:t,anchorRef:R,onChange:m,onDelete:I,onDuplicate:v,onClose:h??(()=>{}),onMoveToStep:p,availableSteps:y,allFieldIds:z,allFields:M})})]})}return(0,e.jsx)("div",{className:"col-span-4",children:Y()})}if(n){let S=t.colSpan??4,_=Ee.find(k=>k.value===S)?.tip??"Full width";return(0,e.jsxs)("div",{ref:W,className:"relative group/card",children:[(0,e.jsxs)("div",{ref:R,className:c("flex items-center gap-3 px-3 py-2.5 rounded-xl border bg-white/[0.03] hover:border-white/20 transition-colors",N?"border-primary/40 bg-primary/[0.04]":"border-white/10"),children:[q&&(0,e.jsx)("div",{className:"shrink-0",children:(0,e.jsx)("button",{type:"button",onClick:k=>{k.stopPropagation(),q(!N,k.shiftKey)},"aria-label":N?"Deselect field":"Select field (Shift+click to select range)",title:N?"Deselect":"Select \xB7 Shift+click to select range",className:c("w-4 h-4 rounded flex items-center justify-center border transition-all",N?"bg-primary border-primary text-primary-foreground":"bg-white/5 border-white/20 hover:border-primary/50"),children:N&&(0,e.jsx)("svg",{viewBox:"0 0 10 8",className:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("polyline",{points:"1,4 3.5,6.5 9,1"})})})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-foreground truncate",children:[t.label,t.required&&(0,e.jsx)("span",{className:"text-red-400 ml-0.5",children:"*"})]}),(0,e.jsx)("span",{className:"text-[9px] text-muted-foreground/40 shrink-0",children:et.find(k=>k.value===t.type)?.label??t.type})]}),t.placeholder&&!["consent","terms"].includes(t.type)&&(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground/60 truncate block",children:t.placeholder}),(t.content??t.formula)&&(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground/50 italic truncate block",children:t.content??t.formula})]}),(0,e.jsx)("span",{className:"text-[9px] text-muted-foreground/40 shrink-0 tabular-nums",children:_}),(0,e.jsxs)("button",{type:"button",title:B?"Close condition editor":t.conditionalOn?.fieldId?"Edit condition":"Add condition",onClick:k=>{k.stopPropagation(),$(l=>!l)},className:c("flex items-center gap-1 px-2 py-1 rounded-lg border text-[11px] font-medium transition-all shrink-0",B?"bg-amber-500/20 border-amber-500/40 text-amber-300":t.conditionalOn?.fieldId?"bg-amber-500/10 border-amber-500/25 text-amber-400 hover:bg-amber-500/20":"bg-white/5 border-white/10 text-muted-foreground hover:border-amber-500/30 hover:text-amber-400"),children:[(0,e.jsx)(re,{className:"w-3 h-3"}),t.conditionalOn?.fieldId&&!B&&(0,e.jsx)("span",{children:"If"})]}),(0,e.jsxs)("button",{onClick:x,className:c("flex items-center gap-1 px-2 py-1 rounded-lg border text-[11px] font-medium transition-all shrink-0",o?"bg-primary/20 border-primary/50 text-primary":"bg-white/5 border-white/10 text-muted-foreground hover:border-primary/40 hover:text-primary"),children:[(0,e.jsx)(de,{className:"w-3 h-3"})," Edit"]}),(0,e.jsx)(te,{children:o&&m&&I&&v&&(0,e.jsx)(Ze,{field:t,anchorRef:R,onChange:m,onDelete:I,onDuplicate:v,onClose:h??(()=>{}
5),onMoveToStep:p,availableSteps:y,allFieldIds:z,allFields:M})})]}),(0,e.jsx)(te,{children:B&&m&&(0,e.jsx)(ut,{field:t,allFields:M,onChange:m,onClose:()=>$(!1)})}),(0,e.jsx)("div",{onPointerDown:b,title:"Drag to resize",className:c("absolute right-0 top-0 bottom-0 w-4 flex items-center justify-center","opacity-0 group-hover/card:opacity-100 transition-opacity duration-150","cursor-col-resize rounded-r-xl","hover:bg-primary/10"),children:(0,e.jsx)(we,{className:"w-3 h-3 text-muted-foreground/50 rotate-90"})})]})}let r=bt(t.colSpan);return(0,e.jsxs)("div",{className:c("flex flex-col gap-1.5",r),children:[(0,e.jsx)("div",{className:"flex items-center gap-1.5",children:(0,e.jsxs)("label",{className:"text-xs font-medium text-muted-foreground",children:[t.label,t.required&&(0,e.jsx)("span",{className:"text-red-400 ml-0.5",children:"*"})]})}),(0,e.jsx)("div",{className:"relative",children:Y()}),u&&(0,e.jsxs)("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[(0,e.jsx)(ue,{className:"w-3 h-3"})," ",u]})]})}function xt({step:t,total:a,onStepClick:u}){let i=a>1?Math.round(t/(a-1)*100):100;return(0,e.jsxs)("div",{className:"mb-5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1.5",children:[(0,e.jsxs)("span",{children:["Step ",t+1," of ",a]}),(0,e.jsxs)("span",{children:[i,"%"]})]}),(0,e.jsx)("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:(0,e.jsx)(V.div,{className:"h-full bg-gradient-to-r from-primary to-primary/60 rounded-full",initial:!1,animate:{width:`${i}%`},transition:{type:"spring",stiffness:200,damping:30}})}),a>1&&(0,e.jsx)("div",{className:"flex justify-between mt-2 px-0.5",children:Array.from({length:a}).map((n,o)=>{let x=o<=t;return(0,e.jsx)("button",{type:"button",disabled:!x||!u,onClick:()=>u?.(o),title:`Go to step ${o+1}`,className:c("rounded-full transition-all duration-200",o<t?"w-1.5 h-1.5 bg-primary cursor-pointer hover:scale-125 hover:ring-2 hover:ring-primary/40":"",o===t?"w-2 h-2 bg-primary scale-125 cursor-default":"",o>t?"w-1.5 h-1.5 bg-white/20 cursor-not-allowed":"")},o)})})]})}function ht({fields:t,allFields:a,builderMode:u=!1,onFieldChange:i,onFieldDelete:n,onFieldDuplicate:o,onFieldMoveToStep:x,availableSteps:m,selectedFieldIds:I,onFieldSelect:v,values:h={},errors:p={},onValueChange:y,stepIdx:N=0,totalSteps:q,onNext:z,onPrev:M,onSubmit:A,submitting:R=!1,isLastStep:W=!1,onStepJump:B}){let[$,d]=(0,w.useState)(null),P=mt(t),F=q??P.length,H=t,J=a??H,K=b=>{u&&d(g=>g===b?null:b)},X=(b,g)=>{i?.(b,g)};if(u)return(0,e.jsx)(e.Fragment,{children:H.map((b,g)=>{if(b.enabled===!1)return null;let L=$===g,Y=I?.has(b.id)??!1;return(0,e.jsx)(Qe,{field:b,builderMode:!0,isSelected:L,onSelect:()=>K(g),onFieldChange:T=>X(g,T),onDelete:()=>{n?.(g),d(null)},onDuplicate:()=>{o?.(g),d(null)},onCloseEditor:()=>d(null),onMoveToStep:x?T=>{x(g,T),d(null)}:void 0,availableSteps:m,isChecked:Y,onCheckToggle:v?(T,Z)=>v(b.id,T,Z):void 0,allFieldIds:J.map(T=>T.id),allFields:J},b.id)})});let s=P[N];return s?(0,e.jsxs)("div",{children:[F>1&&(0,e.jsx)(xt,{step:N,total:F,onStepClick:B}),(0,e.jsx)(te,{mode:"wait",children:(0,e.jsxs)(V.div,{initial:{opacity:0,x:24},animate:{opacity:1,x:0},exit:{opacity:0,x:-24},transition:{duration:.2},children:[s.header&&(0,e.jsxs)("div",{className:"mb-5",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:s.header.label}),s.header.description&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground mt-0.5",children:s.header.description})]}),(0,e.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-x-4 gap-y-4",children:s.fields.filter(b=>Xe(b,h)).map(b=>(0,e.jsx)(Qe,{field:b,value:h[b.id]??"",error:p[b.id],onValueChange:y,onAddressSelect:g=>{[[["pmu-city","ep-city"],g.city],[["pmu-state","ep-state"],g.state],[["pmu-zip","pmu-zipcode","ep-zip"],g.zip]].forEach(([Y,T])=>{Y.forEach(Z=>{let ee=t.find(r=>r.id===Z);ee&&Xe(ee,h)&&y?.(Z,T)})})}},b.id))})]},N)}),(z||M||A)&&(0,e.jsxs)("div",{className:"flex items-center justify-between mt-8 pt-5 border-t border-white/10",children:[(0,e.jsxs)("button",{type:"button",onClick:M,disabled:N===0,className:"flex items-center gap-1.5 px-4 py-2 rounded-xl bg-white/5 border border-white/10 text-sm text-foreground hover:bg-white/10 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:[(0,e.jsx)(Re,{className:"w-4 h-4"})," Back"]}),W?(0,e.jsxs)("button",{type:"button",onClick:A,disabled:R,className:"flex items-center gap-2 px-6 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 transition-opacity disabled:opacity-50",children:[R?(0,e.jsx)(ne,{className:"w-4 h-4 animate-spin"}):(0,e.jsx)(ye,{className:"w-4 h-4"}),R?"Submitting\u2026":"Submit Intake"]}):(0,e.jsxs)("button",{type:"button",onClick:z,className:"flex items-center gap-1.5 px-5 py-2.5 rounded-xl bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 transition-colors",children:["Continue ",(0,e.jsx)(Te,{className:"w-4 h-4"})]})]})]}):null}export{wt as a,Xe as b,mt as c,ht as d};
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.