import{__assign as e}from"tslib";import{jsx as o}from"react/jsx-runtime";import{RbacQueryProvider as r,AppsecProvider as c,AccessListPanel as a}from"appsec-ui";import s from"../store/useAuthStore.js";import{usePermissionsStore as n}from"../store/usePermissionsStore.js";import t from"./AccessPanel.module.css.js";import i from"../store/useEnvStore.js";var u=function(u){var d=u.ruleSetId,p=u.resourceId,l=u.moduleId,m=u.accessLevel,f=void 0===m?"scope":m,v=u.mode,g=void 0===v?"both":v;u.canManageAppAccess;var h=s(function(e){return e.user}),I=i(function(e){return e.rbacConfig}),j=i(function(e){return e.appsecRbacUrl}),A=i(function(e){return e.appsecBaseUrl}),U=null==h?void 0:h.accessToken,b=n(function(e){return e.hasPermission}),P=p||d||void 0,S=Boolean(P),N="application"===f,E=N?"ilotj.scope.access.application":"ilotj.scope.access",G=S&&b("".concat(E,".user.add"),P),k=S&&b("".concat(E,".user.edit"),P),x=S&&b("".concat(E,".user.remove"),P),B=S&&b("".concat(E,".group.add"),P),D=S&&b("".concat(E,".group.edit"),P),M=S&&b("".concat(E,".group.remove"),P);if(!(P&&I&&j&&A))return o("div",e({className:t.accessPanel},{children:o("p",e({className:t.emptyState},{children:"Waiting for access configuration..."}))}));var T=N?I.applicationModuleId||l||I.moduleId:l||I.moduleId;return o("div",e({className:t.accessPanel},{children:o(r,{children:o(c,e({appId:I.applicationName,baseUrl:j,appsecUrl:A,mode:"manage",getAuthToken:function(){return null!=U?U:""}},{children:o(a,{resourceId:P,moduleId:T,mode:g,canAddUser:G,canEditUser:k,canDeleteUser:x,canAddGroup:B,canEditGroup:D,canDeleteGroup:M})}))})}))};export{u as default};
//# sourceMappingURL=AccessPanel.js.map
