vendor: 12,904 bytes, lines 1-516
1/*! 2 Colorbox 1.6.4 3 license: MIT 4 http://www.jacklmoore.com/colorbox 5*/ 6(function ($, document, window) { 7 var 8 // Default settings object. 9 // See http://jacklmoore.com/colorbox for details. 10 defaults = { 11 // data sources 12 html: false, 13 photo: false, 14 iframe: false, 15 inline: false, 16 17 // behavior and appearance 18 transition: "elastic", 19 speed: 300, 20 fadeOut: 300, 21 width: false, 22 initialWidth: "600", 23 innerWidth: false, 24 maxWidth: false, 25 height: false, 26 initialHeight: "450", 27 innerHeight: false, 28 maxHeight: false, 29 scalePhotos: true, 30 scrolling: true, 31 opacity: 0.9, 32 preloading: true, 33 className: false, 34 overlayClose: true, 35 escKey: true, 36 arrowKey: true, 37 top: false, 38 bottom: false, 39 left: false, 40 right: false, 41 fixed: false, 42 data: undefined, 43 closeButton: true, 44 fastIframe: true, 45 open: false, 46 reposition: true, 47 loop: true, 48 slideshow: false, 49 slideshowAuto: true, 50 slideshowSpeed: 2500, 51 slideshowStart: "start slideshow", 52 slideshowStop: "stop slideshow", 53 photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i, 54 55 // alternate image paths for high-res displays 56 retinaImage: false, 57 retinaUrl: false, 58 retinaSuffix: '@2x.$1', 59 60 // internationalization 61 current: "image {current} of {total}", 62 previous: "previous", 63 next: "next", 64 close: "close", 65 xhrError: "This content failed to load.", 66 imgError: "This image failed to load.", 67 68 // accessbility 69 returnFocus: true, 70 trapFocus: true, 71 72 // callbacks 73 onOpen: false, 74 onLoad: false, 75 onComplete: false, 76 onCleanup: false, 77 onClosed: false, 78 79 rel: function() { 80 return this.rel; 81 }, 82 href: function() { 83 // using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container') 84 return $(this).attr('href'); 85 }, 86 title: function() { 87 return this.title; 88 }, 89 createImg: function() { 90 var img = new Image(); 91 var attrs = $(this).data('cbox-img-attrs'); 92 93 if (typeof attrs === 'object') { 94 $.each(attrs, function(key, val){ 95 img[key] = val; 96 }); 97 } 98 99 return img; 100 }, 101 createIframe: function() { 102 var iframe = document.createElement('iframe'); 103 var attrs = $(this).data('cbox-iframe-attrs'); 104 105 if (typeof attrs === 'object') { 106 $.each(attrs, function(key, val){ 107 iframe[key] = val; 108 }); 109 } 110 111 if ('frameBorder' in iframe) { 112 iframe.frameBorder = 0; 113 } 114 if ('allowTransparency' in iframe) { 115 iframe.allowTransparency = "true"; 116 } 117 iframe.name = (new Date()).getTime(); // give the iframe a unique name to prevent caching 118 iframe.allowFullscreen = true; 119 120 return iframe; 121 } 122 }, 123 124 // Abstracting the HTML and event identifiers for easy rebranding 125 colorbox = 'colorbox', 126 prefix = 'cbox', 127 boxElement = prefix + 'Element', 128 129 // Events 130 event_open = prefix + '_open', 131 event_load = prefix + '_load', 132 event_complete = prefix + '_complete', 133 event_cleanup = prefix + '_cleanup', 134 event_closed = prefix + '_closed', 135 event_purge = prefix + '_purge', 136 137 // Cached jQuery Object Variables 138 $overlay, 139 $box, 140 $wrap, 141 $content, 142 $topBorder, 143 $leftBorder, 144 $rightBorder, 145 $bottomBorder, 146 $related, 147 $window, 148 $loaded, 149 $loadingBay, 150 $loadingOverlay, 151 $title, 152 $current, 153 $slideshow, 154 $next, 155 $prev, 156 $close, 157 $groupControls, 158 $events = $('<a/>'), // $({}) would be prefered, but there is an issue with jQuery 1.4.2 159 160 // Variables for cached values or use across multiple functions 161 settings, 162 interfaceHeight, 163 interfaceWidth, 164 loadedHeight, 165 loadedWidth, 166 index, 167 photo, 168 open, 169 active, 170 closing, 171 loadingTimer, 172 publicMethod, 173 div = "div", 174 requests = 0, 175 previousCSS = {}, 176 init; 177 178 // **************** 179 // HELPER FUNCTIONS 180 // **************** 181 182 // Convenience function for creating new jQuery objects 183 function $tag(tag, id, css) { 184 var element = document.createElement(tag); 185 186 if (id) { 187 element.id = prefix + id; 188 } 189 190 if (css) { 191 element.style.cssText = css; 192 } 193 194 return $(element); 195 } 196 197 // Get the window height using innerHeight when available to avoid an issue with iOS 198 // http://bugs.jquery.com/ticket/6724 199 function winheight() { 200 return window.innerHeight ? window.innerHeight : $(window).height(); 201 } 202 203 function Settings(element, options) { 204 if (options !== Object(options)) { 205 options = {}; 206 } 207 208 this.cache = {}; 209 this.el = element; 210 211 this.value = function(key) { 212 var dataAttr; 213 214 if (this.cache[key] === undefined) { 215 dataAttr = $(this.el).attr('data-cbox-'+key); 216 217 if (dataAttr !== undefined) { 218 this.cache[key] = dataAttr; 219 } else if (options[key] !== undefined) { 220 this.cache[key] = options[key]; 221 } else if (defaults[key] !== undefined) { 222 this.cache[key] = defaults[key]; 223 } 224 } 225 226 return this.cache[key]; 227 }; 228 229 this.get = function(key) { 230 var value = this.value(key); 231 return $.isFunction(value) ? value.call(this.el, this) : value; 232 }; 233 } 234 235 // Determine the next and previous members in a group. 236 function getIndex(increment) { 237 var 238 max = $related.length, 239 newIndex = (index + increment) % max; 240 241 return (newIndex < 0) ? max + newIndex : newIndex; 242 } 243 244 // Convert '%' and 'px' values to integers 245 function setSize(size, dimension) { 246 return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10)); 247 } 248 249 // Checks an href to see if it is a photo. 250 // There is a force photo option (photo: true) for hrefs that cannot be matched by the regex. 251 function isImage(settings, url) { 252 return settings.get('photo') || settings.get('photoRegex').test(url); 253 } 254 255 function retinaUrl(settings, url) { 256 return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url; 257 } 258 259 function trapFocus(e) { 260 if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) { 261 e.stopPropagation(); 262 $box.focus(); 263 } 264 } 265 266 function setClass(str) { 267 if (setClass.str !== str) { 268 $box.add($overlay).removeClass(setClass.str).addClass(str); 269 setClass.str = str; 270 } 271 } 272 273 function getRelated(rel) { 274 index = 0; 275 276 if (rel && rel !== false && rel !== 'nofollow') { 277 $related = $('.' + boxElement).filter(function () { 278 var options = $.data(this, colorbox); 279 var settings = new Settings(this, options); 280 return (settings.get('rel') === rel); 281 }); 282 index = $related.index(settings.el); 283 284 // Check direct calls to Colorbox. 285 if (index === -1) { 286 $related = $related.add(settings.el); 287 index = $related.length - 1; 288 } 289 } else { 290 $related = $(settings.el); 291 } 292 } 293 294 function trigger(event) { 295 // for external use 296 $(document).trigger(event); 297 // for internal use 298 $events.triggerHandler(event); 299 } 300 301 var slideshow = (function(){ 302 var active, 303 className = prefix + "Slideshow_", 304 click = "click." + prefix, 305 timeOut; 306 307 function clear () { 308 clearTimeout(timeOut); 309 } 310 311 function set() { 312 if (settings.get('loop') || $related[index + 1]) { 313 clear(); 314 timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed')); 315 } 316 } 317 318 function start() { 319 $slideshow 320 .html(settings.get('slideshowStop')) 321 .unbind(click) 322 .one(click, stop); 323 324 $events 325 .bind(event_complete, set) 326 .bind(event_load, clear); 327 328 $box.removeClass(className + "off").addClass(className + "on"); 329 } 330 331 function stop() { 332 clear(); 333 334 $events 335 .unbind(event_complete, set) 336 .unbind(event_load, clear); 337 338 $slideshow 339 .html(settings.get('slideshowStart')) 340 .unbind(click) 341 .one(click, function () { 342 publicMethod.next(); 343 start(); 344 }); 345 346 $box.removeClass(className + "on").addClass(className + "off"); 347 } 348 349 function reset() { 350 active = false; 351 $slideshow.hide(); 352 clear(); 353 $events 354 .unbind(event_complete, set) 355 .unbind(event_load, clear); 356 $box.removeClass(className + "off " + className + "on"); 357 } 358 359 return function(){ 360 if (active) { 361 if (!settings.get('slideshow')) { 362 $events.unbind(event_cleanup, reset); 363 reset(); 364 } 365 } else { 366 if (settings.get('slideshow') && $related[1]) { 367 active = true; 368 $events.one(event_cleanup, reset); 369 if (settings.get('slideshowAuto')) { 370 start(); 371 } else { 372 stop(); 373 } 374 $slideshow.show(); 375 } 376 } 377 }; 378 379 }()); 380 381 382 function launch(element) { 383 var options; 384 385 if (!closing) { 386 387 options = $(element).data(colorbox); 388 389 settings = new Settings(element, options); 390 391 getRelated(settings.get('rel')); 392 393 if (!open) { 394 open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys. 395 396 setClass(settings.get('className')); 397 398 // Show colorbox so the sizes can be calculated in older versions of jQuery 399 $box.css({visibility:'hidden', display:'block', opacity:''}); 400 401 $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden'); 402 $content.css({width:'', height:''}).append($loaded); 403 404 // Cache values needed for size calculations 405 interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height(); 406 interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width(); 407 loadedHeight = $loaded.outerHeight(true); 408 loadedWidth = $loaded.outerWidth(true); 409 410 // Opens inital empty Colorbox prior to content being loaded. 411 var initialWidth = setSize(settings.get('initialWidth'), 'x'); 412 var initialHeight = setSize(settings.get('initialHeight'), 'y'); 413 var maxWidth = settings.get('maxWidth'); 414 var maxHeight = settings.get('maxHeight'); 415 416 settings.w = Math.max((maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth, 0); 417 settings.h = Math.max((maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight, 0); 418 419 $loaded.css({width:'', height:settings.h}); 420 publicMethod.position(); 421 422 trigger(event_open); 423 settings.get('onOpen'); 424 425 $groupControls.add($title).hide(); 426 427 $box.focus(); 428 429 if (settings.get('trapFocus')) { 430 // Confine focus to the modal 431 // Uses event capturing that is not supported in IE8- 432 if (document.addEventListener) { 433 434 document.addEventListener('focus', trapFocus, true); 435 436 $events.one(event_closed, function () { 437 document.removeEventListener('focus', trapFocus, true); 438 }); 439 } 440 } 441 442 // Return focus on closing 443 if (settings.get('returnFocus')) { 444 $events.one(event_closed, function () { 445 $(settings.el).focus(); 446 }); 447 } 448 } 449 450 var opacity = parseFloat(settings.get('opacity')); 451 $overlay.css({ 452 opacity: opacity === opacity ? opacity : '', 453 cursor: settings.get('overlayClose') ? 'pointer' : '', 454 visibility: 'visible' 455 }).show(); 456 457 if (settings.get('closeButton')) { 458 $close.html(settings.get('close')).appendTo($content); 459 } else { 460 $close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4 461 } 462 463 load(); 464 } 465 } 466 467 // Colorbox's markup needs to be added to the DOM prior to being called 468 // so that the browser will go ahead and load the CSS background images. 469 function appendHTML() { 470 if (!$box) { 471 init = false; 472 $window = $(window); 473 $box = $tag(div).attr({ 474 id: colorbox, 475 'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS. 476 role: 'dialog', 477 tabindex: '-1' 478 }).hide(); 479 $overlay = $tag(div, "Overlay").hide(); 480 $loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]); 481 $wrap = $tag(div, "Wrapper"); 482 $content = $tag(div, "Content").append( 483 $title = $tag(div, "Title"), 484 $current = $tag(div, "Current"), 485 $prev = $('<button type="button"/>').attr({id:prefix+'Previous'}), 486 $next = $('<button type="button"/>').attr({id:prefix+'Next'}), 487 $slideshow = $('<button type="button"/>').attr({id:prefix+'Slideshow'}), 488 $loadingOverlay 489 ); 490 491 $close = $('<button type="button"/>').attr({id:prefix+'Close'}); 492 493 $wrap.append( // The 3x3 Grid that makes up Colorbox 494 $tag(div).append( 495 $tag(div, "TopLeft"), 496 $topBorder = $tag(div, "TopCenter"), 497 $tag(div, "TopRight") 498 ), 499 $tag(div, false, 'clear:left').append( 500 $leftBorder = $tag(div, "MiddleLeft"), 501 $content, 502 $rightBorder = $tag(div, "MiddleRight") 503 ), 504 $tag(div, false, 'clear:left').append( 505 $tag(div, "BottomLeft"), 506 $bottomBorder = $tag(div, "BottomCenter"), 507 $tag(div, "BottomRight") 508 ) 509 ).find('div div').css({'float': 'left'}); 510 511 $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;'); 512 513 $groupControls = $next.add($prev).add($current).add($slideshow); 514 } 515 if (document.body && !$box.parent().length) { 516 $(document.body).
vendor: 1,955 bytes, lines 516-590
516prepend($overlay, $box.append($wrap, $loadingBay)); 517 } 518 } 519 520 // Add Colorbox's event bindings 521 function addBindings() { 522 function clickHandler(e) { 523 // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt. 524 // See: http://jacklmoore.com/notes/click-events/ 525 if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) { 526 e.preventDefault(); 527 launch(this); 528 } 529 } 530 531 if ($box) { 532 if (!init) { 533 init = true; 534 535 // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly. 536 $next.click(function () { 537 publicMethod.next(); 538 }); 539 $prev.click(function () { 540 publicMethod.prev(); 541 }); 542 $close.click(function () { 543 publicMethod.close(); 544 }); 545 $overlay.click(function () { 546 if (settings.get('overlayClose')) { 547 publicMethod.close(); 548 } 549 }); 550 551 // Key Bindings 552 $(document).bind('keydown.' + prefix, function (e) { 553 var key = e.keyCode; 554 if (open && settings.get('escKey') && key === 27) { 555 e.preventDefault(); 556 publicMethod.close(); 557 } 558 if (open && settings.get('arrowKey') && $related[1] && !e.altKey) { 559 if (key === 37) { 560 e.preventDefault(); 561 $prev.click(); 562 } else if (key === 39) { 563 e.preventDefault(); 564 $next.click(); 565 } 566 } 567 }); 568 569 if ($.isFunction($.fn.on)) { 570 // For jQuery 1.7+ 571 $(document).on('click.'+prefix, '.'+boxElement, clickHandler); 572 } else { 573 // For jQuery 1.3.x -> 1.6.x 574 // This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed. 575 // This is not here for jQuery 1.9, it's here for legacy users. 576 $('.'+boxElement).live('click.'+prefix, clickHandler); 577 } 578 } 579 return true; 580 } 581 return false; 582 } 583 584 // Don't do anything if Colorbox already exists. 585 if ($[colorbox]) { 586 return; 587 } 588 589 // Append the HTML when the DOM loads 590 //
vendor: 14,313 bytes, lines 590-1105
590$(appendHTML); 591 592 593 // **************** 594 // PUBLIC FUNCTIONS 595 // Usage format: $.colorbox.close(); 596 // Usage from within an iframe: parent.jQuery.colorbox.close(); 597 // **************** 598 599 publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) { 600 var settings; 601 var $obj = this; 602 603 options = options || {}; 604 605 if ($.isFunction($obj)) { // assume a call to $.colorbox 606 $obj = $('<a/>'); 607 options.open = true; 608 } 609 610 if (!$obj[0]) { // colorbox being applied to empty collection 611 return $obj; 612 } 613 614 appendHTML(); 615 616 if (addBindings()) { 617 618 if (callback) { 619 options.onComplete = callback; 620 } 621 622 $obj.each(function () { 623 var old = $.data(this, colorbox) || {}; 624 $.data(this, colorbox, $.extend(old, options)); 625 }).addClass(boxElement); 626 627 settings = new Settings($obj[0], options); 628 629 if (settings.get('open')) { 630 launch($obj[0]); 631 } 632 } 633 634 return $obj; 635 }; 636 637 publicMethod.position = function (speed, loadedCallback) { 638 var 639 css, 640 top = 0, 641 left = 0, 642 offset = $box.offset(), 643 scrollTop, 644 scrollLeft; 645 646 $window.unbind('resize.' + prefix); 647 648 // remove the modal so that it doesn't influence the document width/height 649 $box.css({top: -9e4, left: -9e4}); 650 651 scrollTop = $window.scrollTop(); 652 scrollLeft = $window.scrollLeft(); 653 654 if (settings.get('fixed')) { 655 offset.top -= scrollTop; 656 offset.left -= scrollLeft; 657 $box.css({position: 'fixed'}); 658 } else { 659 top = scrollTop; 660 left = scrollLeft; 661 $box.css({position: 'absolute'}); 662 } 663 664 // keeps the top and left positions within the browser's viewport. 665 if (settings.get('right') !== false) { 666 left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0); 667 } else if (settings.get('left') !== false) { 668 left += setSize(settings.get('left'), 'x'); 669 } else { 670 left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2); 671 } 672 673 if (settings.get('bottom') !== false) { 674 top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0); 675 } else if (settings.get('top') !== false) { 676 top += setSize(settings.get('top'), 'y'); 677 } else { 678 top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2); 679 } 680 681 $box.css({top: offset.top, left: offset.left, visibility:'visible'}); 682 683 // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly, 684 // but it has to be shrank down around the size of div#colorbox when it's done. If not, 685 // it can invoke an obscure IE bug when using iframes. 686 $wrap[0].style.width = $wrap[0].style.height = "9999px"; 687 688 function modalDimensions() { 689 $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px'; 690 $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px'; 691 } 692 693 css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left}; 694 695 // setting the speed to 0 if the content hasn't changed size or position 696 if (speed) { 697 var tempSpeed = 0; 698 $.each(css, function(i){ 699 if (css[i] !== previousCSS[i]) { 700 tempSpeed = speed; 701 return; 702 } 703 }); 704 speed = tempSpeed; 705 } 706 707 previousCSS = css; 708 709 if (!speed) { 710 $box.css(css); 711 } 712 713 $box.dequeue().animate(css, { 714 duration: speed || 0, 715 complete: function () { 716 modalDimensions(); 717 718 active = false; 719 720 // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation. 721 $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px"; 722 $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px"; 723 724 if (settings.get('reposition')) { 725 setTimeout(function () { // small delay before binding onresize due to an IE8 bug. 726 $window.bind('resize.' + prefix, publicMethod.position); 727 }, 1); 728 } 729 730 if ($.isFunction(loadedCallback)) { 731 loadedCallback(); 732 } 733 }, 734 step: modalDimensions 735 }); 736 }; 737 738 publicMethod.resize = function (options) { 739 var scrolltop; 740 741 if (open) { 742 options = options || {}; 743 744 if (options.width) { 745 settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth; 746 } 747 748 if (options.innerWidth) { 749 settings.w = setSize(options.innerWidth, 'x'); 750 } 751 752 $loaded.css({width: settings.w}); 753 754 if (options.height) { 755 settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight; 756 } 757 758 if (options.innerHeight) { 759 settings.h = setSize(options.innerHeight, 'y'); 760 } 761 762 if (!options.innerHeight && !options.height) { 763 scrolltop = $loaded.scrollTop(); 764 $loaded.css({height: "auto"}); 765 settings.h = $loaded.height(); 766 } 767 768 $loaded.css({height: settings.h}); 769 770 if(scrolltop) { 771 $loaded.scrollTop(scrolltop); 772 } 773 774 publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed')); 775 } 776 }; 777 778 publicMethod.prep = function (object) { 779 if (!open) { 780 return; 781 } 782 783 var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed'); 784 785 $loaded.remove(); 786 787 $loaded = $tag(div, 'LoadedContent').append(object); 788 789 function getWidth() { 790 settings.w = settings.w || $loaded.width(); 791 settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w; 792 return settings.w; 793 } 794 function getHeight() { 795 settings.h = settings.h || $loaded.height(); 796 settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h; 797 return settings.h; 798 } 799 800 $loaded.hide() 801 .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations. 802 .css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'}) 803 .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height. 804 .prependTo($content); 805 806 $loadingBay.hide(); 807 808 // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width. 809 810 $(photo).css({'float': 'none'}); 811 812 setClass(settings.get('className')); 813 814 callback = function () { 815 var total = $related.length, 816 iframe, 817 complete; 818 819 if (!open) { 820 return; 821 } 822 823 function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2 824 if ($.support.opacity === false) { 825 $box[0].style.removeAttribute('filter'); 826 } 827 } 828 829 complete = function () { 830 clearTimeout(loadingTimer); 831 $loadingOverlay.hide(); 832 trigger(event_complete); 833 settings.get('onComplete'); 834 }; 835 836 837 $title.html(settings.get('title')).show(); 838 $loaded.show(); 839 840 if (total > 1) { // handle grouping 841 if (typeof settings.get('current') === "string") { 842 $current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show(); 843 } 844 845 $next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next')); 846 $prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous')); 847 848 slideshow(); 849 850 // Preloads images within a rel group 851 if (settings.get('preloading')) { 852 $.each([getIndex(-1), getIndex(1)], function(){ 853 var img, 854 i = $related[this], 855 settings = new Settings(i, $.data(i, colorbox)), 856 src = settings.get('href'); 857 858 if (src && isImage(settings, src)) { 859 src = retinaUrl(settings, src); 860 img = document.createElement('img'); 861 img.src = src; 862 } 863 }); 864 } 865 } else { 866 $groupControls.hide(); 867 } 868 869 if (settings.get('iframe')) { 870 871 iframe = settings.get('createIframe'); 872 873 if (!settings.get('scrolling')) { 874 iframe.scrolling = "no"; 875 } 876 877 $(iframe) 878 .attr({ 879 src: settings.get('href'), 880 'class': prefix + 'Iframe' 881 }) 882 .one('load', complete) 883 .appendTo($loaded); 884 885 $events.one(event_purge, function () { 886 iframe.src = "//about:blank"; 887 }); 888 889 if (settings.get('fastIframe')) { 890 $(iframe).trigger('load'); 891 } 892 } else { 893 complete(); 894 } 895 896 if (settings.get('transition') === 'fade') { 897 $box.fadeTo(speed, 1, removeFilter); 898 } else { 899 removeFilter(); 900 } 901 }; 902 903 if (settings.get('transition') === 'fade') { 904 $box.fadeTo(speed, 0, function () { 905 publicMethod.position(0, callback); 906 }); 907 } else { 908 publicMethod.position(speed, callback); 909 } 910 }; 911 912 function load () { 913 var href, setResize, prep = publicMethod.prep, $inline, request = ++requests; 914 915 active = true; 916 917 photo = false; 918 919 trigger(event_purge); 920 trigger(event_load); 921 settings.get('onLoad'); 922 923 settings.h = settings.get('height') ? 924 setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight : 925 settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y'); 926 927 settings.w = settings.get('width') ? 928 setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth : 929 settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x'); 930 931 // Sets the minimum dimensions for use in image scaling 932 settings.mw = settings.w; 933 settings.mh = settings.h; 934 935 // Re-evaluate the minimum width and height based on maxWidth and maxHeight values. 936 // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead. 937 if (settings.get('maxWidth')) { 938 settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth; 939 settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw; 940 } 941 if (settings.get('maxHeight')) { 942 settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight; 943 settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh; 944 } 945 946 href = settings.get('href'); 947 948 loadingTimer = setTimeout(function () { 949 $loadingOverlay.show(); 950 }, 100); 951 952 if (settings.get('inline')) { 953 var $target = $(href).eq(0); 954 // Inserts an empty placeholder where inline content is being pulled from. 955 // An event is bound to put inline content back when Colorbox closes or loads new content. 956 $inline = $('<div>').hide().insertBefore($target); 957 958 $events.one(event_purge, function () { 959 $inline.replaceWith($target); 960 }); 961 962 prep($target); 963 } else if (settings.get('iframe')) { 964 // IFrame element won't be added to the DOM until it is ready to be displayed, 965 // to avoid problems with DOM-ready JS that might be trying to run in that iframe. 966 prep(" "); 967 } else if (settings.get('html')) { 968 prep(settings.get('html')); 969 } else if (isImage(settings, href)) { 970 971 href = retinaUrl(settings, href); 972 973 photo = settings.get('createImg'); 974 975 $(photo) 976 .addClass(prefix + 'Photo') 977 .bind('error.'+prefix,function () { 978 prep($tag(div, 'Error').html(settings.get('imgError'))); 979 }) 980 .one('load', function () { 981 if (request !== requests) { 982 return; 983 } 984 985 // A small pause because some browsers will occassionaly report a 986 // img.width and img.height of zero immediately after the img.onload fires 987 setTimeout(function(){ 988 var percent; 989 990 if (settings.get('retinaImage') && window.devicePixelRatio > 1) { 991 photo.height = photo.height / window.devicePixelRatio; 992 photo.width = photo.width / window.devicePixelRatio; 993 } 994 995 if (settings.get('scalePhotos')) { 996 setResize = function () { 997 photo.height -= photo.height * percent; 998 photo.width -= photo.width * percent; 999 }; 1000 if (settings.mw && photo.width > settings.mw) { 1001 percent = (photo.width - settings.mw) / photo.width; 1002 setResize(); 1003 } 1004 if (settings.mh && photo.height > settings.mh) { 1005 percent = (photo.height - settings.mh) / photo.height; 1006 setResize(); 1007 } 1008 } 1009 1010 if (settings.h) { 1011 photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px'; 1012 } 1013 1014 if ($related[1] && (settings.get('loop') || $related[index + 1])) { 1015 photo.style.cursor = 'pointer'; 1016 1017 $(photo).bind('click.'+prefix, function () { 1018 publicMethod.next(); 1019 }); 1020 } 1021 1022 photo.style.width = photo.width + 'px'; 1023 photo.style.height = photo.height + 'px'; 1024 prep(photo); 1025 }, 1); 1026 }); 1027 1028 photo.src = href; 1029 1030 } else if (href) { 1031 $loadingBay.load(href, settings.get('data'), function (data, status) { 1032 if (request === requests) { 1033 prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents()); 1034 } 1035 }); 1036 } 1037 } 1038 1039 // Navigates to the next page/image in a set. 1040 publicMethod.next = function () { 1041 if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) { 1042 index = getIndex(1); 1043 launch($related[index]); 1044 } 1045 }; 1046 1047 publicMethod.prev = function () { 1048 if (!active && $related[1] && (settings.get('loop') || index)) { 1049 index = getIndex(-1); 1050 launch($related[index]); 1051 } 1052 }; 1053 1054 // Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close(); 1055 publicMethod.close = function () { 1056 if (open && !closing) { 1057 1058 closing = true; 1059 open = false; 1060 trigger(event_cleanup); 1061 settings.get('onCleanup'); 1062 $window.unbind('.' + prefix); 1063 $overlay.fadeTo(settings.get('fadeOut') || 0, 0); 1064 1065 $box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () { 1066 $box.hide(); 1067 $overlay.hide(); 1068 trigger(event_purge); 1069 $loaded.remove(); 1070 1071 setTimeout(function () { 1072 closing = false; 1073 trigger(event_closed); 1074 settings.get('onClosed'); 1075 }, 1); 1076 }); 1077 } 1078 }; 1079 1080 // Removes changes Colorbox made to the document, but does not remove the plugin. 1081 publicMethod.remove = function () { 1082 if (!$box) { return; } 1083 1084 $box.stop(); 1085 $[colorbox].close(); 1086 $box.stop(false, true).remove(); 1087 $overlay.remove(); 1088 closing = false; 1089 $box = null; 1090 $('.' + boxElement) 1091 .removeData(colorbox) 1092 .removeClass(boxElement); 1093 1094 $(document).unbind('click.'+prefix).unbind('keydown.'+prefix); 1095 }; 1096 1097 // A method for fetching the current element Colorbox is referencing. 1098 // returns a jQuery object. 1099 publicMethod.element = function () { 1100 return $(settings.el); 1101 }; 1102 1103 publicMethod.settings = defaults; 1104 1105}(jQuery, document, window));
vendor: 10,034 bytes, lines 1106-1461
1106 1107/** 1108 * Swiper 11.1.4 1109 * Most modern mobile touch slider and framework with hardware accelerated transitions 1110 * https://swiperjs.com 1111 * 1112 * Copyright 2014-2024 Vladimir Kharlampidi 1113 * 1114 * Released under the MIT License 1115 * 1116 * Released on: July 8, 2024 1117 */ 1118 1119var Swiper = (function () { 1120 'use strict'; 1121 1122 /** 1123 * SSR Window 4.0.2 1124 * Better handling for window object in SSR environment 1125 * https://github.com/nolimits4web/ssr-window 1126 * 1127 * Copyright 2021, Vladimir Kharlampidi 1128 * 1129 * Licensed under MIT 1130 * 1131 * Released on: December 13, 2021 1132 */ 1133 /* eslint-disable no-param-reassign */ 1134 function isObject$1(obj) { 1135 return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object; 1136 } 1137 function extend$1(target, src) { 1138 if (target === void 0) { 1139 target = {}; 1140 } 1141 if (src === void 0) { 1142 src = {}; 1143 } 1144 Object.keys(src).forEach(key => { 1145 if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject$1(src[key]) && isObject$1(target[key]) && Object.keys(src[key]).length > 0) { 1146 extend$1(target[key], src[key]); 1147 } 1148 }); 1149 } 1150 const ssrDocument = { 1151 body: {}, 1152 addEventListener() {}, 1153 removeEventListener() {}, 1154 activeElement: { 1155 blur() {}, 1156 nodeName: '' 1157 }, 1158 querySelector() { 1159 return null; 1160 }, 1161 querySelectorAll() { 1162 return []; 1163 }, 1164 getElementById() { 1165 return null; 1166 }, 1167 createEvent() { 1168 return { 1169 initEvent() {} 1170 }; 1171 }, 1172 createElement() { 1173 return { 1174 children: [], 1175 childNodes: [], 1176 style: {}, 1177 setAttribute() {}, 1178 getElementsByTagName() { 1179 return []; 1180 } 1181 }; 1182 }, 1183 createElementNS() { 1184 return {}; 1185 }, 1186 importNode() { 1187 return null; 1188 }, 1189 location: { 1190 hash: '', 1191 host: '', 1192 hostname: '', 1193 href: '', 1194 origin: '', 1195 pathname: '', 1196 protocol: '', 1197 search: '' 1198 } 1199 }; 1200 function getDocument() { 1201 const doc = typeof document !== 'undefined' ? document : {}; 1202 extend$1(doc, ssrDocument); 1203 return doc; 1204 } 1205 const ssrWindow = { 1206 document: ssrDocument, 1207 navigator: { 1208 userAgent: '' 1209 }, 1210 location: { 1211 hash: '', 1212 host: '', 1213 hostname: '', 1214 href: '', 1215 origin: '', 1216 pathname: '', 1217 protocol: '', 1218 search: '' 1219 }, 1220 history: { 1221 replaceState() {}, 1222 pushState() {}, 1223 go() {}, 1224 back() {} 1225 }, 1226 CustomEvent: function CustomEvent() { 1227 return this; 1228 }, 1229 addEventListener() {}, 1230 removeEventListener() {}, 1231 getComputedStyle() { 1232 return { 1233 getPropertyValue() { 1234 return ''; 1235 } 1236 }; 1237 }, 1238 Image() {}, 1239 Date() {}, 1240 screen: {}, 1241 setTimeout() {}, 1242 clearTimeout() {}, 1243 matchMedia() { 1244 return {}; 1245 }, 1246 requestAnimationFrame(callback) { 1247 if (typeof setTimeout === 'undefined') { 1248 callback(); 1249 return null; 1250 } 1251 return setTimeout(callback, 0); 1252 }, 1253 cancelAnimationFrame(id) { 1254 if (typeof setTimeout === 'undefined') { 1255 return; 1256 } 1257 clearTimeout(id); 1258 } 1259 }; 1260 function getWindow() { 1261 const win = typeof window !== 'undefined' ? window : {}; 1262 extend$1(win, ssrWindow); 1263 return win; 1264 } 1265 1266 function classesToTokens(classes) { 1267 if (classes === void 0) { 1268 classes = ''; 1269 } 1270 return classes.trim().split(' ').filter(c => !!c.trim()); 1271 } 1272 1273 function deleteProps(obj) { 1274 const object = obj; 1275 Object.keys(object).forEach(key => { 1276 try { 1277 object[key] = null; 1278 } catch (e) { 1279 // no getter for object 1280 } 1281 try { 1282 delete object[key]; 1283 } catch (e) { 1284 // something got wrong 1285 } 1286 }); 1287 } 1288 function nextTick(callback, delay) { 1289 if (delay === void 0) { 1290 delay = 0; 1291 } 1292 return setTimeout(callback, delay); 1293 } 1294 function now() { 1295 return Date.now(); 1296 } 1297 function getComputedStyle$1(el) { 1298 const window = getWindow(); 1299 let style; 1300 if (window.getComputedStyle) { 1301 style = window.getComputedStyle(el, null); 1302 } 1303 if (!style && el.currentStyle) { 1304 style = el.currentStyle; 1305 } 1306 if (!style) { 1307 style = el.style; 1308 } 1309 return style; 1310 } 1311 function getTranslate(el, axis) { 1312 if (axis === void 0) { 1313 axis = 'x'; 1314 } 1315 const window = getWindow(); 1316 let matrix; 1317 let curTransform; 1318 let transformMatrix; 1319 const curStyle = getComputedStyle$1(el); 1320 if (window.WebKitCSSMatrix) { 1321 curTransform = curStyle.transform || curStyle.webkitTransform; 1322 if (curTransform.split(',').length > 6) { 1323 curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', '); 1324 } 1325 // Some old versions of Webkit choke when 'none' is passed; pass 1326 // empty string instead in this case 1327 transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); 1328 } else { 1329 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); 1330 matrix = transformMatrix.toString().split(','); 1331 } 1332 if (axis === 'x') { 1333 // Latest Chrome and webkits Fix 1334 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; 1335 // Crazy IE10 Matrix 1336 else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); 1337 // Normal Browsers 1338 else curTransform = parseFloat(matrix[4]); 1339 } 1340 if (axis === 'y') { 1341 // Latest Chrome and webkits Fix 1342 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; 1343 // Crazy IE10 Matrix 1344 else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); 1345 // Normal Browsers 1346 else curTransform = parseFloat(matrix[5]); 1347 } 1348 return curTransform || 0; 1349 } 1350 function isObject(o) { 1351 return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object'; 1352 } 1353 function isNode(node) { 1354 // eslint-disable-next-line 1355 if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') { 1356 return node instanceof HTMLElement; 1357 } 1358 return node && (node.nodeType === 1 || node.nodeType === 11); 1359 } 1360 function extend() { 1361 const to = Object(arguments.length <= 0 ? undefined : arguments[0]); 1362 const noExtend = ['__proto__', 'constructor', 'prototype']; 1363 for (let i = 1; i < arguments.length; i += 1) { 1364 const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i]; 1365 if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) { 1366 const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0); 1367 for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { 1368 const nextKey = keysArray[nextIndex]; 1369 const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); 1370 if (desc !== undefined && desc.enumerable) { 1371 if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) { 1372 if (nextSource[nextKey].__swiper__) { 1373 to[nextKey] = nextSource[nextKey]; 1374 } else { 1375 extend(to[nextKey], nextSource[nextKey]); 1376 } 1377 } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) { 1378 to[nextKey] = {}; 1379 if (nextSource[nextKey].__swiper__) { 1380 to[nextKey] = nextSource[nextKey]; 1381 } else { 1382 extend(to[nextKey], nextSource[nextKey]); 1383 } 1384 } else { 1385 to[nextKey] = nextSource[nextKey]; 1386 } 1387 } 1388 } 1389 } 1390 } 1391 return to; 1392 } 1393 function setCSSProperty(el, varName, varValue) { 1394 el.style.setProperty(varName, varValue); 1395 } 1396 function animateCSSModeScroll(_ref) { 1397 let { 1398 swiper, 1399 targetPosition, 1400 side 1401 } = _ref; 1402 const window = getWindow(); 1403 const startPosition = -swiper.translate; 1404 let startTime = null; 1405 let time; 1406 const duration = swiper.params.speed; 1407 swiper.wrapperEl.style.scrollSnapType = 'none'; 1408 window.cancelAnimationFrame(swiper.cssModeFrameID); 1409 const dir = targetPosition > startPosition ? 'next' : 'prev'; 1410 const isOutOfBound = (current, target) => { 1411 return dir === 'next' && current >= target || dir === 'prev' && current <= target; 1412 }; 1413 const animate = () => { 1414 time = new Date().getTime(); 1415 if (startTime === null) { 1416 startTime = time; 1417 } 1418 const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); 1419 const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2; 1420 let currentPosition = startPosition + easeProgress * (targetPosition - startPosition); 1421 if (isOutOfBound(currentPosition, targetPosition)) { 1422 currentPosition = targetPosition; 1423 } 1424 swiper.wrapperEl.scrollTo({ 1425 [side]: currentPosition 1426 }); 1427 if (isOutOfBound(currentPosition, targetPosition)) { 1428 swiper.wrapperEl.style.overflow = 'hidden'; 1429 swiper.wrapperEl.style.scrollSnapType = ''; 1430 setTimeout(() => { 1431 swiper.wrapperEl.style.overflow = ''; 1432 swiper.wrapperEl.scrollTo({ 1433 [side]: currentPosition 1434 }); 1435 }); 1436 window.cancelAnimationFrame(swiper.cssModeFrameID); 1437 return; 1438 } 1439 swiper.cssModeFrameID = window.requestAnimationFrame(animate); 1440 }; 1441 animate(); 1442 } 1443 function elementChildren(element, selector) { 1444 if (selector === void 0) { 1445 selector = ''; 1446 } 1447 return [...element.children].filter(el => el.matches(selector)); 1448 } 1449 function showWarning(text) { 1450 try { 1451 console.warn(text); 1452 return; 1453 } catch (err) { 1454 // err 1455 } 1456 } 1457 function createElement(tag, classes) { 1458 if (classes === void 0) { 1459 classes = []; 1460 } 1461 const el = document.createElement(tag);
vendor: 2,710 bytes, lines 1462-1548
1462 el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes))); 1463 return el; 1464 } 1465 function elementPrevAll(el, selector) { 1466 const prevEls = []; 1467 while (el.previousElementSibling) { 1468 const prev = el.previousElementSibling; // eslint-disable-line 1469 if (selector) { 1470 if (prev.matches(selector)) prevEls.push(prev); 1471 } else prevEls.push(prev); 1472 el = prev; 1473 } 1474 return prevEls; 1475 } 1476 function elementNextAll(el, selector) { 1477 const nextEls = []; 1478 while (el.nextElementSibling) { 1479 const next = el.nextElementSibling; // eslint-disable-line 1480 if (selector) { 1481 if (next.matches(selector)) nextEls.push(next); 1482 } else nextEls.push(next); 1483 el = next; 1484 } 1485 return nextEls; 1486 } 1487 function elementStyle(el, prop) { 1488 const window = getWindow(); 1489 return window.getComputedStyle(el, null).getPropertyValue(prop); 1490 } 1491 function elementIndex(el) { 1492 let child = el; 1493 let i; 1494 if (child) { 1495 i = 0; 1496 // eslint-disable-next-line 1497 while ((child = child.previousSibling) !== null) { 1498 if (child.nodeType === 1) i += 1; 1499 } 1500 return i; 1501 } 1502 return undefined; 1503 } 1504 function elementParents(el, selector) { 1505 const parents = []; // eslint-disable-line 1506 let parent = el.parentElement; // eslint-disable-line 1507 while (parent) { 1508 if (selector) { 1509 if (parent.matches(selector)) parents.push(parent); 1510 } else { 1511 parents.push(parent); 1512 } 1513 parent = parent.parentElement; 1514 } 1515 return parents; 1516 } 1517 function elementOuterSize(el, size, includeMargins) { 1518 const window = getWindow(); 1519 if (includeMargins) { 1520 return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom')); 1521 } 1522 return el.offsetWidth; 1523 } 1524 function makeElementsArray(el) { 1525 return (Array.isArray(el) ? el : [el]).filter(e => !!e); 1526 } 1527 1528 let support; 1529 function calcSupport() { 1530 const window = getWindow(); 1531 const document = getDocument(); 1532 return { 1533 smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style, 1534 touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch) 1535 }; 1536 } 1537 function getSupport() { 1538 if (!support) { 1539 support = calcSupport(); 1540 } 1541 return support; 1542 } 1543 1544 let deviceCached; 1545 function calcDevice(_temp) { 1546 let { 1547 userAgent 1548 } = _temp === void 0 ? {} : _temp;
vendor: 6,796 bytes, lines 1549-1756
1549 const support = getSupport(); 1550 const window = getWindow(); 1551 const platform = window.navigator.platform; 1552 const ua = userAgent || window.navigator.userAgent; 1553 const device = { 1554 ios: false, 1555 android: false 1556 }; 1557 const screenWidth = window.screen.width; 1558 const screenHeight = window.screen.height; 1559 const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line 1560 let ipad = ua.match(/(iPad).*OS\s([\d_]+)/); 1561 const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); 1562 const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); 1563 const windows = platform === 'Win32'; 1564 let macos = platform === 'MacIntel'; 1565 1566 // iPadOs 13 fix 1567 const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810']; 1568 if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) { 1569 ipad = ua.match(/(Version)\/([\d.]+)/); 1570 if (!ipad) ipad = [0, 1, '13_0_0']; 1571 macos = false; 1572 } 1573 1574 // Android 1575 if (android && !windows) { 1576 device.os = 'android'; 1577 device.android = true; 1578 } 1579 if (ipad || iphone || ipod) { 1580 device.os = 'ios'; 1581 device.ios = true; 1582 } 1583 1584 // Export object 1585 return device; 1586 } 1587 function getDevice(overrides) { 1588 if (overrides === void 0) { 1589 overrides = {}; 1590 } 1591 if (!deviceCached) { 1592 deviceCached = calcDevice(overrides); 1593 } 1594 return deviceCached; 1595 } 1596 1597 let browser; 1598 function calcBrowser() { 1599 const window = getWindow(); 1600 const device = getDevice(); 1601 let needPerspectiveFix = false; 1602 function isSafari() { 1603 const ua = window.navigator.userAgent.toLowerCase(); 1604 return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0; 1605 } 1606 if (isSafari()) { 1607 const ua = String(window.navigator.userAgent); 1608 if (ua.includes('Version/')) { 1609 const [major, minor] = ua.split('Version/')[1].split(' ')[0].split('.').map(num => Number(num)); 1610 needPerspectiveFix = major < 16 || major === 16 && minor < 2; 1611 } 1612 } 1613 const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent); 1614 const isSafariBrowser = isSafari(); 1615 const need3dFix = isSafariBrowser || isWebView && device.ios; 1616 return { 1617 isSafari: needPerspectiveFix || isSafariBrowser, 1618 needPerspectiveFix, 1619 need3dFix, 1620 isWebView 1621 }; 1622 } 1623 function getBrowser() { 1624 if (!browser) { 1625 browser = calcBrowser(); 1626 } 1627 return browser; 1628 } 1629 1630 function Resize(_ref) { 1631 let { 1632 swiper, 1633 on, 1634 emit 1635 } = _ref; 1636 const window = getWindow(); 1637 let observer = null; 1638 let animationFrame = null; 1639 const resizeHandler = () => { 1640 if (!swiper || swiper.destroyed || !swiper.initialized) return; 1641 emit('beforeResize'); 1642 emit('resize'); 1643 }; 1644 const createObserver = () => { 1645 if (!swiper || swiper.destroyed || !swiper.initialized) return; 1646 observer = new ResizeObserver(entries => { 1647 animationFrame = window.requestAnimationFrame(() => { 1648 const { 1649 width, 1650 height 1651 } = swiper; 1652 let newWidth = width; 1653 let newHeight = height; 1654 entries.forEach(_ref2 => { 1655 let { 1656 contentBoxSize, 1657 contentRect, 1658 target 1659 } = _ref2; 1660 if (target && target !== swiper.el) return; 1661 newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize; 1662 newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize; 1663 }); 1664 if (newWidth !== width || newHeight !== height) { 1665 resizeHandler(); 1666 } 1667 }); 1668 }); 1669 observer.observe(swiper.el); 1670 }; 1671 const removeObserver = () => { 1672 if (animationFrame) { 1673 window.cancelAnimationFrame(animationFrame); 1674 } 1675 if (observer && observer.unobserve && swiper.el) { 1676 observer.unobserve(swiper.el); 1677 observer = null; 1678 } 1679 }; 1680 const orientationChangeHandler = () => { 1681 if (!swiper || swiper.destroyed || !swiper.initialized) return; 1682 emit('orientationchange'); 1683 }; 1684 on('init', () => { 1685 if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') { 1686 createObserver(); 1687 return; 1688 } 1689 window.addEventListener('resize', resizeHandler); 1690 window.addEventListener('orientationchange', orientationChangeHandler); 1691 }); 1692 on('destroy', () => { 1693 removeObserver(); 1694 window.removeEventListener('resize', resizeHandler); 1695 window.removeEventListener('orientationchange', orientationChangeHandler); 1696 }); 1697 } 1698 1699 function Observer(_ref) { 1700 let { 1701 swiper, 1702 extendParams, 1703 on, 1704 emit 1705 } = _ref; 1706 const observers = []; 1707 const window = getWindow(); 1708 const attach = function (target, options) { 1709 if (options === void 0) { 1710 options = {}; 1711 } 1712 const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; 1713 const observer = new ObserverFunc(mutations => { 1714 // The observerUpdate event should only be triggered 1715 // once despite the number of mutations. Additional 1716 // triggers are redundant and are very costly 1717 if (swiper.__preventObserver__) return; 1718 if (mutations.length === 1) { 1719 emit('observerUpdate', mutations[0]); 1720 return; 1721 } 1722 const observerUpdate = function observerUpdate() { 1723 emit('observerUpdate', mutations[0]); 1724 }; 1725 if (window.requestAnimationFrame) { 1726 window.requestAnimationFrame(observerUpdate); 1727 } else { 1728 window.setTimeout(observerUpdate, 0); 1729 } 1730 }); 1731 observer.observe(target, { 1732 attributes: typeof options.attributes === 'undefined' ? true : options.attributes, 1733 childList: typeof options.childList === 'undefined' ? true : options.childList, 1734 characterData: typeof options.characterData === 'undefined' ? true : options.characterData 1735 }); 1736 observers.push(observer); 1737 }; 1738 const init = () => { 1739 if (!swiper.params.observer) return; 1740 if (swiper.params.observeParents) { 1741 const containerParents = elementParents(swiper.hostEl); 1742 for (let i = 0; i < containerParents.length; i += 1) { 1743 attach(containerParents[i]); 1744 } 1745 } 1746 // Observe container 1747 attach(swiper.hostEl, { 1748 childList: swiper.params.observeSlideChildren 1749 }); 1750 1751 // Observe wrapper 1752 attach(swiper.wrapperEl, { 1753 attributes: false 1754 }); 1755 }; 1756 const destroy = () => {
vendor: 4,990 bytes, lines 1757-1899
1757 observers.forEach(observer => { 1758 observer.disconnect(); 1759 }); 1760 observers.splice(0, observers.length); 1761 }; 1762 extendParams({ 1763 observer: false, 1764 observeParents: false, 1765 observeSlideChildren: false 1766 }); 1767 on('init', init); 1768 on('destroy', destroy); 1769 } 1770 1771 /* eslint-disable no-underscore-dangle */ 1772 1773 var eventsEmitter = { 1774 on(events, handler, priority) { 1775 const self = this; 1776 if (!self.eventsListeners || self.destroyed) return self; 1777 if (typeof handler !== 'function') return self; 1778 const method = priority ? 'unshift' : 'push'; 1779 events.split(' ').forEach(event => { 1780 if (!self.eventsListeners[event]) self.eventsListeners[event] = []; 1781 self.eventsListeners[event][method](handler); 1782 }); 1783 return self; 1784 }, 1785 once(events, handler, priority) { 1786 const self = this; 1787 if (!self.eventsListeners || self.destroyed) return self; 1788 if (typeof handler !== 'function') return self; 1789 function onceHandler() { 1790 self.off(events, onceHandler); 1791 if (onceHandler.__emitterProxy) { 1792 delete onceHandler.__emitterProxy; 1793 } 1794 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 1795 args[_key] = arguments[_key]; 1796 } 1797 handler.apply(self, args); 1798 } 1799 onceHandler.__emitterProxy = handler; 1800 return self.on(events, onceHandler, priority); 1801 }, 1802 onAny(handler, priority) { 1803 const self = this; 1804 if (!self.eventsListeners || self.destroyed) return self; 1805 if (typeof handler !== 'function') return self; 1806 const method = priority ? 'unshift' : 'push'; 1807 if (self.eventsAnyListeners.indexOf(handler) < 0) { 1808 self.eventsAnyListeners[method](handler); 1809 } 1810 return self; 1811 }, 1812 offAny(handler) { 1813 const self = this; 1814 if (!self.eventsListeners || self.destroyed) return self; 1815 if (!self.eventsAnyListeners) return self; 1816 const index = self.eventsAnyListeners.indexOf(handler); 1817 if (index >= 0) { 1818 self.eventsAnyListeners.splice(index, 1); 1819 } 1820 return self; 1821 }, 1822 off(events, handler) { 1823 const self = this; 1824 if (!self.eventsListeners || self.destroyed) return self; 1825 if (!self.eventsListeners) return self; 1826 events.split(' ').forEach(event => { 1827 if (typeof handler === 'undefined') { 1828 self.eventsListeners[event] = []; 1829 } else if (self.eventsListeners[event]) { 1830 self.eventsListeners[event].forEach((eventHandler, index) => { 1831 if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) { 1832 self.eventsListeners[event].splice(index, 1); 1833 } 1834 }); 1835 } 1836 }); 1837 return self; 1838 }, 1839 emit() { 1840 const self = this; 1841 if (!self.eventsListeners || self.destroyed) return self; 1842 if (!self.eventsListeners) return self; 1843 let events; 1844 let data; 1845 let context; 1846 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 1847 args[_key2] = arguments[_key2]; 1848 } 1849 if (typeof args[0] === 'string' || Array.isArray(args[0])) { 1850 events = args[0]; 1851 data = args.slice(1, args.length); 1852 context = self; 1853 } else { 1854 events = args[0].events; 1855 data = args[0].data; 1856 context = args[0].context || self; 1857 } 1858 data.unshift(context); 1859 const eventsArray = Array.isArray(events) ? events : events.split(' '); 1860 eventsArray.forEach(event => { 1861 if (self.eventsAnyListeners && self.eventsAnyListeners.length) { 1862 self.eventsAnyListeners.forEach(eventHandler => { 1863 eventHandler.apply(context, [event, ...data]); 1864 }); 1865 } 1866 if (self.eventsListeners && self.eventsListeners[event]) { 1867 self.eventsListeners[event].forEach(eventHandler => { 1868 eventHandler.apply(context, data); 1869 }); 1870 } 1871 }); 1872 return self; 1873 } 1874 }; 1875 1876 function updateSize() { 1877 const swiper = this; 1878 let width; 1879 let height; 1880 const el = swiper.el; 1881 if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) { 1882 width = swiper.params.width; 1883 } else { 1884 width = el.clientWidth; 1885 } 1886 if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) { 1887 height = swiper.params.height; 1888 } else { 1889 height = el.clientHeight; 1890 } 1891 if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) { 1892 return; 1893 } 1894 1895 // Subtract paddings 1896 width = width - parseInt(elementStyle(el, 'padding-left') || 0, 10) - parseInt(elementStyle(el, 'padding-right') || 0, 10); 1897 height = height - parseInt(elementStyle(el, 'padding-top') || 0, 10) - parseInt(elementStyle(el, 'padding-bottom') || 0, 10); 1898 if (Number.isNaN(width)) width = 0; 1899 if (Number.isNaN(height)) height = 0;
vendor: 8,689 bytes, lines 1900-2109
1900 Object.assign(swiper, { 1901 width, 1902 height, 1903 size: swiper.isHorizontal() ? width : height 1904 }); 1905 } 1906 1907 function updateSlides() { 1908 const swiper = this; 1909 function getDirectionPropertyValue(node, label) { 1910 return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0); 1911 } 1912 const params = swiper.params; 1913 const { 1914 wrapperEl, 1915 slidesEl, 1916 size: swiperSize, 1917 rtlTranslate: rtl, 1918 wrongRTL 1919 } = swiper; 1920 const isVirtual = swiper.virtual && params.virtual.enabled; 1921 const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; 1922 const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`); 1923 const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; 1924 let snapGrid = []; 1925 const slidesGrid = []; 1926 const slidesSizesGrid = []; 1927 let offsetBefore = params.slidesOffsetBefore; 1928 if (typeof offsetBefore === 'function') { 1929 offsetBefore = params.slidesOffsetBefore.call(swiper); 1930 } 1931 let offsetAfter = params.slidesOffsetAfter; 1932 if (typeof offsetAfter === 'function') { 1933 offsetAfter = params.slidesOffsetAfter.call(swiper); 1934 } 1935 const previousSnapGridLength = swiper.snapGrid.length; 1936 const previousSlidesGridLength = swiper.slidesGrid.length; 1937 let spaceBetween = params.spaceBetween; 1938 let slidePosition = -offsetBefore; 1939 let prevSlideSize = 0; 1940 let index = 0; 1941 if (typeof swiperSize === 'undefined') { 1942 return; 1943 } 1944 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 1945 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize; 1946 } else if (typeof spaceBetween === 'string') { 1947 spaceBetween = parseFloat(spaceBetween); 1948 } 1949 swiper.virtualSize = -spaceBetween; 1950 1951 // reset margins 1952 slides.forEach(slideEl => { 1953 if (rtl) { 1954 slideEl.style.marginLeft = ''; 1955 } else { 1956 slideEl.style.marginRight = ''; 1957 } 1958 slideEl.style.marginBottom = ''; 1959 slideEl.style.marginTop = ''; 1960 }); 1961 1962 // reset cssMode offsets 1963 if (params.centeredSlides && params.cssMode) { 1964 setCSSProperty(wrapperEl, '--swiper-centered-offset-before', ''); 1965 setCSSProperty(wrapperEl, '--swiper-centered-offset-after', ''); 1966 } 1967 const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; 1968 if (gridEnabled) { 1969 swiper.grid.initSlides(slides); 1970 } else if (swiper.grid) { 1971 swiper.grid.unsetSlides(); 1972 } 1973 1974 // Calc slides 1975 let slideSize; 1976 const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => { 1977 return typeof params.breakpoints[key].slidesPerView !== 'undefined'; 1978 }).length > 0; 1979 for (let i = 0; i < slidesLength; i += 1) { 1980 slideSize = 0; 1981 let slide; 1982 if (slides[i]) slide = slides[i]; 1983 if (gridEnabled) { 1984 swiper.grid.updateSlide(i, slide, slides); 1985 } 1986 if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line 1987 1988 if (params.slidesPerView === 'auto') { 1989 if (shouldResetSlideSize) { 1990 slides[i].style[swiper.getDirectionLabel('width')] = ``; 1991 } 1992 const slideStyles = getComputedStyle(slide); 1993 const currentTransform = slide.style.transform; 1994 const currentWebKitTransform = slide.style.webkitTransform; 1995 if (currentTransform) { 1996 slide.style.transform = 'none'; 1997 } 1998 if (currentWebKitTransform) { 1999 slide.style.webkitTransform = 'none'; 2000 } 2001 if (params.roundLengths) { 2002 slideSize = swiper.isHorizontal() ? elementOuterSize(slide, 'width', true) : elementOuterSize(slide, 'height', true); 2003 } else { 2004 // eslint-disable-next-line 2005 const width = getDirectionPropertyValue(slideStyles, 'width'); 2006 const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left'); 2007 const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right'); 2008 const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left'); 2009 const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right'); 2010 const boxSizing = slideStyles.getPropertyValue('box-sizing'); 2011 if (boxSizing && boxSizing === 'border-box') { 2012 slideSize = width + marginLeft + marginRight; 2013 } else { 2014 const { 2015 clientWidth, 2016 offsetWidth 2017 } = slide; 2018 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); 2019 } 2020 } 2021 if (currentTransform) { 2022 slide.style.transform = currentTransform; 2023 } 2024 if (currentWebKitTransform) { 2025 slide.style.webkitTransform = currentWebKitTransform; 2026 } 2027 if (params.roundLengths) slideSize = Math.floor(slideSize); 2028 } else { 2029 slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; 2030 if (params.roundLengths) slideSize = Math.floor(slideSize); 2031 if (slides[i]) { 2032 slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`; 2033 } 2034 } 2035 if (slides[i]) { 2036 slides[i].swiperSlideSize = slideSize; 2037 } 2038 slidesSizesGrid.push(slideSize); 2039 if (params.centeredSlides) { 2040 slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; 2041 if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 2042 if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 2043 if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0; 2044 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 2045 if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); 2046 slidesGrid.push(slidePosition); 2047 } else { 2048 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 2049 if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); 2050 slidesGrid.push(slidePosition); 2051 slidePosition = slidePosition + slideSize + spaceBetween; 2052 } 2053 swiper.virtualSize += slideSize + spaceBetween; 2054 prevSlideSize = slideSize; 2055 index += 1; 2056 } 2057 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; 2058 if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) { 2059 wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`; 2060 } 2061 if (params.setWrapperSize) { 2062 wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`; 2063 } 2064 if (gridEnabled) { 2065 swiper.grid.updateWrapperSize(slideSize, snapGrid); 2066 } 2067 2068 // Remove last grid elements depending on width 2069 if (!params.centeredSlides) { 2070 const newSlidesGrid = []; 2071 for (let i = 0; i < snapGrid.length; i += 1) { 2072 let slidesGridItem = snapGrid[i]; 2073 if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem); 2074 if (snapGrid[i] <= swiper.virtualSize - swiperSize) { 2075 newSlidesGrid.push(slidesGridItem); 2076 } 2077 } 2078 snapGrid = newSlidesGrid; 2079 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { 2080 snapGrid.push(swiper.virtualSize - swiperSize); 2081 } 2082 } 2083 if (isVirtual && params.loop) { 2084 const size = slidesSizesGrid[0] + spaceBetween; 2085 if (params.slidesPerGroup > 1) { 2086 const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup); 2087 const groupSize = size * params.slidesPerGroup; 2088 for (let i = 0; i < groups; i += 1) { 2089 snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize); 2090 } 2091 } 2092 for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) { 2093 if (params.slidesPerGroup === 1) { 2094 snapGrid.push(snapGrid[snapGrid.length - 1] + size); 2095 } 2096 slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size); 2097 swiper.virtualSize += size; 2098 } 2099 } 2100 if (snapGrid.length === 0) snapGrid = [0]; 2101 if (spaceBetween !== 0) { 2102 const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight'); 2103 slides.filter((_, slideIndex) => { 2104 if (!params.cssMode || params.loop) return true; 2105 if (slideIndex === slides.length - 1) { 2106 return false; 2107 } 2108 return true; 2109 }
vendor: 19,125 bytes, lines 2109-2596
2109).forEach(slideEl => { 2110 slideEl.style[key] = `${spaceBetween}px`; 2111 }); 2112 } 2113 if (params.centeredSlides && params.centeredSlidesBounds) { 2114 let allSlidesSize = 0; 2115 slidesSizesGrid.forEach(slideSizeValue => { 2116 allSlidesSize += slideSizeValue + (spaceBetween || 0); 2117 }); 2118 allSlidesSize -= spaceBetween; 2119 const maxSnap = allSlidesSize - swiperSize; 2120 snapGrid = snapGrid.map(snap => { 2121 if (snap <= 0) return -offsetBefore; 2122 if (snap > maxSnap) return maxSnap + offsetAfter; 2123 return snap; 2124 }); 2125 } 2126 if (params.centerInsufficientSlides) { 2127 let allSlidesSize = 0; 2128 slidesSizesGrid.forEach(slideSizeValue => { 2129 allSlidesSize += slideSizeValue + (spaceBetween || 0); 2130 }); 2131 allSlidesSize -= spaceBetween; 2132 const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0); 2133 if (allSlidesSize + offsetSize < swiperSize) { 2134 const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2; 2135 snapGrid.forEach((snap, snapIndex) => { 2136 snapGrid[snapIndex] = snap - allSlidesOffset; 2137 }); 2138 slidesGrid.forEach((snap, snapIndex) => { 2139 slidesGrid[snapIndex] = snap + allSlidesOffset; 2140 }); 2141 } 2142 } 2143 Object.assign(swiper, { 2144 slides, 2145 snapGrid, 2146 slidesGrid, 2147 slidesSizesGrid 2148 }); 2149 if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { 2150 setCSSProperty(wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`); 2151 setCSSProperty(wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`); 2152 const addToSnapGrid = -swiper.snapGrid[0]; 2153 const addToSlidesGrid = -swiper.slidesGrid[0]; 2154 swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid); 2155 swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid); 2156 } 2157 if (slidesLength !== previousSlidesLength) { 2158 swiper.emit('slidesLengthChange'); 2159 } 2160 if (snapGrid.length !== previousSnapGridLength) { 2161 if (swiper.params.watchOverflow) swiper.checkOverflow(); 2162 swiper.emit('snapGridLengthChange'); 2163 } 2164 if (slidesGrid.length !== previousSlidesGridLength) { 2165 swiper.emit('slidesGridLengthChange'); 2166 } 2167 if (params.watchSlidesProgress) { 2168 swiper.updateSlidesOffset(); 2169 } 2170 swiper.emit('slidesUpdated'); 2171 if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) { 2172 const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`; 2173 const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass); 2174 if (slidesLength <= params.maxBackfaceHiddenSlides) { 2175 if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass); 2176 } else if (hasClassBackfaceClassAdded) { 2177 swiper.el.classList.remove(backFaceHiddenClass); 2178 } 2179 } 2180 } 2181 2182 function updateAutoHeight(speed) { 2183 const swiper = this; 2184 const activeSlides = []; 2185 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 2186 let newHeight = 0; 2187 let i; 2188 if (typeof speed === 'number') { 2189 swiper.setTransition(speed); 2190 } else if (speed === true) { 2191 swiper.setTransition(swiper.params.speed); 2192 } 2193 const getSlideByIndex = index => { 2194 if (isVirtual) { 2195 return swiper.slides[swiper.getSlideIndexByData(index)]; 2196 } 2197 return swiper.slides[index]; 2198 }; 2199 // Find slides currently in view 2200 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { 2201 if (swiper.params.centeredSlides) { 2202 (swiper.visibleSlides || []).forEach(slide => { 2203 activeSlides.push(slide); 2204 }); 2205 } else { 2206 for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) { 2207 const index = swiper.activeIndex + i; 2208 if (index > swiper.slides.length && !isVirtual) break; 2209 activeSlides.push(getSlideByIndex(index)); 2210 } 2211 } 2212 } else { 2213 activeSlides.push(getSlideByIndex(swiper.activeIndex)); 2214 } 2215 2216 // Find new height from highest slide in view 2217 for (i = 0; i < activeSlides.length; i += 1) { 2218 if (typeof activeSlides[i] !== 'undefined') { 2219 const height = activeSlides[i].offsetHeight; 2220 newHeight = height > newHeight ? height : newHeight; 2221 } 2222 } 2223 2224 // Update Height 2225 if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`; 2226 } 2227 2228 function updateSlidesOffset() { 2229 const swiper = this; 2230 const slides = swiper.slides; 2231 // eslint-disable-next-line 2232 const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0; 2233 for (let i = 0; i < slides.length; i += 1) { 2234 slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment(); 2235 } 2236 } 2237 2238 const toggleSlideClasses$1 = (slideEl, condition, className) => { 2239 if (condition && !slideEl.classList.contains(className)) { 2240 slideEl.classList.add(className); 2241 } else if (!condition && slideEl.classList.contains(className)) { 2242 slideEl.classList.remove(className); 2243 } 2244 }; 2245 function updateSlidesProgress(translate) { 2246 if (translate === void 0) { 2247 translate = this && this.translate || 0; 2248 } 2249 const swiper = this; 2250 const params = swiper.params; 2251 const { 2252 slides, 2253 rtlTranslate: rtl, 2254 snapGrid 2255 } = swiper; 2256 if (slides.length === 0) return; 2257 if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset(); 2258 let offsetCenter = -translate; 2259 if (rtl) offsetCenter = translate; 2260 swiper.visibleSlidesIndexes = []; 2261 swiper.visibleSlides = []; 2262 let spaceBetween = params.spaceBetween; 2263 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 2264 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size; 2265 } else if (typeof spaceBetween === 'string') { 2266 spaceBetween = parseFloat(spaceBetween); 2267 } 2268 for (let i = 0; i < slides.length; i += 1) { 2269 const slide = slides[i]; 2270 let slideOffset = slide.swiperSlideOffset; 2271 if (params.cssMode && params.centeredSlides) { 2272 slideOffset -= slides[0].swiperSlideOffset; 2273 } 2274 const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween); 2275 const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween); 2276 const slideBefore = -(offsetCenter - slideOffset); 2277 const slideAfter = slideBefore + swiper.slidesSizesGrid[i]; 2278 const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i]; 2279 const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; 2280 if (isVisible) { 2281 swiper.visibleSlides.push(slide); 2282 swiper.visibleSlidesIndexes.push(i); 2283 } 2284 toggleSlideClasses$1(slide, isVisible, params.slideVisibleClass); 2285 toggleSlideClasses$1(slide, isFullyVisible, params.slideFullyVisibleClass); 2286 slide.progress = rtl ? -slideProgress : slideProgress; 2287 slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress; 2288 } 2289 } 2290 2291 function updateProgress(translate) { 2292 const swiper = this; 2293 if (typeof translate === 'undefined') { 2294 const multiplier = swiper.rtlTranslate ? -1 : 1; 2295 // eslint-disable-next-line 2296 translate = swiper && swiper.translate && swiper.translate * multiplier || 0; 2297 } 2298 const params = swiper.params; 2299 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 2300 let { 2301 progress, 2302 isBeginning, 2303 isEnd, 2304 progressLoop 2305 } = swiper; 2306 const wasBeginning = isBeginning; 2307 const wasEnd = isEnd; 2308 if (translatesDiff === 0) { 2309 progress = 0; 2310 isBeginning = true; 2311 isEnd = true; 2312 } else { 2313 progress = (translate - swiper.minTranslate()) / translatesDiff; 2314 const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1; 2315 const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1; 2316 isBeginning = isBeginningRounded || progress <= 0; 2317 isEnd = isEndRounded || progress >= 1; 2318 if (isBeginningRounded) progress = 0; 2319 if (isEndRounded) progress = 1; 2320 } 2321 if (params.loop) { 2322 const firstSlideIndex = swiper.getSlideIndexByData(0); 2323 const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1); 2324 const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex]; 2325 const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex]; 2326 const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1]; 2327 const translateAbs = Math.abs(translate); 2328 if (translateAbs >= firstSlideTranslate) { 2329 progressLoop = (translateAbs - firstSlideTranslate) / translateMax; 2330 } else { 2331 progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax; 2332 } 2333 if (progressLoop > 1) progressLoop -= 1; 2334 } 2335 Object.assign(swiper, { 2336 progress, 2337 progressLoop, 2338 isBeginning, 2339 isEnd 2340 }); 2341 if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate); 2342 if (isBeginning && !wasBeginning) { 2343 swiper.emit('reachBeginning toEdge'); 2344 } 2345 if (isEnd && !wasEnd) { 2346 swiper.emit('reachEnd toEdge'); 2347 } 2348 if (wasBeginning && !isBeginning || wasEnd && !isEnd) { 2349 swiper.emit('fromEdge'); 2350 } 2351 swiper.emit('progress', progress); 2352 } 2353 2354 const toggleSlideClasses = (slideEl, condition, className) => { 2355 if (condition && !slideEl.classList.contains(className)) { 2356 slideEl.classList.add(className); 2357 } else if (!condition && slideEl.classList.contains(className)) { 2358 slideEl.classList.remove(className); 2359 } 2360 }; 2361 function updateSlidesClasses() { 2362 const swiper = this; 2363 const { 2364 slides, 2365 params, 2366 slidesEl, 2367 activeIndex 2368 } = swiper; 2369 const isVirtual = swiper.virtual && params.virtual.enabled; 2370 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 2371 const getFilteredSlide = selector => { 2372 return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0]; 2373 }; 2374 let activeSlide; 2375 let prevSlide; 2376 let nextSlide; 2377 if (isVirtual) { 2378 if (params.loop) { 2379 let slideIndex = activeIndex - swiper.virtual.slidesBefore; 2380 if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex; 2381 if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length; 2382 activeSlide = getFilteredSlide(`[data-swiper-slide-index="${slideIndex}"]`); 2383 } else { 2384 activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`); 2385 } 2386 } else { 2387 if (gridEnabled) { 2388 activeSlide = slides.filter(slideEl => slideEl.column === activeIndex)[0]; 2389 nextSlide = slides.filter(slideEl => slideEl.column === activeIndex + 1)[0]; 2390 prevSlide = slides.filter(slideEl => slideEl.column === activeIndex - 1)[0]; 2391 } else { 2392 activeSlide = slides[activeIndex]; 2393 } 2394 } 2395 if (activeSlide) { 2396 if (!gridEnabled) { 2397 // Next Slide 2398 nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0]; 2399 if (params.loop && !nextSlide) { 2400 nextSlide = slides[0]; 2401 } 2402 2403 // Prev Slide 2404 prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0]; 2405 if (params.loop && !prevSlide === 0) { 2406 prevSlide = slides[slides.length - 1]; 2407 } 2408 } 2409 } 2410 slides.forEach(slideEl => { 2411 toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass); 2412 toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass); 2413 toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass); 2414 }); 2415 swiper.emitSlidesClasses(); 2416 } 2417 2418 const processLazyPreloader = (swiper, imageEl) => { 2419 if (!swiper || swiper.destroyed || !swiper.params) return; 2420 const slideSelector = () => swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`; 2421 const slideEl = imageEl.closest(slideSelector()); 2422 if (slideEl) { 2423 let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`); 2424 if (!lazyEl && swiper.isElement) { 2425 if (slideEl.shadowRoot) { 2426 lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`); 2427 } else { 2428 // init later 2429 requestAnimationFrame(() => { 2430 if (slideEl.shadowRoot) { 2431 lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`); 2432 if (lazyEl) lazyEl.remove(); 2433 } 2434 }); 2435 } 2436 } 2437 if (lazyEl) lazyEl.remove(); 2438 } 2439 }; 2440 const unlazy = (swiper, index) => { 2441 if (!swiper.slides[index]) return; 2442 const imageEl = swiper.slides[index].querySelector('[loading="lazy"]'); 2443 if (imageEl) imageEl.removeAttribute('loading'); 2444 }; 2445 const preload = swiper => { 2446 if (!swiper || swiper.destroyed || !swiper.params) return; 2447 let amount = swiper.params.lazyPreloadPrevNext; 2448 const len = swiper.slides.length; 2449 if (!len || !amount || amount < 0) return; 2450 amount = Math.min(amount, len); 2451 const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView); 2452 const activeIndex = swiper.activeIndex; 2453 if (swiper.params.grid && swiper.params.grid.rows > 1) { 2454 const activeColumn = activeIndex; 2455 const preloadColumns = [activeColumn - amount]; 2456 preloadColumns.push(...Array.from({ 2457 length: amount 2458 }).map((_, i) => { 2459 return activeColumn + slidesPerView + i; 2460 })); 2461 swiper.slides.forEach((slideEl, i) => { 2462 if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i); 2463 }); 2464 return; 2465 } 2466 const slideIndexLastInView = activeIndex + slidesPerView - 1; 2467 if (swiper.params.rewind || swiper.params.loop) { 2468 for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) { 2469 const realIndex = (i % len + len) % len; 2470 if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex); 2471 } 2472 } else { 2473 for (let i = Math.max(activeIndex - amount, 0); i <= Math.min(slideIndexLastInView + amount, len - 1); i += 1) { 2474 if (i !== activeIndex && (i > slideIndexLastInView || i < activeIndex)) { 2475 unlazy(swiper, i); 2476 } 2477 } 2478 } 2479 }; 2480 2481 function getActiveIndexByTranslate(swiper) { 2482 const { 2483 slidesGrid, 2484 params 2485 } = swiper; 2486 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 2487 let activeIndex; 2488 for (let i = 0; i < slidesGrid.length; i += 1) { 2489 if (typeof slidesGrid[i + 1] !== 'undefined') { 2490 if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) { 2491 activeIndex = i; 2492 } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) { 2493 activeIndex = i + 1; 2494 } 2495 } else if (translate >= slidesGrid[i]) { 2496 activeIndex = i; 2497 } 2498 } 2499 // Normalize slideIndex 2500 if (params.normalizeSlideIndex) { 2501 if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0; 2502 } 2503 return activeIndex; 2504 } 2505 function updateActiveIndex(newActiveIndex) { 2506 const swiper = this; 2507 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 2508 const { 2509 snapGrid, 2510 params, 2511 activeIndex: previousIndex, 2512 realIndex: previousRealIndex, 2513 snapIndex: previousSnapIndex 2514 } = swiper; 2515 let activeIndex = newActiveIndex; 2516 let snapIndex; 2517 const getVirtualRealIndex = aIndex => { 2518 let realIndex = aIndex - swiper.virtual.slidesBefore; 2519 if (realIndex < 0) { 2520 realIndex = swiper.virtual.slides.length + realIndex; 2521 } 2522 if (realIndex >= swiper.virtual.slides.length) { 2523 realIndex -= swiper.virtual.slides.length; 2524 } 2525 return realIndex; 2526 }; 2527 if (typeof activeIndex === 'undefined') { 2528 activeIndex = getActiveIndexByTranslate(swiper); 2529 } 2530 if (snapGrid.indexOf(translate) >= 0) { 2531 snapIndex = snapGrid.indexOf(translate); 2532 } else { 2533 const skip = Math.min(params.slidesPerGroupSkip, activeIndex); 2534 snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); 2535 } 2536 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 2537 if (activeIndex === previousIndex && !swiper.params.loop) { 2538 if (snapIndex !== previousSnapIndex) { 2539 swiper.snapIndex = snapIndex; 2540 swiper.emit('snapIndexChange'); 2541 } 2542 return; 2543 } 2544 if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 2545 swiper.realIndex = getVirtualRealIndex(activeIndex); 2546 return; 2547 } 2548 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 2549 2550 // Get real index 2551 let realIndex; 2552 if (swiper.virtual && params.virtual.enabled && params.loop) { 2553 realIndex = getVirtualRealIndex(activeIndex); 2554 } else if (gridEnabled) { 2555 const firstSlideInColumn = swiper.slides.filter(slideEl => slideEl.column === activeIndex)[0]; 2556 let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10); 2557 if (Number.isNaN(activeSlideIndex)) { 2558 activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0); 2559 } 2560 realIndex = Math.floor(activeSlideIndex / params.grid.rows); 2561 } else if (swiper.slides[activeIndex]) { 2562 const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index'); 2563 if (slideIndex) { 2564 realIndex = parseInt(slideIndex, 10); 2565 } else { 2566 realIndex = activeIndex; 2567 } 2568 } else { 2569 realIndex = activeIndex; 2570 } 2571 Object.assign(swiper, { 2572 previousSnapIndex, 2573 snapIndex, 2574 previousRealIndex, 2575 realIndex, 2576 previousIndex, 2577 activeIndex 2578 }); 2579 if (swiper.initialized) { 2580 preload(swiper); 2581 } 2582 swiper.emit('activeIndexChange'); 2583 swiper.emit('snapIndexChange'); 2584 if (swiper.initialized || swiper.params.runCallbacksOnInit) { 2585 if (previousRealIndex !== realIndex) { 2586 swiper.emit('realIndexChange'); 2587 } 2588 swiper.emit('slideChange'); 2589 } 2590 } 2591 2592 function updateClickedSlide(el, path) { 2593 const swiper = this; 2594 const params = swiper.params; 2595 let slide = el.closest(`.${params.slideClass}, swiper-slide`); 2596 if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) {
vendor: 14,895 bytes, lines 2597-3077
2597 [...path.slice(path.indexOf(el) + 1, path.length)].forEach(pathEl => { 2598 if (!slide && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) { 2599 slide = pathEl; 2600 } 2601 }); 2602 } 2603 let slideFound = false; 2604 let slideIndex; 2605 if (slide) { 2606 for (let i = 0; i < swiper.slides.length; i += 1) { 2607 if (swiper.slides[i] === slide) { 2608 slideFound = true; 2609 slideIndex = i; 2610 break; 2611 } 2612 } 2613 } 2614 if (slide && slideFound) { 2615 swiper.clickedSlide = slide; 2616 if (swiper.virtual && swiper.params.virtual.enabled) { 2617 swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10); 2618 } else { 2619 swiper.clickedIndex = slideIndex; 2620 } 2621 } else { 2622 swiper.clickedSlide = undefined; 2623 swiper.clickedIndex = undefined; 2624 return; 2625 } 2626 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) { 2627 swiper.slideToClickedSlide(); 2628 } 2629 } 2630 2631 var update = { 2632 updateSize, 2633 updateSlides, 2634 updateAutoHeight, 2635 updateSlidesOffset, 2636 updateSlidesProgress, 2637 updateProgress, 2638 updateSlidesClasses, 2639 updateActiveIndex, 2640 updateClickedSlide 2641 }; 2642 2643 function getSwiperTranslate(axis) { 2644 if (axis === void 0) { 2645 axis = this.isHorizontal() ? 'x' : 'y'; 2646 } 2647 const swiper = this; 2648 const { 2649 params, 2650 rtlTranslate: rtl, 2651 translate, 2652 wrapperEl 2653 } = swiper; 2654 if (params.virtualTranslate) { 2655 return rtl ? -translate : translate; 2656 } 2657 if (params.cssMode) { 2658 return translate; 2659 } 2660 let currentTranslate = getTranslate(wrapperEl, axis); 2661 currentTranslate += swiper.cssOverflowAdjustment(); 2662 if (rtl) currentTranslate = -currentTranslate; 2663 return currentTranslate || 0; 2664 } 2665 2666 function setTranslate(translate, byController) { 2667 const swiper = this; 2668 const { 2669 rtlTranslate: rtl, 2670 params, 2671 wrapperEl, 2672 progress 2673 } = swiper; 2674 let x = 0; 2675 let y = 0; 2676 const z = 0; 2677 if (swiper.isHorizontal()) { 2678 x = rtl ? -translate : translate; 2679 } else { 2680 y = translate; 2681 } 2682 if (params.roundLengths) { 2683 x = Math.floor(x); 2684 y = Math.floor(y); 2685 } 2686 swiper.previousTranslate = swiper.translate; 2687 swiper.translate = swiper.isHorizontal() ? x : y; 2688 if (params.cssMode) { 2689 wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y; 2690 } else if (!params.virtualTranslate) { 2691 if (swiper.isHorizontal()) { 2692 x -= swiper.cssOverflowAdjustment(); 2693 } else { 2694 y -= swiper.cssOverflowAdjustment(); 2695 } 2696 wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`; 2697 } 2698 2699 // Check if we need to update progress 2700 let newProgress; 2701 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 2702 if (translatesDiff === 0) { 2703 newProgress = 0; 2704 } else { 2705 newProgress = (translate - swiper.minTranslate()) / translatesDiff; 2706 } 2707 if (newProgress !== progress) { 2708 swiper.updateProgress(translate); 2709 } 2710 swiper.emit('setTranslate', swiper.translate, byController); 2711 } 2712 2713 function minTranslate() { 2714 return -this.snapGrid[0]; 2715 } 2716 2717 function maxTranslate() { 2718 return -this.snapGrid[this.snapGrid.length - 1]; 2719 } 2720 2721 function translateTo(translate, speed, runCallbacks, translateBounds, internal) { 2722 if (translate === void 0) { 2723 translate = 0; 2724 } 2725 if (speed === void 0) { 2726 speed = this.params.speed; 2727 } 2728 if (runCallbacks === void 0) { 2729 runCallbacks = true; 2730 } 2731 if (translateBounds === void 0) { 2732 translateBounds = true; 2733 } 2734 const swiper = this; 2735 const { 2736 params, 2737 wrapperEl 2738 } = swiper; 2739 if (swiper.animating && params.preventInteractionOnTransition) { 2740 return false; 2741 } 2742 const minTranslate = swiper.minTranslate(); 2743 const maxTranslate = swiper.maxTranslate(); 2744 let newTranslate; 2745 if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; 2746 2747 // Update progress 2748 swiper.updateProgress(newTranslate); 2749 if (params.cssMode) { 2750 const isH = swiper.isHorizontal(); 2751 if (speed === 0) { 2752 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; 2753 } else { 2754 if (!swiper.support.smoothScroll) { 2755 animateCSSModeScroll({ 2756 swiper, 2757 targetPosition: -newTranslate, 2758 side: isH ? 'left' : 'top' 2759 }); 2760 return true; 2761 } 2762 wrapperEl.scrollTo({ 2763 [isH ? 'left' : 'top']: -newTranslate, 2764 behavior: 'smooth' 2765 }); 2766 } 2767 return true; 2768 } 2769 if (speed === 0) { 2770 swiper.setTransition(0); 2771 swiper.setTranslate(newTranslate); 2772 if (runCallbacks) { 2773 swiper.emit('beforeTransitionStart', speed, internal); 2774 swiper.emit('transitionEnd'); 2775 } 2776 } else { 2777 swiper.setTransition(speed); 2778 swiper.setTranslate(newTranslate); 2779 if (runCallbacks) { 2780 swiper.emit('beforeTransitionStart', speed, internal); 2781 swiper.emit('transitionStart'); 2782 } 2783 if (!swiper.animating) { 2784 swiper.animating = true; 2785 if (!swiper.onTranslateToWrapperTransitionEnd) { 2786 swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) { 2787 if (!swiper || swiper.destroyed) return; 2788 if (e.target !== this) return; 2789 swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 2790 swiper.onTranslateToWrapperTransitionEnd = null; 2791 delete swiper.onTranslateToWrapperTransitionEnd; 2792 swiper.animating = false; 2793 if (runCallbacks) { 2794 swiper.emit('transitionEnd'); 2795 } 2796 }; 2797 } 2798 swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 2799 } 2800 } 2801 return true; 2802 } 2803 2804 var translate = { 2805 getTranslate: getSwiperTranslate, 2806 setTranslate, 2807 minTranslate, 2808 maxTranslate, 2809 translateTo 2810 }; 2811 2812 function setTransition(duration, byController) { 2813 const swiper = this; 2814 if (!swiper.params.cssMode) { 2815 swiper.wrapperEl.style.transitionDuration = `${duration}ms`; 2816 swiper.wrapperEl.style.transitionDelay = duration === 0 ? `0ms` : ''; 2817 } 2818 swiper.emit('setTransition', duration, byController); 2819 } 2820 2821 function transitionEmit(_ref) { 2822 let { 2823 swiper, 2824 runCallbacks, 2825 direction, 2826 step 2827 } = _ref; 2828 const { 2829 activeIndex, 2830 previousIndex 2831 } = swiper; 2832 let dir = direction; 2833 if (!dir) { 2834 if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset'; 2835 } 2836 swiper.emit(`transition${step}`); 2837 if (runCallbacks && activeIndex !== previousIndex) { 2838 if (dir === 'reset') { 2839 swiper.emit(`slideResetTransition${step}`); 2840 return; 2841 } 2842 swiper.emit(`slideChangeTransition${step}`); 2843 if (dir === 'next') { 2844 swiper.emit(`slideNextTransition${step}`); 2845 } else { 2846 swiper.emit(`slidePrevTransition${step}`); 2847 } 2848 } 2849 } 2850 2851 function transitionStart(runCallbacks, direction) { 2852 if (runCallbacks === void 0) { 2853 runCallbacks = true; 2854 } 2855 const swiper = this; 2856 const { 2857 params 2858 } = swiper; 2859 if (params.cssMode) return; 2860 if (params.autoHeight) { 2861 swiper.updateAutoHeight(); 2862 } 2863 transitionEmit({ 2864 swiper, 2865 runCallbacks, 2866 direction, 2867 step: 'Start' 2868 }); 2869 } 2870 2871 function transitionEnd(runCallbacks, direction) { 2872 if (runCallbacks === void 0) { 2873 runCallbacks = true; 2874 } 2875 const swiper = this; 2876 const { 2877 params 2878 } = swiper; 2879 swiper.animating = false; 2880 if (params.cssMode) return; 2881 swiper.setTransition(0); 2882 transitionEmit({ 2883 swiper, 2884 runCallbacks, 2885 direction, 2886 step: 'End' 2887 }); 2888 } 2889 2890 var transition = { 2891 setTransition, 2892 transitionStart, 2893 transitionEnd 2894 }; 2895 2896 function slideTo(index, speed, runCallbacks, internal, initial) { 2897 if (index === void 0) { 2898 index = 0; 2899 } 2900 if (runCallbacks === void 0) { 2901 runCallbacks = true; 2902 } 2903 if (typeof index === 'string') { 2904 index = parseInt(index, 10); 2905 } 2906 const swiper = this; 2907 let slideIndex = index; 2908 if (slideIndex < 0) slideIndex = 0; 2909 const { 2910 params, 2911 snapGrid, 2912 slidesGrid, 2913 previousIndex, 2914 activeIndex, 2915 rtlTranslate: rtl, 2916 wrapperEl, 2917 enabled 2918 } = swiper; 2919 if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) { 2920 return false; 2921 } 2922 if (typeof speed === 'undefined') { 2923 speed = swiper.params.speed; 2924 } 2925 const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); 2926 let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); 2927 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 2928 const translate = -snapGrid[snapIndex]; 2929 // Normalize slideIndex 2930 if (params.normalizeSlideIndex) { 2931 for (let i = 0; i < slidesGrid.length; i += 1) { 2932 const normalizedTranslate = -Math.floor(translate * 100); 2933 const normalizedGrid = Math.floor(slidesGrid[i] * 100); 2934 const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100); 2935 if (typeof slidesGrid[i + 1] !== 'undefined') { 2936 if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) { 2937 slideIndex = i; 2938 } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) { 2939 slideIndex = i + 1; 2940 } 2941 } else if (normalizedTranslate >= normalizedGrid) { 2942 slideIndex = i; 2943 } 2944 } 2945 } 2946 // Directions locks 2947 if (swiper.initialized && slideIndex !== activeIndex) { 2948 if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) { 2949 return false; 2950 } 2951 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { 2952 if ((activeIndex || 0) !== slideIndex) { 2953 return false; 2954 } 2955 } 2956 } 2957 if (slideIndex !== (previousIndex || 0) && runCallbacks) { 2958 swiper.emit('beforeSlideChangeStart'); 2959 } 2960 2961 // Update progress 2962 swiper.updateProgress(translate); 2963 let direction; 2964 if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; 2965 2966 // Update Index 2967 if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) { 2968 swiper.updateActiveIndex(slideIndex); 2969 // Update Height 2970 if (params.autoHeight) { 2971 swiper.updateAutoHeight(); 2972 } 2973 swiper.updateSlidesClasses(); 2974 if (params.effect !== 'slide') { 2975 swiper.setTranslate(translate); 2976 } 2977 if (direction !== 'reset') { 2978 swiper.transitionStart(runCallbacks, direction); 2979 swiper.transitionEnd(runCallbacks, direction); 2980 } 2981 return false; 2982 } 2983 if (params.cssMode) { 2984 const isH = swiper.isHorizontal(); 2985 const t = rtl ? translate : -translate; 2986 if (speed === 0) { 2987 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 2988 if (isVirtual) { 2989 swiper.wrapperEl.style.scrollSnapType = 'none'; 2990 swiper._immediateVirtual = true; 2991 } 2992 if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) { 2993 swiper._cssModeVirtualInitialSet = true; 2994 requestAnimationFrame(() => { 2995 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 2996 }); 2997 } else { 2998 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 2999 } 3000 if (isVirtual) { 3001 requestAnimationFrame(() => { 3002 swiper.wrapperEl.style.scrollSnapType = ''; 3003 swiper._immediateVirtual = false; 3004 }); 3005 } 3006 } else { 3007 if (!swiper.support.smoothScroll) { 3008 animateCSSModeScroll({ 3009 swiper, 3010 targetPosition: t, 3011 side: isH ? 'left' : 'top' 3012 }); 3013 return true; 3014 } 3015 wrapperEl.scrollTo({ 3016 [isH ? 'left' : 'top']: t, 3017 behavior: 'smooth' 3018 }); 3019 } 3020 return true; 3021 } 3022 swiper.setTransition(speed); 3023 swiper.setTranslate(translate); 3024 swiper.updateActiveIndex(slideIndex); 3025 swiper.updateSlidesClasses(); 3026 swiper.emit('beforeTransitionStart', speed, internal); 3027 swiper.transitionStart(runCallbacks, direction); 3028 if (speed === 0) { 3029 swiper.transitionEnd(runCallbacks, direction); 3030 } else if (!swiper.animating) { 3031 swiper.animating = true; 3032 if (!swiper.onSlideToWrapperTransitionEnd) { 3033 swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) { 3034 if (!swiper || swiper.destroyed) return; 3035 if (e.target !== this) return; 3036 swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 3037 swiper.onSlideToWrapperTransitionEnd = null; 3038 delete swiper.onSlideToWrapperTransitionEnd; 3039 swiper.transitionEnd(runCallbacks, direction); 3040 }; 3041 } 3042 swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 3043 } 3044 return true; 3045 } 3046 3047 function slideToLoop(index, speed, runCallbacks, internal) { 3048 if (index === void 0) { 3049 index = 0; 3050 } 3051 if (runCallbacks === void 0) { 3052 runCallbacks = true; 3053 } 3054 if (typeof index === 'string') { 3055 const indexAsNumber = parseInt(index, 10); 3056 index = indexAsNumber; 3057 } 3058 const swiper = this; 3059 if (swiper.destroyed) return; 3060 if (typeof speed === 'undefined') { 3061 speed = swiper.params.speed; 3062 } 3063 const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; 3064 let newIndex = index; 3065 if (swiper.params.loop) { 3066 if (swiper.virtual && swiper.params.virtual.enabled) { 3067 // eslint-disable-next-line 3068 newIndex = newIndex + swiper.virtual.slidesBefore; 3069 } else { 3070 let targetSlideIndex; 3071 if (gridEnabled) { 3072 const slideIndex = newIndex * swiper.params.grid.rows; 3073 targetSlideIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column; 3074 } else { 3075 targetSlideIndex = swiper.getSlideIndexByData(newIndex); 3076 } 3077 const cols = gridEnabled ? Math.ceil(swiper.slides.length /
vendor: 4,036 bytes, lines 3077-3187
3077swiper.params.grid.rows) : swiper.slides.length; 3078 const { 3079 centeredSlides 3080 } = swiper.params; 3081 let slidesPerView = swiper.params.slidesPerView; 3082 if (slidesPerView === 'auto') { 3083 slidesPerView = swiper.slidesPerViewDynamic(); 3084 } else { 3085 slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10)); 3086 if (centeredSlides && slidesPerView % 2 === 0) { 3087 slidesPerView = slidesPerView + 1; 3088 } 3089 } 3090 let needLoopFix = cols - targetSlideIndex < slidesPerView; 3091 if (centeredSlides) { 3092 needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2); 3093 } 3094 if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) { 3095 needLoopFix = false; 3096 } 3097 if (needLoopFix) { 3098 const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev'; 3099 swiper.loopFix({ 3100 direction, 3101 slideTo: true, 3102 activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1, 3103 slideRealIndex: direction === 'next' ? swiper.realIndex : undefined 3104 }); 3105 } 3106 if (gridEnabled) { 3107 const slideIndex = newIndex * swiper.params.grid.rows; 3108 newIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column; 3109 } else { 3110 newIndex = swiper.getSlideIndexByData(newIndex); 3111 } 3112 } 3113 } 3114 requestAnimationFrame(() => { 3115 swiper.slideTo(newIndex, speed, runCallbacks, internal); 3116 }); 3117 return swiper; 3118 } 3119 3120 /* eslint no-unused-vars: "off" */ 3121 function slideNext(speed, runCallbacks, internal) { 3122 if (runCallbacks === void 0) { 3123 runCallbacks = true; 3124 } 3125 const swiper = this; 3126 const { 3127 enabled, 3128 params, 3129 animating 3130 } = swiper; 3131 if (!enabled || swiper.destroyed) return swiper; 3132 if (typeof speed === 'undefined') { 3133 speed = swiper.params.speed; 3134 } 3135 let perGroup = params.slidesPerGroup; 3136 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 3137 perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1); 3138 } 3139 const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; 3140 const isVirtual = swiper.virtual && params.virtual.enabled; 3141 if (params.loop) { 3142 if (animating && !isVirtual && params.loopPreventsSliding) return false; 3143 swiper.loopFix({ 3144 direction: 'next' 3145 }); 3146 // eslint-disable-next-line 3147 swiper._clientLeft = swiper.wrapperEl.clientLeft; 3148 if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) { 3149 requestAnimationFrame(() => { 3150 swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 3151 }); 3152 return true; 3153 } 3154 } 3155 if (params.rewind && swiper.isEnd) { 3156 return swiper.slideTo(0, speed, runCallbacks, internal); 3157 } 3158 return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 3159 } 3160 3161 /* eslint no-unused-vars: "off" */ 3162 function slidePrev(speed, runCallbacks, internal) { 3163 if (runCallbacks === void 0) { 3164 runCallbacks = true; 3165 } 3166 const swiper = this; 3167 const { 3168 params, 3169 snapGrid, 3170 slidesGrid, 3171 rtlTranslate, 3172 enabled, 3173 animating 3174 } = swiper; 3175 if (!enabled || swiper.destroyed) return swiper; 3176 if (typeof speed === 'undefined') { 3177 speed = swiper.params.speed; 3178 } 3179 const isVirtual = swiper.virtual && params.virtual.enabled; 3180 if (params.loop) { 3181 if (animating && !isVirtual && params.loopPreventsSliding) return false; 3182 swiper.loopFix({ 3183 direction: 'prev' 3184 }); 3185 // eslint-disable-next-line 3186 swiper._clientLeft = swiper.wrapperEl.clientLeft; 3187 }
vendor: 11,243 bytes, lines 3188-3461
3188 const translate = rtlTranslate ? swiper.translate : -swiper.translate; 3189 function normalize(val) { 3190 if (val < 0) return -Math.floor(Math.abs(val)); 3191 return Math.floor(val); 3192 } 3193 const normalizedTranslate = normalize(translate); 3194 const normalizedSnapGrid = snapGrid.map(val => normalize(val)); 3195 let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; 3196 if (typeof prevSnap === 'undefined' && params.cssMode) { 3197 let prevSnapIndex; 3198 snapGrid.forEach((snap, snapIndex) => { 3199 if (normalizedTranslate >= snap) { 3200 // prevSnap = snap; 3201 prevSnapIndex = snapIndex; 3202 } 3203 }); 3204 if (typeof prevSnapIndex !== 'undefined') { 3205 prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; 3206 } 3207 } 3208 let prevIndex = 0; 3209 if (typeof prevSnap !== 'undefined') { 3210 prevIndex = slidesGrid.indexOf(prevSnap); 3211 if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; 3212 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 3213 prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1; 3214 prevIndex = Math.max(prevIndex, 0); 3215 } 3216 } 3217 if (params.rewind && swiper.isBeginning) { 3218 const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 3219 return swiper.slideTo(lastIndex, speed, runCallbacks, internal); 3220 } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) { 3221 requestAnimationFrame(() => { 3222 swiper.slideTo(prevIndex, speed, runCallbacks, internal); 3223 }); 3224 return true; 3225 } 3226 return swiper.slideTo(prevIndex, speed, runCallbacks, internal); 3227 } 3228 3229 /* eslint no-unused-vars: "off" */ 3230 function slideReset(speed, runCallbacks, internal) { 3231 if (runCallbacks === void 0) { 3232 runCallbacks = true; 3233 } 3234 const swiper = this; 3235 if (swiper.destroyed) return; 3236 if (typeof speed === 'undefined') { 3237 speed = swiper.params.speed; 3238 } 3239 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); 3240 } 3241 3242 /* eslint no-unused-vars: "off" */ 3243 function slideToClosest(speed, runCallbacks, internal, threshold) { 3244 if (runCallbacks === void 0) { 3245 runCallbacks = true; 3246 } 3247 if (threshold === void 0) { 3248 threshold = 0.5; 3249 } 3250 const swiper = this; 3251 if (swiper.destroyed) return; 3252 if (typeof speed === 'undefined') { 3253 speed = swiper.params.speed; 3254 } 3255 let index = swiper.activeIndex; 3256 const skip = Math.min(swiper.params.slidesPerGroupSkip, index); 3257 const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup); 3258 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 3259 if (translate >= swiper.snapGrid[snapIndex]) { 3260 // The current translate is on or after the current snap index, so the choice 3261 // is between the current index and the one after it. 3262 const currentSnap = swiper.snapGrid[snapIndex]; 3263 const nextSnap = swiper.snapGrid[snapIndex + 1]; 3264 if (translate - currentSnap > (nextSnap - currentSnap) * threshold) { 3265 index += swiper.params.slidesPerGroup; 3266 } 3267 } else { 3268 // The current translate is before the current snap index, so the choice 3269 // is between the current index and the one before it. 3270 const prevSnap = swiper.snapGrid[snapIndex - 1]; 3271 const currentSnap = swiper.snapGrid[snapIndex]; 3272 if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) { 3273 index -= swiper.params.slidesPerGroup; 3274 } 3275 } 3276 index = Math.max(index, 0); 3277 index = Math.min(index, swiper.slidesGrid.length - 1); 3278 return swiper.slideTo(index, speed, runCallbacks, internal); 3279 } 3280 3281 function slideToClickedSlide() { 3282 const swiper = this; 3283 if (swiper.destroyed) return; 3284 const { 3285 params, 3286 slidesEl 3287 } = swiper; 3288 const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; 3289 let slideToIndex = swiper.clickedIndex; 3290 let realIndex; 3291 const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`; 3292 if (params.loop) { 3293 if (swiper.animating) return; 3294 realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10); 3295 if (params.centeredSlides) { 3296 if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) { 3297 swiper.loopFix(); 3298 slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]); 3299 nextTick(() => { 3300 swiper.slideTo(slideToIndex); 3301 }); 3302 } else { 3303 swiper.slideTo(slideToIndex); 3304 } 3305 } else if (slideToIndex > swiper.slides.length - slidesPerView) { 3306 swiper.loopFix(); 3307 slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]); 3308 nextTick(() => { 3309 swiper.slideTo(slideToIndex); 3310 }); 3311 } else { 3312 swiper.slideTo(slideToIndex); 3313 } 3314 } else { 3315 swiper.slideTo(slideToIndex); 3316 } 3317 } 3318 3319 var slide = { 3320 slideTo, 3321 slideToLoop, 3322 slideNext, 3323 slidePrev, 3324 slideReset, 3325 slideToClosest, 3326 slideToClickedSlide 3327 }; 3328 3329 function loopCreate(slideRealIndex) { 3330 const swiper = this; 3331 const { 3332 params, 3333 slidesEl 3334 } = swiper; 3335 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return; 3336 const initSlides = () => { 3337 const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); 3338 slides.forEach((el, index) => { 3339 el.setAttribute('data-swiper-slide-index', index); 3340 }); 3341 }; 3342 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 3343 const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1); 3344 const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0; 3345 const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0; 3346 const addBlankSlides = amountOfSlides => { 3347 for (let i = 0; i < amountOfSlides; i += 1) { 3348 const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]); 3349 swiper.slidesEl.append(slideEl); 3350 } 3351 }; 3352 if (shouldFillGroup) { 3353 if (params.loopAddBlankSlides) { 3354 const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup; 3355 addBlankSlides(slidesToAdd); 3356 swiper.recalcSlides(); 3357 swiper.updateSlides(); 3358 } else { 3359 showWarning('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)'); 3360 } 3361 initSlides(); 3362 } else if (shouldFillGrid) { 3363 if (params.loopAddBlankSlides) { 3364 const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows; 3365 addBlankSlides(slidesToAdd); 3366 swiper.recalcSlides(); 3367 swiper.updateSlides(); 3368 } else { 3369 showWarning('Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)'); 3370 } 3371 initSlides(); 3372 } else { 3373 initSlides(); 3374 } 3375 swiper.loopFix({ 3376 slideRealIndex, 3377 direction: params.centeredSlides ? undefined : 'next' 3378 }); 3379 } 3380 3381 function loopFix(_temp) { 3382 let { 3383 slideRealIndex, 3384 slideTo = true, 3385 direction, 3386 setTranslate, 3387 activeSlideIndex, 3388 byController, 3389 byMousewheel 3390 } = _temp === void 0 ? {} : _temp; 3391 const swiper = this; 3392 if (!swiper.params.loop) return; 3393 swiper.emit('beforeLoopFix'); 3394 const { 3395 slides, 3396 allowSlidePrev, 3397 allowSlideNext, 3398 slidesEl, 3399 params 3400 } = swiper; 3401 const { 3402 centeredSlides 3403 } = params; 3404 swiper.allowSlidePrev = true; 3405 swiper.allowSlideNext = true; 3406 if (swiper.virtual && params.virtual.enabled) { 3407 if (slideTo) { 3408 if (!params.centeredSlides && swiper.snapIndex === 0) { 3409 swiper.slideTo(swiper.virtual.slides.length, 0, false, true); 3410 } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) { 3411 swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true); 3412 } else if (swiper.snapIndex === swiper.snapGrid.length - 1) { 3413 swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true); 3414 } 3415 } 3416 swiper.allowSlidePrev = allowSlidePrev; 3417 swiper.allowSlideNext = allowSlideNext; 3418 swiper.emit('loopFix'); 3419 return; 3420 } 3421 let slidesPerView = params.slidesPerView; 3422 if (slidesPerView === 'auto') { 3423 slidesPerView = swiper.slidesPerViewDynamic(); 3424 } else { 3425 slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10)); 3426 if (centeredSlides && slidesPerView % 2 === 0) { 3427 slidesPerView = slidesPerView + 1; 3428 } 3429 } 3430 const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup; 3431 let loopedSlides = slidesPerGroup; 3432 if (loopedSlides % slidesPerGroup !== 0) { 3433 loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup; 3434 } 3435 loopedSlides += params.loopAdditionalSlides; 3436 swiper.loopedSlides = loopedSlides; 3437 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 3438 if (slides.length < slidesPerView + loopedSlides) { 3439 showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters'); 3440 } else if (gridEnabled && params.grid.fill === 'row') { 3441 showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`'); 3442 } 3443 const prependSlidesIndexes = []; 3444 const appendSlidesIndexes = []; 3445 let activeIndex = swiper.activeIndex; 3446 if (typeof activeSlideIndex === 'undefined') { 3447 activeSlideIndex = swiper.getSlideIndex(slides.filter(el => el.classList.contains(params.slideActiveClass))[0]); 3448 } else { 3449 activeIndex = activeSlideIndex; 3450 } 3451 const isNext = direction === 'next' || !direction; 3452 const isPrev = direction === 'prev' || !direction; 3453 let slidesPrepended = 0; 3454 let slidesAppended = 0; 3455 const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length; 3456 const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex; 3457 const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0); 3458 // prepend last slides before start 3459 if (activeColIndexWithShift < loopedSlides) { 3460 slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup); 3461 for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
vendor: 15,678 bytes, lines 3462-3890
3462 const index = i - Math.floor(i / cols) * cols; 3463 if (gridEnabled) { 3464 const colIndexToPrepend = cols - index - 1; 3465 for (let i = slides.length - 1; i >= 0; i -= 1) { 3466 if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i); 3467 } 3468 // slides.forEach((slide, slideIndex) => { 3469 // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex); 3470 // }); 3471 } else { 3472 prependSlidesIndexes.push(cols - index - 1); 3473 } 3474 } 3475 } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) { 3476 slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup); 3477 for (let i = 0; i < slidesAppended; i += 1) { 3478 const index = i - Math.floor(i / cols) * cols; 3479 if (gridEnabled) { 3480 slides.forEach((slide, slideIndex) => { 3481 if (slide.column === index) appendSlidesIndexes.push(slideIndex); 3482 }); 3483 } else { 3484 appendSlidesIndexes.push(index); 3485 } 3486 } 3487 } 3488 swiper.__preventObserver__ = true; 3489 requestAnimationFrame(() => { 3490 swiper.__preventObserver__ = false; 3491 }); 3492 if (isPrev) { 3493 prependSlidesIndexes.forEach(index => { 3494 slides[index].swiperLoopMoveDOM = true; 3495 slidesEl.prepend(slides[index]); 3496 slides[index].swiperLoopMoveDOM = false; 3497 }); 3498 } 3499 if (isNext) { 3500 appendSlidesIndexes.forEach(index => { 3501 slides[index].swiperLoopMoveDOM = true; 3502 slidesEl.append(slides[index]); 3503 slides[index].swiperLoopMoveDOM = false; 3504 }); 3505 } 3506 swiper.recalcSlides(); 3507 if (params.slidesPerView === 'auto') { 3508 swiper.updateSlides(); 3509 } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) { 3510 swiper.slides.forEach((slide, slideIndex) => { 3511 swiper.grid.updateSlide(slideIndex, slide, swiper.slides); 3512 }); 3513 } 3514 if (params.watchSlidesProgress) { 3515 swiper.updateSlidesOffset(); 3516 } 3517 if (slideTo) { 3518 if (prependSlidesIndexes.length > 0 && isPrev) { 3519 if (typeof slideRealIndex === 'undefined') { 3520 const currentSlideTranslate = swiper.slidesGrid[activeIndex]; 3521 const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended]; 3522 const diff = newSlideTranslate - currentSlideTranslate; 3523 if (byMousewheel) { 3524 swiper.setTranslate(swiper.translate - diff); 3525 } else { 3526 swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true); 3527 if (setTranslate) { 3528 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; 3529 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; 3530 } 3531 } 3532 } else { 3533 if (setTranslate) { 3534 const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length; 3535 swiper.slideTo(swiper.activeIndex + shift, 0, false, true); 3536 swiper.touchEventsData.currentTranslate = swiper.translate; 3537 } 3538 } 3539 } else if (appendSlidesIndexes.length > 0 && isNext) { 3540 if (typeof slideRealIndex === 'undefined') { 3541 const currentSlideTranslate = swiper.slidesGrid[activeIndex]; 3542 const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended]; 3543 const diff = newSlideTranslate - currentSlideTranslate; 3544 if (byMousewheel) { 3545 swiper.setTranslate(swiper.translate - diff); 3546 } else { 3547 swiper.slideTo(activeIndex - slidesAppended, 0, false, true); 3548 if (setTranslate) { 3549 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; 3550 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; 3551 } 3552 } 3553 } else { 3554 const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length; 3555 swiper.slideTo(swiper.activeIndex - shift, 0, false, true); 3556 } 3557 } 3558 } 3559 swiper.allowSlidePrev = allowSlidePrev; 3560 swiper.allowSlideNext = allowSlideNext; 3561 if (swiper.controller && swiper.controller.control && !byController) { 3562 const loopParams = { 3563 slideRealIndex, 3564 direction, 3565 setTranslate, 3566 activeSlideIndex, 3567 byController: true 3568 }; 3569 if (Array.isArray(swiper.controller.control)) { 3570 swiper.controller.control.forEach(c => { 3571 if (!c.destroyed && c.params.loop) c.loopFix({ 3572 ...loopParams, 3573 slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false 3574 }); 3575 }); 3576 } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) { 3577 swiper.controller.control.loopFix({ 3578 ...loopParams, 3579 slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false 3580 }); 3581 } 3582 } 3583 swiper.emit('loopFix'); 3584 } 3585 3586 function loopDestroy() { 3587 const swiper = this; 3588 const { 3589 params, 3590 slidesEl 3591 } = swiper; 3592 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return; 3593 swiper.recalcSlides(); 3594 const newSlidesOrder = []; 3595 swiper.slides.forEach(slideEl => { 3596 const index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex; 3597 newSlidesOrder[index] = slideEl; 3598 }); 3599 swiper.slides.forEach(slideEl => { 3600 slideEl.removeAttribute('data-swiper-slide-index'); 3601 }); 3602 newSlidesOrder.forEach(slideEl => { 3603 slidesEl.append(slideEl); 3604 }); 3605 swiper.recalcSlides(); 3606 swiper.slideTo(swiper.realIndex, 0); 3607 } 3608 3609 var loop = { 3610 loopCreate, 3611 loopFix, 3612 loopDestroy 3613 }; 3614 3615 function setGrabCursor(moving) { 3616 const swiper = this; 3617 if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; 3618 const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl; 3619 if (swiper.isElement) { 3620 swiper.__preventObserver__ = true; 3621 } 3622 el.style.cursor = 'move'; 3623 el.style.cursor = moving ? 'grabbing' : 'grab'; 3624 if (swiper.isElement) { 3625 requestAnimationFrame(() => { 3626 swiper.__preventObserver__ = false; 3627 }); 3628 } 3629 } 3630 3631 function unsetGrabCursor() { 3632 const swiper = this; 3633 if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) { 3634 return; 3635 } 3636 if (swiper.isElement) { 3637 swiper.__preventObserver__ = true; 3638 } 3639 swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = ''; 3640 if (swiper.isElement) { 3641 requestAnimationFrame(() => { 3642 swiper.__preventObserver__ = false; 3643 }); 3644 } 3645 } 3646 3647 var grabCursor = { 3648 setGrabCursor, 3649 unsetGrabCursor 3650 }; 3651 3652 // Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd 3653 function closestElement(selector, base) { 3654 if (base === void 0) { 3655 base = this; 3656 } 3657 function __closestFrom(el) { 3658 if (!el || el === getDocument() || el === getWindow()) return null; 3659 if (el.assignedSlot) el = el.assignedSlot; 3660 const found = el.closest(selector); 3661 if (!found && !el.getRootNode) { 3662 return null; 3663 } 3664 return found || __closestFrom(el.getRootNode().host); 3665 } 3666 return __closestFrom(base); 3667 } 3668 function preventEdgeSwipe(swiper, event, startX) { 3669 const window = getWindow(); 3670 const { 3671 params 3672 } = swiper; 3673 const edgeSwipeDetection = params.edgeSwipeDetection; 3674 const edgeSwipeThreshold = params.edgeSwipeThreshold; 3675 if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) { 3676 if (edgeSwipeDetection === 'prevent') { 3677 event.preventDefault(); 3678 return true; 3679 } 3680 return false; 3681 } 3682 return true; 3683 } 3684 function onTouchStart(event) { 3685 const swiper = this; 3686 const document = getDocument(); 3687 let e = event; 3688 if (e.originalEvent) e = e.originalEvent; 3689 const data = swiper.touchEventsData; 3690 if (e.type === 'pointerdown') { 3691 if (data.pointerId !== null && data.pointerId !== e.pointerId) { 3692 return; 3693 } 3694 data.pointerId = e.pointerId; 3695 } else if (e.type === 'touchstart' && e.targetTouches.length === 1) { 3696 data.touchId = e.targetTouches[0].identifier; 3697 } 3698 if (e.type === 'touchstart') { 3699 // don't proceed touch event 3700 preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX); 3701 return; 3702 } 3703 const { 3704 params, 3705 touches, 3706 enabled 3707 } = swiper; 3708 if (!enabled) return; 3709 if (!params.simulateTouch && e.pointerType === 'mouse') return; 3710 if (swiper.animating && params.preventInteractionOnTransition) { 3711 return; 3712 } 3713 if (!swiper.animating && params.cssMode && params.loop) { 3714 swiper.loopFix(); 3715 } 3716 let targetEl = e.target; 3717 if (params.touchEventsTarget === 'wrapper') { 3718 if (!swiper.wrapperEl.contains(targetEl)) return; 3719 } 3720 if ('which' in e && e.which === 3) return; 3721 if ('button' in e && e.button > 0) return; 3722 if (data.isTouched && data.isMoved) return; 3723 3724 // change target el for shadow root component 3725 const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; 3726 // eslint-disable-next-line 3727 const eventPath = e.composedPath ? e.composedPath() : e.path; 3728 if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) { 3729 targetEl = eventPath[0]; 3730 } 3731 const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`; 3732 const isTargetShadow = !!(e.target && e.target.shadowRoot); 3733 3734 // use closestElement for shadow root element to get the actual closest for nested shadow root element 3735 if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) { 3736 swiper.allowClick = true; 3737 return; 3738 } 3739 if (params.swipeHandler) { 3740 if (!targetEl.closest(params.swipeHandler)) return; 3741 } 3742 touches.currentX = e.pageX; 3743 touches.currentY = e.pageY; 3744 const startX = touches.currentX; 3745 const startY = touches.currentY; 3746 3747 // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore 3748 3749 if (!preventEdgeSwipe(swiper, e, startX)) { 3750 return; 3751 } 3752 Object.assign(data, { 3753 isTouched: true, 3754 isMoved: false, 3755 allowTouchCallbacks: true, 3756 isScrolling: undefined, 3757 startMoving: undefined 3758 }); 3759 touches.startX = startX; 3760 touches.startY = startY; 3761 data.touchStartTime = now(); 3762 swiper.allowClick = true; 3763 swiper.updateSize(); 3764 swiper.swipeDirection = undefined; 3765 if (params.threshold > 0) data.allowThresholdMove = false; 3766 let preventDefault = true; 3767 if (targetEl.matches(data.focusableElements)) { 3768 preventDefault = false; 3769 if (targetEl.nodeName === 'SELECT') { 3770 data.isTouched = false; 3771 } 3772 } 3773 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl) { 3774 document.activeElement.blur(); 3775 } 3776 const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; 3777 if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) { 3778 e.preventDefault(); 3779 } 3780 if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) { 3781 swiper.freeMode.onTouchStart(); 3782 } 3783 swiper.emit('touchStart', e); 3784 } 3785 3786 function onTouchMove(event) { 3787 const document = getDocument(); 3788 const swiper = this; 3789 const data = swiper.touchEventsData; 3790 const { 3791 params, 3792 touches, 3793 rtlTranslate: rtl, 3794 enabled 3795 } = swiper; 3796 if (!enabled) return; 3797 if (!params.simulateTouch && event.pointerType === 'mouse') return; 3798 let e = event; 3799 if (e.originalEvent) e = e.originalEvent; 3800 if (e.type === 'pointermove') { 3801 if (data.touchId !== null) return; // return from pointer if we use touch 3802 const id = e.pointerId; 3803 if (id !== data.pointerId) return; 3804 } 3805 let targetTouch; 3806 if (e.type === 'touchmove') { 3807 targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0]; 3808 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 3809 } else { 3810 targetTouch = e; 3811 } 3812 if (!data.isTouched) { 3813 if (data.startMoving && data.isScrolling) { 3814 swiper.emit('touchMoveOpposite', e); 3815 } 3816 return; 3817 } 3818 const pageX = targetTouch.pageX; 3819 const pageY = targetTouch.pageY; 3820 if (e.preventedByNestedSwiper) { 3821 touches.startX = pageX; 3822 touches.startY = pageY; 3823 return; 3824 } 3825 if (!swiper.allowTouchMove) { 3826 if (!e.target.matches(data.focusableElements)) { 3827 swiper.allowClick = false; 3828 } 3829 if (data.isTouched) { 3830 Object.assign(touches, { 3831 startX: pageX, 3832 startY: pageY, 3833 currentX: pageX, 3834 currentY: pageY 3835 }); 3836 data.touchStartTime = now(); 3837 } 3838 return; 3839 } 3840 if (params.touchReleaseOnEdges && !params.loop) { 3841 if (swiper.isVertical()) { 3842 // Vertical 3843 if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { 3844 data.isTouched = false; 3845 data.isMoved = false; 3846 return; 3847 } 3848 } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) { 3849 return; 3850 } 3851 } 3852 if (document.activeElement) { 3853 if (e.target === document.activeElement && e.target.matches(data.focusableElements)) { 3854 data.isMoved = true; 3855 swiper.allowClick = false; 3856 return; 3857 } 3858 } 3859 if (data.allowTouchCallbacks) { 3860 swiper.emit('touchMove', e); 3861 } 3862 touches.previousX = touches.currentX; 3863 touches.previousY = touches.currentY; 3864 touches.currentX = pageX; 3865 touches.currentY = pageY; 3866 const diffX = touches.currentX - touches.startX; 3867 const diffY = touches.currentY - touches.startY; 3868 if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return; 3869 if (typeof data.isScrolling === 'undefined') { 3870 let touchAngle; 3871 if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) { 3872 data.isScrolling = false; 3873 } else { 3874 // eslint-disable-next-line 3875 if (diffX * diffX + diffY * diffY >= 25) { 3876 touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; 3877 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; 3878 } 3879 } 3880 } 3881 if (data.isScrolling) { 3882 swiper.emit('touchMoveOpposite', e); 3883 } 3884 if (typeof data.startMoving === 'undefined') { 3885 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { 3886 data.startMoving = true; 3887 } 3888 } 3889 if (data.isScrolling || e.type === 'touchmove' && data.preventTouchMoveFromPointerMove) { 3890 data.isTouched = false;
vendor: 7,230 bytes, lines 3891-4083
3891 return; 3892 } 3893 if (!data.startMoving) { 3894 return; 3895 } 3896 swiper.allowClick = false; 3897 if (!params.cssMode && e.cancelable) { 3898 e.preventDefault(); 3899 } 3900 if (params.touchMoveStopPropagation && !params.nested) { 3901 e.stopPropagation(); 3902 } 3903 let diff = swiper.isHorizontal() ? diffX : diffY; 3904 let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY; 3905 if (params.oneWayMovement) { 3906 diff = Math.abs(diff) * (rtl ? 1 : -1); 3907 touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1); 3908 } 3909 touches.diff = diff; 3910 diff *= params.touchRatio; 3911 if (rtl) { 3912 diff = -diff; 3913 touchesDiff = -touchesDiff; 3914 } 3915 const prevTouchesDirection = swiper.touchesDirection; 3916 swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; 3917 swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next'; 3918 const isLoop = swiper.params.loop && !params.cssMode; 3919 const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev; 3920 if (!data.isMoved) { 3921 if (isLoop && allowLoopFix) { 3922 swiper.loopFix({ 3923 direction: swiper.swipeDirection 3924 }); 3925 } 3926 data.startTranslate = swiper.getTranslate(); 3927 swiper.setTransition(0); 3928 if (swiper.animating) { 3929 const evt = new window.CustomEvent('transitionend', { 3930 bubbles: true, 3931 cancelable: true, 3932 detail: { 3933 bySwiperTouchMove: true 3934 } 3935 }); 3936 swiper.wrapperEl.dispatchEvent(evt); 3937 } 3938 data.allowMomentumBounce = false; 3939 // Grab Cursor 3940 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 3941 swiper.setGrabCursor(true); 3942 } 3943 swiper.emit('sliderFirstMove', e); 3944 } 3945 let loopFixed; 3946 new Date().getTime(); 3947 if (data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) { 3948 Object.assign(touches, { 3949 startX: pageX, 3950 startY: pageY, 3951 currentX: pageX, 3952 currentY: pageY, 3953 startTranslate: data.currentTranslate 3954 }); 3955 data.loopSwapReset = true; 3956 data.startTranslate = data.currentTranslate; 3957 return; 3958 } 3959 swiper.emit('sliderMove', e); 3960 data.isMoved = true; 3961 data.currentTranslate = diff + data.startTranslate; 3962 let disableParentSwiper = true; 3963 let resistanceRatio = params.resistanceRatio; 3964 if (params.touchReleaseOnEdges) { 3965 resistanceRatio = 0; 3966 } 3967 if (diff > 0) { 3968 if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] : swiper.minTranslate())) { 3969 swiper.loopFix({ 3970 direction: 'prev', 3971 setTranslate: true, 3972 activeSlideIndex: 0 3973 }); 3974 } 3975 if (data.currentTranslate > swiper.minTranslate()) { 3976 disableParentSwiper = false; 3977 if (params.resistance) { 3978 data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio; 3979 } 3980 } 3981 } else if (diff < 0) { 3982 if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] : swiper.maxTranslate())) { 3983 swiper.loopFix({ 3984 direction: 'next', 3985 setTranslate: true, 3986 activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10))) 3987 }); 3988 } 3989 if (data.currentTranslate < swiper.maxTranslate()) { 3990 disableParentSwiper = false; 3991 if (params.resistance) { 3992 data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio; 3993 } 3994 } 3995 } 3996 if (disableParentSwiper) { 3997 e.preventedByNestedSwiper = true; 3998 } 3999 4000 // Directions locks 4001 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) { 4002 data.currentTranslate = data.startTranslate; 4003 } 4004 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) { 4005 data.currentTranslate = data.startTranslate; 4006 } 4007 if (!swiper.allowSlidePrev && !swiper.allowSlideNext) { 4008 data.currentTranslate = data.startTranslate; 4009 } 4010 4011 // Threshold 4012 if (params.threshold > 0) { 4013 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { 4014 if (!data.allowThresholdMove) { 4015 data.allowThresholdMove = true; 4016 touches.startX = touches.currentX; 4017 touches.startY = touches.currentY; 4018 data.currentTranslate = data.startTranslate; 4019 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; 4020 return; 4021 } 4022 } else { 4023 data.currentTranslate = data.startTranslate; 4024 return; 4025 } 4026 } 4027 if (!params.followFinger || params.cssMode) return; 4028 4029 // Update active index in free mode 4030 if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { 4031 swiper.updateActiveIndex(); 4032 swiper.updateSlidesClasses(); 4033 } 4034 if (params.freeMode && params.freeMode.enabled && swiper.freeMode) { 4035 swiper.freeMode.onTouchMove(); 4036 } 4037 // Update progress 4038 swiper.updateProgress(data.currentTranslate); 4039 // Update translate 4040 swiper.setTranslate(data.currentTranslate); 4041 } 4042 4043 function onTouchEnd(event) { 4044 const swiper = this; 4045 const data = swiper.touchEventsData; 4046 let e = event; 4047 if (e.originalEvent) e = e.originalEvent; 4048 let targetTouch; 4049 const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel'; 4050 if (!isTouchEvent) { 4051 if (data.touchId !== null) return; // return from pointer if we use touch 4052 if (e.pointerId !== data.pointerId) return; 4053 targetTouch = e; 4054 } else { 4055 targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0]; 4056 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 4057 } 4058 if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) { 4059 const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView); 4060 if (!proceed) { 4061 return; 4062 } 4063 } 4064 data.pointerId = null; 4065 data.touchId = null; 4066 const { 4067 params, 4068 touches, 4069 rtlTranslate: rtl, 4070 slidesGrid, 4071 enabled 4072 } = swiper; 4073 if (!enabled) return; 4074 if (!params.simulateTouch && e.pointerType === 'mouse') return; 4075 if (data.allowTouchCallbacks) { 4076 swiper.emit('touchEnd', e); 4077 } 4078 data.allowTouchCallbacks = false; 4079 if (!data.isTouched) { 4080 if (data.isMoved && params.grabCursor) { 4081 swiper.setGrabCursor(false); 4082 } 4083 data.isMoved = false;
vendor: 4,628 bytes, lines 4084-4210
4084 data.startMoving = false; 4085 return; 4086 } 4087 4088 // Return Grab Cursor 4089 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 4090 swiper.setGrabCursor(false); 4091 } 4092 4093 // Time diff 4094 const touchEndTime = now(); 4095 const timeDiff = touchEndTime - data.touchStartTime; 4096 4097 // Tap, doubleTap, Click 4098 if (swiper.allowClick) { 4099 const pathTree = e.path || e.composedPath && e.composedPath(); 4100 swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree); 4101 swiper.emit('tap click', e); 4102 if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) { 4103 swiper.emit('doubleTap doubleClick', e); 4104 } 4105 } 4106 data.lastClickTime = now(); 4107 nextTick(() => { 4108 if (!swiper.destroyed) swiper.allowClick = true; 4109 }); 4110 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) { 4111 data.isTouched = false; 4112 data.isMoved = false; 4113 data.startMoving = false; 4114 return; 4115 } 4116 data.isTouched = false; 4117 data.isMoved = false; 4118 data.startMoving = false; 4119 let currentPos; 4120 if (params.followFinger) { 4121 currentPos = rtl ? swiper.translate : -swiper.translate; 4122 } else { 4123 currentPos = -data.currentTranslate; 4124 } 4125 if (params.cssMode) { 4126 return; 4127 } 4128 if (params.freeMode && params.freeMode.enabled) { 4129 swiper.freeMode.onTouchEnd({ 4130 currentPos 4131 }); 4132 return; 4133 } 4134 4135 // Find current slide 4136 const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop; 4137 let stopIndex = 0; 4138 let groupSize = swiper.slidesSizesGrid[0]; 4139 for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) { 4140 const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 4141 if (typeof slidesGrid[i + increment] !== 'undefined') { 4142 if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) { 4143 stopIndex = i; 4144 groupSize = slidesGrid[i + increment] - slidesGrid[i]; 4145 } 4146 } else if (swipeToLast || currentPos >= slidesGrid[i]) { 4147 stopIndex = i; 4148 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; 4149 } 4150 } 4151 let rewindFirstIndex = null; 4152 let rewindLastIndex = null; 4153 if (params.rewind) { 4154 if (swiper.isBeginning) { 4155 rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 4156 } else if (swiper.isEnd) { 4157 rewindFirstIndex = 0; 4158 } 4159 } 4160 // Find current slide size 4161 const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; 4162 const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 4163 if (timeDiff > params.longSwipesMs) { 4164 // Long touches 4165 if (!params.longSwipes) { 4166 swiper.slideTo(swiper.activeIndex); 4167 return; 4168 } 4169 if (swiper.swipeDirection === 'next') { 4170 if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex); 4171 } 4172 if (swiper.swipeDirection === 'prev') { 4173 if (ratio > 1 - params.longSwipesRatio) { 4174 swiper.slideTo(stopIndex + increment); 4175 } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) { 4176 swiper.slideTo(rewindLastIndex); 4177 } else { 4178 swiper.slideTo(stopIndex); 4179 } 4180 } 4181 } else { 4182 // Short swipes 4183 if (!params.shortSwipes) { 4184 swiper.slideTo(swiper.activeIndex); 4185 return; 4186 } 4187 const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl); 4188 if (!isNavButtonTarget) { 4189 if (swiper.swipeDirection === 'next') { 4190 swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment); 4191 } 4192 if (swiper.swipeDirection === 'prev') { 4193 swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex); 4194 } 4195 } else if (e.target === swiper.navigation.nextEl) { 4196 swiper.slideTo(stopIndex + increment); 4197 } else { 4198 swiper.slideTo(stopIndex); 4199 } 4200 } 4201 } 4202 4203 function onResize() { 4204 const swiper = this; 4205 const { 4206 params, 4207 el 4208 } = swiper; 4209 if (el && el.offsetWidth === 0) return; 4210
vendor: 6,498 bytes, lines 4211-4430
4211 // Breakpoints 4212 if (params.breakpoints) { 4213 swiper.setBreakpoint(); 4214 } 4215 4216 // Save locks 4217 const { 4218 allowSlideNext, 4219 allowSlidePrev, 4220 snapGrid 4221 } = swiper; 4222 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 4223 4224 // Disable locks on resize 4225 swiper.allowSlideNext = true; 4226 swiper.allowSlidePrev = true; 4227 swiper.updateSize(); 4228 swiper.updateSlides(); 4229 swiper.updateSlidesClasses(); 4230 const isVirtualLoop = isVirtual && params.loop; 4231 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) { 4232 swiper.slideTo(swiper.slides.length - 1, 0, false, true); 4233 } else { 4234 if (swiper.params.loop && !isVirtual) { 4235 swiper.slideToLoop(swiper.realIndex, 0, false, true); 4236 } else { 4237 swiper.slideTo(swiper.activeIndex, 0, false, true); 4238 } 4239 } 4240 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 4241 clearTimeout(swiper.autoplay.resizeTimeout); 4242 swiper.autoplay.resizeTimeout = setTimeout(() => { 4243 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 4244 swiper.autoplay.resume(); 4245 } 4246 }, 500); 4247 } 4248 // Return locks after resize 4249 swiper.allowSlidePrev = allowSlidePrev; 4250 swiper.allowSlideNext = allowSlideNext; 4251 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { 4252 swiper.checkOverflow(); 4253 } 4254 } 4255 4256 function onClick(e) { 4257 const swiper = this; 4258 if (!swiper.enabled) return; 4259 if (!swiper.allowClick) { 4260 if (swiper.params.preventClicks) e.preventDefault(); 4261 if (swiper.params.preventClicksPropagation && swiper.animating) { 4262 e.stopPropagation(); 4263 e.stopImmediatePropagation(); 4264 } 4265 } 4266 } 4267 4268 function onScroll() { 4269 const swiper = this; 4270 const { 4271 wrapperEl, 4272 rtlTranslate, 4273 enabled 4274 } = swiper; 4275 if (!enabled) return; 4276 swiper.previousTranslate = swiper.translate; 4277 if (swiper.isHorizontal()) { 4278 swiper.translate = -wrapperEl.scrollLeft; 4279 } else { 4280 swiper.translate = -wrapperEl.scrollTop; 4281 } 4282 // eslint-disable-next-line 4283 if (swiper.translate === 0) swiper.translate = 0; 4284 swiper.updateActiveIndex(); 4285 swiper.updateSlidesClasses(); 4286 let newProgress; 4287 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 4288 if (translatesDiff === 0) { 4289 newProgress = 0; 4290 } else { 4291 newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; 4292 } 4293 if (newProgress !== swiper.progress) { 4294 swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); 4295 } 4296 swiper.emit('setTranslate', swiper.translate, false); 4297 } 4298 4299 function onLoad(e) { 4300 const swiper = this; 4301 processLazyPreloader(swiper, e.target); 4302 if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) { 4303 return; 4304 } 4305 swiper.update(); 4306 } 4307 4308 function onDocumentTouchStart() { 4309 const swiper = this; 4310 if (swiper.documentTouchHandlerProceeded) return; 4311 swiper.documentTouchHandlerProceeded = true; 4312 if (swiper.params.touchReleaseOnEdges) { 4313 swiper.el.style.touchAction = 'auto'; 4314 } 4315 } 4316 4317 const events = (swiper, method) => { 4318 const document = getDocument(); 4319 const { 4320 params, 4321 el, 4322 wrapperEl, 4323 device 4324 } = swiper; 4325 const capture = !!params.nested; 4326 const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 4327 const swiperMethod = method; 4328 if (!el || typeof el === 'string') return; 4329 4330 // Touch Events 4331 document[domMethod]('touchstart', swiper.onDocumentTouchStart, { 4332 passive: false, 4333 capture 4334 }); 4335 el[domMethod]('touchstart', swiper.onTouchStart, { 4336 passive: false 4337 }); 4338 el[domMethod]('pointerdown', swiper.onTouchStart, { 4339 passive: false 4340 }); 4341 document[domMethod]('touchmove', swiper.onTouchMove, { 4342 passive: false, 4343 capture 4344 }); 4345 document[domMethod]('pointermove', swiper.onTouchMove, { 4346 passive: false, 4347 capture 4348 }); 4349 document[domMethod]('touchend', swiper.onTouchEnd, { 4350 passive: true 4351 }); 4352 document[domMethod]('pointerup', swiper.onTouchEnd, { 4353 passive: true 4354 }); 4355 document[domMethod]('pointercancel', swiper.onTouchEnd, { 4356 passive: true 4357 }); 4358 document[domMethod]('touchcancel', swiper.onTouchEnd, { 4359 passive: true 4360 }); 4361 document[domMethod]('pointerout', swiper.onTouchEnd, { 4362 passive: true 4363 }); 4364 document[domMethod]('pointerleave', swiper.onTouchEnd, { 4365 passive: true 4366 }); 4367 document[domMethod]('contextmenu', swiper.onTouchEnd, { 4368 passive: true 4369 }); 4370 4371 // Prevent Links Clicks 4372 if (params.preventClicks || params.preventClicksPropagation) { 4373 el[domMethod]('click', swiper.onClick, true); 4374 } 4375 if (params.cssMode) { 4376 wrapperEl[domMethod]('scroll', swiper.onScroll); 4377 } 4378 4379 // Resize handler 4380 if (params.updateOnWindowResize) { 4381 swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true); 4382 } else { 4383 swiper[swiperMethod]('observerUpdate', onResize, true); 4384 } 4385 4386 // Images loader 4387 el[domMethod]('load', swiper.onLoad, { 4388 capture: true 4389 }); 4390 }; 4391 function attachEvents() { 4392 const swiper = this; 4393 const { 4394 params 4395 } = swiper; 4396 swiper.onTouchStart = onTouchStart.bind(swiper); 4397 swiper.onTouchMove = onTouchMove.bind(swiper); 4398 swiper.onTouchEnd = onTouchEnd.bind(swiper); 4399 swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper); 4400 if (params.cssMode) { 4401 swiper.onScroll = onScroll.bind(swiper); 4402 } 4403 swiper.onClick = onClick.bind(swiper); 4404 swiper.onLoad = onLoad.bind(swiper); 4405 events(swiper, 'on'); 4406 } 4407 function detachEvents() { 4408 const swiper = this; 4409 events(swiper, 'off'); 4410 } 4411 var events$1 = { 4412 attachEvents, 4413 detachEvents 4414 }; 4415 4416 const isGridEnabled = (swiper, params) => { 4417 return swiper.grid && params.grid && params.grid.rows > 1; 4418 }; 4419 function setBreakpoint() { 4420 const swiper = this; 4421 const { 4422 realIndex, 4423 initialized, 4424 params, 4425 el 4426 } = swiper; 4427 const breakpoints = params.breakpoints; 4428 if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; 4429 4430 // Get breakpoint for window width and update parameters
vendor: 7,997 bytes, lines 4431-4684
4431 const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el); 4432 if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; 4433 const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; 4434 const breakpointParams = breakpointOnlyParams || swiper.originalParams; 4435 const wasMultiRow = isGridEnabled(swiper, params); 4436 const isMultiRow = isGridEnabled(swiper, breakpointParams); 4437 const wasGrabCursor = swiper.params.grabCursor; 4438 const isGrabCursor = breakpointParams.grabCursor; 4439 const wasEnabled = params.enabled; 4440 if (wasMultiRow && !isMultiRow) { 4441 el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`); 4442 swiper.emitContainerClasses(); 4443 } else if (!wasMultiRow && isMultiRow) { 4444 el.classList.add(`${params.containerModifierClass}grid`); 4445 if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') { 4446 el.classList.add(`${params.containerModifierClass}grid-column`); 4447 } 4448 swiper.emitContainerClasses(); 4449 } 4450 if (wasGrabCursor && !isGrabCursor) { 4451 swiper.unsetGrabCursor(); 4452 } else if (!wasGrabCursor && isGrabCursor) { 4453 swiper.setGrabCursor(); 4454 } 4455 4456 // Toggle navigation, pagination, scrollbar 4457 ['navigation', 'pagination', 'scrollbar'].forEach(prop => { 4458 if (typeof breakpointParams[prop] === 'undefined') return; 4459 const wasModuleEnabled = params[prop] && params[prop].enabled; 4460 const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled; 4461 if (wasModuleEnabled && !isModuleEnabled) { 4462 swiper[prop].disable(); 4463 } 4464 if (!wasModuleEnabled && isModuleEnabled) { 4465 swiper[prop].enable(); 4466 } 4467 }); 4468 const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; 4469 const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); 4470 const wasLoop = params.loop; 4471 if (directionChanged && initialized) { 4472 swiper.changeDirection(); 4473 } 4474 extend(swiper.params, breakpointParams); 4475 const isEnabled = swiper.params.enabled; 4476 const hasLoop = swiper.params.loop; 4477 Object.assign(swiper, { 4478 allowTouchMove: swiper.params.allowTouchMove, 4479 allowSlideNext: swiper.params.allowSlideNext, 4480 allowSlidePrev: swiper.params.allowSlidePrev 4481 }); 4482 if (wasEnabled && !isEnabled) { 4483 swiper.disable(); 4484 } else if (!wasEnabled && isEnabled) { 4485 swiper.enable(); 4486 } 4487 swiper.currentBreakpoint = breakpoint; 4488 swiper.emit('_beforeBreakpoint', breakpointParams); 4489 if (initialized) { 4490 if (needsReLoop) { 4491 swiper.loopDestroy(); 4492 swiper.loopCreate(realIndex); 4493 swiper.updateSlides(); 4494 } else if (!wasLoop && hasLoop) { 4495 swiper.loopCreate(realIndex); 4496 swiper.updateSlides(); 4497 } else if (wasLoop && !hasLoop) { 4498 swiper.loopDestroy(); 4499 } 4500 } 4501 swiper.emit('breakpoint', breakpointParams); 4502 } 4503 4504 function getBreakpoint(breakpoints, base, containerEl) { 4505 if (base === void 0) { 4506 base = 'window'; 4507 } 4508 if (!breakpoints || base === 'container' && !containerEl) return undefined; 4509 let breakpoint = false; 4510 const window = getWindow(); 4511 const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight; 4512 const points = Object.keys(breakpoints).map(point => { 4513 if (typeof point === 'string' && point.indexOf('@') === 0) { 4514 const minRatio = parseFloat(point.substr(1)); 4515 const value = currentHeight * minRatio; 4516 return { 4517 value, 4518 point 4519 }; 4520 } 4521 return { 4522 value: point, 4523 point 4524 }; 4525 }); 4526 points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10)); 4527 for (let i = 0; i < points.length; i += 1) { 4528 const { 4529 point, 4530 value 4531 } = points[i]; 4532 if (base === 'window') { 4533 if (window.matchMedia(`(min-width: ${value}px)`).matches) { 4534 breakpoint = point; 4535 } 4536 } else if (value <= containerEl.clientWidth) { 4537 breakpoint = point; 4538 } 4539 } 4540 return breakpoint || 'max'; 4541 } 4542 4543 var breakpoints = { 4544 setBreakpoint, 4545 getBreakpoint 4546 }; 4547 4548 function prepareClasses(entries, prefix) { 4549 const resultClasses = []; 4550 entries.forEach(item => { 4551 if (typeof item === 'object') { 4552 Object.keys(item).forEach(classNames => { 4553 if (item[classNames]) { 4554 resultClasses.push(prefix + classNames); 4555 } 4556 }); 4557 } else if (typeof item === 'string') { 4558 resultClasses.push(prefix + item); 4559 } 4560 }); 4561 return resultClasses; 4562 } 4563 function addClasses() { 4564 const swiper = this; 4565 const { 4566 classNames, 4567 params, 4568 rtl, 4569 el, 4570 device 4571 } = swiper; 4572 // prettier-ignore 4573 const suffixes = prepareClasses(['initialized', params.direction, { 4574 'free-mode': swiper.params.freeMode && params.freeMode.enabled 4575 }, { 4576 'autoheight': params.autoHeight 4577 }, { 4578 'rtl': rtl 4579 }, { 4580 'grid': params.grid && params.grid.rows > 1 4581 }, { 4582 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' 4583 }, { 4584 'android': device.android 4585 }, { 4586 'ios': device.ios 4587 }, { 4588 'css-mode': params.cssMode 4589 }, { 4590 'centered': params.cssMode && params.centeredSlides 4591 }, { 4592 'watch-progress': params.watchSlidesProgress 4593 }], params.containerModifierClass); 4594 classNames.push(...suffixes); 4595 el.classList.add(...classNames); 4596 swiper.emitContainerClasses(); 4597 } 4598 4599 function removeClasses() { 4600 const swiper = this; 4601 const { 4602 el, 4603 classNames 4604 } = swiper; 4605 if (!el || typeof el === 'string') return; 4606 el.classList.remove(...classNames); 4607 swiper.emitContainerClasses(); 4608 } 4609 4610 var classes = { 4611 addClasses, 4612 removeClasses 4613 }; 4614 4615 function checkOverflow() { 4616 const swiper = this; 4617 const { 4618 isLocked: wasLocked, 4619 params 4620 } = swiper; 4621 const { 4622 slidesOffsetBefore 4623 } = params; 4624 if (slidesOffsetBefore) { 4625 const lastSlideIndex = swiper.slides.length - 1; 4626 const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; 4627 swiper.isLocked = swiper.size > lastSlideRightEdge; 4628 } else { 4629 swiper.isLocked = swiper.snapGrid.length === 1; 4630 } 4631 if (params.allowSlideNext === true) { 4632 swiper.allowSlideNext = !swiper.isLocked; 4633 } 4634 if (params.allowSlidePrev === true) { 4635 swiper.allowSlidePrev = !swiper.isLocked; 4636 } 4637 if (wasLocked && wasLocked !== swiper.isLocked) { 4638 swiper.isEnd = false; 4639 } 4640 if (wasLocked !== swiper.isLocked) { 4641 swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); 4642 } 4643 } 4644 var checkOverflow$1 = { 4645 checkOverflow 4646 }; 4647 4648 var defaults = { 4649 init: true, 4650 direction: 'horizontal', 4651 oneWayMovement: false, 4652 swiperElementNodeName: 'SWIPER-CONTAINER', 4653 touchEventsTarget: 'wrapper', 4654 initialSlide: 0, 4655 speed: 300, 4656 cssMode: false, 4657 updateOnWindowResize: true, 4658 resizeObserver: true, 4659 nested: false, 4660 createElements: false, 4661 eventsPrefix: 'swiper', 4662 enabled: true, 4663 focusableElements: 'input, select, option, textarea, button, video, label', 4664 // Overrides 4665 width: null, 4666 height: null, 4667 // 4668 preventInteractionOnTransition: false, 4669 // ssr 4670 userAgent: null, 4671 url: null, 4672 // To support iOS's swipe-to-go-back gesture (when being used in-app). 4673 edgeSwipeDetection: false, 4674 edgeSwipeThreshold: 20, 4675 // Autoheight 4676 autoHeight: false, 4677 // Set wrapper width 4678 setWrapperSize: false, 4679 // Virtual Translate 4680 virtualTranslate: false, 4681 // Effects 4682 effect: 'slide', 4683 // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' 4684
vendor: 4,199 bytes, lines 4685-4828
4685 // Breakpoints 4686 breakpoints: undefined, 4687 breakpointsBase: 'window', 4688 // Slides grid 4689 spaceBetween: 0, 4690 slidesPerView: 1, 4691 slidesPerGroup: 1, 4692 slidesPerGroupSkip: 0, 4693 slidesPerGroupAuto: false, 4694 centeredSlides: false, 4695 centeredSlidesBounds: false, 4696 slidesOffsetBefore: 0, 4697 // in px 4698 slidesOffsetAfter: 0, 4699 // in px 4700 normalizeSlideIndex: true, 4701 centerInsufficientSlides: false, 4702 // Disable swiper and hide navigation when container not overflow 4703 watchOverflow: true, 4704 // Round length 4705 roundLengths: false, 4706 // Touches 4707 touchRatio: 1, 4708 touchAngle: 45, 4709 simulateTouch: true, 4710 shortSwipes: true, 4711 longSwipes: true, 4712 longSwipesRatio: 0.5, 4713 longSwipesMs: 300, 4714 followFinger: true, 4715 allowTouchMove: true, 4716 threshold: 5, 4717 touchMoveStopPropagation: false, 4718 touchStartPreventDefault: true, 4719 touchStartForcePreventDefault: false, 4720 touchReleaseOnEdges: false, 4721 // Unique Navigation Elements 4722 uniqueNavElements: true, 4723 // Resistance 4724 resistance: true, 4725 resistanceRatio: 0.85, 4726 // Progress 4727 watchSlidesProgress: false, 4728 // Cursor 4729 grabCursor: false, 4730 // Clicks 4731 preventClicks: true, 4732 preventClicksPropagation: true, 4733 slideToClickedSlide: false, 4734 // loop 4735 loop: false, 4736 loopAddBlankSlides: true, 4737 loopAdditionalSlides: 0, 4738 loopPreventsSliding: true, 4739 // rewind 4740 rewind: false, 4741 // Swiping/no swiping 4742 allowSlidePrev: true, 4743 allowSlideNext: true, 4744 swipeHandler: null, 4745 // '.swipe-handler', 4746 noSwiping: true, 4747 noSwipingClass: 'swiper-no-swiping', 4748 noSwipingSelector: null, 4749 // Passive Listeners 4750 passiveListeners: true, 4751 maxBackfaceHiddenSlides: 10, 4752 // NS 4753 containerModifierClass: 'swiper-', 4754 // NEW 4755 slideClass: 'swiper-slide', 4756 slideBlankClass: 'swiper-slide-blank', 4757 slideActiveClass: 'swiper-slide-active', 4758 slideVisibleClass: 'swiper-slide-visible', 4759 slideFullyVisibleClass: 'swiper-slide-fully-visible', 4760 slideNextClass: 'swiper-slide-next', 4761 slidePrevClass: 'swiper-slide-prev', 4762 wrapperClass: 'swiper-wrapper', 4763 lazyPreloaderClass: 'swiper-lazy-preloader', 4764 lazyPreloadPrevNext: 0, 4765 // Callbacks 4766 runCallbacksOnInit: true, 4767 // Internals 4768 _emitClasses: false 4769 }; 4770 4771 function moduleExtendParams(params, allModulesParams) { 4772 return function extendParams(obj) { 4773 if (obj === void 0) { 4774 obj = {}; 4775 } 4776 const moduleParamName = Object.keys(obj)[0]; 4777 const moduleParams = obj[moduleParamName]; 4778 if (typeof moduleParams !== 'object' || moduleParams === null) { 4779 extend(allModulesParams, obj); 4780 return; 4781 } 4782 if (params[moduleParamName] === true) { 4783 params[moduleParamName] = { 4784 enabled: true 4785 }; 4786 } 4787 if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) { 4788 params[moduleParamName].auto = true; 4789 } 4790 if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) { 4791 params[moduleParamName].auto = true; 4792 } 4793 if (!(moduleParamName in params && 'enabled' in moduleParams)) { 4794 extend(allModulesParams, obj); 4795 return; 4796 } 4797 if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) { 4798 params[moduleParamName].enabled = true; 4799 } 4800 if (!params[moduleParamName]) params[moduleParamName] = { 4801 enabled: false 4802 }; 4803 extend(allModulesParams, obj); 4804 }; 4805 } 4806 4807 /* eslint no-param-reassign: "off" */ 4808 const prototypes = { 4809 eventsEmitter, 4810 update, 4811 translate, 4812 transition, 4813 slide, 4814 loop, 4815 grabCursor, 4816 events: events$1, 4817 breakpoints, 4818 checkOverflow: checkOverflow$1, 4819 classes 4820 }; 4821 const extendedDefaults = {}; 4822 class Swiper { 4823 constructor() { 4824 let el; 4825 let params; 4826 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 4827 args[_key] = arguments[_key]; 4828 }
vendor: 7,462 bytes, lines 4829-5063
4829 if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') { 4830 params = args[0]; 4831 } else { 4832 [el, params] = args; 4833 } 4834 if (!params) params = {}; 4835 params = extend({}, params); 4836 if (el && !params.el) params.el = el; 4837 const document = getDocument(); 4838 if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) { 4839 const swipers = []; 4840 document.querySelectorAll(params.el).forEach(containerEl => { 4841 const newParams = extend({}, params, { 4842 el: containerEl 4843 }); 4844 swipers.push(new Swiper(newParams)); 4845 }); 4846 // eslint-disable-next-line no-constructor-return 4847 return swipers; 4848 } 4849 4850 // Swiper Instance 4851 const swiper = this; 4852 swiper.__swiper__ = true; 4853 swiper.support = getSupport(); 4854 swiper.device = getDevice({ 4855 userAgent: params.userAgent 4856 }); 4857 swiper.browser = getBrowser(); 4858 swiper.eventsListeners = {}; 4859 swiper.eventsAnyListeners = []; 4860 swiper.modules = [...swiper.__modules__]; 4861 if (params.modules && Array.isArray(params.modules)) { 4862 swiper.modules.push(...params.modules); 4863 } 4864 const allModulesParams = {}; 4865 swiper.modules.forEach(mod => { 4866 mod({ 4867 params, 4868 swiper, 4869 extendParams: moduleExtendParams(params, allModulesParams), 4870 on: swiper.on.bind(swiper), 4871 once: swiper.once.bind(swiper), 4872 off: swiper.off.bind(swiper), 4873 emit: swiper.emit.bind(swiper) 4874 }); 4875 }); 4876 4877 // Extend defaults with modules params 4878 const swiperParams = extend({}, defaults, allModulesParams); 4879 4880 // Extend defaults with passed params 4881 swiper.params = extend({}, swiperParams, extendedDefaults, params); 4882 swiper.originalParams = extend({}, swiper.params); 4883 swiper.passedParams = extend({}, params); 4884 4885 // add event listeners 4886 if (swiper.params && swiper.params.on) { 4887 Object.keys(swiper.params.on).forEach(eventName => { 4888 swiper.on(eventName, swiper.params.on[eventName]); 4889 }); 4890 } 4891 if (swiper.params && swiper.params.onAny) { 4892 swiper.onAny(swiper.params.onAny); 4893 } 4894 4895 // Extend Swiper 4896 Object.assign(swiper, { 4897 enabled: swiper.params.enabled, 4898 el, 4899 // Classes 4900 classNames: [], 4901 // Slides 4902 slides: [], 4903 slidesGrid: [], 4904 snapGrid: [], 4905 slidesSizesGrid: [], 4906 // isDirection 4907 isHorizontal() { 4908 return swiper.params.direction === 'horizontal'; 4909 }, 4910 isVertical() { 4911 return swiper.params.direction === 'vertical'; 4912 }, 4913 // Indexes 4914 activeIndex: 0, 4915 realIndex: 0, 4916 // 4917 isBeginning: true, 4918 isEnd: false, 4919 // Props 4920 translate: 0, 4921 previousTranslate: 0, 4922 progress: 0, 4923 velocity: 0, 4924 animating: false, 4925 cssOverflowAdjustment() { 4926 // Returns 0 unless `translate` is > 2**23 4927 // Should be subtracted from css values to prevent overflow 4928 return Math.trunc(this.translate / 2 ** 23) * 2 ** 23; 4929 }, 4930 // Locks 4931 allowSlideNext: swiper.params.allowSlideNext, 4932 allowSlidePrev: swiper.params.allowSlidePrev, 4933 // Touch Events 4934 touchEventsData: { 4935 isTouched: undefined, 4936 isMoved: undefined, 4937 allowTouchCallbacks: undefined, 4938 touchStartTime: undefined, 4939 isScrolling: undefined, 4940 currentTranslate: undefined, 4941 startTranslate: undefined, 4942 allowThresholdMove: undefined, 4943 // Form elements to match 4944 focusableElements: swiper.params.focusableElements, 4945 // Last click time 4946 lastClickTime: 0, 4947 clickTimeout: undefined, 4948 // Velocities 4949 velocities: [], 4950 allowMomentumBounce: undefined, 4951 startMoving: undefined, 4952 pointerId: null, 4953 touchId: null 4954 }, 4955 // Clicks 4956 allowClick: true, 4957 // Touches 4958 allowTouchMove: swiper.params.allowTouchMove, 4959 touches: { 4960 startX: 0, 4961 startY: 0, 4962 currentX: 0, 4963 currentY: 0, 4964 diff: 0 4965 }, 4966 // Images 4967 imagesToLoad: [], 4968 imagesLoaded: 0 4969 }); 4970 swiper.emit('_swiper'); 4971 4972 // Init 4973 if (swiper.params.init) { 4974 swiper.init(); 4975 } 4976 4977 // Return app instance 4978 // eslint-disable-next-line no-constructor-return 4979 return swiper; 4980 } 4981 getDirectionLabel(property) { 4982 if (this.isHorizontal()) { 4983 return property; 4984 } 4985 // prettier-ignore 4986 return { 4987 'width': 'height', 4988 'margin-top': 'margin-left', 4989 'margin-bottom ': 'margin-right', 4990 'margin-left': 'margin-top', 4991 'margin-right': 'margin-bottom', 4992 'padding-left': 'padding-top', 4993 'padding-right': 'padding-bottom', 4994 'marginRight': 'marginBottom' 4995 }[property]; 4996 } 4997 getSlideIndex(slideEl) { 4998 const { 4999 slidesEl, 5000 params 5001 } = this; 5002 const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); 5003 const firstSlideIndex = elementIndex(slides[0]); 5004 return elementIndex(slideEl) - firstSlideIndex; 5005 } 5006 getSlideIndexByData(index) { 5007 return this.getSlideIndex(this.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index)[0]); 5008 } 5009 recalcSlides() { 5010 const swiper = this; 5011 const { 5012 slidesEl, 5013 params 5014 } = swiper; 5015 swiper.slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); 5016 } 5017 enable() { 5018 const swiper = this; 5019 if (swiper.enabled) return; 5020 swiper.enabled = true; 5021 if (swiper.params.grabCursor) { 5022 swiper.setGrabCursor(); 5023 } 5024 swiper.emit('enable'); 5025 } 5026 disable() { 5027 const swiper = this; 5028 if (!swiper.enabled) return; 5029 swiper.enabled = false; 5030 if (swiper.params.grabCursor) { 5031 swiper.unsetGrabCursor(); 5032 } 5033 swiper.emit('disable'); 5034 } 5035 setProgress(progress, speed) { 5036 const swiper = this; 5037 progress = Math.min(Math.max(progress, 0), 1); 5038 const min = swiper.minTranslate(); 5039 const max = swiper.maxTranslate(); 5040 const current = (max - min) * progress + min; 5041 swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); 5042 swiper.updateActiveIndex(); 5043 swiper.updateSlidesClasses(); 5044 } 5045 emitContainerClasses() { 5046 const swiper = this; 5047 if (!swiper.params._emitClasses || !swiper.el) return; 5048 const cls = swiper.el.className.split(' ').filter(className => { 5049 return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; 5050 }); 5051 swiper.emit('_containerClasses', cls.join(' ')); 5052 } 5053 getSlideClasses(slideEl) { 5054 const swiper = this; 5055 if (swiper.destroyed) return ''; 5056 return slideEl.className.split(' ').filter(className => { 5057 return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; 5058 }).join(' '); 5059 } 5060 emitSlidesClasses() { 5061 const swiper = this; 5062 if (!swiper.params._emitClasses || !swiper.el) return; 5063 const updates = [];
vendor: 2,285 bytes, lines 5064-5136
5064 swiper.slides.forEach(slideEl => { 5065 const classNames = swiper.getSlideClasses(slideEl); 5066 updates.push({ 5067 slideEl, 5068 classNames 5069 }); 5070 swiper.emit('_slideClass', slideEl, classNames); 5071 }); 5072 swiper.emit('_slideClasses', updates); 5073 } 5074 slidesPerViewDynamic(view, exact) { 5075 if (view === void 0) { 5076 view = 'current'; 5077 } 5078 if (exact === void 0) { 5079 exact = false; 5080 } 5081 const swiper = this; 5082 const { 5083 params, 5084 slides, 5085 slidesGrid, 5086 slidesSizesGrid, 5087 size: swiperSize, 5088 activeIndex 5089 } = swiper; 5090 let spv = 1; 5091 if (typeof params.slidesPerView === 'number') return params.slidesPerView; 5092 if (params.centeredSlides) { 5093 let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0; 5094 let breakLoop; 5095 for (let i = activeIndex + 1; i < slides.length; i += 1) { 5096 if (slides[i] && !breakLoop) { 5097 slideSize += Math.ceil(slides[i].swiperSlideSize); 5098 spv += 1; 5099 if (slideSize > swiperSize) breakLoop = true; 5100 } 5101 } 5102 for (let i = activeIndex - 1; i >= 0; i -= 1) { 5103 if (slides[i] && !breakLoop) { 5104 slideSize += slides[i].swiperSlideSize; 5105 spv += 1; 5106 if (slideSize > swiperSize) breakLoop = true; 5107 } 5108 } 5109 } else { 5110 // eslint-disable-next-line 5111 if (view === 'current') { 5112 for (let i = activeIndex + 1; i < slides.length; i += 1) { 5113 const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize; 5114 if (slideInView) { 5115 spv += 1; 5116 } 5117 } 5118 } else { 5119 // previous 5120 for (let i = activeIndex - 1; i >= 0; i -= 1) { 5121 const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize; 5122 if (slideInView) { 5123 spv += 1; 5124 } 5125 } 5126 } 5127 } 5128 return spv; 5129 } 5130 update() { 5131 const swiper = this; 5132 if (!swiper || swiper.destroyed) return; 5133 const { 5134 snapGrid, 5135 params 5136 } = swiper;
vendor: 4,448 bytes, lines 5137-5253
5137 // Breakpoints 5138 if (params.breakpoints) { 5139 swiper.setBreakpoint(); 5140 } 5141 [...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => { 5142 if (imageEl.complete) { 5143 processLazyPreloader(swiper, imageEl); 5144 } 5145 }); 5146 swiper.updateSize(); 5147 swiper.updateSlides(); 5148 swiper.updateProgress(); 5149 swiper.updateSlidesClasses(); 5150 function setTranslate() { 5151 const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; 5152 const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); 5153 swiper.setTranslate(newTranslate); 5154 swiper.updateActiveIndex(); 5155 swiper.updateSlidesClasses(); 5156 } 5157 let translated; 5158 if (params.freeMode && params.freeMode.enabled && !params.cssMode) { 5159 setTranslate(); 5160 if (params.autoHeight) { 5161 swiper.updateAutoHeight(); 5162 } 5163 } else { 5164 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) { 5165 const slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides; 5166 translated = swiper.slideTo(slides.length - 1, 0, false, true); 5167 } else { 5168 translated = swiper.slideTo(swiper.activeIndex, 0, false, true); 5169 } 5170 if (!translated) { 5171 setTranslate(); 5172 } 5173 } 5174 if (params.watchOverflow && snapGrid !== swiper.snapGrid) { 5175 swiper.checkOverflow(); 5176 } 5177 swiper.emit('update'); 5178 } 5179 changeDirection(newDirection, needUpdate) { 5180 if (needUpdate === void 0) { 5181 needUpdate = true; 5182 } 5183 const swiper = this; 5184 const currentDirection = swiper.params.direction; 5185 if (!newDirection) { 5186 // eslint-disable-next-line 5187 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; 5188 } 5189 if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') { 5190 return swiper; 5191 } 5192 swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`); 5193 swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`); 5194 swiper.emitContainerClasses(); 5195 swiper.params.direction = newDirection; 5196 swiper.slides.forEach(slideEl => { 5197 if (newDirection === 'vertical') { 5198 slideEl.style.width = ''; 5199 } else { 5200 slideEl.style.height = ''; 5201 } 5202 }); 5203 swiper.emit('changeDirection'); 5204 if (needUpdate) swiper.update(); 5205 return swiper; 5206 } 5207 changeLanguageDirection(direction) { 5208 const swiper = this; 5209 if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return; 5210 swiper.rtl = direction === 'rtl'; 5211 swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl; 5212 if (swiper.rtl) { 5213 swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`); 5214 swiper.el.dir = 'rtl'; 5215 } else { 5216 swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`); 5217 swiper.el.dir = 'ltr'; 5218 } 5219 swiper.update(); 5220 } 5221 mount(element) { 5222 const swiper = this; 5223 if (swiper.mounted) return true; 5224 5225 // Find el 5226 let el = element || swiper.params.el; 5227 if (typeof el === 'string') { 5228 el = document.querySelector(el); 5229 } 5230 if (!el) { 5231 return false; 5232 } 5233 el.swiper = swiper; 5234 if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) { 5235 swiper.isElement = true; 5236 } 5237 const getWrapperSelector = () => { 5238 return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; 5239 }; 5240 const getWrapper = () => { 5241 if (el && el.shadowRoot && el.shadowRoot.querySelector) { 5242 const res = el.shadowRoot.querySelector(getWrapperSelector()); 5243 // Children needs to return slot items 5244 return res; 5245 } 5246 return elementChildren(el, getWrapperSelector())[0]; 5247 }; 5248 // Find Wrapper 5249 let wrapperEl = getWrapper(); 5250 if (!wrapperEl && swiper.params.createElements) { 5251 wrapperEl = createElement('div', swiper.params.wrapperClass); 5252 el.append(wrapperEl); 5253 elementChildren(el, `.${swiper.params.slideClass}
5253`).forEach(slideEl => { 5254 wrapperEl.append(slideEl); 5255 }); 5256 } 5257 Object.assign(swiper, { 5258 el, 5259 wrapperEl, 5260 slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl, 5261 hostEl: swiper.isElement ? el.parentNode.host : el, 5262 mounted: true, 5263 // RTL 5264 rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl', 5265 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'), 5266 wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box' 5267 }); 5268 return true; 5269 } 5270 init(el) { 5271 const swiper = this; 5272 if (swiper.initialized) return swiper; 5273 const mounted = swiper.mount(el); 5274 if (mounted === false) return swiper; 5275 swiper.emit('beforeInit'); 5276 5277 // Set breakpoint 5278 if (swiper.params.breakpoints) { 5279 swiper.setBreakpoint(); 5280 } 5281 5282 // Add Classes 5283 swiper.addClasses(); 5284 5285 // Update size 5286 swiper.updateSize(); 5287 5288 // Update slides 5289 swiper.updateSlides(); 5290 if (swiper.params.watchOverflow) { 5291 swiper.checkOverflow(); 5292 } 5293 5294 // Set Grab Cursor 5295 if (swiper.params.grabCursor && swiper.enabled) { 5296 swiper.setGrabCursor(); 5297 } 5298 5299 // Slide To Initial Slide 5300 if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 5301 swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true); 5302 } else { 5303 swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); 5304 } 5305 5306 // Create loop 5307 if (swiper.params.loop) { 5308 swiper.loopCreate(); 5309 } 5310 5311 // Attach events 5312 swiper.attachEvents(); 5313 const lazyElements = [...swiper.el.querySelectorAll('[loading="lazy"]')]; 5314 if (swiper.isElement) { 5315 lazyElements.push(...swiper.hostEl.querySelectorAll('[loading="lazy"]')); 5316 } 5317 lazyElements.forEach(imageEl => { 5318 if (imageEl.complete) { 5319 processLazyPreloader(swiper, imageEl); 5320 } else { 5321 imageEl.addEventListener('load', e => { 5322 processLazyPreloader(swiper, e.target); 5323 }); 5324 } 5325 }); 5326 preload(swiper); 5327 5328 // Init Flag 5329 swiper.initialized = true; 5330 preload(swiper); 5331 5332 // Emit 5333 swiper.emit('init'); 5334 swiper.emit('afterInit'); 5335 return swiper; 5336 } 5337 destroy(deleteInstance, cleanStyles) { 5338 if (deleteInstance === void 0) { 5339 deleteInstance = true; 5340 } 5341 if (cleanStyles === void 0) { 5342 cleanStyles = true; 5343 } 5344 const swiper = this; 5345 const { 5346 params, 5347 el, 5348 wrapperEl, 5349 slides 5350 } = swiper; 5351 if (typeof swiper.params === 'undefined' || swiper.destroyed) { 5352 return null; 5353 } 5354 swiper.emit('beforeDestroy'); 5355 5356 // Init Flag 5357 swiper.initialized = false; 5358 5359 // Detach events 5360 swiper.detachEvents(); 5361 5362 // Destroy loop 5363 if (params.loop) { 5364 swiper.loopDestroy(); 5365 } 5366 5367 // Cleanup styles 5368 if (cleanStyles) { 5369 swiper.removeClasses(); 5370 if (el && typeof el !== 'string') { 5371 el.removeAttribute('style'); 5372 } 5373 if (wrapperEl) { 5374 wrapperEl.removeAttribute('style'); 5375 } 5376 if (slides && slides.length) {
vendor: 11,578 bytes, lines 5377-5729
5377 slides.forEach(slideEl => { 5378 slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass); 5379 slideEl.removeAttribute('style'); 5380 slideEl.removeAttribute('data-swiper-slide-index'); 5381 }); 5382 } 5383 } 5384 swiper.emit('destroy'); 5385 5386 // Detach emitter events 5387 Object.keys(swiper.eventsListeners).forEach(eventName => { 5388 swiper.off(eventName); 5389 }); 5390 if (deleteInstance !== false) { 5391 if (swiper.el && typeof swiper.el !== 'string') { 5392 swiper.el.swiper = null; 5393 } 5394 deleteProps(swiper); 5395 } 5396 swiper.destroyed = true; 5397 return null; 5398 } 5399 static extendDefaults(newDefaults) { 5400 extend(extendedDefaults, newDefaults); 5401 } 5402 static get extendedDefaults() { 5403 return extendedDefaults; 5404 } 5405 static get defaults() { 5406 return defaults; 5407 } 5408 static installModule(mod) { 5409 if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = []; 5410 const modules = Swiper.prototype.__modules__; 5411 if (typeof mod === 'function' && modules.indexOf(mod) < 0) { 5412 modules.push(mod); 5413 } 5414 } 5415 static use(module) { 5416 if (Array.isArray(module)) { 5417 module.forEach(m => Swiper.installModule(m)); 5418 return Swiper; 5419 } 5420 Swiper.installModule(module); 5421 return Swiper; 5422 } 5423 } 5424 Object.keys(prototypes).forEach(prototypeGroup => { 5425 Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => { 5426 Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; 5427 }); 5428 }); 5429 Swiper.use([Resize, Observer]); 5430 5431 function createElementIfNotDefined(swiper, originalParams, params, checkProps) { 5432 if (swiper.params.createElements) { 5433 Object.keys(checkProps).forEach(key => { 5434 if (!params[key] && params.auto === true) { 5435 let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0]; 5436 if (!element) { 5437 element = createElement('div', checkProps[key]); 5438 element.className = checkProps[key]; 5439 swiper.el.append(element); 5440 } 5441 params[key] = element; 5442 originalParams[key] = element; 5443 } 5444 }); 5445 } 5446 return params; 5447 } 5448 5449 function Navigation(_ref) { 5450 let { 5451 swiper, 5452 extendParams, 5453 on, 5454 emit 5455 } = _ref; 5456 extendParams({ 5457 navigation: { 5458 nextEl: null, 5459 prevEl: null, 5460 hideOnClick: false, 5461 disabledClass: 'swiper-button-disabled', 5462 hiddenClass: 'swiper-button-hidden', 5463 lockClass: 'swiper-button-lock', 5464 navigationDisabledClass: 'swiper-navigation-disabled' 5465 } 5466 }); 5467 swiper.navigation = { 5468 nextEl: null, 5469 prevEl: null 5470 }; 5471 function getEl(el) { 5472 let res; 5473 if (el && typeof el === 'string' && swiper.isElement) { 5474 res = swiper.el.querySelector(el); 5475 if (res) return res; 5476 } 5477 if (el) { 5478 if (typeof el === 'string') res = [...document.querySelectorAll(el)]; 5479 if (swiper.params.uniqueNavElements && typeof el === 'string' && res && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) { 5480 res = swiper.el.querySelector(el); 5481 } else if (res && res.length === 1) { 5482 res = res[0]; 5483 } 5484 } 5485 if (el && !res) return el; 5486 // if (Array.isArray(res) && res.length === 1) res = res[0]; 5487 return res; 5488 } 5489 function toggleEl(el, disabled) { 5490 const params = swiper.params.navigation; 5491 el = makeElementsArray(el); 5492 el.forEach(subEl => { 5493 if (subEl) { 5494 subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' ')); 5495 if (subEl.tagName === 'BUTTON') subEl.disabled = disabled; 5496 if (swiper.params.watchOverflow && swiper.enabled) { 5497 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass); 5498 } 5499 } 5500 }); 5501 } 5502 function update() { 5503 // Update Navigation Buttons 5504 const { 5505 nextEl, 5506 prevEl 5507 } = swiper.navigation; 5508 if (swiper.params.loop) { 5509 toggleEl(prevEl, false); 5510 toggleEl(nextEl, false); 5511 return; 5512 } 5513 toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind); 5514 toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind); 5515 } 5516 function onPrevClick(e) { 5517 e.preventDefault(); 5518 if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return; 5519 swiper.slidePrev(); 5520 emit('navigationPrev'); 5521 } 5522 function onNextClick(e) { 5523 e.preventDefault(); 5524 if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return; 5525 swiper.slideNext(); 5526 emit('navigationNext'); 5527 } 5528 function init() { 5529 const params = swiper.params.navigation; 5530 swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, { 5531 nextEl: 'swiper-button-next', 5532 prevEl: 'swiper-button-prev' 5533 }); 5534 if (!(params.nextEl || params.prevEl)) return; 5535 let nextEl = getEl(params.nextEl); 5536 let prevEl = getEl(params.prevEl); 5537 Object.assign(swiper.navigation, { 5538 nextEl, 5539 prevEl 5540 }); 5541 nextEl = makeElementsArray(nextEl); 5542 prevEl = makeElementsArray(prevEl); 5543 const initButton = (el, dir) => { 5544 if (el) { 5545 el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick); 5546 } 5547 if (!swiper.enabled && el) { 5548 el.classList.add(...params.lockClass.split(' ')); 5549 } 5550 }; 5551 nextEl.forEach(el => initButton(el, 'next')); 5552 prevEl.forEach(el => initButton(el, 'prev')); 5553 } 5554 function destroy() { 5555 let { 5556 nextEl, 5557 prevEl 5558 } = swiper.navigation; 5559 nextEl = makeElementsArray(nextEl); 5560 prevEl = makeElementsArray(prevEl); 5561 const destroyButton = (el, dir) => { 5562 el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick); 5563 el.classList.remove(...swiper.params.navigation.disabledClass.split(' ')); 5564 }; 5565 nextEl.forEach(el => destroyButton(el, 'next')); 5566 prevEl.forEach(el => destroyButton(el, 'prev')); 5567 } 5568 on('init', () => { 5569 if (swiper.params.navigation.enabled === false) { 5570 // eslint-disable-next-line 5571 disable(); 5572 } else { 5573 init(); 5574 update(); 5575 } 5576 }); 5577 on('toEdge fromEdge lock unlock', () => { 5578 update(); 5579 }); 5580 on('destroy', () => { 5581 destroy(); 5582 }); 5583 on('enable disable', () => { 5584 let { 5585 nextEl, 5586 prevEl 5587 } = swiper.navigation; 5588 nextEl = makeElementsArray(nextEl); 5589 prevEl = makeElementsArray(prevEl); 5590 if (swiper.enabled) { 5591 update(); 5592 return; 5593 } 5594 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.add(swiper.params.navigation.lockClass)); 5595 }); 5596 on('click', (_s, e) => { 5597 let { 5598 nextEl, 5599 prevEl 5600 } = swiper.navigation; 5601 nextEl = makeElementsArray(nextEl); 5602 prevEl = makeElementsArray(prevEl); 5603 const targetEl = e.target; 5604 let targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl); 5605 if (swiper.isElement && !targetIsButton) { 5606 const path = e.path || e.composedPath && e.composedPath(); 5607 if (path) { 5608 targetIsButton = path.find(pathEl => nextEl.includes(pathEl) || prevEl.includes(pathEl)); 5609 } 5610 } 5611 if (swiper.params.navigation.hideOnClick && !targetIsButton) { 5612 if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; 5613 let isHidden; 5614 if (nextEl.length) { 5615 isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass); 5616 } else if (prevEl.length) { 5617 isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass); 5618 } 5619 if (isHidden === true) { 5620 emit('navigationShow'); 5621 } else { 5622 emit('navigationHide'); 5623 } 5624 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass)); 5625 } 5626 }); 5627 const enable = () => { 5628 swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' ')); 5629 init(); 5630 update(); 5631 }; 5632 const disable = () => { 5633 swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' ')); 5634 destroy(); 5635 }; 5636 Object.assign(swiper.navigation, { 5637 enable, 5638 disable, 5639 update, 5640 init, 5641 destroy 5642 }); 5643 } 5644 5645 function classesToSelector(classes) { 5646 if (classes === void 0) { 5647 classes = ''; 5648 } 5649 return `.${classes.trim().replace(/([\.:!+\/])/g, '\\$1') // eslint-disable-line 5650 .replace(/ /g, '.')}`; 5651 } 5652 5653 function Pagination(_ref) { 5654 let { 5655 swiper, 5656 extendParams, 5657 on, 5658 emit 5659 } = _ref; 5660 const pfx = 'swiper-pagination'; 5661 extendParams({ 5662 pagination: { 5663 el: null, 5664 bulletElement: 'span', 5665 clickable: false, 5666 hideOnClick: false, 5667 renderBullet: null, 5668 renderProgressbar: null, 5669 renderFraction: null, 5670 renderCustom: null, 5671 progressbarOpposite: false, 5672 type: 'bullets', 5673 // 'bullets' or 'progressbar' or 'fraction' or 'custom' 5674 dynamicBullets: false, 5675 dynamicMainBullets: 1, 5676 formatFractionCurrent: number => number, 5677 formatFractionTotal: number => number, 5678 bulletClass: `${pfx}-bullet`, 5679 bulletActiveClass: `${pfx}-bullet-active`, 5680 modifierClass: `${pfx}-`, 5681 currentClass: `${pfx}-current`, 5682 totalClass: `${pfx}-total`, 5683 hiddenClass: `${pfx}-hidden`, 5684 progressbarFillClass: `${pfx}-progressbar-fill`, 5685 progressbarOppositeClass: `${pfx}-progressbar-opposite`, 5686 clickableClass: `${pfx}-clickable`, 5687 lockClass: `${pfx}-lock`, 5688 horizontalClass: `${pfx}-horizontal`, 5689 verticalClass: `${pfx}-vertical`, 5690 paginationDisabledClass: `${pfx}-disabled` 5691 } 5692 }); 5693 swiper.pagination = { 5694 el: null, 5695 bullets: [] 5696 }; 5697 let bulletSize; 5698 let dynamicBulletIndex = 0; 5699 function isPaginationDisabled() { 5700 return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0; 5701 } 5702 function setSideBullets(bulletEl, position) { 5703 const { 5704 bulletActiveClass 5705 } = swiper.params.pagination; 5706 if (!bulletEl) return; 5707 bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`]; 5708 if (bulletEl) { 5709 bulletEl.classList.add(`${bulletActiveClass}-${position}`); 5710 bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`]; 5711 if (bulletEl) { 5712 bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`); 5713 } 5714 } 5715 } 5716 function onBulletClick(e) { 5717 const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass)); 5718 if (!bulletEl) { 5719 return; 5720 } 5721 e.preventDefault(); 5722 const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup; 5723 if (swiper.params.loop) { 5724 if (swiper.realIndex === index) return; 5725 swiper.slideToLoop(index); 5726 } else { 5727 swiper.slideTo(index); 5728 } 5729 }
vendor: 14,725 bytes, lines 5730-6080
5730 function update() { 5731 // Render || Update Pagination bullets/items 5732 const rtl = swiper.rtl; 5733 const params = swiper.params.pagination; 5734 if (isPaginationDisabled()) return; 5735 let el = swiper.pagination.el; 5736 el = makeElementsArray(el); 5737 // Current/Total 5738 let current; 5739 let previousIndex; 5740 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 5741 const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 5742 if (swiper.params.loop) { 5743 previousIndex = swiper.previousRealIndex || 0; 5744 current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex; 5745 } else if (typeof swiper.snapIndex !== 'undefined') { 5746 current = swiper.snapIndex; 5747 previousIndex = swiper.previousSnapIndex; 5748 } else { 5749 previousIndex = swiper.previousIndex || 0; 5750 current = swiper.activeIndex || 0; 5751 } 5752 // Types 5753 if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { 5754 const bullets = swiper.pagination.bullets; 5755 let firstIndex; 5756 let lastIndex; 5757 let midIndex; 5758 if (params.dynamicBullets) { 5759 bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true); 5760 el.forEach(subEl => { 5761 subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`; 5762 }); 5763 if (params.dynamicMainBullets > 1 && previousIndex !== undefined) { 5764 dynamicBulletIndex += current - (previousIndex || 0); 5765 if (dynamicBulletIndex > params.dynamicMainBullets - 1) { 5766 dynamicBulletIndex = params.dynamicMainBullets - 1; 5767 } else if (dynamicBulletIndex < 0) { 5768 dynamicBulletIndex = 0; 5769 } 5770 } 5771 firstIndex = Math.max(current - dynamicBulletIndex, 0); 5772 lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); 5773 midIndex = (lastIndex + firstIndex) / 2; 5774 } 5775 bullets.forEach(bulletEl => { 5776 const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat(); 5777 bulletEl.classList.remove(...classesToRemove); 5778 }); 5779 if (el.length > 1) { 5780 bullets.forEach(bullet => { 5781 const bulletIndex = elementIndex(bullet); 5782 if (bulletIndex === current) { 5783 bullet.classList.add(...params.bulletActiveClass.split(' ')); 5784 } else if (swiper.isElement) { 5785 bullet.setAttribute('part', 'bullet'); 5786 } 5787 if (params.dynamicBullets) { 5788 if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { 5789 bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' ')); 5790 } 5791 if (bulletIndex === firstIndex) { 5792 setSideBullets(bullet, 'prev'); 5793 } 5794 if (bulletIndex === lastIndex) { 5795 setSideBullets(bullet, 'next'); 5796 } 5797 } 5798 }); 5799 } else { 5800 const bullet = bullets[current]; 5801 if (bullet) { 5802 bullet.classList.add(...params.bulletActiveClass.split(' ')); 5803 } 5804 if (swiper.isElement) { 5805 bullets.forEach((bulletEl, bulletIndex) => { 5806 bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet'); 5807 }); 5808 } 5809 if (params.dynamicBullets) { 5810 const firstDisplayedBullet = bullets[firstIndex]; 5811 const lastDisplayedBullet = bullets[lastIndex]; 5812 for (let i = firstIndex; i <= lastIndex; i += 1) { 5813 if (bullets[i]) { 5814 bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' ')); 5815 } 5816 } 5817 setSideBullets(firstDisplayedBullet, 'prev'); 5818 setSideBullets(lastDisplayedBullet, 'next'); 5819 } 5820 } 5821 if (params.dynamicBullets) { 5822 const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); 5823 const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; 5824 const offsetProp = rtl ? 'right' : 'left'; 5825 bullets.forEach(bullet => { 5826 bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`; 5827 }); 5828 } 5829 } 5830 el.forEach((subEl, subElIndex) => { 5831 if (params.type === 'fraction') { 5832 subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => { 5833 fractionEl.textContent = params.formatFractionCurrent(current + 1); 5834 }); 5835 subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => { 5836 totalEl.textContent = params.formatFractionTotal(total); 5837 }); 5838 } 5839 if (params.type === 'progressbar') { 5840 let progressbarDirection; 5841 if (params.progressbarOpposite) { 5842 progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; 5843 } else { 5844 progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; 5845 } 5846 const scale = (current + 1) / total; 5847 let scaleX = 1; 5848 let scaleY = 1; 5849 if (progressbarDirection === 'horizontal') { 5850 scaleX = scale; 5851 } else { 5852 scaleY = scale; 5853 } 5854 subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => { 5855 progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`; 5856 progressEl.style.transitionDuration = `${swiper.params.speed}ms`; 5857 }); 5858 } 5859 if (params.type === 'custom' && params.renderCustom) { 5860 subEl.innerHTML = params.renderCustom(swiper, current + 1, total); 5861 if (subElIndex === 0) emit('paginationRender', subEl); 5862 } else { 5863 if (subElIndex === 0) emit('paginationRender', subEl); 5864 emit('paginationUpdate', subEl); 5865 } 5866 if (swiper.params.watchOverflow && swiper.enabled) { 5867 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass); 5868 } 5869 }); 5870 } 5871 function render() { 5872 // Render Container 5873 const params = swiper.params.pagination; 5874 if (isPaginationDisabled()) return; 5875 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.grid && swiper.params.grid.rows > 1 ? swiper.slides.length / Math.ceil(swiper.params.grid.rows) : swiper.slides.length; 5876 let el = swiper.pagination.el; 5877 el = makeElementsArray(el); 5878 let paginationHTML = ''; 5879 if (params.type === 'bullets') { 5880 let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 5881 if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) { 5882 numberOfBullets = slidesLength; 5883 } 5884 for (let i = 0; i < numberOfBullets; i += 1) { 5885 if (params.renderBullet) { 5886 paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); 5887 } else { 5888 // prettier-ignore 5889 paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ''} class="${params.bulletClass}"></${params.bulletElement}>`; 5890 } 5891 } 5892 } 5893 if (params.type === 'fraction') { 5894 if (params.renderFraction) { 5895 paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); 5896 } else { 5897 paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`; 5898 } 5899 } 5900 if (params.type === 'progressbar') { 5901 if (params.renderProgressbar) { 5902 paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); 5903 } else { 5904 paginationHTML = `<span class="${params.progressbarFillClass}"></span>`; 5905 } 5906 } 5907 swiper.pagination.bullets = []; 5908 el.forEach(subEl => { 5909 if (params.type !== 'custom') { 5910 subEl.innerHTML = paginationHTML || ''; 5911 } 5912 if (params.type === 'bullets') { 5913 swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass))); 5914 } 5915 }); 5916 if (params.type !== 'custom') { 5917 emit('paginationRender', el[0]); 5918 } 5919 } 5920 function init() { 5921 swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, { 5922 el: 'swiper-pagination' 5923 }); 5924 const params = swiper.params.pagination; 5925 if (!params.el) return; 5926 let el; 5927 if (typeof params.el === 'string' && swiper.isElement) { 5928 el = swiper.el.querySelector(params.el); 5929 } 5930 if (!el && typeof params.el === 'string') { 5931 el = [...document.querySelectorAll(params.el)]; 5932 } 5933 if (!el) { 5934 el = params.el; 5935 } 5936 if (!el || el.length === 0) return; 5937 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) { 5938 el = [...swiper.el.querySelectorAll(params.el)]; 5939 // check if it belongs to another nested Swiper 5940 if (el.length > 1) { 5941 el = el.filter(subEl => { 5942 if (elementParents(subEl, '.swiper')[0] !== swiper.el) return false; 5943 return true; 5944 })[0]; 5945 } 5946 } 5947 if (Array.isArray(el) && el.length === 1) el = el[0]; 5948 Object.assign(swiper.pagination, { 5949 el 5950 }); 5951 el = makeElementsArray(el); 5952 el.forEach(subEl => { 5953 if (params.type === 'bullets' && params.clickable) { 5954 subEl.classList.add(...(params.clickableClass || '').split(' ')); 5955 } 5956 subEl.classList.add(params.modifierClass + params.type); 5957 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 5958 if (params.type === 'bullets' && params.dynamicBullets) { 5959 subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`); 5960 dynamicBulletIndex = 0; 5961 if (params.dynamicMainBullets < 1) { 5962 params.dynamicMainBullets = 1; 5963 } 5964 } 5965 if (params.type === 'progressbar' && params.progressbarOpposite) { 5966 subEl.classList.add(params.progressbarOppositeClass); 5967 } 5968 if (params.clickable) { 5969 subEl.addEventListener('click', onBulletClick); 5970 } 5971 if (!swiper.enabled) { 5972 subEl.classList.add(params.lockClass); 5973 } 5974 }); 5975 } 5976 function destroy() { 5977 const params = swiper.params.pagination; 5978 if (isPaginationDisabled()) return; 5979 let el = swiper.pagination.el; 5980 if (el) { 5981 el = makeElementsArray(el); 5982 el.forEach(subEl => { 5983 subEl.classList.remove(params.hiddenClass); 5984 subEl.classList.remove(params.modifierClass + params.type); 5985 subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 5986 if (params.clickable) { 5987 subEl.classList.remove(...(params.clickableClass || '').split(' ')); 5988 subEl.removeEventListener('click', onBulletClick); 5989 } 5990 }); 5991 } 5992 if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' '))); 5993 } 5994 on('changeDirection', () => { 5995 if (!swiper.pagination || !swiper.pagination.el) return; 5996 const params = swiper.params.pagination; 5997 let { 5998 el 5999 } = swiper.pagination; 6000 el = makeElementsArray(el); 6001 el.forEach(subEl => { 6002 subEl.classList.remove(params.horizontalClass, params.verticalClass); 6003 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 6004 }); 6005 }); 6006 on('init', () => { 6007 if (swiper.params.pagination.enabled === false) { 6008 // eslint-disable-next-line 6009 disable(); 6010 } else { 6011 init(); 6012 render(); 6013 update(); 6014 } 6015 }); 6016 on('activeIndexChange', () => { 6017 if (typeof swiper.snapIndex === 'undefined') { 6018 update(); 6019 } 6020 }); 6021 on('snapIndexChange', () => { 6022 update(); 6023 }); 6024 on('snapGridLengthChange', () => { 6025 render(); 6026 update(); 6027 }); 6028 on('destroy', () => { 6029 destroy(); 6030 }); 6031 on('enable disable', () => { 6032 let { 6033 el 6034 } = swiper.pagination; 6035 if (el) { 6036 el = makeElementsArray(el); 6037 el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass)); 6038 } 6039 }); 6040 on('lock unlock', () => { 6041 update(); 6042 }); 6043 on('click', (_s, e) => { 6044 const targetEl = e.target; 6045 const el = makeElementsArray(swiper.pagination.el); 6046 if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) { 6047 if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; 6048 const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass); 6049 if (isHidden === true) { 6050 emit('paginationShow'); 6051 } else { 6052 emit('paginationHide'); 6053 } 6054 el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass)); 6055 } 6056 }); 6057 const enable = () => { 6058 swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass); 6059 let { 6060 el 6061 } = swiper.pagination; 6062 if (el) { 6063 el = makeElementsArray(el); 6064 el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass)); 6065 } 6066 init(); 6067 render(); 6068 update(); 6069 }; 6070 const disable = () => { 6071 swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass); 6072 let { 6073 el 6074 } = swiper.pagination; 6075 if (el) { 6076 el = makeElementsArray(el); 6077 el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass)); 6078 } 6079 destroy(); 6080 };
vendor: 4,842 bytes, lines 6081-6227
6081 Object.assign(swiper.pagination, { 6082 enable, 6083 disable, 6084 render, 6085 update, 6086 init, 6087 destroy 6088 }); 6089 } 6090 6091 /* eslint no-underscore-dangle: "off" */ 6092 /* eslint no-use-before-define: "off" */ 6093 function Autoplay(_ref) { 6094 let { 6095 swiper, 6096 extendParams, 6097 on, 6098 emit, 6099 params 6100 } = _ref; 6101 swiper.autoplay = { 6102 running: false, 6103 paused: false, 6104 timeLeft: 0 6105 }; 6106 extendParams({ 6107 autoplay: { 6108 enabled: false, 6109 delay: 3000, 6110 waitForTransition: true, 6111 disableOnInteraction: false, 6112 stopOnLastSlide: false, 6113 reverseDirection: false, 6114 pauseOnMouseEnter: false 6115 } 6116 }); 6117 let timeout; 6118 let raf; 6119 let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000; 6120 let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000; 6121 let autoplayTimeLeft; 6122 let autoplayStartTime = new Date().getTime(); 6123 let wasPaused; 6124 let isTouched; 6125 let pausedByTouch; 6126 let touchStartTimeout; 6127 let slideChanged; 6128 let pausedByInteraction; 6129 let pausedByPointerEnter; 6130 function onTransitionEnd(e) { 6131 if (!swiper || swiper.destroyed || !swiper.wrapperEl) return; 6132 if (e.target !== swiper.wrapperEl) return; 6133 swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd); 6134 if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) { 6135 return; 6136 } 6137 resume(); 6138 } 6139 const calcTimeLeft = () => { 6140 if (swiper.destroyed || !swiper.autoplay.running) return; 6141 if (swiper.autoplay.paused) { 6142 wasPaused = true; 6143 } else if (wasPaused) { 6144 autoplayDelayCurrent = autoplayTimeLeft; 6145 wasPaused = false; 6146 } 6147 const timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - new Date().getTime(); 6148 swiper.autoplay.timeLeft = timeLeft; 6149 emit('autoplayTimeLeft', timeLeft, timeLeft / autoplayDelayTotal); 6150 raf = requestAnimationFrame(() => { 6151 calcTimeLeft(); 6152 }); 6153 }; 6154 const getSlideDelay = () => { 6155 let activeSlideEl; 6156 if (swiper.virtual && swiper.params.virtual.enabled) { 6157 activeSlideEl = swiper.slides.filter(slideEl => slideEl.classList.contains('swiper-slide-active'))[0]; 6158 } else { 6159 activeSlideEl = swiper.slides[swiper.activeIndex]; 6160 } 6161 if (!activeSlideEl) return undefined; 6162 const currentSlideDelay = parseInt(activeSlideEl.getAttribute('data-swiper-autoplay'), 10); 6163 return currentSlideDelay; 6164 }; 6165 const run = delayForce => { 6166 if (swiper.destroyed || !swiper.autoplay.running) return; 6167 cancelAnimationFrame(raf); 6168 calcTimeLeft(); 6169 let delay = typeof delayForce === 'undefined' ? swiper.params.autoplay.delay : delayForce; 6170 autoplayDelayTotal = swiper.params.autoplay.delay; 6171 autoplayDelayCurrent = swiper.params.autoplay.delay; 6172 const currentSlideDelay = getSlideDelay(); 6173 if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0 && typeof delayForce === 'undefined') { 6174 delay = currentSlideDelay; 6175 autoplayDelayTotal = currentSlideDelay; 6176 autoplayDelayCurrent = currentSlideDelay; 6177 } 6178 autoplayTimeLeft = delay; 6179 const speed = swiper.params.speed; 6180 const proceed = () => { 6181 if (!swiper || swiper.destroyed) return; 6182 if (swiper.params.autoplay.reverseDirection) { 6183 if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) { 6184 swiper.slidePrev(speed, true, true); 6185 emit('autoplay'); 6186 } else if (!swiper.params.autoplay.stopOnLastSlide) { 6187 swiper.slideTo(swiper.slides.length - 1, speed, true, true); 6188 emit('autoplay'); 6189 } 6190 } else { 6191 if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) { 6192 swiper.slideNext(speed, true, true); 6193 emit('autoplay'); 6194 } else if (!swiper.params.autoplay.stopOnLastSlide) { 6195 swiper.slideTo(0, speed, true, true); 6196 emit('autoplay'); 6197 } 6198 } 6199 if (swiper.params.cssMode) { 6200 autoplayStartTime = new Date().getTime(); 6201 requestAnimationFrame(() => { 6202 run(); 6203 }); 6204 } 6205 }; 6206 if (delay > 0) { 6207 clearTimeout(timeout); 6208 timeout = setTimeout(() => { 6209 proceed(); 6210 }, delay); 6211 } else { 6212 requestAnimationFrame(() => { 6213 proceed(); 6214 }); 6215 } 6216 6217 // eslint-disable-next-line 6218 return delay; 6219 }; 6220 const start = () => { 6221 autoplayStartTime = new Date().getTime(); 6222 swiper.autoplay.running = true; 6223 run(); 6224 emit('autoplayStart'); 6225 }; 6226 const stop = () => { 6227 swiper.autoplay.running = false;
vendor: 4,203 bytes, lines 6228-6359
6228 clearTimeout(timeout); 6229 cancelAnimationFrame(raf); 6230 emit('autoplayStop'); 6231 }; 6232 const pause = (internal, reset) => { 6233 if (swiper.destroyed || !swiper.autoplay.running) return; 6234 clearTimeout(timeout); 6235 if (!internal) { 6236 pausedByInteraction = true; 6237 } 6238 const proceed = () => { 6239 emit('autoplayPause'); 6240 if (swiper.params.autoplay.waitForTransition) { 6241 swiper.wrapperEl.addEventListener('transitionend', onTransitionEnd); 6242 } else { 6243 resume(); 6244 } 6245 }; 6246 swiper.autoplay.paused = true; 6247 if (reset) { 6248 if (slideChanged) { 6249 autoplayTimeLeft = swiper.params.autoplay.delay; 6250 } 6251 slideChanged = false; 6252 proceed(); 6253 return; 6254 } 6255 const delay = autoplayTimeLeft || swiper.params.autoplay.delay; 6256 autoplayTimeLeft = delay - (new Date().getTime() - autoplayStartTime); 6257 if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return; 6258 if (autoplayTimeLeft < 0) autoplayTimeLeft = 0; 6259 proceed(); 6260 }; 6261 const resume = () => { 6262 if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return; 6263 autoplayStartTime = new Date().getTime(); 6264 if (pausedByInteraction) { 6265 pausedByInteraction = false; 6266 run(autoplayTimeLeft); 6267 } else { 6268 run(); 6269 } 6270 swiper.autoplay.paused = false; 6271 emit('autoplayResume'); 6272 }; 6273 const onVisibilityChange = () => { 6274 if (swiper.destroyed || !swiper.autoplay.running) return; 6275 const document = getDocument(); 6276 if (document.visibilityState === 'hidden') { 6277 pausedByInteraction = true; 6278 pause(true); 6279 } 6280 if (document.visibilityState === 'visible') { 6281 resume(); 6282 } 6283 }; 6284 const onPointerEnter = e => { 6285 if (e.pointerType !== 'mouse') return; 6286 pausedByInteraction = true; 6287 pausedByPointerEnter = true; 6288 if (swiper.animating || swiper.autoplay.paused) return; 6289 pause(true); 6290 }; 6291 const onPointerLeave = e => { 6292 if (e.pointerType !== 'mouse') return; 6293 pausedByPointerEnter = false; 6294 if (swiper.autoplay.paused) { 6295 resume(); 6296 } 6297 }; 6298 const attachMouseEvents = () => { 6299 if (swiper.params.autoplay.pauseOnMouseEnter) { 6300 swiper.el.addEventListener('pointerenter', onPointerEnter); 6301 swiper.el.addEventListener('pointerleave', onPointerLeave); 6302 } 6303 }; 6304 const detachMouseEvents = () => { 6305 if (swiper.el && typeof swiper.el !== 'string') { 6306 swiper.el.removeEventListener('pointerenter', onPointerEnter); 6307 swiper.el.removeEventListener('pointerleave', onPointerLeave); 6308 } 6309 }; 6310 const attachDocumentEvents = () => { 6311 const document = getDocument(); 6312 document.addEventListener('visibilitychange', onVisibilityChange); 6313 }; 6314 const detachDocumentEvents = () => { 6315 const document = getDocument(); 6316 document.removeEventListener('visibilitychange', onVisibilityChange); 6317 }; 6318 on('init', () => { 6319 if (swiper.params.autoplay.enabled) { 6320 attachMouseEvents(); 6321 attachDocumentEvents(); 6322 start(); 6323 } 6324 }); 6325 on('destroy', () => { 6326 detachMouseEvents(); 6327 detachDocumentEvents(); 6328 if (swiper.autoplay.running) { 6329 stop(); 6330 } 6331 }); 6332 on('_freeModeStaticRelease', () => { 6333 if (pausedByTouch || pausedByInteraction) { 6334 resume(); 6335 } 6336 }); 6337 on('_freeModeNoMomentumRelease', () => { 6338 if (!swiper.params.autoplay.disableOnInteraction) { 6339 pause(true, true); 6340 } else { 6341 stop(); 6342 } 6343 }); 6344 on('beforeTransitionStart', (_s, speed, internal) => { 6345 if (swiper.destroyed || !swiper.autoplay.running) return; 6346 if (internal || !swiper.params.autoplay.disableOnInteraction) { 6347 pause(true, true); 6348 } else { 6349 stop(); 6350 } 6351 }); 6352 on('sliderFirstMove', () => { 6353 if (swiper.destroyed || !swiper.autoplay.running) return; 6354 if (swiper.params.autoplay.disableOnInteraction) { 6355 stop(); 6356 return; 6357 } 6358 isTouched = true; 6359 pausedByTouch = false;
6360 pausedByInteraction = false; 6361 touchStartTimeout = setTimeout(() => { 6362 pausedByInteraction = true; 6363 pausedByTouch = true; 6364 pause(true); 6365 }, 200); 6366 }); 6367 on('touchEnd', () => { 6368 if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return; 6369 clearTimeout(touchStartTimeout); 6370 clearTimeout(timeout); 6371 if (swiper.params.autoplay.disableOnInteraction) { 6372 pausedByTouch = false; 6373 isTouched = false; 6374 return; 6375 } 6376 if (pausedByTouch && swiper.params.cssMode) resume(); 6377 pausedByTouch = false; 6378 isTouched = false; 6379 }); 6380 on('slideChange', () => { 6381 if (swiper.destroyed || !swiper.autoplay.running) return; 6382 slideChanged = true; 6383 }); 6384 Object.assign(swiper.autoplay, { 6385 start, 6386 stop, 6387 pause, 6388 resume 6389 }); 6390 } 6391 6392 /** 6393 * Swiper 11.1.4 6394 * Most modern mobile touch slider and framework with hardware accelerated transitions 6395 * https://swiperjs.com 6396 * 6397 * Copyright 2014-2024 Vladimir Kharlampidi 6398 * 6399 * Released under the MIT License 6400 * 6401 * Released on: July 8, 2024 6402 */ 6403 6404 6405 // Swiper Class 6406 const modules = [Navigation, Pagination, Autoplay]; 6407 Swiper.use(modules); 6408 6409 return Swiper; 6410 6411})(); 6412 6413/*! rangeslider.js - v2.3.2 | (c) 2018 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */ 6414(function(factory) { 6415 'use strict'; 6416 6417 if (typeof define === 'function' && define.amd) { 6418 // AMD. Register as an anonymous module. 6419 define(['jquery'], factory); 6420 } else if (typeof exports === 'object') { 6421 // CommonJS 6422 module.exports = factory(require('jquery')); 6423 } else { 6424 // Browser globals 6425 factory(jQuery); 6426 } 6427}(function($) { 6428 'use strict'; 6429 6430 // Polyfill Number.isNaN(value) 6431 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN 6432 Number.isNaN = Number.isNaN || function(value) { 6433 return typeof value === 'number' && value !== value; 6434 }; 6435 6436 /** 6437 * Range feature detection 6438 * @return {Boolean} 6439 */ 6440 function supportsRange() { 6441 var input = document.createElement('input'); 6442 input.setAttribute('type', 'range'); 6443 return input.type !== 'text'; 6444 } 6445 6446 var pluginName = 'rangeslider', 6447 pluginIdentifier = 0, 6448 hasInputRangeSupport = supportsRange(), 6449 defaults = { 6450 polyfill: true, 6451 orientation: 'horizontal', 6452 rangeClass: 'rangeslider', 6453 disabledClass: 'rangeslider--disabled', 6454 activeClass: 'rangeslider--active', 6455 horizontalClass: 'rangeslider--horizontal', 6456 verticalClass: 'rangeslider--vertical', 6457 fillClass: 'rangeslider__fill', 6458 handleClass: 'rangeslider__handle', 6459 startEvent: ['mousedown', 'touchstart', 'pointerdown'], 6460 moveEvent: ['mousemove', 'touchmove', 'pointermove'], 6461 endEvent: ['mouseup', 'touchend', 'pointerup'] 6462 }, 6463 constants = { 6464 orientation: { 6465 horizontal: { 6466 dimension: 'width', 6467 direction: 'left', 6468 directionStyle: 'left', 6469 coordinate: 'x' 6470 }, 6471 vertical: { 6472 dimension: 'height', 6473 direction: 'top', 6474 directionStyle: 'bottom', 6475 coordinate: 'y' 6476 } 6477 } 6478 }; 6479 6480 /** 6481 * Delays a function for the given number of milliseconds, and then calls 6482 * it with the arguments supplied. 6483 * 6484 * @param {Function} fn [description] 6485 * @param {Number} wait [description] 6486 * @return {Function} 6487 */ 6488 function delay(fn, wait) { 6489 var args = Array.prototype.slice.call(arguments, 2); 6490 return setTimeout(function(){ return fn.apply(null, args); }, wait); 6491 } 6492 6493 /** 6494 * Returns a debounced function that will make sure the given 6495 * function is not triggered too much. 6496 * 6497 * @param {Function} fn Function to debounce. 6498 * @param {Number} debounceDuration OPTIONAL. The amount of time in milliseconds for which we will debounce the function. (defaults to 100ms) 6499 * @return {Function} 6500 */ 6501 function debounce(fn, debounceDuration) { 6502 debounceDuration = debounceDuration || 100; 6503 return function() { 6504 if (!fn.debouncing) { 6505 var args = Array.prototype.slice.apply(arguments); 6506 fn.lastReturnVal = fn.apply(window, args); 6507 fn.debouncing = true; 6508 } 6509 clearTimeout(fn.debounceTimeout); 6510 fn.debounceTimeout = setTimeout(function(){ 6511 fn.debouncing = false;
6512 }, debounceDuration); 6513 return fn.lastReturnVal; 6514 }; 6515 } 6516 6517 /** 6518 * Check if a `element` is visible in the DOM 6519 * 6520 * @param {Element} element 6521 * @return {Boolean} 6522 */ 6523 function isHidden(element) { 6524 return ( 6525 element && ( 6526 element.offsetWidth === 0 || 6527 element.offsetHeight === 0 || 6528 // Also Consider native `<details>` elements. 6529 element.open === false 6530 ) 6531 ); 6532 } 6533 6534 /** 6535 * Get hidden parentNodes of an `element` 6536 * 6537 * @param {Element} element 6538 * @return {[type]} 6539 */ 6540 function getHiddenParentNodes(element) { 6541 var parents = [], 6542 node = element.parentNode; 6543 6544 while (isHidden(node)) { 6545 parents.push(node); 6546 node = node.parentNode; 6547 } 6548 return parents; 6549 } 6550 6551 /** 6552 * Returns dimensions for an element even if it is not visible in the DOM. 6553 * 6554 * @param {Element} element 6555 * @param {String} key (e.g. offsetWidth …) 6556 * @return {Number} 6557 */ 6558 function getDimension(element, key) { 6559 var hiddenParentNodes = getHiddenParentNodes(element), 6560 hiddenParentNodesLength = hiddenParentNodes.length, 6561 inlineStyle = [], 6562 dimension = element[key]; 6563 6564 // Used for native `<details>` elements 6565 function toggleOpenProperty(element) { 6566 if (typeof element.open !== 'undefined') { 6567 element.open = (element.open) ? false : true; 6568 } 6569 } 6570 6571 if (hiddenParentNodesLength) { 6572 for (var i = 0; i < hiddenParentNodesLength; i++) { 6573 6574 // Cache style attribute to restore it later. 6575 inlineStyle[i] = hiddenParentNodes[i].style.cssText; 6576 6577 // visually hide 6578 if (hiddenParentNodes[i].style.setProperty) { 6579 hiddenParentNodes[i].style.setProperty('display', 'block', 'important'); 6580 } else { 6581 hiddenParentNodes[i].style.cssText += ';display: block !important'; 6582 } 6583 hiddenParentNodes[i].style.height = '0'; 6584 hiddenParentNodes[i].style.overflow = 'hidden'; 6585 hiddenParentNodes[i].style.visibility = 'hidden'; 6586 toggleOpenProperty(hiddenParentNodes[i]); 6587 } 6588 6589 // Update dimension 6590 dimension = element[key]; 6591 6592 for (var j = 0; j < hiddenParentNodesLength; j++) { 6593 6594 // Restore the style attribute 6595 hiddenParentNodes[j].style.cssText = inlineStyle[j]; 6596 toggleOpenProperty(hiddenParentNodes[j]); 6597 } 6598 } 6599 return dimension; 6600 } 6601 6602 /** 6603 * Returns the parsed float or the default if it failed. 6604 * 6605 * @param {String} str 6606 * @param {Number} defaultValue 6607 * @return {Number} 6608 */ 6609 function tryParseFloat(str, defaultValue) { 6610 var value = parseFloat(str); 6611 return Number.isNaN(value) ? defaultValue : value; 6612 } 6613 6614 /** 6615 * Capitalize the first letter of string 6616 * 6617 * @param {String} str 6618 * @return {String} 6619 */ 6620 function ucfirst(str) { 6621 return str.charAt(0).toUpperCase() + str.substr(1); 6622 } 6623 6624 /** 6625 * Plugin 6626 * @param {String} element 6627 * @param {Object} options 6628 */ 6629 function Plugin(element, options) { 6630 this.$window = $(window); 6631 this.$document = $(document); 6632 this.$element = $(element); 6633 this.options = $.extend( {}, defaults, options ); 6634 this.polyfill = this.options.polyfill; 6635 this.orientation = this.$element[0].getAttribute('data-orientation') || this.options.orientation; 6636 this.onInit = this.options.onInit; 6637 this.onSlide = this.options.onSlide; 6638 this.onSlideEnd = this.options.onSlideEnd; 6639 this.DIMENSION = constants.orientation[this.orientation].dimension; 6640 this.DIRECTION = constants.orientation[this.orientation].direction; 6641 this.DIRECTION_STYLE = constants.orientation[this.orientation].directionStyle; 6642 this.COORDINATE = constants.orientation[this.orientation].coordinate; 6643 6644 // Plugin should only be used as a polyfill 6645 if (this.polyfill) {
6646 // Input range support? 6647 if (hasInputRangeSupport) { return false; } 6648 } 6649 6650 this.identifier = 'js-' + pluginName + '-' +(pluginIdentifier++); 6651 this.startEvent = this.options.startEvent.join('.' + this.identifier + ' ') + '.' + this.identifier; 6652 this.moveEvent = this.options.moveEvent.join('.' + this.identifier + ' ') + '.' + this.identifier; 6653 this.endEvent = this.options.endEvent.join('.' + this.identifier + ' ') + '.' + this.identifier; 6654 this.toFixed = (this.step + '').replace('.', '').length - 1; 6655 this.$fill = $('<div class="' + this.options.fillClass + '" />'); 6656 this.$handle = $('<div class="' + this.options.handleClass + '" />'); 6657 this.$range = $('<div class="' + this.options.rangeClass + ' ' + this.options[this.orientation + 'Class'] + '" id="' + this.identifier + '" />').insertAfter(this.$element).prepend(this.$fill, this.$handle); 6658 6659 // visually hide the input 6660 this.$element.css({ 6661 'position': 'absolute', 6662 'width': '1px', 6663 'height': '1px', 6664 'overflow': 'hidden', 6665 'opacity': '0' 6666 }); 6667 6668 // Store context 6669 this.handleDown = $.proxy(this.handleDown, this); 6670 this.handleMove = $.proxy(this.handleMove, this); 6671 this.handleEnd = $.proxy(this.handleEnd, this); 6672 6673 this.init(); 6674 6675 // Attach Events 6676 var _this = this; 6677 this.$window.on('resize.' + this.identifier, debounce(function() { 6678 // Simulate resizeEnd event. 6679 delay(function() { _this.update(false, false); }, 300); 6680 }, 20)); 6681 6682 this.$document.on(this.startEvent, '#' + this.identifier + ':not(.' + this.options.disabledClass + ')', this.handleDown); 6683 6684 // Listen to programmatic value changes 6685 this.$element.on('change.' + this.identifier, function(e, data) { 6686 if (data && data.origin === _this.identifier) { 6687 return; 6688 } 6689 6690 var value = e.target.value, 6691 pos = _this.getPositionFromValue(value); 6692 _this.setPosition(pos); 6693 }); 6694 } 6695 6696 Plugin.prototype.init = function() { 6697 this.update(true, false); 6698 6699 if (this.onInit && typeof this.onInit === 'function') { 6700 this.onInit(); 6701 } 6702 }; 6703 6704 Plugin.prototype.update = function(updateAttributes, triggerSlide) { 6705 updateAttributes = updateAttributes || false; 6706 6707 if (updateAttributes) { 6708 this.min = tryParseFloat(this.$element[0].getAttribute('min'), 0); 6709 this.max = tryParseFloat(this.$element[0].getAttribute('max'), 100); 6710 this.value = tryParseFloat(this.$element[0].value, Math.round(this.min + (this.max-this.min)/2)); 6711 this.step = tryParseFloat(this.$element[0].getAttribute('step'), 1); 6712 } 6713 6714 this.handleDimension = getDimension(this.$handle[0], 'offset' + ucfirst(this.DIMENSION)); 6715 this.rangeDimension = getDimension(this.$range[0], 'offset' + ucfirst(this.DIMENSION)); 6716 this.maxHandlePos = this.rangeDimension - this.handleDimension; 6717 this.grabPos = this.handleDimension / 2; 6718 this.position = this.getPositionFromValue(this.value); 6719 6720 // Consider disabled state 6721 if (this.$element[0].disabled) { 6722 this.$range.addClass(this.options.disabledClass); 6723 } else { 6724 this.$range.removeClass(this.options.disabledClass); 6725 } 6726 6727 this.setPosition(this.position, triggerSlide); 6728 }; 6729 6730 Plugin.prototype.handleDown = function(e) { 6731 e.preventDefault(); 6732 6733 // Only respond to mouse main button clicks (usually the left button) 6734 if (e.button && e.button !== 0) { return; } 6735 6736 this.$document.on(this.moveEvent, this.handleMove); 6737 this.$document.on(this.endEvent, this.handleEnd); 6738 6739 // add active class because Firefox is ignoring 6740 // the handle:active pseudo selector because of `e.preventDefault();` 6741 this.$range.addClass(this.options.activeClass); 6742 6743 // If we click on the handle don't set the new position 6744 if ((' ' + e.target.className + ' ').replace(/[\n\t]/g, ' ').indexOf(this.options.handleClass) > -1) { 6745 return; 6746 } 6747 6748 var pos = this.getRelativePosition(e), 6749 rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION], 6750 handlePos = this.getPositionFromNode(this.$handle[0]) - rangePos, 6751 setPos = (this.orientation === 'vertical') ? (this.maxHandlePos - (pos - this.grabPos)) : (pos - this.grabPos); 6752 6753 this.setPosition(setPos); 6754 6755 if (pos >= handlePos && pos < handlePos + this.handleDimension) { 6756 this.grabPos = pos - handlePos; 6757 } 6758 }; 6759 6760 Plugin.prototype.handleMove = function(e) { 6761 e.preventDefault(); 6762 var pos = this.getRelativePosition(e); 6763 var setPos = (this.orientation === 'vertical') ? (this.maxHandlePos - (pos - this.grabPos)) : (pos - this.grabPos); 6764 this.setPosition(setPos); 6765 }; 6766 6767 Plugin.prototype.handleEnd = function(e) { 6768 e.preventDefault(); 6769 this.$document.off(this.moveEvent, this.handleMove); 6770 this.$document.off(this.endEvent, this.handleEnd); 6771 6772 this.$range.removeClass(this.options.activeClass); 6773 6774 // Ok we're done fire the change event 6775 this.$element.trigger('change', { origin: this.identifier }); 6776 6777 if (this.onSlideEnd && typeof this.onSlideEnd === 'function') { 6778 this.onSlideEnd(this.position, this.value); 6779 } 6780 }; 6781 6782 Plugin.prototype.cap = function(pos, min, max) { 6783 if (pos < min) { return min; } 6784 if (pos > max) { return max; } 6785 return pos; 6786 }; 6787 6788 Plugin.prototype.setPosition = function(pos, triggerSlide) { 6789 var value, newPos; 6790 6791 if (triggerSlide === undefined) { 6792 triggerSlide = true; 6793 } 6794 6795 // Snapping steps 6796 value = this.getValueFromPosition(this.cap(pos, 0, this.maxHandlePos)); 6797 newPos = this.getPositionFromValue(value); 6798 6799 // Update ui 6800 this.$fill[0].style[this.DIMENSION] = (newPos + this.grabPos) + 'px'; 6801 this.$handle[0].style[this.DIRECTION_STYLE] = newPos + 'px'; 6802 this.setValue(value); 6803 6804 // Update globals 6805 this.position = newPos; 6806 this.value = value; 6807 6808 if (triggerSlide && this.onSlide && typeof this.onSlide === 'function') { 6809 this.onSlide(newPos, value); 6810 } 6811 }; 6812 6813 // Returns element position relative to the parent 6814 Plugin.prototype.getPositionFromNode = function(node) { 6815 var i = 0; 6816 while (node !== null) { 6817 i += node.offsetLeft; 6818 node = node.offsetParent; 6819 } 6820 return i; 6821 }; 6822 6823 Plugin.prototype.getRelativePosition = function(e) { 6824 // Get the offset DIRECTION relative to the viewport 6825 var ucCoordinate = ucfirst(this.COORDINATE), 6826 rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION], 6827 pageCoordinate = 0; 6828 6829 if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') { 6830 pageCoordinate = e.originalEvent['client' + ucCoordinate]; 6831 } 6832 else if ( 6833 e.originalEvent.touches && 6834 e.originalEvent.touches[0] && 6835 typeof e.originalEvent.touches[0]['client' + ucCoordinate] !== 'undefined' 6836 ) { 6837 pageCoordinate = e.originalEvent.touches[0]['client' + ucCoordinate]; 6838 } 6839 else if(e.currentPoint && typeof e.currentPoint[this.COORDINATE] !== 'undefined') { 6840 pageCoordinate = e.currentPoint[this.COORDINATE]; 6841 } 6842 6843 return pageCoordinate - rangePos; 6844 }; 6845 6846 Plugin.prototype.getPositionFromValue = function(value) { 6847 var percentage, pos; 6848 percentage = (value - this.min)/(this.max - this.min); 6849 pos = (!Number.isNaN(percentage)) ? percentage * this.maxHandlePos : 0; 6850 return pos; 6851 }; 6852 6853 Plugin.prototype.getValueFromPosition = function(pos) { 6854 var percentage, value; 6855 percentage = ((pos) / (this.maxHandlePos || 1)); 6856 value = this.step * Math.round(percentage * (this.max - this.min) / this.step) + this.min; 6857 return Number((value).toFixed(this.toFixed)); 6858 }; 6859 6860 Plugin.prototype.setValue = function(value) { 6861 if (value === this.value && this.$element[0].value !== '') { 6862 return; 6863 } 6864 6865 // Set the new value and fire the `input` event 6866 this.$element 6867 .val(value) 6868 .trigger('input', { origin: this.identifier }); 6869 }; 6870 6871 Plugin.prototype.destroy = function() { 6872 this.$document.off('.' + this.identifier); 6873 this.$window.off('.' + this.identifier); 6874 6875 this.$element 6876 .off('.' + this.identifier) 6877 .removeAttr('style') 6878 .removeData('plugin_' + pluginName); 6879 6880 // Remove the generated markup 6881 if (this.$range && this.$range.length) { 6882 this.$range[0].parentNode.removeChild(this.$range[0]); 6883 } 6884 }; 6885 6886 // A really lightweight plugin wrapper around the constructor, 6887 // preventing against multiple instantiations 6888 $.fn[pluginName] = function(options) { 6889 var args = Array.prototype.slice.call(arguments, 1); 6890 6891 return this.each(function() { 6892 var $this = $(this), 6893 data = $this.data('plugin_' + pluginName); 6894 6895 // Create a new instance. 6896 if (!data) { 6897 $this.data('plugin_' + pluginName, (data = new Plugin(this, options))); 6898 } 6899 6900 // Make it possible to access methods from public. 6901 // e.g `$element.rangeslider('method');` 6902 if (typeof options === 'string') { 6903 data[options].apply(data, args); 6904 } 6905 }); 6906 }; 6907 6908 return 'rangeslider.js is available in jQuery context e.g $(selector).rangeslider(options);'; 6909 6910})); 6911 6912/* jquery.nicescroll v3.7.6 InuYaksa - MIT - https://nicescroll.areaaperta.com */ 6913!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradiu
6913s:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,railhoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:function(){var e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t<r;t++)if(void 0!==o[e[t]]){i.trstyle=e[t];break}i.hastransform=!!i.trstyle}(),i.hastransform&&(o[i.trstyle]="translate3d(1px,2px,3px)",i.hastranslate3d=/translate3d/.test(o[i.trstyle])),i.transitionstyle="transition",i.prefixstyle="",i.transitionend="transitionend",i.hastransition="transition"in o||function(){i.transitionend=!1;for(var e=["webkitTransition","msTransition","MozTransition","OTransition","OTransition","KhtmlTransition"],t=["-webkit-","-ms-","-moz-","-o-","-o","-khtml-"],r=["webkitTransitionEnd","msTransitionEnd","transitionend","otransitionend","oTransitionEnd","KhtmlTransitionEnd"],s=0,n=e.length;s<n;s++)if(e[s]in o){i.transitionstyle=e[s],i.prefixstyle=t[s],i.transitionend=r[s];break}i.ischrome26&&(i.prefixstyle=t[1]),i.hastransition=i.transitionstyle}(),i.cursorgrabvalue=function(){var e=["grab","-webkit-grab","-moz-grab"];(i.ischrome&&!i.ischrome38||i.isie)&&(e=[]);for(var t=0,r=e.length;t<r;t++){var s=e[t];if(o.cursor=s,o.cursor==s)return s}return"url(https://cdnjs.cloudflare.com/ajax/libs/slider-pro/1.3.0/css/images/openhand.cur),n-resize"}(),i.hasmousecapture="setCapture"in e,i.hasMutationObserver=!1!==m,e=null,v=i,i},b=function(e,p){function v(){var e=T.doc.css(P.trstyle);return!(!e||"matrix"!=e.substr(0,6))&&e.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/)}function b(){var e=T.win;if("zIndex"in e)return e.zIndex();for(;e.length>0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>
6913350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.6",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!1,this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName,this.istextarea="TEXTAREA"==this.win[0].nodeName,this.forcescreen=!1,this.canshowonmouseevent="scroll"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,N=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==N||"lr-tb"==N||""===N?(this.isrtlmode="rtl"==C.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==N||"tb"==N||"tb-rl"==N||"rl-tb"==N,this.isvertical="vertical-rl"==N||"tb"==N||"tb-rl"==N)}else this.isrtlmode=!0===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var P=n.extend({},this.detected);this.canhwscroll=P.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(P.iswebkit||P.isie||P.isie11):this.hasreversehr=!(P.iswebkit||P.isie&&!P.isie10&&!P.isie11):this.hasreversehr=!1,this.istouchcapable=!1,P.cantouch||!P.hasw3ctouch&&!P.hasmstouch?!P.cantouch||P.isios||P.isandroid||!P.iswebkit&&!P.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(P.hasmousecapture=!1,P.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||
69131,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},P.hastranslate3d&&P.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;P.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(P.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(P.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(P.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(P.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.curs
6913orheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],P.isoperamini)return!0;if(P.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((P.isie11||P.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(P.transitionstyle,P.prefixstyle+"transform 0ms ease-out"),P.transitionend&&T.bind(T.doc,P.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!P.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(P.isie11||P.isie)&&T.css(n("html"),e),!P.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||P.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),P.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),P.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}
6913),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}P.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(P.isie&&T.win.attr("hideFocus","true"),P.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),P.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&P.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),P.cantouch||T.istouchcapable||M.emulatetouch||P.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.
6913stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&P.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return P.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),P.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!P.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),P.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&P.hasmousecapture&&t.setCapture(),T.isiframe&&!P.hasmousecapture&&(T.s
6913aved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(P.hasmousecapture&&l.releaseCapture(),T.isiframe&&!P.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return P.hasmousecapture&&t.setCapture(),T.isiframe&&!P.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(P.hasmousecapture&&l.releaseCapture(),T.isiframe&&!P.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(P.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},P.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!P.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&P.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:P.cursorgrabvalue}),T.css(T.rail,{cursor:P.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t<o&&(t=0),t>=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(P.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):P.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):P.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!P.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}
6913),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||P.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),M.emulatetouch||P.isandroid||P.isios?(T.bind(P.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(P.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(P.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||P.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;
6913case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,P.isopera&&!P.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),P.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),N=parseFloat(T.win.css("width"))+1;T.win.css("width",N),T.synched("chromefix",function(){T.win.attr("style",C)})}if(T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),!T.ispage&&!T.haswrapper)){var R=T.win[0];!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(R,{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]===R)return T.remove()})}),T.observerremover.observe(R.parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(R,P.isie&&!P.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),P.isie9&&R.attachEvent("onpropertychange",T.onAttributeChange),T.bind(R,"DOMNodeRemoved",function(e){e.target===R&&T.remove()}))}!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var _=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!P.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),P.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,P.isopera?"keypress":"keydown",T.onkeypress),P.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&P.cursorgrabvalue&&T.css(n(o.body),{cursor:P.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){_.call(T.doc[0],!1)},500),T.bind(this.doc,"load",_)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0}
6913,e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||(T.rail.visibility||T.showRail(),T.railh&&!T.railh.visibility&&T.showRailHr()),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),e=isNaN(e)?240:e,O=setTimeout(function(){T&&T.resize(),O=0},e),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(P.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}}
6913,T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s&&s.l)for(var n=0,l=s.l.length;n<l;n++)s.a[n]===T.id&&(s.a.splice(n),s.l.splice(n),0===s.a.length&&(T._unbind(e,o,s.l.f),d[o]=null))},this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;T._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){T.events.push({e:e,n:o,f:t,b:r,q:!1}),Y&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){d[o]?T.undelegate(e,o,t,r):e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e<T.events.length;e++){var o=T.events[e];o.q?o.e.unbind(o.n,o.f):T._unbind(o.e,o.n,o.f,o.b)}},this.showRails=function(){return T.showRail().showRailHr()},this.showRail=function(){return 0===T.page.maxh||!T.ispage&&"none"==T.win.css("display")||(T.rail.visibility=!0,T.rail.css("display","block")),T},this.showRailHr=function(){return T.railh&&(0===T.page.maxw||!T.ispage&&"none"==T.win.css("display")||(T.railh.visibility=!0,T.railh.css("display","block"))),T},this.hideRails=function(){return T.hideRail().hideRailHr()},this.hideRail=function(){return T.rail.visibility=!1,T.rail.css("display","none"),T},this.hideRailHr=function(){return T.railh&&(T.railh.visibility=!1,T.railh.css("display","none")),T},this.show=function(){return T.hidden=!1,T.railslocked=!1,T.showRails()},this.hide=function(){return T.hidden=!0,T.railslocked=!0,T.hideRails()},this.toggle=function(){return T.hidden?T.show():T.hide()},this.remove=function(){T.stop(),T.cursortimeout&&clearTimeout(T.cursortimeout);for(var e in T.delaylist)T.delaylist[e]&&h(T.delaylist[e].h);T.doZoomOut(),T.unbindAll(),P.isie9&&T.win[0].detachEvent("onpropertychange",T.onAttributeChange),!1!==T.observer&&T.observer.disconnect(),!1!==T.observerremover&&T.observerremover.disconnect(),!1!==T.observerbody&&T.observerbody.disconnect(),T.events=null,T.cursor&&T.cursor.remove(),T.cursorh&&T.cursorh.remove(),T.rail&&T.rail.remove(),T.railh&&T.railh.remove(),T.zoom&&T.zoom.remove();for(var o=0;o<T.saved.css.length;o++){var t=T.saved.css[o];t[0].css(t[1],void 0===t[2]?"":t[2])}T.saved=!1,T.me.data("__nicescroll","");var r=n.nicescroll;r.each(function(e){if(this&&this.id===T.id){delete r[e];for(var o=++e;o<r.length;o++,e++)r[e]=r[o];--r.length&&delete r[r.length]}});for(var i in T)T[i]=null,delete T[i];T=null},this.scrollstart=function(e){return this.onscrollstart=e,T},this.scrollend=function(e){return this.onscrollend=e,T},this.scrollcancel=function(e){return this.onscrollcancel=e,T},this.zoomin=function(e){return this.onzoomin=e,T},this.zoomout=function(e){return this.onzoomout=e,T},this.isScrollable=function(e){var o=e.target?e.target:e;if("OPTION"==o.nodeName)return!0;for(;o&&1==o.nodeType&&o!==this.me[0]&&!/^BODY|HTML/.test(o.nodeName);){var t=n(o),r=t.css("overflowY")||t.css("overflowX")||t.css("overflow")||"";if(/scroll|auto/.test(r))return o.clientHeight!=o.scrollHeight;o=!!o.parentNode&&o.parentNode}return!1},this.getViewport=function(e){for(var o=!(!e||!e.parentNode)&&e.parentNode;o&&1==o.nodeType&&!/^BODY|HTML/.test(o.nodeName);){var t=n(o);if(/fixed|absolute/.test(t.css("position")))return t;var r=t.css("overflowY")||t.css("overflowX")||t.css("overflow")||"";if(/scroll|auto/.test(r)&&o.clientHeight!=o.scrollHeight)return t;if(t.getNiceScroll().length>0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600<o&&(T.nativescrollingarea=T.isScrollable(e),t=!0),T.checkarea=o,T.nativescrollingarea)return!0;var r=k(e,!1,t);return r&&(T.checkarea=0),r},this.onmousewheelhr=function(e){if(!T.wheelprevented){if(T.railslocked||!T.railh.scrollable)return!0;
6913if(T.rail.drag)return T.cancelEvent(e);var o=f(),t=!1;return M.preservenativescrolling&&T.checkarea+600<o&&(T.nativescrollingarea=T.isScrollable(e),t=!0),T.checkarea=o,!!T.nativescrollingarea||(T.railslocked?T.cancelEvent(e):k(e,!0,t))}},this.stop=function(){return T.cancelScroll(),T.scrollmon&&T.scrollmon.stop(),T.cursorfreezed=!1,T.scroll.y=Math.round(T.getScrollTop()*(1/T.scrollratio.y)),T.noticeCursor(),T},this.getTransitionSpeed=function(e){return 80+e/72*M.scrollspeed|0},M.smoothscroll)if(T.ishwscroll&&P.hastransition&&M.usetransition&&M.smoothscroll){var j="";this.resetTransition=function(){j="",T.doc.css(P.prefixstyle+"transition-duration","0ms")},this.prepareTransition=function(e,o){var t=o?e:T.getTransitionSpeed(e),r=t+"ms";return j!==r&&(j=r,T.doc.css(P.prefixstyle+"transition-duration",r)),t},this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.cursorupdate={running:!1,start:function(){var e=this;if(!e.running){e.running=!0;var o=function(){e.running&&u(o),T.showCursor(T.getScrollTop(),T.getScrollLeft()),T.notifyScrollEvent(T.win[0])};u(o)}},stop:function(){this.running=!1}},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();if(((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll(),M.bouncescroll?(o<0?o=o/2|0:o>T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,P.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,P.transitionend||clearTimeout(P.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}
6913T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},P.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:P.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),P.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)}
6913,set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t<e.length;t++){var r=n.data(e[t],"__nicescroll")||!1;r&&(this[this.length]=r,this.length++)}return this};!function(e,o,t){for(var r=0,i=o.length;r<i;r++)t(e,o[r])}(z.prototype,["show","hide","toggle","onResize","resize","remove","stop","doScrollPos"],function(e,o){e[o]=function(){var e=arguments;return this.each(function(){this[o].apply(this,e)})}}),e.fn.getNiceScroll=function(e){return void 0===e?new z(this):this[e]&&n.data(this[e],"__nicescroll")||!1},(e.expr.pseudos||e.expr[":"]).nicescroll=function(e){return void 0!==n.data(e,"__nicescroll")},n.fn.niceScroll=function(e,o){void 0!==o||"object"!=typeof e||"jquery"in e||(o=e,e=!1);var t=new z;return this.each(function(){var r=n(this),i=n.extend({},o);if(e){var s=n(e);i.doc=s.length>1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)});
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.