
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a4aa1a64-9ace-5dc6-885b-19cd3fd99c94")}catch(e){}}();
import{j as e}from"./jsx-runtime-BjG_zV1W.js";import{c as p}from"./index-x2da_zcv.js";import{B as K}from"./index-DFtJ8-cK.js";import{u as $}from"./useTypedLoaderData-CKNseont.js";import{u as Y,B as W,S as ee}from"./WebThemeContext-DttfuZxo.js";import{u as z,L as G,c as V}from"./components-1fH5YjVo.js";import{u as F}from"./useTranslation-CfKJAmGY.js";import{F as H}from"./ChevronRightIcon-Dsmk2epM.js";import{d as L}from"./dayjs.min-B8CfgAhU.js";import{r as se}from"./relativeTime-tlGPeD3Q.js";import{T as j}from"./index-CJHGmWl4.js";import{F as te,H as oe}from"./HeroChatIcon-DZxH_rr3.js";import{r as f,u as Z,a as ae}from"./index-D6da9p6-.js";import{I as re}from"./Image-ycA_AFLr.js";import{F as ne}from"./LockClosedIcon-BluoCUMI.js";import{P as le}from"./index-BWDs2reA.js";import{u as ce}from"./useDebounce-D-dOlItd.js";import{F as q}from"./MagnifyingGlassIcon-DyQ3eS5L.js";import{F as ie}from"./XMarkIcon-Y2tO3Ykg.js";function de({title:s,titleId:t,...o},r){return f.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},o),s?f.createElement("title",{id:t},s):null,f.createElement("path",{fillRule:"evenodd",d:"M10.5 3.75a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM2.25 10.5a8.25 8.25 0 1 1 14.59 5.28l4.69 4.69a.75.75 0 1 1-1.06 1.06l-4.69-4.69A8.25 8.25 0 0 1 2.25 10.5Z",clipRule:"evenodd"}))}const me=f.forwardRef(de),C=(s,t,o,r)=>{const n=new URLSearchParams(r);n.delete(t),n.set(t,o.toString());const a=n.toString();return a?`${s}?${a}`:s},N=({to:s,disabled:t,rel:o,children:r,activePage:n,color:a,borderColor:l,isNewWebBuilder:c=!1,primaryColor:d,primaryTextColor:i})=>{const{classes:x}=Y();return e.jsx(G,{to:s,className:p(x.radius,"flex items-center gap-2 border border-transparent px-3 py-1 transition duration-150 ease-in-out hover:border-wt-primary",{"pointer-events-none cursor-not-allowed opacity-40":t,"bg-wt-primary text-wt-text-on-primary":n&&!c}),style:{color:c?i:a,border:l&&`1px solid ${l}`,backgroundColor:c?d:""},children:r})},P="../archive",O=8,S="page",he=({homePage:s,isNewWebBuilder:t=!1,buttonBGColor:o,buttonBorderColor:r,buttonTextColor:n})=>{const[a]=z(),{paginatedPosts:l}=$(),c=n,d=r,i=o,x=s?.posts_section.archive.button_active_bg_color||"",u=s?.posts_section.archive.button_active_text_color||"",m=parseInt(a.get("page")||"1",10),g=Math.max(1,m-Math.floor(O/2)),{t:h}=F(),_=Math.min(g+O-1,l.pagination.total_pages);return l.pagination.total_pages===1?null:e.jsxs("div",{className:"col-span-12 mx-auto mt-12 grid grid-cols-4 grid-rows-2 items-center gap-3 px-4 py-4 pb-8 sm:flex sm:justify-center",children:[e.jsxs("div",{className:"wt-button-font order-2 col-span-2 flex justify-end gap-2",children:[e.jsx(N,{to:C(P,S,1,a),disabled:m===1?!0:null,color:c,borderColor:d,primaryColor:i,primaryTextColor:c,isNewWebBuilder:t,children:h("search.pagination.first")}),e.jsxs(N,{to:C(P,S,m-1,a),rel:"prev",disabled:m===1,color:c,primaryColor:i,primaryTextColor:c,borderColor:d,isNewWebBuilder:t,children:[e.jsx(H,{className:"rotate-180 transform",height:"16px"}),h("search.pagination.back")]})]}),e.jsx("div",{className:"order-1 col-span-4 flex justify-center gap-3 sm:order-2",children:Array.from({length:_-g+1},(v,b)=>{const y=g+b,w=m===y,R=w?x:i,T=w?u:c;return e.jsx(N,{to:C(P,S,y,a),activePage:w,color:T,borderColor:d,primaryColor:R,primaryTextColor:T,isNewWebBuilder:t,children:y},b)})}),e.jsxs("div",{className:"wt-button-font order-2 col-span-2 flex items-center gap-2",children:[e.jsxs(N,{to:C(P,S,m+1,a),disabled:m===l.pagination.total_pages,rel:"next",color:c,primaryColor:i,primaryTextColor:c,borderColor:d,isNewWebBuilder:t,children:[h("search.pagination.next")," ",e.jsx(H,{height:"16px"})]}),e.jsx(N,{to:C(P,S,l.pagination.total_pages,a),borderColor:d,primaryColor:i,primaryTextColor:c,disabled:m===l.pagination.total_pages?!0:null,color:c,isNewWebBuilder:t,children:h("search.pagination.last")})]})]})};L.extend(se);function xe(s){let o=L().diff(s,"hour");return o===0&&(o=1),o===1?`${o} hour ago`:o<24?`${o} hours ago`:s.locale("en").format("MMM DD, YYYY")}const pe=({time:s,authors:t,fontFamily:o,textClassName:r,color:n})=>{const a=L(s),l=xe(a);return e.jsxs(j,{size:"sm",fontFamily:o,className:p("flex flex-col space-y-1 no-underline opacity-75",r),color:n,weight:"regular",children:[e.jsx("span",{className:"text-xs font-semibold",children:t?.map(c=>c.name).join(", ")}),e.jsx("time",{dateTime:s,className:"text-xs",children:l})]})},U=({count:s,children:t,className:o,color:r,fontFamily:n,onClick:a})=>{const l=c=>{c.preventDefault(),c.stopPropagation(),a?.()};return e.jsx("button",{type:"button",onClick:l,children:e.jsxs(j,{size:"sm",as:"span",fontFamily:n,className:p(o,"flex items-center space-x-1"),color:r,weight:"regular",children:[t,s>0?e.jsx("span",{className:"mt-0.5 text-xs font-bold",children:s}):null]})})},ue=({post:s,likeCount:t,commentCount:o,color:r,fontFamily:n,commentsEnabled:a})=>{const l=Z();return e.jsxs("div",{className:"z-20 flex w-full items-center space-x-8 opacity-100 transition-all group-hover:opacity-100 sm:opacity-0",children:[e.jsx(U,{count:t,color:r,children:e.jsx(te,{className:"h-4 w-4"})}),a&&e.jsx(U,{count:o,className:"mt-[2px]",color:r,onClick:()=>{l(`/p/${s.slug}?comments=true`)},children:e.jsx(oe,{className:"h-4 w-4"})})]})},ge=({alt:s,radiusClass:t,src:o})=>e.jsx("div",{className:p("w-full overflow-hidden",t||"rounded-wt"),children:e.jsx(re,{src:o,alt:s,maxWidth:800,loading:"eager",aspectRatio:"social"})}),fe=({slug:s,className:t,children:o,style:r})=>e.jsx(G,{style:r,to:`/p/${s}`,className:p(t),prefetch:"intent",children:o}),je=({color:s,fontFamily:t})=>{const{t:o}=F();return e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(ne,{style:{color:s},className:"h-3 w-3"}),e.jsx(j,{as:"h2",size:"xs",fontFamily:t,weight:"bold",color:s,children:o("posts.premium")})]})},ve=({tags:s,fontFamily:t,bgColor:o,color:r})=>!s||s?.length===0?null:e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(n=>e.jsx("div",{style:{backgroundColor:o},className:"flex w-fit items-center space-x-1 rounded px-2 pb-0.5",children:e.jsx(j,{as:"span",size:"xs",fontFamily:t,className:"text-xs font-medium",color:r,children:e.jsx("span",{className:"text-xs",children:n.display})})},n.id))}),be=({title:s,subtitle:t,titleSize:o,fontFamily:r,subtitleSize:n,titleColor:a,subtitleColor:l,textClassName:c,showSubtitle:d=!0})=>e.jsxs(e.Fragment,{children:[e.jsx(j,{as:"h2",size:o,fontFamily:r,weight:"bold",color:a,className:p("line-clamp-4 break-words",c),children:s}),d&&e.jsx(j,{as:"p",size:n,fontFamily:r,color:l,className:p("line-clamp-2 break-words",c),children:t})]}),_e={none:"hover:shadow-none",xs:"hover:shadow-xs",sm:"hover:shadow-sm",md:"hover:shadow-md",lg:"hover:shadow-lg",xl:"hover:shadow-xl"},ye=({post:s,card:t,orientation:o="vertical"})=>{const r=s.audience==="premium",n=W[t?.border_radius||"none"],a=ee[t?.shadow||"none"],l=_e[t?.hover_shadow||"none"],c=t.font,d=o==="vertical",i="flex-col",x=o==="horizontal",u="flex-col md:flex-row",m=s?.comment_count||0,g=s?.likes?.length||0;return e.jsx("div",{suppressHydrationWarning:!0,className:p("group h-full overflow-hidden transition-all",a,l,n),style:{backgroundColor:t.bg_color,borderColor:t.border_color},children:e.jsxs(fe,{slug:s?.slug,style:{backgroundColor:t.bg_color,borderColor:t.border_color},className:p("group flex h-full w-full border transition-all group-hover:brightness-110",n,d&&i,x&&u),children:[e.jsx("div",{className:"w-full",children:e.jsx(ge,{alt:s.web_title,radiusClass:n,src:s.image_url})}),e.jsxs("div",{className:p("flex h-full w-full flex-col justify-between space-y-6 p-4"),children:[e.jsxs("div",{children:[e.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxs("div",{className:"space-y-1",children:[r&&e.jsx(je,{color:t.premium_text_color,fontFamily:t.font}),e.jsx(be,{title:s.web_title,subtitle:s?.web_subtitle,fontFamily:c,titleSize:"xl",subtitleSize:"sm",titleColor:t.text_color,subtitleColor:t.text_color,textClassName:t.hover_underline==="underline"?"group-hover:underline":""})]})}),e.jsx("div",{className:"pt-6",children:e.jsx(pe,{authors:s.authors,time:s.override_scheduled_at,fontFamily:c,color:t.timestamp_text_color})})]}),t?.tags_enabled&&e.jsx("div",{className:"space-y-2",children:e.jsx(ve,{tags:s.content_tags,fontFamily:c,bgColor:t.tags_bg_color,color:t.tags_text_color})}),e.jsx(ue,{post:s,likeCount:g,commentCount:m,commentsEnabled:s.comments_enabled,fontFamily:c,color:t.text_color})]})]})})},we=(s,t=[])=>{if(!s)return[];const o=t.reduce((r,n)=>({...r,[n.display]:n.id}),{});try{return s.map(r=>o[r]||r)}catch{return[]}},Ce=({initialPosts:s,initialPagination:t,publication:o})=>{const r=V(),n=t.total_pages,[a,l]=f.useState(s),[c,d]=f.useState(t.page),i=r?.data,[x]=z(),u=x.get("q"),m=x.getAll("tags"),g=()=>{const h=new URLSearchParams;h.append("page",c+1),u&&h.append("q",u),m.length&&h.append("content_tags",we(m,o?.content_tags)),r.load(`/posts?${h.toString()}`)};return f.useEffect(()=>{a&&(d(1),l(s))},[s]),f.useEffect(()=>{i&&(d(c+1),l(a.concat(i?.posts)))},[i]),{postsToRender:a,showLoadMore:c+1<=n,isLoading:r?.state!=="idle",postsFetcher:r,fetchPosts:g}},Ne=({incomingPosts:s})=>{const t=V(),[o,r]=f.useState(!1),n=s?.map(a=>a.id)||[];return f.useEffect(()=>{if(n&&n.length>0&&!o){const l=n.join(",");t.load(`/posts_insights?post_ids=${l}`),r(!0)}},[n,o]),{postsWithInsights:s?.map(a=>{const l=t?.data?.find(c=>c.id===a.id);return{...a,likes:l?l.likes:[],comment_count:l?l.comment_count:0}})}},Pe=({title:s,description:t,fontFamily:o,accentColor:r,textColor:n,fontSize:a,isNewWebBuilder:l=!1})=>e.jsxs("div",{className:"flex flex-col space-y-0",children:[e.jsx(j,{as:"h4",size:l?a:"xl",fontFamily:o,fontFamilyv2:l?o:void 0,color:r,weight:"bold",children:s}),t&&e.jsx(j,{as:"p",size:"lg",fontFamily:o,fontFamilyv2:l?o:void 0,color:n,weight:"regular",children:t})]}),Se=({color:s,tag:t,setIsSearching:o,bgColor:r,isNewWebBuilder:n,radiusClass:a})=>{const[l,c]=z(),d=l.getAll("tags"),i=t.display,x=d.includes(i),u=Z(),m=ae(),g=()=>{const h=new URLSearchParams(l);x?(h.delete("tags"),d.forEach(v=>{v!==i&&h.append("tags",v)})):h.append("tags",i);const _=h.toString();if(m.pathname.includes("/archive"))o(!0),c(h);else{const v="/archive",b=_?`${v}?${_}`:v;u(b)}};return e.jsx("button",{type:"button",style:{borderColor:s,color:x?r:s,backgroundColor:x?s:"transparent"},onClick:g,className:p(a,"cursor-pointer border px-4 py-1.5 text-xs"),children:i})},B=({setSearchTerm:s,color:t,classNames:o,showX:r})=>{const[n,a]=z(),l=n.has("q")||n.has("tags"),{t:c}=F(),d=i=>{n.delete("q"),n.delete("tags"),s(""),a(n)};return l?e.jsxs("button",{onClick:d,style:{borderColor:t,color:t},className:p(o,"flex items-center space-x-1 border px-4 py-1.5"),children:[r&&e.jsx(ie,{className:"mr-1 h-3 w-3"}),c("search.posts.clear_filters")]}):null},Fe=({searchTerm:s,setSearchTerm:t,isSearching:o,setIsSearching:r,isNewWebBuilder:n=!1})=>{const{classes:a}=Y(),{t:l}=F(),{homePage:c,publication:d}=$(),i=c.general_section.theme.text_color,x=c.general_section.theme.bg_color,u=m=>{t(m.target.value),o||r(!0)};return e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"relative w-full pb-4",children:n?e.jsxs("div",{className:"group relative w-full transition-all",children:[e.jsx("div",{className:"absolute left-2 top-1/2 -translate-y-1/2 transform",children:e.jsx(q,{style:{color:i},className:"h-4 w-4"})}),e.jsx("input",{type:"text",name:"q",id:"q",value:s,onChange:u,style:{color:"#111827",border:"1px solid #F9FAFB",backgroundColor:"#F9FAFB"},className:p(a.radius,"w-full max-w-none pl-8 sm:max-w-4xl"),placeholder:`${l("search.posts.placeholder")}...`||""})]}):e.jsxs("div",{className:"group relative w-full text-wt-text-on-background transition-all",children:[e.jsx("div",{className:"absolute top-2.5",children:e.jsx(q,{style:{color:i},className:"h-4 w-4"})}),e.jsx("input",{type:"text",name:"q",id:"q",value:s,onChange:u,style:{color:i,borderBottomColor:i},className:"text-regular w-full rounded-none border-b border-transparent bg-transparent py-2 pl-6 text-sm outline-none transition-all focus:border-transparent focus:opacity-100",placeholder:`${l("search.posts.placeholder")}...`||""})]})}),e.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:d.content_tags?.map(m=>e.jsx(Se,{tag:m,color:i,bgColor:x,setIsSearching:r,isNewWebBuilder:n,radiusClass:a.radius},m.display))}),e.jsx(B,{setSearchTerm:t,color:i,classNames:p("px-2 py-1 text-xs",a.radius),showX:!0})]})},I=()=>e.jsx("div",{className:"w-full rounded-md border-2 border-gray-600 p-4 opacity-50 shadow",children:e.jsxs("div",{className:"flex animate-pulse space-x-4",children:[e.jsx("div",{className:"h-36 w-36 rounded bg-gray-600"}),e.jsx("div",{className:"flex flex-1 flex-col justify-between py-1",children:e.jsxs("div",{className:"felx flec-col space-y-6",children:[e.jsx("div",{className:"h-2 rounded bg-gray-600"}),e.jsx("div",{className:"h-2 max-w-sm rounded bg-gray-600"}),e.jsx("div",{className:"h-2 max-w-xs rounded bg-gray-600"})]})})]})}),Te=()=>e.jsxs("div",{className:"min-h-screen w-full space-y-4 pt-4",children:[e.jsx(I,{}),e.jsx(I,{}),e.jsx(I,{}),e.jsx(I,{})]}),Xe=({cardOrientation:s="horizontal",gridCols:t="3",isNewWebBuilder:o=!1})=>{const{t:r}=F(),{paginatedPosts:n,homePage:a,publication:l,cardStyles:c}=$(),d=a?.posts_section?.card,i=a.general_section.theme.text_color,x=a.general_section.theme.font,u=a.posts_section.archive.header_text_color??a.general_section.theme.accent_color,m=a?.posts_section?.archive.load_more_posts_type==="pagination",g=a?.posts_section?.archive.header_text||"Archive",h=a?.posts_section?.archive.show_archive_header||!1,_=a?.posts_section?.archive.font_size||"4xl",{searchTerm:v,setSearchTerm:b,isSearching:y,setIsSearching:w}=ce(500),{isLoading:R,fetchPosts:T,postsToRender:Q,showLoadMore:X}=Ce({initialPosts:n.posts,initialPagination:n.pagination,publication:l}),{postsWithInsights:A}=Ne({incomingPosts:Q}),J=()=>e.jsxs("div",{className:"mt-12 flex w-full flex-col items-center justify-center gap-4",children:[e.jsx(me,{className:"h-8 w-8"}),e.jsx(j,{as:"p",size:"xl",fontFamily:d.font,fontFamilyv2:o?d.font:void 0,color:d.text_color,className:"text-xl font-semibold",children:r("search.posts.no_results")}),e.jsx(B,{setSearchTerm:b,color:i,classNames:"p-2 px-4 text-base"})]}),M=a?.posts_section.archive.button_text_color||"",D=a?.general_section.theme.border_color||"",E=a?.posts_section.archive.button_bg_color||"";return e.jsxs("div",{children:[o&&h&&e.jsx("div",{className:"mb-4",children:e.jsx(Pe,{title:g,fontFamily:x,accentColor:u,textColor:i,isNewWebBuilder:o,fontSize:_})}),e.jsx(Fe,{publication:l,searchTerm:v,setSearchTerm:b,isSearching:y,setIsSearching:w,isNewWebBuilder:o}),y?e.jsx(Te,{}):e.jsx(e.Fragment,{children:A.length===0?e.jsx("div",{children:J()}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:p({"flex flex-col space-y-6":s==="horizontal","grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3":s==="vertical"&&t==="3","grid grid-cols-1 gap-6 md:grid-cols-2":s==="vertical"&&t==="2"}),children:A?.map((k,ke)=>o?e.jsx(le,{post:k,cardStyles:c,orientation:s},k.id):e.jsx(ye,{post:k,card:d,orientation:s},k.id))}),!m&&X&&e.jsx("div",{className:"mt-6 flex w-full justify-center",children:e.jsx(K,{style:{backgroundColor:E,borderColor:D,color:M},className:p("transition-all group-hover:brightness-110"),onClick:T,children:R?`${r("shared.actions.loading")}...`:r("shared.cta.load_more")})}),m&&e.jsx(he,{homePage:a,isNewWebBuilder:o,buttonBGColor:E,buttonBorderColor:D,buttonTextColor:M})]})})]})};export{Xe as A,ye as P,Pe as S,be as T,fe as a,ge as b,je as c,Ne as u};
//# sourceMappingURL=index-e0VuMWk-.js.map

//# debugId=a4aa1a64-9ace-5dc6-885b-19cd3fd99c94
