var u=(n,l,s)=>new Promise((t,d)=>{var r=o=>{try{m(s.next(o))}catch(c){d(c)}},i=o=>{try{m(s.throw(o))}catch(c){d(c)}},m=o=>o.done?t(o.value):Promise.resolve(o.value).then(r,i);m((s=s.apply(n,l)).next())});import{jsx as e,jsxs as a}from"react/jsx-runtime";import{a as x,aD as b,aH as g,aF as N,aI as p,aE as y,aG as h,B as f}from"./ui-components-B24mpb8o.js";import{c as v}from"./date-BZvGgr5q.js";import{usePage as w}from"@inertiajs/react";import{ExternalLink as T,Download as k}from"lucide-react";import"next-themes";import"sonner";import"react";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";import"date-fns";const se=()=>{const{props:n}=w(),{resources:l}=n,s=(t,d)=>u(null,null,function*(){d.preventDefault();try{const r=route("resources.download",t.id);window.open(r,"_blank")}catch(r){window.open(t.resource,"_blank")}});return e("div",{className:"space-y-8",children:l&&l.length>0?l.map((t,d)=>a(x,{children:[e("div",{className:"bg-muted rounded-t-lg px-4 py-3",children:a("h3",{className:"text-lg font-semibold",children:["Module: ",t.title]})}),e("div",{className:"space-y-4 p-4",children:t.section_lessons&&t.section_lessons.length>0?t.section_lessons.map(r=>r.resources&&r.resources.length>0?a("div",{className:"rounded-md border",children:[e("div",{className:"p-4",children:a("p",{className:"text-base font-medium",children:[e("span",{className:"font-semibold",children:"Lesson:"})," ",r.title]})}),e("div",{className:"overflow-hidden border-t",children:a(b,{children:[e(g,{className:"bg-muted/50",children:a(N,{children:[e(p,{className:"px-4 font-semibold",children:"Title"}),e(p,{className:"px-4 font-semibold",children:"Date & Time"}),e(p,{className:"px-4 text-right font-semibold",children:"Action"})]})}),e(y,{children:r.resources.map(i=>a(N,{className:"hover:bg-muted/30",children:[e(h,{className:"px-4 py-3 font-medium",children:i.title}),e(h,{className:"text-muted-foreground px-4 py-3",children:v(i.created_at)}),e(h,{className:"px-4 py-3 text-right",children:e("div",{className:"flex items-center justify-end gap-2",children:i.type==="link"?e(f,{asChild:!0,size:"sm",variant:"secondary",children:a("a",{target:"_blank",href:i.resource,children:[e(T,{className:"h-3 w-3"}),"Check"]})}):a(f,{size:"sm",variant:"secondary",onClick:m=>s(i,m),children:[e(k,{className:"h-3 w-3"}),"Download"]})})})]},i.id))})]})})]},r.id):null):e("div",{className:"text-muted-foreground py-8 text-center",children:"No lessons found in this module."})})]},t.id)):e("div",{className:"py-12 text-center",children:e("p",{className:"text-muted-foreground text-lg",children:"No resources available for this course yet."})})})};export{se as default};
