@strapi/admin 4.1.9 → 4.1.10-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/admin/src/components/ConfigurationsProvider/index.js +51 -0
  2. package/admin/src/components/ConfigurationsProvider/reducer.js +28 -0
  3. package/admin/src/components/LeftMenu/index.js +4 -2
  4. package/admin/src/components/Providers/index.js +8 -4
  5. package/admin/src/components/UnauthenticatedLogo/index.js +4 -2
  6. package/admin/src/pages/App/index.js +7 -2
  7. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +85 -0
  8. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/init.js +13 -0
  9. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/reducer.js +43 -0
  10. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +116 -0
  11. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/reducer.js +28 -0
  12. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/stepper.js +25 -0
  13. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/AddLogoDialog.js +67 -0
  14. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromComputerForm.js +176 -0
  15. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromUrlForm.js +82 -0
  16. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/ImageCardAsset.js +51 -0
  17. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/PendingLogoDialog.js +97 -0
  18. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/index.js +85 -0
  19. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/reducer.js +28 -0
  20. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +149 -87
  21. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +16 -0
  22. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/constants.js +3 -0
  23. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/getFormData.js +17 -0
  24. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/parseFileMetadatas.js +76 -0
  25. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +17 -0
  26. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +21 -0
  27. package/admin/src/translations/en.json +25 -0
  28. package/build/7197.959bbe97.chunk.js +113 -0
  29. package/build/{9298.5b5c6ea1.chunk.js → 9298.f97fcef0.chunk.js} +2 -2
  30. package/build/Admin-authenticatedApp.d8767873.chunk.js +80 -0
  31. package/build/Admin_settingsPage.0d94a598.chunk.js +180 -0
  32. package/build/en-json.ca572384.chunk.js +1 -0
  33. package/build/index.html +1 -1
  34. package/build/{main.25315363.js → main.06f66609.js} +1 -1
  35. package/build/{runtime~main.1ecd9f7d.js → runtime~main.dc1c7ef6.js} +1 -1
  36. package/package.json +5 -5
  37. package/server/config/admin-actions.js +14 -0
  38. package/server/controllers/admin.js +33 -1
  39. package/server/routes/admin.js +28 -0
  40. package/server/services/index.js +1 -0
  41. package/server/services/project-settings.js +173 -0
  42. package/server/utils/index.d.ts +2 -0
  43. package/server/validation/project-settings.js +39 -0
  44. package/build/6706.b0b5124d.chunk.js +0 -113
  45. package/build/Admin-authenticatedApp.72cf6aa3.chunk.js +0 -80
  46. package/build/Admin_settingsPage.f83a7c21.chunk.js +0 -172
  47. package/build/en-json.3e1a222e.chunk.js +0 -1
