import{hb as I,ib as F,vb as S}from"./chunk-ROXKKVPK.js";import{C as p,D as u,G as m,Pa as g,Qb as V,Rc as v,S as d,Ta as y,Va as O,X as f,ab as x,ba as o,bd as w,fa as _,fb as P,ha as C,ia as h,ja as E,ka as s,la as l,ra as M,ta as b,va as c,xb as R}from"./chunk-ZVAMPSQU.js";var T=i=>({rating:i}),k=i=>({pointer:i});function A(i,e){if(i&1){let a=M();s(0,"ion-icon",2),b("click",function(){let n=p(a).$index,r=c();return u(r.setRating(n+1))}),l()}if(i&2){let a=e.$implicit,t=c();E("name",a)("ngClass",g(3,k,t.enableEdit)),o("aria-hidden",t.enableEdit?null:"true")}}var W=(()=>{let e=class e{set rating(t){this._rating=t||0,this.updateRatingVisual()}get rating(){return this._rating}get filledStarCount(){return this.ratingVisual.filter(t=>t==="star").length}constructor(){this.ratingChanged=new m,this._rating=0,this.enableEdit=!1,this.ratingVisual=new Array(5).fill("star-outline"),S({star:I,starOutline:F})}updateRatingVisual(){var t,n;this.ratingVisual=new Array(5).fill("star",0,(t=this.rating)!=null?t:void 0).fill("star-outline",(n=this.rating)!=null?n:void 0,5)}setRating(t){this.enableEdit&&(t===this.rating&&(t=0),this.ratingChanged.emit(t))}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=f({type:e,selectors:[["rating"]],inputs:{rating:"rating",enableEdit:"enableEdit"},outputs:{ratingChanged:"ratingChanged"},decls:4,vars:7,consts:[[1,"rating-stars"],[3,"name","ngClass"],[3,"click","name","ngClass"]],template:function(n,r){n&1&&(s(0,"span",0),y(1,"translate"),C(2,A,1,5,"ion-icon",1,_),l()),n&2&&(o("role",r.enableEdit?null:"img")("aria-label",r.enableEdit?null:O(1,2,"components.rating.label",g(5,T,r.filledStarCount))),d(2),h(r.ratingVisual))},dependencies:[P,x,V,R,v,w],styles:[".rating-stars[_ngcontent-%COMP%]{display:inline-flex;vertical-align:middle}.rating-stars[_ngcontent-%COMP%] > ion-icon[_ngcontent-%COMP%]{margin-right:2px}.rating-stars[_ngcontent-%COMP%] > ion-icon.pointer[_ngcontent-%COMP%]{cursor:pointer;transition:transform .1s ease,opacity .1s ease}.rating-stars[_ngcontent-%COMP%] > ion-icon.pointer[_ngcontent-%COMP%]:hover{transform:scale(1.15);opacity:.85}"]});let i=e;return i})();export{W as a};
