PageSourceSearch

https://www.montebravo.com.br/wp-content/themes/montebravo-2025/public/js/app.js?ver=1782830582

js montebravo.com.br collected 2026-09-24 12:57:05 UTC 163,712 bytes, 5,037 lines download raw bytes

1/******/ (() => { // webpackBootstrap
2/******/ 	var __webpack_modules__ = ({
3
vendor: 14,757 bytes, lines 4-13
4/***/ "./node_modules/aos/dist/aos.js":
5/*!**************************************!*\
6  !*** ./node_modules/aos/dist/aos.js ***!
7  \**************************************/
8/***/ (function(module) {
9
10!function(e,t){ true?module.exports=t():0}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="dist/",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=n(1),a=(o(r),n(6)),u=o(a),c=n(7),s=o(c),f=n(8),d=o(f),l=n(9),p=o(l),m=n(10),b=o(m),v=n(11),y=o(v),g=n(14),h=o(g),w=[],k=!1,x={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,startEvent:"DOMContentLoaded",throttleDelay:99,debounceDelay:50,disableMutationObserver:!1},j=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e&&(k=!0),k)return w=(0,y.default)(w,x),(0,b.default)(w,x.once),w},O=function(){w=(0,h.default)(),j()},M=function(){w.forEach(function(e,t){e.node.removeAttribute("data-aos"),e.node.removeAttribute("data-aos-easing"),e.node.removeAttribute("data-aos-duration"),e.node.removeAttribute("data-aos-delay")})},S=function(e){return e===!0||"mobile"===e&&p.default.mobile()||"phone"===e&&p.default.phone()||"tablet"===e&&p.default.tablet()||"function"==typeof e&&e()===!0},_=function(e){x=i(x,e),w=(0,h.default)();var t=document.all&&!window.atob;return S(x.disable)||t?M():(x.disableMutationObserver||d.default.isSupported()||(console.info('\n      aos: MutationObserver is not supported on this browser,\n      code mutations observing has been disabled.\n      You may have to call "refreshHard()" by yourself.\n    '),x.disableMutationObserver=!0),document.querySelector("body").setAttribute("data-aos-easing",x.easing),document.querySelector("body").setAttribute("data-aos-duration",x.duration),document.querySelector("body").setAttribute("data-aos-delay",x.delay),"DOMContentLoaded"===x.startEvent&&["complete","interactive"].indexOf(document.readyState)>-1?j(!0):"load"===x.startEvent?window.addEventListener(x.startEvent,function(){j(!0)}):document.addEventListener(x.startEvent,function(){j(!0)}),window.addEventListener("resize",(0,s.default)(j,x.debounceDelay,!0)),window.addEventListener("orientationchange",(0,s.default)(j,x.debounceDelay,!0)),window.addEventListener("scroll",(0,u.default)(function(){(0,b.default)(w,x.once)},x.throttleDelay)),x.disableMutationObserver||d.default.ready("[data-aos]",O),w)};e.exports={init:_,refresh:j,refreshHard:O}},function(e,t){},,,,,function(e,t){(function(t){"use strict";function n(e,t,n){function o(t){var n=b,o=v;return b=v=void 0,k=t,g=e.apply(o,n)}function r(e){return k=e,h=setTimeout(f,t),M?o(e):g}function a(e){var n=e-w,o=e-k,i=t-n;return S?j(i,y-o):i}function c(e){var n=e-w,o=e-k;return void 0===w||n>=t||n<0||S&&o>=y}function f(){var e=O();return c(e)?d(e):void(h=setTimeout(f,a(e)))}function d(e){return h=void 0,_&&b?o(e):(b=v=void 0,g)}function l(){void 0!==h&&clearTimeout(h),k=0,b=w=v=h=void 0}function p(){return void 0===h?g:d(O())}function m(){var e=O(),n=c(e);if(b=arguments,v=this,w=e,n){if(void 0===h)return r(w);if(S)return h=setTimeout(f,t),o(w)}return void 0===h&&(h=setTimeout(f,t)),g}var b,v,y,g,h,w,k=0,M=!1,S=!1,_=!0;if("function"!=typeof e)throw new TypeError(s);return t=u(t)||0,i(n)&&(M=!!n.leading,S="maxWait"in n,y=S?x(u(n.maxWait)||0,t):y,_="trailing"in n?!!n.trailing:_),m.cancel=l,m.flush=p,m}function o(e,t,o){var r=!0,a=!0;if("function"!=typeof e)throw new TypeError(s);return i(o)&&(r="leading"in o?!!o.leading:r,a="trailing"in o?!!o.trailing:a),n(e,t,{leading:r,maxWait:t,trailing:a})}function i(e){var t="undefined"==typeof e?"undefined":c(e);return!!e&&("object"==t||"function"==t)}function r(e){return!!e&&"object"==("undefined"==typeof e?"undefined":c(e))}function a(e){return"symbol"==("undefined"==typeof e?"undefined":c(e))||r(e)&&k.call(e)==d}function u(e){if("number"==typeof e)return e;if(a(e))return f;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var n=m.test(e);return n||b.test(e)?v(e.slice(2),n?2:8):p.test(e)?f:+e}var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s="Expected a function",f=NaN,d="[object Symbol]",l=/^\s+|\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,m=/^0b[01]+$/i,b=/^0o[0-7]+$/i,v=parseInt,y="object"==("undefined"==typeof t?"undefined":c(t))&&t&&t.Object===Object&&t,g="object"==("undefined"==typeof self?"undefined":c(self))&&self&&self.Object===Object&&self,h=y||g||Function("return this")(),w=Object.prototype,k=w.toString,x=Math.max,j=Math.min,O=function(){return h.Date.now()};e.exports=o}).call(t,function(){return this}())},function(e,t){(function(t){"use strict";function n(e,t,n){function i(t){var n=b,o=v;return b=v=void 0,O=t,g=e.apply(o,n)}function r(e){return O=e,h=setTimeout(f,t),M?i(e):g}function u(e){var n=e-w,o=e-O,i=t-n;return S?x(i,y-o):i}function s(e){var n=e-w,o=e-O;return void 0===w||n>=t||n<0||S&&o>=y}function f(){var e=j();return s(e)?d(e):void(h=setTimeout(f,u(e)))}function d(e){return h=void 0,_&&b?i(e):(b=v=void 0,g)}function l(){void 0!==h&&clearTimeout(h),O=0,b=w=v=h=void 0}function p(){return void 0===h?g:d(j())}function m(){var e=j(),n=s(e);if(b=arguments,v=this,w=e,n){if(void 0===h)return r(w);if(S)return h=setTimeout(f,t),i(w)}return void 0===h&&(h=setTimeout(f,t)),g}var b,v,y,g,h,w,O=0,M=!1,S=!1,_=!0;if("function"!=typeof e)throw new TypeError(c);return t=a(t)||0,o(n)&&(M=!!n.leading,S="maxWait"in n,y=S?k(a(n.maxWait)||0,t):y,_="trailing"in n?!!n.trailing:_),m.cancel=l,m.flush=p,m}function o(e){var t="undefined"==typeof e?"undefined":u(e);return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==("undefined"==typeof e?"undefined":u(e))}function r(e){return"symbol"==("undefined"==typeof e?"undefined":u(e))||i(e)&&w.call(e)==f}function a(e){if("number"==typeof e)return e;if(r(e))return s;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(d,"");var n=p.test(e);return n||m.test(e)?b(e.slice(2),n?2:8):l.test(e)?s:+e}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c="Expected a function",s=NaN,f="[object Symbol]",d=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,m=/^0o[0-7]+$/i,b=parseInt,v="object"==("undefined"==typeof t?"undefined":u(t))&&t&&t.Object===Object&&t,y="object"==("undefined"==typeof self?"undefined":u(self))&&self&&self.Object===Object&&self,g=v||y||Function("return this")(),h=Object.prototype,w=h.toString,k=Math.max,x=Math.min,j=function(){return g.Date.now()};e.exports=n}).call(t,function(){return this}())},function(e,t){"use strict";function n(e){var t=void 0,o=void 0,i=void 0;for(t=0;t<e.length;t+=1){if(o=e[t],o.dataset&&o.dataset.aos)return!0;if(i=o.children&&n(o.children))return!0}return!1}function o(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function i(){return!!o()}function r(e,t){var n=window.document,i=o(),r=new i(a);u=t,r.observe(n.documentElement,{childList:!0,subtree:!0,removedNodes:!0})}function a(e){e&&e.forEach(function(e){var t=Array.prototype.slice.call(e.addedNodes),o=Array.prototype.slice.call(e.removedNodes),i=t.concat(o);if(n(i))return u()})}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){};t.default={isSupported:i,ready:r}},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return navigator.userAgent||navigator.vendor||window.opera||""}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,a=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,u=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,c=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,s=function(){function e(){n(this,e)}return i(e,[{key:"phone",value:function(){var e=o();return!(!r.test(e)&&!a.test(e.substr(0,4)))}},{key:"mobile",value:function(){var e=o();return!(!u.test(e)&&!c.test(e.substr(0,4)))}},{key:"tablet",value:function(){return this.mobile()&&!this.phone()}}]),e}();t.default=new s},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,n){var o=e.node.getAttribute("data-aos-once");t>e.position?e.node.classList.add("aos-animate"):"undefined"!=typeof o&&("false"===o||!n&&"true"!==o)&&e.node.classList.remove("aos-animate")},o=function(e,t){var o=window.pageYOffset,i=window.innerHeight;e.forEach(function(e,r){n(e,i+o,t)})};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(12),r=o(i),a=function(e,t){return e.forEach(function(e,n){e.node.classList.add("aos-init"),e.position=(0,r.default)(e.node,t.offset)}),e};t.default=a},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(13),r=o(i),a=function(e,t){var n=0,o=0,i=window.innerHeight,a={offset:e.getAttribute("data-aos-offset"),anchor:e.getAttribute("data-aos-anchor"),anchorPlacement:e.getAttribute("data-aos-anchor-placement")};switch(a.offset&&!isNaN(a.offset)&&(o=parseInt(a.offset)),a.anchor&&document.querySelectorAll(a.anchor)&&(e=document.querySelectorAll(a.anchor)[0]),n=(0,r.default)(e).top,a.anchorPlacement){case"top-bottom":break;case"center-bottom":n+=e.offsetHeight/2;break;case"bottom-bottom":n+=e.offsetHeight;break;case"top-center":n+=i/2;break;case"bottom-center":n+=i/2+e.offsetHeight;break;case"center-center":n+=i/2+e.offsetHeight/2;break;case"top-top":n+=i;break;case"bottom-top":n+=e.offsetHeight+i;break;case"center-top":n+=e.offsetHeight/2+i}return a.anchorPlacement||a.offset||isNaN(t)||(o=t),n+o};t.default=a},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){for(var t=0,n=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-("BODY"!=e.tagName?e.scrollLeft:0),n+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:n,left:t}};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e=e||document.querySelectorAll("[data-aos]"),Array.prototype.map.call(e,function(e){return{node:e}})};t.default=n}])});
11
12/***/ }),
13
14/***/ "./webpack/js/scripts/copyLink.js":
15/*!****************************************!*\
16  !*** ./webpack/js/scripts/copyLink.js ***!
17  \****************************************/
18/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
19
20"use strict";
21
22
23Object.defineProperty(exports, "__esModule", ({
24    value: true
25}));
26
27exports["default"] = function () {
28    window.addEventListener('DOMContentLoaded', function () {
29        copyLink();
30    });
31};
32
33var _dom = __webpack_require__(/*! ./lib/dom */ "./webpack/js/scripts/lib/dom.js");
34
35var dom = _interopRequireWildcard(_dom);
36
37function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
38
39function copyLink() {
40    var linkBtn = document.querySelectorAll('.js-copy-link');
41    if (linkBtn.length < 1) {
42        return;
43    }
44
45    dom.forEachEl(linkBtn, function (el) {
46        el.addEventListener('click', function (e) {
47            e.preventDefault();
48            var btnText = el.querySelector('span');
49            var dummy = document.createElement('input');
50            var text = window.location.href;
51
52            document.body.appendChild(dummy);
53            dummy.value = text;
54            dummy.select();
55            document.execCommand('copy');
56            document.body.removeChild(dummy);
57            if (btnText) {
58                btnText.innerHTML = 'Copiado';
59            } else {
60                alert('Copiado');
61            }
62        });
63    });
64}
65
66/***/ }),
67
68/***/ "./webpack/js/scripts/lib/dom.js":
69/*!***************************************!*\
70  !*** ./webpack/js/scripts/lib/dom.js ***!
71  \***************************************/
72/***/ ((__unused_webpack_module, exports) => {
73
74"use strict";
75
76
77Object.defineProperty(exports, "__esModule", ({
78    value: true
79}));
80exports.scrollIt = scrollIt;
81exports.scrollToDirection = scrollToDirection;
82exports.isScrolledIntoView = isScrolledIntoView;
83exports.getPosition = getPosition;
84exports.scrollDocumentTo = scrollDocumentTo;
85exports.forEachEl = forEachEl;
86exports.hasClass = hasClass;
87exports.addClass = addClass;
88exports.removeClass = removeClass;
89exports.findTarget = findTarget;
90exports.parents = parents;
91exports.cumulativeOffset = cumulativeOffset;
92exports.getRandomInteger = getRandomInteger;
93exports.copyTextToClipboard = copyTextToClipboard;
94var scrollTo = function scrollTo(element, to, duration) {
95    if (duration <= 0) return;
96
97    var difference = to - element.scrollTop;
98    var perTick = difference / duration * 10;
99
100    setTimeout(function () {
101        element.scrollTop = element.scrollTop + perTick;
102        if (element.scrollTop === to) return;
103        scrollTo(element, to, duration - 10);
104    }, 10);
105};
106
107function scrollIt(destination) {
108    var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
109    var easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'linear';
110    var callback = arguments[3];
111
112
113    var easings = {
114        linear: function linear(t) {
115            return t;
116        },
117        easeInQuad: function easeInQuad(t) {
118            return t * t;
119        },
120        easeOutQuad: function easeOutQuad(t) {
121            return t * (2 - t);
122        },
123        easeInOutQuad: function easeInOutQuad(t) {
124            return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
125        },
126        easeInCubic: function easeInCubic(t) {
127            return t * t * t;
128        },
129        easeOutCubic: function easeOutCubic(t) {
130            return --t * t * t + 1;
131        },
132        easeInOutCubic: function easeInOutCubic(t) {
133            return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
134        },
135        easeInQuart: function easeInQuart(t) {
136            return t * t * t * t;
137        },
138        easeOutQuart: function easeOutQuart(t) {
139            return 1 - --t * t * t * t;
140        },
141        easeInOutQuart: function easeInOutQuart(t) {
142            return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
143        },
144        easeInQuint: function easeInQuint(t) {
145            return t * t * t * t * t;
146        },
147        easeOutQuint: function easeOutQuint(t) {
148            return 1 + --t * t * t * t * t;
149        },
150        easeInOutQuint: function easeInOutQuint(t) {
151            return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
152        }
153    };
154
155    var start = window.pageYOffset;
156    var startTime = 'now' in window.performance ? performance.now() : new Date().getTime();
157
158    var documentHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
159    var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight;
160    var destinationOffset = typeof destination === 'number' ? destination : destination.offsetTop - 120;
161    var destinationOffsetToScroll = Math.round(documentHeight - destinationOffset < windowHeight ? documentHeight - windowHeight : destinationOffset);
162
163    if ('requestAnimationFrame' in window === false) {
164        window.scroll(0, destinationOffsetToScroll);
165        if (callback) {
166            callback();
167        }
168        return;
169    }
170
171    function scroll() {
172        var now = 'now' in window.performance ? performance.now() : new Date().getTime();
173        var time = Math.min(1, (now - startTime) / duration);
174        var timeFunction = easings[easing](time);
175        window.scroll(0, Math.ceil(timeFunction * (destinationOffsetToScroll - start) + start));
176
177        if (window.pageYOffset === destinationOffsetToScroll) {
178            if (callback) {
179                callback();
180            }
181            return;
182        }
183
184        requestAnimationFrame(scroll);
185    }
186
187    scroll();
188}
189
190function scrollToDirection(element, to, duration, direction) {
191    var animating = false;
192    if (animating || !element || to === undefined || !duration) {
193        //stop when already triggered or missing args
194        return false;
195    }
196    var _requestAnimationFrame = function (win, t) {
197        return win["webkitR" + t] || win["r" + t] || win["mozR" + t] || win["msR" + t] || function (fn) {
198            setTimeout(fn, 60);
199        };
200    }(window, "requestAnimationFrame"),
201        easeInOutCubic = function easeInOutCubic(t) {
202        return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
203    },
204        //Or get your own: http://gizma.com/easing/
205    end = +new Date() + duration,
206        from = element === 'window' ? window.pageXOffset : element.scrollLeft;
207    animating = true;
208
209    if (direction === 'vertical') {
210        from = element === 'window' ? window.pageYOffset : element.scrollTop;
211    }
212
213    var step = function step() {
214        var current = +new Date(),
215            remaining = end - current;
216
217        if (remaining < 0) {
218            animating = false;
219        } else {
220            var ease = easeInOutCubic(1 - remaining / duration);
221
222            if (!direction || direction === "horizontal") {
223                element === 'window' ? window.scrollTo(from + ease * (to - from), window.pageYOffset) : element.scrollLeft = from + ease * (to - from);
224            } else if (direction === "vertical") {
225                element === 'window' ? window.scrollTo(window.pageXOffset, from + ease * (to - from)) : element.scrollTop = from + ease * (to - from);
226            }
227        }
228
229        _requestAnimationFrame(step);
230    };
231    step();
232};
233
234function isScrolledIntoView(el) {
235    console.log(el);
236    var rect = el.getBoundingClientRect();
237    var elemTop = rect.top;
238    var elemBottom = rect.bottom;
239
240    // Only completely visible elements return true:
241    // var isVisible = (elemTop >= 0) && (elemBottom <= window.innerHeight);
242    // Partially visible elements return true:
243    var isVisible = elemTop < window.innerHeight && elemBottom >= 0;
244    console.log(isVisible);
245    return isVisible;
246}
247
248function getPosition(el) {
249    var xPos = 0;
250    var yPos = 0;
251
252    while (el) {
253        if (el.tagName == "BODY") {
254            // deal with browser quirks with body/window/document and page scroll
255            var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
256            var yScroll = el.scrollTop || document.documentElement.scrollTop;
257
258            xPos += el.offsetLeft - xScroll + el.clientLeft;
259            yPos += el.offsetTop - yScroll + el.clientTop;
260        } else {
261            // for all other non-BODY elements
262            xPos += el.offsetLeft - el.scrollLeft + el.clientLeft;
263            yPos += el.offsetTop - el.scrollTop + el.clientTop;
264        }
265
266        el = el.offsetParent;
267    }
268    return {
269        x: xPos,
270        y: yPos
271    };
272}
273
274function scrollDocumentTo(to, duration) {
275    console.log(to, duration);
276    scrollTo(document.body, to, duration);
277}
278
279function forEachEl(els, callback) {
280    var elCount = els.length;
281    var i = void 0,
282        boundCallback = void 0;
283
284    for (i = 0; i < elCount; i++) {
285        callback(els[i], i);
286    }
287}
288
289function hasClass(el, klass) {
290    if (el.classList) {
291        return el.classList.contains(klass);
292    }
293
294    return new RegExp('(^| )' + klass + '( |$)', 'gi').test(el.className);
295}
296
297function addClass(el, klass) {
298    if (el.classList) {
299        return el.classList.add(klass);
300    }
301
302    return el.className += ' ' + klass;
303}
304
305function removeClass(el, klass) {
306    if (el.classList) {
307        return el.classList.remove(klass);
308    }
309
310    return el.className = el.className.replace(new RegExp('(^|\\b)' + klass.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
311}
312
313function findTarget(el, klass) {
314    if (hasClass(el, klass)) {
315        return el;
316    }
317    return parents(el, klass);
318}
319
320function parents(el, klass) {
321    if (!el) {
322        return null;
323    }
324
325    var found = false;
326    var targetEl = null;
327    var parentEl = el.parentNode;
328
329    var index = 0;
330
331    while (targetEl === null) {
332        index++;
333        if (index > 3000) {
334            break;
335        }
336        if (!parentEl) {
337            break;
338        }
339
340        if (parentEl.tagName === 'BODY' && !hasClass(parentEl, klass)) {
341            break;
342        }
343
344        if (!hasClass(parentEl, klass)) {
345            parentEl = parentEl.parentNode;
346            continue;
347        }
348
349        targetEl = parentEl;
350    }
351
352    return targetEl;
353}
354
355function cumulativeOffset(element) {
356    var top = 0,
357        left = 0;
358    do {
359        top += element.offsetTop || 0;
360        left += element.offsetLeft || 0;
361        element = element.offsetParent;
362    } while (element);
363
364    return {
365        top: top,
366        left: left
367    };
368};
369
370function getRandomInteger(min, max) {
371    return Math.floor(Math.random() * (max - min + 1)) + min;
372}
373
374function copyTextToClipboard(text) {
375    var textArea = document.createElement("textarea");
376
377    //
378    // *** This styling is an extra step which is likely not required. ***
379    //
380    // Why is it here? To ensure:
381    // 1. the element is able to have focus and selection.
382    // 2. if element was to flash render it has minimal visual impact.
383    // 3. less flakyness with selection and copying which **might** occur if
384    //    the textarea element is not visible.
385    //
386    // The likelihood is the element won't even render, not even a flash,
387    // so some of these are just precautions. However in IE the element
388    // is visible whilst the popup box asking the user for permission for
389    // the web page to copy to the clipboard.
390    //
391
392    // Place in top-left corner of screen regardless of scroll position.
393    textArea.style.position = 'fixed';
394    textArea.style.top = 0;
395    textArea.style.left = 0;
396
397    // Ensure it has a small width and height. Setting to 1px / 1em
398    // doesn't work as this gives a negative w/h on some browsers.
399    textArea.style.width = '2em';
400    textArea.style.height = '2em';
401
402    // We don't need padding, reducing the size if it does flash render.
403    textArea.style.padding = 0;
404
405    // Clean up any borders.
406    textArea.style.border = 'none';
407    textArea.style.outline = 'none';
408    textArea.style.boxShadow = 'none';
409
410    // Avoid flash of white box if rendered for any reason.
411    textArea.style.background = 'transparent';
412
413    textArea.value = text;
414
415    document.body.appendChild(textArea);
416
417    textArea.select();
418
419    try {
420        var successful = document.execCommand('copy');
421        var msg = successful ? 'successful' : 'unsuccessful';
422        console.log('Copying text command was ' + msg);
423        if (msg === 'successful') {
424            alert('URL copiada para área de transferência');
425        }
426    } catch (err) {
427        console.log('Oops, unable to copy');
428    }
429
430    document.body.removeChild(textArea);
431}
432
433/***/ }),
434
435/***/ "./webpack/js/scripts/menu/footerSubMenu.js":
436/*!**************************************************!*\
437  !*** ./webpack/js/scripts/menu/footerSubMenu.js ***!
438  \**************************************************/
439/***/ ((__unused_webpack_module, exports) => {
440
441"use strict";
442
443
444Object.defineProperty(exports, "__esModule", ({
445    value: true
446}));
447
448exports["default"] = function () {
449    var subMenu = document.querySelectorAll("li.c-footer-menu__main-item.menu-item-has-children");
450    var width = document.documentElement.clientWidth;
451    // if(width <= 768) {
452    subMenu.forEach(function (menu) {
453        menu.addEventListener("click", function (e) {
454            // console.log('teste');
455            if (e.target.closest(".sub-menu-item")) {
456                return;
457            } else {
458                var isActive = menu.classList.contains("ativo");
459                subMenu.forEach(function (item) {
460                    return item.classList.remove("ativo");
461                });
462                if (!isActive) {
463                    menu.classList.add("ativo");
464                    e.preventDefault();
465                } else {
466                    menu.classList.remove("ativo");
467                    e.preventDefault();
468                }
469            }
470        });
471    });
472    // }
473};
474
475/***/ }),
476
477/***/ "./webpack/js/scripts/menu/mobileMenu.js":
478/*!***********************************************!*\
479  !*** ./webpack/js/scripts/menu/mobileMenu.js ***!
480  \***********************************************/
481/***/ ((__unused_webpack_module, exports) => {
482
483"use strict";
484
485
486Object.defineProperty(exports, "__esModule", ({
487    value: true
488}));
489
490exports["default"] = function () {
491    var hamburguer = document.querySelector(".hamburguer-menu");
492    var listSuMenu = document.querySelectorAll(".c-submenu-trigger-wrapper");
493    var listMenu = document.querySelector(".menu-mobile");
494
495    function adjustHeight() {
496        var listMenu = document.querySelector(".menu-mobile");
497        listMenu.style.height = window.innerHeight + "px";
498    }
499
500    hamburguer.addEventListener("click", function () {
501        hamburguer.classList.toggle("close-menu");
502        listMenu.classList.toggle("active");
503        listSuMenu.forEach(function (menu) {
504            return menu.classList.remove("ativo");
505        });
506
507        if (listMenu.classList.contains("active")) {
508            document.querySelector("html").style.overflowY = "hidden";
509            window.addEventListener("resize", adjustHeight);
510        } else {
511            document.querySelector("html").style.overflowY = "inherit";
512        }
513    });
514};
515
516/***/ }),
517
518/***/ "./webpack/js/scripts/menu/subMenu.js":
519/*!********************************************!*\
520  !*** ./webpack/js/scripts/menu/subMenu.js ***!
521  \********************************************/
522/***/ ((__unused_webpack_module, exports) => {
523
524"use strict";
525
526
527Object.defineProperty(exports, "__esModule", ({
528    value: true
529}));
530
531exports["default"] = function () {
532    var listMenu = document.querySelectorAll(".c-submenu-trigger-wrapper");
533    var subMenu = document.querySelectorAll(".menu-mobile .c-main-menu__item.menu-item-has-children");
534    var closeMenu = document.querySelectorAll(".js-close-submenu");
535
536    subMenu.forEach(function (menu, index) {
537        menu.addEventListener("click", function (e) {
538            var isActive = listMenu[index].classList.contains("ativo");
539            listMenu.forEach(function (item) {
540                return item.classList.remove("ativo");
541            });
542            if (!isActive) {
543                listMenu[index].classList.add("ativo");
544                e.preventDefault();
545            }
546        });
547    });
548
549    closeMenu.forEach(function (item, i) {
550        item.addEventListener("click", function (e) {
551            e.stopPropagation();
552            listMenu[i].classList.remove("ativo");
553        });
554    });
555};
556
557/***/ }),
558
559/***/ "./webpack/js/scripts/shareSocialMidia.js":
560/*!************************************************!*\
561  !*** ./webpack/js/scripts/shareSocialMidia.js ***!
562  \************************************************/
563/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
564
565"use strict";
566
567
568Object.defineProperty(exports, "__esModule", ({
569    value: true
570}));
571
572exports["default"] = function () {
573    var shareBtn = document.querySelectorAll('.js-share-button');
574    dom.forEachEl(shareBtn, function (el) {
575        el.addEventListener('click', function (e) {
576            e.preventDefault();
577            // console.log(el.getAttribute('href'));
578            var intWidth = '660';
579            var intHeight = '600';
580            shareSocialMidia(el.getAttribute('href'), 'Social Share', intWidth, intHeight);
581        });
582    });
583};
584
585var _dom = __webpack_require__(/*! ./lib/dom.js */ "./webpack/js/scripts/lib/dom.js");
586
587var dom = _interopRequireWildcard(_dom);
588
589function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
590
591function shareSocialMidia(url, title, w, h) {
592    // Fixes dual-screen position                         Most browsers      Firefox
593    var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
594    var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
595
596    var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
597    var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
598
599    var left = width / 2 - w / 2 + dualScreenLeft;
600    var top = height / 2 - h / 2 + dualScreenTop;
601    // console.log(url);
602    // console.log(width);
603    // console.log(height);
604    // console.log(w);
605    // console.log(h);
606    var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
607
608    // Puts focus on the newWindow
609    if (window.focus) {
610        newWindow.focus();
611    };
612};
613
614;
615
616/***/ }),
617
618/***/ "./webpack/js/scripts/sliderPosts.js":
619/*!*******************************************!*\
620  !*** ./webpack/js/scripts/sliderPosts.js ***!
621  \*******************************************/
622/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
623
624"use strict";
625
626
627Object.defineProperty(exports, "__esModule", ({
628    value: true
629}));
630
631var _tinySlider = __webpack_require__(/*! tiny-slider */ "./node_modules/tiny-slider/dist/tiny-slider.js");
632
633exports["default"] = function () {
634    var exist = document.querySelectorAll(".o-post_holder__slider");
635
636    if (exist.length > 0) {
637        exist.forEach(function (holder) {
638            var slider = (0, _tinySlider.tns)({
639                container: holder,
640                autoplay: true,
641                loop: true,
642                items: 2,
643                slideBy: "page",
644                controls: false,
645                touch: true,
646                mouseDrag: true,
647                nav: false,
648                gutter: 16
649            });
650
651            var is_arrows = holder.closest(".o-post_holder__content");
652
653            if (is_arrows && is_arrows.classList.contains("active-arrows")) {
654                var arrowTimeLeft = is_arrows.querySelector(".arrow-left");
655                var arrowTimeRight = is_arrows.querySelector(".arrow-right");
656
657                if (arrowTimeLeft) {
658                    arrowTimeLeft.addEventListener("click", function () {
659                        slider.goTo("prev");
660                    });
661                }
662
663                if (arrowTimeRight) {
664                    arrowTimeRight.addEventListener("click", function () {
665                        slider.goTo("next");
666                    });
667                }
668            }
669        });
670    }
671};
672
673/***/ }),
674
675/***/ "./webpack/css/sass/inline.scss":
676/*!**************************************!*\
677  !*** ./webpack/css/sass/inline.scss ***!
678  \**************************************/
679/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
680
681"use strict";
682__webpack_require__.r(__webpack_exports__);
683// extracted by mini-css-extract-plugin
684
685
686/***/ }),
687
688/***/ "./webpack/css/sass/main.scss":
689/*!************************************!*\
690  !*** ./webpack/css/sass/main.scss ***!
691  \************************************/
692/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
693
694"use strict";
695__webpack_require__.r(__webpack_exports__);
696// extracted by mini-css-extract-plugin
697
698
699/***/ }),
700
vendor: 19,516 bytes, lines 701-1202
701/***/ "./node_modules/rellax/rellax.js":
702/*!***************************************!*\
703  !*** ./node_modules/rellax/rellax.js ***!
704  \***************************************/
705/***/ ((module, exports, __webpack_require__) => {
706
707var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
708// ------------------------------------------
709// Rellax.js
710// Buttery smooth parallax library
711// Copyright (c) 2016 Moe Amaya (@moeamaya)
712// MIT license
713//
714// Thanks to Paraxify.js and Jaime Cabllero
715// for parallax concepts
716// ------------------------------------------
717
718(function (root, factory) {
719  if (true) {
720    // AMD. Register as an anonymous module.
721    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
722		__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
723		(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
724		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
725  } else {}
726}(typeof window !== "undefined" ? window : __webpack_require__.g, function () {
727  var Rellax = function(el, options){
728    "use strict";
729
730    var self = Object.create(Rellax.prototype);
731
732    var posY = 0;
733    var screenY = 0;
734    var posX = 0;
735    var screenX = 0;
736    var blocks = [];
737    var pause = true;
738
739    // check what requestAnimationFrame to use, and if
740    // it's not supported, use the onscroll event
741    var loop = window.requestAnimationFrame ||
742      window.webkitRequestAnimationFrame ||
743      window.mozRequestAnimationFrame ||
744      window.msRequestAnimationFrame ||
745      window.oRequestAnimationFrame ||
746      function(callback){ return setTimeout(callback, 1000 / 60); };
747
748    // store the id for later use
749    var loopId = null;
750
751    // Test via a getter in the options object to see if the passive property is accessed
752    var supportsPassive = false;
753    try {
754      var opts = Object.defineProperty({}, 'passive', {
755        get: function() {
756          supportsPassive = true;
757        }
758      });
759      window.addEventListener("testPassive", null, opts);
760      window.removeEventListener("testPassive", null, opts);
761    } catch (e) {}
762
763    // check what cancelAnimation method to use
764    var clearLoop = window.cancelAnimationFrame || window.mozCancelAnimationFrame || clearTimeout;
765
766    // check which transform property to use
767    var transformProp = window.transformProp || (function(){
768        var testEl = document.createElement('div');
769        if (testEl.style.transform === null) {
770          var vendors = ['Webkit', 'Moz', 'ms'];
771          for (var vendor in vendors) {
772            if (testEl.style[ vendors[vendor] + 'Transform' ] !== undefined) {
773              return vendors[vendor] + 'Transform';
774            }
775          }
776        }
777        return 'transform';
778      })();
779
780    // Default Settings
781    self.options = {
782      speed: -2,
783	    verticalSpeed: null,
784	    horizontalSpeed: null,
785      breakpoints: [576, 768, 1201],
786      center: false,
787      wrapper: null,
788      relativeToWrapper: false,
789      round: true,
790      vertical: true,
791      horizontal: false,
792      verticalScrollAxis: "y",
793      horizontalScrollAxis: "x",
794      callback: function() {},
795    };
796
797    // User defined options (might have more in the future)
798    if (options){
799      Object.keys(options).forEach(function(key){
800        self.options[key] = options[key];
801      });
802    }
803
804    function validateCustomBreakpoints () {
805      if (self.options.breakpoints.length === 3 && Array.isArray(self.options.breakpoints)) {
806        var isAscending = true;
807        var isNumerical = true;
808        var lastVal;
809        self.options.breakpoints.forEach(function (i) {
810          if (typeof i !== 'number') isNumerical = false;
811          if (lastVal !== null) {
812            if (i < lastVal) isAscending = false;
813          }
814          lastVal = i;
815        });
816        if (isAscending && isNumerical) return;
817      }
818      // revert defaults if set incorrectly
819      self.options.breakpoints = [576, 768, 1201];
820      console.warn("Rellax: You must pass an array of 3 numbers in ascending order to the breakpoints option. Defaults reverted");
821    }
822
823    if (options && options.breakpoints) {
824      validateCustomBreakpoints();
825    }
826
827    // By default, rellax class
828    if (!el) {
829      el = '.rellax';
830    }
831
832    // check if el is a className or a node
833    var elements = typeof el === 'string' ? document.querySelectorAll(el) : [el];
834
835    // Now query selector
836    if (elements.length > 0) {
837      self.elems = elements;
838    }
839
840    // The elements don't exist
841    else {
842      console.warn("Rellax: The elements you're trying to select don't exist.");
843      return;
844    }
845
846    // Has a wrapper and it exists
847    if (self.options.wrapper) {
848      if (!self.options.wrapper.nodeType) {
849        var wrapper = document.querySelector(self.options.wrapper);
850
851        if (wrapper) {
852          self.options.wrapper = wrapper;
853        } else {
854          console.warn("Rellax: The wrapper you're trying to use doesn't exist.");
855          return;
856        }
857      }
858    }
859
860    // set a placeholder for the current breakpoint
861    var currentBreakpoint;
862
863    // helper to determine current breakpoint
864    var getCurrentBreakpoint = function (w) {
865      var bp = self.options.breakpoints;
866      if (w < bp[0]) return 'xs';
867      if (w >= bp[0] && w < bp[1]) return 'sm';
868      if (w >= bp[1] && w < bp[2]) return 'md';
869      return 'lg';
870    };
871
872    // Get and cache initial position of all elements
873    var cacheBlocks = function() {
874      for (var i = 0; i < self.elems.length; i++){
875        var block = createBlock(self.elems[i]);
876        blocks.push(block);
877      }
878    };
879
880
881    // Let's kick this script off
882    // Build array for cached element values
883    var init = function() {
884      for (var i = 0; i < blocks.length; i++){
885        self.elems[i].style.cssText = blocks[i].style;
886      }
887
888      blocks = [];
889
890      screenY = window.innerHeight;
891      screenX = window.innerWidth;
892      currentBreakpoint = getCurrentBreakpoint(screenX);
893
894      setPosition();
895
896      cacheBlocks();
897
898      animate();
899
900      // If paused, unpause and set listener for window resizing events
901      if (pause) {
902        window.addEventListener('resize', init);
903        pause = false;
904        // Start the loop
905        update();
906      }
907    };
908
909    // We want to cache the parallax blocks'
910    // values: base, top, height, speed
911    // el: is dom object, return: el cache values
912    var createBlock = function(el) {
913      var dataPercentage = el.getAttribute( 'data-rellax-percentage' );
914      var dataSpeed = el.getAttribute( 'data-rellax-speed' );
915      var dataXsSpeed = el.getAttribute( 'data-rellax-xs-speed' );
916      var dataMobileSpeed = el.getAttribute( 'data-rellax-mobile-speed' );
917      var dataTabletSpeed = el.getAttribute( 'data-rellax-tablet-speed' );
918      var dataDesktopSpeed = el.getAttribute( 'data-rellax-desktop-speed' );
919      var dataVerticalSpeed = el.getAttribute('data-rellax-vertical-speed');
920      var dataHorizontalSpeed = el.getAttribute('data-rellax-horizontal-speed');
921      var dataVericalScrollAxis = el.getAttribute('data-rellax-vertical-scroll-axis');
922      var dataHorizontalScrollAxis = el.getAttribute('data-rellax-horizontal-scroll-axis');
923      var dataZindex = el.getAttribute( 'data-rellax-zindex' ) || 0;
924      var dataMin = el.getAttribute( 'data-rellax-min' );
925      var dataMax = el.getAttribute( 'data-rellax-max' );
926      var dataMinX = el.getAttribute('data-rellax-min-x');
927      var dataMaxX = el.getAttribute('data-rellax-max-x');
928      var dataMinY = el.getAttribute('data-rellax-min-y');
929      var dataMaxY = el.getAttribute('data-rellax-max-y');
930      var mapBreakpoints;
931      var breakpoints = true;
932
933      if (!dataXsSpeed && !dataMobileSpeed && !dataTabletSpeed && !dataDesktopSpeed) {
934        breakpoints = false;
935      } else {
936        mapBreakpoints = {
937          'xs': dataXsSpeed,
938          'sm': dataMobileSpeed,
939          'md': dataTabletSpeed,
940          'lg': dataDesktopSpeed
941        };
942      }
943
944      // initializing at scrollY = 0 (top of browser), scrollX = 0 (left of browser)
945      // ensures elements are positioned based on HTML layout.
946      //
947      // If the element has the percentage attribute, the posY and posX needs to be
948      // the current scroll position's value, so that the elements are still positioned based on HTML layout
949      var wrapperPosY = self.options.wrapper ? self.options.wrapper.scrollTop : (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
950      // If the option relativeToWrapper is true, use the wrappers offset to top, subtracted from the current page scroll.
951      if (self.options.relativeToWrapper) {
952        var scrollPosY = (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
953        wrapperPosY = scrollPosY - self.options.wrapper.offsetTop;
954      }
955      var posY = self.options.vertical ? ( dataPercentage || self.options.center ? wrapperPosY : 0 ) : 0;
956      var posX = self.options.horizontal ? ( dataPercentage || self.options.center ? self.options.wrapper ? self.options.wrapper.scrollLeft : (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft) : 0 ) : 0;
957
958      var blockTop = posY + el.getBoundingClientRect().top;
959      var blockHeight = el.clientHeight || el.offsetHeight || el.scrollHeight;
960
961      var blockLeft = posX + el.getBoundingClientRect().left;
962      var blockWidth = el.clientWidth || el.offsetWidth || el.scrollWidth;
963
964      // apparently parallax equation everyone uses
965      var percentageY = dataPercentage ? dataPercentage : (posY - blockTop + screenY) / (blockHeight + screenY);
966      var percentageX = dataPercentage ? dataPercentage : (posX - blockLeft + screenX) / (blockWidth + screenX);
967      if(self.options.center){ percentageX = 0.5; percentageY = 0.5; }
968
969      // Optional individual block speed as data attr, otherwise global speed
970      var speed = (breakpoints && mapBreakpoints[currentBreakpoint] !== null) ? Number(mapBreakpoints[currentBreakpoint]) : (dataSpeed ? dataSpeed : self.options.speed);
971      var verticalSpeed = dataVerticalSpeed ? dataVerticalSpeed : self.options.verticalSpeed;
972      var horizontalSpeed = dataHorizontalSpeed ? dataHorizontalSpeed : self.options.horizontalSpeed;
973
974      // Optional individual block movement axis direction as data attr, otherwise gobal movement direction
975      var verticalScrollAxis = dataVericalScrollAxis ? dataVericalScrollAxis : self.options.verticalScrollAxis;
976      var horizontalScrollAxis = dataHorizontalScrollAxis ? dataHorizontalScrollAxis : self.options.horizontalScrollAxis;
977
978      var bases = updatePosition(percentageX, percentageY, speed, verticalSpeed, horizontalSpeed);
979
980      // ~~Store non-translate3d transforms~~
981      // Store inline styles and extract transforms
982      var style = el.style.cssText;
983      var transform = '';
984
985      // Check if there's an inline styled transform
986      var searchResult = /transform\s*:/i.exec(style);
987      if (searchResult) {
988        // Get the index of the transform
989        var index = searchResult.index;
990
991        // Trim the style to the transform point and get the following semi-colon index
992        var trimmedStyle = style.slice(index);
993        var delimiter = trimmedStyle.indexOf(';');
994
995        // Remove "transform" string and save the attribute
996        if (delimiter) {
997          transform = " " + trimmedStyle.slice(11, delimiter).replace(/\s/g,'');
998        } else {
999          transform = " " + trimmedStyle.slice(11).replace(/\s/g,'');
1000        }
1001      }
1002
1003      return {
1004        baseX: bases.x,
1005        baseY: bases.y,
1006        top: blockTop,
1007        left: blockLeft,
1008        height: blockHeight,
1009        width: blockWidth,
1010        speed: speed,
1011        verticalSpeed: verticalSpeed,
1012        horizontalSpeed: horizontalSpeed,
1013        verticalScrollAxis: verticalScrollAxis,
1014        horizontalScrollAxis: horizontalScrollAxis,
1015        style: style,
1016        transform: transform,
1017        zindex: dataZindex,
1018        min: dataMin,
1019        max: dataMax,
1020        minX: dataMinX,
1021        maxX: dataMaxX,
1022        minY: dataMinY,
1023        maxY: dataMaxY
1024      };
1025    };
1026
1027    // set scroll position (posY, posX)
1028    // side effect method is not ideal, but okay for now
1029    // returns true if the scroll changed, false if nothing happened
1030    var setPosition = function() {
1031      var oldY = posY;
1032      var oldX = posX;
1033
1034      posY = self.options.wrapper ? self.options.wrapper.scrollTop : (document.documentElement || document.body.parentNode || document.body).scrollTop || window.pageYOffset;
1035      posX = self.options.wrapper ? self.options.wrapper.scrollLeft : (document.documentElement || document.body.parentNode || document.body).scrollLeft || window.pageXOffset;
1036      // If option relativeToWrapper is true, use relative wrapper value instead.
1037      if (self.options.relativeToWrapper) {
1038        var scrollPosY = (document.documentElement || document.body.parentNode || document.body).scrollTop || window.pageYOffset;
1039        posY = scrollPosY - self.options.wrapper.offsetTop;
1040      }
1041
1042
1043      if (oldY != posY && self.options.vertical) {
1044        // scroll changed, return true
1045        return true;
1046      }
1047
1048      if (oldX != posX && self.options.horizontal) {
1049        // scroll changed, return true
1050        return true;
1051      }
1052
1053      // scroll did not change
1054      return false;
1055    };
1056
1057    // Ahh a pure function, gets new transform value
1058    // based on scrollPosition and speed
1059    // Allow for decimal pixel values
1060    var updatePosition = function(percentageX, percentageY, speed, verticalSpeed, horizontalSpeed) {
1061      var result = {};
1062      var valueX = ((horizontalSpeed ? horizontalSpeed : speed) * (100 * (1 - percentageX)));
1063      var valueY = ((verticalSpeed ? verticalSpeed : speed) * (100 * (1 - percentageY)));
1064
1065      result.x = self.options.round ? Math.round(valueX) : Math.round(valueX * 100) / 100;
1066      result.y = self.options.round ? Math.round(valueY) : Math.round(valueY * 100) / 100;
1067
1068      return result;
1069    };
1070
1071    // Remove event listeners and loop again
1072    var deferredUpdate = function() {
1073      window.removeEventListener('resize', deferredUpdate);
1074      window.removeEventListener('orientationchange', deferredUpdate);
1075      (self.options.wrapper ? self.options.wrapper : window).removeEventListener('scroll', deferredUpdate);
1076      (self.options.wrapper ? self.options.wrapper : document).removeEventListener('touchmove', deferredUpdate);
1077
1078      // loop again
1079      loopId = loop(update);
1080    };
1081
1082    // Loop
1083    var update = function() {
1084      if (setPosition() && pause === false) {
1085        animate();
1086
1087        // loop again
1088        loopId = loop(update);
1089      } else {
1090        loopId = null;
1091
1092        // Don't animate until we get a position updating event
1093        window.addEventListener('resize', deferredUpdate);
1094        window.addEventListener('orientationchange', deferredUpdate);
1095        (self.options.wrapper ? self.options.wrapper : window).addEventListener('scroll', deferredUpdate, supportsPassive ? { passive: true } : false);
1096        (self.options.wrapper ? self.options.wrapper : document).addEventListener('touchmove', deferredUpdate, supportsPassive ? { passive: true } : false);
1097      }
1098    };
1099
1100    // Transform3d on parallax element
1101    var animate = function() {
1102      var positions;
1103      for (var i = 0; i < self.elems.length; i++){
1104        // Determine relevant movement directions
1105        var verticalScrollAxis = blocks[i].verticalScrollAxis.toLowerCase();
1106        var horizontalScrollAxis = blocks[i].horizontalScrollAxis.toLowerCase();
1107        var verticalScrollX = verticalScrollAxis.indexOf("x") != -1 ? posY : 0;
1108        var verticalScrollY = verticalScrollAxis.indexOf("y") != -1 ? posY : 0;
1109        var horizontalScrollX = horizontalScrollAxis.indexOf("x") != -1 ? posX : 0;
1110        var horizontalScrollY = horizontalScrollAxis.indexOf("y") != -1 ? posX : 0;
1111
1112        var percentageY = ((verticalScrollY + horizontalScrollY - blocks[i].top + screenY) / (blocks[i].height + screenY));
1113        var percentageX = ((verticalScrollX + horizontalScrollX - blocks[i].left + screenX) / (blocks[i].width + screenX));
1114
1115        // Subtracting initialize value, so element stays in same spot as HTML
1116        positions = updatePosition(percentageX, percentageY, blocks[i].speed, blocks[i].verticalSpeed, blocks[i].horizontalSpeed);
1117        var positionY = positions.y - blocks[i].baseY;
1118        var positionX = positions.x - blocks[i].baseX;
1119
1120        // The next two "if" blocks go like this:
1121        // Check if a limit is defined (first "min", then "max");
1122        // Check if we need to change the Y or the X
1123        // (Currently working only if just one of the axes is enabled)
1124        // Then, check if the new position is inside the allowed limit
1125        // If so, use new position. If not, set position to limit.
1126
1127        // Check if a min limit is defined
1128        if (blocks[i].min !== null) {
1129          if (self.options.vertical && !self.options.horizontal) {
1130            positionY = positionY <= blocks[i].min ? blocks[i].min : positionY;
1131          }
1132          if (self.options.horizontal && !self.options.vertical) {
1133            positionX = positionX <= blocks[i].min ? blocks[i].min : positionX;
1134          }
1135        }
1136
1137        // Check if directional min limits are defined
1138        if (blocks[i].minY != null) {
1139            positionY = positionY <= blocks[i].minY ? blocks[i].minY : positionY;
1140        }
1141        if (blocks[i].minX != null) {
1142            positionX = positionX <= blocks[i].minX ? blocks[i].minX : positionX;
1143        }
1144
1145        // Check if a max limit is defined
1146        if (blocks[i].max !== null) {
1147          if (self.options.vertical && !self.options.horizontal) {
1148            positionY = positionY >= blocks[i].max ? blocks[i].max : positionY;
1149          }
1150          if (self.options.horizontal && !self.options.vertical) {
1151            positionX = positionX >= blocks[i].max ? blocks[i].max : positionX;
1152          }
1153        }
1154
1155        // Check if directional max limits are defined
1156        if (blocks[i].maxY != null) {
1157            positionY = positionY >= blocks[i].maxY ? blocks[i].maxY : positionY;
1158        }
1159        if (blocks[i].maxX != null) {
1160            positionX = positionX >= blocks[i].maxX ? blocks[i].maxX : positionX;
1161        }
1162
1163        var zindex = blocks[i].zindex;
1164
1165        // Move that element
1166        // (Set the new translation and append initial inline transforms.)
1167        var translate = 'translate3d(' + (self.options.horizontal ? positionX : '0') + 'px,' + (self.options.vertical ? positionY : '0') + 'px,' + zindex + 'px) ' + blocks[i].transform;
1168        self.elems[i].style[transformProp] = translate;
1169      }
1170      self.options.callback(positions);
1171    };
1172
1173    self.destroy = function() {
1174      for (var i = 0; i < self.elems.length; i++){
1175        self.elems[i].style.cssText = blocks[i].style;
1176      }
1177
1178      // Remove resize event listener if not pause, and pause
1179      if (!pause) {
1180        window.removeEventListener('resize', init);
1181        pause = true;
1182      }
1183
1184      // Clear the animation loop to prevent possible memory leak
1185      clearLoop(loopId);
1186      loopId = null;
1187    };
1188
1189    // Init
1190    init();
1191
1192    // Allow to recalculate the initial values whenever we want
1193    self.refresh = init;
1194
1195    return self;
1196  };
1197  return Rellax;
1198}));
1199
1200
1201/***/ }),
1202
vendor: 102,516 bytes, lines 1203-4883
1203/***/ "./node_modules/tiny-slider/dist/tiny-slider.js":
1204/*!******************************************************!*\
1205  !*** ./node_modules/tiny-slider/dist/tiny-slider.js ***!
1206  \******************************************************/
1207/***/ ((__unused_webpack_module, exports) => {
1208
1209"use strict";
1210
1211
1212Object.defineProperty(exports, "__esModule", ({ value: true }));
1213
1214var win$1 = window;
1215var raf = win$1.requestAnimationFrame || win$1.webkitRequestAnimationFrame || win$1.mozRequestAnimationFrame || win$1.msRequestAnimationFrame || function (cb) {
1216  return setTimeout(cb, 16);
1217};
1218
1219var win = window;
1220var caf = win.cancelAnimationFrame || win.mozCancelAnimationFrame || function (id) {
1221  clearTimeout(id);
1222};
1223
1224function extend() {
1225  var obj,
1226      name,
1227      copy,
1228      target = arguments[0] || {},
1229      i = 1,
1230      length = arguments.length;
1231
1232  for (; i < length; i++) {
1233    if ((obj = arguments[i]) !== null) {
1234      for (name in obj) {
1235        copy = obj[name];
1236
1237        if (target === copy) {
1238          continue;
1239        } else if (copy !== undefined) {
1240          target[name] = copy;
1241        }
1242      }
1243    }
1244  }
1245
1246  return target;
1247}
1248
1249function checkStorageValue(value) {
1250  return ['true', 'false'].indexOf(value) >= 0 ? JSON.parse(value) : value;
1251}
1252
1253function setLocalStorage(storage, key, value, access) {
1254  if (access) {
1255    try {
1256      storage.setItem(key, value);
1257    } catch (e) {}
1258  }
1259
1260  return value;
1261}
1262
1263function getSlideId() {
1264  var id = window.tnsId;
1265  window.tnsId = !id ? 1 : id + 1;
1266  return 'tns' + window.tnsId;
1267}
1268
1269function getBody() {
1270  var doc = document,
1271      body = doc.body;
1272
1273  if (!body) {
1274    body = doc.createElement('body');
1275    body.fake = true;
1276  }
1277
1278  return body;
1279}
1280
1281var docElement = document.documentElement;
1282
1283function setFakeBody(body) {
1284  var docOverflow = '';
1285
1286  if (body.fake) {
1287    docOverflow = docElement.style.overflow; //avoid crashing IE8, if background image is used
1288
1289    body.style.background = ''; //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible
1290
1291    body.style.overflow = docElement.style.overflow = 'hidden';
1292    docElement.appendChild(body);
1293  }
1294
1295  return docOverflow;
1296}
1297
1298function resetFakeBody(body, docOverflow) {
1299  if (body.fake) {
1300    body.remove();
1301    docElement.style.overflow = docOverflow; // Trigger layout so kinetic scrolling isn't disabled in iOS6+
1302    // eslint-disable-next-line
1303
1304    docElement.offsetHeight;
1305  }
1306}
1307
1308// get css-calc 
1309function calc() {
1310  var doc = document,
1311      body = getBody(),
1312      docOverflow = setFakeBody(body),
1313      div = doc.createElement('div'),
1314      result = false;
1315  body.appendChild(div);
1316
1317  try {
1318    var str = '(10px * 10)',
1319        vals = ['calc' + str, '-moz-calc' + str, '-webkit-calc' + str],
1320        val;
1321
1322    for (var i = 0; i < 3; i++) {
1323      val = vals[i];
1324      div.style.width = val;
1325
1326      if (div.offsetWidth === 100) {
1327        result = val.replace(str, '');
1328        break;
1329      }
1330    }
1331  } catch (e) {}
1332
1333  body.fake ? resetFakeBody(body, docOverflow) : div.remove();
1334  return result;
1335}
1336
1337// get subpixel support value
1338function percentageLayout() {
1339  // check subpixel layout supporting
1340  var doc = document,
1341      body = getBody(),
1342      docOverflow = setFakeBody(body),
1343      wrapper = doc.createElement('div'),
1344      outer = doc.createElement('div'),
1345      str = '',
1346      count = 70,
1347      perPage = 3,
1348      supported = false;
1349  wrapper.className = "tns-t-subp2";
1350  outer.className = "tns-t-ct";
1351
1352  for (var i = 0; i < count; i++) {
1353    str += '<div></div>';
1354  }
1355
1356  outer.innerHTML = str;
1357  wrapper.appendChild(outer);
1358  body.appendChild(wrapper);
1359  supported = Math.abs(wrapper.getBoundingClientRect().left - outer.children[count - perPage].getBoundingClientRect().left) < 2;
1360  body.fake ? resetFakeBody(body, docOverflow) : wrapper.remove();
1361  return supported;
1362}
1363
1364function mediaquerySupport() {
1365  if (window.matchMedia || window.msMatchMedia) {
1366    return true;
1367  }
1368
1369  var doc = document,
1370      body = getBody(),
1371      docOverflow = setFakeBody(body),
1372      div = doc.createElement('div'),
1373      style = doc.createElement('style'),
1374      rule = '@media all and (min-width:1px){.tns-mq-test{position:absolute}}',
1375      position;
1376  style.type = 'text/css';
1377  div.className = 'tns-mq-test';
1378  body.appendChild(style);
1379  body.appendChild(div);
1380
1381  if (style.styleSheet) {
1382    style.styleSheet.cssText = rule;
1383  } else {
1384    style.appendChild(doc.createTextNode(rule));
1385  }
1386
1387  position = window.getComputedStyle ? window.getComputedStyle(div).position : div.currentStyle['position'];
1388  body.fake ? resetFakeBody(body, docOverflow) : div.remove();
1389  return position === "absolute";
1390}
1391
1392// create and append style sheet
1393function createStyleSheet(media, nonce) {
1394  // Create the <style> tag
1395  var style = document.createElement("style"); // style.setAttribute("type", "text/css");
1396  // Add a media (and/or media query) here if you'd like!
1397  // style.setAttribute("media", "screen")
1398  // style.setAttribute("media", "only screen and (max-width : 1024px)")
1399
1400  if (media) {
1401    style.setAttribute("media", media);
1402  } // Add nonce attribute for Content Security Policy
1403
1404
1405  if (nonce) {
1406    style.setAttribute("nonce", nonce);
1407  } // WebKit hack :(
1408  // style.appendChild(document.createTextNode(""));
1409  // Add the <style> element to the page
1410
1411
1412  document.querySelector('head').appendChild(style);
1413  return style.sheet ? style.sheet : style.styleSheet;
1414}
1415
1416// cross browsers addRule method
1417function addCSSRule(sheet, selector, rules, index) {
1418  // return raf(function() {
1419  'insertRule' in sheet ? sheet.insertRule(selector + '{' + rules + '}', index) : sheet.addRule(selector, rules, index); // });
1420}
1421
1422// cross browsers addRule method
1423function removeCSSRule(sheet, index) {
1424  // return raf(function() {
1425  'deleteRule' in sheet ? sheet.deleteRule(index) : sheet.removeRule(index); // });
1426}
1427
1428function getCssRulesLength(sheet) {
1429  var rule = 'insertRule' in sheet ? sheet.cssRules : sheet.rules;
1430  return rule.length;
1431}
1432
1433function toDegree(y, x) {
1434  return Math.atan2(y, x) * (180 / Math.PI);
1435}
1436
1437function getTouchDirection(angle, range) {
1438  var direction = false,
1439      gap = Math.abs(90 - Math.abs(angle));
1440
1441  if (gap >= 90 - range) {
1442    direction = 'horizontal';
1443  } else if (gap <= range) {
1444    direction = 'vertical';
1445  }
1446
1447  return direction;
1448}
1449
1450// https://toddmotto.com/ditch-the-array-foreach-call-nodelist-hack/
1451function forEach(arr, callback, scope) {
1452  for (var i = 0, l = arr.length; i < l; i++) {
1453    callback.call(scope, arr[i], i);
1454  }
1455}
1456
1457var classListSupport = ('classList' in document.createElement('_'));
1458
1459var hasClass = classListSupport ? function (el, str) {
1460  return el.classList.contains(str);
1461} : function (el, str) {
1462  return el.className.indexOf(str) >= 0;
1463};
1464
1465var addClass = classListSupport ? function (el, str) {
1466  if (!hasClass(el, str)) {
1467    el.classList.add(str);
1468  }
1469} : function (el, str) {
1470  if (!hasClass(el, str)) {
1471    el.className += ' ' + str;
1472  }
1473};
1474
1475var removeClass = classListSupport ? function (el, str) {
1476  if (hasClass(el, str)) {
1477    el.classList.remove(str);
1478  }
1479} : function (el, str) {
1480  if (hasClass(el, str)) {
1481    el.className = el.className.replace(str, '');
1482  }
1483};
1484
1485function hasAttr(el, attr) {
1486  return el.hasAttribute(attr);
1487}
1488
1489function getAttr(el, attr) {
1490  return el.getAttribute(attr);
1491}
1492
1493function isNodeList(el) {
1494  // Only NodeList has the "item()" function
1495  return typeof el.item !== "undefined";
1496}
1497
1498function setAttrs(els, attrs) {
1499  els = isNodeList(els) || els instanceof Array ? els : [els];
1500
1501  if (Object.prototype.toString.call(attrs) !== '[object Object]') {
1502    return;
1503  }
1504
1505  for (var i = els.length; i--;) {
1506    for (var key in attrs) {
1507      els[i].setAttribute(key, attrs[key]);
1508    }
1509  }
1510}
1511
1512function removeAttrs(els, attrs) {
1513  els = isNodeList(els) || els instanceof Array ? els : [els];
1514  attrs = attrs instanceof Array ? attrs : [attrs];
1515  var attrLength = attrs.length;
1516
1517  for (var i = els.length; i--;) {
1518    for (var j = attrLength; j--;) {
1519      els[i].removeAttribute(attrs[j]);
1520    }
1521  }
1522}
1523
1524function arrayFromNodeList(nl) {
1525  var arr = [];
1526
1527  for (var i = 0, l = nl.length; i < l; i++) {
1528    arr.push(nl[i]);
1529  }
1530
1531  return arr;
1532}
1533
1534function hideElement(el, forceHide) {
1535  if (el.style.display !== 'none') {
1536    el.style.display = 'none';
1537  }
1538}
1539
1540function showElement(el, forceHide) {
1541  if (el.style.display === 'none') {
1542    el.style.display = '';
1543  }
1544}
1545
1546function isVisible(el) {
1547  return window.getComputedStyle(el).display !== 'none';
1548}
1549
1550function whichProperty(props) {
1551  if (typeof props === 'string') {
1552    var arr = [props],
1553        Props = props.charAt(0).toUpperCase() + props.substr(1),
1554        prefixes = ['Webkit', 'Moz', 'ms', 'O'];
1555    prefixes.forEach(function (prefix) {
1556      if (prefix !== 'ms' || props === 'transform') {
1557        arr.push(prefix + Props);
1558      }
1559    });
1560    props = arr;
1561  }
1562
1563  var el = document.createElement('fakeelement');
1564      props.length;
1565
1566  for (var i = 0; i < props.length; i++) {
1567    var prop = props[i];
1568
1569    if (el.style[prop] !== undefined) {
1570      return prop;
1571    }
1572  }
1573
1574  return false; // explicit for ie9-
1575}
1576
1577function has3DTransforms(tf) {
1578  if (!tf) {
1579    return false;
1580  }
1581
1582  if (!window.getComputedStyle) {
1583    return false;
1584  }
1585
1586  var doc = document,
1587      body = getBody(),
1588      docOverflow = setFakeBody(body),
1589      el = doc.createElement('p'),
1590      has3d,
1591      cssTF = tf.length > 9 ? '-' + tf.slice(0, -9).toLowerCase() + '-' : '';
1592  cssTF += 'transform'; // Add it to the body to get the computed style
1593
1594  body.insertBefore(el, null);
1595  el.style[tf] = 'translate3d(1px,1px,1px)';
1596  has3d = window.getComputedStyle(el).getPropertyValue(cssTF);
1597  body.fake ? resetFakeBody(body, docOverflow) : el.remove();
1598  return has3d !== undefined && has3d.length > 0 && has3d !== "none";
1599}
1600
1601// get transitionend, animationend based on transitionDuration
1602// @propin: string
1603// @propOut: string, first-letter uppercase
1604// Usage: getEndProperty('WebkitTransitionDuration', 'Transition') => webkitTransitionEnd
1605function getEndProperty(propIn, propOut) {
1606  var endProp = false;
1607
1608  if (/^Webkit/.test(propIn)) {
1609    endProp = 'webkit' + propOut + 'End';
1610  } else if (/^O/.test(propIn)) {
1611    endProp = 'o' + propOut + 'End';
1612  } else if (propIn) {
1613    endProp = propOut.toLowerCase() + 'end';
1614  }
1615
1616  return endProp;
1617}
1618
1619// Test via a getter in the options object to see if the passive property is accessed
1620var supportsPassive = false;
1621
1622try {
1623  var opts = Object.defineProperty({}, 'passive', {
1624    get: function () {
1625      supportsPassive = true;
1626    }
1627  });
1628  window.addEventListener("test", null, opts);
1629} catch (e) {}
1630
1631var passiveOption = supportsPassive ? {
1632  passive: true
1633} : false;
1634
1635function addEvents(el, obj, preventScrolling) {
1636  for (var prop in obj) {
1637    var option = ['touchstart', 'touchmove'].indexOf(prop) >= 0 && !preventScrolling ? passiveOption : false;
1638    el.addEventListener(prop, obj[prop], option);
1639  }
1640}
1641
1642function removeEvents(el, obj) {
1643  for (var prop in obj) {
1644    var option = ['touchstart', 'touchmove'].indexOf(prop) >= 0 ? passiveOption : false;
1645    el.removeEventListener(prop, obj[prop], option);
1646  }
1647}
1648
1649function Events() {
1650  return {
1651    topics: {},
1652    on: function (eventName, fn) {
1653      this.topics[eventName] = this.topics[eventName] || [];
1654      this.topics[eventName].push(fn);
1655    },
1656    off: function (eventName, fn) {
1657      if (this.topics[eventName]) {
1658        for (var i = 0; i < this.topics[eventName].length; i++) {
1659          if (this.topics[eventName][i] === fn) {
1660            this.topics[eventName].splice(i, 1);
1661            break;
1662          }
1663        }
1664      }
1665    },
1666    emit: function (eventName, data) {
1667      data.type = eventName;
1668
1669      if (this.topics[eventName]) {
1670        this.topics[eventName].forEach(function (fn) {
1671          fn(data, eventName);
1672        });
1673      }
1674    }
1675  };
1676}
1677
1678function jsTransform(element, attr, prefix, postfix, to, duration, callback) {
1679  var tick = Math.min(duration, 10),
1680      unit = to.indexOf('%') >= 0 ? '%' : 'px',
1681      to = to.replace(unit, ''),
1682      from = Number(element.style[attr].replace(prefix, '').replace(postfix, '').replace(unit, '')),
1683      positionTick = (to - from) / duration * tick;
1684  setTimeout(moveElement, tick);
1685
1686  function moveElement() {
1687    duration -= tick;
1688    from += positionTick;
1689    element.style[attr] = prefix + from + unit + postfix;
1690
1691    if (duration > 0) {
1692      setTimeout(moveElement, tick);
1693    } else {
1694      callback();
1695    }
1696  }
1697}
1698
1699// Object.keys
1700if (!Object.keys) {
1701  Object.keys = function (object) {
1702    var keys = [];
1703
1704    for (var name in object) {
1705      if (Object.prototype.hasOwnProperty.call(object, name)) {
1706        keys.push(name);
1707      }
1708    }
1709
1710    return keys;
1711  };
1712} // ChildNode.remove
1713
1714
1715if (!("remove" in Element.prototype)) {
1716  Element.prototype.remove = function () {
1717    if (this.parentNode) {
1718      this.parentNode.removeChild(this);
1719    }
1720  };
1721}
1722var tns = function (options) {
1723  options = extend({
1724    container: '.slider',
1725    mode: 'carousel',
1726    axis: 'horizontal',
1727    items: 1,
1728    gutter: 0,
1729    edgePadding: 0,
1730    fixedWidth: false,
1731    autoWidth: false,
1732    viewportMax: false,
1733    slideBy: 1,
1734    center: false,
1735    controls: true,
1736    controlsPosition: 'top',
1737    controlsText: ['prev', 'next'],
1738    controlsContainer: false,
1739    prevButton: false,
1740    nextButton: false,
1741    nav: true,
1742    navPosition: 'top',
1743    navContainer: false,
1744    navAsThumbnails: false,
1745    arrowKeys: false,
1746    speed: 300,
1747    autoplay: false,
1748    autoplayPosition: 'top',
1749    autoplayTimeout: 5000,
1750    autoplayDirection: 'forward',
1751    autoplayText: ['start', 'stop'],
1752    autoplayHoverPause: false,
1753    autoplayButton: false,
1754    autoplayButtonOutput: true,
1755    autoplayResetOnVisibility: true,
1756    animateIn: 'tns-fadeIn',
1757    animateOut: 'tns-fadeOut',
1758    animateNormal: 'tns-normal',
1759    animateDelay: false,
1760    loop: true,
1761    rewind: false,
1762    autoHeight: false,
1763    responsive: false,
1764    lazyload: false,
1765    lazyloadSelector: '.tns-lazy-img',
1766    touch: true,
1767    mouseDrag: false,
1768    swipeAngle: 15,
1769    nested: false,
1770    preventActionWhenRunning: false,
1771    preventScrollOnTouch: false,
1772    freezable: true,
1773    onInit: false,
1774    useLocalStorage: true,
1775    nonce: false
1776  }, options || {});
1777  var doc = document,
1778      win = window,
1779      KEYS = {
1780    ENTER: 13,
1781    SPACE: 32,
1782    LEFT: 37,
1783    RIGHT: 39
1784  },
1785      tnsStorage = {},
1786      localStorageAccess = options.useLocalStorage;
1787
1788  if (localStorageAccess) {
1789    // check browser version and local storage access
1790    var browserInfo = navigator.userAgent;
1791    var uid = new Date();
1792
1793    try {
1794      tnsStorage = win.localStorage;
1795
1796      if (tnsStorage) {
1797        tnsStorage.setItem(uid, uid);
1798        localStorageAccess = tnsStorage.getItem(uid) == uid;
1799        tnsStorage.removeItem(uid);
1800      } else {
1801        localStorageAccess = false;
1802      }
1803
1804      if (!localStorageAccess) {
1805        tnsStorage = {};
1806      }
1807    } catch (e) {
1808      localStorageAccess = false;
1809    }
1810
1811    if (localStorageAccess) {
1812      // remove storage when browser version changes
1813      if (tnsStorage['tnsApp'] && tnsStorage['tnsApp'] !== browserInfo) {
1814        ['tC', 'tPL', 'tMQ', 'tTf', 't3D', 'tTDu', 'tTDe', 'tADu', 'tADe', 'tTE', 'tAE'].forEach(function (item) {
1815          tnsStorage.removeItem(item);
1816        });
1817      } // update browserInfo
1818
1819
1820      localStorage['tnsApp'] = browserInfo;
1821    }
1822  }
1823
1824  var CALC = tnsStorage['tC'] ? checkStorageValue(tnsStorage['tC']) : setLocalStorage(tnsStorage, 'tC', calc(), localStorageAccess),
1825      PERCENTAGELAYOUT = tnsStorage['tPL'] ? checkStorageValue(tnsStorage['tPL']) : setLocalStorage(tnsStorage, 'tPL', percentageLayout(), localStorageAccess),
1826      CSSMQ = tnsStorage['tMQ'] ? checkStorageValue(tnsStorage['tMQ']) : setLocalStorage(tnsStorage, 'tMQ', mediaquerySupport(), localStorageAccess),
1827      TRANSFORM = tnsStorage['tTf'] ? checkStorageValue(tnsStorage['tTf']) : setLocalStorage(tnsStorage, 'tTf', whichProperty('transform'), localStorageAccess),
1828      HAS3DTRANSFORMS = tnsStorage['t3D'] ? checkStorageValue(tnsStorage['t3D']) : setLocalStorage(tnsStorage, 't3D', has3DTransforms(TRANSFORM), localStorageAccess),
1829      TRANSITIONDURATION = tnsStorage['tTDu'] ? checkStorageValue(tnsStorage['tTDu']) : setLocalStorage(tnsStorage, 'tTDu', whichProperty('transitionDuration'), localStorageAccess),
1830      TRANSITIONDELAY = tnsStorage['tTDe'] ? checkStorageValue(tnsStorage['tTDe']) : setLocalStorage(tnsStorage, 'tTDe', whichProperty('transitionDelay'), localStorageAccess),
1831      ANIMATIONDURATION = tnsStorage['tADu'] ? checkStorageValue(tnsStorage['tADu']) : setLocalStorage(tnsStorage, 'tADu', whichProperty('animationDuration'), localStorageAccess),
1832      ANIMATIONDELAY = tnsStorage['tADe'] ? checkStorageValue(tnsStorage['tADe']) : setLocalStorage(tnsStorage, 'tADe', whichProperty('animationDelay'), localStorageAccess),
1833      TRANSITIONEND = tnsStorage['tTE'] ? checkStorageValue(tnsStorage['tTE']) : setLocalStorage(tnsStorage, 'tTE', getEndProperty(TRANSITIONDURATION, 'Transition'), localStorageAccess),
1834      ANIMATIONEND = tnsStorage['tAE'] ? checkStorageValue(tnsStorage['tAE']) : setLocalStorage(tnsStorage, 'tAE', getEndProperty(ANIMATIONDURATION, 'Animation'), localStorageAccess); // get element nodes from selectors
1835
1836  var supportConsoleWarn = win.console && typeof win.console.warn === "function",
1837      tnsList = ['container', 'controlsContainer', 'prevButton', 'nextButton', 'navContainer', 'autoplayButton'],
1838      optionsElements = {};
1839  tnsList.forEach(function (item) {
1840    if (typeof options[item] === 'string') {
1841      var str = options[item],
1842          el = doc.querySelector(str);
1843      optionsElements[item] = str;
1844
1845      if (el && el.nodeName) {
1846        options[item] = el;
1847      } else {
1848        if (supportConsoleWarn) {
1849          console.warn('Can\'t find', options[item]);
1850        }
1851
1852        return;
1853      }
1854    }
1855  }); // make sure at least 1 slide
1856
1857  if (options.container.children.length < 1) {
1858    if (supportConsoleWarn) {
1859      console.warn('No slides found in', options.container);
1860    }
1861
1862    return;
1863  } // update options
1864
1865
1866  var responsive = options.responsive,
1867      nested = options.nested,
1868      carousel = options.mode === 'carousel' ? true : false;
1869
1870  if (responsive) {
1871    // apply responsive[0] to options and remove it
1872    if (0 in responsive) {
1873      options = extend(options, responsive[0]);
1874      delete responsive[0];
1875    }
1876
1877    var responsiveTem = {};
1878
1879    for (var key in responsive) {
1880      var val = responsive[key]; // update responsive
1881      // from: 300: 2
1882      // to:
1883      //   300: {
1884      //     items: 2
1885      //   }
1886
1887      val = typeof val === 'number' ? {
1888        items: val
1889      } : val;
1890      responsiveTem[key] = val;
1891    }
1892
1893    responsive = responsiveTem;
1894    responsiveTem = null;
1895  } // update options
1896
1897
1898  function updateOptions(obj) {
1899    for (var key in obj) {
1900      if (!carousel) {
1901        if (key === 'slideBy') {
1902          obj[key] = 'page';
1903        }
1904
1905        if (key === 'edgePadding') {
1906          obj[key] = false;
1907        }
1908
1909        if (key === 'autoHeight') {
1910          obj[key] = false;
1911        }
1912      } // update responsive options
1913
1914
1915      if (key === 'responsive') {
1916        updateOptions(obj[key]);
1917      }
1918    }
1919  }
1920
1921  if (!carousel) {
1922    updateOptions(options);
1923  } // === define and set variables ===
1924
1925
1926  if (!carousel) {
1927    options.axis = 'horizontal';
1928    options.slideBy = 'page';
1929    options.edgePadding = false;
1930    var animateIn = options.animateIn,
1931        animateOut = options.animateOut,
1932        animateDelay = options.animateDelay,
1933        animateNormal = options.animateNormal;
1934  }
1935
1936  var horizontal = options.axis === 'horizontal' ? true : false,
1937      outerWrapper = doc.createElement('div'),
1938      innerWrapper = doc.createElement('div'),
1939      middleWrapper,
1940      container = options.container,
1941      containerParent = container.parentNode,
1942      containerHTML = container.outerHTML,
1943      slideItems = container.children,
1944      slideCount = slideItems.length,
1945      breakpointZone,
1946      windowWidth = getWindowWidth(),
1947      isOn = false;
1948
1949  if (responsive) {
1950    setBreakpointZone();
1951  }
1952
1953  if (carousel) {
1954    container.className += ' tns-vpfix';
1955  } // fixedWidth: viewport > rightBoundary > indexMax
1956
1957
1958  var autoWidth = options.autoWidth,
1959      fixedWidth = getOption('fixedWidth'),
1960      edgePadding = getOption('edgePadding'),
1961      gutter = getOption('gutter'),
1962      viewport = getViewportWidth(),
1963      center = getOption('center'),
1964      items = !autoWidth ? Math.floor(getOption('items')) : 1,
1965      slideBy = getOption('slideBy'),
1966      viewportMax = options.viewportMax || options.fixedWidthViewportWidth,
1967      arrowKeys = getOption('arrowKeys'),
1968      speed = getOption('speed'),
1969      rewind = options.rewind,
1970      loop = rewind ? false : options.loop,
1971      autoHeight = getOption('autoHeight'),
1972      controls = getOption('controls'),
1973      controlsText = getOption('controlsText'),
1974      nav = getOption('nav'),
1975      touch = getOption('touch'),
1976      mouseDrag = getOption('mouseDrag'),
1977      autoplay = getOption('autoplay'),
1978      autoplayTimeout = getOption('autoplayTimeout'),
1979      autoplayText = getOption('autoplayText'),
1980      autoplayHoverPause = getOption('autoplayHoverPause'),
1981      autoplayResetOnVisibility = getOption('autoplayResetOnVisibility'),
1982      sheet = createStyleSheet(null, getOption('nonce')),
1983      lazyload = options.lazyload,
1984      lazyloadSelector = options.lazyloadSelector,
1985      slidePositions,
1986      // collection of slide positions
1987  slideItemsOut = [],
1988      cloneCount = loop ? getCloneCountForLoop() : 0,
1989      slideCountNew = !carousel ? slideCount + cloneCount : slideCount + cloneCount * 2,
1990      hasRightDeadZone = (fixedWidth || autoWidth) && !loop ? true : false,
1991      rightBoundary = fixedWidth ? getRightBoundary() : null,
1992      updateIndexBeforeTransform = !carousel || !loop ? true : false,
1993      // transform
1994  transformAttr = horizontal ? 'left' : 'top',
1995      transformPrefix = '',
1996      transformPostfix = '',
1997      // index
1998  getIndexMax = function () {
1999    if (fixedWidth) {
2000      return function () {
2001        return center && !loop ? slideCount - 1 : Math.ceil(-rightBoundary / (fixedWidth + gutter));
2002      };
2003    } else if (autoWidth) {
2004      return function () {
2005        for (var i = 0; i < slideCountNew; i++) {
2006          if (slidePositions[i] >= -rightBoundary) {
2007            return i;
2008          }
2009        }
2010      };
2011    } else {
2012      return function () {
2013        if (center && carousel && !loop) {
2014          return slideCount - 1;
2015        } else {
2016          return loop || carousel ? Math.max(0, slideCountNew - Math.ceil(items)) : slideCountNew - 1;
2017        }
2018      };
2019    }
2020  }(),
2021      index = getStartIndex(getOption('startIndex')),
2022      indexCached = index;
2023      getCurrentSlide();
2024      var indexMin = 0,
2025      indexMax = !autoWidth ? getIndexMax() : null,
2026      preventActionWhenRunning = options.preventActionWhenRunning,
2027      swipeAngle = options.swipeAngle,
2028      moveDirectionExpected = swipeAngle ? '?' : true,
2029      running = false,
2030      onInit = options.onInit,
2031      events = new Events(),
2032      // id, class
2033  newContainerClasses = ' tns-slider tns-' + options.mode,
2034      slideId = container.id || getSlideId(),
2035      disable = getOption('disable'),
2036      disabled = false,
2037      freezable = options.freezable,
2038      freeze = freezable && !autoWidth ? getFreeze() : false,
2039      frozen = false,
2040      controlsEvents = {
2041    'click': onControlsClick,
2042    'keydown': onControlsKeydown
2043  },
2044      navEvents = {
2045    'click': onNavClick,
2046    'keydown': onNavKeydown
2047  },
2048      hoverEvents = {
2049    'mouseover': mouseoverPause,
2050    'mouseout': mouseoutRestart
2051  },
2052      visibilityEvent = {
2053    'visibilitychange': onVisibilityChange
2054  },
2055      docmentKeydownEvent = {
2056    'keydown': onDocumentKeydown
2057  },
2058      touchEvents = {
2059    'touchstart': onPanStart,
2060    'touchmove': onPanMove,
2061    'touchend': onPanEnd,
2062    'touchcancel': onPanEnd
2063  },
2064      dragEvents = {
2065    'mousedown': onPanStart,
2066    'mousemove': onPanMove,
2067    'mouseup': onPanEnd,
2068    'mouseleave': onPanEnd
2069  },
2070      hasControls = hasOption('controls'),
2071      hasNav = hasOption('nav'),
2072      navAsThumbnails = autoWidth ? true : options.navAsThumbnails,
2073      hasAutoplay = hasOption('autoplay'),
2074      hasTouch = hasOption('touch'),
2075      hasMouseDrag = hasOption('mouseDrag'),
2076      slideActiveClass = 'tns-slide-active',
2077      slideClonedClass = 'tns-slide-cloned',
2078      imgCompleteClass = 'tns-complete',
2079      imgEvents = {
2080    'load': onImgLoaded,
2081    'error': onImgFailed
2082  },
2083      imgsComplete,
2084      liveregionCurrent,
2085      preventScroll = options.preventScrollOnTouch === 'force' ? true : false; // controls
2086
2087
2088  if (hasControls) {
2089    var controlsContainer = options.controlsContainer,
2090        controlsContainerHTML = options.controlsContainer ? options.controlsContainer.outerHTML : '',
2091        prevButton = options.prevButton,
2092        nextButton = options.nextButton,
2093        prevButtonHTML = options.prevButton ? options.prevButton.outerHTML : '',
2094        nextButtonHTML = options.nextButton ? options.nextButton.outerHTML : '',
2095        prevIsButton,
2096        nextIsButton;
2097  } // nav
2098
2099
2100  if (hasNav) {
2101    var navContainer = options.navContainer,
2102        navContainerHTML = options.navContainer ? options.navContainer.outerHTML : '',
2103        navItems,
2104        pages = autoWidth ? slideCount : getPages(),
2105        pagesCached = 0,
2106        navClicked = -1,
2107        navCurrentIndex = getCurrentNavIndex(),
2108        navCurrentIndexCached = navCurrentIndex,
2109        navActiveClass = 'tns-nav-active',
2110        navStr = 'Carousel Page ',
2111        navStrCurrent = ' (Current Slide)';
2112  } // autoplay
2113
2114
2115  if (hasAutoplay) {
2116    var autoplayDirection = options.autoplayDirection === 'forward' ? 1 : -1,
2117        autoplayButton = options.autoplayButton,
2118        autoplayButtonHTML = options.autoplayButton ? options.autoplayButton.outerHTML : '',
2119        autoplayHtmlStrings = ['<span class=\'tns-visually-hidden\'>', ' animation</span>'],
2120        autoplayTimer,
2121        animating,
2122        autoplayHoverPaused,
2123        autoplayUserPaused,
2124        autoplayVisibilityPaused;
2125  }
2126
2127  if (hasTouch || hasMouseDrag) {
2128    var initPosition = {},
2129        lastPosition = {},
2130        translateInit,
2131        panStart = false,
2132        rafIndex,
2133        getDist = horizontal ? function (a, b) {
2134      return a.x - b.x;
2135    } : function (a, b) {
2136      return a.y - b.y;
2137    };
2138  } // disable slider when slidecount <= items
2139
2140
2141  if (!autoWidth) {
2142    resetVariblesWhenDisable(disable || freeze);
2143  }
2144
2145  if (TRANSFORM) {
2146    transformAttr = TRANSFORM;
2147    transformPrefix = 'translate';
2148
2149    if (HAS3DTRANSFORMS) {
2150      transformPrefix += horizontal ? '3d(' : '3d(0px, ';
2151      transformPostfix = horizontal ? ', 0px, 0px)' : ', 0px)';
2152    } else {
2153      transformPrefix += horizontal ? 'X(' : 'Y(';
2154      transformPostfix = ')';
2155    }
2156  }
2157
2158  if (carousel) {
2159    container.className = container.className.replace('tns-vpfix', '');
2160  }
2161
2162  initStructure();
2163  initSheet();
2164  initSliderTransform(); // === COMMON FUNCTIONS === //
2165
2166  function resetVariblesWhenDisable(condition) {
2167    if (condition) {
2168      controls = nav = touch = mouseDrag = arrowKeys = autoplay = autoplayHoverPause = autoplayResetOnVisibility = false;
2169    }
2170  }
2171
2172  function getCurrentSlide() {
2173    var tem = carousel ? index - cloneCount : index;
2174
2175    while (tem < 0) {
2176      tem += slideCount;
2177    }
2178
2179    return tem % slideCount + 1;
2180  }
2181
2182  function getStartIndex(ind) {
2183    ind = ind ? Math.max(0, Math.min(loop ? slideCount - 1 : slideCount - items, ind)) : 0;
2184    return carousel ? ind + cloneCount : ind;
2185  }
2186
2187  function getAbsIndex(i) {
2188    if (i == null) {
2189      i = index;
2190    }
2191
2192    if (carousel) {
2193      i -= cloneCount;
2194    }
2195
2196    while (i < 0) {
2197      i += slideCount;
2198    }
2199
2200    return Math.floor(i % slideCount);
2201  }
2202
2203  function getCurrentNavIndex() {
2204    var absIndex = getAbsIndex(),
2205        result;
2206    result = navAsThumbnails ? absIndex : fixedWidth || autoWidth ? Math.ceil((absIndex + 1) * pages / slideCount - 1) : Math.floor(absIndex / items); // set active nav to the last one when reaches the right edge
2207
2208    if (!loop && carousel && index === indexMax) {
2209      result = pages - 1;
2210    }
2211
2212    return result;
2213  }
2214
2215  function getItemsMax() {
2216    // fixedWidth or autoWidth while viewportMax is not available
2217    if (autoWidth || fixedWidth && !viewportMax) {
2218      return slideCount - 1; // most cases
2219    } else {
2220      var str = fixedWidth ? 'fixedWidth' : 'items',
2221          arr = [];
2222
2223      if (fixedWidth || options[str] < slideCount) {
2224        arr.push(options[str]);
2225      }
2226
2227      if (responsive) {
2228        for (var bp in responsive) {
2229          var tem = responsive[bp][str];
2230
2231          if (tem && (fixedWidth || tem < slideCount)) {
2232            arr.push(tem);
2233          }
2234        }
2235      }
2236
2237      if (!arr.length) {
2238        arr.push(0);
2239      }
2240
2241      return Math.ceil(fixedWidth ? viewportMax / Math.min.apply(null, arr) : Math.max.apply(null, arr));
2242    }
2243  }
2244
2245  function getCloneCountForLoop() {
2246    var itemsMax = getItemsMax(),
2247        result = carousel ? Math.ceil((itemsMax * 5 - slideCount) / 2) : itemsMax * 4 - slideCount;
2248    result = Math.max(itemsMax, result);
2249    return hasOption('edgePadding') ? result + 1 : result;
2250  }
2251
2252  function getWindowWidth() {
2253    return win.innerWidth || doc.documentElement.clientWidth || doc.body.clientWidth;
2254  }
2255
2256  function getInsertPosition(pos) {
2257    return pos === 'top' ? 'afterbegin' : 'beforeend';
2258  }
2259
2260  function getClientWidth(el) {
2261    if (el == null) {
2262      return;
2263    }
2264
2265    var div = doc.createElement('div'),
2266        rect,
2267        width;
2268    el.appendChild(div);
2269    rect = div.getBoundingClientRect();
2270    width = rect.right - rect.left;
2271    div.remove();
2272    return width || getClientWidth(el.parentNode);
2273  }
2274
2275  function getViewportWidth() {
2276    var gap = edgePadding ? edgePadding * 2 - gutter : 0;
2277    return getClientWidth(containerParent) - gap;
2278  }
2279
2280  function hasOption(item) {
2281    if (options[item]) {
2282      return true;
2283    } else {
2284      if (responsive) {
2285        for (var bp in responsive) {
2286          if (responsive[bp][item]) {
2287            return true;
2288          }
2289        }
2290      }
2291
2292      return false;
2293    }
2294  } // get option:
2295  // fixed width: viewport, fixedWidth, gutter => items
2296  // others: window width => all variables
2297  // all: items => slideBy
2298
2299
2300  function getOption(item, ww) {
2301    if (ww == null) {
2302      ww = windowWidth;
2303    }
2304
2305    if (item === 'items' && fixedWidth) {
2306      return Math.floor((viewport + gutter) / (fixedWidth + gutter)) || 1;
2307    } else {
2308      var result = options[item];
2309
2310      if (responsive) {
2311        for (var bp in responsive) {
2312          // bp: convert string to number
2313          if (ww >= parseInt(bp)) {
2314            if (item in responsive[bp]) {
2315              result = responsive[bp][item];
2316            }
2317          }
2318        }
2319      }
2320
2321      if (item === 'slideBy' && result === 'page') {
2322        result = getOption('items');
2323      }
2324
2325      if (!carousel && (item === 'slideBy' || item === 'items')) {
2326        result = Math.floor(result);
2327      }
2328
2329      return result;
2330    }
2331  }
2332
2333  function getSlideMarginLeft(i) {
2334    return CALC ? CALC + '(' + i * 100 + '% / ' + slideCountNew + ')' : i * 100 / slideCountNew + '%';
2335  }
2336
2337  function getInnerWrapperStyles(edgePaddingTem, gutterTem, fixedWidthTem, speedTem, autoHeightBP) {
2338    var str = '';
2339
2340    if (edgePaddingTem !== undefined) {
2341      var gap = edgePaddingTem;
2342
2343      if (gutterTem) {
2344        gap -= gutterTem;
2345      }
2346
2347      str = horizontal ? 'margin: 0 ' + gap + 'px 0 ' + edgePaddingTem + 'px;' : 'margin: ' + edgePaddingTem + 'px 0 ' + gap + 'px 0;';
2348    } else if (gutterTem && !fixedWidthTem) {
2349      var gutterTemUnit = '-' + gutterTem + 'px',
2350          dir = horizontal ? gutterTemUnit + ' 0 0' : '0 ' + gutterTemUnit + ' 0';
2351      str = 'margin: 0 ' + dir + ';';
2352    }
2353
2354    if (!carousel && autoHeightBP && TRANSITIONDURATION && speedTem) {
2355      str += getTransitionDurationStyle(speedTem);
2356    }
2357
2358    return str;
2359  }
2360
2361  function getContainerWidth(fixedWidthTem, gutterTem, itemsTem) {
2362    if (fixedWidthTem) {
2363      return (fixedWidthTem + gutterTem) * slideCountNew + 'px';
2364    } else {
2365      return CALC ? CALC + '(' + slideCountNew * 100 + '% / ' + itemsTem + ')' : slideCountNew * 100 / itemsTem + '%';
2366    }
2367  }
2368
2369  function getSlideWidthStyle(fixedWidthTem, gutterTem, itemsTem) {
2370    var width;
2371
2372    if (fixedWidthTem) {
2373      width = fixedWidthTem + gutterTem + 'px';
2374    } else {
2375      if (!carousel) {
2376        itemsTem = Math.floor(itemsTem);
2377      }
2378
2379      var dividend = carousel ? slideCountNew : itemsTem;
2380      width = CALC ? CALC + '(100% / ' + dividend + ')' : 100 / dividend + '%';
2381    }
2382
2383    width = 'width:' + width; // inner slider: overwrite outer slider styles
2384
2385    return nested !== 'inner' ? width + ';' : width + ' !important;';
2386  }
2387
2388  function getSlideGutterStyle(gutterTem) {
2389    var str = ''; // gutter maybe interger || 0
2390    // so can't use 'if (gutter)'
2391
2392    if (gutterTem !== false) {
2393      var prop = horizontal ? 'padding-' : 'margin-',
2394          dir = horizontal ? 'right' : 'bottom';
2395      str = prop + dir + ': ' + gutterTem + 'px;';
2396    }
2397
2398    return str;
2399  }
2400
2401  function getCSSPrefix(name, num) {
2402    var prefix = name.substring(0, name.length - num).toLowerCase();
2403
2404    if (prefix) {
2405      prefix = '-' + prefix + '-';
2406    }
2407
2408    return prefix;
2409  }
2410
2411  function getTransitionDurationStyle(speed) {
2412    return getCSSPrefix(TRANSITIONDURATION, 18) + 'transition-duration:' + speed / 1000 + 's;';
2413  }
2414
2415  function getAnimationDurationStyle(speed) {
2416    return getCSSPrefix(ANIMATIONDURATION, 17) + 'animation-duration:' + speed / 1000 + 's;';
2417  }
2418
2419  function initStructure() {
2420    var classOuter = 'tns-outer',
2421        classInner = 'tns-inner';
2422        hasOption('gutter');
2423    outerWrapper.className = classOuter;
2424    innerWrapper.className = classInner;
2425    outerWrapper.id = slideId + '-ow';
2426    innerWrapper.id = slideId + '-iw'; // set container properties
2427
2428    if (container.id === '') {
2429      container.id = slideId;
2430    }
2431
2432    newContainerClasses += PERCENTAGELAYOUT || autoWidth ? ' tns-subpixel' : ' tns-no-subpixel';
2433    newContainerClasses += CALC ? ' tns-calc' : ' tns-no-calc';
2434
2435    if (autoWidth) {
2436      newContainerClasses += ' tns-autowidth';
2437    }
2438
2439    newContainerClasses += ' tns-' + options.axis;
2440    container.className += newContainerClasses; // add constrain layer for carousel
2441
2442    if (carousel) {
2443      middleWrapper = doc.createElement('div');
2444      middleWrapper.id = slideId + '-mw';
2445      middleWrapper.className = 'tns-ovh';
2446      outerWrapper.appendChild(middleWrapper);
2447      middleWrapper.appendChild(innerWrapper);
2448    } else {
2449      outerWrapper.appendChild(innerWrapper);
2450    }
2451
2452    if (autoHeight) {
2453      var wp = middleWrapper ? middleWrapper : innerWrapper;
2454      wp.className += ' tns-ah';
2455    }
2456
2457    containerParent.insertBefore(outerWrapper, container);
2458    innerWrapper.appendChild(container); // add id, class, aria attributes
2459    // before clone slides
2460
2461    forEach(slideItems, function (item, i) {
2462      addClass(item, 'tns-item');
2463
2464      if (!item.id) {
2465        item.id = slideId + '-item' + i;
2466      }
2467
2468      if (!carousel && animateNormal) {
2469        addClass(item, animateNormal);
2470      }
2471
2472      setAttrs(item, {
2473        'aria-hidden': 'true',
2474        'tabindex': '-1'
2475      });
2476    }); // ## clone slides
2477    // carousel: n + slides + n
2478    // gallery:      slides + n
2479
2480    if (cloneCount) {
2481      var fragmentBefore = doc.createDocumentFragment(),
2482          fragmentAfter = doc.createDocumentFragment();
2483
2484      for (var j = cloneCount; j--;) {
2485        var num = j % slideCount,
2486            cloneFirst = slideItems[num].cloneNode(true);
2487        addClass(cloneFirst, slideClonedClass);
2488        removeAttrs(cloneFirst, 'id');
2489        fragmentAfter.insertBefore(cloneFirst, fragmentAfter.firstChild);
2490
2491        if (carousel) {
2492          var cloneLast = slideItems[slideCount - 1 - num].cloneNode(true);
2493          addClass(cloneLast, slideClonedClass);
2494          removeAttrs(cloneLast, 'id');
2495          fragmentBefore.appendChild(cloneLast);
2496        }
2497      }
2498
2499      container.insertBefore(fragmentBefore, container.firstChild);
2500      container.appendChild(fragmentAfter);
2501      slideItems = container.children;
2502    }
2503  }
2504
2505  function initSliderTransform() {
2506    // ## images loaded/failed
2507    if (hasOption('autoHeight') || autoWidth || !horizontal) {
2508      var imgs = container.querySelectorAll('img'); // add img load event listener
2509
2510      forEach(imgs, function (img) {
2511        var src = img.src;
2512
2513        if (!lazyload) {
2514          // not data img
2515          if (src && src.indexOf('data:image') < 0) {
2516            img.src = '';
2517            addEvents(img, imgEvents);
2518            addClass(img, 'loading');
2519            img.src = src; // data img
2520          } else {
2521            imgLoaded(img);
2522          }
2523        }
2524      }); // set imgsComplete
2525
2526      raf(function () {
2527        imgsLoadedCheck(arrayFromNodeList(imgs), function () {
2528          imgsComplete = true;
2529        });
2530      }); // reset imgs for auto height: check visible imgs only
2531
2532      if (hasOption('autoHeight')) {
2533        imgs = getImageArray(index, Math.min(index + items - 1, slideCountNew - 1));
2534      }
2535
2536      lazyload ? initSliderTransformStyleCheck() : raf(function () {
2537        imgsLoadedCheck(arrayFromNodeList(imgs), initSliderTransformStyleCheck);
2538      });
2539    } else {
2540      // set container transform property
2541      if (carousel) {
2542        doContainerTransformSilent();
2543      } // update slider tools and events
2544
2545
2546      initTools();
2547      initEvents();
2548    }
2549  }
2550
2551  function initSliderTransformStyleCheck() {
2552    if (autoWidth && slideCount > 1) {
2553      // check styles application
2554      var num = loop ? index : slideCount - 1;
2555
2556      (function stylesApplicationCheck() {
2557        var left = slideItems[num].getBoundingClientRect().left;
2558        var right = slideItems[num - 1].getBoundingClientRect().right;
2559        Math.abs(left - right) <= 1 ? initSliderTransformCore() : setTimeout(function () {
2560          stylesApplicationCheck();
2561        }, 16);
2562      })();
2563    } else {
2564      initSliderTransformCore();
2565    }
2566  }
2567
2568  function initSliderTransformCore() {
2569    // run Fn()s which are rely on image loading
2570    if (!horizontal || autoWidth) {
2571      setSlidePositions();
2572
2573      if (autoWidth) {
2574        rightBoundary = getRightBoundary();
2575
2576        if (freezable) {
2577          freeze = getFreeze();
2578        }
2579
2580        indexMax = getIndexMax(); // <= slidePositions, rightBoundary <=
2581
2582        resetVariblesWhenDisable(disable || freeze);
2583      } else {
2584        updateContentWrapperHeight();
2585      }
2586    } // set container transform property
2587
2588
2589    if (carousel) {
2590      doContainerTransformSilent();
2591    } // update slider tools and events
2592
2593
2594    initTools();
2595    initEvents();
2596  }
2597
2598  function initSheet() {
2599    // gallery:
2600    // set animation classes and left value for gallery slider
2601    if (!carousel) {
2602      for (var i = index, l = index + Math.min(slideCount, items); i < l; i++) {
2603        var item = slideItems[i];
2604        item.style.left = (i - index) * 100 / items + '%';
2605        addClass(item, animateIn);
2606        removeClass(item, animateNormal);
2607      }
2608    } // #### LAYOUT
2609    // ## INLINE-BLOCK VS FLOAT
2610    // ## PercentageLayout:
2611    // slides: inline-block
2612    // remove blank space between slides by set font-size: 0
2613    // ## Non PercentageLayout:
2614    // slides: float
2615    //         margin-right: -100%
2616    //         margin-left: ~
2617    // Resource: https://docs.google.com/spreadsheets/d/147up245wwTXeQYve3BRSAD4oVcvQmuGsFteJOeA5xNQ/edit?usp=sharing
2618
2619
2620    if (horizontal) {
2621      if (PERCENTAGELAYOUT || autoWidth) {
2622        addCSSRule(sheet, '#' + slideId + ' > .tns-item', 'font-size:' + win.getComputedStyle(slideItems[0]).fontSize + ';', getCssRulesLength(sheet));
2623        addCSSRule(sheet, '#' + slideId, 'font-size:0;', getCssRulesLength(sheet));
2624      } else if (carousel) {
2625        forEach(slideItems, function (slide, i) {
2626          slide.style.marginLeft = getSlideMarginLeft(i);
2627        });
2628      }
2629    } // ## BASIC STYLES
2630
2631
2632    if (CSSMQ) {
2633      // middle wrapper style
2634      if (TRANSITIONDURATION) {
2635        var str = middleWrapper && options.autoHeight ? getTransitionDurationStyle(options.speed) : '';
2636        addCSSRule(sheet, '#' + slideId + '-mw', str, getCssRulesLength(sheet));
2637      } // inner wrapper styles
2638
2639
2640      str = getInnerWrapperStyles(options.edgePadding, options.gutter, options.fixedWidth, options.speed, options.autoHeight);
2641      addCSSRule(sheet, '#' + slideId + '-iw', str, getCssRulesLength(sheet)); // container styles
2642
2643      if (carousel) {
2644        str = horizontal && !autoWidth ? 'width:' + getContainerWidth(options.fixedWidth, options.gutter, options.items) + ';' : '';
2645
2646        if (TRANSITIONDURATION) {
2647          str += getTransitionDurationStyle(speed);
2648        }
2649
2650        addCSSRule(sheet, '#' + slideId, str, getCssRulesLength(sheet));
2651      } // slide styles
2652
2653
2654      str = horizontal && !autoWidth ? getSlideWidthStyle(options.fixedWidth, options.gutter, options.items) : '';
2655
2656      if (options.gutter) {
2657        str += getSlideGutterStyle(options.gutter);
2658      } // set gallery items transition-duration
2659
2660
2661      if (!carousel) {
2662        if (TRANSITIONDURATION) {
2663          str += getTransitionDurationStyle(speed);
2664        }
2665
2666        if (ANIMATIONDURATION) {
2667          str += getAnimationDurationStyle(speed);
2668        }
2669      }
2670
2671      if (str) {
2672        addCSSRule(sheet, '#' + slideId + ' > .tns-item', str, getCssRulesLength(sheet));
2673      } // non CSS mediaqueries: IE8
2674      // ## update inner wrapper, container, slides if needed
2675      // set inline styles for inner wrapper & container
2676      // insert stylesheet (one line) for slides only (since slides are many)
2677
2678    } else {
2679      // middle wrapper styles
2680      update_carousel_transition_duration(); // inner wrapper styles
2681
2682      innerWrapper.style.cssText = getInnerWrapperStyles(edgePadding, gutter, fixedWidth, autoHeight); // container styles
2683
2684      if (carousel && horizontal && !autoWidth) {
2685        container.style.width = getContainerWidth(fixedWidth, gutter, items);
2686      } // slide styles
2687
2688
2689      var str = horizontal && !autoWidth ? getSlideWidthStyle(fixedWidth, gutter, items) : '';
2690
2691      if (gutter) {
2692        str += getSlideGutterStyle(gutter);
2693      } // append to the last line
2694
2695
2696      if (str) {
2697        addCSSRule(sheet, '#' + slideId + ' > .tns-item', str, getCssRulesLength(sheet));
2698      }
2699    } // ## MEDIAQUERIES
2700
2701
2702    if (responsive && CSSMQ) {
2703      for (var bp in responsive) {
2704        // bp: convert string to number
2705        bp = parseInt(bp);
2706        var opts = responsive[bp],
2707            str = '',
2708            middleWrapperStr = '',
2709            innerWrapperStr = '',
2710            containerStr = '',
2711            slideStr = '',
2712            itemsBP = !autoWidth ? getOption('items', bp) : null,
2713            fixedWidthBP = getOption('fixedWidth', bp),
2714            speedBP = getOption('speed', bp),
2715            edgePaddingBP = getOption('edgePadding', bp),
2716            autoHeightBP = getOption('autoHeight', bp),
2717            gutterBP = getOption('gutter', bp); // middle wrapper string
2718
2719        if (TRANSITIONDURATION && middleWrapper && getOption('autoHeight', bp) && 'speed' in opts) {
2720          middleWrapperStr = '#' + slideId + '-mw{' + getTransitionDurationStyle(speedBP) + '}';
2721        } // inner wrapper string
2722
2723
2724        if ('edgePadding' in opts || 'gutter' in opts) {
2725          innerWrapperStr = '#' + slideId + '-iw{' + getInnerWrapperStyles(edgePaddingBP, gutterBP, fixedWidthBP, speedBP, autoHeightBP) + '}';
2726        } // container string
2727
2728
2729        if (carousel && horizontal && !autoWidth && ('fixedWidth' in opts || 'items' in opts || fixedWidth && 'gutter' in opts)) {
2730          containerStr = 'width:' + getContainerWidth(fixedWidthBP, gutterBP, itemsBP) + ';';
2731        }
2732
2733        if (TRANSITIONDURATION && 'speed' in opts) {
2734          containerStr += getTransitionDurationStyle(speedBP);
2735        }
2736
2737        if (containerStr) {
2738          containerStr = '#' + slideId + '{' + containerStr + '}';
2739        } // slide string
2740
2741
2742        if ('fixedWidth' in opts || fixedWidth && 'gutter' in opts || !carousel && 'items' in opts) {
2743          slideStr += getSlideWidthStyle(fixedWidthBP, gutterBP, itemsBP);
2744        }
2745
2746        if ('gutter' in opts) {
2747          slideStr += getSlideGutterStyle(gutterBP);
2748        } // set gallery items transition-duration
2749
2750
2751        if (!carousel && 'speed' in opts) {
2752          if (TRANSITIONDURATION) {
2753            slideStr += getTransitionDurationStyle(speedBP);
2754          }
2755
2756          if (ANIMATIONDURATION) {
2757            slideStr += getAnimationDurationStyle(speedBP);
2758          }
2759        }
2760
2761        if (slideStr) {
2762          slideStr = '#' + slideId + ' > .tns-item{' + slideStr + '}';
2763        } // add up
2764
2765
2766        str = middleWrapperStr + innerWrapperStr + containerStr + slideStr;
2767
2768        if (str) {
2769          sheet.insertRule('@media (min-width: ' + bp / 16 + 'em) {' + str + '}', sheet.cssRules.length);
2770        }
2771      }
2772    }
2773  }
2774
2775  function initTools() {
2776    // == slides ==
2777    updateSlideStatus(); // == live region ==
2778
2779    outerWrapper.insertAdjacentHTML('afterbegin', '<div class="tns-liveregion tns-visually-hidden" aria-live="polite" aria-atomic="true">slide <span class="current">' + getLiveRegionStr() + '</span>  of ' + slideCount + '</div>');
2780    liveregionCurrent = outerWrapper.querySelector('.tns-liveregion .current'); // == autoplayInit ==
2781
2782    if (hasAutoplay) {
2783      var txt = autoplay ? 'stop' : 'start';
2784
2785      if (autoplayButton) {
2786        setAttrs(autoplayButton, {
2787          'data-action': txt
2788        });
2789      } else if (options.autoplayButtonOutput) {
2790        outerWrapper.insertAdjacentHTML(getInsertPosition(options.autoplayPosition), '<button type="button" data-action="' + txt + '">' + autoplayHtmlStrings[0] + txt + autoplayHtmlStrings[1] + autoplayText[0] + '</button>');
2791        autoplayButton = outerWrapper.querySelector('[data-action]');
2792      } // add event
2793
2794
2795      if (autoplayButton) {
2796        addEvents(autoplayButton, {
2797          'click': toggleAutoplay
2798        });
2799      }
2800
2801      if (autoplay) {
2802        startAutoplay();
2803
2804        if (autoplayHoverPause) {
2805          addEvents(container, hoverEvents);
2806        }
2807
2808        if (autoplayResetOnVisibility) {
2809          addEvents(container, visibilityEvent);
2810        }
2811      }
2812    } // == navInit ==
2813
2814
2815    if (hasNav) {
2816      // will not hide the navs in case they're thumbnails
2817
2818      if (navContainer) {
2819        setAttrs(navContainer, {
2820          'aria-label': 'Carousel Pagination'
2821        });
2822        navItems = navContainer.children;
2823        forEach(navItems, function (item, i) {
2824          setAttrs(item, {
2825            'data-nav': i,
2826            'tabindex': '-1',
2827            'aria-label': navStr + (i + 1),
2828            'aria-controls': slideId
2829          });
2830        }); // generated nav
2831      } else {
2832        var navHtml = '',
2833            hiddenStr = navAsThumbnails ? '' : 'style="display:none"';
2834
2835        for (var i = 0; i < slideCount; i++) {
2836          // hide nav items by default
2837          navHtml += '<button type="button" data-nav="' + i + '" tabindex="-1" aria-controls="' + slideId + '" ' + hiddenStr + ' aria-label="' + navStr + (i + 1) + '"></button>';
2838        }
2839
2840        navHtml = '<div class="tns-nav" aria-label="Carousel Pagination">' + navHtml + '</div>';
2841        outerWrapper.insertAdjacentHTML(getInsertPosition(options.navPosition), navHtml);
2842        navContainer = outerWrapper.querySelector('.tns-nav');
2843        navItems = navContainer.children;
2844      }
2845
2846      updateNavVisibility(); // add transition
2847
2848      if (TRANSITIONDURATION) {
2849        var prefix = TRANSITIONDURATION.substring(0, TRANSITIONDURATION.length - 18).toLowerCase(),
2850            str = 'transition: all ' + speed / 1000 + 's';
2851
2852        if (prefix) {
2853          str = '-' + prefix + '-' + str;
2854        }
2855
2856        addCSSRule(sheet, '[aria-controls^=' + slideId + '-item]', str, getCssRulesLength(sheet));
2857      }
2858
2859      setAttrs(navItems[navCurrentIndex], {
2860        'aria-label': navStr + (navCurrentIndex + 1) + navStrCurrent
2861      });
2862      removeAttrs(navItems[navCurrentIndex], 'tabindex');
2863      addClass(navItems[navCurrentIndex], navActiveClass); // add events
2864
2865      addEvents(navContainer, navEvents);
2866    } // == controlsInit ==
2867
2868
2869    if (hasControls) {
2870      if (!controlsContainer && (!prevButton || !nextButton)) {
2871        outerWrapper.insertAdjacentHTML(getInsertPosition(options.controlsPosition), '<div class="tns-controls" aria-label="Carousel Navigation" tabindex="0"><button type="button" data-controls="prev" tabindex="-1" aria-controls="' + slideId + '">' + controlsText[0] + '</button><button type="button" data-controls="next" tabindex="-1" aria-controls="' + slideId + '">' + controlsText[1] + '</button></div>');
2872        controlsContainer = outerWrapper.querySelector('.tns-controls');
2873      }
2874
2875      if (!prevButton || !nextButton) {
2876        prevButton = controlsContainer.children[0];
2877        nextButton = controlsContainer.children[1];
2878      }
2879
2880      if (options.controlsContainer) {
2881        setAttrs(controlsContainer, {
2882          'aria-label': 'Carousel Navigation',
2883          'tabindex': '0'
2884        });
2885      }
2886
2887      if (options.controlsContainer || options.prevButton && options.nextButton) {
2888        setAttrs([prevButton, nextButton], {
2889          'aria-controls': slideId,
2890          'tabindex': '-1'
2891        });
2892      }
2893
2894      if (options.controlsContainer || options.prevButton && options.nextButton) {
2895        setAttrs(prevButton, {
2896          'data-controls': 'prev'
2897        });
2898        setAttrs(nextButton, {
2899          'data-controls': 'next'
2900        });
2901      }
2902
2903      prevIsButton = isButton(prevButton);
2904      nextIsButton = isButton(nextButton);
2905      updateControlsStatus(); // add events
2906
2907      if (controlsContainer) {
2908        addEvents(controlsContainer, controlsEvents);
2909      } else {
2910        addEvents(prevButton, controlsEvents);
2911        addEvents(nextButton, controlsEvents);
2912      }
2913    } // hide tools if needed
2914
2915
2916    disableUI();
2917  }
2918
2919  function initEvents() {
2920    // add events
2921    if (carousel && TRANSITIONEND) {
2922      var eve = {};
2923      eve[TRANSITIONEND] = onTransitionEnd;
2924      addEvents(container, eve);
2925    }
2926
2927    if (touch) {
2928      addEvents(container, touchEvents, options.preventScrollOnTouch);
2929    }
2930
2931    if (mouseDrag) {
2932      addEvents(container, dragEvents);
2933    }
2934
2935    if (arrowKeys) {
2936      addEvents(doc, docmentKeydownEvent);
2937    }
2938
2939    if (nested === 'inner') {
2940      events.on('outerResized', function () {
2941        resizeTasks();
2942        events.emit('innerLoaded', info());
2943      });
2944    } else if (responsive || fixedWidth || autoWidth || autoHeight || !horizontal) {
2945      addEvents(win, {
2946        'resize': onResize
2947      });
2948    }
2949
2950    if (autoHeight) {
2951      if (nested === 'outer') {
2952        events.on('innerLoaded', doAutoHeight);
2953      } else if (!disable) {
2954        doAutoHeight();
2955      }
2956    }
2957
2958    doLazyLoad();
2959
2960    if (disable) {
2961      disableSlider();
2962    } else if (freeze) {
2963      freezeSlider();
2964    }
2965
2966    events.on('indexChanged', additionalUpdates);
2967
2968    if (nested === 'inner') {
2969      events.emit('innerLoaded', info());
2970    }
2971
2972    if (typeof onInit === 'function') {
2973      onInit(info());
2974    }
2975
2976    isOn = true;
2977  }
2978
2979  function destroy() {
2980    // sheet
2981    sheet.disabled = true;
2982
2983    if (sheet.ownerNode) {
2984      sheet.ownerNode.remove();
2985    } // remove win event listeners
2986
2987
2988    removeEvents(win, {
2989      'resize': onResize
2990    }); // arrowKeys, controls, nav
2991
2992    if (arrowKeys) {
2993      removeEvents(doc, docmentKeydownEvent);
2994    }
2995
2996    if (controlsContainer) {
2997      removeEvents(controlsContainer, controlsEvents);
2998    }
2999
3000    if (navContainer) {
3001      removeEvents(navContainer, navEvents);
3002    } // autoplay
3003
3004
3005    removeEvents(container, hoverEvents);
3006    removeEvents(container, visibilityEvent);
3007
3008    if (autoplayButton) {
3009      removeEvents(autoplayButton, {
3010        'click': toggleAutoplay
3011      });
3012    }
3013
3014    if (autoplay) {
3015      clearInterval(autoplayTimer);
3016    } // container
3017
3018
3019    if (carousel && TRANSITIONEND) {
3020      var eve = {};
3021      eve[TRANSITIONEND] = onTransitionEnd;
3022      removeEvents(container, eve);
3023    }
3024
3025    if (touch) {
3026      removeEvents(container, touchEvents);
3027    }
3028
3029    if (mouseDrag) {
3030      removeEvents(container, dragEvents);
3031    } // cache Object values in options && reset HTML
3032
3033
3034    var htmlList = [containerHTML, controlsContainerHTML, prevButtonHTML, nextButtonHTML, navContainerHTML, autoplayButtonHTML];
3035    tnsList.forEach(function (item, i) {
3036      var el = item === 'container' ? outerWrapper : options[item];
3037
3038      if (typeof el === 'object' && el) {
3039        var prevEl = el.previousElementSibling ? el.previousElementSibling : false,
3040            parentEl = el.parentNode;
3041        el.outerHTML = htmlList[i];
3042        options[item] = prevEl ? prevEl.nextElementSibling : parentEl.firstElementChild;
3043      }
3044    }); // reset variables
3045
3046    tnsList = animateIn = animateOut = animateDelay = animateNormal = horizontal = outerWrapper = innerWrapper = container = containerParent = containerHTML = slideItems = slideCount = breakpointZone = windowWidth = autoWidth = fixedWidth = edgePadding = gutter = viewport = items = slideBy = viewportMax = arrowKeys = speed = rewind = loop = autoHeight = sheet = lazyload = slidePositions = slideItemsOut = cloneCount = slideCountNew = hasRightDeadZone = rightBoundary = updateIndexBeforeTransform = transformAttr = transformPrefix = transformPostfix = getIndexMax = index = indexCached = indexMin = indexMax = swipeAngle = moveDirectionExpected = running = onInit = events = newContainerClasses = slideId = disable = disabled = freezable = freeze = frozen = controlsEvents = navEvents = hoverEvents = visibilityEvent = docmentKeydownEvent = touchEvents = dragEvents = hasControls = hasNav = navAsThumbnails = hasAutoplay = hasTouch = hasMouseDrag = slideActiveClass = imgCompleteClass = imgEvents = imgsComplete = controls = controlsText = controlsContainer = controlsContainerHTML = prevButton = nextButton = prevIsButton = nextIsButton = nav = navContainer = navContainerHTML = navItems = pages = pagesCached = navClicked = navCurrentIndex = navCurrentIndexCached = navActiveClass = navStr = navStrCurrent = autoplay = autoplayTimeout = autoplayDirection = autoplayText = autoplayHoverPause = autoplayButton = autoplayButtonHTML = autoplayResetOnVisibility = autoplayHtmlStrings = autoplayTimer = animating = autoplayHoverPaused = autoplayUserPaused = autoplayVisibilityPaused = initPosition = lastPosition = translateInit = panStart = rafIndex = getDist = touch = mouseDrag = null; // check variables
3047    // [animateIn, animateOut, animateDelay, animateNormal, horizontal, outerWrapper, innerWrapper, container, containerParent, containerHTML, slideItems, slideCount, breakpointZone, windowWidth, autoWidth, fixedWidth, edgePadding, gutter, viewport, items, slideBy, viewportMax, arrowKeys, speed, rewind, loop, autoHeight, sheet, lazyload, slidePositions, slideItemsOut, cloneCount, slideCountNew, hasRightDeadZone, rightBoundary, updateIndexBeforeTransform, transformAttr, transformPrefix, transformPostfix, getIndexMax, index, indexCached, indexMin, indexMax, resizeTimer, swipeAngle, moveDirectionExpected, running, onInit, events, newContainerClasses, slideId, disable, disabled, freezable, freeze, frozen, controlsEvents, navEvents, hoverEvents, visibilityEvent, docmentKeydownEvent, touchEvents, dragEvents, hasControls, hasNav, navAsThumbnails, hasAutoplay, hasTouch, hasMouseDrag, slideActiveClass, imgCompleteClass, imgEvents, imgsComplete, controls, controlsText, controlsContainer, controlsContainerHTML, prevButton, nextButton, prevIsButton, nextIsButton, nav, navContainer, navContainerHTML, navItems, pages, pagesCached, navClicked, navCurrentIndex, navCurrentIndexCached, navActiveClass, navStr, navStrCurrent, autoplay, autoplayTimeout, autoplayDirection, autoplayText, autoplayHoverPause, autoplayButton, autoplayButtonHTML, autoplayResetOnVisibility, autoplayHtmlStrings, autoplayTimer, animating, autoplayHoverPaused, autoplayUserPaused, autoplayVisibilityPaused, initPosition, lastPosition, translateInit, disX, disY, panStart, rafIndex, getDist, touch, mouseDrag ].forEach(function(item) { if (item !== null) { console.log(item); } });
3048
3049    for (var a in this) {
3050      if (a !== 'rebuild') {
3051        this[a] = null;
3052      }
3053    }
3054
3055    isOn = false;
3056  } // === ON RESIZE ===
3057  // responsive || fixedWidth || autoWidth || !horizontal
3058
3059
3060  function onResize(e) {
3061    raf(function () {
3062      resizeTasks(getEvent(e));
3063    });
3064  }
3065
3066  function resizeTasks(e) {
3067    if (!isOn) {
3068      return;
3069    }
3070
3071    if (nested === 'outer') {
3072      events.emit('outerResized', info(e));
3073    }
3074
3075    windowWidth = getWindowWidth();
3076    var bpChanged,
3077        breakpointZoneTem = breakpointZone,
3078        needContainerTransform = false;
3079
3080    if (responsive) {
3081      setBreakpointZone();
3082      bpChanged = breakpointZoneTem !== breakpointZone; // if (hasRightDeadZone) { needContainerTransform = true; } // *?
3083
3084      if (bpChanged) {
3085        events.emit('newBreakpointStart', info(e));
3086      }
3087    }
3088
3089    var indChanged,
3090        itemsChanged,
3091        itemsTem = items,
3092        disableTem = disable,
3093        freezeTem = freeze,
3094        arrowKeysTem = arrowKeys,
3095        controlsTem = controls,
3096        navTem = nav,
3097        touchTem = touch,
3098        mouseDragTem = mouseDrag,
3099        autoplayTem = autoplay,
3100        autoplayHoverPauseTem = autoplayHoverPause,
3101        autoplayResetOnVisibilityTem = autoplayResetOnVisibility,
3102        indexTem = index;
3103
3104    if (bpChanged) {
3105      var fixedWidthTem = fixedWidth,
3106          autoHeightTem = autoHeight,
3107          controlsTextTem = controlsText,
3108          centerTem = center,
3109          autoplayTextTem = autoplayText;
3110
3111      if (!CSSMQ) {
3112        var gutterTem = gutter,
3113            edgePaddingTem = edgePadding;
3114      }
3115    } // get option:
3116    // fixed width: viewport, fixedWidth, gutter => items
3117    // others: window width => all variables
3118    // all: items => slideBy
3119
3120
3121    arrowKeys = getOption('arrowKeys');
3122    controls = getOption('controls');
3123    nav = getOption('nav');
3124    touch = getOption('touch');
3125    center = getOption('center');
3126    mouseDrag = getOption('mouseDrag');
3127    autoplay = getOption('autoplay');
3128    autoplayHoverPause = getOption('autoplayHoverPause');
3129    autoplayResetOnVisibility = getOption('autoplayResetOnVisibility');
3130
3131    if (bpChanged) {
3132      disable = getOption('disable');
3133      fixedWidth = getOption('fixedWidth');
3134      speed = getOption('speed');
3135      autoHeight = getOption('autoHeight');
3136      controlsText = getOption('controlsText');
3137      autoplayText = getOption('autoplayText');
3138      autoplayTimeout = getOption('autoplayTimeout');
3139
3140      if (!CSSMQ) {
3141        edgePadding = getOption('edgePadding');
3142        gutter = getOption('gutter');
3143      }
3144    } // update options
3145
3146
3147    resetVariblesWhenDisable(disable);
3148    viewport = getViewportWidth(); // <= edgePadding, gutter
3149
3150    if ((!horizontal || autoWidth) && !disable) {
3151      setSlidePositions();
3152
3153      if (!horizontal) {
3154        updateContentWrapperHeight(); // <= setSlidePositions
3155
3156        needContainerTransform = true;
3157      }
3158    }
3159
3160    if (fixedWidth || autoWidth) {
3161      rightBoundary = getRightBoundary(); // autoWidth: <= viewport, slidePositions, gutter
3162      // fixedWidth: <= viewport, fixedWidth, gutter
3163
3164      indexMax = getIndexMax(); // autoWidth: <= rightBoundary, slidePositions
3165      // fixedWidth: <= rightBoundary, fixedWidth, gutter
3166    }
3167
3168    if (bpChanged || fixedWidth) {
3169      items = getOption('items');
3170      slideBy = getOption('slideBy');
3171      itemsChanged = items !== itemsTem;
3172
3173      if (itemsChanged) {
3174        if (!fixedWidth && !autoWidth) {
3175          indexMax = getIndexMax();
3176        } // <= items
3177        // check index before transform in case
3178        // slider reach the right edge then items become bigger
3179
3180
3181        updateIndex();
3182      }
3183    }
3184
3185    if (bpChanged) {
3186      if (disable !== disableTem) {
3187        if (disable) {
3188          disableSlider();
3189        } else {
3190          enableSlider(); // <= slidePositions, rightBoundary, indexMax
3191        }
3192      }
3193    }
3194
3195    if (freezable && (bpChanged || fixedWidth || autoWidth)) {
3196      freeze = getFreeze(); // <= autoWidth: slidePositions, gutter, viewport, rightBoundary
3197      // <= fixedWidth: fixedWidth, gutter, rightBoundary
3198      // <= others: items
3199
3200      if (freeze !== freezeTem) {
3201        if (freeze) {
3202          doContainerTransform(getContainerTransformValue(getStartIndex(0)));
3203          freezeSlider();
3204        } else {
3205          unfreezeSlider();
3206          needContainerTransform = true;
3207        }
3208      }
3209    }
3210
3211    resetVariblesWhenDisable(disable || freeze); // controls, nav, touch, mouseDrag, arrowKeys, autoplay, autoplayHoverPause, autoplayResetOnVisibility
3212
3213    if (!autoplay) {
3214      autoplayHoverPause = autoplayResetOnVisibility = false;
3215    }
3216
3217    if (arrowKeys !== arrowKeysTem) {
3218      arrowKeys ? addEvents(doc, docmentKeydownEvent) : removeEvents(doc, docmentKeydownEvent);
3219    }
3220
3221    if (controls !== controlsTem) {
3222      if (controls) {
3223        if (controlsContainer) {
3224          showElement(controlsContainer);
3225        } else {
3226          if (prevButton) {
3227            showElement(prevButton);
3228          }
3229
3230          if (nextButton) {
3231            showElement(nextButton);
3232          }
3233        }
3234      } else {
3235        if (controlsContainer) {
3236          hideElement(controlsContainer);
3237        } else {
3238          if (prevButton) {
3239            hideElement(prevButton);
3240          }
3241
3242          if (nextButton) {
3243            hideElement(nextButton);
3244          }
3245        }
3246      }
3247    }
3248
3249    if (nav !== navTem) {
3250      if (nav) {
3251        showElement(navContainer);
3252        updateNavVisibility();
3253      } else {
3254        hideElement(navContainer);
3255      }
3256    }
3257
3258    if (touch !== touchTem) {
3259      touch ? addEvents(container, touchEvents, options.preventScrollOnTouch) : removeEvents(container, touchEvents);
3260    }
3261
3262    if (mouseDrag !== mouseDragTem) {
3263      mouseDrag ? addEvents(container, dragEvents) : removeEvents(container, dragEvents);
3264    }
3265
3266    if (autoplay !== autoplayTem) {
3267      if (autoplay) {
3268        if (autoplayButton) {
3269          showElement(autoplayButton);
3270        }
3271
3272        if (!animating && !autoplayUserPaused) {
3273          startAutoplay();
3274        }
3275      } else {
3276        if (autoplayButton) {
3277          hideElement(autoplayButton);
3278        }
3279
3280        if (animating) {
3281          stopAutoplay();
3282        }
3283      }
3284    }
3285
3286    if (autoplayHoverPause !== autoplayHoverPauseTem) {
3287      autoplayHoverPause ? addEvents(container, hoverEvents) : removeEvents(container, hoverEvents);
3288    }
3289
3290    if (autoplayResetOnVisibility !== autoplayResetOnVisibilityTem) {
3291      autoplayResetOnVisibility ? addEvents(doc, visibilityEvent) : removeEvents(doc, visibilityEvent);
3292    }
3293
3294    if (bpChanged) {
3295      if (fixedWidth !== fixedWidthTem || center !== centerTem) {
3296        needContainerTransform = true;
3297      }
3298
3299      if (autoHeight !== autoHeightTem) {
3300        if (!autoHeight) {
3301          innerWrapper.style.height = '';
3302        }
3303      }
3304
3305      if (controls && controlsText !== controlsTextTem) {
3306        prevButton.innerHTML = controlsText[0];
3307        nextButton.innerHTML = controlsText[1];
3308      }
3309
3310      if (autoplayButton && autoplayText !== autoplayTextTem) {
3311        var i = autoplay ? 1 : 0,
3312            html = autoplayButton.innerHTML,
3313            len = html.length - autoplayTextTem[i].length;
3314
3315        if (html.substring(len) === autoplayTextTem[i]) {
3316          autoplayButton.innerHTML = html.substring(0, len) + autoplayText[i];
3317        }
3318      }
3319    } else {
3320      if (center && (fixedWidth || autoWidth)) {
3321        needContainerTransform = true;
3322      }
3323    }
3324
3325    if (itemsChanged || fixedWidth && !autoWidth) {
3326      pages = getPages();
3327      updateNavVisibility();
3328    }
3329
3330    indChanged = index !== indexTem;
3331
3332    if (indChanged) {
3333      events.emit('indexChanged', info());
3334      needContainerTransform = true;
3335    } else if (itemsChanged) {
3336      if (!indChanged) {
3337        additionalUpdates();
3338      }
3339    } else if (fixedWidth || autoWidth) {
3340      doLazyLoad();
3341      updateSlideStatus();
3342      updateLiveRegion();
3343    }
3344
3345    if (itemsChanged && !carousel) {
3346      updateGallerySlidePositions();
3347    }
3348
3349    if (!disable && !freeze) {
3350      // non-mediaqueries: IE8
3351      if (bpChanged && !CSSMQ) {
3352        // middle wrapper styles
3353        // inner wrapper styles
3354        if (edgePadding !== edgePaddingTem || gutter !== gutterTem) {
3355          innerWrapper.style.cssText = getInnerWrapperStyles(edgePadding, gutter, fixedWidth, speed, autoHeight);
3356        }
3357
3358        if (horizontal) {
3359          // container styles
3360          if (carousel) {
3361            container.style.width = getContainerWidth(fixedWidth, gutter, items);
3362          } // slide styles
3363
3364
3365          var str = getSlideWidthStyle(fixedWidth, gutter, items) + getSlideGutterStyle(gutter); // remove the last line and
3366          // add new styles
3367
3368          removeCSSRule(sheet, getCssRulesLength(sheet) - 1);
3369          addCSSRule(sheet, '#' + slideId + ' > .tns-item', str, getCssRulesLength(sheet));
3370        }
3371      } // auto height
3372
3373
3374      if (autoHeight) {
3375        doAutoHeight();
3376      }
3377
3378      if (needContainerTransform) {
3379        doContainerTransformSilent();
3380        indexCached = index;
3381      }
3382    }
3383
3384    if (bpChanged) {
3385      events.emit('newBreakpointEnd', info(e));
3386    }
3387  } // === INITIALIZATION FUNCTIONS === //
3388
3389
3390  function getFreeze() {
3391    if (!fixedWidth && !autoWidth) {
3392      var a = center ? items - (items - 1) / 2 : items;
3393      return slideCount <= a;
3394    }
3395
3396    var width = fixedWidth ? (fixedWidth + gutter) * slideCount : slidePositions[slideCount],
3397        vp = edgePadding ? viewport + edgePadding * 2 : viewport + gutter;
3398
3399    if (center) {
3400      vp -= fixedWidth ? (viewport - fixedWidth) / 2 : (viewport - (slidePositions[index + 1] - slidePositions[index] - gutter)) / 2;
3401    }
3402
3403    return width <= vp;
3404  }
3405
3406  function setBreakpointZone() {
3407    breakpointZone = 0;
3408
3409    for (var bp in responsive) {
3410      bp = parseInt(bp); // convert string to number
3411
3412      if (windowWidth >= bp) {
3413        breakpointZone = bp;
3414      }
3415    }
3416  } // (slideBy, indexMin, indexMax) => index
3417
3418
3419  var updateIndex = function () {
3420    return loop ? carousel ? // loop + carousel
3421    function () {
3422      var leftEdge = indexMin,
3423          rightEdge = indexMax;
3424      leftEdge += slideBy;
3425      rightEdge -= slideBy; // adjust edges when has edge paddings
3426      // or fixed-width slider with extra space on the right side
3427
3428      if (edgePadding) {
3429        leftEdge += 1;
3430        rightEdge -= 1;
3431      } else if (fixedWidth) {
3432        if ((viewport + gutter) % (fixedWidth + gutter)) {
3433          rightEdge -= 1;
3434        }
3435      }
3436
3437      if (cloneCount) {
3438        if (index > rightEdge) {
3439          index -= slideCount;
3440        } else if (index < leftEdge) {
3441          index += slideCount;
3442        }
3443      }
3444    } : // loop + gallery
3445    function () {
3446      if (index > indexMax) {
3447        while (index >= indexMin + slideCount) {
3448          index -= slideCount;
3449        }
3450      } else if (index < indexMin) {
3451        while (index <= indexMax - slideCount) {
3452          index += slideCount;
3453        }
3454      }
3455    } : // non-loop
3456    function () {
3457      index = Math.max(indexMin, Math.min(indexMax, index));
3458    };
3459  }();
3460
3461  function disableUI() {
3462    if (!autoplay && autoplayButton) {
3463      hideElement(autoplayButton);
3464    }
3465
3466    if (!nav && navContainer) {
3467      hideElement(navContainer);
3468    }
3469
3470    if (!controls) {
3471      if (controlsContainer) {
3472        hideElement(controlsContainer);
3473      } else {
3474        if (prevButton) {
3475          hideElement(prevButton);
3476        }
3477
3478        if (nextButton) {
3479          hideElement(nextButton);
3480        }
3481      }
3482    }
3483  }
3484
3485  function enableUI() {
3486    if (autoplay && autoplayButton) {
3487      showElement(autoplayButton);
3488    }
3489
3490    if (nav && navContainer) {
3491      showElement(navContainer);
3492    }
3493
3494    if (controls) {
3495      if (controlsContainer) {
3496        showElement(controlsContainer);
3497      } else {
3498        if (prevButton) {
3499          showElement(prevButton);
3500        }
3501
3502        if (nextButton) {
3503          showElement(nextButton);
3504        }
3505      }
3506    }
3507  }
3508
3509  function freezeSlider() {
3510    if (frozen) {
3511      return;
3512    } // remove edge padding from inner wrapper
3513
3514
3515    if (edgePadding) {
3516      innerWrapper.style.margin = '0px';
3517    } // add class tns-transparent to cloned slides
3518
3519
3520    if (cloneCount) {
3521      var str = 'tns-transparent';
3522
3523      for (var i = cloneCount; i--;) {
3524        if (carousel) {
3525          addClass(slideItems[i], str);
3526        }
3527
3528        addClass(slideItems[slideCountNew - i - 1], str);
3529      }
3530    } // update tools
3531
3532
3533    disableUI();
3534    frozen = true;
3535  }
3536
3537  function unfreezeSlider() {
3538    if (!frozen) {
3539      return;
3540    } // restore edge padding for inner wrapper
3541    // for mordern browsers
3542
3543
3544    if (edgePadding && CSSMQ) {
3545      innerWrapper.style.margin = '';
3546    } // remove class tns-transparent to cloned slides
3547
3548
3549    if (cloneCount) {
3550      var str = 'tns-transparent';
3551
3552      for (var i = cloneCount; i--;) {
3553        if (carousel) {
3554          removeClass(slideItems[i], str);
3555        }
3556
3557        removeClass(slideItems[slideCountNew - i - 1], str);
3558      }
3559    } // update tools
3560
3561
3562    enableUI();
3563    frozen = false;
3564  }
3565
3566  function disableSlider() {
3567    if (disabled) {
3568      return;
3569    }
3570
3571    sheet.disabled = true;
3572    container.className = container.className.replace(newContainerClasses.substring(1), '');
3573    removeAttrs(container, ['style']);
3574
3575    if (loop) {
3576      for (var j = cloneCount; j--;) {
3577        if (carousel) {
3578          hideElement(slideItems[j]);
3579        }
3580
3581        hideElement(slideItems[slideCountNew - j - 1]);
3582      }
3583    } // vertical slider
3584
3585
3586    if (!horizontal || !carousel) {
3587      removeAttrs(innerWrapper, ['style']);
3588    } // gallery
3589
3590
3591    if (!carousel) {
3592      for (var i = index, l = index + slideCount; i < l; i++) {
3593        var item = slideItems[i];
3594        removeAttrs(item, ['style']);
3595        removeClass(item, animateIn);
3596        removeClass(item, animateNormal);
3597      }
3598    } // update tools
3599
3600
3601    disableUI();
3602    disabled = true;
3603  }
3604
3605  function enableSlider() {
3606    if (!disabled) {
3607      return;
3608    }
3609
3610    sheet.disabled = false;
3611    container.className += newContainerClasses;
3612    doContainerTransformSilent();
3613
3614    if (loop) {
3615      for (var j = cloneCount; j--;) {
3616        if (carousel) {
3617          showElement(slideItems[j]);
3618        }
3619
3620        showElement(slideItems[slideCountNew - j - 1]);
3621      }
3622    } // gallery
3623
3624
3625    if (!carousel) {
3626      for (var i = index, l = index + slideCount; i < l; i++) {
3627        var item = slideItems[i],
3628            classN = i < index + items ? animateIn : animateNormal;
3629        item.style.left = (i - index) * 100 / items + '%';
3630        addClass(item, classN);
3631      }
3632    } // update tools
3633
3634
3635    enableUI();
3636    disabled = false;
3637  }
3638
3639  function updateLiveRegion() {
3640    var str = getLiveRegionStr();
3641
3642    if (liveregionCurrent.innerHTML !== str) {
3643      liveregionCurrent.innerHTML = str;
3644    }
3645  }
3646
3647  function getLiveRegionStr() {
3648    var arr = getVisibleSlideRange(),
3649        start = arr[0] + 1,
3650        end = arr[1] + 1;
3651    return start === end ? start + '' : start + ' to ' + end;
3652  }
3653
3654  function getVisibleSlideRange(val) {
3655    if (val == null) {
3656      val = getContainerTransformValue();
3657    }
3658
3659    var start = index,
3660        end,
3661        rangestart,
3662        rangeend; // get range start, range end for autoWidth and fixedWidth
3663
3664    if (center || edgePadding) {
3665      if (autoWidth || fixedWidth) {
3666        rangestart = -(parseFloat(val) + edgePadding);
3667        rangeend = rangestart + viewport + edgePadding * 2;
3668      }
3669    } else {
3670      if (autoWidth) {
3671        rangestart = slidePositions[index];
3672        rangeend = rangestart + viewport;
3673      }
3674    } // get start, end
3675    // - check auto width
3676
3677
3678    if (autoWidth) {
3679      slidePositions.forEach(function (point, i) {
3680        if (i < slideCountNew) {
3681          if ((center || edgePadding) && point <= rangestart + 0.5) {
3682            start = i;
3683          }
3684
3685          if (rangeend - point >= 0.5) {
3686            end = i;
3687          }
3688        }
3689      }); // - check percentage width, fixed width
3690    } else {
3691      if (fixedWidth) {
3692        var cell = fixedWidth + gutter;
3693
3694        if (center || edgePadding) {
3695          start = Math.floor(rangestart / cell);
3696          end = Math.ceil(rangeend / cell - 1);
3697        } else {
3698          end = start + Math.ceil(viewport / cell) - 1;
3699        }
3700      } else {
3701        if (center || edgePadding) {
3702          var a = items - 1;
3703
3704          if (center) {
3705            start -= a / 2;
3706            end = index + a / 2;
3707          } else {
3708            end = index + a;
3709          }
3710
3711          if (edgePadding) {
3712            var b = edgePadding * items / viewport;
3713            start -= b;
3714            end += b;
3715          }
3716
3717          start = Math.floor(start);
3718          end = Math.ceil(end);
3719        } else {
3720          end = start + items - 1;
3721        }
3722      }
3723
3724      start = Math.max(start, 0);
3725      end = Math.min(end, slideCountNew - 1);
3726    }
3727
3728    return [start, end];
3729  }
3730
3731  function doLazyLoad() {
3732    if (lazyload && !disable) {
3733      var arg = getVisibleSlideRange();
3734      arg.push(lazyloadSelector);
3735      getImageArray.apply(null, arg).forEach(function (img) {
3736        if (!hasClass(img, imgCompleteClass)) {
3737          // stop propagation transitionend event to container
3738          var eve = {};
3739
3740          eve[TRANSITIONEND] = function (e) {
3741            e.stopPropagation();
3742          };
3743
3744          addEvents(img, eve);
3745          addEvents(img, imgEvents); // update src
3746
3747          img.src = getAttr(img, 'data-src'); // update srcset
3748
3749          var srcset = getAttr(img, 'data-srcset');
3750
3751          if (srcset) {
3752            img.srcset = srcset;
3753          }
3754
3755          addClass(img, 'loading');
3756        }
3757      });
3758    }
3759  }
3760
3761  function onImgLoaded(e) {
3762    imgLoaded(getTarget(e));
3763  }
3764
3765  function onImgFailed(e) {
3766    imgFailed(getTarget(e));
3767  }
3768
3769  function imgLoaded(img) {
3770    addClass(img, 'loaded');
3771    imgCompleted(img);
3772  }
3773
3774  function imgFailed(img) {
3775    addClass(img, 'failed');
3776    imgCompleted(img);
3777  }
3778
3779  function imgCompleted(img) {
3780    addClass(img, imgCompleteClass);
3781    removeClass(img, 'loading');
3782    removeEvents(img, imgEvents);
3783  }
3784
3785  function getImageArray(start, end, imgSelector) {
3786    var imgs = [];
3787
3788    if (!imgSelector) {
3789      imgSelector = 'img';
3790    }
3791
3792    while (start <= end) {
3793      forEach(slideItems[start].querySelectorAll(imgSelector), function (img) {
3794        imgs.push(img);
3795      });
3796      start++;
3797    }
3798
3799    return imgs;
3800  } // check if all visible images are loaded
3801  // and update container height if it's done
3802
3803
3804  function doAutoHeight() {
3805    var imgs = getImageArray.apply(null, getVisibleSlideRange());
3806    raf(function () {
3807      imgsLoadedCheck(imgs, updateInnerWrapperHeight);
3808    });
3809  }
3810
3811  function imgsLoadedCheck(imgs, cb) {
3812    // execute callback function if all images are complete
3813    if (imgsComplete) {
3814      return cb();
3815    } // check image classes
3816
3817
3818    imgs.forEach(function (img, index) {
3819      if (!lazyload && img.complete) {
3820        imgCompleted(img);
3821      } // Check image.complete
3822
3823
3824      if (hasClass(img, imgCompleteClass)) {
3825        imgs.splice(index, 1);
3826      }
3827    }); // execute callback function if selected images are all complete
3828
3829    if (!imgs.length) {
3830      return cb();
3831    } // otherwise execute this functiona again
3832
3833
3834    raf(function () {
3835      imgsLoadedCheck(imgs, cb);
3836    });
3837  }
3838
3839  function additionalUpdates() {
3840    doLazyLoad();
3841    updateSlideStatus();
3842    updateLiveRegion();
3843    updateControlsStatus();
3844    updateNavStatus();
3845  }
3846
3847  function update_carousel_transition_duration() {
3848    if (carousel && autoHeight) {
3849      middleWrapper.style[TRANSITIONDURATION] = speed / 1000 + 's';
3850    }
3851  }
3852
3853  function getMaxSlideHeight(slideStart, slideRange) {
3854    var heights = [];
3855
3856    for (var i = slideStart, l = Math.min(slideStart + slideRange, slideCountNew); i < l; i++) {
3857      heights.push(slideItems[i].offsetHeight);
3858    }
3859
3860    return Math.max.apply(null, heights);
3861  } // update inner wrapper height
3862  // 1. get the max-height of the visible slides
3863  // 2. set transitionDuration to speed
3864  // 3. update inner wrapper height to max-height
3865  // 4. set transitionDuration to 0s after transition done
3866
3867
3868  function updateInnerWrapperHeight() {
3869    var maxHeight = autoHeight ? getMaxSlideHeight(index, items) : getMaxSlideHeight(cloneCount, slideCount),
3870        wp = middleWrapper ? middleWrapper : innerWrapper;
3871
3872    if (wp.style.height !== maxHeight) {
3873      wp.style.height = maxHeight + 'px';
3874    }
3875  } // get the distance from the top edge of the first slide to each slide
3876  // (init) => slidePositions
3877
3878
3879  function setSlidePositions() {
3880    slidePositions = [0];
3881    var attr = horizontal ? 'left' : 'top',
3882        attr2 = horizontal ? 'right' : 'bottom',
3883        base = slideItems[0].getBoundingClientRect()[attr];
3884    forEach(slideItems, function (item, i) {
3885      // skip the first slide
3886      if (i) {
3887        slidePositions.push(item.getBoundingClientRect()[attr] - base);
3888      } // add the end edge
3889
3890
3891      if (i === slideCountNew - 1) {
3892        slidePositions.push(item.getBoundingClientRect()[attr2] - base);
3893      }
3894    });
3895  } // update slide
3896
3897
3898  function updateSlideStatus() {
3899    var range = getVisibleSlideRange(),
3900        start = range[0],
3901        end = range[1];
3902    forEach(slideItems, function (item, i) {
3903      // show slides
3904      if (i >= start && i <= end) {
3905        if (hasAttr(item, 'aria-hidden')) {
3906          removeAttrs(item, ['aria-hidden', 'tabindex']);
3907          addClass(item, slideActiveClass);
3908        } // hide slides
3909
3910      } else {
3911        if (!hasAttr(item, 'aria-hidden')) {
3912          setAttrs(item, {
3913            'aria-hidden': 'true',
3914            'tabindex': '-1'
3915          });
3916          removeClass(item, slideActiveClass);
3917        }
3918      }
3919    });
3920  } // gallery: update slide position
3921
3922
3923  function updateGallerySlidePositions() {
3924    var l = index + Math.min(slideCount, items);
3925
3926    for (var i = slideCountNew; i--;) {
3927      var item = slideItems[i];
3928
3929      if (i >= index && i < l) {
3930        // add transitions to visible slides when adjusting their positions
3931        addClass(item, 'tns-moving');
3932        item.style.left = (i - index) * 100 / items + '%';
3933        addClass(item, animateIn);
3934        removeClass(item, animateNormal);
3935      } else if (item.style.left) {
3936        item.style.left = '';
3937        addClass(item, animateNormal);
3938        removeClass(item, animateIn);
3939      } // remove outlet animation
3940
3941
3942      removeClass(item, animateOut);
3943    } // removing '.tns-moving'
3944
3945
3946    setTimeout(function () {
3947      forEach(slideItems, function (el) {
3948        removeClass(el, 'tns-moving');
3949      });
3950    }, 300);
3951  } // set tabindex on Nav
3952
3953
3954  function updateNavStatus() {
3955    // get current nav
3956    if (nav) {
3957      navCurrentIndex = navClicked >= 0 ? navClicked : getCurrentNavIndex();
3958      navClicked = -1;
3959
3960      if (navCurrentIndex !== navCurrentIndexCached) {
3961        var navPrev = navItems[navCurrentIndexCached],
3962            navCurrent = navItems[navCurrentIndex];
3963        setAttrs(navPrev, {
3964          'tabindex': '-1',
3965          'aria-label': navStr + (navCurrentIndexCached + 1)
3966        });
3967        removeClass(navPrev, navActiveClass);
3968        setAttrs(navCurrent, {
3969          'aria-label': navStr + (navCurrentIndex + 1) + navStrCurrent
3970        });
3971        removeAttrs(navCurrent, 'tabindex');
3972        addClass(navCurrent, navActiveClass);
3973        navCurrentIndexCached = navCurrentIndex;
3974      }
3975    }
3976  }
3977
3978  function getLowerCaseNodeName(el) {
3979    return el.nodeName.toLowerCase();
3980  }
3981
3982  function isButton(el) {
3983    return getLowerCaseNodeName(el) === 'button';
3984  }
3985
3986  function isAriaDisabled(el) {
3987    return el.getAttribute('aria-disabled') === 'true';
3988  }
3989
3990  function disEnableElement(isButton, el, val) {
3991    if (isButton) {
3992      el.disabled = val;
3993    } else {
3994      el.setAttribute('aria-disabled', val.toString());
3995    }
3996  } // set 'disabled' to true on controls when reach the edges
3997
3998
3999  function updateControlsStatus() {
4000    if (!controls || rewind || loop) {
4001      return;
4002    }
4003
4004    var prevDisabled = prevIsButton ? prevButton.disabled : isAriaDisabled(prevButton),
4005        nextDisabled = nextIsButton ? nextButton.disabled : isAriaDisabled(nextButton),
4006        disablePrev = index <= indexMin ? true : false,
4007        disableNext = !rewind && index >= indexMax ? true : false;
4008
4009    if (disablePrev && !prevDisabled) {
4010      disEnableElement(prevIsButton, prevButton, true);
4011    }
4012
4013    if (!disablePrev && prevDisabled) {
4014      disEnableElement(prevIsButton, prevButton, false);
4015    }
4016
4017    if (disableNext && !nextDisabled) {
4018      disEnableElement(nextIsButton, nextButton, true);
4019    }
4020
4021    if (!disableNext && nextDisabled) {
4022      disEnableElement(nextIsButton, nextButton, false);
4023    }
4024  } // set duration
4025
4026
4027  function resetDuration(el, str) {
4028    if (TRANSITIONDURATION) {
4029      el.style[TRANSITIONDURATION] = str;
4030    }
4031  }
4032
4033  function getSliderWidth() {
4034    return fixedWidth ? (fixedWidth + gutter) * slideCountNew : slidePositions[slideCountNew];
4035  }
4036
4037  function getCenterGap(num) {
4038    if (num == null) {
4039      num = index;
4040    }
4041
4042    var gap = edgePadding ? gutter : 0;
4043    return autoWidth ? (viewport - gap - (slidePositions[num + 1] - slidePositions[num] - gutter)) / 2 : fixedWidth ? (viewport - fixedWidth) / 2 : (items - 1) / 2;
4044  }
4045
4046  function getRightBoundary() {
4047    var gap = edgePadding ? gutter : 0,
4048        result = viewport + gap - getSliderWidth();
4049
4050    if (center && !loop) {
4051      result = fixedWidth ? -(fixedWidth + gutter) * (slideCountNew - 1) - getCenterGap() : getCenterGap(slideCountNew - 1) - slidePositions[slideCountNew - 1];
4052    }
4053
4054    if (result > 0) {
4055      result = 0;
4056    }
4057
4058    return result;
4059  }
4060
4061  function getContainerTransformValue(num) {
4062    if (num == null) {
4063      num = index;
4064    }
4065
4066    var val;
4067
4068    if (horizontal && !autoWidth) {
4069      if (fixedWidth) {
4070        val = -(fixedWidth + gutter) * num;
4071
4072        if (center) {
4073          val += getCenterGap();
4074        }
4075      } else {
4076        var denominator = TRANSFORM ? slideCountNew : items;
4077
4078        if (center) {
4079          num -= getCenterGap();
4080        }
4081
4082        val = -num * 100 / denominator;
4083      }
4084    } else {
4085      val = -slidePositions[num];
4086
4087      if (center && autoWidth) {
4088        val += getCenterGap();
4089      }
4090    }
4091
4092    if (hasRightDeadZone) {
4093      val = Math.max(val, rightBoundary);
4094    }
4095
4096    val += horizontal && !autoWidth && !fixedWidth ? '%' : 'px';
4097    return val;
4098  }
4099
4100  function doContainerTransformSilent(val) {
4101    resetDuration(container, '0s');
4102    doContainerTransform(val);
4103  }
4104
4105  function doContainerTransform(val) {
4106    if (val == null) {
4107      val = getContainerTransformValue();
4108    }
4109
4110    container.style[transformAttr] = transformPrefix + val + transformPostfix;
4111  }
4112
4113  function animateSlide(number, classOut, classIn, isOut) {
4114    var l = number + items;
4115
4116    if (!loop) {
4117      l = Math.min(l, slideCountNew);
4118    }
4119
4120    for (var i = number; i < l; i++) {
4121      var item = slideItems[i]; // set item positions
4122
4123      if (!isOut) {
4124        item.style.left = (i - index) * 100 / items + '%';
4125      }
4126
4127      if (animateDelay && TRANSITIONDELAY) {
4128        item.style[TRANSITIONDELAY] = item.style[ANIMATIONDELAY] = animateDelay * (i - number) / 1000 + 's';
4129      }
4130
4131      removeClass(item, classOut);
4132      addClass(item, classIn);
4133
4134      if (isOut) {
4135        slideItemsOut.push(item);
4136      }
4137    }
4138  } // make transfer after click/drag:
4139  // 1. change 'transform' property for mordern browsers
4140  // 2. change 'left' property for legacy browsers
4141
4142
4143  var transformCore = function () {
4144    return carousel ? function () {
4145      resetDuration(container, '');
4146
4147      if (TRANSITIONDURATION || !speed) {
4148        // for morden browsers with non-zero duration or
4149        // zero duration for all browsers
4150        doContainerTransform(); // run fallback function manually
4151        // when duration is 0 / container is hidden
4152
4153        if (!speed || !isVisible(container)) {
4154          onTransitionEnd();
4155        }
4156      } else {
4157        // for old browser with non-zero duration
4158        jsTransform(container, transformAttr, transformPrefix, transformPostfix, getContainerTransformValue(), speed, onTransitionEnd);
4159      }
4160
4161      if (!horizontal) {
4162        updateContentWrapperHeight();
4163      }
4164    } : function () {
4165      slideItemsOut = [];
4166      var eve = {};
4167      eve[TRANSITIONEND] = eve[ANIMATIONEND] = onTransitionEnd;
4168      removeEvents(slideItems[indexCached], eve);
4169      addEvents(slideItems[index], eve);
4170      animateSlide(indexCached, animateIn, animateOut, true);
4171      animateSlide(index, animateNormal, animateIn); // run fallback function manually
4172      // when transition or animation not supported / duration is 0
4173
4174      if (!TRANSITIONEND || !ANIMATIONEND || !speed || !isVisible(container)) {
4175        onTransitionEnd();
4176      }
4177    };
4178  }();
4179
4180  function render(e, sliderMoved) {
4181    if (updateIndexBeforeTransform) {
4182      updateIndex();
4183    } // render when slider was moved (touch or drag) even though index may not change
4184
4185
4186    if (index !== indexCached || sliderMoved) {
4187      // events
4188      events.emit('indexChanged', info());
4189      events.emit('transitionStart', info());
4190
4191      if (autoHeight) {
4192        doAutoHeight();
4193      } // pause autoplay when click or keydown from user
4194
4195
4196      if (animating && e && ['click', 'keydown'].indexOf(e.type) >= 0) {
4197        stopAutoplay();
4198      }
4199
4200      running = true;
4201      transformCore();
4202    }
4203  }
4204  /*
4205   * Transfer prefixed properties to the same format
4206   * CSS: -Webkit-Transform => webkittransform
4207   * JS: WebkitTransform => webkittransform
4208   * @param {string} str - property
4209   *
4210   */
4211
4212
4213  function strTrans(str) {
4214    return str.toLowerCase().replace(/-/g, '');
4215  } // AFTER TRANSFORM
4216  // Things need to be done after a transfer:
4217  // 1. check index
4218  // 2. add classes to visible slide
4219  // 3. disable controls buttons when reach the first/last slide in non-loop slider
4220  // 4. update nav status
4221  // 5. lazyload images
4222  // 6. update container height
4223
4224
4225  function onTransitionEnd(event) {
4226    // check running on gallery mode
4227    // make sure trantionend/animationend events run only once
4228    if (carousel || running) {
4229      events.emit('transitionEnd', info(event));
4230
4231      if (!carousel && slideItemsOut.length > 0) {
4232        for (var i = 0; i < slideItemsOut.length; i++) {
4233          var item = slideItemsOut[i]; // set item positions
4234
4235          item.style.left = '';
4236
4237          if (ANIMATIONDELAY && TRANSITIONDELAY) {
4238            item.style[ANIMATIONDELAY] = '';
4239            item.style[TRANSITIONDELAY] = '';
4240          }
4241
4242          removeClass(item, animateOut);
4243          addClass(item, animateNormal);
4244        }
4245      }
4246      /* update slides, nav, controls after checking ...
4247       * => legacy browsers who don't support 'event'
4248       *    have to check event first, otherwise event.target will cause an error
4249       * => or 'gallery' mode:
4250       *   + event target is slide item
4251       * => or 'carousel' mode:
4252       *   + event target is container,
4253       *   + event.property is the same with transform attribute
4254       */
4255
4256
4257      if (!event || !carousel && event.target.parentNode === container || event.target === container && strTrans(event.propertyName) === strTrans(transformAttr)) {
4258        if (!updateIndexBeforeTransform) {
4259          var indexTem = index;
4260          updateIndex();
4261
4262          if (index !== indexTem) {
4263            events.emit('indexChanged', info());
4264            doContainerTransformSilent();
4265          }
4266        }
4267
4268        if (nested === 'inner') {
4269          events.emit('innerLoaded', info());
4270        }
4271
4272        running = false;
4273        indexCached = index;
4274      }
4275    }
4276  } // # ACTIONS
4277
4278
4279  function goTo(targetIndex, e) {
4280    if (freeze) {
4281      return;
4282    } // prev slideBy
4283
4284
4285    if (targetIndex === 'prev') {
4286      onControlsClick(e, -1); // next slideBy
4287    } else if (targetIndex === 'next') {
4288      onControlsClick(e, 1); // go to exact slide
4289    } else {
4290      if (running) {
4291        if (preventActionWhenRunning) {
4292          return;
4293        } else {
4294          onTransitionEnd();
4295        }
4296      }
4297
4298      var absIndex = getAbsIndex(),
4299          indexGap = 0;
4300
4301      if (targetIndex === 'first') {
4302        indexGap = -absIndex;
4303      } else if (targetIndex === 'last') {
4304        indexGap = carousel ? slideCount - items - absIndex : slideCount - 1 - absIndex;
4305      } else {
4306        if (typeof targetIndex !== 'number') {
4307          targetIndex = parseInt(targetIndex);
4308        }
4309
4310        if (!isNaN(targetIndex)) {
4311          // from directly called goTo function
4312          if (!e) {
4313            targetIndex = Math.max(0, Math.min(slideCount - 1, targetIndex));
4314          }
4315
4316          indexGap = targetIndex - absIndex;
4317        }
4318      } // gallery: make sure new page won't overlap with current page
4319
4320
4321      if (!carousel && indexGap && Math.abs(indexGap) < items) {
4322        var factor = indexGap > 0 ? 1 : -1;
4323        indexGap += index + indexGap - slideCount >= indexMin ? slideCount * factor : slideCount * 2 * factor * -1;
4324      }
4325
4326      index += indexGap; // make sure index is in range
4327
4328      if (carousel && loop) {
4329        if (index < indexMin) {
4330          index += slideCount;
4331        }
4332
4333        if (index > indexMax) {
4334          index -= slideCount;
4335        }
4336      } // if index is changed, start rendering
4337
4338
4339      if (getAbsIndex(index) !== getAbsIndex(indexCached)) {
4340        render(e);
4341      }
4342    }
4343  } // on controls click
4344
4345
4346  function onControlsClick(e, dir) {
4347    if (running) {
4348      if (preventActionWhenRunning) {
4349        return;
4350      } else {
4351        onTransitionEnd();
4352      }
4353    }
4354
4355    var passEventObject;
4356
4357    if (!dir) {
4358      e = getEvent(e);
4359      var target = getTarget(e);
4360
4361      while (target !== controlsContainer && [prevButton, nextButton].indexOf(target) < 0) {
4362        target = target.parentNode;
4363      }
4364
4365      var targetIn = [prevButton, nextButton].indexOf(target);
4366
4367      if (targetIn >= 0) {
4368        passEventObject = true;
4369        dir = targetIn === 0 ? -1 : 1;
4370      }
4371    }
4372
4373    if (rewind) {
4374      if (index === indexMin && dir === -1) {
4375        goTo('last', e);
4376        return;
4377      } else if (index === indexMax && dir === 1) {
4378        goTo('first', e);
4379        return;
4380      }
4381    }
4382
4383    if (dir) {
4384      index += slideBy * dir;
4385
4386      if (autoWidth) {
4387        index = Math.floor(index);
4388      } // pass e when click control buttons or keydown
4389
4390
4391      render(passEventObject || e && e.type === 'keydown' ? e : null);
4392    }
4393  } // on nav click
4394
4395
4396  function onNavClick(e) {
4397    if (running) {
4398      if (preventActionWhenRunning) {
4399        return;
4400      } else {
4401        onTransitionEnd();
4402      }
4403    }
4404
4405    e = getEvent(e);
4406    var target = getTarget(e),
4407        navIndex; // find the clicked nav item
4408
4409    while (target !== navContainer && !hasAttr(target, 'data-nav')) {
4410      target = target.parentNode;
4411    }
4412
4413    if (hasAttr(target, 'data-nav')) {
4414      var navIndex = navClicked = Number(getAttr(target, 'data-nav')),
4415          targetIndexBase = fixedWidth || autoWidth ? navIndex * slideCount / pages : navIndex * items,
4416          targetIndex = navAsThumbnails ? navIndex : Math.min(Math.ceil(targetIndexBase), slideCount - 1);
4417      goTo(targetIndex, e);
4418
4419      if (navCurrentIndex === navIndex) {
4420        if (animating) {
4421          stopAutoplay();
4422        }
4423
4424        navClicked = -1; // reset navClicked
4425      }
4426    }
4427  } // autoplay functions
4428
4429
4430  function setAutoplayTimer() {
4431    autoplayTimer = setInterval(function () {
4432      onControlsClick(null, autoplayDirection);
4433    }, autoplayTimeout);
4434    animating = true;
4435  }
4436
4437  function stopAutoplayTimer() {
4438    clearInterval(autoplayTimer);
4439    animating = false;
4440  }
4441
4442  function updateAutoplayButton(action, txt) {
4443    setAttrs(autoplayButton, {
4444      'data-action': action
4445    });
4446    autoplayButton.innerHTML = autoplayHtmlStrings[0] + action + autoplayHtmlStrings[1] + txt;
4447  }
4448
4449  function startAutoplay() {
4450    setAutoplayTimer();
4451
4452    if (autoplayButton) {
4453      updateAutoplayButton('stop', autoplayText[1]);
4454    }
4455  }
4456
4457  function stopAutoplay() {
4458    stopAutoplayTimer();
4459
4460    if (autoplayButton) {
4461      updateAutoplayButton('start', autoplayText[0]);
4462    }
4463  } // programaitcally play/pause the slider
4464
4465
4466  function play() {
4467    if (autoplay && !animating) {
4468      startAutoplay();
4469      autoplayUserPaused = false;
4470    }
4471  }
4472
4473  function pause() {
4474    if (animating) {
4475      stopAutoplay();
4476      autoplayUserPaused = true;
4477    }
4478  }
4479
4480  function toggleAutoplay() {
4481    if (animating) {
4482      stopAutoplay();
4483      autoplayUserPaused = true;
4484    } else {
4485      startAutoplay();
4486      autoplayUserPaused = false;
4487    }
4488  }
4489
4490  function onVisibilityChange() {
4491    if (doc.hidden) {
4492      if (animating) {
4493        stopAutoplayTimer();
4494        autoplayVisibilityPaused = true;
4495      }
4496    } else if (autoplayVisibilityPaused) {
4497      setAutoplayTimer();
4498      autoplayVisibilityPaused = false;
4499    }
4500  }
4501
4502  function mouseoverPause() {
4503    if (animating) {
4504      stopAutoplayTimer();
4505      autoplayHoverPaused = true;
4506    }
4507  }
4508
4509  function mouseoutRestart() {
4510    if (autoplayHoverPaused) {
4511      setAutoplayTimer();
4512      autoplayHoverPaused = false;
4513    }
4514  } // keydown events on document
4515
4516
4517  function onDocumentKeydown(e) {
4518    e = getEvent(e);
4519    var keyIndex = [KEYS.LEFT, KEYS.RIGHT].indexOf(e.keyCode);
4520
4521    if (keyIndex >= 0) {
4522      onControlsClick(e, keyIndex === 0 ? -1 : 1);
4523    }
4524  } // on key control
4525
4526
4527  function onControlsKeydown(e) {
4528    e = getEvent(e);
4529    var keyIndex = [KEYS.LEFT, KEYS.RIGHT].indexOf(e.keyCode);
4530
4531    if (keyIndex >= 0) {
4532      if (keyIndex === 0) {
4533        if (!prevButton.disabled) {
4534          onControlsClick(e, -1);
4535        }
4536      } else if (!nextButton.disabled) {
4537        onControlsClick(e, 1);
4538      }
4539    }
4540  } // set focus
4541
4542
4543  function setFocus(el) {
4544    el.focus();
4545  } // on key nav
4546
4547
4548  function onNavKeydown(e) {
4549    e = getEvent(e);
4550    var curElement = doc.activeElement;
4551
4552    if (!hasAttr(curElement, 'data-nav')) {
4553      return;
4554    } // var code = e.keyCode,
4555
4556
4557    var keyIndex = [KEYS.LEFT, KEYS.RIGHT, KEYS.ENTER, KEYS.SPACE].indexOf(e.keyCode),
4558        navIndex = Number(getAttr(curElement, 'data-nav'));
4559
4560    if (keyIndex >= 0) {
4561      if (keyIndex === 0) {
4562        if (navIndex > 0) {
4563          setFocus(navItems[navIndex - 1]);
4564        }
4565      } else if (keyIndex === 1) {
4566        if (navIndex < pages - 1) {
4567          setFocus(navItems[navIndex + 1]);
4568        }
4569      } else {
4570        navClicked = navIndex;
4571        goTo(navIndex, e);
4572      }
4573    }
4574  }
4575
4576  function getEvent(e) {
4577    e = e || win.event;
4578    return isTouchEvent(e) ? e.changedTouches[0] : e;
4579  }
4580
4581  function getTarget(e) {
4582    return e.target || win.event.srcElement;
4583  }
4584
4585  function isTouchEvent(e) {
4586    return e.type.indexOf('touch') >= 0;
4587  }
4588
4589  function preventDefaultBehavior(e) {
4590    e.preventDefault ? e.preventDefault() : e.returnValue = false;
4591  }
4592
4593  function getMoveDirectionExpected() {
4594    return getTouchDirection(toDegree(lastPosition.y - initPosition.y, lastPosition.x - initPosition.x), swipeAngle) === options.axis;
4595  }
4596
4597  function onPanStart(e) {
4598    if (running) {
4599      if (preventActionWhenRunning) {
4600        return;
4601      } else {
4602        onTransitionEnd();
4603      }
4604    }
4605
4606    if (autoplay && animating) {
4607      stopAutoplayTimer();
4608    }
4609
4610    panStart = true;
4611
4612    if (rafIndex) {
4613      caf(rafIndex);
4614      rafIndex = null;
4615    }
4616
4617    var $ = getEvent(e);
4618    events.emit(isTouchEvent(e) ? 'touchStart' : 'dragStart', info(e));
4619
4620    if (!isTouchEvent(e) && ['img', 'a'].indexOf(getLowerCaseNodeName(getTarget(e))) >= 0) {
4621      preventDefaultBehavior(e);
4622    }
4623
4624    lastPosition.x = initPosition.x = $.clientX;
4625    lastPosition.y = initPosition.y = $.clientY;
4626
4627    if (carousel) {
4628      translateInit = parseFloat(container.style[transformAttr].replace(transformPrefix, ''));
4629      resetDuration(container, '0s');
4630    }
4631  }
4632
4633  function onPanMove(e) {
4634    if (panStart) {
4635      var $ = getEvent(e);
4636      lastPosition.x = $.clientX;
4637      lastPosition.y = $.clientY;
4638
4639      if (carousel) {
4640        if (!rafIndex) {
4641          rafIndex = raf(function () {
4642            panUpdate(e);
4643          });
4644        }
4645      } else {
4646        if (moveDirectionExpected === '?') {
4647          moveDirectionExpected = getMoveDirectionExpected();
4648        }
4649
4650        if (moveDirectionExpected) {
4651          preventScroll = true;
4652        }
4653      }
4654
4655      if ((typeof e.cancelable !== 'boolean' || e.cancelable) && preventScroll) {
4656        e.preventDefault();
4657      }
4658    }
4659  }
4660
4661  function panUpdate(e) {
4662    if (!moveDirectionExpected) {
4663      panStart = false;
4664      return;
4665    }
4666
4667    caf(rafIndex);
4668
4669    if (panStart) {
4670      rafIndex = raf(function () {
4671        panUpdate(e);
4672      });
4673    }
4674
4675    if (moveDirectionExpected === '?') {
4676      moveDirectionExpected = getMoveDirectionExpected();
4677    }
4678
4679    if (moveDirectionExpected) {
4680      if (!preventScroll && isTouchEvent(e)) {
4681        preventScroll = true;
4682      }
4683
4684      try {
4685        if (e.type) {
4686          events.emit(isTouchEvent(e) ? 'touchMove' : 'dragMove', info(e));
4687        }
4688      } catch (err) {}
4689
4690      var x = translateInit,
4691          dist = getDist(lastPosition, initPosition);
4692
4693      if (!horizontal || fixedWidth || autoWidth) {
4694        x += dist;
4695        x += 'px';
4696      } else {
4697        var percentageX = TRANSFORM ? dist * items * 100 / ((viewport + gutter) * slideCountNew) : dist * 100 / (viewport + gutter);
4698        x += percentageX;
4699        x += '%';
4700      }
4701
4702      container.style[transformAttr] = transformPrefix + x + transformPostfix;
4703    }
4704  }
4705
4706  function onPanEnd(e) {
4707    if (panStart) {
4708      if (rafIndex) {
4709        caf(rafIndex);
4710        rafIndex = null;
4711      }
4712
4713      if (carousel) {
4714        resetDuration(container, '');
4715      }
4716
4717      panStart = false;
4718      var $ = getEvent(e);
4719      lastPosition.x = $.clientX;
4720      lastPosition.y = $.clientY;
4721      var dist = getDist(lastPosition, initPosition);
4722
4723      if (Math.abs(dist)) {
4724        // drag vs click
4725        if (!isTouchEvent(e)) {
4726          // prevent "click"
4727          var target = getTarget(e);
4728          addEvents(target, {
4729            'click': function preventClick(e) {
4730              preventDefaultBehavior(e);
4731              removeEvents(target, {
4732                'click': preventClick
4733              });
4734            }
4735          });
4736        }
4737
4738        if (carousel) {
4739          rafIndex = raf(function () {
4740            if (horizontal && !autoWidth) {
4741              var indexMoved = -dist * items / (viewport + gutter);
4742              indexMoved = dist > 0 ? Math.floor(indexMoved) : Math.ceil(indexMoved);
4743              index += indexMoved;
4744            } else {
4745              var moved = -(translateInit + dist);
4746
4747              if (moved <= 0) {
4748                index = indexMin;
4749              } else if (moved >= slidePositions[slideCountNew - 1]) {
4750                index = indexMax;
4751              } else {
4752                var i = 0;
4753
4754                while (i < slideCountNew && moved >= slidePositions[i]) {
4755                  index = i;
4756
4757                  if (moved > slidePositions[i] && dist < 0) {
4758                    index += 1;
4759                  }
4760
4761                  i++;
4762                }
4763              }
4764            }
4765
4766            render(e, dist);
4767            events.emit(isTouchEvent(e) ? 'touchEnd' : 'dragEnd', info(e));
4768          });
4769        } else {
4770          if (moveDirectionExpected) {
4771            onControlsClick(e, dist > 0 ? -1 : 1);
4772          }
4773        }
4774      }
4775    } // reset
4776
4777
4778    if (options.preventScrollOnTouch === 'auto') {
4779      preventScroll = false;
4780    }
4781
4782    if (swipeAngle) {
4783      moveDirectionExpected = '?';
4784    }
4785
4786    if (autoplay && !animating) {
4787      setAutoplayTimer();
4788    }
4789  } // === RESIZE FUNCTIONS === //
4790  // (slidePositions, index, items) => vertical_conentWrapper.height
4791
4792
4793  function updateContentWrapperHeight() {
4794    var wp = middleWrapper ? middleWrapper : innerWrapper;
4795    wp.style.height = slidePositions[index + items] - slidePositions[index] + 'px';
4796  }
4797
4798  function getPages() {
4799    var rough = fixedWidth ? (fixedWidth + gutter) * slideCount / viewport : slideCount / items;
4800    return Math.min(Math.ceil(rough), slideCount);
4801  }
4802  /*
4803   * 1. update visible nav items list
4804   * 2. add "hidden" attributes to previous visible nav items
4805   * 3. remove "hidden" attrubutes to new visible nav items
4806   */
4807
4808
4809  function updateNavVisibility() {
4810    if (!nav || navAsThumbnails) {
4811      return;
4812    }
4813
4814    if (pages !== pagesCached) {
4815      var min = pagesCached,
4816          max = pages,
4817          fn = showElement;
4818
4819      if (pagesCached > pages) {
4820        min = pages;
4821        max = pagesCached;
4822        fn = hideElement;
4823      }
4824
4825      while (min < max) {
4826        fn(navItems[min]);
4827        min++;
4828      } // cache pages
4829
4830
4831      pagesCached = pages;
4832    }
4833  }
4834
4835  function info(e) {
4836    return {
4837      container: container,
4838      slideItems: slideItems,
4839      navContainer: navContainer,
4840      navItems: navItems,
4841      controlsContainer: controlsContainer,
4842      hasControls: hasControls,
4843      prevButton: prevButton,
4844      nextButton: nextButton,
4845      items: items,
4846      slideBy: slideBy,
4847      cloneCount: cloneCount,
4848      slideCount: slideCount,
4849      slideCountNew: slideCountNew,
4850      index: index,
4851      indexCached: indexCached,
4852      displayIndex: getCurrentSlide(),
4853      navCurrentIndex: navCurrentIndex,
4854      navCurrentIndexCached: navCurrentIndexCached,
4855      pages: pages,
4856      pagesCached: pagesCached,
4857      sheet: sheet,
4858      isOn: isOn,
4859      event: e || {}
4860    };
4861  }
4862
4863  return {
4864    version: '2.9.4',
4865    getInfo: info,
4866    events: events,
4867    goTo: goTo,
4868    play: play,
4869    pause: pause,
4870    isOn: isOn,
4871    updateSliderHeight: updateInnerWrapperHeight,
4872    refresh: initSliderTransform,
4873    destroy: destroy,
4874    rebuild: function () {
4875      return tns(extend(options, optionsElements));
4876    }
4877  };
4878};
4879
4880exports.tns = tns;
4881
4882
4883/***/ })
vendor: 4,344 bytes, lines 4883-5002
4883
4884
4885/******/ 	});
4886/************************************************************************/
4887/******/ 	// The module cache
4888/******/ 	var __webpack_module_cache__ = {};
4889/******/ 	
4890/******/ 	// The require function
4891/******/ 	function __webpack_require__(moduleId) {
4892/******/ 		// Check if module is in cache
4893/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
4894/******/ 		if (cachedModule !== undefined) {
4895/******/ 			return cachedModule.exports;
4896/******/ 		}
4897/******/ 		// Create a new module (and put it into the cache)
4898/******/ 		var module = __webpack_module_cache__[moduleId] = {
4899/******/ 			// no module.id needed
4900/******/ 			// no module.loaded needed
4901/******/ 			exports: {}
4902/******/ 		};
4903/******/ 	
4904/******/ 		// Execute the module function
4905/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
4906/******/ 	
4907/******/ 		// Return the exports of the module
4908/******/ 		return module.exports;
4909/******/ 	}
4910/******/ 	
4911/************************************************************************/
4912/******/ 	/* webpack/runtime/global */
4913/******/ 	(() => {
4914/******/ 		__webpack_require__.g = (function() {
4915/******/ 			if (typeof globalThis === 'object') return globalThis;
4916/******/ 			try {
4917/******/ 				return this || new Function('return this')();
4918/******/ 			} catch (e) {
4919/******/ 				if (typeof window === 'object') return window;
4920/******/ 			}
4921/******/ 		})();
4922/******/ 	})();
4923/******/ 	
4924/******/ 	/* webpack/runtime/make namespace object */
4925/******/ 	(() => {
4926/******/ 		// define __esModule on exports
4927/******/ 		__webpack_require__.r = (exports) => {
4928/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
4929/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4930/******/ 			}
4931/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
4932/******/ 		};
4933/******/ 	})();
4934/******/ 	
4935/************************************************************************/
4936var __webpack_exports__ = {};
4937// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
4938(() => {
4939"use strict";
4940/*!***************************!*\
4941  !*** ./webpack/js/app.js ***!
4942  \***************************/
4943
4944
4945var _aos = __webpack_require__(/*! aos */ "./node_modules/aos/dist/aos.js");
4946
4947var _aos2 = _interopRequireDefault(_aos);
4948
4949var _rellax = __webpack_require__(/*! rellax */ "./node_modules/rellax/rellax.js");
4950
4951var _rellax2 = _interopRequireDefault(_rellax);
4952
4953var _main = __webpack_require__(/*! ../css/sass/main.scss */ "./webpack/css/sass/main.scss");
4954
4955var _main2 = _interopRequireDefault(_main);
4956
4957var _inline = __webpack_require__(/*! ../css/sass/inline.scss */ "./webpack/css/sass/inline.scss");
4958
4959var _inline2 = _interopRequireDefault(_inline);
4960
4961var _mobileMenu = __webpack_require__(/*! ./scripts/menu/mobileMenu */ "./webpack/js/scripts/menu/mobileMenu.js");
4962
4963var _mobileMenu2 = _interopRequireDefault(_mobileMenu);
4964
4965var _subMenu = __webpack_require__(/*! ./scripts/menu/subMenu */ "./webpack/js/scripts/menu/subMenu.js");
4966
4967var _subMenu2 = _interopRequireDefault(_subMenu);
4968
4969var _footerSubMenu = __webpack_require__(/*! ./scripts/menu/footerSubMenu */ "./webpack/js/scripts/menu/footerSubMenu.js");
4970
4971var _footerSubMenu2 = _interopRequireDefault(_footerSubMenu);
4972
4973var _sliderPosts = __webpack_require__(/*! ./scripts/sliderPosts */ "./webpack/js/scripts/sliderPosts.js");
4974
4975var _sliderPosts2 = _interopRequireDefault(_sliderPosts);
4976
4977var _shareSocialMidia = __webpack_require__(/*! ./scripts/shareSocialMidia */ "./webpack/js/scripts/shareSocialMidia.js");
4978
4979var _shareSocialMidia2 = _interopRequireDefault(_shareSocialMidia);
4980
4981var _copyLink = __webpack_require__(/*! ./scripts/copyLink */ "./webpack/js/scripts/copyLink.js");
4982
4983var _copyLink2 = _interopRequireDefault(_copyLink);
4984
4985function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4986
4987_aos2.default.init({
4988    once: true,
4989    delay: 50
4990});
4991
4992var windowWidth = window.innerWidth;
4993if (windowWidth >= 1024) {
4994    var rellax = new _rellax2.default(".js-rellax");
4995}
4996
4997// import segmentCookieControl from './scripts/segmentCookieControl';
4998// import toggleSubMenu from './scripts/toggleSubMenu';
4999
5000// import toogleModal from './scripts/toogleModal';
5001// import utils from './scripts/lib/utils';
5002// import elsScrolling from './scripts/elsScrolling';
5003// import saveUserLastPage from './scripts/saveUserLastPage';
5004
5005// import simpleLazyImgs from './scripts/simpleLazyImgs';
5006// import resizeVideoEmbeds from './scripts/resizeVideoEmbeds';
5007// import headerScrolling from './scripts/headerScrolling';
5008// import editFormContacts from './scripts/editFormContacts';
5009
5010// import editModalContacts from './scripts/editModalContacts';
5011// import redirect404 from './scripts/redirect404';
5012// import moreScroll from './scripts/moreScroll';
5013
5014// segmentCookieControl();
5015
5016// toogleModal();
5017// utils();
5018// elsScrolling();
5019// saveUserLastPage();
5020// shareSocialMidia();
5021// simpleLazyImgs();
5022// resizeVideoEmbeds();
5023
5024// redirect404();
5025// moreScroll();
5026
5027(0, _mobileMenu2.default)();
5028(0, _subMenu2.default)();
5029(0, _footerSubMenu2.default)();
5030(0, _sliderPosts2.default)();
5031(0, _shareSocialMidia2.default)();
5032(0, _copyLink2.default)();
5033})();
5034
5035/******/ })()
5036;
5037//# sourceMappingURL=app.js.map

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.