import{q as u,r,R as j,A as y,j as e}from"./index-XAQEFxR0.js";import g from"./TopNav-Bk5GTdNw.js";import{C as N}from"./CyberBackground-D4ChG426.js";import{F as v}from"./Footer-BWuDGipe.js";import"./Particles-BRxp5v1w.js";import"./arrow-right-BBWeihko.js";import"./lock-riYib5_N.js";import"./mail-C4YbZpAk.js";const P=()=>{const[p]=u(),s=p.get("id")||"",[i,f]=r.useState(s.toUpperCase()),[t,c]=r.useState(null),[o,d]=r.useState(!1),[x,l]=r.useState("");j.useEffect(()=>{s&&m(s)},[s]);const m=async a=>{d(!0),l(""),c(null);try{const n=await(await fetch(`${y}/api/learning-paths/verify/${a}`)).json();n.valid?c(n.certificate):l(n.message||"Certificate not found")}catch{l("Failed to verify certificate. Please try again.")}finally{d(!1)}},h=async a=>{a.preventDefault(),m(i)};return e.jsxs("div",{className:"min-h-screen bg-[#0a0a0b] relative",children:[e.jsx(N,{}),e.jsx(g,{}),e.jsx("div",{className:"container mx-auto px-4 py-8 mt-20 relative z-10",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsx("h1",{className:"text-4xl font-bold text-white text-center mb-4",children:"Certificate Verification"}),e.jsx("p",{className:"text-gray-400 text-center mb-8",children:"Enter a certificate ID to verify its authenticity"}),e.jsx("form",{onSubmit:h,className:"mb-8",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsx("input",{type:"text",value:i,onChange:a=>f(a.target.value.toUpperCase()),placeholder:"Enter Certificate ID (e.g., CERT-2025-1-34-ABC123)",className:"flex-1 bg-[#1a1b1e] border border-gray-700 rounded-xl px-4 py-3 text-white placeholder-gray-500 focus:outline-none focus:border-purple-500"}),e.jsx("button",{type:"submit",disabled:o||!i,className:"bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700 disabled:opacity-50 text-white font-bold py-3 px-8 rounded-xl transition-all",children:o?"Verifying...":"Verify"})]})}),x&&e.jsxs("div",{className:"bg-red-500/10 border border-red-500/30 rounded-xl p-6 text-center",children:[e.jsx("div",{className:"text-red-400 text-xl mb-2",children:"❌ Invalid Certificate"}),e.jsx("p",{className:"text-gray-400",children:x})]}),t&&e.jsxs("div",{className:"bg-gradient-to-br from-green-500/10 to-emerald-500/10 border border-green-500/30 rounded-2xl p-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"text-green-400 text-3xl mb-2",children:"✅ Valid Certificate"}),e.jsx("p",{className:"text-gray-400",children:"This certificate has been verified as authentic"})]}),e.jsxs("div",{className:"bg-[#0a0a0b] rounded-xl p-6 space-y-4",children:[e.jsxs("div",{className:"flex justify-between border-b border-gray-800 pb-3",children:[e.jsx("span",{className:"text-gray-500",children:"Certificate ID"}),e.jsx("span",{className:"text-white font-mono",children:t.id})]}),e.jsxs("div",{className:"flex justify-between border-b border-gray-800 pb-3",children:[e.jsx("span",{className:"text-gray-500",children:"Recipient"}),e.jsx("span",{className:"text-white font-bold",children:t.userName})]}),e.jsxs("div",{className:"flex justify-between border-b border-gray-800 pb-3",children:[e.jsx("span",{className:"text-gray-500",children:"Learning Path"}),e.jsx("span",{className:"text-purple-400 font-bold",children:t.pathTitle})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-500",children:"Date of Completion"}),e.jsx("span",{className:"text-white",children:t.completedDate})]})]})]})]})}),e.jsx(v,{})]})};export{P as default};
