{"version":3,"names":["dynamic","omit","untrack","useFieldsetContext","mergeRootProps","resolveClassStyle","useRegisteredLabelId","FieldsetLegend","props","context","idOverride","id","undefined","setLegendId","_id","userStyling","disabled","userHtmlProps","internalProps","data-disabled","styledUserProps","merged","Tag","as"],"sources":["fieldset-legend.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { omit, untrack } from \"solid-js\";\nimport { useFieldsetContext } from \"../../internals/fieldset-context.ts\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\nimport { useRegisteredLabelId } from \"../../internals/use-registered-label-id\";\n\nexport interface FieldsetLegendState {\n\t/** Mirrors the root's `disabled` flag. */\n\tdisabled: boolean;\n}\n\nexport interface FieldsetLegendProps\n\textends BaseUIComponentProps<\"legend\", FieldsetLegendState> {\n\t/** Tag/component to render. Defaults to `\"legend\"`. */\n\tas?: ValidComponent;\n}\n\n/**\n * An accessible label that is automatically associated with the fieldset.\n * Renders a `<legend>` element (or `as` override).\n *\n * On mount, registers its id with the root so `aria-labelledby` wires up.\n * On unmount, clears the registration. The root's `legendId` signal opts into\n * `ownedWrite` so the write from `useRegisteredLabelId`'s owned setup/cleanup\n * doesn't trip the Solid 2 write-in-owned-scope check.\n */\nexport function FieldsetLegend(props: FieldsetLegendProps): JSX.Element {\n\tconst context = useFieldsetContext();\n\n\t// `untrack` silences the dev-mode STRICT_READ_UNTRACKED warning (RFC 08)\n\t// that fires on any top-level reactive prop read. The id is only consumed\n\t// once during setup by `useBaseUiId`.\n\tconst idOverride = untrack(() =>\n\t\ttypeof props.id === \"string\" ? props.id : undefined,\n\t);\n\t// When rendered outside a real `<Fieldset.Root>` (the NOOP context),\n\t// `setLegendId` is absent — fall back to a no-op so the legend still\n\t// generates a stable id locally without blowing up.\n\tconst setLegendId = context.setLegendId ?? ((_id: string | undefined) => {});\n\tconst id = useRegisteredLabelId(idOverride, setLegendId);\n\n\t// Strip the consumer's `id` so the authoritative `id` we emit below wins.\n\tconst userStyling = resolveClassStyle(props, () => ({\n\t\tdisabled: context.disabled(),\n\t}));\n\n\tconst userHtmlProps = omit(\n\t\tprops,\n\t\t\"class\",\n\t\t\"style\",\n\t\t\"attrs\",\n\t\t\"as\",\n\t\t\"id\",\n\t) as Record<string, unknown>;\n\n\tconst internalProps = {\n\t\tid,\n\t\tget \"data-disabled\"(): \"\" | undefined {\n\t\t\treturn context.disabled() ? \"\" : undefined;\n\t\t},\n\t};\n\tconst styledUserProps = mergeRootProps(userStyling, userHtmlProps);\n\n\tconst merged = mergeRootProps(internalProps, styledUserProps);\n\n\tconst Tag = dynamic(() => props.as ?? \"legend\");\n\treturn <Tag {...merged} />;\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,IAAI,EAAEC,OAAO,QAAQ,UAAU;AACxC,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,iBAAiB,QAAQ,qCAAqC;AAEvE,SAASC,oBAAoB,QAAQ,yCAAyC;AAa9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,KAA0B,EAAe;EACvE,MAAMC,OAAO,GAAGN,kBAAkB,CAAC,CAAC;;EAEpC;EACA;EACA;EACA,MAAMO,UAAU,GAAGR,OAAO,CAAC,MAC1B,OAAOM,KAAK,CAACG,EAAE,KAAK,QAAQ,GAAGH,KAAK,CAACG,EAAE,GAAGC,SAC3C,CAAC;EACD;EACA;EACA;EACA,MAAMC,WAAW,GAAGJ,OAAO,CAACI,WAAW,KAAMC,GAAuB,IAAK,CAAC,CAAC,CAAC;EAC5E,MAAMH,EAAE,GAAGL,oBAAoB,CAACI,UAAU,EAAEG,WAAW,CAAC;;EAExD;EACA,MAAME,WAAW,GAAGV,iBAAiB,CAACG,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