import{r as t,c as i,h as e,H as n}from"./p-4afc0173.js";const a=class{constructor(e){t(this,e),this.sub=i(this,"sub",7),this.sum=i(this,"sum",7),e.$hostElement$["s-ei"]?this.internals=e.$hostElement$["s-ei"]:(this.internals=e.$hostElement$.attachInternals(),e.$hostElement$["s-ei"]=this.internals),this.min=0,this.max=void 0,this.value=1,this.number=void 0}onValueChange(t){this.number="number"==typeof t?t:parseInt(t),this.internals.setFormValue(this.number.toString())}componentWillLoad(){this.number=this.value,this.internals.setFormValue(this.number.toString())}handleChange(t){this.value=t.target.value,this.internals.setFormValue(t.target.value)}onPlusClick(){!Number.isNaN(this.number)&&this.number+1>this.max||(this.number++,this.sum.emit(this.number))}onMinusClick(){!Number.isNaN(this.number)&&this.number-1<this.min||(this.number--,this.sub.emit(this.number))}render(){return e(n,{key:"bf3d39314e4e32c95102aa4fa27747f121f6f16a"},e("x-chip",{key:"3422b39e9b3adfd50325ba305bfbef66b5e69a9e",hoverable:!0},e("x-button",{key:"412df00631a714992838f6fa254e76baf4bafa73",icon:"plus",onClick:this.onPlusClick.bind(this)}),e("input",{key:"5839335e6c343b24e9b5a8f20adde2ee0f824740",type:"number",value:this.number,min:this.min,max:this.max,onInput:this.handleChange.bind(this)}),e("x-button",{key:"0a5ea6ecb54b4fba5a0e5a8def341638220b1714",icon:"minus",onClick:this.onMinusClick.bind(this)})))}static get formAssociated(){return!0}static get watchers(){return{value:["onValueChange"]}}};a.style="x-quantity x-chip x-button button{background-color:transparent !important}x-quantity input{width:2rem;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-weight:bold;text-align:center;display:inline-block;position:relative;margin:0 0.25rem;border:none;background:transparent;outline:none;-moz-appearance:textfield;border-radius:0.25rem}x-quantity input::-webkit-outer-spin-button,x-quantity input::-webkit-inner-spin-button{-webkit-appearance:none}.is-dark-mode x-quantity input{color:var(--color-text-light, #FEFEFE)}";export{a as x_quantity}