import{__awaiter,__generator}from"tslib";import{r as registerInstance,h,H as Host,g as getElement}from"./index-4d3658f6.js";import{B as BEM}from"./bem-8c7d2eb0.js";import{b as balBreakpoints}from"./breakpoints.subject-bd83ea04.js";import{L as ListenToBreakpoints}from"./breakpoints.decorator-69c1d1da.js";import"./helpers-b53ad333.js";import"./browser-a623d3a0.js";import"./icons.constant-47b0ca12.js";import"./config.utils-8fe5be10.js";import"./device-85159a44.js";import"./listener-aa4bfae3.js";import"./tokens.esm-7faeb0d0.js";var balProgressBarCss=":root{--bal-progress-bar-background-white:var(--bal-color-white);--bal-progress-bar-background-grey:var(--bal-color-grey-3);--bal-progress-bar-line-background:var(--bal-color-primary);--bal-progress-bar-line-radius:var(--bal-radius-rounded)}.bal-progress-bar{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:block;width:100%;min-width:0;height:.25rem}.bal-progress-bar--background-white{background:var(--bal-progress-bar-background-white)}.bal-progress-bar--background-grey{background:var(--bal-progress-bar-background-grey)}.bal-progress-bar__line{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:block;height:.25rem;width:0;background:var(--bal-progress-bar-line-background);border-top-right-radius:var(--bal-progress-bar-line-radius);border-bottom-right-radius:var(--bal-progress-bar-line-radius)}.bal-progress-bar__line--animated{will-change:width;-webkit-transition:all var(--bal-animation-transition-duration) var(--bal-animation-transition-easing);transition:all var(--bal-animation-transition-duration) var(--bal-animation-transition-easing)}.bal-progress-bar__line--full{border-top-right-radius:0;border-bottom-right-radius:0}";var BalProgressBarStyle0=balProgressBarCss;var __decorate=undefined&&undefined.__decorate||function(r,e,a,t){var s=arguments.length,o=s<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,a):t,i;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(r,e,a,t);else for(var n=r.length-1;n>=0;n--)if(i=r[n])o=(s<3?i(o):s>3?i(e,a,o):i(e,a))||o;return s>3&&o&&Object.defineProperty(e,a,o),o};var ProgressBar=function(){function r(r){registerInstance(this,r);this.animated=true;this.isTouch=balBreakpoints.isTouch;this.value=0;this.background="white"}r.prototype.componentDidRender=function(){this.updateProgress()};r.prototype.breakpointListener=function(r){this.updateProgress()};r.prototype.configChanged=function(r){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.animated=r.animated;return[2]}))}))};r.prototype.updateProgress=function(){if(this.lineEl){var r=this.el.clientWidth;var e=Math.max(0,Math.min(100,this.value));var a=r/100*e;this.lineEl.style.width="".concat(a,"px");if(e===100){this.lineEl.classList.add("bal-progress-bar__line--full")}else{this.lineEl.classList.remove("bal-progress-bar__line--full")}}};r.prototype.render=function(){var r=this;var e=BEM.block("progress-bar");var a=e.element("line");return h(Host,{class:Object.assign(Object.assign({},e.class()),e.modifier("background-".concat(this.background)).class())},h("div",{class:Object.assign(Object.assign({},a.class()),a.modifier("animated").class(this.animated)),ref:function(e){return r.lineEl=e}}))};Object.defineProperty(r.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return r}();__decorate([ListenToBreakpoints()],ProgressBar.prototype,"breakpointListener",null);ProgressBar.style=BalProgressBarStyle0;export{ProgressBar as bal_progress_bar};