").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=o=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",o.addClass("scroll-content").css(u),r.on("scroll"+i,(function(t){var o=r.scrollLeft(),i=r.scrollTop();if(s.isRtl)switch(!0){case n.firefox:o=Math.abs(o);case n.msedge||n.msie:o=r[0].scrollWidth-r[0].clientWidth-o}e.isFunction(s.onScroll)&&s.onScroll.call(a,{maxScroll:l.y.maxScrollOffset,scroll:i,size:l.y.size,visible:l.y.visible},{maxScroll:l.x.maxScrollOffset,scroll:o,size:l.x.size,visible:l.x.visible}),l.x.isVisible&&l.x.scroll.bar.css("left",o*l.x.kx+"px"),l.y.isVisible&&l.y.scroll.bar.css("top",i*l.y.kx+"px")})),c.on("scroll"+i,(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"+i,f),c.on("mousewheel"+i,f),n.mobile&&c.on("touchstart"+i,(function(t){var n=t.originalEvent.touches&&t.originalEvent.touches[0]||t,a={pageX:n.pageX,pageY:n.pageY},o={left:r.scrollLeft(),top:r.scrollTop()};e(document).on("touchmove"+i,(function(e){var t=e.originalEvent.targetTouches&&e.originalEvent.targetTouches[0]||e;r.scrollLeft(o.left+a.pageX-t.pageX),r.scrollTop(o.top+a.pageY-t.pageY),e.preventDefault()})),e(document).on("touchend"+i,(function(){e(document).off(i)}))}))}e.isFunction(s.onInit)&&s.onInit.apply(this,[r])}e.each(l,(function(t,o){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;o.scroll||(o.scroll=a._getScroll(s["scroll"+t]).addClass("scroll-"+t),s.showArrows&&o.scroll.addClass("scroll-element_arrows_visible"),o.mousewheel=function(e){if(!o.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,i=o.size-o.visible-o.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>i&&(m=i),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},o.scroll.on("MozMousePixelScroll"+i,o.mousewheel).on("mousewheel"+i,o.mousewheel).on("mouseenter"+i,(function(){m=r[d]()})),o.scroll.find(".scroll-arrow, .scroll-element_track").on("mousedown"+i,(function(i){if(1!=i.which)return!0;u=1;var l={eventOffset:i["x"===t?"pageX":"pageY"],maxScrollValue:o.size-o.visible-o.offset,scrollbarOffset:o.scroll.bar.offset()["x"===t?"left":"top"],scrollbarSize:o.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,o=this.containerWrapper||r,i="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(i),s.scroll.addClass(i),o.addClass(i)):(a.scroll.removeClass(i),s.scroll.removeClass(i),o.removeClass(i)),"y"===t&&(r.is("textarea")||u