import{r as t,d as a,B as r,h as i,e as s}from"./p-9b6cc562.js";const n=class{constructor(r){t(this,r),this.fireenjinStarRating=a(this,"fireenjinStarRating",7),this.disabled=!1,this.name="rating",this.maxRating=5,this.value=void 0,this.currentRating=void 0}onInput(t){if(this.disabled)return!1;this.currentRating=parseFloat(t.target.value),this.fireenjinStarRating.emit({event:t,name:this.name,value:this.currentRating})}async setCurrentRating(t){this.currentRating=parseFloat(t)}onValueChange(){this.currentRating=parseFloat(this.value)}componentDidLoad(){(null==r?void 0:r.isBrowser)&&(this.currentRating=parseFloat(this.value?this.value:"0"),this.starRatingEl.style.setProperty("--star-rating-max",`${this.maxRating}`))}render(){return i("div",{class:this.disabled?"star-rating is-disabled":"star-rating"},[...Array(this.maxRating)].map(((t,a)=>[i("label",{class:this.currentRating>=this.maxRating-a-.5?"star-active":null},i("input",{type:"radio",name:this.name,value:this.maxRating-a,onInput:t=>this.onInput(t)}),"★")])))}get starRatingEl(){return s(this)}static get watchers(){return{value:["onValueChange"]}}};n.style=".star-rating{display:flex;flex-direction:row-reverse;justify-content:space-around;text-align:center;width:var(\n    --star-rating-width,\n    calc(\n      (var(--star-rating-size, 25px) * var(--star-rating-max, 5)) +\n        var(--star-rating-spacing, -10px)\n    )\n  )}.star-rating input{display:none}.star-rating>label{color:var(--star-rating-default, #fff);font-size:var(--star-rating-size, 25px);cursor:pointer}.star-rating .star-active{color:var(--star-rating-active, var(--ion-color-warning-shade, #f90))}.star-rating:not(.is-disabled) label:hover,.star-rating:not(.is-disabled) label:hover~label{color:var(--star-rating-hover, var(--ion-color-warning-tint, #fc0))}";export{n as fireenjin_star_rating}