"use strict";(self.webpackChunk_digicms_admin=self.webpackChunk_digicms_admin||[]).push([[801],{66244:(nt,C,t)=>{t.r(C),t.d(C,{default:()=>qe});var e=t(32735),d=t(88425),w=t(84968),k=t(33795),q=t.n(k);const O={i8:"1.0.1"};var T=t(85539),c=t(5141),_=t(74506),ee=t(51968),A=t(19615),te=t(60216),h=t.n(te),j=t(5636),ne=t(27635),g=t(34499),ae=t(54742),S=t(9808),D=t(95602),oe=t(90662),se=t(82926),re=t.n(se),le=t(70258),ie=t.n(le),ce=t(19799);const de=(0,A.default)(S.Box)`
  width: ${150/16}rem;
  position: absolute;
  bottom: ${({theme:n})=>n.spaces[9]};
  left: ${({theme:n})=>n.spaces[5]};
`,z=(0,A.default)(c.NavLink)`
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  padding: ${({theme:n})=>`${n.spaces[2]} ${n.spaces[4]}`};
  border-radius: ${({theme:n})=>n.spaces[1]};

  &:hover {
    background: ${({theme:n,logout:a})=>a?n.colors.danger100:n.colors.primary100};
    text-decoration: none;
  }

  svg {
    path {
      fill: ${({theme:n})=>n.colors.danger600};
    }
  }
`,U=({generalSectionLinks:n,pluginsSectionLinks:a})=>{const o=(0,e.useRef)(),[u,p]=(0,e.useState)(!1),{logos:{menu:l}}=(0,ce.Z)(),[f,m]=(0,d.usePersistentState)("navbar-condensed",!1),{userDisplayName:i}=(0,d.useAppInfos)(),{formatMessage:r}=(0,j.useIntl)(),y=i.split(" ").map(s=>s.substring(0,1)).join("").substring(0,2),E=()=>p(s=>!s),N=()=>{d.auth.clearAppStorage(),E()},M=s=>{var v,P;!s.currentTarget.contains(s.relatedTarget)&&((P=(v=s.relatedTarget)==null?void 0:v.parentElement)==null?void 0:P.id)!=="main-nav-user-button"&&p(!1)},x=r({id:"app.components.LeftMenu.navbrand.title",defaultMessage:"Digi Dashboard"});return e.createElement(g.MainNav,{condensed:f},e.createElement(g.NavBrand,{as:c.NavLink,workplace:r({id:"app.components.LeftMenu.navbrand.workplace",defaultMessage:"Workplace"}),title:x,icon:e.createElement("img",{src:l.custom||l.default,alt:r({id:"app.components.LeftMenu.logo.alt",defaultMessage:"Application logo"})})}),e.createElement(ne.Divider,null),e.createElement(g.NavSections,null,e.createElement(g.NavLink,{as:c.NavLink,to:"/content-manager",icon:e.createElement(re(),null)},r({id:"global.content-manager",defaultMessage:"Content manager"})),a.length>0?e.createElement(g.NavSection,{label:r({id:"app.components.LeftMenu.plugins",defaultMessage:"Plugins"})},a.map(s=>{const v=s.icon;return e.createElement(g.NavLink,{as:c.NavLink,to:s.to,key:s.to,icon:e.createElement(v,null)},r(s.intlLabel))})):null,n.length>0?e.createElement(g.NavSection,{label:r({id:"app.components.LeftMenu.general",defaultMessage:"General"})},n.map(s=>{const v=s.icon;return e.createElement(g.NavLink,{as:c.NavLink,badgeContent:s.notificationsCount>0&&s.notificationsCount.toString()||void 0,to:s.to,key:s.to,icon:e.createElement(v,null)},r(s.intlLabel))})):null),e.createElement(g.NavUser,{id:"main-nav-user-button",ref:o,onClick:E,initials:y},i),u&&e.createElement(de,{onBlur:M,padding:1,shadow:"tableShadow",background:"neutral0",hasRadius:!0},e.createElement(ae.FocusTrap,{onEscape:E},e.createElement(oe.Stack,{spacing:0},e.createElement(z,{tabIndex:0,onClick:E,to:"/me"},e.createElement(D.Typography,null,r({id:"global.profile",defaultMessage:"Profile"}))),e.createElement(z,{tabIndex:0,onClick:N,logout:"logout",to:"/auth/login"},e.createElement(D.Typography,{textColor:"danger600"},r({id:"app.components.LeftMenu.logout",defaultMessage:"Logout"})),e.createElement(ie(),null))))),e.createElement(g.NavCondense,{onClick:()=>m(s=>!s)},r(f?{id:"app.components.LeftMenu.expand",defaultMessage:"Expand the navbar"}:{id:"app.components.LeftMenu.collapse",defaultMessage:"Collapse the navbar"})))};U.propTypes={generalSectionLinks:h().array.isRequired,pluginsSectionLinks:h().array.isRequired};const ue=U;var pe=t(19192),me=t(16540);const fe=(0,A.default)(S.Box)`
  flex: 1;
`,F=({children:n,sideNav:a})=>{const{formatMessage:o}=(0,j.useIntl)();return e.createElement(S.Box,{background:"neutral100"},e.createElement(me.SkipToContent,null,o({id:"skipToContent",defaultMessage:"Skip to content"})),e.createElement(pe.Flex,{alignItems:"flex-start"},a,e.createElement(fe,null,n)))};F.propTypes={children:h().node.isRequired,sideNav:h().node.isRequired};const ge=F;var B=t(7602);const ve=(0,e.lazy)(()=>Promise.all([t.e(8469),t.e(6925),t.e(9420),t.e(4982),t.e(9649),t.e(4686),t.e(994)]).then(t.bind(t,66495))),he=(0,e.lazy)(()=>t.e(3981).then(t.bind(t,77660))),ye=(0,e.lazy)(()=>t.e(3677).then(t.bind(t,15415))),Ee=(0,e.lazy)(()=>Promise.all([t.e(8469),t.e(5516)]).then(t.bind(t,92698))),V=(0,e.lazy)(()=>Promise.resolve().then(t.bind(t,53951))),Pe=(0,e.lazy)(()=>t.e(9501).then(t.bind(t,92336))),Le=(0,e.lazy)(()=>t.e(9497).then(t.bind(t,9972))),$=(0,e.lazy)(()=>Promise.all([t.e(8469),t.e(9420),t.e(4982),t.e(7106),t.e(5895)]).then(t.bind(t,50020))),Ae=()=>{const{isLoading:n,generalSectionLinks:a,pluginsSectionLinks:o}=(0,T.H9)(),{menu:u}=(0,d.useStrapiApp)(),p=(0,e.useMemo)(()=>u.filter(l=>l.Component).map(({to:l,Component:f,exact:m})=>(0,B.ot)(f,l,m)),[u]);return n?e.createElement(d.LoadingIndicatorPage,null):e.createElement(_.DndProvider,{backend:ee.PD},e.createElement(ge,{sideNav:e.createElement(ue,{generalSectionLinks:a,pluginsSectionLinks:o})},e.createElement(e.Suspense,{fallback:e.createElement(d.LoadingIndicatorPage,null)},e.createElement(c.Switch,null,e.createElement(c.Route,{path:"/",component:he,exact:!0}),e.createElement(c.Route,{path:"/me",component:Le,exact:!0}),e.createElement(c.Route,{path:"/content-manager",component:ve}),p,e.createElement(c.Route,{path:"/settings/:settingId",component:$}),e.createElement(c.Route,{path:"/settings",component:$,exact:!0}),e.createElement(c.Route,{path:"/marketplace"},e.createElement(Ee,null)),e.createElement(c.Route,{path:"/list-plugins",exact:!0},e.createElement(ye,null)),e.createElement(c.Route,{path:"/404",component:V}),e.createElement(c.Route,{path:"/500",component:Pe}),e.createElement(c.Route,{path:"",component:V})))))};var Se=Object.defineProperty,G=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,K=(n,a,o)=>a in n?Se(n,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[a]=o,Ne=(n,a)=>{for(var o in a||(a={}))Re.call(a,o)&&K(n,o,a[o]);if(G)for(var o of G(a))Ie.call(a,o)&&K(n,o,a[o]);return n};const Me=n=>({plugins:Object.keys(n).reduce((a,o)=>(a[o]=Ne({},n[o]),a),{})});var xe=t(49415),Ce=t(3040),Oe=t.n(Ce);const W={plugins:null},Te=(n=W,a)=>(0,xe.default)(n,o=>{switch(a.type){case"SET_PLUGIN_READY":{Oe()(o,["plugins",a.pluginId,"isReady"],!0);break}default:return o}}),je=()=>{const{plugins:n}=(0,d.useStrapiApp)(),[{plugins:a},o]=(0,e.useReducer)(Te,W,()=>Me(n)),u=(0,e.useRef)(l=>{o({type:"SET_PLUGIN_READY",pluginId:l})});if(Object.keys(a).some(l=>a[l].isReady===!1)){const l=Object.keys(a).reduce((f,m)=>{const i=a[m].initializer;if(i){const r=a[m].pluginId;f.push(e.createElement(i,{key:r,setPlugin:u.current}))}return f},[]);return e.createElement(e.Fragment,null,l,e.createElement(d.LoadingIndicatorPage,null))}return e.createElement(Ae,null)};var Q=t(4409),H=t(17367);const De=()=>({type:H.l}),ze=n=>({type:H.m,permissions:n}),Y=({children:n,permissions:a,refetchPermissions:o})=>{const{allPermissions:u}=(0,Q.useSelector)(l=>l.rbacProvider),p=(0,Q.useDispatch)();return(0,e.useEffect)(()=>(p(ze(a)),()=>{p(De())}),[a,p]),u?e.createElement(d.RBACProviderContext.Provider,{value:{allPermissions:u,refetchPermissions:o}},n):e.createElement(d.LoadingIndicatorPage,null)};Y.propTypes={children:h().element.isRequired,permissions:h().array.isRequired,refetchPermissions:h().func.isRequired};const Ue=Y;var Fe=t(43653),Be=t.n(Fe),R=t(17247),L=(n,a,o)=>new Promise((u,p)=>{var l=i=>{try{m(o.next(i))}catch(r){p(r)}},f=i=>{try{m(o.throw(i))}catch(r){p(r)}},m=i=>i.done?u(i.value):Promise.resolve(i.value).then(l,f);m((o=o.apply(n,a)).next())});const Ve=O.i8,$e=()=>L(void 0,null,function*(){try{const{data:{tag_name:n}}=yield Be().get("https://api.github.com/repos/strapi/strapi/releases/latest");return n}catch(n){return Ve}}),Ge=()=>L(void 0,null,function*(){try{const{data:n,headers:a}=yield R.be.get("/admin/information");if(!a["content-type"].includes("application/json"))throw new Error("Not found");return n.data}catch(n){throw new Error(n)}}),Ke=()=>L(void 0,null,function*(){try{const{data:n,headers:a}=yield R.be.get("/admin/users/me/permissions");if(!a["content-type"].includes("application/json"))throw new Error("Not found");return n.data}catch(n){throw new Error(n)}}),We=()=>L(void 0,null,function*(){try{const{data:{data:{roles:n}}}=yield R.be.get("/admin/users/me");return n}catch(n){throw new Error(n)}});var Qe=t(54770),I=t.n(Qe);const He=(n,a)=>!I().valid(n)||!I().valid(a)?!1:I().lt(n,a);var Ye=Object.defineProperty,Ze=Object.defineProperties,Je=Object.getOwnPropertyDescriptors,Z=Object.getOwnPropertySymbols,Xe=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,J=(n,a,o)=>a in n?Ye(n,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[a]=o,we=(n,a)=>{for(var o in a||(a={}))Xe.call(a,o)&&J(n,o,a[o]);if(Z)for(var o of Z(a))be.call(a,o)&&J(n,o,a[o]);return n},ke=(n,a)=>Ze(n,Je(a));const X=O.i8,qe=()=>{const{setGuidedTourVisibility:n}=(0,d.useGuidedTour)(),a=(0,d.useNotification)(),o=(0,e.useRef)(n),u=d.auth.getUserInfo(),p=q()(u,"username")||(0,B.Pp)(u.firstname,u.lastname),[l,f]=(0,e.useState)(p),{showReleaseNotification:m}=(0,T.um)(),[{data:i,status:r},{data:y,isLoading:E},{data:N,status:M,refetch:x,isFetched:s,isFetching:v},{data:P}]=(0,w.useQueries)([{queryKey:"app-infos",queryFn:Ge},{queryKey:"strapi-release",queryFn:()=>$e(a),enabled:m,initialData:X},{queryKey:"admin-users-permission",queryFn:Ke,initialData:[]},{queryKey:"user-roles",queryFn:We}]),b=(0,e.useMemo)(()=>He(X,y),[y]);(0,e.useEffect)(()=>{P&&P.find(({code:tt})=>tt==="strapi-super-admin")&&(i==null?void 0:i.autoReload)&&o.current(!0)},[P,i]);const _e=E||(v&&s||r==="loading"||M==="loading"),et=(0,e.useMemo)(()=>ke(we({},i),{latestStrapiReleaseTag:y,setUserDisplayName:f,shouldUpdateStrapi:b,userDisplayName:l}),[i,y,b,l]);return _e?e.createElement(d.LoadingIndicatorPage,null):r==="error"?e.createElement("div",null,"error..."):e.createElement(d.AppInfosContext.Provider,{value:et},e.createElement(Ue,{permissions:N,refetchPermissions:x},e.createElement(je,null)))}}}]);
