1import{d as Z,ap as ee,M as q,H as te,N as ae,l as ne,s as $,R as T,b as I,a as oe,F as w,r as C,u as O,t as K,P,o as V,y as se,K as k,aq as re,ar as le,e as ie}from"./RVtg6UMd.js";import{u as de}from"./BgIWTIUI.js";import"./BfsisZwU.js";import"./yi-kIxl6.js";const ce=["aria-hidden"],ue=Z({__name:"Slider",props:{dragFactor:{default:.1},releaseFactor:{default:void 0},snap:{type:Boolean,default:!0},snapStrength:{default:1},infinite:{type:Boolean,default:!1},allowDrag:{type:Boolean,default:!0},dragSpeed:{default:1},bounce:{default:.2},controls:{type:Boolean,default:!0},autoplay:{type:Boolean,default:!1},autoplaySpeed:{default:3e3},marquee:{type:Boolean,default:!1},marqueeSpeed:{default:1}},emits:["change"],setup(j,{expose:z,emit:H}){const e=j,G=ee(),A=K(()=>{const a=G.default?.();return a?a.flatMap(n=>n.type===w&&Array.isArray(n.children)?n.children:n):[]}),J=a=>{if(!a.content)return null;const n=W(a.content);return n.key=a.contentKey,n},L=K(()=>A.value?.length??0),B=q(L.value),c=q(0),X=q(0),M=q(1),N=k("slider"),D=k("container"),Q=k("slide"),{utils:p,createDraggable:F,createAnimatable:E,createTimer:v}=te().$anime,S=ae({root:N},a=>{const n=N.value,l=D.value,i=Q.value;if(!(!n||!l||!i?.length||n.offsetParent===null))if(e.infinite){const s=l.offsetWidth;M.value=Math.ceil(n.offsetWidth/s)+1,a?.add("initInfiniteSlider",()=>{const u=l.offsetWidth,d=l.offsetLeft,f=i.map(r=>-r.offsetLeft+d),b=i.map(r=>u-r.offsetLeft+d),h=[...f,...b],t=[...f,-u,...b],o=F({},{trigger:n,y:!1,maxVelocity:0,snap:e.snap&&!e.marquee?t:void 0,dragSpeed:e.allowDrag&&!e.marquee?e.dragSpeed:0,cursor:e.allowDrag&&!e.marquee,onRelease:r=>r.setX(r.destX)});a?.add("goToIndex",(r,m=!1)=>{const x=t[p.wrap(r,0,t.length)]??0,_=Math.ceil(o.x/s)*s;o.setX(x+_),m&&(g=o.x)}),a?.methods.goToIndex?.(c.value);const y=i.map((r,m)=>{const x=m!==i.length-1?t[m+1]??0:-u;return E(r,{x:0,modifier:p.wrap(x,u+x)})});let g=o.x;if(v({onUpdate:({deltaTime:r})=>{const m=U(g,r,o);isNaN(m)||(g=m),y.forEach(_=>{_.x?.(g)}),e.snap&&(o.snapX=t.map(_=>_+Math.ceil(o.x/u)*u));const x=o.x<0?t:o.x>0?h:[0];c.value=p.wrap(x.indexOf(p.snap(o.x%u,x)),0,L.value),X.value=g<0?p.wrap(Math.round(Math.abs(g))%s/s,0,1):g>0?p.wrap((s-Math.round(g)%s)/s,0,1):0}}),e.autoplay){let r=0;v({onUpdate:({deltaTime:m})=>{o.dragged?r=0:(r+=m,r>=e.autoplaySpeed&&(r=0,a?.methods.goToIndex?.(c.value+1)))}})}e.marquee&&v({onUpdate:()=>{if(!o.dragged){const r=e.marqueeSpeed;o.setX(o.x-r)}}})}),P(()=>a?.methods.initInfiniteSlider?.())}else{const s=Math.min(-l.scrollWidth+n.offsetWidth,0),u=i.map(t=>-t.offsetLeft+l.offsetLeft),d=F({},{trigger:n,container:e.marquee?void 0:[0,0,0,s],y:!1,maxVelocity:0,snap:e.snap&&!e.marquee?u:void 0,dragSpeed:e.allowDrag&&!e.marquee?e.dragSpeed:0,containerFriction:1-e.bounce,cursor:e.allowDrag&&!e.marquee,onRelease:t=>t.setX(t.destX)}),f=u.filter(t=>t>s);f.length<u.length&&(f.push(s),B.value=f.length),a?.add("goToIndex",(t,o=!1)=>{d.setX(f[p.clamp(t,0,f.length-1)]??0),o&&(h=d.x)}),a?.methods.goToIndex?.(c.value);const b=i.map(t=>E(t,{x:0}));let h=d.x;if(v({onUpdate:({deltaTime:t})=>{const o=U(h,t,d);isNaN(o)||(h=o),b.forEach(y=>{y.x?.(h)}),c.value=f.indexOf(p.snap(d.x,f)),X.value=s===0?1:Math.abs(p.clamp(h/s,0,1))}}),e.autoplay){let t=0;v({onUpdate:({deltaTime:o})=>{if(d.dragged)t=0;else if(t+=o,t>=e.autoplaySpeed){t=0;const y=c.value+1,g=y>=f.length?0:y;a?.methods.goToIndex?.(g)}}})}e.marquee&&v({onUpdate:()=>{if(!d.dragged){const t=e.marqueeSpeed;d.setX(d.x-t)}}})}}),Y=H;ne(()=>de(window,"resize",R)),$(e,R),$(c,()=>Y("change",c.value));function W(a){if(!re(a))return a;const n=le(a);return Array.isArray(n.children)&&(n.children=n.children.map(W)),n}function U(a,n,l){let i;if(l.dragged)i=e.dragFactor;else{const s=e.snap?e.snapStrength:1;i=(e.releaseFactor??e.dragFactor)*s}return p.damp(a,l.x,n,i)}function R(){e.infinite?(M.value=1,P(()=>S.value?.refresh())):S.value?.refresh()}return z({slidesLength:T(L),paginationLength:T(B),paginationIndex:T(c),progress:T(X),set:(a,n=!1)=>S.value?.methods.goToIndex?.(a,n),previous:()=>S.value?.methods.goToIndex?.(c.value-1),next:()=>S.value?.methods.goToIndex?.(c.value+1)}),(a,n)=>(V(),I("div",{ref_key:"slider",ref:N,class:"slider"},[oe("ul",{ref_key:"container",ref:D,class:"container"},[(V(!0),I(w,null,C(O(M),l=>(V(),I(w,{key:l},[(V(!0),I(w,null,C(O(A),(i,s)=>(V(),I("li",{key:`${l}-${s}
1`,ref_for:!0,ref:"slide","aria-hidden":l!==1,class:"slide"},[se(J,{content:i,"content-key":`${l}-${s}-content`},null,8,["content","content-key"])],8,ce))),128))],64))),128))],512)],512))}}),he=Object.assign(ie(ue,[["__scopeId","data-v-7f2bc821"]]),{__name:"Slider"});export{he as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.