import{c as W,e as X,a as Y,p as s,y as Z,x as R,i as t,s as $,b as y,t as ee,k as te,d as ae,w as v,f as B,h as C,m as i,q as D,v as re,r as A}from"../../custom-element.js";import{i as ne}from"../../if.js";import{e as se}from"../../each.js";import{c as ie}from"../../svelte-component.js";import{e as oe}from"../../svelte-element.js";import{a as V}from"../../attributes.js";import{c as le}from"../../custom-element-forward-events.js";import{S as ce,k as ve,l as me}from"../../Condition20.js";import"../../branches.js";var fe=B("<span><!></span>"),ge=B('<span class="mc-star-rating__info svelte-17npafv"> </span>'),pe=B("<div></div> <!>",1);const de={hash:"svelte-17npafv",code:`/**
 * Do not edit directly, this file was auto-generated.
 */.mc-star-rating.svelte-17npafv {display:inline-flex;align-items:center;gap:0.5rem;}.mc-star-rating--standard.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {fill:var(--star-rating-color-icon-standard, #000000);}.mc-star-rating--accent.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {fill:var(--star-rating-color-icon-accent, #ea7315);}.mc-star-rating--slider.svelte-17npafv {cursor:pointer;}.mc-star-rating--link.svelte-17npafv {text-decoration:none;cursor:pointer;}.mc-star-rating--link.svelte-17npafv:not(:hover) .mc-star-rating__info:where(.svelte-17npafv) {text-decoration:underline;}.mc-star-rating--s.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {width:1.25rem;height:1.25rem;}.mc-star-rating--s.svelte-17npafv .mc-star-rating__info:where(.svelte-17npafv) {font-size:var(--font-size-100, 0.875rem);}.mc-star-rating--m.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {width:1.5rem;height:1.5rem;}.mc-star-rating--m.svelte-17npafv .mc-star-rating__info:where(.svelte-17npafv) {font-size:var(--font-size-150, 1rem);}.mc-star-rating--l.svelte-17npafv .mc-star-rating__icon:where(.svelte-17npafv) {width:2rem;height:2rem;}.mc-star-rating--l.svelte-17npafv .mc-star-rating__info:where(.svelte-17npafv) {font-size:var(--font-size-200, 1.125rem);}.mc-star-rating__wrapper.svelte-17npafv {display:flex;align-items:center;}.mc-star-rating__info.svelte-17npafv {font-weight:var(--font-weight-medium, 600);line-height:var(--line-height-s, 1.3);color:var(--star-rating-color-text, #000000);}.mc-star-rating__icon.svelte-17npafv svg {height:100%;width:100%;}`};function ue(E,a){X(a,!0),Y(E,de);let o=s(a,"rating",15),x=s(a,"readonly",7),p=s(a,"size",7,"m"),m=s(a,"compact",7),d=s(a,"appearance",7,"standard"),f=s(a,"text",7),r=s(a,"href",7),k=s(a,"target",7),b=re(null);const F=v(()=>r()?"a":"div"),g=v(()=>[x(),m(),r(),f()].some(Boolean)),j=v(()=>({"mc-star-rating":!0,"mc-star-rating--link":r(),"mc-star-rating--slider":!t(g),[`mc-star-rating--${p()}`]:p(),[`mc-star-rating--${d()}`]:d()})),z=v(()=>t(b)??o()),u=v(()=>m()?1:5);function q(e){return m()||t(z)>=e+1?ce:t(g)&&t(z)>=e+.5?ve:me}function K(e){D(b,e+1)}function H(){D(b,null)}function L(e){o(e+1)}function N(e){const h=e.key;let n=Math.floor(o());if(h==="ArrowRight")n=Math.min(t(u),n+1);else if(h==="ArrowLeft")n=Math.max(1,n-1);else return;o(n),e.preventDefault()}const O=v(()=>t(g)?{tabindex:-1}:{onkeydown:N,onmouseleave:H,onblur:H,tabindex:0,"aria-valuemin":0,"aria-valuemax":t(u),"aria-valuenow":o(),"aria-readonly":!1});var T={get rating(){return o()},set rating(e){o(e),i()},get readonly(){return x()},set readonly(e){x(e),i()},get size(){return p()},set size(e="m"){p(e),i()},get compact(){return m()},set compact(e){m(e),i()},get appearance(){return d()},set appearance(e="standard"){d(e),i()},get text(){return f()},set text(e){f(e),i()},get href(){return r()},set href(e){r(e),i()},get target(){return k()},set target(e){k(e),i()}},M=Z(),G=R(M);return oe(G,()=>t(F),!1,(e,h)=>{V(e,()=>({href:r(),target:k(),class:t(j)}),void 0,void 0,void 0,"svelte-17npafv");var n=pe(),_=R(n);V(_,()=>({class:"mc-star-rating__wrapper",role:t(g)?"img":"slider","aria-label":`Note ${t(z)} sur ${t(u)}`,...t(O)}),void 0,void 0,void 0,"svelte-17npafv"),se(_,20,()=>Array.from({length:t(u)}).keys(),l=>l,(l,c)=>{const S=v(()=>q(c));var w=fe();V(w,()=>({class:"mc-star-rating__icon",...t(g)?{}:{onmousemove:()=>K(c),onclick:()=>L(c)}}),void 0,void 0,void 0,"svelte-17npafv");var P=C(w);ie(P,()=>t(S),(Q,U)=>{U(Q,{})}),A(w),y(l,w)}),A(_);var I=$(_,2);{var J=l=>{var c=ge(),S=C(c,!0);A(c),ee(()=>te(S,f()||r())),y(l,c)};ne(I,l=>{(f()||r())&&l(J)})}y(h,n)}),y(E,M),ae(T)}customElements.define("m-star-rating",W(ue,{readonly:{attribute:"readonly",reflect:!0,type:"Boolean"},compact:{attribute:"compact",reflect:!0,type:"Boolean"},rating:{},size:{},appearance:{},text:{},href:{},target:{}},[],[],{mode:"open"},le));
//# sourceMappingURL=StarRating.js.map
