import{a as J,b as M,c as _}from"/wp-web-assets/build/_shared/chunk-T2YTEFPX.js";import{c as z}from"/wp-web-assets/build/_shared/chunk-FPSF7EX6.js";import{g as X,h as F}from"/wp-web-assets/build/_shared/chunk-ACZ53S37.js";import{a as B}from"/wp-web-assets/build/_shared/chunk-2TLILPRO.js";import{k as v}from"/wp-web-assets/build/_shared/chunk-VNDGKOW7.js";import{b as r}from"/wp-web-assets/build/_shared/chunk-2YZJKNX4.js";import{a as A}from"/wp-web-assets/build/_shared/chunk-BCAQNPD2.js";import{E as N,a as q}from"/wp-web-assets/build/_shared/chunk-DFBJ2RPP.js";import{e as S}from"/wp-web-assets/build/_shared/chunk-6OSFCK5A.js";var c=S(q());var s={"story-card":"-Pwnr","story-card-data":"u68pf","story-card-left-section":"GhHtk",cover:"XehFk","story-card-right-section":"_7E5id",title:"YsLvC",author:"aZ0hI","story-card-stats":"GQc3d","story-stats":"fkGoe","icon-bar":"EeucE",description:"_7X3mo","set-pointer":"o9ytU","more-details":"_2WcyK","button-wrapper":"qZxhc","storycover-link-position":"_-14pw","story-rank-card":"bBNLq"};var h=S(A());var e=S(N());function K({storyCardOptions:a,titleOptions:f,authorOptions:w,coverOptions:o,descriptionOptions:T,startReadingButton:k,tags:i,storyIconBarOptions:E,statsItemsOptions:C,moreDetailsOptions:b,eventInfo:p}){let[H,U]=(0,c.useState)(o.value),[V,x]=(0,c.useState)(!1),g=(0,c.useRef)(null),{t:G}=v(),L=()=>(0,e.jsxs)("div",{className:m("story-card-data"),children:[(0,e.jsx)("div",{className:r(m("story-card-left-section")),children:(o==null?void 0:o.coverSize)&&Q("cover",o)}),(0,e.jsxs)("div",{className:r(m("story-card-right-section")),children:[f&&R("title",f),w&&R("author",w),E&&(0,e.jsx)("div",{className:s["icon-bar"],"data-testid":"story-icon-bar",children:(0,e.jsx)(J,{isCompleted:E.isCompleted,isMature:E.isMature})}),C&&(0,e.jsx)("div",{className:r(m("story-stats")),"data-testid":"story-stats",children:(0,e.jsx)(M,{statsItems:C.statsItems,showTooltip:C.showTooltip,className:r(m("story-card-stats")),variant:C.variant})}),k&&(0,e.jsx)("div",{className:s["button-wrapper"],children:k}),T&&R("description",T),i&&(0,e.jsx)("div",{className:r(m("tag-meta")),children:i}),(b==null?void 0:b.clickable)&&(0,e.jsxs)("a",{href:b.href,className:s["more-details"],children:[b.value,(0,e.jsx)(B,{name:"chevRight",height:"24",strokeColor:"var(--wp-neutral-1)"})]})]})]}),I=(n,t,l,P)=>(0,e.jsx)("a",{className:r(s["set-pointer"],P),href:t||"",onClick:l,children:n}),R=(n,t)=>{let l=(0,e.jsx)("div",{className:r(m(n)),children:t.value});return t.clickable?I(l,t==null?void 0:t.href,t==null?void 0:t.onClick):l},Q=(n,t)=>{let l=(0,e.jsxs)("div",{className:s[n],children:[(0,e.jsx)("img",{srcSet:t.srcSet,src:H,alt:G("%s by %s",f.value,t.author)}),(t==null?void 0:t.showStoryRank)&&(t==null?void 0:t.storyRank)&&(0,e.jsx)(h.Pill,{variant:h.PillVariant.SOLID,accent:h.Accent.BASE_1,className:s["story-rank-card"],label:`#${t==null?void 0:t.storyRank}`})]});return t.clickable?I(l,t==null?void 0:t.href,t==null?void 0:t.onClick,t!=null&&t.showStoryRank?s["storycover-link-position"]:""):l},m=n=>{var t;return(t=a.customStyles)!=null&&t[n]?a.customStyles[n]:s[n]};return(0,c.useEffect)(()=>{U(X({url:o.value,width:F(o.coverSize)}))},[o.coverSize,o.value]),(0,c.useEffect)(()=>{if(!V&&p){let n=_(()=>{if(g.current){let l=g.current.getBoundingClientRect(),P=l.top,Z=l.bottom;P>=0&&Z<=window.innerHeight&&(z(p),x(!0))}},300);return window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}}},[V,g,x,p]),(0,e.jsx)("div",{ref:g,className:r(m("story-card")),children:a.clickable?I(L(),a.href,a.onClick):(0,e.jsx)(e.Fragment,{children:L()})})}var lt=K;var y={"tag-meta":"Qob6i","tag-items":"vcOri","tag-item":"eE-EO","num-not-shown":"Y0AjP","num-not-shown-button":"li4ui","num-not-shown-text":"ZQJrm"};var u=S(A());var d=S(N()),Y=({tags:a,tagShape:f=u.PillShape.ROUND,tagVariant:w=u.PillVariant.DEFAULT,numNotShownClickHandler:o=null})=>{let{t:T}=v(),k=null;return a!=null&&a.numNotShown&&(k=o?(0,d.jsx)("button",{className:r(y["num-not-shown"],y["num-not-shown-button"]),onClick:i=>o(i),children:T("+%s more",a.numNotShown)}):(0,d.jsx)("span",{className:r(y["num-not-shown"],y["num-not-shown-text"]),children:T("+%s more",a.numNotShown)})),a!=null&&a.tags&&a.tags.length>0?(0,d.jsxs)("div",{className:y["tag-meta"],"data-testid":"tag-meta",children:[(0,d.jsx)("ul",{className:y["tag-items"],children:a.tags.map(i=>(0,d.jsx)("li",{children:(0,d.jsx)(u.Pill,{label:i.name,variant:w,accent:u.Accent.DEFAULT,shape:f,href:i.link,className:r("no-text-decoration-on-focus","no-text-decoration-on-hover")})},i.id))}),k]}):null},ut=Y;export{lt as a,ut as b};