12345678 |
- /*!
- * Splide.js
- * Version : 4.1.2
- * License : MIT
- * Copyright: 2022 Naotoshi Fujita
- */
- var t,n;t=this,n=function(){"use strict";var s="rtl",u="ttb",o={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:["ArrowUp","ArrowRight"],ArrowRight:["ArrowDown","ArrowLeft"]};function e(t,n,e){return{resolve:function(t,n,i){var r=(i=i||e.direction)!==s||n?i===u?0:-1:1;return o[t]&&o[t][r]||t.replace(/width|left|right/i,function(t,n){t=o[t.toLowerCase()][r]||t;return 0<n?t.charAt(0).toUpperCase()+t.slice(1):t})},orient:function(t){return t*(e.direction===s?1:-1)}}}var i="splide",t=i+"__",r=i,a=t+"track",c=t+"list",h=t+"slide",f=h+"--clone",n=t+"arrow",l=t+"pagination",d="is-active",v={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:{slide:h,clone:f,arrows:t+"arrows",arrow:n,prev:n+"--prev",next:n+"--next",pagination:l,page:l+"__page",spinner:t+"spinner"},i18n:{prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select a slide to show",slideLabel:"%s of %s"},reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}};function p(t,n,i){return Array.prototype.slice.call(t,n,i)}function g(t){return t.bind.apply(t,[null].concat(p(arguments,1)))}function w(t,n){return typeof n===t}function b(t){return null!==t&&w("object",t)}var m=Array.isArray,y=(g(w,"function"),g(w,"string"));function x(t){return m(t)?t:[t]}function _(t,n){x(t).forEach(n)}function A(t,n){return t.push.apply(t,x(n)),t}function L(t,n){return function(t){try{return t instanceof(t.ownerDocument.defaultView||window).HTMLElement}catch(t){return!1}}(t)&&(t.msMatchesSelector||t.matches).call(t,n)}function M(t,n){return n?(i=n,n=(n=t)?p(n.children):[],(i?n.filter(function(t){return L(t,i)}):n)[0]):t.firstElementChild;var i}g(w,"undefined");var E=Object.keys;function P(n,i,t){n&&(t?E(n).reverse():E(n)).forEach(function(t){"__proto__"!==t&&i(n[t],t)})}function S(r){return p(arguments,1).forEach(function(i){P(i,function(t,n){r[n]=i[n]})}),r}function X(i){return p(arguments,1).forEach(function(t){P(t,function(t,n){m(t)?i[n]=t.slice():b(t)?i[n]=X({},b(i[n])?i[n]:{},t):i[n]=t})}),i}function j(t){_(t,function(t){t&&t.parentNode&&t.parentNode.removeChild(t)})}function G(t){return y(t)?t:t?t+"px":""}function O(t,n){if(!t)throw new Error("["+i+"] "+(n||""))}Math.min;var R=Math.max;Math.floor,Math.ceil,Math.abs;function T(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}var z={};function B(){var o=[];function i(t,i,r){_(t,function(n){n&&_(i,function(t){t.split(" ").forEach(function(t){t=t.split(".");r(n,t[0],t[1])})})})}return{bind:function(t,n,s,u){i(t,n,function(t,n,i){var r="addEventListener"in t,e=r?t.removeEventListener.bind(t,n,s,u):t.removeListener.bind(t,s);r?t.addEventListener(n,s,u):t.addListener(s),o.push([t,n,i,s,e])})},unbind:function(t,n,e){i(t,n,function(n,i,r){o=o.filter(function(t){return!!(t[0]!==n||t[1]!==i||t[2]!==r||e&&t[3]!==e)||(t[4](),!1)})})},dispatch:function(t,n,i){var r;return"function"==typeof CustomEvent?r=new CustomEvent(n,{bubbles:!0,detail:i}):(r=document.createEvent("CustomEvent")).initCustomEvent(n,!0,!1,i),t.dispatchEvent(r),r},destroy:function(){o.forEach(function(t){t[4]()}),o.length=0}}}function C(t){var i=t?t.event.bus:document.createDocumentFragment(),r=B();return t&&t.event.on("destroy",r.destroy),S(r,{bus:i,on:function(t,n){r.bind(i,x(t).join(" "),function(t){n.apply(n,m(t.detail)?t.detail:[])})},off:g(r.unbind,i),emit:function(t){r.dispatch(i,t,p(arguments,1))}})}var W={listTag:"ul",slideTag:"li"},k=function(){function t(t,n){this.styles={},this.id=t,this.options=n}var n=t.prototype;return n.rule=function(t,n,i,r){r=this.styles[r=r||"default"]=this.styles[r]||{};(r[t]=r[t]||{})[n]=i},n.build=function(){var i=this,n="";return this.styles.default&&(n+=this.buildSelectors(this.styles.default)),Object.keys(this.styles).sort(function(t,n){return"min"===i.options.mediaQuery?+t-+n:+n-+t}).forEach(function(t){"default"!==t&&(n=(n+="@media screen and (max-width: "+t+"px) {")+i.buildSelectors(i.styles[t])+"}")}),n},n.buildSelectors=function(t){var i=this,r="";return P(t,function(t,n){n=("#"+i.id+" "+n).trim(),r+=n+" {",P(t,function(t,n){!t&&0!==t||(r+=n+": "+t+";")}),r+="}"}),r},t}();return function(){function t(t,n,i,r){this.slides=[],this.options={},this.breakpoints=[],X(v,r||{}),X(X(this.options,v),n||{}),this.contents=t,this.config=S({},W,i||{}),this.id=this.config.id||""+(r="splide")+((r=z[r]=(z[r]||0)+1)<10?"0"+r:""+r),this.Style=new k(this.id,this.options),this.Direction=e(0,0,this.options),O(this.contents.length,"Provide at least 1 content."),this.init()}t.clean=function(t){var n,i=C(t).on,r=t.root,t=(t=r,(n="."+f)?p(t.querySelectorAll(n)):[]);i("mounted",function(){j(M(r,"style"))}),j(t)};var n=t.prototype;return n.init=function(){this.parseBreakpoints(),this.initSlides(),this.registerRootStyles(),this.registerTrackStyles(),this.registerSlideStyles(),this.registerListStyles()},n.initSlides=function(){var i=this;A(this.slides,this.contents.map(function(t,n){(t=y(t)?{html:t}:t).styles=t.styles||{},t.attrs=t.attrs||{},i.cover(t);n=i.options.classes.slide+" "+(0===n?"is-active":"");return S(t.attrs,{class:(n+" "+(t.attrs.class||"")).trim(),style:i.buildStyles(t.styles)}),t})),this.isLoop()&&this.generateClones(this.slides)},n.registerRootStyles=function(){var i=this;this.breakpoints.forEach(function(t){var n=t[0],t=t[1];i.Style.rule(" ","max-width",G(t.width),n)})},n.registerTrackStyles=function(){var i=this,r=this.Style,e="."+a;this.breakpoints.forEach(function(t){var n=t[0],t=t[1];r.rule(e,i.resolve("paddingLeft"),i.cssPadding(t,!1),n),r.rule(e,i.resolve("paddingRight"),i.cssPadding(t,!0),n),r.rule(e,"height",i.cssTrackHeight(t),n)})},n.registerListStyles=function(){var i=this,r=this.Style,e="."+c;this.breakpoints.forEach(function(t){var n=t[0],t=t[1];r.rule(e,"transform",i.buildTranslate(t),n),i.cssSlideHeight(t)||r.rule(e,"aspect-ratio",i.cssAspectRatio(t),n)})},n.registerSlideStyles=function(){var i=this,r=this.Style,e="."+h;this.breakpoints.forEach(function(t){var n=t[0],t=t[1];r.rule(e,"width",i.cssSlideWidth(t),n),r.rule(e,"height",i.cssSlideHeight(t)||"100%",n),r.rule(e,i.resolve("marginRight"),G(t.gap)||"0px",n),r.rule(e+" > img","display",t.cover?"none":"inline",n)})},n.buildTranslate=function(t){var n=this.Direction,i=n.resolve,n=n.orient,r=[];return r.push(this.cssOffsetClones(t)),r.push(this.cssOffsetGaps(t)),this.isCenter(t)&&(r.push(this.buildCssValue(n(-50),"%")),r.push.apply(r,this.cssOffsetCenter(t))),r.filter(Boolean).map(function(t){return"translate"+i("X")+"("+t+")"}).join(" ")},n.cssOffsetClones=function(t){var n,i=this.Direction,r=i.resolve,i=i.orient,e=this.getCloneCount();return this.isFixedWidth(t)?(n=(r=this.parseCssValue(t[r("fixedWidth")])).value,r=r.unit,this.buildCssValue(i(n)*e,r)):i(100*e/t.perPage)+"%"},n.cssOffsetCenter=function(t){var n,i,r=this.Direction,e=r.resolve,r=r.orient;return this.isFixedWidth(t)?(n=(e=this.parseCssValue(t[e("fixedWidth")])).value,e=e.unit,[this.buildCssValue(r(n/2),e)]):(n=t.perPage,e=t.gap,(t=[]).push(r(50/n)+"%"),e&&(i=(e=this.parseCssValue(e)).value,e=e.unit,t.push(this.buildCssValue(r((i/n-i)/2),e))),t)},n.cssOffsetGaps=function(t){var n,i,r,e=this.getCloneCount();return e&&t.gap?(n=this.Direction.orient,i=(r=this.parseCssValue(t.gap)).value,r=r.unit,this.isFixedWidth(t)?this.buildCssValue(n(i*e),r):(t=t.perPage,this.buildCssValue(n(e/t*i),r))):""},n.resolve=function(t){return T(this.Direction.resolve(t))},n.cssPadding=function(t,n){t=t.padding,n=this.Direction.resolve(n?"right":"left",!0);return t&&G(t[n]||(b(t)?0:t))||"0px"},n.cssTrackHeight=function(t){var n="";return this.isVertical()&&(O(n=this.cssHeight(t),'"height" is missing.'),n="calc("+n+" - "+this.cssPadding(t,!1)+" - "+this.cssPadding(t,!0)+")"),n},n.cssHeight=function(t){return G(t.height)},n.cssSlideWidth=function(t){return t.autoWidth?"":G(t.fixedWidth)||(this.isVertical()?"":this.cssSlideSize(t))},n.cssSlideHeight=function(t){return G(t.fixedHeight)||(this.isVertical()?t.autoHeight?"":this.cssSlideSize(t):this.cssHeight(t))},n.cssSlideSize=function(t){var n=G(t.gap);return"calc((100%"+(n&&" + "+n)+")/"+(t.perPage||1)+(n&&" - "+n)+")"},n.cssAspectRatio=function(t){t=t.heightRatio;return t?""+1/t:""},n.buildCssValue=function(t,n){return""+t+n},n.parseCssValue=function(t){return y(t)?{value:parseFloat(t)||0,unit:t.replace(/\d*(\.\d*)?/,"")||"px"}:{value:t,unit:"px"}},n.parseBreakpoints=function(){var i=this,t=this.options.breakpoints;this.breakpoints.push(["default",this.options]),t&&P(t,function(t,n){i.breakpoints.push([n,X(X({},i.options),t)])})},n.isFixedWidth=function(t){return!!t[this.Direction.resolve("fixedWidth")]},n.isLoop=function(){return"loop"===this.options.type},n.isCenter=function(t){if("center"===t.focus){if(this.isLoop())return!0;if("slide"===this.options.type)return!this.options.trimSpace}return!1},n.isVertical=function(){return this.options.direction===u},n.buildClasses=function(){var t=this.options;return[r,r+"--"+t.type,r+"--"+t.direction,t.drag&&r+"--draggable",t.isNavigation&&r+"--nav",d,!this.config.hidden&&"is-rendered"].filter(Boolean).join(" ")},n.buildAttrs=function(t){var i="";return P(t,function(t,n){i+=t?" "+T(n)+'="'+t+'"':""}),i.trim()},n.buildStyles=function(t){var i="";return P(t,function(t,n){i+=" "+T(n)+":"+t+";"}),i.trim()},n.renderSlides=function(){var n=this,i=this.config.slideTag;return this.slides.map(function(t){return"<"+i+" "+n.buildAttrs(t.attrs)+">"+(t.html||"")+"</"+i+">"}).join("")},n.cover=function(t){var n=t.styles,t=t.html,t=void 0===t?"":t;this.options.cover&&!this.options.lazyLoad&&(t=t.match(/<img.*?src\s*=\s*(['"])(.+?)\1.*?>/))&&t[2]&&(n.background="center/cover no-repeat url('"+t[2]+"')")},n.generateClones=function(r){for(var e=this.options.classes,s=this.getCloneCount(),t=r.slice();t.length<s;)A(t,t);A(t.slice(-s).reverse(),t.slice(0,s)).forEach(function(t,n){var i=S({},t.attrs,{class:t.attrs.class+" "+e.clone}),t=S({},t,{attrs:i});n<s?r.unshift(t):r.push(t)})},n.getCloneCount=function(){var t;return this.isLoop()?(t=this.options).clones||R.apply(void 0,this.breakpoints.map(function(t){return t[1].perPage}))*((t.flickMaxPages||1)+1):0},n.renderArrows=function(){var t="";return(t+='<div class="'+this.options.classes.arrows+'">')+this.renderArrow(!0)+this.renderArrow(!1)+"</div>"},n.renderArrow=function(t){var n=this.options,i=n.classes,n=n.i18n,i={class:i.arrow+" "+(t?i.prev:i.next),type:"button",ariaLabel:t?n.prev:n.next};return"<button "+this.buildAttrs(i)+'><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="'+(this.options.arrowPath||"m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z")+'" /></svg></button>'},n.html=function(){var t=this.config,n=t.rootClass,i=t.listTag,r=t.arrows,e=t.beforeTrack,s=t.afterTrack,u=t.slider,o=t.beforeSlider,t=t.afterSlider,a="";return a=(a+='<div id="'+this.id+'" class="'+this.buildClasses()+" "+(n||"")+'">')+("<style>"+this.Style.build()+"</style>"),u&&(a=a+(o||"")+'<div class="splide__slider">'),a+=e||"",r&&(a+=this.renderArrows()),a=(a=(a=a+'<div class="splide__track">'+("<"+i+' class="splide__list">'))+this.renderSlides()+("</"+i+">"))+"</div>"+(s||""),u&&(a=a+"</div>"+(t||"")),a+="</div>"},t}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).SplideRenderer=n();
- //# sourceMappingURL=splide-renderer.min.js.map
|