} @media (prefers-reduced-motion) { :where(.carousel__slides) { scroll-behavior: auto; } } .carousel__slides--horizontal { grid-auto-flow: column; grid-auto-columns: var(--slide-size); grid-auto-rows: 100%; column-gap: var(--slide-gap); scroll-snap-type: x mandatory; scroll-padding-inline: var(--scroll-hint); padding-inline: var(--scroll-hint); overflow-y: hidden; } .carousel__slides--vertical { grid-auto-flow: row; grid-auto-columns: 100%; grid-auto-rows: var(--slide-size); row-gap: var(--slide-gap); scroll-snap-type: y mandatory; scroll-padding-block: var(--scroll-hint); padding-block: var(--scroll-hint); overflow-x: hidden; } .carousel__slides--dragging { } :host([vertical]) ::slotted(sl-carousel-item) { height: 100%; } .carousel__slides::-webkit-scrollbar { display: none; } .carousel__navigation { grid-area: navigation; display: contents; font-size: var(--sl-font-size-x-large); } .carousel__navigation-button { flex: 0 0 auto; display: flex; align-items: center; background: none; border: none; border-radius: var(--sl-border-radius-small); font-size: inherit; color: var(--sl-color-neutral-600); padding: var(--sl-spacing-x-small); cursor: pointer; transition: var(--sl-transition-medium) color; appearance: none; } .carousel__navigation-button--disabled { opacity: 0.5; cursor: not-allowed; } .carousel__navigation-button--disabled::part(base) { pointer-events: none; } .carousel__navigation-button--previous { grid-column: 1; grid-row: 1; } .carousel__navigation-button--next { grid-column: 3; grid-row: 1; } .carousel__pagination-item { display: block; cursor: pointer; background: none; border: 0; border-radius: var(--sl-border-radius-circle); width: var(--sl-spacing-small); height: var(--sl-spacing-small); background-color: var(--sl-color-neutral-300); padding: 0; margin: 0; } .carousel__pagination-item--active { background-color: var(--sl-color-neutral-700); transform: scale(1.2); } /* Focus styles */ .carousel__slides:focus-visible, .carousel__navigation-button:focus-visible, .carousel__pagination-item:focus-visible { outline: var(--sl-focus-ring); outline-offset: var(--sl-focus-ring-offset); } `;var Dl=class extends rr{constructor(){super(...arguments),this.loop=!1,this.navigation=!1,this.pagination=!1,this.autoplay=!1,this.autoplayInterval=3e3,this.slidesPerPage=1,this.slidesPerMove=1,this.orientation="horizontal",this.mouseDragging=!1,this.activeSlide=0,this.scrolling=!1,this.dragging=!1,this.autoplayController=new Ml(this,(()=>this.next())),this.localize=new Ui(this),this.handleMouseDrag=e=>{this.dragging||(this.scrollContainer.style.setProperty("scroll-snap-type","none"),this.dragging=!0),this.scrollContainer.scrollBy({left:-e.movementX,top:-e.movementY,behavior:"instant"})},this.handleMouseDragEnd=()=>{const e=this.scrollContainer;document.removeEventListener("pointermove",this.handleMouseDrag,{capture:!0});const t=e.scrollLeft,o=e.scrollTop;e.style.removeProperty("scroll-snap-type"),e.style.setProperty("overflow","hidden");const r=e.scrollLeft,n=e.scrollTop;e.style.removeProperty("overflow"),e.style.setProperty("scroll-snap-type","none"),e.scrollTo({left:t,top:o,behavior:"instant"}),requestAnimationFrame((async()=>{t===r&&o===n||(e.scrollTo({left:r,top:n,behavior:Mi()?"auto":"smooth"}),await Ei(e,"scrollend")),e.style.removeProperty("scroll-snap-type"),this.dragging=!1,this.handleScrollEnd()}))},this.handleSlotChange=e=>{e.some((e=>[...e.addedNodes,...e.removedNodes].some((e=>this.isCarouselItem(e)&&!e.hasAttribute("data-clone")))))&&this.initializeSlides(),this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","region"),this.setAttribute("aria-label",this.localize.term("carousel"))}disconnectedCallback(){var e;super.disconnectedCallback(),null==(e=this.mutationObserver)||e.disconnect()}firstUpdated(){this.initializeSlides(),this.mutationObserver=new MutationObserver(this.handleSlotChange),this.mutationObserver.observe(this,{childList:!0,subtree:!0})}willUpdate(e){(e.has("slidesPerMove")||e.has("slidesPerPage"))&&(this.slidesPerMove=Math.min(this.slidesPerMove,this.slidesPerPage))}getPageCount(){const e=this.getSlides().length,{slidesPerPage:t,slidesPerMove:o,loop:r}=this,n=r?e/o:(e-t)/o+1;return Math.ceil(n)}getCurrentPage(){return Math.ceil(this.activeSlide/this.slidesPerMove)}canScrollNext(){return this.loop||this.getCurrentPage()0}getSlides({excludeClones:e=!0}={}){return[...this.children].filter((t=>this.isCarouselItem(t)&&(!e||!t.hasAttribute("data-clone"))))}handleKeyDown(e){if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)){const t=e.target,o=this.matches(":dir(rtl)"),r=null!==t.closest('[part~="pagination-item"]'),n="ArrowDown"===e.key||!o&&"ArrowRight"===e.key||o&&"ArrowLeft"===e.key,c="ArrowUp"===e.key||!o&&"ArrowLeft"===e.key||o&&"ArrowRight"===e.key;e.preventDefault(),c&&this.previous(),n&&this.next(),"Home"===e.key&&this.goToSlide(0),"End"===e.key&&this.goToSlide(this.getSlides().length-1),r&&this.updateComplete.then((()=>{var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector('[part~="pagination-item--active"]');t&&t.focus()}))}}handleMouseDragStart(e){this.mouseDragging&&0===e.button&&(e.preventDefault(),document.addEventListener("pointermove",this.handleMouseDrag,{capture:!0,passive:!0}),document.addEventListener("pointerup",this.handleMouseDragEnd,{capture:!0,once:!0}))}handleScroll(){this.scrolling=!0}synchronizeSlides(){const e=new IntersectionObserver((t=>{e.disconnect();for(const e of t){const t=e.target;t.toggleAttribute("inert",!e.isIntersecting),t.classList.toggle("--in-view",e.isIntersecting),t.setAttribute("aria-hidden",e.isIntersecting?"false":"true")}const o=t.find((e=>e.isIntersecting));if(o)if(this.loop&&o.target.hasAttribute("data-clone")){const e=Number(o.target.getAttribute("data-clone"));this.goToSlide(e,"instant")}else{const e=this.getSlides().indexOf(o.target);this.activeSlide=Math.ceil(e/this.slidesPerMove)*this.slidesPerMove}}),{root:this.scrollContainer,threshold:.6});this.getSlides({excludeClones:!1}).forEach((t=>{e.observe(t)}))}handleScrollEnd(){this.scrolling&&!this.dragging&&(this.synchronizeSlides(),this.scrolling=!1)}isCarouselItem(e){return e instanceof Element&&"sl-carousel-item"===e.tagName.toLowerCase()}initializeSlides(){this.getSlides({excludeClones:!1}).forEach(((e,t)=>{e.classList.remove("--in-view"),e.classList.remove("--is-active"),e.setAttribute("aria-label",this.localize.term("slideNum",t+1)),e.hasAttribute("data-clone")&&e.remove()})),this.updateSlidesSnap(),this.loop&&this.createClones(),this.synchronizeSlides(),this.goToSlide(this.activeSlide,"auto")}createClones(){const e=this.getSlides(),t=this.slidesPerPage,o=e.slice(-t),r=e.slice(0,t);o.reverse().forEach(((t,o)=>{const r=t.cloneNode(!0);r.setAttribute("data-clone",String(e.length-o-1)),this.prepend(r)})),r.forEach(((e,t)=>{const o=e.cloneNode(!0);o.setAttribute("data-clone",String(t)),this.append(o)}))}handelSlideChange(){const e=this.getSlides();e.forEach(((e,t)=>{e.classList.toggle("--is-active",t===this.activeSlide)})),this.hasUpdated&&this.emit("sl-slide-change",{detail:{index:this.activeSlide,slide:e[this.activeSlide]}})}updateSlidesSnap(){const e=this.getSlides(),t=this.slidesPerMove;e.forEach(((e,o)=>{(o+t)%t==0?e.style.removeProperty("scroll-snap-align"):e.style.setProperty("scroll-snap-align","none")}))}handleAutoplayChange(){this.autoplayController.stop(),this.autoplay&&this.autoplayController.start(this.autoplayInterval)}previous(e="smooth"){this.goToSlide(this.activeSlide-this.slidesPerMove,e)}next(e="smooth"){this.goToSlide(this.activeSlide+this.slidesPerMove,e)}goToSlide(e,t="smooth"){const{slidesPerPage:o,loop:r}=this,n=this.getSlides(),c=this.getSlides({excludeClones:!1});if(!n.length)return;const d=r?(e+n.length)%n.length:Un(e,0,n.length-o);