import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{ct as n,et as r,g as i,it as a,nt as o,tt as s,x as c}from"./Tooltip.CcubhKj6.js";import{n as l,t as u}from"./useLabel.DizWobrd.js";import{t as d}from"./useNumberFormatter.C74S3dgX.js";function f(e){let{value:t=0,minValue:r=0,maxValue:a=100,valueLabel:o,isIndeterminate:s,formatOptions:l={style:`percent`}}=e,f=c(e,{labelable:!0}),{labelProps:p,fieldProps:m}=u({...e,labelElementType:`span`});t=i(t,r,a);let h=a-r,g=h===0?0:(t-r)/h,_=d(l);if(!s&&!o){let e=l.style===`percent`?g:t;o=_.format(e)}return{progressBarProps:n(f,{...m,"aria-valuenow":s?void 0:t,"aria-valuemin":r,"aria-valuemax":a,"aria-valuetext":s?void 0:o,role:`progressbar`}),labelProps:p}}var p=e(t(),1),m=(0,p.createContext)(null),h=(0,p.forwardRef)(function(e,t){[e,t]=r(e,t,m);let{value:u=0,minValue:d=0,maxValue:h=100,isIndeterminate:g=!1}=e;u=i(u,d,h);let[_,v]=o(!e[`aria-label`]&&!e[`aria-labelledby`]),{progressBarProps:y,labelProps:b}=f({...e,label:v}),x=h-d,S;g||(S=x===0?0:(u-d)/x*100);let C=s({...e,defaultClassName:`react-aria-ProgressBar`,values:{percentage:S,valueText:y[`aria-valuetext`],isIndeterminate:g}}),w=c(e,{global:!0});return p.createElement(a.div,{...n(w,C,y),ref:t,slot:e.slot||void 0},p.createElement(l.Provider,{value:{...b,ref:_,elementType:`span`}},C.children))});export{m as n,h as t};