import{R as f,ag as m,bq as h,bs as g,j as t,g as v,Y as C,d8 as y,bv as b,aX as x,T as j,O as k,Q as R,ah as T,d9 as z,da as w,db as S}from"./app-BgLa5dit.js";import{R as A}from"./t8cVFCZO.chunk.js";import{S as P}from"./Cu2-dDll.chunk.js";import{u as $}from"./kOrk-qeI.chunk.js";const N="_imageStyle_12z26_1",B="_item_12z26_6",U="_dashboard_12z26_10",E="_playPage_12z26_25",I="_aspectRatio_12z26_34",L="_outerContainer_12z26_39",M="_innerContainer_12z26_46",D="_actions_12z26_46",H="_titleBelow_12z26_56",O="_thumbnailContainer_12z26_59",F="_titleAbove_12z26_62",G="_teacherPack_12z26_65",q="_text_12z26_68",Q="_hoverState_12z26_71",W="_atomGuide_12z26_74",X="_studentActivity_12z26_83",Y="_additionalMaterials_12z26_92",J="_userUploaded_12z26_101",K="_download_12z26_116",a={imageStyle:N,item:B,dashboard:U,playPage:E,aspectRatio:I,outerContainer:L,innerContainer:M,actions:D,titleBelow:H,thumbnailContainer:O,titleAbove:F,teacherPack:G,text:q,hoverState:Q,atomGuide:W,studentActivity:X,additionalMaterials:Y,userUploaded:J,download:K};function V(e){switch(e){case"atom-guide":return a.atomGuide;case"student-activity":return a.studentActivity;case"teacher-pack":return a.teacherPack;case"additional-materials":return a.additionalMaterials;default:return a.userUploaded}}function Z(e,n){var l;const r=$();return n==="public"?!0:r.xs||r.sm||e.type!=="resource"||!("metadata"in e)?!1:e.metadata.type===y.Image?!0:e.metadata.type===y.Pdf?!!e.url:!!((l=e.pdf)!=null&&l.url)}c.defaultProps={preloadImage:!0,actionBehaviour:"normal"};function c(e){var d,o,s;let n=null;"metadata"in e.data&&(n=e.data.metadata);const r=x.isType(e.data,m.Resource);function l(i){var _;let u=`
      d-flex flex-column align-items-center justify-content-end rounded-3 h-100
      position-relative ${V(i)} ${a.innerContainer}`;return(_=e.theme)!=null&&_.containerClass?u+=` ${e.theme.containerClass}`:u+=" pt-3 px-3",e.applyHoverState&&(u+=` ${a.hoverState}`),u}return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:a.aspectRatio,children:t.jsx("div",{className:a.outerContainer,children:t.jsxs("div",{className:l(n==null?void 0:n.resourceType),children:[e.titlePosition==="above"&&t.jsx(j,{title:e.data.name,children:t.jsx("h3",{className:`text-center text-break h5 mb-3 ${a.text}`,children:t.jsx("span",{className:"clamp-1",children:e.data.name})})}),t.jsx("div",{className:`
              ${((d=e.theme)==null?void 0:d.thumbnailContainerClass)??""} w-75 overflow-hidden 
              ${a.thumbnailContainer} ${e.titlePosition==="above"?a.titleAbove:""} 
              ${a.imageStyle}
            `,children:t.jsx(A,{resource:e.data,imageCdnUrl:e.imageCdnUrl,imageErrorFallbackUrl:e.imageErrorFallbackUrl,preloadImage:e.preloadImage})}),r&&e.onClickDownload&&e.actionBehaviour==="normal"&&t.jsx("div",{className:a.actions,children:t.jsx(k,{onClick:i=>e.onClickDownload(i,e.data),className:`${a.download} d-flex align-items-center justify-content-center`,children:t.jsx(R,{svg:T})})}),!e.hideTypeBadge&&r&&t.jsx(z,{typeId:m.Resource})]})})}),e.titlePosition==="below"&&t.jsxs("div",{className:`mt-1 ${a.titleBelow}`,children:[x.isType(e.data,m.Resource)&&!!((s=(o=e.data)==null?void 0:o.metadata)!=null&&s.resourceType)&&t.jsx(w,{children:S.getResourceTypeName(e.data.metadata.resourceType)}),t.jsx("h3",{className:"h6 clamp-2",children:e.data.name})]})]})}const ne=f.memo(function(e){const n=Z(e.data,e.actionBehaviour);function r(){return e.location==="play-page"?a.playPage:a.dashboard}const l={...e.analyticsData,...e.data},d={...e.analyticsOptions,actionType:g.Click,entity:e.data.typeId===m.Resource?h.Resource:h.Link};function o(){b.logUserAction(l,d)}const s={...e,applyHoverState:n||!!e.data.url};return t.jsx("div",{className:`px-1 flex-shrink-0 ${a.item} ${r()} ${P.RESOURCE_ITEM_SELECTOR}`,children:(()=>{const i="d-block no-decoration";return e.data.type==="link"?t.jsx("a",{href:e.data.url,target:"_blank",className:i,onClick:o,children:t.jsx(c,{...s})}):n?e.actionBehaviour==="public"?t.jsx("div",{className:`${i} cursor-pointer d-inline`,onClick:()=>{o(),v.trigger(e.getAppLink(e.data))},children:t.jsx(c,{...s})}):t.jsx(C,{appLink:e.getAppLink(e.data),className:i,analyticsData:l,analyticsOptions:d,children:t.jsx(c,{...s})}):e.data.url?t.jsx("a",{href:e.data.url,className:i,onClick:o,children:t.jsx(c,{...s})}):t.jsx("div",{className:i,children:t.jsx(c,{...s})})})()})});export{c as R,ne as a};
//# sourceMappingURL=B3xA170I.chunk.js.map
