import{c as t}from"../internal/math.esm.js";function n(t){return"nile-carousel-item"===t.tagName.toLowerCase()}function e(t,n){if(!t.length||!n)return null;const e=n.getBoundingClientRect();let r=null,o=0;return t.forEach((t=>{const n=t.getBoundingClientRect(),s=Math.max(0,Math.min(n.right,e.right)-Math.max(n.left,e.left));s>o&&(o=s,r=t)})),r}function r(t,n,e){const r=(t-n)/e+1;return Math.ceil(r)}function o(t,n){return Math.floor(t/n)}function s(t,n,e=!1){return!!e||t<n-1}function i(t,n=!1){return!!n||t>0}function u(t,n){return(t+n)%n==0}function a(t,n,e="smooth",r){r(!0),window.requestAnimationFrame((()=>{if(!n)return;const o=n.getBoundingClientRect(),s=t.getBoundingClientRect(),i=s.left-o.left,u=s.top-o.top;if(i||u){const t=(a=s,c=o,l=n.scrollLeft,f=n.scrollTop,{left:a.left-c.left+l,top:a.top-c.top+f});r(!0),n.scrollTo({left:t.left,top:t.top,behavior:e})}else r(!1);var a,c,l,f}))}function c(n,e,r,o="smooth",s=!1){if(!e.length)return null;let i,u;if(s){const o=e.length;u=(n%o+o)%o,i=t(u,0,e.length-r)}else i=t(n,0,e.length-r),u=t(n,0,e.length-1);return{newActiveSlide:i,slideToScroll:e[u]}}export{o as a,i as b,s as c,c as d,a as e,e as f,r as g,n as i,u as s};
