"use strict";(self.webpackChunk_digicms_admin=self.webpackChunk_digicms_admin||[]).push([[801],{4507:function(X,M,e){e.r(M),e.d(M,{default:function(){return _e}});var t=e(32735),c=e(58521),C=e(84968),U=e(33795),E=e.n(U),W={i8:"1.1.0"},O=e(31842),d=e(5141),L=e(74506),H=e(51968),$=e(83292),oe=e(60216),N=e.n(oe),A=e(5636),b=e(1897),R=e(42889),m=e(78464),j=e(15300),F=e(72850),z=e(17247),B=e(79318),V=e(66618),Z=e(77013),_=e(58469),ne=e(39935),J=e.n(ne),ae=(n,o)=>o?(0,_.ZP)(n,o.toLowerCase(),{keys:[i=>i.title.toLowerCase()]}):n.sort((i,h)=>{const v=J()(i.title),g=J()(h.title);return v<g?-1:v>g?1:0}),se=e(47510),s=e(4409),r=e(94638),a=e(55721),l=e(70836),P=e(95952),x=e(49943),f=e(42882),u=e(6474),y=e(98399),Y=()=>{const n=(0,s.useDispatch)(),o=(0,c.useNotification)(),i=(0,t.useRef)(),{allPermissions:h}=(0,c.useRBACProvider)(),{runHookWaterfall:v}=(0,c.useStrapiApp)(),p=a.Z.CancelToken.source(),{notifyStatus:S}=(0,r.G)(),{formatMessage:I}=(0,A.useIntl)(),[k,D]=(0,t.useState)({collectionTypeLinks:[],singleTypeLinks:[]}),q=async()=>{try{const[{data:{data:Q}},{data:{data:te}}]=await Promise.all(["components","content-types"].map(me=>z.be.get((0,P.IF)(me),{cancelToken:p.token})));S(I({id:(0,P.OB)("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const{authorizedCtLinks:le,authorizedStLinks:ce}=await(0,u.Z)(te,h,o),{ctLinks:ue}=v(l.LK,{ctLinks:le,models:te}),{stLinks:de}=v(l.dV,{stLinks:ce,models:te});D({collectionTypeLinks:ue,singleTypeLinks:de})}catch(Q){if(a.Z.isCancel(Q))return;y.error(Q),o({type:"warning",message:{id:"notification.error"}})}};return i.current=q,(0,t.useEffect)(()=>(i.current(),()=>{p.cancel("Operation canceled by the user."),n((0,x.b9)())}),[]),{...k,refetchData:i.current}};const ee=()=>{const[n]=(0,t.useState)(""),{formatMessage:o}=(0,A.useIntl)(),{collectionTypeLinks:i,singleTypeLinks:h}=Y(),v=I=>I.map(k=>({...k,title:o({id:k.title,defaultMessage:k.title})})),g=v(i),p=v(h),S=[{id:"collectionTypes",title:{id:(0,se.Z)("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:ae(g,n)},{id:"singleTypes",title:{id:(0,se.Z)("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:ae(p,n)}];return t.createElement("div",null,t.createElement(K,null,S.map(I=>{const k=o({id:I.title.id,defaultMessage:I.title.defaultMessage},I.title.values);return t.createElement(B.D,{key:I.id,label:k,badgeLabel:I.links.length.toString()},I.links.map(D=>{const q=D.search?`?${D.search}`:"";return t.createElement(V.E,{as:d.NavLink,key:D.uid,to:`${D.to}${q}`},D.title)}))})))},K=(0,$.default)(Z.Z)`
  margin-left: -10px;
  margin-right: -10px;
  ol {
    margin-right: 5px;
    overflow-y: hidden;
    max-height: 280px;
    &:hover {
      overflow-y: auto;
    }
    a {
      background-color: transparent;
    }
    /* width */
    &::-webkit-scrollbar {
      width: 3px;
    }

    /* Track */
    &::-webkit-scrollbar-track {
      background: #dcdcdc;
    }

    /* Handle */
    &::-webkit-scrollbar-thumb {
      background: #c4c4c4;
    }

    /* Handle on hover */
    &::-webkit-scrollbar-thumb:hover {
      background: #555;
    }
  }
`;var w=ee;const st=(0,$.default)(F.x)`
  width: ${150/16}rem;
  position: absolute;
  bottom: ${({theme:n})=>n.spaces[9]};
  left: ${({theme:n})=>n.spaces[5]};
`,ot=(0,$.default)(d.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:o})=>o?n.colors.danger100:n.colors.primary100};
    text-decoration: none;
  }

  svg {
    path {
      fill: ${({theme:n})=>n.colors.danger600};
    }
  }
`,fe=({generalSectionLinks:n,pluginsSectionLinks:o})=>{const{formatMessage:i}=(0,A.useIntl)(),{trackUsage:h}=(0,c.useTracking)(),{pathname:v}=(0,d.useLocation)(),g=(0,d.useHistory)();return t.createElement(Ie,{className:"demo"},t.createElement(b._,{id:"main-nav"},t.createElement(w,null),o.length>0?t.createElement(R.y,{label:i({id:"app.components.LeftMenu.plugins",defaultMessage:"Plugins"})},o.map(p=>{const S=p.icon;return t.createElement(m.O,{as:d.NavLink,to:p.to,key:p.to,icon:t.createElement(S,null)},i(p.intlLabel))})):null,n.length>0?t.createElement(R.y,{label:i({id:"app.components.LeftMenu.general",defaultMessage:"General"})},n.map(p=>{const S=p.icon;return t.createElement(m.O,{as:d.NavLink,badgeContent:p.notificationsCount>0&&p.notificationsCount.toString()||void 0,to:p.to,key:p.to,icon:t.createElement(S,null)},i(p.intlLabel))})):null))};fe.propTypes={generalSectionLinks:N().array.isRequired,pluginsSectionLinks:N().array.isRequired};const Ie=(0,$.default)(j.$)`
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 24px;
  hr + div {
    max-height: 100%;
    max-height: 100%;
    overflow-y: hidden;
    padding-bottom: 80px;
    &:hover {
      overflow-y: auto;
    }
    /* width */
    &::-webkit-scrollbar {
      width: 3px;
    }

    /* Track */
    &::-webkit-scrollbar-track {
      background: #dcdcdc;
    }

    /* Handle */
    &::-webkit-scrollbar-thumb {
      background: #c4c4c4;
    }

    /* Handle on hover */
    &::-webkit-scrollbar-thumb:hover {
      background: #555;
    }
  }
  #main-nav-user-button {
    background-color: #fff;
  }
`;var Me=fe,Ae=e(87933),Ce=e(10728);const Re=(0,$.default)(F.x)`
  flex: 1;
`,ye=({children:n,sideNav:o})=>{const{formatMessage:i}=(0,A.useIntl)();return t.createElement(F.x,{background:"neutral100"},t.createElement(Ce.z,null,i({id:"skipToContent",defaultMessage:"Skip to content"})),t.createElement(Ae.k,{alignItems:"flex-start"},o,t.createElement(Re,null,n)))};ye.propTypes={children:N().node.isRequired,sideNav:N().node.isRequired};var xe=ye,re=e(64421);const De=(0,t.lazy)(()=>Promise.all([e.e(4429),e.e(5910),e.e(994)]).then(e.bind(e,32546))),Ne=(0,t.lazy)(()=>e.e(3981).then(e.bind(e,38364))),be=(0,t.lazy)(()=>e.e(3677).then(e.bind(e,15415))),Fe=(0,t.lazy)(()=>e.e(5516).then(e.bind(e,49298))),he=(0,t.lazy)(()=>Promise.resolve().then(e.bind(e,53951))),ke=(0,t.lazy)(()=>e.e(9501).then(e.bind(e,92336))),Oe=(0,t.lazy)(()=>e.e(9497).then(e.bind(e,9972))),ve=(0,t.lazy)(()=>Promise.all([e.e(3343),e.e(5895)]).then(e.bind(e,86360)));var je=()=>{const{isLoading:n,generalSectionLinks:o,pluginsSectionLinks:i}=(0,O.H9)(),{menu:h}=(0,c.useStrapiApp)(),v=(0,t.useMemo)(()=>h.filter(g=>g.Component).map(({to:g,Component:p,exact:S})=>(0,re.ot)(p,g,S)),[h]);return n?t.createElement(c.LoadingIndicatorPage,null):t.createElement(L.DndProvider,{backend:H.PD},t.createElement(xe,{sideNav:t.createElement(Me,{generalSectionLinks:o,pluginsSectionLinks:i})},t.createElement(t.Suspense,{fallback:t.createElement(c.LoadingIndicatorPage,null)},t.createElement(d.Switch,null,t.createElement(d.Route,{path:"/",component:Ne,exact:!0}),t.createElement(d.Route,{path:"/me",component:Oe,exact:!0}),t.createElement(d.Route,{path:"/content-manager",component:De}),v,t.createElement(d.Route,{path:"/settings/:settingId",component:ve}),t.createElement(d.Route,{path:"/settings",component:ve,exact:!0}),t.createElement(d.Route,{path:"/marketplace"},t.createElement(Fe,null)),t.createElement(d.Route,{path:"/list-plugins",exact:!0},t.createElement(be,null)),t.createElement(d.Route,{path:"/404",component:he}),t.createElement(d.Route,{path:"/500",component:ke}),t.createElement(d.Route,{path:"",component:he})))))},ze=n=>({plugins:Object.keys(n).reduce((o,i)=>(o[i]={...n[i]},o),{})}),Ue=e(97889),$e=e(3040),Be=e.n($e);const Le={plugins:null};var Ze=(n=Le,o)=>(0,Ue.default)(n,i=>{switch(o.type){case"SET_PLUGIN_READY":{Be()(i,["plugins",o.pluginId,"isReady"],!0);break}default:return i}}),Ke=()=>{const{plugins:n}=(0,c.useStrapiApp)(),[{plugins:o},i]=(0,t.useReducer)(Ze,Le,()=>ze(n)),h=(0,t.useRef)(g=>{i({type:"SET_PLUGIN_READY",pluginId:g})});if(Object.keys(o).some(g=>o[g].isReady===!1)){const g=Object.keys(o).reduce((p,S)=>{const I=o[S].initializer;if(I){const k=o[S].pluginId;p.push(t.createElement(I,{key:k,setPlugin:h.current}))}return p},[]);return t.createElement(t.Fragment,null,g,t.createElement(c.LoadingIndicatorPage,null))}return t.createElement(je,null)},Te=e(17367);const We=()=>({type:Te.l}),He=n=>({type:Te.m,permissions:n}),Ee=({children:n,permissions:o,refetchPermissions:i})=>{const{allPermissions:h}=(0,s.useSelector)(g=>g.rbacProvider),v=(0,s.useDispatch)();return(0,t.useEffect)(()=>(v(He(o)),()=>{v(We())}),[o,v]),h?t.createElement(c.RBACProviderContext.Provider,{value:{allPermissions:h,refetchPermissions:i}},n):t.createElement(c.LoadingIndicatorPage,null)};Ee.propTypes={children:N().element.isRequired,permissions:N().array.isRequired,refetchPermissions:N().func.isRequired};var Ve=Ee;const Ge=W.i8,Qe=async()=>{try{const{data:{tag_name:n}}=await a.Z.get("https://api.github.com/repos/strapi/strapi/releases/latest");return n}catch{return Ge}},Ye=async()=>{try{const{data:n,headers:o}=await z.be.get("/admin/information");if(!o["content-type"].includes("application/json"))throw new Error("Not found");return n.data}catch(n){throw new Error(n)}},Xe=async()=>{try{const{data:n,headers:o}=await z.be.get("/admin/users/me/permissions");if(!o["content-type"].includes("application/json"))throw new Error("Not found");return n.data}catch(n){throw new Error(n)}},Je=async()=>{try{const{data:{data:{roles:n}}}=await z.be.get("/admin/users/me");return n}catch(n){throw new Error(n)}};var we=e(54770),ie=e.n(we),qe=(n,o)=>!ie().valid(n)||!ie().valid(o)?!1:ie().lt(n,o);const Pe=W.i8;var _e=()=>{const{setGuidedTourVisibility:n}=(0,c.useGuidedTour)(),o=(0,c.useNotification)(),i=(0,t.useRef)(n),h=c.auth.getUserInfo(),v=E()(h,"username")||(0,re.Pp)(h.firstname,h.lastname),[g,p]=(0,t.useState)(v),[S,I]=(0,t.useState)(null),{showReleaseNotification:k}=(0,O.um)(),[{data:D,status:q},{data:Q,isLoading:te},{data:le,status:ce,refetch:ue,isFetched:de,isFetching:me},{data:pe}]=(0,C.useQueries)([{queryKey:"app-infos",queryFn:Ye},{queryKey:"strapi-release",queryFn:()=>Qe(o),enabled:k,initialData:Pe},{queryKey:"admin-users-permission",queryFn:Xe,initialData:[]},{queryKey:"user-roles",queryFn:Je}]),Se=(0,t.useMemo)(()=>qe(Pe,Q),[Q]);(0,t.useEffect)(()=>{pe&&pe.find(({code:ge})=>ge==="strapi-super-admin")&&D?.autoReload&&i.current(!0)},[pe,D]),(0,t.useEffect)(()=>{(async()=>{const ge=await(0,re.Qy)(h);I(ge)})()},[h]);const et=te||(me&&de||q==="loading"||ce==="loading"),tt=(0,t.useMemo)(()=>({...D,userId:S,latestStrapiReleaseTag:Q,setUserDisplayName:p,shouldUpdateStrapi:Se,userDisplayName:g}),[D,Q,Se,g,S]);return et?t.createElement(c.LoadingIndicatorPage,null):q==="error"?t.createElement("div",null,"error..."):t.createElement(c.AppInfosContext.Provider,{value:tt},t.createElement(Ve,{permissions:le,refetchPermissions:ue},t.createElement(Ke,null)))}},49943:function(X,M,e){e.d(M,{Yu:function(){return c},b9:function(){return C},dw:function(){return U}});var t=e(92886);const c=()=>({type:t.ZA}),C=()=>({type:t.c2}),U=(E,W,O,d)=>({type:t.ix,data:{authorizedCtLinks:E,authorizedStLinks:W,components:d,contentTypeSchemas:O}})},42882:function(X,M,e){e.d(M,{Vo:function(){return O},Yg:function(){return C}});var t=e(98178),c=e(34947);const C=()=>L=>L["content-manager_app"]||c.E,U=()=>createSelector(C(),L=>L),E=()=>createSelector(C(),L=>L.models),W=()=>createSelector(C(),L=>({collectionTypeLinks:L.collectionTypeLinks,singleTypeLinks:L.singleTypeLinks})),O=()=>(0,t.P1)(C(),({components:L,models:H})=>({schemas:[...L,...H]}));var d=null},6474:function(X,M,e){e.d(M,{Z:function(){return N}});var t=e(17247),c=e(92891),C=e(33348);const U=(A,b,R=[])=>A.filter(m=>m.isDisplayed).map(m=>{const j=[{action:"plugin::content-manager.explorer.create",subject:m.uid},{action:"plugin::content-manager.explorer.read",subject:m.uid}],F=[{action:"plugin::content-manager.explorer.read",subject:m.uid}],z=b==="collectionTypes"?j:F,B=R.find(({uid:Z})=>Z===m.uid);let V=null;if(B){const Z={page:1,pageSize:B.settings.pageSize,sort:`${B.settings.defaultSortBy}:${B.settings.defaultSortOrder}`};V=(0,C.stringify)(Z,{encode:!1})}return{permissions:z,search:V,kind:m.kind,title:m.info.displayName,to:`/content-manager/${m.kind}/${m.uid}`,uid:m.uid,name:m.uid,isDisplayed:m.isDisplayed}});var W=(A,b)=>{const[R,m]=(0,c.chain)(A).groupBy("kind").map((j,F)=>({name:F,links:j})).sortBy("name").value();return{collectionTypesSectionLinks:U((0,c.get)(R,"links",[]),"collectionTypes",b),singleTypesSectionLinks:U((0,c.get)(m,"links",[]),"singleTypes")}},O=e(58521),L=(A,b)=>b.map(({permissions:R})=>(0,O.hasPermissions)(A,R)),H=e(95952),$=e(98399),N=async(A,b,R)=>{try{const{data:{data:m}}=await t.be.get((0,H.IF)("content-types-settings")),{collectionTypesSectionLinks:j,singleTypesSectionLinks:F}=W(A,m),z=L(b,j),B=await Promise.all(z),V=j.filter((J,G)=>B[G]),Z=L(b,F),_=await Promise.all(Z),ne=F.filter((J,G)=>_[G]);return{authorizedCtLinks:V,authorizedStLinks:ne}}catch(m){return $.error(m),R({type:"warning",message:{id:"notification.error"}}),{authorizedCtLinks:[],authorizedStLinks:[],contentTypes:[]}}}},25708:function(X,M){M.Z={COMPONENT:"component",EDIT_FIELD:"editField",FIELD:"field",DYNAMIC_ZONE:"dynamicZone",RELATION:"relation"}},47510:function(X,M){const e=t=>`content-manager.${t}`;M.Z=e},95952:function(X,M,e){e.d(M,{_Q:function(){return _.Z},W3:function(){return U},ko:function(){return O},FE:function(){return L},Di:function(){return $},du:function(){return N},TA:function(){return R},Ts:function(){return j},Uo:function(){return z},IF:function(){return V},OB:function(){return Z.Z},w8:function(){return J},kc:function(){return se}});var t=e(99381),c=e.n(t),U=(s,r,a)=>{if(Array.isArray(s)&&r>=0&&a>=0&&r<=s.length-1&&a<=s.length-1){const l=c()(s),P=l.splice(r,1);return l.splice(a,0,P[0]),l}return s},E=e(92891),O=s=>{const r=s.type;return r==="relation"?!(0,E.toLower)(s.relationType).includes("morph"):!["json","dynamiczone","richtext","password"].includes(r)&&!!r};const d=(s,r)=>{typeof s=="function"?s(r):s!=null&&(s.current=r)},L=(...s)=>r=>s.forEach(a=>d(a,r)),H=(s,r)=>Object.keys(s).reduce((a,l)=>{const P=(0,E.get)(s,[l],{}),{default:x,component:f,type:u,required:y,min:T,repeatable:Y}=P;if(u==="json"&&(a[l]=null),u==="json"&&y===!0&&(a[l]={}),x!==void 0&&(a[l]=x),u==="component"){const ee=(0,E.get)(r,[f,"attributes"],{}),K=H(ee,r);if(y===!0&&(a[l]=Y===!0?[]:K),T&&Y===!0&&y){a[l]=[];for(let w=0;w<T;w+=1)a[l].push(K)}}return u==="dynamiczone"&&y===!0&&(a[l]=[]),a},{});var $=H,N=({layouts:s,metadatas:r,...a})=>{const l=s.list.map(f=>f.name?f.name:f),P=Object.keys(r).reduce((f,u)=>{const y=(0,E.get)(r,[u],{});let T=y.edit;return T.mainField&&(T={...T,mainField:y.edit.mainField.name}),{...f,[u]:{edit:T,list:(0,E.omit)(y.list,["mainField"])}}},{}),x=s.edit.map(f=>f.map(({name:u,size:y})=>({name:u,size:y})));return{...a,layouts:{edit:x,list:l},metadatas:P}};const A=(s,r)=>s.map(a=>({...a,subject:r}));var R=s=>{const r={create:[{action:"plugin::content-manager.explorer.create",subject:null}],delete:[{action:"plugin::content-manager.explorer.delete",subject:null}],publish:[{action:"plugin::content-manager.explorer.publish",subject:null}],read:[{action:"plugin::content-manager.explorer.read",subject:null}],update:[{action:"plugin::content-manager.explorer.update",subject:null}]};return Object.keys(r).reduce((a,l)=>(a[l]=A(r[l],s),a),{})},j=s=>s.split(".").filter(r=>(0,E.isNaN)(parseInt(r,10))),z=s=>{if(s.length===0)return-1;const r=Math.max.apply(Math,s.map(a=>a.__temp_key__??0));return Number.isNaN(r)?-1:r},V=s=>`/content-manager/${s}`,Z=e(47510),_=e(25708),J=(s,r,a)=>{const l=u=>r.find(y=>y.uid===u),P=Object.assign({},s),x=s[a].uid,f=l(x);return(0,E.set)(P,[a],{...s[a],...f}),Object.keys(s.components).forEach(u=>{const y=l(u);(0,E.set)(P,["components",u],{...s.components[u],...y})}),P},G=e(58521),se=(s,r,a)=>{const l=(P,x)=>Object.keys(P).reduce((f,u)=>{const y=(0,G.getType)(x,u),T=(0,E.get)(P,u),Y=(0,G.getOtherInfos)(x,[u,"component"]),ee=(0,G.getOtherInfos)(x,[u,"repeatable"]);return y==="dynamiczone"?(f[u]=T.map(K=>l(K,a[K.__component])),f):y==="component"?(ee?f[u]=T&&T.map(K=>l(K,a[Y])):f[u]=T&&l(T,a[Y]),f):(y!=="password"&&(f[u]=T),f)},{});return l(s,r)}}}]);
