1import{a_ as j,bg as c,aS as d,aT as o,bl as b,aW as N,b0 as r,b8 as C,b9 as z,bb as I,aV as y,aX as p,aU as h,bt as S,br as F,bv as _,bF as O,bn as k,bL as D,ct as U,bA as $,d3 as L,d4 as A,d5 as E,bK as P,bJ as V,bQ as J}from"./CR1X-UN3.js";import{_ as W}from"./D_R7RGgE.js";import{_ as M}from"./Bq_zr2Ai.js";import{_ as R}from"./Bvpd21Id.js";import{u as K,a as Q}from"./BgPNY_lB.js";import{u as X}from"./DjMmrhrd.js";const Y={key:0,class:"absolute top-3 left-3 z-10 flex gap-1.5"},q={key:0,class:"absolute top-3 right-3 z-10 flex size-8 items-center justify-center rounded-full bg-(--ui-container-primary) text-(--ui-container-on-primary) shadow-sm"},G=j({__name:"LibraryCardBadges",props:{isNew:{type:Boolean},isOnSale:{type:Boolean},isOwned:{type:Boolean},isBookmarked:{type:Boolean}},setup(e){const s=e,n=c(()=>{if(s.isOwned)return[{key:"owned",label:"Owned",class:"bg-(--color-purple-grey-700) text-white"}];const a=[];return s.isNew&&a.push({key:"new",label:"New",class:"bg-(--color-electric-purple-200) text-(--color-electric-purple-800)"}),s.isOnSale&&a.push({key:"sale",label:"Sale",class:"bg-(--ui-accent) text-(--color-electric-purple-800)"}),a});return(a,u)=>{const l=S,m=W;return o(),d(C,null,[r(n).length?(o(),d("div",Y,[(o(!0),d(C,null,z(r(n),i=>(o(),d("span",{key:i.key,class:I(["inline-flex h-8 items-center rounded-full px-3 text-xs leading-none font-semibold shadow-sm",i.class])},y(i.label),3))),128))])):b("",!0),N(m,null,{default:p(()=>[e.isBookmarked?(o(),d("div",q,[N(l,{name:"material-symbols:bookmark",class:"size-5","aria-hidden":"true"}),u[0]||(u[0]=h("span",{class:"sr-only"},"Bookmarked",-1))])):b("",!0)]),_:1})],64)}}}),H=Object.assign(G,{__name:"LibraryCardBadges"}),Z=60;function ee(e){if(typeof e=="number")return Number.isFinite(e)?e<1e12?e*1e3:e:null;if(typeof e=="string"&&e){const s=new Date(e).getTime();return Number.isNaN(s)?null:s}return null}function te(e,s){const n=ee(e);if(n==null)return!1;const a=(Date.now()-n)/864e5;return a>=0&&a<s}function B(e,...s){for(const n of s){const a=e[n];if(a!=null)return a}}function ne(e,s){const n=F(),a=K(),u=Q(),l=()=>_(e),m=()=>_(s),i=()=>Number(l().id??l().objectID),f=()=>m()==="courses",t=()=>m()==="jams",g=c(()=>Number(B(l(),"new","is_new","isNew"))===1||te(B(l(),"releaseDate","release_date"),Z)),x=c(()=>Number(B(l(),"sale","onSale","on_sale"))===1),w=c(()=>n.isAuthenticated?f()?n.ownedCourses.includes(i()):t()?n.ownedItjs.includes(i()):!1:!1),v=c(()=>n.isAuthenticated?t()?u.isFavorited(i()):f()?a.isFavorited(i()):!1:!1);return O({isNew:g,isOnSale:x,isOwned:w,isBookmarked:v})}const se={class:"relative size-full isolate"},ae={class:"truncate text-base font-bold text-(--ui-on-surface)"},re={key:1,class:"flex size-8 items-center justify-center rounded-full bg-gray-200 text-xs font-medium text-gray-500"},oe={class:"min-w-0 flex flex-col"},ie={class:"truncate text-sm text-(--color-grey-700)"},ce={key:0,class:"truncate text-xs font-semibold text-(--ui-on-surface) capitalize"},le=j({__name:"LibraryCard",props:{hit:{},to:{default:"#"},contentType:{default:"courses"},aspect:{default:"horizontal"},productType:{default:"courses"},external:{type:Boolean,default:!1},hideBadges:{type:Boolean,default:!1}},setup(e){const s=ne(()=>e.hit,()=>e.contentType),n=c(()=>{if(e.contentType==="methods"||e.contentType==="learningPaths")return e.hit.img||"";const t=(e.hit.id||e.hit.objectID).toString();return t?e.aspect==="vertical"&&e.contentType==="courses"?L(t):e.contentType==="jampacks"?A(t):e.contentType==="jams"?E(t):P(t):""}),a=c(()=>{if(!n.value)return null;const t=n.value.replace("/promos/","/images/"),g=e.contentType!=="methods"&&e.contentType!=="learningPaths";return V(t,{retina:g})}),{source:u,onError:l}=X(()=>a.value),m=c(()=>{const t=e.hit.authorid||e.hit.educatorId||e.hit.educator_id;return t?J(t.toString()):""}),i=c(()=>(e.hit.educator||"").split(" ").map(g=>g[0]).join("").slice(0,2).toUpperCase()),f=c(()=>{const t=e.hit.genre;return t?Array.isArray(t)?t.slice(0,2):[t]:[]});return(t,g)=>{const x=D,w=H,v=M,T=R;return o(),k(T,{to:e.to,external:e.external,tabindex:"0",title:e.hit.educator?`${e.hit.title} by ${e.hit.educator}`:e.hit.title,class:"w-[80vw] max-w-75 shrink-0 snap-start no-underline sm:w-[calc(50%-10px)] sm:max-w-none md:w-[calc(33.333%-13.333px)] lg:w-[calc(25%-15px)] outline-none focus-visible:ring-2 focus-visible:ring-(--ui-active)"},{default:p(()=>[N(v,{aspect:e.aspect},{image:p(()=>[h("div",se,[r(u)?(o(),k(x,{key:0,src:r(u).src,srcset:r(u).srcset,alt:e.hit.title||"",class:"size-full object-cover transition-transform duration-200 ease-out group-hover:scale-105",loading:e.productType==="featured-courses"?null:"lazy",preload:e.productType==="featured-courses",onError:r(l)},null,8,["src","srcset","alt","loading","preload","onError"])):b("",!0),e.hideBadges?b("",!0):(o(),k(w,U($({key:1},r(s))),null,16))])]),default:p(()=>
1[h("div",ae,y(e.hit.title),1),e.hit.educator?(o(),d("div",{key:0,class:I(["mt-2 flex gap-2",r(f).length?"items-start":"items-center"])},[r(m)?(o(),k(x,{key:0,src:r(m),alt:e.hit.educator,class:"size-8 rounded-full object-cover",loading:"lazy"},null,8,["src","alt"])):(o(),d("div",re,y(r(i)),1)),h("div",oe,[h("span",ie,y(e.hit.educator),1),r(f).length?(o(),d("span",ce,y([...r(f)].join(" · ")),1)):b("",!0)])],2)):b("",!0)]),_:1},8,["aspect"])]),_:1},8,["to","external","title"])}}}),ye=Object.assign(le,{__name:"LibraryCard"});export{ye as _};
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.