@strapi/admin 4.4.5 → 4.4.6

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 (36) hide show
  1. package/admin/src/content-manager/components/DynamicTable/CellContent/CellValue.js +1 -1
  2. package/admin/src/index.js +1 -0
  3. package/admin/src/pages/MarketplacePage/components/NpmPackageCard/index.js +1 -1
  4. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormApiTokenContainer/index.js +5 -4
  5. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormBody/index.js +4 -3
  6. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormHead/index.js +6 -2
  7. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Regenerate/index.js +1 -1
  8. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +5 -4
  9. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js +1 -1
  10. package/admin/src/pages/SettingsPage/pages/Roles/ListPage/components/RoleRow/index.js +3 -1
  11. package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +2 -1
  12. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +2 -2
  13. package/admin/src/translations/en.json +1 -1
  14. package/build/4318.5e670740.chunk.js +30 -0
  15. package/build/{8773.51992277.chunk.js → 8773.8499fa5f.chunk.js} +5 -5
  16. package/build/{9166.8fcb3019.chunk.js → 9166.07858688.chunk.js} +9 -9
  17. package/build/{Admin-authenticatedApp.0148e33c.chunk.js → Admin-authenticatedApp.8a683592.chunk.js} +1 -1
  18. package/build/{Admin_marketplace.3b5a5b5d.chunk.js → Admin_marketplace.3e23f85a.chunk.js} +1 -1
  19. package/build/{Admin_settingsPage.98e2a62b.chunk.js → Admin_settingsPage.961b2f50.chunk.js} +26 -26
  20. package/build/{content-manager.78fe09e2.chunk.js → content-manager.bb2f5081.chunk.js} +2 -2
  21. package/build/{content-type-builder.adbfd710.chunk.js → content-type-builder.16af63a6.chunk.js} +1 -1
  22. package/build/{email-settings-page.bfe6227f.chunk.js → email-settings-page.e7642cea.chunk.js} +1 -1
  23. package/build/en-json.21f90d0c.chunk.js +1 -0
  24. package/build/index.html +1 -1
  25. package/build/main.9104c9e0.js +9338 -0
  26. package/build/{runtime~main.2346f38d.js → runtime~main.6ce5c58e.js} +1 -1
  27. package/build/{webhook-edit-page.9e46fc3f.chunk.js → webhook-edit-page.dc9442ce.chunk.js} +1 -1
  28. package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +3 -2
  29. package/env.js +1 -0
  30. package/package.json +9 -9
  31. package/scripts/build.js +11 -0
  32. package/utils/create-plugins-exclude-path.js +40 -0
  33. package/webpack.config.js +4 -1
  34. package/build/4318.7d167b58.chunk.js +0 -30
  35. package/build/en-json.922ce2db.chunk.js +0 -1
  36. package/build/main.22af697c.js +0 -9338
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[5895],{50020:(ge,D,a)=>{a.r(D),a.d(D,{SettingsPage:()=>_t,default:()=>Rn});var e=a(32735),C=a(88425),r=a(5141),ne=a(11856),V=a(5636),Le=a(99357),Ee=a(775),fe=a(7602),Ne=a(84968),Y=a(16540),F=a(9808),P=a(78330),Z=a(95602),de=a(90662),U=a(44526),te=a(14983),Ge=a(82372),$e=a.n(Ge),ze=a(88677),be=a.n(ze),z=a(60216),y=a.n(z),ue=a(69898),Ke=a(20763),re=a(59290),J=a.n(re),ae=a(23101),it=a.n(ae),Ie=a(49415);const Xe={currentStep:void 0},Se=(p=Xe,c)=>(0,Ie.default)(p,l=>{switch(c.type){case"GO_TO":{l.currentStep=c.to;break}default:return l}});var Ue=a(4122);const Qe={localImage:void 0},Je=(p=Qe,c)=>(0,Ie.default)(p,l=>{switch(c.type){case"SET_LOCAL_IMAGE":{l.localImage=c.value;break}default:return l}}),R=({onChangeLogo:p,customLogo:c,goTo:l,Component:h,modalTitle:u,next:T,prev:M,currentStep:O})=>{const[{localImage:v},x]=(0,e.useReducer)(Je,Qe),{formatMessage:Te}=(0,V.useIntl)(),me=yt=>{x({type:"SET_LOCAL_IMAGE",value:yt})},tt=()=>{l(null)};return O?e.createElement(Ue.ModalLayout,{labelledBy:"modal",onClose:tt},e.createElement(Ue.ModalHeader,null,e.createElement(Z.Typography,{fontWeight:"bold",as:"h2",id:"modal"},Te(u))),e.createElement(h,{setLocalImage:me,goTo:l,next:T,prev:M,onClose:tt,asset:v||c,onChangeLogo:p})):null};R.defaultProps={Component:void 0,currentStep:void 0,customLogo:void 0,modalTitle:void 0,next:null,prev:null},R.propTypes={Component:y().elementType,currentStep:y().string,customLogo:y().shape({name:y().string,url:y().string,width:y().number,height:y().number,ext:y().string}),goTo:y().func.isRequired,modalTitle:y().shape({id:y().string,defaultMessage:y().string}),next:y().string,onChangeLogo:y().func.isRequired,prev:y().string};const k=R,N=750,_=100,pe=["image/jpeg","image/png","image/svg+xml"];var W=a(81700),Q=a(27635),oe=a(19615),G=a(19192),le=a(78752),xe=a(20001),ke=a(22795),Ve=a.n(ke),st=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const qe={id:"Settings.application.customization.modal.upload.error-format",defaultMessage:"Wrong format uploaded (accepted formats only: jpeg, jpg, png, svg)."},B={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)"},K=p=>new Promise(c=>{const l=new FileReader;l.onload=()=>{const h=new Image;h.onload=function(){c({width:h.width,height:h.height})},h.src=l.result},l.readAsDataURL(p)}),H=(p,c)=>({ext:p.name.split(".").pop(),size:p.size/1e3,name:p.name,url:URL.createObjectURL(p),rawFile:p,width:c.width,height:c.height}),f=p=>st(void 0,null,function*(){let c;if(!pe.includes(p.type))throw c=new Error("File format"),c.displayMessage=qe,c;const h=yield K(p);if(!(h.width<=N&&h.height<=N))throw c=new Error("File sizing"),c.displayMessage=B,c;const T=H(p,h);if(!(T.size<=_))throw c=new Error("File sizing"),c.displayMessage=B,c;return T});var Fe=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const _e=(0,oe.default)(xe.FieldInput)`
1
+ "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[5895],{50020:(ge,D,a)=>{a.r(D),a.d(D,{SettingsPage:()=>en,default:()=>Rn});var e=a(32735),C=a(88425),r=a(5141),ne=a(11856),V=a(5636),Ie=a(99357),Ee=a(775),fe=a(7602),Ne=a(84968),Y=a(16540),F=a(9808),P=a(78330),Z=a(95602),de=a(90662),U=a(44526),te=a(14983),ze=a(82372),Ue=a.n(ze),Ke=a(88677),be=a.n(Ke),z=a(60216),y=a.n(z),ue=a(69898),He=a(20763),re=a(59290),J=a.n(re),ae=a(23101),it=a.n(ae),Fe=a(49415);const Ye={currentStep:void 0},We=(p=Ye,c)=>(0,Fe.default)(p,l=>{switch(c.type){case"GO_TO":{l.currentStep=c.to;break}default:return l}});var Ae=a(4122);const ke={localImage:void 0},Je=(p=ke,c)=>(0,Fe.default)(p,l=>{switch(c.type){case"SET_LOCAL_IMAGE":{l.localImage=c.value;break}default:return l}}),R=({onChangeLogo:p,customLogo:c,goTo:l,Component:h,modalTitle:u,next:T,prev:M,currentStep:O})=>{const[{localImage:v},x]=(0,e.useReducer)(Je,ke),{formatMessage:Pe}=(0,V.useIntl)(),me=yt=>{x({type:"SET_LOCAL_IMAGE",value:yt})},tt=()=>{l(null)};return O?e.createElement(Ae.ModalLayout,{labelledBy:"modal",onClose:tt},e.createElement(Ae.ModalHeader,null,e.createElement(Z.Typography,{fontWeight:"bold",as:"h2",id:"modal"},Pe(u))),e.createElement(h,{setLocalImage:me,goTo:l,next:T,prev:M,onClose:tt,asset:v||c,onChangeLogo:p})):null};R.defaultProps={Component:void 0,currentStep:void 0,customLogo:void 0,modalTitle:void 0,next:null,prev:null},R.propTypes={Component:y().elementType,currentStep:y().string,customLogo:y().shape({name:y().string,url:y().string,width:y().number,height:y().number,ext:y().string}),goTo:y().func.isRequired,modalTitle:y().shape({id:y().string,defaultMessage:y().string}),next:y().string,onChangeLogo:y().func.isRequired,prev:y().string};const k=R,N=750,_=100,pe=["image/jpeg","image/png","image/svg+xml"];var W=a(81700),Q=a(27635),oe=a(19615),G=a(19192),le=a(78752),Me=a(20001),Ve=a(22795),Ze=a.n(Ve),st=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const qe={id:"Settings.application.customization.modal.upload.error-format",defaultMessage:"Wrong format uploaded (accepted formats only: jpeg, jpg, png, svg)."},B={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)"},K=p=>new Promise(c=>{const l=new FileReader;l.onload=()=>{const h=new Image;h.onload=function(){c({width:h.width,height:h.height})},h.src=l.result},l.readAsDataURL(p)}),H=(p,c)=>({ext:p.name.split(".").pop(),size:p.size/1e3,name:p.name,url:URL.createObjectURL(p),rawFile:p,width:c.width,height:c.height}),f=p=>st(void 0,null,function*(){let c;if(!pe.includes(p.type))throw c=new Error("File format"),c.displayMessage=qe,c;const h=yield K(p);if(!(h.width<=N&&h.height<=N))throw c=new Error("File sizing"),c.displayMessage=B,c;const T=H(p,h);if(!(T.size<=_))throw c=new Error("File sizing"),c.displayMessage=B,c;return T});var Oe=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const _e=(0,oe.default)(Me.FieldInput)`
2
2
  opacity: 0;
3
3
  position: absolute;
4
4
  top: 0;
@@ -6,7 +6,7 @@
6
6
  left: 0;
7
7
  right: 0;
8
8
  z-index: 1;
9
- `,He=({setLocalImage:p,goTo:c,next:l,onClose:h})=>{const{formatMessage:u}=(0,V.useIntl)(),[T,M]=(0,e.useState)(!1),[O,v]=(0,e.useState)(void 0),x=(0,e.useRef)(null),Te=()=>M(!0),me=()=>M(!1),tt=ot=>{ot.preventDefault(),x.current.click()},yt=()=>Fe(void 0,null,function*(){me();const ot=x.current.files[0];if(!!ot)try{const at=yield f(ot);p(at),c(l)}catch(at){if(at.displayMessage)v(u(at.displayMessage,{size:_,dimension:N})),x.current.focus();else throw at}}),rt=()=>T?"primary500":O?"danger600":"neutral300";return e.createElement(e.Fragment,null,e.createElement("form",null,e.createElement(F.Box,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(xe.Field,{name:"logo-upload",error:O},e.createElement("label",{htmlFor:"logo-upload"},e.createElement(de.Stack,{spacing:2},e.createElement(G.Flex,{paddingTop:9,paddingBottom:7,hasRadius:!0,justifyContent:"center",direction:"column",background:T?"primary100":"neutral100",borderColor:rt(),borderStyle:"dashed",borderWidth:"1px",position:"relative",onDragEnter:Te,onDragLeave:me},e.createElement(le.Icon,{color:"primary600",width:`${60/16}rem`,height:`${60/16}rem`,as:Ve(),"aria-hidden":!0}),e.createElement(F.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(_e,{accept:pe,cursor:"pointer",as:"input",type:"file",name:"files",tabIndex:-1,zIndex:1,onChange:yt,ref:x,id:"logo-upload"}),e.createElement(U.Button,{type:"button",onClick:tt},u({id:"Settings.application.customization.modal.upload.cta.browse",defaultMessage:"Browse files"})),e.createElement(F.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:N})))),e.createElement(xe.FieldError,null)))))),e.createElement(Ue.ModalFooter,{startActions:e.createElement(U.Button,{onClick:h,variant:"tertiary"},u({id:"Settings.application.customization.modal.cancel",defaultMessage:"Cancel"}))}))};He.defaultProps={next:null},He.propTypes={goTo:y().func.isRequired,next:y().string,onClose:y().func.isRequired,setLocalImage:y().func.isRequired};const q=He;var he=a(37178),Pe=a(43653),tn=a.n(Pe),nn=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const Bt=p=>nn(void 0,null,function*(){try{const c=yield tn().get(p,{responseType:"blob",timeout:8e3});return new File([c.data],c.config.url,{type:c.headers["content-type"]})}catch(c){throw c.displayMessage={id:"Settings.application.customization.modal.upload.error-network",defaultMessage:"Network error"},c}});var wt=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const Et=({goTo:p,next:c,onClose:l,setLocalImage:h})=>{const{formatMessage:u}=(0,V.useIntl)(),[T,M]=(0,e.useState)(""),[O,v]=(0,e.useState)(null),x=me=>{M(me.target.value)},Te=()=>wt(void 0,null,function*(){try{const me=yield Bt(T),tt=yield f(me);h(tt),p(c)}catch(me){if(me.displayMessage)v(u(me.displayMessage,{size:_,dimension:N}));else throw me}});return e.createElement("form",{onSubmit:me=>{me.preventDefault(),Te()}},e.createElement(F.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:O,onChange:x,value:T,name:"logo-url"})),e.createElement(Ue.ModalFooter,{startActions:e.createElement(U.Button,{onClick:l,variant:"tertiary"},u({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(U.Button,{type:"submit"},u({id:"Settings.application.customization.modal.upload.next",defaultMessage:"Next"}))}))};Et.defaultProps={next:null},Et.propTypes={goTo:y().func.isRequired,next:y().string,onClose:y().func.isRequired,setLocalImage:y().func.isRequired};const $n=Et,ut=({setLocalImage:p,goTo:c,next:l,onClose:h})=>{const{formatMessage:u}=(0,V.useIntl)();return e.createElement(W.TabGroup,{label:u({id:"Settings.application.customization.modal.tab.label",defaultMessage:"How do you want to upload your assets?"}),variant:"simple"},e.createElement(F.Box,{paddingLeft:8,paddingRight:8},e.createElement(W.Tabs,null,e.createElement(W.Tab,null,u({id:"Settings.application.customization.modal.upload.from-computer",defaultMessage:"From computer"})),e.createElement(W.Tab,null,u({id:"Settings.application.customization.modal.upload.from-url",defaultMessage:"From url"}))),e.createElement(Q.Divider,null)),e.createElement(W.TabPanels,null,e.createElement(W.TabPanel,null,e.createElement(q,{onClose:h,setLocalImage:p,goTo:c,next:l})),e.createElement(W.TabPanel,null,e.createElement($n,{onClose:h,setLocalImage:p,goTo:c,next:l}))))};ut.defaultProps={next:null},ut.propTypes={goTo:y().func.isRequired,next:y().string,onClose:y().func.isRequired,setLocalImage:y().func.isRequired};const Un=ut;var nt=a(31998);const jt=({asset:p})=>{const{formatMessage:c}=(0,V.useIntl)();return e.createElement(nt.Card,null,e.createElement(nt.CardHeader,null,e.createElement(nt.CardAsset,{size:"S",src:p.url})),e.createElement(nt.CardBody,null,e.createElement(nt.CardContent,null,e.createElement(nt.CardTitle,null,p.name),e.createElement(nt.CardSubtitle,null,`${p.ext.toUpperCase()} - ${p.width}\u2715${p.height}`)),e.createElement(nt.CardBadge,null,c({id:"Settings.application.customization.modal.pending.card-badge",defaultMessage:"image"}))))};jt.propTypes={asset:y().shape({name:y().string,url:y().string,width:y().number,height:y().number,ext:y().string}).isRequired};const Nt=jt,Tt=({onClose:p,asset:c,prev:l,next:h,goTo:u,setLocalImage:T,onChangeLogo:M})=>{const{formatMessage:O}=(0,V.useIntl)(),v=()=>{T(void 0),u(l)},x=()=>{M(c),u(h)};return e.createElement(e.Fragment,null,e.createElement(F.Box,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(G.Flex,{justifyContent:"space-between",paddingBottom:6},e.createElement(G.Flex,{direction:"column",alignItems:"flex-start"},e.createElement(Z.Typography,{variant:"pi",fontWeight:"bold"},O({id:"Settings.application.customization.modal.pending.title",defaultMessage:"Logo ready to upload"})),e.createElement(Z.Typography,{variant:"pi",textColor:"neutral500"},O({id:"Settings.application.customization.modal.pending.subtitle",defaultMessage:"Manage the chosen logo before uploading it"}))),e.createElement(U.Button,{onClick:v,variant:"secondary"},O({id:"Settings.application.customization.modal.pending.choose-another",defaultMessage:"Choose another logo"}))),e.createElement(F.Box,{maxWidth:(0,C.pxToRem)(180)},e.createElement(Nt,{asset:c}))),e.createElement(Ue.ModalFooter,{startActions:e.createElement(U.Button,{onClick:p,variant:"tertiary"},O({id:"Settings.application.customization.modal.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(U.Button,{onClick:x},O({id:"Settings.application.customization.modal.pending.upload",defaultMessage:"Upload logo"}))}))};Tt.defaultProps={next:null,prev:null},Tt.propTypes={goTo:y().func.isRequired,asset:y().shape({name:y().string,url:y().string,width:y().number,height:y().number,ext:y().string}).isRequired,next:y().string,onClose:y().func.isRequired,onChangeLogo:y().func.isRequired,prev:y().string,setLocalImage:y().func.isRequired};const sn={upload:{Component:Un,modalTitle:{id:"Settings.application.customization.modal.upload",defaultMessage:"Upload logo"},next:"pending",prev:null},pending:{Component:Tt,modalTitle:{id:"Settings.application.customization.modal.pending",defaultMessage:"Pending logo"},next:null,prev:"upload"}},pt=({customLogo:p,defaultLogo:c,onChangeLogo:l,onResetMenuLogo:h})=>{const[{currentStep:u},T]=(0,e.useReducer)(Se,Xe),{Component:M,next:O,prev:v,modalTitle:x}=sn[u]||{},{formatMessage:Te}=(0,V.useIntl)(),me=tt=>{T({type:"GO_TO",to:tt})};return e.createElement(e.Fragment,null,e.createElement(ue.CarouselInput,{label:Te({id:"Settings.application.customization.carousel.title",defaultMessage:"Logo"}),selectedSlide:0,hint:Te({id:"Settings.application.customization.carousel-hint",defaultMessage:"Change the admin panel logo (Max dimension: {dimension}x{dimension}, Max file size: {size}KB)"},{size:_,dimension:N}),previousLabel:"",nextLabel:"",onNext:()=>{},onPrevious:()=>{},secondaryLabel:(p==null?void 0:p.name)||"logo.png",actions:e.createElement(ue.CarouselActions,null,e.createElement(Ke.IconButton,{onClick:()=>me(p?"pending":"upload"),label:Te({id:"Settings.application.customization.carousel.change-action",defaultMessage:"Change logo"}),icon:e.createElement(J(),null)}),p&&e.createElement(Ke.IconButton,{onClick:h,label:Te({id:"Settings.application.customization.carousel.reset-action",defaultMessage:"Reset logo"}),icon:e.createElement(it(),null)}))},e.createElement(ue.CarouselSlide,{label:Te({id:"Settings.application.customization.carousel-slide.label",defaultMessage:"Logo slide"})},e.createElement(F.Box,{maxHeight:"40%",maxWidth:"40%",as:"img",src:(p==null?void 0:p.url)||c,alt:Te({id:"Settings.application.customization.carousel.title",defaultMessage:"Logo"})}))),e.createElement(k,{Component:M,currentStep:u,onChangeLogo:l,customLogo:p,goTo:me,next:O,prev:v,modalTitle:x}))};pt.defaultProps={customLogo:null},pt.propTypes={customLogo:y().shape({url:y().string,name:y().string}),defaultLogo:y().string.isRequired,onChangeLogo:y().func.isRequired,onResetMenuLogo:y().func.isRequired};const Wt=pt,bt={menuLogo:{display:null,submit:{rawFile:null,isReset:!1}}},Vn=(p=bt,c)=>(0,Ie.default)(p,l=>{switch(c.type){case"SET_CUSTOM_MENU_LOGO":{l.menuLogo.display=c.value,l.menuLogo.submit.rawFile=c.value.rawFile;break}case"RESET_CUSTOM_MENU_LOGO":{l.menuLogo.display=null,l.menuLogo.submit={rawFile:null,isReset:!0};break}default:return l}});var At=a(86349),Zn=a.n(At);const Gn=(p,c)=>Zn()(p,{menuLogo:{display:c.menuLogo}}),Ot=(0,e.forwardRef)(({projectSettingsStored:p},c)=>{const{formatMessage:l}=(0,V.useIntl)(),{trackUsage:h}=(0,C.useTracking)(),{logos:{menu:u}}=(0,Ee.um)(),[{menuLogo:T},M]=(0,e.useReducer)(Vn,bt,()=>Gn(bt,p)),O=x=>{M({type:"SET_CUSTOM_MENU_LOGO",value:x})},v=()=>{h("didClickResetLogo"),M({type:"RESET_CUSTOM_MENU_LOGO"})};return(0,e.useImperativeHandle)(c,()=>({getValues:()=>({menuLogo:T.submit})})),e.createElement(F.Box,{hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingRight:7,paddingLeft:7},e.createElement(Z.Typography,{variant:"delta",as:"h3"},l({id:"Settings.application.customization",defaultMessage:"Customization"})),e.createElement(P.Grid,{paddingTop:4},e.createElement(P.GridItem,{col:6,s:12},e.createElement(Wt,{onChangeLogo:O,customLogo:T.display,defaultLogo:u.default,onResetMenuLogo:v}))))});Ot.defaultProps={projectSettingsStored:null},Ot.propTypes={projectSettingsStored:y().shape({menuLogo:y().shape({url:y().string,name:y().string})})};const rn=Ot;var $t=a(17247),zn=a(48344),gt=a.n(zn),Kn=Object.defineProperty,ft=Object.defineProperties,Ut=Object.getOwnPropertyDescriptors,Rt=Object.getOwnPropertySymbols,kt=Object.prototype.hasOwnProperty,ln=Object.prototype.propertyIsEnumerable,Dt=(p,c,l)=>c in p?Kn(p,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):p[c]=l,Vt=(p,c)=>{for(var l in c||(c={}))kt.call(c,l)&&Dt(p,l,c[l]);if(Rt)for(var l of Rt(c))ln.call(c,l)&&Dt(p,l,c[l]);return p},Zt=(p,c)=>ft(p,Ut(c));const xt=p=>gt()(p,(c,l,h)=>{l&&l.url?c[h]=Zt(Vt({},l),{url:(0,C.prefixFileUrlWithBackendUrl)(l.url)}):c[h]=l},{});var Gt=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const Xn=()=>Gt(void 0,null,function*(){const{data:p}=yield $t.be.get("/admin/project-settings");return xt(p)}),cn=p=>Gt(void 0,null,function*(){const{data:c}=yield $t.be.post("/admin/project-settings",p);return xt(c)}),un=p=>{const c=new FormData;return Object.entries(p).forEach(([l,h])=>{h&&h.rawFile instanceof File&&c.append(l,h.rawFile),h&&h.isReset&&c.append(l,null)}),c};var zt=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const pn=[{action:"admin::project-settings.update",subject:null}],Qn=()=>{const p=(0,e.useRef)(),c=(0,C.useNotification)(),{trackUsage:l}=(0,C.useTracking)(),{formatMessage:h}=(0,V.useIntl)(),u=(0,Ne.useQueryClient)();(0,C.useFocusWhenNavigate)();const T=(0,C.useAppInfos)(),{shouldUpdateStrapi:M,latestStrapiReleaseTag:O,strapiVersion:v}=T,{updateProjectSettings:x}=(0,Ee.um)(),{data:Te}=(0,Ne.useQuery)("project-settings",Xn),me=T.communityEdition?"app.components.UpgradePlanModal.text-ce":"app.components.UpgradePlanModal.text-ee",tt=(0,Ne.useMutation)(rt=>cn(rt),{onSuccess(rt){return zt(this,arguments,function*({menuLogo:ot}){yield u.invalidateQueries("project-settings",{refetchActive:!0}),x({menuLogo:ot==null?void 0:ot.url})})}}),yt=()=>{const rt=p.current.getValues(),ot=un(rt);tt.mutate(ot,{onSuccess(){const{menuLogo:at}=rt;at.rawFile&&l("didChangeLogo")},onError(){c({type:"warning",message:{id:"notification.error",defaultMessage:"An error occurred"}})}})};return e.createElement(ne.Layout,null,e.createElement(C.SettingsPageTitle,{name:"Application"}),e.createElement(Y.Main,null,e.createElement(ne.HeaderLayout,{title:h({id:"Settings.application.title",defaultMessage:"Overview"}),subtitle:h({id:"Settings.application.description",defaultMessage:"Administration panel\u2019s global information"}),primaryAction:e.createElement(U.Button,{onClick:yt,startIcon:e.createElement(be(),null)},h({id:"global.save",defaultMessage:"Save"}))}),e.createElement(ne.ContentLayout,null,e.createElement(de.Stack,{spacing:6},e.createElement(F.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"},h({id:"global.details",defaultMessage:"Details"})),e.createElement(P.Grid,{paddingTop:1},e.createElement(P.GridItem,{col:6,s:12},e.createElement(Z.Typography,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.strapiVersion",defaultMessage:"strapi version"})),e.createElement(Z.Typography,{as:"p"},"v",v),e.createElement(te.Link,{href:T.communityEdition?"https://discord.strapi.io":"https://support.strapi.io/support/home",isExternal:!0,endIcon:e.createElement($e(),null)},h({id:"Settings.application.get-help",defaultMessage:"Get help"}))),e.createElement(P.GridItem,{col:6,s:12},e.createElement(Z.Typography,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.edition-title",defaultMessage:"current plan"})),e.createElement(Z.Typography,{as:"p"},h({id:me,defaultMessage:`${T.communityEdition?"Community Edition":"Enterprise Edition"}`})))),e.createElement(P.Grid,{paddingTop:1},e.createElement(P.GridItem,{col:6,s:12},M&&e.createElement(te.Link,{href:`https://github.com/strapi/strapi/releases/tag/${O}`,isExternal:!0,endIcon:e.createElement($e(),null)},h({id:"Settings.application.link-upgrade",defaultMessage:"Upgrade your admin panel"}))),e.createElement(P.GridItem,{col:6,s:12},e.createElement(te.Link,{href:"https://strapi.io/pricing-self-hosted",isExternal:!0,endIcon:e.createElement($e(),null)},h({id:"Settings.application.link-pricing",defaultMessage:"See all pricing plans"})))),e.createElement(F.Box,{paddingTop:1},e.createElement(Z.Typography,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.node-version",defaultMessage:"node version"})),e.createElement(Z.Typography,{as:"p"},T.nodeVersion)))),Te&&e.createElement(C.CheckPermissions,{permissions:pn},e.createElement(rn,{ref:p,projectSettingsStored:Te}))))))};var Kt=a(3704),mn=a.n(Kt);const gn=p=>mn()(p,l=>l.links).map(l=>(0,fe.ot)(l.Component,l.to,l.exact||!1)),hn=p=>p.filter(c=>!c.links.every(l=>l.isDisplayed===!1));var Ht=a(21930),et=a(18950),yn=a(72975),ye=a.n(yn),vn=function(){return window&&window.strapi&&window.strapi.isEE?a(20178).Z:a(16329).Z}(),Cn=function(){return window&&window.strapi&&window.strapi.isEE?a(51899).Z:a(45677).Z}(),En=[{Component:function(){return{default:Cn}},to:"/settings/roles",exact:!0},{Component:function(){return{default:vn}},to:"/settings/roles/duplicate/:id",exact:!0},{Component:function(){return{default:vn}},to:"/settings/roles/new",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(2544).then(a.bind(a,33778));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/roles/:id",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(5199).then(a.bind(a,31904));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/users",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(4263).then(a.bind(a,40874));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/users/:id",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;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,33238));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks/create",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;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,59021));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks/:id",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(4121).then(a.bind(a,70791));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(8056).then(a.bind(a,83782));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,Promise.all([a.e(7379),a.e(4318),a.e(4299)]).then(a.bind(a,3330));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens/create",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,Promise.all([a.e(7379),a.e(4318),a.e(92)]).then(a.bind(a,97841));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens/:id",exact:!0}];const bn=En;var Xt=function(){return window&&window.strapi&&window.strapi.isEE?a(63775).Z:a(75936).Z}();const Sn=[].concat((0,Ht.Z)(Xt),(0,Ht.Z)(bn));var ht=a(89420),Yt=Object.defineProperty,Pn=Object.defineProperties,Tn=Object.getOwnPropertyDescriptors,Qt=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,An=Object.prototype.propertyIsEnumerable,Lt=(p,c,l)=>c in p?Yt(p,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):p[c]=l,It=(p,c)=>{for(var l in c||(c={}))Mt.call(c,l)&&Lt(p,l,c[l]);if(Qt)for(var l of Qt(c))An.call(c,l)&&Lt(p,l,c[l]);return p},Jt=(p,c)=>Pn(p,Tn(c));const qt=({menu:p})=>{const{formatMessage:c}=(0,V.useIntl)(),h=hn(p).map(T=>Jt(It({},T),{title:T.intlLabel,links:T.links.map(M=>Jt(It({},M),{title:M.intlLabel,name:M.id}))})),u=c({id:"global.settings",defaultMessage:"Settings"});return e.createElement(ht.SubNav,{ariaLabel:u},e.createElement(ht.SubNavHeader,{label:u}),e.createElement(ht.SubNavSections,null,h.map(T=>e.createElement(ht.SubNavSection,{key:T.id,label:c(T.intlLabel)},T.links.map(M=>e.createElement(ht.SubNavLink,{as:r.NavLink,withBullet:M.hasNotification,to:M.to,key:M.id},c(M.intlLabel)))))))};qt.propTypes={menu:y().array.isRequired};const On=qt;function _t(){const{settingId:p}=(0,r.useParams)(),{settings:c}=(0,C.useStrapiApp)(),{formatMessage:l}=(0,V.useIntl)(),{isLoading:h,menu:u}=(0,Ee.Te)(),T=(0,e.useMemo)(()=>(0,fe.WW)(Sn.map(({to:v,Component:x,exact:Te})=>(0,fe.ot)(x,v,Te))),[]),M=gn(c);if(h)return e.createElement(C.LoadingIndicatorPage,null);if(!p)return e.createElement(r.Redirect,{to:"/settings/application-infos"});const O=l({id:"global.settings",defaultMessage:"Settings"});return e.createElement(ne.Layout,{sideNav:e.createElement(On,{menu:u})},e.createElement(Le.Helmet,{title:O}),e.createElement(r.Switch,null,e.createElement(r.Route,{path:"/settings/application-infos",component:Qn,exact:!0}),T,M))}const Rn=(0,e.memo)(_t)},16329:(ge,D,a)=>{a.d(D,{Z:()=>ne});var e=a(32735),C=a(5141);const ne=()=>e.createElement(C.Redirect,{to:"/404"})},49466:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},35123:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},18318:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},52124:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},61526:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},25793:(ge,D,a)=>{a.d(D,{Z:()=>Ja});var e=a(32735),C=a(60216),r=a.n(C),ne=a(88425),V=a(81700),Le=a(23973),Ee=a.n(Le),fe=a(86834),Ne=a.n(fe),Y=a(5636),F=a(9808),P=a(19615),Z=a(98978),de=a.n(Z),U=a(92577),te=a(67793),Ge=a.n(te),$e=a(31476),ze=a.n($e),be=a(35980),z=a(19192),y=a(33795),ue=a.n(y),Ke=a(9086),re=a.n(Ke),J=a(775),ae=a(42258),it=a.n(ae),Ie=a(44526);const Xe=P.default.div`
9
+ `,Xe=({setLocalImage:p,goTo:c,next:l,onClose:h})=>{const{formatMessage:u}=(0,V.useIntl)(),[T,M]=(0,e.useState)(!1),[O,v]=(0,e.useState)(void 0),x=(0,e.useRef)(null),Pe=()=>M(!0),me=()=>M(!1),tt=ot=>{ot.preventDefault(),x.current.click()},yt=()=>Oe(void 0,null,function*(){me();const ot=x.current.files[0];if(!!ot)try{const at=yield f(ot);p(at),c(l)}catch(at){if(at.displayMessage)v(u(at.displayMessage,{size:_,dimension:N})),x.current.focus();else throw at}}),rt=()=>T?"primary500":O?"danger600":"neutral300";return e.createElement(e.Fragment,null,e.createElement("form",null,e.createElement(F.Box,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(Me.Field,{name:"logo-upload",error:O},e.createElement("label",{htmlFor:"logo-upload"},e.createElement(de.Stack,{spacing:2},e.createElement(G.Flex,{paddingTop:9,paddingBottom:7,hasRadius:!0,justifyContent:"center",direction:"column",background:T?"primary100":"neutral100",borderColor:rt(),borderStyle:"dashed",borderWidth:"1px",position:"relative",onDragEnter:Pe,onDragLeave:me},e.createElement(le.Icon,{color:"primary600",width:`${60/16}rem`,height:`${60/16}rem`,as:Ze(),"aria-hidden":!0}),e.createElement(F.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(_e,{accept:pe,cursor:"pointer",as:"input",type:"file",name:"files",tabIndex:-1,zIndex:1,onChange:yt,ref:x,id:"logo-upload"}),e.createElement(U.Button,{type:"button",onClick:tt},u({id:"Settings.application.customization.modal.upload.cta.browse",defaultMessage:"Browse files"})),e.createElement(F.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:N})))),e.createElement(Me.FieldError,null)))))),e.createElement(Ae.ModalFooter,{startActions:e.createElement(U.Button,{onClick:h,variant:"tertiary"},u({id:"Settings.application.customization.modal.cancel",defaultMessage:"Cancel"}))}))};Xe.defaultProps={next:null},Xe.propTypes={goTo:y().func.isRequired,next:y().string,onClose:y().func.isRequired,setLocalImage:y().func.isRequired};const q=Xe;var he=a(37178),Se=a(43653),Tt=a.n(Se),nn=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const wt=p=>nn(void 0,null,function*(){try{const c=yield Tt().get(p,{responseType:"blob",timeout:8e3});return new File([c.data],c.config.url,{type:c.headers["content-type"]})}catch(c){throw c.displayMessage={id:"Settings.application.customization.modal.upload.error-network",defaultMessage:"Network error"},c}});var jt=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const Et=({goTo:p,next:c,onClose:l,setLocalImage:h})=>{const{formatMessage:u}=(0,V.useIntl)(),[T,M]=(0,e.useState)(""),[O,v]=(0,e.useState)(null),x=me=>{M(me.target.value)},Pe=()=>jt(void 0,null,function*(){try{const me=yield wt(T),tt=yield f(me);h(tt),p(c)}catch(me){if(me.displayMessage)v(u(me.displayMessage,{size:_,dimension:N}));else throw me}});return e.createElement("form",{onSubmit:me=>{me.preventDefault(),Pe()}},e.createElement(F.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:O,onChange:x,value:T,name:"logo-url"})),e.createElement(Ae.ModalFooter,{startActions:e.createElement(U.Button,{onClick:l,variant:"tertiary"},u({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(U.Button,{type:"submit"},u({id:"Settings.application.customization.modal.upload.next",defaultMessage:"Next"}))}))};Et.defaultProps={next:null},Et.propTypes={goTo:y().func.isRequired,next:y().string,onClose:y().func.isRequired,setLocalImage:y().func.isRequired};const $n=Et,ut=({setLocalImage:p,goTo:c,next:l,onClose:h})=>{const{formatMessage:u}=(0,V.useIntl)();return e.createElement(W.TabGroup,{label:u({id:"Settings.application.customization.modal.tab.label",defaultMessage:"How do you want to upload your assets?"}),variant:"simple"},e.createElement(F.Box,{paddingLeft:8,paddingRight:8},e.createElement(W.Tabs,null,e.createElement(W.Tab,null,u({id:"Settings.application.customization.modal.upload.from-computer",defaultMessage:"From computer"})),e.createElement(W.Tab,null,u({id:"Settings.application.customization.modal.upload.from-url",defaultMessage:"From url"}))),e.createElement(Q.Divider,null)),e.createElement(W.TabPanels,null,e.createElement(W.TabPanel,null,e.createElement(q,{onClose:h,setLocalImage:p,goTo:c,next:l})),e.createElement(W.TabPanel,null,e.createElement($n,{onClose:h,setLocalImage:p,goTo:c,next:l}))))};ut.defaultProps={next:null},ut.propTypes={goTo:y().func.isRequired,next:y().string,onClose:y().func.isRequired,setLocalImage:y().func.isRequired};const Un=ut;var nt=a(31998);const Nt=({asset:p})=>{const{formatMessage:c}=(0,V.useIntl)();return e.createElement(nt.Card,null,e.createElement(nt.CardHeader,null,e.createElement(nt.CardAsset,{size:"S",src:p.url})),e.createElement(nt.CardBody,null,e.createElement(nt.CardContent,null,e.createElement(nt.CardTitle,null,p.name),e.createElement(nt.CardSubtitle,null,`${p.ext.toUpperCase()} - ${p.width}\u2715${p.height}`)),e.createElement(nt.CardBadge,null,c({id:"Settings.application.customization.modal.pending.card-badge",defaultMessage:"image"}))))};Nt.propTypes={asset:y().shape({name:y().string,url:y().string,width:y().number,height:y().number,ext:y().string}).isRequired};const Wt=Nt,At=({onClose:p,asset:c,prev:l,next:h,goTo:u,setLocalImage:T,onChangeLogo:M})=>{const{formatMessage:O}=(0,V.useIntl)(),v=()=>{T(void 0),u(l)},x=()=>{M(c),u(h)};return e.createElement(e.Fragment,null,e.createElement(F.Box,{paddingLeft:8,paddingRight:8,paddingTop:6,paddingBottom:6},e.createElement(G.Flex,{justifyContent:"space-between",paddingBottom:6},e.createElement(G.Flex,{direction:"column",alignItems:"flex-start"},e.createElement(Z.Typography,{variant:"pi",fontWeight:"bold"},O({id:"Settings.application.customization.modal.pending.title",defaultMessage:"Logo ready to upload"})),e.createElement(Z.Typography,{variant:"pi",textColor:"neutral500"},O({id:"Settings.application.customization.modal.pending.subtitle",defaultMessage:"Manage the chosen logo before uploading it"}))),e.createElement(U.Button,{onClick:v,variant:"secondary"},O({id:"Settings.application.customization.modal.pending.choose-another",defaultMessage:"Choose another logo"}))),e.createElement(F.Box,{maxWidth:(0,C.pxToRem)(180)},e.createElement(Wt,{asset:c}))),e.createElement(Ae.ModalFooter,{startActions:e.createElement(U.Button,{onClick:p,variant:"tertiary"},O({id:"Settings.application.customization.modal.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(U.Button,{onClick:x},O({id:"Settings.application.customization.modal.pending.upload",defaultMessage:"Upload logo"}))}))};At.defaultProps={next:null,prev:null},At.propTypes={goTo:y().func.isRequired,asset:y().shape({name:y().string,url:y().string,width:y().number,height:y().number,ext:y().string}).isRequired,next:y().string,onClose:y().func.isRequired,onChangeLogo:y().func.isRequired,prev:y().string,setLocalImage:y().func.isRequired};const sn={upload:{Component:Un,modalTitle:{id:"Settings.application.customization.modal.upload",defaultMessage:"Upload logo"},next:"pending",prev:null},pending:{Component:At,modalTitle:{id:"Settings.application.customization.modal.pending",defaultMessage:"Pending logo"},next:null,prev:"upload"}},pt=({customLogo:p,defaultLogo:c,onChangeLogo:l,onResetMenuLogo:h})=>{const[{currentStep:u},T]=(0,e.useReducer)(We,Ye),{Component:M,next:O,prev:v,modalTitle:x}=sn[u]||{},{formatMessage:Pe}=(0,V.useIntl)(),me=tt=>{T({type:"GO_TO",to:tt})};return e.createElement(e.Fragment,null,e.createElement(ue.CarouselInput,{label:Pe({id:"Settings.application.customization.carousel.title",defaultMessage:"Logo"}),selectedSlide:0,hint:Pe({id:"Settings.application.customization.carousel-hint",defaultMessage:"Change the admin panel logo (Max dimension: {dimension}x{dimension}, Max file size: {size}KB)"},{size:_,dimension:N}),previousLabel:"",nextLabel:"",onNext:()=>{},onPrevious:()=>{},secondaryLabel:(p==null?void 0:p.name)||"logo.png",actions:e.createElement(ue.CarouselActions,null,e.createElement(He.IconButton,{onClick:()=>me(p?"pending":"upload"),label:Pe({id:"Settings.application.customization.carousel.change-action",defaultMessage:"Change logo"}),icon:e.createElement(J(),null)}),p&&e.createElement(He.IconButton,{onClick:h,label:Pe({id:"Settings.application.customization.carousel.reset-action",defaultMessage:"Reset logo"}),icon:e.createElement(it(),null)}))},e.createElement(ue.CarouselSlide,{label:Pe({id:"Settings.application.customization.carousel-slide.label",defaultMessage:"Logo slide"})},e.createElement(F.Box,{maxHeight:"40%",maxWidth:"40%",as:"img",src:(p==null?void 0:p.url)||c,alt:Pe({id:"Settings.application.customization.carousel.title",defaultMessage:"Logo"})}))),e.createElement(k,{Component:M,currentStep:u,onChangeLogo:l,customLogo:p,goTo:me,next:O,prev:v,modalTitle:x}))};pt.defaultProps={customLogo:null},pt.propTypes={customLogo:y().shape({url:y().string,name:y().string}),defaultLogo:y().string.isRequired,onChangeLogo:y().func.isRequired,onResetMenuLogo:y().func.isRequired};const $t=pt,bt={menuLogo:{display:null,submit:{rawFile:null,isReset:!1}}},Vn=(p=bt,c)=>(0,Fe.default)(p,l=>{switch(c.type){case"SET_CUSTOM_MENU_LOGO":{l.menuLogo.display=c.value,l.menuLogo.submit.rawFile=c.value.rawFile;break}case"RESET_CUSTOM_MENU_LOGO":{l.menuLogo.display=null,l.menuLogo.submit={rawFile:null,isReset:!0};break}default:return l}});var Ot=a(86349),Zn=a.n(Ot);const Gn=(p,c)=>Zn()(p,{menuLogo:{display:c.menuLogo}}),Rt=(0,e.forwardRef)(({projectSettingsStored:p},c)=>{const{formatMessage:l}=(0,V.useIntl)(),{trackUsage:h}=(0,C.useTracking)(),{logos:{menu:u}}=(0,Ee.um)(),[{menuLogo:T},M]=(0,e.useReducer)(Vn,bt,()=>Gn(bt,p)),O=x=>{M({type:"SET_CUSTOM_MENU_LOGO",value:x})},v=()=>{h("didClickResetLogo"),M({type:"RESET_CUSTOM_MENU_LOGO"})};return(0,e.useImperativeHandle)(c,()=>({getValues:()=>({menuLogo:T.submit})})),e.createElement(F.Box,{hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingRight:7,paddingLeft:7},e.createElement(Z.Typography,{variant:"delta",as:"h3"},l({id:"Settings.application.customization",defaultMessage:"Customization"})),e.createElement(P.Grid,{paddingTop:4},e.createElement(P.GridItem,{col:6,s:12},e.createElement($t,{onChangeLogo:O,customLogo:T.display,defaultLogo:u.default,onResetMenuLogo:v}))))});Rt.defaultProps={projectSettingsStored:null},Rt.propTypes={projectSettingsStored:y().shape({menuLogo:y().shape({url:y().string,name:y().string})})};const rn=Rt;var Ut=a(17247),zn=a(48344),gt=a.n(zn),Kn=Object.defineProperty,ft=Object.defineProperties,kt=Object.getOwnPropertyDescriptors,Dt=Object.getOwnPropertySymbols,Vt=Object.prototype.hasOwnProperty,ln=Object.prototype.propertyIsEnumerable,xt=(p,c,l)=>c in p?Kn(p,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):p[c]=l,Zt=(p,c)=>{for(var l in c||(c={}))Vt.call(c,l)&&xt(p,l,c[l]);if(Dt)for(var l of Dt(c))ln.call(c,l)&&xt(p,l,c[l]);return p},Gt=(p,c)=>ft(p,kt(c));const Mt=p=>gt()(p,(c,l,h)=>{l&&l.url?c[h]=Gt(Zt({},l),{url:(0,C.prefixFileUrlWithBackendUrl)(l.url)}):c[h]=l},{});var zt=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const Xn=()=>zt(void 0,null,function*(){const{data:p}=yield Ut.be.get("/admin/project-settings");return Mt(p)}),cn=p=>zt(void 0,null,function*(){const{data:c}=yield Ut.be.post("/admin/project-settings",p);return Mt(c)}),un=p=>{const c=new FormData;return Object.entries(p).forEach(([l,h])=>{h&&h.rawFile instanceof File&&c.append(l,h.rawFile),h&&h.isReset&&c.append(l,null)}),c};var Kt=(p,c,l)=>new Promise((h,u)=>{var T=v=>{try{O(l.next(v))}catch(x){u(x)}},M=v=>{try{O(l.throw(v))}catch(x){u(x)}},O=v=>v.done?h(v.value):Promise.resolve(v.value).then(T,M);O((l=l.apply(p,c)).next())});const pn=[{action:"admin::project-settings.update",subject:null}],Qn=()=>{const p=(0,e.useRef)(),c=(0,C.useNotification)(),{trackUsage:l}=(0,C.useTracking)(),{formatMessage:h}=(0,V.useIntl)(),u=(0,Ne.useQueryClient)();(0,C.useFocusWhenNavigate)();const T=(0,C.useAppInfos)(),{shouldUpdateStrapi:M,latestStrapiReleaseTag:O,strapiVersion:v}=T,{updateProjectSettings:x}=(0,Ee.um)(),{data:Pe}=(0,Ne.useQuery)("project-settings",Xn),me=T.communityEdition?"app.components.UpgradePlanModal.text-ce":"app.components.UpgradePlanModal.text-ee",tt=(0,Ne.useMutation)(rt=>cn(rt),{onSuccess(rt){return Kt(this,arguments,function*({menuLogo:ot}){yield u.invalidateQueries("project-settings",{refetchActive:!0}),x({menuLogo:ot==null?void 0:ot.url})})}}),yt=()=>{const rt=p.current.getValues(),ot=un(rt);tt.mutate(ot,{onSuccess(){const{menuLogo:at}=rt;at.rawFile&&l("didChangeLogo")},onError(){c({type:"warning",message:{id:"notification.error",defaultMessage:"An error occurred"}})}})};return e.createElement(ne.Layout,null,e.createElement(C.SettingsPageTitle,{name:"Application"}),e.createElement(Y.Main,null,e.createElement(ne.HeaderLayout,{title:h({id:"Settings.application.title",defaultMessage:"Overview"}),subtitle:h({id:"Settings.application.description",defaultMessage:"Administration panel\u2019s global information"}),primaryAction:e.createElement(U.Button,{onClick:yt,startIcon:e.createElement(be(),null)},h({id:"global.save",defaultMessage:"Save"}))}),e.createElement(ne.ContentLayout,null,e.createElement(de.Stack,{spacing:6},e.createElement(F.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"},h({id:"global.details",defaultMessage:"Details"})),e.createElement(P.Grid,{paddingTop:1},e.createElement(P.GridItem,{col:6,s:12},e.createElement(Z.Typography,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.strapiVersion",defaultMessage:"strapi version"})),e.createElement(Z.Typography,{as:"p"},"v",v),e.createElement(te.Link,{href:T.communityEdition?"https://discord.strapi.io":"https://support.strapi.io/support/home",isExternal:!0,endIcon:e.createElement(Ue(),null)},h({id:"Settings.application.get-help",defaultMessage:"Get help"}))),e.createElement(P.GridItem,{col:6,s:12},e.createElement(Z.Typography,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.edition-title",defaultMessage:"current plan"})),e.createElement(Z.Typography,{as:"p"},h({id:me,defaultMessage:`${T.communityEdition?"Community Edition":"Enterprise Edition"}`})))),e.createElement(P.Grid,{paddingTop:1},e.createElement(P.GridItem,{col:6,s:12},M&&e.createElement(te.Link,{href:`https://github.com/strapi/strapi/releases/tag/${O}`,isExternal:!0,endIcon:e.createElement(Ue(),null)},h({id:"Settings.application.link-upgrade",defaultMessage:"Upgrade your admin panel"}))),e.createElement(P.GridItem,{col:6,s:12},e.createElement(te.Link,{href:"https://strapi.io/pricing-self-hosted",isExternal:!0,endIcon:e.createElement(Ue(),null)},h({id:"Settings.application.link-pricing",defaultMessage:"See all pricing plans"})))),e.createElement(F.Box,{paddingTop:1},e.createElement(Z.Typography,{variant:"sigma",textColor:"neutral600"},h({id:"Settings.application.node-version",defaultMessage:"node version"})),e.createElement(Z.Typography,{as:"p"},T.nodeVersion)))),Pe&&e.createElement(C.CheckPermissions,{permissions:pn},e.createElement(rn,{ref:p,projectSettingsStored:Pe}))))))};var Ht=a(3704),mn=a.n(Ht);const gn=p=>mn()(p,l=>l.links).map(l=>(0,fe.ot)(l.Component,l.to,l.exact||!1)),hn=p=>p.filter(c=>!c.links.every(l=>l.isDisplayed===!1));var Xt=a(21930),et=a(18950),yn=a(72975),ye=a.n(yn),vn=function(){return window&&window.strapi&&window.strapi.isEE?a(20178).Z:a(16329).Z}(),Cn=function(){return window&&window.strapi&&window.strapi.isEE?a(51899).Z:a(45677).Z}(),En=[{Component:function(){return{default:Cn}},to:"/settings/roles",exact:!0},{Component:function(){return{default:vn}},to:"/settings/roles/duplicate/:id",exact:!0},{Component:function(){return{default:vn}},to:"/settings/roles/new",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(2544).then(a.bind(a,33778));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/roles/:id",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(5199).then(a.bind(a,31904));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/users",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(4263).then(a.bind(a,40874));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/users/:id",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;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,33238));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks/create",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;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,59021));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks/:id",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(4121).then(a.bind(a,70791));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/webhooks",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,a.e(8056).then(a.bind(a,83782));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,Promise.all([a.e(7379),a.e(4318),a.e(4299)]).then(a.bind(a,3330));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens/create",exact:!0},{Component:function(){return(0,et.Z)(ye().mark(function c(){var l;return ye().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,Promise.all([a.e(7379),a.e(4318),a.e(92)]).then(a.bind(a,97841));case 2:return l=u.sent,u.abrupt("return",l);case 4:case"end":return u.stop()}},c)}))()},to:"/settings/api-tokens/:id",exact:!0}];const bn=En;var Yt=function(){return window&&window.strapi&&window.strapi.isEE?a(63775).Z:a(75936).Z}();const Sn=[].concat((0,Xt.Z)(Yt),(0,Xt.Z)(bn));var ht=a(89420),Qt=Object.defineProperty,Pn=Object.defineProperties,Tn=Object.getOwnPropertyDescriptors,Jt=Object.getOwnPropertySymbols,Lt=Object.prototype.hasOwnProperty,An=Object.prototype.propertyIsEnumerable,It=(p,c,l)=>c in p?Qt(p,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):p[c]=l,Ft=(p,c)=>{for(var l in c||(c={}))Lt.call(c,l)&&It(p,l,c[l]);if(Jt)for(var l of Jt(c))An.call(c,l)&&It(p,l,c[l]);return p},qt=(p,c)=>Pn(p,Tn(c));const _t=({menu:p})=>{const{formatMessage:c}=(0,V.useIntl)(),h=hn(p).map(T=>qt(Ft({},T),{title:T.intlLabel,links:T.links.map(M=>qt(Ft({},M),{title:M.intlLabel,name:M.id}))})),u=c({id:"global.settings",defaultMessage:"Settings"});return e.createElement(ht.SubNav,{ariaLabel:u},e.createElement(ht.SubNavHeader,{label:u}),e.createElement(ht.SubNavSections,null,h.map(T=>e.createElement(ht.SubNavSection,{key:T.id,label:c(T.intlLabel)},T.links.map(M=>e.createElement(ht.SubNavLink,{as:r.NavLink,withBullet:M.hasNotification,to:M.to,key:M.id},c(M.intlLabel)))))))};_t.propTypes={menu:y().array.isRequired};const On=_t;function en(){const{settingId:p}=(0,r.useParams)(),{settings:c}=(0,C.useStrapiApp)(),{formatMessage:l}=(0,V.useIntl)(),{isLoading:h,menu:u}=(0,Ee.Te)(),T=(0,e.useMemo)(()=>(0,fe.WW)(Sn.map(({to:v,Component:x,exact:Pe})=>(0,fe.ot)(x,v,Pe))),[]),M=gn(c);if(h)return e.createElement(C.LoadingIndicatorPage,null);if(!p)return e.createElement(r.Redirect,{to:"/settings/application-infos"});const O=l({id:"global.settings",defaultMessage:"Settings"});return e.createElement(ne.Layout,{sideNav:e.createElement(On,{menu:u})},e.createElement(Ie.Helmet,{title:O}),e.createElement(r.Switch,null,e.createElement(r.Route,{path:"/settings/application-infos",component:Qn,exact:!0}),T,M))}const Rn=(0,e.memo)(en)},16329:(ge,D,a)=>{a.d(D,{Z:()=>ne});var e=a(32735),C=a(5141);const ne=()=>e.createElement(C.Redirect,{to:"/404"})},49466:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},35123:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},18318:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},52124:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},61526:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},25793:(ge,D,a)=>{a.d(D,{Z:()=>Ja});var e=a(32735),C=a(60216),r=a.n(C),ne=a(88425),V=a(81700),Ie=a(23973),Ee=a.n(Ie),fe=a(86834),Ne=a.n(fe),Y=a(5636),F=a(9808),P=a(19615),Z=a(98978),de=a.n(Z),U=a(92577),te=a(67793),ze=a.n(te),Ue=a(31476),Ke=a.n(Ue),be=a(35980),z=a(19192),y=a(33795),ue=a.n(y),He=a(9086),re=a.n(He),J=a(775),ae=a(42258),it=a.n(ae),Fe=a(44526);const Ye=P.default.div`
10
10
  position: relative;
11
11
 
12
12
  ${({hasConditions:o,disabled:t,theme:n})=>o&&`
@@ -21,14 +21,14 @@
21
21
  background: ${t?n.colors.neutral100:n.colors.primary600};
22
22
  }
23
23
  `}
24
- `,Ye=({onClick:o,className:t,hasConditions:n,variant:s})=>{const{formatMessage:i}=(0,Y.useIntl)();return e.createElement(Xe,{hasConditions:n,className:t},e.createElement(Ie.Button,{variant:s,startIcon:e.createElement(it(),null),onClick:o},i({id:"global.settings",defaultMessage:"Settings"})))};Ye.defaultProps={className:null,hasConditions:!1,variant:"tertiary"},Ye.propTypes={onClick:r().func.isRequired,className:r().string,hasConditions:r().bool,variant:r().string};const Se=(0,P.default)(Ye)``;var Ue=a(27635),Qe=a(90662),ie=a(4122),Je=a(71657),R=a(95602),k=a(49415),N=a(81346),_=a.n(N),pe=a(23940),W=a.n(pe),Q=a(47169),oe=a(21930),G=a(25716);const le=`${120/16}rem`,xe=`${200/16}rem`,ke=`${53/16}rem`;function Ve(o,t){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable})),n.push.apply(n,s)}return n}function st(o){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ve(Object(n),!0).forEach(function(s){(0,Q.Z)(o,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(n)):Ve(Object(n)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(n,s))})}return o}var qe=function(){return window&&window.strapi&&window.strapi.isEE?a(56899).Z:a(49466).Z}(),B=(0,P.default)(z.Flex).withConfig({displayName:"ActionRow__FlexWrapper",componentId:"sc-1bqpgdl-0"})(["height:",";"],ke),K=function(t){var n=t.arrayOfOptionsGroupedByCategory,s=t.isFormDisabled,i=t.isGrey,d=t.label,m=t.name,g=t.onChange,E=t.value,b=(0,Y.useIntl)(),S=b.formatMessage,L=n.reduce(function(w,j){var A=(0,U.Z)(j,2),I=A[0],X=A[1],se={label:W()(I),children:X.map(function(Oe){return{label:Oe.displayName,value:Oe.id}})};return[].concat((0,oe.Z)(w),[se])},[]),$=Object.values(E).map(function(w){return Object.entries(w).filter(function(j){var A=(0,U.Z)(j,2),I=A[1];return I}).map(function(j){var A=(0,U.Z)(j,1),I=A[0];return I})}).flat(),ee=function(j){var A=(0,U.Z)(n,1),I=(0,U.Z)(A[0],2),X=I[1],se=X.reduce(function(Oe,ve){return st((0,Q.Z)({},ve.id,j.includes(ve.id)),Oe)},{});g(m,se)};return e.createElement(B,{as:"li",background:i?"neutral100":"neutral0"},e.createElement(z.Flex,{paddingLeft:6,style:{width:180}},e.createElement(R.Typography,{variant:"sigma",textColor:"neutral600"},S({id:"Settings.permissions.conditions.can",defaultMessage:"Can"}),"\xA0"),e.createElement(R.Typography,{variant:"sigma",title:d,textColor:"primary600",ellipsis:!0},S({id:"Settings.roles.form.permissions.".concat(d.toLowerCase()),defaultMessage:d})),e.createElement(R.Typography,{variant:"sigma",textColor:"neutral600"},"\xA0",S({id:"Settings.permissions.conditions.when",defaultMessage:"When"}))),e.createElement(F.Box,{style:{maxWidth:430,width:"100%"}},e.createElement(G.MultiSelectNested,{id:m,customizeContent:function(j){return"".concat(j.length," currently selected")},onChange:ee,value:$,options:L,disabled:s||qe})))};K.propTypes={arrayOfOptionsGroupedByCategory:r().array.isRequired,isFormDisabled:r().bool.isRequired,isGrey:r().bool.isRequired,label:r().string.isRequired,name:r().string.isRequired,value:r().object.isRequired,onChange:r().func.isRequired};const H=K;var f=a(92891);const Fe=(o,t)=>o.reduce((n,s)=>(n[s.id]=(0,f.get)(t,s.id,!1),n),{}),_e=(o,t)=>o.reduce((n,s)=>{const[i,d]=s,m=Fe(d,t);return n[i]=m,n},{}),q=(o,t,n)=>o.reduce((s,i)=>{const d=(0,f.get)(t,[...i.pathToConditionsObject,"conditions"],{}),m=_e(n,d);return s[i.pathToConditionsObject.join("..")]=m,s},{});var he=Object.defineProperty,Pe=Object.getOwnPropertySymbols,tn=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable,on=(o,t,n)=>t in o?he(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Bt=(o,t)=>{for(var n in t||(t={}))tn.call(t,n)&&on(o,n,t[n]);if(Pe)for(var n of Pe(t))nn.call(t,n)&&on(o,n,t[n]);return o};const wt=({actions:o,headerBreadCrumbs:t,isFormDisabled:n,onClosed:s,onToggle:i})=>{const{formatMessage:d}=(0,Y.useIntl)(),{availableConditions:m,modifiedData:g,onChangeConditions:E}=(0,J.$_)(),b=(0,e.useMemo)(()=>Object.entries(_()(m,"category")),[m]),S=o.filter(({isDisplayed:A,hasSomeActionsSelected:I,hasAllActionsSelected:X})=>A&&(I||X)),L=(0,e.useMemo)(()=>q(S,g,b),[S,g,b]),[$,ee]=(0,e.useState)(L),w=(A,I)=>{ee((0,k.default)(X=>{X[A]||(X[A]={}),X[A].default||(X[A].default={}),X[A].default=I}))},j=()=>{const A=Object.entries($).reduce((I,X)=>{const[se,Oe]=X,ve=Object.values(Oe).reduce((Re,Be)=>Bt(Bt({},Re),Be),{});return I[se]=ve,I},{});E(A),i()};return e.createElement(ie.ModalLayout,{labelledBy:"condition-modal-breadcrumbs",onClose:s},e.createElement(ie.ModalHeader,null,e.createElement(Je.Breadcrumbs,{id:"condition-modal-breadcrumbs",label:t.join(", ")},t.map(A=>e.createElement(Je.Crumb,{key:A},W()(d({id:A,defaultMessage:A})))))),e.createElement(F.Box,{padding:8},e.createElement(Qe.Stack,{spacing:6},e.createElement(R.Typography,{variant:"beta",as:"h2"},d({id:"Settings.permissions.conditions.define-conditions",defaultMessage:"Define conditions"})),e.createElement(F.Box,null,e.createElement(Ue.Divider,null)),e.createElement(F.Box,null,S.length===0&&e.createElement(R.Typography,null,d({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,S.map(({actionId:A,label:I,pathToConditionsObject:X},se)=>{const Oe=X.join("..");return e.createElement(H,{key:A,arrayOfOptionsGroupedByCategory:b,label:I,isFormDisabled:n,isGrey:se%2===0,name:Oe,onChange:w,value:ue()($,Oe,{})})}))))),e.createElement(ie.ModalFooter,{startActions:e.createElement(Ie.Button,{variant:"tertiary",onClick:i},d({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(Ie.Button,{onClick:j},d({id:"Settings.permissions.conditions.apply",defaultMessage:"Apply"}))}))};wt.propTypes={actions:r().arrayOf(r().shape({actionId:r().string.isRequired,checkboxName:r().string,hasSomeActionsSelected:r().bool.isRequired,hasAllActionsSelected:r().bool,isDisplayed:r().bool.isRequired,label:r().string})).isRequired,headerBreadCrumbs:r().arrayOf(r().string).isRequired,isFormDisabled:r().bool.isRequired,onClosed:r().func.isRequired,onToggle:r().func.isRequired};const Et=wt,ut=P.default.div`
24
+ `,Qe=({onClick:o,className:t,hasConditions:n,variant:s})=>{const{formatMessage:i}=(0,Y.useIntl)();return e.createElement(Ye,{hasConditions:n,className:t},e.createElement(Fe.Button,{variant:s,startIcon:e.createElement(it(),null),onClick:o},i({id:"global.settings",defaultMessage:"Settings"})))};Qe.defaultProps={className:null,hasConditions:!1,variant:"tertiary"},Qe.propTypes={onClick:r().func.isRequired,className:r().string,hasConditions:r().bool,variant:r().string};const We=(0,P.default)(Qe)``;var Ae=a(27635),ke=a(90662),ie=a(4122),Je=a(71657),R=a(95602),k=a(49415),N=a(81346),_=a.n(N),pe=a(23940),W=a.n(pe),Q=a(47169),oe=a(21930),G=a(25716);const le=`${120/16}rem`,Me=`${200/16}rem`,Ve=`${53/16}rem`;function Ze(o,t){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(o);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable})),n.push.apply(n,s)}return n}function st(o){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ze(Object(n),!0).forEach(function(s){(0,Q.Z)(o,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach(function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(n,s))})}return o}var qe=function(){return window&&window.strapi&&window.strapi.isEE?a(56899).Z:a(49466).Z}(),B=(0,P.default)(z.Flex).withConfig({displayName:"ActionRow__FlexWrapper",componentId:"sc-1bqpgdl-0"})(["height:",";"],Ve),K=function(t){var n=t.arrayOfOptionsGroupedByCategory,s=t.isFormDisabled,i=t.isGrey,d=t.label,m=t.name,g=t.onChange,E=t.value,b=(0,Y.useIntl)(),S=b.formatMessage,L=n.reduce(function(w,j){var A=(0,U.Z)(j,2),I=A[0],X=A[1],se={label:W()(I),children:X.map(function(Re){return{label:Re.displayName,value:Re.id}})};return[].concat((0,oe.Z)(w),[se])},[]),$=Object.values(E).map(function(w){return Object.entries(w).filter(function(j){var A=(0,U.Z)(j,2),I=A[1];return I}).map(function(j){var A=(0,U.Z)(j,1),I=A[0];return I})}).flat(),ee=function(j){var A=(0,U.Z)(n,1),I=(0,U.Z)(A[0],2),X=I[1],se=X.reduce(function(Re,ve){return st((0,Q.Z)({},ve.id,j.includes(ve.id)),Re)},{});g(m,se)};return e.createElement(B,{as:"li",background:i?"neutral100":"neutral0"},e.createElement(z.Flex,{paddingLeft:6,style:{width:180}},e.createElement(R.Typography,{variant:"sigma",textColor:"neutral600"},S({id:"Settings.permissions.conditions.can",defaultMessage:"Can"}),"\xA0"),e.createElement(R.Typography,{variant:"sigma",title:d,textColor:"primary600",ellipsis:!0},S({id:"Settings.roles.form.permissions.".concat(d.toLowerCase()),defaultMessage:d})),e.createElement(R.Typography,{variant:"sigma",textColor:"neutral600"},"\xA0",S({id:"Settings.permissions.conditions.when",defaultMessage:"When"}))),e.createElement(F.Box,{style:{maxWidth:430,width:"100%"}},e.createElement(G.MultiSelectNested,{id:m,customizeContent:function(j){return"".concat(j.length," currently selected")},onChange:ee,value:$,options:L,disabled:s||qe})))};K.propTypes={arrayOfOptionsGroupedByCategory:r().array.isRequired,isFormDisabled:r().bool.isRequired,isGrey:r().bool.isRequired,label:r().string.isRequired,name:r().string.isRequired,value:r().object.isRequired,onChange:r().func.isRequired};const H=K;var f=a(92891);const Oe=(o,t)=>o.reduce((n,s)=>(n[s.id]=(0,f.get)(t,s.id,!1),n),{}),_e=(o,t)=>o.reduce((n,s)=>{const[i,d]=s,m=Oe(d,t);return n[i]=m,n},{}),q=(o,t,n)=>o.reduce((s,i)=>{const d=(0,f.get)(t,[...i.pathToConditionsObject,"conditions"],{}),m=_e(n,d);return s[i.pathToConditionsObject.join("..")]=m,s},{});var he=Object.defineProperty,Se=Object.getOwnPropertySymbols,Tt=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable,on=(o,t,n)=>t in o?he(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,wt=(o,t)=>{for(var n in t||(t={}))Tt.call(t,n)&&on(o,n,t[n]);if(Se)for(var n of Se(t))nn.call(t,n)&&on(o,n,t[n]);return o};const jt=({actions:o,headerBreadCrumbs:t,isFormDisabled:n,onClosed:s,onToggle:i})=>{const{formatMessage:d}=(0,Y.useIntl)(),{availableConditions:m,modifiedData:g,onChangeConditions:E}=(0,J.$_)(),b=(0,e.useMemo)(()=>Object.entries(_()(m,"category")),[m]),S=o.filter(({isDisplayed:A,hasSomeActionsSelected:I,hasAllActionsSelected:X})=>A&&(I||X)),L=(0,e.useMemo)(()=>q(S,g,b),[S,g,b]),[$,ee]=(0,e.useState)(L),w=(A,I)=>{ee((0,k.default)(X=>{X[A]||(X[A]={}),X[A].default||(X[A].default={}),X[A].default=I}))},j=()=>{const A=Object.entries($).reduce((I,X)=>{const[se,Re]=X,ve=Object.values(Re).reduce((De,Be)=>wt(wt({},De),Be),{});return I[se]=ve,I},{});E(A),i()};return e.createElement(ie.ModalLayout,{labelledBy:"condition-modal-breadcrumbs",onClose:s},e.createElement(ie.ModalHeader,null,e.createElement(Je.Breadcrumbs,{id:"condition-modal-breadcrumbs",label:t.join(", ")},t.map(A=>e.createElement(Je.Crumb,{key:A},W()(d({id:A,defaultMessage:A})))))),e.createElement(F.Box,{padding:8},e.createElement(ke.Stack,{spacing:6},e.createElement(R.Typography,{variant:"beta",as:"h2"},d({id:"Settings.permissions.conditions.define-conditions",defaultMessage:"Define conditions"})),e.createElement(F.Box,null,e.createElement(Ae.Divider,null)),e.createElement(F.Box,null,S.length===0&&e.createElement(R.Typography,null,d({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,S.map(({actionId:A,label:I,pathToConditionsObject:X},se)=>{const Re=X.join("..");return e.createElement(H,{key:A,arrayOfOptionsGroupedByCategory:b,label:I,isFormDisabled:n,isGrey:se%2===0,name:Re,onChange:w,value:ue()($,Re,{})})}))))),e.createElement(ie.ModalFooter,{startActions:e.createElement(Fe.Button,{variant:"tertiary",onClick:i},d({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(Fe.Button,{onClick:j},d({id:"Settings.permissions.conditions.apply",defaultMessage:"Apply"}))}))};jt.propTypes={actions:r().arrayOf(r().shape({actionId:r().string.isRequired,checkboxName:r().string,hasSomeActionsSelected:r().bool.isRequired,hasAllActionsSelected:r().bool,isDisplayed:r().bool.isRequired,label:r().string})).isRequired,headerBreadCrumbs:r().arrayOf(r().string).isRequired,isFormDisabled:r().bool.isRequired,onClosed:r().func.isRequired,onToggle:r().func.isRequired};const Et=jt,ut=P.default.div`
25
25
  width: ${le};
26
26
  `,nt=(0,P.default)(z.Flex)`
27
27
  padding-right: ${({theme:o})=>o.spaces[2]};
28
28
  overflow: hidden;
29
29
  flex: 1;
30
30
  ${({isCollapsable:o})=>o&&"cursor: pointer;"}
31
- `;var jt=Object.defineProperty,Nt=Object.getOwnPropertySymbols,Tt=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,an=(o,t,n)=>t in o?jt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,sn=(o,t)=>{for(var n in t||(t={}))Tt.call(t,n)&&an(o,n,t[n]);if(Nt)for(var n of Nt(t))kn.call(t,n)&&an(o,n,t[n]);return o};const pt=({children:o,isCollapsable:t,isActive:n,isFormDisabled:s,label:i,onChange:d,onClick:m,checkboxName:g,someChecked:E,value:b})=>{const{formatMessage:S}=(0,Y.useIntl)();return e.createElement(z.Flex,{alignItems:"center",paddingLeft:6,style:{width:xe,flexShrink:0}},e.createElement(F.Box,{paddingRight:2},e.createElement(be.BaseCheckbox,{name:g,"aria-label":S({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:i}),disabled:s,onValueChange:L=>d({target:{name:g,value:L}}),indeterminate:E,value:b})),e.createElement(nt,sn({title:i,alignItems:"center",isCollapsable:t},t&&{onClick:m,"aria-expanded":n,onKeyDown:({key:L})=>(L==="Enter"||L===" ")&&m(),tabIndex:0,role:"button"}),e.createElement(R.Typography,{fontWeight:n?"bold":"",textColor:n?"primary600":"neutral800",ellipsis:!0},W()(i)),o))};pt.defaultProps={children:null,checkboxName:"",onChange(){},value:!1,someChecked:!1,isCollapsable:!1},pt.propTypes={checkboxName:r().string,children:r().node,label:r().string.isRequired,isCollapsable:r().bool,isFormDisabled:r().bool.isRequired,onChange:r().func,onClick:r().func.isRequired,someChecked:r().bool,value:r().bool,isActive:r().bool.isRequired};const Wt=(0,e.memo)(pt),bt=o=>(0,f.isObject)(o)?(0,f.flattenDeep)(Object.values(o).map(t=>(0,f.isObject)(t)?bt(t):t)):[],mt=bt,At=o=>o?Object.keys(o).reduce((t,n)=>(n!=="conditions"&&(t[n]=o[n]),t),{}):null,ct=o=>{const t=At(o),n=mt(t);if(!n.length)return{hasAllActionsSelected:!1,hasSomeActionsSelected:!1};const s=n.every(d=>d),i=n.some(d=>d)&&!s;return{hasAllActionsSelected:s,hasSomeActionsSelected:i}},Ot=(o,t,n)=>o.map(({actionId:s,isDisplayed:i,applyToProperties:d,label:m})=>{if(!i)return{actionId:s,hasSomeActionsSelected:!1,isDisplayed:i};const g=[...n.split(".."),s],E=(0,f.isEmpty)(d)?[...g,"properties","enabled"]:g,b=E.join(".."),S=(0,f.get)(t,[...g,"conditions"],null),L=mt(S).some(j=>j);if((0,f.isEmpty)(d)){const j=(0,f.get)(t,E,!1);return{actionId:s,checkboxName:b,hasAllActionsSelected:j,hasConditions:L,hasSomeActionsSelected:j,isDisplayed:i,isParentCheckbox:!1,label:m,pathToConditionsObject:g}}const $=(0,f.get)(t,E,null),{hasAllActionsSelected:ee,hasSomeActionsSelected:w}=ct($);return{actionId:s,checkboxName:b,hasAllActionsSelected:ee,hasConditions:L,hasSomeActionsSelected:w,isDisplayed:i,isParentCheckbox:!0,label:m,pathToConditionsObject:g}});var rn=a(60672),$t=a.n(rn);const gt=(0,P.default)($t())`
31
+ `;var Nt=Object.defineProperty,Wt=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,an=(o,t,n)=>t in o?Nt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,sn=(o,t)=>{for(var n in t||(t={}))At.call(t,n)&&an(o,n,t[n]);if(Wt)for(var n of Wt(t))kn.call(t,n)&&an(o,n,t[n]);return o};const pt=({children:o,isCollapsable:t,isActive:n,isFormDisabled:s,label:i,onChange:d,onClick:m,checkboxName:g,someChecked:E,value:b})=>{const{formatMessage:S}=(0,Y.useIntl)();return e.createElement(z.Flex,{alignItems:"center",paddingLeft:6,style:{width:Me,flexShrink:0}},e.createElement(F.Box,{paddingRight:2},e.createElement(be.BaseCheckbox,{name:g,"aria-label":S({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:i}),disabled:s,onValueChange:L=>d({target:{name:g,value:L}}),indeterminate:E,value:b})),e.createElement(nt,sn({title:i,alignItems:"center",isCollapsable:t},t&&{onClick:m,"aria-expanded":n,onKeyDown:({key:L})=>(L==="Enter"||L===" ")&&m(),tabIndex:0,role:"button"}),e.createElement(R.Typography,{fontWeight:n?"bold":"",textColor:n?"primary600":"neutral800",ellipsis:!0},W()(i)),o))};pt.defaultProps={children:null,checkboxName:"",onChange(){},value:!1,someChecked:!1,isCollapsable:!1},pt.propTypes={checkboxName:r().string,children:r().node,label:r().string.isRequired,isCollapsable:r().bool,isFormDisabled:r().bool.isRequired,onChange:r().func,onClick:r().func.isRequired,someChecked:r().bool,value:r().bool,isActive:r().bool.isRequired};const $t=(0,e.memo)(pt),bt=o=>(0,f.isObject)(o)?(0,f.flattenDeep)(Object.values(o).map(t=>(0,f.isObject)(t)?bt(t):t)):[],mt=bt,Ot=o=>o?Object.keys(o).reduce((t,n)=>(n!=="conditions"&&(t[n]=o[n]),t),{}):null,ct=o=>{const t=Ot(o),n=mt(t);if(!n.length)return{hasAllActionsSelected:!1,hasSomeActionsSelected:!1};const s=n.every(d=>d),i=n.some(d=>d)&&!s;return{hasAllActionsSelected:s,hasSomeActionsSelected:i}},Rt=(o,t,n)=>o.map(({actionId:s,isDisplayed:i,applyToProperties:d,label:m})=>{if(!i)return{actionId:s,hasSomeActionsSelected:!1,isDisplayed:i};const g=[...n.split(".."),s],E=(0,f.isEmpty)(d)?[...g,"properties","enabled"]:g,b=E.join(".."),S=(0,f.get)(t,[...g,"conditions"],null),L=mt(S).some(j=>j);if((0,f.isEmpty)(d)){const j=(0,f.get)(t,E,!1);return{actionId:s,checkboxName:b,hasAllActionsSelected:j,hasConditions:L,hasSomeActionsSelected:j,isDisplayed:i,isParentCheckbox:!1,label:m,pathToConditionsObject:g}}const $=(0,f.get)(t,E,null),{hasAllActionsSelected:ee,hasSomeActionsSelected:w}=ct($);return{actionId:s,checkboxName:b,hasAllActionsSelected:ee,hasConditions:L,hasSomeActionsSelected:w,isDisplayed:i,isParentCheckbox:!0,label:m,pathToConditionsObject:g}});var rn=a(60672),Ut=a.n(rn);const gt=(0,P.default)(Ut())`
32
32
  display: none;
33
33
  width: ${10/16}rem;
34
34
  transform: rotate(${({$isActive:o})=>o?"180":"0"}deg);
@@ -44,16 +44,16 @@
44
44
  fill: ${o.colors.primary600}
45
45
  };
46
46
  }
47
- `;var Ut=function(){return window&&window.strapi&&window.strapi.isEE?a(68464).Z:a(35123).Z}(),Rt=function o(t,n){return`
48
- `.concat(kt,` {
47
+ `;var kt=function(){return window&&window.strapi&&window.strapi.isEE?a(68464).Z:a(35123).Z}(),Dt=function o(t,n){return`
48
+ `.concat(Vt,` {
49
49
  background-color: `).concat(t.colors.primary100,`;
50
50
  color: `).concat(t.colors.primary600,`;
51
51
  border-radius: `).concat(n?"2px 2px 0 0":"2px",`;
52
52
  }
53
- `).concat(Vt,` {
53
+ `).concat(Zt,` {
54
54
  display: flex;
55
55
  }
56
- `).concat(Se,` {
56
+ `).concat(We,` {
57
57
  display: block;
58
58
  }
59
59
  &:hover {
@@ -64,17 +64,17 @@
64
64
  `).concat(function(s){var i=s.theme,d=s.isActive;return o(i,d)},`
65
65
  }
66
66
 
67
- `)},kt=P.default.div.withConfig({displayName:"Collapse__Wrapper",componentId:"sc-132fji1-0"})(["flex:1;display:flex;align-items:center;height:",";background-color:",";border:1px solid transparent;"],ke,function(o){var t=o.isGrey,n=o.theme;return t?n.colors.neutral100:n.colors.neutral0}),ln=P.default.div.withConfig({displayName:"Collapse__BoxWrapper",componentId:"sc-132fji1-1"})(["display:inline-flex;min-width:100%;","{display:none;}"," &:hover{","}"],Se,function(o){var t=o.isActive,n=o.theme;return t&&Rt(n,t)},function(o){var t=o.theme,n=o.isActive;return Rt(t,n)}),Dt=(0,P.default)(z.Flex).withConfig({displayName:"Collapse__Cell",componentId:"sc-132fji1-2"})(["width:",";position:relative;"],le),Vt=(0,P.default)(F.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}),Zt=P.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,P.default)(F.Box).withConfig({displayName:"Collapse__AbsoluteBox",componentId:"sc-132fji1-5"})(["position:absolute;right:9px;transform:translateY(10px);"]),xt=function(t){var n=t.availableActions,s=t.isActive,i=t.isGrey,d=t.isFormDisabled,m=t.label,g=t.onClickToggle,E=t.pathToData,b=(0,e.useState)(!1),S=(0,U.Z)(b,2),L=S[0],$=S[1],ee=(0,Y.useIntl)(),w=ee.formatMessage,j=(0,J.$_)(),A=j.modifiedData,I=j.onChangeParentCheckbox,X=j.onChangeSimpleCheckbox,se=function(){$(function(Ae){return!Ae})},Oe=function(){$(!1)},ve=ue()(A,E.split(".."),{}),Re=(0,e.useMemo)(function(){return Object.keys(ve).reduce(function(ce,Ae){return ce[Ae]=re()(ve[Ae],"conditions"),ce},{})},[ve]),Be=ct(Re),Me=Be.hasAllActionsSelected,vt=Be.hasSomeActionsSelected,Ce=(0,e.useMemo)(function(){return Ot(n,A,E)},[n,A,E]),we=Ce.some(function(ce){var Ae=ce.hasConditions;return Ae});return e.createElement(ln,{isActive:s},e.createElement(kt,{isGrey:i},e.createElement(Wt,{isCollapsable:!0,isFormDisabled:d,label:m,checkboxName:E,onChange:I,onClick:g,someChecked:vt,value:Me,isActive:s},e.createElement(Vt,{paddingLeft:2},s?e.createElement(ze(),null):e.createElement(Ge(),null))),e.createElement(z.Flex,{style:{flex:1}},Ce.map(function(ce){var Ae=ce.actionId,De=ce.hasConditions,je=ce.hasAllActionsSelected,We=ce.hasSomeActionsSelected,dt=ce.isDisplayed,Ze=ce.isParentCheckbox,lt=ce.checkboxName,St=ce.label;return dt?Ze?e.createElement(Dt,{key:Ae,justifyContent:"center",alignItems:"center"},De&&e.createElement(Zt,null),e.createElement(be.BaseCheckbox,{disabled:d||Ut,name:lt,"aria-label":w({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(St," ").concat(m)}),onValueChange:function(Ct){I({target:{name:lt,value:Ct}})},indeterminate:We,value:je})):e.createElement(Dt,{key:Ae,justifyContent:"center",alignItems:"center"},De&&e.createElement(Zt,null),e.createElement(be.BaseCheckbox,{disabled:d||Ut,indeterminate:De,name:lt,onValueChange:function(Ct){X({target:{name:lt,value:Ct}})},value:je})):e.createElement(ut,{key:Ae})})),L&&e.createElement(Et,{headerBreadCrumbs:[m,"app.components.LeftMenuLinkContainer.settings"],actions:Ce,isFormDisabled:d,onClosed:Oe,onToggle:se})),e.createElement(Hn,null,e.createElement(Se,{onClick:se,hasConditions:we})))};xt.propTypes={availableActions:r().array.isRequired,isActive:r().bool.isRequired,isGrey:r().bool.isRequired,isFormDisabled:r().bool.isRequired,label:r().string.isRequired,onClickToggle:r().func.isRequired,pathToData:r().string.isRequired};const Gt=xt,cn=(o,t)=>o.map(n=>{const s=Array.isArray(n.applyToProperties)&&n.applyToProperties.indexOf(t)!==-1&&n.isDisplayed;return{label:n.label,actionId:n.actionId,isActionRelatedToCurrentProperty:s}}),dn=(0,P.default)(z.Flex)`
67
+ `)},Vt=P.default.div.withConfig({displayName:"Collapse__Wrapper",componentId:"sc-132fji1-0"})(["flex:1;display:flex;align-items:center;height:",";background-color:",";border:1px solid transparent;"],Ve,function(o){var t=o.isGrey,n=o.theme;return t?n.colors.neutral100:n.colors.neutral0}),ln=P.default.div.withConfig({displayName:"Collapse__BoxWrapper",componentId:"sc-132fji1-1"})(["display:inline-flex;min-width:100%;","{display:none;}"," &:hover{","}"],We,function(o){var t=o.isActive,n=o.theme;return t&&Dt(n,t)},function(o){var t=o.theme,n=o.isActive;return Dt(t,n)}),xt=(0,P.default)(z.Flex).withConfig({displayName:"Collapse__Cell",componentId:"sc-132fji1-2"})(["width:",";position:relative;"],le),Zt=(0,P.default)(F.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=P.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,P.default)(F.Box).withConfig({displayName:"Collapse__AbsoluteBox",componentId:"sc-132fji1-5"})(["position:absolute;right:9px;transform:translateY(10px);"]),Mt=function(t){var n=t.availableActions,s=t.isActive,i=t.isGrey,d=t.isFormDisabled,m=t.label,g=t.onClickToggle,E=t.pathToData,b=(0,e.useState)(!1),S=(0,U.Z)(b,2),L=S[0],$=S[1],ee=(0,Y.useIntl)(),w=ee.formatMessage,j=(0,J.$_)(),A=j.modifiedData,I=j.onChangeParentCheckbox,X=j.onChangeSimpleCheckbox,se=function(){$(function(Te){return!Te})},Re=function(){$(!1)},ve=ue()(A,E.split(".."),{}),De=(0,e.useMemo)(function(){return Object.keys(ve).reduce(function(ce,Te){return ce[Te]=re()(ve[Te],"conditions"),ce},{})},[ve]),Be=ct(De),Le=Be.hasAllActionsSelected,vt=Be.hasSomeActionsSelected,Ce=(0,e.useMemo)(function(){return Rt(n,A,E)},[n,A,E]),we=Ce.some(function(ce){var Te=ce.hasConditions;return Te});return e.createElement(ln,{isActive:s},e.createElement(Vt,{isGrey:i},e.createElement($t,{isCollapsable:!0,isFormDisabled:d,label:m,checkboxName:E,onChange:I,onClick:g,someChecked:vt,value:Le,isActive:s},e.createElement(Zt,{paddingLeft:2},s?e.createElement(Ke(),null):e.createElement(ze(),null))),e.createElement(z.Flex,{style:{flex:1}},Ce.map(function(ce){var Te=ce.actionId,xe=ce.hasConditions,je=ce.hasAllActionsSelected,$e=ce.hasSomeActionsSelected,dt=ce.isDisplayed,Ge=ce.isParentCheckbox,lt=ce.checkboxName,St=ce.label;return dt?Ge?e.createElement(xt,{key:Te,justifyContent:"center",alignItems:"center"},xe&&e.createElement(Gt,null),e.createElement(be.BaseCheckbox,{disabled:d||kt,name:lt,"aria-label":w({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(St," ").concat(m)}),onValueChange:function(Ct){I({target:{name:lt,value:Ct}})},indeterminate:$e,value:je})):e.createElement(xt,{key:Te,justifyContent:"center",alignItems:"center"},xe&&e.createElement(Gt,null),e.createElement(be.BaseCheckbox,{disabled:d||kt,indeterminate:xe,name:lt,onValueChange:function(Ct){X({target:{name:lt,value:Ct}})},value:je})):e.createElement(ut,{key:Te})})),L&&e.createElement(Et,{headerBreadCrumbs:[m,"app.components.LeftMenuLinkContainer.settings"],actions:Ce,isFormDisabled:d,onClosed:Re,onToggle:se})),e.createElement(Hn,null,e.createElement(We,{onClick:se,hasConditions:we})))};Mt.propTypes={availableActions:r().array.isRequired,isActive:r().bool.isRequired,isGrey:r().bool.isRequired,isFormDisabled:r().bool.isRequired,label:r().string.isRequired,onClickToggle:r().func.isRequired,pathToData:r().string.isRequired};const zt=Mt,cn=(o,t)=>o.map(n=>{const s=Array.isArray(n.applyToProperties)&&n.applyToProperties.indexOf(t)!==-1&&n.isDisplayed;return{label:n.label,actionId:n.actionId,isActionRelatedToCurrentProperty:s}}),dn=(0,P.default)(z.Flex)`
68
68
  width: ${le};
69
69
  flex-shrink: 0;
70
70
  `,un=(0,P.default)(z.Flex)`
71
- width: ${xe};
72
- height: ${ke};
71
+ width: ${Me};
72
+ height: ${Ve};
73
73
  flex-shrink: 0;
74
- `,zt=({headers:o,label:t})=>{const{formatMessage:n}=(0,Y.useIntl)(),s=n({id:"Settings.roles.form.permission.property-label",defaultMessage:"{label} permissions"},{label:t});return e.createElement(z.Flex,null,e.createElement(un,{alignItems:"center",paddingLeft:6},e.createElement(R.Typography,{variant:"sigma",textColor:"neutral500"},s)),o.map(i=>i.isActionRelatedToCurrentProperty?e.createElement(dn,{justifyContent:"center",key:i.label},e.createElement(R.Typography,{variant:"sigma",textColor:"neutral500"},n({id:`Settings.roles.form.permissions.${i.label.toLowerCase()}`,defaultMessage:i.label}))):e.createElement(dn,{key:i.label})))};zt.propTypes={headers:r().arrayOf(r().shape({label:r().string.isRequired,isActionRelatedToCurrentProperty:r().bool.isRequired})).isRequired,label:r().string.isRequired};const pn=zt,Yn=P.default.span`
74
+ `,Kt=({headers:o,label:t})=>{const{formatMessage:n}=(0,Y.useIntl)(),s=n({id:"Settings.roles.form.permission.property-label",defaultMessage:"{label} permissions"},{label:t});return e.createElement(z.Flex,null,e.createElement(un,{alignItems:"center",paddingLeft:6},e.createElement(R.Typography,{variant:"sigma",textColor:"neutral500"},s)),o.map(i=>i.isActionRelatedToCurrentProperty?e.createElement(dn,{justifyContent:"center",key:i.label},e.createElement(R.Typography,{variant:"sigma",textColor:"neutral500"},n({id:`Settings.roles.form.permissions.${i.label.toLowerCase()}`,defaultMessage:i.label}))):e.createElement(dn,{key:i.label})))};Kt.propTypes={headers:r().arrayOf(r().shape({label:r().string.isRequired,isActionRelatedToCurrentProperty:r().bool.isRequired})).isRequired,label:r().string.isRequired};const pn=Kt,Yn=P.default.span`
75
75
  color: ${({theme:o})=>o.colors.danger700};
76
76
  padding-left: ${({theme:o})=>o.spaces[1]}px;
77
- `,Kt=()=>e.createElement(Yn,null,"*");var mn=Object.defineProperty,Jn=Object.defineProperties,gn=Object.getOwnPropertyDescriptors,fn=Object.getOwnPropertySymbols,hn=Object.prototype.hasOwnProperty,Ht=Object.prototype.propertyIsEnumerable,et=(o,t,n)=>t in o?mn(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,yn=(o,t)=>{for(var n in t||(t={}))hn.call(t,n)&&et(o,n,t[n]);if(fn)for(var n of fn(t))Ht.call(t,n)&&et(o,n,t[n]);return o},ye=(o,t)=>Jn(o,gn(t));const Cn=(o,t)=>o.map(n=>{const s=Array.isArray(n.subjects)&&n.subjects.indexOf(t)!==-1;return ye(yn({},n),{isDisplayed:s})});var En=a(20011),bn=Object.defineProperty,Xt=Object.getOwnPropertySymbols,Sn=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable,Yt=(o,t,n)=>t in o?bn(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Pn=(o,t)=>{for(var n in t||(t={}))Sn.call(t,n)&&Yt(o,n,t[n]);if(Xt)for(var n of Xt(t))ht.call(t,n)&&Yt(o,n,t[n]);return o};const Tn=(0,P.default)(F.Box)`
77
+ `,Ht=()=>e.createElement(Yn,null,"*");var mn=Object.defineProperty,Jn=Object.defineProperties,gn=Object.getOwnPropertyDescriptors,fn=Object.getOwnPropertySymbols,hn=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,et=(o,t,n)=>t in o?mn(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,yn=(o,t)=>{for(var n in t||(t={}))hn.call(t,n)&&et(o,n,t[n]);if(fn)for(var n of fn(t))Xt.call(t,n)&&et(o,n,t[n]);return o},ye=(o,t)=>Jn(o,gn(t));const Cn=(o,t)=>o.map(n=>{const s=Array.isArray(n.subjects)&&n.subjects.indexOf(t)!==-1;return ye(yn({},n),{isDisplayed:s})});var En=a(20011),bn=Object.defineProperty,Yt=Object.getOwnPropertySymbols,Sn=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable,Qt=(o,t,n)=>t in o?bn(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Pn=(o,t)=>{for(var n in t||(t={}))Sn.call(t,n)&&Qt(o,n,t[n]);if(Yt)for(var n of Yt(t))ht.call(t,n)&&Qt(o,n,t[n]);return o};const Tn=(0,P.default)(F.Box)`
78
78
  transform: translate(-4px, -12px);
79
79
 
80
80
  &:before {
@@ -84,7 +84,7 @@
84
84
  background: ${({theme:o})=>o.colors.primary200};
85
85
  display: block;
86
86
  }
87
- `,Qt=P.default.svg`
87
+ `,Jt=P.default.svg`
88
88
  position: relative;
89
89
  flex-shrink: 0;
90
90
  transform: translate(-0.5px, -1px);
@@ -92,7 +92,7 @@
92
92
  * {
93
93
  fill: ${({theme:o,color:t})=>o.colors[t]};
94
94
  }
95
- `,Mt=o=>e.createElement(Tn,null,e.createElement(Qt,Pn({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"})));Mt.defaultProps={fill:"primary200"},Mt.propTypes={fill:r().string};const An=(0,e.memo)(Mt);var Lt=function(){return window&&window.strapi&&window.strapi.isEE?a(19665).Z:a(52124).Z}(),It=(0,P.default)(z.Flex).withConfig({displayName:"SubActionRow__Cell",componentId:"sc-7y8yzq-0"})(["width:",";position:relative;"],le),Jt=(0,P.default)(z.Flex).withConfig({displayName:"SubActionRow__RowWrapper",componentId:"sc-7y8yzq-1"})(["height:",";"],ke),qt=(0,P.default)(F.Box).withConfig({displayName:"SubActionRow__Wrapper",componentId:"sc-7y8yzq-2"})(["padding-left:","rem;"],31/16),On=(0,P.default)(F.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"}),_t=(0,P.default)(z.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&&`
95
+ `,Lt=o=>e.createElement(Tn,null,e.createElement(Jt,Pn({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"})));Lt.defaultProps={fill:"primary200"},Lt.propTypes={fill:r().string};const An=(0,e.memo)(Lt);var It=function(){return window&&window.strapi&&window.strapi.isEE?a(19665).Z:a(52124).Z}(),Ft=(0,P.default)(z.Flex).withConfig({displayName:"SubActionRow__Cell",componentId:"sc-7y8yzq-0"})(["width:",";position:relative;"],le),qt=(0,P.default)(z.Flex).withConfig({displayName:"SubActionRow__RowWrapper",componentId:"sc-7y8yzq-1"})(["height:",";"],Ve),_t=(0,P.default)(F.Box).withConfig({displayName:"SubActionRow__Wrapper",componentId:"sc-7y8yzq-2"})(["padding-left:","rem;"],31/16),On=(0,P.default)(F.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"}),en=(0,P.default)(z.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&&`
96
96
  `.concat(gt,` {
97
97
  display: block;
98
98
  color: `).concat(n.colors.neutral100,`;
@@ -100,7 +100,7 @@
100
100
  &:hover {
101
101
  `).concat(ft(n),`
102
102
  }
103
- `)},function(o){var t=o.isActive,n=o.theme;return t&&ft(n)}),Rn=P.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}),p=function o(t){var n=t.childrenForm,s=t.isFormDisabled,i=t.recursiveLevel,d=t.pathToDataFromActionRow,m=t.propertyActions,g=t.parentName,E=t.propertyName,b=(0,Y.useIntl)(),S=b.formatMessage,L=(0,J.$_)(),$=L.modifiedData,ee=L.onChangeParentCheckbox,w=L.onChangeSimpleCheckbox,j=(0,e.useState)(null),A=(0,U.Z)(j,2),I=A[0],X=A[1],se=function(Re){X(function(Be){return Be===Re?null:Re})},Oe=(0,e.useMemo)(function(){return I?n.find(function(ve){var Re=ve.value;return Re===I}):null},[I,n]);return e.createElement(qt,null,e.createElement(Rn,null),n.map(function(ve,Re){var Be=ve.label,Me=ve.value,vt=ve.required,Ce=ve.children,we=Re+1<n.length,ce=Array.isArray(Ce),Ae=I===Me;return e.createElement(On,{key:Me,isVisible:we},e.createElement(Jt,null,e.createElement(An,{color:"primary200"}),e.createElement(z.Flex,{style:{flex:1}},e.createElement(_t,{level:i,isActive:Ae,isCollapsable:ce},e.createElement(nt,(0,En.Z)({alignItems:"center",isCollapsable:ce},ce&&{onClick:function(){return se(Me)},"aria-expanded":Ae,onKeyDown:function(je){var We=je.key;return(We==="Enter"||We===" ")&&se(Me)},tabIndex:0,role:"button"},{title:Be}),e.createElement(R.Typography,{ellipsis:!0},W()(Be)),vt&&e.createElement(Kt,null),e.createElement(gt,{$isActive:Ae}))),e.createElement(z.Flex,{style:{flex:1}},m.map(function(De){var je=De.actionId,We=De.label,dt=De.isActionRelatedToCurrentProperty;if(!dt)return e.createElement(ut,{key:je});var Ze=[].concat((0,oe.Z)(d.split("..")),[je,"properties",E],(0,oe.Z)(g.split("..")),[Me]),lt=ue()($,Ze,!1);if(!Ce)return e.createElement(It,{key:We,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{disabled:s||Lt,name:Ze.join(".."),"aria-label":S({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(g," ").concat(Be," ").concat(We)}),onValueChange:function(Ft){w({target:{name:Ze.join(".."),value:Ft}})},value:lt}));var St=ct(lt),Pt=St.hasAllActionsSelected,Ct=St.hasSomeActionsSelected;return e.createElement(It,{key:We,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{key:We,disabled:s||Lt,name:Ze.join(".."),"aria-label":S({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(g," ").concat(Be," ").concat(We)}),onValueChange:function(Ft){ee({target:{name:Ze.join(".."),value:Ft}})},value:Pt,indeterminate:Ct}))})))),Oe&&Ae&&e.createElement(F.Box,{paddingBottom:2},e.createElement(o,{isFormDisabled:s,parentName:"".concat(g,"..").concat(Me),pathToDataFromActionRow:d,propertyActions:m,propertyName:E,recursiveLevel:i+1,childrenForm:Oe.children})))}))};p.propTypes={childrenForm:r().array.isRequired,isFormDisabled:r().bool.isRequired,parentName:r().string.isRequired,pathToDataFromActionRow:r().string.isRequired,propertyActions:r().array.isRequired,propertyName:r().string.isRequired,recursiveLevel:r().number.isRequired};const c=(0,e.memo)(p),l=o=>o.reduce((n,s)=>(s.isActionRelatedToCurrentProperty&&n.push(s.actionId),n),[]),u=(o,t,n,s,i)=>{const m=l(o).reduce((g,E)=>{const b=[...n.split(".."),E,"properties",s,i],S=(0,f.get)(t,b,!1);return g[E]=S,g},{});return ct(m)};var T=function(){return window&&window.strapi&&window.strapi.isEE?a(32741).Z:a(18318).Z}(),M=(0,P.default)(z.Flex).withConfig({displayName:"ActionRow__Cell",componentId:"sc-4agenc-0"})(["width:",";position:relative;"],le),O=(0,P.default)(z.Flex).withConfig({displayName:"ActionRow__Wrapper",componentId:"sc-4agenc-1"})(["height:",";flex:1;"," ",";"],ke,function(o){var t=o.isCollapsable,n=o.theme;return t&&`
103
+ `)},function(o){var t=o.isActive,n=o.theme;return t&&ft(n)}),Rn=P.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}),p=function o(t){var n=t.childrenForm,s=t.isFormDisabled,i=t.recursiveLevel,d=t.pathToDataFromActionRow,m=t.propertyActions,g=t.parentName,E=t.propertyName,b=(0,Y.useIntl)(),S=b.formatMessage,L=(0,J.$_)(),$=L.modifiedData,ee=L.onChangeParentCheckbox,w=L.onChangeSimpleCheckbox,j=(0,e.useState)(null),A=(0,U.Z)(j,2),I=A[0],X=A[1],se=function(De){X(function(Be){return Be===De?null:De})},Re=(0,e.useMemo)(function(){return I?n.find(function(ve){var De=ve.value;return De===I}):null},[I,n]);return e.createElement(_t,null,e.createElement(Rn,null),n.map(function(ve,De){var Be=ve.label,Le=ve.value,vt=ve.required,Ce=ve.children,we=De+1<n.length,ce=Array.isArray(Ce),Te=I===Le;return e.createElement(On,{key:Le,isVisible:we},e.createElement(qt,null,e.createElement(An,{color:"primary200"}),e.createElement(z.Flex,{style:{flex:1}},e.createElement(en,{level:i,isActive:Te,isCollapsable:ce},e.createElement(nt,(0,En.Z)({alignItems:"center",isCollapsable:ce},ce&&{onClick:function(){return se(Le)},"aria-expanded":Te,onKeyDown:function(je){var $e=je.key;return($e==="Enter"||$e===" ")&&se(Le)},tabIndex:0,role:"button"},{title:Be}),e.createElement(R.Typography,{ellipsis:!0},W()(Be)),vt&&e.createElement(Ht,null),e.createElement(gt,{$isActive:Te}))),e.createElement(z.Flex,{style:{flex:1}},m.map(function(xe){var je=xe.actionId,$e=xe.label,dt=xe.isActionRelatedToCurrentProperty;if(!dt)return e.createElement(ut,{key:je});var Ge=[].concat((0,oe.Z)(d.split("..")),[je,"properties",E],(0,oe.Z)(g.split("..")),[Le]),lt=ue()($,Ge,!1);if(!Ce)return e.createElement(Ft,{key:$e,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{disabled:s||It,name:Ge.join(".."),"aria-label":S({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(g," ").concat(Be," ").concat($e)}),onValueChange:function(Bt){w({target:{name:Ge.join(".."),value:Bt}})},value:lt}));var St=ct(lt),Pt=St.hasAllActionsSelected,Ct=St.hasSomeActionsSelected;return e.createElement(Ft,{key:$e,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{key:$e,disabled:s||It,name:Ge.join(".."),"aria-label":S({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(g," ").concat(Be," ").concat($e)}),onValueChange:function(Bt){ee({target:{name:Ge.join(".."),value:Bt}})},value:Pt,indeterminate:Ct}))})))),Re&&Te&&e.createElement(F.Box,{paddingBottom:2},e.createElement(o,{isFormDisabled:s,parentName:"".concat(g,"..").concat(Le),pathToDataFromActionRow:d,propertyActions:m,propertyName:E,recursiveLevel:i+1,childrenForm:Re.children})))}))};p.propTypes={childrenForm:r().array.isRequired,isFormDisabled:r().bool.isRequired,parentName:r().string.isRequired,pathToDataFromActionRow:r().string.isRequired,propertyActions:r().array.isRequired,propertyName:r().string.isRequired,recursiveLevel:r().number.isRequired};const c=(0,e.memo)(p),l=o=>o.reduce((n,s)=>(s.isActionRelatedToCurrentProperty&&n.push(s.actionId),n),[]),u=(o,t,n,s,i)=>{const m=l(o).reduce((g,E)=>{const b=[...n.split(".."),E,"properties",s,i],S=(0,f.get)(t,b,!1);return g[E]=S,g},{});return ct(m)};var T=function(){return window&&window.strapi&&window.strapi.isEE?a(32741).Z:a(18318).Z}(),M=(0,P.default)(z.Flex).withConfig({displayName:"ActionRow__Cell",componentId:"sc-4agenc-0"})(["width:",";position:relative;"],le),O=(0,P.default)(z.Flex).withConfig({displayName:"ActionRow__Wrapper",componentId:"sc-4agenc-1"})(["height:",";flex:1;"," ",";"],Ve,function(o){var t=o.isCollapsable,n=o.theme;return t&&`
104
104
  `.concat(gt,` {
105
105
  display: block;
106
106
  color: `).concat(n.colors.neutral100,`;
@@ -108,16 +108,16 @@
108
108
  &:hover {
109
109
  `).concat(ft(n),`
110
110
  }
111
- `)},function(o){var t=o.isActive,n=o.theme;return t&&ft(n)}),v=function(t){var n=t.childrenForm,s=t.label,i=t.isFormDisabled,d=t.name,m=t.required,g=t.pathToData,E=t.propertyActions,b=t.propertyName,S=t.isOdd,L=(0,Y.useIntl)(),$=L.formatMessage,ee=(0,e.useState)(null),w=(0,U.Z)(ee,2),j=w[0],A=w[1],I=(0,J.$_)(),X=I.modifiedData,se=I.onChangeCollectionTypeLeftActionRowCheckbox,Oe=I.onChangeParentCheckbox,ve=I.onChangeSimpleCheckbox,Re=j===d,Be=(0,e.useMemo)(function(){return Array.isArray(n)?n:[]},[n]),Me=Be.length>0,vt=(0,e.useCallback)(function(){Me&&A(function(De){return De===d?null:d})},[Me,d]),Ce=function(je){var We=je.target.value;se(g,b,d,We)},we=(0,e.useMemo)(function(){return u(E,X,g,b,d)},[E,X,g,b,d]),ce=we.hasAllActionsSelected,Ae=we.hasSomeActionsSelected;return e.createElement(e.Fragment,null,e.createElement(O,{alignItems:"center",isCollapsable:Me,isActive:Re,background:S?"neutral100":"neutral0"},e.createElement(z.Flex,null,e.createElement(Wt,{onChange:Ce,onClick:vt,isCollapsable:Me,isFormDisabled:i,label:s,someChecked:Ae,value:ce,isActive:Re},m&&e.createElement(Kt,null),e.createElement(gt,{$isActive:Re})),e.createElement(z.Flex,null,E.map(function(De){var je=De.label,We=De.isActionRelatedToCurrentProperty,dt=De.actionId;if(!We)return e.createElement(ut,{key:je});var Ze=[].concat((0,oe.Z)(g.split("..")),[dt,"properties",b,d]);if(!Me){var lt=ue()(X,Ze,!1);return e.createElement(M,{key:dt,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{disabled:i||T,name:Ze.join(".."),"aria-label":$({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(d," ").concat(je)}),onValueChange:function(Wn){ve({target:{name:Ze.join(".."),value:Wn}})},value:lt}))}var St=ue()(X,Ze,{}),Pt=ct(St),Ct=Pt.hasAllActionsSelected,Nn=Pt.hasSomeActionsSelected;return e.createElement(M,{key:je,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{disabled:i||T,name:Ze.join(".."),onValueChange:function(Wn){Oe({target:{name:Ze.join(".."),value:Wn}})},"aria-label":$({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(d," ").concat(je)}),value:Ct,indeterminate:Nn}))})))),Re&&e.createElement(c,{childrenForm:Be,isFormDisabled:i,parentName:d,pathToDataFromActionRow:g,propertyName:b,propertyActions:E,recursiveLevel:0}))};v.defaultProps={childrenForm:[],required:!1},v.propTypes={childrenForm:r().array,label:r().string.isRequired,isFormDisabled:r().bool.isRequired,name:r().string.isRequired,pathToData:r().string.isRequired,propertyActions:r().array.isRequired,propertyName:r().string.isRequired,required:r().bool,isOdd:r().bool.isRequired};const x=(0,e.memo)(v),Te=P.default.div`
111
+ `)},function(o){var t=o.isActive,n=o.theme;return t&&ft(n)}),v=function(t){var n=t.childrenForm,s=t.label,i=t.isFormDisabled,d=t.name,m=t.required,g=t.pathToData,E=t.propertyActions,b=t.propertyName,S=t.isOdd,L=(0,Y.useIntl)(),$=L.formatMessage,ee=(0,e.useState)(null),w=(0,U.Z)(ee,2),j=w[0],A=w[1],I=(0,J.$_)(),X=I.modifiedData,se=I.onChangeCollectionTypeLeftActionRowCheckbox,Re=I.onChangeParentCheckbox,ve=I.onChangeSimpleCheckbox,De=j===d,Be=(0,e.useMemo)(function(){return Array.isArray(n)?n:[]},[n]),Le=Be.length>0,vt=(0,e.useCallback)(function(){Le&&A(function(xe){return xe===d?null:d})},[Le,d]),Ce=function(je){var $e=je.target.value;se(g,b,d,$e)},we=(0,e.useMemo)(function(){return u(E,X,g,b,d)},[E,X,g,b,d]),ce=we.hasAllActionsSelected,Te=we.hasSomeActionsSelected;return e.createElement(e.Fragment,null,e.createElement(O,{alignItems:"center",isCollapsable:Le,isActive:De,background:S?"neutral100":"neutral0"},e.createElement(z.Flex,null,e.createElement($t,{onChange:Ce,onClick:vt,isCollapsable:Le,isFormDisabled:i,label:s,someChecked:Te,value:ce,isActive:De},m&&e.createElement(Ht,null),e.createElement(gt,{$isActive:De})),e.createElement(z.Flex,null,E.map(function(xe){var je=xe.label,$e=xe.isActionRelatedToCurrentProperty,dt=xe.actionId;if(!$e)return e.createElement(ut,{key:je});var Ge=[].concat((0,oe.Z)(g.split("..")),[dt,"properties",b,d]);if(!Le){var lt=ue()(X,Ge,!1);return e.createElement(M,{key:dt,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{disabled:i||T,name:Ge.join(".."),"aria-label":$({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(d," ").concat(je)}),onValueChange:function(Wn){ve({target:{name:Ge.join(".."),value:Wn}})},value:lt}))}var St=ue()(X,Ge,{}),Pt=ct(St),Ct=Pt.hasAllActionsSelected,Nn=Pt.hasSomeActionsSelected;return e.createElement(M,{key:je,justifyContent:"center",alignItems:"center"},e.createElement(be.BaseCheckbox,{disabled:i||T,name:Ge.join(".."),onValueChange:function(Wn){Re({target:{name:Ge.join(".."),value:Wn}})},"aria-label":$({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:"".concat(d," ").concat(je)}),value:Ct,indeterminate:Nn}))})))),De&&e.createElement(c,{childrenForm:Be,isFormDisabled:i,parentName:d,pathToDataFromActionRow:g,propertyName:b,propertyActions:E,recursiveLevel:0}))};v.defaultProps={childrenForm:[],required:!1},v.propTypes={childrenForm:r().array,label:r().string.isRequired,isFormDisabled:r().bool.isRequired,name:r().string.isRequired,pathToData:r().string.isRequired,propertyActions:r().array.isRequired,propertyName:r().string.isRequired,required:r().bool,isOdd:r().bool.isRequired};const x=(0,e.memo)(v),Pe=P.default.div`
112
112
  display: inline-flex;
113
113
  flex-direction: column;
114
114
  min-width: 0;
115
- `,me=({availableActions:o,childrenForm:t,isFormDisabled:n,label:s,pathToData:i,propertyName:d})=>{const m=(0,e.useMemo)(()=>cn(o,d),[o,d]);return e.createElement(Te,null,e.createElement(pn,{label:s,headers:m}),e.createElement(F.Box,null,t.map(({children:g,label:E,value:b,required:S},L)=>e.createElement(x,{childrenForm:g,key:b,label:E,isFormDisabled:n,name:b,required:S,propertyActions:m,pathToData:i,propertyName:d,isOdd:L%2===0}))))};me.propTypes={childrenForm:r().array.isRequired,availableActions:r().array.isRequired,isFormDisabled:r().bool.isRequired,label:r().string.isRequired,pathToData:r().string.isRequired,propertyName:r().string.isRequired};const tt=me,yt=P.default.div`
115
+ `,me=({availableActions:o,childrenForm:t,isFormDisabled:n,label:s,pathToData:i,propertyName:d})=>{const m=(0,e.useMemo)(()=>cn(o,d),[o,d]);return e.createElement(Pe,null,e.createElement(pn,{label:s,headers:m}),e.createElement(F.Box,null,t.map(({children:g,label:E,value:b,required:S},L)=>e.createElement(x,{childrenForm:g,key:b,label:E,isFormDisabled:n,name:b,required:S,propertyActions:m,pathToData:i,propertyName:d,isOdd:L%2===0}))))};me.propTypes={childrenForm:r().array.isRequired,availableActions:r().array.isRequired,isFormDisabled:r().bool.isRequired,label:r().string.isRequired,pathToData:r().string.isRequired,propertyName:r().string.isRequired};const tt=me,yt=P.default.div`
116
116
  flex-direction: column;
117
117
  display: inline-flex;
118
118
  min-width: 100%;
119
119
  ${({theme:o,isActive:t})=>t&&`border: 1px solid ${o.colors.primary600};`}
120
- `,rt=({allActions:o,contentTypeName:t,label:n,index:s,isActive:i,isFormDisabled:d,onClickToggleCollapse:m,pathToData:g,properties:E})=>{const b=(0,e.useCallback)(()=>{m(t)},[t,m]),S=(0,e.useMemo)(()=>Cn(o,t),[o,t]);return e.createElement(yt,{isActive:i},e.createElement(Gt,{availableActions:S,isActive:i,isGrey:s%2===0,isFormDisabled:d,label:n,onClickToggle:b,pathToData:g}),i&&E.map(({label:L,value:$,children:ee})=>e.createElement(tt,{availableActions:S,childrenForm:ee,isFormDisabled:d,label:L,pathToData:g,propertyName:$,key:$})))};rt.propTypes={allActions:r().array.isRequired,contentTypeName:r().string.isRequired,index:r().number.isRequired,isActive:r().bool.isRequired,isFormDisabled:r().bool.isRequired,label:r().string.isRequired,onClickToggleCollapse:r().func.isRequired,pathToData:r().string.isRequired,properties:r().array.isRequired};const ot=rt,at=({actions:o,isFormDisabled:t,pathToData:n,subjects:s})=>{const[i,d]=(0,e.useState)(null),m=g=>{d(i===g?null:g)};return s.map(({uid:g,label:E,properties:b},S)=>e.createElement(ot,{allActions:o,key:g,contentTypeName:g,label:E,isActive:i===g,isFormDisabled:t,index:S,onClickToggleCollapse:m,pathToData:`${n}..${g}`,properties:b}))};at.defaultProps={actions:[],subjects:[]},at.propTypes={actions:r().array.isRequired,isFormDisabled:r().bool.isRequired,pathToData:r().string.isRequired,subjects:r().arrayOf(r().shape({uid:r().string.isRequired,label:r().string.isRequired,properties:r().array.isRequired}))};const No=(0,e.memo)(at),Wo=o=>o.filter(({subjects:t})=>t&&t.length);var $o=Object.defineProperty,qn=Object.getOwnPropertySymbols,Uo=Object.prototype.hasOwnProperty,ko=Object.prototype.propertyIsEnumerable,_n=(o,t,n)=>t in o?$o(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,eo=(o,t)=>{for(var n in t||(t={}))Uo.call(t,n)&&_n(o,n,t[n]);if(qn)for(var n of qn(t))ko.call(t,n)&&_n(o,n,t[n]);return o};const Vo=o=>o.map(({actionId:t})=>t),Zo=(o,t)=>o.reduce((n,s)=>(Object.keys(t).forEach(i=>{const d=(0,f.get)(t,[i,s],{}),m={[i]:At(d)};n[s]?n[s]=eo(eo({},n[s]),m):n[s]=m}),n),{}),Go=(o,t)=>{const n=Vo(o),s=Zo(n,t);return Object.keys(s).reduce((d,m)=>(d[m]=ct(s[m]),d),{})};var zo=function(){return window&&window.strapi&&window.strapi.isEE?a(36950).Z:a(61526).Z}(),Ko=(0,P.default)(Qe.Stack).withConfig({displayName:"GlobalActions__CenteredStack",componentId:"sc-1vxwsjr-0"})(["align-items:center;justify-content:center;width:",";flex-shrink:0;"],le),Dn=function(t){var n=t.actions,s=t.isFormDisabled,i=t.kind,d=(0,Y.useIntl)(),m=d.formatMessage,g=(0,J.$_)(),E=g.modifiedData,b=g.onChangeCollectionTypeGlobalActionCheckbox,S=(0,e.useMemo)(function(){return Wo(n)},[n]),L=(0,e.useMemo)(function(){return Go(S,E[i])},[E,S,i]);return e.createElement(F.Box,{paddingBottom:4,paddingTop:6,style:{paddingLeft:xe}},e.createElement(Qe.Stack,{horizontal:!0,spacing:0},S.map(function($){var ee=$.label,w=$.actionId;return e.createElement(Ko,{key:w,spacing:3},e.createElement(R.Typography,{variant:"sigma",textColor:"neutral500"},m({id:"Settings.roles.form.permissions.".concat(ee.toLowerCase()),defaultMessage:ee})),e.createElement(be.BaseCheckbox,{disabled:s||zo,onValueChange:function(A){b(i,w,A)},name:w,"aria-label":m({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:m({id:"Settings.roles.form.permissions.".concat(ee.toLowerCase()),defaultMessage:ee})}),value:ue()(L,[w,"hasAllActionsSelected"],!1),indeterminate:ue()(L,[w,"hasSomeActionsSelected"],!1)}))})))};Dn.defaultProps={actions:[]},Dn.propTypes={actions:r().arrayOf(r().shape({label:r().string.isRequired,actionId:r().string.isRequired,subjects:r().array.isRequired})),isFormDisabled:r().bool.isRequired,kind:r().string.isRequired};const Ho=(0,e.memo)(Dn),Xo=(0,P.default)(F.Box)`
120
+ `,rt=({allActions:o,contentTypeName:t,label:n,index:s,isActive:i,isFormDisabled:d,onClickToggleCollapse:m,pathToData:g,properties:E})=>{const b=(0,e.useCallback)(()=>{m(t)},[t,m]),S=(0,e.useMemo)(()=>Cn(o,t),[o,t]);return e.createElement(yt,{isActive:i},e.createElement(zt,{availableActions:S,isActive:i,isGrey:s%2===0,isFormDisabled:d,label:n,onClickToggle:b,pathToData:g}),i&&E.map(({label:L,value:$,children:ee})=>e.createElement(tt,{availableActions:S,childrenForm:ee,isFormDisabled:d,label:L,pathToData:g,propertyName:$,key:$})))};rt.propTypes={allActions:r().array.isRequired,contentTypeName:r().string.isRequired,index:r().number.isRequired,isActive:r().bool.isRequired,isFormDisabled:r().bool.isRequired,label:r().string.isRequired,onClickToggleCollapse:r().func.isRequired,pathToData:r().string.isRequired,properties:r().array.isRequired};const ot=rt,at=({actions:o,isFormDisabled:t,pathToData:n,subjects:s})=>{const[i,d]=(0,e.useState)(null),m=g=>{d(i===g?null:g)};return s.map(({uid:g,label:E,properties:b},S)=>e.createElement(ot,{allActions:o,key:g,contentTypeName:g,label:E,isActive:i===g,isFormDisabled:t,index:S,onClickToggleCollapse:m,pathToData:`${n}..${g}`,properties:b}))};at.defaultProps={actions:[],subjects:[]},at.propTypes={actions:r().array.isRequired,isFormDisabled:r().bool.isRequired,pathToData:r().string.isRequired,subjects:r().arrayOf(r().shape({uid:r().string.isRequired,label:r().string.isRequired,properties:r().array.isRequired}))};const No=(0,e.memo)(at),Wo=o=>o.filter(({subjects:t})=>t&&t.length);var $o=Object.defineProperty,qn=Object.getOwnPropertySymbols,Uo=Object.prototype.hasOwnProperty,ko=Object.prototype.propertyIsEnumerable,_n=(o,t,n)=>t in o?$o(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,eo=(o,t)=>{for(var n in t||(t={}))Uo.call(t,n)&&_n(o,n,t[n]);if(qn)for(var n of qn(t))ko.call(t,n)&&_n(o,n,t[n]);return o};const Vo=o=>o.map(({actionId:t})=>t),Zo=(o,t)=>o.reduce((n,s)=>(Object.keys(t).forEach(i=>{const d=(0,f.get)(t,[i,s],{}),m={[i]:Ot(d)};n[s]?n[s]=eo(eo({},n[s]),m):n[s]=m}),n),{}),Go=(o,t)=>{const n=Vo(o),s=Zo(n,t);return Object.keys(s).reduce((d,m)=>(d[m]=ct(s[m]),d),{})};var zo=function(){return window&&window.strapi&&window.strapi.isEE?a(36950).Z:a(61526).Z}(),Ko=(0,P.default)(ke.Stack).withConfig({displayName:"GlobalActions__CenteredStack",componentId:"sc-1vxwsjr-0"})(["align-items:center;justify-content:center;width:",";flex-shrink:0;"],le),Dn=function(t){var n=t.actions,s=t.isFormDisabled,i=t.kind,d=(0,Y.useIntl)(),m=d.formatMessage,g=(0,J.$_)(),E=g.modifiedData,b=g.onChangeCollectionTypeGlobalActionCheckbox,S=(0,e.useMemo)(function(){return Wo(n)},[n]),L=(0,e.useMemo)(function(){return Go(S,E[i])},[E,S,i]);return e.createElement(F.Box,{paddingBottom:4,paddingTop:6,style:{paddingLeft:Me}},e.createElement(ke.Stack,{horizontal:!0,spacing:0},S.map(function($){var ee=$.label,w=$.actionId;return e.createElement(Ko,{key:w,spacing:3},e.createElement(R.Typography,{variant:"sigma",textColor:"neutral500"},m({id:"Settings.roles.form.permissions.".concat(ee.toLowerCase()),defaultMessage:ee})),e.createElement(be.BaseCheckbox,{disabled:s||zo,onValueChange:function(A){b(i,w,A)},name:w,"aria-label":m({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:m({id:"Settings.roles.form.permissions.".concat(ee.toLowerCase()),defaultMessage:ee})}),value:ue()(L,[w,"hasAllActionsSelected"],!1),indeterminate:ue()(L,[w,"hasSomeActionsSelected"],!1)}))})))};Dn.defaultProps={actions:[]},Dn.propTypes={actions:r().arrayOf(r().shape({label:r().string.isRequired,actionId:r().string.isRequired,subjects:r().array.isRequired})),isFormDisabled:r().bool.isRequired,kind:r().string.isRequired};const Ho=(0,e.memo)(Dn),Xo=(0,P.default)(F.Box)`
121
121
  overflow-x: auto;
122
122
  `,to=({isFormDisabled:o,kind:t,layout:{actions:n,subjects:s}})=>{const i=de()([...s],"label");return e.createElement(Xo,{background:"neutral0"},e.createElement(Ho,{actions:n,kind:t,isFormDisabled:o}),e.createElement(No,{actions:n,isFormDisabled:o,pathToData:t,subjects:i}))};to.propTypes={isFormDisabled:r().bool.isRequired,kind:r().string.isRequired,layout:r().shape({actions:r().array,subjects:r().arrayOf(r().shape({uid:r().string.isRequired,label:r().string.isRequired,properties:r().array.isRequired}))}).isRequired};const no=(0,e.memo)(to);var Yo=a(66694);const oo=({children:o,value:t})=>e.createElement(Yo.$l.Provider,{value:t},o);oo.propTypes={children:r().node.isRequired,value:r().exact({availableConditions:r().array.isRequired,modifiedData:r().object.isRequired,onChangeCollectionTypeLeftActionRowCheckbox:r().func.isRequired,onChangeConditions:r().func.isRequired,onChangeSimpleCheckbox:r().func.isRequired,onChangeParentCheckbox:r().func.isRequired,onChangeCollectionTypeGlobalActionCheckbox:r().func.isRequired}).isRequired};const Qo=oo;var xn=a(12001),ao=a(78330),so=a(52111),Jo=Object.defineProperty,qo=Object.defineProperties,_o=Object.getOwnPropertyDescriptors,ro=Object.getOwnPropertySymbols,ea=Object.prototype.hasOwnProperty,ta=Object.prototype.propertyIsEnumerable,io=(o,t,n)=>t in o?Jo(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,na=(o,t)=>{for(var n in t||(t={}))ea.call(t,n)&&io(o,n,t[n]);if(ro)for(var n of ro(t))ta.call(t,n)&&io(o,n,t[n]);return o},oa=(o,t)=>qo(o,_o(t));const aa=(o,t,n)=>o.map(s=>{const i=[...n,s.action,"properties","enabled"],d=(0,f.get)(t,i,!1),m=(0,f.get)(t,[...n,s.action,"conditions"],{}),g=mt(m).some(E=>E);return oa(na({},s),{isDisplayed:d,checkboxName:i.join(".."),hasSomeActionsSelected:d,value:d,hasConditions:g,label:s.displayName,actionId:s.action,pathToConditionsObject:[...n,s.action]})}),sa=o=>{const t=Object.entries(o).reduce((s,i)=>{const[d,{conditions:m}]=i;return s[d]=m,s},{});return mt(t).some(s=>s)};var Mn=function(){return window&&window.strapi&&window.strapi.isEE?a(96556).Z:a(16437).Z}(),ra=P.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}),ia=P.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,s=o.theme;return t&&`
123
123
  &:before {
@@ -130,13 +130,13 @@
130
130
  border-radius: `).concat(20/16,`rem;
131
131
  background: `).concat(n?s.colors.neutral100:s.colors.primary600,`;
132
132
  }
133
- `)}),lo=function(t){var n=t.categoryName,s=t.isFormDisabled,i=t.subCategoryName,d=t.actions,m=t.pathToData,g=(0,e.useState)(!1),E=(0,U.Z)(g,2),b=E[0],S=E[1],L=(0,J.$_)(),$=L.modifiedData,ee=L.onChangeParentCheckbox,w=L.onChangeSimpleCheckbox,j=(0,Y.useIntl)(),A=j.formatMessage,I=ue()($,m,{}),X=(0,e.useMemo)(function(){return Object.keys(I).reduce(function(Ce,we){return Ce[we]=At(I[we]),Ce},{})},[I]),se=ct(X),Oe=se.hasAllActionsSelected,ve=se.hasSomeActionsSelected,Re=function(){S(function(we){return!we})},Be=function(){S(!1)},Me=aa(d,$,m),vt=sa(ue()($,(0,oe.Z)(m),{}));return e.createElement(e.Fragment,null,e.createElement(F.Box,null,e.createElement(z.Flex,{justifyContent:"space-between",alignItems:"center"},e.createElement(F.Box,{paddingRight:4},e.createElement(R.Typography,{variant:"sigma",textColor:"neutral600"},i)),e.createElement(ra,null),e.createElement(F.Box,{paddingLeft:4},e.createElement(so.Checkbox,{name:m.join(".."),disabled:s||Mn,onValueChange:function(we){ee({target:{name:m.join(".."),value:we}})},indeterminate:ve,value:Oe},A({id:"app.utils.select-all",defaultMessage:"Select all"})))),e.createElement(z.Flex,{paddingTop:6,paddingBottom:6},e.createElement(ao.Grid,{gap:2,style:{flex:1}},Me.map(function(Ce){var we=Ce.checkboxName,ce=Ce.value,Ae=Ce.action,De=Ce.displayName,je=Ce.hasConditions;return e.createElement(ao.GridItem,{col:3,key:Ae},e.createElement(ia,{disabled:s||Mn,hasConditions:je},e.createElement(so.Checkbox,{name:we,disabled:s||Mn,onValueChange:function(dt){w({target:{name:we,value:dt}})},value:ce},De)))})),e.createElement(Se,{hasConditions:vt,onClick:Re}))),b&&e.createElement(Et,{headerBreadCrumbs:[n,i],actions:Me,isFormDisabled:s,onClosed:Be,onToggle:Re}))};lo.propTypes={actions:r().array.isRequired,categoryName:r().string.isRequired,isFormDisabled:r().bool.isRequired,subCategoryName:r().string.isRequired,pathToData:r().array.isRequired};const la=lo,Ln=({childrenForm:o,kind:t,name:n,isOpen:s,isFormDisabled:i,isWhite:d,onOpenCategory:m,pathToData:g})=>{const{formatMessage:E}=(0,Y.useIntl)(),b=()=>{m(n)},S=(0,e.useMemo)(()=>n.split("::").pop(),[n]);return e.createElement(xn.Accordion,{expanded:s,onToggle:b,id:`accordion-${n}`,variant:d?"primary":"secondary"},e.createElement(xn.AccordionToggle,{title:W()(S),description:`${E({id:"Settings.permissions.category"},{category:S})} ${t==="plugins"?"plugin":t}`}),e.createElement(xn.AccordionContent,null,e.createElement(F.Box,{padding:6},o.map(({actions:L,subCategoryName:$,subCategoryId:ee})=>e.createElement(la,{key:$,actions:L,categoryName:S,isFormDisabled:i,subCategoryName:$,pathToData:[...g,ee]})))))};Ln.defaultProps={},Ln.propTypes={childrenForm:r().array.isRequired,isOpen:r().bool.isRequired,isFormDisabled:r().bool.isRequired,isWhite:r().bool.isRequired,kind:r().string.isRequired,name:r().string.isRequired,onOpenCategory:r().func.isRequired,pathToData:r().array.isRequired};const ca=Ln,co=({isFormDisabled:o,kind:t,layout:n})=>{const[s,i]=(0,e.useState)(null),d=m=>{i(m===s?null:m)};return e.createElement(F.Box,{padding:6,background:"neutral0"},n.map(({category:m,categoryId:g,childrenForm:E},b)=>e.createElement(ca,{key:m,childrenForm:E,kind:t,isFormDisabled:o,isOpen:s===m,isWhite:b%2===1,name:m,onOpenCategory:d,pathToData:[t,g]})))};co.propTypes={isFormDisabled:r().bool.isRequired,kind:r().string.isRequired,layout:r().arrayOf(r().shape({category:r().string.isRequired,categoryId:r().string.isRequired,childrenForm:r().arrayOf(r().shape({actions:r().array.isRequired})).isRequired}).isRequired).isRequired};const uo=co,po=(o,t,n)=>o.find(s=>s.action===t&&s.subject===n);var da=Object.defineProperty,ua=Object.defineProperties,pa=Object.getOwnPropertyDescriptors,mo=Object.getOwnPropertySymbols,ma=Object.prototype.hasOwnProperty,ga=Object.prototype.propertyIsEnumerable,go=(o,t,n)=>t in o?da(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,fo=(o,t)=>{for(var n in t||(t={}))ma.call(t,n)&&go(o,n,t[n]);if(mo)for(var n of mo(t))ga.call(t,n)&&go(o,n,t[n]);return o},ho=(o,t)=>ua(o,pa(t));const yo=(o,t=[])=>o.reduce((n,s)=>(n[s.id]=t.indexOf(s.id)!==-1,n),{}),vo=({children:o},t,n="")=>o.reduce((s,i)=>{if(i.children)return ho(fo({},s),{[i.value]:vo(i,t,`${n}${i.value}.`)});const d=t.indexOf(`${n}${i.value}`)!==-1;return s[i.value]=d,s},{}),fa=(o,t,n)=>o.reduce((s,i)=>{const d=t.properties.find(({value:m})=>m===i);if(d){const m=(0,f.get)(n,["properties",d.value],[]),g=vo(d,m);s.properties[i]=g}return s},{properties:{}}),ha=(o,t)=>t.reduce((n,s)=>{const i=o.find(({uid:d})=>d===s)||null;return i&&(n[s]=i),n},{}),Co=({subjects:o},t,n,s=[])=>t.reduce((i,d)=>{const m=d.subjects,g=ha(o,m);if((0,f.isEmpty)(g))return i;const E=Object.keys(g).reduce((b,S)=>{const{actionId:L,applyToProperties:$}=d,j=g[S].properties.map(({value:se})=>se).every(se=>($||[]).indexOf(se)===-1),A=po(s,L,S),I=yo(n,(0,f.get)(A,"conditions",[]));if((0,f.isEmpty)($)||j)return(0,f.set)(b,[S,L],{properties:{enabled:A!==void 0},conditions:I}),b;const X=fa($,g[S],A);return(0,f.set)(b,[S,L],ho(fo({},X),{conditions:I})),b},{});return(0,f.merge)(i,E)},{}),ya=(o,t,n)=>o.reduce((s,i)=>{const d=po(n,i.action,null);return s[i.action]={properties:{enabled:d!==void 0},conditions:yo(t,(0,f.get)(d,"conditions",[]))},s},{}),va=(o,t,n)=>o.reduce((s,i)=>(s[i.subCategoryId]=ya(i.actions,t,n),s),{}),Eo=(o,t,n=[])=>o.reduce((s,{categoryId:i,childrenForm:d})=>{const m=va(d,t,n);return s[i]=m,s},{}),bo=o=>o.split(" ").join("-"),So=(o,t)=>(0,f.chain)(o).groupBy(t).map((n,s)=>({category:s,categoryId:bo(s),childrenForm:(0,f.chain)(n).groupBy("subCategory").map((i,d)=>({subCategoryName:d,subCategoryId:bo(d),actions:i})).value()})).value(),Ca=(o,t)=>{const{conditions:n,sections:{collectionTypes:s,singleTypes:i,plugins:d,settings:m}}=o,g={collectionTypes:s,singleTypes:i,plugins:So(d,"plugin"),settings:So(m,"category")},E={collectionTypes:Co(s,s.actions||[],n,t),singleTypes:Co(i,i.actions||[],n,t),plugins:Eo(g.plugins,n,t),settings:Eo(g.settings,n,t)};return{initialData:E,modifiedData:E,layouts:g}};var Ea=Object.defineProperty,ba=Object.defineProperties,Sa=Object.getOwnPropertyDescriptors,Po=Object.getOwnPropertySymbols,Pa=Object.prototype.hasOwnProperty,Ta=Object.prototype.propertyIsEnumerable,To=(o,t,n)=>t in o?Ea(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,In=(o,t)=>{for(var n in t||(t={}))Pa.call(t,n)&&To(o,n,t[n]);if(Po)for(var n of Po(t))Ta.call(t,n)&&To(o,n,t[n]);return o},Fn=(o,t)=>ba(o,Sa(t));const Ao=o=>Object.keys(o).reduce((t,n)=>{const s=o[n];if((0,f.isObject)(s)&&!(0,f.has)(s,"conditions"))return Fn(In({},t),{[n]:Ao(s)});if((0,f.isObject)(s)&&(0,f.has)(s,"conditions")&&!mt((0,f.omit)(s,"conditions")).some(d=>d)){const d=Object.keys(s.conditions).reduce((m,g)=>(m[g]=!1,m),{});return Fn(In({},t),{[n]:Fn(In({},s),{conditions:d})})}return t[n]=s,t},{}),Bn=Ao;var Aa=Object.defineProperty,Oa=Object.defineProperties,Ra=Object.getOwnPropertyDescriptors,Oo=Object.getOwnPropertySymbols,Da=Object.prototype.hasOwnProperty,xa=Object.prototype.propertyIsEnumerable,Ro=(o,t,n)=>t in o?Aa(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Ma=(o,t)=>{for(var n in t||(t={}))Da.call(t,n)&&Ro(o,n,t[n]);if(Oo)for(var n of Oo(t))xa.call(t,n)&&Ro(o,n,t[n]);return o},La=(o,t)=>Oa(o,Ra(t));const Do=(o,t)=>Object.keys(o).reduce((n,s)=>{const i=o[s];return s==="conditions"?(n[s]=i,n):(0,f.isObject)(i)?La(Ma({},n),{[s]:Do(i,t)}):(n[s]=t,n)},{}),en=Do;var Ia=Object.defineProperty,Fa=Object.defineProperties,Ba=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertySymbols,wa=Object.prototype.hasOwnProperty,ja=Object.prototype.propertyIsEnumerable,Mo=(o,t,n)=>t in o?Ia(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Na=(o,t)=>{for(var n in t||(t={}))wa.call(t,n)&&Mo(o,n,t[n]);if(xo)for(var n of xo(t))ja.call(t,n)&&Mo(o,n,t[n]);return o},Wa=(o,t)=>Fa(o,Ba(t));const $a={initialData:{},modifiedData:{},layouts:{}},Ua=(o,t)=>(0,k.default)(o,n=>{switch(t.type){case"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX":{const{collectionTypeKind:s,actionId:i,value:d}=t,m=["modifiedData",s];Object.keys((0,f.get)(o,m)).forEach(g=>{const E=(0,f.get)(o,[...m,g,i],void 0);if(E){let b=en(E,d);if(!d&&b.conditions){const S=en(b.conditions,!1);b=Wa(Na({},b),{conditions:S})}(0,f.set)(n,[...m,g,i],b)}});break}case"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX":{const{pathToCollectionType:s,propertyName:i,rowName:d,value:m}=t;let g=(0,f.cloneDeep)(o.modifiedData);const E=s.split(".."),b=(0,f.get)(g,E,{});Object.keys(b).forEach(S=>{if((0,f.has)(b[S],`properties.${i}`)){const L=(0,f.get)(b,[S,"properties",i,d]),$=[...E,S,"properties",i,d];if(!(0,f.isObject)(L))(0,f.set)(g,$,m);else{const ee=en(L,m);(0,f.set)(g,$,ee)}}}),m||(g=Bn(g)),(0,f.set)(n,"modifiedData",g);break}case"ON_CHANGE_CONDITIONS":{Object.entries(t.conditions).forEach(s=>{const[i,d]=s;(0,f.set)(n,["modifiedData",...i.split(".."),"conditions"],d)});break}case"ON_CHANGE_SIMPLE_CHECKBOX":{let s=(0,f.cloneDeep)(o.modifiedData);(0,f.set)(s,[...t.keys.split("..")],t.value),t.value||(s=Bn(s)),(0,f.set)(n,"modifiedData",s);break}case"ON_CHANGE_TOGGLE_PARENT_CHECKBOX":{const{keys:s,value:i}=t,d=[...s.split("..")];let m=(0,f.cloneDeep)(o.modifiedData);const g=(0,f.get)(m,d,{}),E=en(g,i);(0,f.set)(m,d,E),i||(m=Bn(m)),(0,f.set)(n,["modifiedData"],m);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),ka=o=>{const[t,{conditions:n}]=o;return{action:t,subject:null,conditions:wn(n),properties:{}}},Va=o=>Object.values(o).reduce((t,n)=>{const s=Object.entries(n).reduce((i,d)=>{const[,{properties:{enabled:m}}]=d;if(!m)return i;const g=ka(d);return i.push(g),i},[]);return[...t,...s]},[]),Lo=o=>Object.values(o).reduce((t,n)=>{const s=Va(n);return[...t,...s]},[]),Io=(o,t="")=>Object.entries(o).reduce((n,s)=>{const[i,d]=s;return(0,f.isObject)(d)?[...n,...Io(d,`${t}${i}.`)]:(d&&!(0,f.isObject)(d)&&n.push(`${t}${i}`),n)},[]),Za=(o,t,{conditions:n,properties:s})=>Object.entries(s).reduce((i,d)=>{const[m,g]=d;return i.properties[m]=Io(g),i},{action:o,subject:t,conditions:wn(n),properties:{}}),Ga=(o,t,{conditions:n})=>({action:o,subject:t,properties:{},conditions:wn(n)}),za=(o,t)=>Object.entries(t).reduce((s,i)=>{const[d,m]=i;if(!mt(m).some(b=>b))return s;if(!(0,f.has)(m,"properties.enabled")){const b=Za(d,o,m);return[...s,b]}if(!m.properties.enabled)return s;const E=Ga(d,o,m);return s.push(E),s},[]),Fo=o=>Object.entries(o).reduce((n,s)=>{const[i,d]=s,m=za(i,d);return[...n,...m]},[]),Ka=o=>{const t=Lo(o.plugins),n=Lo(o.settings),s=Fo(o.collectionTypes),i=Fo(o.singleTypes);return[...t,...n,...s,...i]},Ha=[{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 Xa=Object.defineProperty,Bo=Object.getOwnPropertySymbols,Ya=Object.prototype.hasOwnProperty,Qa=Object.prototype.propertyIsEnumerable,wo=(o,t,n)=>t in o?Xa(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,jo=(o,t)=>{for(var n in t||(t={}))Ya.call(t,n)&&wo(o,n,t[n]);if(Bo)for(var n of Bo(t))Qa.call(t,n)&&wo(o,n,t[n]);return o};const jn=(0,e.forwardRef)(({layout:o,isFormDisabled:t,permissions:n},s)=>{const[{initialData:i,layouts:d,modifiedData:m},g]=(0,e.useReducer)(Ua,$a,()=>Ca(o,n)),{formatMessage:E}=(0,Y.useIntl)();(0,e.useImperativeHandle)(s,()=>({getPermissions(){const w=(0,ne.difference)(i.collectionTypes,m.collectionTypes),j=(0,ne.difference)(i.singleTypes,m.singleTypes),A=jo(jo({},w),j);let I;return Ne()(A)?I=!1:I=Object.values(A).some(X=>Object.values(X).some(se=>Ee()(se,"conditions"))),{permissionsToSend:Ka(m),didUpdateConditions:I}},resetForm(){g({type:"RESET_FORM"})},setFormAfterSubmit(){g({type:"SET_FORM_AFTER_SUBMIT"})}}));const b=(w,j,A,I)=>{g({type:"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX",pathToCollectionType:w,propertyName:j,rowName:A,value:I})},S=(w,j,A)=>{g({type:"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX",collectionTypeKind:w,actionId:j,value:A})},L=w=>{g({type:"ON_CHANGE_CONDITIONS",conditions:w})},$=(0,e.useCallback)(({target:{name:w,value:j}})=>{g({type:"ON_CHANGE_SIMPLE_CHECKBOX",keys:w,value:j})},[]),ee=(0,e.useCallback)(({target:{name:w,value:j}})=>{g({type:"ON_CHANGE_TOGGLE_PARENT_CHECKBOX",keys:w,value:j})},[]);return e.createElement(Qo,{value:{availableConditions:o.conditions,modifiedData:m,onChangeConditions:L,onChangeSimpleCheckbox:$,onChangeParentCheckbox:ee,onChangeCollectionTypeLeftActionRowCheckbox:b,onChangeCollectionTypeGlobalActionCheckbox:S}},e.createElement(V.TabGroup,{id:"tabs",label:E({id:"Settings.permissions.users.tabs.label",defaultMessage:"Tabs Permissions"})},e.createElement(V.Tabs,null,Ha.map(w=>e.createElement(V.Tab,{key:w.id},E({id:w.labelId,defaultMessage:w.defaultMessage})))),e.createElement(V.TabPanels,{style:{position:"relative"}},e.createElement(V.TabPanel,null,e.createElement(no,{layout:d.collectionTypes,kind:"collectionTypes",isFormDisabled:t})),e.createElement(V.TabPanel,null,e.createElement(no,{layout:d.singleTypes,kind:"singleTypes",isFormDisabled:t})),e.createElement(V.TabPanel,null,e.createElement(uo,{layout:d.plugins,kind:"plugins",isFormDisabled:t})),e.createElement(V.TabPanel,null,e.createElement(uo,{layout:d.settings,kind:"settings",isFormDisabled:t})))))});jn.defaultProps={permissions:[],layout:{conditions:[],sections:{collectionTypes:{},singleTypes:{actions:[]},settings:[],plugins:[]}}},jn.propTypes={layout:r().object,isFormDisabled:r().bool.isRequired,permissions:r().array};const Ja=(0,e.memo)(jn)},16437:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},78522:(ge,D,a)=>{a.d(D,{Z:()=>e});const e=()=>"todo empty role"},80779:(ge,D,a)=>{a.d(D,{Z:()=>Ke});var e=a(32735),C=a(60216),r=a.n(C),ne=a(9808),V=a.n(ne),Le=a(19192),Ee=a.n(Le),fe=a(53214),Ne=a.n(fe),Y=a(95602),F=a.n(Y),P=a(20763),Z=a.n(P),de=a(88425),U=a.n(de),te=a(5636),Ge=Object.defineProperty,$e=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,z=(re,J,ae)=>J in re?Ge(re,J,{enumerable:!0,configurable:!0,writable:!0,value:ae}):re[J]=ae,y=(re,J)=>{for(var ae in J||(J={}))ze.call(J,ae)&&z(re,ae,J[ae]);if($e)for(var ae of $e(J))be.call(J,ae)&&z(re,ae,J[ae]);return re};const ue=({id:re,name:J,description:ae,usersCount:it,icons:Ie})=>{const{formatMessage:Xe}=(0,te.useIntl)(),Ye=Xe({id:"Roles.RoleRow.user-count",defaultMessage:"{number, plural, =0 {# user} one {# user} other {# users}}"},{number:it});return e.createElement(fe.Tr,y({key:re},(0,de.onRowClick)({fn:Ie[1].onClick})),e.createElement(fe.Td,{maxWidth:(0,de.pxToRem)(130)},e.createElement(Y.Typography,{ellipsis:!0,textColor:"neutral800"},J)),e.createElement(fe.Td,{maxWidth:(0,de.pxToRem)(250)},e.createElement(Y.Typography,{ellipsis:!0,textColor:"neutral800"},ae)),e.createElement(fe.Td,null,e.createElement(Y.Typography,{textColor:"neutral800"},Ye)),e.createElement(fe.Td,null,e.createElement(Le.Flex,y({justifyContent:"flex-end"},de.stopPropagation),Ie.map((Se,Ue)=>Se?e.createElement(ne.Box,{key:Se.label,paddingLeft:Ue===0?0:1},e.createElement(P.IconButton,{onClick:Se.onClick,label:Se.label,noBorder:!0,icon:Se.icon})):null))))};ue.propTypes={id:r().number.isRequired,name:r().string.isRequired,description:r().string.isRequired,usersCount:r().number.isRequired,icons:r().array.isRequired};const Ke=ue},45677:(ge,D,a)=>{a.d(D,{Z:()=>qe});var e=a(32735),C=a(88425),r=a(83983),ne=a(58469),V=a(59290),Le=a.n(V),Ee=a(76470),fe=a.n(Ee),Ne=a(95717),Y=a.n(Ne),F=a(68192),P=a.n(F),Z=a(44526),de=a(11856),U=a(53214),te=a(95602),Ge=a(16540),$e=a(28004),ze=a(5636),be=a(5141),z=a(80779),y=a(78522),ue=a(60216),Ke=a.n(ue),re=a(19615),J=a(64410),ae=a(54742),it=a(20763),Ie=a(61541),Xe=a(9808),Ye=a(19192),Se=a(90662),Ue=a(82372),Qe=a.n(Ue),ie=a(94009),Je=a.n(ie);const R=a.p+"c3de6118ef47086ad05c.png",k=a.p+"bd81ba6c07827282255d.png",N=re.default.div`
133
+ `)}),lo=function(t){var n=t.categoryName,s=t.isFormDisabled,i=t.subCategoryName,d=t.actions,m=t.pathToData,g=(0,e.useState)(!1),E=(0,U.Z)(g,2),b=E[0],S=E[1],L=(0,J.$_)(),$=L.modifiedData,ee=L.onChangeParentCheckbox,w=L.onChangeSimpleCheckbox,j=(0,Y.useIntl)(),A=j.formatMessage,I=ue()($,m,{}),X=(0,e.useMemo)(function(){return Object.keys(I).reduce(function(Ce,we){return Ce[we]=Ot(I[we]),Ce},{})},[I]),se=ct(X),Re=se.hasAllActionsSelected,ve=se.hasSomeActionsSelected,De=function(){S(function(we){return!we})},Be=function(){S(!1)},Le=aa(d,$,m),vt=sa(ue()($,(0,oe.Z)(m),{}));return e.createElement(e.Fragment,null,e.createElement(F.Box,null,e.createElement(z.Flex,{justifyContent:"space-between",alignItems:"center"},e.createElement(F.Box,{paddingRight:4},e.createElement(R.Typography,{variant:"sigma",textColor:"neutral600"},i)),e.createElement(ra,null),e.createElement(F.Box,{paddingLeft:4},e.createElement(so.Checkbox,{name:m.join(".."),disabled:s||Mn,onValueChange:function(we){ee({target:{name:m.join(".."),value:we}})},indeterminate:ve,value:Re},A({id:"app.utils.select-all",defaultMessage:"Select all"})))),e.createElement(z.Flex,{paddingTop:6,paddingBottom:6},e.createElement(ao.Grid,{gap:2,style:{flex:1}},Le.map(function(Ce){var we=Ce.checkboxName,ce=Ce.value,Te=Ce.action,xe=Ce.displayName,je=Ce.hasConditions;return e.createElement(ao.GridItem,{col:3,key:Te},e.createElement(ia,{disabled:s||Mn,hasConditions:je},e.createElement(so.Checkbox,{name:we,disabled:s||Mn,onValueChange:function(dt){w({target:{name:we,value:dt}})},value:ce},xe)))})),e.createElement(We,{hasConditions:vt,onClick:De}))),b&&e.createElement(Et,{headerBreadCrumbs:[n,i],actions:Le,isFormDisabled:s,onClosed:Be,onToggle:De}))};lo.propTypes={actions:r().array.isRequired,categoryName:r().string.isRequired,isFormDisabled:r().bool.isRequired,subCategoryName:r().string.isRequired,pathToData:r().array.isRequired};const la=lo,Ln=({childrenForm:o,kind:t,name:n,isOpen:s,isFormDisabled:i,isWhite:d,onOpenCategory:m,pathToData:g})=>{const{formatMessage:E}=(0,Y.useIntl)(),b=()=>{m(n)},S=(0,e.useMemo)(()=>n.split("::").pop(),[n]);return e.createElement(xn.Accordion,{expanded:s,onToggle:b,id:`accordion-${n}`,variant:d?"primary":"secondary"},e.createElement(xn.AccordionToggle,{title:W()(S),description:`${E({id:"Settings.permissions.category"},{category:S})} ${t==="plugins"?"plugin":t}`}),e.createElement(xn.AccordionContent,null,e.createElement(F.Box,{padding:6},o.map(({actions:L,subCategoryName:$,subCategoryId:ee})=>e.createElement(la,{key:$,actions:L,categoryName:S,isFormDisabled:i,subCategoryName:$,pathToData:[...g,ee]})))))};Ln.defaultProps={},Ln.propTypes={childrenForm:r().array.isRequired,isOpen:r().bool.isRequired,isFormDisabled:r().bool.isRequired,isWhite:r().bool.isRequired,kind:r().string.isRequired,name:r().string.isRequired,onOpenCategory:r().func.isRequired,pathToData:r().array.isRequired};const ca=Ln,co=({isFormDisabled:o,kind:t,layout:n})=>{const[s,i]=(0,e.useState)(null),d=m=>{i(m===s?null:m)};return e.createElement(F.Box,{padding:6,background:"neutral0"},n.map(({category:m,categoryId:g,childrenForm:E},b)=>e.createElement(ca,{key:m,childrenForm:E,kind:t,isFormDisabled:o,isOpen:s===m,isWhite:b%2===1,name:m,onOpenCategory:d,pathToData:[t,g]})))};co.propTypes={isFormDisabled:r().bool.isRequired,kind:r().string.isRequired,layout:r().arrayOf(r().shape({category:r().string.isRequired,categoryId:r().string.isRequired,childrenForm:r().arrayOf(r().shape({actions:r().array.isRequired})).isRequired}).isRequired).isRequired};const uo=co,po=(o,t,n)=>o.find(s=>s.action===t&&s.subject===n);var da=Object.defineProperty,ua=Object.defineProperties,pa=Object.getOwnPropertyDescriptors,mo=Object.getOwnPropertySymbols,ma=Object.prototype.hasOwnProperty,ga=Object.prototype.propertyIsEnumerable,go=(o,t,n)=>t in o?da(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,fo=(o,t)=>{for(var n in t||(t={}))ma.call(t,n)&&go(o,n,t[n]);if(mo)for(var n of mo(t))ga.call(t,n)&&go(o,n,t[n]);return o},ho=(o,t)=>ua(o,pa(t));const yo=(o,t=[])=>o.reduce((n,s)=>(n[s.id]=t.indexOf(s.id)!==-1,n),{}),vo=({children:o},t,n="")=>o.reduce((s,i)=>{if(i.children)return ho(fo({},s),{[i.value]:vo(i,t,`${n}${i.value}.`)});const d=t.indexOf(`${n}${i.value}`)!==-1;return s[i.value]=d,s},{}),fa=(o,t,n)=>o.reduce((s,i)=>{const d=t.properties.find(({value:m})=>m===i);if(d){const m=(0,f.get)(n,["properties",d.value],[]),g=vo(d,m);s.properties[i]=g}return s},{properties:{}}),ha=(o,t)=>t.reduce((n,s)=>{const i=o.find(({uid:d})=>d===s)||null;return i&&(n[s]=i),n},{}),Co=({subjects:o},t,n,s=[])=>t.reduce((i,d)=>{const m=d.subjects,g=ha(o,m);if((0,f.isEmpty)(g))return i;const E=Object.keys(g).reduce((b,S)=>{const{actionId:L,applyToProperties:$}=d,j=g[S].properties.map(({value:se})=>se).every(se=>($||[]).indexOf(se)===-1),A=po(s,L,S),I=yo(n,(0,f.get)(A,"conditions",[]));if((0,f.isEmpty)($)||j)return(0,f.set)(b,[S,L],{properties:{enabled:A!==void 0},conditions:I}),b;const X=fa($,g[S],A);return(0,f.set)(b,[S,L],ho(fo({},X),{conditions:I})),b},{});return(0,f.merge)(i,E)},{}),ya=(o,t,n)=>o.reduce((s,i)=>{const d=po(n,i.action,null);return s[i.action]={properties:{enabled:d!==void 0},conditions:yo(t,(0,f.get)(d,"conditions",[]))},s},{}),va=(o,t,n)=>o.reduce((s,i)=>(s[i.subCategoryId]=ya(i.actions,t,n),s),{}),Eo=(o,t,n=[])=>o.reduce((s,{categoryId:i,childrenForm:d})=>{const m=va(d,t,n);return s[i]=m,s},{}),bo=o=>o.split(" ").join("-"),So=(o,t)=>(0,f.chain)(o).groupBy(t).map((n,s)=>({category:s,categoryId:bo(s),childrenForm:(0,f.chain)(n).groupBy("subCategory").map((i,d)=>({subCategoryName:d,subCategoryId:bo(d),actions:i})).value()})).value(),Ca=(o,t)=>{const{conditions:n,sections:{collectionTypes:s,singleTypes:i,plugins:d,settings:m}}=o,g={collectionTypes:s,singleTypes:i,plugins:So(d,"plugin"),settings:So(m,"category")},E={collectionTypes:Co(s,s.actions||[],n,t),singleTypes:Co(i,i.actions||[],n,t),plugins:Eo(g.plugins,n,t),settings:Eo(g.settings,n,t)};return{initialData:E,modifiedData:E,layouts:g}};var Ea=Object.defineProperty,ba=Object.defineProperties,Sa=Object.getOwnPropertyDescriptors,Po=Object.getOwnPropertySymbols,Pa=Object.prototype.hasOwnProperty,Ta=Object.prototype.propertyIsEnumerable,To=(o,t,n)=>t in o?Ea(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,In=(o,t)=>{for(var n in t||(t={}))Pa.call(t,n)&&To(o,n,t[n]);if(Po)for(var n of Po(t))Ta.call(t,n)&&To(o,n,t[n]);return o},Fn=(o,t)=>ba(o,Sa(t));const Ao=o=>Object.keys(o).reduce((t,n)=>{const s=o[n];if((0,f.isObject)(s)&&!(0,f.has)(s,"conditions"))return Fn(In({},t),{[n]:Ao(s)});if((0,f.isObject)(s)&&(0,f.has)(s,"conditions")&&!mt((0,f.omit)(s,"conditions")).some(d=>d)){const d=Object.keys(s.conditions).reduce((m,g)=>(m[g]=!1,m),{});return Fn(In({},t),{[n]:Fn(In({},s),{conditions:d})})}return t[n]=s,t},{}),Bn=Ao;var Aa=Object.defineProperty,Oa=Object.defineProperties,Ra=Object.getOwnPropertyDescriptors,Oo=Object.getOwnPropertySymbols,Da=Object.prototype.hasOwnProperty,xa=Object.prototype.propertyIsEnumerable,Ro=(o,t,n)=>t in o?Aa(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Ma=(o,t)=>{for(var n in t||(t={}))Da.call(t,n)&&Ro(o,n,t[n]);if(Oo)for(var n of Oo(t))xa.call(t,n)&&Ro(o,n,t[n]);return o},La=(o,t)=>Oa(o,Ra(t));const Do=(o,t)=>Object.keys(o).reduce((n,s)=>{const i=o[s];return s==="conditions"?(n[s]=i,n):(0,f.isObject)(i)?La(Ma({},n),{[s]:Do(i,t)}):(n[s]=t,n)},{}),tn=Do;var Ia=Object.defineProperty,Fa=Object.defineProperties,Ba=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertySymbols,wa=Object.prototype.hasOwnProperty,ja=Object.prototype.propertyIsEnumerable,Mo=(o,t,n)=>t in o?Ia(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,Na=(o,t)=>{for(var n in t||(t={}))wa.call(t,n)&&Mo(o,n,t[n]);if(xo)for(var n of xo(t))ja.call(t,n)&&Mo(o,n,t[n]);return o},Wa=(o,t)=>Fa(o,Ba(t));const $a={initialData:{},modifiedData:{},layouts:{}},Ua=(o,t)=>(0,k.default)(o,n=>{switch(t.type){case"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX":{const{collectionTypeKind:s,actionId:i,value:d}=t,m=["modifiedData",s];Object.keys((0,f.get)(o,m)).forEach(g=>{const E=(0,f.get)(o,[...m,g,i],void 0);if(E){let b=tn(E,d);if(!d&&b.conditions){const S=tn(b.conditions,!1);b=Wa(Na({},b),{conditions:S})}(0,f.set)(n,[...m,g,i],b)}});break}case"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX":{const{pathToCollectionType:s,propertyName:i,rowName:d,value:m}=t;let g=(0,f.cloneDeep)(o.modifiedData);const E=s.split(".."),b=(0,f.get)(g,E,{});Object.keys(b).forEach(S=>{if((0,f.has)(b[S],`properties.${i}`)){const L=(0,f.get)(b,[S,"properties",i,d]),$=[...E,S,"properties",i,d];if(!(0,f.isObject)(L))(0,f.set)(g,$,m);else{const ee=tn(L,m);(0,f.set)(g,$,ee)}}}),m||(g=Bn(g)),(0,f.set)(n,"modifiedData",g);break}case"ON_CHANGE_CONDITIONS":{Object.entries(t.conditions).forEach(s=>{const[i,d]=s;(0,f.set)(n,["modifiedData",...i.split(".."),"conditions"],d)});break}case"ON_CHANGE_SIMPLE_CHECKBOX":{let s=(0,f.cloneDeep)(o.modifiedData);(0,f.set)(s,[...t.keys.split("..")],t.value),t.value||(s=Bn(s)),(0,f.set)(n,"modifiedData",s);break}case"ON_CHANGE_TOGGLE_PARENT_CHECKBOX":{const{keys:s,value:i}=t,d=[...s.split("..")];let m=(0,f.cloneDeep)(o.modifiedData);const g=(0,f.get)(m,d,{}),E=tn(g,i);(0,f.set)(m,d,E),i||(m=Bn(m)),(0,f.set)(n,["modifiedData"],m);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),ka=o=>{const[t,{conditions:n}]=o;return{action:t,subject:null,conditions:wn(n),properties:{}}},Va=o=>Object.values(o).reduce((t,n)=>{const s=Object.entries(n).reduce((i,d)=>{const[,{properties:{enabled:m}}]=d;if(!m)return i;const g=ka(d);return i.push(g),i},[]);return[...t,...s]},[]),Lo=o=>Object.values(o).reduce((t,n)=>{const s=Va(n);return[...t,...s]},[]),Io=(o,t="")=>Object.entries(o).reduce((n,s)=>{const[i,d]=s;return(0,f.isObject)(d)?[...n,...Io(d,`${t}${i}.`)]:(d&&!(0,f.isObject)(d)&&n.push(`${t}${i}`),n)},[]),Za=(o,t,{conditions:n,properties:s})=>Object.entries(s).reduce((i,d)=>{const[m,g]=d;return i.properties[m]=Io(g),i},{action:o,subject:t,conditions:wn(n),properties:{}}),Ga=(o,t,{conditions:n})=>({action:o,subject:t,properties:{},conditions:wn(n)}),za=(o,t)=>Object.entries(t).reduce((s,i)=>{const[d,m]=i;if(!mt(m).some(b=>b))return s;if(!(0,f.has)(m,"properties.enabled")){const b=Za(d,o,m);return[...s,b]}if(!m.properties.enabled)return s;const E=Ga(d,o,m);return s.push(E),s},[]),Fo=o=>Object.entries(o).reduce((n,s)=>{const[i,d]=s,m=za(i,d);return[...n,...m]},[]),Ka=o=>{const t=Lo(o.plugins),n=Lo(o.settings),s=Fo(o.collectionTypes),i=Fo(o.singleTypes);return[...t,...n,...s,...i]},Ha=[{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 Xa=Object.defineProperty,Bo=Object.getOwnPropertySymbols,Ya=Object.prototype.hasOwnProperty,Qa=Object.prototype.propertyIsEnumerable,wo=(o,t,n)=>t in o?Xa(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,jo=(o,t)=>{for(var n in t||(t={}))Ya.call(t,n)&&wo(o,n,t[n]);if(Bo)for(var n of Bo(t))Qa.call(t,n)&&wo(o,n,t[n]);return o};const jn=(0,e.forwardRef)(({layout:o,isFormDisabled:t,permissions:n},s)=>{const[{initialData:i,layouts:d,modifiedData:m},g]=(0,e.useReducer)(Ua,$a,()=>Ca(o,n)),{formatMessage:E}=(0,Y.useIntl)();(0,e.useImperativeHandle)(s,()=>({getPermissions(){const w=(0,ne.difference)(i.collectionTypes,m.collectionTypes),j=(0,ne.difference)(i.singleTypes,m.singleTypes),A=jo(jo({},w),j);let I;return Ne()(A)?I=!1:I=Object.values(A).some(X=>Object.values(X).some(se=>Ee()(se,"conditions"))),{permissionsToSend:Ka(m),didUpdateConditions:I}},resetForm(){g({type:"RESET_FORM"})},setFormAfterSubmit(){g({type:"SET_FORM_AFTER_SUBMIT"})}}));const b=(w,j,A,I)=>{g({type:"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX",pathToCollectionType:w,propertyName:j,rowName:A,value:I})},S=(w,j,A)=>{g({type:"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX",collectionTypeKind:w,actionId:j,value:A})},L=w=>{g({type:"ON_CHANGE_CONDITIONS",conditions:w})},$=(0,e.useCallback)(({target:{name:w,value:j}})=>{g({type:"ON_CHANGE_SIMPLE_CHECKBOX",keys:w,value:j})},[]),ee=(0,e.useCallback)(({target:{name:w,value:j}})=>{g({type:"ON_CHANGE_TOGGLE_PARENT_CHECKBOX",keys:w,value:j})},[]);return e.createElement(Qo,{value:{availableConditions:o.conditions,modifiedData:m,onChangeConditions:L,onChangeSimpleCheckbox:$,onChangeParentCheckbox:ee,onChangeCollectionTypeLeftActionRowCheckbox:b,onChangeCollectionTypeGlobalActionCheckbox:S}},e.createElement(V.TabGroup,{id:"tabs",label:E({id:"Settings.permissions.users.tabs.label",defaultMessage:"Tabs Permissions"})},e.createElement(V.Tabs,null,Ha.map(w=>e.createElement(V.Tab,{key:w.id},E({id:w.labelId,defaultMessage:w.defaultMessage})))),e.createElement(V.TabPanels,{style:{position:"relative"}},e.createElement(V.TabPanel,null,e.createElement(no,{layout:d.collectionTypes,kind:"collectionTypes",isFormDisabled:t})),e.createElement(V.TabPanel,null,e.createElement(no,{layout:d.singleTypes,kind:"singleTypes",isFormDisabled:t})),e.createElement(V.TabPanel,null,e.createElement(uo,{layout:d.plugins,kind:"plugins",isFormDisabled:t})),e.createElement(V.TabPanel,null,e.createElement(uo,{layout:d.settings,kind:"settings",isFormDisabled:t})))))});jn.defaultProps={permissions:[],layout:{conditions:[],sections:{collectionTypes:{},singleTypes:{actions:[]},settings:[],plugins:[]}}},jn.propTypes={layout:r().object,isFormDisabled:r().bool.isRequired,permissions:r().array};const Ja=(0,e.memo)(jn)},16437:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!0},78522:(ge,D,a)=>{a.d(D,{Z:()=>e});const e=()=>"todo empty role"},80779:(ge,D,a)=>{a.d(D,{Z:()=>He});var e=a(32735),C=a(60216),r=a.n(C),ne=a(9808),V=a.n(ne),Ie=a(19192),Ee=a.n(Ie),fe=a(53214),Ne=a.n(fe),Y=a(95602),F=a.n(Y),P=a(20763),Z=a.n(P),de=a(88425),U=a.n(de),te=a(5636),ze=Object.defineProperty,Ue=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,z=(re,J,ae)=>J in re?ze(re,J,{enumerable:!0,configurable:!0,writable:!0,value:ae}):re[J]=ae,y=(re,J)=>{for(var ae in J||(J={}))Ke.call(J,ae)&&z(re,ae,J[ae]);if(Ue)for(var ae of Ue(J))be.call(J,ae)&&z(re,ae,J[ae]);return re};const ue=({id:re,name:J,description:ae,usersCount:it,icons:Fe,rowIndex:Ye})=>{const{formatMessage:Qe}=(0,te.useIntl)(),We=Qe({id:"Roles.RoleRow.user-count",defaultMessage:"{number, plural, =0 {# user} one {# user} other {# users}}"},{number:it});return e.createElement(fe.Tr,y({"aria-rowindex":Ye,key:re},(0,de.onRowClick)({fn:Fe[1].onClick})),e.createElement(fe.Td,{maxWidth:(0,de.pxToRem)(130)},e.createElement(Y.Typography,{ellipsis:!0,textColor:"neutral800"},J)),e.createElement(fe.Td,{maxWidth:(0,de.pxToRem)(250)},e.createElement(Y.Typography,{ellipsis:!0,textColor:"neutral800"},ae)),e.createElement(fe.Td,null,e.createElement(Y.Typography,{textColor:"neutral800"},We)),e.createElement(fe.Td,null,e.createElement(Ie.Flex,y({justifyContent:"flex-end"},de.stopPropagation),Fe.map((Ae,ke)=>Ae?e.createElement(ne.Box,{key:Ae.label,paddingLeft:ke===0?0:1},e.createElement(P.IconButton,{onClick:Ae.onClick,label:Ae.label,noBorder:!0,icon:Ae.icon})):null))))};ue.propTypes={id:r().number.isRequired,name:r().string.isRequired,description:r().string.isRequired,usersCount:r().number.isRequired,icons:r().array.isRequired,rowIndex:r().number.isRequired};const He=ue},45677:(ge,D,a)=>{a.d(D,{Z:()=>qe});var e=a(32735),C=a(88425),r=a(83983),ne=a(58469),V=a(59290),Ie=a.n(V),Ee=a(76470),fe=a.n(Ee),Ne=a(95717),Y=a.n(Ne),F=a(68192),P=a.n(F),Z=a(44526),de=a(11856),U=a(53214),te=a(95602),ze=a(16540),Ue=a(28004),Ke=a(5636),be=a(5141),z=a(80779),y=a(78522),ue=a(60216),He=a.n(ue),re=a(19615),J=a(64410),ae=a(54742),it=a(20763),Fe=a(61541),Ye=a(9808),Qe=a(19192),We=a(90662),Ae=a(82372),ke=a.n(Ae),ie=a(94009),Je=a.n(ie);const R=a.p+"c3de6118ef47086ad05c.png",k=a.p+"bd81ba6c07827282255d.png",N=re.default.div`
134
134
  position: absolute;
135
135
  z-index: 3;
136
136
  inset: 0;
137
137
  background: ${({theme:B})=>(0,C.setHexOpacity)(B.colors.neutral800,.2)};
138
138
  padding: 0 ${({theme:B})=>B.spaces[8]};
139
- `,_=(0,re.default)(Ye.Flex)`
139
+ `,_=(0,re.default)(Qe.Flex)`
140
140
  position: relative;
141
141
  max-width: ${830/16}rem;
142
142
  height: ${415/16}rem;
@@ -158,15 +158,15 @@
158
158
  margin-right: ${20/16}rem;
159
159
  z-index: 0;
160
160
  }
161
- `,pe=(0,re.default)(Se.Stack)`
161
+ `,pe=(0,re.default)(We.Stack)`
162
162
  align-items: flex-start;
163
163
  max-width: ${400/16}rem;
164
164
  z-index: 0;
165
- `,W=(0,re.default)(Xe.Box)`
165
+ `,W=(0,re.default)(Ye.Box)`
166
166
  position: absolute;
167
167
  right: ${({theme:B})=>B.spaces[4]};
168
168
  top: ${({theme:B})=>B.spaces[4]};
169
- `,Q=({onClose:B,isOpen:K})=>{(0,C.useLockScroll)(K);const{formatMessage:H}=(0,ze.useIntl)();return K?e.createElement(J.Portal,null,e.createElement(N,{onClick:B},e.createElement(ae.FocusTrap,{onEscape:B},e.createElement(_,{onClick:f=>f.stopPropagation(),"aria-labelledby":"upgrade-plan",background:"neutral0",hasRadius:!0},e.createElement("img",{src:R,alt:"air-balloon"}),e.createElement(W,null,e.createElement(it.IconButton,{onClick:B,"aria-label":"Close",icon:e.createElement(Je(),null)})),e.createElement(pe,{spacing:6},e.createElement(te.Typography,{fontWeight:"bold",textColor:"primary600"},H({id:"app.components.UpgradePlanModal.text-ce",defaultMessage:"COMMUNITY EDITION"})),e.createElement(Se.Stack,{spacing:2},e.createElement(te.Typography,{variant:"alpha",as:"h2",id:"upgrade-plan"},H({id:"app.components.UpgradePlanModal.limit-reached",defaultMessage:"You have reached the limit"})),e.createElement(te.Typography,null,H({id:"app.components.UpgradePlanModal.text-power",defaultMessage:"Unlock the full power of Strapi by upgrading your plan to the Enterprise Edition"}))),e.createElement(Ie.LinkButton,{href:"https://strapi.io/pricing-self-hosted",isExternal:!0,endIcon:e.createElement(Qe(),null)},H({id:"app.components.UpgradePlanModal.button",defaultMessage:"Learn more"}))),e.createElement("img",{src:k,alt:"upgrade-arrow"}))))):null};Q.propTypes={onClose:Ke().func.isRequired,isOpen:Ke().bool.isRequired};const oe=Q;var G=a(775);const le=()=>{const{roles:B,isLoading:K}=(0,G.bF)(),H=(0,C.useQuery)(),f=decodeURIComponent(H.get("_q")||""),Fe=(0,ne.ZP)(B,f,{keys:["name","description"]});return{isLoading:K,sortedRoles:Fe}},xe=()=>{const{formatMessage:B}=(0,ze.useIntl)(),[K,H]=(0,e.useState)(!1),{trackUsage:f}=(0,C.useTracking)(),{push:Fe}=(0,be.useHistory)(),_e=(0,e.useCallback)(Pe=>{Fe(`/settings/roles/${Pe}`)},[Fe]),He=(0,e.useCallback)(()=>{H(Pe=>!Pe)},[]),q=(0,e.useCallback)(()=>{f("didShowRBACUpgradeModal"),H(!0)},[f]),he=(0,e.useCallback)(Pe=>[{onClick:He,label:B({id:"app.utils.duplicate",defaultMessage:"Duplicate"}),icon:e.createElement(P(),null)},{onClick:()=>_e(Pe.id),label:B({id:"app.utils.edit",defaultMessage:"Edit"}),icon:e.createElement(Y(),null)},{onClick:He,label:B({id:"global.delete",defaultMessage:"Delete"}),icon:e.createElement(fe(),null)}],[B,He,_e]);return{isModalOpen:K,handleToggleModalForCreatingRole:q,handleToggle:He,getIcons:he}},Ve=()=>{const{formatMessage:B}=(0,ze.useIntl)();(0,C.useFocusWhenNavigate)();const{sortedRoles:K,isLoading:H}=le(),{isModalOpen:f,handleToggle:Fe,handleToggleModalForCreatingRole:_e,getIcons:He}=xe(),q=K.length+1,he=5;return e.createElement(Ge.Main,null,e.createElement(C.SettingsPageTitle,{name:"Roles"}),e.createElement(de.HeaderLayout,{primaryAction:e.createElement(Z.Button,{onClick:_e,startIcon:e.createElement(Le(),null),size:"S"},B({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})),title:B({id:"global.roles",defaultMessage:"roles"}),subtitle:B({id:"Settings.roles.list.description",defaultMessage:"List of roles"})}),e.createElement(de.ContentLayout,null,e.createElement(U.Table,{colCount:he,rowCount:q,footer:e.createElement(U.TFooter,{onClick:_e,icon:e.createElement(Le(),null)},B({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"}))},e.createElement(U.Thead,null,e.createElement(U.Tr,null,e.createElement(U.Th,null,e.createElement(te.Typography,{variant:"sigma",textColor:"neutral600"},B({id:"global.name",defaultMessage:"Name"}))),e.createElement(U.Th,null,e.createElement(te.Typography,{variant:"sigma",textColor:"neutral600"},B({id:"global.description",defaultMessage:"Description"}))),e.createElement(U.Th,null,e.createElement(te.Typography,{variant:"sigma",textColor:"neutral600"},B({id:"global.users",defaultMessage:"Users"}))),e.createElement(U.Th,null,e.createElement($e.VisuallyHidden,null,B({id:"global.actions",defaultMessage:"Actions"}))))),e.createElement(U.Tbody,null,K==null?void 0:K.map(Pe=>e.createElement(z.Z,{key:Pe.id,id:Pe.id,name:Pe.name,description:Pe.description,usersCount:Pe.usersCount,icons:He(Pe)})))),!q&&!H&&e.createElement(y.Z,null)),e.createElement(oe,{isOpen:f,onClose:Fe}))},qe=()=>e.createElement(C.CheckPagePermissions,{permissions:r.Z.settings.roles.main},e.createElement(Ve,null))},75936:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=[]},20178:(ge,D,a)=>{a.d(D,{Z:()=>Qe});var e=a(32735),C=a(64213),r=a(88425),ne=a(9808),V=a(44526),Le=a(11856),Ee=a(78330),fe=a(16540),Ne=a(19192),Y=a(90662),F=a(95602),P=a(37178),Z=a(90353),de=a(98599),U=a.n(de),te=a(83281),Ge=a(33795),$e=a.n(Ge),ze=a(86834),be=a.n(ze),z=a(5636),y=a(5141),ue=a(19615),Ke=a(25793),re=a(775),J=a(83983),ae=a(5173);const Ie=ae.Ry().shape({name:ae.Z_().required(r.translatedErrors.required),description:ae.Z_().required(r.translatedErrors.required)});var Xe=a(98399),Ye=(ie,Je,R)=>new Promise((k,N)=>{var _=Q=>{try{W(R.next(Q))}catch(oe){N(oe)}},pe=Q=>{try{W(R.throw(Q))}catch(oe){N(oe)}},W=Q=>Q.done?k(Q.value):Promise.resolve(Q.value).then(_,pe);W((R=R.apply(ie,Je)).next())});const Se=ue.default.div`
169
+ `,Q=({onClose:B,isOpen:K})=>{(0,C.useLockScroll)(K);const{formatMessage:H}=(0,Ke.useIntl)();return K?e.createElement(J.Portal,null,e.createElement(N,{onClick:B},e.createElement(ae.FocusTrap,{onEscape:B},e.createElement(_,{onClick:f=>f.stopPropagation(),"aria-labelledby":"upgrade-plan",background:"neutral0",hasRadius:!0},e.createElement("img",{src:R,alt:"air-balloon"}),e.createElement(W,null,e.createElement(it.IconButton,{onClick:B,"aria-label":"Close",icon:e.createElement(Je(),null)})),e.createElement(pe,{spacing:6},e.createElement(te.Typography,{fontWeight:"bold",textColor:"primary600"},H({id:"app.components.UpgradePlanModal.text-ce",defaultMessage:"COMMUNITY EDITION"})),e.createElement(We.Stack,{spacing:2},e.createElement(te.Typography,{variant:"alpha",as:"h2",id:"upgrade-plan"},H({id:"app.components.UpgradePlanModal.limit-reached",defaultMessage:"You have reached the limit"})),e.createElement(te.Typography,null,H({id:"app.components.UpgradePlanModal.text-power",defaultMessage:"Unlock the full power of Strapi by upgrading your plan to the Enterprise Edition"}))),e.createElement(Fe.LinkButton,{href:"https://strapi.io/pricing-self-hosted",isExternal:!0,endIcon:e.createElement(ke(),null)},H({id:"app.components.UpgradePlanModal.button",defaultMessage:"Learn more"}))),e.createElement("img",{src:k,alt:"upgrade-arrow"}))))):null};Q.propTypes={onClose:He().func.isRequired,isOpen:He().bool.isRequired};const oe=Q;var G=a(775);const le=()=>{const{roles:B,isLoading:K}=(0,G.bF)(),H=(0,C.useQuery)(),f=decodeURIComponent(H.get("_q")||""),Oe=(0,ne.ZP)(B,f,{keys:["name","description"]});return{isLoading:K,sortedRoles:Oe}},Me=()=>{const{formatMessage:B}=(0,Ke.useIntl)(),[K,H]=(0,e.useState)(!1),{trackUsage:f}=(0,C.useTracking)(),{push:Oe}=(0,be.useHistory)(),_e=(0,e.useCallback)(Se=>{Oe(`/settings/roles/${Se}`)},[Oe]),Xe=(0,e.useCallback)(()=>{H(Se=>!Se)},[]),q=(0,e.useCallback)(()=>{f("didShowRBACUpgradeModal"),H(!0)},[f]),he=(0,e.useCallback)(Se=>[{onClick:Xe,label:B({id:"app.utils.duplicate",defaultMessage:"Duplicate"}),icon:e.createElement(P(),null)},{onClick:()=>_e(Se.id),label:B({id:"app.utils.edit",defaultMessage:"Edit"}),icon:e.createElement(Y(),null)},{onClick:Xe,label:B({id:"global.delete",defaultMessage:"Delete"}),icon:e.createElement(fe(),null)}],[B,Xe,_e]);return{isModalOpen:K,handleToggleModalForCreatingRole:q,handleToggle:Xe,getIcons:he}},Ze=()=>{const{formatMessage:B}=(0,Ke.useIntl)();(0,C.useFocusWhenNavigate)();const{sortedRoles:K,isLoading:H}=le(),{isModalOpen:f,handleToggle:Oe,handleToggleModalForCreatingRole:_e,getIcons:Xe}=Me(),q=K.length+1,he=5;return e.createElement(ze.Main,null,e.createElement(C.SettingsPageTitle,{name:"Roles"}),e.createElement(de.HeaderLayout,{primaryAction:e.createElement(Z.Button,{onClick:_e,startIcon:e.createElement(Ie(),null),size:"S"},B({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})),title:B({id:"global.roles",defaultMessage:"roles"}),subtitle:B({id:"Settings.roles.list.description",defaultMessage:"List of roles"})}),e.createElement(de.ContentLayout,null,e.createElement(U.Table,{colCount:he,rowCount:q,footer:e.createElement(U.TFooter,{onClick:_e,icon:e.createElement(Ie(),null)},B({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"}))},e.createElement(U.Thead,null,e.createElement(U.Tr,null,e.createElement(U.Th,null,e.createElement(te.Typography,{variant:"sigma",textColor:"neutral600"},B({id:"global.name",defaultMessage:"Name"}))),e.createElement(U.Th,null,e.createElement(te.Typography,{variant:"sigma",textColor:"neutral600"},B({id:"global.description",defaultMessage:"Description"}))),e.createElement(U.Th,null,e.createElement(te.Typography,{variant:"sigma",textColor:"neutral600"},B({id:"global.users",defaultMessage:"Users"}))),e.createElement(U.Th,null,e.createElement(Ue.VisuallyHidden,null,B({id:"global.actions",defaultMessage:"Actions"}))))),e.createElement(U.Tbody,null,K==null?void 0:K.map((Se,Tt)=>e.createElement(z.Z,{key:Se.id,id:Se.id,name:Se.name,description:Se.description,usersCount:Se.usersCount,icons:Xe(Se),rowIndex:Tt+2})))),!q&&!H&&e.createElement(y.Z,null)),e.createElement(oe,{isOpen:f,onClose:Oe}))},qe=()=>e.createElement(C.CheckPagePermissions,{permissions:r.Z.settings.roles.main},e.createElement(Ze,null))},75936:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=[]},20178:(ge,D,a)=>{a.d(D,{Z:()=>ke});var e=a(32735),C=a(64213),r=a(88425),ne=a(9808),V=a(44526),Ie=a(11856),Ee=a(78330),fe=a(16540),Ne=a(19192),Y=a(90662),F=a(95602),P=a(37178),Z=a(90353),de=a(98599),U=a.n(de),te=a(83281),ze=a(33795),Ue=a.n(ze),Ke=a(86834),be=a.n(Ke),z=a(5636),y=a(5141),ue=a(19615),He=a(25793),re=a(775),J=a(83983),ae=a(5173);const Fe=ae.Ry().shape({name:ae.Z_().required(r.translatedErrors.required),description:ae.Z_().required(r.translatedErrors.required)});var Ye=a(98399),Qe=(ie,Je,R)=>new Promise((k,N)=>{var _=Q=>{try{W(R.next(Q))}catch(oe){N(oe)}},pe=Q=>{try{W(R.throw(Q))}catch(oe){N(oe)}},W=Q=>Q.done?k(Q.value):Promise.resolve(Q.value).then(_,pe);W((R=R.apply(ie,Je)).next())});const We=ue.default.div`
170
170
  border: 1px solid ${({theme:ie})=>ie.colors.primary200};
171
171
  background: ${({theme:ie})=>ie.colors.primary100};
172
172
  padding: ${({theme:ie})=>`${ie.spaces[2]} ${ie.spaces[4]}`};
@@ -174,5 +174,5 @@
174
174
  border-radius: ${({theme:ie})=>ie.borderRadius};
175
175
  font-size: ${12/16}rem;
176
176
  font-weight: bold;
177
- `,Ue=()=>{const ie=(0,r.useNotification)(),{lockApp:Je,unlockApp:R}=(0,r.useOverlayBlocker)(),{formatMessage:k}=(0,z.useIntl)(),[N,_]=(0,e.useState)(!1),{replace:pe}=(0,y.useHistory)(),W=(0,e.useRef)(),{trackUsage:Q}=(0,r.useTracking)(),oe=(0,y.useRouteMatch)("/settings/roles/duplicate/:id"),G=$e()(oe,"params.id",null),{isLoading:le,data:xe}=(0,re.U_)(),{permissions:ke,isLoading:Ve}=(0,re.Dq)(G),st=B=>{Je(),_(!0),Q(G?"willDuplicateRole":"willCreateNewRole"),Promise.resolve((0,r.request)("/admin/roles",{method:"POST",body:B})).then(K=>Ye(void 0,null,function*(){const{permissionsToSend:H}=W.current.getPermissions();return Q(G?"didDuplicateRole":"didCreateNewRole"),K.data.id&&!be()(H)&&(yield(0,r.request)(`/admin/roles/${K.data.id}/permissions`,{method:"PUT",body:{permissions:H}})),K})).then(K=>{_(!1),ie({type:"success",message:{id:"Settings.roles.created",defaultMessage:"created"}}),pe(`/settings/roles/${K.data.id}`)}).catch(K=>{Xe.error(K),_(!1),ie({type:"warning",message:{id:"notification.error"}})}).finally(()=>{R()})},qe=`${k({id:"Settings.roles.form.created",defaultMessage:"Created"})} ${(0,C.format)(new Date,"PPP")}`;return e.createElement(fe.Main,null,e.createElement(r.SettingsPageTitle,{name:"Roles"}),e.createElement(te.Formik,{initialValues:{name:"",description:qe},onSubmit:st,validationSchema:Ie,validateOnChange:!1},({handleSubmit:B,values:K,errors:H,handleReset:f,handleChange:Fe})=>e.createElement(r.Form,{noValidate:!0},e.createElement(e.Fragment,null,e.createElement(Le.HeaderLayout,{primaryAction:e.createElement(Y.Stack,{horizontal:!0,spacing:2},e.createElement(V.Button,{variant:"secondary",onClick:()=>{f(),W.current.resetForm()},size:"L"},k({id:"app.components.Button.reset",defaultMessage:"Reset"})),e.createElement(V.Button,{onClick:B,loading:N,size:"L"},k({id:"global.save",defaultMessage:"Save"}))),title:k({id:"Settings.roles.create.title",defaultMessage:"Create a role"}),subtitle:k({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(r.Link,{startIcon:e.createElement(U(),null),to:"/settings/roles"},k({id:"global.back",defaultMessage:"Back"}))}),e.createElement(Le.ContentLayout,null,e.createElement(Y.Stack,{spacing:6},e.createElement(ne.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(Y.Stack,{spacing:4},e.createElement(Ne.Flex,{justifyContent:"space-between"},e.createElement(ne.Box,null,e.createElement(ne.Box,null,e.createElement(F.Typography,{fontWeight:"bold"},k({id:"global.details",defaultMessage:"Details"}))),e.createElement(ne.Box,null,e.createElement(F.Typography,{variant:"pi",textColor:"neutral600"},k({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(Se,null,k({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:0}))),e.createElement(Ee.Grid,{gap:4},e.createElement(Ee.GridItem,{col:6},e.createElement(P.TextInput,{name:"name",error:H.name&&k({id:H.name}),label:k({id:"global.name",defaultMessage:"Name"}),onChange:Fe,value:K.name})),e.createElement(Ee.GridItem,{col:6},e.createElement(Z.Textarea,{label:k({id:"global.description",defaultMessage:"Description"}),name:"description",error:H.description&&k({id:H.description}),onChange:Fe},K.description))))),!le&&!Ve?e.createElement(ne.Box,{shadow:"filterShadow",hasRadius:!0},e.createElement(Ke.Z,{isFormDisabled:!1,ref:W,permissions:ke,layout:xe})):e.createElement(ne.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(r.LoadingIndicatorPage,null))))))))};function Qe(){return e.createElement(r.CheckPagePermissions,{permissions:J.Z.settings.roles.create},e.createElement(Ue,null))}},56899:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},68464:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},32741:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},19665:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},36950:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},96556:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},51899:(ge,D,a)=>{a.d(D,{Z:()=>Je});var e=a(32735),C=a(88425),r=a(83983),ne=a(59290),V=a.n(ne),Le=a(76470),Ee=a.n(Le),fe=a(68192),Ne=a.n(fe),Y=a(95717),F=a.n(Y),P=a(44526),Z=a(11856),de=a(28004),U=a(16540),te=a(53214),Ge=a(95602),$e=a(92891),ze=a(58469),be=a(5636),z=a(5141),y=a(17247),ue=a(775),Ke=a(78522),re=a(80779),J=a(49415);const ae={roleToDelete:null,showModalConfirmButtonLoading:!1,shouldRefetchData:!1},Ie=(R,k)=>(0,J.default)(R,N=>{switch(k.type){case"ON_REMOVE_ROLES":{N.showModalConfirmButtonLoading=!0;break}case"ON_REMOVE_ROLES_SUCCEEDED":{N.shouldRefetchData=!0,N.roleToDelete=null;break}case"RESET_DATA_TO_DELETE":{N.shouldRefetchData=!1,N.roleToDelete=null,N.showModalConfirmButtonLoading=!1;break}case"SET_ROLE_TO_DELETE":{N.roleToDelete=k.id;break}default:return N}});var Xe=(R,k,N)=>new Promise((_,pe)=>{var W=G=>{try{oe(N.next(G))}catch(le){pe(le)}},Q=G=>{try{oe(N.throw(G))}catch(le){pe(le)}},oe=G=>G.done?_(G.value):Promise.resolve(G.value).then(W,Q);oe((N=N.apply(R,k)).next())});const Ye=()=>{(0,C.useFocusWhenNavigate)();const{isLoading:R,allowedActions:{canCreate:k,canDelete:N,canRead:_,canUpdate:pe}}=(0,C.useRBAC)(r.Z.settings.roles),{getData:W,roles:Q,isLoading:oe}=(0,ue.bF)(!1),[{query:G}]=(0,C.useQueryParams)(),le=(G==null?void 0:G._q)||"",xe=(0,ze.ZP)(Q,le,{keys:["name","description"]});return(0,e.useEffect)(()=>{!R&&_&&W()},[R,_,W]),{isLoadingForPermissions:R,canCreate:k,canDelete:N,canRead:_,canUpdate:pe,isLoading:oe,getData:W,sortedRoles:xe,roles:Q}},Se=({getData:R,canCreate:k,canDelete:N,canUpdate:_})=>{const{formatMessage:pe}=(0,be.useIntl)(),W=(0,C.useNotification)(),[Q,oe]=(0,e.useState)(!1),{push:G}=(0,z.useHistory)(),[{selectedRoles:le,showModalConfirmButtonLoading:xe,roleToDelete:ke},Ve]=(0,e.useReducer)(Ie,ae),st=()=>Xe(void 0,null,function*(){try{Ve({type:"ON_REMOVE_ROLES"}),yield y.be.post("/admin/roles/batch-delete",{ids:[ke]}),yield R(),Ve({type:"RESET_DATA_TO_DELETE"})}catch(q){const he=(0,$e.get)(q,["response","payload","data","ids"],null);if(he&&Array.isArray(he)){const Pe=he.join(`
178
- `);W({type:"warning",message:Pe})}else W({type:"warning",message:{id:"notification.error"}})}H()}),qe=(0,e.useCallback)(q=>{G(`/settings/roles/duplicate/${q}`)},[G]),B=()=>G("/settings/roles/new"),K=(0,e.useCallback)(q=>{Ve({type:"SET_ROLE_TO_DELETE",id:q}),H()},[]),H=()=>oe(q=>!q),f=(0,e.useCallback)(q=>{G(`/settings/roles/${q}`)},[G]),Fe=(0,e.useCallback)((q,he)=>{q.preventDefault(),q.stopPropagation(),he.usersCount?W({type:"info",message:{id:"Roles.ListPage.notification.delete-not-allowed"}}):K(he.id)},[W,K]),_e=(0,e.useCallback)((q,he)=>{q.preventDefault(),q.stopPropagation(),qe(he.id)},[qe]),He=(0,e.useCallback)(q=>[...k?[{onClick:he=>_e(he,q),label:pe({id:"app.utils.duplicate",defaultMessage:"Duplicate"}),icon:e.createElement(Ne(),null)}]:[],..._?[{onClick:()=>f(q.id),label:pe({id:"app.utils.edit",defaultMessage:"Edit"}),icon:e.createElement(F(),null)}]:[],...N?[{onClick:he=>Fe(he,q),label:pe({id:"global.delete",defaultMessage:"Delete"}),icon:e.createElement(Ee(),null)}]:[]],[pe,Fe,_e,f,k,_,N]);return{handleNewRoleClick:B,getIcons:He,selectedRoles:le,isWarningDeleteAllOpened:Q,showModalConfirmButtonLoading:xe,handleToggleModal:H,handleDeleteData:st}},Qe=()=>{const{formatMessage:R}=(0,be.useIntl)(),{isLoadingForPermissions:k,canCreate:N,canRead:_,canDelete:pe,canUpdate:W,isLoading:Q,getData:oe,sortedRoles:G}=Ye(),{handleNewRoleClick:le,getIcons:xe,isWarningDeleteAllOpened:ke,showModalConfirmButtonLoading:Ve,handleToggleModal:st,handleDeleteData:qe}=Se({getData:oe,canCreate:N,canDelete:pe,canUpdate:W}),B=G.length+1,K=6;if(k)return e.createElement(U.Main,null,e.createElement(C.LoadingIndicatorPage,null));const H=R({id:"global.roles",defaultMessage:"roles"});return e.createElement(U.Main,null,e.createElement(C.SettingsPageTitle,{name:"Roles"}),e.createElement(Z.HeaderLayout,{primaryAction:N?e.createElement(P.Button,{onClick:le,startIcon:e.createElement(V(),null),size:"S"},R({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})):null,title:H,subtitle:R({id:"Settings.roles.list.description",defaultMessage:"List of roles"}),as:"h2"}),_&&e.createElement(Z.ActionLayout,{startActions:e.createElement(C.SearchURLQuery,{label:R({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:H})})}),_&&e.createElement(Z.ContentLayout,null,e.createElement(te.Table,{colCount:K,rowCount:B,footer:N?e.createElement(te.TFooter,{onClick:le,icon:e.createElement(V(),null)},R({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})):null},e.createElement(te.Thead,null,e.createElement(te.Tr,null,e.createElement(te.Th,null,e.createElement(Ge.Typography,{variant:"sigma",textColor:"neutral600"},R({id:"global.name",defaultMessage:"Name"}))),e.createElement(te.Th,null,e.createElement(Ge.Typography,{variant:"sigma",textColor:"neutral600"},R({id:"global.description",defaultMessage:"Description"}))),e.createElement(te.Th,null,e.createElement(Ge.Typography,{variant:"sigma",textColor:"neutral600"},R({id:"global.users",defaultMessage:"Users"}))),e.createElement(te.Th,null,e.createElement(de.VisuallyHidden,null,R({id:"global.actions",defaultMessage:"Actions"}))))),e.createElement(te.Tbody,null,G==null?void 0:G.map(f=>e.createElement(re.Z,{key:f.id,id:f.id,name:f.name,description:f.description,usersCount:f.usersCount,icons:xe(f)})))),!B&&!Q&&e.createElement(Ke.Z,null)),e.createElement(C.ConfirmDialog,{isOpen:ke,onConfirm:qe,isConfirmButtonLoading:Ve,onToggleDialog:st}))},Je=()=>e.createElement(C.CheckPagePermissions,{permissions:r.Z.settings.roles.main},e.createElement(Qe,null))},63775:(ge,D,a)=>{a.d(D,{Z:()=>ne});var e=(V,Le,Ee)=>new Promise((fe,Ne)=>{var Y=Z=>{try{P(Ee.next(Z))}catch(de){Ne(de)}},F=Z=>{try{P(Ee.throw(Z))}catch(de){Ne(de)}},P=Z=>Z.done?fe(Z.value):Promise.resolve(Z.value).then(Y,F);P((Ee=Ee.apply(V,Le)).next())});const ne=[...strapi.features.isEnabled(strapi.features.SSO)?[{Component(){return e(this,null,function*(){return yield a.e(302).then(a.bind(a,49851))})},to:"/settings/single-sign-on",exact:!0}]:[]]}}]);
177
+ `,Ae=()=>{const ie=(0,r.useNotification)(),{lockApp:Je,unlockApp:R}=(0,r.useOverlayBlocker)(),{formatMessage:k}=(0,z.useIntl)(),[N,_]=(0,e.useState)(!1),{replace:pe}=(0,y.useHistory)(),W=(0,e.useRef)(),{trackUsage:Q}=(0,r.useTracking)(),oe=(0,y.useRouteMatch)("/settings/roles/duplicate/:id"),G=Ue()(oe,"params.id",null),{isLoading:le,data:Me}=(0,re.U_)(),{permissions:Ve,isLoading:Ze}=(0,re.Dq)(G),st=B=>{Je(),_(!0),Q(G?"willDuplicateRole":"willCreateNewRole"),Promise.resolve((0,r.request)("/admin/roles",{method:"POST",body:B})).then(K=>Qe(void 0,null,function*(){const{permissionsToSend:H}=W.current.getPermissions();return Q(G?"didDuplicateRole":"didCreateNewRole"),K.data.id&&!be()(H)&&(yield(0,r.request)(`/admin/roles/${K.data.id}/permissions`,{method:"PUT",body:{permissions:H}})),K})).then(K=>{_(!1),ie({type:"success",message:{id:"Settings.roles.created",defaultMessage:"created"}}),pe(`/settings/roles/${K.data.id}`)}).catch(K=>{Ye.error(K),_(!1),ie({type:"warning",message:{id:"notification.error"}})}).finally(()=>{R()})},qe=`${k({id:"Settings.roles.form.created",defaultMessage:"Created"})} ${(0,C.format)(new Date,"PPP")}`;return e.createElement(fe.Main,null,e.createElement(r.SettingsPageTitle,{name:"Roles"}),e.createElement(te.Formik,{initialValues:{name:"",description:qe},onSubmit:st,validationSchema:Fe,validateOnChange:!1},({handleSubmit:B,values:K,errors:H,handleReset:f,handleChange:Oe})=>e.createElement(r.Form,{noValidate:!0},e.createElement(e.Fragment,null,e.createElement(Ie.HeaderLayout,{primaryAction:e.createElement(Y.Stack,{horizontal:!0,spacing:2},e.createElement(V.Button,{variant:"secondary",onClick:()=>{f(),W.current.resetForm()},size:"L"},k({id:"app.components.Button.reset",defaultMessage:"Reset"})),e.createElement(V.Button,{onClick:B,loading:N,size:"L"},k({id:"global.save",defaultMessage:"Save"}))),title:k({id:"Settings.roles.create.title",defaultMessage:"Create a role"}),subtitle:k({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(r.Link,{startIcon:e.createElement(U(),null),to:"/settings/roles"},k({id:"global.back",defaultMessage:"Back"}))}),e.createElement(Ie.ContentLayout,null,e.createElement(Y.Stack,{spacing:6},e.createElement(ne.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(Y.Stack,{spacing:4},e.createElement(Ne.Flex,{justifyContent:"space-between"},e.createElement(ne.Box,null,e.createElement(ne.Box,null,e.createElement(F.Typography,{fontWeight:"bold"},k({id:"global.details",defaultMessage:"Details"}))),e.createElement(ne.Box,null,e.createElement(F.Typography,{variant:"pi",textColor:"neutral600"},k({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(We,null,k({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:0}))),e.createElement(Ee.Grid,{gap:4},e.createElement(Ee.GridItem,{col:6},e.createElement(P.TextInput,{name:"name",error:H.name&&k({id:H.name}),label:k({id:"global.name",defaultMessage:"Name"}),onChange:Oe,value:K.name})),e.createElement(Ee.GridItem,{col:6},e.createElement(Z.Textarea,{label:k({id:"global.description",defaultMessage:"Description"}),name:"description",error:H.description&&k({id:H.description}),onChange:Oe},K.description))))),!le&&!Ze?e.createElement(ne.Box,{shadow:"filterShadow",hasRadius:!0},e.createElement(He.Z,{isFormDisabled:!1,ref:W,permissions:Ve,layout:Me})):e.createElement(ne.Box,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(r.LoadingIndicatorPage,null))))))))};function ke(){return e.createElement(r.CheckPagePermissions,{permissions:J.Z.settings.roles.create},e.createElement(Ae,null))}},56899:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},68464:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},32741:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},19665:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},36950:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},96556:(ge,D,a)=>{a.d(D,{Z:()=>C});const C=!1},51899:(ge,D,a)=>{a.d(D,{Z:()=>Je});var e=a(32735),C=a(88425),r=a(83983),ne=a(59290),V=a.n(ne),Ie=a(76470),Ee=a.n(Ie),fe=a(68192),Ne=a.n(fe),Y=a(95717),F=a.n(Y),P=a(44526),Z=a(11856),de=a(28004),U=a(16540),te=a(53214),ze=a(95602),Ue=a(92891),Ke=a(58469),be=a(5636),z=a(5141),y=a(17247),ue=a(775),He=a(78522),re=a(80779),J=a(49415);const ae={roleToDelete:null,showModalConfirmButtonLoading:!1,shouldRefetchData:!1},Fe=(R,k)=>(0,J.default)(R,N=>{switch(k.type){case"ON_REMOVE_ROLES":{N.showModalConfirmButtonLoading=!0;break}case"ON_REMOVE_ROLES_SUCCEEDED":{N.shouldRefetchData=!0,N.roleToDelete=null;break}case"RESET_DATA_TO_DELETE":{N.shouldRefetchData=!1,N.roleToDelete=null,N.showModalConfirmButtonLoading=!1;break}case"SET_ROLE_TO_DELETE":{N.roleToDelete=k.id;break}default:return N}});var Ye=(R,k,N)=>new Promise((_,pe)=>{var W=G=>{try{oe(N.next(G))}catch(le){pe(le)}},Q=G=>{try{oe(N.throw(G))}catch(le){pe(le)}},oe=G=>G.done?_(G.value):Promise.resolve(G.value).then(W,Q);oe((N=N.apply(R,k)).next())});const Qe=()=>{(0,C.useFocusWhenNavigate)();const{isLoading:R,allowedActions:{canCreate:k,canDelete:N,canRead:_,canUpdate:pe}}=(0,C.useRBAC)(r.Z.settings.roles),{getData:W,roles:Q,isLoading:oe}=(0,ue.bF)(!1),[{query:G}]=(0,C.useQueryParams)(),le=(G==null?void 0:G._q)||"",Me=(0,Ke.ZP)(Q,le,{keys:["name","description"]});return(0,e.useEffect)(()=>{!R&&_&&W()},[R,_,W]),{isLoadingForPermissions:R,canCreate:k,canDelete:N,canRead:_,canUpdate:pe,isLoading:oe,getData:W,sortedRoles:Me,roles:Q}},We=({getData:R,canCreate:k,canDelete:N,canUpdate:_})=>{const{formatMessage:pe}=(0,be.useIntl)(),W=(0,C.useNotification)(),[Q,oe]=(0,e.useState)(!1),{push:G}=(0,z.useHistory)(),[{selectedRoles:le,showModalConfirmButtonLoading:Me,roleToDelete:Ve},Ze]=(0,e.useReducer)(Fe,ae),st=()=>Ye(void 0,null,function*(){try{Ze({type:"ON_REMOVE_ROLES"}),yield y.be.post("/admin/roles/batch-delete",{ids:[Ve]}),yield R(),Ze({type:"RESET_DATA_TO_DELETE"})}catch(q){const he=(0,Ue.get)(q,["response","payload","data","ids"],null);if(he&&Array.isArray(he)){const Se=he.join(`
178
+ `);W({type:"warning",message:Se})}else W({type:"warning",message:{id:"notification.error"}})}H()}),qe=(0,e.useCallback)(q=>{G(`/settings/roles/duplicate/${q}`)},[G]),B=()=>G("/settings/roles/new"),K=(0,e.useCallback)(q=>{Ze({type:"SET_ROLE_TO_DELETE",id:q}),H()},[]),H=()=>oe(q=>!q),f=(0,e.useCallback)(q=>{G(`/settings/roles/${q}`)},[G]),Oe=(0,e.useCallback)((q,he)=>{q.preventDefault(),q.stopPropagation(),he.usersCount?W({type:"info",message:{id:"Roles.ListPage.notification.delete-not-allowed"}}):K(he.id)},[W,K]),_e=(0,e.useCallback)((q,he)=>{q.preventDefault(),q.stopPropagation(),qe(he.id)},[qe]),Xe=(0,e.useCallback)(q=>[...k?[{onClick:he=>_e(he,q),label:pe({id:"app.utils.duplicate",defaultMessage:"Duplicate"}),icon:e.createElement(Ne(),null)}]:[],..._?[{onClick:()=>f(q.id),label:pe({id:"app.utils.edit",defaultMessage:"Edit"}),icon:e.createElement(F(),null)}]:[],...N?[{onClick:he=>Oe(he,q),label:pe({id:"global.delete",defaultMessage:"Delete"}),icon:e.createElement(Ee(),null)}]:[]],[pe,Oe,_e,f,k,_,N]);return{handleNewRoleClick:B,getIcons:Xe,selectedRoles:le,isWarningDeleteAllOpened:Q,showModalConfirmButtonLoading:Me,handleToggleModal:H,handleDeleteData:st}},ke=()=>{const{formatMessage:R}=(0,be.useIntl)(),{isLoadingForPermissions:k,canCreate:N,canRead:_,canDelete:pe,canUpdate:W,isLoading:Q,getData:oe,sortedRoles:G}=Qe(),{handleNewRoleClick:le,getIcons:Me,isWarningDeleteAllOpened:Ve,showModalConfirmButtonLoading:Ze,handleToggleModal:st,handleDeleteData:qe}=We({getData:oe,canCreate:N,canDelete:pe,canUpdate:W}),B=G.length+1,K=6;if(k)return e.createElement(U.Main,null,e.createElement(C.LoadingIndicatorPage,null));const H=R({id:"global.roles",defaultMessage:"roles"});return e.createElement(U.Main,null,e.createElement(C.SettingsPageTitle,{name:"Roles"}),e.createElement(Z.HeaderLayout,{primaryAction:N?e.createElement(P.Button,{onClick:le,startIcon:e.createElement(V(),null),size:"S"},R({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})):null,title:H,subtitle:R({id:"Settings.roles.list.description",defaultMessage:"List of roles"}),as:"h2"}),_&&e.createElement(Z.ActionLayout,{startActions:e.createElement(C.SearchURLQuery,{label:R({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:H})})}),_&&e.createElement(Z.ContentLayout,null,e.createElement(te.Table,{colCount:K,rowCount:B,footer:N?e.createElement(te.TFooter,{onClick:le,icon:e.createElement(V(),null)},R({id:"Settings.roles.list.button.add",defaultMessage:"Add new role"})):null},e.createElement(te.Thead,null,e.createElement(te.Tr,{"aria-rowindex":1},e.createElement(te.Th,null,e.createElement(ze.Typography,{variant:"sigma",textColor:"neutral600"},R({id:"global.name",defaultMessage:"Name"}))),e.createElement(te.Th,null,e.createElement(ze.Typography,{variant:"sigma",textColor:"neutral600"},R({id:"global.description",defaultMessage:"Description"}))),e.createElement(te.Th,null,e.createElement(ze.Typography,{variant:"sigma",textColor:"neutral600"},R({id:"global.users",defaultMessage:"Users"}))),e.createElement(te.Th,null,e.createElement(de.VisuallyHidden,null,R({id:"global.actions",defaultMessage:"Actions"}))))),e.createElement(te.Tbody,null,G==null?void 0:G.map((f,Oe)=>e.createElement(re.Z,{key:f.id,id:f.id,name:f.name,description:f.description,usersCount:f.usersCount,icons:Me(f),rowIndex:Oe+2})))),!B&&!Q&&e.createElement(He.Z,null)),e.createElement(C.ConfirmDialog,{isOpen:Ve,onConfirm:qe,isConfirmButtonLoading:Ze,onToggleDialog:st}))},Je=()=>e.createElement(C.CheckPagePermissions,{permissions:r.Z.settings.roles.main},e.createElement(ke,null))},63775:(ge,D,a)=>{a.d(D,{Z:()=>ne});var e=(V,Ie,Ee)=>new Promise((fe,Ne)=>{var Y=Z=>{try{P(Ee.next(Z))}catch(de){Ne(de)}},F=Z=>{try{P(Ee.throw(Z))}catch(de){Ne(de)}},P=Z=>Z.done?fe(Z.value):Promise.resolve(Z.value).then(Y,F);P((Ee=Ee.apply(V,Ie)).next())});const ne=[...strapi.features.isEnabled(strapi.features.SSO)?[{Component(){return e(this,null,function*(){return yield a.e(302).then(a.bind(a,49851))})},to:"/settings/single-sign-on",exact:!0}]:[]]}}]);