import{__assign as e}from"tslib";import{jsxs as o,jsx as n}from"react/jsx-runtime";import{useEffect as t}from"react";import i from"./RuleContent/RuleContent.js";import r from"./StationsContent/StationsContent.js";import a from"./RBAC/AccessManagementPanel.js";import"appsec-ui";import"./store/useAuthStore.js";import"./store/usePermissionsStore.js";import s from"./store/useEnvStore.js";import l from"./styles/LearningTemplateLayout.module.css.js";import{findNodeById as d}from"./utils/treeUtils.js";import c from"./SidebarWrapper.js";import{useLearningTemplateStore as u}from"./store/useLearningTemplateStore.js";import p from"./components/StationOnboarding/StationOnboardModal.js";import m from"./AuditLog/AuditLog.js";var f=function(f){var S,g,v=f.onOpenCreateModal,C=f.onRefreshRuleSets,h=f.scopeTreeData,R=f.onAddChild,j=f.onRenameChild,A=f.onDeleteChild,I=f.canDeleteScope,D=f.canEditScope,M=f.canCreateScope,O=f.onSectionSelect,T=f.onViewStation,w=f.activeSectionId,b=void 0===w?"learnings":w,k=f.sectionsConfig,y=f.nodeTypesConfig,L=f.app_integration_id,_=f.token,N=u(function(e){return e.isStationModalOpen}),U=u(function(e){return e.setStationModalOpen}),x=u(function(e){return e.isStationOnboardModalTriggered}),B=u(function(e){return e.setIsStationOnboardModalTriggered}),E=u(function(e){return e.selectedRuleSetId}),P=u(function(e){return e.rawAuditRuleData}),V=s(function(e){return e.auditLogConfig});u(function(e){return e.ruleData});var F=E?d((null==h?void 0:h.data)||null,E):null;return Boolean((null===(S=null==h?void 0:h.data)||void 0===S?void 0:S.id)&&E===h.data.id),t(function(){x&&U(!0)},[x,U,B]),o("div",e({className:l.container},{children:[n(c,{onOpenCreateModal:v,onRefreshRuleSets:C,scopeTreeData:h,onAddChild:R,onRenameChild:j,onDeleteChild:A,canDeleteScope:I,canEditScope:D,canCreateScope:M,onSectionSelect:O,activeSectionId:b,sectionsConfig:k,nodeTypesConfig:y}),n("div",e({id:"rule-template-layout-content",className:"".concat(l.content," relative flex-1 overflow-hidden")},{children:"stations"===b?n(r,{scopeId:E||"",scopeName:(null==F?void 0:F.name)||"Unknown Scope",stationsCount:null===(g=null==F?void 0:F.metrics)||void 0===g?void 0:g.stationsCount,onViewStation:T}):"access"===b?n(a,{selectedRuleSetId:E,scopeName:(null==F?void 0:F.name)||"Unknown Scope",useApplicationModuleForScopeAccess:!1}):"history"===b?(null==V?void 0:V.configId)?n(m,{configId:V.configId,scopeId:E||void 0,scopeName:(null==F?void 0:F.name)||"Unknown Scope",ruleData:P}):null:n(i,{onRefreshRuleSets:C,app_integration_id:L,token:_})})),n(p,{isOpen:N,onClose:function(){U(!1),B(!1)},onBoardStation:function(e){C(!0,e)},app_integration_id:L,token:_})]}))};export{f as default};
//# sourceMappingURL=LearningTemplateLayout.js.map
