1import{f as r,j as e,L as T}from"./vendor-react-DN8kURjP.js";import{m as L,i as A,P as M}from"./index-CxYJmUz4.js";import{S as O}from"./shield-DGM5ryEQ.js";import{C as P}from"./circle-check-GnWkFNM1.js";import{D as v}from"./download-B4BsBkyI.js";import{L as u}from"./loader-circle-CuyVJuRo.js";import{P as k}from"./pencil-J6WPU1-Z.js";import{T as E}from"./trash-2-DV4fCk8T.js";import"./vendor-data-CFC2aK0l.js";import"./vendor-ui-DX_CyZTE.js";import"./vendor-monitoring-Ddv-fnWC.js";const _=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],q=L("scroll-text",_);function Q(){const[i,l]=r.useState(null),[d,s]=r.useState(null),[c,S]=r.useState(null),[o,p]=r.useState(""),[y,b]=r.useState(""),[x,f]=r.useState(""),[h,w]=r.useState(""),[j,g]=r.useState("");async function m(){try{const t=await fetch("/api/privacy/audit");if(t.status===401){s({kind:"err",text:"Sign in to view your audit history."});return}const a=await t.json();S(a.events??[])}catch(t){s({kind:"err",text:t.message})}}r.useEffect(()=>{m()},[]);async function R(){l("export"),s(null);try{const t=await fetch("/api/privacy/export");if(t.status===401){s({kind:"err",text:"Sign in to export your data."});return}if(!t.ok)throw new Error(`Export failed (${t.status})`);const a=await t.blob(),N=URL.createObjectURL(a),n=document.createElement("a");n.href=N,n.download=`athlynx-data-export-${Date.now()}.json`,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(N),s({kind:"ok",text:"Your data export was downloaded to your device."})}catch(t){s({kind:"err",text:t.message})}finally{l(null)}}async function C(){if(o!=="DELETE MY DATA"){s({kind:"err",text:'Type exactly "DELETE MY DATA" to confirm.'});return}l("delete"),s(null);try{const t=await fetch("/api/privacy/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:o,reason:y})});if(t.status===401){s({kind:"err",text:"Sign in to submit an erasure request."});return}const a=await t.json();if(!t.ok)throw new Error(a.message||"Request failed");s({kind:"ok",text:a.message}),p(""),b(""),m()}catch(t){s({kind:"err",text:t.message})}finally{l(null)}}async function D(){if(!x||!h){s({kind:"err",text:"Field and new value are required."});return}l("rectify"),s(null);try{const t=await fetch("/api/privacy/rectify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({field:x,requested_value:h,reason:j})});if(t.status===401){s({kind:"err",text:"Sign in to submit a correction."});return}const a=await t.json();if(!t.ok)throw new Error(a.message||"Request failed");s({kind:"ok",text:a.message}),f(""),w(""),g(""),m()}catch(t){s({kind:"err",text:t.message})}finally{l(null)}}return e.jsxs("div",{className:"min-h-screen bg-[#040c1a] text-white",children:[e.jsx("section",{className:"border-b border-white/5 bg-gradient-to-b from-[#0a1628] to-[#040c1a] pt-16 pb-10 px-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-sky-400/40 bg-sky-500/10 px-3 py-1 text-xs font-semibold tracking-wide text-sky-300 mb-4",children:[e.jsx(O,{className:"w-3.5 h-3.5"}),"YOUR DATA · YOUR MOVE"]}),e.jsx("h1",{className:"text-3xl sm:text-4xl font-black mb-3",children:"My Data Rights"}),e.jsxs("p",{className:"text-white/70 max-w-2xl",children:["Export, correct, or erase the data AthlynX holds about you. Every action here is audit-logged. See"," ",e.jsx(T,{href:"/trust",className:"text-sky-300 hover:text-sky-200",children:"/trust"})," ","for our full compliance surface."]})]})}),d&&e.jsx("div",{className:"max-w-4xl mx-auto mt-6 px-4",children:e.jsxs("div",{className:`flex items-start gap-3 rounded-lg border px-4 py-3 ${d.kind==="ok"?"border-emerald-400/40 bg-emerald-500/10 text-emerald-200":"border-cyan-400/40 bg-cyan-500/10 text-cyan-200"}`,children:[d.kind==="ok"?e.jsx(P,{className:"w-5 h-5 mt-0.5 shrink-0"}):e.jsx(A,{className:"w-5 h-5 mt-0.5 shrink-0"}),e.jsx("div",{className:"text-sm",children:d.text})]})}),e.jsx("section",{className:"py-10 px-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto rounded-xl border border-white/10 bg-white/[0.03] p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-sky-500/15 border border-sky-400/30 flex items-center justify-center",children:e.jsx(v,{className:"w-5 h-5 text-sky-300"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold",children:"Export my data"}),e.jsx("p",{className:"text-xs text-white/50",children:"Live JSON snapshot. Downloaded to your device."})]})]}),e.jsxs("button",{onClick:R,disabled:i==="export",className:"mt-2 inline-flex items-center gap-2 rounded-lg bg-white text-[#0066ff] px-5 py-2.5 font-bold hover:bg-white/90 disabled:opacity-50",children:[i==="export"?e.jsx(u,{className:"w-4 h-4 animate-spin"}):e.jsx(v,{className:"w-4 h-4"}),"Download my data"]})]})}),e.jsx("section",{className:"py-4 px-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto rounded-xl border border-white/10 bg-white/[0.03] p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-sky-500/15 border border-sky-400/30 flex items-center justify-center",children:e.jsx(k,{className:"w-5 h-5 text-sky-300"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold",children:"Correct a field"}),e.jsx("p",{className:"text-xs text-white/50",children:"Reviewed within 30 days."})]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 mt-3",children:[e.jsx("input",{value:x,onChange:t=>f(t.target.value),placeholder:"Field name (e.g. name, phone, birthdate)",className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-sm outline-none focus:border-sky-400/50"}),e.jsx("input",{value:h,onChange:t=>w(t.target.value),placeholder:"Requested value",className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-sm outline-none focus:border-sky-400/50"}),e.jsx("input",{value:j,onChange:t=>g(t.target.value),placeholder:"Reason (optional)",className:"sm:col-span-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-sm outline-none focus:border-sky-400/50"})]}),e.jsxs("button",{onClick:D,disabled:i==="rectify",className:"mt-4 inline-flex items-center gap-2 rounded-lg border border-white/25 px-5 py-2.5 font-bold hover:bg-white/10 disabled:opacity-50",children:[i==="rectify"?e.jsx(u,{className:"w-4 h-4 animate-spin"}):e.jsx(k,{className:"w-4 h-4"}
1),"Submit correction"]})]})}),e.jsx("section",{className:"py-4 px-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto rounded-xl border border-red-500/30 bg-red-500/[0.05] p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-red-500/15 border border-red-400/30 flex items-center justify-center",children:e.jsx(E,{className:"w-5 h-5 text-red-300"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold",children:"Erase my data"}),e.jsx("p",{className:"text-xs text-white/50",children:"Queued for human review. Completed within 30 days per GDPR / CCPA. This is not reversible after review."})]})]}),e.jsxs("div",{className:"grid gap-3 mt-3",children:[e.jsx("input",{value:y,onChange:t=>b(t.target.value),placeholder:"Reason (optional but helpful)",className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-sm outline-none focus:border-red-400/50"}),e.jsx("input",{value:o,onChange:t=>p(t.target.value),placeholder:'Type "DELETE MY DATA" to confirm',className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-sm outline-none focus:border-red-400/50"})]}),e.jsxs("button",{onClick:C,disabled:i==="delete"||o!=="DELETE MY DATA",className:"mt-4 inline-flex items-center gap-2 rounded-lg bg-red-500 text-white px-5 py-2.5 font-bold hover:bg-red-400 disabled:opacity-40 disabled:cursor-not-allowed",children:[i==="delete"?e.jsx(u,{className:"w-4 h-4 animate-spin"}):e.jsx(E,{className:"w-4 h-4"}),"Submit erasure request"]})]})}),e.jsx("section",{className:"py-10 px-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto rounded-xl border border-white/10 bg-white/[0.03] p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-sky-500/15 border border-sky-400/30 flex items-center justify-center",children:e.jsx(q,{className:"w-5 h-5 text-sky-300"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold",children:"My audit history"}),e.jsx("p",{className:"text-xs text-white/50",children:"Last 100 actions we recorded involving your account."})]})]}),c===null?e.jsx("div",{className:"text-sm text-white/50",children:"Loadingâ¦"}):c.length===0?e.jsx("div",{className:"text-sm text-white/50",children:"No audit entries yet."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"text-white/50 uppercase tracking-wide",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-2 py-2",children:"When"}),e.jsx("th",{className:"text-left px-2 py-2",children:"Action"}),e.jsx("th",{className:"text-left px-2 py-2",children:"Target"}),e.jsx("th",{className:"text-left px-2 py-2",children:"Status"}),e.jsx("th",{className:"text-left px-2 py-2",children:"IP"})]})}),e.jsx("tbody",{children:c.map((t,a)=>e.jsxs("tr",{className:"border-t border-white/5",children:[e.jsx("td",{className:"px-2 py-2 text-white/70",children:new Date(t.created_at).toLocaleString()}),e.jsx("td",{className:"px-2 py-2 font-mono text-sky-300",children:t.action}),e.jsxs("td",{className:"px-2 py-2 text-white/60",children:[t.target_type??"",t.target_id?` · ${t.target_id}`:""]}),e.jsx("td",{className:"px-2 py-2 text-white/60",children:t.status}),e.jsx("td",{className:"px-2 py-2 text-white/40",children:t.actor_ip??""})]},a))})]})})]})}),e.jsx(M,{})]})}export{Q 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.