1import{j as e}from"./vendor-markdown-C-I3nZWo.js";import{r}from"./vendor-charts-DphG3eWF.js";import{X as T,s as f,r as E,V as g,Y as F,Z as w,_ as C,$ as q,a0 as o,B as h,a3 as i}from"./index-DFoQxP2Z.js";import{T as B}from"./textarea-DyjusVvx.js";import{o as M,e as U,s as m,l as V}from"./vendor-forms-Crpao7PO.js";import"./vendor-office-CYA1a3lH.js";import"./vendor-query-Csct0vqx.js";import"./vendor-radix-DiGlQgnh.js";import"./vendor-icons-DptrxPFP.js";import"./vendor-supabase-C6T5JIOu.js";import"./vendor-analytics-4JMxWFgu.js";const _="Protein OS Contact",I=M({type:U(["question","feedback","feature"]),message:m().trim().min(1,"Message is required").max(5e3),fromName:m().trim().max(100).optional(),fromEmail:m().trim().email().max(255).optional().or(V(""))}),Z=()=>{const b=T(),[c,j]=r.useState("feedback"),[l,d]=r.useState(""),[y,S]=r.useState(""),[v,k]=r.useState(""),[u,p]=r.useState(!1);r.useEffect(()=>{f.auth.getUser().then(({data:{user:a}})=>{if(!a)return;k(a.email??"");const s=a.user_metadata;S((s==null?void 0:s.full_name)??(s==null?void 0:s.name)??"")})},[]);const N=async a=>{var x;a.preventDefault();const s=I.safeParse({type:c,message:l,fromName:y,fromEmail:v});if(!s.success){i.error(((x=s.error.issues[0])==null?void 0:x.message)??"Invalid input");return}p(!0);try{const{data:t,error:n}=await f.functions.invoke("submit-feedback",{body:{...s.data,subject:_,pageUrl:window.location.origin}});if(n||!(t!=null&&t.ok))throw new Error((n==null?void 0:n.message)||(t==null?void 0:t.error)||"Failed to send");i.success("Thanks â your message was sent"),d("")}catch(t){console.error(t),i.error(t instanceof Error?t.message:"Failed to send")}finally{p(!1)}};return e.jsx(E,{children:e.jsxs("div",{className:"max-w-2xl",children:[e.jsx("div",{className:"sticky z-30 -mx-4 sm:-mx-6 md:-mx-10 px-4 sm:px-6 md:px-10 pt-2 pb-3 bg-background border-b border-border",style:{top:"calc(3rem + env(safe-area-inset-top))"},children:e.jsx("h1",{className:"font-redaction italic text-2xl md:text-3xl text-foreground leading-none",children:"Contact"})}),e.jsx("p",{className:"text-sm text-muted-foreground mt-6",children:"Get in touch to share some feedback or suggest a feature:"}),e.jsxs("form",{onSubmit:N,className:"mt-6 space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"type",children:"Type"}),e.jsxs(F,{value:c,onValueChange:a=>j(a),children:[e.jsx(w,{id:"type",children:e.jsx(C,{})}),e.jsxs(q,{children:[e.jsx(o,{value:"feedback",children:"Feedback"}),e.jsx(o,{value:"feature",children:"Feature Request"}),e.jsx(o,{value:"question",children:"Something else â¦"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"message",children:"Message"}),e.jsx(B,{id:"message",value:l,onChange:a=>d(a.target.value),rows:8,maxLength:5e3,required:!0})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{type:"submit",disabled:u,children:u?"Sendingâ¦":"Send message"}),e.jsx(h,{type:"button",variant:"ghost",onClick:()=>b(-1),children:"Cancel"})]})]})]})})};export{Z 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.