import{ao as a,aX as y,gP as v,aZ as S,az as N,f7 as R,bN as A,L as C,aI as k,aC as B,v as p,T as h,f as n,e as c,aq as u,b5 as E,hq as I,r as b,p as x,E as g,hr as w,a$ as H,ba as P,au as D,av as T,fB as O}from"./app-k0jcl5PQ.js";import{L as _}from"./CeW16Gou.chunk.js";const $="_library_1ptb3_1",F="_logo_1ptb3_4",o={library:$,logo:F};function L(){return a.jsx("div",{className:`${o.library} col-6 mb-3`,children:a.jsxs("div",{className:`border rounded-3 d-flex align-items-center
                    justify-content-center flex-column text-decoration-none h-100 p-3 text-center`,children:[a.jsx("div",{className:`${o.logo} mx-auto mb-3 rounded-circle partial-loading-background`}),a.jsx("div",{className:"partial-loading-background",style:{width:"50%",height:"1.2rem"}})]})})}function q(){return a.jsxs("div",{className:"row",children:[a.jsx(L,{}),a.jsx(L,{})]})}const l="libraries.libraries",z=C.encloseNamespace(l);function U(){var m;const{hasPermissions:f}=y(),{focusSearchBar:j}=v(),t=f(S.ViewLibraries),s=N(t&&R.domainLibraries(["customLibrary","sharedLibrary"]));function d(){p.trigger({application:c.DASHBOARD,action:n.Dashboard.HOME,args:[null]},{replace:!0})}return A({title:z("header")}),k.useEffect(()=>{var e,i;if(!t)return d();if(s.hasCompleted){if(!((e=s.data)!=null&&e.length))return d();if(((i=s.data)==null?void 0:i.length)===1){const r=B.first(s.data);p.trigger({application:c.LIBRARIES,action:n.Libraries.LIBRARY,args:[r.id,h.slugify(r.name)]},{replace:!0})}}},[s.hasCompleted,t]),s.hasCompleted&&!((m=s.data)!=null&&m.length)||!t?a.jsx(a.Fragment,{}):a.jsxs("div",{className:"px-3",children:[a.jsxs("div",{className:"d-flex justify-content-between align-items-end pb-3",children:[a.jsx("h1",{className:"h2 mb-0",children:a.jsx(u,{namespace:l,phrase:"header"})}),a.jsx("div",{children:a.jsx("div",{className:"ms-2 d-sm-inline-block d-none",children:a.jsx(E,{svg:H,appLink:{application:c.SEARCH,action:n.Search.HOME,params:{source:w.School}},className:"btn btn-outline-dark me-2",onClick:j,analyticsData:{},analyticsOptions:{entity:g.SearchResults,location:x.Libraries,actionType:b.Click,descriptor:I.School},children:a.jsx(u,{namespace:l,phrase:"searchLibraries"})})})})]}),s.hasCompleted?a.jsx("ul",{className:"list-unstyled row mb-n3",children:_.sort(s.data).map(e=>{var i,r;return a.jsx("li",{className:`${o.library} col-6 mb-3`,children:a.jsxs(P,{appLink:{application:c.LIBRARIES,action:n.Libraries.LIBRARY,args:[e.id,h.slugify(e.name)]},className:`border rounded-3 d-flex align-items-center
                    justify-content-center flex-column text-decoration-none h-100 p-3 text-center`,analyticsData:{id:e.id,name:e.name},analyticsOptions:{actionType:b.Click,entity:g.Library,location:x.Libraries},children:[a.jsx("div",{className:`${o.logo} mx-auto mb-3`,children:a.jsx(D,{imageUrl:(r=(i=e.owner)==null?void 0:i.logo)==null?void 0:r.url,svg:O,variant:"teal",svgSize:T.Large})}),a.jsx("div",{className:"h6",children:e.name})]})},e.id)})}):a.jsx(q,{})]})}export{U as LibrariesView};
//# sourceMappingURL=CPzOuZ72.chunk.js.map
