1import{j as e,r as l}from"./react-vendor.B75MsAI9.js";import{cH as a,u as i,O as o,Q as s,V as t,U as r,t as n,s as p,r as d,p as u,aN as f,ei as c,bm as g,ej as m,a as v,E as y,aG as h,aH as L,H as j,aI as w,aJ as F,aK as b,x as S,y as A,z as V}from"./AuthModalContainer.CwDh3qj_.js";import{u as k}from"./RTLProvider.Dbr8G8Qw.js";import{F as I}from"./FiltersBar.C4fvBThS.js";import{F as O}from"./FiltersPanel.CVoPsmCv.js";import{R as x}from"./ReadingLists.B5hCGlC1.js";import{P as M}from"./Pagination.qyXpDyCG.js";import{B as R}from"./Block.DxpdHCJY.js";import{P as N}from"./PageHeader.DyETjqw4.js";import{N as B}from"./NoResults.BLa53yYz.js";import{f as C}from"./main.Bj0Ml4GZ.js";import"./flatMap.BtxoME2v.js";import"./pick.Cpaa_ErP.js";import"./SelectField.CyNICQh1.js";import"./Inliner.DMPsK-K7.js";import"./ReadingListCard.D-LWH4X3.js";import"./LazyFontLoader.pvie9HdJ.js";const P=l=>{const{isFetchingAllLists:n,lists:p,listsInfo:d,headerBgUrl:u=a.defaultHeaderBgUrl,loadedPages:f,loadMore:c,filtersComponent:g,openListQuickView:m,saveOfflineWorkflow:v,unsaveOfflineWorkflow:y,isAvailableOffline:h,offlineBooks:L,addSlimNotification:j,windowDimensions:w,addNotificationModal:F,removeNotificationModal:b,isLoggedIn:S,viewport:A,openAuthModal:V,profile:k,isRtl:I}=l,O=i(),C="pb-all-lists",P={[C]:!0},$=[{title:O("global.home"),href:o.home(),isInternal:!0},{title:O("global.list",2),href:o.lists()}];return e.jsxs("div",{className:s(P),children:[e.jsx(t,{children:e.jsx("title",{children:`${O("global.all-lists")} - ${O("global.site-title")}`})}),e.jsx(N,{image:u,pullInBottom:!0,title:O("global.all-lists"),breadcrumbPaths:$,isRtl:I}),e.jsxs(R,{children:[g,e.jsx(x,{lists:p,owner:!0,openListQuickView:m,saveOfflineWorkflow:v,unsaveOfflineWorkflow:y,isAvailableOffline:h,offlineBooks:L,isLoggedIn:S,addSlimNotification:j,windowDimensions:w,addNotificationModal:F,removeNotificationModal:b,viewport:A,openAuthModal:V,profile:k,isRtl:I}),0===f?e.jsx(r,{}):null,p.length<d.hits&&f>0?e.jsx(M,{onClick:c,loading:n}):null,n||p.length?null:e.jsx(B,{isRtl:I})]})]})};P.propTypes={};const $={category:[],level:[],language:[],sort:f.relevance,tags:[],query:""},H=()=>{var a,o,s,t,x;const M=i(),R=n(),N=p();d();const B=k(),[H,_]=l.useState({category:"",publisher:"",level:"",language:""}),q=u(e=>e.allLists),D=u(e=>e.viewport),T=u(e=>e.user),W=u(e=>e.offlineBooks),U=u(e=>e.windowDimensions),{isFetchingAllLists:z,lists:E,loadedPages:Q,listsInfo:K,filters:J,isFetchingFilters:G}=q,X=l.useMemo(()=>[{name:M("sort.relevance"),queryValue:f.relevance},{name:M("sort.new-arrivals"),queryValue:f.newArrivals},{name:M("sort.most-viewed"),queryValue:f.mostViewed},{name:M("sort.most-liked"),queryValue:f.mostLiked}],[M]),Y=l.useMemo(()=>X.map(e=>({label:e.name,value:e.queryValue})),[X]),Z=()=>{const e=S.parse(window.location.search);return Object.entries(e).forEach(([l,a])=>{Array.isArray($[l])&&!Array.isArray(a)&&(e[l]=[a])}),{...$,...e}},ee=(e,l)=>{_(a=>({...a,[e]:l}))},le=e=>ee("category",e.target.value),ae=e=>ee("level",e.target.value),ie=e=>ee("language",e.target.value),oe=(e,l)=>{const a=A(Z());Array.isArray(a[e])?a[e].push(l):a[e]=l,R(c()),N(`${location.pathname}?${S.stringify(a)}`.replace(`/${V}`,""),{replace:!0}),R(m({appliedFilters:a,page:1}))},se=(e,l)=>{const a=A(Z());if(a[e]){if(Array.isArray(a[e])){const i=a[e].indexOf(l);-1!==i&&a[e].splice(i,1)}else delete a[e];R(c()),N(`${location.pathname}?${S.stringify(a)}`.replace(`/${V}`,""),{replace:!0}),R(m({appliedFilters:a,page:1}))}},te=e=>oe("sort",e);l.useEffect(()=>{R(c()),R(g()).then(()=>{R(m({appliedFilters:Z(),page:1}))})},[R]);const re={};J&&J.forEach(e=>{re[e.queryKey]=e});const ne=Z(),pe=(null==K?void 0:K.hits)||0,de=(null==K?void 0:K.totalReads)||0;if(!J||G)return e.jsx(r,{});let ue=null;return ue=D.medium?e.jsx(I,{noTopBorder:!0,pullUp:!0,isFetchingData:z,filters:re,applyFilter:oe,removeFilter:se,appliedFilters:ne,categorySearchValue:H.category,updateCategorySearchValue:le,levelSearchValue:H.level,updateLevelSearchValue:ae,languageSearchValue:H.language,updateLanguageSearchValue:ie,itemTypeLabel:M("global.list",pe),resultsCount:pe,readCount:de,s
1ortOptions:X,applySortOption:te,appliedSortOption:ne.sort,isRtl:B,useLevelFilterLabelFromAPI:!0,userId:null==(a=T.profile)?void 0:a.id,userType:null==(o=T.profile)?void 0:o.profile_type,category:v.allListsHome}):e.jsx(O,{viewport:D,filters:re,isFetchingData:z,applyFilter:oe,removeFilter:se,clearFilter:e=>{const l=A(Z());l[e]&&(Array.isArray(l[e])?l[e]=[]:delete l[e],R(c()),N(`${location.pathname}?${S.stringify(l)}`.replace(`/${V}`,""),{replace:!0}),R(m({appliedFilters:l,page:1})))},appliedFilters:ne,categorySearchValue:H.category,updateCategorySearchValue:le,levelSearchValue:H.level,updateLevelSearchValue:ae,languageSearchValue:H.language,updateLanguageSearchValue:ie,itemTypeLabel:M("global.list",pe),resultsCount:pe,readCount:de,sortOptions:Y,applySortOption:te,appliedSortOption:ne.sort,floatingFilter:!0,isRtl:B,useLevelFilterLabelFromAPI:!0,userId:null==(s=T.profile)?void 0:s.id,userType:null==(t=T.profile)?void 0:t.profile_type,category:v.allListsHome}),e.jsx(P,{isFetchingAllLists:z,lists:E,listsInfo:K,loadedPages:Q,loadMore:()=>{var e,l;const a=Z();R(m({appliedFilters:a,page:Q+1})),window.dataLayer&&window.dataLayer.push({event:v.clickedLoadMore,category:v.allListsHome,label:v.bottomButton,item_type:null,item_id:null,item_value:null,user_id:null==(e=T.profile)?void 0:e.id,user_profile:null==(l=T.profile)?void 0:l.profile_type})},filtersComponent:ue,userRoles:null==(x=T.profile)?void 0:x.roles,openListQuickView:e=>R(b({list:e})),saveOfflineWorkflow:(e,l,a)=>R(F({book:e,imageSize:l,userId:a})),unsaveOfflineWorkflow:(e,l,a)=>R(w({book:e,imageSize:l,userId:a})),isAvailableOffline:e=>{var l;return!!(null==(l=T.profile)?void 0:l.id)&&C(e,W,"read",T.profile.id)},offlineBooks:W,addSlimNotification:e=>R(j(e)),windowDimensions:U,addNotificationModal:e=>R(L(e)),removeNotificationModal:()=>R(h()),isLoggedIn:T.isLoggedIn,viewport:D,openAuthModal:()=>R(y()),profile:T.profile,isRtl:B})};export{H as default}; 2//# sourceMappingURL=index.TQQufCds.js.map
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.