{"version":3,"names":["createContext","useContext","AvatarRootContext","useAvatarRootContext","context","Error"],"sources":["avatar-root-context.ts"],"sourcesContent":["import { type Accessor, createContext, useContext } from \"solid-js\";\n\n/**\n * Image-loading status reported by `<Avatar.Image>` into the root context so\n * that `<Avatar.Fallback>` can decide whether to render.\n *\n * - `idle`     — no image mounted yet (or src is absent)\n * - `loading`  — a real image has been attached and is fetching\n * - `loaded`   — the image's `onload` fired; the image is visible\n * - `error`    — the image's `onerror` fired (or src was empty)\n */\nexport type ImageLoadingStatus = \"idle\" | \"loading\" | \"loaded\" | \"error\";\n\nexport interface AvatarRootContextValue {\n\t/** Reactive accessor for the current image-loading status. */\n\timageLoadingStatus: Accessor<ImageLoadingStatus>;\n\t/** Setter invoked by `<Avatar.Image>` on each load/error transition. */\n\tsetImageLoadingStatus: (next: ImageLoadingStatus) => void;\n}\n\n/**\n * Avatar root context. `createContext<T | null>(null)` + `== null` sentinel\n * — Solid 2's `useContext` throws `ContextNotFoundError` when\n * the default is `undefined`, which would shadow the intended Base UI error\n * message below.\n */\nexport const AvatarRootContext = createContext<AvatarRootContextValue | null>(\n\tnull,\n);\n\n/**\n * Read the `<Avatar.Root>` context. Throws a descriptive error if the caller\n * forgot to wrap their subtree in `<Avatar.Root>` — matches Base UI React.\n */\nexport function useAvatarRootContext(): AvatarRootContextValue {\n\tconst context = useContext(AvatarRootContext);\n\tif (context == null) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: AvatarRootContext is missing. Avatar parts must be placed within <Avatar.Root>.\",\n\t\t);\n\t}\n\treturn context;\n}\n"],"mappings":"AAAA,SAAwBA,aAAa,EAAEC,UAAU,QAAQ,UAAU;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGF,aAAa,CAC7C,IACD,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASG,oBAAoBA,CAAA,EAA2B;EAC9D,MAAMC,OAAO,GAAGH,UAAU,CAACC,iBAAiB,CAAC;EAC7C,IAAIE,OAAO,IAAI,IAAI,EAAE;IACpB,MAAM,IAAIC,KAAK,CACd,0FACD,CAAC;EACF;EACA,OAAOD,OAAO;AACf","ignoreList":[]}