"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),a=require("react"),c=require("./AccessPanel.js"),t=require("../store/useEnvStore.js"),i=require("../store/usePermissionsStore.js"),l=require("./AccessPanel.module.css.js"),n=require("../store/useLMSConfigStore.js");exports.default=function(o){var r=o.selectedRuleSetId,d=o.useApplicationModuleForScopeAccess,u=void 0!==d&&d,p=o.scopeName,m=(null==p?void 0:p.trim())||"Selected",v=a.useState("scope"),f=v[0],g=v[1],_=t.default(function(e){return e.rbacConfig}),x=i.usePermissionsStore(function(e){return e.hasPermission}),b=null==_?void 0:_.applicationResourceId,j=(null==_?void 0:_.applicationModuleId)||(null==_?void 0:_.moduleId),h=u?j:null==_?void 0:_.moduleId,A=Boolean(b&&x("ilotj.scope.access.application.view",b));return s.jsxs("div",e.__assign({className:l.default.accessManagement},{children:[s.jsx("div",e.__assign({style:{padding:"24px 24px 0",fontFamily:"Arial, sans-serif"}},{children:s.jsxs("div",e.__assign({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[s.jsx("h1",e.__assign({style:{margin:0,color:"#334155",fontSize:"20px",fontWeight:700,lineHeight:1.25}},{children:n.dt("access.title","".concat(m," - Access Management"),{scope_name:m})})),s.jsx("p",e.__assign({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:n.dt("access.subtitle","Manage users and groups within the ".concat(m," scope."),{scope_name:m})}))]}))})),s.jsxs("div",e.__assign({className:l.default.accessTabs,role:"tablist","aria-label":"Access level"},{children:[s.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":"scope"===f,className:"".concat(l.default.accessTab," ").concat("scope"===f?l.default.accessTabActive:""),onClick:function(){return g("scope")}},{children:n.dt("access.scopeLevelAccess","Scope Level Access")})),s.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":"application"===f,className:"".concat(l.default.accessTab," ").concat("application"===f?l.default.accessTabActive:""),onClick:function(){return g("application")},disabled:!A,title:A?"":"You don't have permission to view application access"},{children:n.dt("access.appLevelAccess","Application Level Access")}))]})),s.jsx("div",e.__assign({className:l.default.accessTabPanel,role:"tabpanel"},{children:"application"===f?s.jsx(c.default,{resourceId:b,moduleId:j,accessLevel:"application"}):s.jsx(c.default,{ruleSetId:r,moduleId:h,accessLevel:"scope"})}))]}))};
//# sourceMappingURL=AccessManagementPanel.js.map
