(function(n){typeof define=="function"&&define.amd?define(["jquery"],n):typeof module!="undefined"&&module.exports?module.exports=n:n(jQuery,window,document)})(function(n){(function(t){var i=typeof define=="function"&&define.amd,r=typeof module!="undefined"&&module.exports,u="https:"==document.location.protocol?"https:":"http:";i||(r?require("jquery-mousewheel")(n):n.event.special.mousewheel||n("head").append(decodeURI("%3Cscript src="+u+"//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js%3E%3C/script%3E")));t()})(function(){var h="mCustomScrollbar",t="mCS",it=".mCustomScrollbar",ot={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,documentTouchScroll:!0,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:"auto",autoUpdateTimeout:60},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},pt=0,b={},p=window.attachEvent&&!window.addEventListener?1:0,e=!1,c,i=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],s={init:function(r){var r=n.extend(!0,{},ot,r),e=v.call(this),u,f;if(r.live){if(u=r.liveSelector||this.selector||it,f=n(u),r.live==="off"){k(u);return}b[u]=setTimeout(function(){f.mCustomScrollbar(r);r.live==="once"&&f.length&&k(u)},500)}else k(u);return r.setWidth=r.set_width?r.set_width:r.setWidth,r.setHeight=r.set_height?r.set_height:r.setHeight,r.axis=r.horizontalScroll?"x":wt(r.axis),r.scrollInertia=r.scrollInertia>0&&r.scrollInertia<17?17:r.scrollInertia,typeof r.mouseWheel!="object"&&r.mouseWheel==!0&&(r.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),r.mouseWheel.scrollAmount=r.mouseWheelPixels?r.mouseWheelPixels:r.mouseWheel.scrollAmount,r.mouseWheel.normalizeDelta=r.advanced.normalizeMouseWheelDelta?r.advanced.normalizeMouseWheelDelta:r.mouseWheel.normalizeDelta,r.scrollButtons.scrollType=bt(r.scrollButtons.scrollType),st(r),n(e).each(function(){var u=n(this);if(!u.data(t)){u.data(t,{idx:++pt,opt:r,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:u.css("direction"),cbOffsets:null,trigger:null,poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}});var e=u.data(t),f=e.opt,o=u.data("mcs-axis"),h=u.data("mcs-scrollbar-position"),c=u.data("mcs-theme");o&&(f.axis=o);h&&(f.scrollbarPosition=h);c&&(f.theme=c,st(f));kt.call(this);e&&f.callbacks.onCreate&&typeof f.callbacks.onCreate=="function"&&f.callbacks.onCreate.call(this);n("#mCSB_"+e.idx+"_container img:not(."+i[2]+")").addClass(i[2]);s.update.call(null,u)}})},update:function(r,f){var e=r||v.call(this);return n(e).each(function(){var s=n(this),c;if(s.data(t)){var e=s.data(t),r=e.opt,h=n("#mCSB_"+e.idx+"_container"),a=n("#mCSB_"+e.idx),l=[n("#mCSB_"+e.idx+"_dragger_vertical"),n("#mCSB_"+e.idx+"_dragger_horizontal")];if(!h.length)return;e.tweenRunning&&o(s);f&&e&&r.callbacks.onBeforeUpdate&&typeof r.callbacks.onBeforeUpdate=="function"&&r.callbacks.onBeforeUpdate.call(this);s.hasClass(i[3])&&s.removeClass(i[3]);s.hasClass(i[4])&&s.removeClass(i[4]);a.css("max-height","none");a.height()!==s.height()&&a.css("max-height",s.height());dt.call(this);r.axis==="y"||r.advanced.autoExpandHorizontalScroll||h.css("width",ht(h));e.overflowed=ii.call(this);ct.call(this);r.autoDraggerLength&&ni.call(this);ti.call(this);ri.call(this);c=[Math.abs(h[0].offsetTop),Math.abs(h[0].offsetLeft)];r.axis!=="x"&&(e.overflowed[0]?l[0].height()>l[0].parent().height()?y.call(this):(u(s,c[0].toString(),{dir:"y",dur:0,overwrite:"none"}),e.contentReset.y=null):(y.call(this),r.axis==="y"?g.call(this):r.axis==="yx"&&e.overflowed[1]&&u(s,c[1].toString(),{dir:"x",dur:0,overwrite:"none"})));r.axis!=="y"&&(e.overflowed[1]?l[1].width()>l[1].parent().width()?y.call(this):(u(s,c[1].toString(),{dir:"x",dur:0,overwrite:"none"}),e.contentReset.x=null):(y.call(this),r.axis==="x"?g.call(this):r.axis==="yx"&&e.overflowed[0]&&u(s,c[0].toString(),{dir:"y",dur:0,overwrite:"none"})));f&&e&&(f===2&&r.callbacks.onImageLoad&&typeof r.callbacks.onImageLoad=="function"?r.callbacks.onImageLoad.call(this):f===3&&r.callbacks.onSelectorChange&&typeof r.callbacks.onSelectorChange=="function"?r.callbacks.onSelectorChange.call(this):r.callbacks.onUpdate&&typeof r.callbacks.onUpdate=="function"&&r.callbacks.onUpdate.call(this));et.call(this)}})},scrollTo:function(i,r){if(typeof i!="undefined"&&i!=null){var f=v.call(this);return n(f).each(function(){var s=n(this);if(s.data(t)){var o=s.data(t),h=o.opt,c={trigger:"external",scrollInertia:h.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},f=n.extend(!0,{},c,r),e=ft.call(this,i),l=f.scrollInertia>0&&f.scrollInertia<17?17:f.scrollInertia;e[0]=at.call(this,e[0],"y");e[1]=at.call(this,e[1],"x");f.moveDragger&&(e[0]*=o.scrollRatio.y,e[1]*=o.scrollRatio.x);f.dur=wi()?0:l;setTimeout(function(){e[0]!==null&&typeof e[0]!="undefined"&&h.axis!=="x"&&o.overflowed[0]&&(f.dir="y",f.overwrite="all",u(s,e[0].toString(),f));e[1]!==null&&typeof e[1]!="undefined"&&h.axis!=="y"&&o.overflowed[1]&&(f.dir="x",f.overwrite="none",u(s,e[1].toString(),f))},f.timeout)}})}},stop:function(){var i=v.call(this);return n(i).each(function(){var i=n(this);i.data(t)&&o(i)})},disable:function(r){var u=v.call(this);return n(u).each(function(){var u=n(this),f;u.data(t)&&(f=u.data(t),et.call(this,"remove"),g.call(this),r&&y.call(this),ct.call(this,!0),u.addClass(i[3]))})},destroy:function(){var r=v.call(this);return n(r).each(function(){var f=n(this);if(f.data(t)){var u=f.data(t),e=u.opt,s=n("#mCSB_"+u.idx),o=n("#mCSB_"+u.idx+"_container"),c=n(".mCSB_"+u.idx+"_scrollbar");e.live&&k(e.liveSelector||n(r).selector);et.call(this,"remove");g.call(this);y.call(this);f.removeData(t);a(this,"mcs");c.remove();o.find("img."+i[2]).removeClass(i[2]);s.replaceWith(o.contents());f.removeClass(h+" _"+t+"_"+u.idx+" "+i[6]+" "+i[7]+" "+i[5]+" "+i[3]).addClass(i[4])}})}},v=function(){return typeof n(this)!="object"||n(this).length<1?it:this},st=function(t){t.autoDraggerLength=n.inArray(t.theme,["rounded","rounded-dark","rounded-dots","rounded-dots-dark"])>-1?!1:t.autoDraggerLength;t.autoExpandScrollbar=n.inArray(t.theme,["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"])>-1?!1:t.autoExpandScrollbar;t.scrollButtons.enable=n.inArray(t.theme,["minimal","minimal-dark"])>-1?!1:t.scrollButtons.enable;t.autoHideScrollbar=n.inArray(t.theme,["minimal","minimal-dark"])>-1?!0:t.autoHideScrollbar;t.scrollbarPosition=n.inArray(t.theme,["minimal","minimal-dark"])>-1?"outside":t.scrollbarPosition},k=function(n){b[n]&&(clearTimeout(b[n]),a(b,n))},wt=function(n){return n==="yx"||n==="xy"||n==="auto"?"yx":n==="x"||n==="horizontal"?"x":"y"},bt=function(n){return n==="stepped"||n==="pixels"||n==="step"||n==="click"?"stepped":"stepless"},kt=function(){var f=n(this),u=f.data(t),r=u.opt,l=r.autoExpandScrollbar?" "+i[1]+"_expand":"",o=["<div id='mCSB_"+u.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+u.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_vertical"+l+"'><div class='"+i[12]+"'><div id='mCSB_"+u.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /><\/div><div class='mCSB_draggerRail' /><\/div><\/div>","<div id='mCSB_"+u.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+u.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_horizontal"+l+"'><div class='"+i[12]+"'><div id='mCSB_"+u.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /><\/div><div class='mCSB_draggerRail' /><\/div><\/div>"],v=r.axis==="yx"?"mCSB_vertical_horizontal":r.axis==="x"?"mCSB_horizontal":"mCSB_vertical",a=r.axis==="yx"?o[0]+o[1]:r.axis==="x"?o[1]:o[0],y=r.axis==="yx"?"<div id='mCSB_"+u.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",p=r.autoHideScrollbar?" "+i[6]:"",w=r.axis!=="x"&&u.langDir==="rtl"?" "+i[7]:"",c,s,e;r.setWidth&&f.css("width",r.setWidth);r.setHeight&&f.css("height",r.setHeight);r.setLeft=r.axis!=="y"&&u.langDir==="rtl"?"989999px":r.setLeft;f.addClass(h+" _"+t+"_"+u.idx+p+w).wrapInner("<div id='mCSB_"+u.idx+"' class='mCustomScrollBox mCS-"+r.theme+" "+v+"'><div id='mCSB_"+u.idx+"_container' class='mCSB_container' style='position:relative; top:"+r.setTop+"; left:"+r.setLeft+";' dir='"+u.langDir+"' /><\/div>");c=n("#mCSB_"+u.idx);s=n("#mCSB_"+u.idx+"_container");r.axis==="y"||r.advanced.autoExpandHorizontalScroll||s.css("width",ht(s));r.scrollbarPosition==="outside"?(f.css("position")==="static"&&f.css("position","relative"),f.css("overflow","visible"),c.addClass("mCSB_outside").after(a)):(c.addClass("mCSB_inside").append(a),s.wrap(y));gt.call(this);e=[n("#mCSB_"+u.idx+"_dragger_vertical"),n("#mCSB_"+u.idx+"_dragger_horizontal")];e[0].css("min-height",e[0].height());e[1].css("min-width",e[1].width())},ht=function(t){var i=[t[0].scrollWidth,Math.max.apply(Math,t.children().map(function(){return n(this).outerWidth(!0)}).get())],r=t.parent().width();return i[0]>r?i[0]:i[1]>r?i[1]:"100%"},dt=function(){var e=n(this),f=e.data(t),r=f.opt,i=n("#mCSB_"+f.idx+"_container"),u;r.advanced.autoExpandHorizontalScroll&&r.axis!=="y"&&(i.css({width:"auto","min-width":0,"overflow-x":"scroll"}),u=Math.ceil(i[0].scrollWidth),r.advanced.autoExpandHorizontalScroll===3||r.advanced.autoExpandHorizontalScroll!==2&&u>i.parent().width()?i.css({width:u,"min-width":"100%","overflow-x":"inherit"}):i.css({"overflow-x":"inherit",position:"absolute"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(i[0].getBoundingClientRect().right+.4)-Math.floor(i[0].getBoundingClientRect().left),"min-width":"100%",position:"relative"}).unwrap())},gt=function(){var s=n(this),o=s.data(t),u=o.opt,h=n(".mCSB_"+o.idx+"_scrollbar:first"),f=tt(u.scrollButtons.tabindex)?"tabindex='"+u.scrollButtons.tabindex+"'":"",r=["<a href='#' class='"+i[13]+"' "+f+" />","<a href='#' class='"+i[14]+"' "+f+" />","<a href='#' class='"+i[15]+"' "+f+" />","<a href='#' class='"+i[16]+"' "+f+" />"],e=[u.axis==="x"?r[2]:r[0],u.axis==="x"?r[3]:r[1],r[2],r[3]];u.scrollButtons.enable&&h.prepend(e[0]).append(e[1]).next(".mCSB_scrollTools").prepend(e[2]).append(e[3])},ni=function(){var s=n(this),u=s.data(t),f=n("#mCSB_"+u.idx),e=n("#mCSB_"+u.idx+"_container"),r=[n("#mCSB_"+u.idx+"_dragger_vertical"),n("#mCSB_"+u.idx+"_dragger_horizontal")],o=[f.height()/e.outerHeight(!1),f.width()/e.outerWidth(!1)],i=[parseInt(r[0].css("min-height")),Math.round(o[0]*r[0].parent().height()),parseInt(r[1].css("min-width")),Math.round(o[1]*r[1].parent().width())],h=p&&i[1]<i[0]?i[0]:i[1],c=p&&i[3]<i[2]?i[2]:i[3];r[0].css({height:h,"max-height":r[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":i[0]+"px"});r[1].css({width:c,"max-width":r[1].parent().width()-10})},ti=function(){var s=n(this),i=s.data(t),u=n("#mCSB_"+i.idx),f=n("#mCSB_"+i.idx+"_container"),r=[n("#mCSB_"+i.idx+"_dragger_vertical"),n("#mCSB_"+i.idx+"_dragger_horizontal")],e=[f.outerHeight(!1)-u.height(),f.outerWidth(!1)-u.width()],o=[e[0]/(r[0].parent().height()-r[0].height()),e[1]/(r[1].parent().width()-r[1].width())];i.scrollRatio={y:o[0],x:o[1]}},d=function(n,t,r){var f=r?i[0]+"_expanded":"",u=n.closest(".mCSB_scrollTools");t==="active"?(n.toggleClass(i[0]+" "+f),u.toggleClass(i[1]),n[0]._draggable=n[0]._draggable?0:1):n[0]._draggable||(t==="hide"?(n.removeClass(i[0]),u.removeClass(i[1])):(n.addClass(i[0]),u.addClass(i[1])))},ii=function(){var h=n(this),r=h.data(t),e=n("#mCSB_"+r.idx),i=n("#mCSB_"+r.idx+"_container"),u=r.overflowed==null?i.height():i.outerHeight(!1),f=r.overflowed==null?i.width():i.outerWidth(!1),o=i[0].scrollHeight,s=i[0].scrollWidth;return o>u&&(u=o),s>f&&(f=s),[u>e.height(),f>e.width()]},y=function(){var r=n(this),i=r.data(t),f=i.opt,c=n("#mCSB_"+i.idx),s=n("#mCSB_"+i.idx+"_container"),h=[n("#mCSB_"+i.idx+"_dragger_vertical"),n("#mCSB_"+i.idx+"_dragger_horizontal")],e;o(r);(f.axis!=="x"&&!i.overflowed[0]||f.axis==="y"&&i.overflowed[0])&&(h[0].add(s).css("top",0),u(r,"_resetY"));(f.axis!=="y"&&!i.overflowed[1]||f.axis==="x"&&i.overflowed[1])&&(e=dx=0,i.langDir==="rtl"&&(e=c.width()-s.outerWidth(!1),dx=Math.abs(e/i.scrollRatio.x)),s.css("left",e),h[1].css("left",dx),u(r,"_resetX"))},ri=function(){var u=n(this),r=u.data(t),i=r.opt,e;if(!r.bindEvents){if(ui.call(this),i.contentTouchScroll&&fi.call(this),ei.call(this),i.mouseWheel.enable){function f(){e=setTimeout(function(){n.event.special.mousewheel?(clearTimeout(e),oi.call(u[0])):f()},100)}f()}hi.call(this);li.call(this);i.advanced.autoScrollOnFocus&&ci.call(this);i.scrollButtons.enable&&ai.call(this);i.keyboard.enable&&vi.call(this);r.bindEvents=!0}},g=function(){var f=n(this),r=f.data(t),u=r.opt,o=t+"_"+r.idx,s=".mCSB_"+r.idx+"_scrollbar",e=n("#mCSB_"+r.idx+",#mCSB_"+r.idx+"_container,#mCSB_"+r.idx+"_container_wrapper,"+s+" ."+i[12]+",#mCSB_"+r.idx+"_dragger_vertical,#mCSB_"+r.idx+"_dragger_horizontal,"+s+">a"),h=n("#mCSB_"+r.idx+"_container");u.advanced.releaseDraggableSelectors&&e.add(n(u.advanced.releaseDraggableSelectors));u.advanced.extraDraggableSelectors&&e.add(n(u.advanced.extraDraggableSelectors));r.bindEvents&&(n(document).add(n(!l()||top.document)).unbind("."+o),e.each(function(){n(this).unbind("."+o)}),clearTimeout(f[0]._focusTimeout),a(f[0],"_focusTimeout"),clearTimeout(r.sequential.step),a(r.sequential,"step"),clearTimeout(h[0].onCompleteTimeout),a(h[0],"onCompleteTimeout"),r.bindEvents=!1)},ct=function(r){var h=n(this),u=h.data(t),o=u.opt,c=n("#mCSB_"+u.idx+"_container_wrapper"),f=c.length?c:n("#mCSB_"+u.idx+"_container"),e=[n("#mCSB_"+u.idx+"_scrollbar_vertical"),n("#mCSB_"+u.idx+"_scrollbar_horizontal")],s=[e[0].find(".mCSB_dragger"),e[1].find(".mCSB_dragger")];o.axis!=="x"&&(u.overflowed[0]&&!r?(e[0].add(s[0]).add(e[0].children("a")).css("display","block"),f.removeClass(i[8]+" "+i[10])):(o.alwaysShowScrollbar?(o.alwaysShowScrollbar!==2&&s[0].css("display","none"),f.removeClass(i[10])):(e[0].css("display","none"),f.addClass(i[10])),f.addClass(i[8])));o.axis!=="y"&&(u.overflowed[1]&&!r?(e[1].add(s[1]).add(e[1].children("a")).css("display","block"),f.removeClass(i[9]+" "+i[11])):(o.alwaysShowScrollbar?(o.alwaysShowScrollbar!==2&&s[1].css("display","none"),f.removeClass(i[11])):(e[1].css("display","none"),f.addClass(i[11])),f.addClass(i[9])));u.overflowed[0]||u.overflowed[1]?h.removeClass(i[5]):h.addClass(i[5])},r=function(t){var e=t.type,i=t.target.ownerDocument!==document&&frameElement!==null?[n(frameElement).offset().top,n(frameElement).offset().left]:null,u=l()&&t.target.ownerDocument!==top.document&&frameElement!==null?[n(t.view.frameElement).offset().top,n(t.view.frameElement).offset().left]:[0,0],r,f;switch(e){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return i?[t.originalEvent.pageY-i[0]+u[0],t.originalEvent.pageX-i[1]+u[1],!1]:[t.originalEvent.pageY,t.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":return r=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0],f=t.originalEvent.touches.length||t.originalEvent.changedTouches.length,t.target.ownerDocument!==document?[r.screenY,r.screenX,f>1]:[r.pageY,r.pageX,f>1];default:return i?[t.pageY-i[0]+u[0],t.pageX-i[1]+u[1],!1]:[t.pageY,t.pageX,!1]}},ui=function(){function k(n,t,r,f){var e,o;w[0].idleTimer=h.scrollInertia<233?250:0;i.attr("id")===y[1]?(e="x",o=(i[0].offsetLeft-t+f)*s.scrollRatio.x):(e="y",o=(i[0].offsetTop-n+r)*s.scrollRatio.y);u(v,o.toString(),{dir:e,drag:!0})}var v=n(this),s=v.data(t),h=s.opt,f=t+"_"+s.idx,y=["mCSB_"+s.idx+"_dragger_vertical","mCSB_"+s.idx+"_dragger_horizontal"],w=n("#mCSB_"+s.idx+"_container"),b=n("#"+y[0]+",#"+y[1]),i,c,a,g=h.advanced.releaseDraggableSelectors?b.add(n(h.advanced.releaseDraggableSelectors)):b,nt=h.advanced.extraDraggableSelectors?n(!l()||top.document).add(n(h.advanced.extraDraggableSelectors)):n(!l()||top.document);b.bind("contextmenu."+f,function(n){n.preventDefault()}).bind("mousedown."+f+" touchstart."+f+" pointerdown."+f+" MSPointerDown."+f,function(t){if(t.stopImmediatePropagation(),t.preventDefault(),yt(t)){e=!0;p&&(document.onselectstart=function(){return!1});lt.call(w,!1);o(v);i=n(this);var u=i.offset(),f=r(t)[0]-u.top,s=r(t)[1]-u.left,l=i.height()+u.top,y=i.width()+u.left;f<l&&f>0&&s<y&&s>0&&(c=f,a=s);d(i,"active",h.autoExpandScrollbar)}}).bind("touchmove."+f,function(n){n.stopImmediatePropagation();n.preventDefault();var t=i.offset(),u=r(n)[0]-t.top,f=r(n)[1]-t.left;k(c,a,u,f)});n(document).add(nt).bind("mousemove."+f+" pointermove."+f+" MSPointerMove."+f,function(n){if(i){var t=i.offset(),u=r(n)[0]-t.top,f=r(n)[1]-t.left;if(c===u&&a===f)return;k(c,a,u,f)}}).add(g).bind("mouseup."+f+" touchend."+f+" pointerup."+f+" MSPointerUp."+f,function(){i&&(d(i,"active",h.autoExpandScrollbar),i=null);e=!1;p&&(document.onselectstart=null);lt.call(w,!0)})},fi=function(){function dt(n){if(!nt(n)||e||r(n)[2]){c=0;return}c=1;ft=0;et=0;st=1;k.removeClass("mCS_touch_action");var t=b.offset();d=r(n)[0]-t.top;g=r(n)[1]-t.left;v=[r(n)[0],r(n)[1]]}function gt(n){var c,l,a,y;if(nt(n)&&!e&&!r(n)[2]&&(f.documentTouchScroll||n.preventDefault(),n.stopImmediatePropagation(),!et||ft)&&st){pt=w();var o=tt.offset(),t=r(n)[0]-o.top,u=r(n)[1]-o.left,h="mcsLinearOut";rt.push(t);ut.push(u);v[2]=Math.abs(r(n)[0]-v[0]);v[3]=Math.abs(r(n)[1]-v[1]);i.overflowed[0]&&(c=it[0].parent().height()-it[0].height(),l=d-t>0&&t-d>-(c*i.scrollRatio.y)&&(v[3]*2<v[2]||f.axis==="yx"));i.overflowed[1]&&(a=it[1].parent().width()-it[1].width(),y=g-u>0&&u-g>-(a*i.scrollRatio.x)&&(v[2]*2<v[3]||f.axis==="yx"));l||y?(kt||n.preventDefault(),ft=1):(et=1,k.addClass("mCS_touch_action"));kt&&n.preventDefault();s=f.axis==="yx"?[d-t,g-u]:f.axis==="x"?[null,g-u]:[d-t,null];b[0].idleTimer=250;i.overflowed[0]&&ot(s[0],wt,h,"y","all",!0);i.overflowed[1]&&ot(s[1],wt,h,"x",lt,!0)}}function ni(n){if(!nt(n)||e||r(n)[2]){c=0;return}c=1;n.stopImmediatePropagation();o(k);yt=w();var t=tt.offset();at=r(n)[0]-t.top;vt=r(n)[1]-t.left;rt=[];ut=[]}function ti(n){var t,u,h;if(nt(n)&&!e&&!r(n)[2]){st=0;n.stopImmediatePropagation();ft=0;et=0;ht=w();var c=tt.offset(),l=r(n)[0]-c.top,v=r(n)[1]-c.left;if(!(ht-pt>30)){a=1e3/(ht-yt);var p="mcsEaseOut",o=a<2.5,k=o?[rt[rt.length-2],ut[ut.length-2]]:[0,0];y=o?[l-k[0],v-k[1]]:[l-at,v-vt];t=[Math.abs(y[0]),Math.abs(y[1])];a=o?[Math.abs(y[0]/4),Math.abs(y[1]/4)]:[a,a];u=[Math.abs(b[0].offsetTop)-y[0]*ii(t[0]/a[0],a[0]),Math.abs(b[0].offsetLeft)-y[1]*ii(t[1]/a[1],a[1])];s=f.axis==="yx"?[u[0],u[1]]:f.axis==="x"?[null,u[1]]:[u[0],null];ct=[t[0]*4+f.scrollInertia,t[1]*4+f.scrollInertia];h=parseInt(f.contentTouchScroll)||0;s[0]=t[0]>h?s[0]:0;s[1]=t[1]>h?s[1]:0;i.overflowed[0]&&ot(s[0],ct[0],p,"y",lt,!1);i.overflowed[1]&&ot(s[1],ct[1],p,"x",lt,!1)}}}function ii(n,t){var i=[t*1.5,t*2,t/1.5,t/2];return n>90?t>4?i[0]:i[3]:n>60?t>3?i[3]:i[2]:n>30?t>8?i[1]:t>6?i[0]:t>4?t:i[2]:t>8?t:i[3]}function ot(n,t,i,r,f,e){n&&u(k,n.toString(),{dur:t,scrollEasing:i,dir:r,overwrite:f,drag:e})}var k=n(this),i=k.data(t),f=i.opt,h=t+"_"+i.idx,tt=n("#mCSB_"+i.idx),b=n("#mCSB_"+i.idx+"_container"),it=[n("#mCSB_"+i.idx+"_dragger_vertical"),n("#mCSB_"+i.idx+"_dragger_horizontal")],st,d,g,at,vt,rt=[],ut=[],yt,pt,ht,y,a,s,wt=0,ct,lt=f.axis==="yx"?"none":"all",v=[],ft,et,bt=b.find("iframe"),p=["touchstart."+h+" pointerdown."+h+" MSPointerDown."+h,"touchmove."+h+" pointermove."+h+" MSPointerMove."+h,"touchend."+h+" pointerup."+h+" MSPointerUp."+h],kt=document.body.style.touchAction!==undefined&&document.body.style.touchAction!=="";b.bind(p[0],function(n){dt(n)}).bind(p[1],function(n){gt(n)});tt.bind(p[0],function(n){ni(n)}).bind(p[2],function(n){ti(n)});bt.length&&bt.each(function(){n(this).bind("load",function(){l(this)&&n(this.contentDocument||this.contentWindow.document).bind(p[0],function(n){dt(n);ni(n)}).bind(p[1],function(n){gt(n)}).bind(p[2],function(n){ti(n)})})})},ei=function(){function y(){return window.getSelection?window.getSelection().toString():document.selection&&document.selection.type!="Control"?document.selection.createRange().text:0}function f(n,t,i){l.type=i&&u?"stepped":"stepless";l.scrollAmount=10;ut(a,n,t,"mcsLinearOut",i?60:null)}var a=n(this),i=a.data(t),v=i.opt,l=i.sequential,s=t+"_"+i.idx,o=n("#mCSB_"+i.idx+"_container"),h=o.parent(),u;o.bind("mousedown."+s,function(){c||u||(u=1,e=!0)}).add(document).bind("mousemove."+s,function(n){if(!c&&u&&y()){var s=o.offset(),t=r(n)[0]-s.top+o[0].offsetTop,e=r(n)[1]-s.left+o[0].offsetLeft;t>0&&t<h.height()&&e>0&&e<h.width()?l.step&&f("off",null,"stepped"):(v.axis!=="x"&&i.overflowed[0]&&(t<0?f("on",38):t>h.height()&&f("on",40)),v.axis!=="y"&&i.overflowed[1]&&(e<0?f("on",37):e>h.width()&&f("on",39)))}}).bind("mouseup."+s+" dragend."+s,function(){c||(u&&(u=0,f("off",null)),e=!1)})},oi=function(){function a(t,h){var v,y;if(o(s),!si(s,t.target)){if(v=i.mouseWheel.deltaFactor!=="auto"?parseInt(i.mouseWheel.deltaFactor):p&&t.deltaFactor<100?100:t.deltaFactor||100,y=i.scrollInertia,i.axis==="x"||i.mouseWheel.axis==="x")var a="x",l=[Math.round(v*r.scrollRatio.x),parseInt(i.mouseWheel.scrollAmount)],w=i.mouseWheel.scrollAmount!=="auto"?l[1]:l[0]>=e.width()?e.width()*.9:l[0],k=Math.abs(n("#mCSB_"+r.idx+"_container")[0].offsetLeft),b=f[1][0].offsetLeft,d=f[1].parent().width()-f[1].width(),c=i.mouseWheel.axis==="y"?t.deltaY||h:t.deltaX;else var a="y",l=[Math.round(v*r.scrollRatio.y),parseInt(i.mouseWheel.scrollAmount)],w=i.mouseWheel.scrollAmount!=="auto"?l[1]:l[0]>=e.height()?e.height()*.9:l[0],k=Math.abs(n("#mCSB_"+r.idx+"_container")[0].offsetTop),b=f[0][0].offsetTop,d=f[0].parent().height()-f[0].height(),c=t.deltaY||h;(a!=="y"||r.overflowed[0])&&(a!=="x"||r.overflowed[1])&&((i.mouseWheel.invert||t.webkitDirectionInvertedFromDevice)&&(c=-c),i.mouseWheel.normalizeDelta&&(c=c<0?-1:1),(c>0&&b!==0||c<0&&b!==d||i.mouseWheel.preventDefault)&&(t.stopImmediatePropagation(),t.preventDefault()),t.deltaFactor<5&&!i.mouseWheel.normalizeDelta&&(w=t.deltaFactor,y=17),u(s,(k-c*w).toString(),{dir:a,dur:y}))}}if(n(this).data(t)){var s=n(this),r=s.data(t),i=r.opt,h=t+"_"+r.idx,e=n("#mCSB_"+r.idx),f=[n("#mCSB_"+r.idx+"_dragger_vertical"),n("#mCSB_"+r.idx+"_dragger_horizontal")],c=n("#mCSB_"+r.idx+"_container").find("iframe");c.length&&c.each(function(){n(this).bind("load",function(){l(this)&&n(this.contentDocument||this.contentWindow.document).bind("mousewheel."+h,function(n,t){a(n,t)})})});e.bind("mousewheel."+h,function(n,t){a(n,t)})}},rt={},l=function(t){var u=!1,i=!1,f=null,r;if(t===undefined?i="#empty":n(t).attr("id")!==undefined&&(i=n(t).attr("id")),i!==!1&&rt[i]!==undefined)return rt[i];if(t){try{r=t.contentDocument||t.contentWindow.document;f=r.body.innerHTML}catch(e){}u=f!==null}else{try{r=top.document;f=r.body.innerHTML}catch(e){}u=f!==null}return i!==!1&&(rt[i]=u),u},lt=function(n){var t=this.find("iframe"),i;t.length&&(i=n?"auto":"none",t.css("pointer-events",i))},si=function(i,r){var u=r.nodeName.toLowerCase(),f=i.data(t).opt.mouseWheel.disableOver;return n.inArray(u,f)>-1&&!(n.inArray(u,["select","textarea"])>-1&&!n(r).is(":focus"))},hi=function(){var s=n(this),f=s.data(t),r=t+"_"+f.idx,h=n("#mCSB_"+f.idx+"_container"),l=h.parent(),a=n(".mCSB_"+f.idx+"_scrollbar ."+i[12]),c;a.bind("mousedown."+r+" touchstart."+r+" pointerdown."+r+" MSPointerDown."+r,function(t){e=!0;n(t.target).hasClass("mCSB_dragger")||(c=1)}).bind("touchend."+r+" pointerup."+r+" MSPointerUp."+r,function(){e=!1}).bind("click."+r,function(t){var r,e;if(c&&(c=0,n(t.target).hasClass(i[12])||n(t.target).hasClass("mCSB_draggerRail"))){if(o(s),r=n(this),e=r.find(".mCSB_dragger"),r.parent(".mCSB_scrollTools_horizontal").length>0){if(!f.overflowed[1])return;var v="x",a=t.pageX>e.offset().left?-1:1,y=Math.abs(h[0].offsetLeft)-a*l.width()*.9}else{if(!f.overflowed[0])return;var v="y",a=t.pageY>e.offset().top?-1:1,y=Math.abs(h[0].offsetTop)-a*l.height()*.9}u(s,y.toString(),{dir:v,scrollEasing:"mcsEaseInOut"})}})},ci=function(){var i=n(this),s=i.data(t),e=s.opt,c=t+"_"+s.idx,r=n("#mCSB_"+s.idx+"_container"),h=r.parent();r.bind("focusin."+c,function(){var t=n(document.activeElement),c=r.find(".mCustomScrollBox").length,s=0;t.is(e.advanced.autoScrollOnFocus)&&(o(i),clearTimeout(i[0]._focusTimeout),i[0]._focusTimer=c?(s+17)*c:0,i[0]._focusTimeout=setTimeout(function(){var n=[f(t)[0],f(t)[1]],o=[r[0].offsetTop,r[0].offsetLeft],c=[o[0]+n[0]>=0&&o[0]+n[0]<h.height()-t.outerHeight(!1),o[1]+n[1]>=0&&o[0]+n[1]<h.width()-t.outerWidth(!1)],l=e.axis==="yx"&&!c[0]&&!c[1]?"none":"all";e.axis==="x"||c[0]||u(i,n[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:l,dur:s});e.axis==="y"||c[1]||u(i,n[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:l,dur:s})},i[0]._focusTimer))})},li=function(){var u=n(this),i=u.data(t),f=t+"_"+i.idx,r=n("#mCSB_"+i.idx+"_container").parent();r.bind("scroll."+f,function(){(r.scrollTop()!==0||r.scrollLeft()!==0)&&n(".mCSB_"+i.idx+"_scrollbar").css("visibility","hidden")})},ai=function(){var f=n(this),r=f.data(t),o=r.opt,u=r.sequential,i=t+"_"+r.idx,s=".mCSB_"+r.idx+"_scrollbar",h=n(s+">a");h.bind("contextmenu."+i,function(n){n.preventDefault()}).bind("mousedown."+i+" touchstart."+i+" pointerdown."+i+" MSPointerDown."+i+" mouseup."+i+" touchend."+i+" pointerup."+i+" MSPointerUp."+i+" mouseout."+i+" pointerout."+i+" MSPointerOut."+i+" click."+i,function(t){function s(n,t){u.scrollAmount=o.scrollButtons.scrollAmount;ut(f,n,t)}if(t.preventDefault(),yt(t)){var i=n(this).attr("class");u.type=o.scrollButtons.scrollType;switch(t.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if(u.type==="stepped")return;e=!0;r.tweenRunning=!1;s("on",i);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if(u.type==="stepped")return;e=!1;u.dir&&s("off",i);break;case"click":if(u.type!=="stepped"||r.tweenRunning)return;s("on",i)}}})},vi=function(){function p(t){function w(n,t){(s.type=r.keyboard.scrollType,s.scrollAmount=r.keyboard.scrollAmount,s.type==="stepped"&&i.tweenRunning)||ut(e,n,t)}var c,y,p,l,v;switch(t.type){case"blur":i.tweenRunning&&s.dir&&w("off",null);break;case"keydown":case"keyup":if(c=t.keyCode?t.keyCode:t.which,y="on",r.axis!=="x"&&(c===38||c===40)||r.axis!=="y"&&(c===37||c===39)){if((c===38||c===40)&&!i.overflowed[0]||(c===37||c===39)&&!i.overflowed[1])return;t.type==="keyup"&&(y="off");n(document.activeElement).is(a)||(t.preventDefault(),t.stopImmediatePropagation(),w(y,c))}else c===33||c===34?((i.overflowed[0]||i.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),t.type==="keyup"&&(o(e),p=c===34?-1:1,r.axis==="x"||r.axis==="yx"&&i.overflowed[1]&&!i.overflowed[0]?(l="x",v=Math.abs(f[0].offsetLeft)-p*h.width()*.9):(l="y",v=Math.abs(f[0].offsetTop)-p*h.height()*.9),u(e,v.toString(),{dir:l,scrollEasing:"mcsEaseInOut"}))):(c===35||c===36)&&(n(document.activeElement).is(a)||((i.overflowed[0]||i.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),t.type==="keyup"&&(r.axis==="x"||r.axis==="yx"&&i.overflowed[1]&&!i.overflowed[0]?(l="x",v=c===35?Math.abs(h.width()-f.outerWidth(!1)):0):(l="y",v=c===35?Math.abs(h.height()-f.outerHeight(!1)):0),u(e,v.toString(),{dir:l,scrollEasing:"mcsEaseInOut"}))))}}var e=n(this),i=e.data(t),r=i.opt,s=i.sequential,c=t+"_"+i.idx,w=n("#mCSB_"+i.idx),f=n("#mCSB_"+i.idx+"_container"),h=f.parent(),a="input,textarea,select,datalist,keygen,[contenteditable='true']",v=f.find("iframe"),y=["blur."+c+" keydown."+c+" keyup."+c];v.length&&v.each(function(){n(this).bind("load",function(){l(this)&&n(this.contentDocument||this.contentWindow.document).bind(y[0],function(n){p(n)})})});w.attr("tabindex","0").bind(y[0],function(n){p(n)})},ut=function(r,f,e,s,h){function y(n){l.snapAmount&&(c.scrollAmount=(l.snapAmount instanceof Array)?c.dir[0]==="x"?l.snapAmount[1]:l.snapAmount[0]:l.snapAmount);var i=c.type!=="stepped",f=h?h:n?i?b/1.5:k:1e3/60,e=n?i?7.5:40:2.5,t=[Math.abs(p[0].offsetTop),Math.abs(p[0].offsetLeft)],o=[v.scrollRatio.y>10?10:v.scrollRatio.y,v.scrollRatio.x>10?10:v.scrollRatio.x],w=c.dir[0]==="x"?t[1]+c.dir[1]*o[1]*e:t[0]+c.dir[1]*o[0]*e,d=c.dir[0]==="x"?t[1]+c.dir[1]*parseInt(c.scrollAmount):t[0]+c.dir[1]*parseInt(c.scrollAmount),a=c.scrollAmount!=="auto"?d:w,g=s?s:n?i?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",nt=n?!0:!1;if(n&&f<17&&(a=c.dir[0]==="x"?t[1]:t[0]),u(r,a.toString(),{dir:c.dir[0],scrollEasing:g,dur:f,onComplete:nt}),n){c.dir=!1;return}clearTimeout(c.step);c.step=setTimeout(function(){y()},f)}function d(){clearTimeout(c.step);a(c,"step");o(r)}var v=r.data(t),l=v.opt,c=v.sequential,p=n("#mCSB_"+v.idx+"_container"),w=c.type==="stepped"?!0:!1,b=l.scrollInertia<26?26:l.scrollInertia,k=l.scrollInertia<1?17:l.scrollInertia;switch(f){case"on":if(c.dir=[e===i[16]||e===i[15]||e===39||e===37?"x":"y",e===i[13]||e===i[15]||e===38||e===37?-1:1],o(r),tt(e)&&c.type==="stepped")return;y(w);break;case"off":d();(w||v.tweenRunning&&c.dir)&&y(!0)}},ft=function(i){var u=n(this).data(t).opt,r=[];return typeof i=="function"&&(i=i()),i instanceof Array?r=i.length>1?[i[0],i[1]]:u.axis==="x"?[null,i[0]]:[i[0],null]:(r[0]=i.y?i.y:i.x||u.axis==="x"?null:i,r[1]=i.x?i.x:i.y||u.axis==="y"?null:i),typeof r[0]=="function"&&(r[0]=r[0]()),typeof r[1]=="function"&&(r[1]=r[1]()),r},at=function(i,r){var h,e;if(i!=null&&typeof i!="undefined"){var c=n(this),l=c.data(t),v=l.opt,u=n("#mCSB_"+l.idx+"_container"),o=u.parent(),y=typeof i;r||(r=v.axis==="x"?"x":"y");var p=r==="x"?u.outerWidth(!1)-o.width():u.outerHeight(!1)-o.height(),a=r==="x"?u[0].offsetLeft:u[0].offsetTop,w=r==="x"?"left":"top";switch(y){case"function":return i();case"object":return(e=i.jquery?i:n(i),!e.length)?void 0:r==="x"?f(e)[1]:f(e)[0];case"string":case"number":if(tt(i))return Math.abs(i);if(i.indexOf("%")!==-1)return Math.abs(p*parseInt(i)/100);if(i.indexOf("-=")!==-1)return Math.abs(a-parseInt(i.split("-=")[1]));if(i.indexOf("+=")!==-1)return h=a+parseInt(i.split("+=")[1]),h>=0?0:Math.abs(h);if(i.indexOf("px")!==-1&&tt(i.split("px")[0]))return Math.abs(i.split("px")[0]);if(i==="top"||i==="left")return 0;if(i==="bottom")return Math.abs(o.height()-u.outerHeight(!1));if(i==="right")return Math.abs(o.width()-u.outerWidth(!1));if(i==="first"||i==="last")return e=u.find(":"+i),r==="x"?f(e)[1]:f(e)[0];if(n(i).length)return r==="x"?f(n(i))[1]:f(n(i))[0];u.css(w,i);s.update.call(null,c[0]);return}}},et=function(r){function c(){if(clearTimeout(e[0].autoUpdate),o.parents("html").length===0){o=null;return}e[0].autoUpdate=setTimeout(function(){if(f.advanced.updateOnSelectorChange&&(u.poll.change.n=v(),u.poll.change.n!==u.poll.change.o)){u.poll.change.o=u.poll.change.n;h(3);return}if(f.advanced.updateOnContentResize&&(u.poll.size.n=o[0].scrollHeight+o[0].scrollWidth+e[0].offsetHeight+o[0].offsetHeight+o[0].offsetWidth,u.poll.size.n!==u.poll.size.o)){u.poll.size.o=u.poll.size.n;h(1);return}if(f.advanced.updateOnImageLoad&&!(f.advanced.updateOnImageLoad==="auto"&&f.axis==="y")&&(u.poll.img.n=e.find("img").length,u.poll.img.n!==u.poll.img.o)){u.poll.img.o=u.poll.img.n;e.find("img").each(function(){l(this)});return}(f.advanced.updateOnSelectorChange||f.advanced.updateOnContentResize||f.advanced.updateOnImageLoad)&&c()},f.advanced.autoUpdateTimeout)}function l(t){function u(n,t){return function(){return t.apply(n,arguments)}}function f(){this.onload=null;n(t).addClass(i[2]);h(2)}if(n(t).hasClass(i[2])){h();return}var r=new Image;r.onload=u(r,f);r.src=t.src}function v(){f.advanced.updateOnSelectorChange===!0&&(f.advanced.updateOnSelectorChange="*");var n=0,t=e.find(f.advanced.updateOnSelectorChange);return f.advanced.updateOnSelectorChange&&t.length>0&&t.each(function(){n+=this.offsetHeight+this.offsetWidth}),n}function h(n){clearTimeout(e[0].autoUpdate);s.update.call(null,o[0],n)}var o=n(this),u=o.data(t),f=u.opt,e=n("#mCSB_"+u.idx+"_container");if(r){clearTimeout(e[0].autoUpdate);a(e[0],"autoUpdate");return}c()},yi=function(n,t,i){return Math.round(n/t)*t-i},o=function(i){var r=i.data(t),u=n("#mCSB_"+r.idx+"_container,#mCSB_"+r.idx+"_container_wrapper,#mCSB_"+r.idx+"_dragger_vertical,#mCSB_"+r.idx+"_dragger_horizontal");u.each(function(){pi.call(this)})},u=function(i,r,u){function c(n){return f&&e.callbacks[n]&&typeof e.callbacks[n]=="function"}function ot(){return[e.callbacks.alwaysTriggerOffsets||p>=l[0]+a,e.callbacks.alwaysTriggerOffsets||p<=-v]}function y(){var n=[o[0].offsetTop,o[0].offsetLeft],t=[h[0].offsetTop,h[0].offsetLeft],r=[o.outerHeight(!1),o.outerWidth(!1)],f=[w.height(),w.width()];i[0].mcs={content:o,top:n[0],left:n[1],draggerTop:t[0],draggerLeft:t[1],topPct:Math.round(100*Math.abs(n[0])/(Math.abs(r[0])-f[0])),leftPct:Math.round(100*Math.abs(n[1])/(Math.abs(r[1])-f[1])),direction:u.dir}}var f=i.data(t),e=f.opt,et={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:e.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},u=n.extend(et,u),g=[u.dur,u.drag?0:u.dur],w=n("#mCSB_"+f.idx),o=n("#mCSB_"+f.idx+"_container"),b=o.parent(),nt=e.callbacks.onTotalScrollOffset?ft.call(i,e.callbacks.onTotalScrollOffset):[0,0],tt=e.callbacks.onTotalScrollBackOffset?ft.call(i,e.callbacks.onTotalScrollBackOffset):[0,0],it;if(f.trigger=u.trigger,(b.scrollTop()!==0||b.scrollLeft()!==0)&&(n(".mCSB_"+f.idx+"_scrollbar").css("visibility","visible"),b.scrollTop(0).scrollLeft(0)),r!=="_resetY"||f.contentReset.y||(c("onOverflowYNone")&&e.callbacks.onOverflowYNone.call(i[0]),f.contentReset.y=1),r!=="_resetX"||f.contentReset.x||(c("onOverflowXNone")&&e.callbacks.onOverflowXNone.call(i[0]),f.contentReset.x=1),r!=="_resetY"&&r!=="_resetX"){(f.contentReset.y||!i[0].mcs)&&f.overflowed[0]&&(c("onOverflowY")&&e.callbacks.onOverflowY.call(i[0]),f.contentReset.x=null);(f.contentReset.x||!i[0].mcs)&&f.overflowed[1]&&(c("onOverflowX")&&e.callbacks.onOverflowX.call(i[0]),f.contentReset.x=null);e.snapAmount&&(it=(e.snapAmount instanceof Array)?u.dir==="x"?e.snapAmount[1]:e.snapAmount[0]:e.snapAmount,r=yi(r,it,e.snapOffset));switch(u.dir){case"x":var h=n("#mCSB_"+f.idx+"_dragger_horizontal"),k="left",p=o[0].offsetLeft,l=[w.width()-o.outerWidth(!1),h.parent().width()-h.width()],s=[r,r===0?0:r/f.scrollRatio.x],a=nt[1],v=tt[1],rt=a>0?a/f.scrollRatio.x:0,ut=v>0?v/f.scrollRatio.x:0;break;case"y":var h=n("#mCSB_"+f.idx+"_dragger_vertical"),k="top",p=o[0].offsetTop,l=[w.height()-o.outerHeight(!1),h.parent().height()-h.height()],s=[r,r===0?0:r/f.scrollRatio.y],a=nt[0],v=tt[0],rt=a>0?a/f.scrollRatio.y:0,ut=v>0?v/f.scrollRatio.y:0}(s[1]<0||s[0]===0&&s[1]===0?s=[0,0]:s[1]>=l[1]?s=[l[0],l[1]]:s[0]=-s[0],i[0].mcs||(y(),c("onInit")&&e.callbacks.onInit.call(i[0])),clearTimeout(o[0].onCompleteTimeout),vt(h[0],k,Math.round(s[1]),g[1],u.scrollEasing),!f.tweenRunning&&(p===0&&s[0]>=0||p===l[0]&&s[0]<=l[0]))||vt(o[0],k,Math.round(s[0]),g[0],u.scrollEasing,u.overwrite,{onStart:function(){u.callbacks&&u.onStart&&!f.tweenRunning&&(c("onScrollStart")&&(y(),e.callbacks.onScrollStart.call(i[0])),f.tweenRunning=!0,d(h),f.cbOffsets=ot())},onUpdate:function(){u.callbacks&&u.onUpdate&&c("whileScrolling")&&(y(),e.callbacks.whileScrolling.call(i[0]))},onComplete:function(){if(u.callbacks&&u.onComplete){e.axis==="yx"&&clearTimeout(o[0].onCompleteTimeout);var n=o[0].idleTimer||0;o[0].onCompleteTimeout=setTimeout(function(){c("onScroll")&&(y(),e.callbacks.onScroll.call(i[0]));c("onTotalScroll")&&s[1]>=l[1]-rt&&f.cbOffsets[0]&&(y(),e.callbacks.onTotalScroll.call(i[0]));c("onTotalScrollBack")&&s[1]<=ut&&f.cbOffsets[1]&&(y(),e.callbacks.onTotalScrollBack.call(i[0]));f.tweenRunning=!1;o[0].idleTimer=0;d(h,"hide")},n)}}})}},vt=function(n,t,i,r,u,f,e){function y(){o.stop||(s||b.call(),s=w()-g,p(),s>=o.time&&(o.time=s>o.time?s+h-(s-o.time):s+h-1,o.time<s+1&&(o.time=s+1)),o.time<r?o.id=l(y):d.call())}function p(){r>0?(o.currVal=it(o.time,c,v,r,u),a[t]=Math.round(o.currVal)+"px"):a[t]=i+"px";k.call()}function nt(){h=1e3/60;o.time=s+h;l=window.requestAnimationFrame?window.requestAnimationFrame:function(n){return p(),setTimeout(n,.01)};o.id=l(y)}function tt(){o.id!=null&&(window.requestAnimationFrame?window.cancelAnimationFrame(o.id):clearTimeout(o.id),o.id=null)}function it(n,t,i,r,u){switch(u){case"linear":case"mcsLinear":return i*n/r+t;case"mcsLinearOut":return n/=r,n--,i*Math.sqrt(1-n*n)+t;case"easeInOutSmooth":return(n/=r/2,n<1)?i/2*n*n+t:(n--,-i/2*(n*(n-2)-1)+t);case"easeInOutStrong":return(n/=r/2,n<1)?i/2*Math.pow(2,10*(n-1))+t:(n--,i/2*(-Math.pow(2,-10*n)+2)+t);case"easeInOut":case"mcsEaseInOut":return(n/=r/2,n<1)?i/2*n*n*n+t:(n-=2,i/2*(n*n*n+2)+t);case"easeOutSmooth":return n/=r,n--,-i*(n*n*n*n-1)+t;case"easeOutStrong":return i*(-Math.pow(2,-10*n/r)+1)+t;case"easeOut":case"mcsEaseOut":default:var f=(n/=r)*n,e=f*n;return t+i*(.499999999999997*e*f+-2.5*f*f+5.5*e+-6.5*f+4*n)}}var v;n._mTween||(n._mTween={top:{},left:{}});var e=e||{},b=e.onStart||function(){},k=e.onUpdate||function(){},d=e.onComplete||function(){},g=w(),h,s=0,c=n.offsetTop,a=n.style,l,o=n._mTween[t];t==="left"&&(c=n.offsetLeft);v=i-c;o.stop=0;f!=="none"&&tt();nt()},w=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},pi=function(){var n=this,r,i,t;for(n._mTween||(n._mTween={top:{},left:{}}),r=["top","left"],i=0;i<r.length;i++)t=r[i],n._mTween[t].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(n._mTween[t].id):clearTimeout(n._mTween[t].id),n._mTween[t].id=null,n._mTween[t].stop=1)},a=function(n,t){try{delete n[t]}catch(i){n[t]=null}},yt=function(n){return!(n.which&&n.which!==1)},nt=function(n){var t=n.originalEvent.pointerType;return!(t&&t!=="touch"&&t!==2)},tt=function(n){return!isNaN(parseFloat(n))&&isFinite(n)},f=function(n){var t=n.parents(".mCSB_container");return[n.offset().top-t.offset().top,n.offset().left-t.offset().left]},wi=function(){function t(){var t=["webkit","moz","ms","o"],n;if("hidden"in document)return"hidden";for(n=0;n<t.length;n++)if(t[n]+"Hidden"in document)return t[n]+"Hidden";return null}var n=t();return n?document[n]:!1};n.fn[h]=function(t){if(s[t])return s[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t!="object"&&t)n.error("Method "+t+" does not exist");else return s.init.apply(this,arguments)};n[h]=function(t){if(s[t])return s[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t!="object"&&t)n.error("Method "+t+" does not exist");else return s.init.apply(this,arguments)};n[h].defaults=ot;window[h]=!0;n(window).bind("load",function(){n(it)[h]();n.extend(n.expr[":"],{mcsInView:n.expr[":"].mcsInView||function(t){var i=n(t),u=i.parents(".mCSB_container"),e,r;if(u.length)return e=u.parent(),r=[u[0].offsetTop,u[0].offsetLeft],r[0]+f(i)[0]>=0&&r[0]+f(i)[0]<e.height()-i.outerHeight(!1)&&r[1]+f(i)[1]>=0&&r[1]+f(i)[1]<e.width()-i.outerWidth(!1)},mcsInSight:n.expr[":"].mcsInSight||function(t,i,r){var e=n(t),o,s=e.parents(".mCSB_container"),u,h,c,l=r[3]==="exact"?[[1,0],[1,0]]:[[.9,.1],[.6,.4]];if(s.length)return o=[e.outerHeight(!1),e.outerWidth(!1)],h=[s[0].offsetTop+f(e)[0],s[0].offsetLeft+f(e)[1]],u=[s.parent()[0].offsetHeight,s.parent()[0].offsetWidth],c=[o[0]<u[0]?l[0]:l[1],o[1]<u[1]?l[0]:l[1]],h[0]-u[0]*c[0][0]<0&&h[0]+o[0]-u[0]*c[0][1]>=0&&h[1]-u[1]*c[1][0]<0&&h[1]+o[1]-u[1]*c[1][1]>=0},mcsOverflow:n.expr[":"].mcsOverflow||function(i){var r=n(i).data(t);if(r)return r.overflowed[0]||r.overflowed[1]}})})})})