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