PageSourceSearch

https://www.custtom.co.uk/build/assets/HorizontalSlider-1aq54MS0.js

js custtom.co.uk collected 2026-09-29 12:37:19 UTC 4,543 bytes, 1 lines download raw bytes

1import{s as le,n as C,v as oe,w as se,A as p,C as h,N as F,F as L,B as I,L as ae,S as ie,G as U,r as u,c as r,D as b,W as X}from"./inertia-prototypes-_0KFShPv.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./isSymbol-DvzfyB44.js";const re={key:0,class:"horizontal-slider__actions"},ue=["disabled"],de=["disabled"],ce={key:1,class:"horizontal-slider__dots"},ve=["onClick"],be=Object.assign({name:"HorizontalSlider"},{__name:"HorizontalSlider",props:{options:{type:Object,default:()=>({})}},setup(Y,{expose:G}){const V=Y,j={slidesToShow:1,mobileFirst:!1,infinite:!1,dots:!0,navButtons:!0,speed:300,responsive:[],wheelScroll:!0,wheelScrollDelay:50,swipeThreshold:30},w=u(null),H=u(null),a=u(null),l=u(0),P=u(!1),m=u(0),d=u(0),E=u(typeof window<"u"?window.innerWidth:0),q=r(()=>({...j,...V.options||{}})),i=r(()=>{const e=q.value,t=Array.isArray(e.responsive)?e.responsive:[];if(!t.length)return e;const s=E.value;let o={...e};return e.mobileFirst?[...t].sort((n,R)=>n.breakpoint-R.breakpoint).forEach(n=>{s>=n.breakpoint&&(o={...o,...n.settings||{}})}):[...t].sort((n,R)=>R.breakpoint-n.breakpoint).forEach(n=>{s<=n.breakpoint&&(o={...o,...n.settings||{}})}),o}),c=r(()=>Math.max(1,i.value.slidesToShow||1)),v=r(()=>Math.max(0,Math.ceil(d.value-c.value))),M=r(()=>l.value>0),x=r(()=>l.value<v.value),T=r(()=>d.value<=c.value),J=r(()=>{let e=l.value*m.value;return l.value===v.value&&d.value>c.value&&(e=(d.value-c.value)*m.value),{transform:`translate3d(${-1*Math.round(e)}px, 0, 0)`,transition:P.value?`transform ${i.value.speed}ms ease`:"none"}});function f(){if(!a.value||!w.value)return;const e=Array.from(a.value.children).filter(t=>t.nodeType===1);d.value=e.length,e.length>0?m.value=e[0].getBoundingClientRect().width:m.value=0,l.value>v.value&&(l.value=v.value)}function _(e){const t=Math.min(Math.max(0,e),v.value);t!==l.value&&(P.value=!0,l.value=t)}function k(){x.value&&_(l.value+1)}function y(){M.value&&_(l.value-1)}function K(){return l.value}function Q(){return i.value}function Z(){C(f)}let D=0;function O(e){if(!i.value.wheelScroll||T.value)return;const t=e.deltaX||0,s=e.deltaY||0,o=Math.abs(t)>Math.abs(s)?t:s;if(Math.abs(o)<4)return;const n=Date.now();if(n<D){e.preventDefault();return}o>0&&x.value?(e.preventDefault(),k(),D=n+i.value.wheelScrollDelay):o<0&&M.value&&(e.preventDefault(),y(),D=n+i.value.wheelScrollDelay)}let B=null,A=0,N=0,S=!1;function ee(e){T.value||e.pointerType==="mouse"&&e.button!==0||(B=e.pointerId,A=e.clientX,N=e.clientY,S=!1)}function W(e){if(e.pointerId!==B)return;B=null;const t=e.clientX-A,s=e.clientY-N,o=i.value.swipeThreshold;Math.abs(t)<o||Math.abs(t)<Math.abs(s)||(S=!0,t<0?k():y())}function te(e){S&&(e.stopPropagation(),e.preventDefault(),S=!1)}let z=null,g=null;function $(){E.value=window.innerWidth,f()}le(()=>{window.addEventListener("resize",$,{passive:!0}
1),a.value&&(a.value.addEventListener("wheel",O,{passive:!1}),typeof MutationObserver<"u"&&(g=new MutationObserver(()=>C(f)),g.observe(a.value,{childList:!0}))),w.value&&typeof ResizeObserver<"u"&&(z=new ResizeObserver(()=>f()),z.observe(w.value)),C(f)}),oe(()=>{window.removeEventListener("resize",$),a.value&&a.value.removeEventListener("wheel",O),g&&g.disconnect(),z&&z.disconnect()}),se(c,()=>C(f));const ne=r(()=>a.value?Array.from(a.value.children):[]);return G({goTo:_,goToNext:k,goToPrev:y,getCurrentSlide:K,getCurrentSettings:Q,reload:Z,slidesAll:ne}),(e,t)=>(b(),p("div",{class:U(["horizontal-slider",{"horizontal-slider--disabled":T.value}])},[h("div",{ref_key:"listRef",ref:w,class:"horizontal-slider__list"},[h("div",{ref_key:"trackRef",ref:H,class:"horizontal-slider__track",style:F(J.value)},[h("div",{ref_key:"slidesRef",ref:a,class:"horizontal-slider__slides",style:F({"--slides-to-show":c.value}),onPointerdown:ee,onPointerup:W,onPointercancel:W,onClickCapture:te},[L(e.$slots,"default")],36)],4)],512),i.value.navButtons?(b(),p("div",re,[h("button",{type:"button",class:"horizontal-slider__nav-button horizontal-slider__nav-button--prev",disabled:!M.value,onClick:y},[L(e.$slots,"prevButton",{},()=>[t[0]||(t[0]=X("‹",-1))])],8,ue),h("button",{type:"button",class:"horizontal-slider__nav-button horizontal-slider__nav-button--next",disabled:!x.value,onClick:k},[L(e.$slots,"nextButton",{},()=>[t[1]||(t[1]=X("›",-1))])],8,de)])):I("",!0),i.value.dots&&d.value>0?(b(),p("ul",ce,[(b(!0),p(ae,null,ie(v.value+1,s=>(b(),p("li",{key:s,class:U({"horizontal-slider__dot--current":s-1===l.value})},[h("button",{type:"button",onClick:o=>_(s-1)},null,8,ve)],2))),128))])):I("",!0)],2))}});export{be 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.