import{u as f,j as e,L as o,aB as u,w as N,c9 as b,i as v,dq as _,e as m}from"./vendor-rThclpOQ.js";import{A as w,a as C,b as y}from"./avatar-BsP_s7dr.js";import{B as T}from"./button-ZcsoqUQn.js";import{C as k,a as A,b as B,e as z}from"./card-HXna_7vU.js";import{T as D,a as E,b as F,c as H}from"./tooltip-WOIaUmuC.js";import{s as I,c as x,e as L}from"./utils-8KAaAB9H.js";const S=({course:s,className:h,wishlists:t})=>{const{props:l}=f(),{user:i}=l.auth,{button:c,common:n,frontend:p}=l.translate,r=t==null?void 0:t.find(d=>d.course_id===s.id),a=I(l.system.fields.selling_currency),j=()=>{r?m.delete(route("course-wishlists.destroy",{id:r.id})):m.post(route("course-wishlists.store",{user_id:i==null?void 0:i.id,course_id:s.id}))};return e.jsxs(k,{className:x(h),children:[e.jsx(A,{className:"p-0",children:e.jsxs("div",{className:"relative",children:[e.jsx(o,{href:route("course.details",{slug:s.slug,id:s.id}),children:e.jsx("div",{className:"relative h-[300px] w-full overflow-hidden rounded-t-lg",children:e.jsx("img",{src:s.thumbnail||"/assets/images/blank-image.jpg",alt:s.title,className:"h-full w-full object-cover transition-transform duration-300 hover:scale-105",onError:d=>{const g=d.target;g.src="/assets/images/blank-image.jpg"}})})}),t&&e.jsx(D,{delayDuration:0,children:e.jsxs(E,{children:[e.jsx(F,{className:"absolute top-2 right-2 z-10",children:e.jsx(T,{size:"icon",variant:"ghost",className:"bg-white/80 hover:bg-white",onClick:j,children:e.jsx(u,{className:x("h-4 w-4",r&&"text-red-500")})})}),e.jsx(H,{children:e.jsxs("p",{children:[" ",r?c.remove_from_wishlist:c.add_to_wishlist]})})]})})]})}),e.jsxs("div",{className:"p-4",children:[e.jsxs(B,{className:"p-0 pb-5",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("p",{className:"text-secondary-foreground text-xs uppercase",children:s.course_category.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.discount?e.jsxs("p",{className:"pt-1 text-gray-300 line-through",children:[a==null?void 0:a.symbol,s.discount_price]}):"",s.pricing_type==="free"?e.jsx("p",{className:"text-lg font-semibold",children:n.free}):e.jsxs("p",{className:"text-lg font-semibold",children:[a==null?void 0:a.symbol,s.price]})]})]}),e.jsx(o,{href:route("course.details",{slug:s.slug,id:s.id}),children:e.jsx("p",{className:"hover:text-secondary-foreground text-lg font-semibold",children:s.title})}),e.jsxs("div",{className:"flex items-center gap-8 py-5",children:[e.jsxs("p",{className:"flex items-center gap-1.5",children:[e.jsx(N,{className:"h-3.5 w-3.5 fill-amber-400 text-amber-400"}),e.jsx("span",{className:"font-medium",children:s.average_rating||0}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",s.reviews_count||0," ",n.reviews,")"]})]}),e.jsxs("p",{className:"flex items-center gap-1.5",children:[e.jsx(b,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"font-medium",children:s.enrollments_count||0}),e.jsx("span",{className:"text-muted-foreground text-sm",children:s.enrollments_count?n.students:p.student})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(w,{className:"h-8 w-8",children:[e.jsx(C,{src:s.instructor.user.photo||"",alt:s.instructor.user.name,className:"object-cover"}),e.jsx(y,{children:"IM"})]}),e.jsx("p",{className:"text-sm font-medium",children:s.instructor.user.name})]})]}),e.jsxs(z,{className:"border-muted flex items-center gap-5 border-t p-0 pt-5",children:[e.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(v,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:L(s,"readable")})]}),e.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(_,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:s.level})]})]})]})]})};export{S as C};
