1import{j as e,m as X}from"./motion-E8bh-rxW.js";import{i as ee,a as s,L as U}from"./react-vendor-CCERdhOQ.js";import{m as te,a6 as p,a7 as N,N as k,F as w,S as $,f as S,ai as z,o as ae}from"./app-CXTxfS1B.js";import{G as H}from"./GradientMesh-oVJRn1uv.js";import{B as Y}from"./button-CjDdYfOF.js";import{L as f,I as y}from"./label-DgXLgMQB.js";import{L as C}from"./loader-circle-Cb1Ce0oy.js";import{L as se}from"./lock-CwmtHosu.js";import{K as re}from"./key-round-Bg9rCIhy.js";import{A as le}from"./arrow-left-BrFWxdE5.js";import"./query-DrybJEaI.js";const ie=te("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),T={value:"card",label:"Payment card",fields:["Cardholder name","Card number","Expiry (MM/YY)","CVC","Billing ZIP"]},v=[{value:"login",label:"Login / password",fields:["Username","Password","URL"]},{value:"api_key",label:"API key",fields:["Service","API key","Secret"]},{value:"url",label:"URL / link",fields:["Label","URL"]},{value:"note",label:"Secure note",fields:["Note"]},{value:"other",label:"Other",fields:["Detail"]}],ve=()=>{const{token:r}=ee(),[d,_]=s.useState(null),[K,A]=s.useState(!0),[q,Z]=s.useState(!1),[m,L]=s.useState(""),[E,I]=s.useState(!1),[x,o]=s.useState(null),[l,P]=s.useState(null),[u,V]=s.useState("login"),[g,F]=s.useState(""),[R,c]=s.useState(v[0].fields.map(t=>({key:t,value:""}))),[D,M]=s.useState(!1),[J,B]=s.useState(!1);s.useEffect(()=>{r&&(A(!0),p.getVault(r).then(_).catch(t=>{t instanceof N&&t.status===404&&Z(!0)}).finally(()=>A(!1)))},[r]);const j=s.useCallback(async t=>{if(!(!r||!t.trim())){I(!0),o(null);try{const a=await p.verifyVault(r,t.trim());P(a),(a.cardAllowed??!1)&&!a.locked&&(V("card"),c(T.fields.map(i=>({key:i,value:""}))));try{localStorage.setItem(`vault:${r}`,t.trim())}catch{}}catch(a){o(a instanceof N?a.message:"Couldn't verify right now. Please try again.")}finally{I(!1)}}},[r]);s.useEffect(()=>{if(!r||l)return;let t="";try{t=localStorage.getItem(`vault:${r}`)??""}catch{}t&&(L(t),j(t))},[r,l,j]);const G=t=>{V(t),c(([T,...v].find(a=>a.value===t)?.fields??["Detail"]).map(a=>({key:a,value:""})))},O=l?.cardAllowed??d?.cardAllowed??!1,Q=O?[T,...v]:v,W=async()=>{if(!r)return;const t={};for(const a of R)a.key.trim()&&a.value.trim()&&(t[a.key.trim()]=a.value);if(!g.trim()){o("Add a label so the team knows what this is.");return}if(Object.keys(t).length===0){o("Fill in at least one field.");return}M(!0),o(null);try{await p.submitVault(r,m.trim(),[{category:u,label:g.trim(),fields:t}]),B(!0),F(""),G(u),P(await p.verifyVault(r,m.trim())),setTimeout(()=>B(!1),2500)}catch(a){o(a instanceof N?a.message:"Couldn't save. Please try again.")}finally{M(!1)}};return K?e.jsxs(e.Fragment,{children:[e.jsx(H,{}),e.jsx(k,{}),e.jsx("main",{className:"relative z-10 pt-32 pb-32",children:e.jsx("div",{className:"max-w-[640px] mx-auto px-6",children:e.jsx(C,{className:"w-5 h-5 animate-spin text-muted-foreground"})})}),e.jsx(w,{})]}):q||!d?e.jsxs(e.Fragment,{children:[e.jsx($,{robots:"noindex,nofollow",title:"Secure link unavailable | Trenith",description:""}),e.jsx(k,{}),e.jsxs("main",{className:"relative z-10 pt-32 pb-32 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Secure link unavailable"}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"This link may have expired or been disabled."}),e.jsx(U,{to:"/contact",className:"text-primary text-sm mt-4 inline-block hover:underline",children:"Contact Trenith"})]}),e.jsx(w,{})]}):e.jsxs(e.Fragment,{children:[e.jsx($,{robots:"noindex,nofollow",title:`Secure details, ${d.title} | Trenith`,description:"Securely share credentials and access with Trenith."}),e.jsx(H,{}),e.jsx(k,{}),e.jsx("main",{className:"relative z-10 pt-32 pb-32 bg-background/95",children:e.jsx("div",{className:"max-w-[680px] mx-auto px-6 md:px-10",children:e.jsxs(X.div,{initial:{opacity:0,y:12}
1,animate:{opacity:1,y:0},transition:{duration:.4},children:[e.jsxs("p",{className:"text-[11px] uppercase tracking-[0.16em] text-muted-foreground flex items-center gap-1.5",children:[e.jsx(S,{className:"w-3.5 h-3.5 text-primary"})," Secure vault"]}),e.jsx("h1",{className:"text-display text-3xl text-foreground mt-2",children:l?.title??d.title}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:O?"This is a one-time secure link for sharing one payment card with the Trenith team. Everything is encrypted and only visible to your Trenith contacts, and the link locks as soon as you submit.":"Share logins, API keys, and access details with the Trenith team. Everything is encrypted and only visible to your Trenith contacts. Please don't submit payment-card numbers here, cards are handled directly in the payment gateway or the tool that needs them."}),d.locked&&!l?e.jsx("p",{className:"mt-8 text-sm text-muted-foreground",children:"This link has already been used. Please ask Trenith for a new one."}):l?e.jsxs("div",{className:"mt-8 space-y-8",children:[l.locked&&e.jsx("p",{className:"rounded-lg border border-border bg-muted/40 p-3 text-xs text-muted-foreground",children:"This was a single-use link and has been submitted. Thank you, your details are with the team."}),!l.locked&&e.jsxs("section",{className:"rounded-xl border border-border bg-card/60 p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[e.jsx(re,{className:"w-4 h-4 text-primary"})," Add a credential"]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(f,{className:"text-xs",children:"Type"}),e.jsx("select",{value:u,onChange:t=>G(t.target.value),className:"w-full h-10 rounded-md border border-border bg-background px-3 text-sm",children:Q.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(f,{className:"text-xs",children:"Label"}),e.jsx(y,{value:g,onChange:t=>F(t.target.value),placeholder:u==="card"?"e.g. Business Visa for ad billing":"e.g. GoHighLevel login, analytics API key"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{className:"text-xs",children:"Details"}),R.map((t,a)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"w-1/3",value:t.key,onChange:i=>c(h=>h.map((n,b)=>b===a?{...n,key:i.target.value}:n)),placeholder:"Field"}),e.jsx(y,{className:"flex-1",value:t.value,onChange:i=>c(h=>h.map((n,b)=>b===a?{...n,value:i.target.value}:n)),placeholder:"Value",type:/password|cvc|secret/i.test(t.key)?"password":"text",autoComplete:"off"}),e.jsx("button",{type:"button",onClick:()=>c(i=>i.filter((h,n)=>n!==a)),"aria-label":"Remove field",className:"text-muted-foreground hover:text-foreground shrink-0 p-2",children:e.jsx(ie,{className:"w-4 h-4"})})]},a)),e.jsxs("button",{type:"button",onClick:()=>c(t=>[...t,{key:"",value:""}]),className:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline",children:[e.jsx(ae,{className:"w-3.5 h-3.5"})," Add field"]})]}),x&&e.jsxs("p",{className:"text-xs text-destructive flex items-start gap-1.5",children:[e.jsx(z,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),x]}),J&&e.jsxs("p",{className:"text-xs text-primary flex items-center gap-1.5",children:[e.jsx(S,{className:"w-3.5 h-3.5"})," Saved securely."]}),e.jsx(Y,{onClick:W,disabled:D,children:D?e.jsx(C,{className:"w-4 h-4 animate-spin"}):"Save securely"})]}),l.entries.length>0&&e.jsxs("section",{children:[e.jsx("h2",{className:"text-xs uppercase tracking-[0.14em] text-muted-foreground mb-3",children:"Already shared"}),e.jsx("div",{className:"space-y-2",children:l.entries.map(t=>e.jsxs("div",{className:"rounded-xl border border-border bg-card/60 p-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.label}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[t.category.toUpperCase(),t.preview?` · ${t.preview}`:""]})]}),e.jsx(S,{className:"w-4 h-4 text-primary shrink-0"})]},t.id))}),e.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:"For your security, saved values can't be shown again here, only your Trenith team can view them."})]}),e.jsxs(U,{to:"/",className:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline",children:[e.jsx(le,{className:"w-3.5 h-3.5"})," Back to Trenith"]})]}):e.jsx("form",{onSubmit:t=>{t.preventDefault(),j(m)},className:"mt-8 max-w-md",children:e.jsxs("div",{className:"rounded-xl border border-border bg-card/60 p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[e.jsx(se,{className:"w-4 h-4 text-primary"})," Verify it's you"]}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Enter the email Trenith has on file for this project."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(f,{htmlFor:"vault-email",className:"text-xs",children:"Email"}),e.jsx(y,{id:"vault-email",type:"email",required:!0,value:m,onChange:t=>L(t.target.value),placeholder:"[email protected]"})]}),x&&e.jsxs("p",{className:"text-xs text-destructive flex items-start gap-1.5",children:[e.jsx(z,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),x]}),e.jsx(Y,{type:"submit",disabled:E,className:"w-full",children:E?e.
1jsx(C,{className:"w-4 h-4 animate-spin"}):"Continue"})]})})]})})}),e.jsx(w,{})]})};export{ve 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.