"use strict";exports.id=44865,exports.ids=[44865,67183,89564],exports.modules={44865:(a,b,c)=>{c.r(b),c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(2116),g=c.n(f),h=c(89564),i=c(41090),j=c(20524),k=c(14113);function l(){let[a,b]=(0,e.useState)([]),[c,f]=(0,e.useState)(!0),[l,m]=(0,e.useState)(null);return c?(0,d.jsx)("div",{children:"Loading certificates..."}):l?(0,d.jsx)(i.Z,{padding:"lg",children:(0,d.jsxs)("p",{className:"text-[var(--muted-foreground)] mb-4",children:["Failed to load certificates: ",l]})}):(0,d.jsxs)("div",{children:[(0,d.jsx)("h1",{className:"text-3xl font-bold text-[var(--foreground)] mb-8",children:"My Certificates"}),0===a.filter(a=>a.course?.certificateTemplateUrl).length?(0,d.jsxs)(i.Z,{padding:"lg",className:"text-center",children:[(0,d.jsx)("p",{className:"text-[var(--muted-foreground)] mb-4",children:"No certificates are available yet. Ask the admin to attach a certificate template to your course."}),(0,d.jsx)(g(),{href:"/courses",children:(0,d.jsx)(j.$,{variant:"primary",children:"Browse Courses"})})]}):(0,d.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6",children:a.filter(a=>a.course?.certificateTemplateUrl).map(a=>(0,d.jsx)(i.Z,{padding:"lg",className:"flex flex-col",children:(0,d.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,d.jsx)("h2",{className:"text-base font-semibold text-[var(--foreground)] mb-1 line-clamp-2",children:a.course?.title??"Course"}),(0,d.jsxs)("p",{className:"text-xs text-[var(--muted-foreground)] mb-2",children:["Status: ",(0,d.jsx)("span",{className:"font-mono break-all",children:a.status})]}),(0,d.jsx)("p",{className:"text-xs text-[var(--muted-foreground)] mb-4",children:(()=>{let b=a.completedAt?(0,k.Yq)(a.completedAt):"";if(b)return`Completed on ${b}`;let c=a.enrolledAt?(0,k.Yq)(a.enrolledAt):"";return c?`Enrolled on ${c}`:"Enrolled"})()}),(0,d.jsxs)("div",{className:"mt-auto flex justify-between items-center gap-2",children:[(0,d.jsx)("span",{className:"text-[11px] uppercase tracking-wide text-[var(--muted-foreground)]",children:"Download your certificate"}),a.course?.certificateTemplateUrl?(0,d.jsx)(h.j,{href:`/dashboard/certificates/${a.course.id}`,children:(0,d.jsx)(j.$,{variant:"primary",size:"sm",children:"View / Download"})}):(0,d.jsx)("span",{className:"text-[11px] text-[var(--muted-foreground)]",children:"Coming soon"})]})]})},a.id))})]})}c(5716)},89564:(a,b,c)=>{c.d(b,{j:()=>l});var d=c(48249),e=c(2116),f=c.n(e),g=c(18954),h=c(17060),i=c(89513);function j(a){return(a.split("?")[0]||a).replace(/\/$/,"")||"/"}function k(a){if("string"==typeof a)return a;if(a&&"object"==typeof a){let b=a.pathname?String(a.pathname):"",c=a.search?String(a.search):"",d=a.hash?String(a.hash):"";return`${b}${c}${d}`}return""}function l({href:a,onClick:b,prefetch:c=!1,scroll:e=!0,...l}){let m=(0,h.sK)(),n=k(a),o=j(k(a)),p=m??"",q=o?(0,i.C)(o):null;return(0,d.jsx)(f(),{href:a,prefetch:c,scroll:e,...l,onClick:a=>{b?.(a),!a.defaultPrevented&&o&&(j(p)===j(o)?a.preventDefault():q&&(a.preventDefault(),(0,g.$)(n,{scroll:e})))}})}}};