import{u as g,o as j,r as u,j as e,B as h,s as p}from"./index-BL0y_fpc.js";import{I as m}from"./input-C0ZJbgJ-.js";import{T as f}from"./textarea-DH087kis.js";import{C as v,b as w,c as N,d as y,a as C}from"./card-CmTQIX9U.js";import{A as S}from"./arrow-left-BSJdqQAo.js";import{M as k}from"./mail-sgluXWmA.js";import{M as F}from"./message-square-b7ZiXcY2.js";import{S as q}from"./send-OP_rWq4V.js";import{o as M,s as r,Z as T}from"./types-3iKgNyo7.js";const E=M({name:r().trim().min(1,"Name is required").max(100,"Name must be less than 100 characters"),email:r().trim().email("Invalid email address").max(255,"Email must be less than 255 characters"),subject:r().trim().min(1,"Subject is required").max(200,"Subject must be less than 200 characters"),message:r().trim().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters"),website:r().optional()}),P=()=>{const x=g(),{toast:n}=j(),[a,l]=u.useState({name:"",email:"",subject:"",message:"",website:""}),[o,c]=u.useState(!1),b=async i=>{i.preventDefault(),c(!0);try{const s=E.parse(a),{error:d}=await p.functions.invoke("send-contact-email",{body:s});if(d)throw d;n({title:"Message sent!",description:"We'll get back to you as soon as possible."}),l({name:"",email:"",subject:"",message:"",website:""})}catch(s){s instanceof T?n({title:"Validation Error",description:s.errors[0].message,variant:"destructive"}):n({title:"Error",description:"Something went wrong. Please try again.",variant:"destructive"})}finally{c(!1)}},t=i=>{l(s=>({...s,[i.target.name]:i.target.value}))};return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-background to-primary/5",children:e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs(h,{variant:"ghost",onClick:()=>x("/"),className:"mb-6",children:[e.jsx(S,{className:"mr-2 h-4 w-4"}),"Back to Home"]}),e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4 bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent",children:"Get in Touch"}),e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Have a question or feedback? We'd love to hear from you."})]}),e.jsx("div",{className:"max-w-2xl mx-auto",children:e.jsxs(v,{children:[e.jsxs(w,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-5 w-5"}),"Contact Form"]}),e.jsx(y,{children:"Fill out the form below and we'll respond within 24 hours"})]}),e.jsx(C,{children:e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium mb-2",children:"Name"}),e.jsx(m,{id:"name",name:"name",value:a.name,onChange:t,placeholder:"Your name",required:!0,maxLength:100})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium mb-2",children:"Email"}),e.jsx(m,{id:"email",name:"email",type:"email",value:a.email,onChange:t,placeholder:"your.email@example.com",required:!0,maxLength:255})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"subject",className:"block text-sm font-medium mb-2",children:"Subject"}),e.jsx(m,{id:"subject",name:"subject",value:a.subject,onChange:t,placeholder:"What's this about?",required:!0,maxLength:200})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"message",className:"block text-sm font-medium mb-2",children:"Message"}),e.jsx(f,{id:"message",name:"message",value:a.message,onChange:t,placeholder:"Tell us more...",required:!0,maxLength:1e3,rows:6})]}),e.jsxs("div",{className:"hidden",children:[e.jsx("label",{htmlFor:"website",children:"Website"}),e.jsx(m,{id:"website",name:"website",type:"text",value:a.website,onChange:t,tabIndex:-1,autoComplete:"off"})]}),e.jsx(h,{type:"submit",className:"w-full",disabled:o,children:o?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"mr-2 h-4 w-4"}),"Send Message"]})})]})})]})})]})})};export{P as default};