itions:v,hasSomeActionsSelected:E,isDisplayed:i,isParentCheckbox:!1,label:d,pathToConditionsObject:c}}const M=y()(n,m,null),{hasAllActionsSelected:N,hasSomeActionsSelected:j}=Te(M);return{actionId:s,checkboxName:u,hasAllActionsSelected:N,hasConditions:v,hasSomeActionsSelected:j,isDisplayed:i,isParentCheckbox:!0,label:d,pathToConditionsObject:c}});const Xe=(t,n)=>` ${it} { background-color: ${t.colors.primary100}; color: ${t.colors.primary600}; border-radius: ${n?"2px 2px 0 0":"2px"}; } ${dt} { display: flex; } ${oe} { display: block; } &:hover { ${We(t)} } &:focus-within { ${({theme:o,isActive:s})=>Xe(o,s)} } `,it=f.ZP.div` flex: 1; display: flex; align-items: center; height: ${Ce}; background-color: ${({isGrey:t,theme:n})=>t?n.colors.neutral100:n.colors.neutral0}; border: 1px solid transparent; `,Gt=f.ZP.div` display: inline-flex; min-width: 100%; ${oe} { display: none; } ${({isActive:t,theme:n})=>t&&Xe(n,t)} &:hover { ${({theme:t,isActive:n})=>Xe(t,n)} } `,lt=(0,f.ZP)(C.k)` width: ${U}; position: relative; `,dt=(0,f.ZP)(p.x)` display: none; svg { width: 11px; } * { fill: ${({theme:t})=>t.colors.primary600}; } `,ct=f.ZP.span` position: absolute; top: -6px; left: 37px; width: 6px; height: 6px; border-radius: 20px; background: ${({theme:t})=>t.colors.primary600}; `,Ut=(0,f.ZP)(p.x)` position: absolute; right: 9px; transform: translateY(10px); `,ut=({availableActions:t,isActive:n,isGrey:o,isFormDisabled:s,label:i,onClickToggle:l,pathToData:d})=>{const[c,m]=(0,e.useState)(!1),{formatMessage:u}=(0,H.Z)(),{modifiedData:g,onChangeParentCheckbox:v,onChangeSimpleCheckbox:M}=(0,G.$_)(),N=()=>{m(K=>!K)},j=()=>{m(!1)},E=y()(g,d.split(".."),{}),h=(0,e.useMemo)(()=>Object.keys(E).reduce((K,J)=>(K[J]=Y()(E[J],"conditions"),K),{}),[E]),{hasAllActionsSelected:L,hasSomeActionsSelected:$}=Te(h),I=(0,e.useMemo)(()=>Ht(t,g,d),[t,g,d]),te=I.some(({hasConditions:K})=>K);return e.createElement(Gt,{isActive:n},e.createElement(it,{isGrey:o},e.createElement(rt,{isCollapsable:!0,isFormDisabled:s,label:i,checkboxName:d,onChange:v,onClick:l,someChecked:$,value:L,isActive:n},e.createElement(dt,{paddingLeft:2},n?e.createElement(ue.Z,null):e.createElement(ae.Z,null))),e.createElement(C.k,{style:{flex:1}},I.map(({actionId:K,hasConditions:J,hasAllActionsSelected:V,hasSomeActionsSelected:fe,isDisplayed:Ie,isParentCheckbox:se,checkboxName:ve,label:Ve})=>Ie?se?e.createElement(lt,{key:K,justifyContent:"center",alignItems:"center"},J&&e.createElement(ct,null),e.createElement(w.C,{disabled:s,name:ve,"aria-label":u({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${Ve} ${i}`}),onValueChange:Se=>{v({target:{name:ve,value:Se}})},indeterminate:fe,value:V})):e.createElement(lt,{key:K,justifyContent:"center",alignItems:"center"},J&&e.createElement(ct,null),e.createElement(w.C,{disabled:s,indeterminate:J,name:ve,onValueChange:Se=>{M({target:{name:ve,value:Se}})},value:V})):e.createElement(Ue,{key:K}))),c&&e.createElement(W,{headerBreadCrumbs:[i,"Settings.permissions.conditions.conditions"],actions:I,isFormDisabled:s,onClosed:j,onToggle:N})),e.createElement(Ut,null,e.createElement(oe,{onClick:N,hasConditions:te})))};ut.propTypes={availableActions:a().array.isRequired,isActive:a().bool.isRequired,isGrey:a().bool.isRequired,isFormDisabled:a().bool.isRequired,label:a().string.isRequired,onClickToggle:a().func.isRequired,pathToData:a().string.isRequired};var Kt=ut;const zt=f.ZP.span` color: ${({theme:t})=>t.colors.danger700}; padding-left: ${({theme:t})=>t.spaces[1]}px; `;var mt=()=>e.createElement(zt,null,"*"),Xt=(t,n)=>t.map(o=>{const s=Array.isArray(o.subjects)&&o.subjects.indexOf(n)!==-1;return{...o,isDisplayed:s}});const wt=(0,f.ZP)(p.x)` transform: translate(-4px, -12px); &:before { content: ''; width: ${4/16}rem; height: ${12/16}rem; background: ${({theme:t})=>t.colors.primary200}; display: block; } `,Yt=f.ZP.svg` position: relative; flex-shrink: 0; transform: translate(-0.5px, -1px); * { fill: ${({theme:t,color:n})=>t.colors[n]}; } `,we=t=>e.createElement(wt,null,e.createElement(Yt,{width:"20",height:"23",viewBox:"0 0 20 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},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"})));we.defaultProps={fill:"primary200"},we.propTypes={fill:a().string};var Jt=(0,e.memo)(we);const pt=(0,f.ZP)(C.k)` width: ${U}; position: relative; `,Qt=(0,f.ZP)(C.k)` height: ${Ce}; `,qt=(0,f.ZP)(p.x)` padding-left: ${31/16}rem; `,_t=(0,f.ZP)(p.x)` border-left: ${({isVisible:t,theme:n})=>t?`4px solid ${n.colors.primary200}`:"4px solid transparent"}; `,en=(0,f.ZP)(C.k)` padding-left: ${({theme:t})=>t.spaces[4]}; width: ${({level:t})=>145-t*36}px; ${({isCollapsable:t,theme:n})=>t&&` ${Ne} { display: block; color: ${n.colors.neutral100}; } &:hover { ${We(n)} } `} ${({isActive:t,theme:n})=>t&&We(n)}; `,tn=f.ZP.div` padding-top: ${({theme:t})=>t.spaces[2]}; margin-top: ${({theme:t})=>t.spaces[2]}; width: ${4/16}rem; background-color: ${({theme:t})=>t.colors.primary200}; border-top-left-radius: 2px; border-top-right-radius: 2px; `,Ye=({childrenForm:t,isFormDisabled:n,recursiveLevel:o,pathToDataFromActionRow:s,propertyActions:i,parentName:l,propertyName:d})=>{const{formatMessage:c}=(0,H.Z)(),{modifiedData:m,onChangeParentCheckbox:u,onChangeSimpleCheckbox:g}=(0,G.$_)(),[v,M]=(0,e.useState)(null),N=E=>{M(h=>h===E?null:E)},j=(0,e.useMemo)(()=>v?t.find(({value:E})=>E===v):null,[v,t]);return e.createElement(qt,null,e.createElement(tn,null),t.map(({label:E,value:h,required:L,children:$},I)=>{const te=I+1N(h),"aria-expanded":J,onKeyDown:({key:V})=>(V==="Enter"||V===" ")&&N(h),tabIndex:0,role:"button"},title:E},e.createElement(T.Z,{ellipsis:!0},ce()(E)),L&&e.createElement(mt,null),e.createElement(Ne,{$isActive:J}))),e.createElement(C.k,{style:{flex:1}},i.map(({actionId:V,label:fe,isActionRelatedToCurrentProperty:Ie})=>{if(!Ie)return e.createElement(Ue,{key:V});const se=[...s.split(".."),V,"properties",d,...l.split(".."),h],ve=y()(m,se,!1);if(!$)return e.createElement(pt,{key:fe,justifyContent:"center",alignItems:"center"},e.createElement(w.C,{disabled:n,name:se.join(".."),"aria-label":c({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${l} ${E} ${fe}`}),onValueChange:Me=>{g({target:{name:se.join(".."),value:Me}})},value:ve}));const{hasAllActionsSelected:Ve,hasSomeActionsSelected:Se}=Te(ve);return e.createElement(pt,{key:fe,justifyContent:"center",alignItems:"center"},e.createElement(w.C,{key:fe,disabled:n,name:se.join(".."),"aria-label":c({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${l} ${E} ${fe}`}),onValueChange:Me=>{u({target:{name:se.join(".."),value:Me}})},value:Ve,indeterminate:Se}))})))),j&&J&&e.createElement(p.x,{paddingBottom:2},e.createElement(Ye,{isFormDisabled:n,parentName:`${l}..${h}`,pathToDataFromActionRow:s,propertyActions:i,propertyName:d,recursiveLevel:o+1,childrenForm:j.children})))}))};Ye.propTypes={childrenForm:a().array.isRequired,isFormDisabled:a().bool.isRequired,parentName:a().string.isRequired,pathToDataFromActionRow:a().string.isRequired,propertyActions:a().array.isRequired,propertyName:a().string.isRequired,recursiveLevel:a().number.isRequired};var nn=(0,e.memo)(Ye);const sn=t=>t.reduce((o,s)=>(s.isActionRelatedToCurrentProperty&&o.push(s.actionId),o),[]);var on=(t,n,o,s,i)=>{const d=sn(t).reduce((c,m)=>{const u=[...o.split(".."),m,"properties",s,i],g=y()(n,u,!1);return c[m]=g,c},{});return Te(d)};const gt=(0,f.ZP)(C.k)` width: ${U}; position: relative; `,rn=(0,f.ZP)(C.k)` height: ${Ce}; flex: 1; ${({isCollapsable:t,theme:n})=>t&&` ${Ne} { display: block; color: ${n.colors.neutral100}; } &:hover { ${We(n)} } `} ${({isActive:t,theme:n})=>t&&We(n)}; `,Je=({childrenForm:t,label:n,isFormDisabled:o,name:s,required:i,pathToData:l,propertyActions:d,propertyName:c,isOdd:m})=>{const{formatMessage:u}=(0,H.Z)(),[g,v]=(0,e.useState)(null),{modifiedData:M,onChangeCollectionTypeLeftActionRowCheckbox:N,onChangeParentCheckbox:j,onChangeSimpleCheckbox:E}=(0,G.$_)(),h=g===s,L=(0,e.useMemo)(()=>Array.isArray(t)?t:[],[t]),$=L.length>0,I=(0,e.useCallback)(()=>{$&&v(V=>V===s?null:s)},[$,s]),te=({target:{value:V}})=>{N(l,c,s,V)},{hasAllActionsSelected:K,hasSomeActionsSelected:J}=(0,e.useMemo)(()=>on(d,M,l,c,s),[d,M,l,c,s]);return e.createElement(e.Fragment,null,e.createElement(rn,{alignItems:"center",isCollapsable:$,isActive:h,background:m?"neutral100":"neutral0"},e.createElement(C.k,null,e.createElement(rt,{onChange:te,onClick:I,isCollapsable:$,isFormDisabled:o,label:n,someChecked:J,value:K,isActive:h},i&&e.createElement(mt,null),e.createElement(Ne,{$isActive:h})),e.createElement(C.k,null,d.map(({label:V,isActionRelatedToCurrentProperty:fe,actionId:Ie})=>{if(!fe)return e.createElement(Ue,{key:V});const se=[...l.split(".."),Ie,"properties",c,s];if(!$){const Me=y()(M,se,!1);return e.createElement(gt,{key:Ie,justifyContent:"center",alignItems:"center"},e.createElement(w.C,{disabled:o,name:se.join(".."),"aria-label":u({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${s} ${V}`}),onValueChange:ts=>{E({target:{name:se.join(".."),value:ts}})},value:Me}))}const ve=y()(M,se,{}),{hasAllActionsSelected:Ve,hasSomeActionsSelected:Se}=Te(ve);return e.createElement(gt,{key:V,justifyContent:"center",alignItems:"center"},e.createElement(w.C,{disabled:o,name:se.join(".."),onValueChange:Me=>{j({target:{name:se.join(".."),value:Me}})},"aria-label":u({id:"Settings.permissions.select-by-permission",defaultMessage:"Select {label} permission"},{label:`${s} ${V}`}),value:Ve,indeterminate:Se}))})))),h&&e.createElement(nn,{childrenForm:L,isFormDisabled:o,parentName:s,pathToDataFromActionRow:l,propertyName:c,propertyActions:d,recursiveLevel:0}))};Je.defaultProps={childrenForm:[],required:!1},Je.propTypes={childrenForm:a().array,label:a().string.isRequired,isFormDisabled:a().bool.isRequired,name:a().string.isRequired,pathToData:a().string.isRequired,propertyActions:a().array.isRequired,propertyName:a().string.isRequired,required:a().bool,isOdd:a().bool.isRequired};var an=(0,e.memo)(Je);const ft=(0,f.ZP)(C.k)` width: ${U}; flex-shrink: 0; `,ln=(0,f.ZP)(C.k)` width: ${ye}; height: ${Ce}; flex-shrink: 0; `,ht=({headers:t,label:n})=>{const{formatMessage:o}=(0,H.Z)(),s=o({id:"Settings.roles.form.permission.property-label",defaultMessage:"{label} permissions"},{label:n});return e.createElement(C.k,null,e.createElement(ln,{alignItems:"center",paddingLeft:6},e.createElement(T.Z,{variant:"sigma",textColor:"neutral500"},s)),t.map(i=>i.isActionRelatedToCurrentProperty?e.createElement(ft,{justifyContent:"center",key:i.label},e.createElement(T.Z,{variant:"sigma",textColor:"neutral500"},o({id:`Settings.roles.form.permissions.${i.label.toLowerCase()}`,defaultMessage:i.label}))):e.createElement(ft,{key:i.label})))};ht.propTypes={headers:a().arrayOf(a().shape({label:a().string.isRequired,isActionRelatedToCurrentProperty:a().bool.isRequired})).isRequired,label:a().string.isRequired};var dn=ht,cn=(t,n)=>t.map(o=>{const s=Array.isArray(o.applyToProperties)&&o.applyToProperties.indexOf(n)!==-1&&o.isDisplayed;return{label:o.label,actionId:o.actionId,isActionRelatedToCurrentProperty:s}});const un=f.ZP.div` display: inline-flex; flex-direction: column; min-width: 0; `,yt=({availableActions:t,childrenForm:n,isFormDisabled:o,label:s,pathToData:i,propertyName:l})=>{const d=(0,e.useMemo)(()=>cn(t,l),[t,l]);return e.createElement(un,null,e.createElement(dn,{label:s,headers:d}),e.createElement(p.x,null,n.map(({children:c,label:m,value:u,required:g},v)=>e.createElement(an,{childrenForm:c,key:u,label:m,isFormDisabled:o,name:u,required:g,propertyActions:d,pathToData:i,propertyName:l,isOdd:v%2===0}))))};yt.propTypes={childrenForm:a().array.isRequired,availableActions:a().array.isRequired,isFormDisabled:a().bool.isRequired,label:a().string.isRequired,pathToData:a().string.isRequired,propertyName:a().string.isRequired};var mn=yt;const pn=f.ZP.div` flex-direction: column; display: inline-flex; min-width: 100%; ${({theme:t,isActive:n})=>n&&`border: 1px solid ${t.colors.primary600};`} `,Ct=({allActions:t,contentTypeName:n,label:o,index:s,isActive:i,isFormDisabled:l,onClickToggleCollapse:d,pathToData:c,properties:m})=>{const u=(0,e.useCallback)(()=>{d(n)},[n,d]),g=(0,e.useMemo)(()=>Xt(t,n),[t,n]);return e.createElement(pn,{isActive:i},e.createElement(Kt,{availableActions:g,isActive:i,isGrey:s%2===0,isFormDisabled:l,label:o,onClickToggle:u,pathToData:c}),i&&m.map(({label:v,value:M,children:N})=>e.createElement(mn,{availableActions:g,childrenForm:N,isFormDisabled:l,label:v,pathToData:c,propertyName:M,key:M})))};Ct.propTypes={allActions:a().array.isRequired,contentTypeName:a().string.isRequired,index:a().number.isRequired,isActive:a().bool.isRequired,isFormDisabled:a().bool.isRequired,label:a().string.isRequired,onClickToggleCollapse:a().func.isRequired,pathToData:a().string.isRequired,properties:a().array.isRequired};var gn=Ct;const Qe=({actions:t,isFormDisabled:n,pathToData:o,subjects:s})=>{const[i,l]=(0,e.useState)(null),d=c=>{l(i===c?null:c)};return s.map(({uid:c,label:m,properties:u},g)=>e.createElement(gn,{allActions:t,key:c,contentTypeName:c,label:m,isActive:i===c,isFormDisabled:n,index:g,onClickToggleCollapse:d,pathToData:`${o}..${c}`,properties:u}))};Qe.defaultProps={actions:[],subjects:[]},Qe.propTypes={actions:a().array.isRequired,isFormDisabled:a().bool.isRequired,pathToData:a().string.isRequired,subjects:a().arrayOf(a().shape({uid:a().string.isRequired,label:a().string.isRequired,properties:a().array.isRequired}))};var fn=(0,e.memo)(Qe),hn=t=>t.filter(({subjects:n})=>n&&n.length);const yn=t=>t.map(({actionId:n})=>n),Cn=(t,n)=>t.reduce((o,s)=>(Object.keys(n).forEach(i=>{const l=y()(n,[i,s],{}),d={[i]:ze(l)};o[s]?o[s]={...o[s],...d}:o[s]=d}),o),{});var vn=(t,n)=>{const o=yn(t),s=Cn(o,n);return Object.keys(s).reduce((l,d)=>(l[d]=Te(s[d]),l),{})};const En=(0,f.ZP)(C.k)` width: ${U}; flex-shrink: 0; `,qe=({actions:t,isFormDisabled:n,kind:o})=>{const{formatMessage:s}=(0,H.Z)(),{modifiedData:i,onChangeCollectionTypeGlobalActionCheckbox:l}=(0,G.$_)(),d=(0,e.useMemo)(()=>hn(t),[t]),c=(0,e.useMemo)(()=>vn(d,i[o]),[i,d,o]);return e.createElement(p.x,{paddingBottom:4,paddingTop:6,style:{paddingLeft:ye}},e.createElement(C.k,{gap:0},d.map(({label:m,actionId:u})=>e.createElement(En,{direction:"column",alignItems:"center",justifyContent:"center",key:u,gap:3},e.createElement(T.Z,{variant:"sigma",textColor:"neutral500"},s({id:`Settings.roles.form.permissions.${m.toLowerCase()}`,defaultMessage:m})),e.createElement(w.C,{disabled:n,onValueChange:g=>{l(o,u,g)},name:u,"aria-label":s({id:"Settings.permissions.select-all-by-permission",defaultMessage:"Select all {label} permissions"},{label:s({id:`Settings.roles.form.permissions.${m.toLowerCase()}`,defaultMessage:m})}),value:y()(c,[u,"hasAllActionsSelected"],!1),indeterminate:y()(c,[u,"hasSomeActionsSelected"],!1)})))))};qe.defaultProps={actions:[]},qe.propTypes={actions:a().arrayOf(a().shape({label:a().string.isRequired,actionId:a().string.isRequired,subjects:a().array.isRequired})),isFormDisabled:a().bool.isRequired,kind:a().string.isRequired};var bn=(0,e.memo)(qe);const xn=(0,f.ZP)(p.x)` overflow-x: auto; `,vt=({isFormDisabled:t,kind:n,layout:{actions:o,subjects:s}})=>{const i=F()([...s],"label");return e.createElement(xn,{background:"neutral0"},e.createElement(bn,{actions:o,kind:n,isFormDisabled:t}),e.createElement(fn,{actions:o,isFormDisabled:t,pathToData:n,subjects:i}))};vt.propTypes={isFormDisabled:a().bool.isRequired,kind:a().string.isRequired,layout:a().shape({actions:a().array,subjects:a().arrayOf(a().shape({uid:a().string.isRequired,label:a().string.isRequired,properties:a().array.isRequired}))}).isRequired};var Et=(0,e.memo)(vt),Rn=r(76402);const bt=({children:t,value:n})=>e.createElement(Rn.$l.Provider,{value:n},t);bt.propTypes={children:a().node.isRequired,value:a().exact({availableConditions:a().array.isRequired,modifiedData:a().object.isRequired,onChangeCollectionTypeLeftActionRowCheckbox:a().func.isRequired,onChangeConditions:a().func.isRequired,onChangeSimpleCheckbox:a().func.isRequired,onChangeParentCheckbox:a().func.isRequired,onChangeCollectionTypeGlobalActionCheckbox:a().func.isRequired}).isRequired};var Pn=bt,An=r(83828),Tn=r(61762),Sn=r(89966),xt=r(8284),Mn=r(15335),$n=r(5803),On=(t,n,o)=>t.map(s=>{const i=[...o,s.action,"properties","enabled"],l=y()(n,i,!1),d=y()(n,[...o,s.action,"conditions"],{}),c=ke(d).some(m=>m);return{...s,isDisplayed:l,checkboxName:i.join(".."),hasSomeActionsSelected:l,value:l,hasConditions:c,label:s.displayName,actionId:s.action,pathToConditionsObject:[...o,s.action]}}),Dn=t=>{const n=Object.entries(t).reduce((s,i)=>{const[l,{conditions:d}]=i;return s[l]=d,s},{});return ke(n).some(s=>s)};const jn=f.ZP.div` flex: 1; align-self: center; border-top: 1px solid ${({theme:t})=>t.colors.neutral150}; `,Ln=f.ZP.div` position: relative; word-break: keep-all; ${({hasConditions:t,disabled:n,theme:o})=>t&&` &:before { content: ''; position: absolute; top: ${-4/16}rem; left: ${-8/16}rem; width: ${6/16}rem; height: ${6/16}rem; border-radius: ${20/16}rem; background: ${n?o.colors.neutral100:o.colors.primary600}; } `} `,Rt=({categoryName:t,isFormDisabled:n,subCategoryName:o,actions:s,pathToData:i})=>{const[l,d]=(0,e.useState)(!1),{modifiedData:c,onChangeParentCheckbox:m,onChangeSimpleCheckbox:u}=(0,G.$_)(),{formatMessage:g}=(0,H.Z)(),v=y()(c,i,{}),M=(0,e.useMemo)(()=>Object.keys(v).reduce((I,te)=>(I[te]=ze(v[te]),I),{}),[v]),{hasAllActionsSelected:N,hasSomeActionsSelected:j}=Te(M),E=()=>{d(I=>!I)},h=()=>{d(!1)},L=On(s,c,i),$=Dn(y()(c,[...i],{}));return e.createElement(e.Fragment,null,e.createElement(p.x,null,e.createElement(C.k,{justifyContent:"space-between",alignItems:"center"},e.createElement(p.x,{paddingRight:4},e.createElement(T.Z,{variant:"sigma",textColor:"neutral600"},o)),e.createElement(jn,null),e.createElement(p.x,{paddingLeft:4},e.createElement(xt.X,{name:i.join(".."),disabled:n,onValueChange:I=>{m({target:{name:i.join(".."),value:I}})},indeterminate:j,value:N},g({id:"app.utils.select-all",defaultMessage:"Select all"})))),e.createElement(C.k,{paddingTop:6,paddingBottom:6},e.createElement(Mn.r,{gap:2,style:{flex:1}},L.map(({checkboxName:I,value:te,action:K,displayName:J,hasConditions:V})=>e.createElement($n.P,{col:3,key:K},e.createElement(Ln,{disabled:n,hasConditions:V},e.createElement(xt.X,{name:I,disabled:n,onValueChange:fe=>{u({target:{name:I,value:fe}})},value:te},J))))),e.createElement(oe,{hasConditions:$,onClick:E}))),l&&e.createElement(W,{headerBreadCrumbs:[t,o],actions:L,isFormDisabled:n,onClosed:h,onToggle:E}))};Rt.propTypes={actions:a().array.isRequired,categoryName:a().string.isRequired,isFormDisabled:a().bool.isRequired,subCategoryName:a().string.isRequired,pathToData:a().array.isRequired};var kn=Rt;const _e=({childrenForm:t,kind:n,name:o,isOpen:s,isFormDisabled:i,isWhite:l,onOpenCategory:d,pathToData:c})=>{const{formatMessage:m}=(0,H.Z)(),u=()=>{d(o)},g=(0,e.useMemo)(()=>o.split("::").pop(),[o]);return e.createElement(An.U,{expanded:s,onToggle:u,id:`accordion-${o}`,variant:l?"primary":"secondary"},e.createElement(Tn.B,{title:ce()(g),description:`${m({id:"Settings.permissions.category"},{category:g})} ${n==="plugins"?"plugin":n}`}),e.createElement(Sn.v,null,e.createElement(p.x,{padding:6},t.map(({actions:v,subCategoryName:M,subCategoryId:N})=>e.createElement(kn,{key:M,actions:v,categoryName:g,isFormDisabled:i,subCategoryName:M,pathToData:[...c,N]})))))};_e.defaultProps={},_e.propTypes={childrenForm:a().array.isRequired,isOpen:a().bool.isRequired,isFormDisabled:a().bool.isRequired,isWhite:a().bool.isRequired,kind:a().string.isRequired,name:a().string.isRequired,onOpenCategory:a().func.isRequired,pathToData:a().array.isRequired};var In=_e;const Pt=({isFormDisabled:t,kind:n,layout:o})=>{const[s,i]=(0,e.useState)(null),l=d=>{i(d===s?null:d)};return e.createElement(p.x,{padding:6,background:"neutral0"},o.map(({category:d,categoryId:c,childrenForm:m},u)=>e.createElement(In,{key:d,childrenForm:m,kind:n,isFormDisabled:t,isOpen:s===d,isWhite:u%2===1,name:d,onOpenCategory:l,pathToData:[n,c]})))};Pt.propTypes={isFormDisabled:a().bool.isRequired,kind:a().string.isRequired,layout:a().arrayOf(a().shape({category:a().string.isRequired,categoryId:a().string.isRequired,childrenForm:a().arrayOf(a().shape({actions:a().array.isRequired})).isRequired}).isRequired).isRequired};var At=Pt,Zn=r(86349),Bn=r.n(Zn),Fn=r(3040),ge=r.n(Fn),Tt=(t,n,o)=>t.find(s=>s.action===n&&s.subject===o);const St=(t,n=[])=>t.reduce((o,s)=>(o[s.id]=n.indexOf(s.id)!==-1,o),{}),Mt=({children:t},n,o="")=>t.reduce((s,i)=>{if(i.children)return{...s,[i.value]:Mt(i,n,`${o}${i.value}.`)};const l=n.indexOf(`${o}${i.value}`)!==-1;return s[i.value]=l,s},{}),Nn=(t,n,o)=>t.reduce((s,i)=>{const l=n.properties.find(({value:d})=>d===i);if(l){const d=y()(o,["properties",l.value],[]),c=Mt(l,d);s.properties[i]=c}return s},{properties:{}}),Wn=(t,n)=>n.reduce((o,s)=>{const i=t.find(({uid:l})=>l===s)||null;return i&&(o[s]=i),o},{});var $t=({subjects:t},n,o,s=[])=>n.reduce((i,l)=>{const d=l.subjects,c=Wn(t,d);if(D()(c))return i;const m=Object.keys(c).reduce((u,g)=>{const{actionId:v,applyToProperties:M}=l,E=c[g].properties.map(({value:I})=>I).every(I=>(M||[]).indexOf(I)===-1),h=Tt(s,v,g),L=St(o,y()(h,"conditions",[]));if(D()(M)||E)return ge()(u,[g,v],{properties:{enabled:h!==void 0},conditions:L}),u;const $=Nn(M,c[g],h);return ge()(u,[g,v],{...$,conditions:L}),u},{});return Bn()(i,m)},{});const Vn=(t,n,o)=>t.reduce((s,i)=>{const l=Tt(o,i.action,null);return s[i.action]={properties:{enabled:l!==void 0},conditions:St(n,l?.conditions??[])},s},{}),Hn=(t,n,o)=>t.reduce((s,i)=>(s[i.subCategoryId]=Vn(i.actions,n,o),s),{});var Ot=(t,n,o=[])=>t.reduce((s,{categoryId:i,childrenForm:l})=>{const d=Hn(l,n,o);return s[i]=d,s},{});const Dt=t=>t.split(" ").join("-");var jt=(t,n)=>Object.entries(de()(t,n)).map(([o,s])=>({category:o,categoryId:Dt(o),childrenForm:Object.entries(de()(s,"subCategory")).map(([i,l])=>({subCategoryName:i,subCategoryId:Dt(i),actions:l}))})),Gn=(t,n)=>{const{conditions:o,sections:{collectionTypes:s,singleTypes:i,plugins:l,settings:d}}=t,c={collectionTypes:s,singleTypes:i,plugins:jt(l,"plugin"),settings:jt(d,"category")},m={collectionTypes:$t(s,s.actions||[],o,n),singleTypes:$t(i,i.actions||[],o,n),plugins:Ot(c.plugins,o,n),settings:Ot(c.settings,o,n)};return{initialData:m,modifiedData:m,layouts:c}},Un=r(99381),et=r.n(Un);const Lt=t=>Object.keys(t).reduce((n,o)=>{const s=t[o];if(be()(s)&&!S()(s,"conditions"))return{...n,[o]:Lt(s)};if(be()(s)&&S()(s,"conditions")&&!ke(Y()(s,"conditions")).some(l=>l)){const l=Object.keys(s.conditions).reduce((d,c)=>(d[c]=!1,d),{});return{...n,[o]:{...s,conditions:l}}}return n[o]=s,n},{});var tt=Lt;const kt=(t,n,o=!1)=>Object.keys(t).reduce((s,i)=>{const l=t[i];return i==="conditions"&&!o?(s[i]=l,s):be()(l)?{...s,[i]:kt(l,n,i==="fields")}:(s[i]=n,s)},{});var Ge=kt;const Kn={initialData:{},modifiedData:{},layouts:{}};var zn=(t,n)=>(0,Q.ZP)(t,o=>{switch(n.type){case"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX":{const{collectionTypeKind:s,actionId:i,value:l}=n,d=["modifiedData",s];Object.keys(y()(t,d)).forEach(c=>{const m=y()(t,[...d,c,i],void 0);if(m){let u=Ge(m,l);if(!l&&u.conditions){const g=Ge(u.conditions,!1);u={...u,conditions:g}}ge()(o,[...d,c,i],u)}});break}case"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX":{const{pathToCollectionType:s,propertyName:i,rowName:l,value:d}=n;let c=et()(t.modifiedData);const m=s.split(".."),u=y()(c,m,{});Object.keys(u).forEach(g=>{if(S()(u[g],`properties.${i}`)){const v=y()(u,[g,"properties",i,l]),M=[...m,g,"properties",i,l];if(!be()(v))ge()(c,M,d);else{const N=Ge(v,d);ge()(c,M,N)}}}),d||(c=tt(c)),ge()(o,"modifiedData",c);break}case"ON_CHANGE_CONDITIONS":{Object.entries(n.conditions).forEach(s=>{const[i,l]=s;ge()(o,["modifiedData",...i.split(".."),"conditions"],l)});break}case"ON_CHANGE_SIMPLE_CHECKBOX":{let s=et()(t.modifiedData);ge()(s,[...n.keys.split("..")],n.value),n.value||(s=tt(s)),ge()(o,"modifiedData",s);break}case"ON_CHANGE_TOGGLE_PARENT_CHECKBOX":{const{keys:s,value:i}=n,l=[...s.split("..")];let d=et()(t.modifiedData);const c=y()(d,l,{}),m=Ge(c,i);ge()(d,l,m),i||(d=tt(d)),ge()(o,["modifiedData"],d);break}case"RESET_FORM":{o.modifiedData=t.initialData;break}case"SET_FORM_AFTER_SUBMIT":{o.initialData=t.modifiedData;break}default:return o}});const nt=t=>Object.entries(t).filter(([,n])=>n).map(([n])=>n),Xn=t=>{const[n,{conditions:o}]=t;return{action:n,subject:null,conditions:nt(o),properties:{}}},wn=t=>Object.values(t).reduce((n,o)=>{const s=Object.entries(o).reduce((i,l)=>{const[,{properties:{enabled:d}}]=l;if(!d)return i;const c=Xn(l);return i.push(c),i},[]);return[...n,...s]},[]);var It=t=>Object.values(t).reduce((n,o)=>{const s=wn(o);return[...n,...s]},[]);const Zt=(t,n="")=>Object.entries(t).reduce((o,s)=>{const[i,l]=s;return be()(l)?[...o,...Zt(l,`${n}${i}.`)]:(l&&!be()(l)&&o.push(`${n}${i}`),o)},[]),Yn=(t,n,{conditions:o,properties:s})=>Object.entries(s).reduce((i,l)=>{const[d,c]=l;return i.properties[d]=Zt(c),i},{action:t,subject:n,conditions:nt(o),properties:{}}),Jn=(t,n,{conditions:o})=>({action:t,subject:n,properties:{},conditions:nt(o)}),Qn=(t,n)=>Object.entries(n).reduce((s,i)=>{const[l,d]=i;if(!ke(d).some(u=>u))return s;if(!d?.properties?.enabled){const u=Yn(l,t,d);return[...s,u]}if(!d.properties.enabled)return s;const m=Jn(l,t,d);return s.push(m),s},[]);var Bt=t=>Object.entries(t).reduce((o,s)=>{const[i,l]=s,d=Qn(i,l);return[...o,...d]},[]),qn=t=>{const n=It(t.plugins),o=It(t.settings),s=Bt(t.collectionTypes),i=Bt(t.singleTypes);return[...n,...o,...s,...i]},_n=[{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"}];const st=(0,e.forwardRef)(({layout:t,isFormDisabled:n,permissions:o},s)=>{const[{initialData:i,layouts:l,modifiedData:d},c]=(0,e.useReducer)(zn,Kn,()=>Gn(t,o)),{formatMessage:m}=(0,H.Z)();(0,e.useImperativeHandle)(s,()=>({getPermissions(){const j=(0,Z.e5)(i.collectionTypes,d.collectionTypes),E=(0,Z.e5)(i.singleTypes,d.singleTypes),h={...j,...E};let L;return D()(h)?L=!1:L=Object.values(h).some($=>Object.values($).some(I=>S()(I,"conditions"))),{permissionsToSend:qn(d),didUpdateConditions:L}},resetForm(){c({type:"RESET_FORM"})},setFormAfterSubmit(){c({type:"SET_FORM_AFTER_SUBMIT"})}}));const u=(j,E,h,L)=>{c({type:"ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX",pathToCollectionType:j,propertyName:E,rowName:h,value:L})},g=(j,E,h)=>{c({type:"ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX",collectionTypeKind:j,actionId:E,value:h})},v=j=>{c({type:"ON_CHANGE_CONDITIONS",conditions:j})},M=(0,e.useCallback)(({target:{name:j,value:E}})=>{c({type:"ON_CHANGE_SIMPLE_CHECKBOX",keys:j,value:E})},[]),N=(0,e.useCallback)(({target:{name:j,value:E}})=>{c({type:"ON_CHANGE_TOGGLE_PARENT_CHECKBOX",keys:j,value:E})},[]);return e.createElement(Pn,{value:{availableConditions:t.conditions,modifiedData:d,onChangeConditions:v,onChangeSimpleCheckbox:M,onChangeParentCheckbox:N,onChangeCollectionTypeLeftActionRowCheckbox:u,onChangeCollectionTypeGlobalActionCheckbox:g}},e.createElement(b.v,{id:"tabs",label:m({id:"Settings.permissions.users.tabs.label",defaultMessage:"Tabs Permissions"})},e.createElement(P.m,null,_n.map(j=>e.createElement(P.O,{key:j.id},m({id:j.labelId,defaultMessage:j.defaultMessage})))),e.createElement(R.n,{style:{position:"relative"}},e.createElement(R.x,null,e.createElement(Et,{layout:l.collectionTypes,kind:"collectionTypes",isFormDisabled:n})),e.createElement(R.x,null,e.createElement(Et,{layout:l.singleTypes,kind:"singleTypes",isFormDisabled:n})),e.createElement(R.x,null,e.createElement(At,{layout:l.plugins,kind:"plugins",isFormDisabled:n})),e.createElement(R.x,null,e.createElement(At,{layout:l.settings,kind:"settings",isFormDisabled:n})))))});st.defaultProps={permissions:[],layout:{conditions:[],sections:{collectionTypes:{},singleTypes:{actions:[]},settings:[],plugins:[]}}},st.propTypes={layout:a().object,isFormDisabled:a().bool.isRequired,permissions:a().array};var es=(0,e.memo)(st)},87056:function(X,B,r){"use strict";r.r(B),r.d(B,{default:function(){return T}});var e=r(32735),b=r(19565),P=r(15062),R=r(53038),Z=r(30305),O=r(27649),S=r(82055),x=r(87933),D=r(41415),q=r(17e3),a=r(72850),H=r(29439),p=r(92802),A=r(33795),F=r.n(A),f=r(67879),C=r(2160),w=r(1283),ue=r(49372),ae=r(15335),ie=r(5803),y=r(10369),le=r(33475),Y=r(60216),G=r.n(Y);const _=({disabled:ne,role:z,values:k,errors:Q,onChange:pe,onBlur:de})=>{const{formatMessage:ee}=(0,f.Z)();return e.createElement(a.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(x.k,{justifyContent:"space-between"},e.createElement(a.x,null,e.createElement(a.x,null,e.createElement(ue.Z,{fontWeight:"bold"},z?z.name:ee({id:"global.details",defaultMessage:"Details"}))),e.createElement(a.x,null,e.createElement(ue.Z,{textColor:"neutral500",variant:"pi"},z?z.description:ee({id:"Settings.roles.form.description",defaultMessage:"Name and description of the role"})))),e.createElement(D.z,{disabled:!0,variant:"secondary"},ee({id:"Settings.roles.form.button.users-with-role",defaultMessage:"{number, plural, =0 {# users} one {# user} other {# users}} with this role"},{number:z.usersCount}))),e.createElement(ae.r,{gap:4},e.createElement(ie.P,{col:6},e.createElement(y.o,{disabled:ne,name:"name",error:Q.name&&ee({id:Q.name}),label:ee({id:"global.name",defaultMessage:"Name"}),onChange:pe,onBlur:de,value:k.name||""})),e.createElement(ie.P,{col:6},e.createElement(le.g,{disabled:ne,label:ee({id:"global.description",defaultMessage:"Description"}),id:"description",error:Q.name&&ee({id:Q.name}),onChange:pe,onBlur:de},k.description||"")))))};_.defaultProps={disabled:!1,role:null,values:{name:"",description:""}},_.propTypes={disabled:G().bool,errors:G().object.isRequired,onBlur:G().func.isRequired,onChange:G().func.isRequired,role:G().object,values:G().object};var xe=_,me=r(24346),oe=me.Ry().shape({name:me.Z_().required(b.I0.required)}),Ee=()=>{const ne=(0,b.lm)(),{formatMessage:z}=(0,f.Z)(),{params:{id:k}}=(0,R.$B)("/settings/roles/:id"),[Q,pe]=(0,e.useState)(!1),de=(0,e.useRef)(),{lockApp:ee,unlockApp:ce}=(0,b.o1)(),{trackUsage:Ze}=(0,b.rS)(),{isLoading:Ae,data:Be}=(0,C.U_)(k),{role:he,permissions:Oe,isLoading:De,onSubmitSucceeded:Fe}=(0,C.Dq)(k),{put:je}=(0,b.kY)(),He=async re=>{try{ee(),pe(!0);const{permissionsToSend:W,didUpdateConditions:U}=de.current.getPermissions();await je(`/admin/roles/${k}`,re),he.code!=="strapi-super-admin"&&(await je(`/admin/roles/${k}/permissions`,{permissions:W}),U&&Ze("didUpdateConditions")),de.current.setFormAfterSubmit(),Fe({name:re.name,description:re.description}),ne({type:"success",message:{id:"notification.success.saved"}})}catch(W){console.error(W.response);const U=F()(W,"response.payload.message","An error occured"),ye=F()(W,"response.payload.data.permissions[0]",U);ne({type:"warning",message:ye})}finally{pe(!1),ce()}},Le=he.code==="strapi-super-admin";return e.createElement(O.o,null,e.createElement(b.SL,{name:"Roles"}),e.createElement(p.J9,{enableReinitialize:!0,initialValues:{name:he.name,description:he.description},onSubmit:He,validationSchema:oe,validateOnChange:!1},({handleSubmit:re,values:W,errors:U,handleChange:ye,handleBlur:Ce})=>e.createElement("form",{onSubmit:re},e.createElement(S.T,{primaryAction:e.createElement(x.k,{gap:2},e.createElement(D.z,{disabled:he.code==="strapi-super-admin",onClick:re,loading:Q,size:"L"},z({id:"global.save",defaultMessage:"Save"}))),title:z({id:"Settings.roles.edit.title",defaultMessage:"Edit a role"}),subtitle:z({id:"Settings.roles.create.description",defaultMessage:"Define the rights given to the role"}),navigationAction:e.createElement(b.rU,{startIcon:e.createElement(H.Z,null),to:"/settings/roles"},z({id:"global.back",defaultMessage:"Back"}))}),e.createElement(q.D,null,e.createElement(x.k,{direction:"column",alignItems:"stretch",gap:6},e.createElement(xe,{isLoading:De,disabled:Le,errors:U,values:W,onChange:ye,onBlur:Ce,role:he}),!Ae&&!De?e.createElement(a.x,{shadow:"filterShadow",hasRadius:!0},e.createElement(w.Z,{isFormDisabled:Le,permissions:Oe,ref:de,layout:Be})):e.createElement(a.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(b.dO,null)))))))},T=()=>{const ne=(0,P.v9)(Z._),{isLoading:z,allowedActions:{canRead:k,canUpdate:Q}}=(0,b.ss)({read:ne.settings.roles.read,update:ne.settings.roles.update});return z?e.createElement(b.dO,null):!k&&!Q?e.createElement(R.l_,{to:"/"}):e.createElement(Ee,null)}},84802:function(X){function B(r,e,b,P){for(var R=-1,Z=r==null?0:r.length;++RC?`1px solid ${p.colors.danger600} !important`:f?`1px solid ${p.colors.neutral150}`:A?`1px solid ${p.colors.primary600}`:F==="primary"?`1px solid ${p.colors.neutral0}`:`1px solid ${p.colors.neutral100}`,q=(0,P.ZP)(O.Z)``,a=(0,P.ZP)(x.x)` border: ${D}; &:hover:not([aria-disabled='true']) { border: 1px solid ${({theme:p})=>p.colors.primary600}; ${q} { color: ${({theme:p,expanded:A})=>A?void 0:p.colors.primary700}; } ${O.Z} { color: ${({theme:p,expanded:A})=>A?void 0:p.colors.primary600}; } & > ${S.k} { background: ${({theme:p})=>p.colors.primary100}; } [data-strapi-dropdown='true'] { background: ${({theme:p})=>p.colors.primary200}; } } `,H=({children:p,disabled:A=!1,error:F,expanded:f=!1,hasErrorMessage:C=!0,id:w,onToggle:ue,toggle:ae,size:ie="M",variant:y="primary",shadow:le})=>{const Y=(0,Z.M)(w),G=b.useMemo(()=>({expanded:f,onToggle:ue,toggle:ae,id:Y,size:ie,variant:y,disabled:A}),[A,f,Y,ue,ie,ae,y]);return(0,e.jsxs)(R.S.Provider,{value:G,children:[(0,e.jsx)(a,{"data-strapi-expanded":f,disabled:A,"aria-disabled":A,expanded:f,hasRadius:!0,variant:y,error:F,shadow:le,children:p}),F&&C&&(0,e.jsx)(x.x,{paddingTop:1,children:(0,e.jsx)(O.Z,{variant:"pi",textColor:"danger600",children:F})})]})}},89966:function(X,B,r){"use strict";r.d(B,{v:function(){return R}});var e=r(74512),b=r(91045),P=r(72850);const R=({children:Z,...O})=>{const{expanded:S,id:x}=(0,b.A)();if(!S)return null;const D=`accordion-content-${x}`,q=`accordion-label-${x}`,a=`accordion-desc-${x}`;return(0,e.jsx)(P.x,{role:"region",id:D,"aria-labelledby":q,"aria-describedby":a,...O,children:Z})}},91045:function(X,B,r){"use strict";r.d(B,{A:function(){return P},S:function(){return b}});var e=r(32735);const b=(0,e.createContext)({disabled:!1,expanded:!1,id:"",size:"M",variant:"primary"}),P=()=>(0,e.useContext)(b)},61762:function(X,B,r){"use strict";r.d(B,{B:function(){return p}});var e=r(74512),b=r(16899),P=r(8471),R=r(83828),Z=r(91045);const O=({expanded:A,disabled:F,variant:f})=>{let C="neutral100";return A?C="primary100":F?C="neutral150":f==="primary"&&(C="neutral0"),C};var S=r(7563),x=r(99140),D=r(87933),q=r(49372);const a=(0,P.ZP)(S.A)` text-align: left; // necessary to make the ellipsis prop work on the title > span { max-width: 100%; } svg { width: ${14/16}rem; height: ${14/16}rem; path { fill: ${({theme:A,expanded:F})=>F?A.colors.primary600:A.colors.neutral500}; } } `,H=(0,P.ZP)(D.k)` min-height: ${({theme:A,size:F})=>A.sizes.accordions[F]}; border-radius: ${({theme:A,expanded:F})=>F?`${A.borderRadius} ${A.borderRadius} 0 0`:A.borderRadius}; &:hover { svg { path { fill: ${({theme:A})=>A.colors.primary600}; } } } `,p=({title:A,description:F,as:f="span",togglePosition:C="right",action:w,...ue})=>{const{onToggle:ae,toggle:ie,expanded:y,id:le,size:Y,variant:G,disabled:_}=(0,Z.A)(),xe=`accordion-content-${le}`,me=`accordion-label-${le}`,Re=`accordion-desc-${le}`,oe=Y==="M"?6:4,Pe=Y==="M"?oe:oe-2,Ee=O({expanded:y,disabled:_,variant:G}),$e={as:f,fontWeight:Y==="S"?"bold":void 0,id:me,textColor:y?"primary600":"neutral700",ellipsis:!0,variant:Y==="M"?"delta":void 0},T=y?"primary600":"neutral600",ne=y?"primary200":"neutral200",z=Y==="M"?`${32/16}rem`:`${24/16}rem`,k=()=>{_||(ie&&!ae?(console.warn('Deprecation warning: Usage of "toggle" prop in Accordion component is deprecated. This is discouraged and will be removed in the next major release. Please use "onToggle" instead'),ie()):ae&&ae())},Q=(0,e.jsx)(D.k,{justifyContent:"center",borderRadius:"50%",height:z,width:z,transform:y?"rotate(180deg)":void 0,"data-strapi-dropdown":!0,"aria-hidden":!0,as:"span",background:ne,cursor:_?"not-allowed":"pointer",onClick:k,shrink:0,children:(0,e.jsx)(x.J,{as:b.Z,width:Y==="M"?`${11/16}rem`:`${8/16}rem`,color:y?"primary600":"neutral600"})});return(0,e.jsx)(H,{paddingBottom:Pe,paddingLeft:oe,paddingRight:oe,paddingTop:Pe,background:Ee,expanded:y,size:Y,justifyContent:"space-between",cursor:_?"not-allowed":"",children:(0,e.jsxs)(D.k,{gap:3,flex:1,maxWidth:"100%",children:[C==="left"&&Q,(0,e.jsx)(a,{onClick:k,"aria-disabled":_,"aria-expanded":y,"aria-controls":xe,"aria-labelledby":me,"data-strapi-accordion-toggle":!0,expanded:y,type:"button",flex:1,minWidth:0,...ue,children:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(R.y,{...$e,children:A}),F&&(0,e.jsx)(q.Z,{as:"p",id:Re,textColor:T,children:F})]})}),C==="right"&&(0,e.jsxs)(D.k,{gap:3,children:[Q,w]}),C==="left"&&w]})})}},27799:function(X,B,r){"use strict";r.d(B,{Q:function(){return R}});var e=r(74512),b=r(8471),P=r(6407);const R=({options:O,...S})=>(0,e.jsx)(P.NU,{...S,children:O.map(x=>"children"in x?(0,e.jsx)(P.Ab,{label:x.label,values:x.children.map(D=>D.value.toString()),children:x.children.map(D=>(0,e.jsx)(Z,{value:D.value,children:D.label},D.value))},x.label):(0,e.jsx)(P.ML,{value:x.value,children:x.label},x.value))}),Z=(0,b.ZP)(P.ML)` padding-left: ${({theme:O})=>O.spaces[7]}; `}}]);