1import{k as I,u as G,r as c,t as d,j as e,h as A,X as H}from"./index-SqMiCr_X.js";import{u as L}from"./useServerFn-rX6y8BTq.js";import{u as _}from"./useMutation-BjeI5N7a.js";import{u as D,s as O,P as W}from"./contact.functions-DAsL9mr8.js";import{C as X}from"./circle-check-C_EmBVpS.js";import{C as U}from"./circle-alert-BxkpgLwS.js";const Y=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],J=I("send",Y),u=5,K=5*1024*1024,P=["image/png","image/jpeg","image/jpg","image/webp","image/gif","application/pdf","text/plain"];function Q(t){return new Promise((o,a)=>{const n=new FileReader;n.onload=()=>{const m=n.result.split(",")[1]??"";o(m)},n.onerror=()=>a(new Error("Failed to read file")),n.readAsDataURL(t)})}const S={"pt-BR":{eyebrow:"Fale conosco",title:"Manda a real pra gente",intro:t=>`Bug, ideia, feedback ou só quer trocar uma ideia? Escreve aqui. Pode anexar prints (PNG/JPG/WebP/GIF), PDFs ou .txt â até ${t} arquivos de 5MB cada. Suas mensagens ficam guardadas na sua conta.`,sentTitle:"Mensagem enviada",sentBody:t=>`Recebemos sua mensagem (id ${t}). A gente lê tudo e responde por email quando faz sentido.`,sendAnother:"Enviar outra",subjectLabel:"Assunto",subjectPh:"Ex: bug ao salvar abas no workspace X",subjectHelp:t=>`${t}/140 · mÃnimo 3 caracteres`,bodyLabel:"Mensagem",bodyPh:"Conta o que aconteceu, o que esperava, e o que apareceu. Quanto mais detalhe (passo a passo + print), mais rápido a gente resolve.",bodyHelp:t=>`${t}/5000 · mÃnimo 10 caracteres`,attachLabel:"Anexos (opcional)",attachMeta:(t,o)=>`${t}/${o} · até 5MB cada`,attachBtn:"Anexar arquivo",removeAria:t=>`Remover ${t}`,footerNote:"Sua mensagem é vinculada à sua conta â não compartilhamos com terceiros.",send:"Enviar",sendOk:"Mensagem enviada â obrigado!",sendErr:"Falha ao enviar mensagem",sendFail:"Falha ao enviar",maxFilesErr:t=>`Máximo de ${t} arquivos`,badMime:t=>`Formato não permitido: ${t}`,tooBig:t=>`${t} é maior que 5MB`,uploadFail:"Falha no upload"},en:{eyebrow:"Contact us",title:"Tell us what's up",intro:t=>`Bug, idea, feedback or just want to chat? Drop it here. Attach screenshots (PNG/JPG/WebP/GIF), PDFs or .txt â up to ${t} files of 5MB each. Your messages stay tied to your account.`,sentTitle:"Message sent",sentBody:t=>`We received your message (id ${t}). We read every one and reply by email when it makes sense.`,sendAnother:"Send another",subjectLabel:"Subject",subjectPh:"Ex: bug saving tabs in workspace X",subjectHelp:t=>`${t}/140 · min 3 characters`,bodyLabel:"Message",bodyPh:"Tell us what happened, what you expected, and what showed up. The more detail (step-by-step + screenshot), the faster we fix it.",bodyHelp:t=>`${t}/5000 · min 10 characters`,attachLabel:"Attachments (optional)",attachMeta:(t,o)=>`${t}/${o} · up to 5MB each`,attachBtn:"Attach file",removeAria:t=>`Remove ${t}`,footerNote:"Your message is linked to your account â we do not share it with third parties.",send:"Send",sendOk:"Message sent â thanks!",sendErr:"Failed to send message",sendFail:"Failed to send",maxFilesErr:t=>`Maximum of ${t} files`,badMime:t=>`Format not allowed: ${t}`,tooBig:t=>`${t} is larger than 5MB`,uploadFail:"Upload failed"}};function re(){const{i18n:t}=G(),a=t.language.toLowerCase().startsWith("en")?S.en:S["pt-BR"],n=L(D),j=L(O),[m,k]=c.useState(""),[b,N]=c.useState(""),[l,h]=c.useState([]),[w,F]=c.useState(!1),[M,C]=c.useState(null),p=c.useRef(null),i=_({mutationFn:async()=>j({data:{subject:m.trim(),body:b.trim(),attachments:l,userAgent:navigator.userAgent.
1slice(0,400)}}),onSuccess:s=>{C({id:s.id}),k(""),N(""),h([]),d.success(a.sendOk)},onError:s=>{d.error(s instanceof Error?s.message:a.sendErr)}});async function $(s){if(!s||s.length===0)return;const x=u-l.length;if(x<=0){d.error(a.maxFilesErr(u));return}const y=Array.from(s).slice(0,x);F(!0);try{for(const r of y){if(!P.includes(r.type)){d.error(a.badMime(r.name));continue}if(r.size>K){d.error(a.tooBig(r.name));continue}const v=await Q(r),R=await n({data:{filename:r.name,mime:r.type,dataBase64:v}});h(T=>[...T,R])}}catch(r){d.error(r instanceof Error?r.message:a.uploadFail)}finally{F(!1),p.current&&(p.current.value="")}}const E=i.isPending||w,g=m.trim().length,f=b.trim().length,z=g>=3&&g<=140,q=f>=10&&f<=5e3,B=z&&q&&!E;return e.jsxs("div",{className:"mx-auto max-w-2xl px-6 py-12",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("p",{className:"mb-3 inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[11px] font-mono uppercase tracking-[0.18em]",style:{borderColor:"color-mix(in oklab, var(--gold) 35%, var(--border-default))",color:"var(--text-secondary)",background:"color-mix(in oklab, var(--surface) 60%, transparent)"},children:a.eyebrow}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight sm:text-4xl",children:a.title}),e.jsx("p",{className:"mt-2 max-w-xl text-sm",style:{color:"var(--text-secondary)"},children:a.intro(u)})]}),M?e.jsxs("div",{className:"rounded-2xl border p-6 text-sm",style:{borderColor:"color-mix(in oklab, var(--gold) 40%, var(--border-default))",background:"color-mix(in oklab, var(--gold) 8%, transparent)"},children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx(X,{className:"size-5",style:{color:"var(--gold)"}}),e.jsx("strong",{children:a.sentTitle})]}),e.jsx("p",{style:{color:"var(--text-secondary)"},children:a.sentBody(M.id.slice(0,8))}),e.jsx("button",{type:"button",onClick:()=>C(null),className:"mt-4 inline-flex h-10 items-center gap-2 rounded-lg border px-4 text-sm font-medium",style:{borderColor:"var(--border-default)"},children:a.sendAnother})]}):e.jsxs("form",{onSubmit:s=>{s.preventDefault(),B&&i.mutate()},className:"space-y-5 rounded-2xl border p-6",style:{borderColor:"var(--border-default)",background:"color-mix(in oklab, var(--surface) 60%, transparent)"},children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"contact-subject",className:"mb-1.5 block text-xs font-medium uppercase tracking-wider",style:{color:"var(--text-secondary)"},children:a.subjectLabel}),e.jsx("input",{id:"contact-subject",type:"text",value:m,onChange:s=>k(s.target.value),maxLength:140,placeholder:a.subjectPh,className:"h-11 w-full rounded-lg border bg-transparent px-3 text-sm outline-none transition focus:ring-2",style:{borderColor:"var(--border-default)",color:"var(--text-primary)"},required:!0}),e.jsx("p",{className:"mt-1 text-[11px]",style:{color:"var(--text-muted)"},children:a.subjectHelp(g)})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"contact-body",className:"mb-1.5 block text-xs font-medium uppercase tracking-wider",style:{color:"var(--text-secondary)"},children:a.bodyLabel}),e.jsx("textarea",{id:"contact-body",value:b,onChange:s=>N(s.target.value),maxLength:5e3,rows:8,placeholder:a.bodyPh,className:"w-full resize-y rounded-lg border bg-transparent p-3 text-sm leading-relaxed outline-none transition focus:ring-2",style:{borderColor:"var(--border-default)",color:"var(--text-primary)",minHeight:180},required:!0}),e.jsx("p",{className:"mt-1 text-[11px]",style:{color:"var(--text-muted)"},children:a.bodyHelp(f)})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[e.jsx("label",{className:"text-xs font-medium uppercase tracking-wider",style:{color:"var(--text-secondary)"},children:a.attachLabel}),e.jsx("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:a.attachMeta(l.length,u)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>p.current?.click(),disabled:l.length>=u||E,className:"inline-flex h-10 items-center gap-2 rounded-lg border px-4 text-sm font-medium transition hover:opacity-90 disabled:opacity-50",style:{borderColor:"var(--border-default)",background:"color-mix(in oklab, var(--surface) 70%, transparent)"},children:[w?e.jsx(A,{className:"size-4 animate-spin"}):e.jsx(W,{className:"size-4"}),a.attachBtn]}),e.jsx("input",{ref:p,type:"file",accept:P.join(","),multiple:!0,hidden:!0,onChange:s=>$(s.target.files)})]}),l.length>0&&e.jsx("ul",{className:"mt-3 space-y-2",children:l.map((s,x)=>e.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-lg border p-2.5",style:{borderColor:"var(--border-default)",background:"color-mix(in oklab, var(--surface) 70%, transparent)"},children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm",children:s.name}),e.jsxs("p",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:[(s.size/1024).toFixed(1)," KB · ",s.mime]})]}),e.jsx("button",{type:"button",onClick:()=>h(y=>y.filter((r,v)=>v!==x)),className:"grid size-8 place-items-center rounded-md border opacity-70 hover:opacity-100",style:{borderColor:"var(--border-default)"},"aria-label":a.removeAria(s.name),children:e.jsx(H,{className:"size-3.5"})})]},s.path))})]}),i.isError&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border p-3 text-xs",style:{borderColor:"color-mix(in oklab, #e85d3a 40%, transparent)",background:"color-mix(in oklab, #e85d3a 10%, transparent)",color:"#f8a890"},children:[e.jsx(U,{className:"mt-0.5 size-4 shrink-0"}),e.jsx("span",{children:i.error instanceof Error?i.error.message:a.sendFail})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 pt-2",children:[e.jsx("p",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:a.footerNote}),e.jsxs("button",{type:"submit",disabled:!B,className:"inline-flex h-11 items-center gap-2 rounded-lg px-5 text-sm font-semibold transition-opacity hover:opacity-90 disabled:opacity-50",style:{background:"var(--gold)",color:"var(--accent-fg)"},children:[i.isPending?e.jsx(A,{className:"size-4 animate-spin"}):e.jsx(J,{className:"size-4"}),a.send]})]})]})]})}export{re as component};
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.