'use client';

// src/components/Stepper/context.tsx
import * as React from "react";
import { jsx } from "react/jsx-runtime";
var StepperContext = React.createContext({
  steps: [],
  activeStep: 0,
  initialStep: 0,
  nextStep: () => {
  },
  prevStep: () => {
  },
  resetSteps: () => {
  },
  setStep: () => {
  }
});
var StepperProvider = ({ value, children }) => {
  const isError = value.state === "error";
  const isLoading = value.state === "loading";
  const [activeStep, setActiveStep] = React.useState(value.initialStep);
  const nextStep = () => {
    setActiveStep((prev) => prev + 1);
  };
  const prevStep = () => {
    setActiveStep((prev) => prev - 1);
  };
  const resetSteps = () => {
    setActiveStep(value.initialStep);
  };
  const setStep = (step) => {
    setActiveStep(step);
  };
  return /* @__PURE__ */ jsx(
    StepperContext.Provider,
    {
      value: {
        ...value,
        isError,
        isLoading,
        activeStep,
        nextStep,
        prevStep,
        resetSteps,
        setStep
      },
      children
    }
  );
};
export {
  StepperContext,
  StepperProvider
};
