import { inject, provide } from "vue"; function createContext(providerComponentName, contextName) { const symbolDescription = typeof providerComponentName === "string" && !contextName ? `${providerComponentName}Context` : contextName; const injectionKey = Symbol(symbolDescription); const injectContext = (fallback) => { const context = inject(injectionKey, fallback); if (context === void 0) throw new Error(`Injection \`${injectionKey.toString()}\` not found. Component must be used within ${Array.isArray(providerComponentName) ? `one of the following components: ${providerComponentName.join(", ")}` : `\`${providerComponentName}\``}`); return context; }; const provideContext = (contextValue) => { provide(injectionKey, contextValue); return contextValue; }; return [ injectContext, provideContext, injectionKey ]; } export { createContext };