import { inject, shallowRef, createVNode } from "vue";
const ProvidersKey = Symbol.for("veno-ui:providers");
function createProviders(app, options) {
  const providers = shallowRef({
    ...options
  });
  Object.values(providers.value).forEach((provider) => {
    var _a;
    (_a = provider.register) == null ? void 0 : _a.call(provider, app);
  });
  function createRootProvider() {
    return Object.values(providers.value).reduce((Prev, Cur) => {
      return (props, {
        slots
      }) => createVNode(Prev, {
        "registered": true
      }, {
        default: () => [createVNode(Cur, {
          "registered": true
        }, {
          default: () => {
            var _a;
            return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
          }
        })]
      });
    }, (props, {
      slots
    }) => {
      var _a;
      return (_a = slots.default) == null ? void 0 : _a.call(slots);
    });
  }
  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
