import{aI as j,M as x,E as b,r as y,ao as e,fq as g,v,ba as C,bv as _,aQ as k,at as R,a_ as T,d7 as w,bp as P,fy as f,o as A}from"./app-k0jcl5PQ.js";import{R as S}from"./BNuOjrBr.chunk.js";import{T as $}from"./WCBjpMHJ.chunk.js";import{D as N}from"./CGYNvpr2.chunk.js";import{R as B}from"./CW-zLlXC.chunk.js";const I="_imageStyle_baaxj_1",U="_item_baaxj_6",D="_dashboard_baaxj_10",E="_playPage_baaxj_24",L="_aspectRatio_baaxj_32",M="_outerContainer_baaxj_37",H="_innerContainer_baaxj_45",O="_actions_baaxj_45",F="_titleBelow_baaxj_55",G="_heading_baaxj_58",V="_thumbnailContainer_baaxj_61",q="_titleAbove_baaxj_64",Q="_teacherPack_baaxj_67",W="_text_baaxj_70",z="_hoverState_baaxj_73",J="_atomGuide_baaxj_76",K="_studentActivity_baaxj_85",X="_additionalMaterials_baaxj_94",Y="_userUploaded_baaxj_103",Z="_download_baaxj_118",t={imageStyle:I,item:U,dashboard:D,playPage:E,aspectRatio:L,outerContainer:M,innerContainer:H,actions:O,titleBelow:F,heading:G,thumbnailContainer:V,titleAbove:q,teacherPack:Q,text:W,hoverState:z,atomGuide:J,studentActivity:K,additionalMaterials:X,userUploaded:Y,download:Z};function p(a){switch(a){case"atom-guide":return t.atomGuide;case"student-activity":return t.studentActivity;case"teacher-pack":return t.teacherPack;case"additional-materials":return t.additionalMaterials;default:return t.userUploaded}}function aa(a,n){var r;const s=P();return n==="public"?!0:s.xs||s.sm||a.type!=="resource"||!("metadata"in a)?!1:a.metadata.type===f.Image?!0:a.metadata.type===f.Pdf?!!a.url:!!((r=a.pdf)!=null&&r.url)}c.defaultProps={preloadImage:!0,actionBehaviour:"normal"};function c(a){var l,i,o;let n=null;"metadata"in a.data&&(n=a.data.metadata);const s=_.isType(a.data,x.Resource);function r(u){var h;let m=`
      d-flex flex-column align-items-center justify-content-end rounded-3 h-100
      position-relative ${p(u)} ${t.innerContainer}`;return(h=a.theme)!=null&&h.containerClass?m+=` ${a.theme.containerClass}`:m+=" pt-3 px-3",a.applyHoverState&&(m+=` ${t.hoverState}`),m}function d(){_.isResource(a.data)&&typeof a.onClickDownload=="function"&&a.onClickDownload(a.data)}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:t.aspectRatio,children:e.jsx("div",{className:t.outerContainer,children:e.jsxs("div",{className:r(n==null?void 0:n.resourceType),children:[a.titlePosition==="above"&&e.jsx(k,{title:a.data.name,children:e.jsx("h3",{className:`text-center text-break h5 mb-3 ${t.text}`,children:e.jsx("span",{className:"clamp-1",children:a.data.name})})}),e.jsx("div",{className:`
              ${((l=a.theme)==null?void 0:l.thumbnailContainerClass)??""} w-75 overflow-hidden 
              ${t.thumbnailContainer} ${a.titlePosition==="above"?t.titleAbove:""} 
              ${t.imageStyle}
            `,children:e.jsx(S,{resource:a.data,imageCdnUrl:a.imageCdnUrl,imageErrorFallbackUrl:a.imageErrorFallbackUrl,preloadImage:a.preloadImage,dynamicRatioImageOptions:a.dynamicRatioImageOptions})}),s&&a.onClickDownload&&a.actionBehaviour==="normal"&&e.jsx("div",{className:t.actions,children:e.jsx(R,{onClick:u=>{u.preventDefault(),u.stopPropagation(),d()},className:`${t.download} d-flex align-items-center justify-content-center`,children:e.jsx(T,{svg:N})})}),!a.hideTypeBadge&&s&&e.jsx($,{typeId:x.Resource})]})})}),a.titlePosition==="below"&&e.jsxs("div",{className:`mt-2 ${t.titleBelow}`,children:[_.isType(a.data,x.Resource)&&!!((o=(i=a.data)==null?void 0:i.metadata)!=null&&o.resourceType)&&e.jsx(w,{children:B.getResourceTypeName(a.data.metadata.resourceType)}),e.jsx("h3",{className:`h6 clamp-2 ${t.heading}`,children:a.data.name})]})]})}const sa=j.memo(function(a){const n=aa(a.data,a.actionBehaviour);function s(){return a.location==="play-page"?t.playPage:t.dashboard}const r={...a.analyticsData,id:a.data.id,name:a.data.name},d={...a.analyticsOptions,actionType:y.Click,entity:a.data.typeId===x.Resource?b.Resource:b.Link};function l(){A.logUserAction(r,d)}const i={...a,applyHoverState:n||!!a.data.url};return e.jsx("div",{className:`px-1 flex-shrink-0 ${t.item} ${s()} ${g.RESOURCE_ITEM_SELECTOR}`,children:(()=>{const o="d-block no-decoration";return a.data.type==="link"?e.jsx("a",{href:a.data.url,target:"_blank",className:o,onClick:l,children:e.jsx(c,{...i})}):n?a.actionBehaviour==="public"?e.jsx("div",{className:`${o} cursor-pointer d-inline`,onClick:()=>{l(),v.trigger(a.getAppLink(a.data))},children:e.jsx(c,{...i})}):e.jsx(C,{appLink:a.getAppLink(a.data),className:o,analyticsData:r,analyticsOptions:d,children:e.jsx(c,{...i})}):a.data.url?e.jsx("a",{href:a.data.url,className:o,onClick:l,children:e.jsx(c,{...i})}):e.jsx("div",{className:o,children:e.jsx(c,{...i})})})()})});export{sa as R,c as a,aa as u};
//# sourceMappingURL=DRX7tQDY.chunk.js.map
