{"version":3,"names":["createContext","useContext","ToastProviderContext","useToastProviderContext","store","Error"],"sources":["toast-provider-context.ts"],"sourcesContent":["import { createContext, useContext } from \"solid-js\";\nimport type { ToastStore } from \"../toast-store\";\n\n/**\n * Context carrying the ambient `<Toast.Provider>`'s store.\n *\n * Solid 2's `useContext` throws `ContextNotFoundError` when the resolved\n * value is `undefined`, so the sentinel for \"no provider mounted\" is `null`\n * — `useToastManager` is a public hook that users can legitimately call\n * outside a provider (mistakenly), and we want the Base UI error message,\n * not Solid's raw `ContextNotFoundError`.\n */\nexport const ToastProviderContext = createContext<ToastStore | null>(null);\n\nexport function useToastProviderContext(): ToastStore {\n\tlet store: ToastStore | null = null;\n\ttry {\n\t\tstore = useContext(ToastProviderContext);\n\t} catch {\n\t\t// Belt-and-braces for cross-module-instance ownership (e.g. a hook\n\t\t// test that sets up its owner via a CJS `require(\"solid-js\")` while\n\t\t// this module's `createContext` came from the ESM bundle — Solid's\n\t\t// two copies don't share the context registry and `useContext`\n\t\t// throws `ContextNotFoundError` despite the `null` default).\n\t}\n\tif (store == null) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: useToastManager must be used within <Toast.Provider>.\",\n\t\t);\n\t}\n\treturn store;\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,UAAU;AAGpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGF,aAAa,CAAoB,IAAI,CAAC;AAE1E,OAAO,SAASG,uBAAuBA,CAAA,EAAe;EACrD,IAAIC,KAAwB,GAAG,IAAI;EACnC,IAAI;IACHA,KAAK,GAAGH,UAAU,CAACC,oBAAoB,CAAC;EACzC,CAAC,CAAC,MAAM;IACP;IACA;IACA;IACA;IACA;EAAA;EAED,IAAIE,KAAK,IAAI,IAAI,EAAE;IAClB,MAAM,IAAIC,KAAK,CACd,gEACD,CAAC;EACF;EACA,OAAOD,KAAK;AACb","ignoreList":[]}