@@ -0,0 +1,80 @@
1
+ "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[801],{72298:(K,R,n)=>{n.r(R),n.d(R,{default:()=>en});var e=n(32735),i=n(10938),B=n(84968),P=n(33795),Q=n.n(P);const S=JSON.parse('{"i8":"4.1.10-beta.0"}');var W=n(28492),f=n(5141),V=n(74506),x=n(51968),C=n(19615),U=n(60216),s=n.n(U),T=n(5636),G=n(27635),v=n(18403),b=n(54742),l=n(9808),d=n(95602),E=n(90662),M=n(82926),Be=n.n(M),be=n(70258),Ge=n.n(be),Ne=n(15015);const Ue=(0,C.default)(l.Box)`
2
+ width: ${150/16}rem;
3
+ position: absolute;
4
+ bottom: ${({theme:t})=>t.spaces[9]};
5
+ left: ${({theme:t})=>t.spaces[5]};
6
+ `,te=(0,C.default)(f.NavLink)`
7
+ display: flex;
8
+ justify-content: space-between;
9
+ align-items: center;
10
+ text-decoration: none;
11
+ padding: ${({theme:t})=>`${t.spaces[2]} ${t.spaces[4]}`};
12
+ border-radius: ${({theme:t})=>t.spaces[1]};
13
+
14
+ &:hover {
15
+ background: ${({theme:t,logout:a})=>a?t.colors.danger100:t.colors.primary100};
16
+ text-decoration: none;
17
+ }
18
+
19
+ svg {
20
+ path {
21
+ fill: ${({theme:t})=>t.colors.danger600};
22
+ }
23
+ }
24
+ `,ne=({generalSectionLinks:t,pluginsSectionLinks:a})=>{const o=(0,e.useRef)(),[r,u]=(0,e.useState)(!1),{logos:{menu:c}}=(0,Ne.Z)(),[g,y]=(0,i.usePersistentState)("navbar-condensed",!1),{userDisplayName:h}=(0,i.useAppInfos)(),{formatMessage:m}=(0,T.useIntl)(),L=h.split(" ").map(p=>p.substring(0,1)).join("").substring(0,2),D=()=>u(p=>!p),j=()=>{i.auth.clearAppStorage(),D()},$=p=>{var A,I;!p.currentTarget.contains(p.relatedTarget)&&((I=(A=p.relatedTarget)==null?void 0:A.parentElement)==null?void 0:I.id)!=="main-nav-user-button"&&u(!1)},N=m({id:"app.components.LeftMenu.navbrand.title",defaultMessage:"Strapi Dashboard"});return e.createElement(v.MainNav,{condensed:g},e.createElement(v.NavBrand,{workplace:m({id:"app.components.LeftMenu.navbrand.workplace",defaultMessage:"Workplace"}),title:N,icon:e.createElement("img",{src:c.custom||c.default,alt:N})}),e.createElement(G.Divider,null),e.createElement(v.NavSections,null,e.createElement(v.NavLink,{to:"/content-manager",icon:e.createElement(Be(),null)},m({id:"global.content-manager",defaultMessage:"Content manager"})),a.length>0?e.createElement(v.NavSection,{label:"Plugins"},a.map(p=>{const A=p.icon;return e.createElement(v.NavLink,{to:p.to,key:p.to,icon:e.createElement(A,null)},m(p.intlLabel))})):null,t.length>0?e.createElement(v.NavSection,{label:"General"},t.map(p=>{const A=p.icon;return e.createElement(v.NavLink,{badgeContent:p.notificationsCount>0&&p.notificationsCount.toString()||void 0,to:p.to,key:p.to,icon:e.createElement(A,null)},m(p.intlLabel))})):null),e.createElement(v.NavUser,{id:"main-nav-user-button",ref:o,onClick:D,initials:L},h),r&&e.createElement(Ue,{onBlur:$,padding:1,shadow:"tableShadow",background:"neutral0",hasRadius:!0},e.createElement(b.FocusTrap,{onEscape:D},e.createElement(E.Stack,{spacing:0},e.createElement(te,{tabIndex:0,onClick:D,to:"/me"},e.createElement(d.Typography,null,m({id:"global.profile",defaultMessage:"Profile"}))),e.createElement(te,{tabIndex:0,onClick:j,logout:"logout",to:"/auth/login"},e.createElement(d.Typography,{textColor:"danger600"},m({id:"app.components.LeftMenu.logout",defaultMessage:"Logout"})),e.createElement(Ge(),null))))),e.createElement(v.NavCondense,{onClick:()=>y(p=>!p)},m(g?{id:"app.components.LeftMenu.expand",defaultMessage:"Expand the navbar"}:{id:"app.components.LeftMenu.collapse",defaultMessage:"Collapse the navbar"})))};ne.propTypes={generalSectionLinks:s().array.isRequired,pluginsSectionLinks:s().array.isRequired};const Fe=ne;var O=n(19192),We=n(16540);const je=(0,C.default)(l.Box)`
25
+ flex: 1;
26
+ `,ae=({children:t,sideNav:a})=>{const{formatMessage:o}=(0,T.useIntl)();return e.createElement(l.Box,{background:"neutral100"},e.createElement(We.SkipToContent,null,o({id:"skipToContent",defaultMessage:"Skip to content"})),e.createElement(O.Flex,{alignItems:"flex-start"},a,e.createElement(je,null,t)))};ae.propTypes={children:s().node.isRequired,sideNav:s().node.isRequired};const $e=ae;var Y=n(16925),oe=n(28257);const Ke=(0,C.default)(l.Box)`
27
+ position: fixed;
28
+ bottom: ${({theme:t})=>t.spaces[2]};
29
+ right: ${({theme:t})=>t.spaces[2]};
30
+ `,Ve=C.default.button`
31
+ width: ${({theme:t})=>t.spaces[8]};
32
+ height: ${({theme:t})=>t.spaces[8]};
33
+ background: ${({theme:t})=>t.colors.primary600};
34
+ box-shadow: ${({theme:t})=>t.shadows.tableShadow};
35
+ border-radius: 50%;
36
+ svg {
37
+ color: ${({theme:t})=>t.colors.buttonNeutral0};
38
+ }
39
+ `,ze=(0,C.default)(l.Box)`
40
+ position: absolute;
41
+ bottom: ${({theme:t})=>`${t.spaces[9]}`};
42
+ right: 0;
43
+ width: ${200/16}rem;
44
+ `,He=C.default.a`
45
+ display: flex;
46
+ align-items: center;
47
+ text-decoration: none;
48
+ padding: ${({theme:t})=>t.spaces[2]};
49
+ padding-left: ${({theme:t})=>t.spaces[5]};
50
+
51
+ svg {
52
+ color: ${({theme:t})=>t.colors.neutral600};
53
+ margin-right: ${({theme:t})=>t.spaces[2]};
54
+ }
55
+
56
+ &:hover {
57
+ background: ${({theme:t})=>t.colors.neutral100};
58
+ color: ${({theme:t})=>t.colors.neutral500};
59
+
60
+ svg {
61
+ color: ${({theme:t})=>t.colors.neutral700};
62
+ }
63
+
64
+ ${[d.Typography]} {
65
+ color: ${({theme:t})=>t.colors.neutral700};
66
+ }
67
+ }
68
+
69
+ ${[d.Typography]} {
70
+ color: ${({theme:t})=>t.colors.neutral600};
71
+ }
72
+ `,ke=()=>{const[t,a]=(0,e.useState)(!1),{formatMessage:o}=(0,T.useIntl)(),{showTutorials:r}=(0,W.um)();if(!r)return null;const u=[{icon:"book",label:o({id:"global.documentation",defaultMessage:"Documentation"}),destination:"https://docs.strapi.io"},{icon:"file",label:o({id:"app.static.links.cheatsheet",defaultMessage:"CheatSheet"}),destination:"https://strapi-showcase.s3-us-west-2.amazonaws.com/CheatSheet.pdf"}],c=()=>{a(g=>!g)};return e.createElement(Ke,{as:"aside"},e.createElement(Ve,{id:"onboarding","aria-label":o({id:"app.components.Onboarding.help.button",defaultMessage:"Help button"}),onClick:c},!t&&e.createElement(Y.G,{icon:oe.faQuestion}),t&&e.createElement(Y.G,{icon:oe.faTimes})),t&&e.createElement(b.FocusTrap,{onEscape:c},e.createElement(ze,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingBottom:2,paddingTop:2},u.map(g=>e.createElement(He,{key:g.label,rel:"nofollow noreferrer noopener",target:"_blank",href:g.destination},e.createElement(Y.G,{icon:g.icon}),e.createElement(d.Typography,null,g.label))))))};var se=n(81430),Ze=n(88311),re=n.n(Ze),Qe=n(70620),Ye=n(64410),Xe=n(20763),ie=n(44526),Je=n(94009),we=n.n(Je);const qe=(0,C.default)(O.Flex)`
73
+ position: fixed;
74
+ z-index: 4;
75
+ inset: 0;
76
+ /* this is theme.colors.neutral800 with opacity */
77
+ background: ${({theme:t})=>`${t.colors.neutral800}1F`};
78
+ `,le=({onClose:t,onSkip:a,children:o,hideSkip:r})=>{const{formatMessage:u}=(0,T.useIntl)();return e.createElement(Ye.Portal,null,e.createElement(qe,{onClick:t,padding:8,justifyContent:"center"},e.createElement(b.FocusTrap,{onEscape:t},e.createElement(E.Stack,{background:"neutral0",width:(0,i.pxToRem)(660),shadow:"popupShadow",hasRadius:!0,padding:4,spacing:8,role:"dialog","aria-modal":!0,onClick:c=>c.stopPropagation()},e.createElement(O.Flex,{justifyContent:"flex-end"},e.createElement(Xe.IconButton,{onClick:t,"aria-label":u({id:"app.utils.close-label",defaultMessage:"Close"}),icon:e.createElement(we(),null)})),e.createElement(l.Box,{paddingLeft:7,paddingRight:7,paddingBottom:r?8:0},o),!r&&e.createElement(O.Flex,{justifyContent:"flex-end"},e.createElement(ie.Button,{variant:"tertiary",onClick:a},u({id:"app.components.GuidedTour.skip",defaultMessage:"Skip the tour"})))))))};le.propTypes={children:s().node.isRequired,onClose:s().func.isRequired,onSkip:s().func.isRequired,hideSkip:s().bool.isRequired};const _e=le;var de=n(49415);const ce={stepContent:null,sectionIndex:null,stepIndex:null,hasSectionAfter:!1,hasStepAfter:!1},et=(t=ce,a)=>(0,de.default)(t,o=>{switch(a.type){case"UPDATE_MODAL":{o.stepContent=a.content,o.sectionIndex=a.newSectionIndex,o.stepIndex=a.newStepIndex,o.hasSectionAfter=a.newHasSectionAfter,o.hasStepAfter=a.newHasStepAfter;break}default:return o}});var tt=n(74064),nt=n(30345),ue=n.n(nt);const at=C.default.li`
79
+ list-style: disc;
80
+ `,pe=({id:t,defaultMessage:a})=>{const{formatMessage:o}=(0,T.useIntl)();return e.createElement(E.Stack,{spacing:4,paddingBottom:6},o({id:t,defaultMessage:a},{documentationLink:r=>e.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:"https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest-api.html#api-parameters"},r),b:r=>e.createElement(d.Typography,{fontWeight:"semiBold"},r),p:r=>e.createElement(d.Typography,null,r),light:r=>e.createElement(d.Typography,{textColor:"neutral600"},r),ul:r=>e.createElement(l.Box,{paddingLeft:6},e.createElement("ul",null,r)),li:r=>e.createElement(at,null,r)}))};pe.propTypes={id:s().string.isRequired,defaultMessage:s().string.isRequired};const ot=pe;var X=n(29470),st=n(48634);const J=({number:t,last:a,type:o})=>e.createElement(l.Box,{paddingTop:3,paddingBottom:a?0:3},e.createElement(st.Z,{number:t,type:o}));J.defaultProps={number:void 0,last:!1,type:""},J.propTypes={number:s().number,last:s().bool,type:s().string};const me=J;var F=n(66358),rt=Object.defineProperty,ge=Object.getOwnPropertySymbols,it=Object.prototype.hasOwnProperty,lt=Object.prototype.propertyIsEnumerable,fe=(t,a,o)=>a in t?rt(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,dt=(t,a)=>{for(var o in a||(a={}))it.call(a,o)&&fe(t,o,a[o]);if(ge)for(var o of ge(a))lt.call(a,o)&&fe(t,o,a[o]);return t};const w=({title:t,content:a,cta:o,onCtaClick:r,sectionIndex:u,stepIndex:c,hasSectionAfter:g})=>{const{formatMessage:y}=(0,T.useIntl)(),h=u>0,m=c>0,L=u+1;return e.createElement(e.Fragment,null,e.createElement(O.Flex,{alignItems:"stretch"},e.createElement(O.Flex,{marginRight:8,justifyContent:"center",minWidth:(0,i.pxToRem)(30)},h&&e.createElement(X.Z,{type:F.hx,minHeight:(0,i.pxToRem)(24)})),e.createElement(d.Typography,{variant:"sigma",textColor:"primary600"},y({id:"app.components.GuidedTour.title",defaultMessage:"3 steps to get started"}))),e.createElement(O.Flex,null,e.createElement(O.Flex,{marginRight:8,minWidth:(0,i.pxToRem)(30)},e.createElement(me,{number:u+1,type:m?F.hx:F.lW})),e.createElement(d.Typography,{variant:"alpha",fontWeight:"bold",textColor:"neutral800",as:"h3",id:"title"},y(t))),e.createElement(O.Flex,{alignItems:"stretch"},e.createElement(O.Flex,{marginRight:8,direction:"column",justifyContent:"center",minWidth:(0,i.pxToRem)(30)},g&&e.createElement(e.Fragment,null,e.createElement(X.Z,{type:F.hx}),m&&e.createElement(me,{number:L+1,type:F.lW,last:!0}))),e.createElement(l.Box,null,e.createElement(ot,dt({},a)),o&&(o.target?e.createElement(tt.LinkButton,{endIcon:e.createElement(ue(),null),onClick:r,to:o.target},y(o.title)):e.createElement(ie.Button,{endIcon:e.createElement(ue(),null),onClick:r},y(o.title))))),m&&g&&e.createElement(l.Box,{paddingTop:3},e.createElement(O.Flex,{marginRight:8,justifyContent:"center",width:(0,i.pxToRem)(30)},e.createElement(X.Z,{type:F.hx,minHeight:(0,i.pxToRem)(24)}))))};w.defaultProps={currentStep:null,cta:void 0},w.propTypes={sectionIndex:s().number.isRequired,stepIndex:s().number.isRequired,hasSectionAfter:s().bool.isRequired,content:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired}).isRequired,cta:s().shape({target:s().string,title:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired})}),currentStep:s().string,onCtaClick:s().func.isRequired,title:s().shape({id:s().string.isRequired,defaultMessage:s().string.isRequired}).isRequired};const ct=w;var ut=Object.defineProperty,pt=Object.defineProperties,mt=Object.getOwnPropertyDescriptors,he=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,Ee=(t,a,o)=>a in t?ut(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,ht=(t,a)=>{for(var o in a||(a={}))gt.call(a,o)&&Ee(t,o,a[o]);if(he)for(var o of he(a))ft.call(a,o)&&Ee(t,o,a[o]);return t},Et=(t,a)=>pt(t,mt(a));const yt=()=>{const{currentStep:t,guidedTourState:a,setCurrentStep:o,setStepState:r,isGuidedTourVisible:u,setSkipped:c}=(0,i.useGuidedTour)(),[g,y]=(0,e.useState)(t),[{stepContent:h,sectionIndex:m,stepIndex:L,hasSectionAfter:D,hasStepAfter:j},$]=(0,e.useReducer)(et,ce),{trackUsage:N}=(0,i.useTracking)();(0,e.useEffect)(()=>{if(!t){y(!1);return}const[I]=re()(a,t);y(!I&&u)},[t,a,u]),(0,e.useEffect)(()=>{if(t){const[I]=re()(Qe.Z,t),H=Object.keys(a),[k,De]=t.split("."),ee=H.indexOf(k),Z=Object.keys(a[k]).indexOf(De),tn=ee<H.length-1,nn=Z<Object.keys(a[k]).length-1;$({type:"UPDATE_MODAL",content:I,newSectionIndex:ee,newStepIndex:Z,newHasSectionAfter:tn,newHasStepAfter:nn})}},[t,a]);const p=()=>{r(t,!0),N(h.trackingEvent),o(null)},A=()=>{c(!0),o(null),N("didSkipGuidedtour")};return g&&h?e.createElement(_e,{hideSkip:!j&&!D,onSkip:A,onClose:p},e.createElement(ct,Et(ht({},h),{onCtaClick:p,currentStep:t,sectionIndex:m,stepIndex:L,hasSectionAfter:D}))):null},vt=(0,e.lazy)(()=>Promise.all([n.e(8469),n.e(6404),n.e(4982),n.e(948),n.e(9298),n.e(994)]).then(n.bind(n,19415))),Tt=(0,e.lazy)(()=>Promise.all([n.e(4800),n.e(3981)]).then(n.bind(n,5085))),Pt=(0,e.lazy)(()=>n.e(3677).then(n.bind(n,73204))),Ct=(0,e.lazy)(()=>Promise.all([n.e(8469),n.e(5516)]).then(n.bind(n,19214))),ye=(0,e.lazy)(()=>Promise.resolve().then(n.bind(n,6437))),Mt=(0,e.lazy)(()=>n.e(9115).then(n.bind(n,69115))),Ot=(0,e.lazy)(()=>n.e(9497).then(n.bind(n,63072))),ve=(0,e.lazy)(()=>Promise.all([n.e(8469),n.e(6404),n.e(4982),n.e(2758),n.e(5895)]).then(n.bind(n,819))),Rt=()=>{const{trackUsage:t}=(0,i.useTracking)();(0,e.useEffect)(()=>{t("didAccessAuthenticatedAdministration")},[])},St=()=>{Rt();const{isLoading:t,generalSectionLinks:a,pluginsSectionLinks:o}=(0,W.H9)(),{menu:r}=(0,i.useStrapiApp)(),u=(0,e.useMemo)(()=>r.filter(c=>c.Component).map(({to:c,Component:g,exact:y})=>(0,se.ot)(g,c,y)),[r]);return t?e.createElement(i.LoadingIndicatorPage,null):e.createElement(V.DndProvider,{backend:x.PD},e.createElement($e,{sideNav:e.createElement(Fe,{generalSectionLinks:a,pluginsSectionLinks:o})},e.createElement(e.Suspense,{fallback:e.createElement(i.LoadingIndicatorPage,null)},e.createElement(f.Switch,null,e.createElement(f.Route,{path:"/",component:Tt,exact:!0}),e.createElement(f.Route,{path:"/me",component:Ot,exact:!0}),e.createElement(f.Route,{path:"/content-manager",component:vt}),u,e.createElement(f.Route,{path:"/settings/:settingId",component:ve}),e.createElement(f.Route,{path:"/settings",component:ve,exact:!0}),e.createElement(f.Route,{path:"/marketplace"},e.createElement(Ct,null)),e.createElement(f.Route,{path:"/list-plugins",exact:!0},e.createElement(Pt,null)),e.createElement(f.Route,{path:"/404",component:ye}),e.createElement(f.Route,{path:"/500",component:Mt}),e.createElement(f.Route,{path:"",component:ye}))),e.createElement(yt,null),e.createElement(ke,null)))};var At=Object.defineProperty,Te=Object.getOwnPropertySymbols,It=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable,Pe=(t,a,o)=>a in t?At(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,Lt=(t,a)=>{for(var o in a||(a={}))It.call(a,o)&&Pe(t,o,a[o]);if(Te)for(var o of Te(a))xt.call(a,o)&&Pe(t,o,a[o]);return t};const Dt=t=>({plugins:Object.keys(t).reduce((a,o)=>(a[o]=Lt({},t[o]),a),{})});var Bt=n(3040),bt=n.n(Bt);const Ce={plugins:null},Gt=(t=Ce,a)=>(0,de.default)(t,o=>{switch(a.type){case"SET_PLUGIN_READY":{bt()(o,["plugins",a.pluginId,"isReady"],!0);break}default:return o}}),Nt=()=>{const{plugins:t}=(0,i.useStrapiApp)(),[{plugins:a},o]=(0,e.useReducer)(Gt,Ce,()=>Dt(t)),r=(0,e.useRef)(c=>{o({type:"SET_PLUGIN_READY",pluginId:c})});if(Object.keys(a).some(c=>a[c].isReady===!1)){const c=Object.keys(a).reduce((g,y)=>{const h=a[y].initializer;if(h){const m=a[y].pluginId;g.push(e.createElement(h,{key:m,setPlugin:r.current}))}return g},[]);return e.createElement(e.Fragment,null,c,e.createElement(i.LoadingIndicatorPage,null))}return e.createElement(St,null)};var Me=n(4409),Oe=n(3828);const Ut=()=>({type:Oe.l}),Ft=t=>({type:Oe.m,permissions:t}),Re=({children:t,permissions:a,refetchPermissions:o})=>{const{allPermissions:r}=(0,Me.v9)(c=>c.rbacProvider),u=(0,Me.I0)();return(0,e.useEffect)(()=>(u(Ft(a)),()=>{u(Ut())}),[a,u]),r?e.createElement(i.RBACProviderContext.Provider,{value:{allPermissions:r,refetchPermissions:o}},t):e.createElement(i.LoadingIndicatorPage,null)};Re.propTypes={children:s().element.isRequired,permissions:s().array.isRequired,refetchPermissions:s().func.isRequired};const Wt=Re;var jt=n(43653),$t=n.n(jt),Kt=n(12551),q=n.n(Kt);const Se=(t,a)=>!q().valid(t)||!q().valid(a)?!1:q().lt(t,a);var _=n(81999),z=(t,a,o)=>new Promise((r,u)=>{var c=h=>{try{y(o.next(h))}catch(m){u(m)}},g=h=>{try{y(o.throw(h))}catch(m){u(m)}},y=h=>h.done?r(h.value):Promise.resolve(h.value).then(c,g);y((o=o.apply(t,a)).next())});const Ae=S.i8,Vt=!JSON.parse(localStorage.getItem("STRAPI_UPDATE_NOTIF")),zt=t=>z(void 0,null,function*(){try{const{data:{tag_name:a}}=yield $t().get("https://api.github.com/repos/strapi/strapi/releases/latest");return Se(Ae,a)&&Vt&&t({type:"info",message:{id:"notification.version.update.message"},link:{url:`https://github.com/strapi/strapi/releases/tag/${a}`,label:{id:"global.see-more"}},blockTransition:!0,onClose:()=>localStorage.setItem("STRAPI_UPDATE_NOTIF",!0)}),a}catch(a){return Ae}}),Ht=()=>z(void 0,null,function*(){try{const{data:t,headers:a}=yield _.be.get("/admin/information");if(!a["content-type"].includes("application/json"))throw new Error("Not found");return t.data}catch(t){throw new Error(t)}}),kt=()=>z(void 0,null,function*(){try{const{data:t,headers:a}=yield _.be.get("/admin/users/me/permissions");if(!a["content-type"].includes("application/json"))throw new Error("Not found");return t.data}catch(t){throw new Error(t)}}),Zt=()=>z(void 0,null,function*(){try{const{data:{data:{roles:t}}}=yield _.be.get("/admin/users/me");return t}catch(t){throw new Error(t)}});var Qt=Object.defineProperty,Yt=Object.defineProperties,Xt=Object.getOwnPropertyDescriptors,Ie=Object.getOwnPropertySymbols,Jt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,xe=(t,a,o)=>a in t?Qt(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,qt=(t,a)=>{for(var o in a||(a={}))Jt.call(a,o)&&xe(t,o,a[o]);if(Ie)for(var o of Ie(a))wt.call(a,o)&&xe(t,o,a[o]);return t},_t=(t,a)=>Yt(t,Xt(a));const Le=S.i8,en=()=>{const{setGuidedTourVisibility:t}=(0,i.useGuidedTour)(),a=(0,i.useNotification)(),o=(0,e.useRef)(t),r=i.auth.getUserInfo(),u=Q()(r,"username")||(0,se.Pp)(r.firstname,r.lastname),[c,g]=(0,e.useState)(u),{showReleaseNotification:y}=(0,W.um)(),[{data:h,status:m},{data:L,isLoading:D},{data:j,status:$,refetch:N,isFetched:p,isFetching:A},{data:I}]=(0,B.useQueries)([{queryKey:"app-infos",queryFn:Ht},{queryKey:"strapi-release",queryFn:()=>zt(a),enabled:y,initialData:Le},{queryKey:"admin-users-permission",queryFn:kt,initialData:[]},{queryKey:"user-roles",queryFn:Zt}]),H=(0,e.useMemo)(()=>Se(Le,L),[L]);return(0,e.useEffect)(()=>{I&&I.find(({code:Z})=>Z==="strapi-super-admin")&&o.current(!0)},[I]),D||(A&&p||m==="loading"||$==="loading")?e.createElement(i.LoadingIndicatorPage,null):m==="error"?e.createElement("div",null,"error..."):e.createElement(i.AppInfosContext.Provider,{value:_t(qt({},h),{latestStrapiReleaseTag:L,setUserDisplayName:g,shouldUpdateStrapi:H,userDisplayName:c})},e.createElement(Wt,{permissions:j,refetchPermissions:N},e.createElement(Nt,null)))}},29470:(K,R,n)=>{n.d(R,{Z:()=>b});var e=n(32735),i=n(60216),B=n.n(i),P=n(10938),Q=n.n(P),S=n(9808),W=n.n(S),f=n(66358),V=Object.defineProperty,x=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,s=(l,d,E)=>d in l?V(l,d,{enumerable:!0,configurable:!0,writable:!0,value:E}):l[d]=E,T=(l,d)=>{for(var E in d||(d={}))C.call(d,E)&&s(l,E,d[E]);if(x)for(var E of x(d))U.call(d,E)&&s(l,E,d[E]);return l},G=(l,d)=>{var E={};for(var M in l)C.call(l,M)&&d.indexOf(M)<0&&(E[M]=l[M]);if(l!=null&&x)for(var M of x(l))d.indexOf(M)<0&&U.call(l,M)&&(E[M]=l[M]);return E};const v=l=>{var d=l,{type:E}=d,M=G(d,["type"]);return e.createElement(S.Box,T({width:(0,P.pxToRem)(2),height:"100%",background:E===f.VM?"neutral300":"primary500",hasRadius:!0},M))};v.defaultProps={type:f.VM},v.propTypes={type:B().oneOf([f.lW,f.hx,f.VM])};const b=v},48634:(K,R,n)=>{n.d(R,{Z:()=>v});var e=n(32735),i=n(60216),B=n.n(i),P=n(10938),Q=n.n(P),S=n(19192),W=n.n(S),f=n(95602),V=n.n(f),x=n(78752),C=n.n(x),U=n(88677),s=n.n(U),T=n(66358);const G=({type:b,number:l})=>b===T.hx?e.createElement(S.Flex,{background:"primary600",padding:2,borderRadius:"50%",width:(0,P.pxToRem)(30),height:(0,P.pxToRem)(30),justifyContent:"center"},e.createElement(x.Icon,{as:s(),"aria-hidden":!0,width:(0,P.pxToRem)(16),color:"neutral0"})):b===T.lW?e.createElement(S.Flex,{background:"primary600",padding:2,borderRadius:"50%",width:(0,P.pxToRem)(30),height:(0,P.pxToRem)(30),justifyContent:"center"},e.createElement(f.Typography,{fontWeight:"semiBold",textColor:"neutral0"},l)):e.createElement(S.Flex,{borderColor:"neutral500",borderWidth:"1px",borderStyle:"solid",padding:2,borderRadius:"50%",width:(0,P.pxToRem)(30),height:(0,P.pxToRem)(30),justifyContent:"center"},e.createElement(f.Typography,{fontWeight:"semiBold",textColor:"neutral600"},l));G.defaultProps={number:void 0,type:T.VM},G.propTypes={number:B().number,type:B().oneOf([T.lW,T.hx,T.VM])};const v=G},66358:(K,R,n)=>{n.d(R,{lW:()=>e,hx:()=>i,VM:()=>B});const e="isActive",i="isDone",B="isNotDone"},70620:(K,R,n)=>{n.d(R,{Z:()=>i});const i={contentTypeBuilder:{home:{title:{id:"app.components.GuidedTour.home.CTB.title",defaultMessage:"\u{1F9E0} Build the content structure"},cta:{title:{id:"app.components.GuidedTour.home.CTB.cta.title",defaultMessage:"Go to the Content type Builder"},type:"REDIRECT",target:"/plugins/content-type-builder"},trackingEvent:"didClickGuidedTourHomepageContentTypeBuilder"},create:{title:{id:"app.components.GuidedTour.CTB.create.title",defaultMessage:"\u{1F9E0} Create a first Collection type"},content:{id:"app.components.GuidedTour.CTB.create.content",defaultMessage:"<p>Collection types help you manage several entries, Single types are suitable to manage only one entry.</p> <p>Ex: For a Blog website, Articles would be a Collection type whereas a Homepage would be a Single type.</p>"},cta:{title:{id:"app.components.GuidedTour.CTB.create.cta.title",defaultMessage:"Build a Collection type"},type:"CLOSE"},trackingEvent:"didClickGuidedTourStep1CollectionType"},success:{title:{id:"app.components.GuidedTour.CTB.success.title",defaultMessage:"Step 1: Completed \u2705"},content:{id:"app.components.GuidedTour.CTB.success.content",defaultMessage:"<p>Good going!</p><b>\u26A1\uFE0F What would you like to share with the world?</b>"},cta:{title:{id:"app.components.GuidedTour.create-content",defaultMessage:"Create content"},type:"REDIRECT",target:"/content-manager"},trackingEvent:"didCreateGuidedTourCollectionType"}},contentManager:{home:{title:{id:"app.components.GuidedTour.home.CM.title",defaultMessage:"\u26A1\uFE0F What would you like to share with the world?"},cta:{title:{id:"app.components.GuidedTour.create-content",defaultMessage:"Create content"},type:"REDIRECT",target:"/content-manager"},trackingEvent:"didClickGuidedTourHomepageContentManager"},create:{title:{id:"app.components.GuidedTour.CM.create.title",defaultMessage:"\u26A1\uFE0F Create content"},content:{id:"app.components.GuidedTour.CM.create.content",defaultMessage:"<p>Create and manage all the content here in the Content Manager.</p><p>Ex: Taking the Blog website example further, one can write an Article, save and publish it as they like.</p><p>\u{1F4A1} Quick tip - Don't forget to hit publish on the content you create.</p>"},cta:{title:{id:"app.components.GuidedTour.create-content",defaultMessage:"Create content"},type:"CLOSE"},trackingEvent:"didClickGuidedTourStep2ContentManager"},success:{title:{id:"app.components.GuidedTour.CM.success.title",defaultMessage:"Step 2: Completed \u2705"},content:{id:"app.components.GuidedTour.CM.success.content",defaultMessage:"<p>Awesome, one last step to go!</p><b>\u{1F680} See content in action</b>"},cta:{title:{id:"app.components.GuidedTour.CM.success.cta.title",defaultMessage:"Test the API"},type:"REDIRECT",target:"/settings/api-tokens"},trackingEvent:"didCreateGuidedTourEntry"}},apiTokens:{home:{title:{id:"app.components.GuidedTour.apiTokens.create.title",defaultMessage:"\u{1F680} See content in action"},cta:{title:{id:"app.components.GuidedTour.home.apiTokens.cta.title",defaultMessage:"Test the API"},type:"REDIRECT",target:"/settings/api-tokens"},trackingEvent:"didClickGuidedTourHomepageApiTokens"},create:{title:{id:"app.components.GuidedTour.apiTokens.create.title",defaultMessage:"\u{1F680} See content in action"},content:{id:"app.components.GuidedTour.apiTokens.create.content",defaultMessage:"<p>Generate an authentication token here and retrieve the content you just created.</p>"},cta:{title:{id:"app.components.GuidedTour.apiTokens.create.cta.title",defaultMessage:"Generate an API Token"},type:"CLOSE"},trackingEvent:"didClickGuidedTourStep3ApiTokens"},success:{title:{id:"app.components.GuidedTour.apiTokens.success.title",defaultMessage:"Step 3: Completed \u2705"},content:{id:"app.components.GuidedTour.apiTokens.success.content",defaultMessage:"<p>See content in action by making an HTTP request:</p><ul><li><p>To this URL: <light>https://'<'YOUR_DOMAIN'>'/api/'<'YOUR_CT'>'</light></p></li><li><p>With the header: <light>Authorization: bearer '<'YOUR_API_TOKEN'>'</light></p></li></ul><p>For more ways to interact with content, see the <documentationLink>documentation</documentationLink>.</p>"},trackingEvent:"didGenerateGuidedTourApiTokens"}}}}}]);
@@ -0,0 +1,180 @@
1
+ "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[5895],{819:(oe,x,a)=>{a.r(x),a.d(x,{SettingsPage:()=>tn,default:()=>Dn});var e=a(32735),E=a(10938),s=a(5141),H=a(11856),U=a(5636),Be=a(99357),Ae=a(28492),ce=a(81430),$e=a(84968),q=a(16540),w=a(9808),b=a(78330),z=a(95602),de=a(90662),Y=a(58434),Z=a(44526),qe=a(82372),Ye=a.n(qe),Ge=a(88677),be=a.n(Ge),K=a(60216),C=a.n(K),ue=a(69898),Ue=a(20763),ze=a(59290),ae=a.n(ze),re=a(23101),fe=a.n(re),Le=a(49415);const _e={currentStep:void 0},ke=(m=_e,d)=>(0,Le.default)(m,c=>{switch(d.type){case"GO_TO":{c.currentStep=d.to;break}default:return c}});var Re=a(4122);const Ze={localImage:void 0},rt=(m=Ze,d)=>(0,Le.default)(m,c=>{switch(d.type){case"SET_LOCAL_IMAGE":{c.localImage=d.value;break}default:return c}}),S=({onChangeLogo:m,customLogo:d,goTo:c,Component:f,modalTitle:u,next:A,prev:M,currentStep:R})=>{const[{localImage:v},D]=(0,e.useReducer)(rt,Ze),{formatMessage:J}=(0,U.useIntl)(),ve=dt=>{D({type:"SET_LOCAL_IMAGE",value:dt})},we=()=>{c(null)};return R?e.createElement(Re.ModalLayout,{labelledBy:"modal",onClose:we},e.createElement(Re.ModalHeader,null,e.createElement(z.Typography,{fontWeight:"bold",as:"h2",id:"modal"},J(u))),e.createElement(f,{setLocalImage:ve,goTo:c,next:A,prev:M,onClose:we,asset:v||d,onChangeLogo:m})):null};S.defaultProps={Component:void 0,currentStep:void 0,customLogo:void 0,modalTitle:void 0,next:null,prev:null},S.propTypes={Component:C().elementType,currentStep:C().string,customLogo:C().shape({name:C().string,url:C().string,width:C().number,height:C().number,ext:C().string}),goTo:C().func.isRequired,modalTitle:C().shape({id:C().string,defaultMessage:C().string}),next:C().string,onChangeLogo:C().func.isRequired,prev:C().string};const pe=S,j=750,$=100,ie=["image/jpeg","image/png","image/svg+xml"];var V=a(81700),Se=a(27635),_=a(19615),F=a(19192),ee=a(78752),Pe=a(20001),He=a(22795),Qe=a.n(He),st=(m,d,c)=>new Promise((f,u)=>{var A=v=>{try{R(c.next(v))}catch(D){u(D)}},M=v=>{try{R(c.throw(v))}catch(D){u(D)}},R=v=>v.done?f(v.value):Promise.resolve(v.value).then(A,M);R((c=c.apply(m,d)).next())});const Je={id:"Settings.application.customization.modal.upload.error-format",defaultMessage:"Wrong format uploaded (accepted formats only: jpeg, jpg, png, svg)."},N={id:"Settings.application.customization.modal.upload.error-size",defaultMessage:"The file uploaded is too large (max dimension: {dimension}x{dimension}, max file size: {size}KB)"},me=m=>new Promise(d=>{const c=new FileReader;c.onload=()=>{const f=new Image;f.onload=function(){d({width:f.width,height:f.height})},f.src=c.result},c.readAsDataURL(m)}),ne=(m,d)=>({ext:m.name.split(".").pop(),size:m.size/1e3,name:m.name,url:URL.createObjectURL(m),rawFile:m,width:d.width,height:d.height}),G=m=>st(void 0,null,function*(){let d;if(!ie.includes(m.type))throw d=new Error("File format"),d.displayMessage=Je,d;const f=yield me(m);if(!(f.width<j&&f.height<j))throw d=new Error("File sizing"),d.displayMessage=N,d;const A=ne(m,f);if(!(A.size<$))throw d=new Error("File sizing"),d.displayMessage=N,d;return A});var ge=(m,d,c)=>new Promise((f,u)=>{var A=v=>{try{R(c.next(v))}catch(D){u(D)}},M=v=>{try{R(c.throw(v))}catch(D){u(D)}},R=v=>v.done?f(v.value):Promise.resolve(v.value).then(A,M);R((c=c.apply(m,d)).next())});const Ke=(0,_.default)(Pe.FieldInput)`
2
+ opacity: 0;
3
+ position: absolute;
4
+ top: 0;
5
+ bottom: 0;
6
+ left: 0;
7
+ right: 0;
8
+ z-index: 1;
9
+ `,Ie=({setLocalImage:m,goTo:d,next:c,onClose:f})=>{const{formatMessage:u}=(0,U.useIntl)(),[A,M]=(0,e.useState)(!1),[R,v]=(0,e.useState)(void 0),D=(0,e.useRef)(null),J=()=>M(!0),ve=()=>M(!1),we=at=>{at.preventDefault(),D.current.click()},dt=()=>ge(void 0,null,function*(){ve();const at=D.current.files[0];if(!!at)try{const ut=yield G(at);m(ut),d(c)}catch(ut){if(ut.displayMessage)v(u(ut.displayMessage,{size:$,dimension:j})),D.current.focus();else throw ut}}),it=()=>A?"primary500":R?"danger600":"neutral300";return e.createElement(e.Fragment,null,e.createElement("form",null,e.createElement(w.Box,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(Pe.Field,{name:"logo-upload",error:R},e.createElement("label",{htmlFor:"logo-upload"},e.createElement(de.Stack,{spacing:2},e.createElement(F.Flex,{paddingTop:9,paddingBottom:7,hasRadius:!0,justifyContent:"center",direction:"column",background:A?"primary100":"neutral100",borderColor:it(),borderStyle:"dashed",borderWidth:"1px",position:"relative",onDragEnter:J,onDragLeave:ve},e.createElement(ee.Icon,{color:"primary600",width:`${60/16}rem`,height:`${60/16}rem`,as:Qe(),"aria-hidden":!0}),e.createElement(w.Box,{paddingTop:3,paddingBottom:5},e.createElement(z.Typography,{variant:"delta",as:"span"},u({id:"Settings.application.customization.modal.upload.drag-drop",defaultMessage:"Drag and Drop here or"}))),e.createElement(Ke,{accept:ie,cursor:"pointer",as:"input",type:"file",name:"files",tabIndex:-1,zIndex:1,onChange:dt,ref:D,id:"logo-upload"}),e.createElement(Z.Button,{type:"button",onClick:we},u({id:"Settings.application.customization.modal.upload.cta.browse",defaultMessage:"Browse files"})),e.createElement(w.Box,{paddingTop:6},e.createElement(z.Typography,{variant:"pi",textColor:"neutral600"},u({id:"Settings.application.customization.modal.upload.file-validation",defaultMessage:"Max dimension: {dimension}x{dimension}, Max size: {size}KB"},{size:$,dimension:j})))),e.createElement(Pe.FieldError,null)))))),e.createElement(Re.ModalFooter,{startActions:e.createElement(Z.Button,{onClick:f,variant:"tertiary"},u({id:"Settings.application.customization.modal.cancel",defaultMessage:"Cancel"}))}))};Ie.defaultProps={next:null},Ie.propTypes={goTo:C().func.isRequired,next:C().string,onClose:C().func.isRequired,setLocalImage:C().func.isRequired};const Q=Ie;var he=a(37178),Oe=a(43653),P=a.n(Oe),on=(m,d,c)=>new Promise((f,u)=>{var A=v=>{try{R(c.next(v))}catch(D){u(D)}},M=v=>{try{R(c.throw(v))}catch(D){u(D)}},R=v=>v.done?f(v.value):Promise.resolve(v.value).then(A,M);R((c=c.apply(m,d)).next())});const Gn=m=>on(void 0,null,function*(){try{const d=yield P().get(m,{responseType:"blob",timeout:8e3});return new File([d.data],d.config.url,{type:d.headers["content-type"]})}catch(d){throw d.displayMessage={id:"Settings.application.customization.modal.upload.error-network",defaultMessage:"Network error"},d}});var an=(m,d,c)=>new Promise((f,u)=>{var A=v=>{try{R(c.next(v))}catch(D){u(D)}},M=v=>{try{R(c.throw(v))}catch(D){u(D)}},R=v=>v.done?f(v.value):Promise.resolve(v.value).then(A,M);R((c=c.apply(m,d)).next())});const Ot=({goTo:m,next:d,onClose:c,setLocalImage:f})=>{const{formatMessage:u}=(0,U.useIntl)(),[A,M]=(0,e.useState)(""),[R,v]=(0,e.useState)(null),D=ve=>{M(ve.target.value)},J=ve=>an(void 0,null,function*(){ve.preventDefault();try{const we=yield Gn(A),dt=yield G(we);f(dt),m(d)}catch(we){if(we.displayMessage)v(u(we.displayMessage,{size:$,dimension:j}));else throw we}});return e.createElement("form",{onSubmit:J},e.createElement(w.Box,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(he.TextInput,{label:u({id:"Settings.application.customization.modal.upload.from-url.input-label",defaultMessage:"URL"}),error:R,onChange:D,value:A,name:"logo-url"})),e.createElement(Re.ModalFooter,{startActions:e.createElement(Z.Button,{onClick:c,variant:"tertiary"},u({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(Z.Button,{type:"submit"},u({id:"Settings.application.customization.modal.upload.next",defaultMessage:"Next"}))}))};Ot.defaultProps={next:null},Ot.propTypes={goTo:C().func.isRequired,next:C().string,onClose:C().func.isRequired,setLocalImage:C().func.isRequired};const wt=Ot,Dt=({setLocalImage:m,goTo:d,next:c,onClose:f})=>{const{formatMessage:u}=(0,U.useIntl)();return e.createElement(V.TabGroup,{label:u({id:"Settings.application.customization.modal.tab.label",defaultMessage:"How do you want to upload your assets?"}),variant:"simple"},e.createElement(w.Box,{paddingLeft:8,paddingRight:8},e.createElement(V.Tabs,null,e.createElement(V.Tab,null,u({id:"Settings.application.customization.modal.upload.from-computer",defaultMessage:"From computer"})),e.createElement(V.Tab,null,u({id:"Settings.application.customization.modal.upload.from-url",defaultMessage:"From url"}))),e.createElement(Se.Divider,null)),e.createElement(V.TabPanels,null,e.createElement(V.TabPanel,null,e.createElement(Q,{onClose:f,setLocalImage:m,goTo:d,next:c})),e.createElement(V.TabPanel,null,e.createElement(wt,{onClose:f,setLocalImage:m,goTo:d,next:c}))))};Dt.defaultProps={next:null},Dt.propTypes={goTo:C().func.isRequired,next:C().string,onClose:C().func.isRequired,setLocalImage:C().func.isRequired};const rn=Dt;var tt=a(31998);const xt=({asset:m})=>{const{formatMessage:d}=(0,U.useIntl)();return e.createElement(tt.Card,null,e.createElement(tt.CardHeader,null,e.createElement(tt.CardAsset,{size:"S",src:m.url})),e.createElement(tt.CardBody,null,e.createElement(tt.CardContent,null,e.createElement(tt.CardTitle,null,m.name),e.createElement(tt.CardSubtitle,null,`${m.ext.toUpperCase()} - ${m.width}\u2715${m.height}`)),e.createElement(tt.CardBadge,null,d({id:"Settings.application.customization.modal.pending.card-badge",defaultMessage:"image"}))))};xt.propTypes={asset:C().shape({name:C().string,url:C().string,width:C().number,height:C().number,ext:C().string}).isRequired};const jt=xt,Ct=({onClose:m,asset:d,prev:c,next:f,goTo:u,setLocalImage:A,onChangeLogo:M})=>{const{formatMessage:R}=(0,U.useIntl)(),v=()=>{A(void 0),u(c)},D=()=>{M(d),u(f)};return e.createElement(e.Fragment,null,e.createElement(w.Box,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(F.Flex,{justifyContent:"space-between",paddingBottom:6},e.createElement(F.Flex,{direction:"column",alignItems:"flex-start"},e.createElement(z.Typography,{variant:"pi",fontWeight:"bold"},R({id:"Settings.application.customization.modal.pending.title",defaultMessage:"Logo ready to upload"})),e.createElement(z.Typography,{variant:"pi",textColor:"neutral500"},R({id:"Settings.application.customization.modal.pending.subtitle",defaultMessage:"Manage the chosen logo before uploading it"}))),e.createElement(Z.Button,{onClick:v,variant:"secondary"},R({id:"Settings.application.customization.modal.pending.choose-another",defaultMessage:"Choose another logo"}))),e.createElement(w.Box,{maxWidth:(0,E.pxToRem)(180)},e.createElement(jt,{asset:d}))),e.createElement(Re.ModalFooter,{startActions:e.createElement(Z.Button,{onClick:m,variant:"tertiary"},R({id:"Settings.application.customization.modal.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(Z.Button,{onClick:D},R({id:"Settings.application.customization.modal.pending.upload",defaultMessage:"Upload logo"}))}))};Ct.defaultProps={next:null,prev:null},Ct.propTypes={goTo:C().func.isRequired,asset:C().shape({name:C().string,url:C().string,width:C().number,height:C().number,ext:C().string}).isRequired,next:C().string,onClose:C().func.isRequired,onChangeLogo:C().func.isRequired,prev:C().string,setLocalImage:C().func.isRequired};const zn={upload:{Component:rn,modalTitle:{id:"Settings.application.customization.modal.upload",defaultMessage:"Upload logo"},next:"pending",prev:null},pending:{Component:Ct,modalTitle:{id:"Settings.application.customization.modal.pending",defaultMessage:"Pending logo"},next:null,prev:"upload"}},Et=({customLogo:m,defaultLogo:d,onChangeLogo:c,onResetMenuLogo:f})=>{const[{currentStep:u},A]=(0,e.useReducer)(ke,_e),{Component:M,next:R,prev:v,modalTitle:D}=zn[u]||{},{formatMessage:J}=(0,U.useIntl)(),ve=we=>{A({type:"GO_TO",to:we})};return e.createElement(e.Fragment,null,e.createElement(ue.CarouselInput,{label:J({id:"Settings.application.customization.carousel.title",defaultMessage:"Logo"}),selectedSlide:0,hint:J({id:"Settings.application.customization.carousel-hint",defaultMessage:"Change the admin panel logo (Max dimension: {dimension}x{dimension}, Max file size: {size}KB)"},{size:$,dimension:j}),previousLabel:"",nextLabel:"",onNext:()=>{},onPrevious:()=>{},secondaryLabel:(m==null?void 0:m.name)||"logo.png",actions:e.createElement(ue.CarouselActions,null,e.createElement(Ue.IconButton,{onClick:()=>ve(m?"pending":"upload"),label:J({id:"Settings.application.customization.carousel.change-action",defaultMessage:"Change logo"}),icon:e.createElement(ae(),null)}),m&&e.createElement(Ue.IconButton,{onClick:f,label:J({id:"Settings.application.customization.carousel.reset-action",defaultMessage:"Reset logo"}),icon:e.createElement(fe(),null)}))},e.createElement(ue.CarouselSlide,{label:J({id:"Settings.application.customization.carousel-slide.label",defaultMessage:"Logo slide"})},e.createElement(w.Box,{maxHeight:"40%",maxWidth:"40%",as:"img",src:(m==null?void 0:m.url)||d,alt:J({id:"Settings.application.customization.carousel.title",defaultMessage:"Logo"})}))),e.createElement(pe,{Component:M,currentStep:u,onChangeLogo:c,customLogo:m,goTo:ve,next:R,prev:v,modalTitle:D}))};Et.defaultProps={customLogo:null},Et.propTypes={customLogo:C().shape({url:C().string,name:C().string}),defaultLogo:C().string.isRequired,onChangeLogo:C().func.isRequired,onResetMenuLogo:C().func.isRequired};const sn=Et,bt={menuLogo:{display:null,submit:{rawFile:null,isReset:!1}}},ln=(m=bt,d)=>(0,Le.default)(m,c=>{switch(d.type){case"SET_CUSTOM_MENU_LOGO":{c.menuLogo.display=d.value,c.menuLogo.submit.rawFile=d.value.rawFile;break}case"RESET_CUSTOM_MENU_LOGO":{c.menuLogo.display=null,c.menuLogo.submit={rawFile:null,isReset:!0};break}default:return c}});var Wt=a(86349),cn=a.n(Wt);const Ut=(m,d)=>cn()(m,{menuLogo:{display:d.menuLogo}}),St=(0,e.forwardRef)(({projectSettingsStored:m},d)=>{const{formatMessage:c}=(0,U.useIntl)(),{trackUsage:f}=(0,E.useTracking)(),{logos:{menu:u}}=(0,Ae.um)(),[{menuLogo:A},M]=(0,e.useReducer)(ln,bt,()=>Ut(bt,m)),R=D=>{M({type:"SET_CUSTOM_MENU_LOGO",value:D})},v=()=>{f("didClickResetLogo"),M({type:"RESET_CUSTOM_MENU_LOGO"})};return(0,e.useImperativeHandle)(d,()=>({getValues:()=>({menuLogo:A.submit})})),e.createElement(w.Box,{hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingRight:7,paddingLeft:7},e.createElement(z.Typography,{variant:"delta",as:"h3"},c({id:"Settings.application.customization",defaultMessage:"Customization"})),e.createElement(b.Grid,{paddingTop:4},e.createElement(b.GridItem,{col:6,s:12},e.createElement(sn,{onChangeLogo:R,customLogo:A.display,defaultLogo:u.default,onResetMenuLogo:v}))))});St.defaultProps={projectSettingsStored:null},St.propTypes={projectSettingsStored:C().shape({menuLogo:C().shape({url:C().string,name:C().string})})};const mt=St;var dn=a(81999),Mt=a(48344),Hn=a.n(Mt),ct=Object.defineProperty,Kn=Object.defineProperties,un=Object.getOwnPropertyDescriptors,kt=Object.getOwnPropertySymbols,pn=Object.prototype.hasOwnProperty,Xn=Object.prototype.propertyIsEnumerable,gt=(m,d,c)=>d in m?ct(m,d,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[d]=c,Yn=(m,d)=>{for(var c in d||(d={}))pn.call(d,c)&&gt(m,c,d[c]);if(kt)for(var c of kt(d))Xn.call(d,c)&&gt(m,c,d[c]);return m},ht=(m,d)=>Kn(m,un(d));const Lt=m=>Hn()(m,(d,c,f)=>{c&&c.url?d[f]=ht(Yn({},c),{url:(0,E.prefixFileUrlWithBackendUrl)(c.url)}):d[f]=c},{});var It=(m,d,c)=>new Promise((f,u)=>{var A=v=>{try{R(c.next(v))}catch(D){u(D)}},M=v=>{try{R(c.throw(v))}catch(D){u(D)}},R=v=>v.done?f(v.value):Promise.resolve(v.value).then(A,M);R((c=c.apply(m,d)).next())});const gn=()=>It(void 0,null,function*(){const{data:m}=yield dn.be.get("/admin/project-settings");return Lt(m)}),Vt=m=>It(void 0,null,function*(){const{data:d}=yield dn.be.post("/admin/project-settings",m);return Lt(d)}),Gt=m=>{const d=new FormData;return Object.entries(m).forEach(([c,f])=>{f&&f.rawFile instanceof File&&d.append(c,f.rawFile),f&&f.isReset&&d.append(c,null)}),d};var hn=(m,d,c)=>new Promise((f,u)=>{var A=v=>{try{R(c.next(v))}catch(D){u(D)}},M=v=>{try{R(c.throw(v))}catch(D){u(D)}},R=v=>v.done?f(v.value):Promise.resolve(v.value).then(A,M);R((c=c.apply(m,d)).next())});const zt=[{action:"admin::project-settings.update",subject:null}],Jn=()=>{const m=(0,e.useRef)(),d=(0,E.useNotification)(),{trackUsage:c}=(0,E.useTracking)(),{formatMessage:f}=(0,U.useIntl)(),u=(0,$e.useQueryClient)();(0,E.useFocusWhenNavigate)();const A=(0,E.useAppInfos)(),{shouldUpdateStrapi:M,latestStrapiReleaseTag:R,strapiVersion:v}=A,{updateProjectSettings:D}=(0,Ae.um)(),{data:J}=(0,$e.useQuery)("project-settings",gn),ve=A.communityEdition?"app.components.UpgradePlanModal.text-ce":"app.components.UpgradePlanModal.text-ee",we=(0,$e.useMutation)(it=>Vt(it),{onSuccess:it=>hn(void 0,[it],function*({menuLogo:at}){yield u.invalidateQueries("project-settings",{refetchActive:!0}),D({menuLogo:at==null?void 0:at.url})})}),dt=()=>{const it=m.current.getValues(),at=Gt(it);we.mutate(at,{onSuccess:()=>{const{menuLogo:ut}=it;ut.rawFile&&c("didChangeLogo")},onError:()=>{d({type:"warning",message:{id:"notification.error",defaultMessage:"An error occurred"}})}})};return e.createElement(H.Layout,null,e.createElement(E.SettingsPageTitle,{name:"Application"}),e.createElement(q.Main,null,e.createElement(H.HeaderLayout,{title:f({id:"Settings.application.title",defaultMessage:"Overview"}),subtitle:f({id:"Settings.application.description",defaultMessage:"Administration panel\u2019s global information"}),primaryAction:e.createElement(Z.Button,{onClick:dt,startIcon:e.createElement(be(),null)},f({id:"global.save",defaultMessage:"Save"}))}),e.createElement(H.ContentLayout,null,e.createElement(de.Stack,{spacing:6},e.createElement(w.Box,{hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingRight:7,paddingLeft:7},e.createElement(de.Stack,{spacing:5},e.createElement(z.Typography,{variant:"delta",as:"h3"},f({id:"global.details",defaultMessage:"Details"})),e.createElement(b.Grid,{paddingTop:1},e.createElement(b.GridItem,{col:6,s:12},e.createElement(z.Typography,{variant:"sigma",textColor:"neutral600"},f({id:"Settings.application.strapiVersion",defaultMessage:"strapi version"})),e.createElement(z.Typography,{as:"p"},"v",v),e.createElement(Y.Link,{href:A.communityEdition?"https://discord.strapi.io":"https://support.strapi.io/support/home",endIcon:e.createElement(Ye(),null)},f({id:"Settings.application.get-help",defaultMessage:"Get help"}))),e.createElement(b.GridItem,{col:6,s:12},e.createElement(z.Typography,{variant:"sigma",textColor:"neutral600"},f({id:"Settings.application.edition-title",defaultMessage:"current plan"})),e.createElement(z.Typography,{as:"p"},f({id:ve,defaultMessage:`${A.communityEdition?"Community Edition":"Enterprise Edition"}`})))),e.createElement(b.Grid,{paddingTop:1},e.createElement(b.GridItem,{col:6,s:12},M&&e.createElement(Y.Link,{href:`https://github.com/strapi/strapi/releases/tag/${R}`,endIcon:e.createElement(Ye(),null)},f({id:"Settings.application.link-upgrade",defaultMessage:"Upgrade your admin panel"}))),e.createElement(b.GridItem,{col:6,s:12},e.createElement(Y.Link,{href:"https://strapi.io/pricing-self-hosted",endIcon:e.createElement(Ye(),null)},f({id:"Settings.application.link-pricing",defaultMessage:"See all pricing plans"})))),e.createElement(w.Box,{paddingTop:1},e.createElement(z.Typography,{variant:"sigma",textColor:"neutral600"},f({id:"Settings.application.node-version",defaultMessage:"node version"})),e.createElement(z.Typography,{as:"p"},A.nodeVersion)))),J&&e.createElement(E.CheckPermissions,{permissions:zt},e.createElement(mt,{ref:m,projectSettingsStored:J}))))))};var yn=a(3704),Zt=a.n(yn);const Ht=m=>Zt()(m,c=>c.links).map(c=>(0,ce.ot)(c.Component,c.to,c.exact||!1)),vn=m=>m.filter(d=>!d.links.every(c=>c.isDisplayed===!1));var Cn=a(46053),Kt=a(93587),ye=a.n(Kt),nt=void 0,ot=function(d,c,f){return new Promise(function(u,A){var M=function(J){try{v(f.next(J))}catch(ve){A(ve)}},R=function(J){try{v(f.throw(J))}catch(ve){A(ve)}},v=function(J){return J.done?u(J.value):Promise.resolve(J.value).then(M,R)};v((f=f.apply(d,c)).next())})},Ft=function(){return window&&window.strapi&&window.strapi.isEE?a(97971).Z:a(16988).Z}(),En=function(){return window&&window.strapi&&window.strapi.isEE?a(49776).Z:a(10333).Z}(),bn=[{Component:function(){return{default:En}},to:"/settings/roles",exact:!0},{Component:function(){return{default:Ft}},to:"/settings/roles/duplicate/:id",exact:!0},{Component:function(){return{default:Ft}},to:"/settings/roles/new",exact:!0},{Component:function(){return ot(nt,null,ye().mark(function d(){var c;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(2544).then(a.bind(a,3079));case 2:return c=u.sent,u.abrupt("return",c);case 4:case"end":return u.stop()}},d)}))},to:"/settings/roles/:id",exact:!0},{Component:function(){return ot(nt,null,ye().mark(function d(){var c;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(5199).then(a.bind(a,79005));case 2:return c=u.sent,u.abrupt("return",c);case 4:case"end":return u.stop()}},d)}))},to:"/settings/users",exact:!0},{Component:function(){return ot(nt,null,ye().mark(function d(){var c;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(4263).then(a.bind(a,28976));case 2:return c=u.sent,u.abrupt("return",c);case 4:case"end":return u.stop()}},d)}))},to:"/settings/users/:id",exact:!0},{Component:function(){return ot(nt,null,ye().mark(function d(){var c;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,Promise.all([a.e(4715),a.e(5162)]).then(a.bind(a,31854));case 2:return c=u.sent,u.abrupt("return",c);case 4:case"end":return u.stop()}},d)}))},to:"/settings/webhooks/create",exact:!0},{Component:function(){return ot(nt,null,ye().mark(function d(){var c;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,Promise.all([a.e(4715),a.e(5162)]).then(a.bind(a,24305));case 2:return c=u.sent,u.abrupt("return",c);case 4:case"end":return u.stop()}},d)}))},to:"/settings/webhooks/:id",exact:!0},{Component:function(){return ot(nt,null,ye().mark(function d(){var c;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(4121).then(a.bind(a,17542));case 2:return c=u.sent,u.abrupt("return",c);case 4:case"end":return u.stop()}},d)}))},to:"/settings/webhooks",exact:!0},{Component:function(){return ot(nt,null,ye().mark(function d(){var c;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(8056).then(a.bind(a,11116));case 2:return c=u.sent,u.abrupt("return",c);case 4:case"end":return u.stop()}},d)}))},to:"/settings/api-tokens",exact:!0},{Component:function(){return ot(nt,null,ye().mark(function d(){var c;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(4299).then(a.bind(a,96854));case 2:return c=u.sent,u.abrupt("return",c);case 4:case"end":return u.stop()}},d)}))},to:"/settings/api-tokens/create",exact:!0},{Component:function(){return ot(nt,null,ye().mark(function d(){var c;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(92).then(a.bind(a,14932));case 2:return c=u.sent,u.abrupt("return",c);case 4:case"end":return u.stop()}},d)}))},to:"/settings/api-tokens/:id",exact:!0}];const Xt=bn;var Sn=function(){return window&&window.strapi&&window.strapi.isEE?a(78251).Z:a(23027).Z}();const Pn=[].concat((0,Cn.Z)(Sn),(0,Cn.Z)(Xt));var Pt=a(6404),Tn=Object.defineProperty,An=Object.defineProperties,Yt=Object.getOwnPropertyDescriptors,Qt=Object.getOwnPropertySymbols,Rn=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,qt=(m,d,c)=>d in m?Tn(m,d,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[d]=c,_t=(m,d)=>{for(var c in d||(d={}))Rn.call(d,c)&&qt(m,c,d[c]);if(Qt)for(var c of Qt(d))Jt.call(d,c)&&qt(m,c,d[c]);return m},en=(m,d)=>An(m,Yt(d));const Tt=({menu:m})=>{const{formatMessage:d}=(0,U.useIntl)(),f=vn(m).map(A=>en(_t({},A),{title:A.intlLabel,links:A.links.map(M=>en(_t({},M),{title:M.intlLabel,name:M.id}))})),u=d({id:"global.settings",defaultMessage:"Settings"});return e.createElement(Pt.SubNav,{ariaLabel:u},e.createElement(Pt.SubNavHeader,{label:u}),e.createElement(Pt.SubNavSections,null,f.map(A=>e.createElement(Pt.SubNavSection,{key:A.id,label:d(A.intlLabel)},A.links.map(M=>e.createElement(Pt.SubNavLink,{withBullet:M.hasNotification,to:M.to,key:M.id},d(M.intlLabel)))))))};Tt.propTypes={menu:C().array.isRequired};const On=Tt;function tn(){const{settingId:m}=(0,s.useParams)(),{settings:d}=(0,E.useStrapiApp)(),{formatMessage:c}=(0,U.useIntl)(),{isLoading:f,menu:u}=(0,Ae.Te)(),A=(0,e.useMemo)(()=>(0,ce.WW)(Pn.map(({to:v,Component:D,exact:J})=>(0,ce.ot)(D,v,J))),[]),M=Ht(d);if(f)return e.createElement(E.LoadingIndicatorPage,null);if(!m)return e.createElement(s.Redirect,{to:"/settings/application-infos"});const R=c({id:"global.settings",defaultMessage:"Settings"});return e.createElement(H.Layout,{sideNav:e.createElement(On,{menu:u})},e.createElement(Be.Helmet,{title:R}),e.createElement(s.Switch,null,e.createElement(s.Route,{path:"/settings/application-infos",component:Jn,exact:!0}),A,M))}const Dn=(0,e.memo)(tn)},16988:(oe,x,a)=>{a.d(x,{Z:()=>H});var e=a(32735),E=a(5141);const H=()=>e.createElement(E.Redirect,{to:"/404"})},65150:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!0},3665:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!0},3288:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!0},16602:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!0},71218:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!0},13806:(oe,x,a)=>{a.d(x,{Z:()=>gr});var e=a(32735),E=a(60216),s=a.n(E),H=a(10938),U=a(81700),Be=a(23973),Ae=a.n(Be),ce=a(86834),$e=a.n(ce),q=a(5636),w=a(9808),b=a(19615),z=a(98978),de=a.n(z),Y=a(67950),Z=a(67793),qe=a.n(Z),Ye=a(31476),Ge=a.n(Ye),be=a(35980),K=a(19192),C=a(33795),ue=a.n(C),Ue=a(9086),ze=a.n(Ue),ae=a(28492),re=a(42258),fe=a.n(re),Le=a(44526);const _e=b.default.div`
10
+ position: relative;
11
+
12
+ ${({hasConditions:o,disabled:t,theme:n})=>o&&`
13
+ &:before {
14
+ content: '';
15
+ position: absolute;
16
+ top: -3px;
17
+ left: -10px;
18
+ width: 6px;
19
+ height: 6px;
20
+ border-radius: ${20/16}rem;;
21
+ background: ${t?n.colors.neutral100:n.colors.primary600};
22
+ }
23
+ `}
24
+ `,et=({onClick:o,className:t,hasConditions:n,variant:r})=>{const{formatMessage:i}=(0,q.useIntl)();return e.createElement(_e,{hasConditions:n,className:t},e.createElement(Le.Button,{variant:r,startIcon:e.createElement(fe(),null),onClick:o},i({id:"global.settings",defaultMessage:"Settings"})))};et.defaultProps={className:null,hasConditions:!1,variant:"tertiary"},et.propTypes={onClick:s().func.isRequired,className:s().string,hasConditions:s().bool,variant:s().string};const ke=(0,b.default)(et)``;var Re=a(27635),Ze=a(90662),lt=a(4122),rt=a(71657),S=a(95602),pe=a(49415),j=a(81346),$=a.n(j),ie=a(23940),V=a.n(ie),Se=a(15453),_=a(46053),F=a(25716);const ee=`${120/16}rem`,Pe=`${200/16}rem`,He=`${53/16}rem`;function Qe(o,t){var n=typeof Symbol!="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!n){if(Array.isArray(o)||(n=st(o))||t&&o&&typeof o.length=="number"){n&&(o=n);var r=0,i=function(){};return{s:i,n:function(){return r>=o.length?{done:!0}:{done:!1,value:o[r++]}},e:function(y){throw y},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
25
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l=!0,p=!1,g;return{s:function(){n=n.call(o)},n:function(){var y=n.next();return l=y.done,y},e:function(y){p=!0,g=y},f:function(){try{!l&&n.return!=null&&n.return()}finally{if(p)throw g}}}}function st(o,t){if(!!o){if(typeof o=="string")return Je(o,t);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor&&(n=o.constructor.name),n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Je(o,t)}}function Je(o,t){(t==null||t>o.length)&&(t=o.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=o[n];return r}var N=Object.defineProperty,me=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,ge=function(t,n,r){return n in t?N(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r},Ke=function(t,n){for(var r in n||(n={}))ne.call(n,r)&&ge(t,r,n[r]);if(me){var i=Qe(me(n)),l;try{for(i.s();!(l=i.n()).done;){var r=l.value;G.call(n,r)&&ge(t,r,n[r])}}catch(p){i.e(p)}finally{i.f()}}return t},Ie=function(){return window&&window.strapi&&window.strapi.isEE?a(10265).Z:a(65150).Z}(),Q=(0,b.default)(K.Flex).withConfig({displayName:"ActionRow__FlexWrapper",componentId:"sc-1bqpgdl-0"})(["height:",";"],He),he=function(t){var n=t.arrayOfOptionsGroupedByCategory,r=t.isFormDisabled,i=t.isGrey,l=t.label,p=t.name,g=t.onChange,h=t.value,y=(0,q.useIntl)(),T=y.formatMessage,L=n.reduce(function(B,W){var O=(0,Y.Z)(W,2),I=O[0],X=O[1],se={label:V()(I),children:X.map(function(De){return{label:De.displayName,value:De.id}})};return[].concat((0,_.Z)(B),[se])},[]),k=Object.values(h).map(function(B){return Object.entries(B).filter(function(W){var O=(0,Y.Z)(W,2),I=O[1];return I}).map(function(W){var O=(0,Y.Z)(W,1),I=O[0];return I})}).flat(),te=function(W){var O=(0,Y.Z)(n,1),I=(0,Y.Z)(O[0],2),X=I[1],se=X.reduce(function(De,Ce){return Ke((0,Se.Z)({},Ce.id,W.includes(Ce.id)),De)},{});g(p,se)};return e.createElement(Q,{as:"li",background:i?"neutral100":"neutral0"},e.createElement(K.Flex,{paddingLeft:6,style:{width:180}},e.createElement(S.Typography,{variant:"sigma",textColor:"neutral600"},T({id:"Settings.permissions.conditions.can",defaultMessage:"Can"}),"\xA0"),e.createElement(S.Typography,{variant:"sigma",title:l,textColor:"primary600",ellipsis:!0},T({id:"Settings.roles.form.permissions.".concat(l.toLowerCase()),defaultMessage:l})),e.createElement(S.Typography,{variant:"sigma",textColor:"neutral600"},"\xA0",T({id:"Settings.permissions.conditions.when",defaultMessage:"When"}))),e.createElement(w.Box,{style:{maxWidth:430,width:"100%"}},e.createElement(F.MultiSelectNested,{id:p,customizeContent:function(W){return"".concat(W.length," currently selected")},onChange:te,value:k,options:L,disabled:r||Ie})))};he.propTypes={arrayOfOptionsGroupedByCategory:s().array.isRequired,isFormDisabled:s().bool.isRequired,isGrey:s().bool.isRequired,label:s().string.isRequired,name:s().string.isRequired,value:s().object.isRequired,onChange:s().func.isRequired};const Oe=he;var P=a(92891);const on=(o,t)=>o.reduce((n,r)=>(n[r.id]=(0,P.get)(t,r.id,!1),n),{}),Vn=(o,t)=>o.reduce((n,r)=>{const[i,l]=r,p=on(l,t);return n[i]=p,n},{}),an=(o,t,n)=>o.reduce((r,i)=>{const l=(0,P.get)(t,[...i.pathToConditionsObject,"conditions"],{}),p=Vn(n,l);return r[i.pathToConditionsObject.join("..")]=p,r},{});var Ot=Object.defineProperty,wt=Object.getOwnPropertySymbols,Dt=Object.prototype.hasOwnProperty,rn=Object.prototype.propertyIsEnumerable,tt=(o,t,n)=>t in o?Ot(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,xt=(o,t)=>{for(var n in t||(t={}))Dt.call(t,n)&&tt(o,n,t[n]);if(wt)for(var n of wt(t))rn.call(t,n)&&tt(o,n,t[n]);return o};const jt=({actions:o,headerBreadCrumbs:t,isFormDisabled:n,onClosed:r,onToggle:i})=>{const{formatMessage:l}=(0,q.useIntl)(),{availableConditions:p,modifiedData:g,onChangeConditions:h}=(0,ae.$_)(),y=(0,e.useMemo)(()=>Object.entries($()(p,"category")),[p]),T=o.filter(({isDisplayed:O,hasSomeActionsSelected:I,hasAllActionsSelected:X})=>O&&(I||X)),L=(0,e.useMemo)(()=>an(T,g,y),[T,g,y]),[k,te]=(0,e.useState)(L),B=(O,I)=>{te((0,pe.default)(X=>{X[O]||(X[O]={}),X[O].default||(X[O].default={}),X[O].default=I}))},W=()=>{const O=Object.entries(k).reduce((I,X)=>{const[se,De]=X,Ce=Object.values(De).reduce((xe,je)=>xt(xt({},xe),je),{});return I[se]=Ce,I},{});h(O),i()};return e.createElement(lt.ModalLayout,{labelledBy:"condition-modal-breadcrumbs",onClose:r},e.createElement(lt.ModalHeader,null,e.createElement(rt.Breadcrumbs,{id:"condition-modal-breadcrumbs",label:t.join(", ")},t.map(O=>e.createElement(rt.Crumb,{key:O},V()(l({id:O,defaultMessage:O})))))),e.createElement(w.Box,{padding:8},e.createElement(Ze.Stack,{spacing:6},e.createElement(S.Typography,{variant:"beta",as:"h2"},l({id:"Settings.permissions.conditions.define-conditions",defaultMessage:"Define conditions"})),e.createElement(w.Box,null,e.createElement(Re.Divider,null)),e.createElement(w.Box,null,T.length===0&&e.createElement(S.Typography,null,l({id:"Settings.permissions.conditions.no-actions",defaultMessage:"You first need to select actions (create, read, update, ...) before defining conditions on them."})),e.createElement("ul",null,T.map(({actionId:O,label:I,pathToConditionsObject:X},se)=>{const De=X.join("..");return e.createElement(Oe,{key:O,arrayOfOptionsGroupedByCategory:y,label:I,isFormDisabled:n,isGrey:se%2===0,name:De,onChange:B,value:ue()(k,De,{})})}))))),e.createElement(lt.ModalFooter,{startActions:e.createElement(Le.Button,{variant:"tertiary",onClick:i},l({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(Le.Button,{onClick:W},l({id:"Settings.permissions.conditions.apply",defaultMessage:"Apply"}))}))};jt.propTypes={actions:s().arrayOf(s().shape({actionId:s().string.isRequired,checkboxName:s().string,hasSomeActionsSelected:s().bool.isRequired,hasAllActionsSelected:s().bool,isDisplayed:s().bool.isRequired,label:s().string})).isRequired,headerBreadCrumbs:s().arrayOf(s().string).isRequired,isFormDisabled:s().bool.isRequired,onClosed:s().func.isRequired,onToggle:s().func.isRequired};const Ct=jt,Nt=b.default.div`
26
+ width: ${ee};
27
+ `,Et=(0,b.default)(K.Flex)`
28
+ padding-right: ${({theme:o})=>o.spaces[2]};
29
+ overflow: hidden;
30
+ flex: 1;
31
+ ${({isCollapsable:o})=>o&&"cursor: pointer;"}
32
+ `;var sn=Object.defineProperty,bt=Object.getOwnPropertySymbols,Zn=Object.prototype.hasOwnProperty,ln=Object.prototype.propertyIsEnumerable,Wt=(o,t,n)=>t in o?sn(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,cn=(o,t)=>{for(var n in t||(t={}))Zn.call(t,n)&&Wt(o,n,t[n]);if(bt)for(var n of bt(t))ln.call(t,n)&&Wt(o,n,t[n]);return o};const $t=({children:o,isCollapsable:t,isActive:n,isFormDisabled:r,label:i,onChange:l,onClick:p,checkboxName:g,someChecked:h,value:y})=>{const{formatMessage:T}=(0,q.useIntl)();return e.createElement(K.Flex,{alignItems:"center",paddingLeft:6,style:{width:Pe,flexShrink:0}},e.createElement(w.Box,{paddingRight:2},e.createElement(be.BaseCheckbox,{name:g,"aria-label":T({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:i}),disabled:r,onValueChange:L=>l({target:{name:g,value:L}}),indeterminate:h,value:y})),e.createElement(Et,cn({title:i,alignItems:"center",isCollapsable:t},t&&{onClick:p,"aria-expanded":n,onKeyDown:({key:L})=>(L==="Enter"||L===" ")&&p(),tabIndex:0,role:"button"}),e.createElement(S.Typography,{fontWeight:n?"bold":"",textColor:n?"primary600":"neutral800",ellipsis:!0},V()(i)),o))};$t.defaultProps={children:null,checkboxName:"",onChange:()=>{},value:!1,someChecked:!1,isCollapsable:!1},$t.propTypes={checkboxName:s().string,children:s().node,label:s().string.isRequired,isCollapsable:s().bool,isFormDisabled:s().bool.isRequired,onChange:s().func,onClick:s().func.isRequired,someChecked:s().bool,value:s().bool,isActive:s().bool.isRequired};const Ut=(0,e.memo)($t),St=o=>(0,P.isObject)(o)?(0,P.flattenDeep)(Object.values(o).map(t=>(0,P.isObject)(t)?St(t):t)):[],mt=St,Mt=o=>o?Object.keys(o).reduce((t,n)=>(n!=="conditions"&&(t[n]=o[n]),t),{}):null,ct=o=>{const t=Mt(o),n=mt(t);if(!n.length)return{hasAllActionsSelected:!1,hasSomeActionsSelected:!1};const r=n.every(l=>l),i=n.some(l=>l)&&!r;return{hasAllActionsSelected:r,hasSomeActionsSelected:i}},un=(o,t,n)=>o.map(({actionId:r,isDisplayed:i,applyToProperties:l,label:p})=>{if(!i)return{actionId:r,hasSomeActionsSelected:!1,isDisplayed:i};const g=[...n.split(".."),r],h=(0,P.isEmpty)(l)?[...g,"properties","enabled"]:g,y=h.join(".."),T=(0,P.get)(t,[...g,"conditions"],null),L=mt(T).some(W=>W);if((0,P.isEmpty)(l)){const W=(0,P.get)(t,h,!1);return{actionId:r,checkboxName:y,hasAllActionsSelected:W,hasConditions:L,hasSomeActionsSelected:W,isDisplayed:i,isParentCheckbox:!1,label:p,pathToConditionsObject:g}}const k=(0,P.get)(t,h,null),{hasAllActionsSelected:te,hasSomeActionsSelected:B}=ct(k);return{actionId:r,checkboxName:y,hasAllActionsSelected:te,hasConditions:L,hasSomeActionsSelected:B,isDisplayed:i,isParentCheckbox:!0,label:p,pathToConditionsObject:g}});var kt=a(60672),pn=a.n(kt);const gt=(0,b.default)(pn())`
33
+ display: none;
34
+ width: ${10/16}rem;
35
+ transform: rotate(${({$isActive:o})=>o?"180":"0"}deg);
36
+ margin-left: ${({theme:o})=>o.spaces[2]};
37
+ `,ht=o=>`
38
+ ${S.Typography} {
39
+ color: ${o.colors.primary600};
40
+ font-weight: ${o.fontWeights.bold}
41
+ }
42
+ ${gt} {
43
+ display: block;
44
+ path {
45
+ fill: ${o.colors.primary600}
46
+ };
47
+ }
48
+ `;var mn=function(){return window&&window.strapi&&window.strapi.isEE?a(47902).Z:a(3665).Z}(),Lt=function o(t,n){return`
49
+ `.concat(It,` {
50
+ background-color: `).concat(t.colors.primary100,`;
51
+ color: `).concat(t.colors.primary600,`;
52
+ border-radius: `).concat(n?"2px 2px 0 0":"2px",`;
53
+ }
54
+ `).concat(fn,` {
55
+ display: flex;
56
+ }
57
+ `).concat(ke,` {
58
+ display: block;
59
+ }
60
+ &:hover {
61
+ `).concat(ht(t),`
62
+ }
63
+
64
+ &:focus-within {
65
+ `).concat(function(r){var i=r.theme,l=r.isActive;return o(i,l)},`
66
+ }
67
+
68
+ `)},It=b.default.div.withConfig({displayName:"Collapse__Wrapper",componentId:"sc-132fji1-0"})(["flex:1;display:flex;align-items:center;height:",";background-color:",";border:1px solid transparent;"],He,function(o){var t=o.isGrey,n=o.theme;return t?n.colors.neutral100:n.colors.neutral0}),gn=b.default.div.withConfig({displayName:"Collapse__BoxWrapper",componentId:"sc-132fji1-1"})(["display:inline-flex;min-width:100%;","{display:none;}"," &:hover{","}"],ke,function(o){var t=o.isActive,n=o.theme;return t&&Lt(n,t)},function(o){var t=o.theme,n=o.isActive;return Lt(t,n)}),Vt=(0,b.default)(K.Flex).withConfig({displayName:"Collapse__Cell",componentId:"sc-132fji1-2"})(["width:",";position:relative;"],ee),fn=(0,b.default)(w.Box).withConfig({displayName:"Collapse__Chevron",componentId:"sc-132fji1-3"})(["display:none;svg{width:11px;}*{fill:",";}"],function(o){var t=o.theme;return t.colors.primary600}),Gt=b.default.span.withConfig({displayName:"Collapse__TinyDot",componentId:"sc-132fji1-4"})(["position:absolute;top:-6px;left:37px;width:6px;height:6px;border-radius:20px;background:",";"],function(o){var t=o.theme;return t.colors.primary600}),hn=(0,b.default)(w.Box).withConfig({displayName:"Collapse__AbsoluteBox",componentId:"sc-132fji1-5"})(["position:absolute;right:9px;transform:translateY(10px);"]),zt=function(t){var n=t.availableActions,r=t.isActive,i=t.isGrey,l=t.isFormDisabled,p=t.label,g=t.onClickToggle,h=t.pathToData,y=(0,e.useState)(!1),T=(0,Y.Z)(y,2),L=T[0],k=T[1],te=(0,q.useIntl)(),B=te.formatMessage,W=(0,ae.$_)(),O=W.modifiedData,I=W.onChangeParentCheckbox,X=W.onChangeSimpleCheckbox,se=function(){k(function(Te){return!Te})},De=function(){k(!1)},Ce=ue()(O,h.split(".."),{}),xe=(0,e.useMemo)(function(){return Object.keys(Ce).reduce(function(le,Te){return le[Te]=ze()(Ce[Te],"conditions"),le},{})},[Ce]),je=ct(xe),Fe=je.hasAllActionsSelected,yt=je.hasSomeActionsSelected,Ee=(0,e.useMemo)(function(){return un(n,O,h)},[n,O,h]),Ne=Ee.some(function(le){var Te=le.hasConditions;return Te});return e.createElement(gn,{isActive:r},e.createElement(It,{isGrey:i},e.createElement(Ut,{isCollapsable:!0,isFormDisabled:l,label:p,checkboxName:h,onChange:I,onClick:g,someChecked:yt,value:Fe,isActive:r},e.createElement(fn,{paddingLeft:2},r?e.createElement(Ge(),null):e.createElement(qe(),null))),e.createElement(K.Flex,{style:{flex:1}},Ee.map(function(le){var Te=le.actionId,Me=le.hasConditions,We=le.hasAllActionsSelected,Ve=le.hasSomeActionsSelected,ft=le.isDisplayed,Xe=le.isParentCheckbox,pt=le.checkboxName,At=le.label;return ft?Xe?e.createElement(Vt,{key:Te,justifyContent:"center",alignItems:"center"},Me&&e.createElement(Gt,null),e.createElement(be.BaseCheckbox,{disabled:l||mn,name:pt,"aria-label":B({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(At," ").concat(p)}),onValueChange:function(vt){I({target:{name:pt,value:vt}})},indeterminate:Ve,value:We})):e.createElement(Vt,{key:Te,justifyContent:"center",alignItems:"center"},Me&&e.createElement(Gt,null),e.createElement(be.BaseCheckbox,{disabled:l||mn,indeterminate:Me,name:pt,onValueChange:function(vt){X({target:{name:pt,value:vt}})},value:We})):e.createElement(Nt,{key:Te})})),L&&e.createElement(Ct,{headerBreadCrumbs:[p,"app.components.LeftMenuLinkContainer.settings"],actions:Ee,isFormDisabled:l,onClosed:De,onToggle:se})),e.createElement(hn,null,e.createElement(ke,{onClick:se,hasConditions:Ne})))};zt.propTypes={availableActions:s().array.isRequired,isActive:s().bool.isRequired,isGrey:s().bool.isRequired,isFormDisabled:s().bool.isRequired,label:s().string.isRequired,onClickToggle:s().func.isRequired,pathToData:s().string.isRequired};const Qn=zt,yn=(o,t)=>o.map(n=>{const r=Array.isArray(n.applyToProperties)&&n.applyToProperties.indexOf(t)!==-1&&n.isDisplayed;return{label:n.label,actionId:n.actionId,isActionRelatedToCurrentProperty:r}}),Zt=(0,b.default)(K.Flex)`
69
+ width: ${ee};
70
+ flex-shrink: 0;
71
+ `,qn=(0,b.default)(K.Flex)`
72
+ width: ${Pe};
73
+ height: ${He};
74
+ flex-shrink: 0;
75
+ `,Ht=({headers:o,label:t})=>{const{formatMessage:n}=(0,q.useIntl)(),r=n({id:"Settings.roles.form.permission.property-label",defaultMessage:"{label} permissions"},{label:t});return e.createElement(K.Flex,null,e.createElement(qn,{alignItems:"center",paddingLeft:6},e.createElement(S.Typography,{variant:"sigma",textColor:"neutral500"},r)),o.map(i=>i.isActionRelatedToCurrentProperty?e.createElement(Zt,{justifyContent:"center",key:i.label},e.createElement(S.Typography,{variant:"sigma",textColor:"neutral500"},n({id:`Settings.roles.form.permissions.${i.label.toLowerCase()}`,defaultMessage:i.label}))):e.createElement(Zt,{key:i.label})))};Ht.propTypes={headers:s().arrayOf(s().shape({label:s().string.isRequired,isActionRelatedToCurrentProperty:s().bool.isRequired})).isRequired,label:s().string.isRequired};const _n=Ht,vn=b.default.span`
76
+ color: ${({theme:o})=>o.colors.danger700};
77
+ padding-left: ${({theme:o})=>o.spaces[1]}px;
78
+ `,Kt=()=>e.createElement(vn,null,"*");var ye=Object.defineProperty,nt=Object.defineProperties,ot=Object.getOwnPropertyDescriptors,Ft=Object.getOwnPropertySymbols,En=Object.prototype.hasOwnProperty,bn=Object.prototype.propertyIsEnumerable,Xt=(o,t,n)=>t in o?ye(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Sn=(o,t)=>{for(var n in t||(t={}))En.call(t,n)&&Xt(o,n,t[n]);if(Ft)for(var n of Ft(t))bn.call(t,n)&&Xt(o,n,t[n]);return o},Pn=(o,t)=>nt(o,ot(t));const Tn=(o,t)=>o.map(n=>{const r=Array.isArray(n.subjects)&&n.subjects.indexOf(t)!==-1;return Pn(Sn({},n),{isDisplayed:r})});var An=Object.defineProperty,Yt=Object.getOwnPropertySymbols,Qt=Object.prototype.hasOwnProperty,Rn=Object.prototype.propertyIsEnumerable,Jt=(o,t,n)=>t in o?An(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,qt=(o,t)=>{for(var n in t||(t={}))Qt.call(t,n)&&Jt(o,n,t[n]);if(Yt)for(var n of Yt(t))Rn.call(t,n)&&Jt(o,n,t[n]);return o};const _t=(0,b.default)(w.Box)`
79
+ transform: translate(-4px, -12px);
80
+
81
+ &:before {
82
+ content: '';
83
+ width: ${4/16}rem;
84
+ height: ${12/16}rem;
85
+ background: ${({theme:o})=>o.colors.primary200};
86
+ display: block;
87
+ }
88
+ `,en=b.default.svg`
89
+ position: relative;
90
+ flex-shrink: 0;
91
+ transform: translate(-0.5px, -1px);
92
+
93
+ * {
94
+ fill: ${({theme:o,color:t})=>o.colors[t]};
95
+ }
96
+ `,Tt=o=>e.createElement(_t,null,e.createElement(en,qt({width:"20",height:"23",viewBox:"0 0 20 23",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o),e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.02477 14.7513C8.65865 17.0594 11.6046 18.6059 17.5596 18.8856C18.6836 18.9384 19.5976 19.8435 19.5976 20.9688V20.9688C19.5976 22.0941 18.6841 23.0125 17.5599 22.9643C10.9409 22.6805 6.454 20.9387 3.75496 17.1258C0.937988 13.1464 0.486328 7.39309 0.486328 0.593262H4.50974C4.50974 7.54693 5.06394 11.9813 7.02477 14.7513Z",fill:"#D9D8FF"})));Tt.defaultProps={fill:"primary200"},Tt.propTypes={fill:s().string};const On=(0,e.memo)(Tt);function tn(o,t){var n=typeof Symbol!="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!n){if(Array.isArray(o)||(n=Dn(o))||t&&o&&typeof o.length=="number"){n&&(o=n);var r=0,i=function(){};return{s:i,n:function(){return r>=o.length?{done:!0}:{done:!1,value:o[r++]}},e:function(y){throw y},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
97
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l=!0,p=!1,g;return{s:function(){n=n.call(o)},n:function(){var y=n.next();return l=y.done,y},e:function(y){p=!0,g=y},f:function(){try{!l&&n.return!=null&&n.return()}finally{if(p)throw g}}}}function Dn(o,t){if(!!o){if(typeof o=="string")return m(o,t);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor&&(n=o.constructor.name),n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(o,t)}}function m(o,t){(t==null||t>o.length)&&(t=o.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=o[n];return r}var d=Object.defineProperty,c=Object.defineProperties,f=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,R=function(t,n,r){return n in t?d(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r},v=function(t,n){for(var r in n||(n={}))A.call(n,r)&&R(t,r,n[r]);if(u){var i=tn(u(n)),l;try{for(i.s();!(l=i.n()).done;){var r=l.value;M.call(n,r)&&R(t,r,n[r])}}catch(p){i.e(p)}finally{i.f()}}return t},D=function(t,n){return c(t,f(n))},J=function(){return window&&window.strapi&&window.strapi.isEE?a(38292).Z:a(16602).Z}(),ve=(0,b.default)(K.Flex).withConfig({displayName:"SubActionRow__Cell",componentId:"sc-7y8yzq-0"})(["width:",";position:relative;"],ee),we=(0,b.default)(K.Flex).withConfig({displayName:"SubActionRow__RowWrapper",componentId:"sc-7y8yzq-1"})(["height:",";"],He),dt=(0,b.default)(w.Box).withConfig({displayName:"SubActionRow__Wrapper",componentId:"sc-7y8yzq-2"})(["padding-left:","rem;"],31/16),it=(0,b.default)(w.Box).withConfig({displayName:"SubActionRow__LeftBorderTimeline",componentId:"sc-7y8yzq-3"})(["border-left:",";"],function(o){var t=o.isVisible,n=o.theme;return t?"4px solid ".concat(n.colors.primary200):"4px solid transparent"}),at=(0,b.default)(K.Flex).withConfig({displayName:"SubActionRow__RowStyle",componentId:"sc-7y8yzq-4"})(["padding-left:",";width:","px;"," ",";"],function(o){var t=o.theme;return t.spaces[4]},function(o){var t=o.level;return 145-t*36},function(o){var t=o.isCollapsable,n=o.theme;return t&&`
98
+ `.concat(gt,` {
99
+ display: block;
100
+ color: `).concat(n.colors.neutral100,`;
101
+ }
102
+ &:hover {
103
+ `).concat(ht(n),`
104
+ }
105
+ `)},function(o){var t=o.isActive,n=o.theme;return t&&ht(n)}),ut=b.default.div.withConfig({displayName:"SubActionRow__TopTimeline",componentId:"sc-7y8yzq-5"})(["padding-top:",";margin-top:",";width:","rem;background-color:",";border-top-left-radius:2px;border-top-right-radius:2px;"],function(o){var t=o.theme;return t.spaces[2]},function(o){var t=o.theme;return t.spaces[2]},4/16,function(o){var t=o.theme;return t.colors.primary200}),eo=function o(t){var n=t.childrenForm,r=t.isFormDisabled,i=t.recursiveLevel,l=t.pathToDataFromActionRow,p=t.propertyActions,g=t.parentName,h=t.propertyName,y=(0,q.useIntl)(),T=y.formatMessage,L=(0,ae.$_)(),k=L.modifiedData,te=L.onChangeParentCheckbox,B=L.onChangeSimpleCheckbox,W=(0,e.useState)(null),O=(0,Y.Z)(W,2),I=O[0],X=O[1],se=function(xe){X(function(je){return je===xe?null:xe})},De=(0,e.useMemo)(function(){return I?n.find(function(Ce){var xe=Ce.value;return xe===I}):null},[I,n]);return e.createElement(dt,null,e.createElement(ut,null),n.map(function(Ce,xe){var je=Ce.label,Fe=Ce.value,yt=Ce.required,Ee=Ce.children,Ne=xe+1<n.length,le=Array.isArray(Ee),Te=I===Fe;return e.createElement(it,{key:Fe,isVisible:Ne},e.createElement(we,null,e.createElement(On,{color:"primary200"}),e.createElement(K.Flex,{style:{flex:1}},e.createElement(at,{level:i,isActive:Te,isCollapsable:le},e.createElement(Et,D(v({alignItems:"center",isCollapsable:le},le&&{onClick:function(){return se(Fe)},"aria-expanded":Te,onKeyDown:function(We){var Ve=We.key;return(Ve==="Enter"||Ve===" ")&&se(Fe)},tabIndex:0,role:"button"}),{title:je}),e.createElement(S.Typography,{ellipsis:!0},V()(je)),yt&&e.createElement(Kt,null),e.createElement(gt,{$isActive:Te}))),e.createElement(K.Flex,{style:{flex:1}},p.map(function(Me){var We=Me.actionId,Ve=Me.label,ft=Me.isActionRelatedToCurrentProperty;if(!ft)return e.createElement(Nt,{key:We});var Xe=[].concat((0,_.Z)(l.split("..")),[We,"properties",h],(0,_.Z)(g.split("..")),[Fe]),pt=ue()(k,Xe,!1);if(!Ee)return e.createElement(ve,{key:Ve,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{disabled:r||J,name:Xe.join(".."),"aria-label":T({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(g," ").concat(je," ").concat(Ve)}),onValueChange:function(Bt){B({target:{name:Xe.join(".."),value:Bt}})},value:pt}));var At=ct(pt),Rt=At.hasAllActionsSelected,vt=At.hasSomeActionsSelected;return e.createElement(ve,{key:Ve,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{key:Ve,disabled:r||J,name:Xe.join(".."),"aria-label":T({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(g," ").concat(je," ").concat(Ve)}),onValueChange:function(Bt){te({target:{name:Xe.join(".."),value:Bt}})},value:Rt,indeterminate:vt}))})))),De&&Te&&e.createElement(w.Box,{paddingBottom:2},e.createElement(o,{isFormDisabled:r,parentName:"".concat(g,"..").concat(Fe),pathToDataFromActionRow:l,propertyActions:p,propertyName:h,recursiveLevel:i+1,childrenForm:De.children})))}))};eo.propTypes={childrenForm:s().array.isRequired,isFormDisabled:s().bool.isRequired,parentName:s().string.isRequired,pathToDataFromActionRow:s().string.isRequired,propertyActions:s().array.isRequired,propertyName:s().string.isRequired,recursiveLevel:s().number.isRequired};const Zo=(0,e.memo)(eo),Ho=o=>o.reduce((n,r)=>(r.isActionRelatedToCurrentProperty&&n.push(r.actionId),n),[]),Ko=(o,t,n,r,i)=>{const p=Ho(o).reduce((g,h)=>{const y=[...n.split(".."),h,"properties",r,i],T=(0,P.get)(t,y,!1);return g[h]=T,g},{});return ct(p)};var to=function(){return window&&window.strapi&&window.strapi.isEE?a(71231).Z:a(3288).Z}(),no=(0,b.default)(K.Flex).withConfig({displayName:"ActionRow__Cell",componentId:"sc-4agenc-0"})(["width:",";position:relative;"],ee),Xo=(0,b.default)(K.Flex).withConfig({displayName:"ActionRow__Wrapper",componentId:"sc-4agenc-1"})(["height:",";flex:1;"," ",";"],He,function(o){var t=o.isCollapsable,n=o.theme;return t&&`
106
+ `.concat(gt,` {
107
+ display: block;
108
+ color: `).concat(n.colors.neutral100,`;
109
+ }
110
+ &:hover {
111
+ `).concat(ht(n),`
112
+ }
113
+ `)},function(o){var t=o.isActive,n=o.theme;return t&&ht(n)}),xn=function(t){var n=t.childrenForm,r=t.label,i=t.isFormDisabled,l=t.name,p=t.required,g=t.pathToData,h=t.propertyActions,y=t.propertyName,T=t.isOdd,L=(0,q.useIntl)(),k=L.formatMessage,te=(0,e.useState)(null),B=(0,Y.Z)(te,2),W=B[0],O=B[1],I=(0,ae.$_)(),X=I.modifiedData,se=I.onChangeCollectionTypeLeftActionRowCheckbox,De=I.onChangeParentCheckbox,Ce=I.onChangeSimpleCheckbox,xe=W===l,je=(0,e.useMemo)(function(){return Array.isArray(n)?n:[]},[n]),Fe=je.length>0,yt=(0,e.useCallback)(function(){Fe&&O(function(Me){return Me===l?null:l})},[Fe,l]),Ee=function(We){var Ve=We.target.value;se(g,y,l,Ve)},Ne=(0,e.useMemo)(function(){return Ko(h,X,g,y,l)},[h,X,g,y,l]),le=Ne.hasAllActionsSelected,Te=Ne.hasSomeActionsSelected;return e.createElement(e.Fragment,null,e.createElement(Xo,{alignItems:"center",isCollapsable:Fe,isActive:xe,background:T?"neutral100":"neutral0"},e.createElement(K.Flex,null,e.createElement(Ut,{onChange:Ee,onClick:yt,isCollapsable:Fe,isFormDisabled:i,label:r,someChecked:Te,value:le,isActive:xe},p&&e.createElement(Kt,null),e.createElement(gt,{$isActive:xe})),e.createElement(K.Flex,null,h.map(function(Me){var We=Me.label,Ve=Me.isActionRelatedToCurrentProperty,ft=Me.actionId;if(!Ve)return e.createElement(Nt,{key:We});var Xe=[].concat((0,_.Z)(g.split("..")),[ft,"properties",y,l]);if(!Fe){var pt=ue()(X,Xe,!1);return e.createElement(no,{key:ft,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{disabled:i||to,name:Xe.join(".."),"aria-label":k({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(l," ").concat(We)}),onValueChange:function(kn){Ce({target:{name:Xe.join(".."),value:kn}})},value:pt}))}var At=ue()(X,Xe,{}),Rt=ct(At),vt=Rt.hasAllActionsSelected,Un=Rt.hasSomeActionsSelected;return e.createElement(no,{key:We,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{disabled:i||to,name:Xe.join(".."),onValueChange:function(kn){De({target:{name:Xe.join(".."),value:kn}})},"aria-label":k({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(l," ").concat(We)}),value:vt,indeterminate:Un}))})))),xe&&e.createElement(Zo,{childrenForm:je,isFormDisabled:i,parentName:l,pathToDataFromActionRow:g,propertyName:y,propertyActions:h,recursiveLevel:0}))};xn.defaultProps={childrenForm:[],required:!1},xn.propTypes={childrenForm:s().array,label:s().string.isRequired,isFormDisabled:s().bool.isRequired,name:s().string.isRequired,pathToData:s().string.isRequired,propertyActions:s().array.isRequired,propertyName:s().string.isRequired,required:s().bool,isOdd:s().bool.isRequired};const Yo=(0,e.memo)(xn),Qo=b.default.div`
114
+ display: inline-flex;
115
+ flex-direction: column;
116
+ min-width: 0;
117
+ `,oo=({availableActions:o,childrenForm:t,isFormDisabled:n,label:r,pathToData:i,propertyName:l})=>{const p=(0,e.useMemo)(()=>yn(o,l),[o,l]);return e.createElement(Qo,null,e.createElement(_n,{label:r,headers:p}),e.createElement(w.Box,null,t.map(({children:g,label:h,value:y,required:T},L)=>e.createElement(Yo,{childrenForm:g,key:y,label:h,isFormDisabled:n,name:y,required:T,propertyActions:p,pathToData:i,propertyName:l,isOdd:L%2===0}))))};oo.propTypes={childrenForm:s().array.isRequired,availableActions:s().array.isRequired,isFormDisabled:s().bool.isRequired,label:s().string.isRequired,pathToData:s().string.isRequired,propertyName:s().string.isRequired};const Jo=oo,qo=b.default.div`
118
+ flex-direction: column;
119
+ display: inline-flex;
120
+ min-width: 100%;
121
+ ${({theme:o,isActive:t})=>t&&`border: 1px solid ${o.colors.primary600};`}
122
+ `,ao=({allActions:o,contentTypeName:t,label:n,index:r,isActive:i,isFormDisabled:l,onClickToggleCollapse:p,pathToData:g,properties:h})=>{const y=(0,e.useCallback)(()=>{p(t)},[t,p]),T=(0,e.useMemo)(()=>Tn(o,t),[o,t]);return e.createElement(qo,{isActive:i},e.createElement(Qn,{availableActions:T,isActive:i,isGrey:r%2===0,isFormDisabled:l,label:n,onClickToggle:y,pathToData:g}),i&&h.map(({label:L,value:k,children:te})=>e.createElement(Jo,{availableActions:T,childrenForm:te,isFormDisabled:l,label:L,pathToData:g,propertyName:k,key:k})))};ao.propTypes={allActions:s().array.isRequired,contentTypeName:s().string.isRequired,index:s().number.isRequired,isActive:s().bool.isRequired,isFormDisabled:s().bool.isRequired,label:s().string.isRequired,onClickToggleCollapse:s().func.isRequired,pathToData:s().string.isRequired,properties:s().array.isRequired};const _o=ao,Mn=({actions:o,isFormDisabled:t,pathToData:n,subjects:r})=>{const[i,l]=(0,e.useState)(null),p=g=>{l(i===g?null:g)};return r.map(({uid:g,label:h,properties:y},T)=>e.createElement(_o,{allActions:o,key:g,contentTypeName:g,label:h,isActive:i===g,isFormDisabled:t,index:T,onClickToggleCollapse:p,pathToData:`${n}..${g}`,properties:y}))};Mn.defaultProps={actions:[],subjects:[]},Mn.propTypes={actions:s().array.isRequired,isFormDisabled:s().bool.isRequired,pathToData:s().string.isRequired,subjects:s().arrayOf(s().shape({uid:s().string.isRequired,label:s().string.isRequired,properties:s().array.isRequired}))};const ea=(0,e.memo)(Mn),ta=o=>o.filter(({subjects:t})=>t&&t.length);var na=Object.defineProperty,ro=Object.getOwnPropertySymbols,oa=Object.prototype.hasOwnProperty,aa=Object.prototype.propertyIsEnumerable,so=(o,t,n)=>t in o?na(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,io=(o,t)=>{for(var n in t||(t={}))oa.call(t,n)&&so(o,n,t[n]);if(ro)for(var n of ro(t))aa.call(t,n)&&so(o,n,t[n]);return o};const ra=o=>o.map(({actionId:t})=>t),sa=(o,t)=>o.reduce((n,r)=>(Object.keys(t).forEach(i=>{const l=(0,P.get)(t,[i,r],{}),p={[i]:Mt(l)};n[r]?n[r]=io(io({},n[r]),p):n[r]=p}),n),{}),ia=(o,t)=>{const n=ra(o),r=sa(n,t);return Object.keys(r).reduce((l,p)=>(l[p]=ct(r[p]),l),{})};var la=function(){return window&&window.strapi&&window.strapi.isEE?a(66713).Z:a(71218).Z}(),ca=(0,b.default)(Ze.Stack).withConfig({displayName:"GlobalActions__CenteredStack",componentId:"sc-1vxwsjr-0"})(["align-items:center;justify-content:center;width:",";flex-shrink:0;"],ee),Ln=function(t){var n=t.actions,r=t.isFormDisabled,i=t.kind,l=(0,q.useIntl)(),p=l.formatMessage,g=(0,ae.$_)(),h=g.modifiedData,y=g.onChangeCollectionTypeGlobalActionCheckbox,T=(0,e.useMemo)(function(){return ta(n)},[n]),L=(0,e.useMemo)(function(){return ia(T,h[i])},[h,T,i]);return e.createElement(w.Box,{paddingBottom:4,paddingTop:6,style:{paddingLeft:Pe}},e.createElement(Ze.Stack,{horizontal:!0,spacing:0},T.map(function(k){var te=k.label,B=k.actionId;return e.createElement(ca,{key:B,spacing:3},e.createElement(S.Typography,{variant:"sigma",textColor:"neutral500"},p({id:"Settings.roles.form.permissions.".concat(te.toLowerCase()),defaultMessage:te})),e.createElement(be.BaseCheckbox,{disabled:r||la,onValueChange:function(O){y(i,B,O)},name:B,"aria-label":p({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:p({id:"Settings.roles.form.permissions.".concat(te.toLowerCase()),defaultMessage:te})}),value:ue()(L,[B,"hasAllActionsSelected"],!1),indeterminate:ue()(L,[B,"hasSomeActionsSelected"],!1)}))})))};Ln.defaultProps={actions:[]},Ln.propTypes={actions:s().arrayOf(s().shape({label:s().string.isRequired,actionId:s().string.isRequired,subjects:s().array.isRequired})),isFormDisabled:s().bool.isRequired,kind:s().string.isRequired};const da=(0,e.memo)(Ln),ua=(0,b.default)(w.Box)`
123
+ overflow-x: auto;
124
+ `,lo=({isFormDisabled:o,kind:t,layout:{actions:n,subjects:r}})=>{const i=de()([...r],"label");return e.createElement(ua,{background:"neutral0"},e.createElement(da,{actions:n,kind:t,isFormDisabled:o}),e.createElement(ea,{actions:n,isFormDisabled:o,pathToData:t,subjects:i}))};lo.propTypes={isFormDisabled:s().bool.isRequired,kind:s().string.isRequired,layout:s().shape({actions:s().array,subjects:s().arrayOf(s().shape({uid:s().string.isRequired,label:s().string.isRequired,properties:s().array.isRequired}))}).isRequired};const co=(0,e.memo)(lo);var pa=a(64564);const uo=({children:o,value:t})=>e.createElement(pa.$l.Provider,{value:t},o);uo.propTypes={children:s().node.isRequired,value:s().exact({availableConditions:s().array.isRequired,modifiedData:s().object.isRequired,onChangeCollectionTypeLeftActionRowCheckbox:s().func.isRequired,onChangeConditions:s().func.isRequired,onChangeSimpleCheckbox:s().func.isRequired,onChangeParentCheckbox:s().func.isRequired,onChangeCollectionTypeGlobalActionCheckbox:s().func.isRequired}).isRequired};const ma=uo;var In=a(12001),po=a(78330),mo=a(52111),ga=Object.defineProperty,fa=Object.defineProperties,ha=Object.getOwnPropertyDescriptors,go=Object.getOwnPropertySymbols,ya=Object.prototype.hasOwnProperty,va=Object.prototype.propertyIsEnumerable,fo=(o,t,n)=>t in o?ga(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Ca=(o,t)=>{for(var n in t||(t={}))ya.call(t,n)&&fo(o,n,t[n]);if(go)for(var n of go(t))va.call(t,n)&&fo(o,n,t[n]);return o},Ea=(o,t)=>fa(o,ha(t));const ba=(o,t,n)=>o.map(r=>{const i=[...n,r.action,"properties","enabled"],l=(0,P.get)(t,i,!1),p=(0,P.get)(t,[...n,r.action,"conditions"],{}),g=mt(p).some(h=>h);return Ea(Ca({},r),{isDisplayed:l,checkboxName:i.join(".."),hasSomeActionsSelected:l,value:l,hasConditions:g,label:r.displayName,actionId:r.action,pathToConditionsObject:[...n,r.action]})}),Sa=o=>{const t=Object.entries(o).reduce((r,i)=>{const[l,{conditions:p}]=i;return r[l]=p,r},{});return mt(t).some(r=>r)};var Fn=function(){return window&&window.strapi&&window.strapi.isEE?a(37582).Z:a(95204).Z}(),Pa=b.default.div.withConfig({displayName:"SubCategory__Border",componentId:"sc-akgczm-0"})(["flex:1;align-self:center;border-top:1px solid ",";"],function(o){var t=o.theme;return t.colors.neutral150}),Ta=b.default.div.withConfig({displayName:"SubCategory__CheckboxWrapper",componentId:"sc-akgczm-1"})(["position:relative;word-break:keep-all;",""],function(o){var t=o.hasConditions,n=o.disabled,r=o.theme;return t&&`
125
+ &:before {
126
+ content: '';
127
+ position: absolute;
128
+ top: `.concat(-4/16,`rem;
129
+ left: `).concat(-8/16,`rem;
130
+ width: `).concat(6/16,`rem;
131
+ height: `).concat(6/16,`rem;
132
+ border-radius: `).concat(20/16,`rem;
133
+ background: `).concat(n?r.colors.neutral100:r.colors.primary600,`;
134
+ }
135
+ `)}),ho=function(t){var n=t.categoryName,r=t.isFormDisabled,i=t.subCategoryName,l=t.actions,p=t.pathToData,g=(0,e.useState)(!1),h=(0,Y.Z)(g,2),y=h[0],T=h[1],L=(0,ae.$_)(),k=L.modifiedData,te=L.onChangeParentCheckbox,B=L.onChangeSimpleCheckbox,W=(0,q.useIntl)(),O=W.formatMessage,I=ue()(k,p,{}),X=(0,e.useMemo)(function(){return Object.keys(I).reduce(function(Ee,Ne){return Ee[Ne]=Mt(I[Ne]),Ee},{})},[I]),se=ct(X),De=se.hasAllActionsSelected,Ce=se.hasSomeActionsSelected,xe=function(){T(function(Ne){return!Ne})},je=function(){T(!1)},Fe=ba(l,k,p),yt=Sa(ue()(k,(0,_.Z)(p),{}));return e.createElement(e.Fragment,null,e.createElement(w.Box,null,e.createElement(K.Flex,{justifyContent:"space-between",alignItems:"center"},e.createElement(w.Box,{paddingRight:4},e.createElement(S.Typography,{variant:"sigma",textColor:"neutral600"},i)),e.createElement(Pa,null),e.createElement(w.Box,{paddingLeft:4},e.createElement(mo.Checkbox,{name:p.join(".."),disabled:r||Fn,onValueChange:function(Ne){te({target:{name:p.join(".."),value:Ne}})},indeterminate:Ce,value:De},O({id:"app.utils.select-all",defaultMessage:"Select all"})))),e.createElement(K.Flex,{paddingTop:6,paddingBottom:6},e.createElement(po.Grid,{gap:2,style:{flex:1}},Fe.map(function(Ee){var Ne=Ee.checkboxName,le=Ee.value,Te=Ee.action,Me=Ee.displayName,We=Ee.hasConditions;return e.createElement(po.GridItem,{col:3,key:Te},e.createElement(Ta,{disabled:r||Fn,hasConditions:We},e.createElement(mo.Checkbox,{name:Ne,disabled:r||Fn,onValueChange:function(ft){B({target:{name:Ne,value:ft}})},value:le},Me)))})),e.createElement(ke,{hasConditions:yt,onClick:xe}))),y&&e.createElement(Ct,{headerBreadCrumbs:[n,i],actions:Fe,isFormDisabled:r,onClosed:je,onToggle:xe}))};ho.propTypes={actions:s().array.isRequired,categoryName:s().string.isRequired,isFormDisabled:s().bool.isRequired,subCategoryName:s().string.isRequired,pathToData:s().array.isRequired};const Aa=ho,Bn=({childrenForm:o,kind:t,name:n,isOpen:r,isFormDisabled:i,isWhite:l,onOpenCategory:p,pathToData:g})=>{const{formatMessage:h}=(0,q.useIntl)(),y=()=>{p(n)},T=(0,e.useMemo)(()=>n.split("::").pop(),[n]);return e.createElement(In.Accordion,{expanded:r,onToggle:y,id:`accordion-${n}`,variant:l?"primary":"secondary"},e.createElement(In.AccordionToggle,{title:V()(T),description:`${h({id:"Settings.permissions.category"},{category:T})} ${t==="plugins"?"plugin":t}`}),e.createElement(In.AccordionContent,null,e.createElement(w.Box,{padding:6},o.map(({actions:L,subCategoryName:k,subCategoryId:te})=>e.createElement(Aa,{key:k,actions:L,categoryName:T,isFormDisabled:i,subCategoryName:k,pathToData:[...g,te]})))))};Bn.defaultProps={},Bn.propTypes={childrenForm:s().array.isRequired,isOpen:s().bool.isRequired,isFormDisabled:s().bool.isRequired,isWhite:s().bool.isRequired,kind:s().string.isRequired,name:s().string.isRequired,onOpenCategory:s().func.isRequired,pathToData:s().array.isRequired};const Ra=Bn,yo=({isFormDisabled:o,kind:t,layout:n})=>{const[r,i]=(0,e.useState)(null),l=p=>{i(p===r?null:p)};return e.createElement(w.Box,{padding:6,background:"neutral0"},n.map(({category:p,categoryId:g,childrenForm:h},y)=>e.createElement(Ra,{key:p,childrenForm:h,kind:t,isFormDisabled:o,isOpen:r===p,isWhite:y%2===1,name:p,onOpenCategory:l,pathToData:[t,g]})))};yo.propTypes={isFormDisabled:s().bool.isRequired,kind:s().string.isRequired,layout:s().arrayOf(s().shape({category:s().string.isRequired,categoryId:s().string.isRequired,childrenForm:s().arrayOf(s().shape({actions:s().array.isRequired})).isRequired}).isRequired).isRequired};const vo=yo,Co=(o,t,n)=>o.find(r=>r.action===t&&r.subject===n);var Oa=Object.defineProperty,Da=Object.defineProperties,xa=Object.getOwnPropertyDescriptors,Eo=Object.getOwnPropertySymbols,Ma=Object.prototype.hasOwnProperty,La=Object.prototype.propertyIsEnumerable,bo=(o,t,n)=>t in o?Oa(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,So=(o,t)=>{for(var n in t||(t={}))Ma.call(t,n)&&bo(o,n,t[n]);if(Eo)for(var n of Eo(t))La.call(t,n)&&bo(o,n,t[n]);return o},Po=(o,t)=>Da(o,xa(t));const To=(o,t=[])=>o.reduce((n,r)=>(n[r.id]=t.indexOf(r.id)!==-1,n),{}),Ao=({children:o},t,n="")=>o.reduce((r,i)=>{if(i.children)return Po(So({},r),{[i.value]:Ao(i,t,`${n}${i.value}.`)});const l=t.indexOf(`${n}${i.value}`)!==-1;return r[i.value]=l,r},{}),Ia=(o,t,n)=>o.reduce((r,i)=>{const l=t.properties.find(({value:p})=>p===i);if(l){const p=(0,P.get)(n,["properties",l.value],[]),g=Ao(l,p);r.properties[i]=g}return r},{properties:{}}),Fa=(o,t)=>t.reduce((n,r)=>{const i=o.find(({uid:l})=>l===r)||null;return i&&(n[r]=i),n},{}),Ro=({subjects:o},t,n,r=[])=>t.reduce((i,l)=>{const p=l.subjects,g=Fa(o,p);if((0,P.isEmpty)(g))return i;const h=Object.keys(g).reduce((y,T)=>{const{actionId:L,applyToProperties:k}=l,W=g[T].properties.map(({value:se})=>se).every(se=>(k||[]).indexOf(se)===-1),O=Co(r,L,T),I=To(n,(0,P.get)(O,"conditions",[]));if((0,P.isEmpty)(k)||W)return(0,P.set)(y,[T,L],{properties:{enabled:O!==void 0},conditions:I}),y;const X=Ia(k,g[T],O);return(0,P.set)(y,[T,L],Po(So({},X),{conditions:I})),y},{});return(0,P.merge)(i,h)},{}),Ba=(o,t,n)=>o.reduce((r,i)=>{const l=Co(n,i.action,null);return r[i.action]={properties:{enabled:l!==void 0},conditions:To(t,(0,P.get)(l,"conditions",[]))},r},{}),wa=(o,t,n)=>o.reduce((r,i)=>(r[i.subCategoryId]=Ba(i.actions,t,n),r),{}),Oo=(o,t,n=[])=>o.reduce((r,{categoryId:i,childrenForm:l})=>{const p=wa(l,t,n);return r[i]=p,r},{}),Do=o=>o.split(" ").join("-"),xo=(o,t)=>(0,P.chain)(o).groupBy(t).map((n,r)=>({category:r,categoryId:Do(r),childrenForm:(0,P.chain)(n).groupBy("subCategory").map((i,l)=>({subCategoryName:l,subCategoryId:Do(l),actions:i})).value()})).value(),ja=(o,t)=>{const{conditions:n,sections:{collectionTypes:r,singleTypes:i,plugins:l,settings:p}}=o,g={collectionTypes:r,singleTypes:i,plugins:xo(l,"plugin"),settings:xo(p,"category")},h={collectionTypes:Ro(r,r.actions||[],n,t),singleTypes:Ro(i,i.actions||[],n,t),plugins:Oo(g.plugins,n,t),settings:Oo(g.settings,n,t)};return{initialData:h,modifiedData:h,layouts:g}};var Na=Object.defineProperty,Wa=Object.defineProperties,$a=Object.getOwnPropertyDescriptors,Mo=Object.getOwnPropertySymbols,Ua=Object.prototype.hasOwnProperty,ka=Object.prototype.propertyIsEnumerable,Lo=(o,t,n)=>t in o?Na(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,wn=(o,t)=>{for(var n in t||(t={}))Ua.call(t,n)&&Lo(o,n,t[n]);if(Mo)for(var n of Mo(t))ka.call(t,n)&&Lo(o,n,t[n]);return o},jn=(o,t)=>Wa(o,$a(t));const Io=o=>Object.keys(o).reduce((t,n)=>{const r=o[n];if((0,P.isObject)(r)&&!(0,P.has)(r,"conditions"))return jn(wn({},t),{[n]:Io(r)});if((0,P.isObject)(r)&&(0,P.has)(r,"conditions")&&!mt((0,P.omit)(r,"conditions")).some(l=>l)){const l=Object.keys(r.conditions).reduce((p,g)=>(p[g]=!1,p),{});return jn(wn({},t),{[n]:jn(wn({},r),{conditions:l})})}return t[n]=r,t},{}),Nn=Io;var Va=Object.defineProperty,Ga=Object.defineProperties,za=Object.getOwnPropertyDescriptors,Fo=Object.getOwnPropertySymbols,Za=Object.prototype.hasOwnProperty,Ha=Object.prototype.propertyIsEnumerable,Bo=(o,t,n)=>t in o?Va(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Ka=(o,t)=>{for(var n in t||(t={}))Za.call(t,n)&&Bo(o,n,t[n]);if(Fo)for(var n of Fo(t))Ha.call(t,n)&&Bo(o,n,t[n]);return o},Xa=(o,t)=>Ga(o,za(t));const wo=(o,t)=>Object.keys(o).reduce((n,r)=>{const i=o[r];return r==="conditions"?(n[r]=i,n):(0,P.isObject)(i)?Xa(Ka({},n),{[r]:wo(i,t)}):(n[r]=t,n)},{}),nn=wo;var Ya=Object.defineProperty,Qa=Object.defineProperties,Ja=Object.getOwnPropertyDescriptors,jo=Object.getOwnPropertySymbols,qa=Object.prototype.hasOwnProperty,_a=Object.prototype.propertyIsEnumerable,No=(o,t,n)=>t in o?Ya(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,er=(o,t)=>{for(var n in t||(t={}))qa.call(t,n)&&No(o,n,t[n]);if(jo)for(var n of jo(t))_a.call(t,n)&&No(o,n,t[n]);return o},tr=(o,t)=>Qa(o,Ja(t));const nr={initialData:{},modifiedData:{},layouts:{}},or=(o,t)=>(0,pe.default)(o,n=>{switch(t.type){case"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX":{const{collectionTypeKind:r,actionId:i,value:l}=t,p=["modifiedData",r];Object.keys((0,P.get)(o,p)).forEach(g=>{const h=(0,P.get)(o,[...p,g,i],void 0);if(h){let y=nn(h,l);if(!l&&y.conditions){const T=nn(y.conditions,!1);y=tr(er({},y),{conditions:T})}(0,P.set)(n,[...p,g,i],y)}});break}case"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX":{const{pathToCollectionType:r,propertyName:i,rowName:l,value:p}=t;let g=(0,P.cloneDeep)(o.modifiedData);const h=r.split(".."),y=(0,P.get)(g,h,{});Object.keys(y).forEach(T=>{if((0,P.has)(y[T],`properties.${i}`)){const L=(0,P.get)(y,[T,"properties",i,l]),k=[...h,T,"properties",i,l];if(!(0,P.isObject)(L))(0,P.set)(g,k,p);else{const te=nn(L,p);(0,P.set)(g,k,te)}}}),p||(g=Nn(g)),(0,P.set)(n,"modifiedData",g);break}case"ON_CHANGE_CONDITIONS":{Object.entries(t.conditions).forEach(r=>{const[i,l]=r;(0,P.set)(n,["modifiedData",...i.split(".."),"conditions"],l)});break}case"ON_CHANGE_SIMPLE_CHECKBOX":{let r=(0,P.cloneDeep)(o.modifiedData);(0,P.set)(r,[...t.keys.split("..")],t.value),t.value||(r=Nn(r)),(0,P.set)(n,"modifiedData",r);break}case"ON_CHANGE_TOGGLE_PARENT_CHECKBOX":{const{keys:r,value:i}=t,l=[...r.split("..")];let p=(0,P.cloneDeep)(o.modifiedData);const g=(0,P.get)(p,l,{}),h=nn(g,i);(0,P.set)(p,l,h),i||(p=Nn(p)),(0,P.set)(n,["modifiedData"],p);break}case"RESET_FORM":{n.modifiedData=o.initialData;break}case"SET_FORM_AFTER_SUBMIT":{n.initialData=o.modifiedData;break}default:return n}}),Wn=o=>Object.entries(o).filter(([,t])=>t).map(([t])=>t),ar=o=>{const[t,{conditions:n}]=o;return{action:t,subject:null,conditions:Wn(n),properties:{}}},rr=o=>Object.values(o).reduce((t,n)=>{const r=Object.entries(n).reduce((i,l)=>{const[,{properties:{enabled:p}}]=l;if(!p)return i;const g=ar(l);return i.push(g),i},[]);return[...t,...r]},[]),Wo=o=>Object.values(o).reduce((t,n)=>{const r=rr(n);return[...t,...r]},[]),$o=(o,t="")=>Object.entries(o).reduce((n,r)=>{const[i,l]=r;return(0,P.isObject)(l)?[...n,...$o(l,`${t}${i}.`)]:(l&&!(0,P.isObject)(l)&&n.push(`${t}${i}`),n)},[]),sr=(o,t,{conditions:n,properties:r})=>Object.entries(r).reduce((i,l)=>{const[p,g]=l;return i.properties[p]=$o(g),i},{action:o,subject:t,conditions:Wn(n),properties:{}}),ir=(o,t,{conditions:n})=>({action:o,subject:t,properties:{},conditions:Wn(n)}),lr=(o,t)=>Object.entries(t).reduce((r,i)=>{const[l,p]=i;if(!mt(p).some(y=>y))return r;if(!(0,P.has)(p,"properties.enabled")){const y=sr(l,o,p);return[...r,y]}if(!p.properties.enabled)return r;const h=ir(l,o,p);return r.push(h),r},[]),Uo=o=>Object.entries(o).reduce((n,r)=>{const[i,l]=r,p=lr(i,l);return[...n,...p]},[]),cr=o=>{const t=Wo(o.plugins),n=Wo(o.settings),r=Uo(o.collectionTypes),i=Uo(o.singleTypes);return[...t,...n,...r,...i]},dr=[{labelId:"app.components.LeftMenuLinkContainer.collectionTypes",defaultMessage:"Collection Types",id:"collectionTypes"},{labelId:"app.components.LeftMenuLinkContainer.singleTypes",id:"singleTypes",defaultMessage:"Single Types"},{labelId:"app.components.LeftMenuLinkContainer.plugins",defaultMessage:"Plugins",id:"plugins"},{labelId:"app.components.LeftMenuLinkContainer.settings",defaultMessage:"Settings",id:"settings"}];var ur=Object.defineProperty,ko=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,Vo=(o,t,n)=>t in o?ur(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Go=(o,t)=>{for(var n in t||(t={}))pr.call(t,n)&&Vo(o,n,t[n]);if(ko)for(var n of ko(t))mr.call(t,n)&&Vo(o,n,t[n]);return o};const $n=(0,e.forwardRef)(({layout:o,isFormDisabled:t,permissions:n},r)=>{const[{initialData:i,layouts:l,modifiedData:p},g]=(0,e.useReducer)(or,nr,()=>ja(o,n)),{formatMessage:h}=(0,q.useIntl)();(0,e.useImperativeHandle)(r,()=>({getPermissions:()=>{const B=(0,H.difference)(i.collectionTypes,p.collectionTypes),W=(0,H.difference)(i.singleTypes,p.singleTypes),O=Go(Go({},B),W);let I;return $e()(O)?I=!1:I=Object.values(O).some(X=>Object.values(X).some(se=>Ae()(se,"conditions"))),{permissionsToSend:cr(p),didUpdateConditions:I}},resetForm:()=>{g({type:"RESET_FORM"})},setFormAfterSubmit:()=>{g({type:"SET_FORM_AFTER_SUBMIT"})}}));const y=(B,W,O,I)=>{g({type:"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX",pathToCollectionType:B,propertyName:W,rowName:O,value:I})},T=(B,W,O)=>{g({type:"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX",collectionTypeKind:B,actionId:W,value:O})},L=B=>{g({type:"ON_CHANGE_CONDITIONS",conditions:B})},k=(0,e.useCallback)(({target:{name:B,value:W}})=>{g({type:"ON_CHANGE_SIMPLE_CHECKBOX",keys:B,value:W})},[]),te=(0,e.useCallback)(({target:{name:B,value:W}})=>{g({type:"ON_CHANGE_TOGGLE_PARENT_CHECKBOX",keys:B,value:W})},[]);return e.createElement(ma,{value:{availableConditions:o.conditions,modifiedData:p,onChangeConditions:L,onChangeSimpleCheckbox:k,onChangeParentCheckbox:te,onChangeCollectionTypeLeftActionRowCheckbox:y,onChangeCollectionTypeGlobalActionCheckbox:T}},e.createElement(U.TabGroup,{id:"tabs",label:h({id:"Settings.permissions.users.tabs.label",defaultMessage:"Tabs Permissions"})},e.createElement(U.Tabs,null,dr.map(B=>e.createElement(U.Tab,{key:B.id},h({id:B.labelId,defaultMessage:B.defaultMessage})))),e.createElement(U.TabPanels,{style:{position:"relative"}},e.createElement(U.TabPanel,null,e.createElement(co,{layout:l.collectionTypes,kind:"collectionTypes",isFormDisabled:t})),e.createElement(U.TabPanel,null,e.createElement(co,{layout:l.singleTypes,kind:"singleTypes",isFormDisabled:t})),e.createElement(U.TabPanel,null,e.createElement(vo,{layout:l.plugins,kind:"plugins",isFormDisabled:t})),e.createElement(U.TabPanel,null,e.createElement(vo,{layout:l.settings,kind:"settings",isFormDisabled:t})))))});$n.defaultProps={permissions:[],layout:{conditions:[],sections:{collectionTypes:{},singleTypes:{actions:[]},settings:[],plugins:[]}}},$n.propTypes={layout:s().object,isFormDisabled:s().bool.isRequired,permissions:s().array};const gr=(0,e.memo)($n)},95204:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!0},6214:(oe,x,a)=>{a.d(x,{Z:()=>e});const e=()=>"todo empty role"},2892:(oe,x,a)=>{a.d(x,{Z:()=>ze});var e=a(32735),E=a(60216),s=a.n(E),H=a(9808),U=a.n(H),Be=a(19192),Ae=a.n(Be),ce=a(53214),$e=a.n(ce),q=a(95602),w=a.n(q),b=a(20763),z=a.n(b),de=a(10938),Y=a.n(de),Z=a(5636),qe=a.n(Z),Ye=Object.defineProperty,Ge=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,C=(ae,re,fe)=>re in ae?Ye(ae,re,{enumerable:!0,configurable:!0,writable:!0,value:fe}):ae[re]=fe,ue=(ae,re)=>{for(var fe in re||(re={}))be.call(re,fe)&&C(ae,fe,re[fe]);if(Ge)for(var fe of Ge(re))K.call(re,fe)&&C(ae,fe,re[fe]);return ae};const Ue=({id:ae,name:re,description:fe,usersCount:Le,icons:_e})=>{const{formatMessage:et}=(0,Z.useIntl)(),ke=et({id:"Roles.RoleRow.user-count",defaultMessage:"{number, plural, =0 {# user} one {# user} other {# users}}"},{number:Le});return e.createElement(ce.Tr,ue({key:ae},(0,de.onRowClick)({fn:_e[1].onClick})),e.createElement(ce.Td,{maxWidth:(0,de.pxToRem)(130)},e.createElement(q.Typography,{ellipsis:!0,textColor:"neutral800"},re)),e.createElement(ce.Td,{maxWidth:(0,de.pxToRem)(250)},e.createElement(q.Typography,{ellipsis:!0,textColor:"neutral800"},fe)),e.createElement(ce.Td,null,e.createElement(q.Typography,{textColor:"neutral800"},ke)),e.createElement(ce.Td,null,e.createElement(Be.Flex,ue({justifyContent:"flex-end"},de.stopPropagation),_e.map((Re,Ze)=>Re?e.createElement(H.Box,{key:Re.label,paddingLeft:Ze===0?0:1},e.createElement(b.IconButton,{onClick:Re.onClick,label:Re.label,noBorder:!0,icon:Re.icon})):null))))};Ue.propTypes={id:s().number.isRequired,name:s().string.isRequired,description:s().string.isRequired,usersCount:s().number.isRequired,icons:s().array.isRequired};const ze=Ue},10333:(oe,x,a)=>{a.d(x,{Z:()=>Je});var e=a(32735),E=a(10938),s=a(79613),H=a(58469),U=a(59290),Be=a.n(U),Ae=a(76470),ce=a.n(Ae),$e=a(95717),q=a.n($e),w=a(68192),b=a.n(w),z=a(44526),de=a(11856),Y=a(53214),Z=a(95602),qe=a(16540),Ye=a(28004),Ge=a(5636),be=a(5141),K=a(2892),C=a(6214),ue=a(60216),Ue=a.n(ue),ze=a(19615),ae=a(64410),re=a(54742),fe=a(20763),Le=a(74064),_e=a(9808),et=a(19192),ke=a(90662),Re=a(82372),Ze=a.n(Re),lt=a(94009),rt=a.n(lt),S=a(378),pe=a(19337);const j=ze.default.div`
136
+ position: absolute;
137
+ z-index: 3;
138
+ inset: 0;
139
+ background: ${({theme:N})=>(0,E.setHexOpacity)(N.colors.neutral800,.2)};
140
+ padding: 0 ${({theme:N})=>N.spaces[8]};
141
+ `,$=(0,ze.default)(et.Flex)`
142
+ position: relative;
143
+ max-width: ${830/16}rem;
144
+ height: ${415/16}rem;
145
+ margin: 0 auto;
146
+ overflow: hidden;
147
+ margin-top: 10%;
148
+ padding-left: ${64/16}rem;
149
+
150
+ img:first-of-type {
151
+ position: absolute;
152
+ right: 0;
153
+ top: 0;
154
+ max-width: ${360/16}rem;
155
+ }
156
+
157
+ img:not(:first-of-type) {
158
+ width: ${130/16}rem;
159
+ margin-left: 12%;
160
+ margin-right: ${20/16}rem;
161
+ z-index: 0;
162
+ }
163
+ `,ie=(0,ze.default)(ke.Stack)`
164
+ align-items: flex-start;
165
+ max-width: ${400/16}rem;
166
+ z-index: 0;
167
+ `,V=(0,ze.default)(_e.Box)`
168
+ position: absolute;
169
+ right: ${({theme:N})=>N.spaces[4]};
170
+ top: ${({theme:N})=>N.spaces[4]};
171
+ `,Se=({onClose:N,isOpen:me})=>{(0,E.useLockScroll)(me);const{formatMessage:ne}=(0,Ge.useIntl)();return me?e.createElement(ae.Portal,null,e.createElement(j,{onClick:N},e.createElement(re.FocusTrap,{onEscape:N},e.createElement($,{onClick:G=>G.stopPropagation(),"aria-labelledby":"upgrade-plan",background:"neutral0",hasRadius:!0},e.createElement("img",{src:S,alt:"air-balloon"}),e.createElement(V,null,e.createElement(fe.IconButton,{onClick:N,"aria-label":"Close",icon:e.createElement(rt(),null)})),e.createElement(ie,{spacing:6},e.createElement(Z.Typography,{fontWeight:"bold",textColor:"primary600"},ne({id:"app.components.UpgradePlanModal.text-ce",defaultMessage:"COMMUNITY EDITION"})),e.createElement(ke.Stack,{spacing:2},e.createElement(Z.Typography,{variant:"alpha",as:"h2",id:"upgrade-plan"},ne({id:"app.components.UpgradePlanModal.limit-reached",defaultMessage:"You have reached the limit"})),e.createElement(Z.Typography,null,ne({id:"app.components.UpgradePlanModal.text-power",defaultMessage:"Unlock the full power of Strapi by upgrading your plan to the Enterprise Edition"}))),e.createElement(Le.LinkButton,{href:"https://strapi.io/pricing-self-hosted",endIcon:e.createElement(Ze(),null)},ne({id:"app.components.UpgradePlanModal.button",defaultMessage:"Learn more"}))),e.createElement("img",{src:pe,alt:"upgrade-arrow"}))))):null};Se.propTypes={onClose:Ue().func.isRequired,isOpen:Ue().bool.isRequired};const _=Se;var F=a(28492);const ee=()=>{const{roles:N,isLoading:me}=(0,F.bF)(),ne=(0,E.useQuery)(),G=decodeURIComponent(ne.get("_q")||""),ge=(0,H.ZP)(N,G,{keys:["name","description"]});return{isLoading:me,sortedRoles:ge}},Pe=()=>{const{formatMessage:N}=(0,Ge.useIntl)(),[me,ne]=(0,e.useState)(!1),{trackUsage:G}=(0,E.useTracking)(),{push:ge}=(0,be.useHistory)(),Ke=(0,e.useCallback)(Oe=>{ge(`/settings/roles/${Oe}`)},[ge]),Ie=(0,e.useCallback)(()=>{ne(Oe=>!Oe)},[]),Q=(0,e.useCallback)(()=>{G("didShowRBACUpgradeModal"),ne(!0)},[G]),he=(0,e.useCallback)(Oe=>[{onClick:Ie,label:N({id:"app.utils.duplicate",defaultMessage:"Duplicate"}),icon:e.createElement(b(),null)},{onClick:()=>Ke(Oe.id),label:N({id:"app.utils.edit",defaultMessage:"Edit"}),icon:e.createElement(q(),null)},{onClick:Ie,label:N({id:"global.delete",defaultMessage:"Delete"}),icon:e.createElement(ce(),null)}],[N,Ie,Ke]);return{isModalOpen:me,handleToggleModalForCreatingRole:Q,handleToggle:Ie,getIcons:he}},Qe=()=>{const{formatMessage:N}=(0,Ge.useIntl)();(0,E.useFocusWhenNavigate)();const{sortedRoles:me,isLoading:ne}=ee(),{isModalOpen:G,handleToggle:ge,handleToggleModalForCreatingRole:Ke,getIcons:Ie}=Pe(),Q=me.length+1,he=5;return e.createElement(qe.Main,null,e.createElement(E.SettingsPageTitle,{name:"Roles"}),e.createElement(de.HeaderLayout,{primaryAction:e.createElement(z.Button,{onClick:Ke,startIcon:e.createElement(Be(),null),size:"L"},N({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})),title:N({id:"global.roles",defaultMessage:"roles"}),subtitle:N({id:"Settings.roles.list.description",defaultMessage:"List of roles"})}),e.createElement(de.ContentLayout,null,e.createElement(Y.Table,{colCount:he,rowCount:Q,footer:e.createElement(Y.TFooter,{onClick:Ke,icon:e.createElement(Be(),null)},N({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"}))},e.createElement(Y.Thead,null,e.createElement(Y.Tr,null,e.createElement(Y.Th,null,e.createElement(Z.Typography,{variant:"sigma",textColor:"neutral600"},N({id:"global.name",defaultMessage:"Name"}))),e.createElement(Y.Th,null,e.createElement(Z.Typography,{variant:"sigma",textColor:"neutral600"},N({id:"global.description",defaultMessage:"Description"}))),e.createElement(Y.Th,null,e.createElement(Z.Typography,{variant:"sigma",textColor:"neutral600"},N({id:"global.users",defaultMessage:"Users"}))),e.createElement(Y.Th,null,e.createElement(Ye.VisuallyHidden,null,N({id:"global.actions",defaultMessage:"Actions"}))))),e.createElement(Y.Tbody,null,me==null?void 0:me.map(Oe=>e.createElement(K.Z,{key:Oe.id,id:Oe.id,name:Oe.name,description:Oe.description,usersCount:Oe.usersCount,icons:Ie(Oe)})))),!Q&&!ne&&e.createElement(C.Z,null)),e.createElement(_,{isOpen:G,onClose:ge}))},Je=()=>e.createElement(E.CheckPagePermissions,{permissions:s.Z.settings.roles.main},e.createElement(Qe,null))},23027:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=[]},97971:(oe,x,a)=>{a.d(x,{Z:()=>rt});var e=a(32735),E=a(53806),s=a.n(E),H=a(10938),U=a(9808),Be=a(44526),Ae=a(11856),ce=a(78330),$e=a(16540),q=a(58434),w=a(19192),b=a(90662),z=a(95602),de=a(37178),Y=a(90353),Z=a(98599),qe=a.n(Z),Ye=a(83281),Ge=a(33795),be=a.n(Ge),K=a(86834),C=a.n(K),ue=a(5636),Ue=a(5141),ze=a(19615),ae=a(13806),re=a(28492),fe=a(79613),Le=a(5173);const et=Le.Ry().shape({name:Le.Z_().required(H.translatedErrors.required),description:Le.Z_().required(H.translatedErrors.required)});var ke=a(98399),Re=(S,pe,j)=>new Promise(($,ie)=>{var V=F=>{try{_(j.next(F))}catch(ee){ie(ee)}},Se=F=>{try{_(j.throw(F))}catch(ee){ie(ee)}},_=F=>F.done?$(F.value):Promise.resolve(F.value).then(V,Se);_((j=j.apply(S,pe)).next())});const Ze=ze.default.div`
172
+ border: 1px solid ${({theme:S})=>S.colors.primary200};
173
+ background: ${({theme:S})=>S.colors.primary100};
174
+ padding: ${({theme:S})=>`${S.spaces[2]} ${S.spaces[4]}`};
175
+ color: ${({theme:S})=>S.colors.primary600};
176
+ border-radius: ${({theme:S})=>S.borderRadius};
177
+ font-size: ${12/16}rem;
178
+ font-width: bold;
179
+ `,lt=()=>{const S=(0,H.useNotification)(),{lockApp:pe,unlockApp:j}=(0,H.useOverlayBlocker)(),{formatMessage:$}=(0,ue.useIntl)(),[ie,V]=(0,e.useState)(!1),{replace:Se}=(0,Ue.useHistory)(),_=(0,e.useRef)(),{trackUsage:F}=(0,H.useTracking)(),ee=(0,Ue.useRouteMatch)("/settings/roles/duplicate/:id"),Pe=be()(ee,"params.id",null),{isLoading:He,data:Qe}=(0,re.U_)(),{permissions:st,isLoading:Je}=(0,re.Dq)(Pe),N=ne=>{pe(),V(!0),F(Pe?"willDuplicateRole":"willCreateNewRole"),Promise.resolve((0,H.request)("/admin/roles",{method:"POST",body:ne})).then(G=>Re(void 0,null,function*(){const{permissionsToSend:ge}=_.current.getPermissions();return F(Pe?"didDuplicateRole":"didCreateNewRole"),G.data.id&&!C()(ge)&&(yield(0,H.request)(`/admin/roles/${G.data.id}/permissions`,{method:"PUT",body:{permissions:ge}})),G})).then(G=>{V(!1),S({type:"success",message:{id:"Settings.roles.created",defaultMessage:"created"}}),Se(`/settings/roles/${G.data.id}`)}).catch(G=>{ke.error(G),V(!1),S({type:"warning",message:{id:"notification.error"}})}).finally(()=>{j()})},me=`${$({id:"Settings.roles.form.created",defaultMessage:"Created"})} ${s()().format("LL")}`;return e.createElement($e.Main,null,e.createElement(H.SettingsPageTitle,{name:"Roles"}),e.createElement(Ye.Formik,{initialValues:{name:"",description:me},onSubmit:N,validationSchema:et,validateOnChange:!1},({handleSubmit:ne,values:G,errors:ge,handleReset:Ke,handleChange:Ie})=>e.createElement(H.Form,{noValidate:!0},e.createElement(e.Fragment,null,e.createElement(Ae.HeaderLayout,{primaryAction:e.createElement(b.Stack,{horizontal:!0,spacing:2},e.createElement(Be.Button,{variant:"secondary",onClick:()=>{Ke(),_.current.resetForm()},size:"L"},$({id:"app.components.Button.reset",defaultMessage:"Reset"})),e.createElement(Be.Button,{onClick:ne,loading:ie,size:"L"},$({id:"global.save",defaultMessage:"Save"}))),title:$({id:"Settings.roles.create.title",defaultMessage:"Create a role"}),subtitle:$({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(q.Link,{startIcon:e.createElement(qe(),null),to:"/settings/roles"},$({id:"global.back",defaultMessage:"Back"}))}),e.createElement(Ae.ContentLayout,null,e.createElement(b.Stack,{spacing:6},e.createElement(U.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(b.Stack,{spacing:4},e.createElement(w.Flex,{justifyContent:"space-between"},e.createElement(U.Box,null,e.createElement(U.Box,null,e.createElement(z.Typography,{fontWeight:"bold"},$({id:"global.details",defaultMessage:"Details"}))),e.createElement(U.Box,null,e.createElement(z.Typography,{variant:"pi",textColor:"neutral600"},$({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(Ze,null,$({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:0}))),e.createElement(ce.Grid,{gap:4},e.createElement(ce.GridItem,{col:6},e.createElement(de.TextInput,{name:"name",error:ge.name&&$({id:ge.name}),label:$({id:"global.name",defaultMessage:"Name"}),onChange:Ie,value:G.name})),e.createElement(ce.GridItem,{col:6},e.createElement(Y.Textarea,{label:$({id:"global.description",defaultMessage:"Description"}),name:"description",error:ge.description&&$({id:ge.description}),onChange:Ie},G.description))))),!He&&!Je?e.createElement(U.Box,{shadow:"filterShadow",hasRadius:!0},e.createElement(ae.Z,{isFormDisabled:!1,ref:_,permissions:st,layout:Qe})):e.createElement(U.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(H.LoadingIndicatorPage,null))))))))},rt=()=>e.createElement(H.CheckPagePermissions,{permissions:fe.Z.settings.roles.create},e.createElement(lt,null))},10265:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!1},47902:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!1},71231:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!1},38292:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!1},66713:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!1},37582:(oe,x,a)=>{a.d(x,{Z:()=>E});const E=!1},49776:(oe,x,a)=>{a.d(x,{Z:()=>rt});var e=a(32735),E=a(10938),s=a(79613),H=a(59290),U=a.n(H),Be=a(76470),Ae=a.n(Be),ce=a(68192),$e=a.n(ce),q=a(95717),w=a.n(q),b=a(44526),z=a(11856),de=a(28004),Y=a(16540),Z=a(53214),qe=a(95602),Ye=a(92891),Ge=a(58469),be=a(5636),K=a(5141),C=a(81999),ue=a(28492),Ue=a(6214),ze=a(2892),ae=a(49415);const re={roleToDelete:null,showModalConfirmButtonLoading:!1,shouldRefetchData:!1},Le=(S,pe)=>(0,ae.default)(S,j=>{switch(pe.type){case"ON_REMOVE_ROLES":{j.showModalConfirmButtonLoading=!0;break}case"ON_REMOVE_ROLES_SUCCEEDED":{j.shouldRefetchData=!0,j.roleToDelete=null;break}case"RESET_DATA_TO_DELETE":{j.shouldRefetchData=!1,j.roleToDelete=null,j.showModalConfirmButtonLoading=!1;break}case"SET_ROLE_TO_DELETE":{j.roleToDelete=pe.id;break}default:return j}});var _e=(S,pe,j)=>new Promise(($,ie)=>{var V=F=>{try{_(j.next(F))}catch(ee){ie(ee)}},Se=F=>{try{_(j.throw(F))}catch(ee){ie(ee)}},_=F=>F.done?$(F.value):Promise.resolve(F.value).then(V,Se);_((j=j.apply(S,pe)).next())});const et=()=>{(0,E.useFocusWhenNavigate)();const{isLoading:S,allowedActions:{canCreate:pe,canDelete:j,canRead:$,canUpdate:ie}}=(0,E.useRBAC)(s.Z.settings.roles),{getData:V,roles:Se,isLoading:_}=(0,ue.bF)(!1),[{query:F}]=(0,E.useQueryParams)(),ee=(F==null?void 0:F._q)||"",Pe=(0,Ge.ZP)(Se,ee,{keys:["name","description"]});return(0,e.useEffect)(()=>{!S&&$&&V()},[S,$,V]),{isLoadingForPermissions:S,canCreate:pe,canDelete:j,canRead:$,canUpdate:ie,isLoading:_,getData:V,sortedRoles:Pe,roles:Se}},ke=({getData:S,canCreate:pe,canDelete:j,canUpdate:$})=>{const{formatMessage:ie}=(0,be.useIntl)(),V=(0,E.useNotification)(),[Se,_]=(0,e.useState)(!1),{push:F}=(0,K.useHistory)(),[{selectedRoles:ee,showModalConfirmButtonLoading:Pe,roleToDelete:He},Qe]=(0,e.useReducer)(Le,re),st=()=>_e(void 0,null,function*(){try{Qe({type:"ON_REMOVE_ROLES"}),yield C.be.post("/admin/roles/batch-delete",{ids:[He]}),yield S(),Qe({type:"RESET_DATA_TO_DELETE"})}catch(Q){const he=(0,Ye.get)(Q,["response","payload","data","ids"],null);if(he&&Array.isArray(he)){const Oe=he.join(`
180
+ `);V({type:"warning",message:Oe})}else V({type:"warning",message:{id:"notification.error"}})}ne()}),Je=(0,e.useCallback)(Q=>{F(`/settings/roles/duplicate/${Q}`)},[F]),N=()=>F("/settings/roles/new"),me=(0,e.useCallback)(Q=>{Qe({type:"SET_ROLE_TO_DELETE",id:Q}),ne()},[]),ne=()=>_(Q=>!Q),G=(0,e.useCallback)(Q=>{F(`/settings/roles/${Q}`)},[F]),ge=(0,e.useCallback)((Q,he)=>{Q.preventDefault(),Q.stopPropagation(),he.usersCount?V({type:"info",message:{id:"Roles.ListPage.notification.delete-not-allowed"}}):me(he.id)},[V,me]),Ke=(0,e.useCallback)((Q,he)=>{Q.preventDefault(),Q.stopPropagation(),Je(he.id)},[Je]),Ie=(0,e.useCallback)(Q=>[...pe?[{onClick:he=>Ke(he,Q),label:ie({id:"app.utils.duplicate",defaultMessage:"Duplicate"}),icon:e.createElement($e(),null)}]:[],...$?[{onClick:()=>G(Q.id),label:ie({id:"app.utils.edit",defaultMessage:"Edit"}),icon:e.createElement(w(),null)}]:[],...j?[{onClick:he=>ge(he,Q),label:ie({id:"global.delete",defaultMessage:"Delete"}),icon:e.createElement(Ae(),null)}]:[]],[ie,ge,Ke,G,pe,$,j]);return{handleNewRoleClick:N,getIcons:Ie,selectedRoles:ee,isWarningDeleteAllOpened:Se,showModalConfirmButtonLoading:Pe,handleToggleModal:ne,handleDeleteData:st}},Ze=()=>{const{formatMessage:S}=(0,be.useIntl)(),{isLoadingForPermissions:pe,canCreate:j,canRead:$,canDelete:ie,canUpdate:V,isLoading:Se,getData:_,sortedRoles:F}=et(),{handleNewRoleClick:ee,getIcons:Pe,isWarningDeleteAllOpened:He,showModalConfirmButtonLoading:Qe,handleToggleModal:st,handleDeleteData:Je}=ke({getData:_,canCreate:j,canDelete:ie,canUpdate:V}),N=F.length+1,me=6;if(pe)return e.createElement(Y.Main,null,e.createElement(E.LoadingIndicatorPage,null));const ne=S({id:"global.roles",defaultMessage:"roles"});return e.createElement(Y.Main,null,e.createElement(E.SettingsPageTitle,{name:"Roles"}),e.createElement(z.HeaderLayout,{primaryAction:j?e.createElement(b.Button,{onClick:ee,startIcon:e.createElement(U(),null),size:"L"},S({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})):null,title:ne,subtitle:S({id:"Settings.roles.list.description",defaultMessage:"List of roles"}),as:"h2"}),$&&e.createElement(z.ActionLayout,{startActions:e.createElement(E.SearchURLQuery,{label:S({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:ne})})}),$&&e.createElement(z.ContentLayout,null,e.createElement(Z.Table,{colCount:me,rowCount:N,footer:j?e.createElement(Z.TFooter,{onClick:ee,icon:e.createElement(U(),null)},S({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})):null},e.createElement(Z.Thead,null,e.createElement(Z.Tr,null,e.createElement(Z.Th,null,e.createElement(qe.Typography,{variant:"sigma",textColor:"neutral600"},S({id:"global.name",defaultMessage:"Name"}))),e.createElement(Z.Th,null,e.createElement(qe.Typography,{variant:"sigma",textColor:"neutral600"},S({id:"global.description",defaultMessage:"Description"}))),e.createElement(Z.Th,null,e.createElement(qe.Typography,{variant:"sigma",textColor:"neutral600"},S({id:"global.users",defaultMessage:"Users"}))),e.createElement(Z.Th,null,e.createElement(de.VisuallyHidden,null,S({id:"global.actions",defaultMessage:"Actions"}))))),e.createElement(Z.Tbody,null,F==null?void 0:F.map(G=>e.createElement(ze.Z,{key:G.id,id:G.id,name:G.name,description:G.description,usersCount:G.usersCount,icons:Pe(G)})))),!N&&!Se&&e.createElement(Ue.Z,null)),e.createElement(E.ConfirmDialog,{isOpen:He,onConfirm:Je,isConfirmButtonLoading:Qe,onToggleDialog:st}))},rt=()=>e.createElement(E.CheckPagePermissions,{permissions:s.Z.settings.roles.main},e.createElement(Ze,null))},78251:(oe,x,a)=>{a.d(x,{Z:()=>H});var e=(U,Be,Ae)=>new Promise((ce,$e)=>{var q=z=>{try{b(Ae.next(z))}catch(de){$e(de)}},w=z=>{try{b(Ae.throw(z))}catch(de){$e(de)}},b=z=>z.done?ce(z.value):Promise.resolve(z.value).then(q,w);b((Ae=Ae.apply(U,Be)).next())});const H=[...strapi.features.isEnabled(strapi.features.SSO)?[{Component:()=>e(void 0,null,function*(){return yield a.e(302).then(a.bind(a,80482))}),to:"/settings/single-sign-on",exact:!0}]:[]]},378:(oe,x,a)=>{oe.exports=a.p+"c3de6118ef47086ad05c.png"},19337:(oe,x,a)=>{oe.exports=a.p+"bd81ba6c07827282255d.png"}}]);