uikit
Version:
UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.
2 lines (1 loc) • 27.9 kB
JavaScript
/*! UIkit 3.21.0 | https://www.getuikit.com | (c) 2014 - 2024 YOOtheme | MIT License */(function(s,I){typeof exports=="object"&&typeof module<"u"?module.exports=I(require("uikit-util")):typeof define=="function"&&define.amd?define("uikitslider",["uikit-util"],I):(s=typeof globalThis<"u"?globalThis:s||self,s.UIkitSlider=I(s.UIkit.util))})(this,function(s){"use strict";function I(t,e="update"){t._connected&&t._updates.length&&(t._queued||(t._queued=new Set,s.fastdom.read(()=>{t._connected&&ut(t,t._queued),delete t._queued})),t._queued.add(e.type||e))}function ut(t,e){for(const{read:i,write:n,events:o=[]}of t._updates){if(!e.has("update")&&!o.some(h=>e.has(h)))continue;let r;i&&(r=i.call(t,t._data,e),r&&s.isPlainObject(r)&&s.assign(t._data,r)),n&&r!==!1&&s.fastdom.write(()=>{t._connected&&n.call(t,t._data,e)})}}function z(t){return P(s.observeResize,t,"resize")}function mt(t){return P(s.observeIntersection,t)}function pt(t={}){return mt({handler:function(e,i){const{targets:n=this.$el,preload:o=5}=t;for(const r of s.toNodes(s.isFunction(n)?n(this):n))s.$$('[loading="lazy"]',r).slice(0,o-1).forEach(h=>s.removeAttr(h,"loading"));for(const r of e.filter(({isIntersecting:h})=>h).map(({target:h})=>h))i.unobserve(r)},...t})}function xt(t){return P((e,i)=>({disconnect:s.on(vt(e),"scroll",i,{passive:!0})}),t,"scroll")}function P(t,e,i){return{observe:t,handler(){I(this,i)},...e}}function vt(t){return s.toNodes(t).map(e=>{const{ownerDocument:i}=e,n=s.scrollParent(e,!0);return n===i.scrollingElement?i:n})}var wt={connected(){s.addClass(this.$el,this.$options.id)}},It={props:{i18n:Object},data:{i18n:null},methods:{t(t,...e){var i,n,o;let r=0;return((o=((i=this.i18n)==null?void 0:i[t])||((n=this.$options.i18n)==null?void 0:n[t]))==null?void 0:o.replace(/%s/g,()=>e[r++]||""))||""}}},bt={props:{autoplay:Boolean,autoplayInterval:Number,pauseOnHover:Boolean},data:{autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},connected(){s.attr(this.list,"aria-live",this.autoplay?"off":"polite"),this.autoplay&&this.startAutoplay()},disconnected(){this.stopAutoplay()},update(){s.attr(this.slides,"tabindex","-1")},events:[{name:"visibilitychange",el:()=>document,filter:({autoplay:t})=>t,handler(){document.hidden?this.stopAutoplay():this.startAutoplay()}}],methods:{startAutoplay(){this.stopAutoplay(),this.interval=setInterval(()=>{this.stack.length||this.draggable&&s.matches(this.$el,":focus-within")&&!s.matches(this.$el,":focus")||this.pauseOnHover&&s.matches(this.$el,":hover")||this.show("next")},this.autoplayInterval)},stopAutoplay(){clearInterval(this.interval)}}};const b={passive:!1,capture:!0},V={passive:!0,capture:!0},$t="touchstart mousedown",D="touchmove mousemove",U="touchend touchcancel mouseup click input scroll",q=t=>t.preventDefault();var yt={props:{draggable:Boolean},data:{draggable:!0,threshold:10},created(){for(const t of["start","move","end"]){const e=this[t];this[t]=i=>{const n=s.getEventPos(i).x*(s.isRtl?-1:1);this.prevPos=n===this.pos?this.prevPos:this.pos,this.pos=n,e(i)}}},events:[{name:$t,passive:!0,delegate:({selList:t})=>`${t} > *`,handler(t){!this.draggable||this.parallax||!s.isTouch(t)&&St(t.target)||t.target.closest(s.selInput)||t.button>0||this.length<2||this.start(t)}},{name:"dragstart",handler(t){t.preventDefault()}},{name:D,el:({list:t})=>t,handler:s.noop,...b}],methods:{start(){this.drag=this.pos,this._transitioner?(this.percent=this._transitioner.percent(),this.drag+=this._transitioner.getDistance()*this.percent*this.dir,this._transitioner.cancel(),this._transitioner.translate(this.percent),this.dragging=!0,this.stack=[]):this.prevIndex=this.index,s.on(document,D,this.move,b),s.on(document,U,this.end,V),s.css(this.list,"userSelect","none")},move(t){const e=this.pos-this.drag;if(e===0||this.prevPos===this.pos||!this.dragging&&Math.abs(e)<this.threshold)return;this.dragging||s.on(this.list,"click",q,b),t.cancelable&&t.preventDefault(),this.dragging=!0,this.dir=e<0?1:-1;let{slides:i,prevIndex:n}=this,o=Math.abs(e),r=this.getIndex(n+this.dir),h=G.call(this,n,r);for(;r!==n&&o>h;)this.drag-=h*this.dir,n=r,o-=h,r=this.getIndex(n+this.dir),h=G.call(this,n,r);this.percent=o/h;const a=i[n],c=i[r],l=this.index!==r,d=n===r;let f;for(const g of[this.index,this.prevIndex])s.includes([r,n],g)||(s.trigger(i[g],"itemhidden",[this]),d&&(f=!0,this.prevIndex=n));(this.index===n&&this.prevIndex!==n||f)&&s.trigger(i[this.index],"itemshown",[this]),l&&(this.prevIndex=n,this.index=r,d||(s.trigger(a,"beforeitemhide",[this]),s.trigger(a,"itemhide",[this])),s.trigger(c,"beforeitemshow",[this]),s.trigger(c,"itemshow",[this])),this._transitioner=this._translate(Math.abs(this.percent),a,!d&&c)},end(){if(s.off(document,D,this.move,b),s.off(document,U,this.end,V),this.dragging)if(this.dragging=null,this.index===this.prevIndex)this.percent=1-this.percent,this.dir*=-1,this._show(!1,this.index,!0),this._transitioner=null;else{const t=(s.isRtl?this.dir*(s.isRtl?1:-1):this.dir)<0==this.prevPos>this.pos;this.index=t?this.index:this.prevIndex,t&&(this.percent=1-this.percent),this.show(this.dir>0&&!t||this.dir<0&&t?"next":"previous",!0)}setTimeout(()=>s.off(this.list,"click",q,b)),s.css(this.list,{userSelect:""}),this.drag=this.percent=null}}};function G(t,e){return this._getTransitioner(t,t!==e&&e).getDistance()||this.slides[t].offsetWidth}function St(t){return s.css(t,"userSelect")!=="none"&&s.toArray(t.childNodes).some(e=>e.nodeType===3&&e.textContent.trim())}s.memoize((t,e)=>{const i=Object.keys(e),n=i.concat(t).map(o=>[s.hyphenate(o),`data-${s.hyphenate(o)}`]).flat();return{attributes:i,filter:n}});let kt=1;function X(t,e=null){return(e==null?void 0:e.id)||`${t.$options.id}-${kt++}`}const $={TAB:9,ESC:27,SPACE:32,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40};var Ct={i18n:{next:"Next slide",previous:"Previous slide",slideX:"Slide %s",slideLabel:"%s of %s",role:"String"},data:{selNav:!1,role:"region"},computed:{nav:({selNav:t},e)=>s.$(t,e),navChildren(){return s.children(this.nav)},selNavItem:({attrItem:t})=>`[${t}],[data-${t}]`,navItems(t,e){return s.$$(this.selNavItem,e)}},watch:{nav(t,e){s.attr(t,"role","tablist"),e&&this.$emit()},list(t){s.isTag(t,"ul")&&s.attr(t,"role","presentation")},navChildren(t){s.attr(t,"role","presentation")},navItems(t){for(const e of t){const i=s.data(e,this.attrItem),n=s.$("a,button",e)||e;let o,r=null;if(s.isNumeric(i)){const h=s.toNumber(i),a=this.slides[h];a&&(a.id||(a.id=X(this,a)),r=a.id),o=this.t("slideX",s.toFloat(i)+1),s.attr(n,"role","tab")}else this.list&&(this.list.id||(this.list.id=X(this,this.list)),r=this.list.id),o=this.t(i);s.attr(n,{"aria-controls":r,"aria-label":s.attr(n,"aria-label")||o})}},slides(t){t.forEach((e,i)=>s.attr(e,{role:this.nav?"tabpanel":"group","aria-label":this.t("slideLabel",i+1,this.length),"aria-roledescription":this.nav?null:"slide"}))},length(t){const e=this.navChildren.length;if(this.nav&&t!==e){s.empty(this.nav);for(let i=0;i<t;i++)s.append(this.nav,`<li ${this.attrItem}="${i}"><a href></a></li>`)}}},connected(){s.attr(this.$el,{role:this.role,"aria-roledescription":"carousel"})},update:[{write(){this.navItems.concat(this.nav).forEach(t=>t&&(t.hidden=!this.maxIndex)),this.updateNav()},events:["resize"]}],events:[{name:"click keydown",delegate:({selNavItem:t})=>t,filter:({parallax:t})=>!t,handler(t){t.target.closest("a,button")&&(t.type==="click"||t.keyCode===$.SPACE)&&(t.preventDefault(),this.show(s.data(t.current,this.attrItem)))}},{name:"itemshow",handler:"updateNav"},{name:"keydown",delegate:({selNavItem:t})=>t,filter:({parallax:t})=>!t,handler(t){const{current:e,keyCode:i}=t,n=s.data(e,this.attrItem);if(!s.isNumeric(n))return;let o=i===$.HOME?0:i===$.END?"last":i===$.LEFT?"previous":i===$.RIGHT?"next":-1;~o&&(t.preventDefault(),this.show(o))}}],methods:{updateNav(){const t=this.getValidIndex();for(const e of this.navItems){const i=s.data(e,this.attrItem),n=s.$("a,button",e)||e;if(s.isNumeric(i)){const r=s.toNumber(i)===t;s.toggleClass(e,this.clsActive,r),s.toggleClass(n,"uk-disabled",this.parallax),s.attr(n,{"aria-selected":r,tabindex:r&&!this.parallax?null:-1}),r&&n&&s.matches(s.parent(e),":focus-within")&&n.focus()}else s.toggleClass(e,"uk-invisible",this.finite&&(i==="previous"&&t===0||i==="next"&&t>=this.maxIndex))}}}},_t={mixins:[bt,yt,Ct,It],props:{clsActivated:String,easing:String,index:Number,finite:Boolean,velocity:Number},data:()=>({easing:"ease",finite:!1,velocity:1,index:0,prevIndex:-1,stack:[],percent:0,clsActive:"uk-active",clsActivated:"",clsEnter:"uk-slide-enter",clsLeave:"uk-slide-leave",clsSlideActive:"uk-slide-active",Transitioner:!1,transitionOptions:{}}),connected(){this.prevIndex=-1,this.index=this.getValidIndex(this.$props.index),this.stack=[]},disconnected(){s.removeClass(this.slides,this.clsActive)},computed:{duration:({velocity:t},e)=>Q(e.offsetWidth/t),list:({selList:t},e)=>s.$(t,e),maxIndex(){return this.length-1},slides(){return s.children(this.list)},length(){return this.slides.length}},watch:{slides(t,e){e&&this.$emit()}},events:{itemshow({target:t}){s.addClass(t,this.clsEnter,this.clsSlideActive)},itemshown({target:t}){s.removeClass(t,this.clsEnter)},itemhide({target:t}){s.addClass(t,this.clsLeave)},itemhidden({target:t}){s.removeClass(t,this.clsLeave,this.clsSlideActive)}},methods:{show(t,e=!1){var i;if(this.dragging||!this.length||this.parallax)return;const{stack:n}=this,o=e?0:n.length,r=()=>{n.splice(o,1),n.length&&this.show(n.shift(),!0)};if(n[e?"unshift":"push"](t),!e&&n.length>1){n.length===2&&((i=this._transitioner)==null||i.forward(Math.min(this.duration,200)));return}const h=this.getIndex(this.index),a=s.hasClass(this.slides,this.clsActive)&&this.slides[h],c=this.getIndex(t,this.index),l=this.slides[c];if(a===l){r();return}if(this.dir=At(t,h),this.prevIndex=h,this.index=c,a&&!s.trigger(a,"beforeitemhide",[this])||!s.trigger(l,"beforeitemshow",[this,a])){this.index=this.prevIndex,r();return}const d=this._show(a,l,e).then(()=>{a&&s.trigger(a,"itemhidden",[this]),s.trigger(l,"itemshown",[this]),n.shift(),this._transitioner=null,n.length&&requestAnimationFrame(()=>n.length&&this.show(n.shift(),!0))});return a&&s.trigger(a,"itemhide",[this]),s.trigger(l,"itemshow",[this]),d},getIndex(t=this.index,e=this.index){return s.clamp(s.getIndex(t,this.slides,e,this.finite),0,Math.max(0,this.maxIndex))},getValidIndex(t=this.index,e=this.prevIndex){return this.getIndex(t,e)},async _show(t,e,i){if(this._transitioner=this._getTransitioner(t,e,this.dir,{easing:i?e.offsetWidth<600?"cubic-bezier(0.25, 0.46, 0.45, 0.94)":"cubic-bezier(0.165, 0.84, 0.44, 1)":this.easing,...this.transitionOptions}),!i&&!t){this._translate(1);return}const{length:n}=this.stack;return this._transitioner[n>1?"forward":"show"](n>1?Math.min(this.duration,75+75/(n-1)):this.duration,this.percent)},_translate(t,e=this.prevIndex,i=this.index){const n=this._getTransitioner(e===i?!1:e,i);return n.translate(t),n},_getTransitioner(t=this.prevIndex,e=this.index,i=this.dir||1,n=this.transitionOptions){return new this.Transitioner(s.isNumber(t)?this.slides[t]:t,s.isNumber(e)?this.slides[e]:e,i*(s.isRtl?-1:1),n)}}};function At(t,e){return t==="next"?1:t==="previous"||t<e?-1:1}function Q(t){return .5*t+300}var Mt={props:{media:Boolean},data:{media:!1},connected(){const t=Et(this.media,this.$el);if(this.matchMedia=!0,t){this.mediaObj=window.matchMedia(t);const e=()=>{this.matchMedia=this.mediaObj.matches,s.trigger(this.$el,s.createEvent("mediachange",!1,!0,[this.mediaObj]))};this.offMediaObj=s.on(this.mediaObj,"change",()=>{e(),this.$emit("resize")}),e()}},disconnected(){var t;(t=this.offMediaObj)==null||t.call(this)}};function Et(t,e){if(s.isString(t)){if(s.startsWith(t,"@"))t=s.toFloat(s.css(e,`--uk-breakpoint-${t.slice(1)}`));else if(isNaN(t))return t}return t&&s.isNumeric(t)?`(min-width: ${t}px)`:""}function Nt(t,e){var i;return(i=t==null?void 0:t.startsWith)==null?void 0:i.call(t,e)}const{isArray:we,from:Ot}=Array;function Tt(t){return typeof t=="function"}function F(t){return t!==null&&typeof t=="object"}function Pt(t){return F(t)&&t===t.window}function Dt(t){return K(t)===9}function J(t){return K(t)>=1}function K(t){return!Pt(t)&&F(t)&&t.nodeType}function R(t){return typeof t=="string"}function Ft(t){return t===void 0}function y(t){return t&&m(t)[0]}function m(t){return J(t)?[t]:Array.from(t||[]).filter(J)}function Y(t){const e=Object.create(null);return(i,...n)=>e[i]||(e[i]=t(i,...n))}function W(t,e,i){var n;if(F(e)){for(const o in e)W(t,o,e[o]);return}if(Ft(i))return(n=y(t))==null?void 0:n.getAttribute(e);for(const o of m(t))Tt(i)&&(i=i.call(o,W(o,e))),i===null?Rt(o,e):o.setAttribute(e,i)}function Rt(t,e){m(t).forEach(i=>i.removeAttribute(e))}const Wt=typeof window<"u"&&Element.prototype.checkVisibility||function(){return this.offsetWidth||this.offsetHeight||this.getClientRects().length};function jt(t){return m(t).some(e=>Wt.call(e))}function Ht(t){var e;return(e=y(t))==null?void 0:e.parentElement}function Lt(t,e){return m(t).filter(i=>Z(i,e))}function Z(t,e){return m(t).some(i=>i.matches(e))}function Bt(t,e){t=y(t);const i=t?Ot(t.children):[];return e?Lt(i,e):i}function tt(t,e){return e?m(t).indexOf(y(e)):Bt(Ht(t)).indexOf(t)}function zt(t,e){return m(Xt(t,y(e),"querySelectorAll"))}const Vt=/([!>+~-])(?=\s+[!>+~-]|\s*$)/g,Ut=/.*?[^\\](?![^(]*\))(?:,|$)/g,qt=/\s*,$/,Gt=Y(t=>{var e;t=t.replace(Vt,"$1 *");let i=!1;const n=[];for(let o of(e=t.match(Ut))!=null?e:[])o=o.replace(qt,"").trim(),i||(i=["!","+","~","-",">"].includes(o[0])),n.push(o);return{selector:n.join(","),selectors:n,isContextSelector:i}}),et=Y(t=>{t=t.slice(1).trim();const e=t.indexOf(" ");return~e?[t.slice(0,e),t.slice(e+1)]:[t,""]});function Xt(t,e=document,i){if(!t||!R(t))return t;const n=Gt(t);if(!n.isContextSelector)return j(e,i,n.selector);t="";const o=n.selectors.length===1;for(let r of n.selectors){let h,a=e;if(r[0]==="!"&&([h,r]=et(r),a=e.parentElement.closest(h),!r&&o)||a&&r[0]==="-"&&([h,r]=et(r),a=a.previousElementSibling,a=Z(a,h)?a:null,!r&&o))return a;if(a){if(o)return r[0]==="~"||r[0]==="+"?(r=`:scope > :nth-child(${tt(a)+1}) ${r}`,a=a.parentElement):r[0]===">"&&(r=`:scope ${r}`),j(a,i,r);t+=`${t?",":""}${Qt(a)} ${r}`}}return Dt(e)||(e=e.ownerDocument),j(e,i,t)}function j(t,e,i){try{return t[e](i)}catch{return null}}function Qt(t){const e=[];for(;t.parentNode;){const i=W(t,"id");if(i){e.unshift(`#${Jt(i)}`);break}else{let{tagName:n}=t;n!=="HTML"&&(n+=`:nth-child(${tt(t)+1})`),e.unshift(n),t=t.parentNode}}return e.join(" > ")}function Jt(t){return R(t)?CSS.escape(t):""}const Kt=/^<(\w+)\s*\/?>(?:<\/\1>)?$/;function Yt(t){const e=Kt.exec(t);if(e)return document.createElement(e[1]);const i=document.createElement("template");return i.innerHTML=t.trim(),Zt(i.content.childNodes)}function Zt(t){return t.length>1?t:t[0]}function te(t,e){return ee(t)?m(Yt(t)):zt(t,e)}function ee(t){return R(t)&&Nt(t.trim(),"<")}function se(t){return jt(t)?Math.ceil(Math.max(0,...te("[stroke]",t).map(e=>e.getTotalLength()))):0}const A={x:M,y:M,rotate:M,scale:M,color:H,backgroundColor:H,borderColor:H,blur:x,hue:x,fopacity:x,grayscale:x,invert:x,saturate:x,sepia:x,opacity:ne,stroke:re,bgx:it,bgy:it},{keys:st}=Object;ht(st(A),"list"),ht(st(A),void 0);function M(t,e,i){let n=N(i)||{x:"px",y:"px",rotate:"deg"}[t]||"",o;return t==="x"||t==="y"?(t=`translate${s.ucfirst(t)}`,o=r=>s.toFloat(s.toFloat(r).toFixed(n==="px"?0:6))):t==="scale"&&(n="",o=r=>{var h;return N([r])?s.toPx(r,"width",e,!0)/e[`offset${(h=r.endsWith)!=null&&h.call(r,"vh")?"Height":"Width"}`]:s.toFloat(r)}),i.length===1&&i.unshift(t==="scale"?1:0),i=v(i,o),(r,h)=>{r.transform=`${r.transform||""} ${t}(${S(i,h)}${n})`}}function H(t,e,i){return i.length===1&&i.unshift(k(e,t,"")),i=v(i,n=>ie(e,n)),(n,o)=>{const[r,h,a]=at(i,o),c=r.map((l,d)=>(l+=a*(h[d]-l),d===3?s.toFloat(l):parseInt(l,10))).join(",");n[t]=`rgba(${c})`}}function ie(t,e){return k(t,"color",e).split(/[(),]/g).slice(1,-1).concat(1).slice(0,4).map(s.toFloat)}function x(t,e,i){i.length===1&&i.unshift(0);const n=N(i)||{blur:"px",hue:"deg"}[t]||"%";return t={fopacity:"opacity",hue:"hue-rotate"}[t]||t,i=v(i),(o,r)=>{const h=S(i,r);o.filter=`${o.filter||""} ${t}(${h+n})`}}function ne(t,e,i){return i.length===1&&i.unshift(k(e,t,"")),i=v(i),(n,o)=>{n[t]=S(i,o)}}function re(t,e,i){i.length===1&&i.unshift(0);const n=N(i),o=se(e);return i=v(i.reverse(),r=>(r=s.toFloat(r),n==="%"?r*o/100:r)),i.some(([r])=>r)?(s.css(e,"strokeDasharray",o),(r,h)=>{r.strokeDashoffset=S(i,h)}):s.noop}function it(t,e,i,n){i.length===1&&i.unshift(0);const o=t==="bgy"?"height":"width";n[t]=v(i,a=>s.toPx(a,o,e));const r=["bgx","bgy"].filter(a=>a in n);if(r.length===2&&t==="bgx")return s.noop;if(k(e,"backgroundSize","")==="cover")return oe(t,e,i,n);const h={};for(const a of r)h[a]=nt(e,a);return rt(r,h,n)}function oe(t,e,i,n){const o=ae(e);if(!o.width)return s.noop;const r={width:e.offsetWidth,height:e.offsetHeight},h=["bgx","bgy"].filter(d=>d in n),a={};for(const d of h){const f=n[d].map(([T])=>T),g=Math.min(...f),u=Math.max(...f),p=f.indexOf(g)<f.indexOf(u),_=u-g;a[d]=`${(p?-_:0)-(p?g:u)}px`,r[d==="bgy"?"height":"width"]+=_}const c=s.Dimensions.cover(o,r);for(const d of h){const f=d==="bgy"?"height":"width",g=c[f]-r[f];a[d]=`max(${nt(e,d)},-${g}px) + ${a[d]}`}const l=rt(h,a,n);return(d,f)=>{l(d,f),d.backgroundSize=`${c.width}px ${c.height}px`,d.backgroundRepeat="no-repeat"}}function nt(t,e){return k(t,`background-position-${e.slice(-1)}`,"")}function rt(t,e,i){return function(n,o){for(const r of t){const h=S(i[r],o);n[`background-position-${r.slice(-1)}`]=`calc(${e[r]} + ${h}px)`}}}const ot={},E={};function ae(t){const e=s.css(t,"backgroundImage").replace(/^none|url\(["']?(.+?)["']?\)$/,"$1");if(E[e])return E[e];const i=new Image;return e&&(i.src=e,!i.naturalWidth&&!ot[e])?(s.once(i,"error load",()=>{E[e]=L(i),s.trigger(t,s.createEvent("load",!1))}),ot[e]=!0,L(i)):E[e]=L(i)}function L(t){return{width:t.naturalWidth,height:t.naturalHeight}}function v(t,e=s.toFloat){const i=[],{length:n}=t;let o=0;for(let r=0;r<n;r++){let[h,a]=s.isString(t[r])?t[r].trim().split(/ (?![^(]*\))/):[t[r]];if(h=e(h),a=a?s.toFloat(a)/100:null,r===0?a===null?a=0:a&&i.push([h,0]):r===n-1&&(a===null?a=1:a!==1&&(i.push([h,a]),a=1)),i.push([h,a]),a===null)o++;else if(o){const c=i[r-o-1][1],l=(a-c)/(o+1);for(let d=o;d>0;d--)i[r-d][1]=c+l*(o-d+1);o=0}}return i}function at(t,e){const i=s.findIndex(t.slice(1),([,n])=>e<=n)+1;return[t[i-1][0],t[i][0],(e-t[i-1][1])/(t[i][1]-t[i-1][1])]}function S(t,e){const[i,n,o]=at(t,e);return i+Math.abs(i-n)*o*(i<n?1:-1)}const he=/^-?\d+(?:\.\d+)?(\S+)?/;function N(t,e){var i;for(const n of t){const o=(i=n.match)==null?void 0:i.call(n,he);if(o)return o[1]}return e}function k(t,e,i){const n=t.style[e],o=s.css(s.css(t,e,i),e);return t.style[e]=n,o}function ht(t,e){return t.reduce((i,n)=>(i[n]=e,i),{})}function de(t,e){return e>=0?Math.pow(t,e+1):1-Math.pow(1-t,1-e)}var ce={props:{parallax:Boolean,parallaxTarget:Boolean,parallaxStart:String,parallaxEnd:String,parallaxEasing:Number},data:{parallax:!1,parallaxTarget:!1,parallaxStart:0,parallaxEnd:0,parallaxEasing:0},observe:[z({target:({$el:t,parallaxTarget:e})=>[t,e],filter:({parallax:t})=>t}),xt({filter:({parallax:t})=>t})],computed:{parallaxTarget({parallaxTarget:t},e){return t&&s.query(t,e)||this.list}},update:{read(){if(!this.parallax)return!1;const t=this.parallaxTarget;if(!t)return!1;const e=s.toPx(this.parallaxStart,"height",t,!0),i=s.toPx(this.parallaxEnd,"height",t,!0),n=de(s.scrolledOver(t,e,i),this.parallaxEasing);return{parallax:this.getIndexAt(n)}},write({parallax:t}){const[e,i]=t,n=this.getValidIndex(e+Math.ceil(i)),o=this.slides[e],r=this.slides[n],{triggerShow:h,triggerShown:a,triggerHide:c,triggerHidden:l}=le(this);if(~this.prevIndex)for(const f of new Set([this.index,this.prevIndex]))s.includes([n,e],f)||(c(this.slides[f]),l(this.slides[f]));const d=this.prevIndex!==e||this.index!==n;this.dir=1,this.prevIndex=e,this.index=n,o!==r&&c(o),h(r),d&&a(o),this._translate(o===r?1:i,o,r)},events:["scroll","resize"]},methods:{getIndexAt(t){const e=t*(this.length-1);return[Math.floor(e),e%1]}}};function le(t){const{clsSlideActive:e,clsEnter:i,clsLeave:n}=t;return{triggerShow:o,triggerShown:r,triggerHide:h,triggerHidden:a};function o(c){s.hasClass(c,n)&&(h(c),a(c)),s.hasClass(c,e)||(s.trigger(c,"beforeitemshow",[t]),s.trigger(c,"itemshow",[t]))}function r(c){s.hasClass(c,i)&&s.trigger(c,"itemshown",[t])}function h(c){s.hasClass(c,e)||o(c),s.hasClass(c,i)&&r(c),s.hasClass(c,n)||(s.trigger(c,"beforeitemhide",[t]),s.trigger(c,"itemhide",[t]))}function a(c){s.hasClass(c,n)&&s.trigger(c,"itemhidden",[t])}}var fe={update:{write(){if(this.stack.length||this.dragging||this.parallax)return;const t=this.getValidIndex();!~this.prevIndex||this.index!==t?this.show(t):this._translate(1,this.prevIndex,this.index)},events:["resize"]}},ge={observe:pt({target:({slides:t})=>t,targets:t=>t.getAdjacentSlides()}),methods:{getAdjacentSlides(){return[1,-1].map(t=>this.slides[this.getIndex(this.index+t)])}}};function dt(t=0,e="%"){return t+=t?e:"",`translate3d(${t}, 0, 0)`}function ue(t,e,i,{center:n,easing:o,list:r}){const h=t?C(t,r,n):C(e,r,n)+s.dimensions(e).width*i,a=e?C(e,r,n):h+s.dimensions(t).width*i*(s.isRtl?-1:1);let c;return{dir:i,show(l,d=0,f){const g=f?"linear":o;return l-=Math.round(l*s.clamp(d,-1,1)),s.css(r,"transitionProperty","none"),this.translate(d),s.css(r,"transitionProperty",""),d=t?d:s.clamp(d,0,1),B(this.getItemIn(),"itemin",{percent:d,duration:l,timing:g,dir:i}),t&&B(this.getItemIn(!0),"itemout",{percent:1-d,duration:l,timing:g,dir:i}),new Promise(u=>{c||(c=u),s.Transition.start(r,{transform:dt(-a*(s.isRtl?-1:1),"px")},l,g).then(c,s.noop)})},cancel(){return s.Transition.cancel(r)},reset(){s.css(r,"transform","")},async forward(l,d=this.percent()){return await this.cancel(),this.show(l,d,!0)},translate(l){if(l===this.percent())return;const d=this.getDistance()*i*(s.isRtl?-1:1);s.css(r,"transform",dt(s.clamp(-a+(d-d*l),-w(r),s.dimensions(r).width)*(s.isRtl?-1:1),"px"));const f=this.getActives(),g=this.getItemIn(),u=this.getItemIn(!0);l=t?s.clamp(l,-1,1):0;for(const p of s.children(r)){const _=s.includes(f,p),T=p===g,gt=p===u,ve=T||!gt&&(_||i*(s.isRtl?-1:1)===-1^O(p,r)>O(t||e));B(p,`itemtranslate${ve?"in":"out"}`,{dir:i,percent:gt?1-l:T?l:_?1:0})}},percent(){return Math.abs((s.css(r,"transform").split(",")[4]*(s.isRtl?-1:1)+h)/(a-h))},getDistance(){return Math.abs(a-h)},getItemIn(l=!1){let d=this.getActives(),f=lt(r,C(e||t,r,n));if(l){const g=d;d=f,f=g}return f[s.findIndex(f,g=>!s.includes(d,g))]},getActives(){return lt(r,C(t||e,r,n))}}}function C(t,e,i){const n=O(t,e);return i?n-me(t,e):Math.min(n,ct(e))}function ct(t){return Math.max(0,w(t)-s.dimensions(t).width)}function w(t,e){return s.sumBy(s.children(t).slice(0,e),i=>s.dimensions(i).width)}function me(t,e){return s.dimensions(e).width/2-s.dimensions(t).width/2}function O(t,e){return t&&(s.position(t).left+(s.isRtl?s.dimensions(t).width-s.dimensions(e).width:0))*(s.isRtl?-1:1)||0}function lt(t,e){e-=1;const i=s.dimensions(t).width,n=e+i+2;return s.children(t).filter(o=>{const r=O(o,t),h=r+Math.min(s.dimensions(o).width,i);return r>=e&&h<=n})}function B(t,e,i){s.trigger(t,s.createEvent(e,!1,!1,i))}var ft={mixins:[wt,_t,fe,ce,ge],props:{center:Boolean,sets:Boolean,active:String},data:{center:!1,sets:!1,attrItem:"uk-slider-item",selList:".uk-slider-items",selNav:".uk-slider-nav",clsContainer:"uk-slider-container",active:"all",Transitioner:ue},computed:{finite({finite:t}){return t||pe(this.list,this.center)},maxIndex(){if(!this.finite||this.center&&!this.sets)return this.length-1;if(this.center)return s.last(this.sets);let t=0;const e=ct(this.list),i=s.findIndex(this.slides,n=>{if(t>=e)return!0;t+=s.dimensions(n).width});return~i?i:this.length-1},sets({sets:t}){if(!t||this.parallax)return;let e=0;const i=[],n=s.dimensions(this.list).width;for(let o=0;o<this.length;o++){const r=s.dimensions(this.slides[o]).width;e+r>n&&(e=0),this.center?e<n/2&&e+r+s.dimensions(this.slides[s.getIndex(+o+1,this.slides)]).width/2>n/2&&(i.push(+o),e=n/2-r/2):e===0&&i.push(Math.min(+o,this.maxIndex)),e+=r}if(i.length)return i},transitionOptions(){return{center:this.center,list:this.list}},slides(){return s.children(this.list).filter(s.isVisible)}},connected(){s.toggleClass(this.$el,this.clsContainer,!s.$(`.${this.clsContainer}`,this.$el))},observe:z({target:({slides:t,$el:e})=>[e,...t]}),update:{write(){for(const t of this.navItems){const e=s.toNumber(s.data(t,this.attrItem));e!==!1&&(t.hidden=!this.maxIndex||e>this.maxIndex||this.sets&&!s.includes(this.sets,e))}this.reorder(),this.updateActiveClasses()},events:["resize"]},events:{beforeitemshow(t){!this.dragging&&this.sets&&this.stack.length<2&&!s.includes(this.sets,this.index)&&(this.index=this.getValidIndex());const e=Math.abs(this.index-this.prevIndex+(this.dir>0&&this.index<this.prevIndex||this.dir<0&&this.index>this.prevIndex?(this.maxIndex+1)*this.dir:0));if(!this.dragging&&e>1){for(let o=0;o<e;o++)this.stack.splice(1,0,this.dir>0?"next":"previous");t.preventDefault();return}const i=this.dir<0||!this.slides[this.prevIndex]?this.index:this.prevIndex,n=w(this.list)/this.length;this.duration=Q(n/this.velocity)*(s.dimensions(this.slides[i]).width/n),this.reorder()},itemshow(){~this.prevIndex&&s.addClass(this._getTransitioner().getItemIn(),this.clsActive),this.updateActiveClasses(this.prevIndex)},itemshown(){this.updateActiveClasses()}},methods:{reorder(){if(this.finite){s.css(this.slides,"order","");return}const t=this.dir>0&&this.slides[this.prevIndex]?this.prevIndex:this.index;if(this.slides.forEach((o,r)=>s.css(o,"order",this.dir>0&&r<t?1:this.dir<0&&r>=this.index?-1:"")),!this.center||!this.length)return;const e=this.slides[t];let i=s.dimensions(this.list).width/2-s.dimensions(e).width/2,n=0;for(;i>0;){const o=this.getIndex(--n+t,t),r=this.slides[o];s.css(r,"order",o>t?-2:-1),i-=s.dimensions(r).width}},updateActiveClasses(t=this.index){let e=this._getTransitioner(t).getActives();this.active!=="all"&&(e=[this.slides[this.getValidIndex(t)]]);const i=[this.clsActive,!this.sets||s.includes(this.sets,s.toFloat(this.index))?this.clsActivated:""];for(const n of this.slides){const o=s.includes(e,n);s.toggleClass(n,i,o),s.attr(n,"aria-hidden",!o);for(const r of s.$$(s.selFocusable,n))s.hasOwn(r,"_tabindex")||(r._tabindex=s.attr(r,"tabindex")),s.attr(r,"tabindex",o?r._tabindex:-1)}},getValidIndex(t=this.index,e=this.prevIndex){if(t=this.getIndex(t,e),!this.sets)return t;let i;do{if(s.includes(this.sets,t))return t;i=t,t=this.getIndex(t+this.dir,e)}while(t!==i);return t},getAdjacentSlides(){const{width:t}=s.dimensions(this.list),e=-t,i=t*2,n=s.dimensions(this.slides[this.index]).width,o=this.center?t/2-n/2:0,r=new Set;for(const h of[-1,1]){let a=o+(h>0?n:0),c=0;do{const l=this.slides[this.getIndex(this.index+h+c++*h)];a+=s.dimensions(l).width*h,r.add(l)}while(this.length>c&&a>e&&a<i)}return Array.from(r)},getIndexAt(t){let e=-1;const i=this.center?w(this.list)-(s.dimensions(this.slides[0]).width/2+s.dimensions(s.last(this.slides)).width/2):w(this.list,this.maxIndex);let n=t*i,o=0;do{const r=s.dimensions(this.slides[++e]).width,h=this.center?r/2+s.dimensions(this.slides[e+1]).width/2:r;o=n/h%1,n-=h}while(n>=0&&e<this.maxIndex);return[e,o]}}};function pe(t,e){if(!t||t.length<2)return!0;const{width:i}=s.dimensions(t);if(!e)return Math.ceil(w(t))<Math.trunc(i+xe(t));const n=s.children(t),o=Math.trunc(i/2);for(const r in n){const h=n[r],a=s.dimensions(h).width,c=new Set([h]);let l=0;for(const d of[-1,1]){let f=a/2,g=0;for(;f<o;){const u=n[s.getIndex(+r+d+g++*d,n)];if(c.has(u))return!0;f+=s.dimensions(u).width,c.add(u)}l=Math.max(l,a/2+s.dimensions(n[s.getIndex(+r+d,n)]).width/2-(f-o))}if(Math.trunc(l)>s.sumBy(n.filter(d=>!c.has(d)),d=>s.dimensions(d).width))return!0}return!1}function xe(t){return Math.max(0,...s.children(t).map(e=>s.dimensions(e).width))}return typeof window<"u"&&window.UIkit&&window.UIkit.component("slider",ft),ft});