import { createVNode as _createVNode } from "vue";
import { inject, shallowRef } from "vue";
const ProvidersKey = Symbol.for("veno-ui:providers");
function createProviders(app, options) {
  const providers = shallowRef({
    ...options
  });
  Object.values(providers.value).forEach((provider) => {
    provider.register?.(app);
  });
  function createRootProvider() {
    return Object.values(providers.value).reduce((Prev, Cur) => (props, {
      slots
    }) => _createVNode(Prev, {
      "registered": true
    }, {
      default: () => [_createVNode(Cur, {
        "registered": true
      }, {
        default: () => [slots.default?.()]
      })]
    }), (props, {
      slots
    }) => slots.default?.());
  }
  function get(key) {
    return providers.value[key];
  }
  function set(key, value) {
    providers.value[key] = value;
  }
  return {
    providers,
    get,
    set,
    createRootProvider
  };
}
function useProviders() {
  const providers = inject(ProvidersKey);
  if (!providers)
    throw new Error("Could not find Veno UI providers injection");
  return providers;
}
export {
  ProvidersKey,
  createProviders,
  useProviders
};
//# sourceMappingURL=index.mjs.map
