1import{y as te,r as c,v as se,m as e,L as j,n as g,B as d,X as le,x as C}from"./index-CpSGH3si.js";import{C as v,b as P,c as S,a as _}from"./card--3jAFIY6.js";import{I as r}from"./input-CJQwYE0h.js";import{T as ie}from"./textarea-DnsCXU4p.js";import{L as i}from"./label-mxM2ZpWz.js";import{S as k,a as E,b as T,c as F,d as R}from"./select-DF7dIvp6.js";import{L as oe}from"./Logo-DmRSeVwj.js";import{W as re}from"./WhatsNextModal-m0z6Ym5z.js";import{i as H,E as ne}from"./emailValidator-CgDbf28y.js";import{v as L}from"./numericValidators-CORrfhZy.js";import{S as ce}from"./StatePicker-daNglNSY.js";import{C as I}from"./circle-check-big-BfTSBK82.js";import{A as de}from"./index-CtsrXVb9.js";import{m as b}from"./proxy-DFy_m_5J.js";import{A as O}from"./arrow-right-wWO7VtP3.js";import{I as me}from"./image-DhDYYEir.js";import{L as V}from"./loader-circle-CZ4nBqpt.js";import{U as M}from"./upload-Cxbl-Jr2.js";import{V as he}from"./video-BtzPO_re.js";import{A as Y}from"./arrow-left-BWOwnNcQ.js";import"./index-BdQq_4o_.js";import"./index-Bs3UMnWC.js";import"./index-Cy91vPlr.js";import"./chevron-up-xOaegNmi.js";import"./dialog-DjQOlXK_.js";const xe=[{value:"land_clearing",label:"Land Clearing"},{value:"excavation",label:"Excavation"},{value:"foundation",label:"Foundation"},{value:"framing",label:"Framing"},{value:"roofing",label:"Roofing"},{value:"siding",label:"Siding"},{value:"electrical",label:"Electrical"},{value:"plumbing",label:"Plumbing"},{value:"hvac",label:"HVAC"},{value:"drywall",label:"Drywall"},{value:"painting",label:"Painting"},{value:"flooring",label:"Flooring"},{value:"kitchen_remodel",label:"Kitchen Remodel"},{value:"bathroom_remodel",label:"Bathroom Remodel"},{value:"basement_finish",label:"Basement Finish"},{value:"deck_patio",label:"Deck & Patio"},{value:"landscaping",label:"Landscaping"},{value:"fencing",label:"Fencing"},{value:"general_renovation",label:"General Renovation"},{value:"new_construction",label:"New Construction"},{value:"other",label:"Other"}],pe=[{value:"asap",label:"As soon as possible"},{value:"within_week",label:"Within 1 week"},{value:"within_2_weeks",label:"Within 2 weeks"},{value:"within_month",label:"Within 1 month"},{value:"flexible",label:"I'm flexible"}],ue=[{value:"single_family",label:"Single Family Home"},{value:"multi_family",label:"Multi-Family"},{value:"condo",label:"Condo"},{value:"townhouse",label:"Townhouse"},{value:"commercial",label:"Commercial"},{value:"land",label:"Vacant Land"}];function ze(){te();const[o,m]=c.useState(1),[$,B]=c.useState(!1),n=new URLSearchParams(window.location.search),J=(()=>{try{return JSON.parse(n.get("project_images")||"[]")}catch{return[]}})(),[t,K]=c.useState({title:"",description:n.get("description")||"",project_type:n.get("project_type")||"",property_type:"single_family",homeowner_name:n.get("homeowner_name")||"",homeowner_email:n.get("homeowner_email")||"",homeowner_phone:n.get("homeowner_phone")||"",location_city:n.get("location_city")||"",location_state:n.get("location_state")||"",location_zip:n.get("location_zip")||"",desired_start_date:"",flexibility:"flexible",budget_min:"",budget_max:"",project_images:J,video_url:"",video_file:null}),[D,A]=c.useState(!1),[f,U]=c.useState(!1),[X,q]=c.useState(!1),y=X&&!H(t.homeowner_email)?ne:null,W=c.useRef(null),z=c.useRef(null),N=se({mutationFn:a=>C.entities.Project.create(a),onSuccess:()=>{B(!0)}}),s=(a,l)=>{K(x=>({...x,[a]:l}))},G=async a=>{A(!0);const l=[];for(const x of Array.from(a)){const{file_url:ae}=await C.integrations.Core.UploadFile({file:x});l.push(ae)}s("project_images",[...t.project_images,...l]),A(!1)},Z=async a=>{U(!0);const{file_url:l}=await C.integrations.Core.UploadFile({file:a});s("video_url",l),U(!1)},Q=a=>{s("project_images",t.project_images.filter((l,x)=>x!==a))},ee=()=>{const a={title:t.title,description:t.description,project_type:t.project_type,property_type:t.property_type,homeowner_name:t.homeowner_name,homeowner_email:t.homeowner_email,homeowner_phone:t.homeowner_phone,location_city:t.location_city,location_state:t.location_state,location_zip:t.location_zip,desired_start_date:t.desired_start_date||void 0,flexibility:t.flexibility,budget_min:t.budget_min?parseFloat(t.budget_min):void 0,budget_max:t.budget_max?parseFloat(t.budget_max):void 0,project_images:t.project_images.length>0?t.project_images:void 0,video_url:t.video_url||void 0,status:"posted"};N.mutate(a)},p=L.project_budget_min(t.budget_min),h=L.project_budget_max(t.budget_max),u=L.project_budget_order(t.budget_min,t.budget_max),w=()=>o===1?t.title&&t.project_type&&t.description:o===2?t.location_city&&t.location_state&&t.flexibility&&!p&&!h&&!u:o===3?t.homeowner_name&&t.homeowner_email&&H(t.homeowner_email):!0;return e.jsxs("div",{className:"min-h-screen bg-slate-50",children:[e.jsx("div",{className:"bg-white border-b border-slate-200",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-4 flex items-center justify-between",children:[e.jsx(j,{to:g("Home"),children:e.jsx(oe,{size:"default"})}),e.jsx(j,{to:g("Search"),className:"text-slate-600 hover:text-slate-900 transition-colors",children:"Find Contractors"})]})}),e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-12",children:[o<4&&e.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",children:[1,2,3].map(a=>e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center font-medium transition-colors ${a<o||a===o?"bg-green-600 text-white":"bg-slate-200 text-slate-500"}`,children:a<o?e.jsx(I,{className:"w-5 h-5"}):a}),a<3&&e.jsx("div",{className:`w-16 h-1 mx-2 rounded ${a<o?"bg-green-600":"bg-slate-200"}`})]},a))}),e.jsxs(de,{mode:"wait",children:[o===1&&e.jsx(b.div,{initial:{opacity:0,x:20}
1,animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:e.jsxs(v,{children:[e.jsxs(P,{className:"text-center",children:[e.jsx(S,{className:"text-2xl",children:"Tell us about your project"}),e.jsx("p",{className:"text-slate-500",children:"Help contractors understand what you need"})]}),e.jsxs(_,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Project Title"}),e.jsx(r,{placeholder:"e.g., Kitchen Remodel in Denver",value:t.title,onChange:a=>s("title",a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Type of Work Needed"}),e.jsxs(k,{value:t.project_type,onValueChange:a=>s("project_type",a),children:[e.jsx(E,{children:e.jsx(T,{placeholder:"Select a category"})}),e.jsx(F,{children:xe.map(a=>e.jsx(R,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Property Type"}),e.jsxs(k,{value:t.property_type,onValueChange:a=>s("property_type",a),children:[e.jsx(E,{children:e.jsx(T,{})}),e.jsx(F,{children:ue.map(a=>e.jsx(R,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Project Description"}),e.jsx(ie,{placeholder:"Describe your project in detail. What work needs to be done? Any specific requirements?",value:t.description,onChange:a=>s("description",a.target.value),rows:4})]}),e.jsxs(d,{onClick:()=>m(2),disabled:!w(),className:"w-full bg-green-600 hover:bg-green-700",children:["Continue",e.jsx(O,{className:"w-4 h-4 ml-2"})]})]})]})},"step1"),o===2&&e.jsx(b.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:e.jsxs(v,{children:[e.jsxs(P,{className:"text-center",children:[e.jsx(S,{className:"text-2xl",children:"Location & Timeline"}),e.jsx("p",{className:"text-slate-500",children:"When and where do you need the work done?"})]}),e.jsxs(_,{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"City"}),e.jsx(r,{placeholder:"Denver",value:t.location_city,onChange:a=>s("location_city",a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"State"}),e.jsx(ce,{value:t.location_state,onChange:a=>s("location_state",a)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"ZIP Code"}),e.jsx(r,{placeholder:"80202",value:t.location_zip,onChange:a=>s("location_zip",a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Desired Start Date"}),e.jsx(r,{type:"date",value:t.desired_start_date,onChange:a=>s("desired_start_date",a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"How flexible is y
1our timeline?"}),e.jsxs(k,{value:t.flexibility,onValueChange:a=>s("flexibility",a),children:[e.jsx(E,{children:e.jsx(T,{})}),e.jsx(F,{children:pe.map(a=>e.jsx(R,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Budget Min ($)"}),e.jsx(r,{type:"number",placeholder:"5000",value:t.budget_min,onChange:a=>s("budget_min",a.target.value),className:p?"border-red-500":""}),p&&e.jsx("p",{className:"text-xs text-red-600",children:p})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Budget Max ($)"}),e.jsx(r,{type:"number",placeholder:"15000",value:t.budget_max,onChange:a=>s("budget_max",a.target.value),className:h||u?"border-red-500":""}),h&&e.jsx("p",{className:"text-xs text-red-600",children:h}),!h&&u&&e.jsx("p",{className:"text-xs text-red-600",children:u})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{className:"flex items-center gap-1.5",children:[e.jsx(me,{className:"w-4 h-4 text-slate-400"}),"Project Photos ",e.jsx("span",{className:"text-slate-400 font-normal",children:"(optional)"})]}),e.jsx("p",{className:"text-xs text-slate-500",children:"Upload photos of the area or existing conditions to help contractors understand the job."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.project_images.map((a,l)=>e.jsxs("div",{className:"relative w-20 h-20",children:[e.jsx("img",{src:a,alt:"",className:"w-full h-full object-cover rounded-lg border border-slate-200"}),e.jsx("button",{onClick:()=>Q(l),className:"absolute -top-1.5 -right-1.5 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center",children:e.jsx(le,{className:"w-3 h-3"})})]},l)),e.jsx("button",{onClick:()=>{var a;return(a=W.current)==null?void 0:a.click()},disabled:D,className:"w-20 h-20 border-2 border-dashed border-slate-300 rounded-lg flex flex-col items-center justify-center text-slate-400 hover:border-green-400 hover:text-green-500 transition-colors",children:D?e.jsx(V,{className:"w-5 h-5 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(M,{className:"w-5 h-5"}),e.jsx("span",{className:"text-xs mt-1",children:"Add"})]})})]}),e.jsx("input",{ref:W,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:a=>{var l;return((l=a.target.files)==null?void 0:l.length)&&G(a.target.files)}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{className:"flex items-center gap-1.5",children:[e.jsx(he,{className:"w-4 h-4 text-slate-400"}),"Project Video ",e.jsx("span",{className:"text-slate-400 font-normal",children:"(optional)"})]}),e.jsx("p",{className:"text-xs text-slate-500",children:"Paste a YouTube link or upload a short video walkthrough."}),e.jsx(r,{placeholder:"https://youtube.com/watch?v=... or leave blank to upload a file",value:t.video_url.startsWith("http")&&!t.video_url.includes("supabase")?t.video_url:"",onChange:a=>s("video_url",a.target.value)}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{var a;return(a=z.current)==null?void 0:a.click()},disabled:f,className:"flex items-center gap-1.5 text-sm text-slate-500 hover:text-green-600 transition-colors",children:[f?e.jsx(V,{className:"w-4 h-4 animate-spin"}):e.jsx(M,{className:"w-4 h-4"}),f?"Uploading...":"Or upload a video file"]}),t.video_url&&e.jsxs("span",{className:"text-xs text-green-600 flex items-center gap-1",children:[e.jsx(I,{className:"w-3.5 h-3.5"})," Video added"]})]}),e.jsx("input",{ref:z,type:"file",accept:"video/*",className:"hidden",onChange:a=>{var l;return((l=a.target.files)==null?void 0:l[0])&&Z(a.target.files[0])}})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(d,{variant:"outline",onClick:()=>m(1),className:"flex-1",children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(d,{onClick:()=>m(3),disabled:!w(),className:"flex-1 bg-green-600 hover:bg-green-700",children:["Continue",e.jsx(O,{className:"w-4 h-4 ml-2"})]})]})]})]})},"step2"),o===3&&e.jsx(b.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:e.jsxs(v,{children:[e.jsxs(P,{className:"text-center",children:[e.jsx(S,{className:"text-2xl",children:"Your Contact Info"}),e.jsx("p",{className:"text-slate-500",children:"How should contractors reach you?"})]}),e.jsxs(_,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Your Name"}),e.jsx(r,{placeholder:"John Smith",value:t.homeowner_name,onChange:a=>s("homeowner_name",a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Email"}),e.jsx(r,{type:"email",placeholder:"[email protected]",value:t.homeowner_email,onChange:a=>s("homeowner_email",a.target.value),onBlur:()=>q(!0),className:y?"border-red-500 focus-visible:ring-red-500":""}),y&&e.jsx("p",{className:"text-xs text-red-600",children:y})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Phone Number"}),e.jsx(r,{type:"tel",placeholder:"(555) 123-4567",value:t.homeowner_phone,onChange:a=>s("homeowner_phone",a.target.value)})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(d,{variant:"outline",onClick:()=>m(2),className:"flex-1",children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(d,{onClick:ee,disabled:!w()||N.isPending,className:"flex-1 bg-green-600 hover:bg-green-700",children:[N.isPending?e.jsx(V,{className:"w-4 h-4 mr-2 animate-spin"}):null,"Post Project"]})]})]})]})},"step3"),o===4&&e.jsx(b.div,{initial:{opacity:0,scale:.95}
1,animate:{opacity:1,scale:1},children:e.jsx(v,{className:"text-center",children:e.jsxs(_,{className:"py-12",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-green-100 flex items-center justify-center mx-auto mb-6",children:e.jsx(I,{className:"w-10 h-10 text-green-600"})}),e.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Project Posted!"}),e.jsx("p",{className:"text-slate-600 mb-8 max-w-md mx-auto",children:"Your project is now live. Contractors matching your criteria will be able to see it and reach out to you."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[e.jsx(j,{to:g("Search"),children:e.jsx(d,{variant:"outline",children:"Browse Contractors"})}),e.jsx(j,{to:g("Home"),children:e.jsx(d,{className:"bg-green-600 hover:bg-green-700",children:"Back to Home"})})]})]})})},"step4")]})]}),e.jsx(re,{open:$,onDismiss:()=>{B(!1),m(4)},prefillData:{project_type:t.project_type,description:t.description,location_city:t.location_city,location_state:t.location_state,location_zip:t.location_zip,project_images:t.project_images,homeowner_name:t.homeowner_name,homeowner_email:t.homeowner_email,homeowner_phone:t.homeowner_phone}})]})}export{ze 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.