import{u as useSelector,r as reactExports,j as jsxRuntimeExports}from"./js-core.esm4.js";import{CombinedPackagesTable}from"./js-core.esm11.js";import{a as usePackageButtonsStyles}from"./js-core.esm97.js";import{g as selectSelectedPackageIds,h as selectPackages,i as selectPackagesStatus,j as selectResourcePagination,f as actions$2,k as selectActiveStep,e as actions}from"./js-core.esm98.js";import{B as Button,M as MemoizedFormattedMessage}from"./js-core.esm7.js";import"./js-core.esm9.js";import{B as Box}from"./js-core.esm8.js";import{u as useDispatch}from"./js-core.esm12.js";import"./js-core.esm15.js";import"./js-core.esm16.js";import"./js-core.esm17.js";import"./js-core.esm18.js";var ActionButtons=function(e){var s=e.onNextClick,e=usePackageButtonsStyles().classes,t=useDispatch(),a=useSelector(selectActiveStep);return jsxRuntimeExports.jsxs(Box,{className:e.actionButtonContainer,children:[jsxRuntimeExports.jsx(Button,{variant:"text",onClick:function(){return t(actions.setActiveStep(a-1))},"data-testid":"action-button.back",children:jsxRuntimeExports.jsx(MemoizedFormattedMessage,{id:"instance-admin-center.create-org.packages.back-btn",defaultMessage:"Back",description:"Back label"})}),jsxRuntimeExports.jsx(Button,{variant:"contained",onClick:function(){s&&s(),t(actions.setActiveStep(a+1))},"data-testid":"action-button.next",children:jsxRuntimeExports.jsx(MemoizedFormattedMessage,{id:"instance-admin-center.create-org.packages.next-btn",defaultMessage:"Next",description:"Next label"})})]})},Packages=function(){var s=useDispatch(),e=useSelector(selectSelectedPackageIds),t=useSelector(selectPackages),a=useSelector(selectPackagesStatus),o=useSelector(selectResourcePagination),c=o.hasMore,o=o.offset,r=(reactExports.useEffect(function(){s(actions$2.fetchPackagesStart({filter:"",reset:!0}))},[s,""]),reactExports.useCallback(function(e){s(actions$2.toggleWizardPackageSelection(e))},[s])),i=reactExports.useCallback(function(){s(actions$2.fetchPackagesStart({filter:"",reset:!1}))},[s,""]);return jsxRuntimeExports.jsxs(Box,{sx:{height:"100%",display:"flex",flexDirection:"column"},children:[jsxRuntimeExports.jsx(Box,{sx:{flexGrow:1,overflow:"hidden"},children:jsxRuntimeExports.jsx(CombinedPackagesTable,{mode:"wizard",items:t,isLoading:"loading"===a,hasMore:c,offset:o,error:"failure"===a,fetchMore:i,wizardSelectedPackageIds:e,onWizardToggle:r,onOpenPackageDetails:function(){}})}),jsxRuntimeExports.jsx(ActionButtons,{})]})};export{Packages as default};
