{"version":3,"names":["dynamic","omit","mergeRootProps","resolveClassStyle","useProgressRootContext","ProgressValue","props","context","content","value","formattedValue","child","children","arg","undefined","userClassStyle","status","userProps","internalSlot","data-indeterminate","data-progressing","data-complete","merged","Tag","as"],"sources":["progress-value.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { omit } from \"solid-js\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\nimport {\n\ttype ProgressRootState,\n\tuseProgressRootContext,\n} from \"../progress-root-context.ts\";\n\nexport interface ProgressValueState extends ProgressRootState {}\n\nexport type ProgressValueChildren =\n\t| JSX.Element\n\t| ((formattedValue: string | null, value: number | null) => JSX.Element);\n\nexport interface ProgressValueProps\n\textends Omit<BaseUIComponentProps<\"span\", ProgressValueState>, \"children\"> {\n\t/**\n\t * Tag/component to render. Defaults to `\"span\"`. Replaces the\n\t * pre-spike `render` prop (axis G).\n\t */\n\tas?: ValidComponent;\n\tchildren?: ProgressValueChildren | undefined;\n}\n\n/**\n * A text label displaying the current value. Renders a `<span>` (or `as`\n * override).\n */\nexport function ProgressValue(props: ProgressValueProps): JSX.Element {\n\tconst context = useProgressRootContext();\n\n\tconst content = (): JSX.Element => {\n\t\tconst value = context.value();\n\t\tconst formattedValue = context.formattedValue();\n\t\tconst child = props.children;\n\t\tif (typeof child === \"function\") {\n\t\t\tconst arg = value == null ? \"indeterminate\" : formattedValue;\n\t\t\treturn child(arg, value);\n\t\t}\n\t\tif (child !== undefined) return child;\n\t\treturn value == null ? null : formattedValue;\n\t};\n\n\t// Resolve `class`/`style` so function values (stateful styling) are invoked\n\t// with the progress state instead of being spread to the DOM raw.\n\tconst userClassStyle = resolveClassStyle(props, () => ({\n\t\tstatus: context.status(),\n\t}));\n\tconst userProps = omit(props, \"as\", \"children\", \"class\", \"style\", \"attrs\");\n\n\tconst internalSlot = {\n\t\t\"aria-hidden\": true,\n\t\tget children(): JSX.Element {\n\t\t\treturn content();\n\t\t},\n\t\tget \"data-indeterminate\"(): \"\" | undefined {\n\t\t\treturn context.status() === \"indeterminate\" ? \"\" : undefined;\n\t\t},\n\t\tget \"data-progressing\"(): \"\" | undefined {\n\t\t\treturn context.status() === \"progressing\" ? \"\" : undefined;\n\t\t},\n\t\tget \"data-complete\"(): \"\" | undefined {\n\t\t\treturn context.status() === \"complete\" ? \"\" : undefined;\n\t\t},\n\t};\n\n\tlet merged: Record<string, unknown> = mergeRootProps(\n\t\tinternalSlot,\n\t\tuserClassStyle,\n\t);\n\tmerged = mergeRootProps(merged, userProps);\n\n\tconst Tag = dynamic(() => props.as ?? \"span\");\n\treturn <Tag {...merged} />;\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,IAAI,QAAQ,UAAU;AAC/B,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,iBAAiB,QAAQ,qCAAqC;AAEvE,SAECC,sBAAsB,QAChB,6BAA6B;AAkBpC;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,KAAyB,EAAe;EACrE,MAAMC,OAAO,GAAGH,sBAAsB,CAAC,CAAC;EAExC,MAAMI,OAAO,GAAGA,CAAA,KAAmB;IAClC,MAAMC,KAAK,GAAGF,OAAO,CAACE,KAAK,CAAC,CAAC;IAC7B,MAAMC,cAAc,GAAGH,OAAO,CAACG,cAAc,CAAC,CAAC;IAC/C,MAAMC,KAAK,GAAGL,KAAK,CAACM,QAAQ;IAC5B,IAAI,OAAOD,KAAK,KAAK,UAAU,EAAE;MAChC,MAAME,GAAG,GAAGJ,KAAK,IAAI,IAAI,GAAG,eAAe,GAAGC,cAAc;MAC5D,OAAOC,KAAK,CAACE,GAAG,EAAEJ,KAAK,CAAC;IACzB;IACA,IAAIE,KAAK,KAAKG,SAAS,EAAE,OAAOH,KAAK;IACrC,OAAOF,KAAK,IA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