import{bO as ee,cS as G,cc as te,dz as le,cW as oe,dk as ne,bS as se,d5 as ae,dC as ie,d6 as re,b5 as z,q as g,dU as q,eb as ue,b_ as D,bC as ce,b$ as fe,I as h,ec as L,c5 as B,ed as ve}from"./index-UvaAT40e.js";function de(l){let{selectedElement:n,containerElement:o,isRtl:i,isHorizontal:v}=l;const d=m(v,o),a=U(v,i,o),p=m(v,n),c=$(v,n),S=p*.4;return a>c?c-S:a+d<c+p?c-d+p+S:a}function pe(l){let{selectedElement:n,containerElement:o,isHorizontal:i}=l;const v=m(i,o),d=$(i,n),a=m(i,n);return d-v/2+a/2}function N(l,n){const o=l?"scrollWidth":"scrollHeight";return(n==null?void 0:n[o])||0}function he(l,n){const o=l?"clientWidth":"clientHeight";return(n==null?void 0:n[o])||0}function U(l,n,o){if(!o)return 0;const{scrollLeft:i,offsetWidth:v,scrollWidth:d}=o;return l?n?d-v+i:i:o.scrollTop}function m(l,n){const o=l?"offsetWidth":"offsetHeight";return(n==null?void 0:n[o])||0}function $(l,n){const o=l?"offsetLeft":"offsetTop";return(n==null?void 0:n[o])||0}const ge=Symbol.for("vuetify:v-slide-group"),Se=ee({centerActive:Boolean,direction:{type:String,default:"horizontal"},symbol:{type:null,default:ge},nextIcon:{type:G,default:"$next"},prevIcon:{type:G,default:"$prev"},showArrows:{type:[Boolean,String],validator:l=>typeof l=="boolean"||["always","desktop","mobile"].includes(l)},...te(),...le({mobile:null}),...oe(),...ne({selectedClass:"v-slide-group-item--active"})},"VSlideGroup"),be=se()({name:"VSlideGroup",props:Se(),emits:{"update:modelValue":l=>!0},setup(l,n){let{slots:o}=n;const{isRtl:i}=ae(),{displayClasses:v,mobile:d}=ie(l),a=re(l,l.symbol),p=z(!1),c=z(0),S=z(0),P=z(0),r=g(()=>l.direction==="horizontal"),{resizeRef:u,contentRect:w}=q(),{resizeRef:f,contentRect:R}=q(),W=ue(),A=g(()=>({container:u.el,duration:200,easing:"easeOutQuart"})),K=g(()=>a.selected.value.length?a.items.value.findIndex(e=>e.id===a.selected.value[0]):-1),Q=g(()=>a.selected.value.length?a.items.value.findIndex(e=>e.id===a.selected.value[a.selected.value.length-1]):-1);if(D){let e=-1;ce(()=>[a.selected.value,w.value,R.value,r.value],()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{if(w.value&&R.value){const t=r.value?"width":"height";S.value=w.value[t],P.value=R.value[t],p.value=S.value+1<P.value}if(K.value>=0&&f.el){const t=f.el.children[Q.value];V(t,l.centerActive)}})})}const x=z(!1);function V(e,t){let s=0;t?s=pe({containerElement:u.el,isHorizontal:r.value,selectedElement:e}):s=de({containerElement:u.el,isHorizontal:r.value,isRtl:i.value,selectedElement:e}),M(s)}function M(e){if(!D||!u.el)return;const t=m(r.value,u.el),s=U(r.value,i.value,u.el);if(!(N(r.value,u.el)<=t||Math.abs(e-s)<16)){if(r.value&&i.value&&u.el){const{scrollWidth:k,offsetWidth:O}=u.el;e=k-O-e}r.value?W.horizontal(e,A.value):W(e,A.value)}}function j(e){const{scrollTop:t,scrollLeft:s}=e.target;c.value=r.value?s:t}function J(e){if(x.value=!0,!(!p.value||!f.el)){for(const t of e.composedPath())for(const s of f.el.children)if(s===t){V(s);return}}}function X(e){x.value=!1}let E=!1;function Y(e){var t;!E&&!x.value&&!(e.relatedTarget&&((t=f.el)!=null&&t.contains(e.relatedTarget)))&&b(),E=!1}function H(){E=!0}function Z(e){if(!f.el)return;function t(s){e.preventDefault(),b(s)}r.value?e.key==="ArrowRight"?t(i.value?"prev":"next"):e.key==="ArrowLeft"&&t(i.value?"next":"prev"):e.key==="ArrowDown"?t("next"):e.key==="ArrowUp"&&t("prev"),e.key==="Home"?t("first"):e.key==="End"&&t("last")}function b(e){var s,y;if(!f.el)return;let t;if(!e)t=ve(f.el)[0];else if(e==="next"){if(t=(s=f.el.querySelector(":focus"))==null?void 0:s.nextElementSibling,!t)return b("first")}else if(e==="prev"){if(t=(y=f.el.querySelector(":focus"))==null?void 0:y.previousElementSibling,!t)return b("last")}else e==="first"?t=f.el.firstElementChild:e==="last"&&(t=f.el.lastElementChild);t&&t.focus({preventScroll:!0})}function T(e){const t=r.value&&i.value?-1:1,s=(e==="prev"?-t:t)*S.value;let y=c.value+s;if(r.value&&i.value&&u.el){const{scrollWidth:k,offsetWidth:O}=u.el;y+=k-O}M(y)}const C=g(()=>({next:a.next,prev:a.prev,select:a.select,isSelected:a.isSelected})),F=g(()=>{switch(l.showArrows){case"always":return!0;case"desktop":return!d.value;case!0:return p.value||Math.abs(c.value)>0;case"mobile":return d.value||p.value||Math.abs(c.value)>0;default:return!d.value&&(p.value||Math.abs(c.value)>0)}}),I=g(()=>Math.abs(c.value)>1),_=g(()=>{if(!u.value)return!1;const e=N(r.value,u.el),t=he(r.value,u.el);return e-t-Math.abs(c.value)>1});return fe(()=>h(l.tag,{class:["v-slide-group",{"v-slide-group--vertical":!r.value,"v-slide-group--has-affixes":F.value,"v-slide-group--is-overflowing":p.value},v.value,l.class],style:l.style,tabindex:x.value||a.selected.value.length?-1:0,onFocus:Y},{default:()=>{var e,t,s;return[F.value&&h("div",{key:"prev",class:["v-slide-group__prev",{"v-slide-group__prev--disabled":!I.value}],onMousedown:H,onClick:()=>I.value&&T("prev")},[((e=o.prev)==null?void 0:e.call(o,C.value))??h(L,null,{default:()=>[h(B,{icon:i.value?l.nextIcon:l.prevIcon},null)]})]),h("div",{key:"container",ref:u,class:"v-slide-group__container",onScroll:j},[h("div",{ref:f,class:"v-slide-group__content",onFocusin:J,onFocusout:X,onKeydown:Z},[(t=o.default)==null?void 0:t.call(o,C.value)])]),F.value&&h("div",{key:"next",class:["v-slide-group__next",{"v-slide-group__next--disabled":!_.value}],onMousedown:H,onClick:()=>_.value&&T("next")},[((s=o.next)==null?void 0:s.call(o,C.value))??h(L,null,{default:()=>[h(B,{icon:i.value?l.prevIcon:l.nextIcon},null)]})])]}})),{selected:a.selected,scrollTo:T,scrollOffset:c,focus:b,hasPrev:I,hasNext:_}}});export{be as V,Se as m};