1import{x as re,U as le,r as c,J as oe,a8 as ne,z as ie,A as ce,j as e,D as G,a9 as de,aa as ue,i as me,B as K,S as he,K as xe,M as pe,P as ye}from"../index.js";import{B as ge}from"./BreadCrumbs-BHBaji19.js";import{p as V,r as be,D as fe,t as U}from"./DateRangeDropdown-CnUy2tii.js";import{P as Le}from"./Pagination-CSdOi52A.js";import{u as Se}from"./useSearchQueryState-Bl1H5UGN.js";import{u as ke}from"./useLazyPagination-BLvcFOb0.js";import{u as je,C as we}from"./content-views-BFazEwqE.js";import{S as Ne}from"./SuccessStoryCard-BF47f5lF.js";import{F as ve}from"./ExclamationCircleIcon-D4d25Pjr.js";import"./CheckIcon-YWbmu-fz.js";import"./ArrowRightIcon-BcHr-VhO.js";const Te="[mask-image:linear-gradient(to_right,#000_calc(100%_-_1.25rem),transparent)] [-webkit-mask-image:linear-gradient(to_right,#000_calc(100%_-_1.25rem),transparent)]",x={searchPlaceholder:"Search stories â e.g. steam, Versaflex, miningâ¦",sortNewestLabel:"Newest first",emptyStateLabel:"No stories match your filters",emptyStateDescription:"Try a different industry, widen the date range, or clear your search.",entriesPerPageLabel:"Entries per page",ofLabel:"of"},Pe={Custom:{key:"Custom",orderLabel:"Custom range"},All:{key:"All",orderLabel:"All time"},Today:{key:"Today",orderLabel:"Today"},Yesterday:{key:"Yesterday",orderLabel:"Yesterday"},ThisWeek:{key:"ThisWeek",orderLabel:"This week"},Last7Days:{key:"Last7Days",orderLabel:"Last 7 days"},ThisMonth:{key:"ThisMonth",orderLabel:"This month"},Last30Days:{key:"Last30Days",orderLabel:"Last 30 days"},Last90Days:{key:"Last90Days",orderLabel:"Last 90 days"},ThisYear:{key:"ThisYear",orderLabel:"This year"}};function Be(){var I,z,Y,B;const{language:n}=re(),p=le(),{page:i,pageSize:r,filters:g,industry:b,productGroup:f,dateRange:L,dateStart:S,dateEnd:u,setPagination:o,setFilters:l,setIndustry:j,setProductGroup:q,setDateRange:Q,getAemQueryString:E}=Se(),k=b??null,w=f??null,d=L??"All",N=S??null,v=u??null,T=c.useMemo(()=>d==="Custom"&&N&&v?{start:V(N),end:V(v,!0)}:null,[d,N,v]),{data:P,loading:W}=oe({language:n,path:"success-stories",query:"success-stories"}),a=(I=P==null?void 0:P.successStoriesByPath)==null?void 0:I.item,D=c.useMemo(()=>(a==null?void 0:a.industries)??[],[a==null?void 0:a.industries]),R=c.useMemo(()=>(a==null?void 0:a.productGroups)??[],[a==null?void 0:a.productGroups]),H=c.useMemo(()=>Object.fromEntries([...D,...R].map(s=>[s.key,s.label])),[D,R]),J=c.useMemo(()=>{const s=(a==null?void 0:a.dateRangeOptions)??[];return s.length?Object.fromEntries(s.map(t=>[t.key,{key:t.key,orderLabel:t.orderLabel}])):Pe},[a==null?void 0:a.dateRangeOptions]),_=((z=g.find(s=>s.key==="title"))==null?void 0:z.value)??"",X=s=>j(s??void 0),O=c.useMemo(()=>{const s=d==="Custom"?T:be(d??"All"),t=E({locale:n,tags:[],industryTagKeys:{keys:k?[k]:[],operator:"OR"},productGroupTagKey:w||void 0,tagFieldNames:{industry:"industryTags",productGroup:"productGroupTags"},launchDateRange:s?{start:s.start.toISOString(),end:s.end.toISOString()}:void 0,launchDateField:"publishedAt",sortKey:"publishedAt",order:"desc"});return ne+t},[n,k,w,d,T,E]),{data:m,isLoading:F}=ie(O,ce,{revalidateOnFocus:!1}),h=((B=(Y=m==null?void 0:m.data)==null?void 0:Y.successStoryEntryList)==null?void 0:B.items)??[],Z=h.map(s=>s.slug),{data:A}=je(we,Z),{totalItems:ee,totalPages:M,hasMore:se}=ke({data:m==null?void 0:m.data,itemsPath:"successStoryEntryList.items",loading:F,currentPage:i,pageSize:r,setPagination:o});c.useEffect(()=>{window.scrollTo({top:0})},[O]);const C=c.useRef(null),ae=s=>{var y;s==null||s.preventDefault();const t=(y=C.current)==null?void 0:y.value.trim();l(t?[{key:"title",operator:"$containsi",value:t}]:[])};return W?e.jsx(G,{}):e.jsxs("div",{className:"flex flex-col grow",children:[e.jsx("div",{className:"px-4 lg:px-6 pt-6 pb-4 bg-gray-100 sticky z-10 top-14 lg:top-16",children:e.jsxs("div",{className:"flex flex-col gap-y-3 lg:flex-row lg:items-center lg:gap-x-4 w-full",children:[e.jsx("form",{onSubmit:ae,className:"w-full shrink-0 lg:max-w-64",children:e.jsx(de,{Icon:ue,placeholder:(a==null?void 0:a.searchPlaceholder)??x.searchPlaceholder,type:"text",ref:C,defaultValue:_,onClear:()=>l([])},_)}),e.jsx(De,{industries:D,productGroups:R,selectedIndustry:k,selectedProductGroup:w,onSelectIndustry:X,onSelectProductGroup:s=>q(s??void 0),dateDropdown:e.jsx(fe,{selectedKey:d,customRange:d==="Custom"?T:null,onChange:(s,t)=>Q(s,t?U(t.start):void 0,t?U(t.end):void 0),labels:J})})]})}),e.jsxs("main",{className:"px-4 lg:px-6 pb-6 grow flex flex-col",children:[(h==null?void 0:h.length)>0&&e.jsx("p",{className:"text-xs text-primary-gray mb-4",children:(a==null?void 0:a.sort
1NewestLabel)??x.sortNewestLabel}),F?e.jsx(G,{}):h.length===0?e.jsx("div",{className:"flex items-center justify-center grow",children:e.jsxs("div",{className:"max-w-sm text-center",children:[e.jsx(ve,{"aria-hidden":!0,className:"size-8 text-gray-400/60 mx-auto"}),e.jsx("p",{className:"leading-snug mt-1 font-semibold",children:(a==null?void 0:a.emptyStateLabel)??x.emptyStateLabel}),e.jsx("p",{className:"text-xs mt-1",children:(a==null?void 0:a.emptyStateDescription)??x.emptyStateDescription})]})}):e.jsx("div",{className:"flex flex-col gap-3.5",children:h.map(s=>{var t,y;return e.jsx(Ne,{story:s,viewCount:A==null?void 0:A[s.slug],categoryLabel:H[((t=s.productGroupTags)==null?void 0:t[0])??""]??((y=s.productGroupTags)==null?void 0:y[0])??"",onOpen:te=>p(`${me.successStoryDetail}?slug=${te}`)},s.slug)})})]}),e.jsx("div",{className:"px-4 lg:px-6 pb-6",children:e.jsx(Le,{page:i,pageSize:r,totalPages:M,totalItems:ee,entriesPerPageLabel:x.entriesPerPageLabel,ofLabel:x.ofLabel,onPageSizeChange:s=>o(1,s),onFirstPageClick:()=>o(1,r),onLastPageClick:()=>{se&&o(M,r)},onNextPageClick:()=>o(i+1,r),onPreviousPageClick:()=>o(i-1,r),undeterministic:!0})})]})}function $({children:n}){return e.jsxs(he,{className:"grow min-w-0",children:[e.jsx(xe,{className:`${Te} py-2 -my-2`,children:e.jsx("div",{className:"flex gap-x-2.5",children:n})}),e.jsx(pe,{orientation:"horizontal",className:"bg-transparent h-1.5 flex flex-col",children:e.jsx(ye,{className:"flex-1 bg-gray-300 hover:bg-gray-400 rounded-full"})})]})}function De({industries:n,productGroups:p,selectedIndustry:i,selectedProductGroup:r,onSelectIndustry:g,onSelectProductGroup:b,dateDropdown:f}){var L,S;if(i){const o=[{name:((L=n.find(l=>l.key===i))==null?void 0:L.label)??i,onClick:r?()=>b(null):void 0}];if(r){const l=((S=p.find(j=>j.key===r))==null?void 0:S.label)??r;o.push({name:l})}return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-3 min-w-0 lg:flex-nowrap lg:grow",children:[e.jsx("div",{className:"grow min-w-0 flex items-center min-h-10 [&_ol]:h-10 lg:grow-0 lg:shrink-0",children:e.jsx(ge,{pages:o,onHomeClick:()=>g(null)})}),!r&&p.length>0&&e.jsx("div",{className:"order-last basis-full min-w-0 lg:order-none lg:basis-auto lg:grow",children:e.jsx($,{children:p.map(l=>e.jsx(K,{small:!0,variant:"light",className:"whitespace-nowrap",onClick:()=>b(l.key),children:l.label},l.key))})}),e.jsx("div",{className:"lg:ml-auto",children:f})]})}return e.jsxs("div",{className:"flex items-center gap-x-4 min-w-0 lg:grow",children:[e.jsx($,{children:n.map(u=>e.jsx(K,{small:!0,variant:"light",className:"whitespace-nowrap",onClick:()=>g(u.key),children:u.label},u.key))}),f]})}export{Be as default};
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.