/* == malihu jquery custom scrollbar plugin == version: 3.1.5, license: mit license (mit) */
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e:e(jquery,window,document)}(function(e){!function(t){var o="function"==typeof define&&define.amd,a="undefined"!=typeof module&&module.exports,n="https:"==document.location.protocol?"https:":"http:",i="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";o||(a?require("jquery-mousewheel")(e):e.event.special.mousewheel||e("head").append(decodeuri("%3cscript src="+n+"//"+i+"%3e%3c/script%3e"))),t()}(function(){var t,o="mcustomscrollbar",a="mcs",n=".mcustomscrollbar",i={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}},r=0,l={},s=window.attachevent&&!window.addeventlistener?1:0,c=!1,d=["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"],u={init:function(t){var t=e.extend(!0,{},i,t),o=f.call(this);if(t.live){var s=t.liveselector||this.selector||n,c=e(s);if("off"===t.live)return void m(s);l[s]=settimeout(function(){c.mcustomscrollbar(t),"once"===t.live&&c.length&&m(s)},500)}else m(s);return t.setwidth=t.set_width?t.set_width:t.setwidth,t.setheight=t.set_height?t.set_height:t.setheight,t.axis=t.horizontalscroll?"x":p(t.axis),t.scrollinertia=t.scrollinertia>0&&t.scrollinertia<17?17:t.scrollinertia,"object"!=typeof t.mousewheel&&1==t.mousewheel&&(t.mousewheel={enable:!0,scrollamount:"auto",axis:"y",preventdefault:!1,deltafactor:"auto",normalizedelta:!1,invert:!1}),t.mousewheel.scrollamount=t.mousewheelpixels?t.mousewheelpixels:t.mousewheel.scrollamount,t.mousewheel.normalizedelta=t.advanced.normalizemousewheeldelta?t.advanced.normalizemousewheeldelta:t.mousewheel.normalizedelta,t.scrollbuttons.scrolltype=g(t.scrollbuttons.scrolltype),h(t),e(o).each(function(){var o=e(this);if(!o.data(a)){o.data(a,{idx:++r,opt:t,scrollratio:{y:null,x:null},overflowed:null,contentreset:{y:null,x:null},bindevents:!1,tweenrunning:!1,sequential:{},langdir:o.css("direction"),cboffsets:null,trigger:null,poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}});var n=o.data(a),i=n.opt,l=o.data("mcs-axis"),s=o.data("mcs-scrollbar-position"),c=o.data("mcs-theme");l&&(i.axis=l),s&&(i.scrollbarposition=s),c&&(i.theme=c,h(i)),v.call(this),n&&i.callbacks.oncreate&&"function"==typeof i.callbacks.oncreate&&i.callbacks.oncreate.call(this),e("#mcsb_"+n.idx+"_container img:not(."+d[2]+")").addclass(d[2]),u.update.call(null,o)}})},update:function(t,o){var n=t||f.call(this);return e(n).each(function(){var t=e(this);if(t.data(a)){var n=t.data(a),i=n.opt,r=e("#mcsb_"+n.idx+"_container"),l=e("#mcsb_"+n.idx),s=[e("#mcsb_"+n.idx+"_dragger_vertical"),e("#mcsb_"+n.idx+"_dragger_horizontal")];if(!r.length)return;n.tweenrunning&&q(t),o&&n&&i.callbacks.onbeforeupdate&&"function"==typeof i.callbacks.onbeforeupdate&&i.callbacks.onbeforeupdate.call(this),t.hasclass(d[3])&&t.removeclass(d[3]),t.hasclass(d[4])&&t.removeclass(d[4]),l.css("max-height","none"),l.height()!==t.height()&&l.css("max-height",t.height()),_.call(this),"y"===i.axis||i.advanced.autoexpandhorizontalscroll||r.css("width",x(r)),n.overflowed=y.call(this),m.call(this),i.autodraggerlength&&s.call(this),b.call(this),t.call(this);var c=[math.abs(r[0].offsettop),math.abs(r[0].offsetleft)];"x"!==i.axis&&(n.overflowed[0]?s[0].height()>s[0].parent().height()?b.call(this):(g(t,c[0].tostring(),{dir:"y",dur:0,overwrite:"none"}),n.contentreset.y=null):(b.call(this),"y"===i.axis?k.call(this):"yx"===i.axis&&n.overflowed[1]&&g(t,c[1].tostring(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==i.axis&&(n.overflowed[1]?s[1].width()>s[1].parent().width()?b.call(this):(g(t,c[1].tostring(),{dir:"x",dur:0,overwrite:"none"}),n.contentreset.x=null):(b.call(this),"x"===i.axis?k.call(this):"yx"===i.axis&&n.overflowed[0]&&g(t,c[0].tostring(),{dir:"y",dur:0,overwrite:"none"}))),o&&n&&(2===o&&i.callbacks.onimageload&&"function"==typeof i.callbacks.onimageload?i.callbacks.onimageload.call(this):3===o&&i.callbacks.onselectorchange&&"function"==typeof i.callbacks.onselectorchange?i.callbacks.onselectorchange.call(this):i.callbacks.onupdate&&"function"==typeof i.callbacks.onupdate&&i.callbacks.onupdate.call(this)),n.call(this)}})},scrollto:function(t,o){if("undefined"!=typeof t&&null!=t){var n=f.call(this);return e(n).each(function(){var n=e(this);if(n.data(a)){var i=n.data(a),r=i.opt,l={trigger:"external",scrollinertia:r.scrollinertia,scrolleasing:"mcseaseinout",movedragger:!1,timeout:60,callbacks:!0,onstart:!0,onupdate:!0,oncomplete:!0},s=e.extend(!0,{},l,o),c=y.call(this,t),d=s.scrollinertia>0&&s.scrollinertia<17?17:s.scrollinertia;c[0]=x.call(this,c[0],"y"),c[1]=x.call(this,c[1],"x"),s.movedragger&&(c[0]*=i.scrollratio.y,c[1]*=i.scrollratio.x),s.dur=ne()?0:d,settimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==r.axis&&i.overflowed[0]&&(s.dir="y",s.overwrite="all",g(n,c[0].tostring(),s)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==r.axis&&i.overflowed[1]&&(s.dir="x",s.overwrite="none",g(n,c[1].tostring(),s))},s.timeout)}})}},stop:function(){var t=f.call(this);return e(t).each(function(){var t=e(this);t.data(a)&&q(t)})},disable:function(t){var o=f.call(this);return e(o).each(function(){var o=e(this);if(o.data(a)){o.data(a);n.call(this,"remove"),k.call(this),t&&b.call(this),m.call(this,!0),o.addclass(d[3])}})},destroy:function(){var t=f.call(this);return e(t).each(function(){var n=e(this);if(n.data(a)){var i=n.data(a),r=i.opt,l=e("#mcsb_"+i.idx),s=e("#mcsb_"+i.idx+"_container"),c=e(".mcsb_"+i.idx+"_scrollbar");r.live&&m(r.liveselector||e(t).selector),n.call(this,"remove"),k.call(this),b.call(this),n.removedata(a),$(this,"mcs"),c.remove(),s.find("img."+d[2]).removeclass(d[2]),l.replacewith(s.contents()),n.removeclass(o+" _"+a+"_"+i.idx+" "+d[6]+" "+d[7]+" "+d[5]+" "+d[3]).addclass(d[4])}})}},f=function(){return"object"!=typeof e(this)||e(this).length<1?n:this},h=function(t){var o=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],a=["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"],n=["minimal","minimal-dark"],i=["minimal","minimal-dark"],r=["minimal","minimal-dark"];t.autodraggerlength=e.inarray(t.theme,o)>-1?!1:t.autodraggerlength,t.autoexpandscrollbar=e.inarray(t.theme,a)>-1?!1:t.autoexpandscrollbar,t.scrollbuttons.enable=e.inarray(t.theme,n)>-1?!1:t.scrollbuttons.enable,t.autohidescrollbar=e.inarray(t.theme,i)>-1?!0:t.autohidescrollbar,t.scrollbarposition=e.inarray(t.theme,r)>-1?"outside":t.scrollbarposition},m=function(e){l[e]&&(cleartimeout(l[e]),$(l,e))},p=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},g=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},v=function(){var t=e(this),n=t.data(a),i=n.opt,r=i.autoexpandscrollbar?" "+d[1]+"_expand":"",l=["
",""],s="yx"===i.axis?"mcsb_vertical_horizontal":"x"===i.axis?"mcsb_horizontal":"mcsb_vertical",c="yx"===i.axis?l[0]+l[1]:"x"===i.axis?l[1]:l[0],u="yx"===i.axis?"":"",f=i.autohidescrollbar?" "+d[6]:"",h="x"!==i.axis&&"rtl"===n.langdir?" "+d[7]:"";i.setwidth&&t.css("width",i.setwidth),i.setheight&&t.css("height",i.setheight),i.setleft="y"!==i.axis&&"rtl"===n.langdir?"989999px":i.setleft,t.addclass(o+" _"+a+"_"+n.idx+f+h).wrapinner("");var m=e("#mcsb_"+n.idx),p=e("#mcsb_"+n.idx+"_container");"y"===i.axis||i.advanced.autoexpandhorizontalscroll||p.css("width",x(p)),"outside"===i.scrollbarposition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),m.addclass("mcsb_outside").after(c)):(m.addclass("mcsb_inside").append(c),p.wrap(u)),w.call(this);var g=[e("#mcsb_"+n.idx+"_dragger_vertical"),e("#mcsb_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},x=function(t){var o=[t[0].scrollwidth,math.max.apply(math,t.children().map(function(){return e(this).outerwidth(!0)}).get())],a=t.parent().width();return o[0]>a?o[0]:o[1]>a?o[1]:"100%"},_=function(){var t=e(this),o=t.data(a),n=o.opt,i=e("#mcsb_"+o.idx+"_container");if(n.advanced.autoexpandhorizontalscroll&&"y"!==n.axis){i.css({width:"auto","min-width":0,"overflow-x":"scroll"});var r=math.ceil(i[0].scrollwidth);3===n.advanced.autoexpandhorizontalscroll||2!==n.advanced.autoexpandhorizontalscroll&&r>i.parent().width()?i.css({width:r,"min-width":"100%","overflow-x":"inherit"}):i.css({"overflow-x":"inherit",position:"absolute"}).wrap("").css({width:math.ceil(i[0].getboundingclientrect().right+.4)-math.floor(i[0].getboundingclientrect().left),"min-width":"100%",position:"relative"}).unwrap()}},w=function(){var t=e(this),o=t.data(a),n=o.opt,i=e(".mcsb_"+o.idx+"_scrollbar:first"),r=oe(n.scrollbuttons.tabindex)?"tabindex='"+n.scrollbuttons.tabindex+"'":"",l=["","","",""],s=["x"===n.axis?l[2]:l[0],"x"===n.axis?l[3]:l[1],l[2],l[3]];n.scrollbuttons.enable&&i.prepend(s[0]).append(s[1]).next(".mcsb_scrolltools").prepend(s[2]).append(s[3])},s=function(){var t=e(this),o=t.data(a),n=e("#mcsb_"+o.idx),i=e("#mcsb_"+o.idx+"_container"),r=[e("#mcsb_"+o.idx+"_dragger_vertical"),e("#mcsb_"+o.idx+"_dragger_horizontal")],l=[n.height()/i.outerheight(!1),n.width()/i.outerwidth(!1)],c=[parseint(r[0].css("min-height")),math.round(l[0]*r[0].parent().height()),parseint(r[1].css("min-width")),math.round(l[1]*r[1].parent().width())],d=s&&c[1]r&&(r=s),c>l&&(l=c),[r>n.height(),l>n.width()]},b=function(){var t=e(this),o=t.data(a),n=o.opt,i=e("#mcsb_"+o.idx),r=e("#mcsb_"+o.idx+"_container"),l=[e("#mcsb_"+o.idx+"_dragger_vertical"),e("#mcsb_"+o.idx+"_dragger_horizontal")];if(q(t),("x"!==n.axis&&!o.overflowed[0]||"y"===n.axis&&o.overflowed[0])&&(l[0].add(r).css("top",0),g(t,"_resety")),"y"!==n.axis&&!o.overflowed[1]||"x"===n.axis&&o.overflowed[1]){var s=dx=0;"rtl"===o.langdir&&(s=i.width()-r.outerwidth(!1),dx=math.abs(s/o.scrollratio.x)),r.css("left",s),l[1].css("left",dx),g(t,"_resetx")}},t=function(){function t(){r=settimeout(function(){e.event.special.mousewheel?(cleartimeout(r),w.call(o[0])):t()},100)}var o=e(this),n=o.data(a),i=n.opt;if(!n.bindevents){if(i.call(this),i.contenttouchscroll&&d.call(this),e.call(this),i.mousewheel.enable){var r;t()}p.call(this),u.call(this),i.advanced.autoscrollonfocus&&h.call(this),i.scrollbuttons.enable&&f.call(this),i.keyboard.enable&&q.call(this),n.bindevents=!0}},k=function(){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=".mcsb_"+o.idx+"_scrollbar",l=e("#mcsb_"+o.idx+",#mcsb_"+o.idx+"_container,#mcsb_"+o.idx+"_container_wrapper,"+r+" ."+d[12]+",#mcsb_"+o.idx+"_dragger_vertical,#mcsb_"+o.idx+"_dragger_horizontal,"+r+">a"),s=e("#mcsb_"+o.idx+"_container");n.advanced.releasedraggableselectors&&l.add(e(n.advanced.releasedraggableselectors)),n.advanced.extradraggableselectors&&l.add(e(n.advanced.extradraggableselectors)),o.bindevents&&(e(document).add(e(!a()||top.document)).unbind("."+i),l.each(function(){e(this).unbind("."+i)}),cleartimeout(t[0]._focustimeout),$(t[0],"_focustimeout"),cleartimeout(o.sequential.step),$(o.sequential,"step"),cleartimeout(s[0].oncompletetimeout),$(s[0],"oncompletetimeout"),o.bindevents=!1)},m=function(t){var o=e(this),n=o.data(a),i=n.opt,r=e("#mcsb_"+n.idx+"_container_wrapper"),l=r.length?r:e("#mcsb_"+n.idx+"_container"),s=[e("#mcsb_"+n.idx+"_scrollbar_vertical"),e("#mcsb_"+n.idx+"_scrollbar_horizontal")],c=[s[0].find(".mcsb_dragger"),s[1].find(".mcsb_dragger")];"x"!==i.axis&&(n.overflowed[0]&&!t?(s[0].add(c[0]).add(s[0].children("a")).css("display","block"),l.removeclass(d[8]+" "+d[10])):(i.alwaysshowscrollbar?(2!==i.alwaysshowscrollbar&&c[0].css("display","none"),l.removeclass(d[10])):(s[0].css("display","none"),l.addclass(d[10])),l.addclass(d[8]))),"y"!==i.axis&&(n.overflowed[1]&&!t?(s[1].add(c[1]).add(s[1].children("a")).css("display","block"),l.removeclass(d[9]+" "+d[11])):(i.alwaysshowscrollbar?(2!==i.alwaysshowscrollbar&&c[1].css("display","none"),l.removeclass(d[11])):(s[1].css("display","none"),l.addclass(d[11])),l.addclass(d[9]))),n.overflowed[0]||n.overflowed[1]?o.removeclass(d[5]):o.addclass(d[5])},o=function(t){var o=t.type,a=t.target.ownerdocument!==document&&null!==frameelement?[e(frameelement).offset().top,e(frameelement).offset().left]:null,n=a()&&t.target.ownerdocument!==top.document&&null!==frameelement?[e(t.view.frameelement).offset().top,e(t.view.frameelement).offset().left]:[0,0];switch(o){case"pointerdown":case"mspointerdown":case"pointermove":case"mspointermove":case"pointerup":case"mspointerup":return a?[t.originalevent.pagey-a[0]+n[0],t.originalevent.pagex-a[1]+n[1],!1]:[t.originalevent.pagey,t.originalevent.pagex,!1];case"touchstart":case"touchmove":case"touchend":var i=t.originalevent.touches[0]||t.originalevent.changedtouches[0],r=t.originalevent.touches.length||t.originalevent.changedtouches.length;return t.target.ownerdocument!==document?[i.screeny,i.screenx,r>1]:[i.pagey,i.pagex,r>1];default:return a?[t.pagey-a[0]+n[0],t.pagex-a[1]+n[1],!1]:[t.pagey,t.pagex,!1]}},i=function(){function t(e,t,a,n){if(h[0].idletimer=d.scrollinertia<233?250:0,o.attr("id")===f[1])var i="x",s=(o[0].offsetleft-t+n)*l.scrollratio.x;else var i="y",s=(o[0].offsettop-e+a)*l.scrollratio.y;g(r,s.tostring(),{dir:i,drag:!0})}var o,n,i,r=e(this),l=r.data(a),d=l.opt,u=a+"_"+l.idx,f=["mcsb_"+l.idx+"_dragger_vertical","mcsb_"+l.idx+"_dragger_horizontal"],h=e("#mcsb_"+l.idx+"_container"),m=e("#"+f[0]+",#"+f[1]),p=d.advanced.releasedraggableselectors?m.add(e(d.advanced.releasedraggableselectors)):m,g=d.advanced.extradraggableselectors?e(!a()||top.document).add(e(d.advanced.extradraggableselectors)):e(!a()||top.document);m.bind("contextmenu."+u,function(e){e.preventdefault()}).bind("mousedown."+u+" touchstart."+u+" pointerdown."+u+" mspointerdown."+u,function(t){if(t.stopimmediatepropagation(),t.preventdefault(),ee(t)){c=!0,s&&(document.onselectstart=function(){return!1}),l.call(h,!1),q(r),o=e(this);var a=o.offset(),l=o(t)[0]-a.top,u=o(t)[1]-a.left,f=o.height()+a.top,m=o.width()+a.left;f>l&&l>0&&m>u&&u>0&&(n=l,i=u),c(o,"active",d.autoexpandscrollbar)}}).bind("touchmove."+u,function(e){e.stopimmediatepropagation(),e.preventdefault();var a=o.offset(),r=o(e)[0]-a.top,l=o(e)[1]-a.left;t(n,i,r,l)}),e(document).add(g).bind("mousemove."+u+" pointermove."+u+" mspointermove."+u,function(e){if(o){var a=o.offset(),r=o(e)[0]-a.top,l=o(e)[1]-a.left;if(n===r&&i===l)return;t(n,i,r,l)}}).add(p).bind("mouseup."+u+" touchend."+u+" pointerup."+u+" mspointerup."+u,function(){o&&(c(o,"active",d.autoexpandscrollbar),o=null),c=!1,s&&(document.onselectstart=null),l.call(h,!0)})},d=function(){function o(e){if(!te(e)||c||o(e)[2])return void(t=0);t=1,b=0,c=0,d=1,y.removeclass("mcs_touch_action");var o=i.offset();u=o(e)[0]-o.top,f=o(e)[1]-o.left,z=[o(e)[0],o(e)[1]]}function n(e){if(te(e)&&!c&&!o(e)[2]&&(t.documenttouchscroll||e.preventdefault(),e.stopimmediatepropagation(),(!c||b)&&d)){g=k();var t=m.offset(),o=o(e)[0]-t.top,a=o(e)[1]-t.left,n="mcslinearout";if(e.push(o),w.push(a),z[2]=math.abs(o(e)[0]-z[0]),z[3]=math.abs(o(e)[1]-z[1]),b.overflowed[0])var i=d[0].parent().height()-d[0].height(),r=u-o>0&&o-u>-(i*b.scrollratio.y)&&(2*z[3]0&&a-f>-(l*b.scrollratio.x)&&(2*z[2]30)){_=1e3/(v-p);var n="mcseaseout",i=2.5>_,r=i?[e[e.length-2],w[w.length-2]]:[0,0];x=i?[o-r[0],a-r[1]]:[o-h,a-m];var u=[math.abs(x[0]),math.abs(x[1])];_=i?[math.abs(x[0]/4),math.abs(x[1]/4)]:[_,_];var f=[math.abs(i[0].offsettop)-x[0]*l(u[0]/_[0],_[0]),math.abs(i[0].offsetleft)-x[1]*l(u[1]/_[1],_[1])];w="yx"===t.axis?[f[0],f[1]]:"x"===t.axis?[null,f[1]]:[f[0],null],s=[4*u[0]+t.scrollinertia,4*u[1]+t.scrollinertia];var y=parseint(t.contenttouchscroll)||0;w[0]=u[0]>y?w[0]:0,w[1]=u[1]>y?w[1]:0,b.overflowed[0]&&s(w[0],s[0],n,"y",l,!1),b.overflowed[1]&&s(w[1],s[1],n,"x",l,!1)}}}function l(e,t){var o=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?o[0]:o[3]:e>60?t>3?o[3]:o[2]:e>30?t>8?o[1]:t>6?o[0]:t>4?t:o[2]:t>8?t:o[3]}function s(e,t,o,a,n,i){e&&g(y,e.tostring(),{dur:t,scrolleasing:o,dir:a,overwrite:n,drag:i})}var d,u,f,h,m,p,g,v,x,_,w,s,b,c,y=e(this),b=y.data(a),t=b.opt,k=a+"_"+b.idx,m=e("#mcsb_"+b.idx),i=e("#mcsb_"+b.idx+"_container"),d=[e("#mcsb_"+b.idx+"_dragger_vertical"),e("#mcsb_"+b.idx+"_dragger_horizontal")],e=[],w=[],r=0,l="yx"===t.axis?"none":"all",z=[],p=i.find("iframe"),h=["touchstart."+k+" pointerdown."+k+" mspointerdown."+k,"touchmove."+k+" pointermove."+k+" mspointermove."+k,"touchend."+k+" pointerup."+k+" mspointerup."+k],u=void 0!==document.body.style.touchaction&&""!==document.body.style.touchaction;i.bind(h[0],function(e){o(e)}).bind(h[1],function(e){n(e)}),m.bind(h[0],function(e){i(e)}).bind(h[2],function(e){r(e)}),p.length&&p.each(function(){e(this).bind("load",function(){a(this)&&e(this.contentdocument||this.contentwindow.document).bind(h[0],function(e){o(e),i(e)}).bind(h[1],function(e){n(e)}).bind(h[2],function(e){r(e)})})})},e=function(){function o(){return window.getselection?window.getselection().tostring():document.selection&&"control"!=document.selection.type?document.selection.createrange().text:0}function n(e,t,o){d.type=o&&i?"stepped":"stepless",d.scrollamount=10,j(r,e,t,"mcslinearout",o?60:null)}var i,r=e(this),l=r.data(a),s=l.opt,d=l.sequential,u=a+"_"+l.idx,f=e("#mcsb_"+l.idx+"_container"),h=f.parent();f.bind("mousedown."+u,function(){t||i||(i=1,c=!0)}).add(document).bind("mousemove."+u,function(e){if(!t&&i&&o()){var a=f.offset(),r=o(e)[0]-a.top+f[0].offsettop,c=o(e)[1]-a.left+f[0].offsetleft;r>0&&r0&&cr?n("on",38):r>h.height()&&n("on",40)),"y"!==s.axis&&l.overflowed[1]&&(0>c?n("on",37):c>h.width()&&n("on",39)))}}).bind("mouseup."+u+" dragend."+u,function(){t||(i&&(i=0,n("off",null)),c=!1)})},w=function(){function t(t,a){if(q(o),!z(o,t.target)){var r="auto"!==i.mousewheel.deltafactor?parseint(i.mousewheel.deltafactor):s&&t.deltafactor<100?100:t.deltafactor||100,d=i.scrollinertia;if("x"===i.axis||"x"===i.mousewheel.axis)var u="x",f=[math.round(r*n.scrollratio.x),parseint(i.mousewheel.scrollamount)],h="auto"!==i.mousewheel.scrollamount?f[1]:f[0]>=l.width()?.9*l.width():f[0],m=math.abs(e("#mcsb_"+n.idx+"_container")[0].offsetleft),p=c[1][0].offsetleft,g=c[1].parent().width()-c[1].width(),v="y"===i.mousewheel.axis?t.deltay||a:t.deltax;else var u="y",f=[math.round(r*n.scrollratio.y),parseint(i.mousewheel.scrollamount)],h="auto"!==i.mousewheel.scrollamount?f[1]:f[0]>=l.height()?.9*l.height():f[0],m=math.abs(e("#mcsb_"+n.idx+"_container")[0].offsettop),p=c[0][0].offsettop,g=c[0].parent().height()-c[0].height(),v=t.deltay||a;"y"===u&&!n.overflowed[0]||"x"===u&&!n.overflowed[1]||((i.mousewheel.invert||t.webkitdirectioninvertedfromdevice)&&(v=-v),i.mousewheel.normalizedelta&&(v=0>v?-1:1),(v>0&&0!==p||0>v&&p!==g||i.mousewheel.preventdefault)&&(t.stopimmediatepropagation(),t.preventdefault()),t.deltafactor<5&&!i.mousewheel.normalizedelta&&(h=t.deltafactor,d=17),g(o,(m-v*h).tostring(),{dir:u,dur:d}))}}if(e(this).data(a)){var o=e(this),n=o.data(a),i=n.opt,r=a+"_"+n.idx,l=e("#mcsb_"+n.idx),c=[e("#mcsb_"+n.idx+"_dragger_vertical"),e("#mcsb_"+n.idx+"_dragger_horizontal")],d=e("#mcsb_"+n.idx+"_container").find("iframe");d.length&&d.each(function(){e(this).bind("load",function(){a(this)&&e(this.contentdocument||this.contentwindow.document).bind("mousewheel."+r,function(e,o){t(e,o)})})}),l.bind("mousewheel."+r,function(e,o){t(e,o)})}},r=new object,a=function(t){var o=!1,a=!1,n=null;if(void 0===t?a="#empty":void 0!==e(t).attr("id")&&(a=e(t).attr("id")),a!==!1&&void 0!==r[a])return r[a];if(t){try{var i=t.contentdocument||t.contentwindow.document;n=i.body.innerhtml}catch(r){}o=null!==n}else{try{var i=top.document;n=i.body.innerhtml}catch(r){}o=null!==n}return a!==!1&&(r[a]=o),o},l=function(e){var t=this.find("iframe");if(t.length){var o=e?"auto":"none";t.css("pointer-events",o)}},z=function(t,o){var n=o.nodename.tolowercase(),i=t.data(a).opt.mousewheel.disableover,r=["select","textarea"];return e.inarray(n,i)>-1&&!(e.inarray(n,r)>-1&&!e(o).is(":focus"))},p=function(){var t,o=e(this),n=o.data(a),i=a+"_"+n.idx,r=e("#mcsb_"+n.idx+"_container"),l=r.parent(),s=e(".mcsb_"+n.idx+"_scrollbar ."+d[12]);s.bind("mousedown."+i+" touchstart."+i+" pointerdown."+i+" mspointerdown."+i,function(o){c=!0,e(o.target).hasclass("mcsb_dragger")||(t=1)}).bind("touchend."+i+" pointerup."+i+" mspointerup."+i,function(){c=!1}).bind("click."+i,function(a){if(t&&(t=0,e(a.target).hasclass(d[12])||e(a.target).hasclass("mcsb_draggerrail"))){q(o);var i=e(this),s=i.find(".mcsb_dragger");if(i.parent(".mcsb_scrolltools_horizontal").length>0){if(!n.overflowed[1])return;var c="x",u=a.pagex>s.offset().left?-1:1,f=math.abs(r[0].offsetleft)-u*(.9*l.width())}else{if(!n.overflowed[0])return;var c="y",u=a.pagey>s.offset().top?-1:1,f=math.abs(r[0].offsettop)-u*(.9*l.height())}g(o,f.tostring(),{dir:c,scrolleasing:"mcseaseinout"})}})},h=function(){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=e("#mcsb_"+o.idx+"_container"),l=r.parent();r.bind("focusin."+i,function(){var o=e(document.activeelement),a=r.find(".mcustomscrollbox").length,i=0;o.is(n.advanced.autoscrollonfocus)&&(q(t),cleartimeout(t[0]._focustimeout),t[0]._focustimer=a?(i+17)*a:0,t[0]._focustimeout=settimeout(function(){var e=[ae(o)[0],ae(o)[1]],a=[r[0].offsettop,r[0].offsetleft],s=[a[0]+e[0]>=0&&a[0]+e[0]=0&&a[0]+e[1]a");s.bind("contextmenu."+r,function(e){e.preventdefault()}).bind("mousedown."+r+" touchstart."+r+" pointerdown."+r+" mspointerdown."+r+" mouseup."+r+" touchend."+r+" pointerup."+r+" mspointerup."+r+" mouseout."+r+" pointerout."+r+" mspointerout."+r+" click."+r,function(a){function r(e,o){i.scrollamount=n.scrollbuttons.scrollamount,j(t,e,o)}if(a.preventdefault(),ee(a)){var l=e(this).attr("class");switch(i.type=n.scrollbuttons.scrolltype,a.type){case"mousedown":case"touchstart":case"pointerdown":case"mspointerdown":if("stepped"===i.type)return;c=!0,o.tweenrunning=!1,r("on",l);break;case"mouseup":case"touchend":case"pointerup":case"mspointerup":case"mouseout":case"pointerout":case"mspointerout":if("stepped"===i.type)return;c=!1,i.dir&&r("off",l);break;case"click":if("stepped"!==i.type||o.tweenrunning)return;r("on",l)}}})},q=function(){function t(t){function a(e,t){r.type=i.keyboard.scrolltype,r.scrollamount=i.keyboard.scrollamount,"stepped"===r.type&&n.tweenrunning||j(o,e,t)}switch(t.type){case"blur":n.tweenrunning&&r.dir&&a("off",null);break;case"keydown":case"keyup":var l=t.keycode?t.keycode:t.which,s="on";if("x"!==i.axis&&(38===l||40===l)||"y"!==i.axis&&(37===l||39===l)){if((38===l||40===l)&&!n.overflowed[0]||(37===l||39===l)&&!n.overflowed[1])return;"keyup"===t.type&&(s="off"),e(document.activeelement).is(u)||(t.preventdefault(),t.stopimmediatepropagation(),a(s,l))}else if(33===l||34===l){if((n.overflowed[0]||n.overflowed[1])&&(t.preventdefault(),t.stopimmediatepropagation()),"keyup"===t.type){q(o);var f=34===l?-1:1;if("x"===i.axis||"yx"===i.axis&&n.overflowed[1]&&!n.overflowed[0])var h="x",m=math.abs(c[0].offsetleft)-f*(.9*d.width());else var h="y",m=math.abs(c[0].offsettop)-f*(.9*d.height());g(o,m.tostring(),{dir:h,scrolleasing:"mcseaseinout"})}}else if((35===l||36===l)&&!e(document.activeelement).is(u)&&((n.overflowed[0]||n.overflowed[1])&&(t.preventdefault(),t.stopimmediatepropagation()),"keyup"===t.type)){if("x"===i.axis||"yx"===i.axis&&n.overflowed[1]&&!n.overflowed[0])var h="x",m=35===l?math.abs(d.width()-c.outerwidth(!1)):0;else var h="y",m=35===l?math.abs(d.height()-c.outerheight(!1)):0;g(o,m.tostring(),{dir:h,scrolleasing:"mcseaseinout"})}}}var o=e(this),n=o.data(a),i=n.opt,r=n.sequential,l=a+"_"+n.idx,s=e("#mcsb_"+n.idx),c=e("#mcsb_"+n.idx+"_container"),d=c.parent(),u="input,textarea,select,datalist,keygen,[contenteditable='true']",f=c.find("iframe"),h=["blur."+l+" keydown."+l+" keyup."+l];f.length&&f.each(function(){e(this).bind("load",function(){a(this)&&e(this.contentdocument||this.contentwindow.document).bind(h[0],function(e){t(e)})})}),s.attr("tabindex","0").bind(h[0],function(e){t(e)})},j=function(t,o,n,i,r){function l(e){u.snapamount&&(f.scrollamount=u.snapamount instanceof array?"x"===f.dir[0]?u.snapamount[1]:u.snapamount[0]:u.snapamount);var o="stepped"!==f.type,a=r?r:e?o?p/1.5:g:1e3/60,n=e?o?7.5:40:2.5,s=[math.abs(h[0].offsettop),math.abs(h[0].offsetleft)],d=[c.scrollratio.y>10?10:c.scrollratio.y,c.scrollratio.x>10?10:c.scrollratio.x],m="x"===f.dir[0]?s[1]+f.dir[1]*(d[1]*n):s[0]+f.dir[1]*(d[0]*n),v="x"===f.dir[0]?s[1]+f.dir[1]*parseint(f.scrollamount):s[0]+f.dir[1]*parseint(f.scrollamount),x="auto"!==f.scrollamount?v:m,_=i?i:e?o?"mcslinearout":"mcseaseinout":"mcslinear",w=!!e;return e&&17>a&&(x="x"===f.dir[0]?s[1]:s[0]),g(t,x.tostring(),{dir:f.dir[0],scrolleasing:_,dur:a,oncomplete:w}),e?void(f.dir=!1):(cleartimeout(f.step),void(f.step=settimeout(function(){l()},a)))}function s(){cleartimeout(f.step),$(f,"step"),q(t)}var c=t.data(a),u=c.opt,f=c.sequential,h=e("#mcsb_"+c.idx+"_container"),m="stepped"===f.type,p=u.scrollinertia<26?26:u.scrollinertia,g=u.scrollinertia<1?17:u.scrollinertia;switch(o){case"on":if(f.dir=[n===d[16]||n===d[15]||39===n||37===n?"x":"y",n===d[13]||n===d[15]||38===n||37===n?-1:1],q(t),oe(n)&&"stepped"===f.type)return;l(m);break;case"off":s(),(m||c.tweenrunning&&f.dir)&&l(!0)}},y=function(t){var o=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof array?n=t.length>1?[t[0],t[1]]:"x"===o.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===o.axis?null:t,n[1]=t.x?t.x:t.y||"y"===o.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},x=function(t,o){if(null!=t&&"undefined"!=typeof t){var n=e(this),i=n.data(a),r=i.opt,l=e("#mcsb_"+i.idx+"_container"),s=l.parent(),c=typeof t;o||(o="x"===r.axis?"x":"y");var d="x"===o?l.outerwidth(!1)-s.width():l.outerheight(!1)-s.height(),f="x"===o?l[0].offsetleft:l[0].offsettop,h="x"===o?"left":"top";switch(c){case"function":return t();case"object":var m=t.jquery?t:e(t);if(!m.length)return;return"x"===o?ae(m)[1]:ae(m)[0];case"string":case"number":if(oe(t))return math.abs(t);if(-1!==t.indexof("%"))return math.abs(d*parseint(t)/100);if(-1!==t.indexof("-="))return math.abs(f-parseint(t.split("-=")[1]));if(-1!==t.indexof("+=")){var p=f+parseint(t.split("+=")[1]);return p>=0?0:math.abs(p)}if(-1!==t.indexof("px")&&oe(t.split("px")[0]))return math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return math.abs(s.height()-l.outerheight(!1));if("right"===t)return math.abs(s.width()-l.outerwidth(!1));if("first"===t||"last"===t){var m=l.find(":"+t);return"x"===o?ae(m)[1]:ae(m)[0]}return e(t).length?"x"===o?ae(e(t))[1]:ae(e(t))[0]:(l.css(h,t),void u.update.call(null,n[0]))}}},n=function(t){function o(){return cleartimeout(f[0].autoupdate),0===l.parents("html").length?void(l=null):void(f[0].autoupdate=settimeout(function(){return c.advanced.updateonselectorchange&&(s.poll.change.n=i(),s.poll.change.n!==s.poll.change.o)?(s.poll.change.o=s.poll.change.n,void r(3)):c.advanced.updateoncontentresize&&(s.poll.size.n=l[0].scrollheight+l[0].scrollwidth+f[0].offsetheight+l[0].offsetheight+l[0].offsetwidth,s.poll.size.n!==s.poll.size.o)?(s.poll.size.o=s.poll.size.n,void r(1)):!c.advanced.updateonimageload||"auto"===c.advanced.updateonimageload&&"y"===c.axis||(s.poll.img.n=f.find("img").length,s.poll.img.n===s.poll.img.o)?void((c.advanced.updateonselectorchange||c.advanced.updateoncontentresize||c.advanced.updateonimageload)&&o()):(s.poll.img.o=s.poll.img.n,void f.find("img").each(function(){n(this)}))},c.advanced.autoupdatetimeout))}function n(t){function o(e,t){return function(){
return t.apply(e,arguments)}}function a(){this.onload=null,e(t).addclass(d[2]),r(2)}if(e(t).hasclass(d[2]))return void r();var n=new image;n.onload=o(n,a),n.src=t.src}function i(){c.advanced.updateonselectorchange===!0&&(c.advanced.updateonselectorchange="*");var e=0,t=f.find(c.advanced.updateonselectorchange);return c.advanced.updateonselectorchange&&t.length>0&&t.each(function(){e+=this.offsetheight+this.offsetwidth}),e}function r(e){cleartimeout(f[0].autoupdate),u.update.call(null,l[0],e)}var l=e(this),s=l.data(a),c=s.opt,f=e("#mcsb_"+s.idx+"_container");return t?(cleartimeout(f[0].autoupdate),void $(f[0],"autoupdate")):void o()},v=function(e,t,o){return math.round(e/t)*t-o},q=function(t){var o=t.data(a),n=e("#mcsb_"+o.idx+"_container,#mcsb_"+o.idx+"_container_wrapper,#mcsb_"+o.idx+"_dragger_vertical,#mcsb_"+o.idx+"_dragger_horizontal");n.each(function(){z.call(this)})},g=function(t,o,n){function i(e){return s&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function r(){return[c.callbacks.alwaystriggeroffsets||w>=s[0]+y,c.callbacks.alwaystriggeroffsets||-b>=w]}function l(){var e=[h[0].offsettop,h[0].offsetleft],o=[x[0].offsettop,x[0].offsetleft],a=[h.outerheight(!1),h.outerwidth(!1)],i=[f.height(),f.width()];t[0].mcs={content:h,top:e[0],left:e[1],draggertop:o[0],draggerleft:o[1],toppct:math.round(100*math.abs(e[0])/(math.abs(a[0])-i[0])),leftpct:math.round(100*math.abs(e[1])/(math.abs(a[1])-i[1])),direction:n.dir}}var s=t.data(a),c=s.opt,d={trigger:"internal",dir:"y",scrolleasing:"mcseaseout",drag:!1,dur:c.scrollinertia,overwrite:"all",callbacks:!0,onstart:!0,onupdate:!0,oncomplete:!0},n=e.extend(d,n),u=[n.dur,n.drag?0:n.dur],f=e("#mcsb_"+s.idx),h=e("#mcsb_"+s.idx+"_container"),m=h.parent(),p=c.callbacks.ontotalscrolloffset?y.call(t,c.callbacks.ontotalscrolloffset):[0,0],g=c.callbacks.ontotalscrollbackoffset?y.call(t,c.callbacks.ontotalscrollbackoffset):[0,0];if(s.trigger=n.trigger,0===m.scrolltop()&&0===m.scrollleft()||(e(".mcsb_"+s.idx+"_scrollbar").css("visibility","visible"),m.scrolltop(0).scrollleft(0)),"_resety"!==o||s.contentreset.y||(i("onoverflowynone")&&c.callbacks.onoverflowynone.call(t[0]),s.contentreset.y=1),"_resetx"!==o||s.contentreset.x||(i("onoverflowxnone")&&c.callbacks.onoverflowxnone.call(t[0]),s.contentreset.x=1),"_resety"!==o&&"_resetx"!==o){if(!s.contentreset.y&&t[0].mcs||!s.overflowed[0]||(i("onoverflowy")&&c.callbacks.onoverflowy.call(t[0]),s.contentreset.x=null),!s.contentreset.x&&t[0].mcs||!s.overflowed[1]||(i("onoverflowx")&&c.callbacks.onoverflowx.call(t[0]),s.contentreset.x=null),c.snapamount){var v=c.snapamount instanceof array?"x"===n.dir?c.snapamount[1]:c.snapamount[0]:c.snapamount;o=v(o,v,c.snapoffset)}switch(n.dir){case"x":var x=e("#mcsb_"+s.idx+"_dragger_horizontal"),_="left",w=h[0].offsetleft,s=[f.width()-h.outerwidth(!1),x.parent().width()-x.width()],b=[o,0===o?0:o/s.scrollratio.x],y=p[1],b=g[1],t=y>0?y/s.scrollratio.x:0,k=b>0?b/s.scrollratio.x:0;break;case"y":var x=e("#mcsb_"+s.idx+"_dragger_vertical"),_="top",w=h[0].offsettop,s=[f.height()-h.outerheight(!1),x.parent().height()-x.height()],b=[o,0===o?0:o/s.scrollratio.y],y=p[0],b=g[0],t=y>0?y/s.scrollratio.y:0,k=b>0?b/s.scrollratio.y:0}b[1]<0||0===b[0]&&0===b[1]?b=[0,0]:b[1]>=s[1]?b=[s[0],s[1]]:b[0]=-b[0],t[0].mcs||(l(),i("oninit")&&c.callbacks.oninit.call(t[0])),cleartimeout(h[0].oncompletetimeout),j(x[0],_,math.round(b[1]),u[1],n.scrolleasing),!s.tweenrunning&&(0===w&&b[0]>=0||w===s[0]&&b[0]<=s[0])||j(h[0],_,math.round(b[0]),u[0],n.scrolleasing,n.overwrite,{onstart:function(){n.callbacks&&n.onstart&&!s.tweenrunning&&(i("onscrollstart")&&(l(),c.callbacks.onscrollstart.call(t[0])),s.tweenrunning=!0,c(x),s.cboffsets=r())},onupdate:function(){n.callbacks&&n.onupdate&&i("whilescrolling")&&(l(),c.callbacks.whilescrolling.call(t[0]))},oncomplete:function(){if(n.callbacks&&n.oncomplete){"yx"===c.axis&&cleartimeout(h[0].oncompletetimeout);var e=h[0].idletimer||0;h[0].oncompletetimeout=settimeout(function(){i("onscroll")&&(l(),c.callbacks.onscroll.call(t[0])),i("ontotalscroll")&&b[1]>=s[1]-t&&s.cboffsets[0]&&(l(),c.callbacks.ontotalscroll.call(t[0])),i("ontotalscrollback")&&b[1]<=k&&s.cboffsets[1]&&(l(),c.callbacks.ontotalscrollback.call(t[0])),s.tweenrunning=!1,h[0].idletimer=0,c(x,"hide")},e)}}})}},j=function(e,t,o,a,n,i,r){function l(){s.stop||(x||m.call(),x=k()-v,s(),x>=s.time&&(s.time=x>s.time?x+f-(x-s.time):x+f-1,s.time0?(s.currval=u(s.time,_,b,a,n),w[t]=math.round(s.currval)+"px"):w[t]=o+"px",p.call()}function c(){f=1e3/60,s.time=x+f,h=window.requestanimationframe?window.requestanimationframe:function(e){return s(),settimeout(e,.01)},s.id=h(l)}function d(){null!=s.id&&(window.requestanimationframe?window.cancelanimationframe(s.id):cleartimeout(s.id),s.id=null)}function u(e,t,o,a,n){switch(n){case"linear":case"mcslinear":return o*e/a+t;case"mcslinearout":return e/=a,e--,o*math.sqrt(1-e*e)+t;case"easeinoutsmooth":return e/=a/2,1>e?o/2*e*e+t:(e--,-o/2*(e*(e-2)-1)+t);case"easeinoutstrong":return e/=a/2,1>e?o/2*math.pow(2,10*(e-1))+t:(e--,o/2*(-math.pow(2,-10*e)+2)+t);case"easeinout":case"mcseaseinout":return e/=a/2,1>e?o/2*e*e*e+t:(e-=2,o/2*(e*e*e+2)+t);case"easeoutsmooth":return e/=a,e--,-o*(e*e*e*e-1)+t;case"easeoutstrong":return o*(-math.pow(2,-10*e/a)+1)+t;case"easeout":case"mcseaseout":default:var i=(e/=a)*e,r=i*e;return t+o*(.499999999999997*r*i+-2.5*i*i+5.5*r+-6.5*i+4*e)}}e._mtween||(e._mtween={top:{},left:{}});var f,h,r=r||{},m=r.onstart||function(){},p=r.onupdate||function(){},g=r.oncomplete||function(){},v=k(),x=0,_=e.offsettop,w=e.style,s=e._mtween[t];"left"===t&&(_=e.offsetleft);var b=o-_;s.stop=0,"none"!==i&&d(),c()},k=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()},z=function(){var e=this;e._mtween||(e._mtween={top:{},left:{}});for(var t=["top","left"],o=0;o=0&&a[0]+ae(n)[0]=0&&a[1]+ae(n)[1]=0&&r[1]-i[1]*l[1][0]<0&&r[1]+n[1]-i[1]*l[1][1]>=0},mcsoverflow:e.expr[":"].mcsoverflow||function(t){var o=e(t).data(a);if(o)return o.overflowed[0]||o.overflowed[1]}})})})});