import{r as t,h as s,g as i}from"./p-fdd3ce28.js";import"./p-29ab64f2.js";import{g as h}from"./p-cae18608.js";const e=class{constructor(s){t(this,s),this._initialValue=this.value,this._inputCreator=h(this,t=>this.error=!!t),this.handleBlur=()=>{this.hasFocus=!1,this._inputCreator.validate()},this.handleFocus=()=>{this.hasFocus=!0},this.handleInput=t=>{const s=t.target;s&&(this.value=parseInt(s.value,10))}}async reset(){this.value=this._initialValue,this._inputCreator.reset()}async validate(t=!1){return this._inputCreator.validate(t)}watchValue(){const t=null!=this.min?this.min:0,s=null!=this.max?this.max:100,i=100/(s-t),h=(null!=this.value?this.value:Math.round((s-t)/2+t))*i-i*t;this.el.shadowRoot.querySelector("input").style.setProperty("--fill-width",`${h}%`)}componentDidLoad(){this.watchValue()}render(){return s(this._inputCreator,null,s("input",{disabled:this.disabled,max:this.max,min:this.min,step:this.step,type:"range",value:this.value,onBlur:this.handleBlur,onFocus:this.handleFocus,onInput:this.handleInput,"aria-label":this.label}))}get el(){return i(this)}static get watchers(){return{value:["watchValue"]}}static get style(){return":host small{position:absolute;font-size:12px;bottom:-16px;left:12px;text-align:left;-webkit-transition:left 0.15s cubic-bezier(0.4, 0, 0.2, 1);transition:left 0.15s cubic-bezier(0.4, 0, 0.2, 1);color:var(--bce-con2-surface)}:host small:before{content:\"\";position:absolute;left:-6px;font-weight:100}:host([disabled]) small{color:var(--bce-con3-surface)}:host([focus]) small{color:var(--bce-con1-surface)}:host([error]) bce-label{color:var(--bce-c500-error)}:host([error]) small{color:var(--bce-c500-error)}\@media screen and (min-width: 1024px){:host(:not([compact])[label]) small{left:calc(25% + 12px)}}:host{--bce-c300:var(--bce-c300-primary);--bce-c400:var(--bce-c400-primary);--bce-c500:var(--bce-c500-primary);--bce-c600:var(--bce-c600-primary);--bce-c700:var(--bce-c700-primary);--bce-con1:var(--bce-con1-primary);--bce-con2:var(--bce-con2-primary);--bce-con3:var(--bce-con3-primary);--bce-con4:var(--bce-con4-primary);position:relative;display:inline-block}:host input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none;height:4px;border-radius:2px;cursor:pointer;background:-webkit-gradient(linear, left top, right top, from(var(--bce-c500)), color-stop(0, var(--bce-c500-ghost)));background:linear-gradient(to right, var(--bce-c500) var(--fill-width, 50%), var(--bce-c500-ghost) 0)}:host input[type=range]::-webkit-slider-thumb{--bce-c-surface:var(--bce-c001-surface);-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);box-shadow:0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);-webkit-appearance:none;appearance:none;width:14px;height:14px;background-color:var(--bce-c500);border-radius:50%}:host input[type=range]::-moz-range-thumb{--bce-c-surface:var(--bce-c001-surface);box-shadow:0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);width:14px;height:14px;background-color:var(--bce-c500);border-radius:50%;border:none}:host([block]),:host([label]){display:-ms-flexbox;display:flex;-ms-flex-flow:column nowrap;flex-flow:column nowrap;margin:20px 0;min-height:40px}:host([block]) input,:host([label]) input{margin:16px 0}\@media screen and (min-width: 1024px){:host([label]){-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-align:center;align-items:center}:host([label]) bce-label{-ms-flex:1 0 25%;flex:1 0 25%}:host([label]) input{margin:0;-ms-flex:0 0 75%;flex:0 0 75%}}"}};export{e as bce_slider};