1import{u as E,q as L,j as e,x as A,s as I,y as B}from"./index-DOfzRMJE.js";import{b as n}from"./react-vendor-lwQMHloj.js";import"./supabase-C5Ru29k3.js";const v="mt-1 w-full rounded-lg border border-slate-300 px-3 py-2.5 text-sm text-slate-800 outline-none focus:border-indigo-500",S="block text-sm font-medium text-slate-500",i="rounded-2xl border border-slate-200 bg-white",T=200,M=5e3;function G(){const{user:t}=E(),s=L(),[x,p]=n.useState(""),[l,u]=n.useState(""),[m,h]=n.useState(!1),[k,j]=n.useState(!1),[b,o]=n.useState(null),C=async a=>{a.preventDefault();const f=x.trim(),g=l.trim();if(!f||!g){o(s("support.errEmpty"));return}h(!0),o(null);const{error:c}=await I.functions.invoke("send-support-message",{body:{subject:f,message:g}});if(h(!1),c){let N="";const y=c.context;if(y instanceof Response)try{const w=await y.clone().json();N=w.message||w.error||""}catch{}o(N||B(c));return}p(""),u(""),j(!0)};return e.jsxs("div",{className:"mx-auto max-w-4xl",children:[e.jsxs("header",{children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-800",children:s("support.title")}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:s("support.subtitle")})]}),e.jsxs("div",{className:"mt-6 grid items-start gap-5 md:grid-cols-3",children:[k?e.jsxs("div",{className:`${i} animate-scale-in p-8 text-center md:col-span-2`,children:[e.jsx("span",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-50 text-green-600",children:e.jsx($,{})}),e.jsx("h2",{className:"mt-3 text-lg font-bold text-slate-800",children:s("support.sentTitle")}),e.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-slate-500",children:s("support.sentBody")}),e.jsx("button",{type:"button",onClick:()=>j(!1),className:"mt-5 inline-flex items-center rounded-lg border border-slate-300 bg-white px-3.5 py-2 text-sm font-semibold text-slate-700 transition hover:border-slate-400 hover:bg-slate-50",children:s("support.sendAnother")})]}):e.jsxs("form",{onSubmit:C,className:`${i} p-6 sm:p-7 md:col-span-2`,children:[b&&e.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-2.5 text-sm text-red-700",children:b}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:S,children:[s("support.subjectLabel"),e.jsx("input",{value:x,onChange:a=>p(a.target.value),maxLength:T,placeholder:s("support.subjectPlaceholder"),className:v})]}),e.jsxs("label",{className:S,children:[e.jsxs("span",{className:"flex items-baseline justify-between gap-2",children:[s("support.messageLabel"),e.jsxs("span",{className:"text-xs font-normal text-slate-400",children:[l.length,"/",M]})]}),e.jsx("textarea",{value:l,onChange:a=>u(a.target.value),rows:8,maxLength:M,placeholder:s("support.messagePlaceholder"),className:`${v} resize-none`})]})]}),e.jsxs("div",{className:"mt-5 flex flex-wrap items-center justify-between gap-3 border-t border-slate-100 pt-5",children:[t!=null&&t.email?e.jsx("span",{className:"text-sm text-slate-500",children:s("support.replyTo",{email:t.email})}):e.jsx("span",{}),e.jsxs("button",{type:"submit",disabled:m,className:`${A} gap-2 shadow-soft`,children:[e.jsx(R,{}),s(m?"support.sending":"support.send")]})]})]}),e.jsxs("aside",{className:`${i} p-6`,children:[e.jsx("h2",{className:"text-base font-bold text-slate-800",children:s("support.expectTitle")}),e.jsxs("ul",{className:"mt-4 space-y-4",children:[e.jsx(d,{icon:e.jsx(z,{}),children:s("support.expectEmail")}),e.jsx(d,{icon:e.jsx(D,{}),children:s("support.expectSpeed")}),e.jsx(d,{icon:e.jsx(P,{}),children:s("support.expectDetail")})]})]})]})]})}function d({icon:t,children:s}){return e.jsxs("li",{className:"flex items-start gap-3 text-sm text-slate-600",children:[e.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-indigo-50 text-indigo-600",children:t}),e.jsx("span",{className:"pt-1.5",children:s})]})}function r({children:t,className:s}){return e.jsx("svg",{className:s??"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t})}function $(){return e.jsx(r,{className:"h-6 w-6",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}function R(){return e.jsxs(r,{children:[e.jsx("path",{d:"M22 2 11 13"}),e.jsx("path",{d:"M22 2 15 22l-4-9-9-4z"})]})}function z(){return e.jsxs(r,{children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]})}function D(){return e.jsxs(r,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 6v6l4 2"})]})}function P(){return e.jsxs(r,{children:[e.jsx("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1.3.5 2.6 1.5 3.5.8.8 1.3 1.5 1.5 2.5"}),e.jsx("path",{d:"M9 18h6"}),e.jsx("path",{d:"M10 22h4"})]})}
1export{G 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.