import{c as D,e as G,a as N,p as z,B as R,s as g,i as t,b as T,d as V,f as H,l as J,h as a,w as j,m as y,v as K,r as n,q as M}from"../../custom-element.js";import{s as A}from"../../slot.js";import{a as Q}from"../../attributes.js";import{b as U}from"../../this.js";import{I as B}from"../iconbutton/IconButton.js";import{G as W,F as X}from"../../Condition20.js";import"../../if.js";import"../../branches.js";import"../loader/Loader.js";var Y=H('<div><div class="mc-carousel__header svelte-10qqjzd"><div class="mc-carousel__headings svelte-10qqjzd"><!></div> <div class="mc-carousel__controls svelte-10qqjzd"><!> <!></div></div> <div class="mc-carousel__content svelte-10qqjzd"><!></div></div>');const Z={hash:"svelte-10qqjzd",code:`/**
 * Do not edit directly, this file was auto-generated.
 */.mt-title.svelte-10qqjzd {font-weight:var(--font-accent, 600);}.mt-title--l.svelte-10qqjzd {font-size:var(--font-title-l, 1.75rem);line-height:calc(var(--font-title-l, 1.75rem) * var(--line-height-s, 1.3));}.mt-title--m.svelte-10qqjzd {font-size:var(--font-title-m, 1.5rem);line-height:calc(var(--font-title-m, 1.5rem) * var(--line-height-s, 1.3));}.mt-title--s.svelte-10qqjzd {font-size:var(--font-title-s, 1.125rem);line-height:calc(var(--font-title-s, 1.125rem) * var(--line-height-s, 1.3));}.mc-carousel.svelte-10qqjzd {display:flex;flex-direction:column;row-gap:1rem;}.mc-carousel__header.svelte-10qqjzd {display:flex;align-items:flex-start;}.mc-carousel__headings.svelte-10qqjzd {display:flex;flex-direction:column;row-gap:0.25rem;flex:1;align-items:flex-start;color:var(--color-text-primary, #000000);}.mc-carousel__controls.svelte-10qqjzd {display:flex;column-gap:0.5rem;margin:0.25rem 0.25rem 0 0;}.mc-carousel__content.svelte-10qqjzd {display:flex;overflow-x:auto;scroll-snap-type:x mandatory;}.mc-carousel__content.svelte-10qqjzd > :where(.svelte-10qqjzd) {scroll-snap-align:start;}::slotted(*) {scroll-snap-align:start;}::slotted(.mc-carousel__title) {margin:0;}::slotted(.mc-carousel__sub-title) {margin:0;}`};function ee(p,s){G(s,!0),N(p,Z);let d=z(s,"previousButtonAriaLabel",7,"previous"),u=z(s,"nextButtonAriaLabel",7,"next"),L=J(s,["$$slots","$$events","$$legacy","$$host","previousButtonAriaLabel","nextButtonAriaLabel"]),r=K(0),l=null,v=null;const w={behavior:"smooth",block:"nearest",inline:"center"};function o(){if(!l)return[];const e=l.querySelector("slot");return e?e.assignedElements({flatten:!0}):[]}function q(e){o()[e]?.scrollIntoView(w)}function C(){t(r)>0&&q(t(r)-1)}function $(){const e=o();t(r)<e.length-1&&q(t(r)+1)}R(()=>{if(l)return v=new IntersectionObserver(e=>{const i=e.find(_=>_.isIntersecting);if(i){const _=o();M(r,_.findIndex(S=>S===i.target),!0)}},{root:l,threshold:.9}),o().forEach(e=>v.observe(e)),()=>v?.disconnect()});const I=j(()=>t(r)===0),k=j(()=>t(r)===o().length-1);var E={get previousButtonAriaLabel(){return d()},set previousButtonAriaLabel(e="previous"){d(e),y()},get nextButtonAriaLabel(){return u()},set nextButtonAriaLabel(e="next"){u(e),y()}},c=Y();Q(c,()=>({class:"mc-carousel",role:"group","aria-roledescription":"carousel","aria-labelledby":"mc-carousel__title",...L}),void 0,void 0,void 0,"svelte-10qqjzd");var m=a(c),f=a(m),P=a(f);A(P,s,"header",{},null),n(f);var b=g(f,2),x=a(b);B(x,{size:"s",outlined:!0,onclick:C,get disabled(){return t(I)},get"aria-label"(){return d()},$$slots:{icon:(e,i)=>{W(e,{slot:"icon"})}}});var F=g(x,2);B(F,{size:"s",outlined:!0,onclick:$,get disabled(){return t(k)},get"aria-label"(){return u()},$$slots:{icon:(e,i)=>{X(e,{slot:"icon"})}}}),n(b),n(m);var h=g(m,2),O=a(h);return A(O,s,"default",{},null),n(h),U(h,e=>l=e,()=>l),n(c),T(p,c),V(E)}customElements.define("m-carousel",D(ee,{previousButtonAriaLabel:{},nextButtonAriaLabel:{}},["header","default"],[],{mode:"open"}));
//# sourceMappingURL=Carousel.js.map
