"use client";
'use strict';

const jsxRuntime = require('react/jsx-runtime');
const React = require('react');

const StackContext = React.createContext(null);
function StackProvider({
  children,
  overrides,
  basePath
}) {
  const value = {
    overrides,
    basePath
  };
  return /* @__PURE__ */ jsxRuntime.jsx(StackContext.Provider, { value, children });
}
function useStack() {
  const context = React.useContext(
    StackContext
  );
  if (!context) {
    throw new Error(
      "useStack must be used within StackProvider. Wrap your app with <StackProvider> in your layout file."
    );
  }
  return context;
}
function usePluginOverrides(pluginName, defaultValues) {
  const context = useStack();
  const pluginOverrides = context.overrides[pluginName];
  const overrides = defaultValues ? { ...defaultValues, ...pluginOverrides } : pluginOverrides;
  return overrides;
}
function useBasePath() {
  const context = useStack();
  if (!context) {
    throw new Error(
      "useBasePath must be used within StackProvider. Wrap your app with <StackProvider> in your layout file."
    );
  }
  return context.basePath;
}

exports.StackProvider = StackProvider;
exports.useBasePath = useBasePath;
exports.usePluginOverrides = usePluginOverrides;
exports.useStack = useStack;
