!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).PerfectScrollbar=e()}(this,function(){"use strict";var v=Math.abs,m=Math.floor;function Y(t){return getComputedStyle(t)}function d(t,e){for(var i in e){var l=e[i];"number"==typeof l&&(l+="px"),t.style[i]=l}return t}function p(t){var e=document.createElement("div");return e.className=t,e}function s(t,e){if(!l)throw new Error("No element matching method supported");return l.call(t,e)}function n(t){t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)}function o(t,e){return Array.prototype.filter.call(t.children,function(t){return s(t,e)})}function X(t,e){var i=t.element.classList,l=W.state.scrolling(e);i.contains(l)?clearTimeout(r[e]):i.add(l)}function w(t,e){r[e]=setTimeout(function(){return t.isAlive&&t.element.classList.remove(W.state.scrolling(e))},t.settings.scrollingThreshold)}function f(t){if("function"==typeof window.CustomEvent)return new CustomEvent(t);var e=document.createEvent("CustomEvent");return e.initCustomEvent(t,!1,!1,void 0),e}function t(t,e,i,l,r){var n;if(void 0===l&&(l=!0),void 0===r&&(r=!1),"top"===e)n=["contentHeight","containerHeight","scrollTop","y","up","down"];else{if("left"!==e)throw new Error("A proper axis should be provided");n=["contentWidth","containerWidth","scrollLeft","x","left","right"]}!function(t,e,i,l,r){var n=i[0],o=i[1],s=i[2],a=i[3],c=i[4],h=i[5];void 0===l&&(l=!0),void 0===r&&(r=!1);var u=t.element;t.reach[a]=null,u[s]<1&&(t.reach[a]="start"),u[s]>t[n]-t[o]-1&&(t.reach[a]="end"),e&&(u.dispatchEvent(f("ps-scroll-"+a)),e<0?u.dispatchEvent(f("ps-scroll-"+c)):0=t.railXWidth-t.scrollbarXWidth&&(t.scrollbarXLeft=t.railXWidth-t.scrollbarXWidth),t.scrollbarYTop>=t.railYHeight-t.scrollbarYHeight&&(t.scrollbarYTop=t.railYHeight-t.scrollbarYHeight),function(t,e){var i={width:e.railXWidth},l=m(t.scrollTop);i.left=e.isRtl?e.negativeScrollAdjustment+t.scrollLeft+e.containerWidth-e.contentWidth:t.scrollLeft,e.isScrollbarXUsingBottom?i.bottom=e.scrollbarXBottom-l:i.top=e.scrollbarXTop+l,d(e.scrollbarXRail,i);var r={top:l,height:e.railYHeight};e.isScrollbarYUsingRight?e.isRtl?r.right=e.contentWidth-(e.negativeScrollAdjustment+t.scrollLeft)-e.scrollbarYRight-e.scrollbarYOuterWidth-9:r.right=e.scrollbarYRight-t.scrollLeft:e.isRtl?r.left=e.negativeScrollAdjustment+t.scrollLeft+2*e.containerWidth-e.contentWidth-e.scrollbarYLeft-e.scrollbarYOuterWidth:r.left=e.scrollbarYLeft+t.scrollLeft,d(e.scrollbarYRail,r),d(e.scrollbarX,{left:e.scrollbarXLeft,width:e.scrollbarXWidth-e.railBorderXWidth}),d(e.scrollbarY,{top:e.scrollbarYTop,height:e.scrollbarYHeight-e.railBorderYWidth})}(i,t),t.scrollbarXActive?i.classList.add(W.state.active("x")):(i.classList.remove(W.state.active("x")),t.scrollbarXWidth=0,t.scrollbarXLeft=0,i.scrollLeft=!0===t.isRtl?t.contentWidth:0),t.scrollbarYActive?i.classList.add(W.state.active("y")):(i.classList.remove(W.state.active("y")),t.scrollbarYHeight=0,t.scrollbarYTop=0,i.scrollTop=0)}function a(t,e){var i=Math.min,l=Math.max;return t.settings.minScrollbarLength&&(e=l(e,t.settings.minScrollbarLength)),t.settings.maxScrollbarLength&&(e=i(e,t.settings.maxScrollbarLength)),e}function e(i,t){function l(t){t.touches&&t.touches[0]&&(t[s]=t.touches[0].pageY),f[u]=b+v*(t[s]-g),X(i,d),y(i),t.stopPropagation(),t.preventDefault()}function r(){w(i,d),i[p].classList.remove(W.state.clicking),i.event.unbind(i.ownerDocument,"mousemove",l)}function e(t,e){b=f[u],e&&t.touches&&(t[s]=t.touches[0].pageY),g=t[s],v=(i[o]-i[n])/(i[a]-i[h]),e?i.event.bind(i.ownerDocument,"touchmove",l):(i.event.bind(i.ownerDocument,"mousemove",l),i.event.once(i.ownerDocument,"mouseup",r),t.preventDefault()),i[p].classList.add(W.state.clicking),t.stopPropagation()}var n=t[0],o=t[1],s=t[2],a=t[3],c=t[4],h=t[5],u=t[6],d=t[7],p=t[8],f=i.element,b=null,g=null,v=null;i.event.bind(i[c],"mousedown",function(t){e(t)}),i.event.bind(i[c],"touchstart",function(t){e(t,!0)})}function i(t){this.element=t,this.handlers={}}var l="undefined"!=typeof Element&&(Element.prototype.matches||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector),W={main:"ps",rtl:"ps__rtl",element:{thumb:function(t){return"ps__thumb-"+t},rail:function(t){return"ps__rail-"+t},consuming:"ps__child--consume"},state:{focus:"ps--focus",clicking:"ps--clicking",active:function(t){return"ps--active-"+t},scrolling:function(t){return"ps--scrolling-"+t}}},r={x:null,y:null},c={isEmpty:{configurable:!0}};i.prototype.bind=function(t,e){void 0===this.handlers[t]&&(this.handlers[t]=[]),this.handlers[t].push(e),this.element.addEventListener(t,e,!1)},i.prototype.unbind=function(e,i){var l=this;this.handlers[e]=this.handlers[e].filter(function(t){return!(!i||t===i)||(l.element.removeEventListener(e,t,!1),!1)})},i.prototype.unbindAll=function(){for(var t in this.handlers)this.unbind(t)},c.isEmpty.get=function(){var e=this;return Object.keys(this.handlers).every(function(t){return 0===e.handlers[t].length})},Object.defineProperties(i.prototype,c);function g(){this.eventElements=[]}g.prototype.eventElement=function(e){var t=this.eventElements.filter(function(t){return t.element===e})[0];return t||(t=new i(e),this.eventElements.push(t)),t},g.prototype.bind=function(t,e,i){this.eventElement(t).bind(e,i)},g.prototype.unbind=function(t,e,i){var l=this.eventElement(t);l.unbind(e,i),l.isEmpty&&this.eventElements.splice(this.eventElements.indexOf(l),1)},g.prototype.unbindAll=function(){this.eventElements.forEach(function(t){return t.unbindAll()}),this.eventElements=[]},g.prototype.once=function(t,e,i){var l=this.eventElement(t),r=function(t){l.unbind(e,r),i(t)};l.bind(e,r)};function h(t,e){var i,l,r=this;if(void 0===e&&(e={}),"string"==typeof t&&(t=document.querySelector(t)),!t||!t.nodeName)throw new Error("no element is specified to initialize PerfectScrollbar");for(var n in(this.element=t).classList.add(W.main),this.settings={handlers:["click-rail","drag-thumb","keyboard","wheel","touch"],maxScrollbarLength:null,minScrollbarLength:null,scrollingThreshold:1e3,scrollXMarginOffset:0,scrollYMarginOffset:0,suppressScrollX:!1,suppressScrollY:!1,swipeEasing:!0,useBothWheelAxes:!1,wheelPropagation:!0,wheelSpeed:1},e)this.settings[n]=e[n];function o(){return t.classList.add(W.state.focus)}function s(){return t.classList.remove(W.state.focus)}this.containerWidth=null,this.containerHeight=null,this.contentWidth=null,this.contentHeight=null,this.isRtl="rtl"===Y(t).direction,!0===this.isRtl&&t.classList.add(W.rtl),this.isNegativeScroll=(l=t.scrollLeft,t.scrollLeft=-1,i=t.scrollLeft<0,t.scrollLeft=l,i),this.negativeScrollAdjustment=this.isNegativeScroll?t.scrollWidth-t.clientWidth:0,this.event=new g,this.ownerDocument=t.ownerDocument||document,this.scrollbarXRail=p(W.element.rail("x")),t.appendChild(this.scrollbarXRail),this.scrollbarX=p(W.element.thumb("x")),this.scrollbarXRail.appendChild(this.scrollbarX),this.scrollbarX.setAttribute("tabindex",0),this.event.bind(this.scrollbarX,"focus",o),this.event.bind(this.scrollbarX,"blur",s),this.scrollbarXActive=null,this.scrollbarXWidth=null,this.scrollbarXLeft=null;var a=Y(this.scrollbarXRail);this.scrollbarXBottom=parseInt(a.bottom,10),isNaN(this.scrollbarXBottom)?(this.isScrollbarXUsingBottom=!1,this.scrollbarXTop=b(a.top)):this.isScrollbarXUsingBottom=!0,this.railBorderXWidth=b(a.borderLeftWidth)+b(a.borderRightWidth),d(this.scrollbarXRail,{display:"block"}),this.railXMarginWidth=b(a.marginLeft)+b(a.marginRight),d(this.scrollbarXRail,{display:""}),this.railXWidth=null,this.railXRatio=null,this.scrollbarYRail=p(W.element.rail("y")),t.appendChild(this.scrollbarYRail),this.scrollbarY=p(W.element.thumb("y")),this.scrollbarYRail.appendChild(this.scrollbarY),this.scrollbarY.setAttribute("tabindex",0),this.event.bind(this.scrollbarY,"focus",o),this.event.bind(this.scrollbarY,"blur",s),this.scrollbarYActive=null,this.scrollbarYHeight=null,this.scrollbarYTop=null;var c,h,u=Y(this.scrollbarYRail);this.scrollbarYRight=parseInt(u.right,10),isNaN(this.scrollbarYRight)?(this.isScrollbarYUsingRight=!1,this.scrollbarYLeft=b(u.left)):this.isScrollbarYUsingRight=!0,this.scrollbarYOuterWidth=this.isRtl?(c=this.scrollbarY,b((h=Y(c)).width)+b(h.paddingLeft)+b(h.paddingRight)+b(h.borderLeftWidth)+b(h.borderRightWidth)):null,this.railBorderYWidth=b(u.borderTopWidth)+b(u.borderBottomWidth),d(this.scrollbarYRail,{display:"block"}),this.railYMarginHeight=b(u.marginTop)+b(u.marginBottom),d(this.scrollbarYRail,{display:""}),this.railYHeight=null,this.railYRatio=null,this.reach={x:t.scrollLeft<=0?"start":t.scrollLeft>=this.contentWidth-this.containerWidth?"end":null,y:t.scrollTop<=0?"start":t.scrollTop>=this.contentHeight-this.containerHeight?"end":null},this.isAlive=!0,this.settings.handlers.forEach(function(t){return R[t](r)}),this.lastScrollTop=m(t.scrollTop),this.lastScrollLeft=t.scrollLeft,this.event.bind(this.element,"scroll",function(t){return r.onScroll(t)}),y(this)}var L={isWebKit:"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style,supportsTouch:"undefined"!=typeof window&&("ontouchstart"in window||"maxTouchPoints"in window.navigator&&0i.scrollbarYTop?1:-1;i.element.scrollTop+=e*i.containerHeight,y(i),t.stopPropagation()}),i.event.bind(i.scrollbarX,"mousedown",function(t){return t.stopPropagation()}),i.event.bind(i.scrollbarXRail,"mousedown",function(t){var e=t.pageX-window.pageXOffset-i.scrollbarXRail.getBoundingClientRect().left>i.scrollbarXLeft?1:-1;i.element.scrollLeft+=e*i.containerWidth,y(i),t.stopPropagation()})},"drag-thumb":function(t){e(t,["containerWidth","contentWidth","pageX","railXWidth","scrollbarX","scrollbarXWidth","scrollLeft","x","scrollbarXRail"]),e(t,["containerHeight","contentHeight","pageY","railYHeight","scrollbarY","scrollbarYHeight","scrollTop","y","scrollbarYRail"])},keyboard:function(n){var o=n.element;n.event.bind(n.ownerDocument,"keydown",function(t){if(!(t.isDefaultPrevented&&t.isDefaultPrevented()||t.defaultPrevented)&&(s(o,":hover")||s(n.scrollbarX,":focus")||s(n.scrollbarY,":focus"))){var e=document.activeElement?document.activeElement:n.ownerDocument.activeElement;if(e){if("IFRAME"===e.tagName)e=e.contentDocument.activeElement;else for(;e.shadowRoot;)e=e.shadowRoot.activeElement;if(s(r=e,"input,[contenteditable]")||s(r,"select,[contenteditable]")||s(r,"textarea,[contenteditable]")||s(r,"button,[contenteditable]"))return}var i=0,l=0;switch(t.which){case 37:i=t.metaKey?-n.contentWidth:t.altKey?-n.containerWidth:-30;break;case 38:l=t.metaKey?n.contentHeight:t.altKey?n.containerHeight:30;break;case 39:i=t.metaKey?n.contentWidth:t.altKey?n.containerWidth:30;break;case 40:l=t.metaKey?-n.contentHeight:t.altKey?-n.containerHeight:-30;break;case 32:l=t.shiftKey?n.containerHeight:-n.containerHeight;break;case 33:l=n.containerHeight;break;case 34:l=-n.containerHeight;break;case 36:l=n.contentHeight;break;case 35:l=-n.contentHeight;break;default:return}n.settings.suppressScrollX&&0!==i||n.settings.suppressScrollY&&0!==l||(o.scrollTop-=l,o.scrollLeft+=i,y(n),function(t,e){var i=m(o.scrollTop);if(0===t){if(!n.scrollbarYActive)return;if(0===i&&0=n.contentHeight-n.containerHeight&&e<0)return!n.settings.wheelPropagation}var l=o.scrollLeft;if(0===e){if(!n.scrollbarXActive)return;if(0===l&&t<0||l>=n.contentWidth-n.containerWidth&&0v(n)?a||c:h||u)||!b.settings.wheelPropagation))&&!t.ctrlKey&&(t.stopPropagation(),t.preventDefault()))}var g=b.element;void 0===window.onwheel?void 0!==window.onmousewheel&&b.event.bind(g,"mousewheel",t):b.event.bind(g,"wheel",t)},touch:function(s){function a(t,e){u.scrollTop-=e,u.scrollLeft-=t,y(s)}function c(t){return t.targetTouches?t.targetTouches[0]:t}function h(t){return(!t.pointerType||"pen"!==t.pointerType||0!==t.buttons)&&(t.targetTouches&&1===t.targetTouches.length||t.pointerType&&"mouse"!==t.pointerType&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE)}function t(t){var e;h(t)&&(e=c(t),d.pageX=e.pageX,d.pageY=e.pageY,p=(new Date).getTime(),null!==l&&clearInterval(l))}function e(t){if(h(t)){var e=c(t),i={pageX:e.pageX,pageY:e.pageY},l=i.pageX-d.pageX,r=i.pageY-d.pageY;if(function(t,e,i){if(u.contains(t))for(var l=t;l&&l!==u;){if(l.classList.contains(W.element.consuming))return 1;var r=Y(l);if(i&&r.overflowY.match(/(scroll|auto)/)){var n=l.scrollHeight-l.clientHeight;if(0