import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{Ct as n,St as r,Tt as i,ht as a,kt as o,xt as s,yt as c}from"./StreamlitMarkdown.CwaSe4JX.js";import{t as l}from"./Label.CGzIOlkG.js";import{t as u}from"./useLabel.C-Ykm1VU.js";import{t as d}from"./useNumberFormatter.R-XhPzf8.js";function f(e){let{value:t=0,minValue:n=0,maxValue:r=100,valueLabel:i,isIndeterminate:s,formatOptions:l={style:`percent`}}=e,f=c(e,{labelable:!0}),{labelProps:p,fieldProps:m}=u({...e,labelElementType:`span`});t=a(t,n,r);let h=(t-n)/(r-n),g=d(l);if(!s&&!i){let e=l.style===`percent`?h:t;i=g.format(e)}return{progressBarProps:o(f,{...m,"aria-valuenow":s?void 0:t,"aria-valuemin":n,"aria-valuemax":r,"aria-valuetext":s?void 0:i,role:`progressbar`}),labelProps:p}}var p=e(t(),1),m=(0,p.createContext)(null),h=(0,p.forwardRef)(function(e,t){[e,t]=s(e,t,m);let{value:u=0,minValue:d=0,maxValue:h=100,isIndeterminate:g=!1}=e;u=a(u,d,h);let[_,v]=n(!e[`aria-label`]&&!e[`aria-labelledby`]),{progressBarProps:y,labelProps:b}=f({...e,label:v}),x=g?void 0:(u-d)/(h-d)*100,S=r({...e,defaultClassName:`react-aria-ProgressBar`,values:{percentage:x,valueText:y[`aria-valuetext`],isIndeterminate:g}}),C=c(e,{global:!0});return p.createElement(i.div,{...o(C,S,y),ref:t,slot:e.slot||void 0},p.createElement(l.Provider,{value:{...b,ref:_,elementType:`span`}},S.children))});export{m as n,h as t};