import{u as useSelector,r as reactExports,j as jsxRuntimeExports}from"./js-core.esm4.js";import{s as selectContentTemplatesToSave,C as ContentTemplates}from"./js-core.esm68.js";import{g as selectIsEditMode,E as ENextButtonType,i as selectUpdateJobErrors,k as actions$8,S as SHARED_TEXT,P as PanelControls$1}from"./js-core.esm81.js";import{m as makeStyles,T as Typography}from"./js-core.esm7.js";import"./js-core.esm67.js";import"./js-core.esm9.js";import"./js-core.esm51.js";import"./js-core.esm64.js";import{u as useDispatch}from"./js-core.esm12.js";import"./js-core.esm41.js";import"./js-core.esm71.js";import"./js-core.esm26.js";import"./js-core.esm60.js";import"./js-core.esm49.js";import"./js-core.esm53.js";import"./js-core.esm8.js";import"./js-core.esm72.js";import"./js-core.esm29.js";import"./js-core.esm27.js";import"./js-core.esm14.js";import"./js-core.esm73.js";import"./js-core.esm13.js";import"./js-core.esm78.js";import"./js-core.esm79.js";import"./js-core.esm32.js";import"./js-core.esm65.js";import"./js-core.esm16.js";import"./js-core.esm31.js";import"./js-core.esm33.js";import"./js-core.esm34.js";import"./js-core.esm69.js";import"./js-core.esm61.js";import"./js-core.esm70.js";import"./js-core.esm52.js";import"./js-core.esm35.js";var useStyles=makeStyles()(function(e){return{contentTemplatesWrapper:{height:"calc(100vh - 300px)",overflow:"hidden"},contentTemplatesWidget:{height:"calc(100% - 24px)"}}}),selectExistingTemplates=function(e){return e.processingCenterIngestion.contentTemplatesStep.existingTemplates||[]},ContentTemplatesStep=function(){var e=useDispatch(),s=useSelector(selectExistingTemplates)||[],t=useStyles().classes,o=useSelector(selectContentTemplatesToSave)||{},o=Object.values(o),r=0===o.length,o=o.every(function(e){return!e.touched||e.submitted&&!e.errors}),m=useSelector(selectIsEditMode),p=r?ENextButtonType.SKIP:ENextButtonType.NEXT,j=r||o,r=useSelector(selectUpdateJobErrors);return reactExports.useEffect(function(){m&&e(actions$8.setUpdateJobErrors({add:!j,tabIndex:5}))},[m,j]),jsxRuntimeExports.jsxs("div",{className:t.contentTemplatesWrapper,children:[jsxRuntimeExports.jsx(Typography,{variant:"body1",children:SHARED_TEXT.ingestionJobsWizard.stepLabels.contentTemplates()}),jsxRuntimeExports.jsx("div",{className:t.contentTemplatesWidget,children:jsxRuntimeExports.jsx(ContentTemplates,{existingTemplates:s})}),jsxRuntimeExports.jsx(PanelControls$1,{disableNext:!j||0<r.length,disableBack:!1,nextButtonType:m?ENextButtonType.UPDATE_SCHEDULED_JOB:p})]})};export{ContentTemplatesStep as default};
