").addClass("scroll-wrapper").addClass(r.attr("class")).css("position","absolute"===r.css("position")?"absolute":"relative").insertBefore(r).append(r),s.isRtl&&c.addClass("scroll--rtl"),r.is("textarea")&&(this.containerWrapper=i=e("
").insertBefore(r).append(r),c.addClass("scroll-textarea")),(u={height:"auto","margin-bottom":-1*n.scroll.height+"px","max-height":""})[s.isRtl?"margin-left":"margin-right"]=-1*n.scroll.width+"px",i.addClass("scroll-content").css(u),r.on("scroll"+o,(function(t){var i=r.scrollLeft(),o=r.scrollTop();if(s.isRtl)switch(!0){case n.firefox:i=Math.abs(i);case n.msedge||n.msie:i=r[0].scrollWidth-r[0].clientWidth-i}e.isFunction(s.onScroll)&&s.onScroll.call(a,{maxScroll:l.y.maxScrollOffset,scroll:o,size:l.y.size,visible:l.y.visible},{maxScroll:l.x.maxScrollOffset,scroll:i,size:l.x.size,visible:l.x.visible}),l.x.isVisible&&l.x.scroll.bar.css("left",i*l.x.kx+"px"),l.y.isVisible&&l.y.scroll.bar.css("top",o*l.y.kx+"px")})),c.on("scroll"+o,(function(){c.scrollTop(0).scrollLeft(0)})),s.disableBodyScroll){var f=function(e){h(e)?l.y.isVisible&&l.y.mousewheel(e):l.x.isVisible&&l.x.mousewheel(e)};c.on("MozMousePixelScroll"+o,f),c.on("mousewheel"+o,f),n.mobile&&c.on("touchstart"+o,(function(t){var n=t.originalEvent.touches&&t.originalEvent.touches[0]||t,a={pageX:n.pageX,pageY:n.pageY},i={left:r.scrollLeft(),top:r.scrollTop()};e(document).on("touchmove"+o,(function(e){var t=e.originalEvent.targetTouches&&e.originalEvent.targetTouches[0]||e;r.scrollLeft(i.left+a.pageX-t.pageX),r.scrollTop(i.top+a.pageY-t.pageY),e.preventDefault()})),e(document).on("touchend"+o,(function(){e(document).off(o)}))}))}e.isFunction(s.onInit)&&s.onInit.apply(this,[r])}e.each(l,(function(t,i){var c=null,u=1,d="x"===t?"scrollLeft":"scrollTop",f=s.scrollStep,p=function(){var e=r[d]();r[d](e+f),1==u&&e+f>=m&&(e=r[d]()),-1==u&&e+f<=m&&(e=r[d]()),r[d]()==e&&c&&c()},m=0;i.scroll||(i.scroll=a._getScroll(s["scroll"+t]).addClass("scroll-"+t),s.showArrows&&i.scroll.addClass("scroll-element_arrows_visible"),i.mousewheel=function(e){if(!i.isVisible||"x"===t&&h(e))return!0;if("y"===t&&!h(e))return l.x.mousewheel(e),!0;var n=-1*e.originalEvent.wheelDelta||e.originalEvent.detail,o=i.size-i.visible-i.offset;return n||("x"===t&&e.originalEvent.deltaX?n=40*e.originalEvent.deltaX:"y"===t&&e.originalEvent.deltaY&&(n=40*e.originalEvent.deltaY)),(n>0&&m
0)&&((m+=n)<0&&(m=0),m>o&&(m=o),a.scrollTo=a.scrollTo||{},a.scrollTo[d]=m,setTimeout((function(){a.scrollTo&&(r.stop().animate(a.scrollTo,240,"linear",(function(){m=r[d]()})),a.scrollTo=null)}),1)),e.preventDefault(),!1},i.scroll.on("MozMousePixelScroll"+o,i.mousewheel).on("mousewheel"+o,i.mousewheel).on("mouseenter"+o,(function(){m=r[d]()})),i.scroll.find(".scroll-arrow, .scroll-element_track").on("mousedown"+o,(function(o){if(1!=o.which)return!0;u=1;var l={eventOffset:o["x"===t?"pageX":"pageY"],maxScrollValue:i.size-i.visible-i.offset,scrollbarOffset:i.scroll.bar.offset()["x"===t?"left":"top"],scrollbarSize:i.scroll.bar["x"===t?"outerWidth":"outerHeight"]()},h=0,v=0;if(e(this).hasClass("scroll-arrow")){if(u=e(this).hasClass("scroll-arrow_more")?1:-1,f=s.scrollStep*u,m=u>0?l.maxScrollValue:0,s.isRtl)switch(!0){case n.firefox:m=u>0?0:-1*l.maxScrollValue;case n.msie||n.msedge:}}else u=l.eventOffset>l.scrollbarOffset+l.scrollbarSize?1:l.eventOffset','','','','",""].join("")};return n[t]&&(t=n[t]),t||(t=n.simple),t="string"==typeof t?e(t).appendTo(this.wrapper):e(t),e.extend(t,{bar:t.find(".scroll-bar"),size:t.find(".scroll-element_size"),track:t.find(".scroll-element_track")}),t},_handleMouseDown:function(t,n){var a=this.namespace;return e(document).on("blur"+a,(function(){e(document).add("body").off(a),t&&t()})),e(document).on("dragstart"+a,(function(e){return e.preventDefault(),!1})),e(document).on("mouseup"+a,(function(){e(document).add("body").off(a),t&&t()})),e("body").on("selectstart"+a,(function(e){return e.preventDefault(),!1})),n&&n.preventDefault(),!1},_updateScroll:function(t,a){var r=this.container,i=this.containerWrapper||r,o="scroll-scroll"+t+"_visible",s="x"===t?this.scrolly:this.scrollx,l=parseInt(this.container.css("x"===t?"left":"top"),10)||0,c=this.wrapper,u=a.size,d=a.visible+l;a.isVisible=u-d>1,a.isVisible?(a.scroll.addClass(o),s.scroll.addClass(o),i.addClass(o)):(a.scroll.removeClass(o),s.scroll.removeClass(o),i.removeClass(o)),"y"===t&&(r.is("textarea")||u